Re: [gcc libcc1] build_qualified_type for self-referencing/incomplete types

Jan Kratochvil <[email protected]>
Newsgroups gmane.comp.gcc.devel,gmane.comp.gdb.devel
Message-ID <[email protected]>
On Fri, 17 Apr 2015 17:22:13 +0200, Jan Kratochvil wrote:
> How to get 'volatile struct sv' GCC 'tree' type for:
> 	volatile struct sv { volatile struct sv *p; };

I have found out how it can work, even with no change on the GCC side:

Instead of current:
	plugin_build_record_type:
		record_type = make_node (RECORD_TYPE)
	plugin_build_add_field:
		add fields to record_type... But there is no qualified_record_type here!
	plugin_finish_record_or_union:
		TYPE_SIZE (record_type) etc. ... to finish the type
	plugin_build_qualified_type:
		qualified_record_type = build_qualified_type (record_type, ...)
one can do instead:
	plugin_build_record_type:
		record_type = make_node (RECORD_TYPE)
	plugin_build_qualified_type:
		qualified_record_type = build_qualified_type (record_type, ...)
	plugin_build_add_field:
		add fields to qualified_record_type
	plugin_finish_record_or_union:
		TYPE_SIZE (qualified_record_type) etc. ... to finish the type
And one forgets about the unfinished record_type.

For a different cv-quals of the same record type one builds a new cv-qualified
record from scratch.


Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.