Commit 1a55127d by Jason Merrill

call.c (call_builtin_trap): New fn.

        * call.c (call_builtin_trap): New fn.
        (convert_arg_to_ellipsis): Use it.  Downgrade error to warning.
        (build_call): Don't set current_function_returns_abnormally outside
        a function.

From-SVN: r58180
parent 74f6d071
2002-10-15 Jason Merrill <jason@redhat.com>
* call.c (call_builtin_trap): New fn.
(convert_arg_to_ellipsis): Use it. Downgrade error to warning.
(build_call): Don't set current_function_returns_abnormally outside
a function.
2002-10-14 Mark Mitchell <mark@codesourcery.com> 2002-10-14 Mark Mitchell <mark@codesourcery.com>
* class.c (check_field_decls): Remove empty_p parameter. Instead, * class.c (check_field_decls): Remove empty_p parameter. Instead,
...@@ -2651,7 +2658,7 @@ ...@@ -2651,7 +2658,7 @@
* pt.c (convert_template_argument): Adjust make_typename_type * pt.c (convert_template_argument): Adjust make_typename_type
return value. return value.
(tsubst): Adjust cp_build_qualified_type_real calls. (tsubst): Adjust cp_build_qualified_type_real calls.
(check_cv_quals_for_unify): Cope with alowing bad qualifications (check_cv_quals_for_unify): Cope with allowing bad qualifications
on template type parms. on template type parms.
(instantiate_decl): Recheck substitutions to give warnings on bad (instantiate_decl): Recheck substitutions to give warnings on bad
qualifications. qualifications.
......
...@@ -101,6 +101,7 @@ static tree convert_class_to_reference PARAMS ((tree, tree, tree)); ...@@ -101,6 +101,7 @@ static tree convert_class_to_reference PARAMS ((tree, tree, tree));
static tree direct_reference_binding PARAMS ((tree, tree)); static tree direct_reference_binding PARAMS ((tree, tree));
static int promoted_arithmetic_type_p PARAMS ((tree)); static int promoted_arithmetic_type_p PARAMS ((tree));
static tree conditional_conversion PARAMS ((tree, tree)); static tree conditional_conversion PARAMS ((tree, tree));
static tree call_builtin_trap PARAMS ((void));
tree tree
build_vfield_ref (datum, type) build_vfield_ref (datum, type)
...@@ -380,7 +381,7 @@ build_call (function, parms) ...@@ -380,7 +381,7 @@ build_call (function, parms)
nothrow = ((decl && TREE_NOTHROW (decl)) nothrow = ((decl && TREE_NOTHROW (decl))
|| TYPE_NOTHROW_P (TREE_TYPE (TREE_TYPE (function)))); || TYPE_NOTHROW_P (TREE_TYPE (TREE_TYPE (function))));
if (decl && TREE_THIS_VOLATILE (decl)) if (decl && TREE_THIS_VOLATILE (decl) && cfun)
current_function_returns_abnormally = 1; current_function_returns_abnormally = 1;
if (decl && TREE_DEPRECATED (decl)) if (decl && TREE_DEPRECATED (decl))
...@@ -4097,6 +4098,22 @@ convert_like_real (convs, expr, fn, argnum, inner) ...@@ -4097,6 +4098,22 @@ convert_like_real (convs, expr, fn, argnum, inner)
LOOKUP_NORMAL|LOOKUP_NO_CONVERSION); LOOKUP_NORMAL|LOOKUP_NO_CONVERSION);
} }
/* Build a call to __builtin_trap which can be used in an expression. */
static tree
call_builtin_trap ()
{
tree fn = get_identifier ("__builtin_trap");
if (IDENTIFIER_GLOBAL_VALUE (fn))
fn = IDENTIFIER_GLOBAL_VALUE (fn);
else
abort ();
fn = build_call (fn, NULL_TREE);
fn = build (COMPOUND_EXPR, integer_type_node, fn, integer_zero_node);
return fn;
}
/* ARG is being passed to a varargs function. Perform any conversions /* ARG is being passed to a varargs function. Perform any conversions
required. Array/function to pointer decay must have already happened. required. Array/function to pointer decay must have already happened.
Return the converted value. */ Return the converted value. */
...@@ -4121,9 +4138,10 @@ convert_arg_to_ellipsis (arg) ...@@ -4121,9 +4138,10 @@ convert_arg_to_ellipsis (arg)
/* Undefined behavior [expr.call] 5.2.2/7. We used to just warn /* Undefined behavior [expr.call] 5.2.2/7. We used to just warn
here and do a bitwise copy, but now cp_expr_size will abort if we here and do a bitwise copy, but now cp_expr_size will abort if we
try to do that. */ try to do that. */
error ("cannot pass objects of non-POD type `%#T' through `...'", warning ("cannot pass objects of non-POD type `%#T' through `...'; \
call will abort at runtime",
TREE_TYPE (arg)); TREE_TYPE (arg));
arg = error_mark_node; arg = call_builtin_trap ();
} }
return arg; return arg;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment