]> git.saurik.com Git - wxWidgets.git/commitdiff
Win64 compilation fixes: define SIZEOF_SIZE_T, added wxUIntPtr
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Feb 2004 12:58:08 +0000 (12:58 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Feb 2004 12:58:08 +0000 (12:58 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25702 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

configure.in
include/wx/defs.h
setup.h.in
setup.h_vms

index 560b2679781b33e4fb1e4d8972af1ec3285da487..0d2097d8396def50676d54b863dbcbcbaad30893 100644 (file)
@@ -1595,6 +1595,7 @@ AC_CHECK_SIZEOF(short, 2)
 AC_CHECK_SIZEOF(void *, 4)
 AC_CHECK_SIZEOF(int, 4)
 AC_CHECK_SIZEOF(long, 4)
+AC_CHECK_SIZEOF(size_t, 4)
 
 case "${host}" in
     arm-*-linux* )
index f665c110b97d21d746dc3e7612ed89a084e9a808..8231ab2b64e4e7871a02fffbbe10ae6848d080a1 100644 (file)
@@ -622,15 +622,6 @@ typedef wxUint16 wxWord;
 
 /*  32bit */
 #ifdef __WINDOWS__
-    #if defined(__WIN64__)
-        /*  you may remove this #error and try to compile the library, please */
-        /*  report the results to wx-dev@lists.wxwindows.org if you do! */
-        #error "wxWindows hasn't been tested under Win64, continue at your own risk"
-
-        /*  the same definitions as for Win32 _should_ work here as only */
-        /*  sizeof(void *) changes, but it must be tested first */
-    #endif /*  __WIN64__ */
-
     /*  Win64 uses LLP64 model and so ints and longs have the same size as in */
     /*  Win32 */
     #if defined(__WIN32__)
@@ -643,13 +634,25 @@ typedef wxUint16 wxWord;
             #define SIZEOF_LONG 4
             #define SIZEOF_WCHAR_T 2
 
-            #define wxSIZE_T_IS_UINT
+            /*
+               under Win64 sizeof(size_t) == 8 and so it is neither unsigned
+               int nor unsigned long!
+             */
+            #ifdef __WIN64__
+                #define SIZEOF_SIZE_T 8
+
+                #undef wxSIZE_T_IS_UINT
+            #else /* Win32 */
+                #define SIZEOF_SIZE_T 4
+
+                #define wxSIZE_T_IS_UINT
+            #endif
             #undef wxSIZE_T_IS_ULONG
 
             #ifdef __WIN64__
-                #define SIZEOF_INT_P 8
+                #define SIZEOF_VOID_P 8
             #else /*  Win32 */
-                #define SIZEOF_INT_P 4
+                #define SIZEOF_VOID_P 4
             #endif /*  Win64/32 */
         #endif /*  !defined(SIZEOF_INT) */
     #else
@@ -678,10 +681,14 @@ typedef wxUint16 wxWord;
             #error "Unknown sizeof(int) value, what are you compiling for?"
         #endif
     #else /*  !defined(SIZEOF_INT) */
-        /*  assume sizeof(int) == 4 -- what else can we do? */
+        /*  assume default 32bit machine -- what else can we do? */
         wxCOMPILE_TIME_ASSERT( sizeof(int) == 4, IntMustBeExactly4Bytes);
+        wxCOMPILE_TIME_ASSERT( sizeof(size_t) == 4, SizeTMustBeExactly4Bytes);
+        wxCOMPILE_TIME_ASSERT( sizeof(void *) == 4, PtrMustBeExactly4Bytes);
 
         #define SIZEOF_INT 4
+        #define SIZEOF_SIZE_T 4
+        #define SIZEOF_VOID_P 4
 
         typedef int wxInt32;
         typedef unsigned int wxUint32;
@@ -704,6 +711,22 @@ typedef wxUint16 wxWord;
 
 typedef wxUint32 wxDword;
 
+/*
+   Define an integral type big enough to contain all of long, size_t and void *.
+ */
+#if SIZEOF_LONG >= SIZEOF_VOID_P && SIZEOF_LONG >= SIZEOF_SIZE_T
+    /* normal case */
+    typedef unsigned long wxUIntPtr;
+#elif SIZEOF_SIZE_T >= SIZEOF_VOID_P
+    /* Win64 case */
+    typedef size_t wxUIntPtr;
+#else
+    /*
+       This should never happen for the current architectures but if you're
+       using one where it does, please contact wx-dev@lists.wxwindows.org.
+     */
+    #error "Pointers can't be stored inside integer types."
+#endif
 
 /*  64 bit */
 
index fa0d1e15699759b1c992602abb9b9419ad95b2a0..9ba2e844ff75b2648046a3609bf274e6896d9f6b 100644 (file)
 /* The number of bytes in a int.  */
 #undef SIZEOF_INT
 
-/* The number of bytes in a int *.  */
-#undef SIZEOF_INT_P
+/* The number of bytes in a pointer.  */
+#undef SIZEOF_VOID_P
 
 /* The number of bytes in a long.  */
 #undef SIZEOF_LONG
 /* The number of bytes in a short.  */
 #undef SIZEOF_SHORT
 
+/* The number of bytes in a size_t.  */
+#undef SIZEOF_SIZE_T
+
 /* Define if size_t on your machine is the same type as unsigned int. */
 #undef wxSIZE_T_IS_UINT
 
index 454e2b82ea6a258c49f9fdfe8df1707efcad90b5..98f790c62feee53f8794a44b0c9629a96e4d3171 100644 (file)
 /* The number of bytes in a int.  */
 #define SIZEOF_INT 4
 
-/* The number of bytes in a int *.  */
-#define SIZEOF_INT_P 4
+/* The number of bytes in a pointer.  */
+#define SIZEOF_VOID_P 4
 
 /* The number of bytes in a long.  */
 #define SIZEOF_LONG 4
 /* The number of bytes in a short.  */
 #define SIZEOF_SHORT 2
 
+/* The number of bytes in a size_t.  */
+#define SIZEOF_SIZE_T 4
+
 /* Define if size_t on your machine is the same type as unsigned int. */
 #define wxSIZE_T_IS_UINT  1