PR c++/81917 - ICE with void_t and partial specialization.
[official-gcc.git] / gcc / testsuite / lib / mpx-dg.exp
blob2fda79540cfc8d21bd4b46be7ddfd451ccdb3f41
1 # Copyright (C) 2014-2018 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 3 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 GCC; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
17 # Return 1 if compilation with "-fcheck-pointer-bounds -mmpx" is
18 # error-free for trivial code, 0 otherwise.
20 proc check_effective_target_mpx {} {
21 return [check_no_compiler_messages mpx executable {
22 int *foo (int *arg) { return arg; }
23 int main (void)
25 int *p = (int *)__builtin_malloc (sizeof (int));
26 int res = foo (p) == 0;
27 __builtin_free (p);
28 return res;
30 } "-fcheck-pointer-bounds -mmpx"]
34 # mpx_link_flags -- compute library path and flags to find libmpx.
37 proc mpx_link_flags { paths } {
38 global srcdir
39 global ld_library_path
40 global shlib_ext
41 global mpx_saved_library_path
43 set gccpath ${paths}
44 set flags ""
46 set shlib_ext [get_shlib_extension]
47 set mpx_saved_library_path $ld_library_path
49 if { $gccpath != "" } {
50 if { [file exists "${gccpath}/libmpx/mpxrt/.libs/libmpx.a"]
51 || [file exists "${gccpath}/libmpx/mpxrt/.libs/libmpx.${shlib_ext}"] } {
52 append flags " -B${gccpath}/libmpx/ "
53 append flags " -B${gccpath}/libmpx/mpxrt "
54 append flags " -L${gccpath}/libmpx/mpxrt/.libs "
55 append ld_library_path ":${gccpath}/libmpx/mpxrt/.libs"
58 if { [file exists "${gccpath}/libmpx/mpxwrap/.libs/libmpxwrappers.a"]
59 || [file exists "${gccpath}/libmpx/mpxwrap/.libs/libmpxwrappers.${shlib_ext}"] } {
60 append flags " -B${gccpath}/libmpx/ "
61 append flags " -B${gccpath}/libmpx/mpxwrap "
62 append flags " -L${gccpath}/libmpx/mpxwrap/.libs "
63 append ld_library_path ":${gccpath}/libmpx/mpxwrap/.libs"
65 } else {
66 global tool_root_dir
68 set libmpx [lookfor_file ${tool_root_dir} libmpx]
69 if { $libmpx != "" } {
70 append flags "-L${libmpx} "
71 append ld_library_path ":${libmpx}"
74 set libmpxwrappers [lookfor_file ${tool_root_dir} libmpxwrappers]
75 if { $libmpxwrappers != "" } {
76 append flags "-L${libmpxwrappers} "
77 append ld_library_path ":${libmpxwrappers}"
81 set_ld_library_path_env_vars
83 return "$flags"
87 # mpx_init -- called at the start of each subdir of tests
90 proc mpx_init { args } {
91 global TEST_ALWAYS_FLAGS
92 global ALWAYS_CXXFLAGS
93 global TOOL_OPTIONS
94 global mpx_saved_TEST_ALWAYS_FLAGS
95 global mpx_saved_ALWAYS_CXXFLAGS
97 setenv CHKP_RT_MODE "stop"
99 set link_flags ""
100 if ![is_remote host] {
101 if [info exists TOOL_OPTIONS] {
102 set link_flags "[mpx_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
103 } else {
104 set link_flags "[mpx_link_flags [get_multilibs]]"
108 if [info exists TEST_ALWAYS_FLAGS] {
109 set mpx_saved_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS
111 if [info exists ALWAYS_CXXFLAGS] {
112 set mpx_saved_ALWAYS_CXXFLAGS $ALWAYS_CXXFLAGS
113 set ALWAYS_CXXFLAGS [concat "{ldflags=$link_flags}" $ALWAYS_CXXFLAGS]
114 } else {
115 if [info exists TEST_ALWAYS_FLAGS] {
116 set TEST_ALWAYS_FLAGS "$link_flags $TEST_ALWAYS_FLAGS"
117 } else {
118 set TEST_ALWAYS_FLAGS "$link_flags"
124 # mpx_finish -- called at the end of each subdir of tests
127 proc mpx_finish { args } {
128 global TEST_ALWAYS_FLAGS
129 global mpx_saved_TEST_ALWAYS_FLAGS
130 global mpx_saved_ALWAYS_CXXFLAGS
131 global mpx_saved_library_path
132 global ld_library_path
134 if [info exists mpx_saved_ALWAYS_CXXFLAGS ] {
135 set ALWAYS_CXXFLAGS $mpx_saved_ALWAYS_CXXFLAGS
136 } else {
137 if [info exists mpx_saved_TEST_ALWAYS_FLAGS] {
138 set TEST_ALWAYS_FLAGS $mpx_saved_TEST_ALWAYS_FLAGS
139 } else {
140 unset TEST_ALWAYS_FLAGS
143 set ld_library_path $mpx_saved_library_path
144 set_ld_library_path_env_vars
145 clear_effective_target_cache