rpeep(): eliminate compiler warning
authorDavid Mitchell <davem@iabyn.com>
Fri, 4 Mar 2016 10:59:21 +0000 (10:59 +0000)
committerDavid Mitchell <davem@iabyn.com>
Fri, 4 Mar 2016 21:07:54 +0000 (21:07 +0000)
    op.c: In function ‘Perl_rpeep’:
    op.c:13692:37: warning: comparison is always false due to limited
    range of data type [-Wtype-limits]
                             ? base : 0) >
                                     ^
replace the '0' with something that still always fails to match but
hopefully won't warn.

op.c

diff --git a/op.c b/op.c
index 400726c..ce0d580 100644 (file)
--- a/op.c
+++ b/op.c
@@ -13684,12 +13684,16 @@ Perl_rpeep(pTHX_ OP *o)
                  * SAVEt_CLEARPADRANGE in pp_padrange.
                  * (The sizeof() stuff will be constant-folded, and is
                  * intended to avoid getting "comparison is always false"
-                 * compiler warnings)
+                 * compiler warnings. See the comments above
+                 * MEM_WRAP_CHECK for more explanation on why we do this
+                 * in a weird way to avoid compiler warnings.)
                  */
                 if (   intro
                     && (8*sizeof(base) >
                         8*sizeof(UV)-OPpPADRANGE_COUNTSHIFT-SAVE_TIGHT_SHIFT
-                        ? base : 0) >
+                        ? base
+                        : (UV_MAX >> (OPpPADRANGE_COUNTSHIFT+SAVE_TIGHT_SHIFT))
+                        ) >
                         (UV_MAX >> (OPpPADRANGE_COUNTSHIFT+SAVE_TIGHT_SHIFT))
                 )
                     break;