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

Jim Idle jimi at temporal-wave.com
Wed Nov 10 09:34:28 PST 2010


You probably need to suppress the warnings for that. The compiler will get rid of them anyway. I thought that this was already done in the generated header but perhaps a different pragma is required if compiling as C++.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Sunil Sawkar
> Sent: Monday, November 01, 2010 10:53 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] g++ compiler warnings on the generated lexer
> and parser .c files
> 
> 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
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address



More information about the antlr-interest mailing list