]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.misc-tests/options.exp
c.opt (Wpsabi): Use LangEnabledBy.
[thirdparty/gcc.git] / gcc / testsuite / gcc.misc-tests / options.exp
CommitLineData
23a5b65a 1# Copyright (C) 2005-2014 Free Software Foundation, Inc.
99ff9e7a
BE
2
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
cd976c16 5# the Free Software Foundation; either version 3 of the License, or
99ff9e7a
BE
6# (at your option) any later version.
7#
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.
12#
13# You should have received a copy of the GNU General Public License
cd976c16
NC
14# along with GCC; see the file COPYING3. If not see
15# <http://www.gnu.org/licenses/>.
99ff9e7a
BE
16
17# Run the LANGUAGE compiler with GCC_OPTIONS and inspect the compiler,
18# assembler and linker output (from gcc -v) to make sure that they
19# match the patterns COMPILER_PATTERN, AS_PATTERN and LD_PATTERN,
20# respectively.
21
1b1c508f 22proc check_for_all_options {language gcc_options compiler_pattern as_pattern ld_pattern} {
e4461577
BE
23 set filename test-[pid]
24 set fd [open $filename.c w]
25 puts $fd "int main (void) \{ return 0; \}"
26 close $fd
27 remote_download host $filename.c
28
99ff9e7a
BE
29 set test "compiler driver $gcc_options option(s)"
30 set gcc_options "\{additional_flags=$gcc_options -v\}"
99ff9e7a
BE
31
32 switch "$language" {
33 "c" { set compiler cc1 }
34 default { error "unknown language" }
35 }
e4461577
BE
36 set gcc_output [gcc_target_compile $filename.c $filename.x executable $gcc_options]
37 remote_file build delete $filename.c $filename.x $filename.gcno
99ff9e7a 38
7cff41e8 39 if {![regexp -- "/${compiler}(\\.exe)? -quiet.*$compiler_pattern" $gcc_output]} {
99ff9e7a
BE
40 fail "$test (compiler options)"
41 return
42 }
7cff41e8 43 if {![regexp -- " *as(\\.exe)? .*$as_pattern" $gcc_output]} {
99ff9e7a
BE
44 fail "$test (assembler options)"
45 return
46 }
7cff41e8 47 if {![regexp -- "/collect2(\\.exe)? .*$ld_pattern" $gcc_output]} {
99ff9e7a
BE
48 fail "$test (linker options)"
49 return
50 }
51 pass $test
52}
53
1b1c508f 54check_for_all_options c {--coverage} {-fprofile-arcs -ftest-coverage} {} {-lgcov}