Fix GC_SIZE_MAX definition (Linux/musl-gcc)
authorIvan Maidanski <ivmai@mail.ru>
Tue, 14 Mar 2017 22:58:41 +0000 (01:58 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 14 Mar 2017 23:02:32 +0000 (02:02 +0300)
* include/private/gc_priv.h [SIZE_MAX && !CPPCHECK] (GC_SIZE_MAX): Cast
SIZE_MAX to size_t explicitly (to workaround incorrect definition
of SIZE_MAX - e.g. it is defined as ~0ULL in musl-tools which is not
correct for a 32-bit target).

include/private/gc_priv.h

index 2cb8915..2e1dc16 100644 (file)
@@ -94,7 +94,8 @@ typedef char * ptr_t;   /* A generic pointer to which we can add        */
 # include <limits.h>
 #endif
 #if defined(SIZE_MAX) && !defined(CPPCHECK)
-# define GC_SIZE_MAX SIZE_MAX
+# define GC_SIZE_MAX ((size_t)SIZE_MAX)
+            /* Extra cast to workaround some buggy SIZE_MAX definitions. */
 #else
 # define GC_SIZE_MAX (~(size_t)0)
 #endif