[antlr-interest] @init actions in “C Target ” have problems with MSVS compilers

Gavin Lambert antlr at mirality.co.nz
Thu Mar 22 12:15:43 PDT 2007


At 01:34 23/03/2007, Alexander Stasenko wrote:
 >Consider the following rule with @init action:
 >
 >		CharacterConstant @init {
 >				char c; int o;
 >		}
[...]
 >MSVS 2005 compiler can not compiler it since "char c; int o;"
 >declarations are placed after executable statements. This
 >restriction was relazed in C99 standart which is unfortunately
 >is not supported even in MSVS 2005 in its C-mode. Trying to
 >compile in C++ mode causes other problems in other places,
 >so usage of C++ mode is not a solution here.

I reported this one a couple of months back, but sadly it still 
doesn't seem to have been fixed.

I did work around it by compiling in C++ mode, though, although it 
required adding a lot of extern "C" blocks.  But really the 
codegen templates need to get fixed.  Or we need to get another 
code-insertion block that inserts at the top of the generated 
function instead of further down.



More information about the antlr-interest mailing list