From 71a7c28254983fb0228469f2b602347a4717dfec Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 23 Jul 2002 22:57:49 +0000 Subject: * cppexp.c (parse_defined): Mark macro used. * cpphash.h (struct cpp_macro): New member "used". (_cpp_mark_macro_used, _cpp_warn_if_unused_macro): New. (struct cpp_reader): New member. * cppinit.c (cpp_finish_options): Set first_unused_line. (cpp_finish): Warn of unused macros if requested. (OPT_TABLE): New switches. (cpp_handle_option): Handle them. * cpplib.c (do_undef): Warn if macro unused. (do_ifdef, do_ifndef): Mark macro used. * cpplib.h (struct cpp_options): New member. * cppmacro.c (_cpp_warn_if_unused_macro): New. (enter_macro_context): Mark macro used. (_cpp_create_definition): Mark macro unused; warn if unused when redefined. * cpptrad.c (scan_out_logcial_line, push_replacement_text): Mark macros used. * doc/cppopts.texi: Update. testsuite: * gcc.dg/cpp/trad/Wunused.c, gcc.dg/cpp/trad/Wunused.h, gcc.dg/cpp/Wunused.c, gcc.dg/cpp/Wunused.h: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55692 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cppexp.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/cppexp.c') diff --git a/gcc/cppexp.c b/gcc/cppexp.c index b66fea925e7..569043651d6 100644 --- a/gcc/cppexp.c +++ b/gcc/cppexp.c @@ -501,6 +501,8 @@ parse_defined (pfile) cpp_error (pfile, DL_WARNING, "this use of \"defined\" may not be portable"); + _cpp_mark_macro_used (node); + /* A possible controlling macro of the form #if !defined (). _cpp_parse_expr checks there was no other junk on the line. */ pfile->mi_ind_cmacro = node; -- cgit v1.2.1