From: Ivan Maidanski Date: Mon, 24 Apr 2017 18:04:34 +0000 (+0300) Subject: Workaround 'value of AO_CLEAR unknown' cppcheck info message X-Git-Tag: v7.6.0~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=43b546e41dc971b1867280de3bcd02eebc248f25;p=libatomic_ops Workaround 'value of AO_CLEAR unknown' cppcheck info message * src/atomic_ops.h [AO_AO_TS_T || AO_CHAR_TS_T] (AO_CLEAR): Check defined(AO_HAVE_CLEAR) instead of defined(AO_CLEAR). * src/atomic_ops.h [AO_AO_TS_T || AO_CHAR_TS_T] (AO_HAVE_CLEAR): Define (unless already defined). * src/atomic_ops/sysdeps/gcc/generic.h (AO_HAVE_CLEAR): Define (along with AO_CLEAR). * src/atomic_ops/sysdeps/gcc/hppa.h (AO_HAVE_CLEAR): Likewise. * src/atomic_ops/sysdeps/hpc/hppa.h (AO_HAVE_CLEAR): Likewise. --- diff --git a/src/atomic_ops.h b/src/atomic_ops.h index 92b4e3d..03f82a6 100644 --- a/src/atomic_ops.h +++ b/src/atomic_ops.h @@ -414,11 +414,13 @@ /* The most common way to clear a test-and-set location */ /* at the end of a critical section. */ -#if AO_AO_TS_T && !defined(AO_CLEAR) +#if AO_AO_TS_T && !defined(AO_HAVE_CLEAR) # define AO_CLEAR(addr) AO_store_release((AO_TS_t *)(addr), AO_TS_CLEAR) +# define AO_HAVE_CLEAR #endif -#if AO_CHAR_TS_T && !defined(AO_CLEAR) +#if AO_CHAR_TS_T && !defined(AO_HAVE_CLEAR) # define AO_CLEAR(addr) AO_char_store_release((AO_TS_t *)(addr), AO_TS_CLEAR) +# define AO_HAVE_CLEAR #endif /* The generalization section. */ diff --git a/src/atomic_ops/sysdeps/gcc/generic.h b/src/atomic_ops/sysdeps/gcc/generic.h index 1c96578..d21a4ee 100644 --- a/src/atomic_ops/sysdeps/gcc/generic.h +++ b/src/atomic_ops/sysdeps/gcc/generic.h @@ -90,6 +90,7 @@ # include "generic-arithm.h" # define AO_CLEAR(addr) __atomic_clear(addr, __ATOMIC_RELEASE) +# define AO_HAVE_CLEAR AO_INLINE AO_TS_VAL_t AO_test_and_set(volatile AO_TS_t *addr) diff --git a/src/atomic_ops/sysdeps/gcc/hppa.h b/src/atomic_ops/sysdeps/gcc/hppa.h index fe38ff8..2d0c491 100644 --- a/src/atomic_ops/sysdeps/gcc/hppa.h +++ b/src/atomic_ops/sysdeps/gcc/hppa.h @@ -87,6 +87,7 @@ AO_pa_clear(volatile AO_TS_t * addr) *a = 1; } #define AO_CLEAR(addr) AO_pa_clear(addr) +#define AO_HAVE_CLEAR #undef AO_PA_LDCW_ALIGNMENT #undef AO_ldcw diff --git a/src/atomic_ops/sysdeps/hpc/hppa.h b/src/atomic_ops/sysdeps/hpc/hppa.h index 27f3fa7..f0da948 100644 --- a/src/atomic_ops/sysdeps/hpc/hppa.h +++ b/src/atomic_ops/sysdeps/hpc/hppa.h @@ -97,6 +97,7 @@ AO_pa_clear(volatile AO_TS_t * addr) *a = 1; } #define AO_CLEAR(addr) AO_pa_clear(addr) +#define AO_HAVE_CLEAR #undef AO_PA_LDCW_ALIGNMENT #undef AO_ldcw