From: Andy Lester Date: Thu, 7 Apr 2005 17:44:42 +0000 (-0500) Subject: Removing Y2K warnings X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2db3864ffcaccbf832bbb3814303b4f6beef8963;p=p5sagit%2Fp5-mst-13.2.git Removing Y2K warnings Message-ID: <20050407224442.GA23895@petdance.com> p4raw-id: //depot/perl@24205 --- diff --git a/INSTALL b/INSTALL index 42ce893..ce6b2a6 100644 --- a/INSTALL +++ b/INSTALL @@ -332,7 +332,7 @@ after the platform hints have been run by using Configure's -A switch. For example, here's how to add a couple of extra flags to C compiler invocations: - sh Configure -Accflags="-DPERL_Y2KWARN -DPERL_POLLUTE_MALLOC" + sh Configure -Accflags="-DPERL_EXTERNAL_GLOB -DPERL_POLLUTE_MALLOC" For more help on Configure switches, run diff --git a/MANIFEST b/MANIFEST index 7067872..2a4d8f5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2451,7 +2451,6 @@ README.vmesa Perl notes for VM/ESA README.vms Perl notes for VMS README.vos Perl notes for Stratus VOS README.win32 Perl notes for Windows -README.Y2K Notes about Year 2000 concerns reentr.c Reentrant interfaces reentr.h Reentrant interfaces reentr.pl Reentrant interfaces diff --git a/README.Y2K b/README.Y2K deleted file mode 100644 index a3eb550..0000000 --- a/README.Y2K +++ /dev/null @@ -1,47 +0,0 @@ -The following information about Perl and the year 2000 is a modified -version of the information that can be found in the Frequently Asked -Question (FAQ) documents. - -Does Perl have a year 2000 problem? Is Perl Y2K compliant? - -Short answer: No, Perl does not have a year 2000 problem. Yes, - Perl is Y2K compliant (whatever that means). The - programmers you've hired to use it, however, probably are - not. If you want perl to complain when your programmers - create programs with certain types of possible year 2000 - problems, a build option allows you to turn on warnings. - -Long answer: The question belies a true understanding of the - issue. Perl is just as Y2K compliant as your pencil - --no more, and no less. Can you use your pencil to write - a non-Y2K-compliant memo? Of course you can. Is that - the pencil's fault? Of course it isn't. - - The date and time functions supplied with perl (gmtime and - localtime) supply adequate information to determine the - year well beyond 2000 (2038 is when trouble strikes for - 32-bit machines). The year returned by these functions - when used in a list context is the year minus 1900. For - years between 1910 and 1999 this happens to be a 2-digit - decimal number. To avoid the year 2000 problem simply do - not treat the year as a 2-digit number. It isn't. - - When gmtime() and localtime() are used in scalar context - they return a timestamp string that contains a fully- - expanded year. For example, $timestamp = - gmtime(1005613200) sets $timestamp to "Tue Nov 13 01:00:00 - 2001". There's no year 2000 problem here. - - That doesn't mean that Perl can't be used to create non- - Y2K compliant programs. It can. But so can your pencil. - It's the fault of the user, not the language. At the risk - of inflaming the NRA: ``Perl doesn't break Y2K, people - do.'' See http://language.perl.com/news/y2k.html for a - longer exposition. - - If you want perl to warn you when it sees a program which - concatenates a number with the string "19" -- a common - indication of a year 2000 problem -- build perl using the - Configure option "-Accflags=-DPERL_Y2KWARN". - (See the file INSTALL for more information about building - perl.) diff --git a/lib/warnings.pm b/lib/warnings.pm index 86e4fce..635993b 100644 --- a/lib/warnings.pm +++ b/lib/warnings.pm @@ -181,17 +181,16 @@ our %Offsets = ( 'untie' => 86, 'utf8' => 88, 'void' => 90, - 'y2k' => 92, # Warnings Categories added in Perl 5.009 - 'assertions' => 94, + 'assertions' => 92, ); our %Bits = ( - 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55", # [0..47] + 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x15", # [0..46] 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [29] - 'assertions' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40", # [47] + 'assertions' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", # [46] 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00", # [30] 'closed' => "\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6] 'closure' => "\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1] @@ -236,13 +235,12 @@ our %Bits = ( 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00", # [43] 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [44] 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [45] - 'y2k' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", # [46] ); our %DeadBits = ( - 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", # [0..47] + 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x2a", # [0..46] 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00", # [29] - 'assertions' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80", # [47] + 'assertions' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20", # [46] 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00", # [30] 'closed' => "\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6] 'closure' => "\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1] @@ -287,11 +285,10 @@ our %DeadBits = ( 'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00", # [43] 'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [44] 'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [45] - 'y2k' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20", # [46] ); $NONE = "\0\0\0\0\0\0\0\0\0\0\0\0"; -$LAST_BIT = 96 ; +$LAST_BIT = 94 ; $BYTES = 12 ; $All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ; diff --git a/pod/buildtoc b/pod/buildtoc index e4dc82a..7d5b019 100644 --- a/pod/buildtoc +++ b/pod/buildtoc @@ -69,7 +69,6 @@ __USAGE__ # Don't copy these top level READMEs %Ignore = ( - Y2K => 1, micro => 1, # vms => 1, ); diff --git a/pod/perldiag.pod b/pod/perldiag.pod index c3035a1..675ac52 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -3188,11 +3188,6 @@ but there was no array C<@foo> in scope at the time. If you wanted a literal @foo, then write it as \@foo; otherwise find out what happened to the array you apparently lost track of. -=item Possible Y2K bug: %s - -(W y2k) You are concatenating the number 19 with another number, which -could be a potential Year 2000 problem. - =item pragma "attrs" is deprecated, use "sub NAME : ATTRS" instead (D deprecated) You have written something like this: diff --git a/pod/perllexwarn.pod b/pod/perllexwarn.pod index 12ce1f6..f250fb4 100644 --- a/pod/perllexwarn.pod +++ b/pod/perllexwarn.pod @@ -298,8 +298,6 @@ The current hierarchy is: +- utf8 | +- void - | - +- y2k Just like the "strict" pragma any of these categories can be combined diff --git a/pp_hot.c b/pp_hot.c index a8d679a..dcacf63 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -178,17 +178,6 @@ PP(pp_concat) SvUTF8_off(TARG); } -#if defined(PERL_Y2KWARN) - if ((SvIOK(right) || SvNOK(right)) && ckWARN(WARN_Y2K) && SvOK(TARG)) { - if (llen >= 2 && lpv[llen - 2] == '1' && lpv[llen - 1] == '9' - && (llen == 2 || !isDIGIT(lpv[llen - 3]))) - { - Perl_warner(aTHX_ packWARN(WARN_Y2K), "Possible Y2K bug: %s", - "about to append an integer to '19'"); - } - } -#endif - if (lbyte != rbyte) { if (lbyte) sv_utf8_upgrade_nomg(TARG); diff --git a/sv.c b/sv.c index dff1b89..c476bb8 100644 --- a/sv.c +++ b/sv.c @@ -9822,19 +9822,6 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV } break; default: /* it had better be ten or less */ -#if defined(PERL_Y2KWARN) - if (ckWARN(WARN_Y2K)) { - STRLEN n; - char *s = SvPV(sv,n); - if (n >= 2 && s[n-2] == '1' && s[n-1] == '9' - && (n == 2 || !isDIGIT(s[n-3]))) - { - Perl_warner(aTHX_ packWARN(WARN_Y2K), - "Possible Y2K bug: %%%c %s", - c, "format string following '19'"); - } - } -#endif do { dig = uv % base; *--eptr = '0' + dig; diff --git a/t/lib/warnings/pp_hot b/t/lib/warnings/pp_hot index f5a5803..070aaf0 100644 --- a/t/lib/warnings/pp_hot +++ b/t/lib/warnings/pp_hot @@ -44,9 +44,6 @@ Deep recursion on anonymous subroutine [Perl_sub_crush_depth] $a = sub { &$a if $a++ < 200} &$a - Possible Y2K bug: about to append an integer to '19' [pp_concat] - $x = "19$yy\n"; - Use of reference "%s" as array index [pp_aelem] $x[\1] @@ -275,32 +272,6 @@ Use of uninitialized value $x in concatenation (.) or string at - line 6. Use of uninitialized value $y in concatenation (.) or string at - line 7. Use of uninitialized value $y in concatenation (.) or string at - line 8. ######## -# pp_hot.c [pp_concat] -use warnings 'y2k'; -use Config; -BEGIN { - unless ($Config{ccflags} =~ /Y2KWARN/) { - print "SKIPPED\n# perl not built with -DPERL_Y2KWARN"; - exit 0; - } -} -my $x; -my $yy = 78; -$x = "19$yy\n"; -$x = "19" . $yy . "\n"; -$x = "319$yy\n"; -$x = "319" . $yy . "\n"; -$yy = 19; -$x = "ok $yy\n"; -$yy = 9; -$x = 1 . $yy; -no warnings 'y2k'; -$x = "19$yy\n"; -$x = "19" . $yy . "\n"; -EXPECT -Possible Y2K bug: about to append an integer to '19' at - line 12. -Possible Y2K bug: about to append an integer to '19' at - line 13. -######## # pp_hot.c [pp_aelem] { use warnings 'misc'; diff --git a/t/lib/warnings/sv b/t/lib/warnings/sv index 1276ee0..a9636e0 100644 --- a/t/lib/warnings/sv +++ b/t/lib/warnings/sv @@ -32,8 +32,6 @@ Undefined value assigned to typeglob - Possible Y2K bug: %d format string following '19' - Reference is already weak [Perl_sv_rvweaken] < [ 5.008, DEFAULT_OFF], 'regexp' => [ 5.008, DEFAULT_OFF], 'glob' => [ 5.008, DEFAULT_OFF], - 'y2k' => [ 5.008, DEFAULT_OFF], 'untie' => [ 5.008, DEFAULT_OFF], 'substr' => [ 5.008, DEFAULT_OFF], 'taint' => [ 5.008, DEFAULT_OFF],