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