On Fri, Nov 15, 2013 at 3:49 AM, Andrew MacLeod <amacl...@redhat.com> wrote:
> On 11/14/2013 05:16 PM, Joseph S. Myers wrote:
>>
>> On Thu, 14 Nov 2013, Diego Novillo wrote:
>>
>>> This patch contains the mechanical side-effects from
>>> http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01663.html
>>
>> There are rather a lot of "Include tm.h" changes here - especially in
>> front ends, where we've tried to eliminate tm.h calls, and put comments on
>> some of those remaining saying exactly what target macros are used to make
>> clear what's needed to eliminate them.  Putting in these includes, without
>> clear comments explaining how to eliminate them, seems a step backwards.
>
> The problem is larger than that...  function.h includes tm.h as well... and
> something like 140ish files include function.h, not to mention another 5
> include files bring it in...  basic-block.h, cfgloop.h, cgraph.h, expr.h,
> and gimple-streamer.h
>
> so pretty much every file in existence gets tm.h one way or another :-P
> Aren't our includes spectacular?
>
> I' ve been thinking that the only way to really tackle this is to flatten
> *everything* so that nothing but .c files have #includes, and then trim out
> all the includes that each .c requires, and then see where we sit.  .h files
> bringing in other .h files really muck things up.

Yeah, though this has interesting effects on includes that do stuff like

#ifdef NO_DOLLARS_IN_LABELS
...

where the presence of this definition depends on another header file
and thus the ultimate outcome in your .c file depends on include file
order.

So ... no #ifdefs inside headers?  Or have meta-defines like

#define NO_DOLLARS_IN_LABELS_DEFINED

and

#ifndef NO_DOLLARS_IN_LABELS_DEFINED
#error ...
#endif

at use sites?

Richard.

> I was contemplating giving that a go over the weekend or maybe next week to
> see what it looks like... I have some scripts that flatten includes into the
> .c files and then try to trim out the ones which aren't needed from each .c
> file.
>
> Andrew
>
> btw, I ran tm.h through the include removal script for the c family front
> end files... The attached patch compiles on x64 and removes 37 includes from
> the front end files.... those are just the extraneous ones...   but it may
> be helpful...

Reply via email to