Re: [ID 20010515.001] -DPERL_Y2KWARN doesn't do what it should (Not OK: perl v5.7...
authorPhilip Newton <pne@cpan.org>
Tue, 15 May 2001 16:31:05 +0000 (18:31 +0200)
committerJarkko Hietaniemi <jhi@iki.fi>
Wed, 16 May 2001 14:15:36 +0000 (14:15 +0000)
Message-ID: <3B0159C9.1905.1C6AEF9@localhost>

Fix PERL_Y2KWARN test to check before rather than after appending.

p4raw-id: //depot/perl@10128

pp_hot.c

index bc7a1b9..023a05b 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -156,6 +156,19 @@ PP(pp_concat)
     if (TARG != left)
        sv_setsv(TARG, left);
 
+#if defined(PERL_Y2KWARN)
+    if ((SvIOK(right) || SvNOK(right)) && ckWARN(WARN_Y2K) && SvOK(TARG)) {
+       STRLEN n;
+       char *s = SvPV(TARG,n);
+       if (n >= 2 && s[n-2] == '1' && s[n-1] == '9'
+           && (n == 2 || !isDIGIT(s[n-3])))
+       {
+           Perl_warner(aTHX_ WARN_Y2K, "Possible Y2K bug: %s",
+                       "about to append an integer to '19'");
+       }
+    }
+#endif
+
     if (TARG == right) {
        if (left == right) {
            /*  $right = $right . $right; */
@@ -175,19 +188,6 @@ PP(pp_concat)
        sv_catsv(TARG, right);
     }
 
-#if defined(PERL_Y2KWARN)
-    if ((SvIOK(right) || SvNOK(right)) && ckWARN(WARN_Y2K)) {
-       STRLEN n;
-       char *s = SvPV(TARG,n);
-       if (n >= 2 && s[n-2] == '1' && s[n-1] == '9'
-           && (n == 2 || !isDIGIT(s[n-3])))
-       {
-           Perl_warner(aTHX_ WARN_Y2K, "Possible Y2K bug: %s",
-                       "about to append an integer to '19'");
-       }
-    }
-#endif
-
     SETTARG;
     RETURN;
   }