Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ævar Arnfjörð Bjarmason committed Jun 21, 2014
1 parent 0c60e31 commit 3664866
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
17 changes: 13 additions & 4 deletions lib/warnings.pm
Expand Up @@ -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.
Expand Down Expand Up @@ -301,6 +301,8 @@ The current hierarchy is:
|
+- misc
|
+- missing
|
+- numeric
|
+- once
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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 ;
Expand Down
9 changes: 7 additions & 2 deletions pod/perldiag.pod
Expand Up @@ -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

Expand Down
8 changes: 7 additions & 1 deletion regen/warnings.pl
Expand Up @@ -104,6 +104,8 @@ BEGIN
[ 5.021, DEFAULT_ON ],
}],

'missing' => [ 5.021, DEFAULT_OFF],

#'default' => [ 5.008, DEFAULT_ON ],
}],
} ;
Expand Down Expand Up @@ -472,7 +474,7 @@ sub mkOct
__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.
Expand Down Expand Up @@ -743,6 +745,10 @@ =head2 Category Hierarchy
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>
Expand Down
1 change: 0 additions & 1 deletion sv.c
Expand Up @@ -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)) {
Expand Down
1 change: 1 addition & 0 deletions warnings.h
Expand Up @@ -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"
Expand Down

0 comments on commit 3664866

Please sign in to comment.