From: Janis Johnson Date: Tue, 25 May 2004 21:04:50 +0000 (+0000) Subject: compat.exp (compat-get-options-main): New. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5ab8e5cc696c9116da67316b19d8c62abde9ed82;p=gcc.git compat.exp (compat-get-options-main): New. 2004-05-25 Janis Johnson * lib/compat.exp (compat-get-options-main): New. (compat-get-options): Remove unneeded code, warn for ignored command. (compat-execute): Check flag set by dg-require-* commands. From-SVN: r82261 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e851d6889b4..9f04f74c9de 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2004-05-25 Janis Johnson + * lib/compat.exp (compat-get-options-main): New. + (compat-get-options): Remove unneeded code, warn for ignored + command. + (compat-execute): Check flag set by dg-require-* commands. + * lib/compat.exp (compat-execute): Break up long lines. 2004-05-24 Janis Johnson diff --git a/gcc/testsuite/lib/compat.exp b/gcc/testsuite/lib/compat.exp index b2ab14961eb..b2ce2b4e3ee 100644 --- a/gcc/testsuite/lib/compat.exp +++ b/gcc/testsuite/lib/compat.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2002 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2004 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 @@ -147,22 +147,52 @@ proc compat-run { testname objlist dest optall optfile optstr } { } # -# compat-get-options -- get special tool flags to use for a source file +# compat-get-options-main -- get target requirements for a test and +# options for the primary source file and the test as a whole # -# SRC is the full patchname of the source file. +# SRC is the full pathname of the primary source file. +# +proc compat-get-options-main { src } { + # dg-options sets a variable called dg-extra-tool-flags. + set dg-extra-tool-flags "" + + # dg-require-* sets dg-do-what. + upvar dg-do-what dg-do-what + + set tmp [dg-get-options $src] + foreach op $tmp { + set cmd [lindex $op 0] + if { ![string compare "dg-options" $cmd] \ + || [string match "dg-require-*" $cmd] } { + set status [catch "$op" errmsg] + if { $status != 0 } { + perror "src: $errmsg for \"$op\"\n" + unresolved "$src: $errmsg for \"$op\"" + return + } + } elseif { ![string compare "dg-xfail-if" $cmd] } { + warning "compat.exp does not support $cmd in primary source file" + } else { + # Ignore unrecognized dg- commands, but warn about them. + warning "compat.exp does not support $cmd" + } + } + + # Return flags to use for compiling the primary source file and for + # linking. + return ${dg-extra-tool-flags} +} + +# +# compat-get-options -- get special tool flags to use for a secondary +# source file +# +# SRC is the full pathname of the source file. # The result is a list of options to use. # # This code is copied from proc dg-test in dg.exp from DejaGNU. # proc compat-get-options { src } { - # Define our own special function `unknown` so we catch spelling errors. - # But first rename the existing one so we can restore it afterwards. - catch {rename dg-save-unknown ""} - rename unknown dg-save-unknown - proc unknown { args } { - return -code error "unknown dg option: $args" - } - # dg-options sets a variable called dg-extra-tool-flags. set dg-extra-tool-flags "" @@ -181,16 +211,14 @@ proc compat-get-options { src } { unresolved "$src: $errmsg for \"$op\"" return } + } elseif { [string match "dg-require-*" $cmd] } { + warning "compat.exp does not support $cmd in secondary source files" } else { # Ignore unrecognized dg- commands, but warn about them. warning "compat.exp does not support $cmd" } } - # Restore normal error handling. - rename unknown "" - rename dg-save-unknown unknown - return ${dg-extra-tool-flags} } @@ -210,6 +238,21 @@ proc compat-execute { src1 sid use_alt } { global testcase global gluefile global compiler_conditional_xfail_data + global dg-do-what-default + + # Get extra flags for this test from the primary source file, and + # process other dg-* options that this suite supports. Warn about + # unsupported flags. + verbose "compat-execute: $src1" 1 + set dg-do-what [list ${dg-do-what-default} "" P] + set extra_flags_1 [compat-get-options-main $src1] + + # Check whether this test is supported for this target. + if { [lindex ${dg-do-what} 1 ] == "N" } { + unsupported "$src1" + verbose "$src1 not supported on this target, skipping it" 3 + return + } # Set up the names of the other source files. regsub "_main.*" $src1 "" base @@ -220,7 +263,6 @@ proc compat-execute { src1 sid use_alt } { # Use the dg-options mechanism to specify extra flags for this test. # The extra flags in each file are used to compile that file, and the # extra flags in *_main.* are also used for linking. - set extra_flags_1 [compat-get-options $src1] set extra_flags_2 [compat-get-options $src2] set compile_xfail_2 $compiler_conditional_xfail_data set extra_flags_3 [compat-get-options $src3]