From: Neil Booth <neil@daikokuya.co.uk>
To: gcc@gcc.gnu.org
Cc: Zack Weinberg <zack@codesourcery.com>
Subject: Unused macros warning?
Date: Mon, 22 Jul 2002 05:22:00 -0000 [thread overview]
Message-ID: <20020722063352.GA22349@daikokuya.co.uk> (raw)
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.
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. 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.
Neil.
next reply other threads:[~2002-07-22 6:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-22 5:22 Neil Booth [this message]
2002-07-22 13:03 ` Paul Koning
2002-07-23 5:15 ` Zack Weinberg
2002-07-23 22:31 ` David O'Brien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020722063352.GA22349@daikokuya.co.uk \
--to=neil@daikokuya.co.uk \
--cc=gcc@gcc.gnu.org \
--cc=zack@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).