From: Ivan Maidanski Date: Thu, 13 Oct 2016 08:03:04 +0000 (+0300) Subject: Workaround more '#error' cppcheck error messages X-Git-Tag: v8.0.0~1115 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3dc5035d76237efed82e675452709f3d9fe4af6d;p=platform%2Fupstream%2Flibgc.git Workaround more '#error' cppcheck error messages * 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. --- diff --git a/darwin_stop_world.c b/darwin_stop_world.c index e3c0548..921f6f5 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -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 diff --git a/dyn_load.c b/dyn_load.c index cdcebe2..1f60e9d 100644 --- a/dyn_load.c +++ b/dyn_load.c @@ -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 diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 0852d48..4e84024 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -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 diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index 98df369..663fc80 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -2942,6 +2942,7 @@ # define INCLUDE_LINUX_THREAD_DESCR #endif +#if !defined(CPPCHECK) #if defined(GC_IRIX_THREADS) && !defined(IRIX5) # error --> inconsistent configuration #endif @@ -2970,13 +2971,14 @@ && !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 @@ -3145,6 +3147,7 @@ #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 @@ -3160,6 +3163,7 @@ && !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 */ diff --git a/pcr_interface.c b/pcr_interface.c index c6c868c..35213bf 100644 --- a/pcr_interface.c +++ b/pcr_interface.c @@ -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; diff --git a/win32_threads.c b/win32_threads.c index 124f4de..22fd581 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -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 */