diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-06-09 15:21:37 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2022-06-24 15:07:28 +0100 |
commit | ef7a6b977bf5e8499734a3b8df48ce2ca690cf57 (patch) | |
tree | 6055e8c25252a10abd352e3d0cbef0e762445c25 /gdb | |
parent | e83907ff5ffbac3d0224d31ee99e6dc056205f39 (diff) | |
download | gdb-ef7a6b977bf5e8499734a3b8df48ce2ca690cf57.zip gdb-ef7a6b977bf5e8499734a3b8df48ce2ca690cf57.tar.gz gdb-ef7a6b977bf5e8499734a3b8df48ce2ca690cf57.tar.bz2 |
gdb/testsuite: remove global gcc_compiled from gdb.exp
After this commit the gcc_compiled global is no longer exported from
lib/gdb.exp. In theory we could switch over all uses of gcc_compiled
to instead call test_compiler_info directly, however, I have instead
added a new proc to gdb.exp: 'is_c_compiler_gcc'. I've then updated
the testsuite to call this proc instead of using the global.
Having a new proc specifically for this task means that we have a
single consistent pattern for detecting gcc. By wrapping this logic
within a proc that calls test_compiler_info, rather than using the
global, means that test scripts don't need to call get_compiler_info
before they read the global, simply calling the new proc does
everything in one go.
As a result I've been able to remove the get_compiler_info calls from
all the test scripts that I've touched in this commit.
In some of the tests e.g. gdb.dwarf2/*.exp, the $gcc_compiled flag was
being checked at the top of the script to decide if the whole script
should be skipped or not. In these cases I've called the new proc
directly and removed all uses of gcc_compiled.
In other cases, e.g. most of the gdb.base scripts, there were many
uses of gcc_compiled. In these cases I set a new global gcc_compiled
near the top of the script, and leave the rest of the script
unchanged.
There should be no changes in what is tested after this commit.
Diffstat (limited to 'gdb')
37 files changed, 54 insertions, 177 deletions
diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp index c8d9181..48d39e5 100644 --- a/gdb/testsuite/gdb.base/ctf-ptype.exp +++ b/gdb/testsuite/gdb.base/ctf-ptype.exp @@ -20,6 +20,9 @@ if [skip_ctf_tests] { return 0 } +# Some tests require GCC. +set gcc_compiled [is_c_compiler_gcc] + standard_testfile .c # Using `-gctf` generates full-fledged CTF debug information. @@ -30,12 +33,6 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return 0 } -# Create and source the file that provides information about the compiler -# used to compile the test case. -if [get_compiler_info] { - return -1 -} - # Test ptype of unnamed enumeration members before any action causes # the partial symbol table to be expanded to full symbols. This fails # with stabs compilers which fail to use a nameless stab (such as diff --git a/gdb/testsuite/gdb.base/funcargs.exp b/gdb/testsuite/gdb.base/funcargs.exp index 96448dc..483fbd9 100644 --- a/gdb/testsuite/gdb.base/funcargs.exp +++ b/gdb/testsuite/gdb.base/funcargs.exp @@ -18,17 +18,13 @@ standard_testfile +set gcc_compiled [is_c_compiler_gcc] + set compile_flags {debug nowarnings quiet} if [support_complex_tests] { lappend compile_flags "additional_flags=-DTEST_COMPLEX" } -# Create and source the file that provides information about the compiler -# used to compile the test case. -if [get_compiler_info] { - return -1 -} - set skip_float_test [gdb_skip_float_test] if {[prepare_for_testing "failed to prepare" $testfile $srcfile $compile_flags]} { diff --git a/gdb/testsuite/gdb.base/gdb1555.exp b/gdb/testsuite/gdb.base/gdb1555.exp index 958cca1..c8c86ed 100644 --- a/gdb/testsuite/gdb.base/gdb1555.exp +++ b/gdb/testsuite/gdb.base/gdb1555.exp @@ -30,11 +30,6 @@ set execsrc "${srcdir}/${subdir}/${srcfile}" remote_exec build "rm -f ${binfile}" -# get the value of gcc_compiled -if [get_compiler_info] { - return -1 -} - if { [gdb_compile_shlib $libsrc $libobj {debug}] != "" || [gdb_compile $execsrc ${binfile} executable \ [list debug shlib=${libobj}]] != "" } { diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp index 9c78a8a..a21ce5c 100644 --- a/gdb/testsuite/gdb.base/langs.exp +++ b/gdb/testsuite/gdb.base/langs.exp @@ -30,13 +30,8 @@ if {[prepare_for_testing "failed to prepare" ${testfile} \ set oldtimeout $timeout set timeout 10 - - -# Create and source the file that provides information about the compiler -# used to compile the test case. -if [get_compiler_info] { - return -1 -} +# Some tests require GCC. +set gcc_compiled [is_c_compiler_gcc] gdb_test_multiple "b -qualified langs0" "break on nonexistent function in langs.exp" { -re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" { diff --git a/gdb/testsuite/gdb.base/morestack.exp b/gdb/testsuite/gdb.base/morestack.exp index 13c7ed1..31f7d1a 100644 --- a/gdb/testsuite/gdb.base/morestack.exp +++ b/gdb/testsuite/gdb.base/morestack.exp @@ -13,12 +13,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -if [get_compiler_info] { - return -1 -} - -if {$gcc_compiled == 0} { - return -1 +if {![is_c_compiler_gcc]} { + unsupported "gcc compiler is required" + return } standard_testfile diff --git a/gdb/testsuite/gdb.base/opaque.exp b/gdb/testsuite/gdb.base/opaque.exp index c3e760c..4d7a325 100644 --- a/gdb/testsuite/gdb.base/opaque.exp +++ b/gdb/testsuite/gdb.base/opaque.exp @@ -15,15 +15,11 @@ # This file was written by Fred Fish. (fnf@cygnus.com) - -# Create and source the file that provides information about the compiler -# used to compile the test case. -if [get_compiler_info] { - return -1 -} - standard_testfile opaque0.c opaque1.c +# Some tests require GCC. +set gcc_compiled [is_c_compiler_gcc] + if {[prepare_for_testing "failed to prepare" $testfile \ [list $srcfile $srcfile2] debug]} { return -1 diff --git a/gdb/testsuite/gdb.base/prelink.exp b/gdb/testsuite/gdb.base/prelink.exp index e0a090e..8145a5b 100644 --- a/gdb/testsuite/gdb.base/prelink.exp +++ b/gdb/testsuite/gdb.base/prelink.exp @@ -23,11 +23,8 @@ if { ![isnative] || [is_remote host] || [skip_shlib_tests]} { return } -if [get_compiler_info] { - return -1 -} - -if {$gcc_compiled == 0} { +if {![is_c_compiler_gcc]} { + unsupported "gcc compiler is required" return -1 } diff --git a/gdb/testsuite/gdb.base/ptype.exp b/gdb/testsuite/gdb.base/ptype.exp index 854acc9..0fee624 100644 --- a/gdb/testsuite/gdb.base/ptype.exp +++ b/gdb/testsuite/gdb.base/ptype.exp @@ -26,11 +26,8 @@ if {[prepare_for_testing "failed to prepare" ${testfile} \ return -1 } -# Create and source the file that provides information about the compiler -# used to compile the test case. -if [get_compiler_info] { - return -1 -} +# Some tests require GCC. +set gcc_compiled [is_c_compiler_gcc] # Test ptype of unnamed enumeration members before any action causes # the partial symbol table to be expanded to full symbols. This fails diff --git a/gdb/testsuite/gdb.base/setvar.exp b/gdb/testsuite/gdb.base/setvar.exp index 576df2a..3d6c570 100644 --- a/gdb/testsuite/gdb.base/setvar.exp +++ b/gdb/testsuite/gdb.base/setvar.exp @@ -26,12 +26,6 @@ standard_testfile -# Create and source the file that provides information about the compiler -# used to compile the test case. -if [get_compiler_info] { - return -1 -} - if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { return -1 } @@ -395,7 +389,7 @@ set timeout $prev_timeout # Test printing of enumeration bitfields. # GNU C supports them, some other compilers don't. -if {$gcc_compiled} then { +if {[is_c_compiler_gcc]} then { gdb_test "print sef.field=sm1" ".*.\[0-9\]* = sm1" gdb_test "print sef.field" ".*.\[0-9\]* = sm1" "print sef.field (sm1)" gdb_test "print sef.field=s1" ".*.\[0-9\]* = s1" diff --git a/gdb/testsuite/gdb.base/type-opaque.exp b/gdb/testsuite/gdb.base/type-opaque.exp index 4608bec..6370c99 100644 --- a/gdb/testsuite/gdb.base/type-opaque.exp +++ b/gdb/testsuite/gdb.base/type-opaque.exp @@ -28,11 +28,6 @@ set execsrc "${srcdir}/${subdir}/${srcfile}" remote_exec build "rm -f ${binfile}" -# get the value of gcc_compiled -if [get_compiler_info] { - return -1 -} - if { [gdb_compile_shlib $libsrc $libobj {debug}] != "" || [gdb_compile $execsrc ${binfile} executable \ [list debug shlib=${libobj}]] != "" } { diff --git a/gdb/testsuite/gdb.base/until-trailing-insns.exp b/gdb/testsuite/gdb.base/until-trailing-insns.exp index ca5b388..6396b66 100644 --- a/gdb/testsuite/gdb.base/until-trailing-insns.exp +++ b/gdb/testsuite/gdb.base/until-trailing-insns.exp @@ -84,12 +84,8 @@ if {![dwarf2_support]} { return 0 } -if [get_compiler_info] { - return -1 -} - # The DWARF assembler requires the gcc compiler. -if {!$gcc_compiled} { +if {![is_c_compiler_gcc]} { unsupported "gcc is required for this test" return 0 } diff --git a/gdb/testsuite/gdb.base/whatis.exp b/gdb/testsuite/gdb.base/whatis.exp index d856e33..2bce3f5 100644 --- a/gdb/testsuite/gdb.base/whatis.exp +++ b/gdb/testsuite/gdb.base/whatis.exp @@ -25,6 +25,9 @@ if [target_info exists no_long_long] { set exec_opts [list debug] } +# Some tests require GCC. +set gcc_compiled [is_c_compiler_gcc] + standard_testfile .c # Define a procedure to set up an xfail for all targets that put out a diff --git a/gdb/testsuite/gdb.ctf/funcreturn.exp b/gdb/testsuite/gdb.ctf/funcreturn.exp index fe4e045..ea01e86 100644 --- a/gdb/testsuite/gdb.ctf/funcreturn.exp +++ b/gdb/testsuite/gdb.ctf/funcreturn.exp @@ -24,6 +24,9 @@ if [target_info exists no_long_long] { set exec_opts [list debug] } +# Some tests require GCC. +set gcc_compiled [is_c_compiler_gcc] + standard_testfile whatis.c # Using `-gctf` generates full-fledged CTF debug information. @@ -34,12 +37,6 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ return 0 } -# Create and source the file that provides information about the compiler -# used to compile the test case. -if [get_compiler_info] { - return -1 -} - # test print command with functions return type set void "(void|)" gdb_test "print v_char_func" \ diff --git a/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp b/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp index 5311dd6..11cc347 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp @@ -30,10 +30,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp index 19f06ad..de33da9 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp @@ -58,10 +58,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp index 198f355..25d7726 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp @@ -53,10 +53,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp index 68261aa..fc4b228 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp @@ -42,10 +42,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp index 9055244..e4f6b27 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp @@ -31,10 +31,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp index 05286ad..a61f162 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp @@ -32,10 +32,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp index bd90715..b5e8957 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp @@ -31,10 +31,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp index 239f5f1..5176bd3 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp @@ -31,10 +31,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp index c449757..48dae27 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp @@ -31,10 +31,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp index 0c5eed9..4af702e 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp @@ -21,10 +21,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { verbose "Skipping $gdb_test_file_name." return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-main-no-line-number.exp b/gdb/testsuite/gdb.dwarf2/dw2-main-no-line-number.exp index c8fd729..75d85d2 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-main-no-line-number.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-main-no-line-number.exp @@ -25,10 +25,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { verbose "Skipping $gdb_test_file_name." return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp index f030e1e..170500b 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp @@ -25,10 +25,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { verbose "Skipping $gdb_test_file_name." return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp index 17530c8..78962d5 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp @@ -24,10 +24,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { verbose "Skipping $gdb_test_file_name." return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp index aa95dae..11f19f1 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp @@ -22,10 +22,7 @@ if {![dwarf2_support]} { return 0 } -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { unsupported "gcc required for this test" return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp index 7ef4f5e..830258d 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp @@ -28,10 +28,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { verbose "Skipping $gdb_test_file_name." return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp index 132f1e9..824d7ba 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp @@ -23,10 +23,7 @@ if {![dwarf2_support]} { return 0 } -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { unsupported "gcc required for this test" return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp index 4c3ae6b..e2d6d75 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp @@ -24,10 +24,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { verbose "Skipping $gdb_test_file_name." return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp b/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp index 29e6858..b2d5763 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp @@ -34,10 +34,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { verbose "Skipping $gdb_test_file_name." return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp index de8c82b..24299d4 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp @@ -21,10 +21,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { verbose "Skipping $gdb_test_file_name." return 0 } diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl index fe92c53..aea04be 100644 --- a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl +++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl @@ -23,10 +23,7 @@ if {![dwarf2_support]} { } # The .c files use __attribute__. -if [get_compiler_info] { - return -1 -} -if !$gcc_compiled { +if ![is_c_compiler_gcc] { return 0 } diff --git a/gdb/testsuite/gdb.threads/tls-shared.exp b/gdb/testsuite/gdb.threads/tls-shared.exp index fb34677..cff80f8 100644 --- a/gdb/testsuite/gdb.threads/tls-shared.exp +++ b/gdb/testsuite/gdb.threads/tls-shared.exp @@ -23,12 +23,6 @@ set binfile_lib [standard_output_file ${libfile}.so] remote_exec build "rm -f ${binfile}" -# get the value of gcc_compiled -if [get_compiler_info] { - return -1 -} - - if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} {debug}] != "" || [gdb_compile_pthreads ${srcdir}/${subdir}/${srcfile} ${binfile} executable [list debug shlib=${binfile_lib}]] != ""} { return -1 diff --git a/gdb/testsuite/gdb.threads/tls-so_extern.exp b/gdb/testsuite/gdb.threads/tls-so_extern.exp index be6e03f..e678317 100644 --- a/gdb/testsuite/gdb.threads/tls-so_extern.exp +++ b/gdb/testsuite/gdb.threads/tls-so_extern.exp @@ -22,12 +22,6 @@ set srcfile_lib ${libfile}.c set binfile_lib [standard_output_file ${libfile}.so] -# get the value of gcc_compiled -if [get_compiler_info] { - return -1 -} - - if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} {debug}] != "" || [gdb_compile_pthreads ${srcdir}/${subdir}/${srcfile} ${binfile} executable [list debug shlib=${binfile_lib}]] != ""} { return -1 diff --git a/gdb/testsuite/lib/compiler.c b/gdb/testsuite/lib/compiler.c index 86140f8..25316ab 100644 --- a/gdb/testsuite/lib/compiler.c +++ b/gdb/testsuite/lib/compiler.c @@ -27,9 +27,6 @@ TODO: make compiler_info a local variable for get_compiler_info and test_compiler_info. - TODO: all clients should use test_compiler_info and should not - use gcc_compiled. - */ set compiler_info "unknown" diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 975e861..efbe393 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -4043,8 +4043,6 @@ if [info exists compiler_info] { unset compiler_info } -set gcc_compiled 0 - # Figure out what compiler I am using. # The result is cached so only the first invocation runs the compiler. # @@ -4178,16 +4176,6 @@ proc get_compiler_info {{language "c"}} { set compiler_info_cache($language) $compiler_info - # Set the legacy symbol gcc_compiled. - if { $language == "c" } { - # Legacy global data symbols. - gdb_persistent_global gcc_compiled - - set gcc_compiled 0 - - regexp "^gcc-(\[0-9\]+)-" "$compiler_info" matchall gcc_compiled - } - # Log what happened. verbose -log "get_compiler_info: $compiler_info" @@ -4220,6 +4208,15 @@ proc test_compiler_info { {compiler ""} {language "c"} } { return [string match $compiler $compiler_info_cache($language)] } +# Return true if the C compiler is GCC, otherwise, return false. + +proc is_c_compiler_gcc {} { + set compiler_info [test_compiler_info] + set gcc_compiled false + regexp "^gcc-(\[0-9\]+)-" "$compiler_info" matchall gcc_compiled + return $gcc_compiled +} + # Return the gcc major version, or -1. # For gcc 4.8.5, the major version is 4.8. # For gcc 7.5.0, the major version 7. |