From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111150 invoked by alias); 28 Oct 2019 12:57:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 111117 invoked by uid 89); 28 Oct 2019 12:57:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 spammy=ifs, considers X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 28 Oct 2019 12:57:16 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id B7A8D20E5E; Mon, 28 Oct 2019 08:57:14 -0400 (EDT) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id 587B320C12; Mon, 28 Oct 2019 08:57:13 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 2CF2820AF6; Mon, 28 Oct 2019 08:57:13 -0400 (EDT) X-Gerrit-PatchSet: 1 Date: Mon, 28 Oct 2019 12:57:00 -0000 From: "Simon Marchi (Code Review)" To: gdb-patches@sourceware.org Cc: Tom Tromey Auto-Submitted: auto-generated X-Gerrit-MessageType: comment Subject: [review] Remove unused includes in infcmd.c and infrun.c X-Gerrit-Change-Id: I5e25af54ecd2235960c4127add8f604ddbb19153 X-Gerrit-Change-Number: 322 X-Gerrit-ChangeURL: X-Gerrit-Commit: 1acc1250e517341ed356355517f0a25c39b7ab6c In-Reply-To: References: X-Gerrit-Comment-Date: Mon, 28 Oct 2019 08:57:13 -0400 Reply-To: gnutoolchain-gerrit@osci.io MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/3.0.3-74-g460fb0f7e9 Content-Type: text/plain; charset=UTF-8 Message-Id: <20191028125713.2CF2820AF6@gnutoolchain-gerrit.osci.io> X-SW-Source: 2019-10/txt/msg00982.txt.bz2 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 Gerrit-Reviewer: Simon Marchi Gerrit-Reviewer: Tom Tromey Gerrit-Comment-Date: Mon, 28 Oct 2019 12:57:13 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: No Gerrit-MessageType: comment