Workaround 'value of AO_CLEAR unknown' cppcheck info message
authorIvan Maidanski <ivmai@mail.ru>
Mon, 24 Apr 2017 18:04:34 +0000 (21:04 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 24 Apr 2017 18:04:34 +0000 (21:04 +0300)
* 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.

src/atomic_ops.h
src/atomic_ops/sysdeps/gcc/generic.h
src/atomic_ops/sysdeps/gcc/hppa.h
src/atomic_ops/sysdeps/hpc/hppa.h

index 92b4e3d..03f82a6 100644 (file)
 
 /* 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.  */
index 1c96578..d21a4ee 100644 (file)
@@ -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)
index fe38ff8..2d0c491 100644 (file)
@@ -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
index 27f3fa7..f0da948 100644 (file)
@@ -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