diff options
author | Tony Cook <tony@develop-help.com> | 2021-03-18 14:37:01 +1100 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2022-10-26 11:11:08 +0200 |
commit | a73e2f42e4d90aabd3c1f9b45b5b18fab652e36e (patch) | |
tree | a49777fb3f48fdde784a7b68b567053ed91c2379 | |
parent | ee05e6d8953bcb0842d59e3379842b4df6929b1a (diff) | |
download | perl-a73e2f42e4d90aabd3c1f9b45b5b18fab652e36e.tar.gz |
op.c - copy cop_features to the COP inserted into the OP tree
All current features are compile-time, so this hasn't been an issue,
but my current implementation of the autovivification issue checks
features at runtime, which failed to work correctly if non-bundle
features were set.
This commit fixes things so that run-time default-on features also work
properly, by setting each COP's cop_features to the value of the bits
set at the COP's compile time - ie the same approach as cop_hints.
-rw-r--r-- | cop.h | 2 | ||||
-rw-r--r-- | op.c | 1 |
2 files changed, 3 insertions, 0 deletions
@@ -558,6 +558,8 @@ string C<p>, creating the package if necessary. #define CopHINTHASH_get(c) ((COPHH*)((c)->cop_hints_hash)) #define CopHINTHASH_set(c,h) ((c)->cop_hints_hash = (h)) +#define CopFEATURES_setfrom(dst, src) ((dst)->cop_features = (src)->cop_features) + /* =for apidoc Am|SV *|cop_hints_fetch_pv |const COP *cop|const char *key |U32 hash|U32 flags =for apidoc_item|SV *|cop_hints_fetch_pvn|const COP *cop|const char *key|STRLEN keylen|U32 hash|U32 flags @@ -8225,6 +8225,7 @@ Perl_newSTATEOP(pTHX_ I32 flags, char *label, OP *o) cop->cop_seq = seq; cop->cop_warnings = DUP_WARNINGS(PL_curcop->cop_warnings); CopHINTHASH_set(cop, cophh_copy(CopHINTHASH_get(PL_curcop))); + CopFEATURES_setfrom(cop, PL_curcop); if (label) { Perl_cop_store_label(aTHX_ cop, label, strlen(label), utf8); |