diff options
30 files changed, 2069 insertions, 170 deletions
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 68bb8e8..f5f0c49 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,10 @@ +2009-03-31 Joseph Myers <joseph@codesourcery.com> + + PR c/448 + * inclhack.def (newlib_stdint_1, newlib_stdint_2): New fixes. + * fixincl.x: Regenerate. + * tests/base/stdint.h: Update. + 2009-03-29 Joseph Myers <joseph@codesourcery.com> * tests/base/math.h, tests/base/pthread.h, tests/base/sys/wait.h: diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index fa38cb3..505e2e8 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed Sunday March 29, 2009 at 01:30:25 AM UTC + * It has been AutoGen-ed Tuesday March 31, 2009 at 05:01:22 PM UTC * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Mar 29 01:30:25 UTC 2009 +/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Mar 31 17:01:22 UTC 2009 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 178 fixup descriptions. + * This file contains 180 fixup descriptions. * * See README for more information. * @@ -4518,6 +4518,96 @@ static const char* apzNetbsd_Extra_SemicolonPatch[] = { /* * * * * * * * * * * * * * * * * * * * * * * * * * * + * Description of Newlib_Stdint_1 fix + */ +tSCC zNewlib_Stdint_1Name[] = + "newlib_stdint_1"; + +/* + * File name selection pattern + */ +tSCC zNewlib_Stdint_1List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +#define apzNewlib_Stdint_1Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zNewlib_Stdint_1Select0[] = + "@todo - Add support for wint_t types"; + +#define NEWLIB_STDINT_1_TEST_CT 1 +static tTestDesc aNewlib_Stdint_1Tests[] = { + { TT_EGREP, zNewlib_Stdint_1Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Newlib_Stdint_1 + */ +static const char* apzNewlib_Stdint_1Patch[] = { sed_cmd_z, + "-e", "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@", + "-e", "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@", + "-e", "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@", + "-e", "s@#define INT_LEAST32_MIN.*@#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@", + "-e", "s@#define INT_LEAST32_MAX.*@#define INT_LEAST32_MAX __INT_LEAST32_MAX__@", + "-e", "s@#define UINT_LEAST32_MAX.*@#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@", + "-e", "s@#define INT_FAST\\([0-9]*\\)_MIN.*@#define INT_FAST\\1_MIN (-INT_FAST\\1_MAX - 1)@", + "-e", "s@#define INT_FAST\\([0-9]*\\)_MAX.*@#define INT_FAST\\1_MAX __INT_FAST\\1_MAX__@", + "-e", "s@#define UINT_FAST\\([0-9]*\\)_MAX.*@#define UINT_FAST\\1_MAX __UINT_FAST\\1_MAX__@", + "-e", "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@", + "-e", "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@", + "-e", "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@", + "-e", "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@", + "-e", "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Newlib_Stdint_2 fix + */ +tSCC zNewlib_Stdint_2Name[] = + "newlib_stdint_2"; + +/* + * File name selection pattern + */ +tSCC zNewlib_Stdint_2List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +#define apzNewlib_Stdint_2Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zNewlib_Stdint_2Select0[] = + "@todo - Add support for wint_t types"; + +#define NEWLIB_STDINT_2_TEST_CT 1 +static tTestDesc aNewlib_Stdint_2Tests[] = { + { TT_EGREP, zNewlib_Stdint_2Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Newlib_Stdint_2 + */ +static const char* apzNewlib_Stdint_2Patch[] = { + "format", + "#define INTMAX_MAX __INTMAX_MAX__\n\ +#define INTMAX_MIN (-INTMAX_MAX - 1)\n\ +#define UINTMAX_MAX __UINTMAX_MAX__\n\ +#define WCHAR_MAX __WCHAR_MAX__\n\ +#define WCHAR_MIN __WCHAR_MIN__\n\ +#define WINT_MAX __WINT_MAX__\n\ +#define WINT_MIN __WINT_MIN__\n\n\ +%0", + "/\\*\\* Macros for minimum-width integer constant expressions \\*/", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * * Description of Next_Math_Prefix fix */ tSCC zNext_Math_PrefixName[] = @@ -7235,9 +7325,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 223 +#define REGEX_COUNT 225 #define MACH_LIST_SIZE_LIMIT 181 -#define FIX_COUNT 178 +#define FIX_COUNT 180 /* * Enumerate the fixes @@ -7354,6 +7444,8 @@ typedef enum { NETBSD_C99_INLINE_1_FIXIDX, NETBSD_C99_INLINE_2_FIXIDX, NETBSD_EXTRA_SEMICOLON_FIXIDX, + NEWLIB_STDINT_1_FIXIDX, + NEWLIB_STDINT_2_FIXIDX, NEXT_MATH_PREFIX_FIXIDX, NEXT_TEMPLATE_FIXIDX, NEXT_VOLITILE_FIXIDX, @@ -7979,6 +8071,16 @@ tFixDesc fixDescList[ FIX_COUNT ] = { NETBSD_EXTRA_SEMICOLON_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aNetbsd_Extra_SemicolonTests, apzNetbsd_Extra_SemicolonPatch, 0 }, + { zNewlib_Stdint_1Name, zNewlib_Stdint_1List, + apzNewlib_Stdint_1Machs, + NEWLIB_STDINT_1_TEST_CT, FD_MACH_ONLY, + aNewlib_Stdint_1Tests, apzNewlib_Stdint_1Patch, 0 }, + + { zNewlib_Stdint_2Name, zNewlib_Stdint_2List, + apzNewlib_Stdint_2Machs, + NEWLIB_STDINT_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aNewlib_Stdint_2Tests, apzNewlib_Stdint_2Patch, 0 }, + { zNext_Math_PrefixName, zNext_Math_PrefixList, apzNext_Math_PrefixMachs, NEXT_MATH_PREFIX_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index f6dbd21..e1d413cc 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -2430,6 +2430,64 @@ fix = { }; +/* newlib's stdint.h has several failures to conform to C99. The fix + for these removed a comment that can be matched to identify unfixed + versions. */ +fix = { + hackname = newlib_stdint_1; + files = stdint.h; + select = "@todo - Add support for wint_t types"; + sed = "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@"; + sed = "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@"; + sed = "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@"; + sed = "s@#define INT_LEAST32_MIN.*@#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@"; + sed = "s@#define INT_LEAST32_MAX.*@#define INT_LEAST32_MAX __INT_LEAST32_MAX__@"; + sed = "s@#define UINT_LEAST32_MAX.*@#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@"; + sed = 's@#define INT_FAST\([0-9]*\)_MIN.*@#define INT_FAST\1_MIN (-INT_FAST\1_MAX - 1)@'; + sed = 's@#define INT_FAST\([0-9]*\)_MAX.*@#define INT_FAST\1_MAX __INT_FAST\1_MAX__@'; + sed = 's@#define UINT_FAST\([0-9]*\)_MAX.*@#define UINT_FAST\1_MAX __UINT_FAST\1_MAX__@'; + sed = "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@"; + sed = "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@"; + sed = "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@"; + sed = "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@"; + sed = "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@"; + test_text = "/* @todo - Add support for wint_t types. */\n" + "#define INT32_MIN (-2147483647-1)\n" + "#define INT32_MAX 2147483647\n" + "#define UINT32_MAX 4294967295U\n" + "#define INT_LEAST32_MIN (-2147483647-1)\n" + "#define INT_LEAST32_MAX 2147483647\n" + "#define UINT_LEAST32_MAX 4294967295U\n" + "#define INT_FAST8_MIN INT8_MIN\n" + "#define INT_FAST8_MAX INT8_MAX\n" + "#define UINT_FAST8_MAX UINT8_MAX\n" + "#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)\n" + "#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)\n" + "#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)\n" + "#define UINT8_C(x) x##U\n" + "#define UINT16_C(x) x##U"; +}; + + +fix = { + hackname = newlib_stdint_2; + files = stdint.h; + select = "@todo - Add support for wint_t types"; + c_fix = format; + c_fix_arg = "#define INTMAX_MAX __INTMAX_MAX__\n" + "#define INTMAX_MIN (-INTMAX_MAX - 1)\n" + "#define UINTMAX_MAX __UINTMAX_MAX__\n" + "#define WCHAR_MAX __WCHAR_MAX__\n" + "#define WCHAR_MIN __WCHAR_MIN__\n" + "#define WINT_MAX __WINT_MAX__\n" + "#define WINT_MIN __WINT_MIN__\n\n" + "%0"; + c_fix_arg = '/\*\* Macros for minimum-width integer constant expressions \*/'; + test_text = "/* @todo - Add support for wint_t types. */\n" + "/** Macros for minimum-width integer constant expressions */"; +}; + + /* * NeXT 3.2 adds const prefix to some math functions. * These conflict with the built-in functions. diff --git a/fixincludes/tests/base/stdint.h b/fixincludes/tests/base/stdint.h index 369b012..9ca62ae 100644 --- a/fixincludes/tests/base/stdint.h +++ b/fixincludes/tests/base/stdint.h @@ -14,3 +14,36 @@ #error This header file is to be used only for c99 mode compilations #else #endif /* IRIX_STDINT_C99_CHECK */ + + +#if defined( NEWLIB_STDINT_1_CHECK ) +/* @todo - Add support for wint_t types. */ +#define INT32_MIN (-INT32_MAX - 1) +#define INT32_MAX __INT32_MAX__ +#define UINT32_MAX __UINT32_MAX__ +#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1) +#define INT_LEAST32_MAX __INT_LEAST32_MAX__ +#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__ +#define INT_FAST8_MIN (-INT_FAST8_MAX - 1) +#define INT_FAST8_MAX __INT_FAST8_MAX__ +#define UINT_FAST8_MAX __UINT_FAST8_MAX__ +#define SIZE_MAX __SIZE_MAX__ +#define PTRDIFF_MIN (-PTRDIFF_MAX - 1) +#define PTRDIFF_MAX __PTRDIFF_MAX__ +#define UINT8_C(c) __UINT8_C(c) +#define UINT16_C(c) __UINT16_C(c) +#endif /* NEWLIB_STDINT_1_CHECK */ + + +#if defined( NEWLIB_STDINT_2_CHECK ) +/* @todo - Add support for wint_t types. */ +#define INTMAX_MAX __INTMAX_MAX__ +#define INTMAX_MIN (-INTMAX_MAX - 1) +#define UINTMAX_MAX __UINTMAX_MAX__ +#define WCHAR_MAX __WCHAR_MAX__ +#define WCHAR_MIN __WCHAR_MIN__ +#define WINT_MAX __WINT_MAX__ +#define WINT_MIN __WINT_MIN__ + +/** Macros for minimum-width integer constant expressions */ +#endif /* NEWLIB_STDINT_2_CHECK */ diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3ac7f56..ec44d8a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,103 @@ +2009-03-31 Joseph Myers <joseph@codesourcery.com> + + PR c/448 + * Makefile.in (USE_GCC_STDINT): Define. + (stmp-int-hdrs): Install stdint.h if applicable. + * c-common.c (CHAR16_TYPE): Define in terms of UINT_LEAST16_TYPE + if known. + (CHAR32_TYPE): Define in terms of UINT_LEAST32_TYPE if known. + (SIG_ATOMIC_TYPE, INT8_TYPE, INT16_TYPE, INT32_TYPE, INT64_TYPE, + UINT8_TYPE, UINT16_TYPE, UINT32_TYPE, UINT64_TYPE, + INT_LEAST8_TYPE, INT_LEAST16_TYPE, INT_LEAST32_TYPE, + INT_LEAST64_TYPE, UINT_LEAST8_TYPE, UINT_LEAST16_TYPE, + UINT_LEAST32_TYPE, UINT_LEAST64_TYPE, INT_FAST8_TYPE, + INT_FAST16_TYPE, INT_FAST32_TYPE, INT_FAST64_TYPE, + UINT_FAST8_TYPE, UINT_FAST16_TYPE, UINT_FAST32_TYPE, + UINT_FAST64_TYPE, INTPTR_TYPE, UINTPTR_TYPE): Define. + (c_common_nodes_and_builtins): Initialize + underlying_wchar_type_node. Do not initialize + signed_wchar_type_node or unsigned_wchar_type_node. Initialize + nodes for new types. + (c_stddef_cpp_builtins): Define macros for new types. + * c-common.h (CTI_SIGNED_WCHAR_TYPE, CTI_UNSIGNED_WCHAR_TYPE): + Remove. + (CTI_UNDERLYING_WCHAR_TYPE, CTI_SIG_ATOMIC_TYPE, CTI_INT8_TYPE, + CTI_INT16_TYPE, CTI_INT32_TYPE, CTI_INT64_TYPE, CTI_UINT8_TYPE, + CTI_UINT16_TYPE, CTI_UINT32_TYPE, CTI_UINT64_TYPE, + CTI_INT_LEAST8_TYPE, CTI_INT_LEAST16_TYPE, CTI_INT_LEAST32_TYPE, + CTI_INT_LEAST64_TYPE, CTI_UINT_LEAST8_TYPE, CTI_UINT_LEAST16_TYPE, + CTI_UINT_LEAST32_TYPE, CTI_UINT_LEAST64_TYPE, CTI_INT_FAST8_TYPE, + CTI_INT_FAST16_TYPE, CTI_INT_FAST32_TYPE, CTI_INT_FAST64_TYPE, + CTI_UINT_FAST8_TYPE, CTI_UINT_FAST16_TYPE, CTI_UINT_FAST32_TYPE, + CTI_UINT_FAST64_TYPE, CTI_INTPTR_TYPE, CTI_UINTPTR_TYPE): Define. + (signed_wchar_type_node, unsigned_wchar_type_node): Remove. + (underlying_wchar_type_node, sig_atomic_type_node, int8_type_node, + int16_type_node, int32_type_node, int64_type_node, + uint8_type_node, uint16_type_node, c_uint32_type_node, + c_uint64_type_node, int_least8_type_node, int_least16_type_node, + int_least32_type_node, int_least64_type_node, + uint_least8_type_node, uint_least16_type_node, + uint_least32_type_node, uint_least64_type_node, + int_fast8_type_node, int_fast16_type_node, int_fast32_type_node, + int_fast64_type_node, uint_fast8_type_node, uint_fast16_type_node, + uint_fast32_type_node, uint_fast64_type_node, intptr_type_node, + uintptr_type_node): Define. + * c-cppbuiltin.c (builtin_define_constants, + builtin_define_type_minmax): New. + (builtin_define_stdint_macros): Define more macros. + (c_cpp_builtins): Define more limit macros. + (type_suffix): New. + (builtin_define_type_max): Define in terms of + builtin_define_type_minmax. Remove is_long parameter. All + callers changed. + * config.gcc (use_gcc_stdint): Define. + (tm_file): Add glibc-stdint.h for targets using glibc or uClibc. + Add newlib-stdint.h for generic targets. + * config/glibc-stdint.h, config/newlib-stdint.h, + ginclude/stdint-gcc.h, ginclude/stdint-wrap.h: New. + * config/m32c/m32c.h (UINTPTR_TYPE): Define. + * config/score/score.h (UINTPTR_TYPE): Define. + * config/sol2.h (SIG_ATOMIC_TYPE, INT8_TYPE, INT16_TYPE, + INT32_TYPE, INT64_TYPE, UINT8_TYPE, UINT16_TYPE, UINT32_TYPE, + UINT64_TYPE, INT_LEAST8_TYPE, INT_LEAST16_TYPE, INT_LEAST32_TYPE, + INT_LEAST64_TYPE, UINT_LEAST8_TYPE, UINT_LEAST16_TYPE, + UINT_LEAST32_TYPE, UINT_LEAST64_TYPE, INT_FAST8_TYPE, + INT_FAST16_TYPE, INT_FAST32_TYPE, INT_FAST64_TYPE, + UINT_FAST8_TYPE, UINT_FAST16_TYPE, UINT_FAST32_TYPE, + UINT_FAST64_TYPE, INTPTR_TYPE, UINTPTR_TYPE): Define. + * config/spu/spu.h (STDINT_LONG32): Define. + * configure.ac (use_gcc_stdint): Substitute. + * configure: Regenerate. + * doc/cpp.texi (__SIG_ATOMIC_TYPE__, __INT8_TYPE__, + __INT16_TYPE__, __INT32_TYPE__, __INT64_TYPE__, __UINT8_TYPE__, + __UINT16_TYPE__, __UINT32_TYPE__, __UINT64_TYPE__, + __INT_LEAST8_TYPE__, __INT_LEAST16_TYPE__, __INT_LEAST32_TYPE__, + __INT_LEAST64_TYPE__, __UINT_LEAST8_TYPE__, __UINT_LEAST16_TYPE__, + __UINT_LEAST32_TYPE_, __UINT_LEAST64_TYPE__, __INT_FAST8_TYPE__, + __INT_FAST16_TYPE__, __INT_FAST32_TYPE__, __INT_FAST64_TYPE__, + __UINT_FAST8_TYPE__, __UINT_FAST16_TYPE__, __UINT_FAST32_TYPE__, + __UINT_FAST64_TYPE__, __INTPTR_TYPE__, __UINTPTR_TYPE__, + __WINT_MAX__, __SIZE_MAX__, __PTRDIFF_MAX__, __UINTMAX_MAX__, + __SIG_ATOMIC_MAX__, __INT8_MAX__, __INT16_MAX__, __INT32_MAX__, + __INT64_MAX__, __UINT8_MAX__, __UINT16_MAX__, __UINT32_MAX__, + __UINT64_MAX__, __INT_LEAST8_MAX__, __INT_LEAST16_MAX__, + __INT_LEAST32_MAX__, __INT_LEAST64_MAX__, __UINT_LEAST8_MAX__, + __UINT_LEAST16_MAX__, __UINT_LEAST32_MAX__, __UINT_LEAST64_MAX__, + __INT_FAST8_MAX__, __INT_FAST16_MAX__, __INT_FAST32_MAX__, + __INT_FAST64_MAX__, __UINT_FAST8_MAX__, __UINT_FAST16_MAX__, + __UINT_FAST32_MAX__, __UINT_FAST64_MAX__, __INTPTR_MAX__, + __UINTPTR_MAX__, __WCHAR_MIN__, __WINT_MIN__, __SIG_ATOMIC_MIN__, + __INT8_C, __INT16_C, __INT32_C, __INT64_C, __UINT8_C, __UINT16_C, + __UINT32_C, __UINT64_C, __INTMAX_C, __UINTMAX_C): Document. + * doc/tm.texi (SIG_ATOMIC_TYPE, INT8_TYPE, INT16_TYPE, INT32_TYPE, + INT64_TYPE, UINT8_TYPE, UINT16_TYPE, UINT32_TYPE, UINT64_TYPE, + INT_LEAST8_TYPE, INT_LEAST16_TYPE, INT_LEAST32_TYPE, + INT_LEAST64_TYPE, UINT_LEAST8_TYPE, UINT_LEAST16_TYPE, + UINT_LEAST32_TYPE, UINT_LEAST64_TYPE, INT_FAST8_TYPE, + INT_FAST16_TYPE, INT_FAST32_TYPE, INT_FAST64_TYPE, + UINT_FAST8_TYPE, UINT_FAST16_TYPE, UINT_FAST32_TYPE, + UINT_FAST64_TYPE, INTPTR_TYPE, UINTPTR_TYPE): Document. + 2009-03-31 Bernd Schmidt <bernd.schmidt@analog.com> * loop-iv.c (suitable_set_for_replacement): Renamed from diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 2651ca3..5d0e4a8 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -634,6 +634,9 @@ EXTRA_GCC_OBJS =@extra_gcc_objs@ # List of additional header files to install. EXTRA_HEADERS =@extra_headers_list@ +# How to handle <stdint.h>. +USE_GCC_STDINT = @use_gcc_stdint@ + # The configure script will set this to collect2$(exeext), except on a # (non-Unix) host which can not build collect2, for which it will be # set to empty. @@ -3533,6 +3536,14 @@ stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) $(UNWIND_H) fixinc_list done rm -f include/unwind.h cp $(UNWIND_H) include/unwind.h + rm -f include/stdint.h + if [ $(USE_GCC_STDINT) = wrap ]; then \ + rm -f include/stdint-gcc.h; \ + cp $(srcdir)/ginclude/stdint-gcc.h include/stdint-gcc.h; \ + cp $(srcdir)/ginclude/stdint-wrap.h include/stdint.h; \ + elif [ $(USE_GCC_STDINT) = provide ]; then \ + cp $(srcdir)/ginclude/stdint-gcc.h include/stdint.h; \ + fi set -e; for ml in `cat fixinc_list`; do \ sysroot_headers_suffix=`echo $${ml} | sed -e 's/;.*$$//'`; \ multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \ diff --git a/gcc/c-common.c b/gcc/c-common.c index f0c3122..8b05a40 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -69,11 +69,21 @@ cpp_reader *parse_in; /* Declared in c-pragma.h. */ #define PID_TYPE "int" #endif -#ifndef CHAR16_TYPE +/* If GCC knows the exact uint_least16_t and uint_least32_t types from + <stdint.h>, use them for char16_t and char32_t. Otherwise, use + these guesses; getting the wrong type of a given width will not + affect C++ name mangling because in C++ these are distinct types + not typedefs. */ + +#ifdef UINT_LEAST16_TYPE +#define CHAR16_TYPE UINT_LEAST16_TYPE +#else #define CHAR16_TYPE "short unsigned int" #endif -#ifndef CHAR32_TYPE +#ifdef UINT_LEAST32_TYPE +#define CHAR32_TYPE UINT_LEAST32_TYPE +#else #define CHAR32_TYPE "unsigned int" #endif @@ -109,6 +119,116 @@ cpp_reader *parse_in; /* Declared in c-pragma.h. */ : "long long unsigned int")) #endif +/* There are no default definitions of these <stdint.h> types. */ + +#ifndef SIG_ATOMIC_TYPE +#define SIG_ATOMIC_TYPE ((const char *) NULL) +#endif + +#ifndef INT8_TYPE +#define INT8_TYPE ((const char *) NULL) +#endif + +#ifndef INT16_TYPE +#define INT16_TYPE ((const char *) NULL) +#endif + +#ifndef INT32_TYPE +#define INT32_TYPE ((const char *) NULL) +#endif + +#ifndef INT64_TYPE +#define INT64_TYPE ((const char *) NULL) +#endif + +#ifndef UINT8_TYPE +#define UINT8_TYPE ((const char *) NULL) +#endif + +#ifndef UINT16_TYPE +#define UINT16_TYPE ((const char *) NULL) +#endif + +#ifndef UINT32_TYPE +#define UINT32_TYPE ((const char *) NULL) +#endif + +#ifndef UINT64_TYPE +#define UINT64_TYPE ((const char *) NULL) +#endif + +#ifndef INT_LEAST8_TYPE +#define INT_LEAST8_TYPE ((const char *) NULL) +#endif + +#ifndef INT_LEAST16_TYPE +#define INT_LEAST16_TYPE ((const char *) NULL) +#endif + +#ifndef INT_LEAST32_TYPE +#define INT_LEAST32_TYPE ((const char *) NULL) +#endif + +#ifndef INT_LEAST64_TYPE +#define INT_LEAST64_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_LEAST8_TYPE +#define UINT_LEAST8_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_LEAST16_TYPE +#define UINT_LEAST16_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_LEAST32_TYPE +#define UINT_LEAST32_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_LEAST64_TYPE +#define UINT_LEAST64_TYPE ((const char *) NULL) +#endif + +#ifndef INT_FAST8_TYPE +#define INT_FAST8_TYPE ((const char *) NULL) +#endif + +#ifndef INT_FAST16_TYPE +#define INT_FAST16_TYPE ((const char *) NULL) +#endif + +#ifndef INT_FAST32_TYPE +#define INT_FAST32_TYPE ((const char *) NULL) +#endif + +#ifndef INT_FAST64_TYPE +#define INT_FAST64_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_FAST8_TYPE +#define UINT_FAST8_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_FAST16_TYPE +#define UINT_FAST16_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_FAST32_TYPE +#define UINT_FAST32_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_FAST64_TYPE +#define UINT_FAST64_TYPE ((const char *) NULL) +#endif + +#ifndef INTPTR_TYPE +#define INTPTR_TYPE ((const char *) NULL) +#endif + +#ifndef UINTPTR_TYPE +#define UINTPTR_TYPE ((const char *) NULL) +#endif + /* The following symbols are subsumed in the c_global_trees array, and listed here individually for documentation purposes. @@ -131,8 +251,6 @@ cpp_reader *parse_in; /* Declared in c-pragma.h. */ tree unsigned_char_type_node; tree signed_char_type_node; tree wchar_type_node; - tree signed_wchar_type_node; - tree unsigned_wchar_type_node; tree char16_type_node; tree char32_type_node; @@ -4762,6 +4880,7 @@ c_common_nodes_and_builtins (void) wchar_type_node = get_identifier (MODIFIED_WCHAR_TYPE); wchar_type_node = TREE_TYPE (identifier_global_value (wchar_type_node)); wchar_type_size = TYPE_PRECISION (wchar_type_node); + underlying_wchar_type_node = wchar_type_node; if (c_dialect_cxx ()) { if (TYPE_UNSIGNED (wchar_type_node)) @@ -4770,11 +4889,6 @@ c_common_nodes_and_builtins (void) wchar_type_node = make_signed_type (wchar_type_size); record_builtin_type (RID_WCHAR, "wchar_t", wchar_type_node); } - else - { - signed_wchar_type_node = c_common_signed_type (wchar_type_node); - unsigned_wchar_type_node = c_common_unsigned_type (wchar_type_node); - } /* This is for wide string constants. */ wchar_array_type_node @@ -4820,6 +4934,88 @@ c_common_nodes_and_builtins (void) uintmax_type_node = TREE_TYPE (identifier_global_value (get_identifier (UINTMAX_TYPE))); + if (SIG_ATOMIC_TYPE) + sig_atomic_type_node = + TREE_TYPE (identifier_global_value (get_identifier (SIG_ATOMIC_TYPE))); + if (INT8_TYPE) + int8_type_node = + TREE_TYPE (identifier_global_value (get_identifier (INT8_TYPE))); + if (INT16_TYPE) + int16_type_node = + TREE_TYPE (identifier_global_value (get_identifier (INT16_TYPE))); + if (INT32_TYPE) + int32_type_node = + TREE_TYPE (identifier_global_value (get_identifier (INT32_TYPE))); + if (INT64_TYPE) + int64_type_node = + TREE_TYPE (identifier_global_value (get_identifier (INT64_TYPE))); + if (UINT8_TYPE) + uint8_type_node = + TREE_TYPE (identifier_global_value (get_identifier (UINT8_TYPE))); + if (UINT16_TYPE) + uint16_type_node = + TREE_TYPE (identifier_global_value (get_identifier (UINT16_TYPE))); + if (UINT32_TYPE) + c_uint32_type_node = + TREE_TYPE (identifier_global_value (get_identifier (UINT32_TYPE))); + if (UINT64_TYPE) + c_uint64_type_node = + TREE_TYPE (identifier_global_value (get_identifier (UINT64_TYPE))); + if (INT_LEAST8_TYPE) + int_least8_type_node = + TREE_TYPE (identifier_global_value (get_identifier (INT_LEAST8_TYPE))); + if (INT_LEAST16_TYPE) + int_least16_type_node = + TREE_TYPE (identifier_global_value (get_identifier (INT_LEAST16_TYPE))); + if (INT_LEAST32_TYPE) + int_least32_type_node = + TREE_TYPE (identifier_global_value (get_identifier (INT_LEAST32_TYPE))); + if (INT_LEAST64_TYPE) + int_least64_type_node = + TREE_TYPE (identifier_global_value (get_identifier (INT_LEAST64_TYPE))); + if (UINT_LEAST8_TYPE) + uint_least8_type_node = + TREE_TYPE (identifier_global_value (get_identifier (UINT_LEAST8_TYPE))); + if (UINT_LEAST16_TYPE) + uint_least16_type_node = + TREE_TYPE (identifier_global_value (get_identifier (UINT_LEAST16_TYPE))); + if (UINT_LEAST32_TYPE) + uint_least32_type_node = + TREE_TYPE (identifier_global_value (get_identifier (UINT_LEAST32_TYPE))); + if (UINT_LEAST64_TYPE) + uint_least64_type_node = + TREE_TYPE (identifier_global_value (get_identifier (UINT_LEAST64_TYPE))); + if (INT_FAST8_TYPE) + int_fast8_type_node = + TREE_TYPE (identifier_global_value (get_identifier (INT_FAST8_TYPE))); + if (INT_FAST16_TYPE) + int_fast16_type_node = + TREE_TYPE (identifier_global_value (get_identifier (INT_FAST16_TYPE))); + if (INT_FAST32_TYPE) + int_fast32_type_node = + TREE_TYPE (identifier_global_value (get_identifier (INT_FAST32_TYPE))); + if (INT_FAST64_TYPE) + int_fast64_type_node = + TREE_TYPE (identifier_global_value (get_identifier (INT_FAST64_TYPE))); + if (UINT_FAST8_TYPE) + uint_fast8_type_node = + TREE_TYPE (identifier_global_value (get_identifier (UINT_FAST8_TYPE))); + if (UINT_FAST16_TYPE) + uint_fast16_type_node = + TREE_TYPE (identifier_global_value (get_identifier (UINT_FAST16_TYPE))); + if (UINT_FAST32_TYPE) + uint_fast32_type_node = + TREE_TYPE (identifier_global_value (get_identifier (UINT_FAST32_TYPE))); + if (UINT_FAST64_TYPE) + uint_fast64_type_node = + TREE_TYPE (identifier_global_value (get_identifier (UINT_FAST64_TYPE))); + if (INTPTR_TYPE) + intptr_type_node = + TREE_TYPE (identifier_global_value (get_identifier (INTPTR_TYPE))); + if (UINTPTR_TYPE) + uintptr_type_node = + TREE_TYPE (identifier_global_value (get_identifier (UINTPTR_TYPE))); + default_function_type = build_function_type (integer_type_node, NULL_TREE); ptrdiff_type_node = TREE_TYPE (identifier_global_value (get_identifier (PTRDIFF_TYPE))); @@ -5522,8 +5718,8 @@ boolean_increment (enum tree_code code, tree arg) return val; } -/* Built-in macros for stddef.h, that require macros defined in this - file. */ +/* Built-in macros for stddef.h and stdint.h, that require macros + defined in this file. */ void c_stddef_cpp_builtins(void) { @@ -5535,6 +5731,60 @@ c_stddef_cpp_builtins(void) builtin_define_with_value ("__UINTMAX_TYPE__", UINTMAX_TYPE, 0); builtin_define_with_value ("__CHAR16_TYPE__", CHAR16_TYPE, 0); builtin_define_with_value ("__CHAR32_TYPE__", CHAR32_TYPE, 0); + if (SIG_ATOMIC_TYPE) + builtin_define_with_value ("__SIG_ATOMIC_TYPE__", SIG_ATOMIC_TYPE, 0); + if (INT8_TYPE) + builtin_define_with_value ("__INT8_TYPE__", INT8_TYPE, 0); + if (INT16_TYPE) + builtin_define_with_value ("__INT16_TYPE__", INT16_TYPE, 0); + if (INT32_TYPE) + builtin_define_with_value ("__INT32_TYPE__", INT32_TYPE, 0); + if (INT64_TYPE) + builtin_define_with_value ("__INT64_TYPE__", INT64_TYPE, 0); + if (UINT8_TYPE) + builtin_define_with_value ("__UINT8_TYPE__", UINT8_TYPE, 0); + if (UINT16_TYPE) + builtin_define_with_value ("__UINT16_TYPE__", UINT16_TYPE, 0); + if (UINT32_TYPE) + builtin_define_with_value ("__UINT32_TYPE__", UINT32_TYPE, 0); + if (UINT64_TYPE) + builtin_define_with_value ("__UINT64_TYPE__", UINT64_TYPE, 0); + if (INT_LEAST8_TYPE) + builtin_define_with_value ("__INT_LEAST8_TYPE__", INT_LEAST8_TYPE, 0); + if (INT_LEAST16_TYPE) + builtin_define_with_value ("__INT_LEAST16_TYPE__", INT_LEAST16_TYPE, 0); + if (INT_LEAST32_TYPE) + builtin_define_with_value ("__INT_LEAST32_TYPE__", INT_LEAST32_TYPE, 0); + if (INT_LEAST64_TYPE) + builtin_define_with_value ("__INT_LEAST64_TYPE__", INT_LEAST64_TYPE, 0); + if (UINT_LEAST8_TYPE) + builtin_define_with_value ("__UINT_LEAST8_TYPE__", UINT_LEAST8_TYPE, 0); + if (UINT_LEAST16_TYPE) + builtin_define_with_value ("__UINT_LEAST16_TYPE__", UINT_LEAST16_TYPE, 0); + if (UINT_LEAST32_TYPE) + builtin_define_with_value ("__UINT_LEAST32_TYPE__", UINT_LEAST32_TYPE, 0); + if (UINT_LEAST64_TYPE) + builtin_define_with_value ("__UINT_LEAST64_TYPE__", UINT_LEAST64_TYPE, 0); + if (INT_FAST8_TYPE) + builtin_define_with_value ("__INT_FAST8_TYPE__", INT_FAST8_TYPE, 0); + if (INT_FAST16_TYPE) + builtin_define_with_value ("__INT_FAST16_TYPE__", INT_FAST16_TYPE, 0); + if (INT_FAST32_TYPE) + builtin_define_with_value ("__INT_FAST32_TYPE__", INT_FAST32_TYPE, 0); + if (INT_FAST64_TYPE) + builtin_define_with_value ("__INT_FAST64_TYPE__", INT_FAST64_TYPE, 0); + if (UINT_FAST8_TYPE) + builtin_define_with_value ("__UINT_FAST8_TYPE__", UINT_FAST8_TYPE, 0); + if (UINT_FAST16_TYPE) + builtin_define_with_value ("__UINT_FAST16_TYPE__", UINT_FAST16_TYPE, 0); + if (UINT_FAST32_TYPE) + builtin_define_with_value ("__UINT_FAST32_TYPE__", UINT_FAST32_TYPE, 0); + if (UINT_FAST64_TYPE) + builtin_define_with_value ("__UINT_FAST64_TYPE__", UINT_FAST64_TYPE, 0); + if (INTPTR_TYPE) + builtin_define_with_value ("__INTPTR_TYPE__", INTPTR_TYPE, 0); + if (UINTPTR_TYPE) + builtin_define_with_value ("__UINTPTR_TYPE__", UINTPTR_TYPE, 0); } static void diff --git a/gcc/c-common.h b/gcc/c-common.h index 642769d..26423a8 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -153,8 +153,7 @@ enum c_tree_index CTI_CHAR16_TYPE, CTI_CHAR32_TYPE, CTI_WCHAR_TYPE, - CTI_SIGNED_WCHAR_TYPE, - CTI_UNSIGNED_WCHAR_TYPE, + CTI_UNDERLYING_WCHAR_TYPE, CTI_WINT_TYPE, CTI_SIGNED_SIZE_TYPE, /* For format checking only. */ CTI_UNSIGNED_PTRDIFF_TYPE, /* For format checking only. */ @@ -163,6 +162,36 @@ enum c_tree_index CTI_WIDEST_INT_LIT_TYPE, CTI_WIDEST_UINT_LIT_TYPE, + /* Types for <stdint.h>, that may not be defined on all + targets. */ + CTI_SIG_ATOMIC_TYPE, + CTI_INT8_TYPE, + CTI_INT16_TYPE, + CTI_INT32_TYPE, + CTI_INT64_TYPE, + CTI_UINT8_TYPE, + CTI_UINT16_TYPE, + CTI_UINT32_TYPE, + CTI_UINT64_TYPE, + CTI_INT_LEAST8_TYPE, + CTI_INT_LEAST16_TYPE, + CTI_INT_LEAST32_TYPE, + CTI_INT_LEAST64_TYPE, + CTI_UINT_LEAST8_TYPE, + CTI_UINT_LEAST16_TYPE, + CTI_UINT_LEAST32_TYPE, + CTI_UINT_LEAST64_TYPE, + CTI_INT_FAST8_TYPE, + CTI_INT_FAST16_TYPE, + CTI_INT_FAST32_TYPE, + CTI_INT_FAST64_TYPE, + CTI_UINT_FAST8_TYPE, + CTI_UINT_FAST16_TYPE, + CTI_UINT_FAST32_TYPE, + CTI_UINT_FAST64_TYPE, + CTI_INTPTR_TYPE, + CTI_UINTPTR_TYPE, + CTI_CHAR_ARRAY_TYPE, CTI_CHAR16_ARRAY_TYPE, CTI_CHAR32_ARRAY_TYPE, @@ -239,8 +268,7 @@ extern const unsigned int num_c_common_reswords; #define char16_type_node c_global_trees[CTI_CHAR16_TYPE] #define char32_type_node c_global_trees[CTI_CHAR32_TYPE] #define wchar_type_node c_global_trees[CTI_WCHAR_TYPE] -#define signed_wchar_type_node c_global_trees[CTI_SIGNED_WCHAR_TYPE] -#define unsigned_wchar_type_node c_global_trees[CTI_UNSIGNED_WCHAR_TYPE] +#define underlying_wchar_type_node c_global_trees[CTI_UNDERLYING_WCHAR_TYPE] #define wint_type_node c_global_trees[CTI_WINT_TYPE] #define signed_size_type_node c_global_trees[CTI_SIGNED_SIZE_TYPE] #define unsigned_ptrdiff_type_node c_global_trees[CTI_UNSIGNED_PTRDIFF_TYPE] @@ -249,6 +277,34 @@ extern const unsigned int num_c_common_reswords; #define widest_integer_literal_type_node c_global_trees[CTI_WIDEST_INT_LIT_TYPE] #define widest_unsigned_literal_type_node c_global_trees[CTI_WIDEST_UINT_LIT_TYPE] +#define sig_atomic_type_node c_global_trees[CTI_SIG_ATOMIC_TYPE] +#define int8_type_node c_global_trees[CTI_INT8_TYPE] +#define int16_type_node c_global_trees[CTI_INT16_TYPE] +#define int32_type_node c_global_trees[CTI_INT32_TYPE] +#define int64_type_node c_global_trees[CTI_INT64_TYPE] +#define uint8_type_node c_global_trees[CTI_UINT8_TYPE] +#define uint16_type_node c_global_trees[CTI_UINT16_TYPE] +#define c_uint32_type_node c_global_trees[CTI_UINT32_TYPE] +#define c_uint64_type_node c_global_trees[CTI_UINT64_TYPE] +#define int_least8_type_node c_global_trees[CTI_INT_LEAST8_TYPE] +#define int_least16_type_node c_global_trees[CTI_INT_LEAST16_TYPE] +#define int_least32_type_node c_global_trees[CTI_INT_LEAST32_TYPE] +#define int_least64_type_node c_global_trees[CTI_INT_LEAST64_TYPE] +#define uint_least8_type_node c_global_trees[CTI_UINT_LEAST8_TYPE] +#define uint_least16_type_node c_global_trees[CTI_UINT_LEAST16_TYPE] +#define uint_least32_type_node c_global_trees[CTI_UINT_LEAST32_TYPE] +#define uint_least64_type_node c_global_trees[CTI_UINT_LEAST64_TYPE] +#define int_fast8_type_node c_global_trees[CTI_INT_FAST8_TYPE] +#define int_fast16_type_node c_global_trees[CTI_INT_FAST16_TYPE] +#define int_fast32_type_node c_global_trees[CTI_INT_FAST32_TYPE] +#define int_fast64_type_node c_global_trees[CTI_INT_FAST64_TYPE] +#define uint_fast8_type_node c_global_trees[CTI_UINT_FAST8_TYPE] +#define uint_fast16_type_node c_global_trees[CTI_UINT_FAST16_TYPE] +#define uint_fast32_type_node c_global_trees[CTI_UINT_FAST32_TYPE] +#define uint_fast64_type_node c_global_trees[CTI_UINT_FAST64_TYPE] +#define intptr_type_node c_global_trees[CTI_INTPTR_TYPE] +#define uintptr_type_node c_global_trees[CTI_UINTPTR_TYPE] + #define truthvalue_type_node c_global_trees[CTI_TRUTHVALUE_TYPE] #define truthvalue_true_node c_global_trees[CTI_TRUTHVALUE_TRUE] #define truthvalue_false_node c_global_trees[CTI_TRUTHVALUE_FALSE] @@ -818,6 +874,21 @@ extern void finish_file (void); || (TREE_CODE (EXPR) == C_MAYBE_CONST_EXPR \ && C_MAYBE_CONST_EXPR_INT_OPERANDS (EXPR)))) +/* C_MAYBE_CONST_EXPR accessors. */ +#define C_MAYBE_CONST_EXPR_PRE(NODE) \ + TREE_OPERAND (C_MAYBE_CONST_EXPR_CHECK (NODE), 0) +#define C_MAYBE_CONST_EXPR_EXPR(NODE) \ + TREE_OPERAND (C_MAYBE_CONST_EXPR_CHECK (NODE), 1) +#define C_MAYBE_CONST_EXPR_INT_OPERANDS(NODE) \ + TREE_LANG_FLAG_0 (C_MAYBE_CONST_EXPR_CHECK (NODE)) +#define C_MAYBE_CONST_EXPR_NON_CONST(NODE) \ + TREE_LANG_FLAG_1 (C_MAYBE_CONST_EXPR_CHECK (NODE)) +#define EXPR_INT_CONST_OPERANDS(EXPR) \ + (INTEGRAL_TYPE_P (TREE_TYPE (EXPR)) \ + && (TREE_CODE (EXPR) == INTEGER_CST \ + || (TREE_CODE (EXPR) == C_MAYBE_CONST_EXPR \ + && C_MAYBE_CONST_EXPR_INT_OPERANDS (EXPR)))) + /* In a FIELD_DECL, nonzero if the decl was originally a bitfield. */ #define DECL_C_BIT_FIELD(NODE) \ (DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) == 1) diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c index 5d6033d..8b776b1 100644 --- a/gcc/c-cppbuiltin.c +++ b/gcc/c-cppbuiltin.c @@ -55,7 +55,9 @@ static void builtin_define_with_hex_fp_value (const char *, tree, const char *, const char *); static void builtin_define_stdint_macros (void); -static void builtin_define_type_max (const char *, tree, int); +static void builtin_define_constants (const char *, tree); +static void builtin_define_type_max (const char *, tree); +static void builtin_define_type_minmax (const char *, const char *, tree); static void builtin_define_type_precision (const char *, tree); static void builtin_define_type_sizeof (const char *, tree); static void builtin_define_float_constants (const char *, @@ -394,21 +396,93 @@ define__GNUC__ (void) cpp_define_formatted (parse_in, "__GNUG__=%d", major); } -/* Define macros used by <stdint.h>. Currently only defines limits - for intmax_t, used by the testsuite. */ +/* Define macros used by <stdint.h>. */ static void builtin_define_stdint_macros (void) { - int intmax_long; - if (intmax_type_node == long_long_integer_type_node) - intmax_long = 2; - else if (intmax_type_node == long_integer_type_node) - intmax_long = 1; - else if (intmax_type_node == integer_type_node) - intmax_long = 0; - else - gcc_unreachable (); - builtin_define_type_max ("__INTMAX_MAX__", intmax_type_node, intmax_long); + builtin_define_type_max ("__INTMAX_MAX__", intmax_type_node); + builtin_define_constants ("__INTMAX_C", intmax_type_node); + builtin_define_type_max ("__UINTMAX_MAX__", uintmax_type_node); + builtin_define_constants ("__UINTMAX_C", uintmax_type_node); + if (sig_atomic_type_node) + builtin_define_type_minmax ("__SIG_ATOMIC_MIN__", "__SIG_ATOMIC_MAX__", + sig_atomic_type_node); + if (int8_type_node) + builtin_define_type_max ("__INT8_MAX__", int8_type_node); + if (int16_type_node) + builtin_define_type_max ("__INT16_MAX__", int16_type_node); + if (int32_type_node) + builtin_define_type_max ("__INT32_MAX__", int32_type_node); + if (int64_type_node) + builtin_define_type_max ("__INT64_MAX__", int64_type_node); + if (uint8_type_node) + builtin_define_type_max ("__UINT8_MAX__", uint8_type_node); + if (uint16_type_node) + builtin_define_type_max ("__UINT16_MAX__", uint16_type_node); + if (c_uint32_type_node) + builtin_define_type_max ("__UINT32_MAX__", c_uint32_type_node); + if (c_uint64_type_node) + builtin_define_type_max ("__UINT64_MAX__", c_uint64_type_node); + if (int_least8_type_node) + { + builtin_define_type_max ("__INT_LEAST8_MAX__", int_least8_type_node); + builtin_define_constants ("__INT8_C", int_least8_type_node); + } + if (int_least16_type_node) + { + builtin_define_type_max ("__INT_LEAST16_MAX__", int_least16_type_node); + builtin_define_constants ("__INT16_C", int_least16_type_node); + } + if (int_least32_type_node) + { + builtin_define_type_max ("__INT_LEAST32_MAX__", int_least32_type_node); + builtin_define_constants ("__INT32_C", int_least32_type_node); + } + if (int_least64_type_node) + { + builtin_define_type_max ("__INT_LEAST64_MAX__", int_least64_type_node); + builtin_define_constants ("__INT64_C", int_least64_type_node); + } + if (uint_least8_type_node) + { + builtin_define_type_max ("__UINT_LEAST8_MAX__", uint_least8_type_node); + builtin_define_constants ("__UINT8_C", uint_least8_type_node); + } + if (uint_least16_type_node) + { + builtin_define_type_max ("__UINT_LEAST16_MAX__", uint_least16_type_node); + builtin_define_constants ("__UINT16_C", uint_least16_type_node); + } + if (uint_least32_type_node) + { + builtin_define_type_max ("__UINT_LEAST32_MAX__", uint_least32_type_node); + builtin_define_constants ("__UINT32_C", uint_least32_type_node); + } + if (uint_least64_type_node) + { + builtin_define_type_max ("__UINT_LEAST64_MAX__", uint_least64_type_node); + builtin_define_constants ("__UINT64_C", uint_least64_type_node); + } + if (int_fast8_type_node) + builtin_define_type_max ("__INT_FAST8_MAX__", int_fast8_type_node); + if (int_fast16_type_node) + builtin_define_type_max ("__INT_FAST16_MAX__", int_fast16_type_node); + if (int_fast32_type_node) + builtin_define_type_max ("__INT_FAST32_MAX__", int_fast32_type_node); + if (int_fast64_type_node) + builtin_define_type_max ("__INT_FAST64_MAX__", int_fast64_type_node); + if (uint_fast8_type_node) + builtin_define_type_max ("__UINT_FAST8_MAX__", uint_fast8_type_node); + if (uint_fast16_type_node) + builtin_define_type_max ("__UINT_FAST16_MAX__", uint_fast16_type_node); + if (uint_fast32_type_node) + builtin_define_type_max ("__UINT_FAST32_MAX__", uint_fast32_type_node); + if (uint_fast64_type_node) + builtin_define_type_max ("__UINT_FAST64_MAX__", uint_fast64_type_node); + if (intptr_type_node) + builtin_define_type_max ("__INTPTR_MAX__", intptr_type_node); + if (uintptr_type_node) + builtin_define_type_max ("__UINTPTR_MAX__", uintptr_type_node); } /* Adjust the optimization macros when a #pragma GCC optimization is done to @@ -518,17 +592,21 @@ c_cpp_builtins (cpp_reader *pfile) if (USING_SJLJ_EXCEPTIONS) cpp_define (pfile, "__USING_SJLJ_EXCEPTIONS__"); - /* 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); - builtin_define_type_max ("__WCHAR_MAX__", wchar_type_node, 0); + /* limits.h and stdint.h need to know these. */ + builtin_define_type_max ("__SCHAR_MAX__", signed_char_type_node); + builtin_define_type_max ("__SHRT_MAX__", short_integer_type_node); + builtin_define_type_max ("__INT_MAX__", integer_type_node); + builtin_define_type_max ("__LONG_MAX__", long_integer_type_node); + builtin_define_type_max ("__LONG_LONG_MAX__", long_long_integer_type_node); + builtin_define_type_minmax ("__WCHAR_MIN__", "__WCHAR_MAX__", + underlying_wchar_type_node); + builtin_define_type_minmax ("__WINT_MIN__", "__WINT_MAX__", wint_type_node); + builtin_define_type_max ("__PTRDIFF_MAX__", ptrdiff_type_node); + builtin_define_type_max ("__SIZE_MAX__", size_type_node); builtin_define_type_precision ("__CHAR_BIT__", char_type_node); - /* stdint.h (eventually) and the testsuite need to know these. */ + /* stdint.h and the testsuite need to know these. */ builtin_define_stdint_macros (); /* float.h needs to know these. */ @@ -891,12 +969,80 @@ builtin_define_with_hex_fp_value (const char *macro, cpp_define (parse_in, buf1); } -/* Define MAX for TYPE based on the precision of the type. IS_LONG is - 1 for type "long" and 2 for "long long". We have to handle - unsigned types, since wchar_t might be unsigned. */ +/* Return a string constant for the suffix for a value of type TYPE + promoted according to the integer promotions. The type must be one + of the standard integer type nodes. */ + +static const char * +type_suffix (tree type) +{ + static const char *const suffixes[] = { "", "U", "L", "UL", "LL", "ULL" }; + int unsigned_suffix; + int is_long; + + if (type == long_long_integer_type_node + || type == long_long_unsigned_type_node) + is_long = 2; + else if (type == long_integer_type_node + || type == long_unsigned_type_node) + is_long = 1; + else if (type == integer_type_node + || type == unsigned_type_node + || type == short_integer_type_node + || type == short_unsigned_type_node + || type == signed_char_type_node + || type == unsigned_char_type_node + /* ??? "char" is not a signed or unsigned integer type and + so is not permitted for the standard typedefs, but some + systems use it anyway. */ + || type == char_type_node) + is_long = 0; + else + gcc_unreachable (); + + unsigned_suffix = TYPE_UNSIGNED (type); + if (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)) + unsigned_suffix = 0; + return suffixes[is_long * 2 + unsigned_suffix]; +} + +/* Define MACRO as a <stdint.h> constant-suffix macro for TYPE. */ +static void +builtin_define_constants (const char *macro, tree type) +{ + const char *suffix; + char *buf; + + suffix = type_suffix (type); + + if (suffix[0] == 0) + { + buf = (char *) alloca (strlen (macro) + 6); + sprintf (buf, "%s(c)=c", macro); + } + else + { + buf = (char *) alloca (strlen (macro) + 9 + strlen (suffix) + 1); + sprintf (buf, "%s(c)=c ## %s", macro, suffix); + } + + cpp_define (parse_in, buf); +} + +/* Define MAX for TYPE based on the precision of the type. */ + +static void +builtin_define_type_max (const char *macro, tree type) +{ + builtin_define_type_minmax (NULL, macro, type); +} + +/* Define MIN_MACRO (if not NULL) and MAX_MACRO for TYPE based on the + precision of the type. */ static void -builtin_define_type_max (const char *macro, tree type, int is_long) +builtin_define_type_minmax (const char *min_macro, const char *max_macro, + tree type) { static const char *const values[] = { "127", "255", @@ -905,7 +1051,6 @@ builtin_define_type_max (const char *macro, tree type, int is_long) "9223372036854775807", "18446744073709551615", "170141183460469231731687303715884105727", "340282366920938463463374607431768211455" }; - static const char *const suffixes[] = { "", "U", "L", "UL", "LL", "ULL" }; const char *value, *suffix; char *buf; @@ -925,11 +1070,27 @@ builtin_define_type_max (const char *macro, tree type, int is_long) } value = values[idx + TYPE_UNSIGNED (type)]; - suffix = suffixes[is_long * 2 + TYPE_UNSIGNED (type)]; + suffix = type_suffix (type); - buf = (char *) alloca (strlen (macro) + 1 + strlen (value) + buf = (char *) alloca (strlen (max_macro) + 1 + strlen (value) + strlen (suffix) + 1); - sprintf (buf, "%s=%s%s", macro, value, suffix); + sprintf (buf, "%s=%s%s", max_macro, value, suffix); cpp_define (parse_in, buf); + + if (min_macro) + { + if (TYPE_UNSIGNED (type)) + { + buf = (char *) alloca (strlen (min_macro) + 2 + strlen (suffix) + 1); + sprintf (buf, "%s=0%s", min_macro, suffix); + } + else + { + buf = (char *) alloca (strlen (min_macro) + 3 + + strlen (max_macro) + 6); + sprintf (buf, "%s=(-%s - 1)", min_macro, max_macro); + } + cpp_define (parse_in, buf); + } } diff --git a/gcc/config.gcc b/gcc/config.gcc index f8afe7d..5617065 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -104,6 +104,12 @@ # use_gcc_tgmath If set, add tgmath.h to the list of used header # files. # +# use_gcc_stdint If "wrap", install a version of stdint.h that +# wraps the system's copy for hosted compilations; +# if "provide", provide a version of systems without +# such a system header; otherwise "none", do not +# provide such a header at all. +# # extra_passes List of extra executables compiled for this target # machine, used for compiling from source to object. # @@ -166,6 +172,7 @@ out_file= tmake_file= extra_headers= use_gcc_tgmath=yes +use_gcc_stdint=none extra_passes= extra_parts= extra_programs= @@ -494,6 +501,7 @@ case ${target} in # Assume that glibc or uClibc are being used and so __cxa_atexit is provided. default_use_cxa_atexit=yes use_gcc_tgmath=no + use_gcc_stdint=wrap ;; *-*-netbsd*) tmake_file="t-slibgcc-elf-ver t-libc-ok t-netbsd t-libgcc-pic" @@ -551,6 +559,10 @@ case ${target} in case ${enable_threads} in yes) thread_file='rtems' ;; esac + use_gcc_stdint=wrap + ;; +*-*-uclinux*) + use_gcc_stdint=wrap ;; *-*-vxworks*) tmake_file=t-vxworks @@ -566,6 +578,7 @@ case ${target} in *-*-elf) # Assume that newlib is being used and so __cxa_atexit is provided. default_use_cxa_atexit=yes + use_gcc_stdint=wrap ;; esac @@ -582,12 +595,12 @@ case ${target} in fi ;; alpha*-*-linux*) - tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h" + tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h glibc-stdint.h" target_cpu_default="MASK_GAS" tmake_file="${tmake_file} alpha/t-crtfm alpha/t-alpha alpha/t-ieee alpha/t-linux" ;; alpha*-*-gnu*) - tm_file="$tm_file alpha/elf.h alpha/linux.h alpha/linux-elf.h gnu.h alpha/gnu.h" + tm_file="$tm_file alpha/elf.h alpha/linux.h alpha/linux-elf.h gnu.h glibc-stdint.h alpha/gnu.h" target_cpu_default="MASK_GAS" tmake_file="${tmake_file} alpha/t-crtfm alpha/t-alpha alpha/t-ieee" ;; @@ -657,7 +670,7 @@ alpha*-dec-*vms*) local_prefix=/gnu ;; arc-*-elf*) - tm_file="dbxelf.h elfos.h svr4.h ${tm_file}" + tm_file="dbxelf.h elfos.h svr4.h newlib-stdint.h ${tm_file}" extra_parts="crtinit.o crtfini.o" ;; arm-wrs-vxworks) @@ -679,7 +692,7 @@ arm*-*-netbsd*) use_collect2=yes ;; arm*-*-linux*) # ARM GNU/Linux with ELF - tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" + tm_file="dbxelf.h elfos.h linux.h glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" case $target in arm*b-*) tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" @@ -705,7 +718,7 @@ arm*-*-linux*) # ARM GNU/Linux with ELF tmake_file="${tmake_file} arm/t-arm-softfp soft-fp/t-softfp" ;; arm*-*-uclinux*) # ARM ucLinux - tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/linux-gas.h arm/uclinux-elf.h" + tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/linux-gas.h arm/uclinux-elf.h glibc-stdint.h" tmake_file="arm/t-arm arm/t-arm-elf" case ${target} in arm*-*-uclinux*eabi) @@ -722,7 +735,7 @@ arm*-*-uclinux*) # ARM ucLinux tmake_file="${tmake_file} arm/t-arm-softfp soft-fp/t-softfp" ;; arm*-*-ecos-elf) - tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/ecos-elf.h" + tm_file="dbxelf.h elfos.h newlib-stdint.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/ecos-elf.h" tmake_file="arm/t-arm arm/t-arm-elf" tmake_file="${tmake_file} arm/t-arm-softfp soft-fp/t-softfp" ;; @@ -736,9 +749,10 @@ arm*-*-eabi* | arm*-*-symbianelf* ) tmake_file="arm/t-arm arm/t-arm-elf" case ${target} in arm*-*-eabi*) - tm_file="$tm_file arm/eabi.h" + tm_file="$tm_file arm/eabi.h newlib-stdint.h" tmake_file="${tmake_file} arm/t-bpabi" extra_options="${extra_options} arm/eabi.opt" + use_gcc_stdint=wrap ;; arm*-*-symbianelf*) tm_file="${tm_file} arm/symbian.h" @@ -751,12 +765,12 @@ arm*-*-eabi* | arm*-*-symbianelf* ) tmake_file="${tmake_file} arm/t-arm-softfp soft-fp/t-softfp" ;; arm*-*-rtems*) - tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/rtems-elf.h rtems.h" + tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/rtems-elf.h rtems.h newlib-stdint.h" tmake_file="arm/t-arm arm/t-arm-elf t-rtems arm/t-rtems" tmake_file="${tmake_file} arm/t-arm-softfp soft-fp/t-softfp" ;; arm*-*-elf) - tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h" + tm_file="dbxelf.h elfos.h newlib-stdint.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h" tmake_file="arm/t-arm arm/t-arm-elf" tmake_file="${tmake_file} arm/t-arm-softfp soft-fp/t-softfp" ;; @@ -767,32 +781,34 @@ arm*-wince-pe*) extra_objs="pe.o" ;; arm-*-pe*) - tm_file="arm/semi.h arm/aout.h arm/arm.h arm/coff.h dbxcoff.h arm/pe.h" + tm_file="arm/semi.h arm/aout.h arm/arm.h arm/coff.h dbxcoff.h arm/pe.h newlib-stdint.h" tmake_file="arm/t-arm arm/t-pe" + use_gcc_stdint=wrap extra_options="${extra_options} arm/pe.opt" extra_objs="pe.o" ;; avr-*-rtems*) - tm_file="avr/avr.h dbxelf.h avr/rtems.h rtems.h" + tm_file="avr/avr.h dbxelf.h avr/rtems.h rtems.h newlib-stdint.h" tmake_file="avr/t-avr t-rtems avr/t-rtems" ;; avr-*-*) - tm_file="avr/avr.h dbxelf.h" + tm_file="avr/avr.h dbxelf.h newlib-stdint.h" + use_gcc_stdint=wrap ;; bfin*-elf*) - tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h" + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h bfin/elf.h" tmake_file=bfin/t-bfin-elf use_collect2=no ;; bfin*-uclinux*) - tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h linux.h bfin/uclinux.h" + tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h linux.h glibc-stdint.h bfin/uclinux.h" tmake_file=bfin/t-bfin-uclinux tm_defines="${tm_defines} UCLIBC_DEFAULT=1" extra_options="${extra_options} linux.opt" use_collect2=no ;; bfin*-linux-uclibc*) - tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h linux.h bfin/linux.h ./linux-sysroot-suffix.h" + tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h linux.h glibc-stdint.h bfin/linux.h ./linux-sysroot-suffix.h" tmake_file="t-slibgcc-elf-ver bfin/t-bfin-linux" extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" use_collect2=no @@ -802,25 +818,28 @@ bfin*-rtems*) tmake_file="bfin/t-bfin t-rtems bfin/t-rtems" ;; bfin*-*) - tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h" + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h bfin/elf.h" tmake_file=bfin/t-bfin use_collect2=no + use_gcc_stdint=wrap ;; crisv32-*-elf | crisv32-*-none) - tm_file="dbxelf.h elfos.h ${tm_file}" + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" tmake_file="cris/t-cris" target_cpu_default=32 gas=yes extra_options="${extra_options} cris/elf.opt" + use_gcc_stdint=wrap ;; cris-*-elf | cris-*-none) - tm_file="dbxelf.h elfos.h ${tm_file}" + tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" tmake_file="cris/t-cris cris/t-elfmulti" gas=yes extra_options="${extra_options} cris/elf.opt" + use_gcc_stdint=wrap ;; crisv32-*-linux* | cris-*-linux*) - tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h" + tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h glibc-stdint.h cris/linux.h" # We need to avoid using t-linux, so override default tmake_file tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux" extra_options="${extra_options} cris/linux.opt" @@ -834,43 +853,44 @@ crisv32-*-linux* | cris-*-linux*) esac ;; crx-*-elf) - tm_file="elfos.h ${tm_file}" + tm_file="elfos.h newlib-stdint.h ${tm_file}" extra_parts="crtbegin.o crtend.o" use_collect2=no ;; fr30-*-elf) - tm_file="dbxelf.h elfos.h svr4.h ${tm_file}" + tm_file="dbxelf.h elfos.h svr4.h newlib-stdint.h ${tm_file}" tmake_file=fr30/t-fr30 extra_parts="crti.o crtn.o crtbegin.o crtend.o" ;; frv-*-elf) - tm_file="dbxelf.h elfos.h svr4.h ${tm_file} frv/frv-abi.h" + tm_file="dbxelf.h elfos.h svr4.h newlib-stdint.h ${tm_file} frv/frv-abi.h" tmake_file=frv/t-frv ;; frv-*-*linux*) tm_file="dbxelf.h elfos.h svr4.h ${tm_file} \ - linux.h frv/linux.h frv/frv-abi.h" + linux.h glibc-stdint.h frv/linux.h frv/frv-abi.h" tmake_file="${tmake_file} frv/t-frv frv/t-linux" ;; h8300-*-rtems*) tmake_file="h8300/t-h8300 h8300/t-elf t-rtems h8300/t-rtems" - tm_file="h8300/h8300.h dbxelf.h elfos.h h8300/elf.h h8300/rtems.h rtems.h" + tm_file="h8300/h8300.h dbxelf.h elfos.h h8300/elf.h h8300/rtems.h rtems.h newlib-stdint.h" ;; h8300-*-elf*) tmake_file="h8300/t-h8300 h8300/t-elf" - tm_file="h8300/h8300.h dbxelf.h elfos.h h8300/elf.h" + tm_file="h8300/h8300.h dbxelf.h elfos.h newlib-stdint.h h8300/elf.h" ;; hppa*64*-*-linux*) target_cpu_default="MASK_PA_11|MASK_PA_20" tm_file="pa/pa64-start.h ${tm_file} dbxelf.h elfos.h svr4.h linux.h \ - pa/pa-linux.h pa/pa64-regs.h pa/pa-64.h pa/pa64-linux.h" + glibc-stdint.h pa/pa-linux.h pa/pa64-regs.h pa/pa-64.h \ + pa/pa64-linux.h" tmake_file="${tmake_file} pa/t-linux64" gas=yes gnu_ld=yes need_64bit_hwint=yes ;; hppa*-*-linux*) target_cpu_default="MASK_PA_11|MASK_NO_SPACE_REGS" - tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h pa/pa-linux.h \ + tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h pa/pa-linux.h \ pa/pa32-regs.h pa/pa32-linux.h" tmake_file="${tmake_file} pa/t-linux" # Set the libgcc version number @@ -1002,11 +1022,11 @@ x86_64-*-darwin*) tm_file="${tm_file} ${cpu_type}/darwin64.h" ;; i[34567]86-*-elf*) - tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h" + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h" tmake_file="${tmake_file} i386/t-i386elf t-svr4" ;; x86_64-*-elf*) - tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h i386/x86-64.h" + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h" tmake_file="${tmake_file} i386/t-i386elf t-svr4" ;; i[34567]86-*-freebsd*) @@ -1045,7 +1065,7 @@ i[34567]86-*-openbsd*) i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu) # Intel 80386's running GNU/* # with ELF format using glibc 2 - tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h" + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h" case ${target} in i[34567]86-*-linux*) if test x$enable_targets = xall; then @@ -1079,7 +1099,7 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i tmake_file="${tmake_file} i386/t-crtstuff i386/t-crtpc i386/t-crtfm t-dfprules" ;; x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu) - tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h \ + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h \ i386/x86-64.h i386/linux64.h" case ${target} in x86_64-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h" ;; @@ -1131,7 +1151,7 @@ i[34567]86-*-nto-qnx*) gas=yes ;; i[34567]86-*-rtems*) - tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h i386/rtemself.h rtems.h" + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h i386/rtemself.h rtems.h newlib-stdint.h" extra_parts="crtbegin.o crtend.o crti.o crtn.o" tmake_file="${tmake_file} i386/t-rtems-i386 i386/t-crtstuff t-rtems" ;; @@ -1167,6 +1187,7 @@ i[34567]86-*-solaris2*) # depends on a runtime test and is thus performed in # libgcc/configure.ac instead. need_64bit_hwint=yes + use_gcc_stdint=wrap case X"${with_cpu}" in Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx) ;; @@ -1182,6 +1203,9 @@ i[34567]86-*-solaris2*) ;; esac ;; + *) + use_gcc_stdint=provide + ;; esac case ${enable_threads}:${have_pthread_h}:${have_thread_h} in "":yes:* | yes:yes:* ) @@ -1275,7 +1299,7 @@ i[34567]86-*-interix3*) fi ;; ia64*-*-elf*) - tm_file="${tm_file} dbxelf.h elfos.h ia64/sysv4.h ia64/elf.h" + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h ia64/sysv4.h ia64/elf.h" tmake_file="ia64/t-ia64" target_cpu_default="0" if test x$gas = xyes @@ -1295,7 +1319,7 @@ ia64*-*-freebsd*) extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o" ;; ia64*-*-linux*) - tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h ia64/sysv4.h ia64/linux.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h ia64/sysv4.h ia64/linux.h" tmake_file="${tmake_file} ia64/t-ia64 t-libunwind ia64/t-glibc" if test x$with_system_libunwind != xyes ; then tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind" @@ -1318,26 +1342,26 @@ ia64*-*-hpux*) extra_options="${extra_options} ia64/ilp32.opt" ;; iq2000*-*-elf*) - tm_file="svr4.h elfos.h iq2000/iq2000.h" + tm_file="svr4.h elfos.h newlib-stdint.h iq2000/iq2000.h" tmake_file=iq2000/t-iq2000 out_file=iq2000/iq2000.c md_file=iq2000/iq2000.md ;; m32r-*-elf*) - tm_file="dbxelf.h elfos.h svr4.h ${tm_file}" + tm_file="dbxelf.h elfos.h svr4.h newlib-stdint.h ${tm_file}" extra_parts="crtinit.o crtfini.o" ;; m32rle-*-elf*) - tm_file="dbxelf.h elfos.h svr4.h m32r/little.h ${tm_file}" + tm_file="dbxelf.h elfos.h svr4.h newlib-stdint.h m32r/little.h ${tm_file}" extra_parts="crtinit.o crtfini.o m32rx/crtinit.o m32rx/crtfini.o" ;; m32r-*-rtems*) - tm_file="dbxelf.h elfos.h svr4.h ${tm_file} m32r/rtems.h rtems.h" + tm_file="dbxelf.h elfos.h svr4.h ${tm_file} m32r/rtems.h rtems.h newlib-stdint.h" tmake_file="m32r/t-m32r t-rtems" extra_parts="crtinit.o crtfini.o" ;; m32r-*-linux*) - tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} m32r/linux.h" + tm_file="dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h ${tm_file} m32r/linux.h" # We override the tmake_file for linux -- why? tmake_file="t-slibgcc-elf-ver m32r/t-linux" gnu_ld=yes @@ -1346,7 +1370,7 @@ m32r-*-linux*) fi ;; m32rle-*-linux*) - tm_file="dbxelf.h elfos.h svr4.h linux.h m32r/little.h ${tm_file} m32r/linux.h" + tm_file="dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h m32r/little.h ${tm_file} m32r/linux.h" # We override the tmake_file for linux -- why? tmake_file="t-slibgcc-elf-ver m32r/t-linux" gnu_ld=yes @@ -1356,19 +1380,21 @@ m32rle-*-linux*) ;; # m68hc11 and m68hc12 share the same machine description. m68hc11-*-*|m6811-*-*) - tm_file="dbxelf.h elfos.h usegas.h m68hc11/m68hc11.h" + tm_file="dbxelf.h elfos.h usegas.h newlib-stdint.h m68hc11/m68hc11.h" tm_p_file="m68hc11/m68hc11-protos.h" md_file="m68hc11/m68hc11.md" out_file="m68hc11/m68hc11.c" tmake_file="m68hc11/t-m68hc11" + use_gcc_stdint=wrap ;; m68hc12-*-*|m6812-*-*) - tm_file="m68hc11/m68hc12.h dbxelf.h elfos.h usegas.h m68hc11/m68hc11.h" + tm_file="m68hc11/m68hc12.h dbxelf.h elfos.h usegas.h newlib-stdint.h m68hc11/m68hc11.h" tm_p_file="m68hc11/m68hc11-protos.h" md_file="m68hc11/m68hc11.md" out_file="m68hc11/m68hc11.c" tmake_file="m68hc11/t-m68hc11" extra_options="${extra_options} m68hc11/m68hc11.opt" + use_gcc_stdint=wrap ;; m68k-*-elf* | fido-*-elf*) case ${target} in @@ -1389,7 +1415,7 @@ m68k-*-elf* | fido-*-elf*) default_cf_cpu=5206 ;; esac - tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/m68kemb.h m68k/m68020-elf.h" + tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h newlib-stdint.h m68k/m68kemb.h m68k/m68020-elf.h" tm_defines="${tm_defines} MOTOROLA=1" tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-m68kelf" # Add multilibs for targets other than fido. @@ -1423,7 +1449,7 @@ m68k-*-uclinuxoldabi*) # Motorola m68k/ColdFire running uClinux # m68k-elf-based ABI default_m68k_cpu=68020 default_cf_cpu=5206 - tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/uclinux-oldabi.h" + tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/uclinux-oldabi.h glibc-stdint.h" tm_defines="${tm_defines} MOTOROLA=1" tmake_file="m68k/t-floatlib m68k/t-uclinux" ;; @@ -1432,7 +1458,7 @@ m68k-*-uclinux*) # Motorola m68k/ColdFire running uClinux # ABI. default_m68k_cpu=68020 default_cf_cpu=5206 - tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h flat.h m68k/linux.h m68k/uclinux.h ./sysroot-suffix.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h flat.h m68k/linux.h m68k/uclinux.h ./sysroot-suffix.h" tm_defines="${tm_defines} MOTOROLA=1 UCLIBC_DEFAULT=1" extra_options="${extra_options} linux.opt" tmake_file="m68k/t-floatlib m68k/t-uclinux m68k/t-mlibs" @@ -1443,7 +1469,7 @@ m68k-*-linux*) # Motorola m68k's running GNU/Linux default_m68k_cpu=68020 default_cf_cpu=5475 with_arch=${with_arch:-m68k} - tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h m68k/linux.h ./sysroot-suffix.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h m68k/linux.h ./sysroot-suffix.h" extra_options="${extra_options} m68k/ieee.opt" tm_defines="${tm_defines} MOTOROLA=1" tmake_file="${tmake_file} m68k/t-floatlib m68k/t-linux m68k/t-mlibs" @@ -1457,19 +1483,20 @@ m68k-*-rtems*) default_m68k_cpu=68020 default_cf_cpu=5206 tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-crtstuff t-rtems m68k/t-rtems m68k/t-mlibs" - tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/m68kemb.h m68k/m68020-elf.h m68k/rtemself.h rtems.h" + tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/m68kemb.h m68k/m68020-elf.h m68k/rtemself.h rtems.h newlib-stdint.h" tm_defines="${tm_defines} MOTOROLA=1" extra_parts="crtbegin.o crtend.o" ;; mcore-*-elf) - tm_file="dbxelf.h elfos.h svr4.h ${tm_file} mcore/mcore-elf.h" + tm_file="dbxelf.h elfos.h svr4.h newlib-stdint.h ${tm_file} mcore/mcore-elf.h" tmake_file=mcore/t-mcore inhibit_libc=true ;; mcore-*-pe*) - tm_file="svr3.h dbxcoff.h ${tm_file} mcore/mcore-pe.h" + tm_file="svr3.h dbxcoff.h newlib-stdint.h ${tm_file} mcore/mcore-pe.h" tmake_file=mcore/t-mcore-pe inhibit_libc=true + use_gcc_stdint=wrap ;; mips-sgi-irix[56]*) tm_file="elfos.h ${tm_file} mips/iris.h" @@ -1503,7 +1530,7 @@ mips*-*-netbsd*) # NetBSD/mips, either endian. tm_file="elfos.h ${tm_file} mips/elf.h netbsd.h netbsd-elf.h mips/netbsd.h" ;; mips64*-*-linux* | mipsisa64*-*-linux*) - tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h mips/linux64.h" + tm_file="dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h ${tm_file} mips/linux.h mips/linux64.h" tmake_file="${tmake_file} mips/t-linux64 mips/t-libgcc-mips16" tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32" case ${target} in @@ -1524,7 +1551,7 @@ mips64*-*-linux* | mipsisa64*-*-linux*) test x$with_llsc != x || with_llsc=yes ;; mips*-*-linux*) # Linux MIPS, either endian. - tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h" + tm_file="dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h ${tm_file} mips/linux.h" tmake_file="${tmake_file} mips/t-libgcc-mips16" case ${target} in mipsisa32r2*) @@ -1546,7 +1573,7 @@ mips*-*-openbsd*) esac ;; mips*-sde-elf*) - tm_file="elfos.h ${tm_file} mips/elf.h mips/sde.h" + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/sde.h" tmake_file="mips/t-sde mips/t-libgcc-mips16" case "${with_newlib}" in yes) @@ -1583,7 +1610,7 @@ mipsisa32-*-elf* | mipsisa32el-*-elf* | \ mipsisa32r2-*-elf* | mipsisa32r2el-*-elf* | \ mipsisa64-*-elf* | mipsisa64el-*-elf* | \ mipsisa64r2-*-elf* | mipsisa64r2el-*-elf*) - tm_file="elfos.h ${tm_file} mips/elf.h" + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h" tmake_file="mips/t-isa3264 mips/t-libgcc-mips16" case ${target} in mipsisa32r2*) @@ -1614,39 +1641,39 @@ mipsisa64r2-*-elf* | mipsisa64r2el-*-elf*) esac ;; mipsisa64sr71k-*-elf*) - tm_file="elfos.h ${tm_file} mips/elf.h" + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h" tmake_file=mips/t-sr71k target_cpu_default="MASK_64BIT|MASK_FLOAT64" tm_defines="${tm_defines} MIPS_ISA_DEFAULT=64 MIPS_CPU_STRING_DEFAULT=\\\"sr71000\\\" MIPS_ABI_DEFAULT=ABI_EABI" ;; mipsisa64sb1-*-elf* | mipsisa64sb1el-*-elf*) - tm_file="elfos.h ${tm_file} mips/elf.h" + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h" tmake_file="mips/t-elf mips/t-libgcc-mips16 mips/t-sb1" target_cpu_default="MASK_64BIT|MASK_FLOAT64" tm_defines="${tm_defines} MIPS_ISA_DEFAULT=64 MIPS_CPU_STRING_DEFAULT=\\\"sb1\\\" MIPS_ABI_DEFAULT=ABI_O64" ;; mips-*-elf* | mipsel-*-elf*) - tm_file="elfos.h ${tm_file} mips/elf.h" + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h" tmake_file="mips/t-elf mips/t-libgcc-mips16" ;; mips64-*-elf* | mips64el-*-elf*) - tm_file="elfos.h ${tm_file} mips/elf.h" + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h" tmake_file="mips/t-elf mips/t-libgcc-mips16" target_cpu_default="MASK_64BIT|MASK_FLOAT64" tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_O64" ;; mips64vr-*-elf* | mips64vrel-*-elf*) - tm_file="elfos.h ${tm_file} mips/vr.h mips/elf.h" + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/vr.h mips/elf.h" tmake_file=mips/t-vr ;; mips64orion-*-elf* | mips64orionel-*-elf*) - tm_file="elfos.h ${tm_file} mips/elforion.h mips/elf.h" + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elforion.h mips/elf.h" tmake_file="mips/t-elf mips/t-libgcc-mips16" target_cpu_default="MASK_64BIT|MASK_FLOAT64" tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_O64" ;; mips*-*-rtems*) - tm_file="elfos.h ${tm_file} mips/elf.h mips/rtems.h rtems.h" + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/rtems.h rtems.h" tmake_file="mips/t-elf mips/t-libgcc-mips16 t-rtems mips/t-rtems" ;; mips-wrs-vxworks) @@ -1654,24 +1681,30 @@ mips-wrs-vxworks) tmake_file="${tmake_file} mips/t-vxworks" ;; mipstx39-*-elf* | mipstx39el-*-elf*) - tm_file="elfos.h ${tm_file} mips/r3900.h mips/elf.h" + tm_file="elfos.h newlib-stdint.h ${tm_file} mips/r3900.h mips/elf.h" tmake_file="mips/t-r3900 mips/t-libgcc-mips16" ;; mmix-knuth-mmixware) + tm_file="${tm_file} newlib-stdint.h" need_64bit_hwint=yes + use_gcc_stdint=wrap ;; mn10300-*-*) - tm_file="dbxelf.h elfos.h svr4.h ${tm_file}" + tm_file="dbxelf.h elfos.h svr4.h newlib-stdint.h ${tm_file}" if test x$stabs = xyes then tm_file="${tm_file} dbx.h" fi use_collect2=no + use_gcc_stdint=wrap ;; pdp11-*-*) + tm_file="${tm_file} newlib-stdint.h" + use_gcc_stdint=wrap ;; picochip-*) - # Nothing special + tm_file="${tm_file} newlib-stdint.h" + use_gcc_stdint=wrap ;; # port not yet contributed #powerpc-*-openbsd*) @@ -1682,7 +1715,7 @@ powerpc64-*-linux*) tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h" test x$with_cpu != x || cpu_is_64bit=yes test x$cpu_is_64bit != xyes || tm_file="${tm_file} rs6000/default64.h" - tm_file="rs6000/biarch64.h ${tm_file} rs6000/linux64.h" + tm_file="rs6000/biarch64.h ${tm_file} rs6000/linux64.h glibc-stdint.h" if test x${enable_secureplt} = xyes; then tm_file="rs6000/secureplt.h ${tm_file}" fi @@ -1690,7 +1723,7 @@ powerpc64-*-linux*) tmake_file="t-dfprules rs6000/t-fprules ${tmake_file} rs6000/t-ppccomm rs6000/t-linux64 rs6000/t-fprules-softfp soft-fp/t-softfp" ;; powerpc64-*-gnu*) - tm_file="${cpu_type}/${cpu_type}.h elfos.h svr4.h freebsd-spec.h gnu.h rs6000/sysv4.h rs6000/linux64.h rs6000/gnu.h" + tm_file="${cpu_type}/${cpu_type}.h elfos.h svr4.h freebsd-spec.h gnu.h rs6000/sysv4.h rs6000/linux64.h rs6000/gnu.h glibc-stdint.h" extra_options="${extra_options} rs6000/sysv4.opt rs6000/linux64.opt" tmake_file="rs6000/t-fprules t-slibgcc-elf-ver t-gnu rs6000/t-linux64 rs6000/t-fprules-softfp soft-fp/t-softfp" ;; @@ -1727,57 +1760,63 @@ powerpc-*-netbsd*) extra_options="${extra_options} rs6000/sysv4.opt" ;; powerpc-*-eabispe*) - tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabispe.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabispe.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="rs6000/t-spe rs6000/t-ppccomm" + use_gcc_stdint=wrap ;; powerpc-*-eabisimaltivec*) - tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabisim.h rs6000/eabialtivec.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabisim.h rs6000/eabialtivec.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcendian rs6000/t-ppccomm" + use_gcc_stdint=wrap ;; powerpc-*-eabisim*) - tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabisim.h" + tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabisim.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" + use_gcc_stdint=wrap ;; powerpc-*-elf*) - tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h" + tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" ;; powerpc-*-eabialtivec*) - tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabialtivec.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabialtivec.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcendian rs6000/t-ppccomm" + use_gcc_stdint=wrap ;; powerpc-xilinx-eabi*) - tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/singlefp.h" + tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/singlefp.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" + use_gcc_stdint=wrap ;; powerpc-*-eabi*) - tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h" + tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" + use_gcc_stdint=wrap ;; powerpc-*-rtems*) - tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/rtems.h rtems.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/rtems.h rtems.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-rtems t-rtems rs6000/t-ppccomm" ;; powerpc-*-linux*altivec*) - tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxaltivec.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxaltivec.h glibc-stdint.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="rs6000/t-fprules rs6000/t-fprules-softfp soft-fp/t-softfp rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" ;; powerpc-*-linux*spe*) - tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxspe.h rs6000/e500.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxspe.h rs6000/e500.h glibc-stdint.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="t-dfprules rs6000/t-fprules rs6000/t-fprules-softfp soft-fp/t-softfp rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" ;; powerpc-*-linux*paired*) - tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h rs6000/750cl.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h rs6000/750cl.h glibc-stdint.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="rs6000/t-fprules rs6000/t-fprules-softfp soft-fp/t-softfp rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" ;; @@ -1790,12 +1829,12 @@ powerpc-*-linux*) if test x$cpu_is_64bit = xyes; then tm_file="${tm_file} rs6000/default64.h" fi - tm_file="rs6000/biarch64.h ${tm_file} rs6000/linux64.h" + tm_file="rs6000/biarch64.h ${tm_file} rs6000/linux64.h glibc-stdint.h" tmake_file="$tmake_file rs6000/t-linux64" extra_options="${extra_options} rs6000/linux64.opt" ;; *) - tm_file="${tm_file} rs6000/linux.h" + tm_file="${tm_file} rs6000/linux.h glibc-stdint.h" ;; esac if test x${enable_secureplt} = xyes; then @@ -1803,7 +1842,7 @@ powerpc-*-linux*) fi ;; powerpc-*-gnu-gnualtivec*) - tm_file="${cpu_type}/${cpu_type}.h elfos.h svr4.h freebsd-spec.h gnu.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxaltivec.h rs6000/gnu.h" + tm_file="${cpu_type}/${cpu_type}.h elfos.h svr4.h freebsd-spec.h gnu.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxaltivec.h rs6000/gnu.h glibc-stdint.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcos t-slibgcc-elf-ver t-gnu rs6000/t-ppccomm" if test x$enable_threads = xyes; then @@ -1811,7 +1850,7 @@ powerpc-*-gnu-gnualtivec*) fi ;; powerpc-*-gnu*) - tm_file="${cpu_type}/${cpu_type}.h elfos.h svr4.h freebsd-spec.h gnu.h rs6000/sysv4.h rs6000/linux.h rs6000/gnu.h" + tm_file="${cpu_type}/${cpu_type}.h elfos.h svr4.h freebsd-spec.h gnu.h rs6000/sysv4.h rs6000/linux.h rs6000/gnu.h glibc-stdint.h" tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcos t-slibgcc-elf-ver t-gnu rs6000/t-ppccomm" extra_options="${extra_options} rs6000/sysv4.opt" if test x$enable_threads = xyes; then @@ -1845,24 +1884,27 @@ powerpc-*-lynxos*) gas=yes ;; powerpcle-*-elf*) - tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/sysv4le.h" + tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/sysv4le.h" tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" extra_options="${extra_options} rs6000/sysv4.opt" ;; powerpcle-*-eabisim*) - tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/sysv4le.h rs6000/eabi.h rs6000/e500.h rs6000/eabisim.h" + tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/sysv4le.h rs6000/eabi.h rs6000/e500.h rs6000/eabisim.h" tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" extra_options="${extra_options} rs6000/sysv4.opt" + use_gcc_stdint=wrap ;; powerpcle-*-eabi*) - tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/sysv4le.h rs6000/eabi.h rs6000/e500.h" + tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/sysv4le.h rs6000/eabi.h rs6000/e500.h" tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" extra_options="${extra_options} rs6000/sysv4.opt" + use_gcc_stdint=wrap ;; powerpc-xilinx-eabi*) - tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/singlefp.h rs6000/xfpu.h" + tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/singlefp.h rs6000/xfpu.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" + use_gcc_stdint=wrap ;; rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*) tm_file="rs6000/biarch64.h ${tm_file} rs6000/aix.h rs6000/aix43.h rs6000/xcoff.h" @@ -1905,11 +1947,11 @@ rs6000-ibm-aix[6789].* | powerpc-ibm-aix[6789].*) extra_headers=altivec.h ;; s390-*-linux*) - tm_file="s390/s390.h dbxelf.h elfos.h svr4.h linux.h s390/linux.h" + tm_file="s390/s390.h dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h s390/linux.h" tmake_file="${tmake_file} t-dfprules s390/t-crtstuff s390/t-linux" ;; s390x-*-linux*) - tm_file="s390/s390x.h s390/s390.h dbxelf.h elfos.h svr4.h linux.h s390/linux.h" + tm_file="s390/s390x.h s390/s390.h dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h s390/linux.h" tm_p_file=s390/s390-protos.h md_file=s390/s390.md extra_modes=s390/s390-modes.def @@ -1928,7 +1970,7 @@ s390x-ibm-tpf*) extra_options="${extra_options} s390/tpf.opt" ;; score-*-elf) - tm_file="dbxelf.h elfos.h score/elf.h score/score.h" + tm_file="dbxelf.h elfos.h score/elf.h score/score.h newlib-stdint.h" tmake_file=score/t-score-elf extra_objs="score7.o score3.o" ;; @@ -1965,7 +2007,7 @@ sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \ tm_file="${tm_file} sh/elf.h" case ${target} in sh*-*-linux*) tmake_file="${tmake_file} sh/t-linux" - tm_file="${tm_file} linux.h sh/linux.h" ;; + tm_file="${tm_file} linux.h glibc-stdint.h sh/linux.h" ;; sh*-*-netbsd*) tm_file="${tm_file} netbsd.h netbsd-elf.h sh/netbsd-elf.h" ;; sh*-superh-elf) if test x$with_libgloss != xno; then with_libgloss=yes @@ -2008,6 +2050,9 @@ sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \ extra_objs="symbian.o" extra_parts="crt1.o crti.o crtn.o crtbegin.o crtend.o crtbeginS.o crtendS.o" ;; + *-*-elf*) + tm_file="${tm_file} newlib-stdint.h" + ;; esac # sed el/eb endian suffixes away to avoid confusion with sh[23]e case `echo ${target} | sed 's/e[lb]-/-/'` in @@ -2099,7 +2144,7 @@ sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \ ;; sh-*-rtems*) tmake_file="sh/t-sh sh/t-elf t-rtems sh/t-rtems" - tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/embed-elf.h sh/rtemself.h rtems.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/embed-elf.h sh/rtemself.h rtems.h newlib-stdint.h" ;; sh-wrs-vxworks) tmake_file="$tmake_file sh/t-sh sh/t-elf sh/t-vxworks" @@ -2116,12 +2161,12 @@ sparc64-*-openbsd*) with_cpu=ultrasparc ;; sparc-*-elf*) - tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sp-elf.h" + tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h svr4.h sparc/sysv4.h sparc/sp-elf.h" tmake_file="sparc/t-elf sparc/t-crtfm" extra_parts="crti.o crtn.o crtbegin.o crtend.o" ;; sparc-*-linux*) # SPARC's running GNU/Linux, libc6 - tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h linux.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h linux.h glibc-stdint.h" extra_options="${extra_options} sparc/long-double-switch.opt" tmake_file="${tmake_file} sparc/t-linux" if test x$enable_targets = xall; then @@ -2133,7 +2178,7 @@ sparc-*-linux*) # SPARC's running GNU/Linux, libc6 tmake_file="${tmake_file} sparc/t-crtfm" ;; sparc-*-rtems*) - tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h newlib-stdint.h" tmake_file="sparc/t-elf sparc/t-crtfm t-rtems" extra_parts="crti.o crtn.o crtbegin.o crtend.o" ;; @@ -2142,6 +2187,10 @@ sparc64-*-solaris2* | sparcv9-*-solaris2*) case ${target} in *-*-solaris2.1[0-9]*) tm_file="${tm_file} sol2-10.h" + use_gcc_stdint=wrap + ;; + *) + use_gcc_stdint=provide ;; esac tm_file="${tm_file} sparc/sol2.h sparc/sol2-64.h sparc/sol2-bi.h" @@ -2173,6 +2222,10 @@ sparc-*-solaris2*) case ${target} in *-*-solaris2.1[0-9]*) tm_file="${tm_file} sol2-10.h" + use_gcc_stdint=wrap + ;; + *) + use_gcc_stdint=provide ;; esac tm_file="${tm_file} sparc/sol2.h" @@ -2217,7 +2270,7 @@ sparc-wrs-vxworks) tmake_file="${tmake_file} sparc/t-vxworks" ;; sparc64-*-elf*) - tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sp64-elf.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h newlib-stdint.h sparc/sysv4.h sparc/sp64-elf.h" extra_options="${extra_options} sparc/little-endian.opt" tmake_file="${tmake_file} sparc/t-crtfm" extra_parts="crtbegin.o crtend.o" @@ -2233,7 +2286,7 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*) esac ;; sparc64-*-linux*) # 64-bit SPARC's running GNU/Linux - tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h linux.h sparc/linux64.h" + tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h linux.h glibc-stdint.h sparc/linux64.h" extra_options="${extra_options} sparc/long-double-switch.opt" tmake_file="${tmake_file} sparc/t-linux sparc/t-linux64 sparc/t-crtfm" ;; @@ -2244,7 +2297,7 @@ sparc64-*-netbsd*) tmake_file="${tmake_file} sparc/t-netbsd64" ;; spu-*-elf*) - tm_file="dbxelf.h elfos.h spu/spu-elf.h spu/spu.h" + tm_file="dbxelf.h elfos.h spu/spu-elf.h spu/spu.h newlib-stdint.h" tmake_file="spu/t-spu-elf" extra_headers="spu_intrinsics.h spu_internals.h vmx2spu.h spu_mfcio.h vec_types.h" extra_modes=spu/spu-modes.def @@ -2253,7 +2306,7 @@ spu-*-elf*) ;; v850e1-*-*) target_cpu_default="TARGET_CPU_v850e1" - tm_file="dbxelf.h elfos.h svr4.h v850/v850.h" + tm_file="dbxelf.h elfos.h svr4.h newlib-stdint.h v850/v850.h" tm_p_file=v850/v850-protos.h tmake_file=v850/t-v850e md_file=v850/v850.md @@ -2266,10 +2319,11 @@ v850e1-*-*) use_collect2=no c_target_objs="v850-c.o" cxx_target_objs="v850-c.o" + use_gcc_stdint=wrap ;; v850e-*-*) target_cpu_default="TARGET_CPU_v850e" - tm_file="dbxelf.h elfos.h svr4.h v850/v850.h" + tm_file="dbxelf.h elfos.h svr4.h newlib-stdint.h v850/v850.h" tm_p_file=v850/v850-protos.h tmake_file=v850/t-v850e md_file=v850/v850.md @@ -2282,10 +2336,11 @@ v850e-*-*) use_collect2=no c_target_objs="v850-c.o" cxx_target_objs="v850-c.o" + use_gcc_stdint=wrap ;; v850-*-*) target_cpu_default="TARGET_CPU_generic" - tm_file="dbxelf.h elfos.h svr4.h ${tm_file}" + tm_file="dbxelf.h elfos.h svr4.h newlib-stdint.h ${tm_file}" tmake_file=v850/t-v850 if test x$stabs = xyes then @@ -2294,6 +2349,7 @@ v850-*-*) use_collect2=no c_target_objs="v850-c.o" cxx_target_objs="v850-c.o" + use_gcc_stdint=wrap ;; vax-*-netbsdelf*) tm_file="${tm_file} elfos.h netbsd.h netbsd-elf.h vax/elf.h vax/netbsd-elf.h" @@ -2310,7 +2366,7 @@ vax-*-openbsd*) ;; xstormy16-*-elf) # For historical reasons, the target files omit the 'x'. - tm_file="dbxelf.h elfos.h svr4.h stormy16/stormy16.h" + tm_file="dbxelf.h elfos.h svr4.h newlib-stdint.h stormy16/stormy16.h" tm_p_file=stormy16/stormy16-protos.h md_file=stormy16/stormy16.md out_file=stormy16/stormy16.c @@ -2319,28 +2375,28 @@ xstormy16-*-elf) extra_parts="crtbegin.o crtend.o" ;; xtensa*-*-elf*) - tm_file="${tm_file} dbxelf.h elfos.h svr4.h xtensa/elf.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h newlib-stdint.h xtensa/elf.h" tmake_file="xtensa/t-xtensa xtensa/t-elf" ;; xtensa*-*-linux*) - tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h xtensa/linux.h" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h xtensa/linux.h" tmake_file="${tmake_file} xtensa/t-xtensa xtensa/t-linux" ;; am33_2.0-*-linux*) - tm_file="mn10300/mn10300.h dbxelf.h elfos.h linux.h mn10300/linux.h" + tm_file="mn10300/mn10300.h dbxelf.h elfos.h linux.h glibc-stdint.h mn10300/linux.h" tmake_file="${tmake_file} mn10300/t-linux" gas=yes gnu_ld=yes extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" use_collect2=no ;; m32c-*-rtems*) - tm_file="dbxelf.h elfos.h svr4.h ${tm_file} m32c/rtems.h rtems.h" + tm_file="dbxelf.h elfos.h svr4.h ${tm_file} m32c/rtems.h rtems.h newlib-stdint.h" tmake_file="${tmake_file} t-rtems" c_target_objs="m32c-pragma.o" cxx_target_objs="m32c-pragma.o" ;; m32c-*-elf*) - tm_file="dbxelf.h elfos.h svr4.h ${tm_file}" + tm_file="dbxelf.h elfos.h svr4.h newlib-stdint.h ${tm_file}" c_target_objs="m32c-pragma.o" cxx_target_objs="m32c-pragma.o" ;; diff --git a/gcc/config/glibc-stdint.h b/gcc/config/glibc-stdint.h new file mode 100644 index 0000000..7772d1a --- /dev/null +++ b/gcc/config/glibc-stdint.h @@ -0,0 +1,50 @@ +/* Definitions for <stdint.h> types on systems using GNU libc or uClibc. + Copyright (C) 2008, 2009 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#define SIG_ATOMIC_TYPE "int" + +#define INT8_TYPE "signed char" +#define INT16_TYPE "short int" +#define INT32_TYPE "int" +#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") +#define UINT8_TYPE "unsigned char" +#define UINT16_TYPE "short unsigned int" +#define UINT32_TYPE "unsigned int" +#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + +#define INT_LEAST8_TYPE "signed char" +#define INT_LEAST16_TYPE "short int" +#define INT_LEAST32_TYPE "int" +#define INT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") +#define UINT_LEAST8_TYPE "unsigned char" +#define UINT_LEAST16_TYPE "short unsigned int" +#define UINT_LEAST32_TYPE "unsigned int" +#define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + +#define INT_FAST8_TYPE "signed char" +#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") +#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") +#define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") +#define UINT_FAST8_TYPE "unsigned char" +#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") +#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") +#define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + +#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") +#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") diff --git a/gcc/config/m32c/m32c.h b/gcc/config/m32c/m32c.h index 55eb3e7..632993c 100644 --- a/gcc/config/m32c/m32c.h +++ b/gcc/config/m32c/m32c.h @@ -189,6 +189,9 @@ machine_function; #undef PTRDIFF_TYPE #define PTRDIFF_TYPE (TARGET_A16 ? "int" : "long int") +#undef UINTPTR_TYPE +#define UINTPTR_TYPE (TARGET_A16 ? "unsigned int" : "long unsigned int") + /* REGISTER USAGE */ /* Register Basics */ diff --git a/gcc/config/newlib-stdint.h b/gcc/config/newlib-stdint.h new file mode 100644 index 0000000..3bc8a59 --- /dev/null +++ b/gcc/config/newlib-stdint.h @@ -0,0 +1,64 @@ +/* Definitions for <stdint.h> types on systems using newlib. + Copyright (C) 2008, 2009 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +/* newlib uses 32-bit long in certain cases for all non-SPU + targets. */ +#ifndef STDINT_LONG32 +#define STDINT_LONG32 (LONG_TYPE_SIZE == 32) +#endif + +#define SIG_ATOMIC_TYPE "int" + +/* The newlib logic actually checks for sizes greater than 32 rather + than equal to 64 for various 64-bit types. */ + +#define INT8_TYPE (CHAR_TYPE_SIZE == 8 ? "signed char" : 0) +#define INT16_TYPE (SHORT_TYPE_SIZE == 16 ? "short int" : INT_TYPE_SIZE == 16 ? "int" : CHAR_TYPE_SIZE == 16 ? "signed char" : 0) +#define INT32_TYPE (STDINT_LONG32 ? "long int" : INT_TYPE_SIZE == 32 ? "int" : SHORT_TYPE_SIZE == 32 ? "short int" : CHAR_TYPE_SIZE == 32 ? "signed char" : 0) +#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : LONG_LONG_TYPE_SIZE == 64 ? "long long int" : INT_TYPE_SIZE == 64 ? "int" : 0) +#define UINT8_TYPE (CHAR_TYPE_SIZE == 8 ? "unsigned char" : 0) +#define UINT16_TYPE (SHORT_TYPE_SIZE == 16 ? "short unsigned int" : INT_TYPE_SIZE == 16 ? "unsigned int" : CHAR_TYPE_SIZE == 16 ? "unsigned char" : 0) +#define UINT32_TYPE (STDINT_LONG32 ? "long unsigned int" : INT_TYPE_SIZE == 32 ? "unsigned int" : SHORT_TYPE_SIZE == 32 ? "short unsigned int" : CHAR_TYPE_SIZE == 32 ? "unsigned char" : 0) +#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : LONG_LONG_TYPE_SIZE == 64 ? "long long unsigned int" : INT_TYPE_SIZE == 64 ? "unsigned int" : 0) + +#define INT_LEAST8_TYPE (INT8_TYPE ? INT8_TYPE : INT16_TYPE ? INT16_TYPE : INT32_TYPE ? INT32_TYPE : INT64_TYPE ? INT64_TYPE : 0) +#define INT_LEAST16_TYPE (INT16_TYPE ? INT16_TYPE : INT32_TYPE ? INT32_TYPE : INT64_TYPE ? INT64_TYPE : 0) +#define INT_LEAST32_TYPE (INT32_TYPE ? INT32_TYPE : INT64_TYPE ? INT64_TYPE : 0) +#define INT_LEAST64_TYPE INT64_TYPE +#define UINT_LEAST8_TYPE (UINT8_TYPE ? UINT8_TYPE : UINT16_TYPE ? UINT16_TYPE : UINT32_TYPE ? UINT32_TYPE : UINT64_TYPE ? UINT64_TYPE : 0) +#define UINT_LEAST16_TYPE (UINT16_TYPE ? UINT16_TYPE : UINT32_TYPE ? UINT32_TYPE : UINT64_TYPE ? UINT64_TYPE : 0) +#define UINT_LEAST32_TYPE (UINT32_TYPE ? UINT32_TYPE : UINT64_TYPE ? UINT64_TYPE : 0) +#define UINT_LEAST64_TYPE UINT64_TYPE + +#define INT_FAST8_TYPE (INT_TYPE_SIZE >= 8 ? "int" : INT_LEAST8_TYPE) +#define INT_FAST16_TYPE (INT_TYPE_SIZE >= 16 ? "int" : INT_LEAST16_TYPE) +#define INT_FAST32_TYPE (INT_TYPE_SIZE >= 32 ? "int" : INT_LEAST32_TYPE) +#define INT_FAST64_TYPE (INT_TYPE_SIZE >= 64 ? "int" : INT_LEAST64_TYPE) +#define UINT_FAST8_TYPE (INT_TYPE_SIZE >= 8 ? "unsigned int" : UINT_LEAST8_TYPE) +#define UINT_FAST16_TYPE (INT_TYPE_SIZE >= 16 ? "unsigned int" : UINT_LEAST16_TYPE) +#define UINT_FAST32_TYPE (INT_TYPE_SIZE >= 32 ? "unsigned int" : UINT_LEAST32_TYPE) +#define UINT_FAST64_TYPE (INT_TYPE_SIZE >= 64 ? "unsigned int" : UINT_LEAST64_TYPE) + +/* Newlib uses the unsigned type corresponding to ptrdiff_t for + uintptr_t; this is the same as size_t for most newlib-using + targets. */ +#define INTPTR_TYPE PTRDIFF_TYPE +#ifndef UINTPTR_TYPE +#define UINTPTR_TYPE SIZE_TYPE +#endif diff --git a/gcc/config/score/score.h b/gcc/config/score/score.h index 7fd720d..3196344 100644 --- a/gcc/config/score/score.h +++ b/gcc/config/score/score.h @@ -1,5 +1,5 @@ /* score.h for Sunplus S+CORE processor - Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc. Contributed by Sunnorth. This file is part of GCC. @@ -216,6 +216,8 @@ /* Default definitions for size_t and ptrdiff_t. */ #define SIZE_TYPE "unsigned int" +#define UINTPTR_TYPE "long unsigned int" + /* Register Usage S+core have: diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h index a8f5514..e3e59fd 100644 --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -1,6 +1,6 @@ /* Operating system specific defines to be used when targeting GCC for any Solaris 2 system. - Copyright 2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc. + Copyright 2002, 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -38,6 +38,40 @@ along with GCC; see the file COPYING3. If not see #undef WINT_TYPE_SIZE #define WINT_TYPE_SIZE BITS_PER_WORD +#define SIG_ATOMIC_TYPE "int" + +/* ??? This definition of int8_t follows the system header but does + not conform to C99. Likewise int_fast8_t, int_least8_t. */ +#define INT8_TYPE "char" +#define INT16_TYPE "short int" +#define INT32_TYPE "int" +#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") +#define UINT8_TYPE "unsigned char" +#define UINT16_TYPE "short unsigned int" +#define UINT32_TYPE "unsigned int" +#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + +#define INT_LEAST8_TYPE "char" +#define INT_LEAST16_TYPE "short int" +#define INT_LEAST32_TYPE "int" +#define INT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") +#define UINT_LEAST8_TYPE "unsigned char" +#define UINT_LEAST16_TYPE "short unsigned int" +#define UINT_LEAST32_TYPE "unsigned int" +#define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + +#define INT_FAST8_TYPE "char" +#define INT_FAST16_TYPE "int" +#define INT_FAST32_TYPE "int" +#define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") +#define UINT_FAST8_TYPE "unsigned char" +#define UINT_FAST16_TYPE "unsigned int" +#define UINT_FAST32_TYPE "unsigned int" +#define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + +#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") +#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") + #define TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME 1 /* ??? Note: in order for -compat-bsd to work fully, diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h index 34585f9..50e09c9 100644 --- a/gcc/config/spu/spu.h +++ b/gcc/config/spu/spu.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. +/* Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -142,6 +142,8 @@ extern GTY(()) int spu_tune; #define DEFAULT_SIGNED_CHAR 0 +#define STDINT_LONG32 0 + /* Register Basics */ diff --git a/gcc/configure b/gcc/configure index 9149197..190dd3c 100755 --- a/gcc/configure +++ b/gcc/configure @@ -458,7 +458,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_libsubdir build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNATBIND ac_ct_GNATBIND GNATMAKE ac_ct_GNATMAKE NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP loose_warn strict_warn warn_cflags nocommon_flag TREEBROWSER valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_decimal_float enable_fixed_point enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI datarootdir docdir htmldir SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB LIBICONV LTLIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file extra_opt_files USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS BUILD_LDFLAGS STMP_FIXINC collect2 LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN OBJDUMP ac_ct_OBJDUMP ac_ct_AR STRIP ac_ct_STRIP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 objdir enable_fast_install gcc_cv_as ORIGINAL_AS_FOR_TARGET gcc_cv_ld ORIGINAL_LD_FOR_TARGET gcc_cv_nm ORIGINAL_NM_FOR_TARGET gcc_cv_objdump gcc_cv_readelf libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir subdirs srcdir all_compilers all_gtfiles all_lang_makefrags all_lang_makefiles all_languages all_selected_languages build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines build_file_translate check_languages cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines use_gcc_stdint c_target_objs cxx_target_objs fortran_target_objs target_cpu_default GMPLIBS GMPINC PPLLIBS PPLINC CLOOGLIBS CLOOGINC LIBOBJS LTLIBOBJS' ac_subst_files='language_hooks' ac_pwd=`pwd` @@ -23337,7 +23337,7 @@ if test "${gcc_cv_as_powerpc_tls_markers+set}" = set; then else gcc_cv_as_powerpc_tls_markers=no if test $in_tree_gas = yes; then - if test $gcc_cv_gas_vers -ge `expr \( \( 9 \* 1000 \) + 99 \) \* 1000 + 0` + if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 20 \) \* 1000 + 0` then gcc_cv_as_powerpc_tls_markers=yes fi elif test x$gcc_cv_as != x; then @@ -24645,6 +24645,7 @@ fi; + # Echo link setup. if test x${build} = x${host} ; then if test x${host} = x${target} ; then @@ -25512,6 +25513,7 @@ s,@tm_p_include_list@,$tm_p_include_list,;t t s,@xm_file_list@,$xm_file_list,;t t s,@xm_include_list@,$xm_include_list,;t t s,@xm_defines@,$xm_defines,;t t +s,@use_gcc_stdint@,$use_gcc_stdint,;t t s,@c_target_objs@,$c_target_objs,;t t s,@cxx_target_objs@,$cxx_target_objs,;t t s,@fortran_target_objs@,$fortran_target_objs,;t t diff --git a/gcc/configure.ac b/gcc/configure.ac index 6a6a7d3..0b72bcb 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3911,6 +3911,7 @@ AC_SUBST(tm_p_include_list) AC_SUBST(xm_file_list) AC_SUBST(xm_include_list) AC_SUBST(xm_defines) +AC_SUBST(use_gcc_stdint) AC_SUBST(c_target_objs) AC_SUBST(cxx_target_objs) AC_SUBST(fortran_target_objs) diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi index 0eaece1..d79991c 100644 --- a/gcc/doc/cpp.texi +++ b/gcc/doc/cpp.texi @@ -11,7 +11,8 @@ @copying @c man begin COPYRIGHT Copyright @copyright{} 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, -1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, +2008, 2009 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document @@ -2117,13 +2118,50 @@ OSF/rose @option{-mno-underscores} option). @itemx __WINT_TYPE__ @itemx __INTMAX_TYPE__ @itemx __UINTMAX_TYPE__ +@itemx __SIG_ATOMIC_TYPE__ +@itemx __INT8_TYPE__ +@itemx __INT16_TYPE__ +@itemx __INT32_TYPE__ +@itemx __INT64_TYPE__ +@itemx __UINT8_TYPE__ +@itemx __UINT16_TYPE__ +@itemx __UINT32_TYPE__ +@itemx __UINT64_TYPE__ +@itemx __INT_LEAST8_TYPE__ +@itemx __INT_LEAST16_TYPE__ +@itemx __INT_LEAST32_TYPE__ +@itemx __INT_LEAST64_TYPE__ +@itemx __UINT_LEAST8_TYPE__ +@itemx __UINT_LEAST16_TYPE__ +@itemx __UINT_LEAST32_TYPE__ +@itemx __UINT_LEAST64_TYPE__ +@itemx __INT_FAST8_TYPE__ +@itemx __INT_FAST16_TYPE__ +@itemx __INT_FAST32_TYPE__ +@itemx __INT_FAST64_TYPE__ +@itemx __UINT_FAST8_TYPE__ +@itemx __UINT_FAST16_TYPE__ +@itemx __UINT_FAST32_TYPE__ +@itemx __UINT_FAST64_TYPE__ +@itemx __INTPTR_TYPE__ +@itemx __UINTPTR_TYPE__ These macros are defined to the correct underlying types for the @code{size_t}, @code{ptrdiff_t}, @code{wchar_t}, @code{wint_t}, -@code{intmax_t}, and @code{uintmax_t} -typedefs, respectively. They exist to make the standard header files -@file{stddef.h} and @file{wchar.h} work correctly. You should not use -these macros directly; instead, include the appropriate headers and use -the typedefs. +@code{intmax_t}, @code{uintmax_t}, @code{sig_atomic_t}, @code{int8_t}, +@code{int16_t}, @code{int32_t}, @code{int64_t}, @code{uint8_t}, +@code{uint16_t}, @code{uint32_t}, @code{uint64_t}, +@code{int_least8_t}, @code{int_least16_t}, @code{int_least32_t}, +@code{int_least64_t}, @code{uint_least8_t}, @code{uint_least16_t}, +@code{uint_least32_t}, @code{uint_least64_t}, @code{int_fast8_t}, +@code{int_fast16_t}, @code{int_fast32_t}, @code{int_fast64_t}, +@code{uint_fast8_t}, @code{uint_fast16_t}, @code{uint_fast32_t}, +@code{uint_fast64_t}, @code{intptr_t}, and @code{uintptr_t} typedefs, +respectively. They exist to make the standard header files +@file{stddef.h}, @file{stdint.h}, and @file{wchar.h} work correctly. +You should not use these macros directly; instead, include the +appropriate headers and use the typedefs. Some of these macros may +not be defined on particular systems if GCC does not provide a +@file{stdint.h} header on those systems. @item __CHAR_BIT__ Defined to the number of bits used in the representation of the @@ -2137,14 +2175,77 @@ this macro directly; instead, include the appropriate headers. @itemx __INT_MAX__ @itemx __LONG_MAX__ @itemx __LONG_LONG_MAX__ +@itemx __WINT_MAX__ +@itemx __SIZE_MAX__ +@itemx __PTRDIFF_MAX__ @itemx __INTMAX_MAX__ +@itemx __UINTMAX_MAX__ +@itemx __SIG_ATOMIC_MAX__ +@itemx __INT8_MAX__ +@itemx __INT16_MAX__ +@itemx __INT32_MAX__ +@itemx __INT64_MAX__ +@itemx __UINT8_MAX__ +@itemx __UINT16_MAX__ +@itemx __UINT32_MAX__ +@itemx __UINT64_MAX__ +@itemx __INT_LEAST8_MAX__ +@itemx __INT_LEAST16_MAX__ +@itemx __INT_LEAST32_MAX__ +@itemx __INT_LEAST64_MAX__ +@itemx __UINT_LEAST8_MAX__ +@itemx __UINT_LEAST16_MAX__ +@itemx __UINT_LEAST32_MAX__ +@itemx __UINT_LEAST64_MAX__ +@itemx __INT_FAST8_MAX__ +@itemx __INT_FAST16_MAX__ +@itemx __INT_FAST32_MAX__ +@itemx __INT_FAST64_MAX__ +@itemx __UINT_FAST8_MAX__ +@itemx __UINT_FAST16_MAX__ +@itemx __UINT_FAST32_MAX__ +@itemx __UINT_FAST64_MAX__ +@itemx __INTPTR_MAX__ +@itemx __UINTPTR_MAX__ +@itemx __WCHAR_MIN__ +@itemx __WINT_MIN__ +@itemx __SIG_ATOMIC_MIN__ Defined to the maximum value of the @code{signed char}, @code{wchar_t}, @code{signed short}, -@code{signed int}, @code{signed long}, @code{signed long long}, and -@code{intmax_t} types -respectively. They exist to make the standard header given numerical limits -work correctly. You should not use these macros directly; instead, include -the appropriate headers. +@code{signed int}, @code{signed long}, @code{signed long long}, +@code{wint_t}, @code{size_t}, @code{ptrdiff_t}, +@code{intmax_t}, @code{uintmax_t}, @code{sig_atomic_t}, @code{int8_t}, +@code{int16_t}, @code{int32_t}, @code{int64_t}, @code{uint8_t}, +@code{uint16_t}, @code{uint32_t}, @code{uint64_t}, +@code{int_least8_t}, @code{int_least16_t}, @code{int_least32_t}, +@code{int_least64_t}, @code{uint_least8_t}, @code{uint_least16_t}, +@code{uint_least32_t}, @code{uint_least64_t}, @code{int_fast8_t}, +@code{int_fast16_t}, @code{int_fast32_t}, @code{int_fast64_t}, +@code{uint_fast8_t}, @code{uint_fast16_t}, @code{uint_fast32_t}, +@code{uint_fast64_t}, @code{intptr_t}, and @code{uintptr_t} types and +to the minimum value of the @code{wchar_t}, @code{wint_t}, and +@code{sig_atomic_t} types respectively. They exist to make the +standard header given numerical limits work correctly. You should not +use these macros directly; instead, include the appropriate headers. +Some of these macros may not be defined on particular systems if GCC +does not provide a @file{stdint.h} header on those systems. + +@item __INT8_C +@itemx __INT16_C +@itemx __INT32_C +@itemx __INT64_C +@itemx __UINT8_C +@itemx __UINT16_C +@itemx __UINT32_C +@itemx __UINT64_C +@itemx __INTMAX_C +@itemx __UINTMAX_C +Defined to implementations of the standard @file{stdint.h} macros with +the same names without the leading @code{__}. They exist the make the +implementation of that header work correctly. You should not use +these macros directly; instead, include the appropriate headers. Some +of these macros may not be defined on particular systems if GCC does +not provide a @file{stdint.h} header on those systems. @item __SIZEOF_INT__ @itemx __SIZEOF_LONG__ diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index f4680b6..665b269 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -1782,6 +1782,51 @@ unsigned int"} that has as much precision as @code{long long unsigned int}. @end defmac +@defmac SIG_ATOMIC_TYPE +@defmacx INT8_TYPE +@defmacx INT16_TYPE +@defmacx INT32_TYPE +@defmacx INT64_TYPE +@defmacx UINT8_TYPE +@defmacx UINT16_TYPE +@defmacx UINT32_TYPE +@defmacx UINT64_TYPE +@defmacx INT_LEAST8_TYPE +@defmacx INT_LEAST16_TYPE +@defmacx INT_LEAST32_TYPE +@defmacx INT_LEAST64_TYPE +@defmacx UINT_LEAST8_TYPE +@defmacx UINT_LEAST16_TYPE +@defmacx UINT_LEAST32_TYPE +@defmacx UINT_LEAST64_TYPE +@defmacx INT_FAST8_TYPE +@defmacx INT_FAST16_TYPE +@defmacx INT_FAST32_TYPE +@defmacx INT_FAST64_TYPE +@defmacx UINT_FAST8_TYPE +@defmacx UINT_FAST16_TYPE +@defmacx UINT_FAST32_TYPE +@defmacx UINT_FAST64_TYPE +@defmacx INTPTR_TYPE +@defmacx UINTPTR_TYPE +C expressions for the standard types @code{sig_atomic_t}, +@code{int8_t}, @code{int16_t}, @code{int32_t}, @code{int64_t}, +@code{uint8_t}, @code{uint16_t}, @code{uint32_t}, @code{uint64_t}, +@code{int_least8_t}, @code{int_least16_t}, @code{int_least32_t}, +@code{int_least64_t}, @code{uint_least8_t}, @code{uint_least16_t}, +@code{uint_least32_t}, @code{uint_least64_t}, @code{int_fast8_t}, +@code{int_fast16_t}, @code{int_fast32_t}, @code{int_fast64_t}, +@code{uint_fast8_t}, @code{uint_fast16_t}, @code{uint_fast32_t}, +@code{uint_fast64_t}, @code{intptr_t}, and @code{uintptr_t}. See +@code{SIZE_TYPE} above for more information. + +If any of these macros evaluates to a null pointer, the corresponding +type is not supported; if GCC is configured to provide +@code{<stdint.h>} in such a case, the header provided may not conform +to C99, depending on the type in question. The defaults for all of +these macros are null pointers. +@end defmac + @defmac TARGET_PTRMEMFUNC_VBIT_LOCATION The C++ compiler represents a pointer-to-member-function with a struct that looks like: diff --git a/gcc/ginclude/stdint-gcc.h b/gcc/ginclude/stdint-gcc.h new file mode 100644 index 0000000..9c0a44c --- /dev/null +++ b/gcc/ginclude/stdint-gcc.h @@ -0,0 +1,262 @@ +/* Copyright (C) 2008, 2009 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING. If not, write to +the Free Software Foundation, 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +/* As a special exception, if you include this header file into source + files compiled by GCC, this header file does not by itself cause + the resulting executable to be covered by the GNU General Public + License. This exception does not however invalidate any other + reasons why the executable file might be covered by the GNU General + Public License. */ + +/* + * ISO C Standard: 7.18 Integer types <stdint.h> + */ + +#ifndef _GCC_STDINT_H +#define _GCC_STDINT_H + +/* 7.8.1.1 Exact-width integer types */ + +#ifdef __INT8_TYPE__ +typedef __INT8_TYPE__ int8_t; +#endif +#ifdef __INT16_TYPE__ +typedef __INT16_TYPE__ int16_t; +#endif +#ifdef __INT32_TYPE__ +typedef __INT32_TYPE__ int32_t; +#endif +#ifdef __INT64_TYPE__ +typedef __INT64_TYPE__ int64_t; +#endif +#ifdef __UINT8_TYPE__ +typedef __UINT8_TYPE__ uint8_t; +#endif +#ifdef __UINT16_TYPE__ +typedef __UINT16_TYPE__ uint16_t; +#endif +#ifdef __UINT32_TYPE__ +typedef __UINT32_TYPE__ uint32_t; +#endif +#ifdef __UINT64_TYPE__ +typedef __UINT64_TYPE__ uint64_t; +#endif + +/* 7.8.1.2 Minimum-width integer types */ + +typedef __INT_LEAST8_TYPE__ int_least8_t; +typedef __INT_LEAST16_TYPE__ int_least16_t; +typedef __INT_LEAST32_TYPE__ int_least32_t; +typedef __INT_LEAST64_TYPE__ int_least64_t; +typedef __UINT_LEAST8_TYPE__ uint_least8_t; +typedef __UINT_LEAST16_TYPE__ uint_least16_t; +typedef __UINT_LEAST32_TYPE__ uint_least32_t; +typedef __UINT_LEAST64_TYPE__ uint_least64_t; + +/* 7.8.1.3 Fastest minimum-width integer types */ + +typedef __INT_FAST8_TYPE__ int_fast8_t; +typedef __INT_FAST16_TYPE__ int_fast16_t; +typedef __INT_FAST32_TYPE__ int_fast32_t; +typedef __INT_FAST64_TYPE__ int_fast64_t; +typedef __UINT_FAST8_TYPE__ uint_fast8_t; +typedef __UINT_FAST16_TYPE__ uint_fast16_t; +typedef __UINT_FAST32_TYPE__ uint_fast32_t; +typedef __UINT_FAST64_TYPE__ uint_fast64_t; + +/* 7.8.1.4 Integer types capable of holding object pointers */ + +#ifdef __INTPTR_TYPE__ +typedef __INTPTR_TYPE__ intptr_t; +#endif +#ifdef __UINTPTR_TYPE__ +typedef __UINTPTR_TYPE__ uintptr_t; +#endif + +/* 7.8.1.5 Greatest-width integer types */ + +typedef __INTMAX_TYPE__ intmax_t; +typedef __UINTMAX_TYPE__ uintmax_t; + +#if !defined __cplusplus || defined __STDC_LIMIT_MACROS + +/* 7.18.2 Limits of specified-width integer types */ + +#ifdef __INT8_MAX__ +# undef INT8_MAX +# define INT8_MAX __INT8_MAX__ +# undef INT8_MIN +# define INT8_MIN (-INT8_MAX - 1) +#endif +#ifdef __UINT8_MAX__ +# undef UINT8_MAX +# define UINT8_MAX __UINT8_MAX__ +#endif +#ifdef __INT16_MAX__ +# undef INT16_MAX +# define INT16_MAX __INT16_MAX__ +# undef INT16_MIN +# define INT16_MIN (-INT16_MAX - 1) +#endif +#ifdef __UINT16_MAX__ +# undef UINT16_MAX +# define UINT16_MAX __UINT16_MAX__ +#endif +#ifdef __INT32_MAX__ +# undef INT32_MAX +# define INT32_MAX __INT32_MAX__ +# undef INT32_MIN +# define INT32_MIN (-INT32_MAX - 1) +#endif +#ifdef __UINT32_MAX__ +# undef UINT32_MAX +# define UINT32_MAX __UINT32_MAX__ +#endif +#ifdef __INT64_MAX__ +# undef INT64_MAX +# define INT64_MAX __INT64_MAX__ +# undef INT64_MIN +# define INT64_MIN (-INT64_MAX - 1) +#endif +#ifdef __UINT64_MAX__ +# undef UINT64_MAX +# define UINT64_MAX __UINT64_MAX__ +#endif + +#undef INT_LEAST8_MAX +#define INT_LEAST8_MAX __INT_LEAST8_MAX__ +#undef INT_LEAST8_MIN +#define INT_LEAST8_MIN (-INT_LEAST8_MAX - 1) +#undef UINT_LEAST8_MAX +#define UINT_LEAST8_MAX __UINT_LEAST8_MAX__ +#undef INT_LEAST16_MAX +#define INT_LEAST16_MAX __INT_LEAST16_MAX__ +#undef INT_LEAST16_MIN +#define INT_LEAST16_MIN (-INT_LEAST16_MAX - 1) +#undef UINT_LEAST16_MAX +#define UINT_LEAST16_MAX __UINT_LEAST16_MAX__ +#undef INT_LEAST32_MAX +#define INT_LEAST32_MAX __INT_LEAST32_MAX__ +#undef INT_LEAST32_MIN +#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1) +#undef UINT_LEAST32_MAX +#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__ +#undef INT_LEAST64_MAX +#define INT_LEAST64_MAX __INT_LEAST64_MAX__ +#undef INT_LEAST64_MIN +#define INT_LEAST64_MIN (-INT_LEAST64_MAX - 1) +#undef UINT_LEAST64_MAX +#define UINT_LEAST64_MAX __UINT_LEAST64_MAX__ + +#undef INT_FAST8_MAX +#define INT_FAST8_MAX __INT_FAST8_MAX__ +#undef INT_FAST8_MIN +#define INT_FAST8_MIN (-INT_FAST8_MAX - 1) +#undef UINT_FAST8_MAX +#define UINT_FAST8_MAX __UINT_FAST8_MAX__ +#undef INT_FAST16_MAX +#define INT_FAST16_MAX __INT_FAST16_MAX__ +#undef INT_FAST16_MIN +#define INT_FAST16_MIN (-INT_FAST16_MAX - 1) +#undef UINT_FAST16_MAX +#define UINT_FAST16_MAX __UINT_FAST16_MAX__ +#undef INT_FAST32_MAX +#define INT_FAST32_MAX __INT_FAST32_MAX__ +#undef INT_FAST32_MIN +#define INT_FAST32_MIN (-INT_FAST32_MAX - 1) +#undef UINT_FAST32_MAX +#define UINT_FAST32_MAX __UINT_FAST32_MAX__ +#undef INT_FAST64_MAX +#define INT_FAST64_MAX __INT_FAST64_MAX__ +#undef INT_FAST64_MIN +#define INT_FAST64_MIN (-INT_FAST64_MAX - 1) +#undef UINT_FAST64_MAX +#define UINT_FAST64_MAX __UINT_FAST64_MAX__ + +#ifdef __INTPTR_MAX__ +# undef INTPTR_MAX +# define INTPTR_MAX __INTPTR_MAX__ +# undef INTPTR_MIN +# define INTPTR_MIN (-INTPTR_MAX - 1) +#endif +#ifdef __UINTPTR_MAX__ +# undef UINTPTR_MAX +# define UINTPTR_MAX __UINTPTR_MAX__ +#endif + +#undef INTMAX_MAX +#define INTMAX_MAX __INTMAX_MAX__ +#undef INTMAX_MIN +#define INTMAX_MIN (-INTMAX_MAX - 1) +#undef UINTMAX_MAX +#define UINTMAX_MAX __UINTMAX_MAX__ + +/* 7.18.3 Limits of other integer types */ + +#undef PTRDIFF_MAX +#define PTRDIFF_MAX __PTRDIFF_MAX__ +#undef PTRDIFF_MIN +#define PTRDIFF_MIN (-PTRDIFF_MAX - 1) + +#undef SIG_ATOMIC_MAX +#define SIG_ATOMIC_MAX __SIG_ATOMIC_MAX__ +#undef SIG_ATOMIC_MIN +#define SIG_ATOMIC_MIN __SIG_ATOMIC_MIN__ + +#undef SIZE_MAX +#define SIZE_MAX __SIZE_MAX__ + +#undef WCHAR_MAX +#define WCHAR_MAX __WCHAR_MAX__ +#undef WCHAR_MIN +#define WCHAR_MIN __WCHAR_MIN__ + +#undef WINT_MAX +#define WINT_MAX __WINT_MAX__ +#undef WINT_MIN +#define WINT_MIN __WINT_MIN__ + +#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */ + +#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS + +#undef INT8_C +#define INT8_C(c) __INT8_C(c) +#undef INT16_C +#define INT16_C(c) __INT16_C(c) +#undef INT32_C +#define INT32_C(c) __INT32_C(c) +#undef INT64_C +#define INT64_C(c) __INT64_C(c) +#undef UINT8_C +#define UINT8_C(c) __UINT8_C(c) +#undef UINT16_C +#define UINT16_C(c) __UINT16_C(c) +#undef UINT32_C +#define UINT32_C(c) __UINT32_C(c) +#undef UINT64_C +#define UINT64_C(c) __UINT64_C(c) +#undef INTMAX_C +#define INTMAX_C(c) __INTMAX_C(c) +#undef UINTMAX_C +#define UINTMAX_C(c) __UINTMAX_C(c) + +#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ + +#endif /* _GCC_STDINT_H */ diff --git a/gcc/ginclude/stdint-wrap.h b/gcc/ginclude/stdint-wrap.h new file mode 100644 index 0000000..e45f819 --- /dev/null +++ b/gcc/ginclude/stdint-wrap.h @@ -0,0 +1,8 @@ +#ifndef _GCC_WRAP_STDINT_H +#if __STDC_HOSTED__ +# include_next <stdint.h> +#else +# include "stdint-gcc.h" +#endif +#define _GCC_WRAP_STDINT_H +#endif diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 132d026..c845ed9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2009-03-31 Joseph Myers <joseph@codesourcery.com> + + PR c/448 + * lib/target-supports.exp (check_effective_target_stdint_types): + Update comment. + (check_effective_target_inttypes_types): New. + * gcc.dg/c99-stdint-1.c, gcc.dg/c99-stdint-2.c, + gcc.dg/c99-stdint-3.c, gcc.dg/c99-stdint-4.c, + gcc.dg/c99-stdint-5.c, gcc.dg/c99-stdint-6.c: New tests. + 2009-03-31 Paul Thomas <pault@gcc.gnu.org> PR fortran/38917 diff --git a/gcc/testsuite/gcc.dg/c99-stdint-1.c b/gcc/testsuite/gcc.dg/c99-stdint-1.c new file mode 100644 index 0000000..5dcac41 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-stdint-1.c @@ -0,0 +1,265 @@ +/* Verify that <stdint.h> is present and follows the C99 requirements. + If this test fails because of the header being missing on a + particular target, this indicates GCC has not been correctly + configured regarding what version of <stdint.h> to install or what + the <stdint.h> types are on that target. If GCC is wrapping a + system copy of the header and some tests fail because of bugs in + that copy, they should be fixed with fixincludes (and the bugs + reported to maintainer of that copy if still present in the latest + version). */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors -fhosted" } */ + +#include <limits.h> +#include <stdint.h> +/* This and the later SIG_ATOMIC_* tests should be appropriately + conditioned for any freestanding targets with no <signal.h>. */ +#include <signal.h> + +/* Note that some of these conditions assume two's complement and no + padding bits; GCC only supports two's complement, and no supported + target has padding bits in any integer type of the standard + widths. */ +#define CHECK_SIGNED(TYPE) \ + do { TYPE a; int b[(TYPE)-1 < 0 ? 1 : -1]; } while (0) +#define CHECK_UNSIGNED(TYPE) \ + do { TYPE a; int b[(TYPE)-1 < 0 ? -1 : 1]; } while (0) +#define CHECK_WIDTH_EQUALS(TYPE, WIDTH) \ + do { int a[sizeof(TYPE) * CHAR_BIT == (WIDTH) ? 1 : -1]; } while (0) +#define CHECK_WIDTH_AT_LEAST(TYPE, WIDTH) \ + do { int a[sizeof(TYPE) * CHAR_BIT >= (WIDTH) ? 1 : -1]; } while (0) +#define CHECK_WIDTH_ORDER(TYPE1, TYPE2) \ + do { int a[sizeof(TYPE2) >= sizeof(TYPE1) ? 1 : -1]; } while (0) +#define CHECK_EXPR_TYPE(TYPE, EXPR) \ + do { __typeof__(EXPR) a; __typeof__((TYPE)0 + 0) *b = &a; } while (0) +#define UNSIGNED_MAX_COND(TYPE, EXPR) \ + ((EXPR) == (TYPE)-1) +#define SIGNED_MIN_MAX_COND(TYPE, MIN, MAX) \ + ((MIN) == -(MAX)-1 \ + && ((MAX) & 1) \ + && ((((MAX) >> 1) + 1) >> (sizeof(TYPE) * CHAR_BIT - 2)) == 1) +#define MIN_MAX_COND(TYPE, MIN, MAX) \ + ((TYPE)-1 < 0 \ + ? SIGNED_MIN_MAX_COND(TYPE, (MIN), (MAX)) \ + : ((MIN) == 0 && UNSIGNED_MAX_COND(TYPE, (MAX)))) +#define CHECK_SIGNED_LIMITS(TYPE, MIN, MAX) \ + CHECK_SIGNED(TYPE); \ + CHECK_EXPR_TYPE(TYPE, (MIN)); \ + CHECK_EXPR_TYPE(TYPE, (MAX)); \ + do { int a[SIGNED_MIN_MAX_COND(TYPE, (MIN), (MAX)) ? 1 : -1]; } while (0) +#define CHECK_SIGNED_LIMITS_2(TYPE, MIN, MAX, MINBD, MAXBD) \ + CHECK_SIGNED(TYPE); \ + CHECK_EXPR_TYPE(TYPE, (MIN)); \ + CHECK_EXPR_TYPE(TYPE, (MAX)); \ + do { int a[(SIGNED_MIN_MAX_COND(TYPE, (MIN), (MAX)) \ + && (MIN) <= (MINBD) \ + && (MAX) >= (MAXBD)) ? 1 : -1]; } while (0) +#define CHECK_UNSIGNED_LIMITS(TYPE, MAX) \ + CHECK_UNSIGNED(TYPE); \ + CHECK_EXPR_TYPE(TYPE, (MAX)); \ + do { int a[UNSIGNED_MAX_COND(TYPE, (MAX)) ? 1 : -1]; } while (0) +#define CHECK_UNSIGNED_LIMITS_2(TYPE, MAX, MAXBD) \ + CHECK_UNSIGNED(TYPE); \ + CHECK_EXPR_TYPE(TYPE, (MAX)); \ + do { int a[(UNSIGNED_MAX_COND(TYPE, (MAX)) \ + && (MAX) >= (MAXBD)) ? 1 : -1]; } while (0) +#define CHECK_LIMITS_2(TYPE, MIN, MAX, SMINBD, SMAXBD, UMAXBD) \ + do { int a[(MIN_MAX_COND(TYPE, (MIN), (MAX)) \ + && ((TYPE)-1 < 0 \ + ? ((MIN) <= (SMINBD) && (MAX) >= (SMAXBD)) \ + : (MAX) >= (UMAXBD))) ? 1 : -1]; } while (0) +#define CHECK_CONSTS(TYPE, MACRO) \ + CHECK_EXPR_TYPE(TYPE, MACRO(01)); \ + CHECK_EXPR_TYPE(TYPE, MACRO(2)); \ + CHECK_EXPR_TYPE(TYPE, MACRO(0x3)); \ + do { int a[(MACRO(12) == 12 \ + && MACRO(012) == 012 \ + && MACRO(0x12) == 0x12) ? 1 : -1]; } while (0); + +void +test_exact (void) +{ +#ifdef INT8_MIN + CHECK_WIDTH_EQUALS(int8_t, 8); + CHECK_SIGNED_LIMITS(int8_t, INT8_MIN, INT8_MAX); +#else + CHECK_WIDTH_AT_LEAST(int_least8_t, 9); +#endif +#ifdef INT16_MIN + CHECK_WIDTH_EQUALS(int16_t, 16); + CHECK_SIGNED_LIMITS(int16_t, INT16_MIN, INT16_MAX); +#else + CHECK_WIDTH_AT_LEAST(int_least8_t, 17); +#endif +#ifdef INT32_MIN + CHECK_WIDTH_EQUALS(int32_t, 32); + CHECK_SIGNED_LIMITS(int32_t, INT32_MIN, INT32_MAX); +#else + CHECK_WIDTH_AT_LEAST(int_least8_t, 33); +#endif +#ifdef INT64_MIN + CHECK_WIDTH_EQUALS(int64_t, 64); + CHECK_SIGNED_LIMITS(int64_t, INT64_MIN, INT64_MAX); +#else + CHECK_WIDTH_AT_LEAST(int_least8_t, 65); +#endif +#ifdef UINT8_MAX + CHECK_WIDTH_EQUALS(uint8_t, 8); + CHECK_UNSIGNED_LIMITS(uint8_t, UINT8_MAX); +#else + CHECK_WIDTH_AT_LEAST(uint_least8_t, 9); +#endif +#ifdef UINT16_MAX + CHECK_WIDTH_EQUALS(uint16_t, 16); + CHECK_UNSIGNED_LIMITS(uint16_t, UINT16_MAX); +#else + CHECK_WIDTH_AT_LEAST(uint_least8_t, 17); +#endif +#ifdef UINT32_MAX + CHECK_WIDTH_EQUALS(uint32_t, 32); + CHECK_UNSIGNED_LIMITS(uint32_t, UINT32_MAX); +#else + CHECK_WIDTH_AT_LEAST(uint_least8_t, 33); +#endif +#ifdef UINT64_MAX + CHECK_WIDTH_EQUALS(uint64_t, 64); + CHECK_UNSIGNED_LIMITS(uint64_t, UINT64_MAX); +#else + CHECK_WIDTH_AT_LEAST(uint_least8_t, 65); +#endif +} + +void +test_least (void) +{ + CHECK_WIDTH_AT_LEAST(int_least8_t, 8); + CHECK_WIDTH_ORDER(int_least8_t, int_fast8_t); + CHECK_SIGNED_LIMITS(int_least8_t, INT_LEAST8_MIN, INT_LEAST8_MAX); + CHECK_WIDTH_AT_LEAST(int_least16_t, 16); + CHECK_WIDTH_ORDER(int_least16_t, int_fast16_t); + CHECK_SIGNED_LIMITS(int_least16_t, INT_LEAST16_MIN, INT_LEAST16_MAX); + CHECK_WIDTH_AT_LEAST(int_least32_t, 32); + CHECK_WIDTH_ORDER(int_least32_t, int_fast32_t); + CHECK_SIGNED_LIMITS(int_least32_t, INT_LEAST32_MIN, INT_LEAST32_MAX); + CHECK_WIDTH_AT_LEAST(int_least64_t, 64); + CHECK_WIDTH_ORDER(int_least64_t, int_fast64_t); + CHECK_SIGNED_LIMITS(int_least64_t, INT_LEAST64_MIN, INT_LEAST64_MAX); + CHECK_WIDTH_AT_LEAST(uint_least8_t, 8); + CHECK_WIDTH_ORDER(uint_least8_t, uint_fast8_t); + CHECK_UNSIGNED_LIMITS(uint_least8_t, UINT_LEAST8_MAX); + CHECK_WIDTH_AT_LEAST(uint_least16_t, 16); + CHECK_WIDTH_ORDER(uint_least16_t, uint_fast16_t); + CHECK_UNSIGNED_LIMITS(uint_least16_t, UINT_LEAST16_MAX); + CHECK_WIDTH_AT_LEAST(uint_least32_t, 32); + CHECK_WIDTH_ORDER(uint_least32_t, uint_fast32_t); + CHECK_UNSIGNED_LIMITS(uint_least32_t, UINT_LEAST32_MAX); + CHECK_WIDTH_AT_LEAST(uint_least64_t, 64); + CHECK_WIDTH_ORDER(uint_least64_t, uint_fast64_t); + CHECK_UNSIGNED_LIMITS(uint_least64_t, UINT_LEAST64_MAX); +} + +void +test_fast (void) +{ + CHECK_WIDTH_AT_LEAST(int_fast8_t, 8); + CHECK_SIGNED_LIMITS(int_fast8_t, INT_FAST8_MIN, INT_FAST8_MAX); + CHECK_WIDTH_AT_LEAST(int_fast16_t, 16); + CHECK_SIGNED_LIMITS(int_fast16_t, INT_FAST16_MIN, INT_FAST16_MAX); + CHECK_WIDTH_AT_LEAST(int_fast32_t, 32); + CHECK_SIGNED_LIMITS(int_fast32_t, INT_FAST32_MIN, INT_FAST32_MAX); + CHECK_WIDTH_AT_LEAST(int_fast64_t, 64); + CHECK_SIGNED_LIMITS(int_fast64_t, INT_FAST64_MIN, INT_FAST64_MAX); + CHECK_WIDTH_AT_LEAST(uint_fast8_t, 8); + CHECK_UNSIGNED_LIMITS(uint_fast8_t, UINT_FAST8_MAX); + CHECK_WIDTH_AT_LEAST(uint_fast16_t, 16); + CHECK_UNSIGNED_LIMITS(uint_fast16_t, UINT_FAST16_MAX); + CHECK_WIDTH_AT_LEAST(uint_fast32_t, 32); + CHECK_UNSIGNED_LIMITS(uint_fast32_t, UINT_FAST32_MAX); + CHECK_WIDTH_AT_LEAST(uint_fast64_t, 64); + CHECK_UNSIGNED_LIMITS(uint_fast64_t, UINT_FAST64_MAX); +} + +void +test_ptr (void) +{ +#ifdef INTPTR_MIN + CHECK_SIGNED_LIMITS_2(intptr_t, INTPTR_MIN, INTPTR_MAX, -0x7fff, 0x7fff); +#endif +#ifdef UINTPTR_MAX + CHECK_UNSIGNED_LIMITS_2(uintptr_t, UINTPTR_MAX, 0xffffU); +#endif +} + +void +test_max (void) +{ + CHECK_WIDTH_AT_LEAST(intmax_t, 64); + CHECK_WIDTH_ORDER(long long, intmax_t); + CHECK_WIDTH_ORDER(int_fast8_t, intmax_t); + CHECK_WIDTH_ORDER(int_fast16_t, intmax_t); + CHECK_WIDTH_ORDER(int_fast32_t, intmax_t); + CHECK_WIDTH_ORDER(int_fast64_t, intmax_t); + CHECK_SIGNED_LIMITS(intmax_t, INTMAX_MIN, INTMAX_MAX); + CHECK_WIDTH_AT_LEAST(uintmax_t, 64); + CHECK_WIDTH_ORDER(unsigned long long, uintmax_t); + CHECK_WIDTH_ORDER(uint_fast8_t, uintmax_t); + CHECK_WIDTH_ORDER(uint_fast16_t, uintmax_t); + CHECK_WIDTH_ORDER(uint_fast32_t, uintmax_t); + CHECK_WIDTH_ORDER(uint_fast64_t, uintmax_t); + CHECK_UNSIGNED_LIMITS(uintmax_t, UINTMAX_MAX); +} + +void +test_misc_limits (void) +{ + CHECK_SIGNED_LIMITS_2(__PTRDIFF_TYPE__, PTRDIFF_MIN, PTRDIFF_MAX, -65535L, 65535L); + CHECK_LIMITS_2(sig_atomic_t, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX, -127, 127, 255); + CHECK_UNSIGNED_LIMITS_2(__SIZE_TYPE__, SIZE_MAX, 65535U); + CHECK_LIMITS_2(__WCHAR_TYPE__, WCHAR_MIN, WCHAR_MAX, -127, 127, 255); + CHECK_LIMITS_2(__WINT_TYPE__, WINT_MIN, WINT_MAX, -32767, 32767, 65535); +} + +void +test_constants (void) +{ + CHECK_CONSTS(int_least8_t, INT8_C); + CHECK_CONSTS(int_least16_t, INT16_C); + CHECK_CONSTS(int_least32_t, INT32_C); + CHECK_CONSTS(int_least64_t, INT64_C); + CHECK_CONSTS(intmax_t, INTMAX_C); + CHECK_CONSTS(uint_least8_t, UINT8_C); + CHECK_CONSTS(uint_least16_t, UINT16_C); + CHECK_CONSTS(uint_least32_t, UINT32_C); + CHECK_CONSTS(uint_least64_t, UINT64_C); + CHECK_CONSTS(uintmax_t, UINTMAX_C); +#if INT8_C(12) != 12 +#error "INT8_C not usable in #if" +#endif +#if INT16_C(12) != 12 +#error "INT16_C not usable in #if" +#endif +#if INT32_C(12) != 12 +#error "INT32_C not usable in #if" +#endif +#if INT64_C(12) != 12 +#error "INT64_C not usable in #if" +#endif +#if INTMAX_C(12) != 12 +#error "INTMAX_C not usable in #if" +#endif +#if UINT8_C(12) != 12 +#error "UINT8_C not usable in #if" +#endif +#if UINT16_C(12) != 12 +#error "UINT16_C not usable in #if" +#endif +#if UINT32_C(12) != 12 +#error "UINT32_C not usable in #if" +#endif +#if UINT64_C(12) != 12 +#error "UINT64_C not usable in #if" +#endif +#if UINTMAX_C(12) != 12 +#error "UINTMAX_C not usable in #if" +#endif +} diff --git a/gcc/testsuite/gcc.dg/c99-stdint-2.c b/gcc/testsuite/gcc.dg/c99-stdint-2.c new file mode 100644 index 0000000..0187b03 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-stdint-2.c @@ -0,0 +1,8 @@ +/* Verify that <stdint.h> is present and follows the C99 requirements. + Freestanding version. */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors -ffreestanding" } */ + +/* The test is that there are no diagnostics, so just include the + hosted version. */ +#include "c99-stdint-1.c" diff --git a/gcc/testsuite/gcc.dg/c99-stdint-3.c b/gcc/testsuite/gcc.dg/c99-stdint-3.c new file mode 100644 index 0000000..c42ac8b --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-stdint-3.c @@ -0,0 +1,39 @@ +/* Verify that pairs of types in <stdint.h> are corresponding types + (requires no pointer sign warnings, so separate from + c99-stdint-1.c). */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -fhosted" } */ + +#include <stdint.h> + +#define CHECK_CORRESPONDING(TYPE1, TYPE2) \ + do { TYPE1 a; TYPE2 *b = &a; TYPE2 c; TYPE1 *d = &c; } while (0) + +void +check_corresponding (void) +{ +#if defined(INT8_MAX) && defined(UINT8_MAX) + CHECK_CORRESPONDING(int8_t, uint8_t); +#endif +#if defined(INT16_MAX) && defined(UINT16_MAX) + CHECK_CORRESPONDING(int16_t, uint16_t); +#endif +#if defined(INT32_MAX) && defined(UINT32_MAX) + CHECK_CORRESPONDING(int32_t, uint32_t); +#endif +#if defined(INT64_MAX) && defined(UINT64_MAX) + CHECK_CORRESPONDING(int64_t, uint64_t); +#endif + CHECK_CORRESPONDING(int_least8_t, uint_least8_t); + CHECK_CORRESPONDING(int_least16_t, uint_least16_t); + CHECK_CORRESPONDING(int_least32_t, uint_least32_t); + CHECK_CORRESPONDING(int_least64_t, uint_least64_t); + CHECK_CORRESPONDING(int_fast8_t, uint_fast8_t); + CHECK_CORRESPONDING(int_fast16_t, uint_fast16_t); + CHECK_CORRESPONDING(int_fast32_t, uint_fast32_t); + CHECK_CORRESPONDING(int_fast64_t, uint_fast64_t); +#if defined(INTPTR_MAX) && defined(UINTPTR_MAX) + CHECK_CORRESPONDING(intptr_t, uintptr_t); +#endif + CHECK_CORRESPONDING(intmax_t, uintmax_t); +} diff --git a/gcc/testsuite/gcc.dg/c99-stdint-4.c b/gcc/testsuite/gcc.dg/c99-stdint-4.c new file mode 100644 index 0000000..469df8c --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-stdint-4.c @@ -0,0 +1,8 @@ +/* Verify that pairs of types in <stdint.h> are corresponding types. + Freestanding version. */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -ffreestanding" } */ + +/* The test is that there are no diagnostics, so just include the + hosted version. */ +#include "c99-stdint-3.c" diff --git a/gcc/testsuite/gcc.dg/c99-stdint-5.c b/gcc/testsuite/gcc.dg/c99-stdint-5.c new file mode 100644 index 0000000..da2f356 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-stdint-5.c @@ -0,0 +1,65 @@ +/* Verify that GCC's internal notions of types in <stdint.h> agree + with any system header (which GCC will use by default for hosted + compilations). */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +#include <stdint.h> +#include <signal.h> + +#define CHECK_TYPES(TYPE1, TYPE2) \ + do { TYPE1 a; TYPE2 *b = &a; TYPE2 c; TYPE1 *d = &c; } while (0) + +void +check_types (void) +{ +#ifdef __INT8_TYPE__ + CHECK_TYPES(__INT8_TYPE__, int8_t); +#endif +#ifdef __INT16_TYPE__ + CHECK_TYPES(__INT16_TYPE__, int16_t); +#endif +#ifdef __INT32_TYPE__ + CHECK_TYPES(__INT32_TYPE__, int32_t); +#endif +#ifdef __INT64_TYPE__ + CHECK_TYPES(__INT64_TYPE__, int64_t); +#endif +#ifdef __UINT8_TYPE__ + CHECK_TYPES(__UINT8_TYPE__, uint8_t); +#endif +#ifdef __UINT16_TYPE__ + CHECK_TYPES(__UINT16_TYPE__, uint16_t); +#endif +#ifdef __UINT32_TYPE__ + CHECK_TYPES(__UINT32_TYPE__, uint32_t); +#endif +#ifdef __UINT64_TYPE__ + CHECK_TYPES(__UINT64_TYPE__, uint64_t); +#endif + CHECK_TYPES(__INT_LEAST8_TYPE__, int_least8_t); + CHECK_TYPES(__INT_LEAST16_TYPE__, int_least16_t); + CHECK_TYPES(__INT_LEAST32_TYPE__, int_least32_t); + CHECK_TYPES(__INT_LEAST64_TYPE__, int_least64_t); + CHECK_TYPES(__UINT_LEAST8_TYPE__, uint_least8_t); + CHECK_TYPES(__UINT_LEAST16_TYPE__, uint_least16_t); + CHECK_TYPES(__UINT_LEAST32_TYPE__, uint_least32_t); + CHECK_TYPES(__UINT_LEAST64_TYPE__, uint_least64_t); + CHECK_TYPES(__INT_FAST8_TYPE__, int_fast8_t); + CHECK_TYPES(__INT_FAST16_TYPE__, int_fast16_t); + CHECK_TYPES(__INT_FAST32_TYPE__, int_fast32_t); + CHECK_TYPES(__INT_FAST64_TYPE__, int_fast64_t); + CHECK_TYPES(__UINT_FAST8_TYPE__, uint_fast8_t); + CHECK_TYPES(__UINT_FAST16_TYPE__, uint_fast16_t); + CHECK_TYPES(__UINT_FAST32_TYPE__, uint_fast32_t); + CHECK_TYPES(__UINT_FAST64_TYPE__, uint_fast64_t); +#ifdef __INTPTR_TYPE__ + CHECK_TYPES(__INTPTR_TYPE__, intptr_t); +#endif +#ifdef __UINTPTR_TYPE__ + CHECK_TYPES(__UINTPTR_TYPE__, uintptr_t); +#endif + CHECK_TYPES(__INTMAX_TYPE__, intmax_t); + CHECK_TYPES(__UINTMAX_TYPE__, uintmax_t); + CHECK_TYPES(__SIG_ATOMIC_TYPE__, sig_atomic_t); +} diff --git a/gcc/testsuite/gcc.dg/c99-stdint-6.c b/gcc/testsuite/gcc.dg/c99-stdint-6.c new file mode 100644 index 0000000..5007f54 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-stdint-6.c @@ -0,0 +1,67 @@ +/* Verify that GCC's internal notions of types in <stdint.h> agree + with any system <inttypes.h> header. */ +/* { dg-do compile { target inttypes_types } } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ +/* { dg-options "-std=gnu99 -pedantic-errors -DNO_FAST_TYPES" { target *-*-solaris2.[789]* } } */ + +#include <inttypes.h> +#include <signal.h> + +#define CHECK_TYPES(TYPE1, TYPE2) \ + do { TYPE1 a; TYPE2 *b = &a; TYPE2 c; TYPE1 *d = &c; } while (0) + +void +check_types (void) +{ +#ifdef __INT8_TYPE__ + CHECK_TYPES(__INT8_TYPE__, int8_t); +#endif +#ifdef __INT16_TYPE__ + CHECK_TYPES(__INT16_TYPE__, int16_t); +#endif +#ifdef __INT32_TYPE__ + CHECK_TYPES(__INT32_TYPE__, int32_t); +#endif +#ifdef __INT64_TYPE__ + CHECK_TYPES(__INT64_TYPE__, int64_t); +#endif +#ifdef __UINT8_TYPE__ + CHECK_TYPES(__UINT8_TYPE__, uint8_t); +#endif +#ifdef __UINT16_TYPE__ + CHECK_TYPES(__UINT16_TYPE__, uint16_t); +#endif +#ifdef __UINT32_TYPE__ + CHECK_TYPES(__UINT32_TYPE__, uint32_t); +#endif +#ifdef __UINT64_TYPE__ + CHECK_TYPES(__UINT64_TYPE__, uint64_t); +#endif + CHECK_TYPES(__INT_LEAST8_TYPE__, int_least8_t); + CHECK_TYPES(__INT_LEAST16_TYPE__, int_least16_t); + CHECK_TYPES(__INT_LEAST32_TYPE__, int_least32_t); + CHECK_TYPES(__INT_LEAST64_TYPE__, int_least64_t); + CHECK_TYPES(__UINT_LEAST8_TYPE__, uint_least8_t); + CHECK_TYPES(__UINT_LEAST16_TYPE__, uint_least16_t); + CHECK_TYPES(__UINT_LEAST32_TYPE__, uint_least32_t); + CHECK_TYPES(__UINT_LEAST64_TYPE__, uint_least64_t); +#ifndef NO_FAST_TYPES + CHECK_TYPES(__INT_FAST8_TYPE__, int_fast8_t); + CHECK_TYPES(__INT_FAST16_TYPE__, int_fast16_t); + CHECK_TYPES(__INT_FAST32_TYPE__, int_fast32_t); + CHECK_TYPES(__INT_FAST64_TYPE__, int_fast64_t); + CHECK_TYPES(__UINT_FAST8_TYPE__, uint_fast8_t); + CHECK_TYPES(__UINT_FAST16_TYPE__, uint_fast16_t); + CHECK_TYPES(__UINT_FAST32_TYPE__, uint_fast32_t); + CHECK_TYPES(__UINT_FAST64_TYPE__, uint_fast64_t); +#endif +#ifdef __INTPTR_TYPE__ + CHECK_TYPES(__INTPTR_TYPE__, intptr_t); +#endif +#ifdef __UINTPTR_TYPE__ + CHECK_TYPES(__UINTPTR_TYPE__, uintptr_t); +#endif + CHECK_TYPES(__INTMAX_TYPE__, intmax_t); + CHECK_TYPES(__UINTMAX_TYPE__, uintmax_t); + CHECK_TYPES(__SIG_ATOMIC_TYPE__, sig_atomic_t); +} diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 115f992..884e743d 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2620,7 +2620,8 @@ proc check_effective_target_string_merging { } { } # Return 1 if target has the basic signed and unsigned types in -# <stdint.h>, 0 otherwise. +# <stdint.h>, 0 otherwise. This will be obsolete when GCC ensures a +# working <stdint.h> for all targets. proc check_effective_target_stdint_types { } { return [check_no_compiler_messages stdint_types assembly { @@ -2630,6 +2631,19 @@ proc check_effective_target_stdint_types { } { }] } +# Return 1 if target has the basic signed and unsigned types in +# <inttypes.h>, 0 otherwise. This is for tests that GCC's notions of +# these types agree with those in the header, as some systems have +# only <inttypes.h>. + +proc check_effective_target_inttypes_types { } { + return [check_no_compiler_messages inttypes_types assembly { + #include <inttypes.h> + int8_t a; int16_t b; int32_t c; int64_t d; + uint8_t e; uint16_t f; uint32_t g; uint64_t h; + }] +} + # Return 1 if programs are intended to be run on a simulator # (i.e. slowly) rather than hardware (i.e. fast). |