From 7834ab392321cfd71058bc348460af9f56bcfd48 Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Tue, 8 Jul 1997 00:17:49 +0000 Subject: [PATCH] 92th Cygnus<->FSF merge From-SVN: r14401 --- gcc/cp/ChangeLog | 39 +++++++++++++++++++++++++++++++++++++++ gcc/cp/class.c | 2 +- gcc/cp/decl.c | 16 ++++++++++++++-- gcc/cp/decl2.c | 3 +-- gcc/cp/method.c | 3 +-- gcc/cp/pt.c | 4 ++-- gcc/cp/rtti.c | 6 +++--- gcc/cp/tree.c | 16 +++++++++++++++- gcc/cp/typeck2.c | 5 +++++ 9 files changed, 81 insertions(+), 13 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 37a439e68b3..90479465fab 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,42 @@ +Thu Jul 3 01:44:05 1997 Jason Merrill + + * class.c (finish_struct_1): Only complain about pointers without + copy stuff if there are any constructors. + + * rtti.c (build_dynamic_cast): Call complete_type on the types. + + * decl.c (grokfndecl): If the function we chose doesn't actually + match, die. + + * decl2.c (grokclassfn): Don't specify 'const int' for the + artificial destructor parm. + + * pt.c (type_unification): If we are called recursively, nothing + decays. + +Mon Jun 30 17:53:21 1997 Geoffrey Noer + + * decl.c: Stop trying to catch signals other than SIGABRT + since the Cygwin32 library doesn't support them correctly + yet. This fixes a situation in which g++ causes a hang on + SIGSEGVs and other such signals in our Win32-hosted tools. + +Mon Jun 30 14:50:01 1997 Jason Merrill + + * tree.c (mapcar, case CALL_EXPR): Handle all the parse node data. + +Fri Jun 27 15:18:49 1997 Jason Merrill + + * typeck2.c (store_init_value): Always return the value if our + type needs constructing. + + * method.c (hack_identifier): Convert class statics from + reference, too. + +Thu Jun 26 11:44:46 1997 Jason Merrill + + * Make-lang.in (cplib2.ready): Add $(LANGUAGES) dependency. + Thu Jun 19 16:49:28 1997 Mike Stump * typeck.c (c_expand_return): Make sure we clean up temporaries at diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 0dee0fd9690..62753322186 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -3598,7 +3598,7 @@ finish_struct_1 (t, warn_anon) } /* Effective C++ rule 11. */ - if (has_pointers && warn_ecpp + if (has_pointers && warn_ecpp && TYPE_HAS_CONSTRUCTOR (t) && ! (TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t))) { cp_warning ("`%#T' has pointer data members", t); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 5a5978c727f..248275e2b69 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4677,6 +4677,7 @@ init_decl_processing () around compiler bugs. */ signal (SIGSEGV, signal_catch); +#ifndef __CYGWIN32__ /* We will also catch aborts in the back-end through signal_catch and give the user a chance to see where the error might be, and to defeat aborts in the back-end when there have been errors previously in their @@ -4693,6 +4694,13 @@ init_decl_processing () #ifdef SIGBUS signal (SIGBUS, signal_catch); #endif +#else /* ndef __CYGWIN32__ */ + /* Cygwin32 cannot handle catching signals other than + SIGABRT yet. We hope this will cease to be the case soon. */ +#ifdef SIGABRT + signal (SIGABRT, signal_catch); +#endif +#endif /* ndef __CYGWIN32__ */ gcc_obstack_init (&decl_obstack); @@ -7189,8 +7197,12 @@ grokfndecl (ctype, type, declarator, virtualp, flags, quals, } if (tmp && DECL_ARTIFICIAL (tmp)) cp_error ("definition of implicitly-declared `%D'", tmp); - if (tmp && duplicate_decls (decl, tmp)) - return tmp; + if (tmp) + { + if (!duplicate_decls (decl, tmp)) + my_friendly_abort (892); + return tmp; + } } if (ctype == NULL_TREE || check) diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 229a656f260..b4fced4a127 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -949,10 +949,9 @@ grokclassfn (ctype, cname, function, flags, quals) if (flags == DTOR_FLAG) { char *buf, *dbuf; - tree const_integer_type = build_type_variant (integer_type_node, 1, 0); int len = sizeof (DESTRUCTOR_DECL_PREFIX)-1; - arg_types = hash_tree_chain (const_integer_type, void_list_node); + arg_types = hash_tree_chain (integer_type_node, void_list_node); TREE_SIDE_EFFECTS (arg_types) = 1; /* Build the overload name. It will look like `7Example'. */ if (IDENTIFIER_TYPE_VALUE (cname)) diff --git a/gcc/cp/method.c b/gcc/cp/method.c index a8502d45f43..de641d4c393 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1646,9 +1646,8 @@ hack_identifier (value, name) } } } - return value; } - if (TREE_CODE (value) == TREE_LIST && TREE_NONLOCAL_FLAG (value)) + else if (TREE_CODE (value) == TREE_LIST && TREE_NONLOCAL_FLAG (value)) { if (type == 0) { diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7febfc6390d..291e33baa3a 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2686,10 +2686,10 @@ type_unification (tparms, targs, parms, args, nsubsts, subr, strict) arg = TREE_TYPE (arg); } #endif - if (TREE_CODE (arg) == REFERENCE_TYPE) + if (! subr && TREE_CODE (arg) == REFERENCE_TYPE) arg = TREE_TYPE (arg); - if (TREE_CODE (parm) != REFERENCE_TYPE) + if (! subr && TREE_CODE (parm) != REFERENCE_TYPE) { if (TREE_CODE (arg) == FUNCTION_TYPE || TREE_CODE (arg) == METHOD_TYPE) diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 92b2c579f72..138432421e2 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -439,7 +439,7 @@ build_dynamic_cast (type, expr) goto fail; if (TREE_CODE (TREE_TYPE (exprtype)) != RECORD_TYPE) goto fail; - if (TYPE_SIZE (TREE_TYPE (exprtype)) == NULL_TREE) + if (TYPE_SIZE (complete_type (TREE_TYPE (exprtype))) == NULL_TREE) goto fail; if (TREE_READONLY (TREE_TYPE (exprtype)) && ! TYPE_READONLY (TREE_TYPE (type))) @@ -450,7 +450,7 @@ build_dynamic_cast (type, expr) case REFERENCE_TYPE: if (TREE_CODE (TREE_TYPE (type)) != RECORD_TYPE) goto fail; - if (TYPE_SIZE (TREE_TYPE (type)) == NULL_TREE) + if (TYPE_SIZE (complete_type (TREE_TYPE (type))) == NULL_TREE) goto fail; break; /* else fall through */ @@ -475,7 +475,7 @@ build_dynamic_cast (type, expr) goto fail; if (TREE_CODE (TREE_TYPE (exprtype)) != RECORD_TYPE) goto fail; - if (TYPE_SIZE (TREE_TYPE (exprtype)) == NULL_TREE) + if (TYPE_SIZE (complete_type (TREE_TYPE (exprtype))) == NULL_TREE) goto fail; if (TREE_READONLY (TREE_TYPE (exprtype)) && ! TYPE_READONLY (TREE_TYPE (type))) diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index a0605306d91..e6c0e500843 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1529,7 +1529,6 @@ mapcar (t, func) case PREINCREMENT_EXPR: case POSTDECREMENT_EXPR: case POSTINCREMENT_EXPR: - case CALL_EXPR: case ARRAY_REF: case SCOPE_REF: t = copy_node (t); @@ -1537,6 +1536,21 @@ mapcar (t, func) TREE_OPERAND (t, 1) = mapcar (TREE_OPERAND (t, 1), func); return t; + case CALL_EXPR: + t = copy_node (t); + TREE_TYPE (t) = mapcar (TREE_TYPE (t), func); + TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func); + TREE_OPERAND (t, 1) = mapcar (TREE_OPERAND (t, 1), func); + + /* tree.def says that operand two is RTL, but + build_call_declarator puts trees in there. */ + if (TREE_OPERAND (t, 2) + && TREE_CODE (TREE_OPERAND (t, 2)) == TREE_LIST) + TREE_OPERAND (t, 2) = mapcar (TREE_OPERAND (t, 2), func); + else + TREE_OPERAND (t, 2) = NULL_TREE; + return t; + case CONVERT_EXPR: case ADDR_EXPR: case INDIRECT_REF: diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index afd4cd8f205..d2a9839db96 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -621,6 +621,11 @@ store_init_value (decl, init) if (TREE_CODE (value) == ERROR_MARK) ; + /* Other code expects that initializers for objects of types that need + constructing never make it into DECL_INITIAL, and passes 'init' to + expand_aggr_init without checking DECL_INITIAL. So just return. */ + else if (TYPE_NEEDS_CONSTRUCTING (type)) + return value; else if (TREE_STATIC (decl) && (! TREE_CONSTANT (value) || ! initializer_constant_valid_p (value, TREE_TYPE (value)) -- 2.30.2