Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / lib / c-compat.exp
blobddbdd2d455ed39456f036b13ace0296a7f11ee14
1 # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008
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/>.
18 # Please email any bugs, comments, and/or additions to this file to:
19 # gcc-patches@gcc.gnu.org
21 # Globals.
23 global compat_use_alt
24 global compat_same_alt
25 global compat_have_dfp
26 global compat_skip_list
28 # This file defines procs for determining features supported by both C
29 # compilers for compatibility tests.
31 load_lib target-supports.exp
34 # compat-use-alt-compiler -- make the alternate compiler the default
36 proc compat-use-alt-compiler { } {
37 global GCC_UNDER_TEST ALT_CC_UNDER_TEST
38 global compat_same_alt
40 # We don't need to do this if the alternate compiler is actually
41 # the same as the compiler under test.
42 if { $compat_same_alt == 0 } then {
43 set GCC_UNDER_TEST $ALT_CC_UNDER_TEST
48 # compat-use-tst-compiler -- make compiler under test the default
50 proc compat-use-tst-compiler { } {
51 global GCC_UNDER_TEST compat_save_gcc_under_test
52 global compat_same_alt
54 # We don't need to do this if the alternate compiler is actually
55 # the same as the compiler under test.
57 if { $compat_same_alt == 0 } then {
58 set GCC_UNDER_TEST $compat_save_gcc_under_test
62 # Find out whether both compilers support decimal float types.
63 proc compat_setup_dfp { } {
64 global compat_use_alt
65 global compat_same_alt
66 global compat_have_dfp
68 verbose "compat_setup_dfp: $compat_use_alt $compat_same_alt" 2
70 # Does the compiler under test support decimal float types?
71 compat-use-tst-compiler
72 set compat_have_dfp [check_effective_target_dfprt_nocache]
73 verbose "compat_have_dfp for tst compiler: $compat_have_dfp" 2
75 # If there is an alternate compiler, does it support decimal float types?
76 if { $compat_have_dfp == 1 && $compat_use_alt == 1 && $compat_same_alt == 0 } {
77 compat-use-alt-compiler
78 set compat_have_dfp [check_effective_target_dfprt_nocache]
79 compat-use-tst-compiler
80 verbose "compat_have_dfp for alt compiler: $compat_have_dfp" 2
83 # If decimal float is not supported, add it to the skip list, which
84 # affects code in the header files.
85 if { $compat_have_dfp == 0 } {
86 global compat_skip_list
87 lappend compat_skip_list "DECIMAL_FLOAT"
91 # If either compiler does not support decimal float types, skip this test.
93 proc dg-require-compat-dfp { args } {
94 global compat_have_dfp
95 if { $compat_have_dfp == 0 } {
96 upvar dg-do-what dg-do-what
97 set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]