1 | /* Test if __LDBL_COMPAT redirections conflict with other types. |
2 | Copyright (C) 2018-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. |
4 | |
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. |
9 | |
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. |
14 | |
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/>. */ |
18 | |
19 | /* Redirecting functions twice may lead to -Werror=pragmas errors. |
20 | In a __LDBL_COMPAT environment, only long double functions should be |
21 | redirected. This test redirects math functions to a dummy function in |
22 | order to validate if they have not been redirected before. */ |
23 | |
24 | #include <math.h> |
25 | #include <complex.h> |
26 | |
27 | #if defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0 |
28 | # error "This test should never request finite functions" |
29 | #endif |
30 | |
31 | #define MATH_REDIRX(function, to) \ |
32 | extern typeof (function) function __asm__ ("" # to); |
33 | #define MATH_REDIR(function) MATH_REDIRX (function, __ ## function) |
34 | |
35 | #if __HAVE_FLOAT32 |
36 | # define MATH_F32(function) MATH_REDIR(function ## f32) |
37 | #else |
38 | # define MATH_F32(function) |
39 | #endif |
40 | |
41 | #if __HAVE_FLOAT32X |
42 | # define MATH_F32X(function) MATH_REDIR(function ## f32x) |
43 | #else |
44 | # define MATH_F32X(function) |
45 | #endif |
46 | |
47 | #if __HAVE_FLOAT64 |
48 | # define MATH_F64(function) MATH_REDIR(function ## f64) |
49 | #else |
50 | # define MATH_F64(function) |
51 | #endif |
52 | |
53 | #if __HAVE_FLOAT64X |
54 | # define MATH_F64X(function) MATH_REDIR(function ## f64x) |
55 | #else |
56 | # define MATH_F64X(function) |
57 | #endif |
58 | |
59 | #define MATH_FUNCTION(function) \ |
60 | MATH_REDIR(function); \ |
61 | MATH_REDIR(function ## f); \ |
62 | MATH_F32(function); \ |
63 | MATH_F32X(function); \ |
64 | MATH_F64(function); \ |
65 | MATH_F64X(function); |
66 | |
67 | MATH_FUNCTION (acos); |
68 | MATH_FUNCTION (asin); |
69 | MATH_FUNCTION (exp); |
70 | MATH_FUNCTION (floor); |
71 | MATH_FUNCTION (ldexp); |
72 | MATH_FUNCTION (log); |
73 | MATH_FUNCTION (sin); |
74 | MATH_FUNCTION (cabs); |
75 | MATH_FUNCTION (cacos); |
76 | MATH_FUNCTION (casin); |
77 | MATH_FUNCTION (clog); |
78 | MATH_FUNCTION (csin); |
79 | |
80 | static int |
81 | do_test (void) |
82 | { |
83 | /* This is a compilation test. */ |
84 | return 0; |
85 | } |
86 | |
87 | #include <support/test-driver.c> |
88 | |