[review] Remove unused includes in infcmd.c and infrun.c

Simon Marchi (Code Review) gerrit@gnutoolchain-gerrit.osci.io
Mon Oct 28 12:57:00 GMT 2019


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



More information about the Gdb-patches mailing list