From 62b28bd6688c933b9ffa56f53be1f827450625a7 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 29 Aug 2023 17:27:19 +0200 Subject: [PATCH] [gdb/testsuite] Handle some test-cases with older compiler When running test-case gdb.mi/print-simple-values.exp with gcc 4.8.4, I run into a compilation failure due to the test-case requiring c++11 and the compiler defaulting to less than that. Fix this by compiling with -std=c++11. Likewise in a few other test-cases. Tested on x86_64-linux. --- gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp | 6 +++++- gdb/testsuite/gdb.dwarf2/nullptr_t.exp | 7 ++++++- gdb/testsuite/gdb.fortran/mixed-lang-stack.exp | 2 +- gdb/testsuite/gdb.linespec/cpcompletion.exp | 6 +++++- gdb/testsuite/gdb.mi/print-simple-values.exp | 7 ++++++- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp index 6fffc982722..f2b0b7204c3 100644 --- a/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp +++ b/gdb/testsuite/gdb.dwarf2/gdb-index-cxx.exp @@ -17,8 +17,12 @@ load_lib dwarf.exp standard_testfile index.cc +set opts {} +lappend opts debug +lappend opts additional_flags=-std=c++11 + if {[prepare_for_testing "failed to prepare" "${testfile}" \ - [list ${srcfile}]]} { + [list ${srcfile}] $opts]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/nullptr_t.exp b/gdb/testsuite/gdb.dwarf2/nullptr_t.exp index c40c7677f7f..df2f163af38 100644 --- a/gdb/testsuite/gdb.dwarf2/nullptr_t.exp +++ b/gdb/testsuite/gdb.dwarf2/nullptr_t.exp @@ -17,7 +17,12 @@ require allow_cplus_tests standard_testfile .cc -if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}] { +set opts {} +lappend opts debug +lappend opts c++ +lappend opts additional_flags=-std=c++11 + +if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] { return -1 } diff --git a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp index 5fc36f7b95b..3973f68c666 100644 --- a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp +++ b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp @@ -30,7 +30,7 @@ standard_testfile mixed-lang-stack.c mixed-lang-stack.cpp mixed-lang-stack.f90 if {[prepare_for_testing_full "failed to prepare" \ [list ${binfile} {debug f90 additional_flags=-lstdc++} \ $srcfile {debug} \ - $srcfile2 {debug c++} \ + $srcfile2 {debug c++ additional_flags=-std=c++11} \ $srcfile3 {debug f90}]]} { return -1 } diff --git a/gdb/testsuite/gdb.linespec/cpcompletion.exp b/gdb/testsuite/gdb.linespec/cpcompletion.exp index f005707b9da..23bec063941 100644 --- a/gdb/testsuite/gdb.linespec/cpcompletion.exp +++ b/gdb/testsuite/gdb.linespec/cpcompletion.exp @@ -20,8 +20,12 @@ load_lib data-structures.exp standard_testfile cpls.cc cpls2.cc cpls-hyphen.cc +set opts {} +lappend opts debug +lappend opts additional_flags=-std=c++11 + if {[prepare_for_testing "failed to prepare" $testfile \ - [list $srcfile $srcfile2 $srcfile3] {debug}]} { + [list $srcfile $srcfile2 $srcfile3] $opts]} { return -1 } diff --git a/gdb/testsuite/gdb.mi/print-simple-values.exp b/gdb/testsuite/gdb.mi/print-simple-values.exp index 9436645df84..267cf369567 100644 --- a/gdb/testsuite/gdb.mi/print-simple-values.exp +++ b/gdb/testsuite/gdb.mi/print-simple-values.exp @@ -25,7 +25,12 @@ set MIFLAGS "-i=mi" standard_testfile .cc -if [build_executable "failed to prepare" $testfile $srcfile {debug c++}] { +set opts {} +lappend opts debug +lappend opts c++ +lappend opts additional_flags=-std=c++11 + +if [build_executable "failed to prepare" $testfile $srcfile $opts] { return -1 } -- 2.30.2