Document use of CC and CFLAGS in more detail (bug 20980, bug 21234).
[glibc.git] / sysdeps / generic / math-tests.h
blobcf9eff46910d119bf43952d25c24bbb56808a364
1 /* Configuration for math tests. Generic version.
2 Copyright (C) 2013-2018 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library 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 GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #include <bits/floatn.h>
21 /* Expand the appropriate macro for whether to enable tests for a
22 given type. */
23 #if __HAVE_DISTINCT_FLOAT128
24 # define MATH_TESTS_TG(PREFIX, ARGS, TYPE) \
25 (sizeof (TYPE) == sizeof (float) ? PREFIX ## float ARGS \
26 : sizeof (TYPE) == sizeof (double) ? PREFIX ## double ARGS \
27 : __builtin_types_compatible_p (TYPE, _Float128) ? PREFIX ## float128 ARGS \
28 : PREFIX ## long_double ARGS)
29 # else
30 # define MATH_TESTS_TG(PREFIX, ARGS, TYPE) \
31 (sizeof (TYPE) == sizeof (float) ? PREFIX ## float ARGS \
32 : sizeof (TYPE) == sizeof (double) ? PREFIX ## double ARGS \
33 : PREFIX ## long_double ARGS)
34 #endif
36 /* Indicate whether to run tests involving sNaN values for the float, double,
37 and long double C data types, respectively. All are run unless
38 overridden. */
39 #ifndef SNAN_TESTS_float
40 # define SNAN_TESTS_float 1
41 #endif
42 #ifndef SNAN_TESTS_double
43 # define SNAN_TESTS_double 1
44 #endif
45 #ifndef SNAN_TESTS_long_double
46 # define SNAN_TESTS_long_double 1
47 #endif
48 #ifndef SNAN_TESTS_float128
49 # define SNAN_TESTS_float128 1
50 #endif
52 /* Return nonzero value if to run tests involving sNaN values for X. */
53 #define SNAN_TESTS(x) MATH_TESTS_TG (SNAN_TESTS_, , x)
55 /* Indicate whether to run tests involving type casts of sNaN values. These
56 are run unless overridden. */
57 #ifndef SNAN_TESTS_TYPE_CAST
58 # define SNAN_TESTS_TYPE_CAST 1
59 #endif
61 /* Indicate whether operations on signaling NaNs preserve the payload
62 (if possible; it is not possible with a zero payload if the high
63 bit is set for signaling NaNs) when generating a quiet NaN, and
64 this should be tested. */
65 #ifndef SNAN_TESTS_PRESERVE_PAYLOAD
66 # define SNAN_TESTS_PRESERVE_PAYLOAD 1
67 #endif
69 /* Indicate whether to run tests involving a given rounding mode for a
70 given floating-point type, given that fesetround succeeds for that
71 mode. All are run if fesetround succeeds unless overridden. */
72 #ifndef ROUNDING_TESTS_float
73 # define ROUNDING_TESTS_float(MODE) 1
74 #endif
75 #ifndef ROUNDING_TESTS_double
76 # define ROUNDING_TESTS_double(MODE) 1
77 #endif
78 #ifndef ROUNDING_TESTS_long_double
79 # define ROUNDING_TESTS_long_double(MODE) 1
80 #endif
81 #ifndef ROUNDING_TESTS_float128
82 # define ROUNDING_TESTS_float128(MODE) 1
83 #endif
85 #define ROUNDING_TESTS(TYPE, MODE) \
86 MATH_TESTS_TG (ROUNDING_TESTS_, (MODE), TYPE)
88 /* Indicate whether to run tests of floating-point exceptions for a
89 given floating-point type, given that the exception macros are
90 defined. All are run unless overridden. */
91 #ifndef EXCEPTION_TESTS_float
92 # define EXCEPTION_TESTS_float 1
93 #endif
94 #ifndef EXCEPTION_TESTS_double
95 # define EXCEPTION_TESTS_double 1
96 #endif
97 #ifndef EXCEPTION_TESTS_long_double
98 # define EXCEPTION_TESTS_long_double 1
99 #endif
100 #ifndef EXCEPTION_TESTS_float128
101 # define EXCEPTION_TESTS_float128 1
102 #endif
104 #define EXCEPTION_TESTS(TYPE) MATH_TESTS_TG (EXCEPTION_TESTS_, , TYPE)
106 /* Indicate whether the given exception trap(s) can be enabled
107 in feenableexcept. If non-zero, the traps are always supported.
108 If zero, traps may or may not be supported depending on the
109 target (this can be determined by checking the return value
110 of feenableexcept). This enables skipping of tests which use
111 traps. By default traps are supported unless overridden. */
112 #ifndef EXCEPTION_ENABLE_SUPPORTED
113 # define EXCEPTION_ENABLE_SUPPORTED(EXCEPT) \
114 (EXCEPTION_TESTS_float || EXCEPTION_TESTS_double)
115 #endif
117 /* Indicate whether exception traps, if enabled, occur whenever an
118 exception flag is set explicitly, so it is not possible to set flag
119 bits with traps enabled without causing traps to be taken. If
120 traps cannot be enabled, the value of this macro does not
121 matter. */
122 #ifndef EXCEPTION_SET_FORCES_TRAP
123 # define EXCEPTION_SET_FORCES_TRAP 0
124 #endif