From 5aaa3cc6f9aa5b2f0956f5be55e2143605ab7026 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Mon, 17 Oct 2016 10:01:16 +0300 Subject: [PATCH] Workaround 'unused variable' cppcheck style warnings * include/private/gc_locks.h [PCR && THREADS] (DCL_LOCK_STATE): Define to empty if CPPCHECK. * mach_dep.c [MACOS && __MWERKS__ && POWERPC] (getRegisters): Declare as external of CPPCHECK (as cppcheck does not recognize "asm" in function declaration). --- include/private/gc_locks.h | 6 +++++- mach_dep.c | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h index 1359d1f1..38c73507 100644 --- a/include/private/gc_locks.h +++ b/include/private/gc_locks.h @@ -36,8 +36,12 @@ # include # include GC_EXTERN PCR_Th_ML GC_allocate_ml; -# define DCL_LOCK_STATE \ +# if defined(CPPCHECK) +# define DCL_LOCK_STATE /* empty */ +# else +# define DCL_LOCK_STATE \ PCR_ERes GC_fastLockRes; PCR_sigset_t GC_old_sig_mask +# endif # define UNCOND_LOCK() PCR_Th_ML_Acquire(&GC_allocate_ml) # define UNCOND_UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml) # endif diff --git a/mach_dep.c b/mach_dep.c index 7fa87741..6a9bc0f0 100644 --- a/mach_dep.c +++ b/mach_dep.c @@ -34,11 +34,15 @@ }; typedef struct ppc_registers ppc_registers; - asm static void getRegisters(register ppc_registers* regs) - { +# if defined(CPPCHECK) + void getRegisters(ppc_registers* regs); +# else + asm static void getRegisters(register ppc_registers* regs) + { stmw r13,regs->gprs /* save R13-R31 */ blr - } + } +# endif static void PushMacRegisters(void) { -- 2.40.0