summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-07-24 10:00:19 +0200
committerAndreas Schneider <asn@cryptomilk.org>2013-07-24 10:00:19 +0200
commit8d3e410068e1c848263ab08f12892739658f686e (patch)
treecdd26a6fefe474c3c5f46fa34f9641d2a0bab251
parent00df1ba097c973cd33f4f381178668db83705493 (diff)
downloadcmocka-8d3e410068e1c848263ab08f12892739658f686e.tar.gz
cmocka-8d3e410068e1c848263ab08f12892739658f686e.tar.bz2
cmocka-8d3e410068e1c848263ab08f12892739658f686e.zip
include: Don't redefine uintptr_t on Windows.
Visual Studio defines _UINTPTR_T_DEFINED if we have uintptr_t.
-rw-r--r--include/cmocka.h55
1 files changed, 25 insertions, 30 deletions
diff --git a/include/cmocka.h b/include/cmocka.h
index 1255bbe..985f246 100644
--- a/include/cmocka.h
+++ b/include/cmocka.h
@@ -82,38 +82,33 @@ int __stdcall IsDebuggerPresent();
((LargestIntegralType)((size_t)(value)))
/* Smallest integral type capable of holding a pointer. */
-#ifndef _UINTPTR_T
-#define _UINTPTR_T
-#ifdef _WIN32
-
-/* WIN32 is an ILP32 platform */
-typedef unsigned long uintptr_t;
-
-/* what about 64-bit windows?
- * what's the right preprocessor symbol?
-typedef unsigned long long uintptr_t */
-
-#else /* _WIN32 */
+#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED)
+# if defined(_WIN32)
+ /* WIN32 is an ILP32 platform */
+ typedef unsigned int uintptr_t;
+# elif defined(_WIN64)
+ typedef unsigned long int uintptr_t
+# else /* _WIN32 */
/* ILP32 and LP64 platforms */
-#ifdef __WORDSIZE /* glibc */
-# if __WORDSIZE == 64
-typedef unsigned long int uintptr_t;
-# else
-typedef unsigned int uintptr_t;
-# endif /* __WORDSIZE == 64 */
-#else /* __WORDSIZE */
-
-# if defined(_LP64) || defined(_I32LPx)
-typedef unsigned long int uintptr_t;
-# else
-typedef unsigned int uintptr_t;
-# endif
-
-#endif /* __WORDSIZE */
-
-#endif /* _WIN32 */
-#endif /* _UINTPTR_T */
+# ifdef __WORDSIZE /* glibc */
+# if __WORDSIZE == 64
+ typedef unsigned long int uintptr_t;
+# else
+ typedef unsigned int uintptr_t;
+# endif /* __WORDSIZE == 64 */
+# else /* __WORDSIZE */
+# if defined(_LP64) || defined(_I32LPx)
+ typedef unsigned long int uintptr_t;
+# else
+ typedef unsigned int uintptr_t;
+# endif
+# endif /* __WORDSIZE */
+# endif /* _WIN32 */
+
+# define _UINTPTR_T
+# define _UINTPTR_T_DEFINED
+#endif /* !defined(_UINTPTR_T) || !defined(_UINTPTR_T_DEFINED) */
/* Perform an unsigned cast to uintptr_t. */
#define cast_to_pointer_integral_type(value) \