OSDN Git Service

PR c++/60248
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / lib / objc-dg.exp
1 #   Copyright (C) 1997, 1999, 2000, 2001, 2003, 2007, 2010
2 #   Free Software Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13
14 # You should have received a copy of the GNU General Public License
15 # along with GCC; see the file COPYING3.  If not see
16 # <http://www.gnu.org/licenses/>.
17
18 load_lib gcc-dg.exp
19
20 # Define gcc callbacks for dg.exp.
21
22 proc objc-dg-test { prog do_what extra_tool_flags } {
23     return [gcc-dg-test-1 objc_target_compile $prog $do_what $extra_tool_flags]
24 }
25
26 proc objc-dg-prune { system text } {
27     return [gcc-dg-prune $system $text]
28 }
29
30 # Utility routines.
31
32 # Modified dg-runtest that can cycle through a list of optimization options
33 # as c-torture does.
34 proc objc-dg-runtest { testcases default-extra-flags } {
35     global runtests
36
37     # Some callers set torture options themselves; don't override those.
38     set existing_torture_options [torture-options-exist]
39     if { $existing_torture_options == 0 } {
40         global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
41         torture-init
42         set-torture-options $DG_TORTURE_OPTIONS [list {}] $LTO_TORTURE_OPTIONS
43     }
44     dump-torture-options
45
46     foreach test $testcases {
47         global torture_with_loops torture_without_loops
48         # If we're only testing specific files and this isn't one of
49         # them, skip it.
50         if ![runtest_file_p $runtests $test] {
51             continue
52         }
53
54         # Look for a loop within the source code - if we don't find one,
55         # don't pass -funroll[-all]-loops.
56         if [expr [search_for $test "for*("]+[search_for $test "while*("]] {
57             set option_list $torture_with_loops
58         } else {
59             set option_list $torture_without_loops
60         }
61
62         set nshort [file tail [file dirname $test]]/[file tail $test]
63
64         foreach flags $option_list {
65             # combine flags so that dg-skip & xfail will see the extras.
66             set combined_flags "$flags ${default-extra-flags}"
67             verbose "Testing $nshort, $combined_flags" 1
68             dg-test $test $combined_flags ""
69         }
70     }
71
72     if { $existing_torture_options == 0 } {
73         torture-finish
74     }
75 }