]> www.ginac.de Git - cln.git/blobdiff - m4/intparam.m4
64-bit mingw port: Use intptr_t, not long, to guarantee alignment.
[cln.git] / m4 / intparam.m4
index b9967bbaeebee063aa3a9d4bc9a8d6443ad7519a..d7830b0a77d90e51c00578f534f99cf937edde73 100644 (file)
@@ -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([], [typedef int verify[2*(sizeof(char*)<=sizeof (long))-1];],
-      [], [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. */"
@@ -258,7 +258,7 @@ AC_DEFUN([CL_INTPARAM_BITSIZE],
 [
   n=1; x="($1)2"
   while true; do
-    AC_TRY_COMPILE([], [typedef int verify[2*(($1)($x) == 0) - 1];],
+    AC_TRY_COMPILE([], [static_assert(($1)($x) == 0, "");],
       [$2=$n; break;],
       [if test $n = 1000; then $2=; break; fi;])
     n=`expr $n + 1`; x="$x * ($1)2"
@@ -290,7 +290,7 @@ AC_DEFUN([CL_INTPARAM_ALIGNOF],
 #else
 # define alignof(type)  offsetof (struct { char slot1; type slot2; }, slot2)
 #endif
-], [typedef int verify[2*(alignof($1) == $n) - 1];],
+], [static_assert(alignof($1) == $n, "");],
       [$2=$n; break;]
       [if test $n = 0; then $2=; break; fi])
     n=`expr $n '*' 2`