-fdump-go-spec option does not handle redefinitions

Ian Lance Taylor iant@google.com
Wed Nov 2 07:34:00 GMT 2011


Uros Bizjak <ubizjak@gmail.com> writes:

>> The problem with your proposal is that the output would be invalid Go,
>> because it would attempt to define the name _aa twice.  However, it does
>> seem plausible that in most scenarios of this type it would be more
>> useful for -fdump-go-spec to generate
>>
>> const _aa = 3
>
> I agree.

This patch implements this approach.  Bootstrapped and ran Go testsuite
on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


2011-11-01  Ian Lance Taylor  <iant@google.com>

	* godump.c (struct macro_hash_value): Define.
	(macro_hash_hashval): New static function.
	(macro_hash_eq, macro_hash_del): New static functions.
	(go_define): Use macro_hash_value to store values in macro_hash.
	Replace an old value on a redefinition.  Don't print anything to
	go_dump_file.
	(go_undef): Delete the entry from the hash table.
	(go_output_typedef): For an enum, use macro_hash_value, and don't
	print anything to go_dump_file.
	(go_print_macro): New static function.
	(go_finish): Traverse macro_hash with go_print_macro.
	(dump_go_spec_init): Update macro_hash creation for
	macro_hash_value.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-diff
Size: 8085 bytes
Desc: patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111102/1a1baebe/attachment.bin>


More information about the Gcc-patches mailing list