1 # Copyright
(C
) 2009-2014 Free Software Foundation
, Inc.
3 # This
program is free software
; you can redistribute it and
/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation
; either version
3 of the License
, or
6 #
(at your option
) any later version.
8 # This
program is distributed in the hope that it will be useful
,
9 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License
for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with GCC
; see the file COPYING3.
If not see
15 #
<http
://www.gnu.org
/licenses
/>.
17 # We
set LC_ALL and LANG to C so that we
get the same error messages as expected.
21 # Many hosts now default to a non
-ASCII C locale
, however
, so
22 # they can
set a
charset encoding here
if they need.
23 if { [ishost
"*-*-cygwin*"] } {
28 # Run the LANGUAGE compiler with GCC_OPTIONS and inspect the compiler
29 # output to make sure that they match the newline
-separated patterns
30 # in COMPILER_PATTERNS but not the patterns in COMPILER_NON_PATTERNS.
31 # In case of failure
, xfail
if XFAIL is nonempty.
33 proc check_for_options
{language gcc_options compiler_patterns compiler_non_patterns expected_failure
} {
34 set filename test
-[pid
]
35 set fd
[open $filename.c w
]
36 puts $fd
"int main (void) { return 0; }"
38 remote_download host $filename.c
40 set test
"compiler driver $gcc_options option(s):"
41 set gcc_options
"\{additional_flags=$gcc_options\}"
44 "c" { set compiler cc1 }
45 default
{ error
"unknown language" }
47 set gcc_output
[gcc_target_compile $filename.c $filename.x executable $gcc_options
]
48 remote_file build
delete $filename.c $filename.x $filename.gcno
50 foreach pattern
[split $compiler_patterns
"\n"] {
52 if {[regexp
-- "$pattern" $gcc_output]} {
55 if {$expected_failure
!= ""} {
56 xfail
"$test $pattern"
63 foreach pattern
[split $compiler_non_patterns
"\n"] {
65 if {![regexp
-- "$pattern" $gcc_output]} {
68 if {$expected_failure
!= ""} {
69 xfail
"$test $pattern"