summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-02-02 06:27:43 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-02-02 06:27:43 +0000
commit327afb7f88ad8e777feb1035abf13a2fc193c626 (patch)
tree916fcc7a43a6ceac75fc328a9effecf032e0485d
parentb9b446592491a9e83ac86f67237cd6509788def1 (diff)
downloadperl-327afb7f88ad8e777feb1035abf13a2fc193c626.tar.gz
future-proof unknown warning categories (from Greg Bacon
<gbacon@cs.uah.edu>) p4raw-id: //depot/perl@4947
-rw-r--r--lib/warnings.pm15
-rw-r--r--t/pragma/warn/2use6
-rw-r--r--warnings.pl15
3 files changed, 18 insertions, 18 deletions
diff --git a/lib/warnings.pm b/lib/warnings.pm
index e15d364193..977395b74e 100644
--- a/lib/warnings.pm
+++ b/lib/warnings.pm
@@ -115,14 +115,15 @@ sub bits {
my $catmask ;
my $fatal = 0 ;
foreach my $word (@_) {
- if ($word eq 'FATAL')
- { $fatal = 1 }
- elsif ($catmask = $Bits{$word}) {
- $mask |= $catmask ;
- $mask |= $DeadBits{$word} if $fatal ;
+ if ($word eq 'FATAL') {
+ $fatal = 1;
+ }
+ else {
+ if ($catmask = $Bits{$word}) {
+ $mask |= $catmask ;
+ $mask |= $DeadBits{$word} if $fatal ;
+ }
}
- else
- { croak "unknown warning category '$word'" }
}
return $mask ;
diff --git a/t/pragma/warn/2use b/t/pragma/warn/2use
index 384b3b361e..396f20142c 100644
--- a/t/pragma/warn/2use
+++ b/t/pragma/warn/2use
@@ -5,11 +5,9 @@ TODO
__END__
-# check illegal category is caught
-use warnings 'blah' ;
+# ignore unknown warning categories
+use warnings 'this-should-never-be-a-warning-category' ;
EXPECT
-unknown warning category 'blah' at - line 3
-BEGIN failed--compilation aborted at - line 3.
########
# Check compile time scope of pragma
diff --git a/warnings.pl b/warnings.pl
index 72d19af67b..8d3450b4cd 100644
--- a/warnings.pl
+++ b/warnings.pl
@@ -300,14 +300,15 @@ sub bits {
my $catmask ;
my $fatal = 0 ;
foreach my $word (@_) {
- if ($word eq 'FATAL')
- { $fatal = 1 }
- elsif ($catmask = $Bits{$word}) {
- $mask |= $catmask ;
- $mask |= $DeadBits{$word} if $fatal ;
+ if ($word eq 'FATAL') {
+ $fatal = 1;
+ }
+ else {
+ if ($catmask = $Bits{$word}) {
+ $mask |= $catmask ;
+ $mask |= $DeadBits{$word} if $fatal ;
+ }
}
- else
- { croak "unknown warning category '$word'" }
}
return $mask ;