summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-03-04 22:23:41 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-03-04 22:23:41 +0000
commit75b6c4caab1abb3506eab9e8e512c69bbeb1c49f (patch)
treedb7e5e70081c15524e3f4de91ac64c8fca63575f /mg.c
parent8fa7688f7865696bdfa78bc12d4ffb78bd1d6103 (diff)
downloadperl-75b6c4caab1abb3506eab9e8e512c69bbeb1c49f.tar.gz
Patch by Salvador FandiƱo to read the warning mask
returned by caller() and ${^WARNING_BITS} from $warnings::Bits{all} and not from the hardcoded core constant. (This mask could have been extended by warnings::register.) Plus tests. p4raw-id: //depot/perl@18829
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index 433cc23b01..3f462eeb73 100644
--- a/mg.c
+++ b/mg.c
@@ -676,7 +676,16 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
sv_setpvn(sv, WARN_NONEstring, WARNsize) ;
}
else if (PL_compiling.cop_warnings == pWARN_ALL) {
- sv_setpvn(sv, WARN_ALLstring, WARNsize) ;
+ /* Get the bit mask for $warnings::Bits{all}, because
+ * it could have been extended by warnings::register */
+ SV **bits_all;
+ HV *bits=get_hv("warnings::Bits", FALSE);
+ if (bits && (bits_all=hv_fetch(bits, "all", 3, FALSE))) {
+ sv_setsv(sv, *bits_all);
+ }
+ else {
+ sv_setpvn(sv, WARN_ALLstring, WARNsize) ;
+ }
}
else {
sv_setsv(sv, PL_compiling.cop_warnings);