diff options
author | Florian Ragwitz <rafl@debian.org> | 2010-09-10 20:09:27 +0200 |
---|---|---|
committer | Florian Ragwitz <rafl@debian.org> | 2010-09-10 20:09:27 +0200 |
commit | 1378181044ae371d10218f7cd4456d83c4cb3f50 (patch) | |
tree | fc47b385d21eb62926177db56ee666608a245fe9 /warnings.pl | |
parent | c927b67657643fae661071a5ac37bb1502732181 (diff) | |
download | perl-1378181044ae371d10218f7cd4456d83c4cb3f50.tar.gz |
Update warnings.pl with the ::register changes
Also regenerate lib/warnings.pm from that.
Diffstat (limited to 'warnings.pl')
-rw-r--r-- | warnings.pl | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/warnings.pl b/warnings.pl index e57ed1f513..1e136f6336 100644 --- a/warnings.pl +++ b/warnings.pl @@ -599,6 +599,11 @@ Equivalent to: if (warnings::enabled($object)) { warnings::warn($object, $message) } +=item warnings::register(@names) + +This registers warning categories for the given names and is primarily for +use by the warnings::register pragma, for which see L<perllexwarn>. + =back See L<perlmodlib/Pragmatic Modules> and L<perllexwarn>. @@ -775,10 +780,37 @@ sub __chk Carp::carp($message); } +sub _mkMask +{ + my ($bit) = @_; + my $mask = ""; + + vec($mask, $bit, 1) = 1; + return $mask; +} + +sub register +{ + my @names = @_; + + for my $name (@names) { + if (! defined $Bits{$name}) { + $Bits{$name} = _mkMask($LAST_BIT); + vec($Bits{'all'}, $LAST_BIT, 1) = 1; + $Offsets{$name} = $LAST_BIT ++; + foreach my $k (keys %Bits) { + vec($Bits{$k}, $LAST_BIT, 1) = 0; + } + $DeadBits{$name} = _mkMask($LAST_BIT); + vec($DeadBits{'all'}, $LAST_BIT++, 1) = 1; + } + } +} + sub _error_loc { require Carp; goto &Carp::short_error_loc; # don't introduce another stack frame -} +} sub enabled { |