]>
Commit | Line | Data |
---|---|---|
a5544970 | 1 | # Copyright (C) 2002-2019 Free Software Foundation, Inc. |
27a2694f JJ |
2 | |
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 | |
cd976c16 | 5 | # the Free Software Foundation; either version 3 of the License, or |
27a2694f JJ |
6 | # (at your option) any later version. |
7 | # | |
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. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
cd976c16 NC |
14 | # along with GCC; see the file COPYING3. If not see |
15 | # <http://www.gnu.org/licenses/>. | |
27a2694f JJ |
16 | |
17 | # Please email any bugs, comments, and/or additions to this file to: | |
18 | # gcc-patches@gcc.gnu.org | |
19 | ||
20 | # Globals. | |
21 | ||
22 | global compat_use_alt | |
23 | global compat_same_alt | |
24 | global compat_have_dfp | |
25 | global compat_skip_list | |
26 | ||
27 | # This file defines procs for determining features supported by both C | |
28 | # compilers for compatibility tests. | |
29 | ||
30 | load_lib target-supports.exp | |
51db86a8 | 31 | load_lib target-libpath.exp |
27a2694f JJ |
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 | |
bd38d0da | 38 | global compat_same_alt compat_alt_caret compat_alt_color compat_no_line_no |
868f97d5 | 39 | global TEST_ALWAYS_FLAGS |
27a2694f JJ |
40 | |
41 | # We don't need to do this if the alternate compiler is actually | |
42 | # the same as the compiler under test. | |
43 | if { $compat_same_alt == 0 } then { | |
44 | set GCC_UNDER_TEST $ALT_CC_UNDER_TEST | |
868f97d5 JJ |
45 | if { $compat_alt_caret == 0 } then { |
46 | regsub -- "-fno-diagnostics-show-caret" $TEST_ALWAYS_FLAGS "" TEST_ALWAYS_FLAGS | |
47 | } | |
a2e836b2 JJ |
48 | if { $compat_alt_color == 0 } then { |
49 | regsub -- "-fdiagnostics-color=never" $TEST_ALWAYS_FLAGS "" TEST_ALWAYS_FLAGS | |
50 | } | |
bd38d0da IS |
51 | if { $compat_no_line_no == 0 } then { |
52 | regsub -- "-fno-diagnostics-show-line-numbers" $TEST_ALWAYS_FLAGS "" TEST_ALWAYS_FLAGS | |
53 | } | |
51db86a8 | 54 | restore_gcc_exec_prefix_env_var |
27a2694f JJ |
55 | } |
56 | } | |
57 | ||
58 | # | |
59 | # compat-use-tst-compiler -- make compiler under test the default | |
60 | # | |
61 | proc compat-use-tst-compiler { } { | |
62 | global GCC_UNDER_TEST compat_save_gcc_under_test | |
63 | global compat_same_alt | |
868f97d5 | 64 | global TEST_ALWAYS_FLAGS compat_save_TEST_ALWAYS_FLAGS |
27a2694f JJ |
65 | |
66 | # We don't need to do this if the alternate compiler is actually | |
67 | # the same as the compiler under test. | |
68 | ||
69 | if { $compat_same_alt == 0 } then { | |
70 | set GCC_UNDER_TEST $compat_save_gcc_under_test | |
868f97d5 | 71 | set TEST_ALWAYS_FLAGS $compat_save_TEST_ALWAYS_FLAGS |
51db86a8 | 72 | set_gcc_exec_prefix_env_var |
27a2694f JJ |
73 | } |
74 | } | |
75 | ||
76 | # Find out whether both compilers support decimal float types. | |
77 | proc compat_setup_dfp { } { | |
78 | global compat_use_alt | |
79 | global compat_same_alt | |
80 | global compat_have_dfp | |
868f97d5 | 81 | global compat_alt_caret |
a2e836b2 | 82 | global compat_alt_color |
bd38d0da | 83 | global compat_no_line_no |
868f97d5 JJ |
84 | global TEST_ALWAYS_FLAGS compat_save_TEST_ALWAYS_FLAGS |
85 | ||
86 | set compat_alt_caret 0 | |
a2e836b2 | 87 | set compat_alt_color 0 |
bd38d0da | 88 | set compat_no_line_no 0 |
868f97d5 | 89 | set compat_save_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS |
27a2694f JJ |
90 | |
91 | verbose "compat_setup_dfp: $compat_use_alt $compat_same_alt" 2 | |
6efbd94a DJ |
92 | |
93 | # Does the compiler under test support decimal float types? | |
94 | compat-use-tst-compiler | |
95 | set compat_have_dfp [check_effective_target_dfprt_nocache] | |
96 | verbose "compat_have_dfp for tst compiler: $compat_have_dfp" 2 | |
97 | ||
868f97d5 JJ |
98 | if { $compat_use_alt == 1 && $compat_same_alt == 0 } { |
99 | compat-use-alt-compiler | |
100 | if { [check_no_compiler_messages_nocache compat_alt_has_caret object { | |
101 | int dummy; } "-fno-diagnostics-show-caret"] != 0 } { | |
102 | set compat_alt_caret 1 | |
103 | } | |
a2e836b2 JJ |
104 | if { [check_no_compiler_messages_nocache compat_alt_has_color object { |
105 | int dummy; } "-fdiagnostics-color=never"] != 0 } { | |
106 | set compat_alt_color 1 | |
107 | } | |
bd38d0da IS |
108 | if { [check_no_compiler_messages_nocache compat_alt_has_no_line_no object { |
109 | int dummy; } "-fno-diagnostics-show-line-numbers"] != 0 } { | |
110 | set compat_no_line_no 1 | |
111 | } | |
112 | ||
868f97d5 JJ |
113 | compat-use-tst-compiler |
114 | } | |
115 | ||
27a2694f | 116 | # If there is an alternate compiler, does it support decimal float types? |
6efbd94a | 117 | if { $compat_have_dfp == 1 && $compat_use_alt == 1 && $compat_same_alt == 0 } { |
27a2694f | 118 | compat-use-alt-compiler |
265e7d50 | 119 | set compat_have_dfp [check_effective_target_dfprt_nocache] |
27a2694f JJ |
120 | compat-use-tst-compiler |
121 | verbose "compat_have_dfp for alt compiler: $compat_have_dfp" 2 | |
122 | } | |
27a2694f JJ |
123 | |
124 | # If decimal float is not supported, add it to the skip list, which | |
125 | # affects code in the header files. | |
126 | if { $compat_have_dfp == 0 } { | |
127 | global compat_skip_list | |
128 | lappend compat_skip_list "DECIMAL_FLOAT" | |
129 | } | |
130 | } | |
131 | ||
27a2694f JJ |
132 | # If either compiler does not support decimal float types, skip this test. |
133 | ||
134 | proc dg-require-compat-dfp { args } { | |
135 | global compat_have_dfp | |
136 | if { $compat_have_dfp == 0 } { | |
137 | upvar dg-do-what dg-do-what | |
138 | set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] | |
139 | } | |
140 | } |