summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-03-31 13:50:04 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-04-03 08:46:03 -0700
commitd1718a7cf54f01c3c9d449a1ea96c9bba32d1126 (patch)
treee8589072ca6d679a871b14f215413bc51da4a517 /op.c
parent6331a2f5f6ee89f25cb6803c1d9ef97d6d1799e5 (diff)
downloadperl-d1718a7cf54f01c3c9d449a1ea96c9bba32d1126.tar.gz
[perl #111462] Move strict hints from %^H to $^H
With commit b50b20584, strict.pm starting putting hints in %^H to indicate that strict mode has been enabled or disabled explicitly, so version declarations should not change the setting. This causes ‘Unbalanced string table refcount’ warnings when Safe.pm encounters prohibited ops. This happens because ops are leaking when those ops point to HEKs (in the internal form that %^H takes when attached to ops). This commit moves those new strict hints into $^H, to avoid those warnings. This does simply paper over the real problem (leaked ops), but at least it gets the warnings back down to the 5.14 amount. Because of the new hints in $^H, B::Concise has been updated to account for them, and so have all its tests. I modified OptreeCheck to avoid setting the hints with ‘no strict;’, as that resulted in slightly fewer changes to the tests. It will also result in fewer changes to the tests in future. Two B::Deparse tests started failing due to %^H not being localised. Apparently there is a bug somewhere (in perl, Deparse.pm or deparse.t) that got triggered as a result. In fact, one of the tests exhibited *two* bugs. But for now, I’ve simply added a workaround to the two tests so they don’t trigger those bugs (which bugs will have to wait till after 5.16).
Diffstat (limited to 'op.c')
-rw-r--r--op.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/op.c b/op.c
index 1e6addb023..c585b98040 100644
--- a/op.c
+++ b/op.c
@@ -4688,9 +4688,6 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg)
newSTATEOP(0, NULL, imop) ));
if (use_version) {
- HV * const hinthv = GvHV(PL_hintgv);
- const bool hhoff = !hinthv || !(PL_hints & HINT_LOCALIZE_HH);
-
/* Enable the
* feature bundle that corresponds to the required version. */
use_version = sv_2mortal(new_version(use_version));
@@ -4699,20 +4696,20 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg)
/* If a version >= 5.11.0 is requested, strictures are on by default! */
if (vcmp(use_version,
sv_2mortal(upg_version(newSVnv(5.011000), FALSE))) >= 0) {
- if (hhoff || !hv_exists(hinthv, "strict/refs", 11))
+ if (!(PL_hints & HINT_EXPLICIT_STRICT_REFS))
PL_hints |= HINT_STRICT_REFS;
- if (hhoff || !hv_exists(hinthv, "strict/subs", 11))
+ if (!(PL_hints & HINT_EXPLICIT_STRICT_SUBS))
PL_hints |= HINT_STRICT_SUBS;
- if (hhoff || !hv_exists(hinthv, "strict/vars", 11))
+ if (!(PL_hints & HINT_EXPLICIT_STRICT_VARS))
PL_hints |= HINT_STRICT_VARS;
}
/* otherwise they are off */
else {
- if (hhoff || !hv_exists(hinthv, "strict/refs", 11))
+ if (!(PL_hints & HINT_EXPLICIT_STRICT_REFS))
PL_hints &= ~HINT_STRICT_REFS;
- if (hhoff || !hv_exists(hinthv, "strict/subs", 11))
+ if (!(PL_hints & HINT_EXPLICIT_STRICT_SUBS))
PL_hints &= ~HINT_STRICT_SUBS;
- if (hhoff || !hv_exists(hinthv, "strict/vars", 11))
+ if (!(PL_hints & HINT_EXPLICIT_STRICT_VARS))
PL_hints &= ~HINT_STRICT_VARS;
}
}