aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-06-16 11:24:10 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-06-16 11:24:10 +0000
commit4e61a9695a2292d4ba89a32a198606ef8bdced35 (patch)
tree8eb25ccabadb40a37d53c31350c7586d347dbfc4 /gcc/cp
parent75c613dbc5bfb736400045edde2af639cb266e26 (diff)
downloadgcc-4e61a9695a2292d4ba89a32a198606ef8bdced35.zip
gcc-4e61a9695a2292d4ba89a32a198606ef8bdced35.tar.gz
gcc-4e61a9695a2292d4ba89a32a198606ef8bdced35.tar.bz2
call.c (build_method_call): Remove bogus code for two-argument delete.
* call.c (build_method_call): Remove bogus code for two-argument delete. * init.c (build_new_1): Expand on comment, and remove dead code. From-SVN: r27547
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/call.c23
-rw-r--r--gcc/cp/init.c20
3 files changed, 14 insertions, 33 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 53e5f614..4336252 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
1999-06-16 Mark Mitchell <mark@codesourcery.com>
+ * call.c (build_method_call): Remove bogus code for two-argument
+ delete.
+ * init.c (build_new_1): Expand on comment, and remove dead code.
+
* init.c (expand_cleanup_for_base): New function, split out
from ...
(emit_base_init): Here.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 66d98c5..cdfba04 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -474,29 +474,6 @@ build_method_call (instance, name, parms, basetype_path, flags)
return build_min_nt (METHOD_CALL_EXPR, name, instance, parms, NULL_TREE);
}
- /* This is the logic that magically deletes the second argument to
- operator delete, if it is not needed. */
- if (name == ansi_opname[(int) DELETE_EXPR] && list_length (parms)==2)
- {
- tree save_last = TREE_CHAIN (parms);
-
- /* get rid of unneeded argument */
- TREE_CHAIN (parms) = NULL_TREE;
- if (build_method_call (instance, name, parms, basetype_path,
- (LOOKUP_SPECULATIVELY|flags) & ~LOOKUP_COMPLAIN))
- {
- /* If it finds a match, return it. */
- return build_method_call (instance, name, parms, basetype_path, flags);
- }
- /* If it doesn't work, two argument delete must work */
- TREE_CHAIN (parms) = save_last;
- }
- /* We already know whether it's needed or not for vec delete. */
- else if (name == ansi_opname[(int) VEC_DELETE_EXPR]
- && TYPE_LANG_SPECIFIC (TREE_TYPE (instance))
- && ! TYPE_VEC_DELETE_TAKES_SIZE (TREE_TYPE (instance)))
- TREE_CHAIN (parms) = NULL_TREE;
-
if (TREE_CODE (name) == BIT_NOT_EXPR)
{
if (parms)
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 852bb0b..019b5f9 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2191,21 +2191,21 @@ build_new_1 (exp)
signature_error (NULL_TREE, true_type);
return error_mark_node;
}
+
+ /* When we allocate an array, and the corresponding deallocation
+ function takes a second argument of type size_t, and that's the
+ "usual deallocation function", we allocate some extra space at
+ the beginning of the array to store the size of the array.
-#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. */
+ Well, that's what we should do. For backwards compatibility, we
+ have to do this whenever there's a two-argument array-delete
+ operator.
+ FIXME: For -fnew-abi, we don't have to maintain backwards
+ compatibility and we should fix this. */
use_cookie = (has_array && TYPE_VEC_NEW_USES_COOKIE (true_type)
&& ! (placement && ! TREE_CHAIN (placement)
&& TREE_TYPE (TREE_VALUE (placement)) == ptr_type_node));
-#else
- /* Get a little extra space to store a couple of things before the new'ed
- array, if this is either non-placement new or new (nothrow). */
-
- use_cookie = (has_array && TYPE_VEC_NEW_USES_COOKIE (true_type)
- && (! placement || nothrow));
-#endif
if (use_cookie)
{