Bug 30380 - [gdb/testsuite] Missing c++ flag in c++ tests
Summary: [gdb/testsuite] Missing c++ flag in c++ tests
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: testsuite (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 17.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-23 07:36 UTC by Tom de Vries
Modified: 2025-02-04 12:53 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
patch to be submitted (3.11 KB, patch)
2025-01-30 08:44 UTC, Tom de Vries
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2023-04-23 07:36:27 UTC
I tried a target board that enforces an older c dialect:
...
+set found_gcc "[find_gcc] -std=gnu90"
...
trying to simulate using gcc 4.8.5 using a current system compiler.

This itself gives some problems because $found_gcc is expected to be a file, but I also run into this:
...
gdb compile failed, cc1plus: warning: command line option '-std=gnu90' is valid for C/ObjC but not for C++
...

For these test-cases:
...
$ egrep "Running|not for" old-dialect/leap-15-4/CHECKLOG.gdb | grep -B1 "not for" | grep Running
Running /data/vries/gdb/src/gdb/testsuite/gdb.base/condbreak-multi-context.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.base/main-psymtab.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.base/persistent-lang.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.base/skipcxx.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.base/start-cpp.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.cp/call-method-register.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.cp/empty-enum.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.cp/incomplete-type-overload.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.cp/method-call-in-c.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.cp/minsym-fallback.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.cp/vla-cxx.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.dwarf2/method-ptr.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.dwarf2/missing-type-name-for-templates.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.dwarf2/subrange.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.guile/types-module.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.linespec/cp-completion-aliases.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.linespec/cpcompletion.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.linespec/cpls-ops.exp ...
...

Fixed presumably by:
...
diff --git a/gdb/testsuite/gdb.base/condbreak-multi-context.exp b/gdb/testsuite/gdb.base/condbreak-multi-context.exp
index ba9ef080503..79e223d8ac5 100644
--- a/gdb/testsuite/gdb.base/condbreak-multi-context.exp
+++ b/gdb/testsuite/gdb.base/condbreak-multi-context.exp
@@ -18,7 +18,7 @@
 
 standard_testfile .cc
 
-if {[prepare_for_testing "failed to prepare" ${binfile} ${srcfile}]} {
+if {[prepare_for_testing "failed to prepare" ${binfile} ${srcfile} {debug c++}]} {
     return
 }
 
...
Comment 1 Tom de Vries 2025-01-30 08:44:55 UTC
Created attachment 15908 [details]
patch to be submitted

I'd like to submit this patch, but am running to email problems, so for now posting it here, to be able to refer to it elsewhere.
Comment 2 Tom de Vries 2025-01-30 12:41:02 UTC
(In reply to Tom de Vries from comment #1)
> Created attachment 15908 [details]
> patch to be submitted
> 
> I'd like to submit this patch, but am running to email problems, so for now
> posting it here, to be able to refer to it elsewhere.

https://sourceware.org/pipermail/gdb-patches/2025-January/215087.html
Comment 3 Sourceware Commits 2025-02-04 12:53:23 UTC
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

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

commit a03e9c2782b42ba82a80164ffc9cf956b9dc092c
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Feb 4 13:53:20 2025 +0100

    [gdb/testsuite] Use c++ flag in c++ test-cases
    
    In some cases, test-cases use c++, but don't add "c++" to the compilation
    flags.  This can cause problems with some compilers.
    
    Fix this in some test-cases.
    
    Approved-By: Tom Tromey <tom@tromey.com>
    
    PR testsuite/30380
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30380
Comment 4 Tom de Vries 2025-02-04 12:53:53 UTC
Fixed.