test_ipfrag: remove array of size zero

Message ID 1741313581-14300-1-git-send-email-andremue@linux.microsoft.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series test_ipfrag: remove array of size zero |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Andre Muezerie March 7, 2025, 2:13 a.m. UTC
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(-)
  

Patch

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 */
 		}
 	}
 }