Workaround more '#error' cppcheck error messages
authorIvan Maidanski <ivmai@mail.ru>
Thu, 13 Oct 2016 08:03:04 +0000 (11:03 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 13 Oct 2016 08:03:04 +0000 (11:03 +0300)
* darwin_stop_world.c (GC_stack_range_for): Skip #error pragma if
CPPCHECK.
* dyn_load.c [DYNAMIC_LOADING && !PCR && !DARWIN]: Likewise.
* dyn_load.c [SOLARISDL && !PCR && !GC_SOLARIS_THREADS && THREADS]:
Likewise.
* include/private/gc_priv.h [!POWERPC && !I386 && !X86_64 && !ARM32
&& !AARCH64] (GC_THREAD_STATE_T): Likewise.
* include/private/gcconfig.h [GC_IRIX_THREADS && !IRIX5 || ...]:
Likewise.
* include/private/gcconfig.h [PARALLEL_MARK && !THREADS]: Likewise.
* include/private/gcconfig.h [MARK_BIT_PER_GRANULE && MARK_BIT_PER_OBJ
|| ...]: Likewise.
* pcr_interface.c [PCR] (GC_enumerate_block): Likewise.
* win32_threads.c [!I386 && !X86_64 && !ARM32 && !SHx && !MIPS && !PPC
&& !ALPHA] (GC_push_stack_for): Likewise.
* darwin_stop_world.c (GC_stack_range_for): Initialize "lo" local
variable even if platform unsupported.

darwin_stop_world.c
dyn_load.c
include/private/gc_priv.h
include/private/gcconfig.h
pcr_interface.c
win32_threads.c

index e3c0548..921f6f5 100644 (file)
@@ -294,6 +294,8 @@ STATIC ptr_t GC_stack_range_for(ptr_t *phi, thread_act_t thread, GC_thread p,
       GC_push_one(state.THREAD_FLD(fp));
       GC_push_one(state.THREAD_FLD(lr));
 
+#   elif defined(CPPCHECK)
+      lo = NULL;
 #   else
 #     error FIXME for non-x86 || ppc || arm architectures
 #   endif
index cdcebe2..1f60e9d 100644 (file)
@@ -59,7 +59,8 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0;
     && !(defined(FREEBSD) && defined(__ELF__)) \
     && !((defined(LINUX) || defined(NACL)) && defined(__ELF__)) \
     && !(defined(NETBSD) && defined(__ELF__)) && !defined(HURD) \
-    && !(defined(OPENBSD) && (defined(__ELF__) || defined(M68K)))
+    && !(defined(OPENBSD) && (defined(__ELF__) || defined(M68K))) \
+    && !defined(CPPCHECK)
 # error We only know how to find data segments of dynamic libraries for above.
 # error Additional SVR4 variants might not be too hard to add.
 #endif
@@ -212,7 +213,8 @@ GC_FirstDLOpenedLinkMap(void)
 # if defined(SOLARISDL)
 
 /* Add dynamic library data sections to the root set.           */
-# if !defined(PCR) && !defined(GC_SOLARIS_THREADS) && defined(THREADS)
+# if !defined(PCR) && !defined(GC_SOLARIS_THREADS) && defined(THREADS) \
+     && !defined(CPPCHECK)
 #   error Fix mutual exclusion with dlopen
 # endif
 
index 0852d48..4e84024 100644 (file)
@@ -626,7 +626,7 @@ GC_EXTERN GC_warn_proc GC_current_warn_proc;
 #   define GC_THREAD_STATE_T            arm_thread_state64_t
 #   define GC_MACH_THREAD_STATE         ARM_THREAD_STATE64
 #   define GC_MACH_THREAD_STATE_COUNT   ARM_THREAD_STATE64_COUNT
-# else
+# elif !defined(CPPCHECK)
 #   error define GC_THREAD_STATE_T
 # endif
 # ifndef GC_MACH_THREAD_STATE
index 98df369..663fc80 100644 (file)
 # define INCLUDE_LINUX_THREAD_DESCR
 #endif
 
+#if !defined(CPPCHECK)
 #if defined(GC_IRIX_THREADS) && !defined(IRIX5)
 # error --> inconsistent configuration
 #endif
     && !defined(MSWINCE)
 # error --> inconsistent configuration
 #endif
+#endif /* !CPPCHECK */
 
 #if defined(PCR) || defined(GC_WIN32_THREADS) || defined(GC_PTHREADS) \
     || defined(SN_TARGET_PS3)
 # define THREADS
 #endif
 
-#if defined(PARALLEL_MARK) && !defined(THREADS)
+#if defined(PARALLEL_MARK) && !defined(THREADS) && !defined(CPPCHECK)
 # error "invalid config - PARALLEL_MARK requires GC_THREADS"
 #endif
 
 #endif
 
 /* Some static sanity tests.    */
+#if !defined(CPPCHECK)
 #if defined(MARK_BIT_PER_GRANULE) && defined(MARK_BIT_PER_OBJ)
 # error Define only one of MARK_BIT_PER_GRANULE and MARK_BIT_PER_OBJ.
 #endif
      && !defined(REDIRECT_MALLOC_IN_HEADER)
 # error "REDIRECT_MALLOC with THREADS works at most on Linux."
 #endif
+#endif /* !CPPCHECK */
 
 #ifdef GC_PRIVATE_H
         /* This relies on some type definitions from gc_priv.h, from    */
index c6c868c..35213bf 100644 (file)
@@ -72,9 +72,11 @@ void GC_enumerate_block(struct hblk *h; enumerate_data * ed)
     ptr_t p;
     ptr_t lim;
     word descr;
+
+# if !defined(CPPCHECK)
 #   error This code was updated without testing.
 #   error and its precursor was clearly broken.
-
+# endif
     hhdr = HDR(h);
     descr = hhdr -> hb_descr;
     sz = hhdr -> hb_sz;
index 124f4de..22fd581 100644 (file)
@@ -1425,7 +1425,7 @@ STATIC word GC_push_stack_for(GC_thread thread, DWORD me)
       PUSH4(IntA0,IntA1,IntA2,IntA3), PUSH4(IntA4,IntA5,IntT8,IntT9);
       PUSH4(IntT10,IntT11,IntT12,IntAt);
       sp = (ptr_t)context.IntSp;
-#   else
+#   elif !defined(CPPCHECK)
 #     error "architecture is not supported"
 #   endif
   } /* ! current thread */