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

Justin Murray jmurray at aerotech.com
Thu Jul 21 10:53:11 PDT 2011


Understood, thanks!

On 7/21/2011 1:49 PM, Jim Idle wrote:
> Well actually as this is a change to the template, it is not in the 3.4
> release, but will be in the next patch release (should there be one).
>
> Jim
>
>> -----Original Message-----
>> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
>> bounces at antlr.org] On Behalf Of Justin Murray
>> Sent: Thursday, July 21, 2011 10:19 AM
>> To: antlr-interest at antlr.org
>> Subject: Re: [antlr-interest] [C target] Warnings in 64-bit compile
>>
>> Hi Jim,
>>
>> I think I tracked down and fixed this bug in the C target template.
>> Attached is the patched version of C.stg, which I extracted from antlr-
>> 3.4-complete-no-antlrv2.jar/org/antlr/codegen/templates/C/C.stg
>> and modified. It looks like it is a simple one line fix on line 1699,
>> changing from ANTLR3_UINT32 to ANTLR3_MARKER. I've confirmed that this
>> patch makes the warnings go away in my 64-bit build, so I'm submitting
>> for your review. Please let me know if/when this makes it into a
>> release.
>>
>> Thanks,
>>
>> -- Justin
>>
>> On 6/24/2011 1:34 PM, Jim Idle wrote:
>>> There are few bug fixes in this beta - all that I can get in will be
>>> in the release version, which won't be too long now. However, you
>>> should still avoid backtrack and memorize unless there is no other
>> choice.
>>> Jim
>>>
>>>> -----Original Message-----
>>>> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
>>>> bounces at antlr.org] On Behalf Of Justin Murray
>>>> Sent: Friday, June 24, 2011 8:12 AM
>>>> To: antlr-interest at antlr.org
>>>> Subject: Re: [antlr-interest] [C target] Warnings in 64-bit compile
>>>>
>>>> Jim,
>>>>
>>>> I just wanted to see if this was on your radar for the 3.4 C runtime
>>>> update. I haven't been able to test it with beta3 because I hit some
>>>> earlier roadblocks.
>>>>
>>>> Thanks,
>>>>
>>>> -- Justin
>>>>
>>>>
>>>>
>>>> 	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:jmur... at aerotech.com]
>>>>
>>>> 	Sent: Tuesday, December 28, 2010 1:39 PM
>>>>
>>>> 	To: Jim Idle; antl... 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: antl... at antlr.org
>>>>
>>>> 	[mailto:antl... at antlr.org] On Behalf Of Jim Idle
>>>>
>>>> 	Sent: Tuesday, December 28, 2010 3:04 PM
>>>>
>>>> 	To: antl... 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: antl... at antlr.org [mailto:antlr-interest-
>>>>
>>>> 	boun... at antlr.org] On Behalf Of Justin Murray
>>>>
>>>> 	Sent: Tuesday, December 28, 2010 11:59 AM
>>>>
>>>> 	To: antl... 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
>>>>
>>>> 	jmur... 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
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> 	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
>>> 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