]> granicus.if.org Git - gc/commitdiff
Fix 'void pointers in calculations: behavior undefined' cppcheck warning
authorIvan Maidanski <ivmai@mail.ru>
Wed, 14 Sep 2016 06:47:40 +0000 (09:47 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 14 Sep 2016 06:47:40 +0000 (09:47 +0300)
* dbg_mlc.c (OFN_UNSET): Replace -1 with ~(signed_word)0; add
outermost parentheses.

dbg_mlc.c

index 02e36defad960b4b8ef43d72971d6edf3ebf913b..ecea2222615cfd36ca81ddb9221699fad9bb9f1f 100644 (file)
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -1115,7 +1115,7 @@ STATIC void GC_CALLBACK GC_debug_invoke_finalizer(void * obj, void * data)
 }
 
 /* Special finalizer_proc value to detect GC_register_finalizer() failure. */
-#define OFN_UNSET (GC_finalization_proc)(signed_word)-1
+#define OFN_UNSET ((GC_finalization_proc)~(signed_word)0)
 
 /* Set ofn and ocd to reflect the values we got back.   */
 static void store_old(void *obj, GC_finalization_proc my_old_fn,