1 /* Test of <math.h> substitute in C++ mode.
2 Copyright (C) 2010-2016 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 <http://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));
166 #if GNULIB_TEST_FMODF
167 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodf, float, (float, float));
170 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmod, double, (double, double));
172 #if GNULIB_TEST_FMODL
173 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodl, long double,
174 (long double, long double));
177 #if GNULIB_TEST_FREXPF
178 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpf, float, (float, int *));
180 #if GNULIB_TEST_FREXP
181 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexp, double, (double, int *));
183 #if GNULIB_TEST_FREXPL
184 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpl, long double, (long double, int *));
187 #if GNULIB_TEST_HYPOTF
188 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypotf, float, (float, float));
190 #if GNULIB_TEST_HYPOT
191 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypot, double, (double, double));
193 #if GNULIB_TEST_HYPOTL
194 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypotl, long double,
195 (long double, long double));
198 #if GNULIB_TEST_ILOGBF
199 SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogbf, int, (float));
201 #if GNULIB_TEST_ILOGB
202 SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogb, int, (double));
204 #if GNULIB_TEST_ILOGBL
205 SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogbl, int, (long double));
208 //SIGNATURE_CHECK (GNULIB_NAMESPACE::j0, double, (double));
210 //SIGNATURE_CHECK (GNULIB_NAMESPACE::j1, double, (double));
212 //SIGNATURE_CHECK (GNULIB_NAMESPACE::jn, double, (int, double));
214 #if GNULIB_TEST_LDEXPF
215 SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpf, float, (float, int));
217 //SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexp, double, (double, int));
218 #if GNULIB_TEST_LDEXPL
219 SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpl, long double, (long double, int));
222 //SIGNATURE_CHECK (GNULIB_NAMESPACE::lgamma, double, (double));
224 #if GNULIB_TEST_LOG10
225 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10, double, (double));
227 #if GNULIB_TEST_LOG10L
228 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10l, long double, (long double));
231 #if GNULIB_TEST_LOG1PF
232 SIGNATURE_CHECK (GNULIB_NAMESPACE::log1pf, float, (float));
234 #if GNULIB_TEST_LOG1P
235 SIGNATURE_CHECK (GNULIB_NAMESPACE::log1p, double, (double));
237 #if GNULIB_TEST_LOG1PL
238 SIGNATURE_CHECK (GNULIB_NAMESPACE::log1pl, long double, (long double));
242 SIGNATURE_CHECK (GNULIB_NAMESPACE::logf, float, (float));
245 SIGNATURE_CHECK (GNULIB_NAMESPACE::log, double, (double));
248 SIGNATURE_CHECK (GNULIB_NAMESPACE::logl, long double, (long double));
251 #if GNULIB_TEST_LOG10F
252 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10f, float, (float));
255 #if GNULIB_TEST_LOG2F
256 SIGNATURE_CHECK (GNULIB_NAMESPACE::log2f, float, (float));
259 SIGNATURE_CHECK (GNULIB_NAMESPACE::log2, double, (double));
261 #if GNULIB_TEST_LOG2L
262 SIGNATURE_CHECK (GNULIB_NAMESPACE::log2l, long double, (long double));
265 #if GNULIB_TEST_LOGBF
266 SIGNATURE_CHECK (GNULIB_NAMESPACE::logbf, float, (float));
269 SIGNATURE_CHECK (GNULIB_NAMESPACE::logb, double, (double));
271 #if GNULIB_TEST_LOGBL
272 SIGNATURE_CHECK (GNULIB_NAMESPACE::logbl, long double, (long double));
275 #if GNULIB_TEST_MODFF
276 SIGNATURE_CHECK (GNULIB_NAMESPACE::modff, float, (float, float *));
279 SIGNATURE_CHECK (GNULIB_NAMESPACE::modf, double, (double, double *));
281 #if GNULIB_TEST_MODFL
282 SIGNATURE_CHECK (GNULIB_NAMESPACE::modfl, long double,
283 (long double, long double *));
286 //SIGNATURE_CHECK (GNULIB_NAMESPACE::nextafter, double, (double, double));
289 SIGNATURE_CHECK (GNULIB_NAMESPACE::powf, float, (float, float));
291 //SIGNATURE_CHECK (GNULIB_NAMESPACE::pow, double, (double, double));
293 #if GNULIB_TEST_REMAINDERF
294 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderf, float, (float, float));
296 #if GNULIB_TEST_REMAINDER
297 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainder, double, (double, double));
299 #if GNULIB_TEST_REMAINDERL
300 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderl, long double,
301 (long double, long double));
304 #if GNULIB_TEST_RINTF
305 SIGNATURE_CHECK (GNULIB_NAMESPACE::rintf, float, (float));
308 SIGNATURE_CHECK (GNULIB_NAMESPACE::rint, double, (double));
310 #if GNULIB_TEST_RINTL
311 SIGNATURE_CHECK (GNULIB_NAMESPACE::rintl, long double, (long double));
314 #if GNULIB_TEST_ROUNDF
315 SIGNATURE_CHECK (GNULIB_NAMESPACE::roundf, float, (float));
317 #if GNULIB_TEST_ROUND
318 SIGNATURE_CHECK (GNULIB_NAMESPACE::round, double, (double));
320 #if GNULIB_TEST_ROUNDL
321 SIGNATURE_CHECK (GNULIB_NAMESPACE::roundl, long double, (long double));
325 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinf, float, (float));
327 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sin, double, (double));
329 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinl, long double, (long double));
332 #if GNULIB_TEST_SINHF
333 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinhf, float, (float));
335 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sinh, double, (double));
337 #if GNULIB_TEST_SQRTF
338 SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtf, float, (float));
340 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrt, double, (double));
341 #if GNULIB_TEST_SQRTL
342 SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtl, long double, (long double));
346 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanf, float, (float));
348 //SIGNATURE_CHECK (GNULIB_NAMESPACE::tan, double, (double));
350 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanl, long double, (long double));
353 #if GNULIB_TEST_TANHF
354 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanhf, float, (float));
356 //SIGNATURE_CHECK (GNULIB_NAMESPACE::tanh, double, (double));
358 #if GNULIB_TEST_TRUNCF
359 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncf, float, (float));
361 #if GNULIB_TEST_TRUNC
362 SIGNATURE_CHECK (GNULIB_NAMESPACE::trunc, double, (double));
364 #if GNULIB_TEST_TRUNCL
365 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncl, long double, (long double));
368 //SIGNATURE_CHECK (GNULIB_NAMESPACE::y0, double, (double));
370 //SIGNATURE_CHECK (GNULIB_NAMESPACE::y1, double, (double));
372 //SIGNATURE_CHECK (GNULIB_NAMESPACE::yn, double, (int, double));
374 #if GNULIB_TEST_ISFINITE
376 # error "isfinite should not be a macro in C++"
378 REAL_FLOATING_CHECK (isfinite, int, (float), int, (double), int, (long double));
381 #if GNULIB_TEST_ISINF
383 # error "isinf should not be a macro in C++"
385 REAL_FLOATING_CHECK (isinf, int, (float), int, (double), int, (long double));
388 #if GNULIB_TEST_ISNAN
390 # error "isnan should not be a macro in C++"
392 REAL_FLOATING_CHECK (isnan, int, (float), int, (double), int, (long double));
395 #if GNULIB_TEST_SIGNBIT
397 # error "signbit should not be a macro in C++"
399 REAL_FLOATING_CHECK (signbit, int, (float), int, (double), int, (long double));