1 # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2007, 2010
2 # Free Software Foundation, Inc.
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.
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.
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/>.
20 # Define gcc callbacks for dg.exp.
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]
26 proc objc-dg-prune { system text } {
27 return [gcc-dg-prune $system $text]
32 # Modified dg-runtest that can cycle through a list of optimization options
34 proc objc-dg-runtest { testcases default-extra-flags } {
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
42 set-torture-options $DG_TORTURE_OPTIONS [list {}] $LTO_TORTURE_OPTIONS
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
50 if ![runtest_file_p $runtests $test] {
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
59 set option_list $torture_without_loops
62 set nshort [file tail [file dirname $test]]/[file tail $test]
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 ""
72 if { $existing_torture_options == 0 } {