DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] test_ipfrag: remove array of size zero
@ 2025-03-07  2:13 Andre Muezerie
  2025-05-16  9:17 ` David Marchand
  2025-05-16 13:18 ` David Marchand
  0 siblings, 2 replies; 3+ messages in thread
From: Andre Muezerie @ 2025-03-07  2:13 UTC (permalink / raw)
  To: Konstantin Ananyev; +Cc: dev, Andre Muezerie

When compiling with MSVC the error below pops up:

../app/test/test_ipfrag.c(39): error C2466:
    cannot allocate an array of constant size 0
../app/test/test_ipfrag.c(157): warning C4034: sizeof returns 0
../app/test/test_ipfrag.c(160): warning C4034: sizeof returns 0

The fix is to simplify the code and remove the zero-size array.

Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
 app/test/test_ipfrag.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/app/test/test_ipfrag.c b/app/test/test_ipfrag.c
index 18d6727157..95d7952b4d 100644
--- a/app/test/test_ipfrag.c
+++ b/app/test/test_ipfrag.c
@@ -36,8 +36,6 @@ uint8_t expected_first_frag_ipv4_opts_nocopied[] = {
 	0x00, 0x00, 0x00, 0x00,
 };
 
-uint8_t expected_sub_frag_ipv4_opts_nocopied[0];
-
 struct test_opt_data {
 	bool is_first_frag;		 /**< offset is 0 */
 	bool opt_copied;		 /**< ip option copied flag */
@@ -153,11 +151,8 @@ test_get_ipv4_opt(bool is_first_frag, bool opt_copied,
 				expected_sub_frag_ipv4_opts_copied,
 				sizeof(expected_sub_frag_ipv4_opts_copied));
 		} else {
-			expected_opt->len =
-				sizeof(expected_sub_frag_ipv4_opts_nocopied);
-			memcpy(expected_opt->data,
-				expected_sub_frag_ipv4_opts_nocopied,
-				sizeof(expected_sub_frag_ipv4_opts_nocopied));
+			expected_opt->len = 0;
+			/* No data to be copied */
 		}
 	}
 }
-- 
2.48.1.vfs.0.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] test_ipfrag: remove array of size zero
  2025-03-07  2:13 [PATCH] test_ipfrag: remove array of size zero Andre Muezerie
@ 2025-05-16  9:17 ` David Marchand
  2025-05-16 13:18 ` David Marchand
  1 sibling, 0 replies; 3+ messages in thread
From: David Marchand @ 2025-05-16  9:17 UTC (permalink / raw)
  To: Andre Muezerie; +Cc: Konstantin Ananyev, dev

On Fri, Mar 7, 2025 at 3:13 AM Andre Muezerie
<andremue@linux.microsoft.com> wrote:
>
> When compiling with MSVC the error below pops up:
>
> ../app/test/test_ipfrag.c(39): error C2466:
>     cannot allocate an array of constant size 0
> ../app/test/test_ipfrag.c(157): warning C4034: sizeof returns 0
> ../app/test/test_ipfrag.c(160): warning C4034: sizeof returns 0
>
> The fix is to simplify the code and remove the zero-size array.
>
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>

Looks simple enough and valid.
Reviewed-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] test_ipfrag: remove array of size zero
  2025-03-07  2:13 [PATCH] test_ipfrag: remove array of size zero Andre Muezerie
  2025-05-16  9:17 ` David Marchand
@ 2025-05-16 13:18 ` David Marchand
  1 sibling, 0 replies; 3+ messages in thread
From: David Marchand @ 2025-05-16 13:18 UTC (permalink / raw)
  To: Andre Muezerie; +Cc: Konstantin Ananyev, dev

On Fri, Mar 7, 2025 at 3:13 AM Andre Muezerie
<andremue@linux.microsoft.com> wrote:
>
> When compiling with MSVC the error below pops up:
>
> ../app/test/test_ipfrag.c(39): error C2466:
>     cannot allocate an array of constant size 0
> ../app/test/test_ipfrag.c(157): warning C4034: sizeof returns 0
> ../app/test/test_ipfrag.c(160): warning C4034: sizeof returns 0
>
> The fix is to simplify the code and remove the zero-size array.
>
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>

Applied, thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-16 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-07  2:13 [PATCH] test_ipfrag: remove array of size zero Andre Muezerie
2025-05-16  9:17 ` David Marchand
2025-05-16 13:18 ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).