From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 55652 invoked by alias); 21 Jan 2019 17:34:08 -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 55632 invoked by uid 89); 21 Jan 2019 17:34:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=H*u:1.3.6, H*UA:1.3.6, tui, wiki X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Jan 2019 17:34:05 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id x0LHXxAn000747 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 21 Jan 2019 12:34:03 -0500 Received: by simark.ca (Postfix, from userid 112) id 149701E7B9; Mon, 21 Jan 2019 12:33:59 -0500 (EST) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id E8E0B1E4A3; Mon, 21 Jan 2019 12:33:57 -0500 (EST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 21 Jan 2019 17:34:00 -0000 From: Simon Marchi To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Remove duplicate or commented-out #includes In-Reply-To: <20190119213007.23712-1-tom@tromey.com> References: <20190119213007.23712-1-tom@tromey.com> Message-ID: <8308e985e1e6893e17b968fd7b74c90b@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.6 X-IsSubscribed: yes X-SW-Source: 2019-01/txt/msg00454.txt.bz2 On 2019-01-19 16:30, Tom Tromey wrote: > I wrote a little script to detect duplicate or commented-out #includes > and ran it on gdb. This patch is the result. Tested by rebuilding. Nice, thanks, this LGTM. > 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. I wasn't sure of what the advantage of using IWYU was, so I read this: https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/WhyIWYU.md In the end, removing unnecessary includes would be nice. If a .c file includes a header file unnecessarily, it will be rebuild for nothing when that header file is modified. If we can avoid that, it means less wasted time for everybody. Replacing includes by forward declarations is also nice to cut down on compilation time. It would be really tedious to do those changes by hand, but if a tool can do it automatically, why not. We have that policy where .h files must assume that defs.h has been included (providing common types) [1]. I am not sure how IWYU will cope with that. [1] https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#Include_Files > gdb/ChangeLog > 2019-01-19 Tom Tromey > > * ui-out.c: Fix includes. > * tui/tui-source.c: Fix includes. > * target.c: Fix includes. > * remote.c: Fix includes. > * regcache.c: Fix includes. > * python/py-block.c: Fix includes. > * printcmd.c: Fix includes. > * or1k-tdep.c: Fix includes. > * mi/mi-main.c: Fix includes. > * m32r-tdep.c: Fix includes. > * csky-tdep.c: Fix includes. > * compile/compile-cplus-types.c: Fix includes. > * cli/cli-interp.c: Fix includes. > > gdb/gdbserver/ChangeLog > 2019-01-19 Tom Tromey > > * tracepoint.c: Fix includes. > * remote-utils.c: Fix includes. > * linux-x86-low.c: Fix includes. > > gdb/stubs/ChangeLog > 2019-01-19 Tom Tromey > > * ia64vms-stub.c: Fix includes. Watch out for that email address in the ChangeLog entries. Simon