From: Bruno Haible Date: Sun, 27 Oct 2019 18:46:51 +0000 (+0100) Subject: 64-bit mingw port: Verify that pointers fit in 'intptr_t', not 'long'. X-Git-Tag: cln_1-3-5~25 X-Git-Url: https://www.ginac.de/CLN/cln.git//cln.git?a=commitdiff_plain;h=a4895e4e96996b17ec71c1afc49f580a23bc8e69;p=cln.git 64-bit mingw port: Verify that pointers fit in 'intptr_t', not 'long'. --- diff --git a/autoconf/intparam.c b/autoconf/intparam.c index 375ff80..d3b9408 100644 --- a/autoconf/intparam.c +++ b/autoconf/intparam.c @@ -10,6 +10,7 @@ #define ushort os_ushort #define uint os_uint #define ulong os_ulong +#include #include #undef ulong #undef uint @@ -414,8 +415,8 @@ void main5(void) { void main6(void) { #define check_sizeof_pointer(type,typestr) \ - { if (!(sizeof(type) <= sizeof(long))) \ - printf("#error \"Type %s does not fit into a long!!\"\n",typestr); \ + { if (!(sizeof(type) <= sizeof(intptr_t))) \ + printf("#error \"Type %s does not fit into an intptr_t!!\"\n",typestr); \ } check_sizeof_pointer(char*,"char *"); check_sizeof_pointer(long*,"long *"); diff --git a/m4/intparam.m4 b/m4/intparam.m4 index d8536b2..d7830b0 100644 --- a/m4/intparam.m4 +++ b/m4/intparam.m4 @@ -113,8 +113,8 @@ AC_DEFUN([CL_INTPARAM_CROSS], echo "#error \"Integer types long long and unsigned long long have different sizes!!\"" fi fi - AC_TRY_COMPILE([], [static_assert(sizeof(char*) <= sizeof(long), "");], - [], [echo "#error \"Type char * does not fit into a long!!\""]) + AC_TRY_COMPILE([], [static_assert(sizeof(char*) <= sizeof(intptr_t), "");], + [], [echo "#error \"Type char * does not fit into an intptr_t!!\""]) _AC_COMPUTE_INT([sizeof (char *)], [pointer_size]) pointer_bitsize=`expr $pointer_size '*' $char_bitsize` echo "/* Pointers of type char * have $pointer_bitsize bits. */"