From 79bdb1a759f16845ffe5352c328e0275f5e2276c Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 23 Dec 2016 01:44:06 +0300 Subject: [PATCH] Workaround 'condition is always true' cppcheck style warnings in GC_init * misc.c (GC_init): Skip GC_STATIC_ASSERT for sizeof(ptr_t), sizeof(word), (word)-1>(word)0 and ((signed_word)-1)<0 if CPPCHECK. --- misc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/misc.c b/misc.c index 16a833ad..a9b6a2b1 100644 --- a/misc.c +++ b/misc.c @@ -1184,21 +1184,21 @@ GC_API void GC_CALL GC_init(void) # endif } # endif - GC_STATIC_ASSERT(sizeof (ptr_t) == sizeof(word)); # if !defined(CPPCHECK) + GC_STATIC_ASSERT(sizeof(ptr_t) == sizeof(word)); GC_STATIC_ASSERT(sizeof(signed_word) == sizeof(word)); +# if !defined(_AUX_SOURCE) || defined(__GNUC__) + GC_STATIC_ASSERT((word)(-1) > (word)0); + /* word should be unsigned */ +# endif + /* We no longer check for ((void*)(-1) > NULL) since all pointers */ + /* are explicitly cast to word in every less/greater comparison. */ + GC_STATIC_ASSERT((signed_word)(-1) < (signed_word)0); # endif GC_STATIC_ASSERT(sizeof (struct hblk) == HBLKSIZE); # ifndef THREADS GC_ASSERT(!((word)GC_stackbottom HOTTER_THAN (word)GC_approx_sp())); # endif -# if !defined(_AUX_SOURCE) || defined(__GNUC__) - GC_STATIC_ASSERT((word)(-1) > (word)0); - /* word should be unsigned */ -# endif - /* We no longer check for ((void*)(-1) > NULL) since all pointers */ - /* are explicitly cast to word in every less-greater comparison. */ - GC_STATIC_ASSERT((signed_word)(-1) < (signed_word)0); # ifndef GC_DISABLE_INCREMENTAL if (GC_incremental || 0 != GETENV("GC_ENABLE_INCREMENTAL")) { /* For GWW_VDB on Win32, this needs to happen before any */ -- 2.40.0