From 29b871ec5e1da82a58a6f58b575395dd07ff0050 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Thu, 11 May 2017 13:09:42 +0000 Subject: [PATCH] scanlang.exp: New. * lib/scanlang.exp: New. * lib/gcc-dg.exp: Load scanlang.exp. * g++.dg/inherit/covariant7.C: Use scan-lang-dump. From-SVN: r247904 --- gcc/testsuite/ChangeLog | 6 ++++ gcc/testsuite/g++.dg/inherit/covariant7.C | 16 ++++----- gcc/testsuite/lib/gcc-dg.exp | 1 + gcc/testsuite/lib/scanlang.exp | 43 +++++++++++++++++++++++ 4 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/lib/scanlang.exp diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2b5f6aca067..832eba38ec0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-05-11 Nathan Sidwell + + * lib/scanlang.exp: New. + * lib/gcc-dg.exp: Load scanlang.exp. + * g++.dg/inherit/covariant7.C: Use scan-lang-dump. + 2017-05-11 Mikhail Maltsev PR testsuite/80580 diff --git a/gcc/testsuite/g++.dg/inherit/covariant7.C b/gcc/testsuite/g++.dg/inherit/covariant7.C index 7aec6fda234..b8c5c8e717e 100644 --- a/gcc/testsuite/g++.dg/inherit/covariant7.C +++ b/gcc/testsuite/g++.dg/inherit/covariant7.C @@ -36,15 +36,15 @@ struct c6 : c0, c3, c4 // f2 appears four times in the c6 vtables: // once in c1-in-c3-in-c6 - covariant, virtual base, uses c1 vcall offset and c0 vbase offset -// { dg-final { scan-tree-dump "24 .*c6::_ZTcv0_n16_v0_n12_NV2c62f2Ev" "class" { target ilp32 } } } -// { dg-final { scan-tree-dump "48 .*c6::_ZTcv0_n32_v0_n24_NV2c62f2Ev" "class" { target lp64 } } } +// { dg-final { scan-lang-dump "24 .*c6::_ZTcv0_n16_v0_n12_NV2c62f2Ev" "class" { target ilp32 } } } +// { dg-final { scan-lang-dump "48 .*c6::_ZTcv0_n32_v0_n24_NV2c62f2Ev" "class" { target lp64 } } } // once in c3-in-c6 - non-covariant, non-virtual base, calls f2 directly -// { dg-final { scan-tree-dump "28 .*c6::f2" "class" { target ilp32 } } } -// { dg-final { scan-tree-dump "56 .*c6::f2" "class" { target lp64 } } } +// { dg-final { scan-lang-dump "28 .*c6::f2" "class" { target ilp32 } } } +// { dg-final { scan-lang-dump "56 .*c6::f2" "class" { target lp64 } } } // once in c1-in-c3-in-c4-in-c6 - lost primary -// { dg-final { scan-tree-dump "80 .*0" "class" { target ilp32 } } } -// { dg-final { scan-tree-dump "160 .*0" "class" { target lp64 } } } +// { dg-final { scan-lang-dump "80 .*0" "class" { target ilp32 } } } +// { dg-final { scan-lang-dump "160 .*0" "class" { target lp64 } } } // once in c3-in-c4-in-c6 - c3 vcall offset -// { dg-final { scan-tree-dump "84 .*c6::_ZTv0_n16_NV2c62f2Ev" "class" { target ilp32 } } } -// { dg-final { scan-tree-dump "168 .*c6::_ZTv0_n32_NV2c62f2Ev" "class" { target lp64 } } } +// { dg-final { scan-lang-dump "84 .*c6::_ZTv0_n16_NV2c62f2Ev" "class" { target ilp32 } } } +// { dg-final { scan-lang-dump "168 .*c6::_ZTv0_n32_NV2c62f2Ev" "class" { target lp64 } } } diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index f4b288a05c7..82cc2214e39 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -22,6 +22,7 @@ load_lib scanasm.exp load_lib scanrtl.exp load_lib scantree.exp load_lib scanipa.exp +load_lib scanlang.exp load_lib timeout.exp load_lib timeout-dg.exp load_lib prune.exp diff --git a/gcc/testsuite/lib/scanlang.exp b/gcc/testsuite/lib/scanlang.exp new file mode 100644 index 00000000000..796214385c8 --- /dev/null +++ b/gcc/testsuite/lib/scanlang.exp @@ -0,0 +1,43 @@ +# Copyright (C) 2000-2017 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# Various utilities for scanning tree dump output, used by gcc-dg.exp and +# g++-dg.exp. + +load_lib scandump.exp + +# Utility for scanning compiler result, invoked via dg-final. +# Call pass if pattern is present, otherwise fail. +# +# Argument 0 is the regexp to match +# Argument 1 is the name of the dumped lang pass +# Argument 2 handles expected failures and the like +proc scan-lang-dump { args } { + + if { [llength $args] < 2 } { + error "scan-tree-dump: too few arguments" + return + } + if { [llength $args] > 3 } { + error "scan-tree-dump: too many arguments" + return + } + if { [llength $args] >= 3 } { + scan-dump "lang" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]l.[lindex $args 1]" [lindex $args 2] + } else { + scan-dump "lang" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]l.[lindex $args 1]" + } +} -- 2.30.2