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

Justin Murray jmurray at aerotech.com
Tue Dec 28 13:39:10 PST 2010


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