From 1b9d23d741f481cf6a6f4105d8ab5906d9098e49 Mon Sep 17 00:00:00 2001 From: hp Date: Fri, 4 Nov 2011 18:06:43 +0000 Subject: [PATCH] * lib/gcc-dg.exp (gcc_force_conventional_output): New global variable, default empty, -ffat-lto-objects for effective_target_lto. (gcc-dg-test-1): Add options from dg-final methods. * lib/scanasm.exp (scan-assembler_required_options) (scan-assembler-not_required_options): New procs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180972 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/lib/gcc-dg.exp | 21 +++++++++++++++++++++ gcc/testsuite/lib/scanasm.exp | 10 ++++++++++ 3 files changed, 39 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d0e9423..e39ed46 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2011-11-04 Hans-Peter Nilsson + + * lib/gcc-dg.exp (gcc_force_conventional_output): New global + variable, default empty, -ffat-lto-objects for effective_target_lto. + (gcc-dg-test-1): Add options from dg-final methods. + * lib/scanasm.exp (scan-assembler_required_options) + (scan-assembler-not_required_options): New procs. + 2011-10-09 Magnus Fromreide * g++.dg/cpp0x/enum21a.C: Test that enum x { y, } does diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index caa057f..d0b679d 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -73,6 +73,13 @@ if [info exists ADDITIONAL_TORTURE_OPTIONS] { } set LTO_TORTURE_OPTIONS "" + +# Some torture-options cause intermediate code output, unusable for +# testing using e.g. scan-assembler. In this variable are the options +# how to force it, when needed. +global gcc_force_conventional_output +set gcc_force_conventional_output "" + if [check_effective_target_lto] { # When having plugin test both slim and fat LTO and plugin/nonplugin # path. @@ -81,6 +88,7 @@ if [check_effective_target_lto] { { -O2 -flto -fno-use-linker-plugin -flto-partition=none } \ { -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects } ] + set gcc_force_conventional_output "-ffat-lto-objects" } else { set LTO_TORTURE_OPTIONS [list \ { -O2 -flto -flto-partition=none } \ @@ -156,6 +164,19 @@ proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } { } } + # Let { dg-final { action } } force options as returned by an + # optional proc ${action}_required_options. + upvar 2 dg-final-code finalcode + foreach x [split $finalcode "\n"] { + set finalcmd [lindex $x 0] + if { [info procs ${finalcmd}_required_options] != "" } { + set req [${finalcmd}_required_options] + if { $req != "" } { + lappend extra_tool_flags $req + } + } + } + if { $extra_tool_flags != "" } { lappend options "additional_flags=$extra_tool_flags" } diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp index 6574ab1..3ba22f9 100644 --- a/gcc/testsuite/lib/scanasm.exp +++ b/gcc/testsuite/lib/scanasm.exp @@ -85,6 +85,11 @@ proc scan-assembler { args } { dg-scan "scan-assembler" 1 $testcase $output_file $args } +proc scan-assembler_required_options { args } { + global gcc_force_conventional_output + return $gcc_force_conventional_output +} + # Check that a pattern is not present in the .s file produced by the # compiler. See dg-scan for details. @@ -96,6 +101,11 @@ proc scan-assembler-not { args } { dg-scan "scan-assembler-not" 0 $testcase $output_file $args } +proc scan-assembler-not_required_options { args } { + global gcc_force_conventional_output + return $gcc_force_conventional_output +} + # Return the scan for the assembly for hidden visibility. proc hidden-scan-for { symbol } { -- 2.7.4