]> granicus.if.org Git - gc/commitdiff
Workaround cppcheck warnings regarding CLOCKS_PER_SEC, REDIRECT_REALLOC
authorIvan Maidanski <ivmai@mail.ru>
Wed, 14 Nov 2018 08:02:01 +0000 (11:02 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 26 Nov 2018 10:21:43 +0000 (13:21 +0300)
(a cherry-pick of commits 85422f322b7fe6 from 'master')

Also, this commit adjusts the workaround for FIXUP_POINTER.

* include/private/gcconfig.h [CPPCHECK] (CLOCKS_PER_SEC, FIXUP_POINTER,
POINTER_MASK, POINTER_SHIFT, REDIRECT_REALLOC): Undefine.
* include/private/gcconfig.h [!FIXUP_POINTER && POINTER_MASK]
(FIXUP_POINTER): Same definition regardless of CPPCHECK.

include/private/gcconfig.h

index 4baffd523b4e872572c45f29e0bb5313e075a889..7f9091e8b00908ea13d63dc6959f8d06a3f6ab03 100644 (file)
 #ifndef GCCONFIG_H
 #define GCCONFIG_H
 
+#ifdef CPPCHECK
+# undef CLOCKS_PER_SEC
+# undef FIXUP_POINTER
+# undef POINTER_MASK
+# undef POINTER_SHIFT
+# undef REDIRECT_REALLOC
+#endif
+
 #ifndef PTR_T_DEFINED
   typedef char * ptr_t;
 # define PTR_T_DEFINED
@@ -3493,11 +3501,7 @@ EXTERN_C_BEGIN
 #endif
 
 #if !defined(FIXUP_POINTER) && defined(POINTER_MASK)
-# if defined(CPPCHECK)
-#   define FIXUP_POINTER(p) (p = (p) << 4) /* e.g. */
-# else
-#   define FIXUP_POINTER(p) (p = ((p) & POINTER_MASK) << POINTER_SHIFT)
-# endif
+# define FIXUP_POINTER(p) (p = ((p) & POINTER_MASK) << POINTER_SHIFT)
 #endif
 
 #if defined(FIXUP_POINTER)