aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2015-04-30 13:35:44 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2015-04-30 13:35:44 +0000
commitec3fba517279402b4686129c23af1d34f23b5ce0 (patch)
tree12c27f55b052dc69bf525409a1a916d114a67287 /gcc/c
parent4d1919ed6b1380ed3941f74e16e53529f26ddf9f (diff)
downloadgcc-ec3fba517279402b4686129c23af1d34f23b5ce0.zip
gcc-ec3fba517279402b4686129c23af1d34f23b5ce0.tar.gz
gcc-ec3fba517279402b4686129c23af1d34f23b5ce0.tar.bz2
c-typeck.c (c_build_va_arg): Clarify the error message.
* c-typeck.c (c_build_va_arg): Clarify the error message. * gcc.dg/pr65901.c (foo): Adjust dg-error. * gcc.c-torture/compile/pr48767.c (foo): Likewise. From-SVN: r222626
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog2
-rw-r--r--gcc/c/c-typeck.c13
2 files changed, 10 insertions, 5 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 3894bb9..2ef895a 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -6,6 +6,8 @@
* c-typeck.c (c_incomplete_type_error): Refactor to use %qT. Print
the type of a decl.
+ * c-typeck.c (c_build_va_arg): Clarify the error message.
+
2015-04-29 Thomas Schwinge <thomas@codesourcery.com>
* c-parser.c (c_parser_oacc_enter_exit_data): Use
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 413cd07..328f294 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -12635,14 +12635,17 @@ c_build_qualified_type (tree type, int type_quals)
tree
c_build_va_arg (location_t loc, tree expr, tree type)
{
- if (warn_cxx_compat && TREE_CODE (type) == ENUMERAL_TYPE)
- warning_at (loc, OPT_Wc___compat,
- "C++ requires promoted type, not enum type, in %<va_arg%>");
- if (type == error_mark_node || !COMPLETE_TYPE_P (type))
+ if (error_operand_p (type))
+ return error_mark_node;
+ else if (!COMPLETE_TYPE_P (type))
{
- c_incomplete_type_error (NULL_TREE, type);
+ error_at (loc, "second argument to %<va_arg%> is of incomplete "
+ "type %qT", type);
return error_mark_node;
}
+ else if (warn_cxx_compat && TREE_CODE (type) == ENUMERAL_TYPE)
+ warning_at (loc, OPT_Wc___compat,
+ "C++ requires promoted type, not enum type, in %<va_arg%>");
return build_va_arg (loc, expr, type);
}