[antlr-interest] ANTLR-generated code & Findbugs

Kay Roepke kroepke at classdump.org
Tue Oct 31 14:42:55 PST 2006


On 31. Oct 2006, at 21:47 , Jim Idle wrote:

> Surely the objective C compiler does not generate code and overhead  
> for unused stuff unless it is told to? Perhaps we should write a  
> new one? ;-)

;) Before you ask, it's gcc 4.0.1 and yes it sucks...

I was talking about building up lists of matched tokens when building  
ASTs. Most of the time these lists are built up but not subsequently  
used in rewriting actions. I'm not totally sure whether I can  
influence this in codegen, or if ANTLR must detect this.
So in a sense, it is used, but useless...

>> though I'd like to get rid of the warnings, too.
>
> The C code generator generates code that compiles without warning  
> at W4 mode in Visual C++. In some case though I rely on ensuring  
> that all pointers etc are initialized, then turning off the warning  
> about variables that are initialized and used, allowing the  
> compiler to optimize them away. Perhaps you can do the same? I am  
> sure that eventually Ter could identify these suckers and cull them  
> from the codegen, but this seems effort that would be best spent  
> elsewhere at the moment?

I agree that time should be spent where it helps most. This is  
currently bugfixing and not getting rid of warnings about unused  
variables.

It surprises me that you don't have warnings about unused variables  
created for lookahead chars/tokens. They don't hurt and get optimized  
away properly but nevertheless they bug me. For my C grammar I get  
about 190 of the in the parser.
I could turn off these warnings, but I'd rather fix the cause than  
suppress the symptoms. But it is not pressing.

cheers,

-k






More information about the antlr-interest mailing list