From: Jason Merrill Date: Tue, 28 Jan 2003 19:30:00 +0000 (-0500) Subject: cpplib.h (struct cpp_options): Add warn_deprecated field. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9fbd3e416654b42041026f9d51d1115a42dd5d34;p=gcc.git cpplib.h (struct cpp_options): Add warn_deprecated field. * cpplib.h (struct cpp_options): Add warn_deprecated field. * cppinit.c (cpp_create_reader): Turn it on by default. * c-opts.c (c_common_decode_option): Set it. * cpplib.c (do_pragma_once): Only complain about #pragma once if warn_deprecated is set. From-SVN: r62005 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 405ea857ad6..51fed17af87 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,13 @@ +2003-01-28 Jason Merrill + + * cpplib.h (struct cpp_options): Add warn_deprecated field. + * cppinit.c (cpp_create_reader): Turn it on by default. + * c-opts.c (c_common_decode_option): Set it. + * cpplib.c (do_pragma_once): Only complain about #pragma once + if warn_deprecated is set. + 2003-01-28 Dale Johannesen + * emit-rtl.c (const_double_htab_hash): Use mode in the hash. * loop.c (scan_loop): Move movables on -Os rich-register targets. * config/rs6000/rs6000.md (sibcall*): Use match_operand for LR. diff --git a/gcc/c-opts.c b/gcc/c-opts.c index bb074615e2a..4043447fdf2 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -767,6 +767,7 @@ c_common_decode_option (argc, argv) case OPT_Wdeprecated: warn_deprecated = on; + cpp_opts->warn_deprecated = on; break; case OPT_Wdiv_by_zero: diff --git a/gcc/cppinit.c b/gcc/cppinit.c index 324cb7784eb..591b4bfd76a 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -527,6 +527,7 @@ cpp_create_reader (lang) CPP_OPTION (pfile, tabstop) = 8; CPP_OPTION (pfile, operator_names) = 1; CPP_OPTION (pfile, warn_endif_labels) = 1; + CPP_OPTION (pfile, warn_deprecated) = 1; CPP_OPTION (pfile, warn_long_long) = !CPP_OPTION (pfile, c99); CPP_OPTION (pfile, pending) = diff --git a/gcc/cpplib.c b/gcc/cpplib.c index 1019a2a9713..a40fe1229ff 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -1223,7 +1223,8 @@ static void do_pragma_once (pfile) cpp_reader *pfile; { - cpp_error (pfile, DL_WARNING, "#pragma once is obsolete"); + if (CPP_OPTION (pfile, warn_deprecated)) + cpp_error (pfile, DL_WARNING, "#pragma once is obsolete"); if (pfile->buffer->prev == NULL) cpp_error (pfile, DL_WARNING, "#pragma once in main file"); diff --git a/gcc/cpplib.h b/gcc/cpplib.h index 556c78381f3..d16bf121db6 100644 --- a/gcc/cpplib.h +++ b/gcc/cpplib.h @@ -278,6 +278,9 @@ struct cpp_options /* Nonzero means don't print warning messages. */ unsigned char inhibit_warnings; + /* Nonzero means complain about deprecated features. */ + unsigned char warn_deprecated; + /* Nonzero means don't suppress warnings from system headers. */ unsigned char warn_system_headers;