From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6477 invoked by alias); 22 Jan 2019 04:07:37 -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 6469 invoked by uid 89); 22 Jan 2019 04:07:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=chose, stanza, stanzas, hear X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.18) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 Jan 2019 04:07:35 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway32.websitewelcome.com (Postfix) with ESMTP id BC0DF10F608 for ; Mon, 21 Jan 2019 22:07:33 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id lnLZgdaUe2qH7lnLZgFxjN; Mon, 21 Jan 2019 22:07:33 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rfzJkr5bs+Q+nwzTuuHGVyP0g/XHL6xJZ6m+5i6aJ2M=; b=CtZyJVfeSFgOIzPwAk37OLiqN1 dLd4GYYPUJ8exlxF5gRcgFTmHe6ja701nea2sTVYKJpA2BTQDYzi5a30HOS/qTnstmj8yVuMtLOEs B5L4KQUO1TTs4MEMLEMm9lZ88; Received: from 75-166-72-210.hlrn.qwest.net ([75.166.72.210]:40174 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1glnLZ-0021wB-Gr; Mon, 21 Jan 2019 22:07:33 -0600 From: Tom Tromey To: Gary Benson Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH] Remove duplicate or commented-out #includes References: <20190119213007.23712-1-tom@tromey.com> <20190121172843.GA7007@blade.nx> Date: Tue, 22 Jan 2019 04:07:00 -0000 In-Reply-To: <20190121172843.GA7007@blade.nx> (Gary Benson's message of "Mon, 21 Jan 2019 17:28:44 +0000") Message-ID: <87muntpc6z.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-01/txt/msg00461.txt.bz2 >> 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. 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. Tom