public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Further cleanup of get_compiler_info
@ 2022-06-09 18:38 Andrew Burgess
  2022-06-09 18:38 ` [PATCH 1/3] gdb/testsuite: remove definition of true/false from gdb_compiler_info Andrew Burgess
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Andrew Burgess @ 2022-06-09 18:38 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

While working on the recent updates to get_compiler_info, I spotted
some additional things that could be improved.

Thoughts?

Thanks,
Andrew

---

Andrew Burgess (3):
  gdb/testsuite: remove definition of true/false from gdb_compiler_info
  gdb/testsuite: remove global gcc_compiled from gdb.exp
  gdb/testsuite: remove unneeded calls to get_compiler_info

 gdb/testsuite/gdb.ada/array_of_variant.exp    |  3 ---
 gdb/testsuite/gdb.ada/arrayidx.exp            |  3 ---
 gdb/testsuite/gdb.ada/big_packed_array.exp    |  3 ---
 gdb/testsuite/gdb.ada/null_array.exp          |  4 ---
 gdb/testsuite/gdb.arch/altivec-abi.exp        |  5 ----
 gdb/testsuite/gdb.arch/altivec-regs.exp       |  5 ----
 gdb/testsuite/gdb.arch/amd64-byte.exp         |  4 ---
 gdb/testsuite/gdb.arch/amd64-dword.exp        |  4 ---
 gdb/testsuite/gdb.arch/amd64-word.exp         |  4 ---
 gdb/testsuite/gdb.arch/i386-avx.exp           |  4 ---
 gdb/testsuite/gdb.arch/i386-byte.exp          |  4 ---
 gdb/testsuite/gdb.arch/i386-sse.exp           |  4 ---
 gdb/testsuite/gdb.arch/i386-word.exp          |  4 ---
 gdb/testsuite/gdb.arch/ppc-dfp.exp            |  5 ----
 gdb/testsuite/gdb.arch/ppc-fp.exp             |  5 ----
 gdb/testsuite/gdb.arch/s390-multiarch.exp     |  4 ---
 gdb/testsuite/gdb.arch/vsx-regs.exp           |  5 ----
 gdb/testsuite/gdb.arch/vsx-vsr-float28.exp    |  5 ----
 gdb/testsuite/gdb.base/align-c++.exp          |  2 +-
 gdb/testsuite/gdb.base/all-bin.exp            |  8 +++---
 gdb/testsuite/gdb.base/annota1.exp            |  2 +-
 gdb/testsuite/gdb.base/attach.exp             |  4 ---
 gdb/testsuite/gdb.base/break-interp.exp       |  4 ---
 .../gdb.base/break-on-linker-gcd-function.exp |  4 ---
 gdb/testsuite/gdb.base/call-ar-st.exp         |  4 ---
 gdb/testsuite/gdb.base/call-rt-st.exp         |  9 -------
 gdb/testsuite/gdb.base/call-sc.exp            |  6 -----
 gdb/testsuite/gdb.base/catch-load.exp         |  6 -----
 gdb/testsuite/gdb.base/completion.exp         |  4 ---
 gdb/testsuite/gdb.base/complex.exp            |  4 ---
 gdb/testsuite/gdb.base/condbreak.exp          |  4 ---
 gdb/testsuite/gdb.base/consecutive.exp        |  4 ---
 gdb/testsuite/gdb.base/constvars.exp          |  6 -----
 gdb/testsuite/gdb.base/corefile.exp           |  6 -----
 gdb/testsuite/gdb.base/ctf-ptype.exp          |  9 +++----
 gdb/testsuite/gdb.base/dprintf-pending.exp    |  4 ---
 gdb/testsuite/gdb.base/eval-skip.exp          |  7 +++---
 gdb/testsuite/gdb.base/expand-psymtabs.exp    |  5 ----
 gdb/testsuite/gdb.base/exprs.exp              |  8 +++---
 gdb/testsuite/gdb.base/fileio.exp             |  7 ------
 gdb/testsuite/gdb.base/fixsection.exp         |  4 ---
 gdb/testsuite/gdb.base/funcargs.exp           |  8 ++----
 gdb/testsuite/gdb.base/gdb11530.exp           |  5 ----
 gdb/testsuite/gdb.base/gdb1555.exp            |  5 ----
 gdb/testsuite/gdb.base/gnu-ifunc.exp          |  4 ---
 .../gdb.base/hbreak-in-shr-unsupported.exp    |  4 ---
 .../gdb.base/infcall-nested-structs-c++.exp   |  2 +-
 gdb/testsuite/gdb.base/info-fun.exp           |  4 ---
 gdb/testsuite/gdb.base/info-types-c++.exp     |  2 +-
 .../infoline-reloc-main-from-zero.exp         |  4 ---
 gdb/testsuite/gdb.base/jit-elf-fork.exp       |  5 ----
 gdb/testsuite/gdb.base/jit-elf-so.exp         |  5 ----
 gdb/testsuite/gdb.base/jit-elf.exp            |  5 ----
 gdb/testsuite/gdb.base/jit-reader.exp         |  6 -----
 gdb/testsuite/gdb.base/langs.exp              |  9 ++-----
 gdb/testsuite/gdb.base/list.exp               |  6 -----
 gdb/testsuite/gdb.base/logical.exp            |  4 ---
 gdb/testsuite/gdb.base/long_long.exp          |  6 -----
 gdb/testsuite/gdb.base/longjmp.exp            |  4 ---
 gdb/testsuite/gdb.base/max-depth-c++.exp      |  2 +-
 gdb/testsuite/gdb.base/mips_pro.exp           |  7 ------
 gdb/testsuite/gdb.base/miscexprs.exp          |  7 +++---
 gdb/testsuite/gdb.base/morestack.exp          |  9 +++----
 gdb/testsuite/gdb.base/nodebug.exp            |  4 ---
 gdb/testsuite/gdb.base/opaque.exp             | 10 +++-----
 gdb/testsuite/gdb.base/pc-fp.exp              |  4 ---
 gdb/testsuite/gdb.base/pending.exp            |  4 ---
 gdb/testsuite/gdb.base/permissions.exp        |  4 ---
 gdb/testsuite/gdb.base/pointers.exp           |  8 +++---
 gdb/testsuite/gdb.base/prelink.exp            |  7 ++----
 gdb/testsuite/gdb.base/print-file-var.exp     |  2 +-
 gdb/testsuite/gdb.base/printcmds.exp          |  2 --
 gdb/testsuite/gdb.base/psym-external-decl.exp |  1 -
 gdb/testsuite/gdb.base/psymtab.exp            |  6 -----
 gdb/testsuite/gdb.base/ptype.exp              |  7 ++----
 gdb/testsuite/gdb.base/relational.exp         |  8 +++---
 gdb/testsuite/gdb.base/scope.exp              |  6 -----
 gdb/testsuite/gdb.base/setvar.exp             |  8 +-----
 gdb/testsuite/gdb.base/shlib-call.exp         |  4 ---
 gdb/testsuite/gdb.base/shreloc.exp            |  4 ---
 gdb/testsuite/gdb.base/signals.exp            |  6 -----
 gdb/testsuite/gdb.base/sizeof.exp             |  4 ---
 gdb/testsuite/gdb.base/so-impl-ld.exp         |  4 ---
 gdb/testsuite/gdb.base/solib-disc.exp         |  4 ---
 gdb/testsuite/gdb.base/solib-display.exp      |  4 ---
 gdb/testsuite/gdb.base/solib-nodir.exp        |  3 +--
 gdb/testsuite/gdb.base/solib-overlap.exp      |  4 ---
 gdb/testsuite/gdb.base/solib-search.exp       |  7 ------
 gdb/testsuite/gdb.base/solib-symbol.exp       |  4 ---
 gdb/testsuite/gdb.base/solib-weak.exp         |  4 ---
 gdb/testsuite/gdb.base/store.exp              |  4 ---
 gdb/testsuite/gdb.base/structs.exp            |  7 ------
 gdb/testsuite/gdb.base/structs2.exp           |  6 -----
 gdb/testsuite/gdb.base/sym-file.exp           |  4 ---
 .../gdb.base/symtab-search-order.exp          |  4 ---
 gdb/testsuite/gdb.base/type-opaque.exp        |  5 ----
 gdb/testsuite/gdb.base/unload.exp             |  4 ---
 .../gdb.base/until-trailing-insns.exp         |  6 +----
 gdb/testsuite/gdb.base/varargs.exp            |  4 ---
 gdb/testsuite/gdb.base/volatile.exp           |  6 -----
 gdb/testsuite/gdb.base/watch_thread_num.exp   |  6 -----
 gdb/testsuite/gdb.base/watchpoint-solib.exp   |  4 ---
 gdb/testsuite/gdb.base/watchpoint.exp         |  4 ---
 gdb/testsuite/gdb.base/watchpoints.exp        |  4 ---
 gdb/testsuite/gdb.base/whatis.exp             |  3 +++
 .../gdb.compile/compile-cplus-print.exp       |  1 -
 gdb/testsuite/gdb.compile/compile-cplus.exp   |  1 -
 gdb/testsuite/gdb.compile/compile-ifunc.exp   |  1 -
 gdb/testsuite/gdb.compile/compile.exp         |  1 -
 gdb/testsuite/gdb.cp/ambiguous.exp            |  5 ----
 gdb/testsuite/gdb.cp/breakpoint.exp           |  4 ---
 gdb/testsuite/gdb.cp/bs15503.exp              |  4 ---
 gdb/testsuite/gdb.cp/casts.exp                |  4 ---
 gdb/testsuite/gdb.cp/class2.exp               |  6 -----
 gdb/testsuite/gdb.cp/cpexprs.exp.tcl          |  4 ---
 gdb/testsuite/gdb.cp/cplusfuncs.exp           |  4 ---
 gdb/testsuite/gdb.cp/ctti.exp                 |  4 ---
 gdb/testsuite/gdb.cp/disasm-func-name.exp     |  4 ---
 gdb/testsuite/gdb.cp/dispcxx.exp              |  5 ----
 gdb/testsuite/gdb.cp/gdb1355.exp              |  4 ---
 gdb/testsuite/gdb.cp/gdb2384.exp              |  6 -----
 gdb/testsuite/gdb.cp/gdb2495.exp              |  6 -----
 gdb/testsuite/gdb.cp/infcall-dlopen.exp       |  4 ---
 .../gdb.cp/infcall-nodebug-c++-d0.exp         |  2 +-
 .../gdb.cp/infcall-nodebug-c++-d1.exp         |  2 +-
 gdb/testsuite/gdb.cp/local.exp                |  4 ---
 gdb/testsuite/gdb.cp/m-data.exp               |  4 ---
 gdb/testsuite/gdb.cp/m-static.exp             |  4 ---
 gdb/testsuite/gdb.cp/mb-ctor.exp              |  4 ---
 gdb/testsuite/gdb.cp/mb-inline.exp            |  4 ---
 gdb/testsuite/gdb.cp/mb-templates.exp         |  4 ---
 gdb/testsuite/gdb.cp/member-ptr.exp           |  4 ---
 gdb/testsuite/gdb.cp/method.exp               |  4 ---
 gdb/testsuite/gdb.cp/namespace.exp            |  4 ---
 gdb/testsuite/gdb.cp/nextoverthrow.exp        |  7 ------
 gdb/testsuite/gdb.cp/nsdecl.exp               |  4 ---
 gdb/testsuite/gdb.cp/nsrecurs.exp             |  4 ---
 gdb/testsuite/gdb.cp/nsstress.exp             |  4 ---
 gdb/testsuite/gdb.cp/nsusing.exp              |  4 ---
 gdb/testsuite/gdb.cp/pr-1023.exp              |  4 ---
 gdb/testsuite/gdb.cp/pr-1210.exp              |  4 ---
 gdb/testsuite/gdb.cp/pr-574.exp               |  4 ---
 gdb/testsuite/gdb.cp/pr9631.exp               |  4 ---
 gdb/testsuite/gdb.cp/printmethod.exp          |  4 ---
 gdb/testsuite/gdb.cp/psmang.exp               |  4 ---
 gdb/testsuite/gdb.cp/re-set-overloaded.exp    |  6 -----
 gdb/testsuite/gdb.cp/rtti.exp                 |  4 ---
 gdb/testsuite/gdb.cp/rvalue-ref-casts.exp     |  4 ---
 gdb/testsuite/gdb.cp/shadow.exp               |  4 ---
 gdb/testsuite/gdb.cp/static-typedef-print.exp |  4 ---
 gdb/testsuite/gdb.cp/step-and-next-inline.exp |  5 ----
 gdb/testsuite/gdb.cp/temargs.exp              |  2 --
 gdb/testsuite/gdb.cp/templates.exp            |  6 -----
 gdb/testsuite/gdb.cp/try_catch.exp            |  4 ---
 gdb/testsuite/gdb.cp/typed-enum.exp           |  4 ---
 gdb/testsuite/gdb.cp/typedef-base.exp         |  4 ---
 gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp     |  6 -----
 gdb/testsuite/gdb.ctf/funcreturn.exp          |  9 +++----
 gdb/testsuite/gdb.ctf/multi.exp               |  6 -----
 .../gdb.dwarf2/break-inline-psymtab.exp       |  1 -
 .../gdb.dwarf2/dw2-disasm-over-non-stmt.exp   |  5 +---
 .../gdb.dwarf2/dw2-inline-header-1.exp        |  5 +---
 .../gdb.dwarf2/dw2-inline-header-2.exp        |  5 +---
 .../gdb.dwarf2/dw2-inline-header-3.exp        |  5 +---
 .../gdb.dwarf2/dw2-inline-many-frames.exp     |  5 +---
 .../gdb.dwarf2/dw2-inline-small-func.exp      |  5 +---
 .../gdb.dwarf2/dw2-inline-stepping.exp        |  5 +---
 gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp    |  5 +---
 gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp      |  5 +---
 .../gdb.dwarf2/dw2-line-number-zero.exp       |  5 +---
 .../gdb.dwarf2/dw2-main-no-line-number.exp    |  5 +---
 .../dw2-out-of-range-end-of-seq.exp           |  5 +---
 gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp  |  5 +---
 gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp  |  5 +---
 .../gdb.dwarf2/dw2-ranges-overlap.exp         |  5 +---
 gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp  |  5 +---
 gdb/testsuite/gdb.dwarf2/dw2-ranges.exp       |  5 +---
 .../dw2-step-out-of-function-no-stmt.exp      |  5 +---
 .../gdb.dwarf2/dw2-vendor-extended-opcode.exp |  5 +---
 .../gdb.dwarf2/imported-unit-bp.exp.tcl       |  5 +---
 gdb/testsuite/gdb.fortran/library-module.exp  |  6 -----
 gdb/testsuite/gdb.guile/scm-type.exp          |  4 ---
 gdb/testsuite/gdb.mi/gdb792.exp               |  4 ---
 gdb/testsuite/gdb.mi/mi-catch-load.exp        |  6 -----
 gdb/testsuite/gdb.mi/mi-dprintf-pending.exp   |  4 ---
 .../gdb.mi/mi-inheritance-syntax-error.exp    |  4 ---
 gdb/testsuite/gdb.mi/mi-pending.exp           |  4 ---
 gdb/testsuite/gdb.mi/mi-solib.exp             |  4 ---
 gdb/testsuite/gdb.mi/mi-var-cp.exp            |  4 ---
 .../gdb.opt/clobbered-registers-O2.exp        |  6 -----
 gdb/testsuite/gdb.opt/inline-bt.exp           |  1 -
 gdb/testsuite/gdb.opt/inline-cmds.exp         |  1 -
 gdb/testsuite/gdb.opt/inline-locals.exp       |  1 -
 gdb/testsuite/gdb.opt/solib-intra-step.exp    |  4 ---
 gdb/testsuite/gdb.python/py-events.exp        |  4 ---
 .../gdb.python/py-finish-breakpoint.exp       |  4 ---
 gdb/testsuite/gdb.python/py-format-string.exp |  4 ---
 gdb/testsuite/gdb.python/py-type.exp          |  4 ---
 gdb/testsuite/gdb.reverse/solib-precsave.exp  |  4 ---
 gdb/testsuite/gdb.reverse/solib-reverse.exp   |  4 ---
 gdb/testsuite/gdb.server/solib-list.exp       |  3 +--
 gdb/testsuite/gdb.stabs/weird.exp             |  4 ---
 .../gdb.threads/attach-into-signal.exp        |  4 ---
 gdb/testsuite/gdb.threads/attach-stopped.exp  |  4 ---
 .../multiple-successive-infcall.exp           |  4 ---
 gdb/testsuite/gdb.threads/tls-shared.exp      |  6 -----
 gdb/testsuite/gdb.threads/tls-so_extern.exp   |  6 -----
 gdb/testsuite/gdb.trace/change-loc.exp        |  4 ---
 gdb/testsuite/gdb.trace/strace.exp            |  4 ---
 gdb/testsuite/lib/compiler.c                  |  3 ---
 gdb/testsuite/lib/gdb.exp                     | 25 ++++++-------------
 211 files changed, 85 insertions(+), 896 deletions(-)

-- 
2.25.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] gdb/testsuite: remove definition of true/false from gdb_compiler_info
  2022-06-09 18:38 [PATCH 0/3] Further cleanup of get_compiler_info Andrew Burgess
@ 2022-06-09 18:38 ` Andrew Burgess
  2022-06-10  7:14   ` Tom de Vries
  2022-06-09 18:38 ` [PATCH 2/3] gdb/testsuite: remove global gcc_compiled from gdb.exp Andrew Burgess
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Andrew Burgess @ 2022-06-09 18:38 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

Since pretty much forever the get_compiler_info function has included
these lines:

    # Most compilers will evaluate comparisons and other boolean
    # operations to 0 or 1.
    uplevel \#0 { set true 1 }
    uplevel \#0 { set false 0 }

These define global variables true (to 1) and false (to 0).

It seems odd to me that these globals are defined in
get_compiler_info, I guess maybe the original thinking was that if a
compiler had different true/false values then we would detect it there
and define true/false differently.

I don't think we should be bundling this logic into get_compiler_info,
it seems weird to me that in order to use $true/$false a user needs to
first call get_compiler_info.

It would be better I think if each test script that wants these
variables just defined them itself, if in the future we did need
different true/false values based on compiler version then we'd just
do:

  if { [test_compiler_info "some_pattern"] } {
    # Defined true/false one way...
  } else {
    # Defined true/false another way...
  }

But given the current true/false definitions have been in place since
at least 1999, I suspect this will not be needed any time soon.

Given that the definitions of true/false are so simple, right now my
suggestion is just to define them in each test script that wants
them (there's not that many).  If we ever did need more complex logic
then we can always add a function in gdb.exp that sets up these
globals, but that seems overkill for now.

There should be no change in what is tested after this commit.
---
 gdb/testsuite/gdb.base/all-bin.exp    | 4 ++++
 gdb/testsuite/gdb.base/eval-skip.exp  | 3 +++
 gdb/testsuite/gdb.base/exprs.exp      | 4 ++++
 gdb/testsuite/gdb.base/miscexprs.exp  | 3 +++
 gdb/testsuite/gdb.base/pointers.exp   | 4 ++++
 gdb/testsuite/gdb.base/relational.exp | 4 ++++
 gdb/testsuite/lib/gdb.exp             | 5 -----
 7 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.base/all-bin.exp b/gdb/testsuite/gdb.base/all-bin.exp
index 5d493e6d6fc..1f481210e19 100644
--- a/gdb/testsuite/gdb.base/all-bin.exp
+++ b/gdb/testsuite/gdb.base/all-bin.exp
@@ -46,6 +46,10 @@ if ![runto_main] then {
     return
 }
 
+# These are used as expected result values.
+set false 0
+set true 1
+
 gdb_test "next" "return 0;" "continuing after dummy()"
 
 gdb_test "print v_int+v_char" " = 71" "print value of v_int+v_char"
diff --git a/gdb/testsuite/gdb.base/eval-skip.exp b/gdb/testsuite/gdb.base/eval-skip.exp
index 218aaab476c..81b37d1a891 100644
--- a/gdb/testsuite/gdb.base/eval-skip.exp
+++ b/gdb/testsuite/gdb.base/eval-skip.exp
@@ -51,6 +51,9 @@ if ![runto_main] then {
     return
 }
 
+# This is used as an expected result value.
+set false 0
+
 gdb_test_no_output "set variable x=14" "set variable x=14"
 gdb_test_no_output "set variable y=2" "set variable y=2"
 gdb_test_no_output "set variable z=2" "set variable z=2"
diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp
index 83bc60aa610..dfe0ec93737 100644
--- a/gdb/testsuite/gdb.base/exprs.exp
+++ b/gdb/testsuite/gdb.base/exprs.exp
@@ -41,6 +41,10 @@ if ![runto_main] then {
     return
 }
 
+# These are used as expected result values.
+set false 0
+set true 1
+
 proc test_expr { args } {
     if { [llength $args] % 2 } {
 	warning "an even # of arguments should be passed to test_expr"
diff --git a/gdb/testsuite/gdb.base/miscexprs.exp b/gdb/testsuite/gdb.base/miscexprs.exp
index cac8cf2ce87..f633d143b6f 100644
--- a/gdb/testsuite/gdb.base/miscexprs.exp
+++ b/gdb/testsuite/gdb.base/miscexprs.exp
@@ -59,6 +59,9 @@ if ![runto_main] then {
     return
 }
 
+# This is used as an expected result value.
+set false 0
+
 gdb_test "break marker1" ".*" ""
 
 gdb_test "cont" \
diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp
index e6406613318..586f85a4947 100644
--- a/gdb/testsuite/gdb.base/pointers.exp
+++ b/gdb/testsuite/gdb.base/pointers.exp
@@ -48,6 +48,10 @@ if ![runto_main] then {
     return
 }
 
+# These are used as expected result values.
+set false 0
+set true 1
+
 gdb_test "next " "more_code.*;" "continuing after dummy()"
 
 
diff --git a/gdb/testsuite/gdb.base/relational.exp b/gdb/testsuite/gdb.base/relational.exp
index 858398323cd..87ccb9f3fe7 100644
--- a/gdb/testsuite/gdb.base/relational.exp
+++ b/gdb/testsuite/gdb.base/relational.exp
@@ -42,6 +42,10 @@ if ![runto_main] then {
     return
 }
 
+# These are used as expected result values.
+set false 0
+set true 1
+
 #
 # test expressions with "int" types
 #
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 37accd9947a..75efc4a62d1 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4191,11 +4191,6 @@ proc get_compiler_info {{language "c"}} {
     # Log what happened.
     verbose -log "get_compiler_info: $compiler_info"
 
-    # Most compilers will evaluate comparisons and other boolean
-    # operations to 0 or 1.
-    uplevel \#0 { set true 1 }
-    uplevel \#0 { set false 0 }
-
     return 0
 }
 
-- 
2.25.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/3] gdb/testsuite: remove global gcc_compiled from gdb.exp
  2022-06-09 18:38 [PATCH 0/3] Further cleanup of get_compiler_info Andrew Burgess
  2022-06-09 18:38 ` [PATCH 1/3] gdb/testsuite: remove definition of true/false from gdb_compiler_info Andrew Burgess
@ 2022-06-09 18:38 ` Andrew Burgess
  2022-06-09 18:38 ` [PATCH 3/3] gdb/testsuite: remove unneeded calls to get_compiler_info Andrew Burgess
  2022-06-24 14:08 ` [PATCH 0/3] Further cleanup of get_compiler_info Andrew Burgess
  3 siblings, 0 replies; 7+ messages in thread
From: Andrew Burgess @ 2022-06-09 18:38 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

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.
---
 gdb/testsuite/gdb.base/ctf-ptype.exp          |  9 +++------
 gdb/testsuite/gdb.base/funcargs.exp           |  8 ++------
 gdb/testsuite/gdb.base/gdb1555.exp            |  5 -----
 gdb/testsuite/gdb.base/langs.exp              |  9 ++-------
 gdb/testsuite/gdb.base/morestack.exp          |  9 +++------
 gdb/testsuite/gdb.base/opaque.exp             | 10 +++-------
 gdb/testsuite/gdb.base/prelink.exp            |  7 ++-----
 gdb/testsuite/gdb.base/ptype.exp              |  7 ++-----
 gdb/testsuite/gdb.base/setvar.exp             |  8 +-------
 gdb/testsuite/gdb.base/type-opaque.exp        |  5 -----
 .../gdb.base/until-trailing-insns.exp         |  6 +-----
 gdb/testsuite/gdb.base/whatis.exp             |  3 +++
 gdb/testsuite/gdb.ctf/funcreturn.exp          |  9 +++------
 .../gdb.dwarf2/dw2-disasm-over-non-stmt.exp   |  5 +----
 .../gdb.dwarf2/dw2-inline-header-1.exp        |  5 +----
 .../gdb.dwarf2/dw2-inline-header-2.exp        |  5 +----
 .../gdb.dwarf2/dw2-inline-header-3.exp        |  5 +----
 .../gdb.dwarf2/dw2-inline-many-frames.exp     |  5 +----
 .../gdb.dwarf2/dw2-inline-small-func.exp      |  5 +----
 .../gdb.dwarf2/dw2-inline-stepping.exp        |  5 +----
 gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp    |  5 +----
 gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp      |  5 +----
 .../gdb.dwarf2/dw2-line-number-zero.exp       |  5 +----
 .../gdb.dwarf2/dw2-main-no-line-number.exp    |  5 +----
 .../dw2-out-of-range-end-of-seq.exp           |  5 +----
 gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp  |  5 +----
 gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp  |  5 +----
 .../gdb.dwarf2/dw2-ranges-overlap.exp         |  5 +----
 gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp  |  5 +----
 gdb/testsuite/gdb.dwarf2/dw2-ranges.exp       |  5 +----
 .../dw2-step-out-of-function-no-stmt.exp      |  5 +----
 .../gdb.dwarf2/dw2-vendor-extended-opcode.exp |  5 +----
 .../gdb.dwarf2/imported-unit-bp.exp.tcl       |  5 +----
 gdb/testsuite/gdb.threads/tls-shared.exp      |  6 ------
 gdb/testsuite/gdb.threads/tls-so_extern.exp   |  6 ------
 gdb/testsuite/lib/compiler.c                  |  3 ---
 gdb/testsuite/lib/gdb.exp                     | 20 ++++++++-----------
 37 files changed, 53 insertions(+), 177 deletions(-)

diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp
index c8d91814f0e..48d39e56c7b 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 96448dc2c9a..483fbd94263 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 958cca1a63e..c8c86edbc23 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 9c78a8a4397..a21ce5ce3c4 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 13c7ed1c1fc..31f7d1a72d0 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 c3e760ca368..4d7a3257880 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 e0a090e3b78..8145a5b8a68 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 854acc9c457..0fee624d1db 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 576df2a066c..3d6c5700a49 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 4608bec1e89..6370c995657 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 ca5b388c0a6..6396b6650c1 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 d856e336c21..2bce3f5cdcb 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 fe4e045d0ce..ea01e860a84 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 5311dd61a4c..11cc347570a 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 19f06adef7b..de33da9d8d4 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 198f3553997..25d77263c0a 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 68261aa78b0..fc4b228d5b6 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 9055244979d..e4f6b278aea 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 05286ad6d2f..a61f1625499 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 bd90715c198..b5e8957f107 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 239f5f1d9e9..5176bd34b20 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 c449757becb..48dae27fa75 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 0c5eed9814f..4af702ecc4a 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 c8fd729120e..75d85d2a582 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 f030e1edc1f..170500b6045 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 17530c8cc4b..78962d56290 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 aa95dae6bfc..11f19f141a1 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 7ef4f5e5b1e..830258d3154 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 132f1e9f738..824d7ba8085 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 4c3ae6bbf0a..e2d6d75044c 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 29e6858e04b..b2d5763c539 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 de8c82bb40c..24299d45459 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 fe92c530888..aea04be1d6c 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 fb34677f874..cff80f86049 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 be6e03fd88d..e6783175904 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 86140f8c0e7..25316abb407 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 75efc4a62d1..a5ecb885e57 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,14 @@ 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.
-- 
2.25.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/3] gdb/testsuite: remove unneeded calls to get_compiler_info
  2022-06-09 18:38 [PATCH 0/3] Further cleanup of get_compiler_info Andrew Burgess
  2022-06-09 18:38 ` [PATCH 1/3] gdb/testsuite: remove definition of true/false from gdb_compiler_info Andrew Burgess
  2022-06-09 18:38 ` [PATCH 2/3] gdb/testsuite: remove global gcc_compiled from gdb.exp Andrew Burgess
@ 2022-06-09 18:38 ` Andrew Burgess
  2022-06-24 14:08 ` [PATCH 0/3] Further cleanup of get_compiler_info Andrew Burgess
  3 siblings, 0 replies; 7+ messages in thread
From: Andrew Burgess @ 2022-06-09 18:38 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

It is not necessary to call get_compiler_info before calling
test_compiler_info, and, after recent commits that removed setting up
the gcc_compiled, true, and false globals from get_compiler_info,
there is now no longer any need for any test script to call
get_compiler_info directly.

As a result every call to get_compiler_info outside of lib/gdb.exp is
redundant, and this commit removes them all.

There should be no change in what is tested after this commit.
---
 gdb/testsuite/gdb.ada/array_of_variant.exp               | 3 ---
 gdb/testsuite/gdb.ada/arrayidx.exp                       | 3 ---
 gdb/testsuite/gdb.ada/big_packed_array.exp               | 3 ---
 gdb/testsuite/gdb.ada/null_array.exp                     | 4 ----
 gdb/testsuite/gdb.arch/altivec-abi.exp                   | 5 -----
 gdb/testsuite/gdb.arch/altivec-regs.exp                  | 5 -----
 gdb/testsuite/gdb.arch/amd64-byte.exp                    | 4 ----
 gdb/testsuite/gdb.arch/amd64-dword.exp                   | 4 ----
 gdb/testsuite/gdb.arch/amd64-word.exp                    | 4 ----
 gdb/testsuite/gdb.arch/i386-avx.exp                      | 4 ----
 gdb/testsuite/gdb.arch/i386-byte.exp                     | 4 ----
 gdb/testsuite/gdb.arch/i386-sse.exp                      | 4 ----
 gdb/testsuite/gdb.arch/i386-word.exp                     | 4 ----
 gdb/testsuite/gdb.arch/ppc-dfp.exp                       | 5 -----
 gdb/testsuite/gdb.arch/ppc-fp.exp                        | 5 -----
 gdb/testsuite/gdb.arch/s390-multiarch.exp                | 4 ----
 gdb/testsuite/gdb.arch/vsx-regs.exp                      | 5 -----
 gdb/testsuite/gdb.arch/vsx-vsr-float28.exp               | 5 -----
 gdb/testsuite/gdb.base/align-c++.exp                     | 2 +-
 gdb/testsuite/gdb.base/all-bin.exp                       | 4 ----
 gdb/testsuite/gdb.base/annota1.exp                       | 2 +-
 gdb/testsuite/gdb.base/attach.exp                        | 4 ----
 gdb/testsuite/gdb.base/break-interp.exp                  | 4 ----
 gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp  | 4 ----
 gdb/testsuite/gdb.base/call-ar-st.exp                    | 4 ----
 gdb/testsuite/gdb.base/call-rt-st.exp                    | 9 ---------
 gdb/testsuite/gdb.base/call-sc.exp                       | 6 ------
 gdb/testsuite/gdb.base/catch-load.exp                    | 6 ------
 gdb/testsuite/gdb.base/completion.exp                    | 4 ----
 gdb/testsuite/gdb.base/complex.exp                       | 4 ----
 gdb/testsuite/gdb.base/condbreak.exp                     | 4 ----
 gdb/testsuite/gdb.base/consecutive.exp                   | 4 ----
 gdb/testsuite/gdb.base/constvars.exp                     | 6 ------
 gdb/testsuite/gdb.base/corefile.exp                      | 6 ------
 gdb/testsuite/gdb.base/dprintf-pending.exp               | 4 ----
 gdb/testsuite/gdb.base/eval-skip.exp                     | 4 ----
 gdb/testsuite/gdb.base/expand-psymtabs.exp               | 5 -----
 gdb/testsuite/gdb.base/exprs.exp                         | 4 ----
 gdb/testsuite/gdb.base/fileio.exp                        | 7 -------
 gdb/testsuite/gdb.base/fixsection.exp                    | 4 ----
 gdb/testsuite/gdb.base/gdb11530.exp                      | 5 -----
 gdb/testsuite/gdb.base/gnu-ifunc.exp                     | 4 ----
 gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp     | 4 ----
 gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp    | 2 +-
 gdb/testsuite/gdb.base/info-fun.exp                      | 4 ----
 gdb/testsuite/gdb.base/info-types-c++.exp                | 2 +-
 gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp | 4 ----
 gdb/testsuite/gdb.base/jit-elf-fork.exp                  | 5 -----
 gdb/testsuite/gdb.base/jit-elf-so.exp                    | 5 -----
 gdb/testsuite/gdb.base/jit-elf.exp                       | 5 -----
 gdb/testsuite/gdb.base/jit-reader.exp                    | 6 ------
 gdb/testsuite/gdb.base/list.exp                          | 6 ------
 gdb/testsuite/gdb.base/logical.exp                       | 4 ----
 gdb/testsuite/gdb.base/long_long.exp                     | 6 ------
 gdb/testsuite/gdb.base/longjmp.exp                       | 4 ----
 gdb/testsuite/gdb.base/max-depth-c++.exp                 | 2 +-
 gdb/testsuite/gdb.base/mips_pro.exp                      | 7 -------
 gdb/testsuite/gdb.base/miscexprs.exp                     | 4 ----
 gdb/testsuite/gdb.base/nodebug.exp                       | 4 ----
 gdb/testsuite/gdb.base/pc-fp.exp                         | 4 ----
 gdb/testsuite/gdb.base/pending.exp                       | 4 ----
 gdb/testsuite/gdb.base/permissions.exp                   | 4 ----
 gdb/testsuite/gdb.base/pointers.exp                      | 4 ----
 gdb/testsuite/gdb.base/print-file-var.exp                | 2 +-
 gdb/testsuite/gdb.base/printcmds.exp                     | 2 --
 gdb/testsuite/gdb.base/psym-external-decl.exp            | 1 -
 gdb/testsuite/gdb.base/psymtab.exp                       | 6 ------
 gdb/testsuite/gdb.base/relational.exp                    | 4 ----
 gdb/testsuite/gdb.base/scope.exp                         | 6 ------
 gdb/testsuite/gdb.base/shlib-call.exp                    | 4 ----
 gdb/testsuite/gdb.base/shreloc.exp                       | 4 ----
 gdb/testsuite/gdb.base/signals.exp                       | 6 ------
 gdb/testsuite/gdb.base/sizeof.exp                        | 4 ----
 gdb/testsuite/gdb.base/so-impl-ld.exp                    | 4 ----
 gdb/testsuite/gdb.base/solib-disc.exp                    | 4 ----
 gdb/testsuite/gdb.base/solib-display.exp                 | 4 ----
 gdb/testsuite/gdb.base/solib-nodir.exp                   | 3 +--
 gdb/testsuite/gdb.base/solib-overlap.exp                 | 4 ----
 gdb/testsuite/gdb.base/solib-search.exp                  | 7 -------
 gdb/testsuite/gdb.base/solib-symbol.exp                  | 4 ----
 gdb/testsuite/gdb.base/solib-weak.exp                    | 4 ----
 gdb/testsuite/gdb.base/store.exp                         | 4 ----
 gdb/testsuite/gdb.base/structs.exp                       | 7 -------
 gdb/testsuite/gdb.base/structs2.exp                      | 6 ------
 gdb/testsuite/gdb.base/sym-file.exp                      | 4 ----
 gdb/testsuite/gdb.base/symtab-search-order.exp           | 4 ----
 gdb/testsuite/gdb.base/unload.exp                        | 4 ----
 gdb/testsuite/gdb.base/varargs.exp                       | 4 ----
 gdb/testsuite/gdb.base/volatile.exp                      | 6 ------
 gdb/testsuite/gdb.base/watch_thread_num.exp              | 6 ------
 gdb/testsuite/gdb.base/watchpoint-solib.exp              | 4 ----
 gdb/testsuite/gdb.base/watchpoint.exp                    | 4 ----
 gdb/testsuite/gdb.base/watchpoints.exp                   | 4 ----
 gdb/testsuite/gdb.compile/compile-cplus-print.exp        | 1 -
 gdb/testsuite/gdb.compile/compile-cplus.exp              | 1 -
 gdb/testsuite/gdb.compile/compile-ifunc.exp              | 1 -
 gdb/testsuite/gdb.compile/compile.exp                    | 1 -
 gdb/testsuite/gdb.cp/ambiguous.exp                       | 5 -----
 gdb/testsuite/gdb.cp/breakpoint.exp                      | 4 ----
 gdb/testsuite/gdb.cp/bs15503.exp                         | 4 ----
 gdb/testsuite/gdb.cp/casts.exp                           | 4 ----
 gdb/testsuite/gdb.cp/class2.exp                          | 6 ------
 gdb/testsuite/gdb.cp/cpexprs.exp.tcl                     | 4 ----
 gdb/testsuite/gdb.cp/cplusfuncs.exp                      | 4 ----
 gdb/testsuite/gdb.cp/ctti.exp                            | 4 ----
 gdb/testsuite/gdb.cp/disasm-func-name.exp                | 4 ----
 gdb/testsuite/gdb.cp/dispcxx.exp                         | 5 -----
 gdb/testsuite/gdb.cp/gdb1355.exp                         | 4 ----
 gdb/testsuite/gdb.cp/gdb2384.exp                         | 6 ------
 gdb/testsuite/gdb.cp/gdb2495.exp                         | 6 ------
 gdb/testsuite/gdb.cp/infcall-dlopen.exp                  | 4 ----
 gdb/testsuite/gdb.cp/infcall-nodebug-c++-d0.exp          | 2 +-
 gdb/testsuite/gdb.cp/infcall-nodebug-c++-d1.exp          | 2 +-
 gdb/testsuite/gdb.cp/local.exp                           | 4 ----
 gdb/testsuite/gdb.cp/m-data.exp                          | 4 ----
 gdb/testsuite/gdb.cp/m-static.exp                        | 4 ----
 gdb/testsuite/gdb.cp/mb-ctor.exp                         | 4 ----
 gdb/testsuite/gdb.cp/mb-inline.exp                       | 4 ----
 gdb/testsuite/gdb.cp/mb-templates.exp                    | 4 ----
 gdb/testsuite/gdb.cp/member-ptr.exp                      | 4 ----
 gdb/testsuite/gdb.cp/method.exp                          | 4 ----
 gdb/testsuite/gdb.cp/namespace.exp                       | 4 ----
 gdb/testsuite/gdb.cp/nextoverthrow.exp                   | 7 -------
 gdb/testsuite/gdb.cp/nsdecl.exp                          | 4 ----
 gdb/testsuite/gdb.cp/nsrecurs.exp                        | 4 ----
 gdb/testsuite/gdb.cp/nsstress.exp                        | 4 ----
 gdb/testsuite/gdb.cp/nsusing.exp                         | 4 ----
 gdb/testsuite/gdb.cp/pr-1023.exp                         | 4 ----
 gdb/testsuite/gdb.cp/pr-1210.exp                         | 4 ----
 gdb/testsuite/gdb.cp/pr-574.exp                          | 4 ----
 gdb/testsuite/gdb.cp/pr9631.exp                          | 4 ----
 gdb/testsuite/gdb.cp/printmethod.exp                     | 4 ----
 gdb/testsuite/gdb.cp/psmang.exp                          | 4 ----
 gdb/testsuite/gdb.cp/re-set-overloaded.exp               | 6 ------
 gdb/testsuite/gdb.cp/rtti.exp                            | 4 ----
 gdb/testsuite/gdb.cp/rvalue-ref-casts.exp                | 4 ----
 gdb/testsuite/gdb.cp/shadow.exp                          | 4 ----
 gdb/testsuite/gdb.cp/static-typedef-print.exp            | 4 ----
 gdb/testsuite/gdb.cp/step-and-next-inline.exp            | 5 -----
 gdb/testsuite/gdb.cp/temargs.exp                         | 2 --
 gdb/testsuite/gdb.cp/templates.exp                       | 6 ------
 gdb/testsuite/gdb.cp/try_catch.exp                       | 4 ----
 gdb/testsuite/gdb.cp/typed-enum.exp                      | 4 ----
 gdb/testsuite/gdb.cp/typedef-base.exp                    | 4 ----
 gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp                | 6 ------
 gdb/testsuite/gdb.ctf/multi.exp                          | 6 ------
 gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp        | 1 -
 gdb/testsuite/gdb.fortran/library-module.exp             | 6 ------
 gdb/testsuite/gdb.guile/scm-type.exp                     | 4 ----
 gdb/testsuite/gdb.mi/gdb792.exp                          | 4 ----
 gdb/testsuite/gdb.mi/mi-catch-load.exp                   | 6 ------
 gdb/testsuite/gdb.mi/mi-dprintf-pending.exp              | 4 ----
 gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp     | 4 ----
 gdb/testsuite/gdb.mi/mi-pending.exp                      | 4 ----
 gdb/testsuite/gdb.mi/mi-solib.exp                        | 4 ----
 gdb/testsuite/gdb.mi/mi-var-cp.exp                       | 4 ----
 gdb/testsuite/gdb.opt/clobbered-registers-O2.exp         | 6 ------
 gdb/testsuite/gdb.opt/inline-bt.exp                      | 1 -
 gdb/testsuite/gdb.opt/inline-cmds.exp                    | 1 -
 gdb/testsuite/gdb.opt/inline-locals.exp                  | 1 -
 gdb/testsuite/gdb.opt/solib-intra-step.exp               | 4 ----
 gdb/testsuite/gdb.python/py-events.exp                   | 4 ----
 gdb/testsuite/gdb.python/py-finish-breakpoint.exp        | 4 ----
 gdb/testsuite/gdb.python/py-format-string.exp            | 4 ----
 gdb/testsuite/gdb.python/py-type.exp                     | 4 ----
 gdb/testsuite/gdb.reverse/solib-precsave.exp             | 4 ----
 gdb/testsuite/gdb.reverse/solib-reverse.exp              | 4 ----
 gdb/testsuite/gdb.server/solib-list.exp                  | 3 +--
 gdb/testsuite/gdb.stabs/weird.exp                        | 4 ----
 gdb/testsuite/gdb.threads/attach-into-signal.exp         | 4 ----
 gdb/testsuite/gdb.threads/attach-stopped.exp             | 4 ----
 .../gdb.threads/multiple-successive-infcall.exp          | 4 ----
 gdb/testsuite/gdb.trace/change-loc.exp                   | 4 ----
 gdb/testsuite/gdb.trace/strace.exp                       | 4 ----
 174 files changed, 10 insertions(+), 714 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/array_of_variant.exp b/gdb/testsuite/gdb.ada/array_of_variant.exp
index 63c4263b8c7..606974ced83 100644
--- a/gdb/testsuite/gdb.ada/array_of_variant.exp
+++ b/gdb/testsuite/gdb.ada/array_of_variant.exp
@@ -20,9 +20,6 @@ if { [skip_ada_tests] } { return -1 }
 
 standard_ada_testfile p
 
-if [get_compiler_info] {
-    return -1
-}
 set old_gcc [expr [test_compiler_info {gcc-[0-7]-*}]]
 
 proc gdb_test_with_xfail { cmd re re_xfail msg } {
diff --git a/gdb/testsuite/gdb.ada/arrayidx.exp b/gdb/testsuite/gdb.ada/arrayidx.exp
index 218d51903db..43393e61d3c 100644
--- a/gdb/testsuite/gdb.ada/arrayidx.exp
+++ b/gdb/testsuite/gdb.ada/arrayidx.exp
@@ -23,9 +23,6 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
     return -1
 }
 
-if [get_compiler_info] {
-    return -1
-}
 set old_gcc [expr [test_compiler_info {gcc-[0-3]-*}] \
 	     || [test_compiler_info {gcc-4-[0-6]-*}]]
 
diff --git a/gdb/testsuite/gdb.ada/big_packed_array.exp b/gdb/testsuite/gdb.ada/big_packed_array.exp
index 415c5c95140..e82892a420c 100644
--- a/gdb/testsuite/gdb.ada/big_packed_array.exp
+++ b/gdb/testsuite/gdb.ada/big_packed_array.exp
@@ -19,9 +19,6 @@ if { [skip_ada_tests] } { return -1 }
 
 standard_ada_testfile foo_ra24_010
 
-if [get_compiler_info] {
-    return -1
-}
 set old_gcc [expr [test_compiler_info {gcc-[0-8]-*}]]
 
 foreach_with_prefix scenario {all minimal} {
diff --git a/gdb/testsuite/gdb.ada/null_array.exp b/gdb/testsuite/gdb.ada/null_array.exp
index 8b93976324e..e8b3b93446b 100644
--- a/gdb/testsuite/gdb.ada/null_array.exp
+++ b/gdb/testsuite/gdb.ada/null_array.exp
@@ -28,10 +28,6 @@ clean_restart ${testfile}
 set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb]
 runto "foo.adb:$bp_location"
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[test_compiler_info {gcc-[0-3]-*}]
     || [test_compiler_info {gcc-4-[0-4]-*}]} {
     # Ada array bounds are missing in older GCCs.
diff --git a/gdb/testsuite/gdb.arch/altivec-abi.exp b/gdb/testsuite/gdb.arch/altivec-abi.exp
index b3dffbb70aa..d46882ad7ac 100644
--- a/gdb/testsuite/gdb.arch/altivec-abi.exp
+++ b/gdb/testsuite/gdb.arch/altivec-abi.exp
@@ -28,11 +28,6 @@ if {![istarget "powerpc*"] || [skip_altivec_tests]} then {
 
 standard_testfile
 
-if [get_compiler_info] {
-    warning "get_compiler failed"
-    return -1
-}
-
 proc altivec_abi_tests { extra_flags force_abi } {
     global testfile binfile srcfile srcdir subdir
     global gdb_prompt
diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp
index d4c13afa8a1..42521a0a9ab 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -30,11 +30,6 @@ if {![istarget "powerpc*"] || [skip_altivec_tests]} then {
 standard_testfile
 
 set compile_flags {debug nowarnings}
-if [get_compiler_info] {
-    warning "get_compiler failed"
-    return -1
-}
-
 if [test_compiler_info gcc*] {
     set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec"
 } elseif [test_compiler_info xlc*] {
diff --git a/gdb/testsuite/gdb.arch/amd64-byte.exp b/gdb/testsuite/gdb.arch/amd64-byte.exp
index 549b4e00435..085963230cc 100644
--- a/gdb/testsuite/gdb.arch/amd64-byte.exp
+++ b/gdb/testsuite/gdb.arch/amd64-byte.exp
@@ -26,10 +26,6 @@ if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
 
 standard_testfile amd64-pseudo.c
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } {
     untested "failed to compile"
     return
diff --git a/gdb/testsuite/gdb.arch/amd64-dword.exp b/gdb/testsuite/gdb.arch/amd64-dword.exp
index 242c16e1b15..0c297529dc0 100644
--- a/gdb/testsuite/gdb.arch/amd64-dword.exp
+++ b/gdb/testsuite/gdb.arch/amd64-dword.exp
@@ -26,10 +26,6 @@ if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
 
 standard_testfile amd64-pseudo.c
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } {
     untested "failed to compile"
     return
diff --git a/gdb/testsuite/gdb.arch/amd64-word.exp b/gdb/testsuite/gdb.arch/amd64-word.exp
index 37784cfee12..c518dc96c86 100644
--- a/gdb/testsuite/gdb.arch/amd64-word.exp
+++ b/gdb/testsuite/gdb.arch/amd64-word.exp
@@ -26,10 +26,6 @@ if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
 
 standard_testfile amd64-pseudo.c
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } {
     untested "failed to compile"
     return
diff --git a/gdb/testsuite/gdb.arch/i386-avx.exp b/gdb/testsuite/gdb.arch/i386-avx.exp
index c86bf05ad5a..950b411809e 100644
--- a/gdb/testsuite/gdb.arch/i386-avx.exp
+++ b/gdb/testsuite/gdb.arch/i386-avx.exp
@@ -31,10 +31,6 @@ if { ![have_avx] } {
 
 standard_testfile .c
 
-if [get_compiler_info] {
-    return -1
-}
-
 set flags { debug }
 
 # C11 for _Alignas, gnu for asm.
diff --git a/gdb/testsuite/gdb.arch/i386-byte.exp b/gdb/testsuite/gdb.arch/i386-byte.exp
index 30bb561a330..f29d54ec1bc 100644
--- a/gdb/testsuite/gdb.arch/i386-byte.exp
+++ b/gdb/testsuite/gdb.arch/i386-byte.exp
@@ -26,10 +26,6 @@ if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"])} then {
 
 standard_testfile i386-pseudo.c
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } {
     untested "failed to compile"
     return
diff --git a/gdb/testsuite/gdb.arch/i386-sse.exp b/gdb/testsuite/gdb.arch/i386-sse.exp
index e94121882c6..6565f15aa76 100644
--- a/gdb/testsuite/gdb.arch/i386-sse.exp
+++ b/gdb/testsuite/gdb.arch/i386-sse.exp
@@ -26,10 +26,6 @@ if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
 
 standard_testfile .c
 
-if [get_compiler_info] {
-    return -1
-}
-
 set flags { debug }
 
 # C11 for _Alignas, gnu for asm.
diff --git a/gdb/testsuite/gdb.arch/i386-word.exp b/gdb/testsuite/gdb.arch/i386-word.exp
index 3c3626cf0af..5ad01eb20f1 100644
--- a/gdb/testsuite/gdb.arch/i386-word.exp
+++ b/gdb/testsuite/gdb.arch/i386-word.exp
@@ -26,10 +26,6 @@ if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"])} then {
 
 standard_testfile i386-pseudo.c
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } {
     untested "failed to compile"
     return
diff --git a/gdb/testsuite/gdb.arch/ppc-dfp.exp b/gdb/testsuite/gdb.arch/ppc-dfp.exp
index 45194dc79d8..ecaf2499a0f 100644
--- a/gdb/testsuite/gdb.arch/ppc-dfp.exp
+++ b/gdb/testsuite/gdb.arch/ppc-dfp.exp
@@ -23,11 +23,6 @@ if ![istarget "powerpc*"] then {
 
 standard_testfile
 
-if [get_compiler_info] {
-    warning "get_compiler failed"
-    return -1
-}
-
 if ![test_compiler_info gcc*] {
     # We use GCC's extended asm syntax
     warning "unknown compiler"
diff --git a/gdb/testsuite/gdb.arch/ppc-fp.exp b/gdb/testsuite/gdb.arch/ppc-fp.exp
index a95427323a4..bf1a1c59082 100644
--- a/gdb/testsuite/gdb.arch/ppc-fp.exp
+++ b/gdb/testsuite/gdb.arch/ppc-fp.exp
@@ -23,11 +23,6 @@ if ![istarget "powerpc*"] then {
 
 standard_testfile
 
-if [get_compiler_info] {
-    warning "get_compiler failed"
-    return -1
-}
-
 if ![test_compiler_info gcc*] {
     # We use GCC's extended asm syntax
     warning "unknown compiler"
diff --git a/gdb/testsuite/gdb.arch/s390-multiarch.exp b/gdb/testsuite/gdb.arch/s390-multiarch.exp
index ee7f2287e19..f0e85544bd5 100644
--- a/gdb/testsuite/gdb.arch/s390-multiarch.exp
+++ b/gdb/testsuite/gdb.arch/s390-multiarch.exp
@@ -33,10 +33,6 @@ set binprefix $binfile
 
 gdb_exit
 
-if { [get_compiler_info] } {
-    return -1
-}
-
 proc compile_and_dump {variant ccopts binfile} {
     global srcdir subdir srcfile
     set compile_flags {debug}
diff --git a/gdb/testsuite/gdb.arch/vsx-regs.exp b/gdb/testsuite/gdb.arch/vsx-regs.exp
index 56fea796a9b..c288b2f7d6f 100644
--- a/gdb/testsuite/gdb.arch/vsx-regs.exp
+++ b/gdb/testsuite/gdb.arch/vsx-regs.exp
@@ -27,11 +27,6 @@ if {![istarget "powerpc*"] || [skip_vsx_tests]} then {
 standard_testfile
 
 set compile_flags {debug nowarnings quiet}
-if [get_compiler_info] {
-    warning "get_compiler failed"
-    return -1
-}
-
 if [test_compiler_info gcc*] {
     set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec"
 } elseif [test_compiler_info xlc*] {
diff --git a/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp b/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp
index 7e94d05753f..b5b2d584403 100644
--- a/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp
+++ b/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp
@@ -27,11 +27,6 @@ if {![istarget "powerpc*"] || [skip_vsx_tests]} then {
 standard_testfile
 
 set compile_flags {debug nowarnings quiet}
-if [get_compiler_info] {
-    warning "get_compiler failed"
-    return -1
-}
-
 if [test_compiler_info gcc*] {
     set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec"
 } elseif [test_compiler_info xlc*] {
diff --git a/gdb/testsuite/gdb.base/align-c++.exp b/gdb/testsuite/gdb.base/align-c++.exp
index 4e62feebc2f..bb72b1fe7ee 100644
--- a/gdb/testsuite/gdb.base/align-c++.exp
+++ b/gdb/testsuite/gdb.base/align-c++.exp
@@ -19,7 +19,7 @@
 # compiler.
 
 # Only test C++ if we are able.
-if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
+if { [skip_cplus_tests] } {
     return -1
 }
 set lang c++
diff --git a/gdb/testsuite/gdb.base/all-bin.exp b/gdb/testsuite/gdb.base/all-bin.exp
index 1f481210e19..cf53cd7997e 100644
--- a/gdb/testsuite/gdb.base/all-bin.exp
+++ b/gdb/testsuite/gdb.base/all-bin.exp
@@ -29,10 +29,6 @@
 
 standard_testfile all-types.c
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
index ac6ad6478f4..ed4faee624b 100644
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -499,7 +499,7 @@ proc thread_test {} {
     set binfile [standard_output_file ${testfile}-watch_thread_num]
     set gdb_prompt $old_gdb_prompt
 
-    if { ![get_compiler_info] && [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] == "" } {
+    if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] == "" } {
 
 	gdb_exit
 	gdb_start
diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
index 7b661e99a1c..cfe806bb9dd 100644
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -49,10 +49,6 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile3}" "${binfile3}" executable {d
     return -1
 }
 
-if [get_compiler_info] {
-    return -1
-}
-
 # This is a test of the error cases for gdb's ability to attach to a
 # running process.
 
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index f6533e99ac8..99371f1f6a1 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -30,10 +30,6 @@ set binfile_lib ${binprefix}.so
 set srcfile "${test}-main.c"
 set srcfile_lib "${test}-lib.c"
 
-if [get_compiler_info] {
-    return -1
-}
-
 # Use -soname so that the new library gets copied by build_executable_own_libs.
 
 if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug ldflags=-Wl,-soname,${test}.so]] != ""} {
diff --git a/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp b/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp
index aa1e328cdab..b1c93f61c8c 100644
--- a/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp
+++ b/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp
@@ -27,10 +27,6 @@ if { [skip_cplus_tests] } { continue }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[build_executable_from_specs $testfile.exp $testfile \
        {c++ additional_flags=-Wl,--gc-sections} \
        $srcfile {debug c++ additional_flags=-ffunction-sections}]} {
diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp
index 239cfa4c518..7c80ec7c0b8 100644
--- a/gdb/testsuite/gdb.base/call-ar-st.exp
+++ b/gdb/testsuite/gdb.base/call-ar-st.exp
@@ -29,10 +29,6 @@ if [target_info exists gdb,cannot_call_functions] {
 # 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 debug]} {
diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp
index fee192d7d02..00af32c13a1 100644
--- a/gdb/testsuite/gdb.base/call-rt-st.exp
+++ b/gdb/testsuite/gdb.base/call-rt-st.exp
@@ -28,15 +28,6 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
     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 targets can't do function calls, so don't even bother with this
 # test.
 if [target_info exists gdb,cannot_call_functions] {
diff --git a/gdb/testsuite/gdb.base/call-sc.exp b/gdb/testsuite/gdb.base/call-sc.exp
index af9495fe94f..ddf2ceedf96 100644
--- a/gdb/testsuite/gdb.base/call-sc.exp
+++ b/gdb/testsuite/gdb.base/call-sc.exp
@@ -29,12 +29,6 @@ if [target_info exists gdb,cannot_call_functions] {
 
 standard_testfile .c
 
-# 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]
 
 # Compile a variant of scalars.c using TYPE to specify the type of the
diff --git a/gdb/testsuite/gdb.base/catch-load.exp b/gdb/testsuite/gdb.base/catch-load.exp
index 7f18f63806a..f8677b0a53d 100644
--- a/gdb/testsuite/gdb.base/catch-load.exp
+++ b/gdb/testsuite/gdb.base/catch-load.exp
@@ -18,12 +18,6 @@ if {[skip_shlib_tests]} {
     return -1
 }
 
-if {[get_compiler_info]} {
-    warning "Could not get compiler info"
-    untested "no compiler info"
-    return -1
-}
-
 standard_testfile .c
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug shlib_load}] != "" } {
     untested "failed to compile"
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index 0c58a1ab6b7..e3803c9d2d5 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -52,10 +52,6 @@
 
 standard_testfile break.c break1.c
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile \
 	 [list $srcfile $srcfile2] {debug nowarnings}]} {
     return -1
diff --git a/gdb/testsuite/gdb.base/complex.exp b/gdb/testsuite/gdb.base/complex.exp
index dcade008814..e2c60029593 100644
--- a/gdb/testsuite/gdb.base/complex.exp
+++ b/gdb/testsuite/gdb.base/complex.exp
@@ -16,10 +16,6 @@
 
 standard_testfile
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.base/condbreak.exp b/gdb/testsuite/gdb.base/condbreak.exp
index b8122d092b5..aecee177adf 100644
--- a/gdb/testsuite/gdb.base/condbreak.exp
+++ b/gdb/testsuite/gdb.base/condbreak.exp
@@ -28,10 +28,6 @@ if {[prepare_for_testing "failed to prepare" $testfile [list $srcfile $srcfile2]
     return -1
 }
 
-if [get_compiler_info] {
-    return -1
-}
-
 set bp_location1  [gdb_get_line_number "set breakpoint 1 here"]
 set bp_location6  [gdb_get_line_number "set breakpoint 6 here"]
 set bp_location8  [gdb_get_line_number "set breakpoint 8 here" $srcfile2]
diff --git a/gdb/testsuite/gdb.base/consecutive.exp b/gdb/testsuite/gdb.base/consecutive.exp
index cd5c6f321a0..4b38de0c3bc 100644
--- a/gdb/testsuite/gdb.base/consecutive.exp
+++ b/gdb/testsuite/gdb.base/consecutive.exp
@@ -22,10 +22,6 @@
 
 standard_testfile
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarnings}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.base/constvars.exp b/gdb/testsuite/gdb.base/constvars.exp
index fd15743c521..671baf62f01 100644
--- a/gdb/testsuite/gdb.base/constvars.exp
+++ b/gdb/testsuite/gdb.base/constvars.exp
@@ -29,12 +29,6 @@
 
 standard_testfile .c
 
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug ] != "" } {
     untested "failed to compile"
     return -1
diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
index 4ed92a02955..fa9d8243a59 100644
--- a/gdb/testsuite/gdb.base/corefile.exp
+++ b/gdb/testsuite/gdb.base/corefile.exp
@@ -23,12 +23,6 @@ if ![isnative] then {
 
 standard_testfile coremaker.c
 
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info] {
-    return -1
-}
-
 if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
     untested "failed to compile"
     return -1
diff --git a/gdb/testsuite/gdb.base/dprintf-pending.exp b/gdb/testsuite/gdb.base/dprintf-pending.exp
index c3e121241d7..2ab8d52f146 100644
--- a/gdb/testsuite/gdb.base/dprintf-pending.exp
+++ b/gdb/testsuite/gdb.base/dprintf-pending.exp
@@ -26,10 +26,6 @@ set lib_sl [standard_output_file $libfile.sl]
 set lib_opts  debug
 set exec_opts [list debug shlib=$lib_sl]
 
-if { [get_compiler_info] } {
-    return -1
-}
-
 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
      || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} {
     untested "failed to compile shared library"
diff --git a/gdb/testsuite/gdb.base/eval-skip.exp b/gdb/testsuite/gdb.base/eval-skip.exp
index 81b37d1a891..659a8b8a61e 100644
--- a/gdb/testsuite/gdb.base/eval-skip.exp
+++ b/gdb/testsuite/gdb.base/eval-skip.exp
@@ -39,10 +39,6 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
      return -1
     }
 
-if [get_compiler_info] {
-    return -1
-}
-
 clean_restart ${binfile}
 
 
diff --git a/gdb/testsuite/gdb.base/expand-psymtabs.exp b/gdb/testsuite/gdb.base/expand-psymtabs.exp
index 6848272c816..e55dddd63fa 100644
--- a/gdb/testsuite/gdb.base/expand-psymtabs.exp
+++ b/gdb/testsuite/gdb.base/expand-psymtabs.exp
@@ -30,11 +30,6 @@
 
 standard_testfile
 
-# What compiler are we using?
-if [get_compiler_info] {
-    return -1
-}
-
 # We intentionally compile the source file in twice.
 if {[prepare_for_testing_full "failed to prepare" \
 	 [list $testfile debug $srcfile {debug additional_flags=-DFIRST} \
diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp
index dfe0ec93737..0605dd62480 100644
--- a/gdb/testsuite/gdb.base/exprs.exp
+++ b/gdb/testsuite/gdb.base/exprs.exp
@@ -26,10 +26,6 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
      return -1
 }
 
-if [get_compiler_info] {
-    return -1
-}
-
 clean_restart ${binfile}
 
 #
diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp
index 7d0d85fccca..e00a1cefa0a 100644
--- a/gdb/testsuite/gdb.base/fileio.exp
+++ b/gdb/testsuite/gdb.base/fileio.exp
@@ -36,13 +36,6 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
     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
-}
-
 set dir2 [standard_output_file dir2.fileio.test]
 if {[file exists $dir2] && ![file writable $dir2]} {
     system "chmod +w $dir2"
diff --git a/gdb/testsuite/gdb.base/fixsection.exp b/gdb/testsuite/gdb.base/fixsection.exp
index 47174b04337..5734fcaae74 100644
--- a/gdb/testsuite/gdb.base/fixsection.exp
+++ b/gdb/testsuite/gdb.base/fixsection.exp
@@ -27,10 +27,6 @@ set lib_sl [standard_output_file ${libfile}.sl]
 set lib_opts [list debug nowarnings]
 set exec_opts [list debug nowarnings shlib=$lib_sl]
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
      || [gdb_compile $srcdir/$subdir/$srcfile $binfile \
 	     executable $exec_opts] != ""} {
diff --git a/gdb/testsuite/gdb.base/gdb11530.exp b/gdb/testsuite/gdb.base/gdb11530.exp
index bd8d0669a3a..7f16965d11d 100644
--- a/gdb/testsuite/gdb.base/gdb11530.exp
+++ b/gdb/testsuite/gdb.base/gdb11530.exp
@@ -22,11 +22,6 @@ standard_testfile
 
 # Unnamed union is a GNU extension, thus we restrict the test
 # to gcc compiler.
-
-if [get_compiler_info] {
-    return -1
-}
-
 if { ![test_compiler_info gcc*] } {
     return 0
 }
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.exp b/gdb/testsuite/gdb.base/gnu-ifunc.exp
index 713f3ffa568..672ae85a218 100644
--- a/gdb/testsuite/gdb.base/gnu-ifunc.exp
+++ b/gdb/testsuite/gdb.base/gnu-ifunc.exp
@@ -31,10 +31,6 @@ set libsrc ${libfile}.c
 set final_file "${testfile}-final"
 set final_src ${final_file}.c
 
-if [get_compiler_info] {
-    return -1
-}
-
 # Return the binary suffix appended to program and library names to
 # make each testcase variant unique.
 proc make_binsuffix {resolver_attr resolver_debug final_debug} {
diff --git a/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp b/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp
index 13c01de02e6..a521637e17e 100644
--- a/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp
+++ b/gdb/testsuite/gdb.base/hbreak-in-shr-unsupported.exp
@@ -30,10 +30,6 @@ set lib_so [standard_output_file ${lib_basename}]
 set lib_opts "debug"
 set exec_opts [list debug shlib=${lib_so}]
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile_shlib ${srcdir}/${subdir}/${lib_src} ${lib_so} $lib_opts] != ""
      || [gdb_compile ${srcdir}/${subdir}/${main_src} ${binfile} executable $exec_opts] != ""} {
     untested "failed to compile"
diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp b/gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp
index e05bb923ec9..5415c7a7c10 100644
--- a/gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp
+++ b/gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp
@@ -16,7 +16,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Only test C++ if we are able.
-if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
+if { [skip_cplus_tests] } {
     return -1
 }
 set lang c++
diff --git a/gdb/testsuite/gdb.base/info-fun.exp b/gdb/testsuite/gdb.base/info-fun.exp
index 175753a234b..e683bc3aa70 100644
--- a/gdb/testsuite/gdb.base/info-fun.exp
+++ b/gdb/testsuite/gdb.base/info-fun.exp
@@ -26,10 +26,6 @@ standard_testfile .c
 set executable ${testfile}
 set bin_flags [list debug shlib=${binfile_lib}]
 
-if [get_compiler_info] {
-    return -1
-}
-
 foreach_with_prefix n_flag { 0 1 } {
 
     # SEP must be last for the possible `unsupported' error path.
diff --git a/gdb/testsuite/gdb.base/info-types-c++.exp b/gdb/testsuite/gdb.base/info-types-c++.exp
index 082879dce4a..2aca2e35004 100644
--- a/gdb/testsuite/gdb.base/info-types-c++.exp
+++ b/gdb/testsuite/gdb.base/info-types-c++.exp
@@ -14,7 +14,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Only test C++ if we are able.
-if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
+if { [skip_cplus_tests] } {
     return -1
 }
 set lang c++
diff --git a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp
index ef5fe8c24bc..31e753a0c1c 100644
--- a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp
+++ b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp
@@ -23,10 +23,6 @@
 
 standard_testfile .c
 
-if [get_compiler_info] {
-    return -1
-}
-
 # Build executable with stripped startup code and text section starting at zero
 
 set opts {debug "additional_flags=-nostdlib -emain -Wl,-Ttext=0x00 -Wl,-N"}
diff --git a/gdb/testsuite/gdb.base/jit-elf-fork.exp b/gdb/testsuite/gdb.base/jit-elf-fork.exp
index 635248cd8e4..a8e85b30e1b 100644
--- a/gdb/testsuite/gdb.base/jit-elf-fork.exp
+++ b/gdb/testsuite/gdb.base/jit-elf-fork.exp
@@ -20,11 +20,6 @@ if {[skip_shlib_tests]} {
     return -1
 }
 
-if {[get_compiler_info]} {
-    untested "could not get compiler info"
-    return 1
-}
-
 load_lib jit-elf-helpers.exp
 
 # The main code that loads and registers JIT objects.
diff --git a/gdb/testsuite/gdb.base/jit-elf-so.exp b/gdb/testsuite/gdb.base/jit-elf-so.exp
index b6081b3ab5e..dcc9afc36b9 100644
--- a/gdb/testsuite/gdb.base/jit-elf-so.exp
+++ b/gdb/testsuite/gdb.base/jit-elf-so.exp
@@ -21,11 +21,6 @@ if {[skip_shlib_tests]} {
     return -1
 }
 
-if {[get_compiler_info]} {
-    untested "could not get compiler info"
-    return 1
-}
-
 load_lib jit-elf-helpers.exp
 
 # Increase this to see more detail.
diff --git a/gdb/testsuite/gdb.base/jit-elf.exp b/gdb/testsuite/gdb.base/jit-elf.exp
index 4b75188a00d..38d541f74b9 100644
--- a/gdb/testsuite/gdb.base/jit-elf.exp
+++ b/gdb/testsuite/gdb.base/jit-elf.exp
@@ -18,11 +18,6 @@ if {[skip_shlib_tests]} {
     return -1
 }
 
-if {[get_compiler_info]} {
-    untested "could not get compiler info"
-    return 1
-}
-
 load_lib jit-elf-helpers.exp
 
 # Increase this to see more detail.
diff --git a/gdb/testsuite/gdb.base/jit-reader.exp b/gdb/testsuite/gdb.base/jit-reader.exp
index d94360cd7d9..e0b3ba42115 100644
--- a/gdb/testsuite/gdb.base/jit-reader.exp
+++ b/gdb/testsuite/gdb.base/jit-reader.exp
@@ -27,12 +27,6 @@ if { ![isnative] } {
     return -1
 }
 
-if {[get_compiler_info]} {
-    untested "could not get compiler info"
-    return 1
-}
-
-
 # Increase this to see more detail.
 set test_verbose 0
 
diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
index d11d35e6697..fe894a0098e 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -26,12 +26,6 @@ if {[build_executable "failed to prepare" $testfile [list $srcfile $srcfile2] \
     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
-}
-
 # The last line in the file.
 set last_line [gdb_get_line_number "last line" "list0.c"]
 
diff --git a/gdb/testsuite/gdb.base/logical.exp b/gdb/testsuite/gdb.base/logical.exp
index f594c3be110..b1d3c757768 100644
--- a/gdb/testsuite/gdb.base/logical.exp
+++ b/gdb/testsuite/gdb.base/logical.exp
@@ -32,10 +32,6 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
     return -1
 }
 
-if [get_compiler_info] {
-    return -1
-}
-
 clean_restart ${binfile}
 
 
diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp
index 43e689f8ae4..9c8dd16b7eb 100644
--- a/gdb/testsuite/gdb.base/long_long.exp
+++ b/gdb/testsuite/gdb.base/long_long.exp
@@ -24,12 +24,6 @@ if [target_info exists no_long_long] {
 
 standard_testfile .c
 
-# What compiler are we using?
-#
-if [get_compiler_info] {
-    return -1
-}
-
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [concat debug nowarnings]] != "" } {
      untested "failed to compile"
      return -1
diff --git a/gdb/testsuite/gdb.base/longjmp.exp b/gdb/testsuite/gdb.base/longjmp.exp
index 6ab1474d9b4..f301cac2897 100644
--- a/gdb/testsuite/gdb.base/longjmp.exp
+++ b/gdb/testsuite/gdb.base/longjmp.exp
@@ -25,10 +25,6 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
      return -1
 }
 
-if [get_compiler_info] {
-    return -1
-}
-
 clean_restart ${binfile}
 
 if ![runto_main] then {
diff --git a/gdb/testsuite/gdb.base/max-depth-c++.exp b/gdb/testsuite/gdb.base/max-depth-c++.exp
index ea2538b6458..9561176ba32 100644
--- a/gdb/testsuite/gdb.base/max-depth-c++.exp
+++ b/gdb/testsuite/gdb.base/max-depth-c++.exp
@@ -14,7 +14,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Only test C++ if we are able.
-if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
+if { [skip_cplus_tests] } {
     return -1
 }
 set lang c++
diff --git a/gdb/testsuite/gdb.base/mips_pro.exp b/gdb/testsuite/gdb.base/mips_pro.exp
index 1c8f3dc4eb4..fe5eb94f001 100644
--- a/gdb/testsuite/gdb.base/mips_pro.exp
+++ b/gdb/testsuite/gdb.base/mips_pro.exp
@@ -16,13 +16,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
-}
-
-
 # This test must be compiled with -O2 if using gcc.
 
 set options debug
diff --git a/gdb/testsuite/gdb.base/miscexprs.exp b/gdb/testsuite/gdb.base/miscexprs.exp
index f633d143b6f..7d9542fbeba 100644
--- a/gdb/testsuite/gdb.base/miscexprs.exp
+++ b/gdb/testsuite/gdb.base/miscexprs.exp
@@ -44,10 +44,6 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [lis
     return -1
 }
 
-if [get_compiler_info] {
-    return -1
-}
-
 clean_restart ${binfile}
 
 
diff --git a/gdb/testsuite/gdb.base/nodebug.exp b/gdb/testsuite/gdb.base/nodebug.exp
index 0dbd0ad153e..68a21eb07dd 100644
--- a/gdb/testsuite/gdb.base/nodebug.exp
+++ b/gdb/testsuite/gdb.base/nodebug.exp
@@ -18,10 +18,6 @@
 
 standard_testfile .c
 
-if [get_compiler_info] {
-    return -1
-}
-
 if [test_compiler_info "xlc-*"] {
     # By default, IBM'x xlc compiler doesn't add static variables into the symtab.
     # Use "-qstatsym" to do so. 
diff --git a/gdb/testsuite/gdb.base/pc-fp.exp b/gdb/testsuite/gdb.base/pc-fp.exp
index 6b61fc06a98..b0e7ec9b335 100644
--- a/gdb/testsuite/gdb.base/pc-fp.exp
+++ b/gdb/testsuite/gdb.base/pc-fp.exp
@@ -26,10 +26,6 @@
 
 standard_testfile
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarnings}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.base/pending.exp b/gdb/testsuite/gdb.base/pending.exp
index c9178fc9d15..9b3fb024887 100644
--- a/gdb/testsuite/gdb.base/pending.exp
+++ b/gdb/testsuite/gdb.base/pending.exp
@@ -31,10 +31,6 @@ set lib_sl  [standard_output_file $libfile.sl]
 set lib_opts  debug
 set exec_opts [list debug shlib=$lib_sl]
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
      || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} {
     untested "failed to compile"
diff --git a/gdb/testsuite/gdb.base/permissions.exp b/gdb/testsuite/gdb.base/permissions.exp
index 233b630f0ea..f13e985e77e 100644
--- a/gdb/testsuite/gdb.base/permissions.exp
+++ b/gdb/testsuite/gdb.base/permissions.exp
@@ -26,10 +26,6 @@ if {[build_executable $testfile.exp $testfile \
     return -1
 }
 
-if [get_compiler_info] {
-    return -1
-}
-
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp
index 586f85a4947..41981ee6623 100644
--- a/gdb/testsuite/gdb.base/pointers.exp
+++ b/gdb/testsuite/gdb.base/pointers.exp
@@ -32,10 +32,6 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
      return -1
     }
 
-if [get_compiler_info] {
-    return -1
-}
-
 clean_restart ${binfile}
 
 
diff --git a/gdb/testsuite/gdb.base/print-file-var.exp b/gdb/testsuite/gdb.base/print-file-var.exp
index dca753e8bb3..9abe87d7758 100644
--- a/gdb/testsuite/gdb.base/print-file-var.exp
+++ b/gdb/testsuite/gdb.base/print-file-var.exp
@@ -139,7 +139,7 @@ proc test {hidden dlopen version_id_main lang} {
 }
 
 # Only test C++ if we are able.  Always use C.
-if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
+if { [skip_cplus_tests] } {
     set lang_list {c}
 } else {
     set lang_list {c c++}
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp
index 3260c8a3c09..96104049b61 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -27,8 +27,6 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
      return -1
 }
 
-get_compiler_info
-
 proc test_integer_literals_accepted {} {
     global gdb_prompt
 
diff --git a/gdb/testsuite/gdb.base/psym-external-decl.exp b/gdb/testsuite/gdb.base/psym-external-decl.exp
index 0148f261c97..3d8f3aae5c5 100644
--- a/gdb/testsuite/gdb.base/psym-external-decl.exp
+++ b/gdb/testsuite/gdb.base/psym-external-decl.exp
@@ -15,7 +15,6 @@
 
 standard_testfile .c psym-external-decl-2.c
 
-get_compiler_info
 if { [test_compiler_info "clang-*"] } {
     return -1
 }
diff --git a/gdb/testsuite/gdb.base/psymtab.exp b/gdb/testsuite/gdb.base/psymtab.exp
index 863e0ec54eb..e805218b076 100644
--- a/gdb/testsuite/gdb.base/psymtab.exp
+++ b/gdb/testsuite/gdb.base/psymtab.exp
@@ -28,12 +28,6 @@ if { [skip_cplus_tests] } { continue }
 
 standard_testfile psymtab1.c psymtab2.c
 
-# 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 \
 	 [list $srcfile $srcfile2] debug]} {
     return -1
diff --git a/gdb/testsuite/gdb.base/relational.exp b/gdb/testsuite/gdb.base/relational.exp
index 87ccb9f3fe7..80185052f20 100644
--- a/gdb/testsuite/gdb.base/relational.exp
+++ b/gdb/testsuite/gdb.base/relational.exp
@@ -29,10 +29,6 @@ if { [prepare_for_testing "failed to prepare" relational int-type.c {debug nowar
     return -1
 }
 
-if [get_compiler_info] {
-    return -1
-}
-
 #
 # set it up at a breakpoint so we can play with the variable values
 #
diff --git a/gdb/testsuite/gdb.base/scope.exp b/gdb/testsuite/gdb.base/scope.exp
index a8ddb61350a..55f70a85687 100644
--- a/gdb/testsuite/gdb.base/scope.exp
+++ b/gdb/testsuite/gdb.base/scope.exp
@@ -23,12 +23,6 @@ if {[build_executable "failed to build" ${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
-}
-
 # Test locating various things when stopped just inside main, after
 # running init0().  To prevent cascading of errors, we report the
 # first one and quit.  If all pass, then we print the pass results.
diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp
index 6c766e148de..ceef308380e 100644
--- a/gdb/testsuite/gdb.base/shlib-call.exp
+++ b/gdb/testsuite/gdb.base/shlib-call.exp
@@ -43,10 +43,6 @@ set lib2     [standard_output_file shr2.sl]
 set lib_opts "debug"
 set exec_opts [list debug shlib=${lib1} shlib=${lib2}]
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile_shlib ${lib1src} ${lib1} $lib_opts] != ""
      || [gdb_compile_shlib ${lib2src} ${lib2} $lib_opts] != ""
      || [gdb_compile ${srcfile} ${binfile} executable $exec_opts] != ""} {
diff --git a/gdb/testsuite/gdb.base/shreloc.exp b/gdb/testsuite/gdb.base/shreloc.exp
index 6f23889c0b1..25032400ee6 100644
--- a/gdb/testsuite/gdb.base/shreloc.exp
+++ b/gdb/testsuite/gdb.base/shreloc.exp
@@ -37,10 +37,6 @@ set binfile [standard_output_file $testfile]
 set lib1_sl [standard_output_file shreloc1.sl]
 set lib2_sl [standard_output_file shreloc2.sl]
 
-if [get_compiler_info] {
-    return -1
-}
-
 set lib_opts "debug"
 set exec_opts [list debug shlib=$lib1_sl shlib=$lib2_sl]
 
diff --git a/gdb/testsuite/gdb.base/signals.exp b/gdb/testsuite/gdb.base/signals.exp
index 11fa9d859d8..2b3fc1c6662 100644
--- a/gdb/testsuite/gdb.base/signals.exp
+++ b/gdb/testsuite/gdb.base/signals.exp
@@ -26,12 +26,6 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
     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
-}
-
 gdb_exit
 gdb_start
 
diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp
index 7e86b2ac3e8..3237c212a0a 100644
--- a/gdb/testsuite/gdb.base/sizeof.exp
+++ b/gdb/testsuite/gdb.base/sizeof.exp
@@ -21,10 +21,6 @@
 
 standard_testfile
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.base/so-impl-ld.exp b/gdb/testsuite/gdb.base/so-impl-ld.exp
index 69c35d4c7ac..372b18f3915 100644
--- a/gdb/testsuite/gdb.base/so-impl-ld.exp
+++ b/gdb/testsuite/gdb.base/so-impl-ld.exp
@@ -26,10 +26,6 @@ set lib_sl  [standard_output_file $libfile.sl]
 set lib_opts  debug
 set exec_opts [list debug shlib=$lib_sl]
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
      || [gdb_compile $srcdir/$subdir/$srcfile $binfile \
 	     executable $exec_opts] != ""} {
diff --git a/gdb/testsuite/gdb.base/solib-disc.exp b/gdb/testsuite/gdb.base/solib-disc.exp
index c1c4ccf3074..8f686ce6e89 100644
--- a/gdb/testsuite/gdb.base/solib-disc.exp
+++ b/gdb/testsuite/gdb.base/solib-disc.exp
@@ -38,10 +38,6 @@ set lib_syms [shlib_symbol_file ${libname}]
 
 remote_exec build "rm -f ${binfile}"
 
-if [get_compiler_info] {
-    return -1
-}
-
 set exec_opts [list debug shlib_load additional_flags=-DSHLIB_NAME=\"${lib_dlopen}\"]
 
 if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
diff --git a/gdb/testsuite/gdb.base/solib-display.exp b/gdb/testsuite/gdb.base/solib-display.exp
index d67541374a3..4c4da6aee9d 100644
--- a/gdb/testsuite/gdb.base/solib-display.exp
+++ b/gdb/testsuite/gdb.base/solib-display.exp
@@ -61,10 +61,6 @@ set executable ${testfile}
 set binfile [standard_output_file ${executable}]
 set bin_flags [list debug shlib=${binfile_lib}]
 
-if [get_compiler_info] {
-    return -1
-}
-
 # SEP must be last for the possible `unsupported' error path.
 foreach libsepdebug {NO IN SEP} { with_test_prefix "$libsepdebug" {
 
diff --git a/gdb/testsuite/gdb.base/solib-nodir.exp b/gdb/testsuite/gdb.base/solib-nodir.exp
index cd84091b956..c687b7eb511 100644
--- a/gdb/testsuite/gdb.base/solib-nodir.exp
+++ b/gdb/testsuite/gdb.base/solib-nodir.exp
@@ -42,8 +42,7 @@ set objfile [standard_output_file ${executable}.o]
 set binfile [standard_output_file ${executable}]
 
 # build the first test case
-if { [get_compiler_info]
-     || [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" "${binlibfile}" [list debug ldflags=-Wl,-soname,${binlibfilebase}]] != ""
+if { [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" "${binlibfile}" [list debug ldflags=-Wl,-soname,${binlibfilebase}]] != ""
      || [gdb_gnu_strip_debug $binlibfile]
      || [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != ""
      || [gdb_compile "${objfile} ${binlibfile}" "${binfile}" executable {}] != "" } {
diff --git a/gdb/testsuite/gdb.base/solib-overlap.exp b/gdb/testsuite/gdb.base/solib-overlap.exp
index a7fa056464e..3d9110baf2c 100644
--- a/gdb/testsuite/gdb.base/solib-overlap.exp
+++ b/gdb/testsuite/gdb.base/solib-overlap.exp
@@ -35,10 +35,6 @@ if {![can_spawn_for_attach]} {
     return 0
 }
 
-if [get_compiler_info] {
-    return -1
-}
-
 # Library file.
 set libname "solib-overlap-lib"
 set srcfile_lib ${srcdir}/${subdir}/${libname}.c
diff --git a/gdb/testsuite/gdb.base/solib-search.exp b/gdb/testsuite/gdb.base/solib-search.exp
index 202e79d85de..ab4f2c45072 100644
--- a/gdb/testsuite/gdb.base/solib-search.exp
+++ b/gdb/testsuite/gdb.base/solib-search.exp
@@ -21,13 +21,6 @@ if {[is_remote target] || [skip_shlib_tests]} {
     return -1
 }
 
-# This is required by gdb_compile_shlib.
-if {[get_compiler_info]} {
-    warning "Could not get compiler info"
-    untested "no compiler info"
-    return 1
-}
-
 # Build "wrong" and "right" versions of the libraries in separate directories.
 set wrong_lib_subdir "solib-search-wrong"
 set right_lib_subdir "solib-search-right"
diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp
index f2735162d23..02b2028ce92 100644
--- a/gdb/testsuite/gdb.base/solib-symbol.exp
+++ b/gdb/testsuite/gdb.base/solib-symbol.exp
@@ -30,10 +30,6 @@ set srcfile ${srcdir}/${subdir}/${testfile}.c
 set binfile [standard_output_file ${testfile}]
 set bin_flags [list debug shlib=${binfile_lib}]
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
      || [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
   untested "failed to compile"
diff --git a/gdb/testsuite/gdb.base/solib-weak.exp b/gdb/testsuite/gdb.base/solib-weak.exp
index db7b7f1fa4b..c82eee28e21 100644
--- a/gdb/testsuite/gdb.base/solib-weak.exp
+++ b/gdb/testsuite/gdb.base/solib-weak.exp
@@ -29,10 +29,6 @@ if {([istarget *-*-mingw*]
 }
 
 # This test uses GCC-specific syntax.
-if [get_compiler_info] {
-    return -1
-}
-
 if {![test_compiler_info "gcc-*"]} {
     return 0
 }
diff --git a/gdb/testsuite/gdb.base/store.exp b/gdb/testsuite/gdb.base/store.exp
index cb0e3c206a5..65847c7fbd5 100644
--- a/gdb/testsuite/gdb.base/store.exp
+++ b/gdb/testsuite/gdb.base/store.exp
@@ -22,10 +22,6 @@ if { [prepare_for_testing "failed to prepare" $executable $srcfile] } {
     return -1
 }
 
-if [get_compiler_info] {
-    return -1
-}
-
 #
 # set it up at a breakpoint so we can play with the variable values
 #
diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp
index e9326a6e4a5..71c07ebe368 100644
--- a/gdb/testsuite/gdb.base/structs.exp
+++ b/gdb/testsuite/gdb.base/structs.exp
@@ -29,13 +29,6 @@ standard_testfile .c
 # Regex matching any value of `char' type like: a = 65 'A'
 set anychar_re {-?[0-9]{1,3} '(.|\\([0-7]{3}|[a-z]|\\|'))'}
 
-# 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]
 
 # Compile a variant of structs.c using TYPES to specify the type of
diff --git a/gdb/testsuite/gdb.base/structs2.exp b/gdb/testsuite/gdb.base/structs2.exp
index 86d47ecbb9e..eecc19bba3e 100644
--- a/gdb/testsuite/gdb.base/structs2.exp
+++ b/gdb/testsuite/gdb.base/structs2.exp
@@ -15,12 +15,6 @@
 
 standard_testfile .c
 
-# 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" $binfile $srcfile {debug}] } {
     return -1
 }
diff --git a/gdb/testsuite/gdb.base/sym-file.exp b/gdb/testsuite/gdb.base/sym-file.exp
index bd8159b306f..66273f19e9c 100644
--- a/gdb/testsuite/gdb.base/sym-file.exp
+++ b/gdb/testsuite/gdb.base/sym-file.exp
@@ -60,10 +60,6 @@ set lib_dlopen [shlib_target_file ${lib_basename}.so]
 set exec_opts [list debug "additional_flags= -I$srcdir/../../include/ -D$target_size\
  -DSHLIB_NAME\\=\"$lib_dlopen\""]
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[gdb_compile_shlib $libsrc $lib_so {debug}] != ""} {
     untested "failed to compile shared library"
     return
diff --git a/gdb/testsuite/gdb.base/symtab-search-order.exp b/gdb/testsuite/gdb.base/symtab-search-order.exp
index 6b93ce1f66e..d811af3cdec 100644
--- a/gdb/testsuite/gdb.base/symtab-search-order.exp
+++ b/gdb/testsuite/gdb.base/symtab-search-order.exp
@@ -26,10 +26,6 @@ set lib1     [standard_output_file symtab-search-order-1.sl]
 set lib_opts "debug"
 set exec_opts [list debug shlib=$lib1]
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile_shlib $lib1src $lib1 $lib_opts] != ""
      || [gdb_compile [list $srcfile $srcfile2] $binfile executable \
 	     $exec_opts] != ""} {
diff --git a/gdb/testsuite/gdb.base/unload.exp b/gdb/testsuite/gdb.base/unload.exp
index 6033203bfb8..0a66814ac3f 100644
--- a/gdb/testsuite/gdb.base/unload.exp
+++ b/gdb/testsuite/gdb.base/unload.exp
@@ -42,10 +42,6 @@ set lib_dlopen2 [shlib_target_file ${libname2}]
 set lib_syms [shlib_symbol_file ${libname}]
 set lib_syms2 [shlib_symbol_file ${libname2}]
 
-if [get_compiler_info] {
-    return -1
-}
-
 set lib_opts debug
 set exec_opts [list debug shlib_load additional_flags=-DSHLIB_NAME=\"${lib_dlopen}\" additional_flags=-DSHLIB_NAME2=\"${lib_dlopen2}\"]
 
diff --git a/gdb/testsuite/gdb.base/varargs.exp b/gdb/testsuite/gdb.base/varargs.exp
index 7d49acc17d3..7bd2cb08207 100644
--- a/gdb/testsuite/gdb.base/varargs.exp
+++ b/gdb/testsuite/gdb.base/varargs.exp
@@ -31,10 +31,6 @@
 
 standard_testfile .c
 
-if [get_compiler_info] {
-    return -1
-}
-
 set skip_float_test [gdb_skip_float_test]
 
 set additional_flags {debug}
diff --git a/gdb/testsuite/gdb.base/volatile.exp b/gdb/testsuite/gdb.base/volatile.exp
index ae5fa3f34c2..4c56eb40fe9 100644
--- a/gdb/testsuite/gdb.base/volatile.exp
+++ b/gdb/testsuite/gdb.base/volatile.exp
@@ -39,12 +39,6 @@ if { [prepare_for_testing "failed to prepare" volatile constvars.c] } {
     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
-}
-
 #
 # set it up at a breakpoint so we can play with the variable values
 #
diff --git a/gdb/testsuite/gdb.base/watch_thread_num.exp b/gdb/testsuite/gdb.base/watch_thread_num.exp
index 96bc9091080..7d4f19ddc06 100644
--- a/gdb/testsuite/gdb.base/watch_thread_num.exp
+++ b/gdb/testsuite/gdb.base/watch_thread_num.exp
@@ -29,12 +29,6 @@ if {[skip_hw_watchpoint_access_tests]} {
 
 standard_testfile .c
 
-# What compiler are we using?
-#
-if [get_compiler_info] {
-    return -1
-}
-
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     return -1
 }
diff --git a/gdb/testsuite/gdb.base/watchpoint-solib.exp b/gdb/testsuite/gdb.base/watchpoint-solib.exp
index 005f4825d1e..aa4cf0d7adb 100644
--- a/gdb/testsuite/gdb.base/watchpoint-solib.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-solib.exp
@@ -33,10 +33,6 @@ set lib_sl  [standard_output_file $libname]
 set lib_dlopen [shlib_target_file ${libname}]
 set lib_syms [shlib_symbol_file ${libname}]
 
-if [get_compiler_info] {
-    return -1
-}
-
 set lib_opts debug
 set exec_opts [list debug shlib_load additional_flags=-DSHLIB_NAME=\"${lib_dlopen}\"]
 
diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index 97dee3a72b2..01abff5336a 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -18,10 +18,6 @@
 
 standard_testfile
 
-if [get_compiler_info] {
-    return -1
-}
-
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
      untested "failed to compile"
      return -1
diff --git a/gdb/testsuite/gdb.base/watchpoints.exp b/gdb/testsuite/gdb.base/watchpoints.exp
index d364edeb550..767157ee593 100644
--- a/gdb/testsuite/gdb.base/watchpoints.exp
+++ b/gdb/testsuite/gdb.base/watchpoints.exp
@@ -20,10 +20,6 @@ standard_testfile
 
 set wp_set 1
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-print.exp b/gdb/testsuite/gdb.compile/compile-cplus-print.exp
index fd6470b28f9..67b39518b74 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-print.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus-print.exp
@@ -17,7 +17,6 @@ load_lib compile-support.exp
 
 standard_testfile
 
-get_compiler_info
 set options {}
 if [test_compiler_info gcc*] {
     lappend options additional_flags=-g3
diff --git a/gdb/testsuite/gdb.compile/compile-cplus.exp b/gdb/testsuite/gdb.compile/compile-cplus.exp
index d700d3dd165..dbdae5f8bf4 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus.exp
@@ -17,7 +17,6 @@ load_lib compile-support.exp
 
 standard_testfile .c compile-shlib.c compile-constvar.S compile-nodebug.c
 
-get_compiler_info
 set options {}
 if { [test_compiler_info gcc*] || [test_compiler_info clang*] } {
     lappend options additional_flags=-g3
diff --git a/gdb/testsuite/gdb.compile/compile-ifunc.exp b/gdb/testsuite/gdb.compile/compile-ifunc.exp
index dc7b19aabcd..4f671c6453f 100644
--- a/gdb/testsuite/gdb.compile/compile-ifunc.exp
+++ b/gdb/testsuite/gdb.compile/compile-ifunc.exp
@@ -19,7 +19,6 @@ if {[skip_ifunc_tests]} {
 
 standard_testfile
 
-get_compiler_info
 set flags ""
 if [test_compiler_info gcc*] {
     set flags additional_flags=-Wno-attribute-alias
diff --git a/gdb/testsuite/gdb.compile/compile.exp b/gdb/testsuite/gdb.compile/compile.exp
index f8d6fb123a2..f2515586c39 100644
--- a/gdb/testsuite/gdb.compile/compile.exp
+++ b/gdb/testsuite/gdb.compile/compile.exp
@@ -15,7 +15,6 @@
 
 standard_testfile .c compile-shlib.c compile-constvar.S compile-nodebug.c
 
-get_compiler_info
 set options {}
 if [test_compiler_info gcc*] {
     lappend options additional_flags=-g3
diff --git a/gdb/testsuite/gdb.cp/ambiguous.exp b/gdb/testsuite/gdb.cp/ambiguous.exp
index 63871157ce1..c6bc9a6df9f 100644
--- a/gdb/testsuite/gdb.cp/ambiguous.exp
+++ b/gdb/testsuite/gdb.cp/ambiguous.exp
@@ -23,11 +23,6 @@ if { [skip_cplus_tests] } {  return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    unsupported "couldn't find a valid c++ compiler"
-    return -1
-}
-
 set additional_flags ""
 if {[test_compiler_info {gcc-[0-9]-*}]} {
     # GCCs prior to 10.1 do not support -Wno-inaccessible-base.
diff --git a/gdb/testsuite/gdb.cp/breakpoint.exp b/gdb/testsuite/gdb.cp/breakpoint.exp
index 49bb162c7a4..1a0f946a481 100644
--- a/gdb/testsuite/gdb.cp/breakpoint.exp
+++ b/gdb/testsuite/gdb.cp/breakpoint.exp
@@ -25,10 +25,6 @@ if { [skip_cplus_tests] } { continue }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/bs15503.exp b/gdb/testsuite/gdb.cp/bs15503.exp
index 5eb3dc83e69..bf5e660a54d 100644
--- a/gdb/testsuite/gdb.cp/bs15503.exp
+++ b/gdb/testsuite/gdb.cp/bs15503.exp
@@ -21,10 +21,6 @@ if { [skip_stl_tests] } { return }
 
 standard_testfile .cc
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/casts.exp b/gdb/testsuite/gdb.cp/casts.exp
index 77ff6037fb2..0f6460bd255 100644
--- a/gdb/testsuite/gdb.cp/casts.exp
+++ b/gdb/testsuite/gdb.cp/casts.exp
@@ -29,10 +29,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc casts03.cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/class2.exp b/gdb/testsuite/gdb.cp/class2.exp
index 04f665b2251..32f9dfc18a5 100644
--- a/gdb/testsuite/gdb.cp/class2.exp
+++ b/gdb/testsuite/gdb.cp/class2.exp
@@ -18,12 +18,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc
 
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/cpexprs.exp.tcl b/gdb/testsuite/gdb.cp/cpexprs.exp.tcl
index b4ed3cda80e..55c34898daa 100644
--- a/gdb/testsuite/gdb.cp/cpexprs.exp.tcl
+++ b/gdb/testsuite/gdb.cp/cpexprs.exp.tcl
@@ -686,10 +686,6 @@ if {[skip_cplus_tests]} { continue }
 
 standard_testfile cpexprs.cc
 
-if {[get_compiler_info "c++"]} {
-    return -1
-}
-
 # Include required flags.
 set flags "$flags debug c++"
 
diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.exp b/gdb/testsuite/gdb.cp/cplusfuncs.exp
index a4da0de43e1..4824c19e818 100644
--- a/gdb/testsuite/gdb.cp/cplusfuncs.exp
+++ b/gdb/testsuite/gdb.cp/cplusfuncs.exp
@@ -20,10 +20,6 @@ if { [skip_cplus_tests] } { continue }
 
 standard_testfile .cc
 
-if { [get_compiler_info "c++"] } {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/ctti.exp b/gdb/testsuite/gdb.cp/ctti.exp
index 1011a1408d9..36b7d34c48b 100644
--- a/gdb/testsuite/gdb.cp/ctti.exp
+++ b/gdb/testsuite/gdb.cp/ctti.exp
@@ -25,10 +25,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile cttiadd.cc cttiadd1.cc cttiadd2.cc cttiadd3.cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile \
 	 [list $srcfile $srcfile2 $srcfile3 $srcfile4] {debug c++}]} {
     return -1
diff --git a/gdb/testsuite/gdb.cp/disasm-func-name.exp b/gdb/testsuite/gdb.cp/disasm-func-name.exp
index d1a93f7d2e7..7d325fe567f 100644
--- a/gdb/testsuite/gdb.cp/disasm-func-name.exp
+++ b/gdb/testsuite/gdb.cp/disasm-func-name.exp
@@ -22,10 +22,6 @@ if {[skip_cplus_tests]} { return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile \
 	 $srcfile {debug c++}]} {
     return -1
diff --git a/gdb/testsuite/gdb.cp/dispcxx.exp b/gdb/testsuite/gdb.cp/dispcxx.exp
index df931ae1b77..f82e5889321 100644
--- a/gdb/testsuite/gdb.cp/dispcxx.exp
+++ b/gdb/testsuite/gdb.cp/dispcxx.exp
@@ -17,11 +17,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    untested "couldn't find a valid c++ compiler"
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/gdb1355.exp b/gdb/testsuite/gdb.cp/gdb1355.exp
index e558f738aea..ecbf88f4bb9 100644
--- a/gdb/testsuite/gdb.cp/gdb1355.exp
+++ b/gdb/testsuite/gdb.cp/gdb1355.exp
@@ -29,10 +29,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/gdb2384.exp b/gdb/testsuite/gdb.cp/gdb2384.exp
index 34065b041d2..4181ab48119 100644
--- a/gdb/testsuite/gdb.cp/gdb2384.exp
+++ b/gdb/testsuite/gdb.cp/gdb2384.exp
@@ -28,12 +28,6 @@ standard_testfile .cc gdb2384-base.cc
 
 set sofile [standard_output_file gdb2384-base.so]
 
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if { [gdb_compile_shlib $srcdir/$subdir/$srcfile2 $sofile {debug c++}] != ""
      || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list debug "c++" shlib=${sofile}]] != ""} {
     untested "failed to compile"
diff --git a/gdb/testsuite/gdb.cp/gdb2495.exp b/gdb/testsuite/gdb.cp/gdb2495.exp
index c0c9dfd1065..1babf5e3322 100644
--- a/gdb/testsuite/gdb.cp/gdb2495.exp
+++ b/gdb/testsuite/gdb.cp/gdb2495.exp
@@ -40,12 +40,6 @@ if [target_info exists gdb,nosignals] {
 
 standard_testfile .cc
 
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 # Some targets can't do function calls, so don't even bother with this
 # test.
 if [target_info exists gdb,cannot_call_functions] {
diff --git a/gdb/testsuite/gdb.cp/infcall-dlopen.exp b/gdb/testsuite/gdb.cp/infcall-dlopen.exp
index 1eebad88579..0ca53ef872e 100644
--- a/gdb/testsuite/gdb.cp/infcall-dlopen.exp
+++ b/gdb/testsuite/gdb.cp/infcall-dlopen.exp
@@ -17,10 +17,6 @@ if {[skip_shlib_tests]} {
     return 0
 }
 
-if [get_compiler_info] {
-    return -1
-}
-
 standard_testfile .cc infcall-dlopen-lib.cc
 set libfile [standard_output_file ${testfile}.so]
 set lib_dlopen [shlib_target_file ${testfile}.so]
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d0.exp b/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d0.exp
index 806acbe850d..2b5fc1ebdbf 100644
--- a/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d0.exp
+++ b/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d0.exp
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Only test C++ if we are able.  Always use C.
-if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
+if { [skip_cplus_tests] } {
     return -1
 }
 set lang {c++}
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d1.exp b/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d1.exp
index 5bd3dec64cc..0914058a38d 100644
--- a/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d1.exp
+++ b/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d1.exp
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Only test C++ if we are able.  Always use C.
-if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
+if { [skip_cplus_tests] } {
     return -1
 }
 set lang {c++}
diff --git a/gdb/testsuite/gdb.cp/local.exp b/gdb/testsuite/gdb.cp/local.exp
index cc78770d535..140147ff723 100644
--- a/gdb/testsuite/gdb.cp/local.exp
+++ b/gdb/testsuite/gdb.cp/local.exp
@@ -31,10 +31,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-  return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/m-data.exp b/gdb/testsuite/gdb.cp/m-data.exp
index 7dae01c7ee1..f86e5fd0867 100644
--- a/gdb/testsuite/gdb.cp/m-data.exp
+++ b/gdb/testsuite/gdb.cp/m-data.exp
@@ -26,10 +26,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/m-static.exp b/gdb/testsuite/gdb.cp/m-static.exp
index 6b347e25971..979de23a44f 100644
--- a/gdb/testsuite/gdb.cp/m-static.exp
+++ b/gdb/testsuite/gdb.cp/m-static.exp
@@ -27,10 +27,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc m-static1.cc
 
-if [get_compiler_info] {
-    return -1
-}
-
 set flags [list debug c++]
 if { [test_compiler_info gcc-*] && [gcc_major_version] >= 10 } {
     # Work around PR gcc/101452.
diff --git a/gdb/testsuite/gdb.cp/mb-ctor.exp b/gdb/testsuite/gdb.cp/mb-ctor.exp
index cf22be9caa8..f5f5d9143d1 100644
--- a/gdb/testsuite/gdb.cp/mb-ctor.exp
+++ b/gdb/testsuite/gdb.cp/mb-ctor.exp
@@ -21,10 +21,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/mb-inline.exp b/gdb/testsuite/gdb.cp/mb-inline.exp
index 47a2a5dcb7c..bf74df4fee8 100644
--- a/gdb/testsuite/gdb.cp/mb-inline.exp
+++ b/gdb/testsuite/gdb.cp/mb-inline.exp
@@ -23,10 +23,6 @@ if { [skip_cplus_tests] } { continue }
 standard_testfile mb-inline1.cc mb-inline2.cc
 set hdrfile "${testfile}.h"
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile \
 	 [list $srcfile $srcfile2] {debug c++}]} {
     return -1
diff --git a/gdb/testsuite/gdb.cp/mb-templates.exp b/gdb/testsuite/gdb.cp/mb-templates.exp
index 6c988e7335e..5d4c886825e 100644
--- a/gdb/testsuite/gdb.cp/mb-templates.exp
+++ b/gdb/testsuite/gdb.cp/mb-templates.exp
@@ -21,10 +21,6 @@ if { [skip_stl_tests] } { continue }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/member-ptr.exp b/gdb/testsuite/gdb.cp/member-ptr.exp
index a01e62284a0..110497b893b 100644
--- a/gdb/testsuite/gdb.cp/member-ptr.exp
+++ b/gdb/testsuite/gdb.cp/member-ptr.exp
@@ -26,10 +26,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/method.exp b/gdb/testsuite/gdb.cp/method.exp
index 615307f1c68..9e7ee51162e 100644
--- a/gdb/testsuite/gdb.cp/method.exp
+++ b/gdb/testsuite/gdb.cp/method.exp
@@ -36,10 +36,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-  return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp
index a721ecdb0b9..95a15aa12b7 100644
--- a/gdb/testsuite/gdb.cp/namespace.exp
+++ b/gdb/testsuite/gdb.cp/namespace.exp
@@ -29,10 +29,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc namespace1.cc
 
-if [get_compiler_info c++] {
-    return -1
-}
-
 set xfail_class_types 0
 if {[test_compiler_info {gcc-[0-3]-*}]
     || [test_compiler_info {gcc-4-[0-4]-*}]} {
diff --git a/gdb/testsuite/gdb.cp/nextoverthrow.exp b/gdb/testsuite/gdb.cp/nextoverthrow.exp
index 2e6bf84fcc1..b74ef1296ed 100644
--- a/gdb/testsuite/gdb.cp/nextoverthrow.exp
+++ b/gdb/testsuite/gdb.cp/nextoverthrow.exp
@@ -18,13 +18,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc
 
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info "c++"] {
-    untested "couldn't find a valid c++ compiler"
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/nsdecl.exp b/gdb/testsuite/gdb.cp/nsdecl.exp
index 8f612807049..f35e38ea48e 100644
--- a/gdb/testsuite/gdb.cp/nsdecl.exp
+++ b/gdb/testsuite/gdb.cp/nsdecl.exp
@@ -18,10 +18,6 @@
 
 standard_testfile .cc
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/nsrecurs.exp b/gdb/testsuite/gdb.cp/nsrecurs.exp
index 94cb069ee00..c658d36fc25 100644
--- a/gdb/testsuite/gdb.cp/nsrecurs.exp
+++ b/gdb/testsuite/gdb.cp/nsrecurs.exp
@@ -16,10 +16,6 @@
 
 standard_testfile .cc
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/nsstress.exp b/gdb/testsuite/gdb.cp/nsstress.exp
index 7ae3f514c0e..c255a3557f3 100644
--- a/gdb/testsuite/gdb.cp/nsstress.exp
+++ b/gdb/testsuite/gdb.cp/nsstress.exp
@@ -18,10 +18,6 @@
 
 standard_testfile .cc
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/nsusing.exp b/gdb/testsuite/gdb.cp/nsusing.exp
index 87011e4e41a..2835207a21e 100644
--- a/gdb/testsuite/gdb.cp/nsusing.exp
+++ b/gdb/testsuite/gdb.cp/nsusing.exp
@@ -15,10 +15,6 @@
 
 standard_testfile .cc
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/pr-1023.exp b/gdb/testsuite/gdb.cp/pr-1023.exp
index f25cdb80ef2..1bb244f116b 100644
--- a/gdb/testsuite/gdb.cp/pr-1023.exp
+++ b/gdb/testsuite/gdb.cp/pr-1023.exp
@@ -26,10 +26,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/pr-1210.exp b/gdb/testsuite/gdb.cp/pr-1210.exp
index b6604575638..a5e13e3dd0b 100644
--- a/gdb/testsuite/gdb.cp/pr-1210.exp
+++ b/gdb/testsuite/gdb.cp/pr-1210.exp
@@ -25,10 +25,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/pr-574.exp b/gdb/testsuite/gdb.cp/pr-574.exp
index e13b6426902..a4d37f30fc0 100644
--- a/gdb/testsuite/gdb.cp/pr-574.exp
+++ b/gdb/testsuite/gdb.cp/pr-574.exp
@@ -28,10 +28,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 set flags [list debug c++]
 if { [test_compiler_info gcc-*] && [gcc_major_version] >= 10 } {
     # Work around PR gcc/101452.
diff --git a/gdb/testsuite/gdb.cp/pr9631.exp b/gdb/testsuite/gdb.cp/pr9631.exp
index 0bbc49aaf41..6a010ed8179 100644
--- a/gdb/testsuite/gdb.cp/pr9631.exp
+++ b/gdb/testsuite/gdb.cp/pr9631.exp
@@ -19,10 +19,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/printmethod.exp b/gdb/testsuite/gdb.cp/printmethod.exp
index be597f51a86..2a8a3bc07a2 100644
--- a/gdb/testsuite/gdb.cp/printmethod.exp
+++ b/gdb/testsuite/gdb.cp/printmethod.exp
@@ -27,10 +27,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/psmang.exp b/gdb/testsuite/gdb.cp/psmang.exp
index 9a40d307049..5751b6dc3a5 100644
--- a/gdb/testsuite/gdb.cp/psmang.exp
+++ b/gdb/testsuite/gdb.cp/psmang.exp
@@ -180,10 +180,6 @@ if { [skip_cplus_tests] } { continue }
 
 standard_testfile psmang1.cc psmang2.cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile \
 	 [list $srcfile $srcfile2] {debug c++}]} {
     return -1
diff --git a/gdb/testsuite/gdb.cp/re-set-overloaded.exp b/gdb/testsuite/gdb.cp/re-set-overloaded.exp
index 9aa8f2dc428..c64ae2f38ed 100644
--- a/gdb/testsuite/gdb.cp/re-set-overloaded.exp
+++ b/gdb/testsuite/gdb.cp/re-set-overloaded.exp
@@ -20,12 +20,6 @@ standard_testfile bool.cc .cc
 
 set sofile [standard_output_file ${testfile}.so]
 
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if { [gdb_compile_shlib $srcdir/$subdir/$srcfile2 $sofile {debug c++}] != ""
      || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list debug "c++" shlib=${sofile}]] != ""} {
     untested "failed to compile"
diff --git a/gdb/testsuite/gdb.cp/rtti.exp b/gdb/testsuite/gdb.cp/rtti.exp
index b71f44bddf2..e69c0cf7611 100644
--- a/gdb/testsuite/gdb.cp/rtti.exp
+++ b/gdb/testsuite/gdb.cp/rtti.exp
@@ -34,10 +34,6 @@ if { [skip_cplus_tests] } { return }
 
 standard_testfile rtti1.cc rtti2.cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile \
 	 [list $srcfile $srcfile2] {debug c++}]} {
     return -1
diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-casts.exp b/gdb/testsuite/gdb.cp/rvalue-ref-casts.exp
index 4351cff224b..e3b834a250a 100644
--- a/gdb/testsuite/gdb.cp/rvalue-ref-casts.exp
+++ b/gdb/testsuite/gdb.cp/rvalue-ref-casts.exp
@@ -21,10 +21,6 @@ if {[skip_cplus_tests]} { continue }
 
 standard_testfile .cc
 
-if {[get_compiler_info "c++"]} {
-    return -1
-}
-
 if {[prepare_for_testing $testfile.exp $testfile $srcfile \
     {debug c++ additional_flags="-std=gnu++11"}]} {
     return -1
diff --git a/gdb/testsuite/gdb.cp/shadow.exp b/gdb/testsuite/gdb.cp/shadow.exp
index 613aac30129..f0bfb5b476d 100644
--- a/gdb/testsuite/gdb.cp/shadow.exp
+++ b/gdb/testsuite/gdb.cp/shadow.exp
@@ -19,10 +19,6 @@
 
 standard_testfile .cc
 
-if [get_compiler_info] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/static-typedef-print.exp b/gdb/testsuite/gdb.cp/static-typedef-print.exp
index bde467fb66b..0af27dd280e 100644
--- a/gdb/testsuite/gdb.cp/static-typedef-print.exp
+++ b/gdb/testsuite/gdb.cp/static-typedef-print.exp
@@ -17,10 +17,6 @@ if { [skip_cplus_tests] } { continue }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.exp b/gdb/testsuite/gdb.cp/step-and-next-inline.exp
index 82abff3f146..8b2ad2766bc 100644
--- a/gdb/testsuite/gdb.cp/step-and-next-inline.exp
+++ b/gdb/testsuite/gdb.cp/step-and-next-inline.exp
@@ -15,11 +15,6 @@
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    unsupported "couldn't find a valid c++ compiler"
-    return -1
-}
-
 if {[test_compiler_info gcc*] && ![supports_statement_frontiers] } {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/temargs.exp b/gdb/testsuite/gdb.cp/temargs.exp
index 507068d5a68..05fd902bb83 100644
--- a/gdb/testsuite/gdb.cp/temargs.exp
+++ b/gdb/testsuite/gdb.cp/temargs.exp
@@ -32,8 +32,6 @@ if {![runto_main]} {
     return -1
 }
 
-# NOTE: prepare_for_testing calls get_compiler_info, which we need
-# for the test_compiler_info calls.
 # gcc 4.4 and earlier don't emit enough info for some of our template tests.
 set have_older_template_gcc 0
 set have_pr_41736_fixed 1
diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp
index a798054d19c..27c9bbc1c7e 100644
--- a/gdb/testsuite/gdb.cp/templates.exp
+++ b/gdb/testsuite/gdb.cp/templates.exp
@@ -21,12 +21,6 @@ if { [skip_cplus_tests] } { continue }
 
 standard_testfile .cc
 
-# Create and source the file that provides information about the compiler
-# used to compile the test case.
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 set flags [list debug c++]
 if { [test_compiler_info gcc-*] && [gcc_major_version] >= 10 } {
     # Work around PR gcc/101452.
diff --git a/gdb/testsuite/gdb.cp/try_catch.exp b/gdb/testsuite/gdb.cp/try_catch.exp
index 8e74c91760e..31fe298b10f 100644
--- a/gdb/testsuite/gdb.cp/try_catch.exp
+++ b/gdb/testsuite/gdb.cp/try_catch.exp
@@ -26,10 +26,6 @@ if { [skip_stl_tests] } { return }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/typed-enum.exp b/gdb/testsuite/gdb.cp/typed-enum.exp
index 0408e6a3cda..743a141f73c 100644
--- a/gdb/testsuite/gdb.cp/typed-enum.exp
+++ b/gdb/testsuite/gdb.cp/typed-enum.exp
@@ -19,10 +19,6 @@ if { [skip_cplus_tests] } { continue }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.cp/typedef-base.exp b/gdb/testsuite/gdb.cp/typedef-base.exp
index f58c8419aab..6dc937d5986 100644
--- a/gdb/testsuite/gdb.cp/typedef-base.exp
+++ b/gdb/testsuite/gdb.cp/typedef-base.exp
@@ -19,10 +19,6 @@ if { [skip_cplus_tests] } { continue }
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp b/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp
index 72ee46869aa..a43e36bbe68 100644
--- a/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp
+++ b/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp
@@ -31,12 +31,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
-}
-
 # Same thing with struct and union.
 gdb_test "ptype struct A" "type = struct A \{\[\r\n\]+\[ \t\]+struct B \\*foo;\[\r\n\]+\}.*" "ptype structure A"
 gdb_test "ptype struct B" "type = struct B \{\[\r\n\]+\[ \t\]+struct B \\*next;\[\r\n\]+\}.*" "ptype structure B"
diff --git a/gdb/testsuite/gdb.ctf/multi.exp b/gdb/testsuite/gdb.ctf/multi.exp
index 4ab2186d752..07fd10a884c 100644
--- a/gdb/testsuite/gdb.ctf/multi.exp
+++ b/gdb/testsuite/gdb.ctf/multi.exp
@@ -30,12 +30,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
-}
-
 # Same thing with struct and union.
 gdb_test "ptype struct A" "type = struct A \{\[\r\n\]+\[ \t\]+struct B \\*b;\[\r\n\]+\[ \t\]+struct A \\*next;\[\r\n\]+\}.*" "ptype structure A"
 gdb_test "ptype struct B" "type = struct B \{\[\r\n\]+\[ \t\]+struct C \\*c;\[\r\n\]+\[ \t\]+int \\wombat;\[\r\n\]+\}.*" "ptype structure B"
diff --git a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp
index 7914961e895..f97455feac9 100644
--- a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp
+++ b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp
@@ -24,7 +24,6 @@ if ![runto_main] {
     return -1
 }
 
-get_compiler_info
 get_debug_format
 if { [skip_inline_frame_tests] } {
     return -1
diff --git a/gdb/testsuite/gdb.fortran/library-module.exp b/gdb/testsuite/gdb.fortran/library-module.exp
index a28dc3634cc..1745360d80c 100644
--- a/gdb/testsuite/gdb.fortran/library-module.exp
+++ b/gdb/testsuite/gdb.fortran/library-module.exp
@@ -21,12 +21,6 @@ standard_testfile library-module-main.f90
 set srclibfile ${testfile}-lib.f90
 set libfile [standard_output_file ${testfile}-lib.so]
 
-# Required for -fPIC by gdb_compile_shlib.
-if { [get_compiler_info f90] } {
-   warning "Could not get compiler info"
-   return -1
-}
-
 if  { [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $libfile {debug f90}] != "" } {
     untested "failed to compile shared library"
     return -1
diff --git a/gdb/testsuite/gdb.guile/scm-type.exp b/gdb/testsuite/gdb.guile/scm-type.exp
index 996184b64b2..9582fa8ba4d 100644
--- a/gdb/testsuite/gdb.guile/scm-type.exp
+++ b/gdb/testsuite/gdb.guile/scm-type.exp
@@ -20,10 +20,6 @@ load_lib gdb-guile.exp
 
 standard_testfile
 
-if [get_compiler_info c++] {
-    return -1
-}
-
 # Build inferior to language specification.
 
 proc build_inferior {exefile lang} {
diff --git a/gdb/testsuite/gdb.mi/gdb792.exp b/gdb/testsuite/gdb.mi/gdb792.exp
index 92edb3addd6..bd6bacf6108 100644
--- a/gdb/testsuite/gdb.mi/gdb792.exp
+++ b/gdb/testsuite/gdb.mi/gdb792.exp
@@ -23,10 +23,6 @@ set MIFLAGS "-i=mi"
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""} {
   untested "failed to compile"
   return -1
diff --git a/gdb/testsuite/gdb.mi/mi-catch-load.exp b/gdb/testsuite/gdb.mi/mi-catch-load.exp
index ca2f586fae5..354168bd975 100644
--- a/gdb/testsuite/gdb.mi/mi-catch-load.exp
+++ b/gdb/testsuite/gdb.mi/mi-catch-load.exp
@@ -18,12 +18,6 @@ if {[skip_shlib_tests]} {
     return -1
 }
 
-if {[get_compiler_info]} {
-    warning "Could not get compiler info"
-    untested "no compiler info"
-    return -1
-}
-
 standard_testfile mi-catch-load.c
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug shlib_load}] != "" } {
diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
index a293444d9e6..0e77735f682 100644
--- a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
+++ b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
@@ -31,10 +31,6 @@ set lib_sl1  [standard_output_file $libfile1.sl]
 set lib_opts debug
 set exec_opts [list debug shlib=$lib_sl1 shlib_load]
 
-if {[get_compiler_info]} {
-    return -1
-}
-
 if {[gdb_compile_shlib $libsrc1 $lib_sl1 $lib_opts] != ""} {
     untested "failed to compile shared library"
     return -1
diff --git a/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp b/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp
index f19c2c15c58..e8f507f90d5 100644
--- a/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp
+++ b/gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp
@@ -25,10 +25,6 @@ if [mi_gdb_start] {
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""} {
   untested "failed to compile"
   return -1
diff --git a/gdb/testsuite/gdb.mi/mi-pending.exp b/gdb/testsuite/gdb.mi/mi-pending.exp
index d71d60620ff..cfb4a3a99f2 100644
--- a/gdb/testsuite/gdb.mi/mi-pending.exp
+++ b/gdb/testsuite/gdb.mi/mi-pending.exp
@@ -35,10 +35,6 @@ set lib_sl2  [standard_output_file $libfile2.sl]
 set lib_opts debug
 set exec_opts [list debug shlib=$lib_sl1 shlib_load]
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile_shlib $libsrc1 $lib_sl1 $lib_opts] != ""
      || [gdb_compile_shlib $libsrc2 $lib_sl2 $lib_opts] != ""} {
     untested "failed to compile shared library"
diff --git a/gdb/testsuite/gdb.mi/mi-solib.exp b/gdb/testsuite/gdb.mi/mi-solib.exp
index 88d030dde3a..37c203b04e0 100644
--- a/gdb/testsuite/gdb.mi/mi-solib.exp
+++ b/gdb/testsuite/gdb.mi/mi-solib.exp
@@ -36,10 +36,6 @@ set lib_flags [list debug]
 set srcfile_main ${srcdir}/${subdir}/$srcfile
 set bin_flags [list debug shlib=${binfile_lib}]
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
      || [gdb_compile ${srcfile_main} ${binfile} executable $bin_flags] != "" } {
   untested "failed to compile"
diff --git a/gdb/testsuite/gdb.mi/mi-var-cp.exp b/gdb/testsuite/gdb.mi/mi-var-cp.exp
index 2258b30100c..cb85b771dc7 100644
--- a/gdb/testsuite/gdb.mi/mi-var-cp.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-cp.exp
@@ -25,10 +25,6 @@ if [mi_gdb_start] {
 
 standard_testfile .cc
 
-if [get_compiler_info "c++"] {
-    return -1
-}
-
 if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""} {
   untested "failed to compile"
   return -1
diff --git a/gdb/testsuite/gdb.opt/clobbered-registers-O2.exp b/gdb/testsuite/gdb.opt/clobbered-registers-O2.exp
index b38f3642840..66ec5c85d21 100644
--- a/gdb/testsuite/gdb.opt/clobbered-registers-O2.exp
+++ b/gdb/testsuite/gdb.opt/clobbered-registers-O2.exp
@@ -20,12 +20,6 @@
 
 standard_testfile .c -2.c -3.c
 
-# What compiler are we using?
-#
-if [get_compiler_info] {
-    return -1
-}
-
 if {[prepare_for_testing "failed to prepare" $testfile \
 	 [list $srcfile $srcfile2 $srcfile3] \
 	 {debug optimize=-O2 nowarnings}]} {
diff --git a/gdb/testsuite/gdb.opt/inline-bt.exp b/gdb/testsuite/gdb.opt/inline-bt.exp
index faa7686a9b7..bfd93a85c08 100644
--- a/gdb/testsuite/gdb.opt/inline-bt.exp
+++ b/gdb/testsuite/gdb.opt/inline-bt.exp
@@ -23,7 +23,6 @@ if {[prepare_for_testing "failed to prepare" $testfile \
 
 runto_main
 
-get_compiler_info
 get_debug_format
 if { [skip_inline_frame_tests] } {
     untested "skipping inline frame tests"
diff --git a/gdb/testsuite/gdb.opt/inline-cmds.exp b/gdb/testsuite/gdb.opt/inline-cmds.exp
index 17ad83672d1..1d434bc20f6 100644
--- a/gdb/testsuite/gdb.opt/inline-cmds.exp
+++ b/gdb/testsuite/gdb.opt/inline-cmds.exp
@@ -27,7 +27,6 @@ gdb_test_no_output "set listsize 1"
 
 runto_main
 
-get_compiler_info
 get_debug_format
 if { [skip_inline_frame_tests] } {
     untested "skipping inline frame tests"
diff --git a/gdb/testsuite/gdb.opt/inline-locals.exp b/gdb/testsuite/gdb.opt/inline-locals.exp
index 68c45f0fe31..498ebb5085a 100644
--- a/gdb/testsuite/gdb.opt/inline-locals.exp
+++ b/gdb/testsuite/gdb.opt/inline-locals.exp
@@ -22,7 +22,6 @@ if {[prepare_for_testing "failed to prepare" $testfile \
 
 runto_main
 
-get_compiler_info
 get_debug_format
 if { [skip_inline_var_tests] } {
     untested inline-bt.exp
diff --git a/gdb/testsuite/gdb.opt/solib-intra-step.exp b/gdb/testsuite/gdb.opt/solib-intra-step.exp
index 1f824521556..0acda6594c5 100644
--- a/gdb/testsuite/gdb.opt/solib-intra-step.exp
+++ b/gdb/testsuite/gdb.opt/solib-intra-step.exp
@@ -30,10 +30,6 @@ set srcfile ${srcdir}/${subdir}/${testfile}.c
 set binfile [standard_output_file ${testfile}]
 set bin_flags [list debug shlib=${binfile_lib}]
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
      || [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
   untested "failed to compile"
diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp
index 2fdd2160a44..a9ababbc40c 100644
--- a/gdb/testsuite/gdb.python/py-events.exp
+++ b/gdb/testsuite/gdb.python/py-events.exp
@@ -27,10 +27,6 @@ set lib_opts  debug
 standard_testfile
 set exec_opts [list debug shlib=$lib_sl]
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
      || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} {
     untested "failed to compile"
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
index 776549cb7ed..34e0a2b9855 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
@@ -31,10 +31,6 @@ set lib_opts ""
 standard_testfile
 set exec_opts [list debug shlib=$lib_sl]
 
-if [get_compiler_info] {
-    return -1
-}
-
 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
      || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""} {
     untested "failed to compile"
diff --git a/gdb/testsuite/gdb.python/py-format-string.exp b/gdb/testsuite/gdb.python/py-format-string.exp
index 63b87e73476..9e45cbd6608 100644
--- a/gdb/testsuite/gdb.python/py-format-string.exp
+++ b/gdb/testsuite/gdb.python/py-format-string.exp
@@ -20,10 +20,6 @@ load_lib gdb-python.exp
 
 standard_testfile
 
-if [get_compiler_info c++] {
-    return -1
-}
-
 # Skip all tests if Python scripting is not enabled.
 gdb_exit
 gdb_start
diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp
index 5613bc024f6..20f5084c332 100644
--- a/gdb/testsuite/gdb.python/py-type.exp
+++ b/gdb/testsuite/gdb.python/py-type.exp
@@ -20,10 +20,6 @@ load_lib gdb-python.exp
 
 standard_testfile
 
-if [get_compiler_info c++] {
-    return -1
-}
-
 # Build inferior to language specification.
 proc build_inferior {exefile lang} {
   global srcdir subdir srcfile testfile hex
diff --git a/gdb/testsuite/gdb.reverse/solib-precsave.exp b/gdb/testsuite/gdb.reverse/solib-precsave.exp
index 096867d40a1..18179a5b03f 100644
--- a/gdb/testsuite/gdb.reverse/solib-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/solib-precsave.exp
@@ -33,10 +33,6 @@ set lib2file "shr2"
 set lib2src  ${lib2file}.c
 set library2 [standard_output_file ${lib2file}.sl]
 
-if [get_compiler_info] {
-    return -1
-}
-
 # Compile the first without debug info so that
 # stepping and reverse stepping doesn't end up inside them.
 if { [gdb_compile_shlib ${srcdir}/${subdir}/${lib1src} ${library1} ""] != "" } {
diff --git a/gdb/testsuite/gdb.reverse/solib-reverse.exp b/gdb/testsuite/gdb.reverse/solib-reverse.exp
index 1ea5679527b..3bcf2dfcb24 100644
--- a/gdb/testsuite/gdb.reverse/solib-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/solib-reverse.exp
@@ -31,10 +31,6 @@ set lib2file "shr2"
 set lib2src  ${lib2file}.c
 set library2 [standard_output_file ${lib2file}.sl]
 
-if [get_compiler_info] {
-    return -1
-}
-
 # Compile the first without debug info so that
 # stepping and reverse stepping doesn't end up inside them.
 if { [gdb_compile_shlib ${srcdir}/${subdir}/${lib1src} ${library1} ""] != "" } {
diff --git a/gdb/testsuite/gdb.server/solib-list.exp b/gdb/testsuite/gdb.server/solib-list.exp
index db549d1ce15..9c99107af4e 100644
--- a/gdb/testsuite/gdb.server/solib-list.exp
+++ b/gdb/testsuite/gdb.server/solib-list.exp
@@ -31,8 +31,7 @@ standard_testfile solib-list-main.c
 set srclibfile ${testfile}-lib.c
 set binlibfile [standard_output_file ${testfile}.so]
 
-if { [get_compiler_info]
-     || [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" "${binlibfile}" {debug}] != ""
+if { [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" "${binlibfile}" {debug}] != ""
      || [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "shlib=${binlibfile}"] != "" } {
     untested "failed to compile"
     return -1
diff --git a/gdb/testsuite/gdb.stabs/weird.exp b/gdb/testsuite/gdb.stabs/weird.exp
index 88c0d9abd48..81aca82c901 100644
--- a/gdb/testsuite/gdb.stabs/weird.exp
+++ b/gdb/testsuite/gdb.stabs/weird.exp
@@ -21,10 +21,6 @@ set testfile weird
 set srcfile [standard_output_file weird.s]
 set binfile [standard_output_file weirdx.o]
 
-if { [ get_compiler_info ] } {
-    return -1
-}
-
 proc do_tests {} {
 	global binfile
 	global gdb_prompt
diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.exp b/gdb/testsuite/gdb.threads/attach-into-signal.exp
index 11bfad4510e..96878d5e6a0 100644
--- a/gdb/testsuite/gdb.threads/attach-into-signal.exp
+++ b/gdb/testsuite/gdb.threads/attach-into-signal.exp
@@ -38,10 +38,6 @@ proc corefunc { threadtype executable } {
 	set binfile [standard_output_file $executable]
 	set escapedbinfile [string_to_regexp ${binfile}]
 
-	if [get_compiler_info] {
-	    return -1
-	}
-
 	gdb_test "handle SIGALRM stop print pass" "Yes.*Yes.*Yes.*"
 
 	set test_spawn_id [spawn_wait_for_attach $binfile]
diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
index 72a907728db..ef3617cc57d 100644
--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
@@ -40,10 +40,6 @@ proc corefunc { threadtype } {
     global subdir
     global gdb_prompt
 
-    if [get_compiler_info] {
-	return -1
-    }
-
     set test_spawn_id [spawn_wait_for_attach $binfile]
     set testpid [spawn_id_get_pid $test_spawn_id]
 
diff --git a/gdb/testsuite/gdb.threads/multiple-successive-infcall.exp b/gdb/testsuite/gdb.threads/multiple-successive-infcall.exp
index c76d366e7a2..b950107f3d0 100644
--- a/gdb/testsuite/gdb.threads/multiple-successive-infcall.exp
+++ b/gdb/testsuite/gdb.threads/multiple-successive-infcall.exp
@@ -18,10 +18,6 @@
 
 standard_testfile
 
-if [get_compiler_info] {
-  return -1
-}
-
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
   executable {debug additional_flags=-std=gnu99}] != "" } {
   return -1
diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp
index cbb4fa36070..5e31d0c77f6 100644
--- a/gdb/testsuite/gdb.trace/change-loc.exp
+++ b/gdb/testsuite/gdb.trace/change-loc.exp
@@ -34,10 +34,6 @@ set lib_sl2 [standard_output_file $libfile2.sl]
 
 set lib_opts debug
 
-if [get_compiler_info] {
-    return -1
-}
-
 # Some targets have leading underscores on assembly symbols.
 set additional_flags [list debug shlib=$lib_sl1 shlib_load [gdb_target_symbol_prefix_flags]]
 
diff --git a/gdb/testsuite/gdb.trace/strace.exp b/gdb/testsuite/gdb.trace/strace.exp
index fd6784eda38..d015381899b 100644
--- a/gdb/testsuite/gdb.trace/strace.exp
+++ b/gdb/testsuite/gdb.trace/strace.exp
@@ -25,10 +25,6 @@ set libipa [get_in_proc_agent]
 
 set lib_opts debug
 
-if [get_compiler_info] {
-    return -1
-}
-
 set additional_flags [list quiet debug shlib=$libipa shlib_load \
 			  "additional_flags=-lust -lurcu-bp" ]
 
-- 
2.25.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] gdb/testsuite: remove definition of true/false from gdb_compiler_info
  2022-06-09 18:38 ` [PATCH 1/3] gdb/testsuite: remove definition of true/false from gdb_compiler_info Andrew Burgess
@ 2022-06-10  7:14   ` Tom de Vries
  2022-06-10 10:06     ` Andrew Burgess
  0 siblings, 1 reply; 7+ messages in thread
From: Tom de Vries @ 2022-06-10  7:14 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches

On 6/9/22 20:38, Andrew Burgess via Gdb-patches wrote:
> Since pretty much forever the get_compiler_info function has included
> these lines:
> 
>      # Most compilers will evaluate comparisons and other boolean
>      # operations to 0 or 1.
>      uplevel \#0 { set true 1 }
>      uplevel \#0 { set false 0 }
> 
> These define global variables true (to 1) and false (to 0).
> 
> It seems odd to me that these globals are defined in
> get_compiler_info, I guess maybe the original thinking was that if a
> compiler had different true/false values then we would detect it there
> and define true/false differently.
> 
> I don't think we should be bundling this logic into get_compiler_info,
> it seems weird to me that in order to use $true/$false a user needs to
> first call get_compiler_info.
> 
> It would be better I think if each test script that wants these
> variables just defined them itself, if in the future we did need
> different true/false values based on compiler version then we'd just
> do:
> 
>    if { [test_compiler_info "some_pattern"] } {
>      # Defined true/false one way...
>    } else {
>      # Defined true/false another way...
>    }
> 
> But given the current true/false definitions have been in place since
> at least 1999, I suspect this will not be needed any time soon.
> 
> Given that the definitions of true/false are so simple, right now my
> suggestion is just to define them in each test script that wants
> them (there's not that many).  If we ever did need more complex logic
> then we can always add a function in gdb.exp that sets up these
> globals, but that seems overkill for now.
> 
> There should be no change in what is tested after this commit.

LGTM, and AFAIU should fix the ERROR I reported here ( 
https://sourceware.org/pipermail/gdb-patches/2022-June/189977.html ).

Thanks,
- Tom

> ---
>   gdb/testsuite/gdb.base/all-bin.exp    | 4 ++++
>   gdb/testsuite/gdb.base/eval-skip.exp  | 3 +++
>   gdb/testsuite/gdb.base/exprs.exp      | 4 ++++
>   gdb/testsuite/gdb.base/miscexprs.exp  | 3 +++
>   gdb/testsuite/gdb.base/pointers.exp   | 4 ++++
>   gdb/testsuite/gdb.base/relational.exp | 4 ++++
>   gdb/testsuite/lib/gdb.exp             | 5 -----
>   7 files changed, 22 insertions(+), 5 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.base/all-bin.exp b/gdb/testsuite/gdb.base/all-bin.exp
> index 5d493e6d6fc..1f481210e19 100644
> --- a/gdb/testsuite/gdb.base/all-bin.exp
> +++ b/gdb/testsuite/gdb.base/all-bin.exp
> @@ -46,6 +46,10 @@ if ![runto_main] then {
>       return
>   }
>   
> +# These are used as expected result values.
> +set false 0
> +set true 1
> +
>   gdb_test "next" "return 0;" "continuing after dummy()"
>   
>   gdb_test "print v_int+v_char" " = 71" "print value of v_int+v_char"
> diff --git a/gdb/testsuite/gdb.base/eval-skip.exp b/gdb/testsuite/gdb.base/eval-skip.exp
> index 218aaab476c..81b37d1a891 100644
> --- a/gdb/testsuite/gdb.base/eval-skip.exp
> +++ b/gdb/testsuite/gdb.base/eval-skip.exp
> @@ -51,6 +51,9 @@ if ![runto_main] then {
>       return
>   }
>   
> +# This is used as an expected result value.
> +set false 0
> +
>   gdb_test_no_output "set variable x=14" "set variable x=14"
>   gdb_test_no_output "set variable y=2" "set variable y=2"
>   gdb_test_no_output "set variable z=2" "set variable z=2"
> diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp
> index 83bc60aa610..dfe0ec93737 100644
> --- a/gdb/testsuite/gdb.base/exprs.exp
> +++ b/gdb/testsuite/gdb.base/exprs.exp
> @@ -41,6 +41,10 @@ if ![runto_main] then {
>       return
>   }
>   
> +# These are used as expected result values.
> +set false 0
> +set true 1
> +
>   proc test_expr { args } {
>       if { [llength $args] % 2 } {
>   	warning "an even # of arguments should be passed to test_expr"
> diff --git a/gdb/testsuite/gdb.base/miscexprs.exp b/gdb/testsuite/gdb.base/miscexprs.exp
> index cac8cf2ce87..f633d143b6f 100644
> --- a/gdb/testsuite/gdb.base/miscexprs.exp
> +++ b/gdb/testsuite/gdb.base/miscexprs.exp
> @@ -59,6 +59,9 @@ if ![runto_main] then {
>       return
>   }
>   
> +# This is used as an expected result value.
> +set false 0
> +
>   gdb_test "break marker1" ".*" ""
>   
>   gdb_test "cont" \
> diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp
> index e6406613318..586f85a4947 100644
> --- a/gdb/testsuite/gdb.base/pointers.exp
> +++ b/gdb/testsuite/gdb.base/pointers.exp
> @@ -48,6 +48,10 @@ if ![runto_main] then {
>       return
>   }
>   
> +# These are used as expected result values.
> +set false 0
> +set true 1
> +
>   gdb_test "next " "more_code.*;" "continuing after dummy()"
>   
>   
> diff --git a/gdb/testsuite/gdb.base/relational.exp b/gdb/testsuite/gdb.base/relational.exp
> index 858398323cd..87ccb9f3fe7 100644
> --- a/gdb/testsuite/gdb.base/relational.exp
> +++ b/gdb/testsuite/gdb.base/relational.exp
> @@ -42,6 +42,10 @@ if ![runto_main] then {
>       return
>   }
>   
> +# These are used as expected result values.
> +set false 0
> +set true 1
> +
>   #
>   # test expressions with "int" types
>   #
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 37accd9947a..75efc4a62d1 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -4191,11 +4191,6 @@ proc get_compiler_info {{language "c"}} {
>       # Log what happened.
>       verbose -log "get_compiler_info: $compiler_info"
>   
> -    # Most compilers will evaluate comparisons and other boolean
> -    # operations to 0 or 1.
> -    uplevel \#0 { set true 1 }
> -    uplevel \#0 { set false 0 }
> -
>       return 0
>   }
>   

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] gdb/testsuite: remove definition of true/false from gdb_compiler_info
  2022-06-10  7:14   ` Tom de Vries
@ 2022-06-10 10:06     ` Andrew Burgess
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Burgess @ 2022-06-10 10:06 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:

> On 6/9/22 20:38, Andrew Burgess via Gdb-patches wrote:
>> Since pretty much forever the get_compiler_info function has included
>> these lines:
>> 
>>      # Most compilers will evaluate comparisons and other boolean
>>      # operations to 0 or 1.
>>      uplevel \#0 { set true 1 }
>>      uplevel \#0 { set false 0 }
>> 
>> These define global variables true (to 1) and false (to 0).
>> 
>> It seems odd to me that these globals are defined in
>> get_compiler_info, I guess maybe the original thinking was that if a
>> compiler had different true/false values then we would detect it there
>> and define true/false differently.
>> 
>> I don't think we should be bundling this logic into get_compiler_info,
>> it seems weird to me that in order to use $true/$false a user needs to
>> first call get_compiler_info.
>> 
>> It would be better I think if each test script that wants these
>> variables just defined them itself, if in the future we did need
>> different true/false values based on compiler version then we'd just
>> do:
>> 
>>    if { [test_compiler_info "some_pattern"] } {
>>      # Defined true/false one way...
>>    } else {
>>      # Defined true/false another way...
>>    }
>> 
>> But given the current true/false definitions have been in place since
>> at least 1999, I suspect this will not be needed any time soon.
>> 
>> Given that the definitions of true/false are so simple, right now my
>> suggestion is just to define them in each test script that wants
>> them (there's not that many).  If we ever did need more complex logic
>> then we can always add a function in gdb.exp that sets up these
>> globals, but that seems overkill for now.
>> 
>> There should be no change in what is tested after this commit.
>
> LGTM, and AFAIU should fix the ERROR I reported here ( 
> https://sourceware.org/pipermail/gdb-patches/2022-June/189977.html ).

Thanks.

As this fixes an existing regression I've gone ahead and pushed this
first patch.  I'll leave the other patches a bit longer to give folk a
chance to review them.

Thanks,
Andrew


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] Further cleanup of get_compiler_info
  2022-06-09 18:38 [PATCH 0/3] Further cleanup of get_compiler_info Andrew Burgess
                   ` (2 preceding siblings ...)
  2022-06-09 18:38 ` [PATCH 3/3] gdb/testsuite: remove unneeded calls to get_compiler_info Andrew Burgess
@ 2022-06-24 14:08 ` Andrew Burgess
  3 siblings, 0 replies; 7+ messages in thread
From: Andrew Burgess @ 2022-06-24 14:08 UTC (permalink / raw)
  To: gdb-patches

Andrew Burgess <aburgess@redhat.com> writes:

> While working on the recent updates to get_compiler_info, I spotted
> some additional things that could be improved.

I've gone ahead and pushed all the patches in this series (patch #1 was
pushed a while ago).

Thanks,
Andrew


>
> Thoughts?
>
> Thanks,
> Andrew
>
> ---
>
> Andrew Burgess (3):
>   gdb/testsuite: remove definition of true/false from gdb_compiler_info
>   gdb/testsuite: remove global gcc_compiled from gdb.exp
>   gdb/testsuite: remove unneeded calls to get_compiler_info
>
>  gdb/testsuite/gdb.ada/array_of_variant.exp    |  3 ---
>  gdb/testsuite/gdb.ada/arrayidx.exp            |  3 ---
>  gdb/testsuite/gdb.ada/big_packed_array.exp    |  3 ---
>  gdb/testsuite/gdb.ada/null_array.exp          |  4 ---
>  gdb/testsuite/gdb.arch/altivec-abi.exp        |  5 ----
>  gdb/testsuite/gdb.arch/altivec-regs.exp       |  5 ----
>  gdb/testsuite/gdb.arch/amd64-byte.exp         |  4 ---
>  gdb/testsuite/gdb.arch/amd64-dword.exp        |  4 ---
>  gdb/testsuite/gdb.arch/amd64-word.exp         |  4 ---
>  gdb/testsuite/gdb.arch/i386-avx.exp           |  4 ---
>  gdb/testsuite/gdb.arch/i386-byte.exp          |  4 ---
>  gdb/testsuite/gdb.arch/i386-sse.exp           |  4 ---
>  gdb/testsuite/gdb.arch/i386-word.exp          |  4 ---
>  gdb/testsuite/gdb.arch/ppc-dfp.exp            |  5 ----
>  gdb/testsuite/gdb.arch/ppc-fp.exp             |  5 ----
>  gdb/testsuite/gdb.arch/s390-multiarch.exp     |  4 ---
>  gdb/testsuite/gdb.arch/vsx-regs.exp           |  5 ----
>  gdb/testsuite/gdb.arch/vsx-vsr-float28.exp    |  5 ----
>  gdb/testsuite/gdb.base/align-c++.exp          |  2 +-
>  gdb/testsuite/gdb.base/all-bin.exp            |  8 +++---
>  gdb/testsuite/gdb.base/annota1.exp            |  2 +-
>  gdb/testsuite/gdb.base/attach.exp             |  4 ---
>  gdb/testsuite/gdb.base/break-interp.exp       |  4 ---
>  .../gdb.base/break-on-linker-gcd-function.exp |  4 ---
>  gdb/testsuite/gdb.base/call-ar-st.exp         |  4 ---
>  gdb/testsuite/gdb.base/call-rt-st.exp         |  9 -------
>  gdb/testsuite/gdb.base/call-sc.exp            |  6 -----
>  gdb/testsuite/gdb.base/catch-load.exp         |  6 -----
>  gdb/testsuite/gdb.base/completion.exp         |  4 ---
>  gdb/testsuite/gdb.base/complex.exp            |  4 ---
>  gdb/testsuite/gdb.base/condbreak.exp          |  4 ---
>  gdb/testsuite/gdb.base/consecutive.exp        |  4 ---
>  gdb/testsuite/gdb.base/constvars.exp          |  6 -----
>  gdb/testsuite/gdb.base/corefile.exp           |  6 -----
>  gdb/testsuite/gdb.base/ctf-ptype.exp          |  9 +++----
>  gdb/testsuite/gdb.base/dprintf-pending.exp    |  4 ---
>  gdb/testsuite/gdb.base/eval-skip.exp          |  7 +++---
>  gdb/testsuite/gdb.base/expand-psymtabs.exp    |  5 ----
>  gdb/testsuite/gdb.base/exprs.exp              |  8 +++---
>  gdb/testsuite/gdb.base/fileio.exp             |  7 ------
>  gdb/testsuite/gdb.base/fixsection.exp         |  4 ---
>  gdb/testsuite/gdb.base/funcargs.exp           |  8 ++----
>  gdb/testsuite/gdb.base/gdb11530.exp           |  5 ----
>  gdb/testsuite/gdb.base/gdb1555.exp            |  5 ----
>  gdb/testsuite/gdb.base/gnu-ifunc.exp          |  4 ---
>  .../gdb.base/hbreak-in-shr-unsupported.exp    |  4 ---
>  .../gdb.base/infcall-nested-structs-c++.exp   |  2 +-
>  gdb/testsuite/gdb.base/info-fun.exp           |  4 ---
>  gdb/testsuite/gdb.base/info-types-c++.exp     |  2 +-
>  .../infoline-reloc-main-from-zero.exp         |  4 ---
>  gdb/testsuite/gdb.base/jit-elf-fork.exp       |  5 ----
>  gdb/testsuite/gdb.base/jit-elf-so.exp         |  5 ----
>  gdb/testsuite/gdb.base/jit-elf.exp            |  5 ----
>  gdb/testsuite/gdb.base/jit-reader.exp         |  6 -----
>  gdb/testsuite/gdb.base/langs.exp              |  9 ++-----
>  gdb/testsuite/gdb.base/list.exp               |  6 -----
>  gdb/testsuite/gdb.base/logical.exp            |  4 ---
>  gdb/testsuite/gdb.base/long_long.exp          |  6 -----
>  gdb/testsuite/gdb.base/longjmp.exp            |  4 ---
>  gdb/testsuite/gdb.base/max-depth-c++.exp      |  2 +-
>  gdb/testsuite/gdb.base/mips_pro.exp           |  7 ------
>  gdb/testsuite/gdb.base/miscexprs.exp          |  7 +++---
>  gdb/testsuite/gdb.base/morestack.exp          |  9 +++----
>  gdb/testsuite/gdb.base/nodebug.exp            |  4 ---
>  gdb/testsuite/gdb.base/opaque.exp             | 10 +++-----
>  gdb/testsuite/gdb.base/pc-fp.exp              |  4 ---
>  gdb/testsuite/gdb.base/pending.exp            |  4 ---
>  gdb/testsuite/gdb.base/permissions.exp        |  4 ---
>  gdb/testsuite/gdb.base/pointers.exp           |  8 +++---
>  gdb/testsuite/gdb.base/prelink.exp            |  7 ++----
>  gdb/testsuite/gdb.base/print-file-var.exp     |  2 +-
>  gdb/testsuite/gdb.base/printcmds.exp          |  2 --
>  gdb/testsuite/gdb.base/psym-external-decl.exp |  1 -
>  gdb/testsuite/gdb.base/psymtab.exp            |  6 -----
>  gdb/testsuite/gdb.base/ptype.exp              |  7 ++----
>  gdb/testsuite/gdb.base/relational.exp         |  8 +++---
>  gdb/testsuite/gdb.base/scope.exp              |  6 -----
>  gdb/testsuite/gdb.base/setvar.exp             |  8 +-----
>  gdb/testsuite/gdb.base/shlib-call.exp         |  4 ---
>  gdb/testsuite/gdb.base/shreloc.exp            |  4 ---
>  gdb/testsuite/gdb.base/signals.exp            |  6 -----
>  gdb/testsuite/gdb.base/sizeof.exp             |  4 ---
>  gdb/testsuite/gdb.base/so-impl-ld.exp         |  4 ---
>  gdb/testsuite/gdb.base/solib-disc.exp         |  4 ---
>  gdb/testsuite/gdb.base/solib-display.exp      |  4 ---
>  gdb/testsuite/gdb.base/solib-nodir.exp        |  3 +--
>  gdb/testsuite/gdb.base/solib-overlap.exp      |  4 ---
>  gdb/testsuite/gdb.base/solib-search.exp       |  7 ------
>  gdb/testsuite/gdb.base/solib-symbol.exp       |  4 ---
>  gdb/testsuite/gdb.base/solib-weak.exp         |  4 ---
>  gdb/testsuite/gdb.base/store.exp              |  4 ---
>  gdb/testsuite/gdb.base/structs.exp            |  7 ------
>  gdb/testsuite/gdb.base/structs2.exp           |  6 -----
>  gdb/testsuite/gdb.base/sym-file.exp           |  4 ---
>  .../gdb.base/symtab-search-order.exp          |  4 ---
>  gdb/testsuite/gdb.base/type-opaque.exp        |  5 ----
>  gdb/testsuite/gdb.base/unload.exp             |  4 ---
>  .../gdb.base/until-trailing-insns.exp         |  6 +----
>  gdb/testsuite/gdb.base/varargs.exp            |  4 ---
>  gdb/testsuite/gdb.base/volatile.exp           |  6 -----
>  gdb/testsuite/gdb.base/watch_thread_num.exp   |  6 -----
>  gdb/testsuite/gdb.base/watchpoint-solib.exp   |  4 ---
>  gdb/testsuite/gdb.base/watchpoint.exp         |  4 ---
>  gdb/testsuite/gdb.base/watchpoints.exp        |  4 ---
>  gdb/testsuite/gdb.base/whatis.exp             |  3 +++
>  .../gdb.compile/compile-cplus-print.exp       |  1 -
>  gdb/testsuite/gdb.compile/compile-cplus.exp   |  1 -
>  gdb/testsuite/gdb.compile/compile-ifunc.exp   |  1 -
>  gdb/testsuite/gdb.compile/compile.exp         |  1 -
>  gdb/testsuite/gdb.cp/ambiguous.exp            |  5 ----
>  gdb/testsuite/gdb.cp/breakpoint.exp           |  4 ---
>  gdb/testsuite/gdb.cp/bs15503.exp              |  4 ---
>  gdb/testsuite/gdb.cp/casts.exp                |  4 ---
>  gdb/testsuite/gdb.cp/class2.exp               |  6 -----
>  gdb/testsuite/gdb.cp/cpexprs.exp.tcl          |  4 ---
>  gdb/testsuite/gdb.cp/cplusfuncs.exp           |  4 ---
>  gdb/testsuite/gdb.cp/ctti.exp                 |  4 ---
>  gdb/testsuite/gdb.cp/disasm-func-name.exp     |  4 ---
>  gdb/testsuite/gdb.cp/dispcxx.exp              |  5 ----
>  gdb/testsuite/gdb.cp/gdb1355.exp              |  4 ---
>  gdb/testsuite/gdb.cp/gdb2384.exp              |  6 -----
>  gdb/testsuite/gdb.cp/gdb2495.exp              |  6 -----
>  gdb/testsuite/gdb.cp/infcall-dlopen.exp       |  4 ---
>  .../gdb.cp/infcall-nodebug-c++-d0.exp         |  2 +-
>  .../gdb.cp/infcall-nodebug-c++-d1.exp         |  2 +-
>  gdb/testsuite/gdb.cp/local.exp                |  4 ---
>  gdb/testsuite/gdb.cp/m-data.exp               |  4 ---
>  gdb/testsuite/gdb.cp/m-static.exp             |  4 ---
>  gdb/testsuite/gdb.cp/mb-ctor.exp              |  4 ---
>  gdb/testsuite/gdb.cp/mb-inline.exp            |  4 ---
>  gdb/testsuite/gdb.cp/mb-templates.exp         |  4 ---
>  gdb/testsuite/gdb.cp/member-ptr.exp           |  4 ---
>  gdb/testsuite/gdb.cp/method.exp               |  4 ---
>  gdb/testsuite/gdb.cp/namespace.exp            |  4 ---
>  gdb/testsuite/gdb.cp/nextoverthrow.exp        |  7 ------
>  gdb/testsuite/gdb.cp/nsdecl.exp               |  4 ---
>  gdb/testsuite/gdb.cp/nsrecurs.exp             |  4 ---
>  gdb/testsuite/gdb.cp/nsstress.exp             |  4 ---
>  gdb/testsuite/gdb.cp/nsusing.exp              |  4 ---
>  gdb/testsuite/gdb.cp/pr-1023.exp              |  4 ---
>  gdb/testsuite/gdb.cp/pr-1210.exp              |  4 ---
>  gdb/testsuite/gdb.cp/pr-574.exp               |  4 ---
>  gdb/testsuite/gdb.cp/pr9631.exp               |  4 ---
>  gdb/testsuite/gdb.cp/printmethod.exp          |  4 ---
>  gdb/testsuite/gdb.cp/psmang.exp               |  4 ---
>  gdb/testsuite/gdb.cp/re-set-overloaded.exp    |  6 -----
>  gdb/testsuite/gdb.cp/rtti.exp                 |  4 ---
>  gdb/testsuite/gdb.cp/rvalue-ref-casts.exp     |  4 ---
>  gdb/testsuite/gdb.cp/shadow.exp               |  4 ---
>  gdb/testsuite/gdb.cp/static-typedef-print.exp |  4 ---
>  gdb/testsuite/gdb.cp/step-and-next-inline.exp |  5 ----
>  gdb/testsuite/gdb.cp/temargs.exp              |  2 --
>  gdb/testsuite/gdb.cp/templates.exp            |  6 -----
>  gdb/testsuite/gdb.cp/try_catch.exp            |  4 ---
>  gdb/testsuite/gdb.cp/typed-enum.exp           |  4 ---
>  gdb/testsuite/gdb.cp/typedef-base.exp         |  4 ---
>  gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp     |  6 -----
>  gdb/testsuite/gdb.ctf/funcreturn.exp          |  9 +++----
>  gdb/testsuite/gdb.ctf/multi.exp               |  6 -----
>  .../gdb.dwarf2/break-inline-psymtab.exp       |  1 -
>  .../gdb.dwarf2/dw2-disasm-over-non-stmt.exp   |  5 +---
>  .../gdb.dwarf2/dw2-inline-header-1.exp        |  5 +---
>  .../gdb.dwarf2/dw2-inline-header-2.exp        |  5 +---
>  .../gdb.dwarf2/dw2-inline-header-3.exp        |  5 +---
>  .../gdb.dwarf2/dw2-inline-many-frames.exp     |  5 +---
>  .../gdb.dwarf2/dw2-inline-small-func.exp      |  5 +---
>  .../gdb.dwarf2/dw2-inline-stepping.exp        |  5 +---
>  gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp    |  5 +---
>  gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp      |  5 +---
>  .../gdb.dwarf2/dw2-line-number-zero.exp       |  5 +---
>  .../gdb.dwarf2/dw2-main-no-line-number.exp    |  5 +---
>  .../dw2-out-of-range-end-of-seq.exp           |  5 +---
>  gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp  |  5 +---
>  gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp  |  5 +---
>  .../gdb.dwarf2/dw2-ranges-overlap.exp         |  5 +---
>  gdb/testsuite/gdb.dwarf2/dw2-ranges-psym.exp  |  5 +---
>  gdb/testsuite/gdb.dwarf2/dw2-ranges.exp       |  5 +---
>  .../dw2-step-out-of-function-no-stmt.exp      |  5 +---
>  .../gdb.dwarf2/dw2-vendor-extended-opcode.exp |  5 +---
>  .../gdb.dwarf2/imported-unit-bp.exp.tcl       |  5 +---
>  gdb/testsuite/gdb.fortran/library-module.exp  |  6 -----
>  gdb/testsuite/gdb.guile/scm-type.exp          |  4 ---
>  gdb/testsuite/gdb.mi/gdb792.exp               |  4 ---
>  gdb/testsuite/gdb.mi/mi-catch-load.exp        |  6 -----
>  gdb/testsuite/gdb.mi/mi-dprintf-pending.exp   |  4 ---
>  .../gdb.mi/mi-inheritance-syntax-error.exp    |  4 ---
>  gdb/testsuite/gdb.mi/mi-pending.exp           |  4 ---
>  gdb/testsuite/gdb.mi/mi-solib.exp             |  4 ---
>  gdb/testsuite/gdb.mi/mi-var-cp.exp            |  4 ---
>  .../gdb.opt/clobbered-registers-O2.exp        |  6 -----
>  gdb/testsuite/gdb.opt/inline-bt.exp           |  1 -
>  gdb/testsuite/gdb.opt/inline-cmds.exp         |  1 -
>  gdb/testsuite/gdb.opt/inline-locals.exp       |  1 -
>  gdb/testsuite/gdb.opt/solib-intra-step.exp    |  4 ---
>  gdb/testsuite/gdb.python/py-events.exp        |  4 ---
>  .../gdb.python/py-finish-breakpoint.exp       |  4 ---
>  gdb/testsuite/gdb.python/py-format-string.exp |  4 ---
>  gdb/testsuite/gdb.python/py-type.exp          |  4 ---
>  gdb/testsuite/gdb.reverse/solib-precsave.exp  |  4 ---
>  gdb/testsuite/gdb.reverse/solib-reverse.exp   |  4 ---
>  gdb/testsuite/gdb.server/solib-list.exp       |  3 +--
>  gdb/testsuite/gdb.stabs/weird.exp             |  4 ---
>  .../gdb.threads/attach-into-signal.exp        |  4 ---
>  gdb/testsuite/gdb.threads/attach-stopped.exp  |  4 ---
>  .../multiple-successive-infcall.exp           |  4 ---
>  gdb/testsuite/gdb.threads/tls-shared.exp      |  6 -----
>  gdb/testsuite/gdb.threads/tls-so_extern.exp   |  6 -----
>  gdb/testsuite/gdb.trace/change-loc.exp        |  4 ---
>  gdb/testsuite/gdb.trace/strace.exp            |  4 ---
>  gdb/testsuite/lib/compiler.c                  |  3 ---
>  gdb/testsuite/lib/gdb.exp                     | 25 ++++++-------------
>  211 files changed, 85 insertions(+), 896 deletions(-)
>
> -- 
> 2.25.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-06-24 14:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09 18:38 [PATCH 0/3] Further cleanup of get_compiler_info Andrew Burgess
2022-06-09 18:38 ` [PATCH 1/3] gdb/testsuite: remove definition of true/false from gdb_compiler_info Andrew Burgess
2022-06-10  7:14   ` Tom de Vries
2022-06-10 10:06     ` Andrew Burgess
2022-06-09 18:38 ` [PATCH 2/3] gdb/testsuite: remove global gcc_compiled from gdb.exp Andrew Burgess
2022-06-09 18:38 ` [PATCH 3/3] gdb/testsuite: remove unneeded calls to get_compiler_info Andrew Burgess
2022-06-24 14:08 ` [PATCH 0/3] Further cleanup of get_compiler_info Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).