1 /* Test of <math.h> substitute in C++ mode.
2 Copyright (C) 2010-2011 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));
71 //SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrt, double, (double));
74 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceilf, float, (float));
77 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceil, double, (double));
80 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceill, long double, (long double));
83 #if GNULIB_TEST_COPYSIGNF
84 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignf, float, (float, float));
86 #if GNULIB_TEST_COPYSIGN
87 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysign, double, (double, double));
89 #if GNULIB_TEST_COPYSIGNL
90 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignl, long double,
91 (long double, long double));
95 SIGNATURE_CHECK (GNULIB_NAMESPACE::cosf, float, (float));
97 //SIGNATURE_CHECK (GNULIB_NAMESPACE::cos, double, (double));
99 SIGNATURE_CHECK (GNULIB_NAMESPACE::cosl, long double, (long double));
102 #if GNULIB_TEST_COSHF
103 SIGNATURE_CHECK (GNULIB_NAMESPACE::coshf, float, (float));
105 //SIGNATURE_CHECK (GNULIB_NAMESPACE::cosh, double, (double));
107 //SIGNATURE_CHECK (GNULIB_NAMESPACE::erf, double, (double));
109 //SIGNATURE_CHECK (GNULIB_NAMESPACE::erfc, double, (double));
112 SIGNATURE_CHECK (GNULIB_NAMESPACE::expf, float, (float));
114 //SIGNATURE_CHECK (GNULIB_NAMESPACE::exp, double, (double));
116 SIGNATURE_CHECK (GNULIB_NAMESPACE::expl, long double, (long double));
119 #if GNULIB_TEST_FABSF
120 SIGNATURE_CHECK (GNULIB_NAMESPACE::fabsf, float, (float));
122 //SIGNATURE_CHECK (GNULIB_NAMESPACE::fabs, double, (double));
124 #if GNULIB_TEST_FLOORF
125 SIGNATURE_CHECK (GNULIB_NAMESPACE::floorf, float, (float));
127 #if GNULIB_TEST_FLOOR
128 SIGNATURE_CHECK (GNULIB_NAMESPACE::floor, double, (double));
130 #if GNULIB_TEST_FLOORL
131 SIGNATURE_CHECK (GNULIB_NAMESPACE::floorl, long double, (long double));
134 #if GNULIB_TEST_FMODF
135 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodf, float, (float, float));
137 //SIGNATURE_CHECK (GNULIB_NAMESPACE::fmod, double, (double, double));
139 #if GNULIB_TEST_FREXPF
140 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpf, float, (float, int *));
142 #if GNULIB_TEST_FREXP
143 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexp, double, (double, int *));
145 #if GNULIB_TEST_FREXPL
146 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpl, long double, (long double, int *));
149 //SIGNATURE_CHECK (GNULIB_NAMESPACE::hypot, double, (double, double));
151 //SIGNATURE_CHECK (GNULIB_NAMESPACE::j0, double, (double));
153 //SIGNATURE_CHECK (GNULIB_NAMESPACE::j1, double, (double));
155 //SIGNATURE_CHECK (GNULIB_NAMESPACE::jn, double, (int, double));
157 #if GNULIB_TEST_LDEXPF
158 SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpf, float, (float, int));
160 //SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexp, double, (double, int));
161 #if GNULIB_TEST_LDEXPL
162 SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpl, long double, (long double, int));
165 //SIGNATURE_CHECK (GNULIB_NAMESPACE::lgamma, double, (double));
167 //SIGNATURE_CHECK (GNULIB_NAMESPACE::log10, double, (double));
169 //SIGNATURE_CHECK (GNULIB_NAMESPACE::log1p, double, (double));
171 //SIGNATURE_CHECK (GNULIB_NAMESPACE::logb, double, (double));
174 SIGNATURE_CHECK (GNULIB_NAMESPACE::logf, float, (float));
176 //SIGNATURE_CHECK (GNULIB_NAMESPACE::log, double, (double));
178 SIGNATURE_CHECK (GNULIB_NAMESPACE::logl, long double, (long double));
181 #if GNULIB_TEST_LOG10F
182 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10f, float, (float));
185 #if GNULIB_TEST_MODFF
186 SIGNATURE_CHECK (GNULIB_NAMESPACE::modff, float, (float, float *));
188 //SIGNATURE_CHECK (GNULIB_NAMESPACE::modf, double, (double, double *));
190 //SIGNATURE_CHECK (GNULIB_NAMESPACE::nextafter, double, (double, double));
193 SIGNATURE_CHECK (GNULIB_NAMESPACE::powf, float, (float, float));
195 //SIGNATURE_CHECK (GNULIB_NAMESPACE::pow, double, (double, double));
197 //SIGNATURE_CHECK (GNULIB_NAMESPACE::remainder, double, (double, double));
199 #if GNULIB_TEST_RINTF
200 SIGNATURE_CHECK (GNULIB_NAMESPACE::rintf, float, (float));
203 SIGNATURE_CHECK (GNULIB_NAMESPACE::rint, double, (double));
205 #if GNULIB_TEST_RINTL
206 SIGNATURE_CHECK (GNULIB_NAMESPACE::rintl, long double, (long double));
209 #if GNULIB_TEST_ROUNDF
210 SIGNATURE_CHECK (GNULIB_NAMESPACE::roundf, float, (float));
212 #if GNULIB_TEST_ROUND
213 SIGNATURE_CHECK (GNULIB_NAMESPACE::round, double, (double));
215 #if GNULIB_TEST_ROUNDL
216 SIGNATURE_CHECK (GNULIB_NAMESPACE::roundl, long double, (long double));
220 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinf, float, (float));
222 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sin, double, (double));
224 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinl, long double, (long double));
227 #if GNULIB_TEST_SINHF
228 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinhf, float, (float));
230 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sinh, double, (double));
232 #if GNULIB_TEST_SQRTF
233 SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtf, float, (float));
235 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrt, double, (double));
236 #if GNULIB_TEST_SQRTL
237 SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtl, long double, (long double));
241 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanf, float, (float));
243 //SIGNATURE_CHECK (GNULIB_NAMESPACE::tan, double, (double));
245 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanl, long double, (long double));
248 #if GNULIB_TEST_TANHF
249 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanhf, float, (float));
251 //SIGNATURE_CHECK (GNULIB_NAMESPACE::tanh, double, (double));
253 #if GNULIB_TEST_TRUNCF
254 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncf, float, (float));
256 #if GNULIB_TEST_TRUNC
257 SIGNATURE_CHECK (GNULIB_NAMESPACE::trunc, double, (double));
259 #if GNULIB_TEST_TRUNCL
260 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncl, long double, (long double));
263 //SIGNATURE_CHECK (GNULIB_NAMESPACE::y0, double, (double));
265 //SIGNATURE_CHECK (GNULIB_NAMESPACE::y1, double, (double));
267 //SIGNATURE_CHECK (GNULIB_NAMESPACE::yn, double, (int, double));
269 #if GNULIB_TEST_ISFINITE
271 # error "isfinite should not be a macro in C++"
273 REAL_FLOATING_CHECK (isfinite, int, (float), int, (double), int, (long double));
276 #if GNULIB_TEST_ISINF
278 # error "isinf should not be a macro in C++"
280 REAL_FLOATING_CHECK (isinf, int, (float), int, (double), int, (long double));
283 #if GNULIB_TEST_ISNAN
285 # error "isnan should not be a macro in C++"
287 REAL_FLOATING_CHECK (isnan, int, (float), int, (double), int, (long double));
290 #if GNULIB_TEST_SIGNBIT
292 # error "signbit should not be a macro in C++"
294 REAL_FLOATING_CHECK (signbit, int, (float), int, (double), int, (long double));