1 /* Test of <math.h> substitute in C++ mode.
2 Copyright (C) 2010-2019 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2010. */
19 #define GNULIB_NAMESPACE gnulib
24 #include "signature.h"
26 /* Signature check for a function that takes a real-floating argument.
27 Check that each overloaded function with the specified signature
28 exists in the GNULIB_NAMESPACE namespace. */
29 #define REAL_FLOATING_CHECK(func,\
30 rettype1, parameters1,\
31 rettype2, parameters2,\
32 rettype3, parameters3) \
33 OVERLOADED_CHECK (func, rettype1, parameters1, _1); \
34 OVERLOADED_CHECK (func, rettype2, parameters2, _2); \
35 OVERLOADED_CHECK (func, rettype3, parameters3, _3)
36 #define OVERLOADED_CHECK(func, rettype, parameters, suffix) \
37 static rettype (* _GL_UNUSED signature_check_ ## func ## suffix) parameters \
38 = static_cast<rettype(*)parameters>(GNULIB_NAMESPACE::func)
41 /* Keep these checks in the same order as math.in.h! */
44 SIGNATURE_CHECK (GNULIB_NAMESPACE::acosf
, float, (float));
46 //SIGNATURE_CHECK (GNULIB_NAMESPACE::acos, double, (double));
48 SIGNATURE_CHECK (GNULIB_NAMESPACE::acosl
, long double, (long double));
52 SIGNATURE_CHECK (GNULIB_NAMESPACE::asinf
, float, (float));
54 //SIGNATURE_CHECK (GNULIB_NAMESPACE::asin, double, (double));
56 SIGNATURE_CHECK (GNULIB_NAMESPACE::asinl
, long double, (long double));
60 SIGNATURE_CHECK (GNULIB_NAMESPACE::atanf
, float, (float));
62 //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan, double, (double));
64 SIGNATURE_CHECK (GNULIB_NAMESPACE::atanl
, long double, (long double));
67 #if GNULIB_TEST_ATAN2F
68 SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2f
, float, (float, float));
70 //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2, double, (double, double));
73 SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrtf
, float, (float));
76 SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrt
, double, (double));
79 SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrtl
, long double, (long double));
83 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceilf
, float, (float));
86 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceil
, double, (double));
89 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceill
, long double, (long double));
92 #if GNULIB_TEST_COPYSIGNF
93 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignf
, float, (float, float));
95 #if GNULIB_TEST_COPYSIGN
96 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysign
, double, (double, double));
98 #if GNULIB_TEST_COPYSIGNL
99 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignl
, long double,
100 (long double, long double));
104 SIGNATURE_CHECK (GNULIB_NAMESPACE::cosf
, float, (float));
106 //SIGNATURE_CHECK (GNULIB_NAMESPACE::cos, double, (double));
108 SIGNATURE_CHECK (GNULIB_NAMESPACE::cosl
, long double, (long double));
111 #if GNULIB_TEST_COSHF
112 SIGNATURE_CHECK (GNULIB_NAMESPACE::coshf
, float, (float));
114 //SIGNATURE_CHECK (GNULIB_NAMESPACE::cosh, double, (double));
116 //SIGNATURE_CHECK (GNULIB_NAMESPACE::erf, double, (double));
118 //SIGNATURE_CHECK (GNULIB_NAMESPACE::erfc, double, (double));
121 SIGNATURE_CHECK (GNULIB_NAMESPACE::expf
, float, (float));
123 //SIGNATURE_CHECK (GNULIB_NAMESPACE::exp, double, (double));
125 SIGNATURE_CHECK (GNULIB_NAMESPACE::expl
, long double, (long double));
128 #if GNULIB_TEST_EXP2F
129 SIGNATURE_CHECK (GNULIB_NAMESPACE::exp2f
, float, (float));
132 SIGNATURE_CHECK (GNULIB_NAMESPACE::exp2
, double, (double));
134 #if GNULIB_TEST_EXP2L
135 SIGNATURE_CHECK (GNULIB_NAMESPACE::exp2l
, long double, (long double));
138 #if GNULIB_TEST_EXPM1F
139 SIGNATURE_CHECK (GNULIB_NAMESPACE::expm1f
, float, (float));
141 #if GNULIB_TEST_EXPM1
142 SIGNATURE_CHECK (GNULIB_NAMESPACE::expm1
, double, (double));
144 #if GNULIB_TEST_EXPM1L
145 SIGNATURE_CHECK (GNULIB_NAMESPACE::expm1l
, long double, (long double));
148 #if GNULIB_TEST_FABSF
149 SIGNATURE_CHECK (GNULIB_NAMESPACE::fabsf
, float, (float));
151 //SIGNATURE_CHECK (GNULIB_NAMESPACE::fabs, double, (double));
152 #if GNULIB_TEST_FABSL
153 SIGNATURE_CHECK (GNULIB_NAMESPACE::fabsl
, long double, (long double));
156 #if GNULIB_TEST_FLOORF
157 SIGNATURE_CHECK (GNULIB_NAMESPACE::floorf
, float, (float));
159 #if GNULIB_TEST_FLOOR
160 SIGNATURE_CHECK (GNULIB_NAMESPACE::floor
, double, (double));
162 #if GNULIB_TEST_FLOORL
163 SIGNATURE_CHECK (GNULIB_NAMESPACE::floorl
, long double, (long double));
167 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmaf
, float, (float, float, float));
170 SIGNATURE_CHECK (GNULIB_NAMESPACE::fma
, double, (double, double, double));
173 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmal
, long double,
174 (long double, long double, long double));
177 #if GNULIB_TEST_FMODF
178 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodf
, float, (float, float));
181 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmod
, double, (double, double));
183 #if GNULIB_TEST_FMODL
184 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodl
, long double,
185 (long double, long double));
188 #if GNULIB_TEST_FREXPF
189 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpf
, float, (float, int *));
191 #if GNULIB_TEST_FREXP
192 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexp
, double, (double, int *));
194 #if GNULIB_TEST_FREXPL
195 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpl
, long double, (long double, int *));
198 #if GNULIB_TEST_HYPOTF
199 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypotf
, float, (float, float));
201 #if GNULIB_TEST_HYPOT
202 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypot
, double, (double, double));
204 #if GNULIB_TEST_HYPOTL
205 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypotl
, long double,
206 (long double, long double));
209 #if GNULIB_TEST_ILOGBF
210 SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogbf
, int, (float));
212 #if GNULIB_TEST_ILOGB
213 SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogb
, int, (double));
215 #if GNULIB_TEST_ILOGBL
216 SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogbl
, int, (long double));
219 //SIGNATURE_CHECK (GNULIB_NAMESPACE::j0, double, (double));
221 //SIGNATURE_CHECK (GNULIB_NAMESPACE::j1, double, (double));
223 //SIGNATURE_CHECK (GNULIB_NAMESPACE::jn, double, (int, double));
225 #if GNULIB_TEST_LDEXPF
226 SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpf
, float, (float, int));
228 //SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexp, double, (double, int));
229 #if GNULIB_TEST_LDEXPL
230 SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpl
, long double, (long double, int));
233 //SIGNATURE_CHECK (GNULIB_NAMESPACE::lgamma, double, (double));
236 SIGNATURE_CHECK (GNULIB_NAMESPACE::logf
, float, (float));
239 SIGNATURE_CHECK (GNULIB_NAMESPACE::log
, double, (double));
242 SIGNATURE_CHECK (GNULIB_NAMESPACE::logl
, long double, (long double));
245 #if GNULIB_TEST_LOG10F
246 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10f
, float, (float));
248 #if GNULIB_TEST_LOG10
249 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10
, double, (double));
251 #if GNULIB_TEST_LOG10L
252 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10l
, long double, (long double));
255 #if GNULIB_TEST_LOG1PF
256 SIGNATURE_CHECK (GNULIB_NAMESPACE::log1pf
, float, (float));
258 #if GNULIB_TEST_LOG1P
259 SIGNATURE_CHECK (GNULIB_NAMESPACE::log1p
, double, (double));
261 #if GNULIB_TEST_LOG1PL
262 SIGNATURE_CHECK (GNULIB_NAMESPACE::log1pl
, long double, (long double));
265 #if GNULIB_TEST_LOG2F
266 SIGNATURE_CHECK (GNULIB_NAMESPACE::log2f
, float, (float));
269 SIGNATURE_CHECK (GNULIB_NAMESPACE::log2
, double, (double));
271 #if GNULIB_TEST_LOG2L
272 SIGNATURE_CHECK (GNULIB_NAMESPACE::log2l
, long double, (long double));
275 #if GNULIB_TEST_LOGBF
276 SIGNATURE_CHECK (GNULIB_NAMESPACE::logbf
, float, (float));
279 SIGNATURE_CHECK (GNULIB_NAMESPACE::logb
, double, (double));
281 #if GNULIB_TEST_LOGBL
282 SIGNATURE_CHECK (GNULIB_NAMESPACE::logbl
, long double, (long double));
285 #if GNULIB_TEST_MODFF
286 SIGNATURE_CHECK (GNULIB_NAMESPACE::modff
, float, (float, float *));
289 SIGNATURE_CHECK (GNULIB_NAMESPACE::modf
, double, (double, double *));
291 #if GNULIB_TEST_MODFL
292 SIGNATURE_CHECK (GNULIB_NAMESPACE::modfl
, long double,
293 (long double, long double *));
296 //SIGNATURE_CHECK (GNULIB_NAMESPACE::nextafter, double, (double, double));
299 SIGNATURE_CHECK (GNULIB_NAMESPACE::powf
, float, (float, float));
301 //SIGNATURE_CHECK (GNULIB_NAMESPACE::pow, double, (double, double));
303 #if GNULIB_TEST_REMAINDERF
304 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderf
, float, (float, float));
306 #if GNULIB_TEST_REMAINDER
307 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainder
, double, (double, double));
309 #if GNULIB_TEST_REMAINDERL
310 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderl
, long double,
311 (long double, long double));
314 #if GNULIB_TEST_RINTF
315 SIGNATURE_CHECK (GNULIB_NAMESPACE::rintf
, float, (float));
318 SIGNATURE_CHECK (GNULIB_NAMESPACE::rint
, double, (double));
320 #if GNULIB_TEST_RINTL
321 SIGNATURE_CHECK (GNULIB_NAMESPACE::rintl
, long double, (long double));
324 #if GNULIB_TEST_ROUNDF
325 SIGNATURE_CHECK (GNULIB_NAMESPACE::roundf
, float, (float));
327 #if GNULIB_TEST_ROUND
328 SIGNATURE_CHECK (GNULIB_NAMESPACE::round
, double, (double));
330 #if GNULIB_TEST_ROUNDL
331 SIGNATURE_CHECK (GNULIB_NAMESPACE::roundl
, long double, (long double));
335 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinf
, float, (float));
337 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sin, double, (double));
339 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinl
, long double, (long double));
342 #if GNULIB_TEST_SINHF
343 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinhf
, float, (float));
345 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sinh, double, (double));
347 #if GNULIB_TEST_SQRTF
348 SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtf
, float, (float));
350 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrt, double, (double));
351 #if GNULIB_TEST_SQRTL
352 SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtl
, long double, (long double));
356 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanf
, float, (float));
358 //SIGNATURE_CHECK (GNULIB_NAMESPACE::tan, double, (double));
360 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanl
, long double, (long double));
363 #if GNULIB_TEST_TANHF
364 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanhf
, float, (float));
366 //SIGNATURE_CHECK (GNULIB_NAMESPACE::tanh, double, (double));
368 #if GNULIB_TEST_TRUNCF
369 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncf
, float, (float));
371 #if GNULIB_TEST_TRUNC
372 SIGNATURE_CHECK (GNULIB_NAMESPACE::trunc
, double, (double));
374 #if GNULIB_TEST_TRUNCL
375 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncl
, long double, (long double));
378 //SIGNATURE_CHECK (GNULIB_NAMESPACE::y0, double, (double));
380 //SIGNATURE_CHECK (GNULIB_NAMESPACE::y1, double, (double));
382 //SIGNATURE_CHECK (GNULIB_NAMESPACE::yn, double, (int, double));
384 #if GNULIB_TEST_ISFINITE
386 # error "isfinite should not be a macro in C++"
388 REAL_FLOATING_CHECK (isfinite
, int, (float), int, (double), int, (long double));
391 #if GNULIB_TEST_ISINF
393 # error "isinf should not be a macro in C++"
395 REAL_FLOATING_CHECK (isinf
, int, (float), int, (double), int, (long double));
398 #if GNULIB_TEST_ISNAN
400 # error "isnan should not be a macro in C++"
402 REAL_FLOATING_CHECK (isnan
, int, (float), int, (double), int, (long double));
405 #if GNULIB_TEST_SIGNBIT
407 # error "signbit should not be a macro in C++"
409 REAL_FLOATING_CHECK (signbit
, int, (float), int, (double), int, (long double));