Win64 compilation fixes: define SIZEOF_SIZE_T, added wxUIntPtr

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25702 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-02-10 12:58:08 +00:00
parent d2213b1fa5
commit a369f7c88a
4 changed files with 47 additions and 17 deletions

View 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* )

View 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 */

View File

@@ -1053,8 +1053,8 @@
/* 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
@@ -1065,6 +1065,9 @@
/* 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

View File

@@ -1070,8 +1070,8 @@
/* 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
@@ -1082,6 +1082,9 @@
/* 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