include: Define __WORDSIZE if needed.
authorAndreas Schneider <asn@cryptomilk.org>
Wed, 11 Feb 2015 07:10:07 +0000 (08:10 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 11 Feb 2015 16:09:11 +0000 (17:09 +0100)
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
include/cmocka.h

index d1c057b..2980055 100644 (file)
@@ -60,6 +60,16 @@ int __stdcall IsDebuggerPresent();
  * Largest integral type.  This type should be large enough to hold any
  * pointer or integer supported by the compiler.
  */
+
+/* If __WORDSIZE is not set, try to figure it out and default to 32 bit. */
+#ifndef __WORDSIZE
+# if defined(__x86_64__) && !defined(__ILP32__)
+#  define __WORDSIZE 64
+# else
+#  define __WORDSIZE 32
+# endif
+#endif
+
 #ifndef LargestIntegralType
 # if __WORDSIZE == 64
 #  define LargestIntegralType unsigned long int