]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
ppc test_dfp2 build fix for GCC 15
authorMark Wielaard <mark@klomp.org>
Wed, 15 Jan 2025 15:27:12 +0000 (16:27 +0100)
committerMark Wielaard <mark@klomp.org>
Wed, 15 Jan 2025 16:02:39 +0000 (17:02 +0100)
GCC 15 defaults to C23 which changes the meaning of unprototyped
functions, those declaring no arguments with (). Causing some errors:

test_dfp2.c:412:26: error: initialization of 'void (*)(void)' from incompatible pointer type 'void (*)(int)' [-Wincompatible-pointer-types]
  412 |                        { &_test_dscri,  "dscri",   dfp_2args_x1, 20, LONG_TEST, ">>", True},
      |                          ^
test_dfp2.c:412:26: note: (near initialization for 'dfp_two_arg_tests[0].test_func')
test_dfp2.c:110:13: note: '_test_dscri' declared here
  110 | static void _test_dscri (int shift)
      |             ^~~~~~~~~~~

test_dfp2.c:664:17: error: assignment to 'test_func_t' {aka 'void (*)(void)'} from incompatible pointer type 'test_func_main_t' {aka 'void (*)(int)'} [-Wincompatible-pointer-types]
  664 |    while ((func = all_tests[i].test_category)) {
      |                 ^
test_dfp2.c:237:16: note: 'test_func_t' declared here
  237 | typedef void (*test_func_t)();
      |                ^~~~~~~~~~~
test_dfp2.c:238:16: note: 'test_func_main_t' declared here
  238 | typedef void (*test_func_main_t)(int);
      |                ^~~~~~~~~~~~~~~~
test_dfp2.c:667:8: error: too many arguments to function 'func'; expected 0, have 1
  667 |       (*func)(has_vsx);
      |       ~^~~~~~ ~~~~~~~

Fix this by just explicitly compiling that code with -std=gnu99.

none/tests/ppc32/Makefile.am
none/tests/ppc64/Makefile.am

index 187cab74f763543a4d5a4e062713c57ea732d052..7727876fdf660c7f16c732831996558aca016628 100644 (file)
@@ -129,8 +129,10 @@ test_isa_2_06_part3_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(VSX_
 
 test_dfp1_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \
                        @FLAG_M32@ $(BUILD_FLAGS_DFP)
+# Explicitly use -std=gnu99 because the meaning of void (*test_func_t)()
+# changed in c23, causing incompatible-pointer-types errors.
 test_dfp2_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \
-                       @FLAG_M32@ $(BUILD_FLAGS_DFP)
+                       @FLAG_M32@ $(BUILD_FLAGS_DFP) -std=gnu99
 test_dfp3_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \
                        @FLAG_M32@ $(BUILD_FLAGS_DFP)
 test_dfp4_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \
index f8eab9fc00b2c89f0655eeb946492d82083b7bfc..98a14b434bc4cc168cf8ce97671698de297a74fc 100644 (file)
@@ -190,8 +190,10 @@ test_isa_2_06_part3_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(VSX_
 
 test_dfp1_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \
                        @FLAG_M64@ $(BUILD_FLAGS_DFP)
+# Explicitly use -std=gnu99 because the meaning of void (*test_func_t)()
+# changed in c23, causing incompatible-pointer-types errors.
 test_dfp2_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \
-                       @FLAG_M64@ $(BUILD_FLAGS_DFP)
+                       @FLAG_M64@ $(BUILD_FLAGS_DFP) -std=gnu99
 test_dfp3_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \
                        @FLAG_M64@ $(BUILD_FLAGS_DFP)
 test_dfp4_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(DFP_FLAG) \