]> granicus.if.org Git - gc/commitdiff
Workaround '#error' cppcheck messages in backgraph and private headers
authorIvan Maidanski <ivmai@mail.ru>
Fri, 9 Nov 2018 17:54:23 +0000 (20:54 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 9 Nov 2018 17:54:23 +0000 (20:54 +0300)
* backgraph.c [!DBG_HDRS_ALL || ALIGNMENT!=CPP_WORDSZ/8]: Skip #error
directive if CPPCHECK.
* include/private/dbg_mlc.h [(KEEP_BACK_PTRS || MAKE_BACK_GRAPH)
&& SHORT_DBG_HDRS]: Likewise.
* include/private/gc_atomic_ops.h [!GC_BUILTIN_ATOMIC && (!AO_HAVE_load
|| !AO_HAVE_store)]: Likewise.
* include/private/gc_hdrs.h [CPP_WORDSZ!=32 && CPP_WORDSZ<36]: Likewise.
* include/private/gc_priv.h [HBLKSIZE]: Likewise.
* include/private/gcconfig.h [SPARC && LINUX && !__ELF__]: Likewise.
* include/private/gcconfig.h [I386 && (__LP64__ || _WIN64)]: Likewise.
* include/private/gcconfig.h [IA64 && HPUX && !_ILP32 && !_LP64]:
Likewise.
* include/private/gcconfig.h [CPP_WORDSZ!=32 && CPP_WORDSZ!=64]:
Likewise.

backgraph.c
include/private/dbg_mlc.h
include/private/gc_atomic_ops.h
include/private/gc_hdrs.h
include/private/gc_priv.h
include/private/gcconfig.h

index d43d1708c2cc322c2a6e99974a081fecd2518d6d..8ea4251221170f74e3b93d0e94a653b710c6863b 100644 (file)
@@ -32,7 +32,8 @@
 
 /* #include <unistd.h> */
 
-#if !defined(DBG_HDRS_ALL) || (ALIGNMENT != CPP_WORDSZ/8) /* || !defined(UNIX_LIKE) */
+#if (!defined(DBG_HDRS_ALL) || (ALIGNMENT != CPP_WORDSZ/8) \
+     /* || !defined(UNIX_LIKE) */) && !defined(CPPCHECK)
 # error The configuration does not support MAKE_BACK_GRAPH
 #endif
 
index b0c2599e1f4cf47eafbdb99de7267bdc1516c15d..33e810e820c1fbdb52f33eabae330298a1c913e4 100644 (file)
@@ -158,7 +158,7 @@ typedef struct {
 #endif
 
 #if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH)
-# ifdef SHORT_DBG_HDRS
+# if defined(SHORT_DBG_HDRS) && !defined(CPPCHECK)
 #   error Non-ptr stored in object results in GC_HAS_DEBUG_INFO malfunction
     /* We may mistakenly conclude that p has a debugging wrapper.       */
 # endif
index 776d4551905426528744c9b27b7de37e4709802b..ef982d51d899d0fb622c27b0591aa38c00a38695 100644 (file)
   /* only if AO_REQUIRE_CAS is defined (or if the corresponding         */
   /* AO_HAVE_x macro is defined).  x86/x64 targets have AO_nop_full,    */
   /* AO_load_acquire, AO_store_release, at least.                       */
-# if !defined(AO_HAVE_load) || !defined(AO_HAVE_store)
+# if (!defined(AO_HAVE_load) || !defined(AO_HAVE_store)) && !defined(CPPCHECK)
 #   error AO_load or AO_store is missing; probably old version of atomic_ops
 # endif
 
index 94f29e9c7c9a1d14e4c1c0a79729d7ebc39fa894..a6e7037a5698cff1c54ae329b1af15be0d0dfd23 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef GC_HEADERS_H
 #define GC_HEADERS_H
 
-#if CPP_WORDSZ != 32 && CPP_WORDSZ < 36
+#if CPP_WORDSZ != 32 && CPP_WORDSZ < 36 && !defined(CPPCHECK)
 # error Get a real machine
 #endif
 
index 12c4ae4409b063da3b9847a64440f088ebc01afd..9274d1bcd9af72db81bd133e2f9d0953cbdaecd1 100644 (file)
@@ -860,8 +860,8 @@ EXTERN_C_BEGIN
 #   define CPP_LOG_HBLKSIZE 13
 # elif HBLKSIZE == 16384
 #   define CPP_LOG_HBLKSIZE 14
-# else
-#   error fix HBLKSIZE
+# elif !defined(CPPCHECK)
+#   error Bad HBLKSIZE value
 # endif
 # undef HBLKSIZE
 #endif
index 9863a878a1e78490e7e7bc9562d0ebccdace31f9..9da9c0d5f1604201fd47f1108cb7e100ffaade3c 100644 (file)
@@ -1274,8 +1274,8 @@ EXTERN_C_BEGIN
 #     define OS_TYPE "LINUX"
 #     ifdef __ELF__
 #       define DYNAMIC_LOADING
-#     else
-#       error --> Linux SPARC a.out not supported
+#     elif !defined(CPPCHECK)
+#       error Linux SPARC a.out not supported
 #     endif
       extern int _end[];
       extern int _etext[];
@@ -1347,7 +1347,7 @@ EXTERN_C_BEGIN
 
 # ifdef I386
 #   define MACH_TYPE "I386"
-#   if defined(__LP64__) || defined(_WIN64)
+#   if (defined(__LP64__) || defined(_WIN64)) && !defined(CPPCHECK)
 #     error This should be handled as X86_64
 #   else
 #     define CPP_WORDSZ 32
@@ -2099,8 +2099,8 @@ EXTERN_C_BEGIN
             /* Requires 8 byte alignment for malloc */
 #         define ALIGNMENT 4
 #       else
-#         ifndef _LP64
-#           error --> unknown ABI
+#         if !defined(_LP64) && !defined(CPPCHECK)
+#           error Unknown ABI
 #         endif
 #         define CPP_WORDSZ 64
             /* Requires 16 byte alignment for malloc */
@@ -3043,10 +3043,8 @@ EXTERN_C_BEGIN
 #if defined(CPPCHECK)
 # undef CPP_WORDSZ
 # define CPP_WORDSZ (__SIZEOF_POINTER__ * 8)
-#endif
-
-#if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
-# error --> bad word size
+#elif CPP_WORDSZ != 32 && CPP_WORDSZ != 64
+# error Bad word size
 #endif
 
 #if !defined(ALIGNMENT) && !defined(CPPCHECK)