[antlr-interest] [C target] Warnings in 64-bit compile

Jim Idle jimi at temporal-wave.com
Tue Dec 28 13:46:17 PST 2010


Ah it is probably because the backtrack and memorize option. I strongly
advise that you don't use these but left factor your grammar. However, I
will fix it of course.

Jim

> -----Original Message-----
> From: Justin Murray [mailto:jmurray at aerotech.com]
> Sent: Tuesday, December 28, 2010 1:39 PM
> To: Jim Idle; antlr-interest at antlr.org
> Subject: RE: [antlr-interest] [C target] Warnings in 64-bit compile
>
> I believe that it is caused by using the memorize=true; option and
> building 64-bit. The following grammar has these warnings in the
> generated TestParser.c (compiled as C++ code in Visual Studio 2008).
> You will find the offending line at the beginning of the generated
> prog() function.
>
> -----------------------------
> grammar Test;
>
> options
> {
> 	language=C;
> 	backtrack=true;
> 	memoize=true;
> }
>
> prog
> 	:	SOMETHING+;
>
> SOMETHING
> 	:	'A'..'Z';
> ------------------------------
>
> Thanks,
>
> Justin
>
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org
> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jim Idle
> Sent: Tuesday, December 28, 2010 3:04 PM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] [C target] Warnings in 64-bit compile
>
> There were some such warnings a number of versions back but they are
> all fixed as far as I know. What construct are you using that results
> in the warning? If you give me a reproducible grammar snippet, then I
> will fix it for the next release, which is just waiting on my other
> commitments right now.
>
> Jim
>
> > -----Original Message-----
> > From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> > bounces at antlr.org] On Behalf Of Justin Murray
> > Sent: Tuesday, December 28, 2010 11:59 AM
> > To: antlr-interest at antlr.org
> > Subject: [antlr-interest] [C target] Warnings in 64-bit compile
> >
> > Jim,
> >
> >
> >
> > I am working on making our compiler support 64-bit builds, and have
> run
> > into a number of compiler warnings due to conflicting types in the
> > ANTLR generated C code:
> >
> >
> >
> > warning C4244: '=' : conversion from 'ANTLR3_MARKER' to
> > 'ANTLR3_UINT32', possible loss of data
> >
> >
> >
> > This comes from the line:
> >
> >
> >
> > axisMask_StartIndex = INDEX();
> >
> >
> >
> > axisMask_StartIndex is declared as type ANTLR3_UINT32, and INDEX() is
> > returning type ANTLR3_MARKER. On a 64-bit build (on a Windows
> machine),
> > ANTLR3_UINT32 is a typedef of uint32_t, and ANTLR3_MARKER is of type
> > ANTLR3_INT64 which is a typedef of int64_t. It seems to me that this
> is
> > a bug in the template, and that axisMask_StartIndex should have been
> > declared as type ANTLR3_MARKER.
> >
> >
> >
> > My questions are, do you know of a quick workaround for this for now?
> > Do you know if this will be fixed in the next release of the C target
> > runtime? Also, is there a tenative release date for the C runtime
> that
> > will officially support ANTLR 3.3 (it seems that the code generated
> by
> > ANTLR 3.3 works ok with the 3.2 C runtime)?
> >
> >
> >
> > Thanks,
> >
> > Justin Murray
> > Software Engineer
> > jmurray at aerotech.com
> >
> > Aerotech, Inc.
> > 101 Zeta Drive
> > Pittsburgh, PA 15238
> > 412-963-7470
> >
> >
> >
> >
> > List: http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe: http://www.antlr.org/mailman/options/antlr-
> interest/your-
> > email-address
>
> 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