feature.h: Mask hints in CURRENT_FEATURE_BUNDLE
authorFather Chrysostomos <sprout@cpan.org>
Sun, 29 Jan 2012 07:06:25 +0000 (23:06 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 29 Jan 2012 07:35:14 +0000 (23:35 -0800)
Otherwise CURRENT_FEATURE_BUNDLE will end up including any hints added
later that happen to use higher bits.

This was causing autobox to turn off all features, causing failures
for Dist::Zilla::PluginBundle::AVAR.

I’m not adding tests for this, as such tests would need constant
tweaking in future perl developement.  What autobox is doing is
naughty and unsupported anyway.

feature.h
regen/feature.pl

index 2d06450..60bf41d 100644 (file)
--- a/feature.h
+++ b/feature.h
@@ -17,7 +17,8 @@
 
 #define CURRENT_HINTS \
     (PL_curcop == &PL_compiling ? PL_hints : PL_curcop->cop_hints)
-#define CURRENT_FEATURE_BUNDLE (CURRENT_HINTS >> HINT_FEATURE_SHIFT)
+#define CURRENT_FEATURE_BUNDLE \
+    ((CURRENT_HINTS & HINT_FEATURE_MASK) >> HINT_FEATURE_SHIFT)
 
 #define FEATURE_IS_ENABLED(name)                                       \
        ((CURRENT_HINTS                                                  \
index 05643d9..2444ad1 100755 (executable)
@@ -226,7 +226,8 @@ print $h <<'EOH';
 
 #define CURRENT_HINTS \
     (PL_curcop == &PL_compiling ? PL_hints : PL_curcop->cop_hints)
-#define CURRENT_FEATURE_BUNDLE (CURRENT_HINTS >> HINT_FEATURE_SHIFT)
+#define CURRENT_FEATURE_BUNDLE \
+    ((CURRENT_HINTS & HINT_FEATURE_MASK) >> HINT_FEATURE_SHIFT)
 
 #define FEATURE_IS_ENABLED(name)                                       \
        ((CURRENT_HINTS                                                  \