*/
#define __stdint_join3(a,b,c) a ## b ## c
-#define __intn_t(n) __stdint_join3( int, n, _t)
-#define __uintn_t(n) __stdint_join3(uint, n, _t)
-
#ifndef _INTPTR_T
#ifndef __intptr_t_defined
-typedef __intn_t(__INTPTR_WIDTH__) intptr_t;
+typedef __INTPTR_TYPE__ intptr_t;
#define __intptr_t_defined
#define _INTPTR_T
#endif
#endif
#ifndef _UINTPTR_T
-typedef __uintn_t(__INTPTR_WIDTH__) uintptr_t;
+typedef __UINTPTR_TYPE__ uintptr_t;
#define _UINTPTR_T
#endif
/* C99 7.18.2.4 Limits of integer types capable of holding object pointers. */
/* C99 7.18.3 Limits of other integer types. */
-#define INTPTR_MIN __INTN_MIN(__INTPTR_WIDTH__)
-#define INTPTR_MAX __INTN_MAX(__INTPTR_WIDTH__)
-#define UINTPTR_MAX __UINTN_MAX(__INTPTR_WIDTH__)
-#define PTRDIFF_MIN __INTN_MIN(__PTRDIFF_WIDTH__)
-#define PTRDIFF_MAX __INTN_MAX(__PTRDIFF_WIDTH__)
-#define SIZE_MAX __UINTN_MAX(__SIZE_WIDTH__)
+#define INTPTR_MIN (-__INTPTR_MAX__-1)
+#define INTPTR_MAX __INTPTR_MAX__
+#define UINTPTR_MAX __UINTPTR_MAX__
+#define PTRDIFF_MIN (-__PTRDIFF_MAX__-1)
+#define PTRDIFF_MAX __PTRDIFF_MAX__
+#define SIZE_MAX __SIZE_MAX__
/* ISO9899:2011 7.20 (C11 Annex K): Define RSIZE_MAX if __STDC_WANT_LIB_EXT1__
* is enabled. */
#endif
/* C99 7.18.2.5 Limits of greatest-width integer types. */
-#define INTMAX_MIN __INTN_MIN(__INTMAX_WIDTH__)
-#define INTMAX_MAX __INTN_MAX(__INTMAX_WIDTH__)
-#define UINTMAX_MAX __UINTN_MAX(__INTMAX_WIDTH__)
+#define INTMAX_MIN (-__INTMAX_MAX__-1)
+#define INTMAX_MAX __INTMAX_MAX__
+#define UINTMAX_MAX __UINTMAX_MAX__
/* C99 7.18.3 Limits of other integer types. */
#define SIG_ATOMIC_MIN __INTN_MIN(__SIG_ATOMIC_WIDTH__)
#endif
/* 7.18.4.2 Macros for greatest-width integer constants. */
-#define INTMAX_C(v) __INTN_C(__INTMAX_WIDTH__, v)
-#define UINTMAX_C(v) __UINTN_C(__INTMAX_WIDTH__, v)
+#define INTMAX_C(v) __int_c(v, __INTMAX_C_SUFFIX__)
+#define UINTMAX_C(v) __int_c(v, __UINTMAX_C_SUFFIX__)
#endif /* __STDC_HOSTED__ */
#endif /* __CLANG_STDINT_H */
--- /dev/null
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=aarch64-none-none
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=arm-none-none
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=i386-none-none
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=mips-none-none
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=mips64-none-none
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=msp430-none-none
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=powerpc64-none-none
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=powerpc64-none-netbsd
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=powerpc-none-none
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=s390x-none-none
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=sparc-none-none
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=tce-none-none
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=x86_64-none-none
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=x86_64-pc-linux-gnu
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=i386-mingw32
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only -triple=xcore-none-none
+// RUN: %clang_cc1 %s -ffreestanding -std=c++1z -fsyntax-only
+
+#include <stdint.h>
+#include <stddef.h>
+
+static_assert(__is_same(__typeof__(INTPTR_MIN), intptr_t));
+static_assert(__is_same(__typeof__(INTPTR_MAX), intptr_t));
+static_assert(__is_same(__typeof__(UINTPTR_MAX), uintptr_t));
+static_assert(__is_same(__typeof__(PTRDIFF_MIN), ptrdiff_t));
+static_assert(__is_same(__typeof__(PTRDIFF_MAX), ptrdiff_t));
+static_assert(__is_same(__typeof__(SIZE_MAX), size_t));
+static_assert(__is_same(__typeof__(INTMAX_MIN), intmax_t));
+static_assert(__is_same(__typeof__(INTMAX_MAX), intmax_t));
+static_assert(__is_same(__typeof__(UINTMAX_MAX), uintmax_t));
+static_assert(__is_same(__typeof__(INTMAX_C(5)), intmax_t));
+static_assert(__is_same(__typeof__(UINTMAX_C(5)), uintmax_t));
// ARM:typedef int8_t int_fast8_t;
// ARM:typedef uint8_t uint_fast8_t;
//
-// ARM:typedef int32_t intptr_t;
-// ARM:typedef uint32_t uintptr_t;
+// ARM:typedef long int intptr_t;
+// ARM:typedef long unsigned int uintptr_t;
//
// ARM:typedef long long int intmax_t;
// ARM:typedef long long unsigned int uintmax_t;
// ARM:INT_FAST64_MAX_ 9223372036854775807LL
// ARM:UINT_FAST64_MAX_ 18446744073709551615ULL
//
-// ARM:INTPTR_MIN_ (-2147483647 -1)
-// ARM:INTPTR_MAX_ 2147483647
-// ARM:UINTPTR_MAX_ 4294967295U
+// ARM:INTPTR_MIN_ (-2147483647L -1)
+// ARM:INTPTR_MAX_ 2147483647L
+// ARM:UINTPTR_MAX_ 4294967295UL
// ARM:PTRDIFF_MIN_ (-2147483647 -1)
// ARM:PTRDIFF_MAX_ 2147483647
// ARM:SIZE_MAX_ 4294967295U
// I386:typedef int8_t int_fast8_t;
// I386:typedef uint8_t uint_fast8_t;
//
-// I386:typedef int32_t intptr_t;
-// I386:typedef uint32_t uintptr_t;
+// I386:typedef int intptr_t;
+// I386:typedef unsigned int uintptr_t;
//
// I386:typedef long long int intmax_t;
// I386:typedef long long unsigned int uintmax_t;
// MIPS:typedef int8_t int_fast8_t;
// MIPS:typedef uint8_t uint_fast8_t;
//
-// MIPS:typedef int32_t intptr_t;
-// MIPS:typedef uint32_t uintptr_t;
+// MIPS:typedef long int intptr_t;
+// MIPS:typedef long unsigned int uintptr_t;
//
// MIPS:typedef long long int intmax_t;
// MIPS:typedef long long unsigned int uintmax_t;
// MIPS:INT_FAST64_MAX_ 9223372036854775807LL
// MIPS:UINT_FAST64_MAX_ 18446744073709551615ULL
//
-// MIPS:INTPTR_MIN_ (-2147483647 -1)
-// MIPS:INTPTR_MAX_ 2147483647
-// MIPS:UINTPTR_MAX_ 4294967295U
+// MIPS:INTPTR_MIN_ (-2147483647L -1)
+// MIPS:INTPTR_MAX_ 2147483647L
+// MIPS:UINTPTR_MAX_ 4294967295UL
// MIPS:PTRDIFF_MIN_ (-2147483647 -1)
// MIPS:PTRDIFF_MAX_ 2147483647
// MIPS:SIZE_MAX_ 4294967295U
// MIPS64:typedef int8_t int_fast8_t;
// MIPS64:typedef uint8_t uint_fast8_t;
//
-// MIPS64:typedef int64_t intptr_t;
-// MIPS64:typedef uint64_t uintptr_t;
+// MIPS64:typedef long int intptr_t;
+// MIPS64:typedef long unsigned int uintptr_t;
//
// MIPS64:typedef long int intmax_t;
// MIPS64:typedef long unsigned int uintmax_t;
// MSP430:typedef int8_t int_fast8_t;
// MSP430:typedef uint8_t uint_fast8_t;
//
-// MSP430:typedef int16_t intptr_t;
-// MSP430:typedef uint16_t uintptr_t;
+// MSP430:typedef int intptr_t;
+// MSP430:typedef unsigned int uintptr_t;
//
// MSP430:typedef long long int intmax_t;
// MSP430:typedef long long unsigned int uintmax_t;
// PPC64:typedef int8_t int_fast8_t;
// PPC64:typedef uint8_t uint_fast8_t;
//
-// PPC64:typedef int64_t intptr_t;
-// PPC64:typedef uint64_t uintptr_t;
+// PPC64:typedef long int intptr_t;
+// PPC64:typedef long unsigned int uintptr_t;
//
// PPC64:typedef long int intmax_t;
// PPC64:typedef long unsigned int uintmax_t;
// PPC64-NETBSD:typedef int8_t int_fast8_t;
// PPC64-NETBSD:typedef uint8_t uint_fast8_t;
//
-// PPC64-NETBSD:typedef int64_t intptr_t;
-// PPC64-NETBSD:typedef uint64_t uintptr_t;
+// PPC64-NETBSD:typedef long int intptr_t;
+// PPC64-NETBSD:typedef long unsigned int uintptr_t;
//
// PPC64-NETBSD:typedef long long int intmax_t;
// PPC64-NETBSD:typedef long long unsigned int uintmax_t;
// PPC64-NETBSD:INT_FAST64_MAX_ 9223372036854775807LL
// PPC64-NETBSD:UINT_FAST64_MAX_ 18446744073709551615ULL
//
-// PPC64-NETBSD:INTPTR_MIN_ (-9223372036854775807LL -1)
-// PPC64-NETBSD:INTPTR_MAX_ 9223372036854775807LL
-// PPC64-NETBSD:UINTPTR_MAX_ 18446744073709551615ULL
-// PPC64-NETBSD:PTRDIFF_MIN_ (-9223372036854775807LL -1)
-// PPC64-NETBSD:PTRDIFF_MAX_ 9223372036854775807LL
-// PPC64-NETBSD:SIZE_MAX_ 18446744073709551615ULL
+// PPC64-NETBSD:INTPTR_MIN_ (-9223372036854775807L -1)
+// PPC64-NETBSD:INTPTR_MAX_ 9223372036854775807L
+// PPC64-NETBSD:UINTPTR_MAX_ 18446744073709551615UL
+// PPC64-NETBSD:PTRDIFF_MIN_ (-9223372036854775807L -1)
+// PPC64-NETBSD:PTRDIFF_MAX_ 9223372036854775807L
+// PPC64-NETBSD:SIZE_MAX_ 18446744073709551615UL
//
// PPC64-NETBSD:INTMAX_MIN_ (-9223372036854775807LL -1)
// PPC64-NETBSD:INTMAX_MAX_ 9223372036854775807LL
// PPC:typedef int8_t int_fast8_t;
// PPC:typedef uint8_t uint_fast8_t;
//
-// PPC:typedef int32_t intptr_t;
-// PPC:typedef uint32_t uintptr_t;
+// PPC:typedef long int intptr_t;
+// PPC:typedef long unsigned int uintptr_t;
//
// PPC:typedef long long int intmax_t;
// PPC:typedef long long unsigned int uintmax_t;
// PPC:INT_FAST64_MAX_ 9223372036854775807LL
// PPC:UINT_FAST64_MAX_ 18446744073709551615ULL
//
-// PPC:INTPTR_MIN_ (-2147483647 -1)
-// PPC:INTPTR_MAX_ 2147483647
-// PPC:UINTPTR_MAX_ 4294967295U
-// PPC:PTRDIFF_MIN_ (-2147483647 -1)
-// PPC:PTRDIFF_MAX_ 2147483647
-// PPC:SIZE_MAX_ 4294967295U
+// PPC:INTPTR_MIN_ (-2147483647L -1)
+// PPC:INTPTR_MAX_ 2147483647L
+// PPC:UINTPTR_MAX_ 4294967295UL
+// PPC:PTRDIFF_MIN_ (-2147483647L -1)
+// PPC:PTRDIFF_MAX_ 2147483647L
+// PPC:SIZE_MAX_ 4294967295UL
//
// PPC:INTMAX_MIN_ (-9223372036854775807LL -1)
// PPC:INTMAX_MAX_ 9223372036854775807LL
// S390X:typedef int8_t int_fast8_t;
// S390X:typedef uint8_t uint_fast8_t;
//
-// S390X:typedef int64_t intptr_t;
-// S390X:typedef uint64_t uintptr_t;
+// S390X:typedef long int intptr_t;
+// S390X:typedef long unsigned int uintptr_t;
//
// S390X:typedef long int intmax_t;
// S390X:typedef long unsigned int uintmax_t;
// SPARC:typedef int8_t int_fast8_t;
// SPARC:typedef uint8_t uint_fast8_t;
//
-// SPARC:typedef int32_t intptr_t;
-// SPARC:typedef uint32_t uintptr_t;
+// SPARC:typedef int intptr_t;
+// SPARC:typedef unsigned int uintptr_t;
//
// SPARC:typedef long long int intmax_t;
// SPARC:typedef long long unsigned int uintmax_t;
// TCE:typedef int8_t int_fast8_t;
// TCE:typedef uint8_t uint_fast8_t;
//
-// TCE:typedef int32_t intptr_t;
-// TCE:typedef uint32_t uintptr_t;
+// TCE:typedef int intptr_t;
+// TCE:typedef unsigned int uintptr_t;
//
// TCE:typedef long int intmax_t;
// TCE:typedef long unsigned int uintmax_t;
// TCE:PTRDIFF_MAX_ 2147483647
// TCE:SIZE_MAX_ 4294967295U
//
-// TCE:INTMAX_MIN_ (-2147483647 -1)
-// TCE:INTMAX_MAX_ 2147483647
-// TCE:UINTMAX_MAX_ 4294967295U
+// TCE:INTMAX_MIN_ (-2147483647L -1)
+// TCE:INTMAX_MAX_ 2147483647L
+// TCE:UINTMAX_MAX_ 4294967295UL
//
// TCE:SIG_ATOMIC_MIN_ (-2147483647 -1)
// TCE:SIG_ATOMIC_MAX_ 2147483647
// X86_64:typedef int8_t int_fast8_t;
// X86_64:typedef uint8_t uint_fast8_t;
//
-// X86_64:typedef int64_t intptr_t;
-// X86_64:typedef uint64_t uintptr_t;
+// X86_64:typedef long int intptr_t;
+// X86_64:typedef long unsigned int uintptr_t;
//
// X86_64:typedef long int intmax_t;
// X86_64:typedef long unsigned int uintmax_t;
// XCORE:typedef int8_t int_fast8_t;
// XCORE:typedef uint8_t uint_fast8_t;
//
-// XCORE:typedef int32_t intptr_t;
-// XCORE:typedef uint32_t uintptr_t;
+// XCORE:typedef int intptr_t;
+// XCORE:typedef unsigned int uintptr_t;
//
// XCORE:typedef long long int intmax_t;
// XCORE:typedef long long unsigned int uintmax_t;
// the identifiers used in the operations (int, uint, _t, INT, UINT, _MIN,
// _MAX, and _C(v)) are themselves macros.
//
-// RUN: %clang_cc1 -E -ffreestanding -U__UINTMAX_TYPE__ -U__INTMAX_TYPE__ -Dint=a -Duint=b -D_t=c -DINT=d -DUINT=e -D_MIN=f -D_MAX=g '-D_C(v)=h' -triple=i386-none-none %s | FileCheck -check-prefix JOIN %s
-// JOIN:typedef int32_t intptr_t;
-// JOIN:typedef uint32_t uintptr_t;
+// RUN: %clang_cc1 -E -ffreestanding \
+// RUN: -U__UINTPTR_TYPE__ -U__INTPTR_TYPE__ \
+// RUN: -U__UINTMAX_TYPE__ -U__INTMAX_TYPE__ \
+// RUN: -Dint=a -Duint=b -D_t=c -DINT=d -DUINT=e -D_MIN=f -D_MAX=g \
+// RUN: '-D_C(v)=h' -triple=i386-none-none %s \
+// RUN: | FileCheck -check-prefix JOIN %s
+// JOIN:typedef __INTPTR_TYPE__ intptr_t;
+// JOIN:typedef __UINTPTR_TYPE__ uintptr_t;
// JOIN:typedef __INTMAX_TYPE__ intmax_t;
// JOIN:typedef __UINTMAX_TYPE__ uintmax_t;
// JOIN:INTPTR_MIN_ (-2147483647 -1)