Subject: | Don't mix declarations with executable statements in XS code |
It is not allowed by C89, and it breaks under Microsoft VC, at least for
older versions.
I would have sent a github pull request, but the repo seems to be
out-of-date: git://github.com/rafl/devel-declare.git
--- Declare.xs.orig 2011-11-05 14:47:29.000000000 -0700
+++ Declare.xs 2011-12-07 18:06:45.700971700 -0800
@@ -490,13 +490,15 @@
if (!initialized) {
initialized = 1;
#if DD_GROW_VIA_BLOCKHOOK
- static BHK bhk;
+ {
+ static BHK bhk;
#if PERL_VERSION_GE(5,13,6)
- BhkENTRY_set(&bhk, bhk_start, dd_block_start);
+ BhkENTRY_set(&bhk, bhk_start, dd_block_start);
#else /* <5.13.6 */
- BhkENTRY_set(&bhk, start, dd_block_start);
+ BhkENTRY_set(&bhk, start, dd_block_start);
#endif /* <5.13.6 */
- Perl_blockhook_register(aTHX_ &bhk);
+ Perl_blockhook_register(aTHX_ &bhk);
+ }
#else /* !DD_GROW_VIA_BLOCKHOOK */
hook_op_check(OP_ENTEREVAL, dd_ck_entereval, NULL);
#endif /* !DD_GROW_VIA_BLOCKHOOK */