aboutsummaryrefslogtreecommitdiff
path: root/libcpp/macro.c
diff options
context:
space:
mode:
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-19 05:34:31 +0000
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-19 05:34:31 +0000
commit806fe15ec1838389137de157d0f484177a3cbc5e (patch)
treeedb34abe06088024ce40380f1b5573f991d29584 /libcpp/macro.c
parent88943ddeb3caf4af541d5f58f81d0e5d23da1281 (diff)
gcc/c-family/
* c-opts.c (sanitize_cpp_opts): Make warn_long_long be set according to warn_c90_c99_compat. * c.opt (Wc90-c99-compat, Wdeclaration-after-statement): Initialize to -1. gcc/c/ * c-decl.c (warn_variable_length_array): Pass OPT_Wvla unconditionally to pedwarn_c90. * c-errors.c: Include "opts.h". (pedwarn_c90): Rewrite to handle -Wno-c90-c99-compat better. * c-parser.c (disable_extension_diagnostics): Handle negative value of warn_c90_c99_compat, too. (restore_extension_diagnostics): Likewise. (c_parser_compound_statement_nostart): Pass OPT_Wdeclaration_after_statement unconditionally to pedwarn_c90. gcc/testsuite/ * gcc.dg/Wc90-c99-compat-4.c: Remove all dg-warnings. * gcc.dg/Wc90-c99-compat-5.c: Remove all dg-errors. * gcc.dg/Wc90-c99-compat-7.c: New test. * gcc.dg/Wc90-c99-compat-8.c: New test. * gcc.dg/Wdeclaration-after-statement-4.c: New test. libcpp/ * charset.c (_cpp_valid_ucn): Warn only if -Wc90-c99-compat. * lex.c (_cpp_lex_direct): Likewise. * macro.c (replace_args): Likewise. (parse_params): Likewise. * include/cpplib.h (cpp_options): Change cpp_warn_c90_c99_compat to char. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214131 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/macro.c')
-rw-r--r--libcpp/macro.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libcpp/macro.c b/libcpp/macro.c
index ff6685c2665..a1ba1373615 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -1787,7 +1787,7 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro,
" in ISO C++98",
NODE_NAME (node),
src->val.macro_arg.arg_no);
- else
+ else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat))
cpp_error (pfile, CPP_DL_PEDWARN,
"invoking macro %s argument %d: "
"empty macro arguments are undefined"
@@ -1795,7 +1795,7 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro,
NODE_NAME (node),
src->val.macro_arg.arg_no);
}
- else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat)
+ else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat) > 0
&& ! macro->syshdr
&& ! cpp_in_system_header (pfile)
&& ! CPP_OPTION (pfile, cplusplus))
@@ -2858,7 +2858,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro)
(pfile, CPP_W_VARIADIC_MACROS,
"anonymous variadic macros were introduced in C99");
}
- else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat)
+ else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat) > 0
&& ! CPP_OPTION (pfile, cplusplus))
cpp_error (pfile, CPP_DL_WARNING,
"anonymous variadic macros were introduced in C99");