method.c (build_decl_overload_real): Don't mess with global placement delete.
* method.c (build_decl_overload_real): Don't mess with global placement delete. * init.c (build_new): Check for null throw spec, not nothrow_t. * decl.c (duplicate_decls): Don't complain about different exceptions from an internal declaration. * call.c (build_op_delete_call): Fix check for member fns again. * decl2.c (import_export_decl): Interface hackery affects virtual synthesized methods. From-SVN: r16612
This commit is contained in:
parent
7bb9fb0edf
commit
047f64a30c
|
@ -1,3 +1,18 @@
|
|||
Thu Nov 20 14:40:17 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* method.c (build_decl_overload_real): Don't mess with global
|
||||
placement delete.
|
||||
|
||||
* init.c (build_new): Check for null throw spec, not nothrow_t.
|
||||
|
||||
* decl.c (duplicate_decls): Don't complain about different exceptions
|
||||
from an internal declaration.
|
||||
|
||||
* call.c (build_op_delete_call): Fix check for member fns again.
|
||||
|
||||
* decl2.c (import_export_decl): Interface hackery affects
|
||||
virtual synthesized methods.
|
||||
|
||||
Wed Nov 19 18:24:14 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* decl.c (start_decl): Don't just complain about a mismatched
|
||||
|
|
|
@ -5182,8 +5182,8 @@ build_op_delete_call (code, addr, size, flags)
|
|||
|
||||
if (fn != error_mark_node)
|
||||
{
|
||||
if (TREE_PURPOSE (fns))
|
||||
/* TREE_PURPOSE is only set for lists of member functions. */
|
||||
if (TREE_CODE (TREE_VALUE (fns)) == TREE_LIST)
|
||||
/* Member functions. */
|
||||
enforce_access (TREE_PURPOSE (TREE_VALUE (fns)), fn);
|
||||
return build_function_call (fn, expr_tree_cons (NULL_TREE, addr, args));
|
||||
}
|
||||
|
|
|
@ -2769,7 +2769,8 @@ duplicate_decls (newdecl, olddecl)
|
|||
TREE_TYPE (olddecl) = build_exception_variant (newtype,
|
||||
TYPE_RAISES_EXCEPTIONS (oldtype));
|
||||
|
||||
if ((pedantic || ! DECL_IN_SYSTEM_HEADER (olddecl))
|
||||
if ((pedantic || (! DECL_IN_SYSTEM_HEADER (olddecl)
|
||||
&& DECL_SOURCE_LINE (olddecl) != 0))
|
||||
&& flag_exceptions
|
||||
&& ! compexcepttypes (TREE_TYPE (newdecl), TREE_TYPE (olddecl)))
|
||||
{
|
||||
|
|
|
@ -2793,7 +2793,8 @@ import_export_decl (decl)
|
|||
else if (DECL_FUNCTION_MEMBER_P (decl))
|
||||
{
|
||||
tree ctype = DECL_CLASS_CONTEXT (decl);
|
||||
if (CLASSTYPE_INTERFACE_KNOWN (ctype) && ! DECL_ARTIFICIAL (decl))
|
||||
if (CLASSTYPE_INTERFACE_KNOWN (ctype)
|
||||
&& (! DECL_ARTIFICIAL (decl) || DECL_VINDEX (decl)))
|
||||
{
|
||||
DECL_NOT_REALLY_EXTERN (decl)
|
||||
= ! (CLASSTYPE_INTERFACE_ONLY (ctype)
|
||||
|
|
|
@ -2452,16 +2452,6 @@ build_new (placement, decl, init, use_global_new)
|
|||
return error_mark_node;
|
||||
}
|
||||
|
||||
/* If the first placement arg is of type nothrow_t, it's allowed to
|
||||
return 0 on allocation failure. */
|
||||
nothrow = (placement && TREE_VALUE (placement)
|
||||
&& TREE_TYPE (TREE_VALUE (placement))
|
||||
&& IS_AGGR_TYPE (TREE_TYPE (TREE_VALUE (placement)))
|
||||
&& (TYPE_IDENTIFIER (TREE_TYPE (TREE_VALUE (placement)))
|
||||
== get_identifier ("nothrow_t")));
|
||||
|
||||
check_new = flag_check_new || nothrow;
|
||||
|
||||
#if 1
|
||||
/* Get a little extra space to store a couple of things before the new'ed
|
||||
array, if this isn't the default placement new. */
|
||||
|
@ -2513,6 +2503,30 @@ build_new (placement, decl, init, use_global_new)
|
|||
rval = cp_convert (build_pointer_type (true_type), rval);
|
||||
}
|
||||
|
||||
/* unless an allocation function is declared with an empty excep-
|
||||
tion-specification (_except.spec_), throw(), it indicates failure to
|
||||
allocate storage by throwing a bad_alloc exception (clause _except_,
|
||||
_lib.bad.alloc_); it returns a non-null pointer otherwise If the allo-
|
||||
cation function is declared with an empty exception-specification,
|
||||
throw(), it returns null to indicate failure to allocate storage and a
|
||||
non-null pointer otherwise.
|
||||
|
||||
So check for a null exception spec on the op new we just called. */
|
||||
|
||||
nothrow = 0;
|
||||
if (rval)
|
||||
{
|
||||
/* The CALL_EXPR. */
|
||||
tree t = TREE_OPERAND (rval, 0);
|
||||
/* The function. */
|
||||
t = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
|
||||
t = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (t));
|
||||
|
||||
if (t && TREE_VALUE (t) == NULL_TREE)
|
||||
nothrow = 1;
|
||||
}
|
||||
check_new = flag_check_new || nothrow;
|
||||
|
||||
if (flag_exceptions && rval)
|
||||
{
|
||||
/* This must last longer so we can use it in the cleanup.
|
||||
|
|
|
@ -1117,19 +1117,17 @@ build_decl_overload_real (dname, parms, ret_type, tparms, targs,
|
|||
char *name = IDENTIFIER_POINTER (dname);
|
||||
|
||||
/* member operators new and delete look like methods at this point. */
|
||||
if (! for_method && parms != NULL_TREE && TREE_CODE (parms) == TREE_LIST)
|
||||
if (! for_method && parms != NULL_TREE && TREE_CODE (parms) == TREE_LIST
|
||||
&& TREE_CHAIN (parms) == void_list_node)
|
||||
{
|
||||
if (dname == ansi_opname[(int) DELETE_EXPR])
|
||||
return get_identifier ("__builtin_delete");
|
||||
else if (dname == ansi_opname[(int) VEC_DELETE_EXPR])
|
||||
return get_identifier ("__builtin_vec_delete");
|
||||
else if (TREE_CHAIN (parms) == void_list_node)
|
||||
{
|
||||
if (dname == ansi_opname[(int) NEW_EXPR])
|
||||
return get_identifier ("__builtin_new");
|
||||
else if (dname == ansi_opname[(int) VEC_NEW_EXPR])
|
||||
return get_identifier ("__builtin_vec_new");
|
||||
}
|
||||
if (dname == ansi_opname[(int) NEW_EXPR])
|
||||
return get_identifier ("__builtin_new");
|
||||
else if (dname == ansi_opname[(int) VEC_NEW_EXPR])
|
||||
return get_identifier ("__builtin_vec_new");
|
||||
}
|
||||
|
||||
OB_INIT ();
|
||||
|
|
Loading…
Reference in New Issue