]> git.ipfire.org Git - thirdparty/gcc.git/commit - libcpp/directives.c
cppexp.c (parse_defined): Mark macro used.
authorNeil Booth <neil@daikokuya.co.uk>
Tue, 23 Jul 2002 22:57:49 +0000 (22:57 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Tue, 23 Jul 2002 22:57:49 +0000 (22:57 +0000)
commita69cbaac60d73feb37e6c17abd6f84991dc791a0
treed7305615fe0d53e288982b583d2c9c637deb2699
parentb841421a28b7e7c616e58cae4b5e36599f288b7f
cppexp.c (parse_defined): Mark macro used.

* 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.

From-SVN: r55692
14 files changed:
gcc/ChangeLog
gcc/cppexp.c
gcc/cpphash.h
gcc/cppinit.c
gcc/cpplib.c
gcc/cpplib.h
gcc/cppmacro.c
gcc/cpptrad.c
gcc/doc/cppopts.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/cpp/Wunused.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/Wunused.h [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/trad/Wunused.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/trad/Wunused.h [new file with mode: 0644]