This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]