diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-04 15:13:40 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-04 15:13:40 +0000 |
commit | 04afd8784b95bd771961ab52fa1a6553a80404bc (patch) | |
tree | c7538be5564ae0acb2315138a89ce1f3cc020b22 /libcpp/macro.c | |
parent | 09e3d55b86385fef45099c1ded99db8592710b1a (diff) | |
download | gcc-04afd8784b95bd771961ab52fa1a6553a80404bc.tar.gz |
gcc/ChangeLog:
2014-09-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
* doc/options.texi: Document that Var and Init are required if CPP
is given.
* optc-gen.awk: Require Var and Init if CPP is given.
* common.opt (Wpedantic): Use Init.
libcpp/ChangeLog:
2014-09-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
* macro.c (replace_args): Use cpp_pedwarning, cpp_warning and
CPP_W flags.
* include/cpplib.h: Add CPP_W_C90_C99_COMPAT and CPP_W_PEDANTIC.
* init.c (cpp_create_reader): Do not init to -1 here.
* expr.c (num_binary_op): Use cpp_pedwarning.
gcc/c-family/ChangeLog:
2014-09-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
* c.opt (Wc90-c99-compat,Wc++-compat,Wcomment,Wendif-labels,
Winvalid-pch,Wlong-long,Wmissing-include-dirs,Wmultichar,Wpedantic,
(Wdate-time,Wtraditional,Wundef,Wvariadic-macros): Add CPP, Var
and Init.
* c-opts.c (c_common_handle_option): Do not handle here.
(sanitize_cpp_opts): Likewise.
* c-common.c (struct reason_option_codes_t): Handle
CPP_W_C90_C99_COMPAT and CPP_W_PEDANTIC.
gcc/testsuite/ChangeLog:
2014-09-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
* gcc.dg/cpp/endif-pedantic2.c: More general options do not
override specific ones, but specific ones do.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214904 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/macro.c')
-rw-r--r-- | libcpp/macro.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/libcpp/macro.c b/libcpp/macro.c index 8445ce39eda..8fa97705740 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -1776,35 +1776,32 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro, paste_flag = (const cpp_token **) tokens_buff_last_token_ptr (buff); } - else if (CPP_PEDANTIC (pfile) && ! macro->syshdr - && ! CPP_OPTION (pfile, c99) - && ! cpp_in_system_header (pfile)) + else if (CPP_PEDANTIC (pfile) && ! CPP_OPTION (pfile, c99) + && ! macro->syshdr && ! cpp_in_system_header (pfile)) { if (CPP_OPTION (pfile, cplusplus)) - cpp_error (pfile, CPP_DL_PEDWARN, - "invoking macro %s argument %d: " - "empty macro arguments are undefined" - " in ISO C++98", - NODE_NAME (node), - src->val.macro_arg.arg_no); + cpp_pedwarning (pfile, CPP_W_PEDANTIC, + "invoking macro %s argument %d: " + "empty macro arguments are undefined" + " in ISO C++98", + NODE_NAME (node), src->val.macro_arg.arg_no); 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" - " in ISO C90", - NODE_NAME (node), - src->val.macro_arg.arg_no); + cpp_pedwarning (pfile, + CPP_OPTION (pfile, cpp_warn_c90_c99_compat) > 0 + ? CPP_W_C90_C99_COMPAT : CPP_W_PEDANTIC, + "invoking macro %s argument %d: " + "empty macro arguments are undefined" + " in ISO C90", + NODE_NAME (node), src->val.macro_arg.arg_no); } else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat) > 0 - && ! macro->syshdr - && ! cpp_in_system_header (pfile) - && ! CPP_OPTION (pfile, cplusplus)) - cpp_error (pfile, CPP_DL_WARNING, - "invoking macro %s argument %d: " - "empty macro arguments are undefined" - " in ISO C90", - NODE_NAME (node), - src->val.macro_arg.arg_no); + && ! CPP_OPTION (pfile, cplusplus) + && ! macro->syshdr && ! cpp_in_system_header (pfile)) + cpp_warning (pfile, CPP_W_C90_C99_COMPAT, + "invoking macro %s argument %d: " + "empty macro arguments are undefined" + " in ISO C90", + NODE_NAME (node), src->val.macro_arg.arg_no); /* Avoid paste on RHS (even case count == 0). */ if (!pfile->state.in_directive && !(src->flags & PASTE_LEFT)) |