aboutsummaryrefslogtreecommitdiff
blob: 7cebb1ad97b12f396673bb31831e83a79f0ca8e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/* Test C99 math functions are available in C++11 without _GNU_SOURCE.
   Copyright (C) 2017-2020 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <https://www.gnu.org/licenses/>.  */

#undef _GNU_SOURCE
#undef _DEFAULT_SOURCE
#undef _XOPEN_SOURCE
#undef _POSIX_SOURCE
#undef _POSIX_C_SOURCE
// __STRICT_ANSI__ gets defined by -std=c++11 in CFLAGS
#include <math.h>
#include <stdio.h>

static int
do_test (void)
{
#ifdef _GNU_SOURCE
  printf ("FAIL: _GNU_SOURCE is defined.\n");
  return 1;
#endif

#if __cplusplus >= 201103L
  /* Verify that C11 math functions and types are defined for C++11,
     without _GNU_SOURCE being defined. [BZ #21326] */
  (void) FP_INFINITE;
  (void) FP_NAN;
  (void) FP_NORMAL;
  (void) FP_SUBNORMAL;
  (void) FP_ZERO;
  double_t d = 1.0;
  (void) d;
  float_t f = 1.0f;
  (void) f;
  (void) acosh;
  (void) acoshf;
  (void) acoshl;
  (void) asinh;
  (void) asinhf;
  (void) asinhl;
  (void) atanh;
  (void) atanhf;
  (void) atanhl;
  (void) cbrt;
  (void) cbrtf;
  (void) cbrtl;
  (void) copysign;
  (void) copysignf;
  (void) copysignl;
  (void) erf;
  (void) erff;
  (void) erfl;
  (void) erfc;
  (void) erfcf;
  (void) erfcl;
  (void) exp2;
  (void) exp2f;
  (void) exp2l;
  (void) expm1;
  (void) expm1f;
  (void) expm1l;
  (void) fdim;
  (void) fdimf;
  (void) fdiml;
  (void) fma;
  (void) fmaf;
  (void) fmal;
  (void) fmax;
  (void) fmaxf;
  (void) fmaxl;
  (void) fmin;
  (void) fminf;
  (void) fminl;
  (void) hypot;
  (void) hypotf;
  (void) hypotl;
  (void) ilogb;
  (void) ilogbf;
  (void) ilogbl;
  (void) lgamma;
  (void) lgammaf;
  (void) lgammal;
  (void) llrint;
  (void) llrintf;
  (void) llrintl;
  (void) llround;
  (void) llroundf;
  (void) llroundl;
  (void) log1p;
  (void) log1pf;
  (void) log1pl;
  (void) log2;
  (void) log2f;
  (void) log2l;
  (void) logb;
  (void) logbf;
  (void) logbl;
  (void) lrint;
  (void) lrintf;
  (void) lrintl;
  (void) lround;
  (void) lroundf;
  (void) lroundl;
  (void) nan;
  (void) nanf;
  (void) nanl;
  (void) nearbyint;
  (void) nearbyintf;
  (void) nearbyintl;
  (void) nextafter;
  (void) nextafterf;
  (void) nextafterl;
  (void) nexttoward;
  (void) nexttowardf;
  (void) nexttowardl;
  (void) remainder;
  (void) remainderf;
  (void) remainderl;
  (void) remquo;
  (void) remquof;
  (void) remquol;
  (void) rint;
  (void) rintf;
  (void) rintl;
  (void) round;
  (void) roundf;
  (void) roundl;
  (void) scalbln;
  (void) scalblnf;
  (void) scalblnl;
  (void) scalbn;
  (void) scalbnf;
  (void) scalbnl;
  (void) tgamma;
  (void) tgammaf;
  (void) tgammal;
  (void) trunc;
  (void) truncf;
  (void) truncl;
  printf ("PASS: C11 math functions present in C++11 without _GNU_SOURCE.\n");
#else
  printf ("UNSUPPORTED: C++11 not enabled.\n");
#endif
  return 0;
}

#include <support/test-driver.c>