1 # Copyright (C) 1997 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 2 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 this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gcc@prep.ai.mit.edu
20 # Define gcc callbacks for dg.exp.
24 proc gcc-dg-test { prog do_what extra_tool_flags } {
25 # Set up the compiler flags, based on what we're going to do.
29 set compile_type "preprocess"
30 set output_file "[file rootname [file tail $prog]].i"
33 set compile_type "object"
34 set output_file "[file rootname [file tail $prog]].s"
37 set compile_type "assembly"
38 set output_file "[file rootname [file tail $prog]].o"
41 set compile_type "executable"
42 set output_file "a.out"
43 # The following line is needed for targets like the i960 where
44 # the default output file is b.out. Sigh.
47 set compile_type "executable"
48 # FIXME: "./" is to cope with "." not being in $PATH.
49 # Should this be handled elsewhere?
51 set output_file "./a.out"
52 # This is the only place where we care if an executable was
53 # created or not. If it was, dg.exp will try to run it.
54 remote_file build delete $output_file;
57 perror "$do_what: not a valid dg-do keyword"
62 if { $extra_tool_flags != "" } {
63 lappend options "additional_flags=$extra_tool_flags"
66 set comp_output [gcc_target_compile "$prog" "$output_file" "$compile_type" $options];
68 return [list $comp_output $output_file]
72 proc gcc-dg-prune { system text } {
73 set text [prune_gcc_output $text]
75 # If we see "region xxx is full" then the testcase is too big for ram.
76 # This is tricky to deal with in a large testsuite like c-torture so
77 # deal with it here. Just mark the testcase as unsupported.
78 if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $text] {
79 # The format here is important. See dg.exp.
80 return "::unsupported::memory full"