Hi,
at the start of build_va_arg, we error out if there's an invalid va_list
argument.
Therefore, the following checks on va_list type are not user errors, but
internal errors.
This patch changes the user errors into internal errors.
Bootstrapped and reg-tested on x86_64.
OK for trunk?
Thanks,
- Tom
Replace error_at with assert in build_va_arg
2016-08-22 Tom de Vries <t...@codesourcery.com>
* c-common.c (build_va_arg): Replace first argument type error
with assert.
---
gcc/c-family/c-common.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 7ad1930..a289d2b 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -5820,12 +5820,7 @@ build_va_arg (location_t loc, tree expr, tree type)
/* Verify that &ap is still recognized as having va_list type. */
tree canon_expr_type
= targetm.canonical_va_list_type (TREE_TYPE (expr));
- if (canon_expr_type == NULL_TREE)
- {
- error_at (loc,
- "first argument to %<va_arg%> not of type %<va_list%>");
- return error_mark_node;
- }
+ gcc_assert (canon_expr_type != NULL_TREE);
return build_va_arg_1 (loc, type, expr);
}
@@ -5893,12 +5888,7 @@ build_va_arg (location_t loc, tree expr, tree type)
/* Verify that &ap is still recognized as having va_list type. */
tree canon_expr_type
= targetm.canonical_va_list_type (TREE_TYPE (expr));
- if (canon_expr_type == NULL_TREE)
- {
- error_at (loc,
- "first argument to %<va_arg%> not of type %<va_list%>");
- return error_mark_node;
- }
+ gcc_assert (canon_expr_type != NULL_TREE);
}
else
{