features.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. /* Copyright (C) 1991-2026 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <https://www.gnu.org/licenses/>. */
  14. #ifndef _FEATURES_H
  15. #define _FEATURES_H 1
  16. /* These are defined by the user (or the compiler)
  17. to specify the desired environment:
  18. __STRICT_ANSI__ ISO Standard C.
  19. _ISOC99_SOURCE Extensions to ISO C89 from ISO C99.
  20. _ISOC11_SOURCE Extensions to ISO C99 from ISO C11.
  21. _ISOC23_SOURCE Extensions to ISO C99 from ISO C23.
  22. _ISOC2X_SOURCE Old name for _ISOC23_SOURCE.
  23. _ISOC2Y_SOURCE Extensions to ISO C23 from ISO C2Y.
  24. __STDC_WANT_LIB_EXT2__
  25. Extensions to ISO C99 from TR 27431-2:2010.
  26. __STDC_WANT_IEC_60559_BFP_EXT__
  27. Extensions to ISO C11 from TS 18661-1:2014.
  28. __STDC_WANT_IEC_60559_FUNCS_EXT__
  29. Extensions to ISO C11 from TS 18661-4:2015.
  30. __STDC_WANT_IEC_60559_TYPES_EXT__
  31. Extensions to ISO C11 from TS 18661-3:2015.
  32. __STDC_WANT_IEC_60559_EXT__
  33. ISO C23 interfaces defined only in Annex F.
  34. _POSIX_SOURCE IEEE Std 1003.1.
  35. _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
  36. if >=199309L, add IEEE Std 1003.1b-1993;
  37. if >=199506L, add IEEE Std 1003.1c-1995;
  38. if >=200112L, all of IEEE 1003.1-2004
  39. if >=200809L, all of IEEE 1003.1-2008
  40. if >=202405L, all of IEEE 1003.1-2024
  41. _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if
  42. Single Unix conformance is wanted, to 600 for the
  43. sixth revision, to 700 for the seventh revision,
  44. to 800 for the eighth revision.
  45. _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
  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.
  49. _ATFILE_SOURCE Additional *at interfaces.
  50. _DYNAMIC_STACK_SIZE_SOURCE Select correct (but non compile-time constant)
  51. MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN.
  52. _GNU_SOURCE All of the above, plus GNU extensions.
  53. _DEFAULT_SOURCE The default set of features (taking precedence over
  54. __STRICT_ANSI__).
  55. _FORTIFY_SOURCE Add security hardening to many library functions.
  56. Set to 1, 2 or 3; 3 performs stricter checks than 2, which
  57. performs stricter checks than 1.
  58. _REENTRANT, _THREAD_SAFE
  59. Obsolete; equivalent to _POSIX_C_SOURCE=199506L.
  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
  63. to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
  64. 202405L, 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.
  68. These are defined by this file and are used by the
  69. header files to decide what to declare or define:
  70. __GLIBC_USE (F) Define things from feature set F. This is defined
  71. to 1 or 0; the subsequent macros are either defined
  72. or undefined, and those tests should be moved to
  73. __GLIBC_USE.
  74. __USE_ISOC11 Define ISO C11 things.
  75. __USE_ISOC99 Define ISO C99 things.
  76. __USE_ISOC95 Define ISO C90 AMD1 (C95) things.
  77. __USE_ISOCXX11 Define ISO C++11 things.
  78. __USE_POSIX Define IEEE Std 1003.1 things.
  79. __USE_POSIX2 Define IEEE Std 1003.2 things.
  80. __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things.
  81. __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things.
  82. __USE_XOPEN Define XPG things.
  83. __USE_XOPEN_EXTENDED Define X/Open Unix things.
  84. __USE_UNIX98 Define Single Unix V2 things.
  85. __USE_XOPEN2K Define XPG6 things.
  86. __USE_XOPEN2KXSI Define XPG6 XSI things.
  87. __USE_XOPEN2K8 Define XPG7 things.
  88. __USE_XOPEN2K8XSI Define XPG7 XSI things.
  89. __USE_XOPEN2K24 Define XPG8 things.
  90. __USE_XOPEN2K24XSI Define XPG8 XSI things.
  91. __USE_LARGEFILE Define correct standard I/O things.
  92. __USE_LARGEFILE64 Define LFS things with separate names.
  93. __USE_FILE_OFFSET64 Define 64bit interface as default.
  94. __USE_MISC Define things from 4.3BSD or System V Unix.
  95. __USE_ATFILE Define *at interfaces and AT_* constants for them.
  96. __USE_DYNAMIC_STACK_SIZE Define correct (but non compile-time constant)
  97. MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN.
  98. __USE_GNU Define GNU extensions.
  99. __USE_FORTIFY_LEVEL Additional security measures used, according to level.
  100. The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
  101. defined by this file unconditionally. `__GNU_LIBRARY__' is provided
  102. only for compatibility. All new code should use the other symbols
  103. to test for features.
  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
  108. lack of any definitions) are defined by the file.
  109. ISO C feature test macros depend on the definition of the macro
  110. when an affected header is included, not when the first system
  111. header is included, and so they are handled in
  112. <bits/libc-header-start.h>, which does not have a multiple include
  113. guard. Feature test macros that can be handled from the first
  114. system header included are handled here. */
  115. /* Undefine everything, so we get a clean slate. */
  116. #undef __USE_ISOC11
  117. #undef __USE_ISOC99
  118. #undef __USE_ISOC95
  119. #undef __USE_ISOCXX11
  120. #undef __USE_POSIX
  121. #undef __USE_POSIX2
  122. #undef __USE_POSIX199309
  123. #undef __USE_POSIX199506
  124. #undef __USE_XOPEN
  125. #undef __USE_XOPEN_EXTENDED
  126. #undef __USE_UNIX98
  127. #undef __USE_XOPEN2K
  128. #undef __USE_XOPEN2KXSI
  129. #undef __USE_XOPEN2K8
  130. #undef __USE_XOPEN2K8XSI
  131. #undef __USE_XOPEN2K24
  132. #undef __USE_XOPEN2K24XSI
  133. #undef __USE_LARGEFILE
  134. #undef __USE_LARGEFILE64
  135. #undef __USE_FILE_OFFSET64
  136. #undef __USE_MISC
  137. #undef __USE_ATFILE
  138. #undef __USE_DYNAMIC_STACK_SIZE
  139. #undef __USE_GNU
  140. #undef __USE_FORTIFY_LEVEL
  141. #undef __KERNEL_STRICT_NAMES
  142. #undef __GLIBC_USE_ISOC23
  143. #undef __GLIBC_USE_ISOC2Y
  144. #undef __GLIBC_USE_DEPRECATED_GETS
  145. #undef __GLIBC_USE_DEPRECATED_SCANF
  146. #undef __GLIBC_USE_C23_STRTOL
  147. /* Suppress kernel-name space pollution unless user explicitly asks
  148. for it. */
  149. #ifndef _LOOSE_KERNEL_NAMES
  150. # define __KERNEL_STRICT_NAMES
  151. #endif
  152. /* Convenience macro to test the version of gcc.
  153. Use like this:
  154. #if __GNUC_PREREQ (2,8)
  155. ... code requiring gcc 2.8 or later ...
  156. #endif
  157. Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was
  158. added in 2.0. */
  159. #if defined __GNUC__ && defined __GNUC_MINOR__
  160. # define __GNUC_PREREQ(maj, min) \
  161. ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
  162. #else
  163. # define __GNUC_PREREQ(maj, min) 0
  164. #endif
  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. /* Whether to use feature set F. */
  176. #define __GLIBC_USE(F) __GLIBC_USE_ ## F
  177. /* _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for
  178. _DEFAULT_SOURCE. If _DEFAULT_SOURCE is present we do not
  179. issue a warning; the expectation is that the source is being
  180. transitioned to use the new macro. */
  181. #if (defined _BSD_SOURCE || defined _SVID_SOURCE) \
  182. && !defined _DEFAULT_SOURCE
  183. # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
  184. # undef _DEFAULT_SOURCE
  185. # define _DEFAULT_SOURCE 1
  186. #endif
  187. /* Remap the old name _ISOC2X_SOURCE to _ISOC23_SOURCE. */
  188. #ifdef _ISOC2X_SOURCE
  189. # undef _ISOC2X_SOURCE
  190. # undef _ISOC23_SOURCE
  191. # define _ISOC23_SOURCE 1
  192. #endif
  193. /* If _GNU_SOURCE was defined by the user, turn on all the other features. */
  194. #ifdef _GNU_SOURCE
  195. # undef _ISOC95_SOURCE
  196. # define _ISOC95_SOURCE 1
  197. # undef _ISOC99_SOURCE
  198. # define _ISOC99_SOURCE 1
  199. # undef _ISOC11_SOURCE
  200. # define _ISOC11_SOURCE 1
  201. # undef _ISOC23_SOURCE
  202. # define _ISOC23_SOURCE 1
  203. # undef _ISOC2Y_SOURCE
  204. # define _ISOC2Y_SOURCE 1
  205. # undef _POSIX_SOURCE
  206. # define _POSIX_SOURCE 1
  207. # undef _POSIX_C_SOURCE
  208. # define _POSIX_C_SOURCE 202405L
  209. # undef _XOPEN_SOURCE
  210. # define _XOPEN_SOURCE 800
  211. # undef _XOPEN_SOURCE_EXTENDED
  212. # define _XOPEN_SOURCE_EXTENDED 1
  213. # undef _LARGEFILE64_SOURCE
  214. # define _LARGEFILE64_SOURCE 1
  215. # undef _DEFAULT_SOURCE
  216. # define _DEFAULT_SOURCE 1
  217. # undef _ATFILE_SOURCE
  218. # define _ATFILE_SOURCE 1
  219. # undef _DYNAMIC_STACK_SIZE_SOURCE
  220. # define _DYNAMIC_STACK_SIZE_SOURCE 1
  221. #endif
  222. /* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,
  223. define _DEFAULT_SOURCE. */
  224. #if (defined _DEFAULT_SOURCE \
  225. || (!defined __STRICT_ANSI__ \
  226. && !defined _ISOC99_SOURCE && !defined _ISOC11_SOURCE \
  227. && !defined _ISOC23_SOURCE && !defined _ISOC2Y_SOURCE \
  228. && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE \
  229. && !defined _XOPEN_SOURCE))
  230. # undef _DEFAULT_SOURCE
  231. # define _DEFAULT_SOURCE 1
  232. #endif
  233. /* This is to enable the ISO C2Y extension. */
  234. #if (defined _ISOC2Y_SOURCE \
  235. || (defined __STDC_VERSION__ && __STDC_VERSION__ > 202311L))
  236. # define __GLIBC_USE_ISOC2Y 1
  237. #else
  238. # define __GLIBC_USE_ISOC2Y 0
  239. #endif
  240. /* This is to enable the ISO C23 extension. */
  241. #if (defined _ISOC23_SOURCE || defined _ISOC2Y_SOURCE \
  242. || (defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L))
  243. # define __GLIBC_USE_ISOC23 1
  244. #else
  245. # define __GLIBC_USE_ISOC23 0
  246. #endif
  247. /* This is to enable the ISO C11 extension. */
  248. #if (defined _ISOC11_SOURCE || defined _ISOC23_SOURCE \
  249. || defined _ISOC2Y_SOURCE \
  250. || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L))
  251. # define __USE_ISOC11 1
  252. #endif
  253. /* This is to enable the ISO C99 extension. */
  254. #if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \
  255. || defined _ISOC23_SOURCE || defined _ISOC2Y_SOURCE \
  256. || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
  257. # define __USE_ISOC99 1
  258. #endif
  259. /* This is to enable the ISO C90 Amendment 1:1995 extension. */
  260. #if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \
  261. || defined _ISOC23_SOURCE || defined _ISOC2Y_SOURCE \
  262. || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199409L))
  263. # define __USE_ISOC95 1
  264. #endif
  265. #ifdef __cplusplus
  266. /* This is to enable compatibility for ISO C++17. */
  267. # if __cplusplus >= 201703L
  268. # define __USE_ISOC11 1
  269. # endif
  270. /* This is to enable compatibility for ISO C++11.
  271. Check the temporary macro for now, too. */
  272. # if __cplusplus >= 201103L || defined __GXX_EXPERIMENTAL_CXX0X__
  273. # define __USE_ISOCXX11 1
  274. # define __USE_ISOC99 1
  275. # endif
  276. #endif
  277. /* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE
  278. is defined, use POSIX.1-2024 (or another version depending on
  279. _XOPEN_SOURCE). */
  280. #ifdef _DEFAULT_SOURCE
  281. # if !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE
  282. # define __USE_POSIX_IMPLICITLY 1
  283. # endif
  284. # undef _POSIX_SOURCE
  285. # define _POSIX_SOURCE 1
  286. # undef _POSIX_C_SOURCE
  287. # define _POSIX_C_SOURCE 202405L
  288. #endif
  289. #if ((!defined __STRICT_ANSI__ \
  290. || (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500)) \
  291. && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE)
  292. # define _POSIX_SOURCE 1
  293. # if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500
  294. # define _POSIX_C_SOURCE 2
  295. # elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 600
  296. # define _POSIX_C_SOURCE 199506L
  297. # elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 700
  298. # define _POSIX_C_SOURCE 200112L
  299. # elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 800
  300. # define _POSIX_C_SOURCE 200809L
  301. # else
  302. # define _POSIX_C_SOURCE 202405L
  303. # endif
  304. # define __USE_POSIX_IMPLICITLY 1
  305. #endif
  306. /* Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be
  307. defined in all multithreaded code. GNU libc has not required this
  308. for many years. We now treat them as compatibility synonyms for
  309. _POSIX_C_SOURCE=199506L, which is the earliest level of POSIX with
  310. comprehensive support for multithreaded code. Using them never
  311. lowers the selected level of POSIX conformance, only raises it. */
  312. #if ((!defined _POSIX_C_SOURCE || (_POSIX_C_SOURCE - 0) < 199506L) \
  313. && (defined _REENTRANT || defined _THREAD_SAFE))
  314. # define _POSIX_SOURCE 1
  315. # undef _POSIX_C_SOURCE
  316. # define _POSIX_C_SOURCE 199506L
  317. #endif
  318. #if (defined _POSIX_SOURCE \
  319. || (defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 1) \
  320. || defined _XOPEN_SOURCE)
  321. # define __USE_POSIX 1
  322. #endif
  323. #if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE
  324. # define __USE_POSIX2 1
  325. #endif
  326. #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L
  327. # define __USE_POSIX199309 1
  328. #endif
  329. #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199506L
  330. # define __USE_POSIX199506 1
  331. #endif
  332. #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200112L
  333. # define __USE_XOPEN2K 1
  334. # undef __USE_ISOC95
  335. # define __USE_ISOC95 1
  336. # undef __USE_ISOC99
  337. # define __USE_ISOC99 1
  338. #endif
  339. #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200809L
  340. # define __USE_XOPEN2K8 1
  341. # undef _ATFILE_SOURCE
  342. # define _ATFILE_SOURCE 1
  343. #endif
  344. #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 202405L
  345. # define __USE_XOPEN2K24 1
  346. #endif
  347. #ifdef _XOPEN_SOURCE
  348. # define __USE_XOPEN 1
  349. # if (_XOPEN_SOURCE - 0) >= 500
  350. # define __USE_XOPEN_EXTENDED 1
  351. # define __USE_UNIX98 1
  352. # undef _LARGEFILE_SOURCE
  353. # define _LARGEFILE_SOURCE 1
  354. # if (_XOPEN_SOURCE - 0) >= 600
  355. # if (_XOPEN_SOURCE - 0) >= 700
  356. # define __USE_XOPEN2K8 1
  357. # define __USE_XOPEN2K8XSI 1
  358. # if (_XOPEN_SOURCE - 0) >= 800
  359. # define __USE_XOPEN2K24 1
  360. # define __USE_XOPEN2K24XSI 1
  361. # endif
  362. # endif
  363. # define __USE_XOPEN2K 1
  364. # define __USE_XOPEN2KXSI 1
  365. # undef __USE_ISOC95
  366. # define __USE_ISOC95 1
  367. # undef __USE_ISOC99
  368. # define __USE_ISOC99 1
  369. # endif
  370. # else
  371. # ifdef _XOPEN_SOURCE_EXTENDED
  372. # define __USE_XOPEN_EXTENDED 1
  373. # endif
  374. # endif
  375. #endif
  376. #ifdef _LARGEFILE_SOURCE
  377. # define __USE_LARGEFILE 1
  378. #endif
  379. #ifdef _LARGEFILE64_SOURCE
  380. # define __USE_LARGEFILE64 1
  381. #endif
  382. #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
  383. # define __USE_FILE_OFFSET64 1
  384. #endif
  385. #include <features-time64.h>
  386. #if defined _DEFAULT_SOURCE
  387. # define __USE_MISC 1
  388. #endif
  389. #ifdef _ATFILE_SOURCE
  390. # define __USE_ATFILE 1
  391. #endif
  392. #ifdef _DYNAMIC_STACK_SIZE_SOURCE
  393. # define __USE_DYNAMIC_STACK_SIZE 1
  394. #endif
  395. #ifdef _GNU_SOURCE
  396. # define __USE_GNU 1
  397. #endif
  398. #if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0
  399. # if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0
  400. # warning _FORTIFY_SOURCE requires compiling with optimization (-O)
  401. # elif !__GNUC_PREREQ (4, 1)
  402. # warning _FORTIFY_SOURCE requires GCC 4.1 or later
  403. # elif _FORTIFY_SOURCE > 2 && (__glibc_clang_prereq (9, 0) \
  404. || __GNUC_PREREQ (12, 0))
  405. # if _FORTIFY_SOURCE > 3
  406. # warning _FORTIFY_SOURCE > 3 is treated like 3 on this platform
  407. # endif
  408. # define __USE_FORTIFY_LEVEL 3
  409. # elif _FORTIFY_SOURCE > 1
  410. # if _FORTIFY_SOURCE > 2
  411. # warning _FORTIFY_SOURCE > 2 is treated like 2 on this platform
  412. # endif
  413. # define __USE_FORTIFY_LEVEL 2
  414. # else
  415. # define __USE_FORTIFY_LEVEL 1
  416. # endif
  417. #endif
  418. #ifndef __USE_FORTIFY_LEVEL
  419. # define __USE_FORTIFY_LEVEL 0
  420. #endif
  421. /* The function 'gets' existed in C89, but is impossible to use
  422. safely. It has been removed from ISO C11 and ISO C++14. Note: for
  423. compatibility with various implementations of <cstdio>, this test
  424. must consider only the value of __cplusplus when compiling C++. */
  425. #if defined __cplusplus ? __cplusplus >= 201402L : defined __USE_ISOC11
  426. # define __GLIBC_USE_DEPRECATED_GETS 0
  427. #else
  428. # define __GLIBC_USE_DEPRECATED_GETS 1
  429. #endif
  430. /* GNU formerly extended the scanf functions with modified format
  431. specifiers %as, %aS, and %a[...] that allocate a buffer for the
  432. input using malloc. This extension conflicts with ISO C99, which
  433. defines %a as a standalone format specifier that reads a floating-
  434. point number; moreover, POSIX.1-2008 provides the same feature
  435. using the modifier letter 'm' instead (%ms, %mS, %m[...]).
  436. We now follow C99 unless GNU extensions are active and the compiler
  437. is specifically in C89 or C++98 mode (strict or not). For
  438. instance, with GCC, -std=gnu11 will have C99-compliant scanf with
  439. or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the
  440. old extension. */
  441. #if (defined __USE_GNU \
  442. && (defined __cplusplus \
  443. ? (__cplusplus < 201103L && !defined __GXX_EXPERIMENTAL_CXX0X__) \
  444. : (!defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L)))
  445. # define __GLIBC_USE_DEPRECATED_SCANF 1
  446. #else
  447. # define __GLIBC_USE_DEPRECATED_SCANF 0
  448. #endif
  449. /* ISO C23 added support for a 0b or 0B prefix on binary constants as
  450. inputs to strtol-family functions (base 0 or 2). This macro is
  451. used to condition redirection in headers to allow that redirection
  452. to be disabled when building those functions, despite _GNU_SOURCE
  453. being defined. */
  454. #if __GLIBC_USE (ISOC23)
  455. # define __GLIBC_USE_C23_STRTOL 1
  456. #else
  457. # define __GLIBC_USE_C23_STRTOL 0
  458. #endif
  459. /* Get definitions of __STDC_* predefined macros, if the compiler has
  460. not preincluded this header automatically. */
  461. #include <stdc-predef.h>
  462. /* This macro indicates that the installed library is the GNU C Library.
  463. For historic reasons the value now is 6 and this will stay from now
  464. on. The use of this variable is deprecated. Use __GLIBC__ and
  465. __GLIBC_MINOR__ now (see below) when you want to test for a specific
  466. GNU C library version and use the values in <gnu/lib-names.h> to get
  467. the sonames of the shared libraries. */
  468. #undef __GNU_LIBRARY__
  469. #define __GNU_LIBRARY__ 6
  470. /* Major and minor version number of the GNU C library package. Use
  471. these macros to test for features in specific releases. */
  472. #define __GLIBC__ 2
  473. #define __GLIBC_MINOR__ 43
  474. #define __GLIBC_PREREQ(maj, min) \
  475. ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
  476. /* This is here only because every header file already includes this one. */
  477. #ifndef __ASSEMBLER__
  478. # ifndef _SYS_CDEFS_H
  479. # include <sys/cdefs.h>
  480. # endif
  481. /* If we don't have __REDIRECT, prototypes will be missing if
  482. __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */
  483. # if defined __USE_FILE_OFFSET64 && !defined __REDIRECT
  484. # define __USE_LARGEFILE 1
  485. # define __USE_LARGEFILE64 1
  486. # endif
  487. #endif /* !ASSEMBLER */
  488. /* Decide whether we can define 'extern inline' functions in headers. */
  489. #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
  490. && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \
  491. && defined __extern_inline && !(defined __clang__ && defined _LIBC)
  492. # define __USE_EXTERN_INLINES 1
  493. #endif
  494. /* This is here only because every header file already includes this one.
  495. Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
  496. <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
  497. that will always return failure (and set errno to ENOSYS). */
  498. #include <gnu/stubs.h>
  499. #endif /* features.h */