Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Simon Marchi (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@sourceware.org>
Subject: [review] Remove unused includes in infcmd.c and infrun.c
Date: Mon, 28 Oct 2019 12:57:00 -0000	[thread overview]
Message-ID: <20191028125713.2CF2820AF6@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1572157288000.I5e25af54ecd2235960c4127add8f604ddbb19153@gnutoolchain-gerrit.osci.io>

Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/322
......................................................................


Patch Set 1:

> Patch Set 1: Code-Review+2
> 
> Thanks.  This seems fine to me.
> 
> How does include-what-you-use decide if an include is unnecessary?

I suppose it compiles the file, makes the list of all symbols/types/macros provided by each header file, makes the list of all symbols/types/macros used in the .c file, and reports if some header file did not contribute anything the .c file used.

I haven't tried, but we might need to be a bit careful when preprocessor #ifs or #ifdefs are involved.  Since it compiles a particular configuration, as described in a compile_commands.json file, I would guess that it only considers what's kept by the preprocessor in this particular configuration.  So it could tell you to remove an include that's actually needed when the other branch of the #ifdef is taken.  Though maybe in that case, the include file should be conditionally included, using that same condition.


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I5e25af54ecd2235960c4127add8f604ddbb19153
Gerrit-Change-Number: 322
Gerrit-PatchSet: 1
Gerrit-Owner: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Mon, 28 Oct 2019 12:57:13 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


  parent reply	other threads:[~2019-10-28 12:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-27  6:21 Simon Marchi (Code Review)
2019-10-28 12:37 ` Tom Tromey (Code Review)
2019-10-28 12:57 ` Simon Marchi (Code Review) [this message]
2019-10-28 13:38 ` Tom Tromey (Code Review)
2019-10-28 15:29 ` Konrad Kleine (Code Review)
2019-10-28 15:51 ` Simon Marchi (Code Review)
2019-10-29 21:56 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-10-29 21:56 ` Sourceware to Gerrit sync (Code Review)

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=20191028125713.2CF2820AF6@gnutoolchain-gerrit.osci.io \
    --to=gerrit@gnutoolchain-gerrit.osci.io \
    --cc=gdb-patches@sourceware.org \
    --cc=gnutoolchain-gerrit@osci.io \
    --cc=tromey@sourceware.org \
    /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