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