This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Avoid an unused argument in S_sv_2iuv_non_preserve() by using
authorNicholas Clark <nick@ccl4.org>
Fri, 18 Jan 2008 18:00:56 +0000 (18:00 +0000)
committerNicholas Clark <nick@ccl4.org>
Fri, 18 Jan 2008 18:00:56 +0000 (18:00 +0000)
conditional compilation to only pass it in if it's needed.

p4raw-id: //depot/perl@33004

embed.fnc
embed.h
proto.h
sv.c

index abfc59e..972e541 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1503,7 +1503,11 @@ sR       |SV *   |varname        |NULLOK GV *gv|const char gvtype|PADOFFSET targ \
 s      |void   |del_sv |NN SV *p
 #  endif
 #  if !defined(NV_PRESERVES_UV)
+#    ifdef DEBUGGING
 s      |int    |sv_2iuv_non_preserve   |NN SV *sv|I32 numtype
+#    else
+s      |int    |sv_2iuv_non_preserve   |NN SV *sv
+#    endif
 #  endif
 sR     |I32    |expect_number  |NN char** pattern
 #
diff --git a/embed.h b/embed.h
index 35a7971..e2fb594 100644 (file)
--- a/embed.h
+++ b/embed.h
 #endif
 #  endif
 #  if !defined(NV_PRESERVES_UV)
+#    ifdef DEBUGGING
 #ifdef PERL_CORE
 #define sv_2iuv_non_preserve   S_sv_2iuv_non_preserve
 #endif
+#    else
+#ifdef PERL_CORE
+#define sv_2iuv_non_preserve   S_sv_2iuv_non_preserve
+#endif
+#    endif
 #  endif
 #ifdef PERL_CORE
 #define expect_number          S_expect_number
 #endif
 #  endif
 #  if !defined(NV_PRESERVES_UV)
+#    ifdef DEBUGGING
 #ifdef PERL_CORE
 #define sv_2iuv_non_preserve(a,b)      S_sv_2iuv_non_preserve(aTHX_ a,b)
 #endif
+#    else
+#ifdef PERL_CORE
+#define sv_2iuv_non_preserve(a)        S_sv_2iuv_non_preserve(aTHX_ a)
+#endif
+#    endif
 #  endif
 #ifdef PERL_CORE
 #define expect_number(a)       S_expect_number(aTHX_ a)
diff --git a/proto.h b/proto.h
index a226fea..e1a3647 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -3972,9 +3972,15 @@ STATIC void      S_del_sv(pTHX_ SV *p)
 
 #  endif
 #  if !defined(NV_PRESERVES_UV)
+#    ifdef DEBUGGING
 STATIC int     S_sv_2iuv_non_preserve(pTHX_ SV *sv, I32 numtype)
                        __attribute__nonnull__(pTHX_1);
 
+#    else
+STATIC int     S_sv_2iuv_non_preserve(pTHX_ SV *sv)
+                       __attribute__nonnull__(pTHX_1);
+
+#    endif
 #  endif
 STATIC I32     S_expect_number(pTHX_ char** pattern)
                        __attribute__warn_unused_result__
diff --git a/sv.c b/sv.c
index e801249..d9c9ef8 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1862,10 +1862,13 @@ S_glob_2pv(pTHX_ GV * const gv, STRLEN * const len)
 
 /* For sv_2nv these three cases are "SvNOK and don't bother casting"  */
 STATIC int
-S_sv_2iuv_non_preserve(pTHX_ register SV *sv, I32 numtype)
+S_sv_2iuv_non_preserve(pTHX_ register SV *sv
+#  ifdef DEBUGGING
+                      , I32 numtype
+#  endif
+                      )
 {
     dVAR;
-    PERL_UNUSED_ARG(numtype); /* Used only under DEBUGGING? */
     DEBUG_c(PerlIO_printf(Perl_debug_log,"sv_2iuv_non '%s', IV=0x%"UVxf" NV=%"NVgf" inttype=%"UVXf"\n", SvPVX_const(sv), SvIVX(sv), SvNVX(sv), (UV)numtype));
     if (SvNVX(sv) < (NV)IV_MIN) {
        (void)SvIOKp_on(sv);
@@ -2143,7 +2146,11 @@ S_sv_2iuv_common(pTHX_ SV *sv) {
                          1      1       already read UV.
                        so there's no point in sv_2iuv_non_preserve() attempting
                        to use atol, strtol, strtoul etc.  */
+#  ifdef DEBUGGING
                     sv_2iuv_non_preserve (sv, numtype);
+#  else
+                    sv_2iuv_non_preserve (sv);
+#  endif
                 }
             }
 #endif /* NV_PRESERVES_UV */