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