On 07/23/2015 01:44 PM, David Malcolm wrote:
On Wed, 2015-07-22 at 20:50 -0400, Andrew MacLeod wrote:

(snip)


I will eventually put all these tools into a directory in contrib. It
simple enough to run it this ordering on any source file.
(snip)

If I'm understanding things right, we will have a standardized include
file ordering.

Can this ordering be documented somewhere in the source tree please?
(and be maintained)  I have a number of local (git) feature branches
that I'm hacking on, and every time I merge changes from master into one
of my branches, I seem to spend some time having to figure out which
include files I need.  I tend to just copy and paste #includes until it
compiles again, so having the order be documented would be helpful.

In theory, once I finish up with it and check the tool into contrib, all you'll have to do is run

contrib/gcc-order-includes filename

and it'll make the ordering right for whatever headers are in your file

I'm planning to add an option to show the canonical ordering, so
contrib/gcc-order-includes -s
with no filename will list the order it will arrange headers in.

It doesn't deal with every header file, just the primary core ones I listed in the original email . arbitrary ones can appear in whatever order they want.

If we have headers with implicit dependencies, the tool can be updated with that dependency and include those headers.. I haven't quite gotten that far yet. When IM done with the reorg, I'll look at what other implcit orderings there are.

This doesnt help you set up an initial include list, other than you can start with this canonical list and add whatever else you need.

Again, in theory, you will be able to run the include removal tool to get rid of the ones you dont need... but that might be overkill for a single file without some further tweaking

Andrew

Reply via email to