$target.h vs $target-protos.h

Sandra Loosemore sandra@codesourcery.com
Mon Feb 19 17:35:00 GMT 2018


On 02/19/2018 09:45 AM, Joseph Myers wrote:
> On Sun, 18 Feb 2018, Sandra Loosemore wrote:
> 
>> Thanks, this makes sense.  I think I could produce a documentation patch that
>> explains that the difference is early vs late inclusion, and explains that any
>> declarations involving tree or rtx types must go in $target-protos.h because
>> those types are not defined when $target.h is included.
> 
> That's not the case now for tree or rtx types, since they're (forward)
> declared in coretypes.h.  It may still be the case for some types, but not
> those.

OK, I think I misunderstood your previous message -- it's the 
machine_mode-related types that have the circular dependency, but rtx 
and tree no longer do.  Is that right?

> 
>> So am I right in thinking it is actually not possible to have a .h file for
>> internal bits shared between $target.c and the .md files, without hacking e.g.
>> genrecog.c which currently emits a fixed set of include directives?
> 
> I'm not aware of a way to do that.

Thinking about it some more, perhaps in $target-protos.h

#ifdef IN_TARGET_CODE
#include "$target-internal.h"
#endif

??

-Sandra



More information about the Gcc mailing list