features.h 20 KB

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