diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-07 00:23:17 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-07 00:23:17 +0000 |
commit | 25d69b57ccef6e598d6a4cd8823ee24d56b2c9f7 (patch) | |
tree | 4a017036c414eae88431c88ef315b6d656c656eb | |
parent | 224605064a4ef87d1c3d35ad1cb363f8b534012b (diff) |
Apparently it is important to define intptr_t and uintptr_t to
long instead of int. This is because system heaers like to redefine
typedefs and that is an error if they don't exactly match. Use long
for intptr_t on all systems where long is the right size.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63984 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Headers/stdint.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Headers/stdint.h b/lib/Headers/stdint.h index e7b205a0fc..606d396f4d 100644 --- a/lib/Headers/stdint.h +++ b/lib/Headers/stdint.h @@ -70,7 +70,14 @@ typedef uint64_t uint_fast64_t; /* C99 7.18.1.4 Integer types capable of holding object pointers. */ -#if __POINTER_WIDTH__ == 64 +#if (1LL << (__POINTER_WIDTH__-1))-1 == __LONG_MAX__ +/* If the pointer size is equal to long, use long. This is for compatibility + * with many systems which just use long and expect it to work in 32-bit and + * 64-bit mode. If long is not suitable, we use a fixed size type below. + */ +typedef long intptr_t; +typedef unsigned long uintptr_t; +#elif __POINTER_WIDTH__ == 64 typedef int64_t intptr_t; typedef uint64_t uintptr_t; #elif __POINTER_WIDTH__ == 32 |