libc-header-start.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* Handle feature test macros at the start of a header.
  2. Copyright (C) 2016-2023 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  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.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. /* This header is internal to glibc and should not be included outside
  16. of glibc headers. Headers including it must define
  17. __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION first. This header
  18. cannot have multiple include guards because ISO C feature test
  19. macros depend on the definition of the macro when an affected
  20. header is included, not when the first system header is
  21. included. */
  22. #ifndef __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
  23. # error "Never include <bits/libc-header-start.h> directly."
  24. #endif
  25. #undef __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
  26. #include <features.h>
  27. /* ISO/IEC TR 24731-2:2010 defines the __STDC_WANT_LIB_EXT2__
  28. macro. */
  29. #undef __GLIBC_USE_LIB_EXT2
  30. #if (defined __USE_GNU \
  31. || (defined __STDC_WANT_LIB_EXT2__ && __STDC_WANT_LIB_EXT2__ > 0))
  32. # define __GLIBC_USE_LIB_EXT2 1
  33. #else
  34. # define __GLIBC_USE_LIB_EXT2 0
  35. #endif
  36. /* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__
  37. macro. Most but not all symbols enabled by that macro in TS
  38. 18661-1 are enabled unconditionally in C2X. In C2X, the symbols in
  39. Annex F still require a new feature test macro
  40. __STDC_WANT_IEC_60559_EXT__ instead (C2X does not define
  41. __STDC_WANT_IEC_60559_BFP_EXT__), while a few features from TS
  42. 18661-1 are not included in C2X (and thus should depend on
  43. __STDC_WANT_IEC_60559_BFP_EXT__ even when C2X features are
  44. enabled).
  45. __GLIBC_USE (IEC_60559_BFP_EXT) controls those features from TS
  46. 18661-1 not included in C2X.
  47. __GLIBC_USE (IEC_60559_BFP_EXT_C2X) controls those features from TS
  48. 18661-1 that are also included in C2X (with no feature test macro
  49. required in C2X).
  50. __GLIBC_USE (IEC_60559_EXT) controls those features from TS 18661-1
  51. that are included in C2X but conditional on
  52. __STDC_WANT_IEC_60559_EXT__. (There are currently no features
  53. conditional on __STDC_WANT_IEC_60559_EXT__ that are not in TS
  54. 18661-1.) */
  55. #undef __GLIBC_USE_IEC_60559_BFP_EXT
  56. #if defined __USE_GNU || defined __STDC_WANT_IEC_60559_BFP_EXT__
  57. # define __GLIBC_USE_IEC_60559_BFP_EXT 1
  58. #else
  59. # define __GLIBC_USE_IEC_60559_BFP_EXT 0
  60. #endif
  61. #undef __GLIBC_USE_IEC_60559_BFP_EXT_C2X
  62. #if __GLIBC_USE (IEC_60559_BFP_EXT) || __GLIBC_USE (ISOC2X)
  63. # define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 1
  64. #else
  65. # define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 0
  66. #endif
  67. #undef __GLIBC_USE_IEC_60559_EXT
  68. #if __GLIBC_USE (IEC_60559_BFP_EXT) || defined __STDC_WANT_IEC_60559_EXT__
  69. # define __GLIBC_USE_IEC_60559_EXT 1
  70. #else
  71. # define __GLIBC_USE_IEC_60559_EXT 0
  72. #endif
  73. /* ISO/IEC TS 18661-4:2015 defines the
  74. __STDC_WANT_IEC_60559_FUNCS_EXT__ macro. Other than the reduction
  75. functions, the symbols from this TS are enabled unconditionally in
  76. C2X. */
  77. #undef __GLIBC_USE_IEC_60559_FUNCS_EXT
  78. #if defined __USE_GNU || defined __STDC_WANT_IEC_60559_FUNCS_EXT__
  79. # define __GLIBC_USE_IEC_60559_FUNCS_EXT 1
  80. #else
  81. # define __GLIBC_USE_IEC_60559_FUNCS_EXT 0
  82. #endif
  83. #undef __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X
  84. #if __GLIBC_USE (IEC_60559_FUNCS_EXT) || __GLIBC_USE (ISOC2X)
  85. # define __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X 1
  86. #else
  87. # define __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X 0
  88. #endif
  89. /* ISO/IEC TS 18661-3:2015 defines the
  90. __STDC_WANT_IEC_60559_TYPES_EXT__ macro. */
  91. #undef __GLIBC_USE_IEC_60559_TYPES_EXT
  92. #if defined __USE_GNU || defined __STDC_WANT_IEC_60559_TYPES_EXT__
  93. # define __GLIBC_USE_IEC_60559_TYPES_EXT 1
  94. #else
  95. # define __GLIBC_USE_IEC_60559_TYPES_EXT 0
  96. #endif