[antlr-interest] g++ compiler warnings on the generated lexer and parser .c files

Sunil Sawkar ssawkar at aehr.com
Mon Nov 1 10:53:15 PDT 2010


Hi,

Is there anyway to get rid of "unused variables"  to eliminate the compiler 
warnings such as:

algoexprLexer.c: In function ‘ANTLR3_INT32 
dfa47_sst(algoexprLexer_Ctx_struct*, ANTLR3_BASE_RECOGNIZER_struct*, 
ANTLR3_INT_STREAM_struct*, ANTLR3_CYCLIC_DFA_struct*, ANTLR3_INT32)’:                                                                                                                                                         
algoexprLexer.c:10940: warning: unused variable ‘index47_62’                                                                                                           
algoexprLexer.c:10964: warning: unused variable ‘index47_170’

algoexprParser.c: In function ‘algoexprParser_set_op_return 
set_op(algoexprParser_Ctx_struct*)’:
algoexprParser.c:3478: warning: unused variable ‘LA9_1’                                                                                                                
algoexprParser.c: In function ‘algoexprParser_algo_vector_return 
algo_vector(algoexprParser_Ctx_struct*)’:
algoexprParser.c:8901: warning: unused variable ‘LA47_1’                                                                                                               
algoexprParser.c:8915: warning: unused variable ‘LA47_2’

I have checked my grammar file to make sure everything in there is being used. 
Yet I see these warnings. When I look in the generated source, I can see these 
variables being declared but not referenced anywhere.

Any help appreciated..

-Sunil Sawkar


More information about the antlr-interest mailing list