1 # Copyright
(C
) 2003-2018 Free Software Foundation
, Inc.
3 # This file is part of GCC.
5 # GCC is free software
; you can redistribute it and
/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation
; either version
3, or
(at your option
)
10 # GCC is distributed in the hope that it will be useful
,
11 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License
for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with GCC
; see the file COPYING3.
If not see
17 #
<http
://www.gnu.org
/licenses
/>.
19 # This harness is
for testing builtin support. Each test has two files
:
21 #
- foo.c defines the main testing function
, main_test
().
22 #
- foo
-lib.c implements the library functions that foo.c is testing.
24 # The functions in foo
-lib.c will often want to abort
on certain inputs.
25 # They can use the global
variable inside_main to see whether they are
26 # being called from the test
program or part of the common runtime.
28 # In many cases
, the library functions will behave as
normal at
-O0
29 # and abort when optimisation is enabled. Such implementations should
30 # go into the lib
/ directory so that they can be included by
any test
31 # that needs them. They shouldn
't call any external functions in case
32 # those functions were overridden too.
34 load_lib torture-options.exp
35 load_lib c-torture.exp
38 set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
40 set additional_flags "-fno-tree-loop-distribute-patterns -fno-tracer"
41 if [istarget "powerpc-*-darwin*"] {
42 lappend additional_flags "-Wl,-multiply_defined,suppress"
44 if { [istarget *-*-eabi*]
46 || [istarget *-*-mingw*]
47 || [istarget *-*-rtems*] } {
48 lappend additional_flags "-Wl,--allow-multiple-definition"
51 foreach src [lsort [find $srcdir/$subdir *.c]] {
52 if {![string match *-lib.c $src] && [runtest_file_p $runtests $src]} {
53 c-torture-execute [list $src \
54 [file root $src]-lib.c \
55 $srcdir/$subdir/lib/main.c] \