1 | /* Test compilation of tgmath macros. |
2 | Copyright (C) 2007-2022 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 | <https://www.gnu.org/licenses/>. */ |
18 | |
19 | #ifndef HAVE_MAIN |
20 | #include <float.h> |
21 | #include <math.h> |
22 | #include <complex.h> |
23 | #include <stdio.h> |
24 | #include <string.h> |
25 | #include <tgmath.h> |
26 | |
27 | //#define DEBUG |
28 | |
29 | typedef complex float cfloat; |
30 | typedef complex double cdouble; |
31 | #if LDBL_MANT_DIG > DBL_MANT_DIG |
32 | typedef long double ldouble; |
33 | typedef complex long double cldouble; |
34 | #else |
35 | typedef double ldouble; |
36 | typedef complex double cldouble; |
37 | #endif |
38 | |
39 | float vfloat1, vfloat2, vfloat3; |
40 | double vdouble1, vdouble2, vdouble3; |
41 | ldouble vldouble1, vldouble2, vldouble3; |
42 | cfloat vcfloat1, vcfloat2, vcfloat3; |
43 | cdouble vcdouble1, vcdouble2, vcdouble3; |
44 | cldouble vcldouble1, vcldouble2, vcldouble4; |
45 | int vint1, vint2, vint3; |
46 | long int vlong1, vlong2, vlong3; |
47 | long long int vllong1, vllong2, vllong3; |
48 | const float Vfloat1 = 1, Vfloat2 = 2, Vfloat3 = 3; |
49 | const double Vdouble1 = 1, Vdouble2 = 2, Vdouble3 = 3; |
50 | const ldouble Vldouble1 = 1, Vldouble2 = 2, Vldouble3 = 3; |
51 | const cfloat Vcfloat1 = 1, Vcfloat2 = 2, Vcfloat3 = 3; |
52 | const cdouble Vcdouble1 = 1, Vcdouble2 = 2, Vcdouble3 = 3; |
53 | const cldouble Vcldouble1 = 1, Vcldouble2 = 2, Vcldouble4 = 3; |
54 | const int Vint1 = 1, Vint2 = 2, Vint3 = 3; |
55 | const long int Vlong1 = 1, Vlong2 = 2, Vlong3 = 3; |
56 | const long long int Vllong1 = 1, Vllong2 = 2, Vllong3 = 3; |
57 | enum |
58 | { |
59 | Tfloat = 0, |
60 | Tcfloat, |
61 | Tdouble, |
62 | Tcdouble, |
63 | #if LDBL_MANT_DIG > DBL_MANT_DIG |
64 | Tldouble, |
65 | Tcldouble, |
66 | #else |
67 | Tldouble = Tdouble, |
68 | Tcldouble = Tcdouble, |
69 | #endif |
70 | Tlast |
71 | }; |
72 | enum |
73 | { |
74 | C_cos = 0, |
75 | C_fabs, |
76 | C_cabs, |
77 | C_conj, |
78 | C_expm1, |
79 | C_lrint, |
80 | C_ldexp, |
81 | C_atan2, |
82 | C_remquo, |
83 | C_pow, |
84 | C_fma, |
85 | C_last |
86 | }; |
87 | int count; |
88 | int counts[Tlast][C_last]; |
89 | |
90 | #define FAIL(str) \ |
91 | do \ |
92 | { \ |
93 | printf ("%s failure on line %d\n", (str), __LINE__); \ |
94 | result = 1; \ |
95 | } \ |
96 | while (0) |
97 | #define TEST_TYPE_ONLY(expr, rettype) \ |
98 | do \ |
99 | { \ |
100 | __typeof__ (expr) |
---|