Commit c11b6f21 by Mike Stump

merging

From-SVN: r12700
parent 55df28b8
Wed Sep 11 22:38:13 1996 Gerald Baumgartner <gb@cs.purdue.edu>
* call.c (build_method_call): When calling a signature
default implementation, as in other cases, let instance_ptr simply
be instance.
Wed Sep 11 22:14:44 1996 Mike Stump <mrs@cygnus.com>
* parse.y (simple_stmt): Cleanup and use do_poplevel ().
Wed Sep 11 22:10:48 1996 Mike Stump <mrs@cygnus.com>
* except.c (expand_start_catch_block): Add a pushlevel so that -g
works on hppa and SPARC.
Wed Sep 11 10:18:06 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* typeck.c (build_indirect_ref): Catch PTR being an error_mark_node.
Mon Sep 9 19:51:14 1996 Gerald Baumgartner <gb@cs.purdue.edu>
* call.c (build_over_call): Check first whether DECL_CONTEXT exists
before testing whether it's a signature.
Sun Sep 8 16:06:57 1996 Gerald Baumgartner <gb@cs.purdue.edu>
* call.c (build_new_method_call): Don't complain about signature
pointers and references not being an aggr type.
(build_this): If a signature pointer or reference was passed in,
just return it.
(build_new_method_call): If instance is a signature pointer, set
basetype to the signature type of instance.
* sig.c (build_signature_method_call): Deleted basetype and
instance parameters, they can be found as the DECL_CONTEXT of
function and as the first argument passed in.
* cp-tree.h: Changed declaration of build_signature_method_call.
* call.c (build_method_call): Deleted first two arguments in call
of build_signature_method_call.
(build_over_call): Added call to build_signature_method_call.
Thu Sep 5 16:51:28 1996 Jason Merrill <jason@yorick.cygnus.com>
* typeck.c (build_c_cast): Don't tack a non_lvalue_expr onto a
target_expr.
Thu Sep 5 10:05:38 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* cvt.c (convert_to_reference): Use %#T, not %#D, for error.
Wed Sep 4 17:16:09 1996 Bob Manson <manson@charmed.cygnus.com> Wed Sep 4 17:16:09 1996 Bob Manson <manson@charmed.cygnus.com>
* except.c (expand_start_try_stmts): Move to except.c in the backend. * except.c (expand_start_try_stmts): Move to except.c in the backend.
...@@ -7,6 +56,191 @@ Wed Sep 4 17:16:09 1996 Bob Manson <manson@charmed.cygnus.com> ...@@ -7,6 +56,191 @@ Wed Sep 4 17:16:09 1996 Bob Manson <manson@charmed.cygnus.com>
of directly manipulating lists. of directly manipulating lists.
(emit_base_init): Ditto. (emit_base_init): Ditto.
Wed Sep 4 12:14:36 1996 Mike Stump <mrs@cygnus.com>
* except.c (expand_exception_blocks): Always make sure USE and
CLOBBER insns that came at the end still do, the backend relies
upon this.
Wed Sep 4 07:44:48 1996 Jason Merrill <jason@yorick.cygnus.com>
* call.c (build_over_call): We can only use a TARGET_EXPR of the
right type.
Tue Sep 3 19:26:05 1996 Jason Merrill <jason@yorick.cygnus.com>
* cvt.c (convert_to_reference): Revert last change, don't complain
about temp without target decl.
Tue Sep 3 10:22:56 1996 Mike Stump <mrs@cygnus.com>
* decl.c (grokdeclarator): Don't core dump when void() is given.
Tue Sep 3 02:38:56 1996 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (copy_args_p): Don't crash.
Fri Aug 30 14:26:57 1996 Mike Stump <mrs@cygnus.com>
* pt.c (tsubst): And support template args inside the exception
specification.
* pt.c (tsubst): Add support for exception specifications in
template functions.
Fri Aug 30 10:01:55 1996 Mike Stump <mrs@cygnus.com>
* cp-tree.def (DECL_STMT): Eliminate the throw spec field, only 3
fields now.
* cp-tree.h (start_decl): Eliminate the throw spec parameter.
(start_function): Likewise.
(start_method): Likewise.
(grokfield): Likewise.
(make_call_declarator): Add throw spec parameter.
(set_quals_and_spec): Add routine.
* lex.c (set_quals_and_spec): Likewise.
* decl.h (grokdeclarator): Eliminate the throw spec parameter.
* decl.c (shadow_tag): Eliminate the throw spec parameter to
grokdeclarator.
(groktypename): Likewise.
(start_decl): Eliminate the throw spec parameter. Eliminate the
throw spec parameter to grokdeclarator. Eliminate the throw spec
field in DECL_STMT.
(cp_finish_decl): Eliminate the throw spec field in DECL_STMT.
(grokfndecl): Remove useless set of raises.
(grokdeclarator): Eliminate the throw spec parameter. Eliminate
the throw spec parameter to start_decl. Pull the throw spec out
of the call declarator.
(grokparms): Eliminate the throw spec parameter to grokdeclarator.
(start_function): Eliminate the throw spec parameter. Eliminate
the throw spec parameter to grokdeclarator.
(start_method): Likewise.
* decl2.c (grokfield): Likewise.
(grokbitfield): Eliminate the throw spec parameter to grokdeclarator.
(grokoptypename): Likewise.
(finish_file): Eliminate the throw spec parameter to
start_function. Add throw spec to make_call_declarator.
* except.c (init_exception_processing): Add throw spec to
make_call_declarator. Eliminate the throw spec parameter to
start_decl.
(expand_start_catch_block): Eliminate the throw spec parameter to
grokdeclarator.
(expand_builtin_throw): Add throw spec to make_call_declarator.
Eliminate the throw spec parameter to start_function.
(start_anon_func): Likewise.
* lex.c (make_call_declarator): Add throw spec parameter.
(set_quals_and_spec): New routine.
(cons_up_default_function): Add throw spec to make_call_declarator.
Eliminate the throw spec parameter to grokfield.
* method.c (synthesize_method): Eliminate the throw spec parameter
to start_function.
* pt.c (process_template_parm): Eliminate the throw spec parameter
to grokdeclarator.
(tsubst): Add throw spec to make_call_declarator.
(tsubst_expr): Eliminate the throw spec parameter to start_decl.
(do_function_instantiation): Eliminate the throw spec parameter to
grokdeclarator. Eliminate the throw spec parameter to
start_function.
* rtti.c (synthesize_tinfo_fn): Eliminate the throw spec parameter
to start_function.
* parse.y (datadef): Remove non-winning optimization.
(decl): Likewise.
(fndef): Remove ambiguous error productions uncovered by grammer
fixing.
(constructor_declarator): Add exception_specification_opt here.
(component_constructor_declarator): Likewise.
(direct_after_type_declarator): Likewise.
(complex_direct_notype_declarator): Likewise.
(direct_abstract_declarator): Likewise.
(fn.def1): Remove exception_specification_opt.
(fn.def2): Likewise.
(condition): Likewise.
(initdcl0): Likewise.
(initdcl): Likewise.
(notype_initdcl0): Likewise.
(nomods_initdcl0): Likewise.
(component_decl_1): Likewise.
(component_declarator): Likewise.
(after_type_component_declarator0): Likewise.
(after_type_component_declarator): Likewise.
(notype_component_declarator): Likewise.
Wed Aug 28 01:40:30 1996 Jason Merrill <jason@yorick.cygnus.com>
* call.c (build_over_call): Also use an INIT_EXPR when
initializing anything from an rvalue.
* call.c (build_over_call): Call stabilize_reference when building
an INIT_EXPR instead of calling the copy ctor.
* call.c (joust): Extend the previous change to all comparisons.
* decl2.c, method.c, lex.c: Use MAKE_DECL_ONE_ONLY and
NO_LINKAGE_HEURISTICS.
* decl2.c (finish_file): Emit any statics that weren't already.
* typeck.c (build_static_cast): Implement.
* tree.c (build_cplus_new): Handle getting a TARGET_EXPR.
* decl.c (grokparms): Use can_convert_arg instead of
implicit_conversion directly.
(copy_args_p): New fn.
* cvt.c (convert_to_reference): Don't complain about temp with
static_cast.
(build_up_reference): Handle TARGET_EXPRs.
* call.c (build_over_call): Elide unnecessary temps.
(can_convert*): Use new overloading code.
Tue Aug 27 13:12:21 1996 Jason Merrill <jason@yorick.cygnus.com>
* call.c: Move TYPE_PTR*_MACROS ...
* cp-tree.h: To here.
* typeck.c (build_reinterpret_cast): Implement.
* call.c (add_builtin_candidate): Use TYPE_PTROB_P instead of
ptr_complete_ob.
(joust): If we're comparing a function to a builtin and the worst
conversion for the builtin is worse than the worst conversion for the
function, take the function.
* typeck.c (build_const_cast): Implement.
(comp_ptr_ttypes_const): Like comp_ptr_ttypes, for const_cast.
(comp_ptr_ttypes_reinterpret): Like cpt, for reinterpret_cast.
Tue Aug 27 13:14:58 1996 Bob Manson <manson@charmed.cygnus.com>
* rtti.c (build_dynamic_cast): Don't try to dereference exprtype
too early. Make sure we explode if exprtype turns out to be a
NULL_TREE when it shouldn't be.
Tue Aug 27 10:56:21 1996 Mike Stump <mrs@cygnus.com>
* cp-tree.h: New routine make_call_declarator.
* lex.c (make_call_declarator): Define it.
* except.c (init_exception_processing): Use it.
(expand_builtin_throw): Likewise.
(start_anon_func): Likewise.
* decl2.c (finish_file): Likewise.
* lex.c (cons_up_default_function): Likewise.
* parse.y: Likewise.
* pt.c (tsubst): Likewise.
Mon Aug 26 17:40:03 1996 Mike Stump <mrs@cygnus.com>
* decl2.c (groktypefield): Remove unused code.
Mon Aug 26 17:00:33 1996 Mike Stump <mrs@cygnus.com>
* gxx.gperf: Change TYPE_QUAL into CV_QUALIFIER.
* parse.y: Likewise. Change maybe_type_qual into maybe_cv_qualifier.
Change type_quals into cv_qualifiers. Change nonempty_type_quals into
nonempty_cv_qualifiers.
* hash.h: Rebuild.
* lex.c (make_pointer_declarator): Change type_quals into
cv_qualifiers.
(make_reference_declarator): Likewise.
Thu Aug 22 01:09:22 1996 Jason Merrill <jason@yorick.cygnus.com> Thu Aug 22 01:09:22 1996 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (start_function): Only check interface_* for templates * decl.c (start_function): Only check interface_* for templates
...@@ -122,10 +356,6 @@ Tue Aug 13 12:16:10 1996 Jason Merrill <jason@yorick.cygnus.com> ...@@ -122,10 +356,6 @@ Tue Aug 13 12:16:10 1996 Jason Merrill <jason@yorick.cygnus.com>
(import_export_decl): Use it. (import_export_decl): Use it.
* method.c (make_thunk): Use it. * method.c (make_thunk): Use it.
Sat Aug 17 15:23:39 1996 Geoffrey Noer <noer@cygnus.com>
* g++.c: Update test for win32 (&& ! cygwin32).
Mon Aug 12 00:09:18 1996 Jason Merrill <jason@yorick.cygnus.com> Mon Aug 12 00:09:18 1996 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (end_template_decl): If we don't actually have parms, return. * pt.c (end_template_decl): If we don't actually have parms, return.
......
...@@ -123,7 +123,7 @@ DEFTREECODE (DOTSTAR_EXPR, "dotstar_expr", "e", 2) ...@@ -123,7 +123,7 @@ DEFTREECODE (DOTSTAR_EXPR, "dotstar_expr", "e", 2)
DEFTREECODE (EXPR_STMT, "expr_stmt", "e", 1) DEFTREECODE (EXPR_STMT, "expr_stmt", "e", 1)
DEFTREECODE (COMPOUND_STMT, "compound_stmt", "e", 1) DEFTREECODE (COMPOUND_STMT, "compound_stmt", "e", 1)
DEFTREECODE (DECL_STMT, "decl_stmt", "e", 4) DEFTREECODE (DECL_STMT, "decl_stmt", "e", 3)
DEFTREECODE (IF_STMT, "if_stmt", "e", 3) DEFTREECODE (IF_STMT, "if_stmt", "e", 3)
DEFTREECODE (FOR_STMT, "for_stmt", "e", 4) DEFTREECODE (FOR_STMT, "for_stmt", "e", 4)
DEFTREECODE (WHILE_STMT, "while_stmt", "e", 2) DEFTREECODE (WHILE_STMT, "while_stmt", "e", 2)
......
...@@ -1265,6 +1265,21 @@ extern int flag_new_for_scope; ...@@ -1265,6 +1265,21 @@ extern int flag_new_for_scope;
#define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \ #define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \
(TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE)) (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE))
#define TYPE_PTRMEM_P(NODE) \
(TREE_CODE (NODE) == POINTER_TYPE \
&& TREE_CODE (TREE_TYPE (NODE)) == OFFSET_TYPE)
#define TYPE_PTR_P(NODE) \
(TREE_CODE (NODE) == POINTER_TYPE \
&& TREE_CODE (TREE_TYPE (NODE)) != OFFSET_TYPE)
#define TYPE_PTROB_P(NODE) \
(TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE \
&& TREE_CODE (TREE_TYPE (NODE)) != VOID_TYPE)
#define TYPE_PTROBV_P(NODE) \
(TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE)
#define TYPE_PTRFN_P(NODE) \
(TREE_CODE (NODE) == POINTER_TYPE \
&& TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
/* Nonzero for _TYPE node means that this type is a pointer to member /* Nonzero for _TYPE node means that this type is a pointer to member
function type. */ function type. */
#define TYPE_PTRMEMFUNC_P(NODE) (TREE_CODE(NODE) == RECORD_TYPE && TYPE_LANG_SPECIFIC(NODE)->type_flags.ptrmemfunc_flag) #define TYPE_PTRMEMFUNC_P(NODE) (TREE_CODE(NODE) == RECORD_TYPE && TYPE_LANG_SPECIFIC(NODE)->type_flags.ptrmemfunc_flag)
...@@ -2047,7 +2062,7 @@ extern int init_type_desc PROTO((void)); ...@@ -2047,7 +2062,7 @@ extern int init_type_desc PROTO((void));
extern void shadow_tag PROTO((tree)); extern void shadow_tag PROTO((tree));
extern int grok_ctor_properties PROTO((tree, tree)); extern int grok_ctor_properties PROTO((tree, tree));
extern tree groktypename PROTO((tree)); extern tree groktypename PROTO((tree));
extern tree start_decl PROTO((tree, tree, int, tree)); extern tree start_decl PROTO((tree, tree, int));
extern void cp_finish_decl PROTO((tree, tree, tree, int, int)); extern void cp_finish_decl PROTO((tree, tree, tree, int, int));
extern void expand_static_init PROTO((tree, tree)); extern void expand_static_init PROTO((tree, tree));
extern int complete_array_type PROTO((tree, tree, int)); extern int complete_array_type PROTO((tree, tree, int));
...@@ -2061,13 +2076,13 @@ extern tree start_enum PROTO((tree)); ...@@ -2061,13 +2076,13 @@ extern tree start_enum PROTO((tree));
extern tree finish_enum PROTO((tree, tree)); extern tree finish_enum PROTO((tree, tree));
extern tree build_enumerator PROTO((tree, tree)); extern tree build_enumerator PROTO((tree, tree));
extern tree grok_enum_decls PROTO((tree, tree)); extern tree grok_enum_decls PROTO((tree, tree));
extern int start_function PROTO((tree, tree, tree, tree, int)); extern int start_function PROTO((tree, tree, tree, int));
extern void store_parm_decls PROTO((void)); extern void store_parm_decls PROTO((void));
extern void expand_start_early_try_stmts PROTO((void)); extern void expand_start_early_try_stmts PROTO((void));
extern void store_in_parms PROTO((struct rtx_def *)); extern void store_in_parms PROTO((struct rtx_def *));
extern void store_return_init PROTO((tree, tree)); extern void store_return_init PROTO((tree, tree));
extern void finish_function PROTO((int, int, int)); extern void finish_function PROTO((int, int, int));
extern tree start_method PROTO((tree, tree, tree)); extern tree start_method PROTO((tree, tree));
extern tree finish_method PROTO((tree)); extern tree finish_method PROTO((tree));
extern void hack_incomplete_structures PROTO((tree)); extern void hack_incomplete_structures PROTO((tree));
extern tree maybe_build_cleanup PROTO((tree)); extern tree maybe_build_cleanup PROTO((tree));
...@@ -2092,7 +2107,7 @@ extern tree grok_alignof PROTO((tree)); ...@@ -2092,7 +2107,7 @@ extern tree grok_alignof PROTO((tree));
extern tree grok_array_decl PROTO((tree, tree)); extern tree grok_array_decl PROTO((tree, tree));
extern tree delete_sanity PROTO((tree, tree, int, int)); extern tree delete_sanity PROTO((tree, tree, int, int));
extern tree check_classfn PROTO((tree, tree)); extern tree check_classfn PROTO((tree, tree));
extern tree grokfield PROTO((tree, tree, tree, tree, tree, tree)); extern tree grokfield PROTO((tree, tree, tree, tree, tree));
extern tree grokbitfield PROTO((tree, tree, tree)); extern tree grokbitfield PROTO((tree, tree, tree));
extern tree groktypefield PROTO((tree, tree)); extern tree groktypefield PROTO((tree, tree));
extern tree grokoptypename PROTO((tree, tree)); extern tree grokoptypename PROTO((tree, tree));
...@@ -2192,6 +2207,8 @@ extern tree build_vec_delete PROTO((tree, tree, tree, tree, int)); ...@@ -2192,6 +2207,8 @@ extern tree build_vec_delete PROTO((tree, tree, tree, tree, int));
/* in lex.c */ /* in lex.c */
extern tree make_pointer_declarator PROTO((tree, tree)); extern tree make_pointer_declarator PROTO((tree, tree));
extern tree make_reference_declarator PROTO((tree, tree)); extern tree make_reference_declarator PROTO((tree, tree));
extern tree make_call_declarator PROTO((tree, tree, tree, tree));
extern void set_quals_and_spec PROTO((tree, tree, tree));
extern char *operator_name_string PROTO((tree)); extern char *operator_name_string PROTO((tree));
extern void lang_init PROTO((void)); extern void lang_init PROTO((void));
extern void lang_finish PROTO((void)); extern void lang_finish PROTO((void));
...@@ -2345,7 +2362,7 @@ extern tree get_template_base PROTO((tree, tree)); ...@@ -2345,7 +2362,7 @@ extern tree get_template_base PROTO((tree, tree));
extern tree build_signature_pointer_type PROTO((tree, int, int)); extern tree build_signature_pointer_type PROTO((tree, int, int));
extern tree build_signature_reference_type PROTO((tree, int, int)); extern tree build_signature_reference_type PROTO((tree, int, int));
extern tree build_signature_pointer_constructor PROTO((tree, tree)); extern tree build_signature_pointer_constructor PROTO((tree, tree));
extern tree build_signature_method_call PROTO((tree, tree, tree, tree)); extern tree build_signature_method_call PROTO((tree, tree));
extern tree build_optr_ref PROTO((tree)); extern tree build_optr_ref PROTO((tree));
extern tree build_sptr_ref PROTO((tree)); extern tree build_sptr_ref PROTO((tree));
extern void append_signature_fields PROTO((tree)); extern void append_signature_fields PROTO((tree));
......
...@@ -594,6 +594,11 @@ build_up_reference (type, arg, flags, checkconst) ...@@ -594,6 +594,11 @@ build_up_reference (type, arg, flags, checkconst)
TREE_REFERENCE_EXPR (rval) = 1; TREE_REFERENCE_EXPR (rval) = 1;
return rval; return rval;
case TARGET_EXPR:
TREE_ADDRESSABLE (targ) = 1;
put_var_into_stack (TREE_OPERAND (targ, 0));
break;
default: default:
break; break;
} }
...@@ -742,15 +747,14 @@ convert_to_reference (reftype, expr, convtype, flags, decl) ...@@ -742,15 +747,14 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
ttr = cp_build_type_variant (TREE_TYPE (expr), r, v); ttr = cp_build_type_variant (TREE_TYPE (expr), r, v);
} }
if (! real_lvalue_p (expr) && if (! real_lvalue_p (expr) && ! TYPE_READONLY (ttl))
(decl == NULL_TREE || ! TYPE_READONLY (ttl)))
{ {
if (decl) if (decl)
/* Ensure semantics of [dcl.init.ref] */ /* Ensure semantics of [dcl.init.ref] */
cp_pedwarn ("initialization of non-const `%T' from rvalue `%T'", cp_pedwarn ("initialization of non-const reference `%#T' from rvalue `%T'",
reftype, intype); reftype, intype);
else else
cp_pedwarn ("conversion to `%T' from rvalue `%T'", cp_pedwarn ("conversion to non-const `%T' from rvalue `%T'",
reftype, intype); reftype, intype);
} }
else if (! (convtype & CONV_CONST)) else if (! (convtype & CONV_CONST))
......
...@@ -5700,7 +5700,7 @@ shadow_tag (declspecs) ...@@ -5700,7 +5700,7 @@ shadow_tag (declspecs)
if (TYPE_FIELDS (t)) if (TYPE_FIELDS (t))
{ {
tree decl = grokdeclarator (NULL_TREE, declspecs, NORMAL, 0, tree decl = grokdeclarator (NULL_TREE, declspecs, NORMAL, 0,
NULL_TREE, NULL_TREE); NULL_TREE);
finish_anon_union (decl); finish_anon_union (decl);
} }
} }
...@@ -5739,7 +5739,7 @@ groktypename (typename) ...@@ -5739,7 +5739,7 @@ groktypename (typename)
return typename; return typename;
return grokdeclarator (TREE_VALUE (typename), return grokdeclarator (TREE_VALUE (typename),
TREE_PURPOSE (typename), TREE_PURPOSE (typename),
TYPENAME, 0, NULL_TREE, NULL_TREE); TYPENAME, 0, NULL_TREE);
} }
/* Decode a declarator in an ordinary declaration or data definition. /* Decode a declarator in an ordinary declaration or data definition.
...@@ -5764,10 +5764,9 @@ int debug_temp_inits = 1; ...@@ -5764,10 +5764,9 @@ int debug_temp_inits = 1;
void start_decl_1 (); void start_decl_1 ();
tree tree
start_decl (declarator, declspecs, initialized, raises) start_decl (declarator, declspecs, initialized)
tree declarator, declspecs; tree declarator, declspecs;
int initialized; int initialized;
tree raises;
{ {
register tree decl; register tree decl;
register tree type, tem; register tree type, tem;
...@@ -5788,7 +5787,7 @@ start_decl (declarator, declspecs, initialized, raises) ...@@ -5788,7 +5787,7 @@ start_decl (declarator, declspecs, initialized, raises)
used_extern_spec = 1; used_extern_spec = 1;
} }
decl = grokdeclarator (declarator, declspecs, NORMAL, initialized, raises, decl = grokdeclarator (declarator, declspecs, NORMAL, initialized,
NULL_TREE); NULL_TREE);
if (decl == NULL_TREE || decl == void_type_node) if (decl == NULL_TREE || decl == void_type_node)
return NULL_TREE; return NULL_TREE;
...@@ -5923,7 +5922,7 @@ start_decl (declarator, declspecs, initialized, raises) ...@@ -5923,7 +5922,7 @@ start_decl (declarator, declspecs, initialized, raises)
DECL_VINDEX (decl) DECL_VINDEX (decl)
= build_min_nt (DECL_STMT, copy_to_permanent (declarator), = build_min_nt (DECL_STMT, copy_to_permanent (declarator),
copy_to_permanent (declspecs), copy_to_permanent (declspecs),
copy_to_permanent (raises), NULL_TREE); NULL_TREE);
} }
...@@ -6249,7 +6248,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags) ...@@ -6249,7 +6248,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
{ {
tree stmt = DECL_VINDEX (decl); tree stmt = DECL_VINDEX (decl);
DECL_VINDEX (decl) = NULL_TREE; DECL_VINDEX (decl) = NULL_TREE;
TREE_OPERAND (stmt, 3) = copy_to_permanent (init); TREE_OPERAND (stmt, 2) = copy_to_permanent (init);
add_tree (stmt); add_tree (stmt);
} }
...@@ -7111,8 +7110,8 @@ grokfndecl (ctype, type, declarator, virtualp, flags, quals, ...@@ -7111,8 +7110,8 @@ grokfndecl (ctype, type, declarator, virtualp, flags, quals,
if (raises) if (raises)
{ {
type = build_exception_variant (type, raises); type = build_exception_variant (type, raises);
raises = TYPE_RAISES_EXCEPTIONS (type);
} }
decl = build_lang_decl (FUNCTION_DECL, declarator, type); decl = build_lang_decl (FUNCTION_DECL, declarator, type);
/* propagate volatile out from type to decl */ /* propagate volatile out from type to decl */
if (TYPE_VOLATILE (type)) if (TYPE_VOLATILE (type))
...@@ -7447,12 +7446,12 @@ build_ptrmemfunc_type (type) ...@@ -7447,12 +7446,12 @@ build_ptrmemfunc_type (type)
enum return_types { return_normal, return_ctor, return_dtor, return_conversion }; enum return_types { return_normal, return_ctor, return_dtor, return_conversion };
tree tree
grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrlist) grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
tree declspecs; tree declspecs;
tree declarator; tree declarator;
enum decl_context decl_context; enum decl_context decl_context;
int initialized; int initialized;
tree raises, attrlist; tree attrlist;
{ {
RID_BIT_TYPE specbits; RID_BIT_TYPE specbits;
int nclasses = 0; int nclasses = 0;
...@@ -7489,6 +7488,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli ...@@ -7489,6 +7488,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
tree ctor_return_type = NULL_TREE; tree ctor_return_type = NULL_TREE;
enum overload_flags flags = NO_SPECIAL; enum overload_flags flags = NO_SPECIAL;
tree quals = NULL_TREE; tree quals = NULL_TREE;
tree raises = NULL_TREE;
RIDBIT_RESET_ALL (specbits); RIDBIT_RESET_ALL (specbits);
if (decl_context == FUNCDEF) if (decl_context == FUNCDEF)
...@@ -7579,7 +7579,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli ...@@ -7579,7 +7579,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
*next = TREE_OPERAND (decl, 0); *next = TREE_OPERAND (decl, 0);
init = TREE_OPERAND (decl, 1); init = TREE_OPERAND (decl, 1);
decl = start_decl (declarator, declspecs, 1, NULL_TREE); decl = start_decl (declarator, declspecs, 1);
finish_decl (decl, init, NULL_TREE); finish_decl (decl, init, NULL_TREE);
return 0; return 0;
} }
...@@ -7587,6 +7587,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli ...@@ -7587,6 +7587,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
if (decl_context == FIELD && ctype == NULL_TREE) if (decl_context == FIELD && ctype == NULL_TREE)
ctype = current_class_type; ctype = current_class_type;
if (ctype if (ctype
&& TREE_OPERAND (decl, 0)
&& (TREE_CODE (TREE_OPERAND (decl, 0)) == TYPE_DECL && (TREE_CODE (TREE_OPERAND (decl, 0)) == TYPE_DECL
&& ((DECL_NAME (TREE_OPERAND (decl, 0)) && ((DECL_NAME (TREE_OPERAND (decl, 0))
== constructor_name_full (ctype)) == constructor_name_full (ctype))
...@@ -8529,6 +8530,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli ...@@ -8529,6 +8530,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
/* Pick up type qualifiers which should be applied to `this'. */ /* Pick up type qualifiers which should be applied to `this'. */
quals = TREE_OPERAND (declarator, 2); quals = TREE_OPERAND (declarator, 2);
/* Pick up the exception specifications. */
raises = TREE_TYPE (declarator);
/* Say it's a definition only for the CALL_EXPR /* Say it's a definition only for the CALL_EXPR
closest to the identifier. */ closest to the identifier. */
funcdecl_p = funcdecl_p =
...@@ -9776,11 +9780,10 @@ grokparms (first_parm, funcdef_flag) ...@@ -9776,11 +9780,10 @@ grokparms (first_parm, funcdef_flag)
if (decl != void_type_node) if (decl != void_type_node)
{ {
/* @@ May need to fetch out a `raises' here. */
decl = grokdeclarator (TREE_VALUE (decl), decl = grokdeclarator (TREE_VALUE (decl),
TREE_PURPOSE (decl), TREE_PURPOSE (decl),
PARM, init != NULL_TREE, PARM, init != NULL_TREE,
NULL_TREE, NULL_TREE); NULL_TREE);
if (! decl) if (! decl)
continue; continue;
type = TREE_TYPE (decl); type = TREE_TYPE (decl);
...@@ -9878,7 +9881,7 @@ grokparms (first_parm, funcdef_flag) ...@@ -9878,7 +9881,7 @@ grokparms (first_parm, funcdef_flag)
else else
init = require_instantiated_type (type, init, integer_zero_node); init = require_instantiated_type (type, init, integer_zero_node);
if (! current_template_parms if (! current_template_parms
&& ! implicit_conversion (type, TREE_TYPE (init), init, LOOKUP_NORMAL)) && ! can_convert_arg (type, TREE_TYPE (init), init))
cp_pedwarn ("invalid type `%T' for default argument to `%#D'", cp_pedwarn ("invalid type `%T' for default argument to `%#D'",
TREE_TYPE (init), decl); TREE_TYPE (init), decl);
} }
...@@ -9933,6 +9936,21 @@ grokparms (first_parm, funcdef_flag) ...@@ -9933,6 +9936,21 @@ grokparms (first_parm, funcdef_flag)
return result; return result;
} }
int
copy_args_p (d)
tree d;
{
tree t = FUNCTION_ARG_CHAIN (d);
if (t && TREE_CODE (TREE_VALUE (t)) == REFERENCE_TYPE
&& (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (t)))
== DECL_CLASS_CONTEXT (d))
&& (TREE_CHAIN (t) == NULL_TREE
|| TREE_CHAIN (t) == void_list_node
|| TREE_PURPOSE (TREE_CHAIN (t))))
return 1;
return 0;
}
/* These memoizing functions keep track of special properties which /* These memoizing functions keep track of special properties which
a class may have. `grok_ctor_properties' notices whether a class a class may have. `grok_ctor_properties' notices whether a class
has a constructor of the form X(X&), and also complains has a constructor of the form X(X&), and also complains
...@@ -10880,8 +10898,8 @@ static int function_depth; ...@@ -10880,8 +10898,8 @@ static int function_depth;
@@ something we had previously. */ @@ something we had previously. */
int int
start_function (declspecs, declarator, raises, attrs, pre_parsed_p) start_function (declspecs, declarator, attrs, pre_parsed_p)
tree declspecs, declarator, raises, attrs; tree declspecs, declarator, attrs;
int pre_parsed_p; int pre_parsed_p;
{ {
tree decl1; tree decl1;
...@@ -10957,8 +10975,6 @@ start_function (declspecs, declarator, raises, attrs, pre_parsed_p) ...@@ -10957,8 +10975,6 @@ start_function (declspecs, declarator, raises, attrs, pre_parsed_p)
doing_friend = 1; doing_friend = 1;
} }
raises = TYPE_RAISES_EXCEPTIONS (fntype);
/* In a fcn definition, arg types must be complete. */ /* In a fcn definition, arg types must be complete. */
require_complete_types_for_parms (DECL_ARGUMENTS (decl1)); require_complete_types_for_parms (DECL_ARGUMENTS (decl1));
...@@ -10975,8 +10991,7 @@ start_function (declspecs, declarator, raises, attrs, pre_parsed_p) ...@@ -10975,8 +10991,7 @@ start_function (declspecs, declarator, raises, attrs, pre_parsed_p)
} }
else else
{ {
decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, raises, decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, NULL_TREE);
NULL_TREE);
/* If the declarator is not suitable for a function definition, /* If the declarator is not suitable for a function definition,
cause a syntax error. */ cause a syntax error. */
if (decl1 == NULL_TREE || TREE_CODE (decl1) != FUNCTION_DECL) return 0; if (decl1 == NULL_TREE || TREE_CODE (decl1) != FUNCTION_DECL) return 0;
...@@ -12109,10 +12124,10 @@ finish_function (lineno, call_poplevel, nested) ...@@ -12109,10 +12124,10 @@ finish_function (lineno, call_poplevel, nested)
CHANGES TO CODE IN `grokfield'. */ CHANGES TO CODE IN `grokfield'. */
tree tree
start_method (declspecs, declarator, raises) start_method (declspecs, declarator)
tree declarator, declspecs, raises; tree declarator, declspecs;
{ {
tree fndecl = grokdeclarator (declarator, declspecs, MEMFUNCDEF, 0, raises, tree fndecl = grokdeclarator (declarator, declspecs, MEMFUNCDEF, 0,
NULL_TREE); NULL_TREE);
/* Something too ugly to handle. */ /* Something too ugly to handle. */
......
...@@ -31,7 +31,7 @@ enum decl_context ...@@ -31,7 +31,7 @@ enum decl_context
}; };
/* We need this in here to get the decl_context definition. */ /* We need this in here to get the decl_context definition. */
extern tree grokdeclarator PROTO((tree, tree, enum decl_context, int, tree, tree)); extern tree grokdeclarator PROTO((tree, tree, enum decl_context, int, tree));
/* C++: Keep these around to reduce calls to `get_identifier'. /* C++: Keep these around to reduce calls to `get_identifier'.
Identifiers for `this' in member functions and the auto-delete Identifiers for `this' in member functions and the auto-delete
......
...@@ -37,10 +37,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -37,10 +37,6 @@ Boston, MA 02111-1307, USA. */
#include "lex.h" #include "lex.h"
#include "output.h" #include "output.h"
#ifndef SUPPORTS_ONE_ONLY
#define SUPPORTS_ONE_ONLY 0
#endif
extern tree get_file_function_name (); extern tree get_file_function_name ();
extern tree cleanups_this_call; extern tree cleanups_this_call;
static void grok_function_init PROTO((tree, tree)); static void grok_function_init PROTO((tree, tree));
...@@ -1339,8 +1335,8 @@ check_classfn (ctype, function) ...@@ -1339,8 +1335,8 @@ check_classfn (ctype, function)
CHANGES TO CODE IN `start_method'. */ CHANGES TO CODE IN `start_method'. */
tree tree
grokfield (declarator, declspecs, raises, init, asmspec_tree, attrlist) grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
tree declarator, declspecs, raises, init, asmspec_tree, attrlist; tree declarator, declspecs, init, asmspec_tree, attrlist;
{ {
register tree value; register tree value;
char *asmspec = 0; char *asmspec = 0;
...@@ -1376,8 +1372,7 @@ grokfield (declarator, declspecs, raises, init, asmspec_tree, attrlist) ...@@ -1376,8 +1372,7 @@ grokfield (declarator, declspecs, raises, init, asmspec_tree, attrlist)
&& TREE_CHAIN (init) == NULL_TREE) && TREE_CHAIN (init) == NULL_TREE)
init = NULL_TREE; init = NULL_TREE;
value = grokdeclarator (declarator, declspecs, FIELD, init != 0, value = grokdeclarator (declarator, declspecs, FIELD, init != 0, NULL_TREE);
raises, NULL_TREE);
if (! value) if (! value)
return value; /* friend or constructor went bad. */ return value; /* friend or constructor went bad. */
...@@ -1593,7 +1588,7 @@ grokbitfield (declarator, declspecs, width) ...@@ -1593,7 +1588,7 @@ grokbitfield (declarator, declspecs, width)
tree declarator, declspecs, width; tree declarator, declspecs, width;
{ {
register tree value = grokdeclarator (declarator, declspecs, BITFIELD, register tree value = grokdeclarator (declarator, declspecs, BITFIELD,
0, NULL_TREE, NULL_TREE); 0, NULL_TREE);
if (! value) return NULL_TREE; /* friends went bad. */ if (! value) return NULL_TREE; /* friends went bad. */
...@@ -1640,194 +1635,11 @@ grokbitfield (declarator, declspecs, width) ...@@ -1640,194 +1635,11 @@ grokbitfield (declarator, declspecs, width)
return value; return value;
} }
#if 0
/* Like GROKFIELD, except that the declarator has been
buried in DECLSPECS. Find the declarator, and
return something that looks like it came from
GROKFIELD. */
tree
groktypefield (declspecs, parmlist)
tree declspecs;
tree parmlist;
{
tree spec = declspecs;
tree prev = NULL_TREE;
tree type_id = NULL_TREE;
tree quals = NULL_TREE;
tree lengths = NULL_TREE;
tree decl = NULL_TREE;
while (spec)
{
register tree id = TREE_VALUE (spec);
if (TREE_CODE (spec) != TREE_LIST)
/* Certain parse errors slip through. For example,
`int class ();' is not caught by the parser. Try
weakly to recover here. */
return NULL_TREE;
if (TREE_CODE (id) == TYPE_DECL
|| (TREE_CODE (id) == IDENTIFIER_NODE && TREE_TYPE (id)))
{
/* We have a constructor/destructor or
conversion operator. Use it. */
if (prev)
TREE_CHAIN (prev) = TREE_CHAIN (spec);
else
declspecs = TREE_CHAIN (spec);
type_id = id;
goto found;
}
prev = spec;
spec = TREE_CHAIN (spec);
}
/* Nope, we have a conversion operator to a scalar type or something
else, that includes things like constructor declarations for
templates. */
spec = declspecs;
while (spec)
{
tree id = TREE_VALUE (spec);
if (TREE_CODE (id) == IDENTIFIER_NODE)
{
if (id == ridpointers[(int)RID_INT]
|| id == ridpointers[(int)RID_DOUBLE]
|| id == ridpointers[(int)RID_FLOAT]
|| id == ridpointers[(int)RID_WCHAR])
{
if (type_id)
error ("extra `%s' ignored",
IDENTIFIER_POINTER (id));
else
type_id = id;
}
else if (id == ridpointers[(int)RID_LONG]
|| id == ridpointers[(int)RID_SHORT]
|| id == ridpointers[(int)RID_CHAR])
{
lengths = tree_cons (NULL_TREE, id, lengths);
}
else if (id == ridpointers[(int)RID_VOID])
{
if (type_id)
error ("spurious `void' type ignored");
else
error ("conversion to `void' type invalid");
}
else if (id == ridpointers[(int)RID_AUTO]
|| id == ridpointers[(int)RID_REGISTER]
|| id == ridpointers[(int)RID_TYPEDEF]
|| id == ridpointers[(int)RID_CONST]
|| id == ridpointers[(int)RID_VOLATILE])
{
error ("type specifier `%s' used invalidly",
IDENTIFIER_POINTER (id));
}
else if (id == ridpointers[(int)RID_FRIEND]
|| id == ridpointers[(int)RID_VIRTUAL]
|| id == ridpointers[(int)RID_INLINE]
|| id == ridpointers[(int)RID_UNSIGNED]
|| id == ridpointers[(int)RID_SIGNED]
|| id == ridpointers[(int)RID_STATIC]
|| id == ridpointers[(int)RID_EXTERN])
{
quals = tree_cons (NULL_TREE, id, quals);
}
else
{
/* Happens when we have a global typedef
and a class-local member function with
the same name. */
type_id = id;
goto found;
}
}
else if (TREE_CODE (id) == RECORD_TYPE)
{
type_id = TYPE_NAME (id);
if (TREE_CODE (type_id) == TYPE_DECL)
type_id = DECL_NAME (type_id);
if (type_id == NULL_TREE)
error ("identifier for aggregate type conversion omitted");
}
else if (TREE_CODE_CLASS (TREE_CODE (id)) == 't')
error ("`operator' missing on conversion operator or tag missing from type");
else
my_friendly_abort (194);
spec = TREE_CHAIN (spec);
}
if (type_id)
declspecs = chainon (lengths, quals);
else if (lengths)
{
if (TREE_CHAIN (lengths))
error ("multiple length specifiers");
type_id = ridpointers[(int)RID_INT];
declspecs = chainon (lengths, quals);
}
else if (quals)
{
error ("no type given, defaulting to `operator int ...'");
type_id = ridpointers[(int)RID_INT];
declspecs = quals;
}
else
return NULL_TREE;
found:
decl = grokdeclarator (build_parse_node (CALL_EXPR, type_id, parmlist, NULL_TREE),
declspecs, FIELD, 0, NULL_TREE, NULL_TREE);
if (decl == NULL_TREE)
return NULL_TREE;
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_CHAIN (decl) != NULL_TREE)
{
/* Need a fresh node here so that we don't get circularity
when we link these together. */
decl = copy_node (decl);
}
if (decl == void_type_node
|| (TREE_CODE (decl) == FUNCTION_DECL
&& TREE_CODE (TREE_TYPE (decl)) != METHOD_TYPE))
/* bunch of friends. */
return decl;
if (DECL_IN_AGGR_P (decl))
{
cp_error ("`%D' already defined in the class ", decl);
return void_type_node;
}
cp_finish_decl (decl, NULL_TREE, NULL_TREE, 0, 0);
/* If this declaration is common to another declaration
complain about such redundancy, and return NULL_TREE
so that we don't build a circular list. */
if (DECL_CHAIN (decl))
{
cp_error ("function `%D' declared twice in class %T", decl,
DECL_CONTEXT (decl));
return NULL_TREE;
}
DECL_IN_AGGR_P (decl) = 1;
return decl;
}
#endif
tree tree
grokoptypename (declspecs, declarator) grokoptypename (declspecs, declarator)
tree declspecs, declarator; tree declspecs, declarator;
{ {
tree t = grokdeclarator (declarator, declspecs, TYPENAME, 0, tree t = grokdeclarator (declarator, declspecs, TYPENAME, 0, NULL_TREE);
NULL_TREE, NULL_TREE);
return build_typename_overload (t); return build_typename_overload (t);
} }
...@@ -2486,12 +2298,9 @@ comdat_linkage (decl) ...@@ -2486,12 +2298,9 @@ comdat_linkage (decl)
{ {
TREE_PUBLIC (decl) = 0; TREE_PUBLIC (decl) = 0;
#ifdef DECL_ONE_ONLY #ifdef MAKE_DECL_ONE_ONLY
if (SUPPORTS_ONE_ONLY) MAKE_DECL_ONE_ONLY (decl);
{ TREE_PUBLIC (decl) = 1;
DECL_ONE_ONLY (decl) = 1;
TREE_PUBLIC (decl) = 1;
}
#endif #endif
if (flag_weak) if (flag_weak)
...@@ -2499,7 +2308,6 @@ comdat_linkage (decl) ...@@ -2499,7 +2308,6 @@ comdat_linkage (decl)
DECL_WEAK (decl) = 1; DECL_WEAK (decl) = 1;
TREE_PUBLIC (decl) = 1; TREE_PUBLIC (decl) = 1;
} }
} }
/* Set TREE_PUBLIC and/or DECL_EXTERN on the vtable DECL, /* Set TREE_PUBLIC and/or DECL_EXTERN on the vtable DECL,
...@@ -2585,8 +2393,8 @@ finish_prevtable_vardecl (prev, vars) ...@@ -2585,8 +2393,8 @@ finish_prevtable_vardecl (prev, vars)
tree ctype = DECL_CONTEXT (vars); tree ctype = DECL_CONTEXT (vars);
import_export_template (ctype); import_export_template (ctype);
#ifndef NO_LINKAGE_HEURISTICS
if (CLASSTYPE_INTERFACE_UNKNOWN (ctype) && TYPE_VIRTUAL_P (ctype) if (CLASSTYPE_INTERFACE_UNKNOWN (ctype) && TYPE_VIRTUAL_P (ctype)
&& ! (SUPPORTS_ONE_ONLY > 1)
&& ! CLASSTYPE_TEMPLATE_INSTANTIATION (ctype)) && ! CLASSTYPE_TEMPLATE_INSTANTIATION (ctype))
{ {
tree method; tree method;
...@@ -2604,6 +2412,7 @@ finish_prevtable_vardecl (prev, vars) ...@@ -2604,6 +2412,7 @@ finish_prevtable_vardecl (prev, vars)
} }
} }
} }
#endif
import_export_vtable (vars, ctype, 1); import_export_vtable (vars, ctype, 1);
return 1; return 1;
...@@ -2785,9 +2594,8 @@ import_export_decl (decl) ...@@ -2785,9 +2594,8 @@ import_export_decl (decl)
{ {
/* Statically initialized vars are weak or comdat, if /* Statically initialized vars are weak or comdat, if
supported. */ supported. */
#ifdef DECL_ONE_ONLY #ifdef MAKE_DECL_ONE_ONLY
if (SUPPORTS_ONE_ONLY) MAKE_DECL_ONE_ONLY (decl);
DECL_ONE_ONLY (decl) = 1;
#endif #endif
if (flag_weak) if (flag_weak)
DECL_WEAK (decl) = 1; DECL_WEAK (decl) = 1;
...@@ -2991,6 +2799,9 @@ finish_file () ...@@ -2991,6 +2799,9 @@ finish_file ()
} }
} }
for (vars = static_aggregates; vars; vars = TREE_CHAIN (vars))
if (! TREE_ASM_WRITTEN (TREE_VALUE (vars)))
rest_of_decl_compilation (TREE_VALUE (vars), 0, 1, 1);
vars = static_aggregates; vars = static_aggregates;
if (static_ctors || vars || exception_table_p ()) if (static_ctors || vars || exception_table_p ())
...@@ -3017,9 +2828,9 @@ finish_file () ...@@ -3017,9 +2828,9 @@ finish_file ()
fnname = get_file_function_name ('D'); fnname = get_file_function_name ('D');
start_function (void_list_node, start_function (void_list_node,
build_parse_node (CALL_EXPR, fnname, void_list_node, make_call_declarator (fnname, void_list_node, NULL_TREE,
NULL_TREE), NULL_TREE),
NULL_TREE, NULL_TREE, 0); NULL_TREE, 0);
fnname = DECL_ASSEMBLER_NAME (current_function_decl); fnname = DECL_ASSEMBLER_NAME (current_function_decl);
store_parm_decls (); store_parm_decls ();
...@@ -3083,9 +2894,9 @@ finish_file () ...@@ -3083,9 +2894,9 @@ finish_file ()
{ {
fnname = get_file_function_name ('I'); fnname = get_file_function_name ('I');
start_function (void_list_node, start_function (void_list_node,
build_parse_node (CALL_EXPR, fnname, make_call_declarator (fnname, void_list_node, NULL_TREE,
void_list_node, NULL_TREE), NULL_TREE),
NULL_TREE, NULL_TREE, 0); NULL_TREE, 0);
fnname = DECL_ASSEMBLER_NAME (current_function_decl); fnname = DECL_ASSEMBLER_NAME (current_function_decl);
store_parm_decls (); store_parm_decls ();
......
...@@ -312,36 +312,36 @@ init_exception_processing () ...@@ -312,36 +312,36 @@ init_exception_processing ()
declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE); declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_pc")); d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_pc"));
d = start_decl (d, declspecs, 0, NULL_TREE); d = start_decl (d, declspecs, 0);
DECL_COMMON (d) = 1; DECL_COMMON (d) = 1;
cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0); cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
saved_pc = lookup_name (get_identifier ("__eh_pc"), 0); saved_pc = lookup_name (get_identifier ("__eh_pc"), 0);
declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE); declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_type")); d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_type"));
d = start_decl (d, declspecs, 0, NULL_TREE); d = start_decl (d, declspecs, 0);
DECL_COMMON (d) = 1; DECL_COMMON (d) = 1;
cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0); cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
saved_throw_type = lookup_name (get_identifier ("__eh_type"), 0); saved_throw_type = lookup_name (get_identifier ("__eh_type"), 0);
declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE); declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_value")); d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_value"));
d = start_decl (d, declspecs, 0, NULL_TREE); d = start_decl (d, declspecs, 0);
DECL_COMMON (d) = 1; DECL_COMMON (d) = 1;
cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0); cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
saved_throw_value = lookup_name (get_identifier ("__eh_value"), 0); saved_throw_value = lookup_name (get_identifier ("__eh_value"), 0);
declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE); declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_cleanup")); d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_cleanup"));
d = build_parse_node (CALL_EXPR, d, void_list_node, NULL_TREE); d = make_call_declarator (d, void_list_node, NULL_TREE, NULL_TREE);
d = start_decl (d, declspecs, 0, NULL_TREE); d = start_decl (d, declspecs, 0);
DECL_COMMON (d) = 1; DECL_COMMON (d) = 1;
cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0); cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
saved_cleanup = lookup_name (get_identifier ("__eh_cleanup"), 0); saved_cleanup = lookup_name (get_identifier ("__eh_cleanup"), 0);
declspecs = tree_cons (NULL_TREE, get_identifier ("bool"), NULL_TREE); declspecs = tree_cons (NULL_TREE, get_identifier ("bool"), NULL_TREE);
d = get_identifier ("__eh_in_catch"); d = get_identifier ("__eh_in_catch");
d = start_decl (d, declspecs, 0, NULL_TREE); d = start_decl (d, declspecs, 0);
DECL_COMMON (d) = 1; DECL_COMMON (d) = 1;
cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0); cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
saved_in_catch = lookup_name (get_identifier ("__eh_in_catch"), 0); saved_in_catch = lookup_name (get_identifier ("__eh_in_catch"), 0);
...@@ -429,6 +429,7 @@ expand_start_catch_block (declspecs, declarator) ...@@ -429,6 +429,7 @@ expand_start_catch_block (declspecs, declarator)
return; return;
/* Create a binding level for the parm. */ /* Create a binding level for the parm. */
pushlevel (0);
expand_start_bindings (0); expand_start_bindings (0);
false_label_rtx = gen_label_rtx (); false_label_rtx = gen_label_rtx ();
...@@ -440,8 +441,7 @@ expand_start_catch_block (declspecs, declarator) ...@@ -440,8 +441,7 @@ expand_start_catch_block (declspecs, declarator)
rtx call_rtx, return_value_rtx; rtx call_rtx, return_value_rtx;
tree init_type; tree init_type;
decl = grokdeclarator (declarator, declspecs, CATCHPARM, 1, decl = grokdeclarator (declarator, declspecs, CATCHPARM, 1, NULL_TREE);
NULL_TREE, NULL_TREE);
if (decl == NULL_TREE) if (decl == NULL_TREE)
{ {
...@@ -545,8 +545,8 @@ void expand_end_catch_block () ...@@ -545,8 +545,8 @@ void expand_end_catch_block ()
expand_leftover_cleanups (); expand_leftover_cleanups ();
/* Cleanup the EH parameter. */ /* Cleanup the EH parameter. */
decls = getdecls (); expand_end_bindings (getdecls (), kept_level_p (), 0);
expand_end_bindings (decls, decls != NULL_TREE, 0); poplevel (kept_level_p (), 1, 0);
/* label we emit to jump to if this catch block didn't match. */ /* label we emit to jump to if this catch block didn't match. */
/* This the closing } in the `if (eq) {' of the documentation. */ /* This the closing } in the `if (eq) {' of the documentation. */
...@@ -671,10 +671,11 @@ expand_builtin_throw () ...@@ -671,10 +671,11 @@ expand_builtin_throw ()
return; return;
params = void_list_node; params = void_list_node;
t = build_parse_node (CALL_EXPR, get_identifier ("__throw"), params, NULL_TREE); t = make_call_declarator (get_identifier ("__throw"), params, NULL_TREE,
NULL_TREE);
start_function (decl_tree_cons (NULL_TREE, get_identifier ("static"), start_function (decl_tree_cons (NULL_TREE, get_identifier ("static"),
void_list_node), void_list_node),
t, NULL_TREE, NULL_TREE, 0); t, NULL_TREE, 0);
store_parm_decls (); store_parm_decls ();
pushlevel (0); pushlevel (0);
clear_last_expr (); clear_last_expr ();
...@@ -868,7 +869,7 @@ void ...@@ -868,7 +869,7 @@ void
expand_exception_blocks () expand_exception_blocks ()
{ {
rtx funcend; rtx funcend;
rtx insns; rtx insn, insns;
rtx eh_spec_insns = NULL_RTX; rtx eh_spec_insns = NULL_RTX;
start_sequence (); start_sequence ();
...@@ -957,7 +958,14 @@ expand_exception_blocks () ...@@ -957,7 +958,14 @@ expand_exception_blocks ()
store_after_parms (eh_spec_insns); store_after_parms (eh_spec_insns);
#endif #endif
emit_insns (insns); insn = get_last_insn ();
while (GET_CODE (insn) == NOTE
|| (GET_CODE (insn) == INSN
&& (GET_CODE (PATTERN (insn)) == USE
|| GET_CODE (PATTERN (insn)) == CLOBBER)))
insn = PREV_INSN (insn);
emit_insns_after (insns, insn);
} }
tree tree
...@@ -980,10 +988,11 @@ start_anon_func () ...@@ -980,10 +988,11 @@ start_anon_func ()
params = void_list_node; params = void_list_node;
/* tcf stands for throw clean funciton. */ /* tcf stands for throw clean funciton. */
sprintf (name, "__tcf_%d", counter++); sprintf (name, "__tcf_%d", counter++);
t = build_parse_node (CALL_EXPR, get_identifier (name), params, NULL_TREE); t = make_call_declarator (get_identifier (name), params, NULL_TREE,
NULL_TREE);
start_function (decl_tree_cons (NULL_TREE, get_identifier ("static"), start_function (decl_tree_cons (NULL_TREE, get_identifier ("static"),
void_list_node), void_list_node),
t, NULL_TREE, NULL_TREE, 0); t, NULL_TREE, 0);
store_parm_decls (); store_parm_decls ();
pushlevel (0); pushlevel (0);
clear_last_expr (); clear_last_expr ();
......
...@@ -9,8 +9,8 @@ __asm, GCC_ASM_KEYWORD, NORID ...@@ -9,8 +9,8 @@ __asm, GCC_ASM_KEYWORD, NORID
__asm__, GCC_ASM_KEYWORD, NORID __asm__, GCC_ASM_KEYWORD, NORID
__attribute, ATTRIBUTE, NORID __attribute, ATTRIBUTE, NORID
__attribute__, ATTRIBUTE, NORID __attribute__, ATTRIBUTE, NORID
__const, TYPE_QUAL, RID_CONST __const, CV_QUALIFIER, RID_CONST
__const__, TYPE_QUAL, RID_CONST __const__, CV_QUALIFIER, RID_CONST
__extension__, EXTENSION, NORID __extension__, EXTENSION, NORID
__inline, SCSPEC, RID_INLINE __inline, SCSPEC, RID_INLINE
__inline__, SCSPEC, RID_INLINE __inline__, SCSPEC, RID_INLINE
...@@ -22,8 +22,8 @@ __signed__, TYPESPEC, RID_SIGNED ...@@ -22,8 +22,8 @@ __signed__, TYPESPEC, RID_SIGNED
__sigof__, SIGOF, NORID /* Extension */, __sigof__, SIGOF, NORID /* Extension */,
__typeof, TYPEOF, NORID __typeof, TYPEOF, NORID
__typeof__, TYPEOF, NORID __typeof__, TYPEOF, NORID
__volatile, TYPE_QUAL, RID_VOLATILE __volatile, CV_QUALIFIER, RID_VOLATILE
__volatile__, TYPE_QUAL, RID_VOLATILE __volatile__, CV_QUALIFIER, RID_VOLATILE
__wchar_t, TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */, __wchar_t, TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */,
asm, ASM_KEYWORD, NORID, asm, ASM_KEYWORD, NORID,
and, ANDAND, NORID, and, ANDAND, NORID,
...@@ -38,7 +38,7 @@ catch, CATCH, NORID, ...@@ -38,7 +38,7 @@ catch, CATCH, NORID,
char, TYPESPEC, RID_CHAR, char, TYPESPEC, RID_CHAR,
class, AGGR, RID_CLASS, class, AGGR, RID_CLASS,
compl, '~', NORID, compl, '~', NORID,
const, TYPE_QUAL, RID_CONST, const, CV_QUALIFIER, RID_CONST,
const_cast, CONST_CAST, NORID, const_cast, CONST_CAST, NORID,
continue, CONTINUE, NORID, continue, CONTINUE, NORID,
default, DEFAULT, NORID, default, DEFAULT, NORID,
...@@ -97,7 +97,7 @@ unsigned, TYPESPEC, RID_UNSIGNED, ...@@ -97,7 +97,7 @@ unsigned, TYPESPEC, RID_UNSIGNED,
using, USING, NORID, using, USING, NORID,
virtual, SCSPEC, RID_VIRTUAL, virtual, SCSPEC, RID_VIRTUAL,
void, TYPESPEC, RID_VOID, void, TYPESPEC, RID_VOID,
volatile, TYPE_QUAL, RID_VOLATILE, volatile, CV_QUALIFIER, RID_VOLATILE,
while, WHILE, NORID, while, WHILE, NORID,
xor, '^', NORID, xor, '^', NORID,
xor_eq, ASSIGN, NORID, xor_eq, ASSIGN, NORID,
/* C code produced by gperf version 2.5 (GNU C++ version) */ /* C code produced by gperf version 2.5 (GNU C++ version) */
/* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,4,7,$ /yorick/splunge/jason/g++/small/devo/gcc/cp/gxx.gperf */ /* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,4,7,$ ../../../devo/gcc/cp/gxx.gperf */
/* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,4,$,7 gplus.gperf */ /* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,4,$,7 gplus.gperf */
struct resword { char *name; short token; enum rid rid;}; struct resword { char *name; short token; enum rid rid;};
...@@ -123,7 +123,7 @@ is_reserved_word (str, len) ...@@ -123,7 +123,7 @@ is_reserved_word (str, len)
{"mutable", SCSPEC, RID_MUTABLE,}, {"mutable", SCSPEC, RID_MUTABLE,},
{"short", TYPESPEC, RID_SHORT,}, {"short", TYPESPEC, RID_SHORT,},
{"signature", AGGR, RID_SIGNATURE /* Extension */,}, {"signature", AGGR, RID_SIGNATURE /* Extension */,},
{"const", TYPE_QUAL, RID_CONST,}, {"const", CV_QUALIFIER, RID_CONST,},
{"static", SCSPEC, RID_STATIC,}, {"static", SCSPEC, RID_STATIC,},
{"",}, {"",}, {"",}, {"",},
{"for", FOR, NORID,}, {"for", FOR, NORID,},
...@@ -149,11 +149,11 @@ is_reserved_word (str, len) ...@@ -149,11 +149,11 @@ is_reserved_word (str, len)
{"",}, {"",}, {"",}, {"",}, {"",}, {"",},
{"signed", TYPESPEC, RID_SIGNED,}, {"signed", TYPESPEC, RID_SIGNED,},
{"this", THIS, NORID,}, {"this", THIS, NORID,},
{"__const", TYPE_QUAL, RID_CONST}, {"__const", CV_QUALIFIER, RID_CONST},
{"__const__", TYPE_QUAL, RID_CONST}, {"__const__", CV_QUALIFIER, RID_CONST},
{"__volatile", TYPE_QUAL, RID_VOLATILE}, {"__volatile", CV_QUALIFIER, RID_VOLATILE},
{"__null", CONSTANT, RID_NULL}, {"__null", CONSTANT, RID_NULL},
{"__volatile__", TYPE_QUAL, RID_VOLATILE}, {"__volatile__", CV_QUALIFIER, RID_VOLATILE},
{"__typeof__", TYPEOF, NORID}, {"__typeof__", TYPEOF, NORID},
{"or_eq", ASSIGN, NORID,}, {"or_eq", ASSIGN, NORID,},
{"",}, {"",},
...@@ -178,7 +178,7 @@ is_reserved_word (str, len) ...@@ -178,7 +178,7 @@ is_reserved_word (str, len)
{"bitor", '|', NORID,}, {"bitor", '|', NORID,},
{"",}, {"",},
{"do", DO, NORID,}, {"do", DO, NORID,},
{"volatile", TYPE_QUAL, RID_VOLATILE,}, {"volatile", CV_QUALIFIER, RID_VOLATILE,},
{"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
{"if", IF, NORID,}, {"if", IF, NORID,},
{"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
......
...@@ -131,35 +131,35 @@ extern int *token_count; ...@@ -131,35 +131,35 @@ extern int *token_count;
/* Return something to represent absolute declarators containing a *. /* Return something to represent absolute declarators containing a *.
TARGET is the absolute declarator that the * contains. TARGET is the absolute declarator that the * contains.
TYPE_QUALS is a list of modifiers such as const or volatile CV_QUALIFIERS is a list of modifiers such as const or volatile
to apply to the pointer type, represented as identifiers. to apply to the pointer type, represented as identifiers.
We return an INDIRECT_REF whose "contents" are TARGET We return an INDIRECT_REF whose "contents" are TARGET
and whose type is the modifier list. */ and whose type is the modifier list. */
tree tree
make_pointer_declarator (type_quals, target) make_pointer_declarator (cv_qualifiers, target)
tree type_quals, target; tree cv_qualifiers, target;
{ {
if (target && TREE_CODE (target) == IDENTIFIER_NODE if (target && TREE_CODE (target) == IDENTIFIER_NODE
&& ANON_AGGRNAME_P (target)) && ANON_AGGRNAME_P (target))
error ("type name expected before `*'"); error ("type name expected before `*'");
target = build_parse_node (INDIRECT_REF, target); target = build_parse_node (INDIRECT_REF, target);
TREE_TYPE (target) = type_quals; TREE_TYPE (target) = cv_qualifiers;
return target; return target;
} }
/* Return something to represent absolute declarators containing a &. /* Return something to represent absolute declarators containing a &.
TARGET is the absolute declarator that the & contains. TARGET is the absolute declarator that the & contains.
TYPE_QUALS is a list of modifiers such as const or volatile CV_QUALIFIERS is a list of modifiers such as const or volatile
to apply to the reference type, represented as identifiers. to apply to the reference type, represented as identifiers.
We return an ADDR_EXPR whose "contents" are TARGET We return an ADDR_EXPR whose "contents" are TARGET
and whose type is the modifier list. */ and whose type is the modifier list. */
tree tree
make_reference_declarator (type_quals, target) make_reference_declarator (cv_qualifiers, target)
tree type_quals, target; tree cv_qualifiers, target;
{ {
if (target) if (target)
{ {
...@@ -177,9 +177,26 @@ make_reference_declarator (type_quals, target) ...@@ -177,9 +177,26 @@ make_reference_declarator (type_quals, target)
error ("type name expected before `&'"); error ("type name expected before `&'");
} }
target = build_parse_node (ADDR_EXPR, target); target = build_parse_node (ADDR_EXPR, target);
TREE_TYPE (target) = type_quals; TREE_TYPE (target) = cv_qualifiers;
return target; return target;
} }
tree
make_call_declarator (target, parms, cv_qualifiers, exception_specification)
tree target, parms, cv_qualifiers, exception_specification;
{
target = build_parse_node (CALL_EXPR, target, parms, cv_qualifiers);
TREE_TYPE (target) = exception_specification;
return target;
}
void
set_quals_and_spec (call_declarator, cv_qualifiers, exception_specification)
tree call_declarator, cv_qualifiers, exception_specification;
{
TREE_OPERAND (call_declarator, 2) = cv_qualifiers;
TREE_TYPE (call_declarator) = exception_specification;
}
/* Build names and nodes for overloaded operators. */ /* Build names and nodes for overloaded operators. */
...@@ -1681,12 +1698,11 @@ cons_up_default_function (type, full_name, kind) ...@@ -1681,12 +1698,11 @@ cons_up_default_function (type, full_name, kind)
TREE_PARMLIST (args) = 1; TREE_PARMLIST (args) = 1;
{ {
tree declarator = build_parse_node (CALL_EXPR, name, args, NULL_TREE); tree declarator = make_call_declarator (name, args, NULL_TREE, NULL_TREE);
if (retref) if (retref)
declarator = build_parse_node (ADDR_EXPR, declarator); declarator = build_parse_node (ADDR_EXPR, declarator);
fn = grokfield (declarator, declspecs, NULL_TREE, NULL_TREE, fn = grokfield (declarator, declspecs, NULL_TREE, NULL_TREE, NULL_TREE);
NULL_TREE, NULL_TREE);
} }
if (fn == void_type_node) if (fn == void_type_node)
...@@ -2444,20 +2460,6 @@ readescape (ignore_ptr) ...@@ -2444,20 +2460,6 @@ readescape (ignore_ptr)
Value is 0 if we treat this name in a default fashion. */ Value is 0 if we treat this name in a default fashion. */
int looking_for_typename = 0; int looking_for_typename = 0;
#if 0
/* NO LONGER USED: Value is -1 if we must not see a type name. */
void
dont_see_typename ()
{
looking_for_typename = -1;
if (yychar == TYPENAME || yychar == PTYPENAME)
{
yychar = IDENTIFIER;
lastiddecl = 0;
}
}
#endif
#ifdef __GNUC__ #ifdef __GNUC__
extern __inline int identifier_type (); extern __inline int identifier_type ();
__inline __inline
...@@ -4363,11 +4365,6 @@ handle_cp_pragma (pname) ...@@ -4363,11 +4365,6 @@ handle_cp_pragma (pname)
main_filename = TREE_STRING_POINTER (yylval.ttype); main_filename = TREE_STRING_POINTER (yylval.ttype);
} }
#ifdef SUPPORTS_ONE_ONLY
if (SUPPORTS_ONE_ONLY > 1)
return 1;
#endif
while (token != END_OF_LINE) while (token != END_OF_LINE)
{ {
if (!warned_already && extra_warnings) if (!warned_already && extra_warnings)
...@@ -4378,6 +4375,7 @@ handle_cp_pragma (pname) ...@@ -4378,6 +4375,7 @@ handle_cp_pragma (pname)
token = real_yylex (); token = real_yylex ();
} }
#ifndef NO_LINKAGE_HEURISTICS
write_virtuals = 3; write_virtuals = 3;
if (impl_file_chain == 0) if (impl_file_chain == 0)
...@@ -4404,6 +4402,7 @@ handle_cp_pragma (pname) ...@@ -4404,6 +4402,7 @@ handle_cp_pragma (pname)
interface_unknown = 0; interface_unknown = 0;
TREE_INT_CST_LOW (fileinfo) = interface_only; TREE_INT_CST_LOW (fileinfo) = interface_only;
TREE_INT_CST_HIGH (fileinfo) = interface_unknown; TREE_INT_CST_HIGH (fileinfo) = interface_unknown;
#endif /* NO_LINKAGE_HEURISTICS */
return 1; return 1;
} }
...@@ -4436,11 +4435,7 @@ handle_cp_pragma (pname) ...@@ -4436,11 +4435,7 @@ handle_cp_pragma (pname)
token = real_yylex (); token = real_yylex ();
} }
#ifdef SUPPORTS_ONE_ONLY #ifndef NO_LINKAGE_HEURISTICS
if (SUPPORTS_ONE_ONLY > 1)
return 1;
#endif
if (write_virtuals == 3) if (write_virtuals == 3)
{ {
struct impl_files *ifiles = impl_file_chain; struct impl_files *ifiles = impl_file_chain;
...@@ -4485,6 +4480,8 @@ handle_cp_pragma (pname) ...@@ -4485,6 +4480,8 @@ handle_cp_pragma (pname)
#endif #endif
TREE_INT_CST_LOW (fileinfo) = interface_only; TREE_INT_CST_LOW (fileinfo) = interface_only;
TREE_INT_CST_HIGH (fileinfo) = interface_unknown; TREE_INT_CST_HIGH (fileinfo) = interface_unknown;
#endif /* NO_LINKAGE_HEURISTICS */
return 1; return 1;
} }
......
...@@ -39,10 +39,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -39,10 +39,6 @@ Boston, MA 02111-1307, USA. */
#include "hard-reg-set.h" #include "hard-reg-set.h"
#include "flags.h" #include "flags.h"
#ifndef SUPPORTS_ONE_ONLY
#define SUPPORTS_ONE_ONLY 0
#endif
/* TREE_LIST of the current inline functions that need to be /* TREE_LIST of the current inline functions that need to be
processed. */ processed. */
struct pending_inline *pending_inlines; struct pending_inline *pending_inlines;
...@@ -2179,7 +2175,7 @@ synthesize_method (fndecl) ...@@ -2179,7 +2175,7 @@ synthesize_method (fndecl)
push_cp_function_context (context); push_cp_function_context (context);
interface_unknown = 1; interface_unknown = 1;
start_function (NULL_TREE, fndecl, NULL_TREE, NULL_TREE, 1); start_function (NULL_TREE, fndecl, NULL_TREE, 1);
store_parm_decls (); store_parm_decls ();
if (DECL_NAME (fndecl) == ansi_opname[MODIFY_EXPR]) if (DECL_NAME (fndecl) == ansi_opname[MODIFY_EXPR])
......
...@@ -118,7 +118,7 @@ process_template_parm (list, next) ...@@ -118,7 +118,7 @@ process_template_parm (list, next)
my_friendly_assert (TREE_CODE (TREE_PURPOSE (parm)) == TREE_LIST, 260); my_friendly_assert (TREE_CODE (TREE_PURPOSE (parm)) == TREE_LIST, 260);
/* is a const-param */ /* is a const-param */
parm = grokdeclarator (TREE_VALUE (parm), TREE_PURPOSE (parm), parm = grokdeclarator (TREE_VALUE (parm), TREE_PURPOSE (parm),
PARM, 0, NULL_TREE, NULL_TREE); PARM, 0, NULL_TREE);
/* A template parameter is not modifiable. */ /* A template parameter is not modifiable. */
TREE_READONLY (parm) = 1; TREE_READONLY (parm) = 1;
if (IS_AGGR_TYPE (TREE_TYPE (parm)) if (IS_AGGR_TYPE (TREE_TYPE (parm))
...@@ -1761,7 +1761,8 @@ tsubst (t, args, nargs, in_decl) ...@@ -1761,7 +1761,8 @@ tsubst (t, args, nargs, in_decl)
{ {
tree values = TYPE_ARG_TYPES (t); tree values = TYPE_ARG_TYPES (t);
tree context = TYPE_CONTEXT (t); tree context = TYPE_CONTEXT (t);
tree new_value; tree raises = TYPE_RAISES_EXCEPTIONS (t);
tree fntype;
/* Don't bother recursing if we know it won't change anything. */ /* Don't bother recursing if we know it won't change anything. */
if (values != void_list_node) if (values != void_list_node)
...@@ -1777,7 +1778,7 @@ tsubst (t, args, nargs, in_decl) ...@@ -1777,7 +1778,7 @@ tsubst (t, args, nargs, in_decl)
tree value tree value
= tsubst (TREE_VALUE (values), args, nargs, in_decl); = tsubst (TREE_VALUE (values), args, nargs, in_decl);
tree purpose = tsubst_expr (TREE_PURPOSE (values), tree purpose = tsubst_expr (TREE_PURPOSE (values),
args, nargs, in_decl); args, nargs, in_decl);
tree x = build_tree_list (purpose, value); tree x = build_tree_list (purpose, value);
if (first) if (first)
...@@ -1807,34 +1808,39 @@ tsubst (t, args, nargs, in_decl) ...@@ -1807,34 +1808,39 @@ tsubst (t, args, nargs, in_decl)
if (TREE_CODE (t) == FUNCTION_TYPE if (TREE_CODE (t) == FUNCTION_TYPE
&& context == NULL_TREE) && context == NULL_TREE)
{ {
new_value = build_function_type (type, values); fntype = build_function_type (type, values);
} }
else if (context == NULL_TREE) else if (context == NULL_TREE)
{ {
tree base = tsubst (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))), tree base = tsubst (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))),
args, nargs, in_decl); args, nargs, in_decl);
new_value = build_cplus_method_type (base, type, fntype = build_cplus_method_type (base, type,
TREE_CHAIN (values)); TREE_CHAIN (values));
} }
else else
{ {
new_value = make_node (TREE_CODE (t)); fntype = make_node (TREE_CODE (t));
TREE_TYPE (new_value) = type; TREE_TYPE (fntype) = type;
TYPE_CONTEXT (new_value) = context; TYPE_CONTEXT (fntype) = context;
TYPE_VALUES (new_value) = values; TYPE_VALUES (fntype) = values;
TYPE_SIZE (new_value) = TYPE_SIZE (t); TYPE_SIZE (fntype) = TYPE_SIZE (t);
TYPE_ALIGN (new_value) = TYPE_ALIGN (t); TYPE_ALIGN (fntype) = TYPE_ALIGN (t);
TYPE_MODE (new_value) = TYPE_MODE (t); TYPE_MODE (fntype) = TYPE_MODE (t);
if (TYPE_METHOD_BASETYPE (t)) if (TYPE_METHOD_BASETYPE (t))
TYPE_METHOD_BASETYPE (new_value) = tsubst (TYPE_METHOD_BASETYPE (t), TYPE_METHOD_BASETYPE (fntype) = tsubst (TYPE_METHOD_BASETYPE (t),
args, nargs, in_decl); args, nargs, in_decl);
/* Need to generate hash value. */ /* Need to generate hash value. */
my_friendly_abort (84); my_friendly_abort (84);
} }
new_value = build_type_variant (new_value, fntype = build_type_variant (fntype,
TYPE_READONLY (t), TYPE_READONLY (t),
TYPE_VOLATILE (t)); TYPE_VOLATILE (t));
return new_value; if (raises)
{
raises = tsubst (raises, args, nargs, in_decl);
fntype = build_exception_variant (fntype, raises);
}
return fntype;
} }
case ARRAY_TYPE: case ARRAY_TYPE:
{ {
...@@ -1880,9 +1886,11 @@ tsubst (t, args, nargs, in_decl) ...@@ -1880,9 +1886,11 @@ tsubst (t, args, nargs, in_decl)
tsubst_expr (TREE_OPERAND (t, 1), args, nargs, in_decl)); tsubst_expr (TREE_OPERAND (t, 1), args, nargs, in_decl));
case CALL_EXPR: case CALL_EXPR:
return build_parse_node return make_call_declarator
(CALL_EXPR, tsubst (TREE_OPERAND (t, 0), args, nargs, in_decl), (tsubst (TREE_OPERAND (t, 0), args, nargs, in_decl),
tsubst (TREE_OPERAND (t, 1), args, nargs, in_decl), NULL_TREE); tsubst (TREE_OPERAND (t, 1), args, nargs, in_decl),
TREE_OPERAND (t, 2),
tsubst (TREE_TYPE (t), args, nargs, in_decl));
case SCOPE_REF: case SCOPE_REF:
return build_parse_node return build_parse_node
...@@ -2182,9 +2190,8 @@ tsubst_expr (t, args, nargs, in_decl) ...@@ -2182,9 +2190,8 @@ tsubst_expr (t, args, nargs, in_decl)
dcl = start_decl dcl = start_decl
(tsubst (TREE_OPERAND (t, 0), args, nargs, in_decl), (tsubst (TREE_OPERAND (t, 0), args, nargs, in_decl),
tsubst (TREE_OPERAND (t, 1), args, nargs, in_decl), tsubst (TREE_OPERAND (t, 1), args, nargs, in_decl),
TREE_OPERAND (t, 3) != 0, TREE_OPERAND (t, 2) != 0);
tsubst (TREE_OPERAND (t, 2), args, nargs, in_decl)); init = tsubst_expr (TREE_OPERAND (t, 2), args, nargs, in_decl);
init = tsubst_expr (TREE_OPERAND (t, 3), args, nargs, in_decl);
cp_finish_decl cp_finish_decl
(dcl, init, NULL_TREE, 1, /*init ? LOOKUP_ONLYCONVERTING :*/ 0); (dcl, init, NULL_TREE, 1, /*init ? LOOKUP_ONLYCONVERTING :*/ 0);
resume_momentary (i); resume_momentary (i);
...@@ -3057,8 +3064,7 @@ void ...@@ -3057,8 +3064,7 @@ void
do_function_instantiation (declspecs, declarator, storage) do_function_instantiation (declspecs, declarator, storage)
tree declspecs, declarator, storage; tree declspecs, declarator, storage;
{ {
tree decl = grokdeclarator (declarator, declspecs, NORMAL, 0, tree decl = grokdeclarator (declarator, declspecs, NORMAL, 0, NULL_TREE);
NULL_TREE, NULL_TREE);
tree name; tree name;
tree fn; tree fn;
tree result = NULL_TREE; tree result = NULL_TREE;
...@@ -3354,7 +3360,7 @@ instantiate_decl (d) ...@@ -3354,7 +3360,7 @@ instantiate_decl (d)
lineno = DECL_SOURCE_LINE (d); lineno = DECL_SOURCE_LINE (d);
input_filename = DECL_SOURCE_FILE (d); input_filename = DECL_SOURCE_FILE (d);
start_function (NULL_TREE, d, NULL_TREE, NULL_TREE, 1); start_function (NULL_TREE, d, NULL_TREE, 1);
store_parm_decls (); store_parm_decls ();
if (t && TREE_CODE (t) == RETURN_INIT) if (t && TREE_CODE (t) == RETURN_INIT)
......
...@@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA. */
#include "cp-tree.h" #include "cp-tree.h"
#include "flags.h" #include "flags.h"
#include "output.h" #include "output.h"
#include "assert.h"
#undef NULL #undef NULL
#define NULL 0 #define NULL 0
...@@ -348,7 +349,7 @@ build_dynamic_cast (type, expr) ...@@ -348,7 +349,7 @@ build_dynamic_cast (type, expr)
{ {
enum tree_code tc = TREE_CODE (type); enum tree_code tc = TREE_CODE (type);
tree exprtype = TREE_TYPE (expr); tree exprtype = TREE_TYPE (expr);
enum tree_code ec = TREE_CODE (exprtype); enum tree_code ec;
tree dcast_fn; tree dcast_fn;
if (type == error_mark_node || expr == error_mark_node) if (type == error_mark_node || expr == error_mark_node)
...@@ -360,6 +361,9 @@ build_dynamic_cast (type, expr) ...@@ -360,6 +361,9 @@ build_dynamic_cast (type, expr)
return t; return t;
} }
assert (exprtype != NULL_TREE);
ec = TREE_CODE (exprtype);
switch (tc) switch (tc)
{ {
case POINTER_TYPE: case POINTER_TYPE:
...@@ -977,7 +981,7 @@ synthesize_tinfo_fn (fndecl) ...@@ -977,7 +981,7 @@ synthesize_tinfo_fn (fndecl)
DECL_ALIGN (tdecl) = TYPE_ALIGN (ptr_type_node); DECL_ALIGN (tdecl) = TYPE_ALIGN (ptr_type_node);
cp_finish_decl (tdecl, NULL_TREE, NULL_TREE, 0, 0); cp_finish_decl (tdecl, NULL_TREE, NULL_TREE, 0, 0);
start_function (NULL_TREE, fndecl, NULL_TREE, NULL_TREE, 1); start_function (NULL_TREE, fndecl, NULL_TREE, 1);
store_parm_decls (); store_parm_decls ();
clear_last_expr (); clear_last_expr ();
push_momentary (); push_momentary ();
......
...@@ -919,17 +919,19 @@ save_this (instance) ...@@ -919,17 +919,19 @@ save_this (instance)
/* Build a signature member function call. Looks up the signature table /* Build a signature member function call. Looks up the signature table
entry corresponding to FUNCTION. Depending on the value of the CODE entry corresponding to FUNCTION. Depending on the value of the CODE
field, either call the function in PFN directly, or use OFFSET to field, either call the function in PFN directly, or use OFFSET to
index INSTANCE's virtual function table. */ index the object's virtual function table. */
tree tree
build_signature_method_call (basetype, instance, function, parms) build_signature_method_call (function, parms)
tree basetype, instance, function, parms; tree function, parms;
{ {
tree instance = TREE_VALUE (parms);
tree saved_instance = save_this (instance); /* Create temp for `this'. */ tree saved_instance = save_this (instance); /* Create temp for `this'. */
tree object_ptr = build_optr_ref (saved_instance); tree object_ptr = build_optr_ref (saved_instance);
tree new_object_ptr, new_parms; tree new_object_ptr, new_parms;
tree signature_tbl_ptr = build_sptr_ref (saved_instance); tree signature_tbl_ptr = build_sptr_ref (saved_instance);
tree sig_field_name = DECL_NAME (DECL_MEMFUNC_POINTER_TO (function)); tree sig_field_name = DECL_NAME (DECL_MEMFUNC_POINTER_TO (function));
tree basetype = DECL_CONTEXT (function);
tree basetype_path = TYPE_BINFO (basetype); tree basetype_path = TYPE_BINFO (basetype);
tree tbl_entry = build_component_ref (build1 (INDIRECT_REF, basetype, tree tbl_entry = build_component_ref (build1 (INDIRECT_REF, basetype,
signature_tbl_ptr), signature_tbl_ptr),
......
...@@ -215,6 +215,9 @@ build_cplus_new (type, init) ...@@ -215,6 +215,9 @@ build_cplus_new (type, init)
tree slot; tree slot;
tree rval; tree rval;
if (TREE_CODE (init) == TARGET_EXPR || init == error_mark_node)
return init;
slot = build (VAR_DECL, type); slot = build (VAR_DECL, type);
layout_decl (slot, 0); layout_decl (slot, 0);
rval = build (NEW_EXPR, type, rval = build (NEW_EXPR, type,
......
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