From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id A548F384188D; Mon, 27 Jun 2022 10:47:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A548F384188D Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Skip gdb.fortran/namelist.exp for gfortran 4.8 X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 65067f1c2c842f001017638c4fe53613d6656263 X-Git-Newrev: 2043638bf9e8b7ea31b4cbf2c6f7299a3c27efb5 Message-Id: <20220627104742.A548F384188D@sourceware.org> Date: Mon, 27 Jun 2022 10:47:42 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2022 10:47:42 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D2043638bf9e8= b7ea31b4cbf2c6f7299a3c27efb5 commit 2043638bf9e8b7ea31b4cbf2c6f7299a3c27efb5 Author: Tom de Vries Date: Mon Jun 27 12:47:26 2022 +0200 [gdb/testsuite] Skip gdb.fortran/namelist.exp for gfortran 4.8 =20 The test-case gdb.fortran/namelist.exp uses a gfortran feature (emitting DW_TAG_namelist in the debug info) that has been supported since gfortr= an 4.9, see PR gcc/37132. =20 Skip the test for gfortran 4.8 and earlier. Do this using gcc_major_ve= rsion, and update it to be able to handle "gcc_major_version {gfortran-*} f90". =20 Tested on x86_64-linux, with gfortran 4.8.5, 7.5.0, and 12.1.1. Diff: --- gdb/testsuite/gdb.fortran/namelist.exp | 6 +++++- gdb/testsuite/lib/gdb.exp | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/gdb.fortran/namelist.exp b/gdb/testsuite/gdb.for= tran/namelist.exp index 3917f1b9adb..39cf0e17654 100644 --- a/gdb/testsuite/gdb.fortran/namelist.exp +++ b/gdb/testsuite/gdb.fortran/namelist.exp @@ -37,7 +37,11 @@ set int [fortran_int4] gdb_breakpoint [gdb_get_line_number "Display namelist"] gdb_continue_to_breakpoint "Display namelist" =20 -if { [test_compiler_info {gfortran-*} f90] } { +# DW_TAG_namelist is supported starting gcc 4.9. +set supported [expr \ + [test_compiler_info {gfortran-*} f90] \ + && [gcc_major_version {gfortran-*} f90] >=3D 4.9] +if { $supported } { gdb_test "ptype nml" \ "type =3D Type nml\r\n *$int :: a\r\n *$int :: b\r\n *End Type nml" gdb_test "print nml" \ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index efbe393f72a..141cb043fe2 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -4220,13 +4220,17 @@ proc is_c_compiler_gcc {} { # 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. +# The COMPILER and LANGUAGE arguments are as for test_compiler_info. =20 -proc gcc_major_version { } { +proc gcc_major_version { {compiler "gcc-*"} {language "c"} } { global decimal - if { ![test_compiler_info "gcc-*"] } { + if { ![test_compiler_info $compiler $language] } { return -1 } - set res [regexp gcc-($decimal)-($decimal)- [test_compiler_info] \ + # Strip "gcc-*" to "gcc". + regsub -- {-.*} $compiler "" compiler + set res [regexp $compiler-($decimal)-($decimal)- \ + [test_compiler_info "" $language] \ dummy_var major minor] if { $res !=3D 1 } { return -1