Author: compnerd Date: Tue Oct 17 17:00:50 2017 New Revision: 316046 URL: http://llvm.org/viewvc/llvm-project?rev=316046&view=rev Log: Basic: fix __{,U}INTPTR_TYPE__ on ARM
Darwin and OpenBSD are the only platforms which use `long int` for `__INTPTR_TYPE__`. The other platforms use `int` in 32-bit, and `long int` on 64-bit (except for VMS and Windows which are LLP64). Adjust the type definitions to match the platform definitions. We now generate the same definition as GCC on all the targets. Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp cfe/trunk/test/Preprocessor/init.c cfe/trunk/test/Preprocessor/stdint.c Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=316046&r1=316045&r2=316046&view=diff ============================================================================== --- cfe/trunk/lib/Basic/Targets/ARM.cpp (original) +++ cfe/trunk/lib/Basic/Targets/ARM.cpp Tue Oct 17 17:00:50 2017 @@ -236,6 +236,10 @@ ARMTargetInfo::ARMTargetInfo(const llvm: break; } + IntPtrType = (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::OpenBSD) + ? SignedLong + : SignedInt; + // Cache arch related info. setArchInfo(); @@ -923,7 +927,6 @@ WindowsARMTargetInfo::WindowsARMTargetIn const TargetOptions &Opts) : WindowsTargetInfo<ARMleTargetInfo>(Triple, Opts), Triple(Triple) { SizeType = UnsignedInt; - IntPtrType = SignedInt; } void WindowsARMTargetInfo::getVisualStudioDefines(const LangOptions &Opts, Modified: cfe/trunk/test/Preprocessor/init.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=316046&r1=316045&r2=316046&view=diff ============================================================================== --- cfe/trunk/test/Preprocessor/init.c (original) +++ cfe/trunk/test/Preprocessor/init.c Tue Oct 17 17:00:50 2017 @@ -1668,10 +1668,10 @@ // ARM:#define __INTMAX_MAX__ 9223372036854775807LL // ARM:#define __INTMAX_TYPE__ long long int // ARM:#define __INTMAX_WIDTH__ 64 -// ARM:#define __INTPTR_FMTd__ "ld" -// ARM:#define __INTPTR_FMTi__ "li" -// ARM:#define __INTPTR_MAX__ 2147483647L -// ARM:#define __INTPTR_TYPE__ long int +// ARM:#define __INTPTR_FMTd__ "d" +// ARM:#define __INTPTR_FMTi__ "i" +// ARM:#define __INTPTR_MAX__ 2147483647 +// ARM:#define __INTPTR_TYPE__ int // ARM:#define __INTPTR_WIDTH__ 32 // ARM:#define __INT_FAST16_FMTd__ "hd" // ARM:#define __INT_FAST16_FMTi__ "hi" @@ -1763,8 +1763,8 @@ // ARM:#define __UINTMAX_MAX__ 18446744073709551615ULL // ARM:#define __UINTMAX_TYPE__ long long unsigned int // ARM:#define __UINTMAX_WIDTH__ 64 -// ARM:#define __UINTPTR_MAX__ 4294967295UL -// ARM:#define __UINTPTR_TYPE__ long unsigned int +// ARM:#define __UINTPTR_MAX__ 4294967295U +// ARM:#define __UINTPTR_TYPE__ unsigned int // ARM:#define __UINTPTR_WIDTH__ 32 // ARM:#define __UINT_FAST16_MAX__ 65535 // ARM:#define __UINT_FAST16_TYPE__ unsigned short @@ -1860,10 +1860,10 @@ // ARM-BE:#define __INTMAX_MAX__ 9223372036854775807LL // ARM-BE:#define __INTMAX_TYPE__ long long int // ARM-BE:#define __INTMAX_WIDTH__ 64 -// ARM-BE:#define __INTPTR_FMTd__ "ld" -// ARM-BE:#define __INTPTR_FMTi__ "li" -// ARM-BE:#define __INTPTR_MAX__ 2147483647L -// ARM-BE:#define __INTPTR_TYPE__ long int +// ARM-BE:#define __INTPTR_FMTd__ "d" +// ARM-BE:#define __INTPTR_FMTi__ "i" +// ARM-BE:#define __INTPTR_MAX__ 2147483647 +// ARM-BE:#define __INTPTR_TYPE__ int // ARM-BE:#define __INTPTR_WIDTH__ 32 // ARM-BE:#define __INT_FAST16_FMTd__ "hd" // ARM-BE:#define __INT_FAST16_FMTi__ "hi" @@ -1953,8 +1953,8 @@ // ARM-BE:#define __UINTMAX_MAX__ 18446744073709551615ULL // ARM-BE:#define __UINTMAX_TYPE__ long long unsigned int // ARM-BE:#define __UINTMAX_WIDTH__ 64 -// ARM-BE:#define __UINTPTR_MAX__ 4294967295UL -// ARM-BE:#define __UINTPTR_TYPE__ long unsigned int +// ARM-BE:#define __UINTPTR_MAX__ 4294967295U +// ARM-BE:#define __UINTPTR_TYPE__ unsigned int // ARM-BE:#define __UINTPTR_WIDTH__ 32 // ARM-BE:#define __UINT_FAST16_MAX__ 65535 // ARM-BE:#define __UINT_FAST16_TYPE__ unsigned short @@ -2053,10 +2053,10 @@ // ARMEABISOFTFP:#define __INTMAX_MAX__ 9223372036854775807LL // ARMEABISOFTFP:#define __INTMAX_TYPE__ long long int // ARMEABISOFTFP:#define __INTMAX_WIDTH__ 64 -// ARMEABISOFTFP:#define __INTPTR_FMTd__ "ld" -// ARMEABISOFTFP:#define __INTPTR_FMTi__ "li" -// ARMEABISOFTFP:#define __INTPTR_MAX__ 2147483647L -// ARMEABISOFTFP:#define __INTPTR_TYPE__ long int +// ARMEABISOFTFP:#define __INTPTR_FMTd__ "d" +// ARMEABISOFTFP:#define __INTPTR_FMTi__ "i" +// ARMEABISOFTFP:#define __INTPTR_MAX__ 2147483647 +// ARMEABISOFTFP:#define __INTPTR_TYPE__ int // ARMEABISOFTFP:#define __INTPTR_WIDTH__ 32 // ARMEABISOFTFP:#define __INT_FAST16_FMTd__ "hd" // ARMEABISOFTFP:#define __INT_FAST16_FMTi__ "hi" @@ -2148,8 +2148,8 @@ // ARMEABISOFTFP:#define __UINTMAX_MAX__ 18446744073709551615ULL // ARMEABISOFTFP:#define __UINTMAX_TYPE__ long long unsigned int // ARMEABISOFTFP:#define __UINTMAX_WIDTH__ 64 -// ARMEABISOFTFP:#define __UINTPTR_MAX__ 4294967295UL -// ARMEABISOFTFP:#define __UINTPTR_TYPE__ long unsigned int +// ARMEABISOFTFP:#define __UINTPTR_MAX__ 4294967295U +// ARMEABISOFTFP:#define __UINTPTR_TYPE__ unsigned int // ARMEABISOFTFP:#define __UINTPTR_WIDTH__ 32 // ARMEABISOFTFP:#define __UINT_FAST16_MAX__ 65535 // ARMEABISOFTFP:#define __UINT_FAST16_TYPE__ unsigned short @@ -2248,10 +2248,10 @@ // ARMEABIHARDFP:#define __INTMAX_MAX__ 9223372036854775807LL // ARMEABIHARDFP:#define __INTMAX_TYPE__ long long int // ARMEABIHARDFP:#define __INTMAX_WIDTH__ 64 -// ARMEABIHARDFP:#define __INTPTR_FMTd__ "ld" -// ARMEABIHARDFP:#define __INTPTR_FMTi__ "li" -// ARMEABIHARDFP:#define __INTPTR_MAX__ 2147483647L -// ARMEABIHARDFP:#define __INTPTR_TYPE__ long int +// ARMEABIHARDFP:#define __INTPTR_FMTd__ "d" +// ARMEABIHARDFP:#define __INTPTR_FMTi__ "i" +// ARMEABIHARDFP:#define __INTPTR_MAX__ 2147483647 +// ARMEABIHARDFP:#define __INTPTR_TYPE__ int // ARMEABIHARDFP:#define __INTPTR_WIDTH__ 32 // ARMEABIHARDFP:#define __INT_FAST16_FMTd__ "hd" // ARMEABIHARDFP:#define __INT_FAST16_FMTi__ "hi" @@ -2343,8 +2343,8 @@ // ARMEABIHARDFP:#define __UINTMAX_MAX__ 18446744073709551615ULL // ARMEABIHARDFP:#define __UINTMAX_TYPE__ long long unsigned int // ARMEABIHARDFP:#define __UINTMAX_WIDTH__ 64 -// ARMEABIHARDFP:#define __UINTPTR_MAX__ 4294967295UL -// ARMEABIHARDFP:#define __UINTPTR_TYPE__ long unsigned int +// ARMEABIHARDFP:#define __UINTPTR_MAX__ 4294967295U +// ARMEABIHARDFP:#define __UINTPTR_TYPE__ unsigned int // ARMEABIHARDFP:#define __UINTPTR_WIDTH__ 32 // ARMEABIHARDFP:#define __UINT_FAST16_MAX__ 65535 // ARMEABIHARDFP:#define __UINT_FAST16_TYPE__ unsigned short @@ -2446,10 +2446,10 @@ // ARM-NETBSD:#define __INTMAX_MAX__ 9223372036854775807LL // ARM-NETBSD:#define __INTMAX_TYPE__ long long int // ARM-NETBSD:#define __INTMAX_WIDTH__ 64 -// ARM-NETBSD:#define __INTPTR_FMTd__ "ld" -// ARM-NETBSD:#define __INTPTR_FMTi__ "li" -// ARM-NETBSD:#define __INTPTR_MAX__ 2147483647L -// ARM-NETBSD:#define __INTPTR_TYPE__ long int +// ARM-NETBSD:#define __INTPTR_FMTd__ "d" +// ARM-NETBSD:#define __INTPTR_FMTi__ "i" +// ARM-NETBSD:#define __INTPTR_MAX__ 2147483647 +// ARM-NETBSD:#define __INTPTR_TYPE__ int // ARM-NETBSD:#define __INTPTR_WIDTH__ 32 // ARM-NETBSD:#define __INT_FAST16_FMTd__ "hd" // ARM-NETBSD:#define __INT_FAST16_FMTi__ "hi" @@ -2541,8 +2541,8 @@ // ARM-NETBSD:#define __UINTMAX_MAX__ 18446744073709551615ULL // ARM-NETBSD:#define __UINTMAX_TYPE__ long long unsigned int // ARM-NETBSD:#define __UINTMAX_WIDTH__ 64 -// ARM-NETBSD:#define __UINTPTR_MAX__ 4294967295UL -// ARM-NETBSD:#define __UINTPTR_TYPE__ long unsigned int +// ARM-NETBSD:#define __UINTPTR_MAX__ 4294967295U +// ARM-NETBSD:#define __UINTPTR_TYPE__ unsigned int // ARM-NETBSD:#define __UINTPTR_WIDTH__ 32 // ARM-NETBSD:#define __UINT_FAST16_MAX__ 65535 // ARM-NETBSD:#define __UINT_FAST16_TYPE__ unsigned short Modified: cfe/trunk/test/Preprocessor/stdint.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/stdint.c?rev=316046&r1=316045&r2=316046&view=diff ============================================================================== --- cfe/trunk/test/Preprocessor/stdint.c (original) +++ cfe/trunk/test/Preprocessor/stdint.c Tue Oct 17 17:00:50 2017 @@ -28,8 +28,8 @@ // ARM:typedef int8_t int_fast8_t; // ARM:typedef uint8_t uint_fast8_t; // -// ARM:typedef long int intptr_t; -// ARM:typedef long unsigned int uintptr_t; +// ARM:typedef int intptr_t; +// ARM:typedef unsigned int uintptr_t; // // ARM:typedef long long int intmax_t; // ARM:typedef long long unsigned int uintmax_t; @@ -74,9 +74,9 @@ // ARM:INT_FAST64_MAX_ 9223372036854775807LL // ARM:UINT_FAST64_MAX_ 18446744073709551615ULL // -// ARM:INTPTR_MIN_ (-2147483647L -1) -// ARM:INTPTR_MAX_ 2147483647L -// ARM:UINTPTR_MAX_ 4294967295UL +// ARM:INTPTR_MIN_ (-2147483647 -1) +// ARM:INTPTR_MAX_ 2147483647 +// ARM:UINTPTR_MAX_ 4294967295U // ARM:PTRDIFF_MIN_ (-2147483647 -1) // ARM:PTRDIFF_MAX_ 2147483647 // ARM:SIZE_MAX_ 4294967295U _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits