]>
Commit | Line | Data |
---|---|---|
04277e02 | 1 | /* Copyright (C) 1991-2019 Free Software Foundation, Inc. |
2c6fe0bd | 2 | This file is part of the GNU C Library. |
28f540f4 | 3 | |
2c6fe0bd | 4 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
28f540f4 | 8 | |
2c6fe0bd UD |
9 | The GNU C Library 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 GNU | |
41bdb6e2 | 12 | Lesser General Public License for more details. |
28f540f4 | 13 | |
41bdb6e2 | 14 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
15 | License along with the GNU C Library; if not, see |
16 | <http://www.gnu.org/licenses/>. */ | |
28f540f4 RM |
17 | |
18 | #ifndef _FEATURES_H | |
28f540f4 RM |
19 | #define _FEATURES_H 1 |
20 | ||
21 | /* These are defined by the user (or the compiler) | |
22 | to specify the desired environment: | |
23 | ||
d38cd08c | 24 | __STRICT_ANSI__ ISO Standard C. |
ec751a23 | 25 | _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. |
d7809905 | 26 | _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. |
c0307377 ZW |
27 | __STDC_WANT_LIB_EXT2__ |
28 | Extensions to ISO C99 from TR 27431-2:2010. | |
29 | __STDC_WANT_IEC_60559_BFP_EXT__ | |
30 | Extensions to ISO C11 from TS 18661-1:2014. | |
31 | __STDC_WANT_IEC_60559_FUNCS_EXT__ | |
32 | Extensions to ISO C11 from TS 18661-4:2015. | |
4fc12f0e PM |
33 | __STDC_WANT_IEC_60559_TYPES_EXT__ |
34 | Extensions to ISO C11 from TS 18661-3:2015. | |
c0307377 | 35 | |
28f540f4 | 36 | _POSIX_SOURCE IEEE Std 1003.1. |
6d52618b | 37 | _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2; |
118bad87 | 38 | if >=199309L, add IEEE Std 1003.1b-1993; |
7a80496f UD |
39 | if >=199506L, add IEEE Std 1003.1c-1995; |
40 | if >=200112L, all of IEEE 1003.1-2004 | |
3e6b0a28 | 41 | if >=200809L, all of IEEE 1003.1-2008 |
a5a0310d | 42 | _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if |
925e31d9 | 43 | Single Unix conformance is wanted, to 600 for the |
3e6b0a28 | 44 | sixth revision, to 700 for the seventh revision. |
2c6fe0bd | 45 | _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions. |
dfd2257a UD |
46 | _LARGEFILE_SOURCE Some more functions for correct standard I/O. |
47 | _LARGEFILE64_SOURCE Additional functionality from LFS for large files. | |
48 | _FILE_OFFSET_BITS=N Select default filesystem interface. | |
0b8f25bb | 49 | _ATFILE_SOURCE Additional *at interfaces. |
28f540f4 | 50 | _GNU_SOURCE All of the above, plus GNU extensions. |
c688b419 JM |
51 | _DEFAULT_SOURCE The default set of features (taking precedence over |
52 | __STRICT_ANSI__). | |
c0307377 ZW |
53 | |
54 | _FORTIFY_SOURCE Add security hardening to many library functions. | |
55 | Set to 1 or 2; 2 performs stricter checks than 1. | |
56 | ||
57 | _REENTRANT, _THREAD_SAFE | |
58 | Obsolete; equivalent to _POSIX_C_SOURCE=199506L. | |
28f540f4 | 59 | |
c688b419 JM |
60 | The `-ansi' switch to the GNU C compiler, and standards conformance |
61 | options such as `-std=c99', define __STRICT_ANSI__. If none of | |
62 | these are defined, or if _DEFAULT_SOURCE is defined, the default is | |
c941736c JM |
63 | to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to |
64 | 200809L, as well as enabling miscellaneous functions from BSD and | |
65 | SVID. If more than one of these are defined, they accumulate. For | |
66 | example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together | |
67 | give you ISO C, 1003.1, and 1003.2, but nothing else. | |
28f540f4 RM |
68 | |
69 | These are defined by this file and are used by the | |
70 | header files to decide what to declare or define: | |
71 | ||
48789000 JM |
72 | __GLIBC_USE (F) Define things from feature set F. This is defined |
73 | to 1 or 0; the subsequent macros are either defined | |
74 | or undefined, and those tests should be moved to | |
75 | __GLIBC_USE. | |
d7809905 | 76 | __USE_ISOC11 Define ISO C11 things. |
ec751a23 | 77 | __USE_ISOC99 Define ISO C99 things. |
087722b8 | 78 | __USE_ISOC95 Define ISO C90 AMD1 (C95) things. |
d6c064e9 | 79 | __USE_ISOCXX11 Define ISO C++11 things. |
28f540f4 RM |
80 | __USE_POSIX Define IEEE Std 1003.1 things. |
81 | __USE_POSIX2 Define IEEE Std 1003.2 things. | |
4a582094 UD |
82 | __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things. |
83 | __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things. | |
2c6fe0bd UD |
84 | __USE_XOPEN Define XPG things. |
85 | __USE_XOPEN_EXTENDED Define X/Open Unix things. | |
a5a0310d | 86 | __USE_UNIX98 Define Single Unix V2 things. |
925e31d9 | 87 | __USE_XOPEN2K Define XPG6 things. |
f095bb72 | 88 | __USE_XOPEN2KXSI Define XPG6 XSI things. |
81489b2e | 89 | __USE_XOPEN2K8 Define XPG7 things. |
f095bb72 | 90 | __USE_XOPEN2K8XSI Define XPG7 XSI things. |
925e31d9 | 91 | __USE_LARGEFILE Define correct standard I/O things. |
dfd2257a UD |
92 | __USE_LARGEFILE64 Define LFS things with separate names. |
93 | __USE_FILE_OFFSET64 Define 64bit interface as default. | |
498afc54 | 94 | __USE_MISC Define things from 4.3BSD or System V Unix. |
0b8f25bb | 95 | __USE_ATFILE Define *at interfaces and AT_* constants for them. |
28f540f4 | 96 | __USE_GNU Define GNU extensions. |
b5cc329c | 97 | __USE_FORTIFY_LEVEL Additional security measures used, according to level. |
28f540f4 | 98 | |
d38cd08c UD |
99 | The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are |
100 | defined by this file unconditionally. `__GNU_LIBRARY__' is provided | |
101 | only for compatibility. All new code should use the other symbols | |
102 | to test for features. | |
28f540f4 | 103 | |
28f540f4 RM |
104 | All macros listed above as possibly being defined by this file are |
105 | explicitly undefined if they are not explicitly defined. | |
106 | Feature-test macros that are not defined by the user or compiler | |
107 | but are implied by the other feature-test macros defined (or by the | |
48789000 JM |
108 | lack of any definitions) are defined by the file. |
109 | ||
110 | ISO C feature test macros depend on the definition of the macro | |
111 | when an affected header is included, not when the first system | |
112 | header is included, and so they are handled in | |
113 | <bits/libc-header-start.h>, which does not have a multiple include | |
114 | guard. Feature test macros that can be handled from the first | |
115 | system header included are handled here. */ | |
28f540f4 RM |
116 | |
117 | ||
118 | /* Undefine everything, so we get a clean slate. */ | |
d7809905 | 119 | #undef __USE_ISOC11 |
ec751a23 | 120 | #undef __USE_ISOC99 |
087722b8 | 121 | #undef __USE_ISOC95 |
8fd8ff3b | 122 | #undef __USE_ISOCXX11 |
28f540f4 RM |
123 | #undef __USE_POSIX |
124 | #undef __USE_POSIX2 | |
6d52618b | 125 | #undef __USE_POSIX199309 |
4a582094 | 126 | #undef __USE_POSIX199506 |
2c6fe0bd UD |
127 | #undef __USE_XOPEN |
128 | #undef __USE_XOPEN_EXTENDED | |
dfd2257a | 129 | #undef __USE_UNIX98 |
24d6fe58 | 130 | #undef __USE_XOPEN2K |
f095bb72 | 131 | #undef __USE_XOPEN2KXSI |
3e6b0a28 | 132 | #undef __USE_XOPEN2K8 |
f095bb72 | 133 | #undef __USE_XOPEN2K8XSI |
dfd2257a UD |
134 | #undef __USE_LARGEFILE |
135 | #undef __USE_LARGEFILE64 | |
136 | #undef __USE_FILE_OFFSET64 | |
28f540f4 | 137 | #undef __USE_MISC |
0b8f25bb | 138 | #undef __USE_ATFILE |
28f540f4 | 139 | #undef __USE_GNU |
b5cc329c | 140 | #undef __USE_FORTIFY_LEVEL |
a1470b6f | 141 | #undef __KERNEL_STRICT_NAMES |
7caa5054 | 142 | #undef __GLIBC_USE_DEPRECATED_GETS |
03992356 | 143 | #undef __GLIBC_USE_DEPRECATED_SCANF |
28f540f4 | 144 | |
a1470b6f | 145 | /* Suppress kernel-name space pollution unless user expressedly asks |
2c6fe0bd | 146 | for it. */ |
a1470b6f RM |
147 | #ifndef _LOOSE_KERNEL_NAMES |
148 | # define __KERNEL_STRICT_NAMES | |
149 | #endif | |
28f540f4 | 150 | |
cab4d74b ZW |
151 | /* Convenience macro to test the version of gcc. |
152 | Use like this: | |
b5cc329c UD |
153 | #if __GNUC_PREREQ (2,8) |
154 | ... code requiring gcc 2.8 or later ... | |
155 | #endif | |
cab4d74b ZW |
156 | Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was |
157 | added in 2.0. */ | |
b5cc329c UD |
158 | #if defined __GNUC__ && defined __GNUC_MINOR__ |
159 | # define __GNUC_PREREQ(maj, min) \ | |
160 | ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) | |
161 | #else | |
162 | # define __GNUC_PREREQ(maj, min) 0 | |
163 | #endif | |
164 | ||
cab4d74b ZW |
165 | /* Similarly for clang. Features added to GCC after version 4.2 may |
166 | or may not also be available in clang, and clang's definitions of | |
167 | __GNUC(_MINOR)__ are fixed at 4 and 2 respectively. Not all such | |
168 | features can be queried via __has_extension/__has_feature. */ | |
169 | #if defined __clang_major__ && defined __clang_minor__ | |
170 | # define __glibc_clang_prereq(maj, min) \ | |
171 | ((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min)) | |
172 | #else | |
173 | # define __glibc_clang_prereq(maj, min) 0 | |
174 | #endif | |
175 | ||
48789000 JM |
176 | /* Whether to use feature set F. */ |
177 | #define __GLIBC_USE(F) __GLIBC_USE_ ## F | |
178 | ||
c941736c | 179 | /* _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for |
ade40b10 CD |
180 | _DEFAULT_SOURCE. If _DEFAULT_SOURCE is present we do not |
181 | issue a warning; the expectation is that the source is being | |
182 | transitioned to use the new macro. */ | |
183 | #if (defined _BSD_SOURCE || defined _SVID_SOURCE) \ | |
184 | && !defined _DEFAULT_SOURCE | |
c941736c JM |
185 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" |
186 | # undef _DEFAULT_SOURCE | |
187 | # define _DEFAULT_SOURCE 1 | |
188 | #endif | |
28f540f4 | 189 | |
59dd8641 RM |
190 | /* If _GNU_SOURCE was defined by the user, turn on all the other features. */ |
191 | #ifdef _GNU_SOURCE | |
e531ede5 UD |
192 | # undef _ISOC95_SOURCE |
193 | # define _ISOC95_SOURCE 1 | |
ec751a23 UD |
194 | # undef _ISOC99_SOURCE |
195 | # define _ISOC99_SOURCE 1 | |
d7809905 UD |
196 | # undef _ISOC11_SOURCE |
197 | # define _ISOC11_SOURCE 1 | |
5107cf1d UD |
198 | # undef _POSIX_SOURCE |
199 | # define _POSIX_SOURCE 1 | |
200 | # undef _POSIX_C_SOURCE | |
3e6b0a28 | 201 | # define _POSIX_C_SOURCE 200809L |
5107cf1d | 202 | # undef _XOPEN_SOURCE |
3e6b0a28 | 203 | # define _XOPEN_SOURCE 700 |
5107cf1d UD |
204 | # undef _XOPEN_SOURCE_EXTENDED |
205 | # define _XOPEN_SOURCE_EXTENDED 1 | |
dfd2257a UD |
206 | # undef _LARGEFILE64_SOURCE |
207 | # define _LARGEFILE64_SOURCE 1 | |
c688b419 JM |
208 | # undef _DEFAULT_SOURCE |
209 | # define _DEFAULT_SOURCE 1 | |
0b8f25bb RM |
210 | # undef _ATFILE_SOURCE |
211 | # define _ATFILE_SOURCE 1 | |
59dd8641 | 212 | #endif |
28f540f4 | 213 | |
c688b419 | 214 | /* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, |
498afc54 | 215 | define _DEFAULT_SOURCE. */ |
c688b419 JM |
216 | #if (defined _DEFAULT_SOURCE \ |
217 | || (!defined __STRICT_ANSI__ \ | |
862b4502 | 218 | && !defined _ISOC99_SOURCE && !defined _ISOC11_SOURCE \ |
c688b419 | 219 | && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE \ |
498afc54 | 220 | && !defined _XOPEN_SOURCE)) |
c688b419 JM |
221 | # undef _DEFAULT_SOURCE |
222 | # define _DEFAULT_SOURCE 1 | |
28f540f4 RM |
223 | #endif |
224 | ||
d7809905 UD |
225 | /* This is to enable the ISO C11 extension. */ |
226 | #if (defined _ISOC11_SOURCE \ | |
227 | || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)) | |
c0e87cc0 UD |
228 | # define __USE_ISOC11 1 |
229 | #endif | |
d7809905 UD |
230 | |
231 | /* This is to enable the ISO C99 extension. */ | |
232 | #if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ | |
47a81620 | 233 | || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) |
ec751a23 | 234 | # define __USE_ISOC99 1 |
2f6d1f1b UD |
235 | #endif |
236 | ||
087722b8 | 237 | /* This is to enable the ISO C90 Amendment 1:1995 extension. */ |
d7809905 | 238 | #if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ |
087722b8 UD |
239 | || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199409L)) |
240 | # define __USE_ISOC95 1 | |
241 | #endif | |
242 | ||
d6c064e9 JW |
243 | #ifdef __cplusplus |
244 | /* This is to enable compatibility for ISO C++17. */ | |
245 | # if __cplusplus >= 201703L | |
246 | # define __USE_ISOC11 1 | |
247 | # endif | |
8fd8ff3b | 248 | /* This is to enable compatibility for ISO C++11. |
d6c064e9 JW |
249 | Check the temporary macro for now, too. */ |
250 | # if __cplusplus >= 201103L || defined __GXX_EXPERIMENTAL_CXX0X__ | |
251 | # define __USE_ISOCXX11 1 | |
252 | # define __USE_ISOC99 1 | |
253 | # endif | |
8fd8ff3b UD |
254 | #endif |
255 | ||
c688b419 JM |
256 | /* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE |
257 | is defined, use POSIX.1-2008 (or another version depending on | |
258 | _XOPEN_SOURCE). */ | |
259 | #ifdef _DEFAULT_SOURCE | |
260 | # if !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE | |
261 | # define __USE_POSIX_IMPLICITLY 1 | |
262 | # endif | |
263 | # undef _POSIX_SOURCE | |
264 | # define _POSIX_SOURCE 1 | |
265 | # undef _POSIX_C_SOURCE | |
266 | # define _POSIX_C_SOURCE 200809L | |
267 | #endif | |
c0307377 | 268 | |
f248238c JM |
269 | #if ((!defined __STRICT_ANSI__ \ |
270 | || (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500)) \ | |
271 | && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE) | |
5107cf1d | 272 | # define _POSIX_SOURCE 1 |
925e31d9 | 273 | # if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500 |
5107cf1d | 274 | # define _POSIX_C_SOURCE 2 |
1676aaef | 275 | # elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 600 |
a334319f | 276 | # define _POSIX_C_SOURCE 199506L |
3e6b0a28 | 277 | # elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 700 |
1676aaef | 278 | # define _POSIX_C_SOURCE 200112L |
3e6b0a28 UD |
279 | # else |
280 | # define _POSIX_C_SOURCE 200809L | |
5107cf1d | 281 | # endif |
2e6d6bac | 282 | # define __USE_POSIX_IMPLICITLY 1 |
28f540f4 RM |
283 | #endif |
284 | ||
c0307377 ZW |
285 | /* Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be |
286 | defined in all multithreaded code. GNU libc has not required this | |
287 | for many years. We now treat them as compatibility synonyms for | |
288 | _POSIX_C_SOURCE=199506L, which is the earliest level of POSIX with | |
289 | comprehensive support for multithreaded code. Using them never | |
290 | lowers the selected level of POSIX conformance, only raises it. */ | |
291 | #if ((!defined _POSIX_C_SOURCE || (_POSIX_C_SOURCE - 0) < 199506L) \ | |
292 | && (defined _REENTRANT || defined _THREAD_SAFE)) | |
293 | # define _POSIX_SOURCE 1 | |
294 | # undef _POSIX_C_SOURCE | |
295 | # define _POSIX_C_SOURCE 199506L | |
296 | #endif | |
297 | ||
f248238c JM |
298 | #if (defined _POSIX_SOURCE \ |
299 | || (defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 1) \ | |
300 | || defined _XOPEN_SOURCE) | |
5107cf1d | 301 | # define __USE_POSIX 1 |
28f540f4 RM |
302 | #endif |
303 | ||
d38cd08c | 304 | #if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE |
5107cf1d | 305 | # define __USE_POSIX2 1 |
28f540f4 RM |
306 | #endif |
307 | ||
f248238c | 308 | #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L |
9756dfe1 | 309 | # define __USE_POSIX199309 1 |
6d52618b UD |
310 | #endif |
311 | ||
f248238c | 312 | #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199506L |
4a582094 UD |
313 | # define __USE_POSIX199506 1 |
314 | #endif | |
315 | ||
f248238c | 316 | #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200112L |
23ae6451 | 317 | # define __USE_XOPEN2K 1 |
e531ede5 UD |
318 | # undef __USE_ISOC95 |
319 | # define __USE_ISOC95 1 | |
c163ee23 UD |
320 | # undef __USE_ISOC99 |
321 | # define __USE_ISOC99 1 | |
23ae6451 UD |
322 | #endif |
323 | ||
f248238c | 324 | #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200809L |
3e6b0a28 UD |
325 | # define __USE_XOPEN2K8 1 |
326 | # undef _ATFILE_SOURCE | |
327 | # define _ATFILE_SOURCE 1 | |
328 | #endif | |
329 | ||
2c6fe0bd | 330 | #ifdef _XOPEN_SOURCE |
5107cf1d | 331 | # define __USE_XOPEN 1 |
219aa9e9 | 332 | # if (_XOPEN_SOURCE - 0) >= 500 |
5107cf1d | 333 | # define __USE_XOPEN_EXTENDED 1 |
a5a0310d | 334 | # define __USE_UNIX98 1 |
dfd2257a UD |
335 | # undef _LARGEFILE_SOURCE |
336 | # define _LARGEFILE_SOURCE 1 | |
925e31d9 | 337 | # if (_XOPEN_SOURCE - 0) >= 600 |
3e6b0a28 UD |
338 | # if (_XOPEN_SOURCE - 0) >= 700 |
339 | # define __USE_XOPEN2K8 1 | |
f095bb72 | 340 | # define __USE_XOPEN2K8XSI 1 |
3e6b0a28 | 341 | # endif |
219aa9e9 | 342 | # define __USE_XOPEN2K 1 |
f095bb72 | 343 | # define __USE_XOPEN2KXSI 1 |
e531ede5 UD |
344 | # undef __USE_ISOC95 |
345 | # define __USE_ISOC95 1 | |
91bc38d0 UD |
346 | # undef __USE_ISOC99 |
347 | # define __USE_ISOC99 1 | |
219aa9e9 | 348 | # endif |
a5a0310d UD |
349 | # else |
350 | # ifdef _XOPEN_SOURCE_EXTENDED | |
351 | # define __USE_XOPEN_EXTENDED 1 | |
352 | # endif | |
5107cf1d | 353 | # endif |
2c6fe0bd UD |
354 | #endif |
355 | ||
dfd2257a UD |
356 | #ifdef _LARGEFILE_SOURCE |
357 | # define __USE_LARGEFILE 1 | |
358 | #endif | |
359 | ||
360 | #ifdef _LARGEFILE64_SOURCE | |
361 | # define __USE_LARGEFILE64 1 | |
362 | #endif | |
363 | ||
364 | #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64 | |
365 | # define __USE_FILE_OFFSET64 1 | |
366 | #endif | |
367 | ||
498afc54 | 368 | #if defined _DEFAULT_SOURCE |
5107cf1d | 369 | # define __USE_MISC 1 |
28f540f4 RM |
370 | #endif |
371 | ||
0b8f25bb RM |
372 | #ifdef _ATFILE_SOURCE |
373 | # define __USE_ATFILE 1 | |
374 | #endif | |
375 | ||
28f540f4 | 376 | #ifdef _GNU_SOURCE |
5107cf1d | 377 | # define __USE_GNU 1 |
28f540f4 RM |
378 | #endif |
379 | ||
05c2c961 RMG |
380 | #if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 |
381 | # if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0 | |
382 | # warning _FORTIFY_SOURCE requires compiling with optimization (-O) | |
383 | # elif !__GNUC_PREREQ (4, 1) | |
384 | # warning _FORTIFY_SOURCE requires GCC 4.1 or later | |
385 | # elif _FORTIFY_SOURCE > 1 | |
a334319f | 386 | # define __USE_FORTIFY_LEVEL 2 |
faa26ad4 RM |
387 | # else |
388 | # define __USE_FORTIFY_LEVEL 1 | |
b5cc329c | 389 | # endif |
05c2c961 RMG |
390 | #endif |
391 | #ifndef __USE_FORTIFY_LEVEL | |
faa26ad4 | 392 | # define __USE_FORTIFY_LEVEL 0 |
b5cc329c UD |
393 | #endif |
394 | ||
7caa5054 ZW |
395 | /* The function 'gets' existed in C89, but is impossible to use |
396 | safely. It has been removed from ISO C11 and ISO C++14. Note: for | |
397 | compatibility with various implementations of <cstdio>, this test | |
398 | must consider only the value of __cplusplus when compiling C++. */ | |
399 | #if defined __cplusplus ? __cplusplus >= 201402L : defined __USE_ISOC11 | |
400 | # define __GLIBC_USE_DEPRECATED_GETS 0 | |
401 | #else | |
402 | # define __GLIBC_USE_DEPRECATED_GETS 1 | |
403 | #endif | |
404 | ||
03992356 ZW |
405 | /* GNU formerly extended the scanf functions with modified format |
406 | specifiers %as, %aS, and %a[...] that allocate a buffer for the | |
407 | input using malloc. This extension conflicts with ISO C99, which | |
408 | defines %a as a standalone format specifier that reads a floating- | |
409 | point number; moreover, POSIX.1-2008 provides the same feature | |
410 | using the modifier letter 'm' instead (%ms, %mS, %m[...]). | |
411 | ||
412 | We now follow C99 unless GNU extensions are active and the compiler | |
413 | is specifically in C89 or C++98 mode (strict or not). For | |
414 | instance, with GCC, -std=gnu11 will have C99-compliant scanf with | |
415 | or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the | |
416 | old extension. */ | |
417 | #if defined __USE_GNU && \ | |
418 | (defined __cplusplus \ | |
419 | ? (__cplusplus < 201103L && !defined __GXX_EXPERIMENTAL_CXX0X__) \ | |
420 | : (!defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L)) | |
421 | # define __GLIBC_USE_DEPRECATED_SCANF 1 | |
422 | #else | |
423 | # define __GLIBC_USE_DEPRECATED_SCANF 0 | |
424 | #endif | |
425 | ||
ff3b3d82 JM |
426 | /* Get definitions of __STDC_* predefined macros, if the compiler has |
427 | not preincluded this header automatically. */ | |
428 | #include <stdc-predef.h> | |
91bc38d0 | 429 | |
ba1ffaa1 UD |
430 | /* This macro indicates that the installed library is the GNU C Library. |
431 | For historic reasons the value now is 6 and this will stay from now | |
432 | on. The use of this variable is deprecated. Use __GLIBC__ and | |
433 | __GLIBC_MINOR__ now (see below) when you want to test for a specific | |
434 | GNU C library version and use the values in <gnu/lib-names.h> to get | |
435 | the sonames of the shared libraries. */ | |
436 | #undef __GNU_LIBRARY__ | |
437 | #define __GNU_LIBRARY__ 6 | |
438 | ||
439 | /* Major and minor version number of the GNU C library package. Use | |
440 | these macros to test for features in specific releases. */ | |
441 | #define __GLIBC__ 2 | |
56c86f5d | 442 | #define __GLIBC_MINOR__ 29 |
28f540f4 | 443 | |
f042f18f UD |
444 | #define __GLIBC_PREREQ(maj, min) \ |
445 | ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) | |
4360eafd | 446 | |
28f540f4 | 447 | /* This is here only because every header file already includes this one. */ |
edf5b2d7 | 448 | #ifndef __ASSEMBLER__ |
95589177 UD |
449 | # ifndef _SYS_CDEFS_H |
450 | # include <sys/cdefs.h> | |
451 | # endif | |
01cad722 UD |
452 | |
453 | /* If we don't have __REDIRECT, prototypes will be missing if | |
454 | __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */ | |
455 | # if defined __USE_FILE_OFFSET64 && !defined __REDIRECT | |
4152ed15 UD |
456 | # define __USE_LARGEFILE 1 |
457 | # define __USE_LARGEFILE64 1 | |
01cad722 UD |
458 | # endif |
459 | ||
eedbbe58 UD |
460 | #endif /* !ASSEMBLER */ |
461 | ||
462 | /* Decide whether we can define 'extern inline' functions in headers. */ | |
07c416ed | 463 | #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ |
de1c3ebb UD |
464 | && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \ |
465 | && defined __extern_inline | |
eedbbe58 | 466 | # define __USE_EXTERN_INLINES 1 |
edf5b2d7 | 467 | #endif |
28f540f4 | 468 | |
28f540f4 | 469 | |
ce460d04 RM |
470 | /* This is here only because every header file already includes this one. |
471 | Get the definitions of all the appropriate `__stub_FUNCTION' symbols. | |
472 | <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub | |
473 | that will always return failure (and set errno to ENOSYS). */ | |
474 | #include <gnu/stubs.h> | |
28f540f4 | 475 | |
28f540f4 | 476 | |
6ed0492f | 477 | #endif /* features.h */ |