From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23896 invoked by alias); 23 Jul 2002 05:55:33 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 23889 invoked from network); 23 Jul 2002 05:55:32 -0000 Received: from unknown (HELO egil.codesourcery.com) (66.92.14.122) by sources.redhat.com with SMTP; 23 Jul 2002 05:55:32 -0000 Received: from zack by egil.codesourcery.com with local (Exim 3.35 #1 (Debian)) id 17Wsdt-00085n-00; Mon, 22 Jul 2002 22:55:29 -0700 Date: Tue, 23 Jul 2002 05:15:00 -0000 From: Zack Weinberg To: Neil Booth Cc: gcc@gcc.gnu.org Subject: Re: Unused macros warning? Message-ID: <20020723055529.GC8141@codesourcery.com> References: <20020722063352.GA22349@daikokuya.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020722063352.GA22349@daikokuya.co.uk> User-Agent: Mutt/1.4i X-SW-Source: 2002-07/txt/msg01078.txt.bz2 On Mon, Jul 22, 2002 at 07:33:52AM +0100, Neil Booth wrote: > I made a local modification to cpplib so that, if -Wunused, it reports > all macros defined in the main file that are unused, or unused before > being #undef-ed. > > Might this be a useful addition to mainline? It shouldn't be in -Wall, > as it involves a slightly expensive hashtable walk at the end of > preprocessing which most users wouldn't want to pay for, but could > be enabled with the front ends' -Wunused, say. Yes, I think this would be useful, as long as it doesn't ding you for macros in headers. > Long-term, it would be nice if cpplib could tell you if any header you > include is not used for any purpose. The kernel guys have wanted this > feature for a long time. Oooh, I want this. > I think it's not too hard, once the front end uses logical lines > internally; it then just becomes a matter of reporting a line as > "used" when something from it (like a macro, struct, typedef etc.) > is used, and letting cpplib use the line maps to convert that to > file usage, and doing a quick pass over the linemap structures at > the end of preprocessing. Sounds plausible. zw