1 /* Copyright (C) 1992, 1994, 1997, 1998 Free Software Foundation, Inc.
3 This file is part of GCC.
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
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
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.
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/>. */
24 /* This administrivia gets added to the beginning of limits.h
25 if the system has its own version of limits.h. */
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_
32 #ifndef _LIBC_LIMITS_H_
33 /* Use "..." so that we find syslimits.h only in this same directory. */
34 #include "syslimits.h"
36 /* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, 2001,
37 2002 Free Software Foundation, Inc.
39 This file is part of GCC.
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
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
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.
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/>. */
63 /* Number of bits in a `char'. */
65 #define CHAR_BIT __CHAR_BIT__
67 /* Maximum length of a multibyte character. */
72 /* Minimum and maximum values a `signed char' can hold. */
74 #define SCHAR_MIN (-SCHAR_MAX - 1)
76 #define SCHAR_MAX __SCHAR_MAX__
78 /* Maximum value an `unsigned char' can hold. (Minimum is 0). */
80 #if __SCHAR_MAX__ == __INT_MAX__
81 # define UCHAR_MAX (SCHAR_MAX * 2U + 1U)
83 # define UCHAR_MAX (SCHAR_MAX * 2 + 1)
86 /* Minimum and maximum values a `char' can hold. */
87 #ifdef __CHAR_UNSIGNED__
89 # if __SCHAR_MAX__ == __INT_MAX__
95 # define CHAR_MAX UCHAR_MAX
98 # define CHAR_MIN SCHAR_MIN
100 # define CHAR_MAX SCHAR_MAX
103 /* Minimum and maximum values a `signed short int' can hold. */
105 #define SHRT_MIN (-SHRT_MAX - 1)
107 #define SHRT_MAX __SHRT_MAX__
109 /* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
111 #if __SHRT_MAX__ == __INT_MAX__
112 # define USHRT_MAX (SHRT_MAX * 2U + 1U)
114 # define USHRT_MAX (SHRT_MAX * 2 + 1)
117 /* Minimum and maximum values a `signed int' can hold. */
119 #define INT_MIN (-INT_MAX - 1)
121 #define INT_MAX __INT_MAX__
123 /* Maximum value an `unsigned int' can hold. (Minimum is 0). */
125 #define UINT_MAX (INT_MAX * 2U + 1U)
127 /* Minimum and maximum values a `signed long int' can hold.
130 #define LONG_MIN (-LONG_MAX - 1L)
132 #define LONG_MAX __LONG_MAX__
134 /* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
136 #define ULONG_MAX (LONG_MAX * 2UL + 1UL)
138 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
139 /* Minimum and maximum values a `signed long long int' can hold. */
141 # define LLONG_MIN (-LLONG_MAX - 1LL)
143 # define LLONG_MAX __LONG_LONG_MAX__
145 /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
147 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
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__
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)
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. */
166 #else /* not _GCC_LIMITS_H_ */
168 #ifdef _GCC_NEXT_LIMITS_H
169 #include_next <limits.h> /* recurse down to the real one */
172 #endif /* not _GCC_LIMITS_H_ */