limits.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /* Copyright (C) 1992-2019 Free Software Foundation, Inc.
  2. This file is part of GCC.
  3. GCC is free software; you can redistribute it and/or modify it under
  4. the terms of the GNU General Public License as published by the Free
  5. Software Foundation; either version 3, or (at your option) any later
  6. version.
  7. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  8. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  10. for more details.
  11. Under Section 7 of GPL version 3, you are granted additional
  12. permissions described in the GCC Runtime Library Exception, version
  13. 3.1, as published by the Free Software Foundation.
  14. You should have received a copy of the GNU General Public License and
  15. a copy of the GCC Runtime Library Exception along with this program;
  16. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  17. <http://www.gnu.org/licenses/>. */
  18. /* This administrivia gets added to the beginning of limits.h
  19. if the system has its own version of limits.h. */
  20. /* We use _GCC_LIMITS_H_ because we want this not to match
  21. any macros that the system's limits.h uses for its own purposes. */
  22. #ifndef _GCC_LIMITS_H_ /* Terminated in limity.h. */
  23. #define _GCC_LIMITS_H_
  24. #ifndef _LIBC_LIMITS_H_
  25. /* Use "..." so that we find syslimits.h only in this same directory. */
  26. #include "syslimits.h"
  27. #endif
  28. /* Copyright (C) 1991-2019 Free Software Foundation, Inc.
  29. This file is part of GCC.
  30. GCC is free software; you can redistribute it and/or modify it under
  31. the terms of the GNU General Public License as published by the Free
  32. Software Foundation; either version 3, or (at your option) any later
  33. version.
  34. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  35. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  36. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  37. for more details.
  38. Under Section 7 of GPL version 3, you are granted additional
  39. permissions described in the GCC Runtime Library Exception, version
  40. 3.1, as published by the Free Software Foundation.
  41. You should have received a copy of the GNU General Public License and
  42. a copy of the GCC Runtime Library Exception along with this program;
  43. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  44. <http://www.gnu.org/licenses/>. */
  45. #ifndef _LIMITS_H___
  46. #define _LIMITS_H___
  47. /* Number of bits in a `char'. */
  48. #undef CHAR_BIT
  49. #define CHAR_BIT __CHAR_BIT__
  50. /* Maximum length of a multibyte character. */
  51. #ifndef MB_LEN_MAX
  52. #define MB_LEN_MAX 1
  53. #endif
  54. /* Minimum and maximum values a `signed char' can hold. */
  55. #undef SCHAR_MIN
  56. #define SCHAR_MIN (-SCHAR_MAX - 1)
  57. #undef SCHAR_MAX
  58. #define SCHAR_MAX __SCHAR_MAX__
  59. /* Maximum value an `unsigned char' can hold. (Minimum is 0). */
  60. #undef UCHAR_MAX
  61. #if __SCHAR_MAX__ == __INT_MAX__
  62. # define UCHAR_MAX (SCHAR_MAX * 2U + 1U)
  63. #else
  64. # define UCHAR_MAX (SCHAR_MAX * 2 + 1)
  65. #endif
  66. /* Minimum and maximum values a `char' can hold. */
  67. #ifdef __CHAR_UNSIGNED__
  68. # undef CHAR_MIN
  69. # if __SCHAR_MAX__ == __INT_MAX__
  70. # define CHAR_MIN 0U
  71. # else
  72. # define CHAR_MIN 0
  73. # endif
  74. # undef CHAR_MAX
  75. # define CHAR_MAX UCHAR_MAX
  76. #else
  77. # undef CHAR_MIN
  78. # define CHAR_MIN SCHAR_MIN
  79. # undef CHAR_MAX
  80. # define CHAR_MAX SCHAR_MAX
  81. #endif
  82. /* Minimum and maximum values a `signed short int' can hold. */
  83. #undef SHRT_MIN
  84. #define SHRT_MIN (-SHRT_MAX - 1)
  85. #undef SHRT_MAX
  86. #define SHRT_MAX __SHRT_MAX__
  87. /* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
  88. #undef USHRT_MAX
  89. #if __SHRT_MAX__ == __INT_MAX__
  90. # define USHRT_MAX (SHRT_MAX * 2U + 1U)
  91. #else
  92. # define USHRT_MAX (SHRT_MAX * 2 + 1)
  93. #endif
  94. /* Minimum and maximum values a `signed int' can hold. */
  95. #undef INT_MIN
  96. #define INT_MIN (-INT_MAX - 1)
  97. #undef INT_MAX
  98. #define INT_MAX __INT_MAX__
  99. /* Maximum value an `unsigned int' can hold. (Minimum is 0). */
  100. #undef UINT_MAX
  101. #define UINT_MAX (INT_MAX * 2U + 1U)
  102. /* Minimum and maximum values a `signed long int' can hold.
  103. (Same as `int'). */
  104. #undef LONG_MIN
  105. #define LONG_MIN (-LONG_MAX - 1L)
  106. #undef LONG_MAX
  107. #define LONG_MAX __LONG_MAX__
  108. /* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
  109. #undef ULONG_MAX
  110. #define ULONG_MAX (LONG_MAX * 2UL + 1UL)
  111. #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  112. /* Minimum and maximum values a `signed long long int' can hold. */
  113. # undef LLONG_MIN
  114. # define LLONG_MIN (-LLONG_MAX - 1LL)
  115. # undef LLONG_MAX
  116. # define LLONG_MAX __LONG_LONG_MAX__
  117. /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
  118. # undef ULLONG_MAX
  119. # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
  120. #endif
  121. #if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
  122. /* Minimum and maximum values a `signed long long int' can hold. */
  123. # undef LONG_LONG_MIN
  124. # define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
  125. # undef LONG_LONG_MAX
  126. # define LONG_LONG_MAX __LONG_LONG_MAX__
  127. /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
  128. # undef ULONG_LONG_MAX
  129. # define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
  130. #endif
  131. #ifdef __STDC_WANT_IEC_60559_BFP_EXT__
  132. /* TS 18661-1 widths of integer types. */
  133. # undef CHAR_WIDTH
  134. # define CHAR_WIDTH __SCHAR_WIDTH__
  135. # undef SCHAR_WIDTH
  136. # define SCHAR_WIDTH __SCHAR_WIDTH__
  137. # undef UCHAR_WIDTH
  138. # define UCHAR_WIDTH __SCHAR_WIDTH__
  139. # undef SHRT_WIDTH
  140. # define SHRT_WIDTH __SHRT_WIDTH__
  141. # undef USHRT_WIDTH
  142. # define USHRT_WIDTH __SHRT_WIDTH__
  143. # undef INT_WIDTH
  144. # define INT_WIDTH __INT_WIDTH__
  145. # undef UINT_WIDTH
  146. # define UINT_WIDTH __INT_WIDTH__
  147. # undef LONG_WIDTH
  148. # define LONG_WIDTH __LONG_WIDTH__
  149. # undef ULONG_WIDTH
  150. # define ULONG_WIDTH __LONG_WIDTH__
  151. # undef LLONG_WIDTH
  152. # define LLONG_WIDTH __LONG_LONG_WIDTH__
  153. # undef ULLONG_WIDTH
  154. # define ULLONG_WIDTH __LONG_LONG_WIDTH__
  155. #endif
  156. #endif /* _LIMITS_H___ */
  157. /* This administrivia gets added to the end of limits.h
  158. if the system has its own version of limits.h. */
  159. #else /* not _GCC_LIMITS_H_ */
  160. #ifdef _GCC_NEXT_LIMITS_H
  161. #include_next <limits.h> /* recurse down to the real one */
  162. #endif
  163. #endif /* not _GCC_LIMITS_H_ */