This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Unused macros warning?


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]