diff options
-rw-r--r-- | INSTALL | 2 | ||||
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | README.Y2K | 47 | ||||
-rw-r--r-- | lib/warnings.pm | 15 | ||||
-rw-r--r-- | pod/buildtoc | 1 | ||||
-rw-r--r-- | pod/perldiag.pod | 5 | ||||
-rw-r--r-- | pod/perllexwarn.pod | 2 | ||||
-rw-r--r-- | pp_hot.c | 11 | ||||
-rw-r--r-- | sv.c | 13 | ||||
-rw-r--r-- | t/lib/warnings/pp_hot | 29 | ||||
-rw-r--r-- | t/lib/warnings/sv | 36 | ||||
-rw-r--r-- | t/op/caller.t | 16 | ||||
-rw-r--r-- | warnings.h | 3 | ||||
-rw-r--r-- | warnings.pl | 1 |
14 files changed, 17 insertions, 165 deletions
@@ -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 @@ -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 a3eb5502aa..0000000000 --- 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 86e4fcee0a..635993bbd8 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 e4dc82ade3..7d5b01996b 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 c3035a1892..675ac5278c 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 12ce1f6c82..f250fb41ef 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 @@ -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); @@ -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 f5a580337c..070aaf0aa5 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 1276ee056e..a9636e0cf7 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] <<TODO Mandatory Warnings @@ -317,40 +315,6 @@ EXPECT Undefined value assigned to typeglob at - line 3. ######## # sv.c -use warnings 'y2k'; -use Config; -BEGIN { - unless ($Config{ccflags} =~ /Y2KWARN/) { - print "SKIPPED\n# perl not built with -DPERL_Y2KWARN"; - exit 0; - } - $|=1; -} -my $x; -my $yy = 78; -$x = printf "19%02d\n", $yy; -$x = sprintf "#19%02d\n", $yy; -$x = printf " 19%02d\n", 78; -$x = sprintf "19%02d\n", 78; -$x = printf "319%02d\n", $yy; -$x = sprintf "319%02d\n", $yy; -no warnings 'y2k'; -$x = printf "19%02d\n", $yy; -$x = sprintf "19%02d\n", $yy; -$x = printf "19%02d\n", 78; -$x = sprintf "19%02d\n", 78; -EXPECT -Possible Y2K bug: %d format string following '19' at - line 16. -Possible Y2K bug: %d format string following '19' at - line 13. -1978 -Possible Y2K bug: %d format string following '19' at - line 14. -Possible Y2K bug: %d format string following '19' at - line 15. - 1978 -31978 -1978 -1978 -######## -# sv.c use warnings 'numeric' ; $a = "\x{100}\x{200}" * 42; no warnings 'numeric' ; diff --git a/t/op/caller.t b/t/op/caller.t index c97191b14a..4d90aeafd3 100644 --- a/t/op/caller.t +++ b/t/op/caller.t @@ -67,21 +67,23 @@ ok( $c[4], "hasargs true with unknown sub" ); sub testwarn { my $w = shift; - is( (caller(0))[9], $w, "warnings"); + is( (caller(0))[9], $w, "warnings match caller"); } # NB : extend the warning mask values below when new warnings are added { no warnings; - BEGIN { is( ${^WARNING_BITS}, "\0" x 12, 'warning bits' ) } + BEGIN { is( ${^WARNING_BITS}, "\0" x 12, 'all bits off via "no warnings"' ) } testwarn("\0" x 12); + use warnings; - BEGIN { is( ${^WARNING_BITS}, "U" x 12, 'warning bits' ) } - BEGIN { testwarn("U" x 12); } + BEGIN { is( ${^WARNING_BITS}, "UUUUUUUUUUU\025", 'default bits on via "use warnings"' ); } + BEGIN { testwarn("UUUUUUUUUUU\025", "#1"); } # run-time : # the warning mask has been extended by warnings::register - testwarn("UUUUUUUUUUUU\001"); + testwarn("UUUUUUUUUUUU"); + use warnings::register; - BEGIN { is( ${^WARNING_BITS}, "UUUUUUUUUUUU\001", 'warning bits' ) } - testwarn("UUUUUUUUUUUU\001"); + BEGIN { is( ${^WARNING_BITS}, "UUUUUUUUUUUU", 'warning bits on via "use warnings::register"' ) } + testwarn("UUUUUUUUUUUU","#3"); } diff --git a/warnings.h b/warnings.h index 2798467a25..11efe1dc7e 100644 --- a/warnings.h +++ b/warnings.h @@ -71,11 +71,10 @@ #define WARN_UNTIE 43 #define WARN_UTF8 44 #define WARN_VOID 45 -#define WARN_Y2K 46 /* Warnings Categories added in Perl 5.009 */ -#define WARN_ASSERTIONS 47 +#define WARN_ASSERTIONS 46 #define WARNsize 12 #define WARN_ALLstring "\125\125\125\125\125\125\125\125\125\125\125\125" diff --git a/warnings.pl b/warnings.pl index 43f0aa6e12..e7659b9374 100644 --- a/warnings.pl +++ b/warnings.pl @@ -49,7 +49,6 @@ my $tree = { 'misc' => [ 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], |