[antlr-interest] void* conversion in C runtime

Gary R. Van Sickle g.r.vansickle at att.net
Sun Feb 22 04:47:34 PST 2009


Hi Jim,

Looks like you may have "missed a spot" or two.  With the recent 3.1.2
release I'm getting a number of such errors.  E.g. here's one:


static pss9_combined_lexer_parserParser_declaration_SCOPE
pss9_combined_lexer_parserParser_declarationPush(pss9_combined_lexer_parserP
arser ctx)
{
    /* Pointer used to create a new set of attributes
     */
    pss9_combined_lexer_parserParser_declaration_SCOPE      newAttributes;

    /* Allocate the memory for a new structure if we need one.
     */
    if
(ctx->pss9_combined_lexer_parserParser_declarationStack->size(ctx->pss9_comb
ined_lexer_parserParser_declarationStack) >
ctx->pss9_combined_lexer_parserParser_declarationStack_limit)
    {
        // The current limit value was less than the number of scopes
available on the stack so
        // we can just reuse one. Our limit tracks the stack count, so the
index of the entry we want
        // is one less than that, or conveniently, the current value of
limit.
        //
	///// GRVS: HERE'S THE ERROR:
        newAttributes =
ctx->pss9_combined_lexer_parserParser_declarationStack->get(ctx->pss9_combin
ed_lexer_parserParser_declarationStack,
ctx->pss9_combined_lexer_parserParser_declarationStack_limit);
    }
    else
    {
        // Need a new allocation
        //
        newAttributes = (pss9_combined_lexer_parserParser_declaration_SCOPE)
ANTLR3_MALLOC(sizeof(ss9_combined_lexer_parserParser_declaration_SCOPE));
        if  (newAttributes != NULL)
        {
            /* Standard ANTLR3 library implementation
             */
 
ctx->pss9_combined_lexer_parserParser_declarationStack->push(ctx->pss9_combi
ned_lexer_parserParser_declarationStack, newAttributes, (void (*)(void
*))declarationFree);
        }
    }
	[...etc...]


This gets me the following error from gcc:

ss9_combined_lexer_parserParser.cpp: In function
`ss9_combined_lexer_parserParser_declaration_SCOPE_struct*
pss9_combined_lexer_parserParser_declarationPush(ss9_combined_lexer_parserPa
rser_Ctx_struct*)':
ss9_combined_lexer_parserParser.cpp:353: error: invalid conversion from
`void*' to `ss9_combined_lexer_parserParser_declaration_SCOPE_struct*'

There's different breakage as well.  Check this out:


    	if	(SCOPE_TOP(external_declaration)>free != NULL)
	{
 
SCOPE_TOP(external_declaration)>->free(SCOPE_TOP(external_declaration));
	}


Not quite sure what's going on there, but in the first case it looks like
there's one too few "-"'s and in the second one too many ">"'s before the
"free".

-- 
Gary R. Van Sickle
 

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org 
> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jim Idle
> Sent: Saturday, February 21, 2009 7:46 PM
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] void* conversion in C runtime
> 
> Robert Soule wrote:
> > Hi Jim,
> >
> > Is there a stable version of the antlr tool jar that supports this 
> > change? I got:
> >
> > antlr-3.1.2-SNAPSHOT-jar-with-dependencies.jar
> >
> > from:
> >
> > 
> http://antlr.org/hudson/job/ANTLR_Tool/lastSuccessfulBuild/org.antlr$a
> > ntlr/
> >
> > but the code it generates doesn't compile. I see from the web page 
> > that there are 17 failures in the unit tests.
> >   
> 
> Unit tests are known failures, mostly down to the tests 
> themselves, but you can download the 3.1.2 release now from 
> the main download page.
> 
> Jim
> > thanks,
> > Robert
> >
> >
> > On Fri, Feb 20, 2009 at 4:00 PM, Jim Idle 
> <jimi at temporal-wave.com> wrote:
> >   
> >> Robert Soule wrote:
> >>     
> >>> I am using antlr-3.1.1.jar and libantlr3c-3.1.2.b1.
> >>>
> >>> If this change doesn't get into the official release, can I get a 
> >>> copy from cvs or something?
> >>>
> >>>       
> >> I have just fixed it, so that one will be in the release.
> >>
> >> In order to get other fixes like this, you need to use the 
> >> 3.1.2-SNAPSHOT jar. You can get the latest jars by visiting 
> >> org.antlr/hudson, where you will be able to pick up that 
> change later 
> >> this afternoon (check the recent changes link).
> >>
> >> Jim
> >>
> >> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> >> Unsubscribe: 
> >> 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-addres
> >> s
> >>
> >>     
> 
> 
> 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