c-common.c (builtin_define_type_max): New.
* c-common.c (builtin_define_type_max): New. (cb_register_builtins): Define __SCHAR_MAX__, __SHRT_MAX__, __INT_MAX__, __LONG_MAX__, __LONG_LONG_MAX__, __CHAR_BIT__. From Joseph S. Myers: * glimits.h: Rewrite to expect the double underscore definitions from the compiler. * config/alpha/unicosmk.h, config/avr/avr.h, config/h8300/h8300.h, config/i386/linux64.h, config/ia64/aix.h, config/ia64/hpux.h, config/ia64/ia64.h, config/m68hc11/m68hc11.h, config/m68hc11/m68hc12.h, config/mips/mips.h, config/mmix/mmix.h, config/mn10200/mn10200.h, config/pa/pa.h, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/linux64.h, config/s390/linux.h, config/sh/sh.h, config/stormy16/stormy16.h: Don't define any of __SHRT_MAX__, __INT_MAX__, __LONG_MAX__, or __LONG_LONG_MAX__. From-SVN: r54544
This commit is contained in:
parent
116b7a5ea8
commit
676997cfd2
22 changed files with 152 additions and 109 deletions
|
@ -1,3 +1,22 @@
|
|||
2002-06-11 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* c-common.c (builtin_define_type_max): New.
|
||||
(cb_register_builtins): Define __SCHAR_MAX__, __SHRT_MAX__,
|
||||
__INT_MAX__, __LONG_MAX__, __LONG_LONG_MAX__, __CHAR_BIT__.
|
||||
|
||||
From Joseph S. Myers:
|
||||
* glimits.h: Rewrite to expect the double underscore definitions
|
||||
from the compiler.
|
||||
|
||||
* config/alpha/unicosmk.h, config/avr/avr.h, config/h8300/h8300.h,
|
||||
config/i386/linux64.h, config/ia64/aix.h, config/ia64/hpux.h,
|
||||
config/ia64/ia64.h, config/m68hc11/m68hc11.h, config/m68hc11/m68hc12.h,
|
||||
config/mips/mips.h, config/mmix/mmix.h, config/mn10200/mn10200.h,
|
||||
config/pa/pa.h, config/rs6000/aix43.h, config/rs6000/aix51.h,
|
||||
config/rs6000/linux64.h, config/s390/linux.h, config/sh/sh.h,
|
||||
config/stormy16/stormy16.h: Don't define any of __SHRT_MAX__,
|
||||
__INT_MAX__, __LONG_MAX__, or __LONG_LONG_MAX__.
|
||||
|
||||
2002-06-11 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* config/alpha/alpha.c (ALPHA_BUILTIN_THREAD_POINTER): New.
|
||||
|
|
|
@ -365,6 +365,7 @@ static bool get_nonnull_operand PARAMS ((tree,
|
|||
void builtin_define_std PARAMS ((const char *));
|
||||
static void builtin_define_with_value PARAMS ((const char *, const char *,
|
||||
int));
|
||||
static void builtin_define_type_max PARAMS ((const char *, tree, int));
|
||||
|
||||
/* Table of machine-independent attributes common to all C-like languages. */
|
||||
const struct attribute_spec c_common_attribute_table[] =
|
||||
|
@ -4346,6 +4347,19 @@ cb_register_builtins (pfile)
|
|||
builtin_define_with_value ("__WCHAR_TYPE__", MODIFIED_WCHAR_TYPE, 0);
|
||||
builtin_define_with_value ("__WINT_TYPE__", WINT_TYPE, 0);
|
||||
|
||||
/* limits.h needs to know these. */
|
||||
builtin_define_type_max ("__SCHAR_MAX__", signed_char_type_node, 0);
|
||||
builtin_define_type_max ("__SHRT_MAX__", short_integer_type_node, 0);
|
||||
builtin_define_type_max ("__INT_MAX__", integer_type_node, 0);
|
||||
builtin_define_type_max ("__LONG_MAX__", long_integer_type_node, 1);
|
||||
builtin_define_type_max ("__LONG_LONG_MAX__", long_long_integer_type_node, 2);
|
||||
|
||||
{
|
||||
char buf[8];
|
||||
sprintf (buf, "%d", (int) TYPE_PRECISION (signed_char_type_node));
|
||||
builtin_define_with_value ("__CHAR_BIT__", buf, 0);
|
||||
}
|
||||
|
||||
/* For use in assembly language. */
|
||||
builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
|
||||
builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
|
||||
|
@ -4457,6 +4471,54 @@ builtin_define_with_value (macro, expansion, is_str)
|
|||
cpp_define (parse_in, buf);
|
||||
}
|
||||
|
||||
/* Define MAX for TYPE based on the precision of the type, which is assumed
|
||||
to be signed. IS_LONG is 1 for type "long" and 2 for "long long". */
|
||||
|
||||
static void
|
||||
builtin_define_type_max (macro, type, is_long)
|
||||
const char *macro;
|
||||
tree type;
|
||||
int is_long;
|
||||
{
|
||||
const char *value;
|
||||
char *buf;
|
||||
size_t mlen, vlen, extra;
|
||||
|
||||
/* Pre-rendering the values mean we don't have to futz with printing a
|
||||
multi-word decimal value. There are also a very limited number of
|
||||
precisions that we support, so it's really a waste of time. */
|
||||
switch (TYPE_PRECISION (type))
|
||||
{
|
||||
case 8:
|
||||
value = "127";
|
||||
break;
|
||||
case 16:
|
||||
value = "32767";
|
||||
break;
|
||||
case 32:
|
||||
value = "2147483647";
|
||||
break;
|
||||
case 64:
|
||||
value = "9223372036854775807";
|
||||
break;
|
||||
case 128:
|
||||
value = "170141183460469231731687303715884105727";
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
mlen = strlen (macro);
|
||||
vlen = strlen (value);
|
||||
extra = 2 + is_long;
|
||||
buf = alloca (mlen + vlen + extra);
|
||||
|
||||
sprintf (buf, "%s=%s%s", macro, value,
|
||||
(is_long == 1 ? "L" : is_long == 2 ? "LL" : ""));
|
||||
|
||||
cpp_define (parse_in, buf);
|
||||
}
|
||||
|
||||
/* Front end initialization common to C, ObjC and C++. */
|
||||
const char *
|
||||
c_common_init (filename)
|
||||
|
|
|
@ -43,8 +43,6 @@ Boston, MA 02111-1307, USA. */
|
|||
builtin_define ("_ADDR64"); \
|
||||
builtin_define ("_LD64"); \
|
||||
builtin_define ("__UNICOSMK__"); \
|
||||
builtin_define ("__INT_MAX__=9223372036854775807"); \
|
||||
builtin_define ("__SHRT_MAX__=2147483647"); \
|
||||
} while (0)
|
||||
|
||||
#define SHORT_TYPE_SIZE 32
|
||||
|
|
|
@ -38,10 +38,6 @@ Boston, MA 02111-1307, USA. */
|
|||
builtin_define ("__AVR_MEGA__"); \
|
||||
if (TARGET_NO_INTERRUPTS) \
|
||||
builtin_define ("__NO_INTERRUPTS__"); \
|
||||
if (TARGET_INT8) \
|
||||
builtin_define ("__INT_MAX__=127"); \
|
||||
else \
|
||||
builtin_define ("__INT_MAX__=32767"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
|
|
|
@ -59,12 +59,6 @@ extern const char * const *h8_reg_names;
|
|||
builtin_assert ("cpu=h8300"); \
|
||||
builtin_assert ("machine=h8300"); \
|
||||
} \
|
||||
if (TARGET_INT32) \
|
||||
builtin_define ("__INT_MAX__=2147483647"); \
|
||||
else \
|
||||
builtin_define ("__INT_MAX__=32767"); \
|
||||
builtin_define ("__LONG_MAX__=2147483647L"); \
|
||||
builtin_define ("__LONG_LONG_MAX__=2147483647L"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ Boston, MA 02111-1307, USA. */
|
|||
#define CPP_PREDEFINES "-D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -Asystem(posix)"
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT} %{!m32:-D__LONG_MAX__=9223372036854775807L}"
|
||||
#define CPP_SPEC "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
|
||||
|
||||
/* Provide a LINK_SPEC. Here we provide support for the special GCC
|
||||
options -static and -shared, which allow us to link things in one
|
||||
|
|
|
@ -81,8 +81,7 @@ Boston, MA 02111-1307, USA. */
|
|||
%{mcpu=itanium:-D__itanium__} %{mbig-endian:-D__BIG_ENDIAN__} \
|
||||
%{ansi:-D_ANSI_C_SOURCE} \
|
||||
%{posix:-D_POSIX_SOURCE} \
|
||||
%{cpp_cpu} \
|
||||
-D__LONG_MAX__=9223372036854775807L"
|
||||
%{cpp_cpu}"
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "\
|
||||
|
@ -97,7 +96,6 @@ Boston, MA 02111-1307, USA. */
|
|||
-D_XOPEN_SOURCE_EXTENDED=1 \
|
||||
-D_LARGE_FILE_API \
|
||||
-D_ALL_SOURCE \
|
||||
-D__LONG_MAX__=9223372036854775807L \
|
||||
%{cpp_cpu}"
|
||||
|
||||
/* Define this for shared library support. */
|
||||
|
|
|
@ -40,7 +40,7 @@ Boston, MA 02111-1307, USA. */
|
|||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "\
|
||||
%{mcpu=itanium:-D__itanium__} \
|
||||
%{mlp64:-D__LP64__ -D_LP64 -D__LONG_MAX__=9223372036854775807L} \
|
||||
%{mlp64:-D__LP64__ -D_LP64} \
|
||||
%{!ansi:%{!std=c*:%{!std=i*: -D_HPUX_SOURCE -D__STDC_EXT__}}} \
|
||||
-D__fpreg=long\\ double \
|
||||
-D__float80=long\\ double \
|
||||
|
|
|
@ -212,14 +212,8 @@ extern const char *ia64_tls_size_string;
|
|||
CPP. It can also specify how to translate options you give to GNU CC into
|
||||
options for GNU CC to pass to the CPP. */
|
||||
|
||||
/* ??? __LONG_MAX__ depends on LP64/ILP32 switch. */
|
||||
/* ??? An alternative is to modify glimits.h to check for __LP64__ instead
|
||||
of checked for CPU specific defines. We could also get rid of all LONG_MAX
|
||||
defines in other tm.h files. */
|
||||
#define CPP_SPEC \
|
||||
"%{mcpu=itanium:-D__itanium__} %{mbig-endian:-D__BIG_ENDIAN__} \
|
||||
%(cpp_cpu) \
|
||||
-D__LONG_MAX__=9223372036854775807L"
|
||||
"%{mcpu=itanium:-D__itanium__} %{mbig-endian:-D__BIG_ENDIAN__} %(cpp_cpu)"
|
||||
|
||||
/* A C string constant that tells the GNU CC driver program options to pass to
|
||||
`cc1'. It can also specify how to translate options you give to GNU CC into
|
||||
|
|
|
@ -62,8 +62,8 @@ Note:
|
|||
|
||||
#ifndef CPP_SPEC
|
||||
#define CPP_SPEC \
|
||||
"%{mshort:-D__HAVE_SHORT_INT__ -D__INT__=16 -D__INT_MAX__=32767}\
|
||||
%{!mshort:-D__INT__=32 -D__INT_MAX__=2147483647}\
|
||||
"%{mshort:-D__HAVE_SHORT_INT__ -D__INT__=16}\
|
||||
%{!mshort:-D__INT__=32}\
|
||||
%{m68hc12:-Dmc6812 -DMC6812 -Dmc68hc12}\
|
||||
%{!m68hc12:-Dmc6811 -DMC6811 -Dmc68hc11}\
|
||||
%{fshort-double:-D__HAVE_SHORT_DOUBLE__}"
|
||||
|
|
|
@ -29,8 +29,8 @@ Boston, MA 02111-1307, USA. */
|
|||
#define LINK_SPEC "%{m68hc11:-m m68hc11elf}%{!m68hc11:-m m68hc12elf}"
|
||||
|
||||
#define CPP_SPEC \
|
||||
"%{mshort:-D__HAVE_SHORT_INT__ -D__INT__=16 -D__INT_MAX__=32767}\
|
||||
%{!mshort:-D__INT__=32 -D__INT_MAX__=2147483647}\
|
||||
"%{mshort:-D__HAVE_SHORT_INT__ -D__INT__=16}\
|
||||
%{!mshort:-D__INT__=32}\
|
||||
%{m68hc11:-Dmc6811 -DMC6811 -Dmc68hc11}\
|
||||
%{!m68hc11:-Dmc6812 -DMC6812 -Dmc68hc12}\
|
||||
%{fshort-double:-D__HAVE_SHORT_DOUBLE__}"
|
||||
|
|
|
@ -417,9 +417,6 @@ extern void sbss_section PARAMS ((void));
|
|||
if (TARGET_SINGLE_FLOAT) \
|
||||
builtin_define ("__mips_single_float"); \
|
||||
\
|
||||
if (TARGET_LONG64) \
|
||||
builtin_define ("__LONG_MAX__=9223372036854775807L"); \
|
||||
\
|
||||
if (TARGET_BIG_ENDIAN) \
|
||||
{ \
|
||||
builtin_define_std ("MIPSEB"); \
|
||||
|
|
|
@ -145,7 +145,6 @@ extern const char *mmix_cc1_ignored_option;
|
|||
{ \
|
||||
builtin_define ("__mmix__"); \
|
||||
builtin_define ("__MMIX__"); \
|
||||
builtin_define ("__LONG_MAX__=9223372036854775807L"); \
|
||||
if (TARGET_ABI_GNU) \
|
||||
builtin_define ("__MMIX_ABI_GNU__"); \
|
||||
else \
|
||||
|
|
|
@ -32,7 +32,7 @@ Boston, MA 02111-1307, USA. */
|
|||
|
||||
/* Names to predefine in the preprocessor for this target machine. */
|
||||
|
||||
#define CPP_PREDEFINES "-D__mn10200__ -D__MN10200__ -D__LONG_MAX__=2147483647L -D__LONG_LONG_MAX__=2147483647L -D__INT_MAX__=32767"
|
||||
#define CPP_PREDEFINES "-D__mn10200__ -D__MN10200__"
|
||||
|
||||
/* Run-time compilation parameters selecting different hardware subsets. */
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ extern int target_flags;
|
|||
#define CPP_PA10_SPEC ""
|
||||
#define CPP_PA11_SPEC "-D_PA_RISC1_1 -D__hp9000s700"
|
||||
#define CPP_PA20_SPEC "-D_PA_RISC2_0 -D__hp9000s800"
|
||||
#define CPP_64BIT_SPEC "-D__LP64__ -D__LONG_MAX__=9223372036854775807L"
|
||||
#define CPP_64BIT_SPEC "-D__LP64__"
|
||||
|
||||
#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_PA_11) == 0
|
||||
#define CPP_CPU_DEFAULT_SPEC "%(cpp_pa10)"
|
||||
|
|
|
@ -103,7 +103,7 @@ do { \
|
|||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
|
||||
%{ansi: -D_ANSI_C_SOURCE}\
|
||||
%{maix64: -D__64BIT__ -D__LONG_MAX__=9223372036854775807L}\
|
||||
%{maix64: -D__64BIT__}\
|
||||
%{mpe: -I/usr/lpp/ppe.poe/include}\
|
||||
%{pthread: -D_THREAD_SAFE}"
|
||||
|
||||
|
@ -114,9 +114,9 @@ do { \
|
|||
"-D_XOPEN_SOURCE=500 \
|
||||
-D_XOPEN_SOURCE_EXTENDED=1 \
|
||||
-D_LARGE_FILE_API \
|
||||
-D_ALL_SOURCE \
|
||||
%{maix64: -D__64BIT__ -D__LONG_MAX__=9223372036854775807L}\
|
||||
%{mpe: -I/usr/lpp/ppe.poe/include}\
|
||||
-D_ALL_SOURCE \
|
||||
%{maix64: -D__64BIT__} \
|
||||
%{mpe: -I/usr/lpp/ppe.poe/include} \
|
||||
%{pthread: -D_THREAD_SAFE}"
|
||||
|
||||
#undef TARGET_DEFAULT
|
||||
|
|
|
@ -101,22 +101,22 @@ do { \
|
|||
-D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -Asystem=unix -Asystem=aix"
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
|
||||
%{ansi: -D_ANSI_C_SOURCE}\
|
||||
%{maix64: -D__64BIT__ -D__LONG_MAX__=9223372036854775807L}
|
||||
%{mpe: -I/usr/lpp/ppe.poe/include}\
|
||||
#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
|
||||
%{ansi: -D_ANSI_C_SOURCE} \
|
||||
%{maix64: -D__64BIT__} \
|
||||
%{mpe: -I/usr/lpp/ppe.poe/include} \
|
||||
%{pthread: -D_THREAD_SAFE}"
|
||||
|
||||
/* The GNU C++ standard library requires that these macros be
|
||||
defined. */
|
||||
#undef CPLUSPLUS_CPP_SPEC
|
||||
#define CPLUSPLUS_CPP_SPEC \
|
||||
"-D_XOPEN_SOURCE=500 \
|
||||
-D_XOPEN_SOURCE_EXTENDED=1 \
|
||||
-D_LARGE_FILE_API \
|
||||
-D_ALL_SOURCE \
|
||||
%{maix64: -D__64BIT__ -D__LONG_MAX__=9223372036854775807L}
|
||||
%{mpe: -I/usr/lpp/ppe.poe/include}\
|
||||
#define CPLUSPLUS_CPP_SPEC \
|
||||
"-D_XOPEN_SOURCE=500 \
|
||||
-D_XOPEN_SOURCE_EXTENDED=1 \
|
||||
-D_LARGE_FILE_API \
|
||||
-D_ALL_SOURCE \
|
||||
%{maix64: -D__64BIT__} \
|
||||
%{mpe: -I/usr/lpp/ppe.poe/include} \
|
||||
%{pthread: -D_THREAD_SAFE}"
|
||||
|
||||
#undef TARGET_DEFAULT
|
||||
|
|
|
@ -110,7 +110,6 @@ Boston, MA 02111-1307, USA. */
|
|||
#define CPP_PREDEFINES \
|
||||
"-D_PPC_ -D__PPC__ -D_PPC64_ -D__PPC64__ -D__powerpc__ -D__powerpc64__ \
|
||||
-D_PIC_ -D__PIC__ -D__ELF__ \
|
||||
-D__LONG_MAX__=9223372036854775807L \
|
||||
-Acpu=powerpc64 -Amachine=powerpc64"
|
||||
|
||||
#undef CPP_OS_DEFAULT_SPEC
|
||||
|
|
|
@ -55,7 +55,7 @@ Boston, MA 02111-1307, USA. */
|
|||
-Acpu(s390) -Amachine(s390) -D__s390__"
|
||||
|
||||
#define CPP_ARCH31_SPEC ""
|
||||
#define CPP_ARCH64_SPEC "-D__s390x__ -D__LONG_MAX__=9223372036854775807L"
|
||||
#define CPP_ARCH64_SPEC "-D__s390x__"
|
||||
|
||||
#undef CPP_SPEC
|
||||
#ifdef DEFAULT_TARGET_64BIT
|
||||
|
|
|
@ -65,9 +65,6 @@ do { \
|
|||
TARGET_SHMEDIA ? "1" : "0", 0); \
|
||||
if (! TARGET_FPU_DOUBLE) \
|
||||
builtin_define ("__SH4_NOFPU__"); \
|
||||
if (TARGET_SHMEDIA64) \
|
||||
builtin_define_with_value ("__LONG_MAX__", \
|
||||
"9223372036854775807L", 0); \
|
||||
} \
|
||||
} \
|
||||
if (TARGET_HITACHI) \
|
||||
|
|
|
@ -67,7 +67,7 @@ Boston, MA 02111-1307, USA. */
|
|||
|
||||
/* Run-time target specifications */
|
||||
|
||||
#define CPP_PREDEFINES "-Dxstormy16 -Amachine=xstormy16 -D__INT_MAX__=32767"
|
||||
#define CPP_PREDEFINES "-Dxstormy16 -Amachine=xstormy16"
|
||||
|
||||
/* This declaration should be present. */
|
||||
extern int target_flags;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/* Number of bits in a `char'. */
|
||||
#undef CHAR_BIT
|
||||
#define CHAR_BIT 8
|
||||
#define CHAR_BIT __CHAR_BIT__
|
||||
|
||||
/* Maximum length of a multibyte character. */
|
||||
#ifndef MB_LEN_MAX
|
||||
|
@ -12,102 +12,92 @@
|
|||
|
||||
/* Minimum and maximum values a `signed char' can hold. */
|
||||
#undef SCHAR_MIN
|
||||
#define SCHAR_MIN (-128)
|
||||
#define SCHAR_MIN (-SCHAR_MAX - 1)
|
||||
#undef SCHAR_MAX
|
||||
#define SCHAR_MAX 127
|
||||
#define SCHAR_MAX __SCHAR_MAX__
|
||||
|
||||
/* Maximum value an `unsigned char' can hold. (Minimum is 0). */
|
||||
#undef UCHAR_MAX
|
||||
#define UCHAR_MAX 255
|
||||
#if __SCHAR_MAX__ == __INT_MAX__
|
||||
# define UCHAR_MAX (SCHAR_MAX * 2U + 1U)
|
||||
#else
|
||||
# define UCHAR_MAX (SCHAR_MAX * 2 + 1)
|
||||
#endif
|
||||
|
||||
/* Minimum and maximum values a `char' can hold. */
|
||||
#ifdef __CHAR_UNSIGNED__
|
||||
#undef CHAR_MIN
|
||||
#define CHAR_MIN 0
|
||||
#undef CHAR_MAX
|
||||
#define CHAR_MAX 255
|
||||
# undef CHAR_MIN
|
||||
# if __SCHAR_MAX__ == __INT_MAX__
|
||||
# define CHAR_MIN 0U
|
||||
# else
|
||||
# define CHAR_MIN 0
|
||||
# endif
|
||||
# undef CHAR_MAX
|
||||
# define CHAR_MAX UCHAR_MAX
|
||||
#else
|
||||
#undef CHAR_MIN
|
||||
#define CHAR_MIN (-128)
|
||||
#undef CHAR_MAX
|
||||
#define CHAR_MAX 127
|
||||
#endif
|
||||
|
||||
#ifndef __SHRT_MAX__
|
||||
#define __SHRT_MAX__ 32767
|
||||
# undef CHAR_MIN
|
||||
# define CHAR_MIN SCHAR_MIN
|
||||
# undef CHAR_MAX
|
||||
# define CHAR_MAX SCHAR_MAX
|
||||
#endif
|
||||
|
||||
/* Minimum and maximum values a `signed short int' can hold. */
|
||||
#undef SHRT_MIN
|
||||
#define SHRT_MIN (-SHRT_MAX-1)
|
||||
#define SHRT_MIN (-SHRT_MAX - 1)
|
||||
#undef SHRT_MAX
|
||||
#define SHRT_MAX __SHRT_MAX__
|
||||
|
||||
/* Minimum and maximum values a `signed int' can hold. */
|
||||
#ifndef __INT_MAX__
|
||||
#define __INT_MAX__ 2147483647
|
||||
#endif
|
||||
#undef INT_MIN
|
||||
#define INT_MIN (-INT_MAX-1)
|
||||
#undef INT_MAX
|
||||
#define INT_MAX __INT_MAX__
|
||||
|
||||
/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
|
||||
#undef USHRT_MAX
|
||||
#if __SHRT_MAX__ == __INT_MAX__
|
||||
#define USHRT_MAX (SHRT_MAX * 2U + 1U)
|
||||
# define USHRT_MAX (SHRT_MAX * 2U + 1U)
|
||||
#else
|
||||
#define USHRT_MAX (SHRT_MAX * 2 + 1)
|
||||
# define USHRT_MAX (SHRT_MAX * 2 + 1)
|
||||
#endif
|
||||
|
||||
/* Minimum and maximum values a `signed int' can hold. */
|
||||
#undef INT_MIN
|
||||
#define INT_MIN (-INT_MAX - 1)
|
||||
#undef INT_MAX
|
||||
#define INT_MAX __INT_MAX__
|
||||
|
||||
/* Maximum value an `unsigned int' can hold. (Minimum is 0). */
|
||||
#undef UINT_MAX
|
||||
#define UINT_MAX (INT_MAX * 2U + 1)
|
||||
#define UINT_MAX (INT_MAX * 2U + 1U)
|
||||
|
||||
/* Minimum and maximum values a `signed long int' can hold.
|
||||
(Same as `int'). */
|
||||
#ifndef __LONG_MAX__
|
||||
#if defined (__alpha__) || (defined (__sparc__) && defined(__arch64__)) || defined (__sparcv9)
|
||||
#define __LONG_MAX__ 9223372036854775807L
|
||||
#else
|
||||
#define __LONG_MAX__ 2147483647L
|
||||
#endif /* __alpha__ || sparc64 */
|
||||
#endif
|
||||
#undef LONG_MIN
|
||||
#define LONG_MIN (-LONG_MAX-1)
|
||||
#define LONG_MIN (-LONG_MAX - 1L)
|
||||
#undef LONG_MAX
|
||||
#define LONG_MAX __LONG_MAX__
|
||||
|
||||
/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
|
||||
#undef ULONG_MAX
|
||||
#define ULONG_MAX (LONG_MAX * 2UL + 1)
|
||||
|
||||
#ifndef __LONG_LONG_MAX__
|
||||
#define __LONG_LONG_MAX__ 9223372036854775807LL
|
||||
#endif
|
||||
#define ULONG_MAX (LONG_MAX * 2UL + 1UL)
|
||||
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
/* Minimum and maximum values a `signed long long int' can hold. */
|
||||
#undef LLONG_MIN
|
||||
#define LLONG_MIN (-LLONG_MAX-1)
|
||||
#undef LLONG_MAX
|
||||
#define LLONG_MAX __LONG_LONG_MAX__
|
||||
# undef LLONG_MIN
|
||||
# define LLONG_MIN (-LLONG_MAX - 1LL)
|
||||
# undef LLONG_MAX
|
||||
# define LLONG_MAX __LONG_LONG_MAX__
|
||||
|
||||
/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
|
||||
#undef ULLONG_MAX
|
||||
#define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
|
||||
# undef ULLONG_MAX
|
||||
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
|
||||
#endif
|
||||
|
||||
#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
|
||||
/* Minimum and maximum values a `signed long long int' can hold. */
|
||||
#undef LONG_LONG_MIN
|
||||
#define LONG_LONG_MIN (-LONG_LONG_MAX-1)
|
||||
#undef LONG_LONG_MAX
|
||||
#define LONG_LONG_MAX __LONG_LONG_MAX__
|
||||
# undef LONG_LONG_MIN
|
||||
# define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
|
||||
# undef LONG_LONG_MAX
|
||||
# define LONG_LONG_MAX __LONG_LONG_MAX__
|
||||
|
||||
/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
|
||||
#undef ULONG_LONG_MAX
|
||||
#define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1)
|
||||
# undef ULONG_LONG_MAX
|
||||
# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
|
||||
#endif
|
||||
|
||||
#endif /* _LIMITS_H___ */
|
||||
|
|
Loading…
Add table
Reference in a new issue