Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tom@tromey.com>, Gary Benson <gbenson@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Remove duplicate or commented-out #includes
Date: Wed, 23 Jan 2019 16:40:00 -0000	[thread overview]
Message-ID: <40c4819b-e15f-671c-51d7-7a6cedcad7de@redhat.com> (raw)
In-Reply-To: <87muntpc6z.fsf@tromey.com>

On 01/22/2019 04:07 AM, Tom Tromey wrote:
>>> It would be possible to sort #includes, or maybe run
>>> include-what-you-use on gdb, but I haven't tried that.  I'd be
>>> interested to hear if you think this would be worthwhile, thoug.
> 
> Gary> I'd consider it worthwhile.  I'd really like sorted #includes.
> Gary> Some files have random whitespace in the list too, that maybe
> Gary> made sense once.
> 
> I wrote a script to sort the includes.  The output is rather voluminous,
> not totally sure yet how I will submit it.
> 
> It doesn't try to do a 100% job.  For example, some files in gdb include
> other files at random spots -- not all includes are at the top of the
> file -- and the script doesn't try to handle this.
> 
> It did find 40 .h files that don't have include guards.  Maybe I will
> try to automatically fix these.
> 
> Building revealed a few minor order dependencies in the headers.  I'll
> submit this as an initial cleanup.
> 
> 
> I chose to have the includes ordered this way:
> 
> First stanza:
> 
> 1. defs.h (or server.h or common-defs.h)
> 2. for a .c file, the corresponding .h if it exists
>    (two exceptions were needed to this rule)
> 
> Second stanza (stanzas separated by a blank line) holds system headers.
> 
> Third stanzas holds includes of headers in binutils-gdb but not part of
> gdb proper.
> 
> Fourth stanza is gdb-specific headers.
> 
> 
> It's reasonably easy to change this around though.

That order seems fine to me.  Thanks a lot for doing that!  Looking forward.

Thanks,
Pedro Alves

> It would be possible to modify this same script to try removing includes
> from .c files and seeing whether the file still compiles.  It would just
> take a long time on this machine I have at the moment.
> 
> If anyone wants to try it out for themselves, I can send the
> instructions.


      parent reply	other threads:[~2019-01-23 16:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-19 21:31 Tom Tromey
2019-01-21 17:34 ` Simon Marchi
2019-01-21 18:28   ` Tom Tromey
     [not found] ` <20190121172843.GA7007@blade.nx>
2019-01-22  4:07   ` Tom Tromey
2019-01-23  4:00     ` Tom Tromey
2019-01-23 16:40     ` Pedro Alves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40c4819b-e15f-671c-51d7-7a6cedcad7de@redhat.com \
    --to=palves@redhat.com \
    --cc=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox