[PATCH v2 1/2] gdb/testsuite: use test_compiler_info in gcc_major_version
Andrew Burgess
aburgess@redhat.com
Wed Jun 8 09:50:30 GMT 2022
Nils-Christian Kempke <nils-christian.kempke@intel.com> writes:
> The procedure gcc_major_version was earlier using the global variable
> compiler_info to retrieve gcc's major version. This is discouraged and
> (as can be read in a comment in compiler.c) compiler_info should be
> local to get_compiler_info and test_compiler_info.
>
> The preferred way of getting the compiler string is via calling
> test_compiler_info without arguments. Gcc_major_version was changed to
Lower cast 'g' in "Gcc_major_version was changed ..."
OK with this change.
Thanks,
Andrew
> do that.
> ---
> gdb/testsuite/lib/gdb.exp | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 402450152a..4ee7c1fb0a 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -4218,12 +4218,11 @@ proc test_compiler_info { {compiler ""} {language ""} } {
> # For gcc 7.5.0, the major version 7.
>
> proc gcc_major_version { } {
> - global compiler_info
> global decimal
> if { ![test_compiler_info "gcc-*"] } {
> return -1
> }
> - set res [regexp gcc-($decimal)-($decimal)- $compiler_info \
> + set res [regexp gcc-($decimal)-($decimal)- [test_compiler_info] \
> dummy_var major minor]
> if { $res != 1 } {
> return -1
> --
> 2.25.1
>
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
> Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928
More information about the Gdb-patches
mailing list