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

Tom de Vries vries@sourceware.org
Wed Nov 12 10:08:36 GMT 2025


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

commit 8f2a5c0dc8a6cba1efd23293e93cd749b4417b05
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed Nov 12 11:08:31 2025 +0100

    [gdb/testsuite] Use -std=c99 in gdb.base/nodebug.exp
    
    With test-case gdb.base/nodebug.exp I run into:
    ...
    gdb compile failed, gdb.base/nodebug.c: In function 'multf_noproto':
    gdb.base/nodebug.c:63:1: warning: old-style function definition \
      [-Wold-style-definition]
       63 | multf_noproto (v1, v2)
          | ^~~~~~~~~~~~~
    ...
    
    Fix this using -std=c99.
    
    Tested on x86_64-linux.
    
    PR testsuite/32756
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32756

Diff:
---
 gdb/testsuite/gdb.base/nodebug.exp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/nodebug.exp b/gdb/testsuite/gdb.base/nodebug.exp
index 195ad855c5c..5c897761c35 100644
--- a/gdb/testsuite/gdb.base/nodebug.exp
+++ b/gdb/testsuite/gdb.base/nodebug.exp
@@ -18,12 +18,17 @@
 
 standard_testfile .c
 
+set exec_opts {}
+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 exec_opts additional_flags=-std=c99
+}
+
 if {[test_compiler_info "xlc-*"]} {
     # By default, IBM'x xlc compiler doesn't add static variables into the symtab.
     # Use "-qstatsym" to do so.
-    set exec_opts additional_flags=-qstatsym
-} else {
-    set exec_opts ""
+    lappend exec_opts additional_flags=-qstatsym
 }
 
 if  { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != "" } {


More information about the Gdb-cvs mailing list