cdefs.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. /* Copyright (C) 1992-2021 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 _SYS_CDEFS_H
  15. #define _SYS_CDEFS_H 1
  16. /* We are almost always included from features.h. */
  17. #ifndef _FEATURES_H
  18. # include <features.h>
  19. #endif
  20. /* The GNU libc does not support any K&R compilers or the traditional mode
  21. of ISO C compilers anymore. Check for some of the combinations not
  22. supported anymore. */
  23. #if defined __GNUC__ && !defined __STDC__
  24. # error "You need a ISO C conforming compiler to use the glibc headers"
  25. #endif
  26. /* Some user header file might have defined this before. */
  27. #undef __P
  28. #undef __PMT
  29. #ifdef __GNUC__
  30. /* All functions, except those with callbacks or those that
  31. synchronize memory, are leaf functions. */
  32. # if __GNUC_PREREQ (4, 6) && !defined _LIBC
  33. # define __LEAF , __leaf__
  34. # define __LEAF_ATTR __attribute__ ((__leaf__))
  35. # else
  36. # define __LEAF
  37. # define __LEAF_ATTR
  38. # endif
  39. /* GCC can always grok prototypes. For C++ programs we add throw()
  40. to help it optimize the function calls. But this only works with
  41. gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions
  42. as non-throwing using a function attribute since programs can use
  43. the -fexceptions options for C code as well. */
  44. # if !defined __cplusplus && __GNUC_PREREQ (3, 3)
  45. # define __THROW __attribute__ ((__nothrow__ __LEAF))
  46. # define __THROWNL __attribute__ ((__nothrow__))
  47. # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
  48. # define __NTHNL(fct) __attribute__ ((__nothrow__)) fct
  49. # else
  50. # if defined __cplusplus && __GNUC_PREREQ (2,8)
  51. # if __cplusplus >= 201103L
  52. # define __THROW noexcept (true)
  53. # else
  54. # define __THROW throw ()
  55. # endif
  56. # define __THROWNL __THROW
  57. # define __NTH(fct) __LEAF_ATTR fct __THROW
  58. # define __NTHNL(fct) fct __THROW
  59. # else
  60. # define __THROW
  61. # define __THROWNL
  62. # define __NTH(fct) fct
  63. # define __NTHNL(fct) fct
  64. # endif
  65. # endif
  66. #else /* Not GCC. */
  67. # if (defined __cplusplus \
  68. || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
  69. # define __inline inline
  70. # else
  71. # define __inline /* No inline functions. */
  72. # endif
  73. # define __THROW
  74. # define __THROWNL
  75. # define __NTH(fct) fct
  76. #endif /* GCC. */
  77. /* Compilers that are not clang may object to
  78. #if defined __clang__ && __has_extension(...)
  79. even though they do not need to evaluate the right-hand side of the &&. */
  80. #if defined __clang__ && defined __has_extension
  81. # define __glibc_clang_has_extension(ext) __has_extension (ext)
  82. #else
  83. # define __glibc_clang_has_extension(ext) 0
  84. #endif
  85. /* These two macros are not used in glibc anymore. They are kept here
  86. only because some other projects expect the macros to be defined. */
  87. #define __P(args) args
  88. #define __PMT(args) args
  89. /* For these things, GCC behaves the ANSI way normally,
  90. and the non-ANSI way under -traditional. */
  91. #define __CONCAT(x,y) x ## y
  92. #define __STRING(x) #x
  93. /* This is not a typedef so `const __ptr_t' does the right thing. */
  94. #define __ptr_t void *
  95. /* C++ needs to know that types and declarations are C, not C++. */
  96. #ifdef __cplusplus
  97. # define __BEGIN_DECLS extern "C" {
  98. # define __END_DECLS }
  99. #else
  100. # define __BEGIN_DECLS
  101. # define __END_DECLS
  102. #endif
  103. /* Fortify support. */
  104. #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
  105. #define __bos0(ptr) __builtin_object_size (ptr, 0)
  106. /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */
  107. #if __USE_FORTIFY_LEVEL == 3 && __glibc_clang_prereq (9, 0)
  108. # define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0)
  109. # define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1)
  110. #else
  111. # define __glibc_objsize0(__o) __bos0 (__o)
  112. # define __glibc_objsize(__o) __bos (__o)
  113. #endif
  114. #if __GNUC_PREREQ (4,3)
  115. # define __warnattr(msg) __attribute__((__warning__ (msg)))
  116. # define __errordecl(name, msg) \
  117. extern void name (void) __attribute__((__error__ (msg)))
  118. #else
  119. # define __warnattr(msg)
  120. # define __errordecl(name, msg) extern void name (void)
  121. #endif
  122. /* Support for flexible arrays.
  123. Headers that should use flexible arrays only if they're "real"
  124. (e.g. only if they won't affect sizeof()) should test
  125. #if __glibc_c99_flexarr_available. */
  126. #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
  127. # define __flexarr []
  128. # define __glibc_c99_flexarr_available 1
  129. #elif __GNUC_PREREQ (2,97)
  130. /* GCC 2.97 supports C99 flexible array members as an extension,
  131. even when in C89 mode or compiling C++ (any version). */
  132. # define __flexarr []
  133. # define __glibc_c99_flexarr_available 1
  134. #elif defined __GNUC__
  135. /* Pre-2.97 GCC did not support C99 flexible arrays but did have
  136. an equivalent extension with slightly different notation. */
  137. # define __flexarr [0]
  138. # define __glibc_c99_flexarr_available 1
  139. #else
  140. /* Some other non-C99 compiler. Approximate with [1]. */
  141. # define __flexarr [1]
  142. # define __glibc_c99_flexarr_available 0
  143. #endif
  144. /* __asm__ ("xyz") is used throughout the headers to rename functions
  145. at the assembly language level. This is wrapped by the __REDIRECT
  146. macro, in order to support compilers that can do this some other
  147. way. When compilers don't support asm-names at all, we have to do
  148. preprocessor tricks instead (which don't have exactly the right
  149. semantics, but it's the best we can do).
  150. Example:
  151. int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
  152. #if defined __GNUC__ && __GNUC__ >= 2
  153. # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
  154. # ifdef __cplusplus
  155. # define __REDIRECT_NTH(name, proto, alias) \
  156. name proto __THROW __asm__ (__ASMNAME (#alias))
  157. # define __REDIRECT_NTHNL(name, proto, alias) \
  158. name proto __THROWNL __asm__ (__ASMNAME (#alias))
  159. # else
  160. # define __REDIRECT_NTH(name, proto, alias) \
  161. name proto __asm__ (__ASMNAME (#alias)) __THROW
  162. # define __REDIRECT_NTHNL(name, proto, alias) \
  163. name proto __asm__ (__ASMNAME (#alias)) __THROWNL
  164. # endif
  165. # define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
  166. # define __ASMNAME2(prefix, cname) __STRING (prefix) cname
  167. /*
  168. #elif __SOME_OTHER_COMPILER__
  169. # define __REDIRECT(name, proto, alias) name proto; \
  170. _Pragma("let " #name " = " #alias)
  171. */
  172. #endif
  173. /* GCC has various useful declarations that can be made with the
  174. `__attribute__' syntax. All of the ways we use this do fine if
  175. they are omitted for compilers that don't understand it. */
  176. #if !defined __GNUC__ || __GNUC__ < 2
  177. # define __attribute__(xyz) /* Ignore */
  178. #endif
  179. /* At some point during the gcc 2.96 development the `malloc' attribute
  180. for functions was introduced. We don't want to use it unconditionally
  181. (although this would be possible) since it generates warnings. */
  182. #if __GNUC_PREREQ (2,96)
  183. # define __attribute_malloc__ __attribute__ ((__malloc__))
  184. #else
  185. # define __attribute_malloc__ /* Ignore */
  186. #endif
  187. /* Tell the compiler which arguments to an allocation function
  188. indicate the size of the allocation. */
  189. #if __GNUC_PREREQ (4, 3)
  190. # define __attribute_alloc_size__(params) \
  191. __attribute__ ((__alloc_size__ params))
  192. #else
  193. # define __attribute_alloc_size__(params) /* Ignore. */
  194. #endif
  195. /* At some point during the gcc 2.96 development the `pure' attribute
  196. for functions was introduced. We don't want to use it unconditionally
  197. (although this would be possible) since it generates warnings. */
  198. #if __GNUC_PREREQ (2,96)
  199. # define __attribute_pure__ __attribute__ ((__pure__))
  200. #else
  201. # define __attribute_pure__ /* Ignore */
  202. #endif
  203. /* This declaration tells the compiler that the value is constant. */
  204. #if __GNUC_PREREQ (2,5)
  205. # define __attribute_const__ __attribute__ ((__const__))
  206. #else
  207. # define __attribute_const__ /* Ignore */
  208. #endif
  209. /* At some point during the gcc 3.1 development the `used' attribute
  210. for functions was introduced. We don't want to use it unconditionally
  211. (although this would be possible) since it generates warnings. */
  212. #if __GNUC_PREREQ (3,1)
  213. # define __attribute_used__ __attribute__ ((__used__))
  214. # define __attribute_noinline__ __attribute__ ((__noinline__))
  215. #else
  216. # define __attribute_used__ __attribute__ ((__unused__))
  217. # define __attribute_noinline__ /* Ignore */
  218. #endif
  219. /* Since version 3.2, gcc allows marking deprecated functions. */
  220. #if __GNUC_PREREQ (3,2)
  221. # define __attribute_deprecated__ __attribute__ ((__deprecated__))
  222. #else
  223. # define __attribute_deprecated__ /* Ignore */
  224. #endif
  225. /* Since version 4.5, gcc also allows one to specify the message printed
  226. when a deprecated function is used. clang claims to be gcc 4.2, but
  227. may also support this feature. */
  228. #if __GNUC_PREREQ (4,5) \
  229. || __glibc_clang_has_extension (__attribute_deprecated_with_message__)
  230. # define __attribute_deprecated_msg__(msg) \
  231. __attribute__ ((__deprecated__ (msg)))
  232. #else
  233. # define __attribute_deprecated_msg__(msg) __attribute_deprecated__
  234. #endif
  235. /* At some point during the gcc 2.8 development the `format_arg' attribute
  236. for functions was introduced. We don't want to use it unconditionally
  237. (although this would be possible) since it generates warnings.
  238. If several `format_arg' attributes are given for the same function, in
  239. gcc-3.0 and older, all but the last one are ignored. In newer gccs,
  240. all designated arguments are considered. */
  241. #if __GNUC_PREREQ (2,8)
  242. # define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))
  243. #else
  244. # define __attribute_format_arg__(x) /* Ignore */
  245. #endif
  246. /* At some point during the gcc 2.97 development the `strfmon' format
  247. attribute for functions was introduced. We don't want to use it
  248. unconditionally (although this would be possible) since it
  249. generates warnings. */
  250. #if __GNUC_PREREQ (2,97)
  251. # define __attribute_format_strfmon__(a,b) \
  252. __attribute__ ((__format__ (__strfmon__, a, b)))
  253. #else
  254. # define __attribute_format_strfmon__(a,b) /* Ignore */
  255. #endif
  256. /* The nonull function attribute allows to mark pointer parameters which
  257. must not be NULL. */
  258. #if __GNUC_PREREQ (3,3)
  259. # define __nonnull(params) __attribute__ ((__nonnull__ params))
  260. #else
  261. # define __nonnull(params)
  262. #endif
  263. /* If fortification mode, we warn about unused results of certain
  264. function calls which can lead to problems. */
  265. #if __GNUC_PREREQ (3,4)
  266. # define __attribute_warn_unused_result__ \
  267. __attribute__ ((__warn_unused_result__))
  268. # if __USE_FORTIFY_LEVEL > 0
  269. # define __wur __attribute_warn_unused_result__
  270. # endif
  271. #else
  272. # define __attribute_warn_unused_result__ /* empty */
  273. #endif
  274. #ifndef __wur
  275. # define __wur /* Ignore */
  276. #endif
  277. /* Forces a function to be always inlined. */
  278. #if __GNUC_PREREQ (3,2)
  279. /* The Linux kernel defines __always_inline in stddef.h (283d7573), and
  280. it conflicts with this definition. Therefore undefine it first to
  281. allow either header to be included first. */
  282. # undef __always_inline
  283. # define __always_inline __inline __attribute__ ((__always_inline__))
  284. #else
  285. # undef __always_inline
  286. # define __always_inline __inline
  287. #endif
  288. /* Associate error messages with the source location of the call site rather
  289. than with the source location inside the function. */
  290. #if __GNUC_PREREQ (4,3)
  291. # define __attribute_artificial__ __attribute__ ((__artificial__))
  292. #else
  293. # define __attribute_artificial__ /* Ignore */
  294. #endif
  295. /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
  296. inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
  297. or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
  298. older than 4.3 may define these macros and still not guarantee GNU inlining
  299. semantics.
  300. clang++ identifies itself as gcc-4.2, but has support for GNU inlining
  301. semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
  302. __GNUC_GNU_INLINE__ macro definitions. */
  303. #if (!defined __cplusplus || __GNUC_PREREQ (4,3) \
  304. || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \
  305. || defined __GNUC_GNU_INLINE__)))
  306. # if defined __GNUC_STDC_INLINE__ || defined __cplusplus
  307. # define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
  308. # define __extern_always_inline \
  309. extern __always_inline __attribute__ ((__gnu_inline__))
  310. # else
  311. # define __extern_inline extern __inline
  312. # define __extern_always_inline extern __always_inline
  313. # endif
  314. #endif
  315. #ifdef __extern_always_inline
  316. # define __fortify_function __extern_always_inline __attribute_artificial__
  317. #endif
  318. /* GCC 4.3 and above allow passing all anonymous arguments of an
  319. __extern_always_inline function to some other vararg function. */
  320. #if __GNUC_PREREQ (4,3)
  321. # define __va_arg_pack() __builtin_va_arg_pack ()
  322. # define __va_arg_pack_len() __builtin_va_arg_pack_len ()
  323. #endif
  324. /* It is possible to compile containing GCC extensions even if GCC is
  325. run in pedantic mode if the uses are carefully marked using the
  326. `__extension__' keyword. But this is not generally available before
  327. version 2.8. */
  328. #if !__GNUC_PREREQ (2,8)
  329. # define __extension__ /* Ignore */
  330. #endif
  331. /* __restrict is known in EGCS 1.2 and above. */
  332. #if !__GNUC_PREREQ (2,92)
  333. # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
  334. # define __restrict restrict
  335. # else
  336. # define __restrict /* Ignore */
  337. # endif
  338. #endif
  339. /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
  340. array_name[restrict]
  341. GCC 3.1 supports this. */
  342. #if __GNUC_PREREQ (3,1) && !defined __GNUG__
  343. # define __restrict_arr __restrict
  344. #else
  345. # ifdef __GNUC__
  346. # define __restrict_arr /* Not supported in old GCC. */
  347. # else
  348. # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
  349. # define __restrict_arr restrict
  350. # else
  351. /* Some other non-C99 compiler. */
  352. # define __restrict_arr /* Not supported. */
  353. # endif
  354. # endif
  355. #endif
  356. #if __GNUC__ >= 3
  357. # define __glibc_unlikely(cond) __builtin_expect ((cond), 0)
  358. # define __glibc_likely(cond) __builtin_expect ((cond), 1)
  359. #else
  360. # define __glibc_unlikely(cond) (cond)
  361. # define __glibc_likely(cond) (cond)
  362. #endif
  363. #ifdef __has_attribute
  364. # define __glibc_has_attribute(attr) __has_attribute (attr)
  365. #else
  366. # define __glibc_has_attribute(attr) 0
  367. #endif
  368. #if (!defined _Noreturn \
  369. && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
  370. && !__GNUC_PREREQ (4,7))
  371. # if __GNUC_PREREQ (2,8)
  372. # define _Noreturn __attribute__ ((__noreturn__))
  373. # else
  374. # define _Noreturn
  375. # endif
  376. #endif
  377. #if __GNUC_PREREQ (8, 0)
  378. /* Describes a char array whose address can safely be passed as the first
  379. argument to strncpy and strncat, as the char array is not necessarily
  380. a NUL-terminated string. */
  381. # define __attribute_nonstring__ __attribute__ ((__nonstring__))
  382. #else
  383. # define __attribute_nonstring__
  384. #endif
  385. /* Undefine (also defined in libc-symbols.h). */
  386. #undef __attribute_copy__
  387. #if __GNUC_PREREQ (9, 0)
  388. /* Copies attributes from the declaration or type referenced by
  389. the argument. */
  390. # define __attribute_copy__(arg) __attribute__ ((__copy__ (arg)))
  391. #else
  392. # define __attribute_copy__(arg)
  393. #endif
  394. #if (!defined _Static_assert && !defined __cplusplus \
  395. && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
  396. && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__))
  397. # define _Static_assert(expr, diagnostic) \
  398. extern int (*__Static_assert_function (void)) \
  399. [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
  400. #endif
  401. #include <bits/wordsize.h>
  402. #include <bits/long-double.h>
  403. #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
  404. # ifdef __REDIRECT
  405. /* Alias name defined automatically. */
  406. # define __LDBL_REDIR(name, proto) ... unused__ldbl_redir
  407. # define __LDBL_REDIR_DECL(name) \
  408. extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128"));
  409. /* Alias name defined automatically, with leading underscores. */
  410. # define __LDBL_REDIR2_DECL(name) \
  411. extern __typeof (__##name) __##name \
  412. __asm (__ASMNAME ("__" #name "ieee128"));
  413. /* Alias name defined manually. */
  414. # define __LDBL_REDIR1(name, proto, alias) ... unused__ldbl_redir1
  415. # define __LDBL_REDIR1_DECL(name, alias) \
  416. extern __typeof (name) name __asm (__ASMNAME (#alias));
  417. # define __LDBL_REDIR1_NTH(name, proto, alias) \
  418. __REDIRECT_NTH (name, proto, alias)
  419. # define __REDIRECT_NTH_LDBL(name, proto, alias) \
  420. __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
  421. /* Unused. */
  422. # define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
  423. # define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
  424. # else
  425. _Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
  426. # endif
  427. #elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
  428. # define __LDBL_COMPAT 1
  429. # ifdef __REDIRECT
  430. # define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias)
  431. # define __LDBL_REDIR(name, proto) \
  432. __LDBL_REDIR1 (name, proto, __nldbl_##name)
  433. # define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias)
  434. # define __LDBL_REDIR_NTH(name, proto) \
  435. __LDBL_REDIR1_NTH (name, proto, __nldbl_##name)
  436. # define __LDBL_REDIR2_DECL(name) \
  437. extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name));
  438. # define __LDBL_REDIR1_DECL(name, alias) \
  439. extern __typeof (name) name __asm (__ASMNAME (#alias));
  440. # define __LDBL_REDIR_DECL(name) \
  441. extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
  442. # define __REDIRECT_LDBL(name, proto, alias) \
  443. __LDBL_REDIR1 (name, proto, __nldbl_##alias)
  444. # define __REDIRECT_NTH_LDBL(name, proto, alias) \
  445. __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
  446. # endif
  447. #endif
  448. #if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
  449. || !defined __REDIRECT
  450. # define __LDBL_REDIR1(name, proto, alias) name proto
  451. # define __LDBL_REDIR(name, proto) name proto
  452. # define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
  453. # define __LDBL_REDIR_NTH(name, proto) name proto __THROW
  454. # define __LDBL_REDIR2_DECL(name)
  455. # define __LDBL_REDIR_DECL(name)
  456. # ifdef __REDIRECT
  457. # define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
  458. # define __REDIRECT_NTH_LDBL(name, proto, alias) \
  459. __REDIRECT_NTH (name, proto, alias)
  460. # endif
  461. #endif
  462. /* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is
  463. intended for use in preprocessor macros.
  464. Note: MESSAGE must be a _single_ string; concatenation of string
  465. literals is not supported. */
  466. #if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5)
  467. # define __glibc_macro_warning1(message) _Pragma (#message)
  468. # define __glibc_macro_warning(message) \
  469. __glibc_macro_warning1 (GCC warning message)
  470. #else
  471. # define __glibc_macro_warning(msg)
  472. #endif
  473. /* Generic selection (ISO C11) is a C-only feature, available in GCC
  474. since version 4.9. Previous versions do not provide generic
  475. selection, even though they might set __STDC_VERSION__ to 201112L,
  476. when in -std=c11 mode. Thus, we must check for !defined __GNUC__
  477. when testing __STDC_VERSION__ for generic selection support.
  478. On the other hand, Clang also defines __GNUC__, so a clang-specific
  479. check is required to enable the use of generic selection. */
  480. #if !defined __cplusplus \
  481. && (__GNUC_PREREQ (4, 9) \
  482. || __glibc_clang_has_extension (c_generic_selections) \
  483. || (!defined __GNUC__ && defined __STDC_VERSION__ \
  484. && __STDC_VERSION__ >= 201112L))
  485. # define __HAVE_GENERIC_SELECTION 1
  486. #else
  487. # define __HAVE_GENERIC_SELECTION 0
  488. #endif
  489. #if __GNUC_PREREQ (10, 0)
  490. /* Designates a 1-based positional argument ref-index of pointer type
  491. that can be used to access size-index elements of the pointed-to
  492. array according to access mode, or at least one element when
  493. size-index is not provided:
  494. access (access-mode, <ref-index> [, <size-index>]) */
  495. #define __attr_access(x) __attribute__ ((__access__ x))
  496. #else
  497. # define __attr_access(x)
  498. #endif
  499. /* Specify that a function such as setjmp or vfork may return
  500. twice. */
  501. #if __GNUC_PREREQ (4, 1)
  502. # define __attribute_returns_twice__ __attribute__ ((__returns_twice__))
  503. #else
  504. # define __attribute_returns_twice__ /* Ignore. */
  505. #endif
  506. #endif /* sys/cdefs.h */