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