aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog8
-rw-r--r--libcpp/expr.c4
-rw-r--r--libcpp/include/cpplib.h4
-rw-r--r--libcpp/init.c1
-rw-r--r--libcpp/macro.c45
5 files changed, 35 insertions, 27 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index c1ac8c9..890b7fc 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,11 @@
+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.
+
2014-08-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
* directives.c (check_eol_1): New.
diff --git a/libcpp/expr.c b/libcpp/expr.c
index 519bb87..003fcb0 100644
--- a/libcpp/expr.c
+++ b/libcpp/expr.c
@@ -1880,8 +1880,8 @@ num_binary_op (cpp_reader *pfile, cpp_num lhs, cpp_num rhs, enum cpp_ttype op)
default: /* case CPP_COMMA: */
if (CPP_PEDANTIC (pfile) && (!CPP_OPTION (pfile, c99)
|| !pfile->state.skip_eval))
- cpp_error (pfile, CPP_DL_PEDWARN,
- "comma operator in operand of #if");
+ cpp_pedwarning (pfile, CPP_W_PEDANTIC,
+ "comma operator in operand of #if");
lhs = rhs;
break;
}
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 28fc0f8..28cb495 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -939,7 +939,9 @@ enum {
CPP_W_INVALID_PCH,
CPP_W_WARNING_DIRECTIVE,
CPP_W_LITERAL_SUFFIX,
- CPP_W_DATE_TIME
+ CPP_W_DATE_TIME,
+ CPP_W_PEDANTIC,
+ CPP_W_C90_C99_COMPAT
};
/* Output a diagnostic of some kind. */
diff --git a/libcpp/init.c b/libcpp/init.c
index 2998d88..d612374 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -185,6 +185,7 @@ cpp_create_reader (enum c_lang lang, cpp_hash_table *table,
CPP_OPTION (pfile, operator_names) = 1;
CPP_OPTION (pfile, warn_trigraphs) = 2;
CPP_OPTION (pfile, warn_endif_labels) = 1;
+ CPP_OPTION (pfile, cpp_warn_c90_c99_compat) = -1;
CPP_OPTION (pfile, cpp_warn_deprecated) = 1;
CPP_OPTION (pfile, cpp_warn_long_long) = 0;
CPP_OPTION (pfile, dollars_in_ident) = 1;
diff --git a/libcpp/macro.c b/libcpp/macro.c
index 8445ce3..8fa9770 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))