FOOMARK debugging macros: fix %d cast; only -Dsv
authorDavid Mitchell <davem@iabyn.com>
Sat, 28 Nov 2015 17:09:13 +0000 (17:09 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sat, 28 Nov 2015 17:09:13 +0000 (17:09 +0000)
The debugging variants of POPMARK() etc: use %IVdf rather than %d
to avoid compiler warnings when sizeof(IV) != sizeof(int);
also, make these macros trigger only under -Dsv rather than just -Ds
(-v is the verbose variant).

pp.h

diff --git a/pp.h b/pp.h
index 60fe9ee..61c3c3e 100644 (file)
--- a/pp.h
+++ b/pp.h
@@ -62,26 +62,30 @@ Refetch the stack pointer.  Used after a callback.  See L<perlcall>.
         if (UNLIKELY((mark_stack_entry = ++PL_markstack_ptr) == PL_markstack_max)) \
            mark_stack_entry = markstack_grow();                      \
         *mark_stack_entry  = (I32)((p) - PL_stack_base);              \
-        DEBUG_s(PerlIO_printf(Perl_debug_log, "MARK push %p %d\n",    \
-                PL_markstack_ptr, *mark_stack_entry));                \
+        DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log,                 \
+                "MARK push %p %"IVdf"\n",                             \
+                PL_markstack_ptr, (IV)*mark_stack_entry)));           \
     } STMT_END
 #  define TOPMARK                                                       \
     ({                                                                \
-        DEBUG_s(PerlIO_printf(Perl_debug_log, "MARK top  %p %d\n",    \
-                PL_markstack_ptr, *PL_markstack_ptr));                \
+        DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log,                 \
+                "MARK top  %p %"IVdf"\n",                             \
+                PL_markstack_ptr, (IV)*PL_markstack_ptr)));           \
         *PL_markstack_ptr;                                            \
     })
 #  define POPMARK                                                       \
     ({                                                                \
-        DEBUG_s(PerlIO_printf(Perl_debug_log, "MARK pop  %p %d\n",    \
-                (PL_markstack_ptr-1), *(PL_markstack_ptr-1)));        \
+        DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log,                 \
+                "MARK pop  %p %"IVdf"\n",                             \
+                (PL_markstack_ptr-1), (IV)*(PL_markstack_ptr-1))));   \
         assert((PL_markstack_ptr > PL_markstack) || !"MARK underflow");\
         *PL_markstack_ptr--;                                          \
     })
 #  define INCMARK                                                       \
     ({                                                                \
-        DEBUG_s(PerlIO_printf(Perl_debug_log, "MARK inc  %p %d\n",    \
-                (PL_markstack_ptr+1), *(PL_markstack_ptr+1)));        \
+        DEBUG_s(DEBUG_v(PerlIO_printf(Perl_debug_log,                 \
+                "MARK inc  %p %"IVdf"\n",                             \
+                (PL_markstack_ptr+1), (IV)*(PL_markstack_ptr+1))));   \
         *PL_markstack_ptr++;                                          \
     })
 #else