gdb/testsuite: remove global gcc_compiled from gdb.exp
authorAndrew Burgess <aburgess@redhat.com>
Thu, 9 Jun 2022 14:21:37 +0000 (15:21 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Fri, 24 Jun 2022 14:07:28 +0000 (15:07 +0100)
commitef7a6b977bf5e8499734a3b8df48ce2ca690cf57
tree6055e8c25252a10abd352e3d0cbef0e762445c25
parente83907ff5ffbac3d0224d31ee99e6dc056205f39
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.
37 files changed:
gdb/testsuite/gdb.base/ctf-ptype.exp
gdb/testsuite/gdb.base/funcargs.exp
gdb/testsuite/gdb.base/gdb1555.exp
gdb/testsuite/gdb.base/langs.exp
gdb/testsuite/gdb.base/morestack.exp
gdb/testsuite/gdb.base/opaque.exp
gdb/testsuite/gdb.base/prelink.exp
gdb/testsuite/gdb.base/ptype.exp
gdb/testsuite/gdb.base/setvar.exp
gdb/testsuite/gdb.base/type-opaque.exp
gdb/testsuite/gdb.base/until-trailing-insns.exp
gdb/testsuite/gdb.base/whatis.exp
gdb/testsuite/gdb.ctf/funcreturn.exp
gdb/testsuite/gdb.dwarf2/dw2-disasm-over-non-stmt.exp
gdb/testsuite/gdb.dwarf2/dw2-inline-header-1.exp
gdb/testsuite/gdb.dwarf2/dw2-inline-header-2.exp
gdb/testsuite/gdb.dwarf2/dw2-inline-header-3.exp
gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp
gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp
gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp
gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp
gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp
gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
gdb/testsuite/gdb.dwarf2/dw2-main-no-line-number.exp
gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp
gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp
gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp
gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
gdb/testsuite/gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp
gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp.tcl
gdb/testsuite/gdb.threads/tls-shared.exp
gdb/testsuite/gdb.threads/tls-so_extern.exp
gdb/testsuite/lib/compiler.c
gdb/testsuite/lib/gdb.exp