1 /* Test of <math.h> substitute in C++ mode.
2 Copyright (C) 2010-2013 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 exists. */
28 #define REAL_FLOATING_CHECK(func,\
29 rettype1, parameters1,\
30 rettype2, parameters2,\
31 rettype3, parameters3) \
32 OVERLOADED_CHECK (func, rettype1, parameters1, _1); \
33 OVERLOADED_CHECK (func, rettype2, parameters2, _2); \
34 OVERLOADED_CHECK (func, rettype3, parameters3, _3)
35 #define OVERLOADED_CHECK(func, rettype, parameters, suffix) \
36 static rettype (* _GL_UNUSED signature_check_ ## func ## suffix) parameters \
37 = static_cast<rettype(*)parameters>(func)
40 /* Keep these checks in the same order as math.in.h! */
43 SIGNATURE_CHECK (GNULIB_NAMESPACE::acosf, float, (float));
45 //SIGNATURE_CHECK (GNULIB_NAMESPACE::acos, double, (double));
47 SIGNATURE_CHECK (GNULIB_NAMESPACE::acosl, long double, (long double));
51 SIGNATURE_CHECK (GNULIB_NAMESPACE::asinf, float, (float));
53 //SIGNATURE_CHECK (GNULIB_NAMESPACE::asin, double, (double));
55 SIGNATURE_CHECK (GNULIB_NAMESPACE::asinl, long double, (long double));
59 SIGNATURE_CHECK (GNULIB_NAMESPACE::atanf, float, (float));
61 //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan, double, (double));
63 SIGNATURE_CHECK (GNULIB_NAMESPACE::atanl, long double, (long double));
66 #if GNULIB_TEST_ATAN2F
67 SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2f, float, (float, float));
69 //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2, double, (double, double));
72 SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrtf, float, (float));
75 SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrt, double, (double));
78 SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrtl, long double, (long double));
82 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceilf, float, (float));
85 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceil, double, (double));
88 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceill, long double, (long double));
91 #if GNULIB_TEST_COPYSIGNF
92 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignf, float, (float, float));
94 #if GNULIB_TEST_COPYSIGN
95 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysign, double, (double, double));
97 #if GNULIB_TEST_COPYSIGNL
98 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignl, long double,
99 (long double, long double));
103 SIGNATURE_CHECK (GNULIB_NAMESPACE::cosf, float, (float));
105 //SIGNATURE_CHECK (GNULIB_NAMESPACE::cos, double, (double));
107 SIGNATURE_CHECK (GNULIB_NAMESPACE::cosl, long double, (long double));
110 #if GNULIB_TEST_COSHF
111 SIGNATURE_CHECK (GNULIB_NAMESPACE::coshf, float, (float));
113 //SIGNATURE_CHECK (GNULIB_NAMESPACE::cosh, double, (double));
115 //SIGNATURE_CHECK (GNULIB_NAMESPACE::erf, double, (double));
117 //SIGNATURE_CHECK (GNULIB_NAMESPACE::erfc, double, (double));
120 SIGNATURE_CHECK (GNULIB_NAMESPACE::expf, float, (float));
122 //SIGNATURE_CHECK (GNULIB_NAMESPACE::exp, double, (double));
124 SIGNATURE_CHECK (GNULIB_NAMESPACE::expl, long double, (long double));
127 #if GNULIB_TEST_EXP2F
128 SIGNATURE_CHECK (GNULIB_NAMESPACE::exp2f, float, (float));
131 SIGNATURE_CHECK (GNULIB_NAMESPACE::exp2, double, (double));
133 #if GNULIB_TEST_EXP2L
134 SIGNATURE_CHECK (GNULIB_NAMESPACE::exp2l, long double, (long double));
137 #if GNULIB_TEST_EXPM1F
138 SIGNATURE_CHECK (GNULIB_NAMESPACE::expm1f, float, (float));
140 #if GNULIB_TEST_EXPM1
141 SIGNATURE_CHECK (GNULIB_NAMESPACE::expm1, double, (double));
143 #if GNULIB_TEST_EXPM1L
144 SIGNATURE_CHECK (GNULIB_NAMESPACE::expm1l, long double, (long double));
147 #if GNULIB_TEST_FABSF
148 SIGNATURE_CHECK (GNULIB_NAMESPACE::fabsf, float, (float));
150 //SIGNATURE_CHECK (GNULIB_NAMESPACE::fabs, double, (double));
151 #if GNULIB_TEST_FABSL
152 SIGNATURE_CHECK (GNULIB_NAMESPACE::fabsl, long double, (long double));
155 #if GNULIB_TEST_FLOORF
156 SIGNATURE_CHECK (GNULIB_NAMESPACE::floorf, float, (float));
158 #if GNULIB_TEST_FLOOR
159 SIGNATURE_CHECK (GNULIB_NAMESPACE::floor, double, (double));
161 #if GNULIB_TEST_FLOORL
162 SIGNATURE_CHECK (GNULIB_NAMESPACE::floorl, long double, (long double));
165 #if GNULIB_TEST_FMODF
166 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodf, float, (float, float));
169 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmod, double, (double, double));
171 #if GNULIB_TEST_FMODL
172 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodl, long double,
173 (long double, long double));
176 #if GNULIB_TEST_FREXPF
177 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpf, float, (float, int *));
179 #if GNULIB_TEST_FREXP
180 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexp, double, (double, int *));
182 #if GNULIB_TEST_FREXPL
183 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpl, long double, (long double, int *));
186 #if GNULIB_TEST_HYPOTF
187 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypotf, float, (float, float));
189 #if GNULIB_TEST_HYPOT
190 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypot, double, (double, double));
192 #if GNULIB_TEST_HYPOTL
193 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypotl, long double,
194 (long double, long double));
197 #if GNULIB_TEST_ILOGBF
198 SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogbf, int, (float));
200 #if GNULIB_TEST_ILOGB
201 SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogb, int, (double));
203 #if GNULIB_TEST_ILOGBL
204 SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogbl, int, (long double));
207 //SIGNATURE_CHECK (GNULIB_NAMESPACE::j0, double, (double));
209 //SIGNATURE_CHECK (GNULIB_NAMESPACE::j1, double, (double));
211 //SIGNATURE_CHECK (GNULIB_NAMESPACE::jn, double, (int, double));
213 #if GNULIB_TEST_LDEXPF
214 SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpf, float, (float, int));
216 //SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexp, double, (double, int));
217 #if GNULIB_TEST_LDEXPL
218 SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpl, long double, (long double, int));
221 //SIGNATURE_CHECK (GNULIB_NAMESPACE::lgamma, double, (double));
223 #if GNULIB_TEST_LOG10
224 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10, double, (double));
226 #if GNULIB_TEST_LOG10L
227 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10l, long double, (long double));
230 #if GNULIB_TEST_LOG1PF
231 SIGNATURE_CHECK (GNULIB_NAMESPACE::log1pf, float, (float));
233 #if GNULIB_TEST_LOG1P
234 SIGNATURE_CHECK (GNULIB_NAMESPACE::log1p, double, (double));
236 #if GNULIB_TEST_LOG1PL
237 SIGNATURE_CHECK (GNULIB_NAMESPACE::log1pl, long double, (long double));
241 SIGNATURE_CHECK (GNULIB_NAMESPACE::logf, float, (float));
244 SIGNATURE_CHECK (GNULIB_NAMESPACE::log, double, (double));
247 SIGNATURE_CHECK (GNULIB_NAMESPACE::logl, long double, (long double));
250 #if GNULIB_TEST_LOG10F
251 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10f, float, (float));
254 #if GNULIB_TEST_LOG2F
255 SIGNATURE_CHECK (GNULIB_NAMESPACE::log2f, float, (float));
258 SIGNATURE_CHECK (GNULIB_NAMESPACE::log2, double, (double));
260 #if GNULIB_TEST_LOG2L
261 SIGNATURE_CHECK (GNULIB_NAMESPACE::log2l, long double, (long double));
264 #if GNULIB_TEST_LOGBF
265 SIGNATURE_CHECK (GNULIB_NAMESPACE::logbf, float, (float));
268 SIGNATURE_CHECK (GNULIB_NAMESPACE::logb, double, (double));
270 #if GNULIB_TEST_LOGBL
271 SIGNATURE_CHECK (GNULIB_NAMESPACE::logbl, long double, (long double));
274 #if GNULIB_TEST_MODFF
275 SIGNATURE_CHECK (GNULIB_NAMESPACE::modff, float, (float, float *));
278 SIGNATURE_CHECK (GNULIB_NAMESPACE::modf, double, (double, double *));
280 #if GNULIB_TEST_MODFL
281 SIGNATURE_CHECK (GNULIB_NAMESPACE::modfl, long double,
282 (long double, long double *));
285 //SIGNATURE_CHECK (GNULIB_NAMESPACE::nextafter, double, (double, double));
288 SIGNATURE_CHECK (GNULIB_NAMESPACE::powf, float, (float, float));
290 //SIGNATURE_CHECK (GNULIB_NAMESPACE::pow, double, (double, double));
292 #if GNULIB_TEST_REMAINDERF
293 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderf, float, (float, float));
295 #if GNULIB_TEST_REMAINDER
296 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainder, double, (double, double));
298 #if GNULIB_TEST_REMAINDERL
299 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderl, long double,
300 (long double, long double));
303 #if GNULIB_TEST_RINTF
304 SIGNATURE_CHECK (GNULIB_NAMESPACE::rintf, float, (float));
307 SIGNATURE_CHECK (GNULIB_NAMESPACE::rint, double, (double));
309 #if GNULIB_TEST_RINTL
310 SIGNATURE_CHECK (GNULIB_NAMESPACE::rintl, long double, (long double));
313 #if GNULIB_TEST_ROUNDF
314 SIGNATURE_CHECK (GNULIB_NAMESPACE::roundf, float, (float));
316 #if GNULIB_TEST_ROUND
317 SIGNATURE_CHECK (GNULIB_NAMESPACE::round, double, (double));
319 #if GNULIB_TEST_ROUNDL
320 SIGNATURE_CHECK (GNULIB_NAMESPACE::roundl, long double, (long double));
324 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinf, float, (float));
326 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sin, double, (double));
328 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinl, long double, (long double));
331 #if GNULIB_TEST_SINHF
332 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinhf, float, (float));
334 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sinh, double, (double));
336 #if GNULIB_TEST_SQRTF
337 SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtf, float, (float));
339 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrt, double, (double));
340 #if GNULIB_TEST_SQRTL
341 SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtl, long double, (long double));
345 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanf, float, (float));
347 //SIGNATURE_CHECK (GNULIB_NAMESPACE::tan, double, (double));
349 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanl, long double, (long double));
352 #if GNULIB_TEST_TANHF
353 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanhf, float, (float));
355 //SIGNATURE_CHECK (GNULIB_NAMESPACE::tanh, double, (double));
357 #if GNULIB_TEST_TRUNCF
358 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncf, float, (float));
360 #if GNULIB_TEST_TRUNC
361 SIGNATURE_CHECK (GNULIB_NAMESPACE::trunc, double, (double));
363 #if GNULIB_TEST_TRUNCL
364 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncl, long double, (long double));
367 //SIGNATURE_CHECK (GNULIB_NAMESPACE::y0, double, (double));
369 //SIGNATURE_CHECK (GNULIB_NAMESPACE::y1, double, (double));
371 //SIGNATURE_CHECK (GNULIB_NAMESPACE::yn, double, (int, double));
373 #if GNULIB_TEST_ISFINITE
375 # error "isfinite should not be a macro in C++"
377 REAL_FLOATING_CHECK (isfinite, int, (float), int, (double), int, (long double));
380 #if GNULIB_TEST_ISINF
382 # error "isinf should not be a macro in C++"
384 REAL_FLOATING_CHECK (isinf, int, (float), int, (double), int, (long double));
387 #if GNULIB_TEST_ISNAN
389 # error "isnan should not be a macro in C++"
391 REAL_FLOATING_CHECK (isnan, int, (float), int, (double), int, (long double));
394 #if GNULIB_TEST_SIGNBIT
396 # error "signbit should not be a macro in C++"
398 REAL_FLOATING_CHECK (signbit, int, (float), int, (double), int, (long double));