From: Steve Hay Date: Wed, 6 May 2009 11:50:09 +0000 (+0100) Subject: Fix code before declaration compile error on Win32 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=938cfd5cbc71c8edc25160094f2b45a593724fb5;p=p5sagit%2Fp5-mst-13.2.git Fix code before declaration compile error on Win32 The code written out by ExtUtils::Miniperl::writemain() contained the code PERL_UNUSED_CONTEXT; before the declarations const char file[] = __FILE__; dXSUB_SYS; which Win32's VC++ compiler doesn't like. --- diff --git a/minimod.pl b/minimod.pl index fea77c0..bd945c2 100644 --- a/minimod.pl +++ b/minimod.pl @@ -67,11 +67,12 @@ sub writemain{ print "EXTERN_C void boot_${cname} (pTHX_ CV* cv);\n"; } - my ($tail1,$tail2) = ( $tail =~ /\A(.*\n)(\s*\}.*)\Z/s ); - print $tail1; + my ($tail1,$tail2,$tail3) = ( $tail =~ /\A(.*{\s*\n)(.*\n)(\s*\}.*)\Z/s ); + print $tail1; print "\tconst char file[] = __FILE__;\n"; print "\tdXSUB_SYS;\n" if $] > 5.002; + print $tail2; foreach $_ (@exts){ my($pname) = canon('/', $_); @@ -91,7 +92,7 @@ sub writemain{ } print "\t}\n"; } - print $tail2; + print $tail3; } sub canon{