diff options
author | Ævar Arnfjörð Bjarmason <avar@cpan.org> | 2014-01-19 14:58:02 +0000 |
---|---|---|
committer | Ævar Arnfjörð Bjarmason <avar@cpan.org> | 2014-06-21 13:54:22 +0000 |
commit | 3664866ee329279683fd8c71e52e5983da4272dd (patch) | |
tree | 95050b402ac4538196e36d3a4dfdd5a2a5b76125 | |
parent | 0c60e3193cada7eee789f68009742a6f1c55c0ac (diff) | |
download | perl-3664866ee329279683fd8c71e52e5983da4272dd.tar.gz |
Split up the fake "missing" warning category into an actual category
Ever since the warning for missing printf arguments was added in
v5.11.2-116-g7baa469 the "missing" warning category has been defined in
terms of the "uninitialized" category, so you couldn't turn it on/off
independently of that.
As discussed in RT #121025 I'm hacking on adding a new "reduntant"
category for too many printf arguments. So add the long-missing
"missing" category in preparation for that for consistency.
-rw-r--r-- | lib/warnings.pm | 17 | ||||
-rw-r--r-- | pod/perldiag.pod | 9 | ||||
-rw-r--r-- | regen/warnings.pl | 8 | ||||
-rw-r--r-- | sv.c | 1 | ||||
-rw-r--r-- | warnings.h | 1 |
5 files changed, 28 insertions, 8 deletions
diff --git a/lib/warnings.pm b/lib/warnings.pm index 37e6e56556..f650ef06ed 100644 --- a/lib/warnings.pm +++ b/lib/warnings.pm @@ -5,7 +5,7 @@ package warnings; -our $VERSION = '1.24'; +our $VERSION = '1.25'; # Verify that we're called correctly so that warnings will work. # see also strict.pm. @@ -301,6 +301,8 @@ The current hierarchy is: | +- misc | + +- missing + | +- numeric | +- once @@ -396,6 +398,10 @@ Note: Before Perl 5.8.0, the lexical warnings category "deprecated" was a sub-category of the "syntax" category. It is now a top-level category in its own right. +Note: Before 5.21.0, the "missing" lexical warnings category was +internally defined to be the same as the "uninitialized" category. It +is now a top-level category in its own right. + =head2 Fatal Warnings X<warning, fatal> @@ -818,10 +824,11 @@ our %Offsets = ( # Warnings Categories added in Perl 5.021 'experimental::win32_perlio'=> 120, + 'missing' => 122, ); our %Bits = ( - 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x01", # [0..60] + 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x05", # [0..61] 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00", # [29] 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00", # [30] 'closed' => "\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6] @@ -849,6 +856,7 @@ our %Bits = ( 'layer' => "\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8] 'malloc' => "\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [25] 'misc' => "\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12] + 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [61] 'newline' => "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9] 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00", # [48] 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00", # [49] @@ -885,7 +893,7 @@ our %Bits = ( ); our %DeadBits = ( - 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x02", # [0..60] + 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x0a", # [0..61] 'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00", # [29] 'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00", # [30] 'closed' => "\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6] @@ -913,6 +921,7 @@ our %DeadBits = ( 'layer' => "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8] 'malloc' => "\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [25] 'misc' => "\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12] + 'missing' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [61] 'newline' => "\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [9] 'non_unicode' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00", # [48] 'nonchar' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00", # [49] @@ -950,7 +959,7 @@ our %DeadBits = ( $NONE = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; $DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x55\x15\x01", # [2,56,52,53,57,54,58,55,60,4,22,23,25] -$LAST_BIT = 122 ; +$LAST_BIT = 124 ; $BYTES = 16 ; $All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ; diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 8bd44acb09..86ba73b879 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2987,8 +2987,13 @@ separate two digits. =item Missing argument in %s -(W uninitialized) A printf-type format required more arguments than were -supplied. +(W missing) You called a function with fewer arguments than other +arguments you supplied indicated would be needed. + +Currently only emitted when a printf-type format required more +arguments than were supplied, but might be used in the future for +other cases where we can statically determine that arguments to +functions are missing, e.g. for the L<perlfunc/pack> function. =item Missing argument to -%c diff --git a/regen/warnings.pl b/regen/warnings.pl index 49fc88a6fe..b910657b7f 100644 --- a/regen/warnings.pl +++ b/regen/warnings.pl @@ -104,6 +104,8 @@ my $tree = { [ 5.021, DEFAULT_ON ], }], + 'missing' => [ 5.021, DEFAULT_OFF], + #'default' => [ 5.008, DEFAULT_ON ], }], } ; @@ -472,7 +474,7 @@ read_only_bottom_close_and_rename($pm); __END__ package warnings; -our $VERSION = '1.24'; +our $VERSION = '1.25'; # Verify that we're called correctly so that warnings will work. # see also strict.pm. @@ -743,6 +745,10 @@ Note: Before Perl 5.8.0, the lexical warnings category "deprecated" was a sub-category of the "syntax" category. It is now a top-level category in its own right. +Note: Before 5.21.0, the "missing" lexical warnings category was +internally defined to be the same as the "uninitialized" category. It +is now a top-level category in its own right. + =head2 Fatal Warnings X<warning, fatal> @@ -10522,7 +10522,6 @@ Perl_sv_vsetpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen, * Warn of missing argument to sprintf, and then return a defined value * to avoid inappropriate "use of uninit" warnings [perl #71000]. */ -#define WARN_MISSING WARN_UNINITIALIZED /* Not sure we want a new category */ STATIC SV* S_vcatpvfn_missing_argument(pTHX) { if (ckWARN(WARN_MISSING)) { diff --git a/warnings.h b/warnings.h index 5bbb691edd..a5bd2391ec 100644 --- a/warnings.h +++ b/warnings.h @@ -105,6 +105,7 @@ /* Warnings Categories added in Perl 5.021 */ #define WARN_EXPERIMENTAL__WIN32_PERLIO 60 +#define WARN_MISSING 61 #define WARNsize 16 #define WARN_ALLstring "\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125" |