[antlr-interest] Many unused variables in the generated parser c file

Sunil Sawkar ssawkar at aehr.com
Wed Jan 26 12:17:37 PST 2011


Hi,

Any suggestions as to how I can prevent unused variable declarations within 
the generated parser c file ? 

Thanks,
-Sunil Sawkar

Following is an example warning from compiler, and the related source in the c 
file:

compiler warning:

algoexprParser.c:5462: warning: unused variable ‘LA2_2’    
algoexprParser.c:5476: warning: unused variable ‘LA2_3’

source:
            for (;;)
            {
                int alt2=2;
                switch ( LA(1) ) 
                {
                case VARIABLE:
                case LABEL_NOT_VAR:
                	{
                		{
                		   /* 
dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState)
                		    */
                		    int LA2_2 = LA(2);
                		    if ( (synpred2_algoexpr(ctx)) ) 
                		    {
                		        alt2=1;
                		    }

                		}
                	}
                    break;
                case 72:
                	{
                		{
                		   /* 
dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState)
                		    */
                		    int LA2_3 = LA(2);
                		    if ( (synpred2_algoexpr(ctx)) ) 
                		    {
                		        alt2=1;
                		    }

                		}
                	}
                    break;
.....


More information about the antlr-interest mailing list