[binutils-gdb] [gdb/testsuite] Use -std=c99 in gdb.base/callfuncs.exp

Tom de Vries vries@sourceware.org
Sun Nov 9 07:08:02 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f081af0715900fa48ebfc3b1d9ece297d024e303

commit f081af0715900fa48ebfc3b1d9ece297d024e303
Author: Tom de Vries <tdevries@suse.de>
Date:   Sun Nov 9 08:07:57 2025 +0100

    [gdb/testsuite] Use -std=c99 in gdb.base/callfuncs.exp
    
    In test-case gdb.base/callfuncs.exp I run into:
    ...
    gdb compile failed, gdb.base/callfuncs.c: In function 't_func_values':
    gdb.base/callfuncs.c:611:12: error: too many arguments to function \
      'func_arg1'; expected 0, have 2
      611 |   return ((*func_arg1) (5,5)  == (*func_val1) (5,5)
          |           ~^~~~~~~~~~~  ~
    ...
    
    Fix this by using -std=c99.
    
    Tested on x86_64-linux.
    
    Approved-By: Tom Tromey <tom@tromey.com>
    
    PR testsuite/32756
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32756

Diff:
---
 gdb/testsuite/gdb.base/callfuncs.exp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp
index d4a53e803c6..d7640aba4f3 100644
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -18,9 +18,19 @@
 
 standard_testfile
 
+set compile_flags {}
+lappend compile_flags debug
+
 # We still want to test non-prototype functions for now, which is why
 # we disable compilers warning about them.
-set compile_flags {debug additional_flags=-Wno-deprecated-non-prototype}
+lappend compile_flags additional_flags=-Wno-deprecated-non-prototype
+
+if {[have_compile_flag -std=c99]} {
+    # Gcc 15 defaults to c23, which no longer supports unprototyped functions.
+    # Use a c dialect that does support this.
+    lappend compile_flags additional_flags=-std=c99
+}
+
 if {[support_complex_tests]} {
     lappend compile_flags "additional_flags=-DTEST_COMPLEX"
 }


More information about the Gdb-cvs mailing list