OSDN Git Service

Update Copyright years for files modified in 2008 and/or 2009.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / lib / c-compat.exp
1 # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008
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 # Please email any bugs, comments, and/or additions to this file to:
19 # gcc-patches@gcc.gnu.org
20
21 # Globals.
22
23 global compat_use_alt
24 global compat_same_alt
25 global compat_have_dfp
26 global compat_skip_list
27
28 # This file defines procs for determining features supported by both C
29 # compilers for compatibility tests.
30
31 load_lib target-supports.exp
32
33 #
34 # compat-use-alt-compiler -- make the alternate compiler the default
35
36 proc compat-use-alt-compiler { } {
37     global GCC_UNDER_TEST ALT_CC_UNDER_TEST
38     global compat_same_alt
39
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
44     }
45 }
46
47 #
48 # compat-use-tst-compiler -- make compiler under test the default
49 #
50 proc compat-use-tst-compiler { } {
51     global GCC_UNDER_TEST compat_save_gcc_under_test
52     global compat_same_alt
53
54     # We don't need to do this if the alternate compiler is actually
55     # the same as the compiler under test.
56
57     if { $compat_same_alt == 0 } then {
58         set GCC_UNDER_TEST $compat_save_gcc_under_test
59     }
60 }
61
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
67
68     verbose "compat_setup_dfp: $compat_use_alt $compat_same_alt" 2
69
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
74
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
81     }
82
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"
88     }
89 }
90
91 # If either compiler does not support decimal float types, skip this test.
92
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"]
98     }
99 }