summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gcc/cp')
-rw-r--r--contrib/gcc/cp/ChangeLog24138
-rw-r--r--contrib/gcc/cp/ChangeLog.19451
-rw-r--r--contrib/gcc/cp/ChangeLog.220675
-rw-r--r--contrib/gcc/cp/ChangeLog.egcs4
-rw-r--r--contrib/gcc/cp/Make-lang.in299
-rw-r--r--contrib/gcc/cp/NEWS90
-rw-r--r--contrib/gcc/cp/call.c3110
-rw-r--r--contrib/gcc/cp/cfns.gperf229
-rw-r--r--contrib/gcc/cp/class.c9024
-rw-r--r--contrib/gcc/cp/config-lang.in12
-rw-r--r--contrib/gcc/cp/cp-lang.c110
-rw-r--r--contrib/gcc/cp/cp-tree.def121
-rw-r--r--contrib/gcc/cp/cp-tree.h4986
-rw-r--r--contrib/gcc/cp/cvt.c666
-rw-r--r--contrib/gcc/cp/decl.c12301
-rw-r--r--contrib/gcc/cp/decl.h10
-rw-r--r--contrib/gcc/cp/decl2.c3233
-rw-r--r--contrib/gcc/cp/dump.c440
-rw-r--r--contrib/gcc/cp/error.c2671
-rw-r--r--contrib/gcc/cp/except.c1566
-rw-r--r--contrib/gcc/cp/expr.c367
-rw-r--r--contrib/gcc/cp/friend.c219
-rw-r--r--contrib/gcc/cp/g++.1643
-rw-r--r--contrib/gcc/cp/g++spec.c59
-rw-r--r--contrib/gcc/cp/init.c3146
-rw-r--r--contrib/gcc/cp/lang-options.h151
-rw-r--r--contrib/gcc/cp/lang-specs.h115
-rw-r--r--contrib/gcc/cp/lex.c4949
-rw-r--r--contrib/gcc/cp/lex.h94
-rw-r--r--contrib/gcc/cp/mangle.c2482
-rw-r--r--contrib/gcc/cp/method.c2808
-rw-r--r--contrib/gcc/cp/operators.def157
-rw-r--r--contrib/gcc/cp/optimize.c303
-rw-r--r--contrib/gcc/cp/parse.y2041
-rw-r--r--contrib/gcc/cp/pt.c4894
-rw-r--r--contrib/gcc/cp/ptree.c78
-rw-r--r--contrib/gcc/cp/repo.c73
-rw-r--r--contrib/gcc/cp/rtti.c1886
-rw-r--r--contrib/gcc/cp/search.c2781
-rw-r--r--contrib/gcc/cp/semantics.c2183
-rw-r--r--contrib/gcc/cp/spew.c1537
-rw-r--r--contrib/gcc/cp/tree.c2777
-rw-r--r--contrib/gcc/cp/typeck.c4393
-rw-r--r--contrib/gcc/cp/typeck2.c894
-rw-r--r--contrib/gcc/cp/xref.c78
45 files changed, 80342 insertions, 51902 deletions
diff --git a/contrib/gcc/cp/ChangeLog b/contrib/gcc/cp/ChangeLog
index be101ba..63c8747 100644
--- a/contrib/gcc/cp/ChangeLog
+++ b/contrib/gcc/cp/ChangeLog
@@ -1,16227 +1,11699 @@
-Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com)
+2002-02-01 Jason Merrill <jason@redhat.com>
- * gcc-2.95.3 Released.
+ * error.c (dump_scope): Don't add TFF_DECL_SPECIFIERS.
+ (dump_function_decl): Always dump parms.
-Fri Jun 9 17:55:08 2000 Jeffrey A Law (law@cygnus.com)
+ * decl2.c (finish_static_data_member_decl): Complain about a local
+ class with a static data member.
- 2000-02-07 <loewis@informatik.hu-berlin.de>
- * decl2.c (import_export_decl): vlist ctor wrappers follow virtual
- methods in their interface.
- (vlist_ctor_wrapper_p): new function.
- (finish_vlist_ctor_wrapper): likewise.
+ PR c++/4286
+ * search.c (lookup_field_1): Don't xref a static data member
+ just because we looked it up.
- 2000-02-06 <loewis@informatik.hu-berlin.de>
- * decl2.c (maybe_retrofit_in_chrg): Move call to
- make_vlist_ctor_wrapper from here ...
- * decl.c (grok_ctor_properties): ... to here.
- * decl.c (grokfndecl): ... and here.
- * init.c (no_vlist_base_init): Declare unseen Vlist ctor weak.
- * decl2.c (maybe_retrofit_in_chrg): Be sorry about varargs ctors.
+2002-01-31 Jason Merrill <jason@redhat.com>
-2000-03-08 Nathan Sidwell <nathan@codesourcery.com>
-
- * exception.cc (__cp_pop_exception): Cleanup the original object.
-
-1999-11-13 Jason Merrill <jason@yorick.cygnus.com>
-
- * rtti.c (get_tinfo_fn_unused): Split out from get_tinfo_fn.
- * class.c (set_rtti_entry): Use it.
-
-Wed Apr 12 00:45:49 2000 Jeffrey A Law (law@cygnus.com)
-
- 2000-02-03 <loewis@informatik.hu-berlin.de>
- * call.c (add_function_candidate): Do not add vlist ctor into
- candidates in compatibility mode.
- (build_user_type_conversion_1): Add LOOKUP_HAS_VLIST when adding
- vlist.
- (convert_like): Likewise.
- (build_over_call): Skip vlist only if it is mentioned in flags.
- (build_new_method_call): Do not add vlist in compatibility mode,
- except for dtors.
- * cp-tree.h (flag_vtable_thunks): Has now four possible values.
- (DECL_VLIST_CTOR_WRAPPER_P, DECL_VLIST_CTOR_WRAPPED): New macros.
- (in_charge_identifier): Declare external.
- * decl.c (xref_basetypes): Check for vtable_thunks >=2.
- (finish_dtor): Use bit 2 of in_chrg.
- (finish_function): Do not finish vlist ctor wrappers.
- * decl2.c (flag_vtable_thunks_compat): New variable.
- (lang_decode_option): Set it accordingly.
- (maybe_retrofit_in_chrg): Call make_vlist_ctor_wrapper.
- * init.c (build_base_dtor_call): Pass 4 in in_chrg.
- (no_vlist_base_init): New function.
- (expand_default_init): Do not pass vlist in compatibility mode.
- Try to call old base ctor if new one was not generated.
- (build_new_1): Do not pass vlist in compatibility mode.
- * method.c (get_id_2): Do not put _Vlist into dtor name in
- compatibility mode.
- (make_vlist_ctor_wrapper, emit_vlist_ctor_wrapper): New functions.
- (synthesize_method): Call emit_vlist_ctor_wrapper.
- * pt.c (instantiate_class_template): Check for vtable_thunks >=2.
-
- Sat Nov 13 15:48:59 1999 H.J. Lu <hjl@gnu.org>
- * init.c (finish_dtor): Call mark_all_temps_used () before
- declaring vlist.
-
- Tue Nov 9 15:01:57 1999 H.J. Lu <hjl@gnu.org>
- * init.c (construct_virtual_bases): Update.
- (expand_cleanup_for_base): Update.
-
- Tue Nov 9 08:25:04 1999 H.J. Lu <hjl@gnu.org>
- * init.c (construct_virtual_bases): Update.
- (expand_cleanup_for_base): Take vlist parameter.
- (emit_base_init): Pass vlist to expand_cleanup_for_base.
- (construct_virtual_bases): Likewise.
-
- 1999-05-02 Martin von Löwis <loewis@informatik.hu-berlin.de>
- * class.c (prepare_ctor_vtable, finish_one_ctor_vtable,
- prepend_ctor_vfields_for_vbase, finish_ctor_vtables_for_vbases,
- finish_ctor_vtables_1, prepend_vbase_vfields,
- finish_ctor_vtables): New functions.
- (finish_struct_1): Call finish_ctor_vtables.
- * cp-tree.h (TYPE_USES_PVBASES): New macro.
- (constructor_for_vbase_attr): Widen to two bits.
- (CONSTRUCTOR_FOR_VBASE, CONSTRUCTOR_FOR_PVBASE,
- DESTRUCTOR_FOR_PVBASE): New macros.
- (DECL_CONSTRUCTOR_FOR_VBASE_P): Adopt to new enumeration.
- (DECL_CONSTRUCTOR_FOR_VBASE): New macro.
- (DECL_CONSTRUCTOR_FOR_PVBASE_P, DECL_DESTRUCTOR_FOR_PVBASE_P): New
- macros.
- (vlist_identifier, vlist_type_node, vlist_zero_node): Declare.
- (VCTABLE_NAME, VLIST_NAME_FORMAT, VLIST_NAME, VLIST1_NAME,
- VLIST_TYPE_NAME): New macros.
- (LOOKUP_HAS_VLIST): New macro.
- (build_base_dtor_call, init_vlist): Declare.
- (build_destructor_name): Add int argument.
- * decl.c (vlist_identifier, vlist_type_node, vlist_zero_node):
- Define.
- (init_decl_processing): Initialize them.
- (grokdeclarator): Handle vlist argument.
- (copy_args_p): Likewise.
- (grok_ctor_properties): Don't try to skip initial int for
- templates. Skip vlist if available.
- (xref_basetypes): Set TYPE_USES_PVBASES.
- (finish_dtor, finish_ctor): New functions, moved out of ...
- (finish_function): ... here.
- * decl2.c (lang_decode_option): Set flag_vtable_thunks explicitly.
- (maybe_retrofit_in_chrg): Retrofit __vlist parameter.
- (grokclassfn): Pass pvbase flag into mangled name.
- * init.c (build_base_dtor_call): New function.
- (build_partial_cleanup_for): Call it.
- (pvbasecount, init_vlist, ): New functions.
- (emit_base_init): Process vlist argument.
- (expand_aggr_vbase_init_1): Likewise.
- (expand_aggr_vbase_init): Likewise.
- (expand_default_init): Likewise.
- (build_new_1): Pass null vlist argument.
- (build_delete): Likewise. Call build_base_dtor_call.
- * method.c (process_overload_item): Mangle _Vlist specially.
- (build_base_path, get_vlist_vtable_id): New functions.
- (build_destructor_name): Potentially mangle _Vlist into it.
- (do_build_copy_constructor): Skip vlist argument.
- (synthesize_method): Likewise.
- * pt.c (has_pvbases_p): New function.
- (instantiate_class_template): Call it.
- (tsubst_decl): Retrofit before mangling. Pass pvbase_p to
- destructor mangling.
- * search.c (expand_direct_vtbls_init_thunks): New function.
- (expand_indirect_vtbls_init_thunks): New function.
- (expand_indirect_vtbls_init): Call it.
- * call.c (add_function_candidate): Process vlist argument.
- (build_user_type_conversion_1): Add vlist argument.
- (convert_like): Likewise.
- (build_over_call): Likewise.
- (build_new_method_call): Likewise.
-
-2000-02-18 Martin von Loewis <loewis@informatik.hu-berlin.de>
-
- * typeck2.c (my_friendly_abort): Use GCCBUGURL.
-
-1999-11-01 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (maybe_make_one_only): Always make things comdat on
- ELF targets, too.
-
-Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95.2 Released.
-
-1999-09-06 Mark Mitchell <mark@codesourcery.com>
-
- * pt.c (tsubst): Back out 1999-08-06 patch. Use fold and
- decl_constant_value to simplify array bounds.
-
-1999-08-19 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h: Declare flag_use_repository.
- * pt.c (do_decl_instantiation): Don't complain about duplicate
- instantiation with -frepo.
- (do_type_instantiation): Likewise.
-
-1999-08-14 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (lookup_arg_dependent): Note that we've already checked
- the current namespace.
-
-Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95.1 Released.
-
-1999-08-12 Mark Mitchell <mark@codesourcery.com>
-
- * decl2.c (lang_decode_option): Deprecate signatures.
-
-1999-08-11 Martin v. Loewis <martin@mira.isdn.cs.tu-berlin.de>
-
- * lex.c (do_identifier): If we find a hidden type after a global
- was selected already, continue using the global.
-
-1999-08-10 Martin v. Loewis <martin@mira.isdn.cs.tu-berlin.de>
-
- * decl2.c (set_decl_namespace): Do not complain about non-matching
- decls if processing a template.
-
-1999-08-09 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (function_try_block): Call end_protect_partials
- before expand_start_all_catch.
-
-1999-08-06 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (maybe_get_template_decl_from_type_decl): Make sure that
- we're looking at a class.
-
- * decl.c (lookup_name_real): Set the complain flag if we're
- looking for a namespace member.
-
- * decl.c (pushdecl): Only give an error for shadowing a parm
- from *this* function.
-
- * decl2.c (build_expr_from_tree, case METHOD_CALL_EXPR): Only
- build_expr_from_tree on the args of a TEMPLATE_ID_EXPR.
-
- * class.c (mark_overriders): Fix order of args to overrides.
- (warn_hidden): Likewise. Fix for having virtual and non-virtual
- functions with the same name.
-
- * cp-tree.h (DECL_VIRTUAL_CONTEXT): New macro.
- * typeck.c (expand_ptrmemfunc_cst): Calculate delta correctly for
- virtual functions and MI. Simplify.
-
- * typeck.c (c_expand_return): Downgrade pedwarn about returning NULL
- from op new to warning.
-
- * decl2.c (reparse_absdcl_as_casts): Don't warn about old-style
- casts in system headers or extern "C" blocks.
-
- * pt.c (do_decl_instantiation): Downgrade duplicate instantiation
- errors to pedwarn.
-
- * error.c (dump_type_real): Handle TREE_LIST again.
+ * Make-lang.in (parse.c): Handle .output file.
- * typeck.c (comp_target_parms): Don't complain about
- converting from () to (...) if !flag_strict_prototype.
+ PR c++/3395
+ * decl.c (xref_tag): Remember early attributes in TYPE_ATTRIBUTES,
+ not TREE_TYPE.
+ * semantics.c (finish_class_definition): Adjust.
- * class.c (instantiate_type): Downgrade errors for object-dependent
- memfn refs to pedwarn.
-
-1999-08-06 Alexandre Oliva <oliva@dcc.unicamp.br>
-
- * pt.c (tsubst): Use build_index_type to build in-template array
- index type. Fixes g++.oliva/dwarf1.C.
- * decl.c (grokdeclarator): Likewise, just for consistency, as it
- doesn't seem to trigger the bug without it.
-
-Thu Aug 5 02:40:42 1999 Jeffrey A Law (law@cygnus.com)
-
- * typeck2.c: Update URLs and mail addresses.
-
-1999-08-03 Mumit Khan <khan@xraylith.wisc.edu>
-
- * decl.c (start_decl): Set attributes before duplicate_decls call.
-
-Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95 Released.
-
-Sun Jul 25 15:24:21 1999 Jeffrey A Law (law@cygnus.com)
-
- * g++FAQ.texi: Deleted per Joe Buck's request.
- * Makefile.in: Corresponding changes.
-
-Sat Jul 17 23:50:47 1999 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (INTERFACE): Bump to 2.
-
-1999-07-17 Alexandre Oliva <oliva@dcc.unicamp.br>
-
- * typeck2.c (my_friendly_abort): Updated URL with bug reporting
- instructions to gcc.gnu.org. Removed e-mail address.
-
-1999-07-15 Mark Mitchell <mark@codesourcery.com>
-
- * pt.c (check_default_tmpl_args): Handle friends defined in the
- class just like member functions defined in the class.
-
-Thu Jul 15 01:26:49 1999 H.J. Lu <hjl@gnu.org>
-
- * decl.c (duplicate_decls): Relax restriction for exception
- checks on duplicate symbols.
-
-1999-07-07 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokdeclarator): Update the names of all variants when
- de-anonymizing.
-
-Wed Jul 7 01:26:47 1999 Alexandre Oliva <oliva@dcc.unicamp.br>
-
- * decl2.c (mark_vtable_entries): Fix check for rtti offset.
-
-1999-06-26 Richard Henderson <rth@cygnus.com>
-
- * decl.c (cp_finish_decl): Fix typo in cp_warning_at call.
-
-1999-06-21 Mark Mitchell <mark@codesourcery.com>
-
- * init.c (expand_aggr_vbase_init): Rename to
- construct_virtual_bases. Conditionalize construction here,
- rather than ...
- (emit_base_init): Here.
-
-1999-06-19 Mark Mitchell <mark@codesourcery.com>
-
- * semantics.c (finish_asm_statement): Apply decay conversions to
- input operands.
-
- * decl.c (expand_static_init): When building an anonymous function
- for use with atexit, compute its body before and after entering
- the function.
-
-1999-06-18 Mark Mitchell <mark@codesourcery.com>
-
- * init.c (expand_aggr_vbase_init): Add flag parameter.
- (build_partial_cleanup_for): Remove, inlining into ..
- (expand_cleanup_for_base): ... here. Take flag parameter.
- (emit_base_init): Pass the in_chrg parameter to
- emit_aggr_vbase_init.
- (emit_aggr_vbase_init): Pass it to expand_cleanup_for_base.
-
-1999-06-16 Mark Mitchell <mark@codesourcery.com>
+ Allow attributes in parms and casts.
+ * parse.y (named_parm): Don't strip attrs.
+ (declmods): Remove 'attributes' production.
+ (nonempty_cv_qualifiers): Accept attributes.
+ (ATTRIBUTE): Give precedence.
+ * decl.c (groktypename): Handle attributes.
+ (grokparms): Likewise.
- * decl2.c (import_export_decl): Use same_type_p, rather than
- relying on pointer-equality for types.
+2002-01-29 Jakub Jelinek <jakub@redhat.com>
- * method.c (do_build_copy_constructor): Simplify.
+ * decl2.c (cxx_decode_option): Pass 0 as last argument to
+ cpp_handle_option.
+ * lang-specs.h: Use cpp_unique_options instead of cpp_options
+ when used together with cc1_options.
- * call.c (build_method_call): Remove bogus code for two-argument
- delete.
- * init.c (build_new_1): Expand on comment, and remove dead code.
+2002-01-29 Nathan Sidwell <nathan@codesourcery.com>
- * init.c (expand_cleanup_for_base): New function, split out
- from ...
- (emit_base_init): Here.
- (expand_aggr_vbase_init): Use it.
+ PR c++/5132
+ * typeck2.c (digest_init): Make sure non-array core type is
+ instantiated.
+ * decl2.c (reparse_absdcl_as_casts): Just store the type in the
+ constructor, rather than build a new one.
+ (build_expr_from_tree, CONSTRUCTOR case): Be careful with the
+ PURPOSE of constructor elts.
+
+2002-01-23 Zack Weinberg <zack@codesourcery.com>
+
+ * Make-lang.in (parse.c): Adjust expected number of
+ shift-reduce conflicts.
+ (decl.o): Depend on diagnostic.h.
+ * decl.c: Include diagnostic.h.
+ (grokdeclarator): Check for null pointer.
+ (finish_function): Don't abort when
+ current_binding_level->parm_flag != 1, if errors have
+ occurred; throw away the statement tree and extra binding
+ levels, and continue.
+ * lex.c (note_list_got_semicolon): Check for null pointer.
+ * method.c (hack_identifier): Just return error_mark_node if
+ value is error_mark_node.
+ * parse.y (primary: TYPEID(type_id)): No need to use
+ TYPE_MAIN_VARIANT here.
+ (handler_seq): Accept an empty list of catch clauses and
+ generate a fake handler block to avoid later crashes.
+ (ansi_raise_identifier): Accept the error token too.
+ * semantics.c (begin_class_definition,
+ finish_class_definition): Check for error_mark_node.
-1999-06-15 Mark Mitchell <mark@codesourcery.com>
+2002-01-23 Zack Weinberg <zack@codesourcery.com>
- * cp-tree.h (class_cache_firstobj): Declare.
- (maybe_push_cache_obstack): Rename to push_cache_obstack.
- * class.c (permanent_obstack): Remove declaration.
- (class_cache_firstobj): Make it global.
- (add_method): Don't use permanent_obstack directly.
- (pushclass): Only free the class_cache_obstack if we know how far
- back to free it.
- (maybe_push_cache_obstack): Rename to push_cache_obstack.
- * decl.c: Remove dead comment.
- (saved_scope): Add class_cache_firstobj.
- (push_to_top_level): Save it.
- (pop_from_top_level): Restore it.
- (push_class_level_binding): Use push_cache_obstack, not
- maybe_push_cache_obstack.
- * search.c (push_class_decls): Likewise.
+ * typeck2.c (friendly_abort): Delete definition.
+ * cp-tree.h (friendly_abort): Don't prototype.
+ (my_friendly_assert): Use fancy_abort.
-1999-06-14 Nathan Sidwell <nathan@acm.org>
+2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
- * call.c (build_new_op): Remove REF_BIND from all operands.
+ * cp-tree.h (my_friendly_abort): Remove.
-1999-06-07 Mark Mitchell <mark@codesourcery.com>
+2002-01-23 Jakub Jelinek <jakub@redhat.com>
- * search.c (convert_pointer_to_single_level): Reimplement without
- using get_binfo.
+ * spew.c (pending_inlines, pending_inlines_tail,
+ processing_these_inlines): Make static.
+ (mark_pending_inlines): Remove static.
+ (begin_parsing_inclass_inline): If in function, save pi
+ for GC to cp_function_chain->unparsed_inlines instead.
+ (process_next_inline): Likewise.
+ * cp-tree.h (struct cp_language_function): Add unparsed_inlines.
+ (mark_pending_inlines): Add prototype.
+ * decl.c (spew_debug): Remove unused extern.
+ (mark_lang_function): Call mark_pending_inlines.
-1999-06-06 Mark Mitchell <mark@codesourcery.com>
+2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
- * method.c (is_back_referenceable_type): Back-reference bools when
- not squangling.
+ * call.c, class.c, decl.c, decl2.c, error.c, expr.c, friend.c,
+ init.c, lex.c, mangle.c, method.c, pt.c, repo.c, rtti.c, search.c,
+ semantics.c, spew.c, tree.c, typeck.c, typeck2.c, xref.c:
+ Change my_fancy_abort() to abort().
-1999-06-04 Jason Merrill <jason@yorick.cygnus.com>
+2002-01-23 Jason Merrill <jason@redhat.com>
- * semantics.c (finish_if_stmt_cond): Copy cond to permanent_obstack.
- (finish_while_stmt_cond, finish_do_stmt, finish_for_cond): Likewise.
+ PR c++/5453
+ * class.c (fixed_type_or_null): Fix thinko.
-1999-05-30 Mark Mitchell <mark@codesourcery.com>
+ PR c++/3331
+ * init.c (resolve_offset_ref): Use build_indirect_ref.
- * lex.c (make_lang_type): Create TYPE_BINFO for
- TEMPLATE_TYPE_PARMs just like for non-template types.
+ * decl2.c (grokclassfn): Don't set DECL_REGISTER on 'this'.
-1999-05-28 Nathan Sidwell <nathan@acm.org>
+2002-01-22 Jason Merrill <jason@redhat.com>
- * decl.c (complete_array_type): Allocate off same obstack. Fix
- DO_DEFAULT comment to match reality.
+ * parse.y (function_body): Suppress the block for the outermost
+ curly braces.
+ * decl.c (pushdecl): Don't try to skip it.
+ (begin_function_body): Keep the block we create, not the next one.
+ * init.c (emit_base_init): Don't mess with keep_next_level.
-1999-05-22 Mark Mitchell <mark@codesourcery.com>
+ * class.c (build_base_path): Tweak formatting.
- * tree.c (mapcar): Handle NON_LVALUE_EXPR.
+2002-01-19 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-21 Mark Mitchell <mark@codesourcery.com>
+ Fix regression introduced with patch for c++/775
+ * parse.y (class_head_defn): Check for template specializations
+ with a different class-key.
- * typeck.c (build_ptrmemfunc): Handle PTRMEM_CSTs carefully to
- reveal optimization opportunities.
+2002-01-17 Jason Merrill <jason@redhat.com>
-1999-05-20 Mark Mitchell <mark@codesourcery.com>
+ * decl.c (begin_constructor_body, begin_destructor_body): New fns.
+ (begin_function_body): Call them and keep_next_level.
+ * init.c (emit_base_init): Call keep_next_level.
+ * semantics.c (setup_vtbl_ptr): Lose.
+ * cp-tree.h (struct cp_language_function): Remove vtbls_set_up_p.
+ (vtbls_set_up_p): Lose.
+ * pt.c (tsubst_expr, CTOR_INITIALIZER): Call emit_base_init.
+ * method.c (do_build_copy_constructor): Likewise.
+ (synthesize_method): Call finish_mem_initializers.
+ * parse.y (nodecls): Likewise.
- * decl.c (grokdeclarator): Don't treat [] as indicating a
- zero-sized array in a typedef.
+ * error.c (dump_type_suffix): Print the exception specs before
+ recursing.
+ (dump_function_decl): Here, too.
- * call.c (build_object_call): Don't look at DECL_NAME for a type.
- (pt.c): Or CP_TYPE_QUALS for an ERROR_MARK.
- (typeck.c): Or TYPE_MAIN_VARIANT for a type.
+ * cp-tree.h (TMPL_PARMS_DEPTH): Cast to signed HOST_WIDE_INT.
+
+2002-01-10 Ira Ruben <ira@apple.com>
+
+ PR c++/907
+ * decl.c (start_method): Handle attrlist.
+
+2002-01-10 Jakub Jelinek <jakub@redhat.com>
+
+ * decl2.c (max_tinst_depth): Increase default limit to 500.
+
+2002-01-10 Graham Stott <grahams@redhat.com>
+
+ * spew.c (YYCHAR): Uppercase macro parameter and add
+ parenthesis.
+ (YYCODE): Likewise.
+ (NAME): Uppercase macro parameter.
+
+2002-01-09 Graham Stott <grahams@redhat.com>
+
+ * decl.h (grokdeclarator): Wrap long line.
+
+ * semantics.c (FINISH_COND): Uppercase macro paramaters and
+ add parenthesis.
+
+2002-01-08 Graham Stott <grahams@redhat.com>
+
+ * xref.c (FILE_NAME_ABSOLUTE_P): Add parenthesis.
+ (PALLOC): Uppercase macro parameter and whitespace.
+ (SALLOC): Uppercase macro parameter.
+ (SFREE): Uppercase macros parameter, add parenthese and
+ whitespace.
+ (STREQL): Uppercase macro parameter and whitespace.
+ (STRNEQ): Likewise.
+ (STRLSS): Likewise.
+ (STRLEQ): Likewise.
+ (STRGTR): Likewise.
+ (STRGEQ): Likewise.
+
+ * call.c (convert_like): Add parenthesis and wrap.
+ (convert_like_with_context): Likewise.
+ (ICS_RANK): Whitespace.
+ (NEED_TEMPORARY_P): Remove parenthesis.
+
+ * class.c (VTT_TOP_LEVEL_P): Uppercase macro parameter and
+ whitespace.
+ (VTT_MARKED_BINFO_P): Likewise.
+
+ * decl.c (BINDING_LEVEL): Add parenthesis.
+ (DEF_OPERATOR): Likewise.
+
+ * mangle.c (MANGLE_TRACE): Add parenthesis.
+ (MANGLE_TRACE_TREE): Likewise.
+ (write_signed_number): Likewise.
+ (write_unsigned_number): Likewise.
+
+ * pt.c (ccat): Uppercase macro parameter.
+ (cat): Likewise
+
+ * search.c (SET_BINFO_ACCESS): Add parenthesis.
+
+2002-01-07 Jason Merrill <jason@redhat.com>
+
+ * decl2.c (coerce_new_type): Downgrade error for size_t mismatch
+ to pedwarn.
+
+ PR c++/3536
+ * method.c (make_thunk): If !flag_weak, give the thunk the
+ function's linkage.
+ (use_thunk): Here, too.
+
+2002-01-07 Graham Stott <grahams@redhat.com>
+
+ * error.c: Update copyright date.
+ (print_scope_operator): Add parenthesis.
+ (print_left_paren): Likewise.
+ (print_right_paren): Likewise.
+ (print_left_bracket): Likewise.
+ (print_right_bracket): Likewise.
+ (print_template_argument_list_start): Likewise.
+ (print_template_argument_list_end): Likewise.
+ (print_non_consecutive_character): Likewise.
+ (print_tree_identifier): Likewise.
+ (print_identifier): Likewise.
+ (NEXT_CODE): Uppercase macro parameter.
+ (ident_fndecl): Delete unused.
+ (GLOBAL_THING): Likewise.
+
+2002-01-06 Graham Stott <grahams@redhat.com>
+
+ * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): Add parenthesis.
+ (VAR_FUNCTION_OR_PARM_DECL_CHECK): Likewise.
+ (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK) Likewise.
+ (RECORD_OR_UNION_TYPE_CHECK): Likewise.
+ (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Likewise.
+ (C_IS_RESERVED_WORD): Uppercase macro parameter.
+ (C_RID_YYCODE) Likewise.
+ (ptrmem_cst): Use rtx.
+ (LOCAL_BINDING_P): Add whitespace.
+ (INHERITED_VALUE_BINDING_P): Likewise.
+ (BINDING_SCOPE): Wrap long line.
+ (BINDING_HAS_LEVEL_P): Remove parenthesis.
+ (BINDING_VALUE): Wrap long line.
+ (BINDING_TYPE): Whitespace.
+ (IDENTIFIER_GLOBAL_VALUE): Add parenthesis.
+ (SET_IDENTIFIER_GLOBAL_VALUE): Likewise.
+ (IDENTIFIER_NAMESPACE_VALUE): Likewise.
+ (SET_IDENTIFIER_NAMESPACE_VALUE: Likewise.
+ (same_type_p): Uppercase macro parameters.
+ (same_type_ignoring_top_level_qualifiers_p): Likewise.
+ (OVL_FUNCTION): Wrap long line.
+ (OVL_CHAIN): Whitespace.
+ (OVL_CURRENT): Add parenthesis and whitespace.
+ (OVL_NEXT): Whitespace.
+ (OVL_USED): Likewise.
+ (IDENTIFIER_TYPE_VALUE): Likewise.
+ (REAL_IDENTIFIER_TYPE_VALUE): Remove parenthesis.
+ (SET_IDENTIFIER_TYPE_VALUE): Add parenthesis and whitespace.
+ (LANG_ID_FIELD): Whitespace.
+ (SET_LANG_ID(NODE,VALUE,NAME): Likewise.
+ (IDENTIFIER_LABEL_VALUE): Whitespace and wrap.
+ (SET_IDENTIFIER_LABEL_VALUE): Whitespace.
+ (IDENTIFIER_IMPLICIT_DECL): Whitespace and wrap.
+ (SET_IDENTIFIER_IMPLICIT_DECL); Whitespace.
+ (IDENTIFIER_ERROR_LOCUS): Whitespace and wrap.
+ (SET_IDENTIFIER_ERROR_LOCUS); Whitespace.
+ (IDENTIFIER_VIRTUAL_P): Likewise.
+ (IDENTIFIER_OPNAME_P): Likewise.
+ (IDENTIFIER_TYPENAME_P): Remove parenthesis.
+ (C_TYPE_FIELDS_READONLY): Uppercase macro parameters.
+ (C_SET_EXP_ORIGINAL_CODE): Likewise.
+ (TYPE_ASSEMBLER_NAME_STRING): Wrap long line.
+ (TYPE_ASSEMBLER_NAME_LENGTH): Likewise.
+ (IS_AGGR_TYPE): Uppercase macro parameter.
+ (CLASS_TYPE_P): Likewise.
+ (IS_AGGR_TYPE_CODE): Uppercase macro parameter and parenthesis.
+ (IS_AGGR_TYPE_2): Whitespace.
+ (TAGGED_TYPE_P): Uppercase macro parameter.
+ (TYPE_BUILT_IN): Whitespace.
+ (TYPE_FOR_JAVA): Likewise.
+ (FUNCTION_ARG_CHAIN): Remove parenthesis.
+ (FUNCTION_FIRST_USER_PARMTYPE): Add parenthesis.
+ (FUNCTION_FIRST_USER_PARAM): Likewise.
+ (PROMOTES_TO_AGGR_TYPE): Whitespace.
+ (DERIVED_FROM_P): Add parenthesis and wrap.
+ (UNIQUELY_DERIVED_FROM_P): Likewise.
+ (ACCESSIBLY_UNIQUELY_DERIVED_P): Likewise.
+ (PUBLICLY_UNIQUELY_DERIVED_P): Likewise.
+ (CLASSTYPE_USE_TEMPLATE): Whitespace.
+ (CLASSTYPE_INLINE_FRIENDS): Remove parenthesis.
+ (TYPE_GETS_DELETE): Add parenthesis.
+ (TYPE_HAS_CONVERSION): Add parenthesis and wrap.
+ (TYPE_HAS_ASSIGN_REF): Likewise,
+ (TYPE_HAS_CONST_ASSIGN_REF): Likewise.
+ (TYPE_HAS_INIT_REF): Likewise.
+ (TYPE_HAS_CONST_INIT_REF): Likewise.
+ (TYPE_BEING_DEFINED): Likewise.
+ (TYPE_LANG_SPECIFIC): Likewise.
+ (CLASSTYPE_RTTI): Likewise.
+ (TYPE_OVERLOADS_CALL_EXPR): Likewise.
+ (TYPE_OVERLOADS_ARRAY_REF): Likewise.
+ (TYPE_OVERLOADS_ARROW): Likewise.
+ (TYPE_USES_MULTIPLE_INHERITANCE): Likewise.
+ (TYPE_USES_VIRTUAL_BASECLASSES): Add parenthesis.
+ (CLASSTYPE_METHOD_VEC): Likewise.
+ (CLASSTYPE_MARKED_N): Likewise.
+ (CLASSTYPE_MARKED): Likewise.
+ (CLASSTYPE_MARKED2): Likewise.
+ (CLASSTYPE_MARKED3): Likewise.
+ (CLASSTYPE_MARKED4): Likewise.
+ (CLASSTYPE_MARKED5): Likewise.
+ (CLASSTYPE_MARKED6): Likewise.
+ (SET_CLASSTYPE_MARKED): Whitespace.
+ (CLEAR_CLASSTYPE_MARKED): Likewise.
+ (SET_CLASSTYPE_MARKED2): Likewise.
+ (CLEAR_CLASSTYPE_MARKED2): Likewise.
+ (SET_CLASSTYPE_MARKED3): Likewise.
+ (CLEAR_CLASSTYPE_MARKED3): Likewise.
+ (SET_CLASSTYPE_MARKED4): Likewise.
+ (CLEAR_CLASSTYPE_MARKED4): Likewise.
+ (SET_CLASSTYPE_MARKED5): Likewise.
+ (CLEAR_CLASSTYPE_MARKED5): Likewise.
+ (SET_CLASSTYPE_MARKED6): Likewise.
+ (CLEAR_CLASSTYPE_MARKED6): Likewise.
+ (CLASSTYPE_TAGS): Likewise.
+ (CLASSTYPE_VSIZE): Likewise.
+ (CLASSTYPE_VBASECLASSES): Likewise.
+ (CANONICAL_BINFO): Add parenthesis.
+ (CLASSTYPE_SIZE(NODE): Likewise.
+ (CLASSTYPE_SIZE_UNIT): Likewise.
+ (CLASSTYPE_ALIGN(NODE): Likewise.
+ (CLASSTYPE_USER_ALIGN): Likewise.
+ (TYPE_JAVA_INTERFACE): Likewise.
+ (CLASSTYPE_PURE_VIRTUALS): Likewise.
+ (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Whitespace and wrap.
+ (TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise.
+ (CLASSTYPE_HAS_MUTABLE): Likewise.
+ (CLASSTYPE_FRIEND_CLASSES): Likewise. Likewise.
+ (CLASSTYPE_DECLARED_CLASS): Whitespace and wrap.
+ (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Likewise.
+ (CLASSTYPE_REF_FIELDS_NEED_INIT): Likewise.
+ (CLASSTYPE_INTERFACE_ONLY): Likewise.
+ (CLASSTYPE_INTERFACE_KNOWN): Likewise.
+ (CLASSTYPE_INTERFACE_UNKNOWN): Likewise.
+ (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise.
+ (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise.
+ (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise.
+ (CLASSTYPE_DEBUG_REQUESTED): Whitespace and wrap.
+ (BINFO_UNSHARED_MARKED): Whitespace.
+ (BINFO_MARKED): Whitespace and wrap.
+ (SET_BINFO_MARKED): Likewise.
+ (CLEAR_BINFO_MARKED): Likewise.
+ (BINFO_VTABLE_PATH_MARKED): Likewise.
+ (SET_BINFO_VTABLE_PATH_MARKED): Likewise.
+ (CLEAR_BINFO_VTABLE_PATH_MARKED): Likewise.
+ (BINFO_SUBVTT_INDEX): Remove parenthesis.
+ (BINFO_VPTR_INDEX): Likewise.
+ (BINFO_PRIMARY_BASE_OF): Likewise,
+ (CLASSTYPE_VFIELDS): Whitespace.
+ (VF_DERIVED_VALUE): Wrap long line.
+ (NAMESPACE_LEVEL): Whitespace.
+ (CAN_HAVE_FULL_LANG_DECL_P): Remove parenthesis.
+ (DEFARG_POINTER): Whitespace.
+ (DECL_NEEDED_P): Remove parenthesis.
+ (DECL_LANGUAGE): Whitespace.
+ (SET_DECL_LANGUAGE): Add parenthesis.
+ (DECL_CONSTRUCTOR_P): Whitespace and wrap.
+ (DECL_OVERLOADED_OPERATOR_P): Remove parenthesis.
+ (DECL_IN_AGGR_P): Whitespace.
+ (DECL_FRIEND_P): Likewise.
+ (DECL_BEFRIENDING_CLASSES): Likewise.
+ (DECL_STATIC_FUNCTION_P): Whitespace and wrap.
+ (DECL_NONCONVERTING_P): Whitespace.
+ (DECL_PURE_VIRTUAL_P): Likewise.
+ (DECL_NEEDS_FINAL_OVERRIDER_P): Likewise.
+ (DECL_PENDING_INLINE_INFO): Whitespace.
+ (DECL_SORTED_FIELDS): Likewise.
+ (DECL_DEFERRED_FN): Likewise.
+ (DECL_TEMPLATE_INFO): Likewise.
+ (CLASSTYPE_TEMPLATE_INFO): Whitespace and wrap.
+ (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO); Likewise.
+ (SET_TYPE_TEMPLATE_INFO): Add parenthesis.
+ (TMPL_ARGS_LEVEL): Likewise.
+ (SET_TMPL_ARGS_LEVEL): Likewise.
+ (INNERMOST_TEMPLATE_PARMS): Whitespace.
+ (C_TYPEDEF_EXPLICITLY_SIGNED): Uppercase macro parameter.
+ (INTEGRAL_CODE_P(CODE): Add parenthesis.
+ (CP_INTEGRAL_TYPE_P): Remove parenthesis.
+ (TYPE_HAS_CONSTRUCTOR): Whitespace.
+ (TREE_HAS_CONSTRUCTOR): Likewise.
+ (TYPE_HAS_DESTRUCTOR): Likewise.
+ (TYPE_HAS_REAL_ASSIGN_REF): Likewise.
+ (TYPE_HAS_COMPLEX_ASSIGN_REF): Likewise.
+ (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise.
+ (TYPE_HAS_COMPLEX_INIT_REF): Likewise.
+ (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise.
+ (TYPE_PTRMEMFUNC_P): Likewise.
+ (TYPE_PTRMEMFUNC_FLAG): Likewise.
+ (TYPE_GET_PTRMEMFUNC_TYPE): Likewise.
+ (TYPE_SET_PTRMEMFUNC_TYPE): Likewise.
+ (TYPE_PTRMEM_CLASS_TYPE): Remove parenthesis.
+ (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise.
+ (DECL_ACCESS): Whitespace.
+ (DECL_GLOBAL_CTOR_P): Remove parenthesis.
+ (DECL_GLOBAL_DTOR_P): Likewise.
+ (GLOBAL_INIT_PRIORITY): Likewise.
+ (DECL_TEMPLATE_PARMS): Likewise.
+ (DECL_TEMPLATE_RESULT): Likewise.
+ (DECL_TEMPLATE_INSTANTIATIONS): Likewise.
+ (DECL_TEMPLATE_SPECIALIZATIONS): Likewise.
+ (DECL_IMPLICIT_TYPEDEF_P): Remove parenthesis.
+ (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise.
+ (PRIMARY_TEMPLATE_P): Add parenthesis.
+ (DECL_USE_TEMPLATE): Whitespace.
+ (CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise.
+ (SET_CLASSTYPE_IMPLICIT_INSTANTIATION): Likewise.
+ (CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise.
+ (SET_CLASSTYPE_EXPLICIT_INSTANTIATION): Likewise.
+ (CALL_DECLARATOR_PARMS): Remove parenthesis.
+ (CALL_DECLARATOR_QUALS): Likewise.
+ (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise.
+ (TEMP_NAME_P): Wrap.
+ (VFIELD_NAME_P): Likewise.
+ (B_SET): Uppercase macro parameters and add parenthesis.
+ (B_CLR): Likewise.
+ (B_TST): Likewise.
+ (LOOKUP_NAMESPACES_ONLY): Uppercase macro parameters.
+ (LOOKUP_TYPES_ONLY): Uppercase macro parameters.
+ (LOOKUP_QUALIFIERS_ONLY): Uppercase macro parameters.
+ (same_or_base_type_p): Likewise.
+ (cp_deprecated): Likewise.
-1999-05-20 Jason Merrill <jason@yorick.cygnus.com>
+2002-01-05 Richard Henderson <rth@redhat.com>
- * tree.c (lvalue_p_1): A NOP_EXPR can be an lvalue.
- (build_cplus_new): Make sure that what we return is of the right type.
+ * semantics.c (expand_body): Revert last change.
-1999-05-20 Mark Mitchell <mark@codesourcery.com>
+2002-01-04 Jason Merrill <jason@redhat.com>
- * cp-tree.h (make_ptrmem_cst): New function.
- * expr.c (cplus_expand_constant): Split out from ...
- (cplus_expand_expr): Here. Use cplus_expand_constant.
- (init_cplus_expand): Set lang_expand_constant.
- * pt.c (convert_nontype_argument): Use make_ptrmem_cst.
- * tree.c (make_ptrmem_cst): Define.
- * typeck.c (unary_complex_lvalue): Use make_ptrmem_cst.
- * typeck2.c (initializer_constant_valid_p): Use make_ptrmem_cst.
+ PR c++/4122
+ * class.c (update_vtable_entry_for_fn): Set delta to zero for a
+ lost primary.
-1999-05-19 Mark Mitchell <mark@codesourcery.com>
+ * class.c (build_vtbl_initializer): Check for a lost primary
+ before calculating the vtable entry to throw away.
- * decl2.c (start_static_storage_duration_function): Fix comment.
- (finish_file): Create static storage duration functions lazily.
+2002-01-02 Jason Merrill <jason@redhat.com>
-Wed May 19 02:50:53 1999 Arvind Sankar <arvinds@mit.edu>
+ * semantics.c (expand_body): Call outlining_inline_function when
+ emitting an inline function out of line.
- * gxxint.texi: Fix typo.
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-18 Jason Merrill <jason@yorick.cygnus.com>
+ PR c++/5116, c++/764 reversion
+ * call.c (build_new_op): Revert the instantiations. They are
+ incorrect.
- * call.c (joust): Compare the types of the conv ops, not the
- target types of the conversions.
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-Tue May 18 00:21:34 1999 Zack Weinberg <zack@rabi.phys.columbia.edu>
+ PR c++/5089
+ * decl2.c (reparse_absdcl_as_casts): Don't warn about casts to void.
- * lang-specs.h: Define __GNUC__ and __GNUC_MINOR__ only if -no-gcc
- was not given.
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-17 Mark Mitchell <mark@codesourcery.com>
+ PR c++/3716
+ * pt.c (tsubst_aggr_type): Move pmf handling into tsubst.
+ (tsubst, case POINTER_TYPE): Handle pmfs here.
+ (tsubst, case OFFSET_TYPE): Check it is not an offset to
+ reference. If it is offset to FUNCTION_TYPE, create a METHOD_TYPE.
- * cp-tree.def (TEMPLATE_ID_EXPR): Update documentation.
- * decl.c (grokfndecl): Don't allow inline declarations of friend
- template specializations, or friend template specializations with
- default arguments.
- * pt.c (tsubst): Handle substitution into array types that does
- not yield a fixed upper bound, even when not processing a
- template.
- (tsubst_copy): Deal with the fact that the second operand to a
- TEMPLATE_ID_EXPR may be NULL_TREE, a TREE_LIST, or a TREE_VEC.
- * search.c (marked_pushdecls_p): Don't descend into
- TEMPLATE_TYPE_PARMs and the like.
- (unmarked_pushdecls_p): Likewise.
-
- * call.c (build_over_call): Don't throw away
- initializations/copies of empty classes; use MODIFY_EXPR and
- INIT_EXPR as for non-empty classes.
- * class.c (finish_struct_1): Put the padding byte for an empty
- class on the TYPE_NONCOPIED_PARTS list for the class.
-
-1999-05-16 Mark Mitchell <mark@codesourcery.com>
-
- * decl2.c (build_expr_from_tree): Handle COMPONENT_REFs that
- indicate a reference to a field that is a qualified name.
-
-1999-05-16 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_objects): Don't use .?tors.* if we don't have
- ASM_OUTPUT_CONSTRUCTOR.
-
- * friend.c (do_friend): Add attrlist arg. Remove support for
- getting a non-decl as 'decl'.
- * decl.c (grokfndecl): Remove attrlist arg. Don't set attrs or
- rtl.
- (grokdeclarator): Adjust.
- * cp-tree.h: Adjust.
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-16 Mark Mitchell <mark@codesourcery.com>
+ PR c++/35
+ * cp-tree.h (DECL_LANG_FLAG_0): Used for PARM_DECL too.
+ (DECL_TEMPLATE_PARM_P): A PARM_DECL might be one too.
+ * pt.c (process_template_parm): SET_DECL_TEMPLATE_PARM_P on the
+ PARM_DECL.
+ (tsubst_template_parms): Break up loop statements.
+ (tsubst_decl, case PARM_DECL): Copy DECL_TEMPLATE_PARM_P. Template
+ parm PARM_DECLs don't get promoted.
- * cp-tree.h (permanent_p): New function.
- * init.c (build_new_1): Use mapcar, not copy_node, to copy a
- possibly complex tree node.
- * tree.c (mapcar): Adjust comments, and follow coding standards in
- conditional.
- (permanent_p): New function.
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-13 Per Bothner <bothner@cygnus.com>
+ PR c++/5123
+ * typeck.c (build_component_ref): Cope with a TEMPLATE_ID_EXPR.
+ (build_x_function_call): Cope with a COMPONENT_REF containing a
+ TEMPLATE_ID_EXPR.
- * class.c (push_lang_context): Turn off DECL_IGNORED_P for
- primitive Java types, if we actually see `extern "Java"'.
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-10 18:21 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu>
+ PR c++/5213
+ * pt.c (convert_template_argument): Be more careful determining
+ when RECORD_TYPE templates are or are not templates.
- * lang-specs.h: Pass -$ to the preprocessor.
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-10 Jason Merrill <jason@yorick.cygnus.com>
+ PR c++/775
+ * cp-tree.h (handle_class_head): Adjust prototype.
+ * decl2.c (handle_class_head): Add DEFN_P and NEW_TYPE_P
+ parameters. Use for all class heads.
+ * parse.y (named_class_head_sans_basetype, named_class_head,
+ named_complex_class_head_sans_basetype,
+ named_class_head_sans_basetype_defn,
+ unnamed_class_head): Remove.
+ (class_head, class_head_apparent_template): Recognize class heads
+ (class_head_decl, class_head_defn): New reductions. Process class
+ heads.
+ (structsp): Adjust class definition and class declaration
+ reductions.
+ (maybe_base_class_list): Give diagnostic on empty list.
- * init.c (build_offset_ref): Wrap baselinks in OFFSET_REF, too.
- Don't bother wrapping an OFFSET_TYPE around unknown_type_node.
- (resolve_offset_ref): Don't handle a raw baselink.
- * cvt.c (build_expr_type_conversion): Likewise.
- * typeck.c (decay_conversion, build_c_cast, convert_for_assignment,
- convert_for_initialization): Likewise.
- * class.c (instantiate_type): Handle seeing a baselink under an
- OFFSET_REF.
- * error.c (dump_expr): Likewise.
- * pt.c (for_each_template_parm): Likewise.
- (resolve_overloaded_unification): Likewise.
- * tree.c (is_overloaded_fn, really_overloaded_fn): Likewise.
- * typeck.c (expr_sizeof): Also complain about other permutations
- of overloaded functions.
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-07 Jason Merrill <jason@yorick.cygnus.com>
+ PR c++/4379
+ * typeck.c (build_x_unary_op): Don't destroy the OFFSET_REF on a
+ single non-static member.
+ (unary_complex_lvalue): If it cannot be a pointer to member, don't
+ make it so. Check it is not pointer to reference.
- * init.c (resolve_offset_ref): Don't return a raw method.
- Use BASELINK_P.
- * typeck.c (decay_conversion): Don't handle a raw method.
- Resolve all OFFSET_REFs.
- (get_member_function_from_ptrfunc): 0 is a valid vtable index.
- (build_binary_op_nodefault): Handle resolving overloaded fns. Use
- same_type_p for pmf bits. Don't use build_binary_op to compare
- raw pointers to methods.
- (convert_for_assignment): Check for OFFSET_REF, not OFFSET_TYPE,
- to decide when to call resolve_offset_ref.
- (build_c_cast, convert_for_initialization): Likewise.
- * cvt.c (build_expr_type_conversion): Likewise.
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-06 Nathan Sidwell <nathan@acm.org>
+ PR c++/5132
+ * decl2.c (reparse_absdcl_as_casts): Don't digest_init if we
+ are processing a template decl.
- * call.c (build_new_method_call): Use TYPE_MAIN_VARIANT of class.
+2002-01-02 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-05 Mark Mitchell <mark@codesourcery.com>
+ PR c++/5116, c++/764
+ * call.c (build_new_op): Make sure template class operands are
+ instantiated. Simplify arglist construction.
- * decl2.c (start_objects): Don't let static constructors and
- destructors get inlined.
+2001-12-29 Nathan Sidwell <nathan@codesourcery.com>
- * parse.y (nested_name_specifier): Make sure ordinary types are
- complete, just like template types.
- * parse.c: Regenerated.
+ * call.c (build_user_type_conversion_1): Use my_friendly_assert
+ rather than if ... abort.
+ * cvt.c (convert_to_reference): Likewise.
+ * semantics.c (setup_vtbl_ptr): Likewise.
+ * pt.c (lookup_template_class): Comment typo.
- * pt.c (check_explicit_specialization): Improve error messages.
+2001-12-29 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-04 Martin von Löwis <loewis@informatik.hu-berlin.de>
+ PR c++/5125
+ * pt.c (push_template_decl_real): Make sure DECL has
+ DECL_LANG_SPECIFIC.
- * typeck.c (string_conv_p): Use same_type_p to check whether we
- try to convert between char and wchar_t.
+2001-12-29 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-03 Mark Mitchell <mark@codesourcery.com>
+ PR c++/335
+ * init.c (resolve_offset_ref): Copy cv qualifiers of this pointer
+ for non-reference fields.
+ * typeck.c (require_complete_type): Use resolve_offset_ref).
- * search.c (lookup_field_r): Set the TREE_TYPE of an ambiguous
- lookup to error_mark_node here.
- (lookup_member): Revise documentation. Add comments. Don't set
- the TREE_TYPE to error_mark_node here, and don't build up an extra
- TREE_LIST for ambiguous lookups.
- (setup_class_bindings): Adjust accordingly.
- (push_class_decls): Revise out-of-date comments.
-
- * typeck.c (build_const_cast): Tighten checks for legality.
+2001-12-26 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-02 Martin von Löwis <loewis@informatik.hu-berlin.de>
+ PR c++/196
+ * parse.y (bad_parm): Better diagnostic when given a SCOPE_REF.
- * init.c (build_member_call): Lookup names coming from
- namespace-scoped LOOKUP_EXPR.
+2001-12-24 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-03 Jim Blandy <jimb@zwingli.cygnus.com>
+ PR c++/160
+ * typeck.c (build_modify_expr): Remove old unreachable code & tidy
+ up. Don't stabilize_references when initializing a reference.
- * gxxint.texi: Add documentation for 'I'.
+2001-12-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-1999-05-02 Martin von Löwis <loewis@informatik.hu-berlin.de>
+ * decl2.c (lang_f_options): Const-ify.
- * tinfo.cc (operator==): Qualify type_info with std::.
+2001-12-20 Joseph S. Myers <jsm28@cam.ac.uk>
-1999-05-02 Mark Mitchell <mark@codesourcery.com>
+ * config-lang.in (diff_excludes): Remove.
- * cp-tree.h (lang_decl_flags): Remove comdat. Updated dummy.
- (DECL_COMDAT): Remove definition.
+2001-12-19 Nathan Sidwell <nathan@codesourcery.com>
-1999-05-01 Mark Mitchell <mark@codesourcery.com>
+ PR c++/90
+ * typeck.c (build_function_call_real): Use original function
+ expression for errors.
- * decl.c (wrapup_globals_for_namespace): Fix thinko in previous
- change.
+2001-12-18 Jason Merrill <jason@redhat.com>
-1999-04-30 Mark Mitchell <mark@codesourcery.com>
+ PR c++/3242
+ * class.c (add_method): Do compare 'this' quals when trying to match a
+ used function. Don't defer to another used function.
- * class.c (build_vtable): Use build_lang_decl when building
- vtables, not just build_decl.
- (prepare_fresh_vtable): Likewise.
- * decl.c (wrapup_globals_for_namespace): Mark vtables as
- DECL_EXTERNAL when calling wrapup_global_declarations.
- * decl2.c (priority_info_s): Add initializations_p and
- destructions_p members.
- (finish_vtable_vardecl): Use TREE_SYMBOL_REFERENCED, not TREE_USED,
- when deciding what vtables to write out.
- (ssdf_decls): New variable.
- (ssdf_decls_used): Likewise.
- (start_static_storage_duration_function): Deal with being called
- multiple times. Avoid inlining this function.
- (generate_inits_for_priority): Deal with reuse of priority map.
- (get_priority_info): Clear initializations_p and destructions_p.
- (do_static_initialization): Tweak comment.
- (do_static_destruction): Likewise. Fix condition on sentries for
- destruction.
- (generate_ctor_or_dtor_function): Call all of the static storage
- duration functions.
- (generate_ctor_or_dtor_function_for_priority): Check
- initializations_p and destructions_p to see what priorities need
- initialization functions.
- (finish_file): Rework to generate multiple static storage duration
- functions, rather than just one.
-
- * typeck.c (build_const_cast): Tweak last change to handle
- templates correctly.
+2001-12-18 Nathan Sidwell <nathan@codesourcery.com>
- * typeck.c (build_const_cast): Disallow use of const_cast to
- anything but a pointer or reference type.
+ * pt.c (instantiate_clone): Remove, fold into ...
+ (instantiate_template): ... here. Simplify by removing mutual
+ recursion.
+ * typeck2.c (build_m_component_ref): Don't cv qualify the function
+ pointed to by a pointer to function.
+ * class.c (delete_duplicate_fields_1): Typo.
-1999-04-30 Nathan Sidwell <nathan@acm.org>
+2001-12-18 Jason Merrill <jason@redhat.com>
- * decl.c (cp_finish_decl): Don't permit arrays of abstract or
- signature type.
+ C++ ABI change: destroy value arguments in caller.
+ * semantics.c (genrtl_start_function, genrtl_finish_function): Don't
+ create an extra binding level for the parameters.
+ * decl.c (store_parm_decls): Don't do parameter cleanups.
-1999-04-29 Mark Mitchell <mark@codesourcery.com>
+2001-12-18 Nathan Sidwell <nathan@codesourcery.com>
- * decl2.c (do_static_destruction): Remove obsolete FIXME comment.
- (finish_file): Indent comments properly.
+ * call.c (build_new_method_call): Use '%#V'.
+ * error.c (cv_to_string): Use V parameter to determine padding.
-1999-04-29 Richard Henderson <rth@cygnus.com>
+2001-12-18 Joseph S. Myers <jsm28@cam.ac.uk>
- * decl2.c (do_static_initialization): Call do_pending_stack_adjust.
- (do_static_destruction): Likewise.
+ * call.c, decl2.c, init.c: Use "built-in" and "bit-field"
+ spellings in messages.
-1999-04-29 Nathan Sidwell <nathan@acm.org>
+2001-12-17 Zack Weinberg <zack@codesourcery.com>
- * cp-tree.h (TYPE_NOTHROW_P): New macro.
- * decl2.c (delete_sanity): Warn on deleting void *.
- * init.c (build_new_1): Use TYPE_NOTHROW_P.
- * typeck.c (c_expand_return): cp_pedwarn on returning NULL from
- throwing operator new.
+ * cp-tree.h: Delete #defines for cp_error, cp_warning,
+ cp_pedwarn, and cp_compiler_error.
+ * call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
+ except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
+ rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
+ typeck2.c: Change calls to the above macros to use their
+ language-independent equivalents: error, warning, pedwarn, and
+ internal_error respectively.
-1999-04-28 Nathan Sidwell <nathan@acm.org>
+2001-12-16 Neil Booth <neil@daikokuya.demon.co.uk>
- * cp-tree.h (build_component_addr): Remove prototype.
- * typeck.c (build_component_addr): Make static. Remove MSG
- argument.
- (build_component_addr): Remove MSG parameter, clean up
- comment.
- (build_x_function_call): Use cp_error.
- (build_unary_op): Adjust call of build_component_addr.
-
-1999-04-28 Mark Mitchell <mark@codesourcery.com>
-
- * pt.c (tsubst_friend_class): Check for NULL.
-
-Wed Apr 28 11:42:22 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
-
- * search.c (binfo_for_vtable): Initialize bfvi.var.
-
-1999-04-27 Nathan Sidwell <nathan@acm.org>
-
- * rtti.c (build_x_typeid): Check rtti is enabled.
-
-1999-04-26 Mark Mitchell <mark@codesourcery.com>
-
- * search.c (is_subobject_of_p): Make sure we're looking at the
- right baseclasses.
-
-1999-04-26 Marc Espie <espie@cvs.openbsd.org>
-
- * Make-lang.in (cplib2.ready): Don't depend on phony targets.
-
-1999-04-23 Mark Mitchell <mark@codesourcery.com>
-
- * decl2.c (finish_file): Tweak handling of extern inlines so that
- they are not unnecessarily put out.
-
- * search.c (is_subobject_of_p): Handle TEMPLATE_TYPE_PARMs and
- such as base classes.
-
-1999-04-22 Brendan Kehoe <brendan@cygnus.com>
-
- * tree.c (build_exception_variant): Fix typo: use the chain of U,
- not trying V, while cycling through U.
-
-1999-04-22 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (lang_decl_flags): Remove returns_first_arg and
- preserves_first_arg. Enlarge dummy accordingly.
- (DECL_TINFO_FN_P): New macro.
- (SET_DECL_TINFO_FN_P): Likeiwse.
- (DECL_RETURNS_FIRST_ARG): Remove.
- (DECL_PRESERVES_THIS): Likewise.
- (DECL_INIT_PRIORITY): New macro.
- (finish_struct_1): Change prototype.
- (cat_namespace_levels): Remove prototype.
- (vtable_decl_p): New prototype.
- (vtype_decl_p): Likewise.
- (sigtable_decl_p): Likewise.
- (walk_globals_pred): New typedef.
- (walk_globals_fn): Likewise.
- (walk_globals): New prototype.
- (walk_namespaces_fn): New typedef.
- (walk_namespaces): New prototype.
- (wrapup_globals_for_namespace): Likewise.
- (walk_vtables): Remove prototype.
- (walk_sigtables): Likewise.
- (instantiate_pending_templates): New prototype.
- * class.c (finish_struct_1): Don't return a value.
- * decl.h (pending_statics): Remove declaration.
- * decl.c (walk_namespaces_r): New function.
- (walk_globals_r): Likewise.
- (vtable_decl_p): Likewise.
- (vtype_decl_p): Likewise.
- (sigtable_decl_p): Likewise.
- (walk_namespaces): Likewise.
- (walk_globals_data): New type.
- (walk_globals): New function.
- (wrapup_globals_for_namespace): Likewise.
- (expand_static_init): Remove assertion. Remove redundancy in
- conditional. Don't put static data members in static_aggregates
- Tidy.
- (finish_function): Remove redundancy in conditional. Don't set
- DECL_RETURNS_FIRST_ARG.
- (cat_namespace_levels): Remove.
- * decl2.c: Include splay-tree.h and varray.h.
- (priority_info_s): New structure.
- (finish_vtable_vardecl): Change prototype. Adjust for new calling
- conventions.
- (prune_vtable_vardecl): Likewise.
- (finish_sigtable_vardecl): Likewise.
- (setup_initp): Remove.
- (do_dtors): Remove.
- (do_ctors): Remove.
- (start_static_storage_duration_function): New function.
- (generate_inits_for_priority): Likewise.
- (finish_static_storage_duration_function): Likewise.
- (get_priority_info): Likewise.
- (do_static_initialization): Likewise.
- (do_static_destruction): Likewise.
- (do_static_initialization_and_destruction): Likewise.
- (generate_ctor_or_dtor_function): Likewise.
- (generate_ctor_and_dtor_functions_for_priority): Likewise.
- (pending_statics): Make it a varray.
- (pending_statics_used): New variable.
- (saved_inlines): Make it a varray.
- (saved_inlines_used): New variable.
- (finish_static_data_member): Change method of updating
- pending_statics.
- (mark_inline_for_output): Remove #if 0'd code. Change method of
- updating saved_inlines.
- (walk_vtables): Remove.
- (walk_sigtables): Likewise.
- (import_export_decl): Use DECL_TINFO_FN_P.
- (pending_templates): Remove declaration.
- (maybe_templates): Likewise.
- (static_aggregates_initp): Likewise.
- (setup_initp): Likewise.
- (finish_objects): Simplify.
- (INITIALIZE_P_IDENTIFIER): New macro.
- (PRIORITY_IDENTIFIER): New macro.
- (SSDF_IDENTIFIER): New macro.
- (initialize_p_decl): New variable.
- (priority_decl): Likewise.
- (ssdf_decl): Likewise.
- (priority_info_map): Likewise.
- (finish_file): Recode output of static intializers and other
- file-scope finalization tasks.
- * error.c (OB_END_TEMPLATE_ID): New macro.
- (dump_type_real): Use it.
- (dump_decl): Likewise.
- (dump_function_name): Likewise.
- * lex.c (set_typedecl_interface_info): Adjust for new walk_globals
- interface.
- (check_newline): Use walk_globals, not walk_vtables.
- * pt.c (pending_tempalte_expansions): Remove.
- (set_vardecl_interface_info): Likewise.
- (pending_templates): Make static.
- (maybe_templates): Likewise.
- (instantiate_class_template): Adjust call to finish_struct_1.
- (instantiate_pending_templates): New function.
- * rtti.c (get_tinfo_fn): Use SET_DECL_TINFO_FN_P.
- * tree.c (static_aggregates_initp): Remove.
- (cp_valid_lang_attribute): Don't use it; use DECL_INIT_PRIORITY
- instead.
- * Makefile.in (decl2.o): Depend on varray.h and splay-tree.h.
+ * decl2.c (finish_file): Remove back_end_hook.
- * gxx.gperf (RETURN): Rename to RETURN_KEYWORD to avoid clashes
- with the RTL code RETURN.
- * hash.h: Regenerated.
- * lex.c (reinit_parse_for_block): Use RETURN_KEYWORD.
- * parse.y: Replace RETURN with RETURN_KEYWORD throughout.
- * parse.c: Regenerated.
- * pt.c: Include varray.h. Include rtl.h since varray.h requires
- it.
- (inline_parm_levels): New variable.
- (inline_parm_levels_used): Likewise.
- (maybe_begin_member_template_processing): Update them.
- (maybe_end_member_template_processing): Use them, rather than
- guessing how many levels to pop.
-
- * decl.c (make_typename_type): Tighten error-checking.
-
-1999-04-20 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (build_binary_op): Remove unneeded parameter.
- * class.c (build_vrable_entry_ref): Adjust call to
- build_binary_op.
- * decl.c (expand_static_init): Likewise.
- (grokdeclarator): Likewise.
- (finish_function): Likewise.
- * decl2.c (delete_sanity): Likewise.
- (do_dtors): Likewise.
- (do_ctors): Likewise.
- * error.c (dump_type_suffix): Likewise.
- * expr.c (cplus_expand_expr): Likewise.
- * init.c (resolve_offset_ref): Likewise.
- (build_new): Likewise.
- (build_new_1): Likewise.
- (build_vec_delete_1): Likewise.
- (expand_vec_init_catch_clause): Likewise.
- (build_delete): Likewise.
- * pt.c (tsubst): Likewise.
- * rtti.c (synthesize_tinfo_fn): Likewise.
- * search.c (expand_upcast_fixups): Likewise.
- (expand_direct_vtbls_init): Likewise.
- * typeck.c (get_member_function_from_ptrfunc): Likewise.
- (build_binary_op_nodefault): Likewise.
- (point_int_sum): Likewise.
- (pointer_diff): Likewise.
- (build_unary_op): Likewise.
- (build_modify_expr): Likewise.
- (get_delta_difference): Likewise.
- (build_ptrmemfunc): Likewise.
- (expand_ptrmemfunc_cst): Likewise.
-
-1999-04-20 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokfndecl): Always call cplus_decl_attributes.
- * decl2.c (grokfield): Pass attrlist to grokdeclarator.
-
-1999-04-19 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (finish_static_data_member_decl): New function.
- * decl2.c (finish_static_data_member_decl): Split out from ...
- (grokfield): Here.
- * pt.c (instantiate_class_template): Use it here instead of
- trying to fake it.
- (tsubst_decl): Don't set DECL_ASSEMBLER_NAME;
- finish_static_data_member_decl will do that. Explicit set
- DECL_EXTERNAL to match non-template processing.
-
-1999-04-18 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (finish_class_definition): Add parameter.
- * parse.y (structsp): Use it. Don't call pop_scope here.
- * parse.c: Regenerated.
- * semantics.c (finish_class_definition): Pop it here.
+2001-12-16 Joseph S. Myers <jsm28@cam.ac.uk>
-1999-04-17 Mark Mitchell <mark@codesourcery.com>
+ * ChangeLog.1, ChangeLog.2, ChangeLog, NEWS, call.c, class.c,
+ cp-tree.h, decl.c, decl2.c, except.c, operators.def, optimize.c,
+ pt.c, rtti.c, semantics.c, typeck.c: Fix spelling errors.
- * decl.c (xref_tag): Revise handling of nested template
- declarations.
- * pt.c (check_explicit_specialization): Tweak handling of friend
- templates in template classes.
- (tsubst_friend_class): Handle friend declarations for nested
- member template classes.
-
-1999-04-16 Mark Mitchell <mark@codesourcery.com>
-
- * class.c (finish_struct): Remove unused variable.
- (pushclass): Likewise.
- (invalidate_class_lookup_cache): Likewise.
- * cp-tree.def (TYPENAME_TYPE): Improve documentation.
- * decl.c (build_typename_type): Make sure TYPENAME_TYPE_FULLNAME
- doesn't get obliterated.
- (make_typename_type): Handle template classes correctly.
-
- * cp-tree.h (TREE_NONLOCAL_FLAG): Remove.
- (storetags): Declare.
- * class.c (finish_struct): Don't use TREE_NONLOCAL_FLAG.
- (pushclass): Likewise. Use storetags to install tag declarations,
- not pushtag.
- (invalidate_class_lookup_cache): Don't use TREE_NONLOCAL_FLAG.
- * decl.c (storetags): Make it global.
- (push_class_binding): Set INHERITED_VALUE_BINDING_P for an
- implicit typename declaration.
- (pushtag): Tidy. Don't use TREE_NONLOCAL_FLAG.
- * method.c (hack_identifier): Likewise.
- * search.c (lookup_member): Likewise.
-
- * decl.c (warn_about_implicit_typename_lookup): New function.
- (lookup_name_real): Use it. Rework handling of implicit typename
- extension.
+2001-12-15 Joseph S. Myers <jsm28@cam.ac.uk>
-1999-04-15 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (lookup_nested_field): Remove.
- * class.c (push_nested_class): Handle UNION_TYPEs.
- (pop_nested_class): Likewise.
- * decl.c (lookup_name_real): Don't call lookup_nested_field.
- (start_decl): Use push_nested_class, not just pushclass.
- (cp_finish_decl): Use pop_nested_class, not just popclass.
- * search.c (lookup_nested_field): Remove.
-
- * cp-tree.h (lang_type): Add documentation.
- * decl2.c (handle_class_head): Create template declarations here,
- as appropriate.
- * parse.y (class_head): Return whether or not we entered a new
- scope, as well as the type named.
- (named_class_head): Likewise.
- (named_complex_class_head_sans_basetype): Likewise.
- (structsp): Adjust accordingly. Pop scope when required.
- * parse.c: Regenerated.
- * pt.c (check_default_tmpl_args): Robustify.
- (redeclare_class_template): Likewise.
- (instantiate_class_template): An instantiation of an
- anonymous union is itself an anonymous union.
- * semantics.c (begin_class_definition): Don't create template
- declarations here.
-
-1999-04-15 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (after_type_declarator_intern): New nonterminal.
- (after_type_declarator): Use it.
- (direct_after_type_declarator): Likewise. Move above
- nonnested_type to fix reduce/reduce conflict resolution.
- (declmods): Reducing from just 'attributes' has EMPTY precedence.
- * Makefile.in (CONFLICTS): Update.
-
- * decl.c (define_label): Downgrade error for jumping over a
- non-POD decl to pedwarn.
-
-1999-04-14 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (popclass): Change declaration.
- (pop_nested_class): Likewise.
- (poplevel_class): Remove declaration.
- * call.c (convert_default_argument): Pass no arguments to
- popclass.
- * class.c (finish_struct_1): Likewise.
- (finish_struct): Likewise.
- (popclass): Remove argument. Simplify code accordingly.
- (pop_nested_class): Likewise.
- * decl.c (poplevel_class): Declare it here, and make it static.
- (poplevel): Handle class scopes.
- (poplevel_class): Don't take an rgument. Simplify.
- (pop_everything): Pass no arguments to pop_nested_class.
- (cp_finish_decl): Pass no arguments to popclass.
- (grokdeclarator): Pass no arguments to pop_nested_class.
- (finish_function): Likewise.
- * decl2.c (grokfield): Likewise.
- (pop_scope): Pass no arguments to popclass.
- * lex.c (do_pending_defargs): Pass no arguments to pop_nested_class.
- * pt.c (instantiate_class_template): Move call to pushclass, and
- document. Pass no arguments to popclass.
- (regenerate_decl_from_template): Likewise.
-
-1999-04-14 Jason Merrill <jason@yorick.cygnus.com>
+ * lang-options.h: Use American spelling in messages.
- * typeck.c (build_unary_op): Handle taking the address of a unique
- bound non-static member function.
+2001-12-13 Jason Merrill <jason@redhat.com>
-1999-04-13 Martin von Loewis <loewis@informatik.hu-berlin.de>
+ * Make-lang.in (parse.h): Separate rule, just depend on parse.c.
- * lang-options.h (-Wdeprecated): New flag.
- * decl2.c (warn_deprecated): New flag.
- (lang_decode_option): Deprecated this-is-variable,
- external-templates, alt-external-templates.
- Support -Wdeprecated.
- * errfn.c (cp_deprecated): New function.
+ Use cleanups to run base and member destructors.
+ * init.c (push_base_cleanups): New function, split out from...
+ (build_delete): ...here. Lose !TYPE_HAS_DESTRUCTOR code.
+ * decl.c (finish_destructor_body): Move vbase destruction code to
+ push_base_cleanups.
+ (begin_function_body, finish_function_body): New fns.
+ (finish_function): Move [cd]tor handling and call_poplevel to
+ finish_function_body.
+ (pushdecl): Skip the new level.
+ * semantics.c (genrtl_try_block): Don't call end_protect_partials.
+ (setup_vtbl_ptr): Call push_base_cleanups.
+ * method.c (synthesize_method): Call {begin,end}_function_body.
+ * pt.c (tsubst_expr): Handle COMPOUND_STMT_BODY_BLOCK.
+ * cp-tree.h: Declare new fns.
+ * parse.y (function_body, .begin_function_body): New nonterminals.
+ (fndef, pending_inline, function_try_block): Use function_body.
+ (ctor_initializer_opt, function_try_block): No longer has a value.
+ (base_init): Remove .set_base_init token.
+ (.set_base_init, compstmt_or_error): Remove.
+ * Make-lang.in (parse.c): Expect two fewer s/r conflicts.
-1999-04-13 Jason Merrill <jason@yorick.cygnus.com>
+ * optimize.c (maybe_clone_body): Fix parameter updating.
- * decl2.c (setup_initp): Compare DECL_ASSEMBLER_NAME instead
- of the decls themselves.
+2001-12-12 Jason Merrill <jason@redhat.com>
- * pt.c (tsubst_function_type): Copy attributes over.
+ * decl.c (store_parm_decls): Remove parms_have_cleanups cruft.
+ * semantics.c (genrtl_start_function): Don't pass
+ parms_have_cleanups or push an extra binding level.
+ (genrtl_finish_function): Lose cleanup_label cruft.
- * tree.c (cp_valid_lang_attribute): New fn. Handle init_priority
- and com_interface.
- * cp-tree.h: Add prototype.
- * decl.c (init_decl_processing): Set valid_lang_attribute.
+ * cp-tree.h (struct cp_language_function): Remove x_ctor_label.
+ (ctor_label): Remove.
+ * semantics.c (finish_return_stmt): Lose ctor_label support.
+ * decl.c (finish_constructor_body, mark_lang_function): Likewise.
+ * typeck.c (check_return_expr): Check DECL_DESTRUCTOR_P, not
+ dtor_label.
-1999-04-13 Mark Mitchell <mark@codesourcery.com>
+ * call.c (build_new_method_call): Let resolves_to_fixed_type_p
+ check for [cd]tors.
+ * class.c (fixed_type_or_null, case INDIRECT_REF): Fix.
- * class.c (finish_struct_1): Look at the const-ness of the field's
- type, not the TREE_READONLY-ness of the declaration.
- * method.c (synthesize_method): Likewise.
- * pt.c (tsubst_decl): Call c_apply_type_quals_to_decl when
- creating new declarations.
+ * decl.c (finish_function): Check VMS_TARGET, not VMS.
-1999-04-13 Mike Stump <mrs@wrs.com>
+ * decl.c (start_cleanup_fn): Remove redundant pushlevel.
+ (end_cleanup_fn): And poplevel.
- * decl2.c (import_export_decl): Because vtables always reference
- virtual functions, even if they are inlined, don't allow
- -fno-implement-inlines to not emit them, instead, emit them with
- the vtable.
- * decl.c (start_function): Likewise.
+ * semantics.c (setup_vtbl_ptr): Always build a CTOR_INITIALIZER
+ if we're in a template.
-1999-04-12 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h (struct lang_type): Add com_interface.
- (CLASSTYPE_COM_INTERFACE): New macro.
- * class.c (set_rtti_entry): COM interface classes have no RTTI
- entries in their vtables; adjust.
- (add_virtual_function, finish_base_struct, skip_rtti_stuff,
- modify_one_vtable, fixup_vtable_deltas1, override_one_vtable,
- finish_struct_1): Likewise.
- * decl2.c (mark_vtable_entries): Likewise.
- * rtti.c (build_headof, get_tinfo_fn_dynamic): Likewise.
- * search.c (get_abstract_virtuals_1, get_abstract_virtuals,
- expand_upcast_fixups): Likewise.
- * tree.c (debug_binfo): Likewise.
+2001-12-12 Jakub Jelinek <jakub@redhat.com>
- * cp-tree.h (COMPARE_NO_ATTRIBUTES): New macro.
- * typeck.c (comptypes): If we get it, ignore attributes.
- * class.c (instantiate_type): Use BASELINK_P. Change complain
- parameter to flags; 2 means ignore attributes.
- * call.c (build_op_delete_call): Pass it.
+ * cp-tree.h (DESTRUCTOR_DECL_PREFIX, DESTRUCTOR_NAME_P,
+ ANON_PARMNAME_FORMAT, ANON_PARMNAME_P, DESTRUCTOR_NAME_FORMAT,
+ THIS_NAME_P): Delete.
+ * spew.c (read_process_identifier): Remove DESTRUCTOR_NAME_P,
+ THIS_NAME_P and ANON_PARMNAME_P tests from warning about clash
+ with internal naming scheme.
+ * error.c (dump_decl): Remove DESTRUCTOR_NAME_P use.
- * decl.c (xref_tag): Only complain once about using a typedef-name
- with 'struct'. Downgrade to pedwarn.
+2001-12-12 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (grokdeclarator): Allow [] syntax for zero-length array.
+ * decl.c (grokdeclarator): Deprecated implicit typename use.
- * parse.y (absdcl_intern): New nonterminal.
- (absdcl, direct_abstract_declarator): Use it.
+2001-12-11 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (lookup_template_class): Look through implict typename.
+ PR g++/51
+ * parse.y (frob_specs): Indicate it is a language linkage which
+ contained the extern.
+ * decl.c (grokdeclarator): Allow extern language linkage with
+ other specifiers.
-1999-04-11 Mark Mitchell <mark@codesourcery.com>
+2001-12-10 Nathan Sidwell <nathan@codesourcery.com>
- * friend.c (add_friend): Deal gracefully with error_mark_node.
- * method.c (build_overload_value): Handle pointers-to-members as
+ PR g++/72
+ * decl.c (add_binding): Don't reject duplicate typedefs involving
template parameters.
- * decl.c (push_binding): Fix typo in comment.
-
-1999-04-10 Mark Mitchell <mark@codesourcery.com>
-
- * error.c (dump_type_real): If a typename is a template-id, put
- out the template arguments.
- (dump_expr): Handle TEMPLATE_ID_EXPR.
- * pt.c (lookup_template_class): Now that full arguments are
- available everywhere, remove code that tried to guess them.
-
-1999-04-09 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (make_typename_type): Complain if we don't find a type
- when trying to make a typename type for a non-template type.
-
-1999-04-09 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (start_decl): Pass attributes to grokdeclarator.
- (grokdeclarator): Handle attributes on constructor-syntax
- initializers.
-
-1999-04-08 Mark Mitchell <mark@codesourcery.com>
-
- * error.c (dump_expr): Don't crash on INDIRECT_REFs whose operands
- don't have types.
-
- * search.c (template_self_reference_p): Tweak.
-
-1999-04-07 Mark Mitchell <mark@codesourcery.com>
-
- * init.c (build_offset_ref): Don't build yet another weird data
- structure to describe overloaded functions.
-
-1999-04-06 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (BASELINK_P): New macro.
- (SET_BASELINK_P): Likewise.
- * init.c (build_member_call): Remove needless assignment in if
- statement.
- * search.c (lookup_field_r): Fix handling when we are looking
- specifically for a type; these are not hidden by functions and
- variables.
- (lookup_member): Use SET_BASELINK_P.
- * tree.c (is_overloaded_fn): Use BASELINK_P.
- (really_overloaed_fn): Likewise.
- (get_first_fn): Likewise.
-
-1999-04-05 Mark Mitchell <mark@codesourcery.com>
-
- * decl.c (lookup_name_current_level): Tweak, and improve
- documentation.
-
- * class.c (maybe_fixup_vptrs): Remove declaration.
- (build_class_init_list): Likewise.
- * decl.c (pushdecl_class_level): Call check_template_shadow here
- ...
- (push_class_level_binding): ... not here.
- * search.c (dfs_push_type_decls): Only avoid
- template-self-reference TYPE_DECLs if they are from base classes.
-
-1999-04-04 Mark Mitchell <mark@codesourcery.com>
-
- * pt.c (check_template_shadow): Don't treat OVERLOADs as _DECL
- nodes. Tidy.
-
-1999-04-03 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (maybe_fixup_vptrs, build_class_init_list): Lose.
- (finish_struct_1): Don't call build_class_init_list.
-
-1999-04-02 Mark Mitchell <mark@codesourcery.com>
-
- * tinfo.h (__class_type_info): Fix illegal declaration.
-
- * cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
- * cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
- (IDENTIFIER_CLASS_VALUE): Improve documentation.
- (is_properly_derived_from): Declare.
- (invalidate_class_lookup_cache): Likewise.
- (maybe_maybe_note_name_used_in_class): Likewise.
- (note_name_declared_in_class): Likewise.
- (push_using_decl): Remove duplicate declaration.
- (id_in_current_class): Remove declaration.
- (push_class_binding): Change prototype.
- (clear_identitifer_class_values): Declare.
- * call.c (is_properly_derived_from): Make it global.
- (build_new_function_call): Be careful about updating candidates.
- (build_new_method_call): Handle COMPONENT_REFs. Don't crash when
- asked to make illegal calls.
- * class.c: Include splay-tree.h.
- (class_stack_node): Add names_used slot.
- (check_member_decl_is_same_in_complete_scope): Remove.
- (add_method): Fix comment. Push the declaration into class
- scope.
- (finish_struct_1): When popping the class, pop the bindings too.
- Remove check for data member/function member conflict.
- (finish_struct): Remove calls to
- check_member_decl_is_same_in_complete_scope. Change calls to
- popclass.
- (pushclass): Clear names_used in the class stack entry.
- Use invalidate_class_lookup_cache to remove cached entries, rather
- than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
- before entering a new class. Remove dead code. Don't mess with
- current_function_decl when pushing declarations.
- (invalidate_class_lookup_cache): New function, split out from ...
- (popclass): Here. Clean up names_used on our way out.
- (instantiate_type): Adjust.
- (build_self_reference): Don't push the declaration here.
- (maybe_note_name_used_in_class): New function.
- (note_name_declared_in_class): Likewise.
- * decl.c (add_binding): Change prototype.
- (find_class_binding_level): New function.
- (innermost_nonclass_level): Likewise.
- (current_binding_level): Update documentation.
- (inner_binding_level): Remove. Replace with current_binding_level
- throughout.
- (push_binding_level): Remove special handling of
- class_binding_level.
- (pop_binding_level): Likewise. Use find_class_binding_level.
- (suspend_binding_level): Likewise.
- (global_bindings_p): Use innermost_nonclass_level.
- (toplevel_bindings_p): Likewise.
- (namespace_bindings_p): Likewise.
- (pseudo_global_level_p): Likewise.
- (push_binding): Clear INHERITED_VALUE_BINDING_P.
- (add_binding): Check for illegal multiple declarations. Return a
- value indicating whether or not the new binding was legal.
- (push_local_binding): Skip over class binding levels. Check
- return value from add_binding.
- (push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
- note_name_declared_in_class.
- (pushlevel_class): Remove "fake out the rest of the compiler"
- code.
- (poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
- (clear_identifier_class_values): New function.
- (pop_from_top_level): Use it.
- (pop_everything): Tweak.
- (maybe_process_template_type_declaration): Don't push the
- declaration for the template here.
- (pushtag): Don't push tag declarations into class scope here.
- (pushdecl): Apply DeMorgan's law for readability.
- (pushdecl_class_level): Remove special-case code for
- TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
- (push_class_level_bindng): Deal with inherited bindings.
- (lookup_name_real): Remove special-case code for
- TYPE_BEING_DEFINED, and some implicit typename magic.
- (grokdeclarator): Handle COMPONENT_REF for a template function.
- (build_enumerator): Don't call pushdecl_class_level here.
- (id_in_current_class): Remove.
- * decl2.c (grokfield): Don't call pushdecl_class_level or
- check_template_shadow.
- * errfn.c (cp_file_of): Don't declare.
- (cp_line_of): Likewise.
- * error.c (dump_decl): Handle an OVERLOAD.
- (cp_file_of): Likewise.
- (cp_line_of): Likewise.
- * init.c (build_member_call): Handle a COMPONENT_REF.
- * lex.c (do_identifier): Call maybe_note_name_used_in_class, not
- pushdecl_class_level.
- * method.c (hack_identifier): Build COMPONENT_REFs for references
- to member templates as well as member functions. Remove dead
- code.
- * parse.y (left_curly): Remove.
- (nonnested_type): Call maybe_note_name_used_in_class, not
- pushdecl_class_level.
- * parse.c: Regenerated.
- (nested_name_specifier_1): Likewise.
- * pt.c (check_explicit_specialization): Adjust, for robustness.
- (check_template_shadow): Handle OVERLOADs.
- (build_template_decl): Set DECL_CONSTRUCTOR_P on the
- TEMPLATE_DECL, if appropriate.
- * search.c (envelope_add_decl): Remove.
- (dfs_pushdecls): Likewise.
- (dfs_compress_decls): Likewise.
- (dfs_push_decls): New function.
- (dfs_push_type_decls): Likewise.
- (setup_class_bindings): Likewise.
- (template_self_reference_p): Likewise.
- (lookup_field_r): Use it.
- (looup_member): Remove old comment. Deal with ambiguity.
- (push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
- and remove envelope processing.
- * semantics.c (begin_class_definition): Let pushclass push
- declarations for base classes.
- (finish_member_declaration): Push declarations into class scope.
- * typeck.c (build_component_ref): Just put an OVERLOAD into the
- COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
- (build_x_function_call): Deal with OVERLOAD. Handle template-ids.
- * Makefile.in (class.o): Depend on splay-tree.h.
-
-Wed Mar 31 11:30:43 1999 Nathan Sidwell <nathan@acm.org>
-
- * cvt.c (convert_pointer_to_real): Use same_type_p.
- * typeck.c (comp_target_types): Use same_type_p.
-
-1999-03-31 Jason Merrill <jason@yorick.cygnus.com>
-
- * semantics.c (begin_inline_definitions,
- finish_inline_definitions): Rename from finish_default_args and
- begin_inline_definitions, respectively, to something that isn't a
- total lie. :)
- * parse.y (structsp): Adjust.
-
- * tree.c (hash_tree_cons): Remove obsolete via_* parms.
- (list_hash_lookup): Likewise.
- (hash_tree_chain): Adjust.
- * pt.c (tsubst): Adjust.
- (tsubst_arg_types): Use plain hash_tree_cons.
- * cp-tree.h (hash_tree_cons_simple): Lose.
- * parse.y (declmods, nonempty_cv_qualifiers): Use hash_tree_cons.
-
-Wed Mar 31 10:48:29 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (hash.h): Generate using gperf language 'C', not
- 'KR-C', so gperf uses the `const' keyword on strings.
-
- * gxx.gperf (resword): Const-ify a char*.
-
-1999-03-30 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h (IDENTIFIER_AS_DESC, IDENTIFIER_AS_LIST,
- CLASSTYPE_BASELINK_VEC, CLASSTYPE_N_SUPERCLASSES,
- CLASSTYPE_N_BASECLASSES, CLASSTYPE_MAX_DEPTH,
- CLASSTYPE_BASE_INIT_LIST, CLASSTYPE_AS_LIST, CLASSTYPE_ID_AS_LIST,
- CLASSTYPE_BINFO_AS_LIST): Remove cruft.
- * class.c, lex.c, parse.y, ptree.c, search.c, semantics.c,
- tree.c: Adjust.
-
-1999-03-29 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (lang_decode_option): Remove -Wsign-promo from -Wall.
-
-1999-03-28 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (fn_type_unification): Ignore 'this' parm from conversion ops.
-
-1999-03-27 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (add_friend): Declare.
- (add_friends): Likewise.
- * friend.c (add_friend): Make it global. Don't add to
- DECL_BEFRIENDING_CLASSES if the befriending class is a template.
- (add_friends): Make it global.
- (make_friend_class): Don't add to DECL_BEFRIENDING_CLASSES if the
- befriending class is a template.
- * parse.y (component_decl_1): Fix typo in comment.
- * parse.c: Regenerated.
- * pt.c (instantiate_class_template): Use add_friend and
- add_friends rather that duplicating some of their functionality
- here.
-
-1999-03-27 Jason Merrill <jason@yorick.cygnus.com>
+2001-12-10 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * parse.y, semantics.c: Similarly.
+
+2001-12-09 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR g++/87
+ * cp-tree.h (DECL_COPY_CONSTRUCTOR_P): Use copy_fn_p.
+ (copy_args_p): Rename to ...
+ (copy_fn_p): ... here.
+ (grok_special_member_properties): New function.
+ (grok_op_properties): Lose VIRTUALP parameter.
+ (copy_assignment_arg_p): Remove.
+ * call.c (build_over_call): Use copy_fn_p.
+ * decl.c (grokfndecl): Reformat. Adjust call to
+ grok_op_properties.
+ (copy_args_p): Rename to ...
+ (copy_fn_p): ... here. Reject template functions. Check for pass
+ by value.
+ (grok_special_member_properties): Remember special functions.
+ (grok_ctor_properties): Don't remember them here, just check.
+ (grok_op_properties): Likewise.
+ (start_method): Call grok_special_member_properties.
+ * decl2.c (grokfield): Likewise.
+ (copy_assignment_arg_p): Remove.
+ (grok_function_init): Don't remember abstract assignment here.
+ * pt.c (instantiate_class_template): Call
+ grok_special_member_properties.
+ (tsubst_decl): Adjust grok_op_properties call.
- * call.c (build_field_call): Unify 'this' and non-'this' cases.
+2001-12-08 Aldy Hernandez <aldyh@redhat.com>
- * typeck.c (build_indirect_ref): Check for 'this' sooner.
+ * lex.c (rid_to_yy): Add RID_CHOOSE_EXPR and
+ RID_TYPES_COMPATIBLE_P.
-Fri Mar 26 10:20:34 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+2001-12-08 John David Anglin <dave@hiauly1.hia.nrc.ca>
- * call.c (op_error): Const-ify a char*.
- (add_candidate, source_type, add_warning): Add static prototype.
- (print_z_candidates): Const-ify a char*.
+ * semantics.c (simplify_aggr_init_exprs_r): Add DIRECT_BIND flag in
+ call to build_aggr_init.
+ * cp-tree.h (DIRECT_BIND): Document new use of DIRECT_BIND.
- * class.c (resolve_address_of_overloaded_function,
- fixed_type_or_null, build_vtable_entry_ref): Add static prototype.
- (get_vtable_name, finish_struct_1): Const-ify a char*.
+2001-12-08 Neil Booth <neil@daikokuya.demon.co.uk>
- * cvt.c (convert_to_reference): Likewise.
+ * parse.y: Replace uses of the string non-terminal with STRING.
+ Don't perform string concatentaion here.
+ (string): Remove non-terminal.
+ * semantics.c (finish_asm_stmt): Don't concatenate strings here.
- * decl.c (redeclaration_error_message, record_builtin_type,
- record_unknown_type, member_function_or_else, bad_specifiers):
- Likewise.
- (find_binding, select_decl, unqualified_namespace_lookup,
- lookup_flags, qualify_lookup, record_builtin_java_type, tag_name):
- Add static prototype.
- (warn_extern_redeclared_static, duplicate_decls, pushdecl,
- implicitly_declare, record_builtin_java_type, define_function,
- grok_op_properties, tag_name): Const-ify a char*.
-
- * cp-tree.h (FORMAT_VBASE_NAME): Allow parameter `BUF' to be const.
- (define_function, finish_builtin_type): Const-ify a char*.
- (cp_error, cp_error_at, cp_warning, cp_warning_at, cp_pedwarn,
- cp_pedwarn_at, cp_compiler_error, cp_sprintf): Add prototype args.
- (file_name_nondirectory): Const-ify a char*.
- (init_filename_times): Don't prototype.
- (compiler_error): Prototype.
- (yyerror, init_repo): Const-ify a char*.
- (build_srcloc): Don't prototype.
- (build_x_indirect_ref, build_indirect_ref, build_component_addr):
- Const-ify a char*.
- (warn_for_assignment): Don't prototype.
- (convert_for_initialization, readonly_error, check_for_new_type,
- GNU_xref_begin, GNU_xref_file, GNU_xref_ref, GNU_xref_call):
- Const-ify a char*.
-
- * decl2.c (acceptable_java_type, output_vtable_inherit,
- setup_initp, start_objects, finish_objects, do_dtors, do_ctors,
- merge_functions, decl_namespace, validate_nonmember_using_decl,
- do_nonmember_using_decl): Add static prototype.
- (lang_f_options): Const-ify a char*.
- (finish_builtin_type): Likewise.
- (add_function, arg_assoc_namespace, arg_assoc_class): Add static
- prototype.
+2001-12-05 Jason Merrill <jason@redhat.com>
- * errfn.c: Include cp-tree.h.
- (cp_thing): Add static prototype.
- (compiler_error): Don't protoptype.
- (cp_compiler_error): Cast `compiler_error' to `errorfn' before
- passing it to `cp_thing'.
-
- * error.c (interesting_scope_p): Add static prototype.
+ * cp-lang.c (LANG_HOOKS_TREE_INLINING_START_INLINING): Define.
+ (LANG_HOOKS_TREE_INLINING_END_INLINING): Define.
+ * tree.c (cp_start_inlining, cp_end_inlining): New fns.
+ * pt.c (push_tinst_level): No longer static.
+ * cp-tree.h: Declare them.
- * except.c (build_eh_type_type, build_eh_type_type_ref): Const-ify
- a char*.
+ * init.c (resolve_offset_ref): Don't check access for the base
+ conversion to access a FIELD_DECL.
- * init.c (compiler_error): Don't prototype.
- (member_init_ok_or_else): Const-ify a char*.
- (build_java_class_ref): Add static prototype.
+ * cp-tree.h (TYPE_REFFN_P): New macro.
+ * decl.c (bad_specifiers): Check it, too.
- * lex.c (compiler_error): Don't prototype.
- (get_time_identifier, interface_strcmp, extend_token_buffer,
- handle_cp_pragma): Const-ify a char*.
- (is_global, init_filename_times): Add static prototype.
- (file_name_nondirectory, cplus_tree_code_name): Const-ify a char*.
- (compiler_error): Change from fixed args to variable args.
- (yyerror): Const-ify a char*.
+ * rtti.c (create_pseudo_type_info): Set CLASSTYPE_INTERFACE_ONLY
+ on the __*_type_info type if we haven't seen a definition.
- * parse.y (cond_stmt_keyword): Const-ify a char*.
- (parse_decl): Add static prototype.
+2001-12-05 Neil Booth <neil@daikokuya.demon.co.uk>
- * pt.c (template_args_equal, print_template_context): Likewise.
- (print_candidates, check_default_tmpl_args): Const-ify a char*.
- (instantiate_class_template): Likewise.
+ * decl.c: Include c-common.h.
+ (shadow_warning): Move to c-common.c.
- * repo.c (get_base_filename, open_repo_file, init_repo): Likewise.
+Wed Dec 5 17:00:49 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
- * rtti.c (call_void_fn, expand_generic_desc, expand_si_desc,
- expand_class_desc, expand_ptr_desc, expand_attr_desc): Likewise.
+ * decl.c (duplicate_decls): Don't copy DECL_NO_CHECK_MEMORY_USAGE.
- * search.c (lookup_field_info, lookup_member): Likewise.
- (lookup_member): Cast the first argument of `bzero' to a PTR.
+2001-12-04 Nathan Sidwell <nathan@codesourcery.com>
- * sig.c (compiler_error): Don't prototype.
- (build_signature_pointer_or_reference_nam): Const-ify a char*.
- (get_sigtable_name, build_member_function_pointer): Likewise.
+ * pt.c (end_template_parm_list): Clear TREE_CHAIN of each parm.
- * tree.c (compiler_error): Don't prototype.
- (no_linkage_helper, build_srcloc): Add static prototype.
- (build_vbase_pointer_fields): Const-ify a char*.
- (__eprintf): Don't unnecessarily handle `const' when !__STDC__.
+2001-12-04 Nathan Sidwell <nathan@codesourcery.com>
- * typeck.c (compiler_error): Don't prototype.
- (convert_for_assignment): Const-ify a char*.
- (comp_cv_target_types): Add static prototype.
- (build_x_indirect_ref, build_indirect_ref, convert_arguments,
- build_component_addr, build_unary_op, convert_for_initialization):
- Const-ify a char*.
-
- * typeck2.c (ack): Add static prototype and change from fixed args
- to variable args.
- (readonly_error, check_for_new_type): Const-ify a char*.
+ PR g++/164
+ * init.c (sort_base_init): Allow binfos to be directly specified.
+ * method.c (do_build_copy_constructor): Explicitly convert to the
+ base instance.
+ (do_build_assign_ref): Likewise.
- * xref.c (_XREF_FILE, find_file, filename, fctname, declname,
- fixname, open_xref_file, classname, GNU_xref_begin): Likewise.
- (GNU_xref_file): Likewise. Also use `xmalloc' instead of `malloc'.
- (GNU_xref_end_scope, GNU_xref_ref, GNU_xref_decl, GNU_xref_call,
- gen_assign, GNU_xref_member): Const-ify a char*.
+2001-12-03 Hans-Peter Nilsson <hp@bitrange.com>
-1999-03-25 Martin von Löwis <loewis@informatik.hu-berlin.de>
+ * decl.c (xref_basetypes): Don't use C99 construct in tag_code
+ declaration and initialization.
- * gxxint.texi: Remove old discussion on copying virtual bases.
+2001-12-03 Neil Booth <neil@daikokuya.demon.co.uk>
-1999-03-25 Zack Weinberg <zack@rabi.columbia.edu>
+ * typeck2.c: Remove leading capital from diagnostic messages, as
+ per GNU coding standards.
- * Make-lang.in: Remove all references to g++.o/g++.c.
- Link g++ from gcc.o.
+2001-12-03 Mumit Khan <khan@nanotech.wisc.edu>
-1999-03-25 Jason Merrill <jason@yorick.cygnus.com>
+ PR c++/3394
+ * decl.c (xref_basetypes): Handle attributes between
+ 'class' and name.
- * decl2.c (comdat_linkage): Treat vtables like functions.
+2001-12-03 Nathan Sidwell <nathan@codesourcery.com>
-1999-03-25 Mark Mitchell <mark@codesourcery.com>
+ PR g++/3381
+ * parse.y (named_complex_class_head_sans_basetype): Add new
+ reduction.
+ * Make-lang.in (parse.c): Adjust expected conflict count.
- * pt.c (tsubst_decl): tsubst into DECL_BEFRIENDING_CLASSES.
+2001-12-03 Jason Merrill <jason@redhat.com>
-1999-03-25 Nathan Sidwell <nathan@acm.org>
+ * class.c (finish_vtbls): Fill in BINFO_VPTR_FIELD in the
+ immediate binfos for our virtual bases.
- * decl.c (init_decl_processing): Add `signed' type as a synonym
- for `int'.
+2001-12-02 Neil Booth <neil@daikokuya.demon.co.uk>
-1999-03-25 Jason Merrill <jason@yorick.cygnus.com>
+ * call.c (build_java_interface_fn_ref): Similarly.
+ * except.c (is_admissible_throw_operand): Similarly.
+ * init.c (build_java_class_ref): Similarly.
+ * xref.c (open_xref_file): Similarly.
- * typeck.c (common_type): Handle cv-qual unification for pointers
- to members.
+2001-12-01 Neil Booth <neil@daikokuya.demon.co.uk>
- * decl.c (unqualified_namespace_lookup): Return error_mark_node
- on error.
- (lookup_name_real): Set LOOKUP_COMPLAIN when *not* parsing.
- * lex.c (do_identifier): If we got error_mark_node, call
- lookup_name again.
+ * class.c (finish_struct): Remove trailing periods from messages.
+ * decl.c (check_tag_decl): Similarly.
+ * lex.c (cxx_set_yydebug): Similarly.
+ * typeck2.c (friendly_abort): Similarly.
-1999-03-24 Martin von Löwis <loewis@informatik.hu-berlin.de>
+2001-11-29 Mark Mitchell <mark@codesourcery.com>
- * class.c (finish_struct_1): Always reset TYPE_FIELDS for empty
- classes.
+ PR c++/3048
+ * cp-tree.h (ovl_member): Remove.
+ * decl2.c (merge_functions): Handle extern "C" functions
+ specially.
+ * tree.c (ovl_member): Remove.
+
+2001-11-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/4842
+ * class.c (get_basefndecls): Take an IDENTIFIER_NODE, not a
+ FUNCTION_DECL, as input.
+ (mark_overriders): Remove.
+ (warn_hidden): Rework for the new ABI.
+
+2001-11-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/3471
+ * call.c (convert_like_real): Do not build additional temporaries
+ for rvalues of class type.
+
+2001-11-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (UNIQUELY_DERIVED_FROM_P): Use lookup base.
+ (ACCESSIBLY_UNIQUELY_DERIVED_FROM_P): Likewise.
+ (PUBLICLY_UNIQUELY_DERIVED_FROM_P: Likewise.
+ (DERIVED_FROM_P): Likewise.
+ (enum base_access): Renumber, add ba_quiet bit mask.
+ (get_binfo): Remove.
+ (get_base_distance): Remove.
+ (binfo_value): Remove.
+ (ACCESSIBLY_DERIVED_FROM_P): Remove.
+ * call.c (standard_conversion): Use lookup_base.
+ * class.c (strictly_overrides): Likewise.
+ (layout_virtual_bases): Likewise.
+ (warn_about_ambiguous_direct_bases): Likewise.
+ (is_base_of_enclosing_class): Likewise.
+ (add_vcall_offset_vtbl_entries_1): Likewise.
+ * cvt.c (build_up_reference): Adjust comment.
+ * init.c (build_member_call): Reformat.
+ * search.c (get_binfo): Remove.
+ (get_base_distance_recursive): Remove.
+ (get_base_distance): Remove.
+ (lookup_base_r): Tweak.
+ (lookup_base): Add ba_quiet control. Complete the types here.
+ (covariant_return_p): Use lookup_base.
+ * tree.c (binfo_value): Remove.
+ (maybe_dummy_object): Use lookup_base.
+ * typeck.c (build_static_cast): Use lookup_base.
+ (get_delta_difference): Likewise.
+ * typeck2.c (binfo_or_else): Use lookup_base.
+ (build_scoped_ref): Add back error_mark_check.
+ (build_m_component_ref): Use lookup_base.
-1999-03-24 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (lookup_name_real): Do nested field lookup regardless of
- TYPE_BEING_DEFINED.
-
-1999-03-24 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (lang_type): Remove has_assignment and
- has_real_assignment. Add befriending_classes.
- (TYPE_HAS_ASSIGNMENT): Remove.
- (TYPE_HAS_REAL_ASSIGNMENT): Likewise.
- (CLASSTYPE_BEFRIENDING_CLASSES): New macro.
- (lang_decl): Document.
- (DECL_BEFRIENDING_CLASSES): New macro.
- (FRIEND_NAME): Move declaration to more obvious location.
- (FRIEND_DECLS): Likewise.
- * class.c (finish_struct_1): Don't use TYPE_HAS_REAL_ASSIGNMENT.
- * decl.c (duplicate_decls): Copy DECL_BEFRIENDING_CLASSES.
- (fixup_anonymous_union): Don't use TYPE_HAS_ASSIGNMENT.
- (grok_op_properties): Likewise.
- * friend.c (is_friend): Use FRIEND_NAME and FRIEND_DECLS.
- (add_friend): Likewise. Don't do weird things with assignment
- operators. Update DECL_BEFRIENDING_CLASSES.
- (add_friends): Don't do weird things with assignment operators.
- (make_friend_class): Likewise. Update
- CLASSTYPE_BEFRIENDING_CLASSES.
- * pt.c (instantiate_class_template): Don't set
- TYPE_HAS_ASSIGNMENT.
- (tsubst_copy): Substitute the TREE_TYPE for more unary
- expressions.
- * ptree.c (print_lang_type): Don't look at TYPE_HAS_ASSIGNMENT.
- * search.c (protected_accessible_p): New function.
- (friend_accessible_p): Likewise.
- (accessible_p): Use them.
+2001-11-29 Joseph S. Myers <jsm28@cam.ac.uk>
-1999-03-23 Mark Mitchell <mark@codesourcery.com>
+ * Make-lang.in (c++.generated-manpages): New dummy target.
- * pt.c (convert_nontype_argument): Don't create things that aren't
- PTRMEM_CSTs when applying a qualification conversion to a
- PTRMEM_CST.
+Tue Nov 27 09:03:47 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-1999-03-23 Mark Mitchell <mark@codesourcery.com>
+ * Make-lang.in (cp-lang.o): Depends on c-common.h.
+ * cp-lang.c (c-common.h): Include.
+ (LANG_HOOKS_EXPAND_CONSTANT, LANG_HOOKS_SAFE_FROM_P): New hooks.
+ * decl.c (cxx_init_decl_processing): Don't set lang_safe_from_p.
+ * expr.c (init_cplus_expand): Don't set lang_expand_constant.
- * Makefile.in (OBJS): Don't mention hash.o.
- (OBJDEPS): Likewise.
+2001-11-26 Neil Booth <neil@daikokuya.demon.co.uk>
-1999-03-23 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_file): Set at_eof to 2 after expanding ctors.
- * decl.c (expand_static_init): Make sure we don't add any after
- then.
-
- * decl.c (cp_finish_decl): Move intelligence about handling
- DECL_COMDAT for variables from here...
- * decl2.c (comdat_linkage): ...to here.
- (maybe_make_one_only): Tweak.
- (import_export_decl): Call comdat_linkage for variables, too.
- (finish_file): Handle template statics properly.
-
-1999-03-22 Mark Mitchell <mark@codesourcery.com>
-
- * cp-tree.h (TYPE_PTRMEMFUNC_P): Use TYPE_PTRMEMFUNC_FLAG.
- Document internals of pointer-to-member-functions.
- (DELTA2_FROM_PTRMEMFUNC): Make it call delta2_from_ptrmemfunc.
- (PFN_FROM_PTRMEMFUNC): Likewise.
- (build_type_conversion): Remove unused parameter.
- (build_ptrmemfunc1): Declare.
- (expand_ptrmemfunc_cst): New function.
- (delta2_from_ptrmemfunc): Likewise.
- (pfn_from_ptrmemfunc): Likewise.
- * cvt.c (cp_convert_to_pointer): Remove unused parameter to
- build_type_conversion. Use TYPE_PTRMEM_P for readability.
- (convert_to_reference): Remove unused parameter to
- build_type_conversion.
- (ocp_convert): Likewise.
- (build_user_type_conversion): Likewise.
- * error.c (dump_expr): Handle NULL pointer-to-member functions.
- * expr.c (cplus_expand_expr): Handle PTRMEM_CSTs for functions.
- * method.c (build_overload_value): Don't go splitting CONSTRUCTORs
- open when handling pointer-to-member functions.
- * pt.c (convert_nontype_argument): Clean up error messages. Be
- more stringent with pointers-to-members.
- * typeck.c (build_ptrmemfunc1): Don't declare. Make it global.
- (build_unary_op): Tidy ever-so-slightly.
- (build_conditional_expr): Remove extra parameter to
- build_type_conversion.
- (build_ptrmemfunc): Build PTRMEM_CSTs if we know what function
- we're using.
- (expand_ptrmemfunc_cst): Define.
- (delta2_from_ptrmemfunc): Likewise.
- (pfn_from_ptrmemfunc): Likewise.
-
-1999-03-19 Mark Mitchell <mark@codesourcery.com>
-
- * init.c (build_member_call): Handle template-id expressions
- correctly.
- * typeck.c (build_x_function_call): Likewise.
+ * decl2.c (c_language): Move to c-common.c.
+ * lex.c (cxx_post_options, cxx_init_options): Use c-common.c
+ functions.
+ (cxx_init): Update.
-1999-03-19 Chip Salzenberg <chip@perlsupport.com>
+2001-11-26 Jason Merrill <jason@redhat.com>
- * friend.c (make_friend_class): Avoid core dump when
- not-yet-defined friend type lacks TYPE_LANG_SPECIFIC().
+ * call.c (joust): Remove COND_EXPR hack.
-1999-03-18 Jason Merrill <jason@yorick.cygnus.com>
+2001-11-25 Aldy Hernandez <aldyh@redhat.com>
- * decl.c (start_function): Suppress normal linkage heuristics
- for #pragma interface under MULTIPLE_SYMBOL_SPACES.
+ * search.c (lookup_base_r): Declare bk in variable declaration
+ space.
-1999-03-19 Alexandre Oliva <oliva@dcc.unicamp.br>
+2001-11-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR g++/3145
+ * class.c (build_vbase_pointer): Remove.
+ (build_vbase_path): Remove.
+ (build_base_path): New function.
+ * cp-tree.h (base_access, base_kind): New enumerations.
+ (build_base_path): Declare.
+ (convert_pointer_to_real): Remove.
+ (convert_pointer_to): Remove.
+ (lookup_base): Declare.
+ (convert_pointer_to_vbase): Remove.
+ * call.c (build_scoped_method_call): Use lookup_base &
+ build_base_path instead of convert_pointer_to_real,
+ get_base_distance & get_binfo.
+ (build_over_call): Likewise.
+ * cvt.c (cp_convert_to_pointer): Likewise.
+ (convert_to_pointer_force): Likewise.
+ (build_up_reference): Likewise.
+ (convert_pointer_to_real): Remove.
+ (convert_pointer_to): Remove.
+ * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path
+ instead of convert_pointer_to_vbase & build_vbase_path.
+ (emit_base_init): Use build_base_path instead of
+ convert_pointer_to_real.
+ (expand_virtual_init): Lose unrequired conversions.
+ (resolve_offset_ref): Use lookup_base and build_base_path
+ instead of convert_pointer_to.
+ * rtti.c (build_dynamic_cast_1): Use lookup_base &
+ build_base_path instead of get_base_distance & build_vbase_path.
+ * search.c (get_vbase_1): Remove.
+ (get_vbase): Remove.
+ (convert_pointer_to_vbase): Remove.
+ (lookup_base_recursive): New function.
+ (lookup_base): New function.
+ * typeck.c (require_complete_type): Use lookup_base &
+ build_base_path instead of convert_pointer_to.
+ (build_component_ref): Likewise.
+ (build_x_function_call): Likewise.
+ (get_member_function_from_ptrfunc): Likewise.
+ (build_component_addr): Likewise.
+ * typeck2.c (build_scoped_ref): Likewise.
+
+2001-11-22 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
+
+ * cp-tree.h (CP_TYPE_QUALS): Removed.
+ * decl.c (cxx_init_decl_processing): Don't set lang_dump_tree.
+ * cp-lang.c: Set LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN and
+ LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN.
+ * dump.c (cp_dump_tree): Use void* dump_info argument to match
+ lang-hooks prototype.
+ * call.c, cp-tree.h, cvt.c, decl.c, init.c, mangle.c, method.c, pt.c,
+ rtti.c, semantics.c, tree.c, typeck.c, typeck2.c: All references to
+ CP_TYPE_QUALS changed to cp_type_quals.
+ * Make-lang.in: References to c-dump.h changed to tree-dump.h.
+ (CXX_C_OBJS): Remove c-dump.o.
+
+2001-11-21 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/3637
+ * pt.c (lookup_template_class): Ensure that all specializations
+ are registered on the list corresponding to the most general
+ template.
- * Make-lang.in: ($(INTL_TARGETS)): Depend on cp/parse.c.
- ($(srcdir)/cp/parse.c): Moved from ../Makefile.in.
+2001-11-20 Mark Mitchell <mark@codesourcery.com>
-1999-03-17 Martin von Löwis <loewis@informatik.hu-berlin.de>
+ * call.c (non_reference): Add documentation.
+ (convert_class_to_reference): Do not strip reference types
+ from conversion operators.
+ (maybe_handle_ref_bind): Simplify.
+ (compare_ics): Correct handling of references.
- * parse.y (named_complex_class_head_sans_basetype):
- Do not push a scope for error_mark_node.
- (maybe_base_class_list): Likewise.
+2001-11-19 John Wilkinson <johnw@research.att.com>
- * decl.c (start_decl): Check for error_mark_node as a type.
- Detected by g++.brendan/array-refs.C.
- (start_decl_1): Likewise. Detected by g++.bugs/900322_01.C.
- (maybe_build_cleanup_1): Likewise. Detected by
- g++.jason/incomplete1.C.
+ * dump.c (dump_op): New function.
+ (cp_dump_tree): Dump CLASSTYPE_TEMPLATE_SPECIALIZATION. Use
+ dump_op. Dump DECL_MUTABLE, access and staticness for VAR_DECLs.
+ DECL_PURE_VIRTUAL_P, DECL_VIRTUAL_P,
- * tree.c (build_dummy_object): Use void_zero_node instead of the
- error_mark_node.
- (is_dummy_object): Check for such a node.
- Detected by g++.bob/inherit1.C
+2001-11-19 Mark Mitchell <mark@codesourcery.com>
-1999-03-16 Jason Merrill <jason@yorick.cygnus.com>
+ PR4629
+ * semantics.c (finish_sizeof): Make sure that expression created
+ while processing a template do not have a type.
+ (finish_alignof): Likewise.
+ * typeck.c (c_sizeof): Likewise.
+ (expr_sizeof): Likewise.
- * method.c (old_backref_index): Split out...
- (flush_repeats): From here. Rename back from try_old_backref.
- (build_mangled_name): Put back some old-style repeat handling.
+2001-11-18 Neil Booth <neil@daikokuya.demon.co.uk>
-Mon Mar 15 21:57:16 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ * lex.c (cxx_finish): Call c_common_finish.
+ (finish_parse): Remove.
- * lex.c: Don't include setjmp.h.
- (parse_float): New static function.
- (pf_args): New struct.
- (real_yylex): Use them in call to `do_float_handler'.
+2001-11-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-1999-03-15 Mark Mitchell <mark@markmitchell.com>
+ * decl.c (create_array_type_for_decl): Check if NAME is NULL_TREE
+ when displaying error message about missing array bounds.
- * decl.c (xref_basetypes): Set CLASSTYPE_VBASECLASSES here.
- * tree.c (layout_basetypes): Not here.
- * search.c (dfs_search): Remove; no longer used.
+2001-11-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-1999-03-12 Mark Mitchell <mark@markmitchell.com>
+ * mangle.c (write_expression): Handle CAST_EXPR, STATIC_CAST_EXPR,
+ CONST_CAST_EXPR.
+ * operators.def: Add CAST_EXPR, STATIC_CAST_EXPR, CONST_CAST_EXPR.
- * decl2.c (validate_nonmember_using_decl): Issue sensible
- error-messages on bogus qualifiers.
+2001-11-16 Neil Booth <neil@daikokuya.demon.co.uk>
-1999-03-14 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (print_class_statistics): Restore.
- * call.c (add_function_candidate): Fix uninitialized variable.
+2001-11-15 Jason Merrill <jason@redhat.com>
- * Makefile.in (search.o): Add dependency on varray.h.
+ * method.c (use_thunk): Don't emit debugging information for thunks.
-1999-03-13 Jason Merrill <jason@yorick.cygnus.com>
+ * parse.y: Add ... IDENTIFIER SCOPE and ... PTYPENAME SCOPE expansions.
+ * decl.c (make_typename_type): Handle getting a class template.
+ * search.c (lookup_field_r): A class template is good enough for
+ want_type.
- * decl.c (duplicate_decls): Use same_type_p.
- * method.c (try_old_backref): Renamed from flush_repeats. Use
- same_type_p. Don't try to handle repeats. Return success.
- (is_back_referenceable_type): Return 0 if TYPE_FOR_JAVA. Support
- calls from old-style code, too.
- (check_ktype): Use same_type_p.
- (check_btype): Use same_type_p. Don't pull out TYPE_MAIN_VARIANT.
- (build_qualified_name): Simplify logic.
- (process_overload_item): Strip typedefs and quals at the top.
- (build_mangled_name_for_type_with_Gcode): Remove call to
- type_canonical_variant.
- (build_mangled_name): Likewise. Remove support for old-style
- repeats, which have been disabled since 2.7.2. Don't mess with
- TREE_USED.
- (build_decl_overload_real): Don't mess with TREE_USED.
+ * call.c (convert_like_real): Only use cp_convert for the bad part.
+ (standard_conversion): Also allow bad int->enum.
+ * typeck.c (ptr_reasonably_similar): Also allow functions to
+ interconvert. Pointers to same-size integers are reasonably
+ similar.
-1999-03-13 Nathan Sidwell <nathan@acm.org>
+ * cvt.c (convert_to_void): If we build a new COND_EXPR, always
+ give it void type.
- * error.c (cp_printers): Add 'F' escape character.
- (dump_type_real): Remove TREE_LIST (fnargs) printing.
- Functionality moved to dump_parameters.
- (dump_type_suffix): Use dump_parameters and dump_exception_spec.
- (dump_function_decl): Extend meaning of V parameter. Use
- dump_parameters and dump_exception_spec.
- (dump_parameters): New static function.
- (dump_exception_spec): New static function.
- (fndecl_as_string): Change argument semantics. Use
- dump_function_decl directly.
+2001-11-15 Nathan Sidwell <nathan@codesourcery.com>
- * sig.c (build_signature_table_constructor): Use cp_error.
+ PR g++/3154
+ * init.c (sort_base_init): Remove unreachable code.
+ (expand_member_init): Adjust comment to reflect reality. Simplify
+ and remove unreachable code.
-1999-03-13 Martin von Löwis <loewis@informatik.hu-berlin.de>
+2001-11-15 Neil Booth <neil@daikokuya.demon.co.uk>
- * semantics.c (finish_switch_cond): Handle error cases gracefully.
- Detected by g++.law/enum5.C.
+ * cp-tree.h (init_reswords, cxx_init_decl_processing): New.
+ (cxx_init): Update prototype.
+ * decl.c (init_decl_processing): Rename. Move null node init
+ to its creation time.
+ * lex.c (cxx_init_options): Update.
+ (cxx_init): Combine with old init_parse; also call
+ cxx_init_decl_processing.
- * typeck.c (build_modify_expr): Check for errors after resolving
- offsets. Detected by g++.brendan/static1.C.
+2001-11-14 Richard Sandiford <rsandifo@redhat.com>
- * decl.c (complete_array_type): Ignore initial_value if it is an
- error. Detected by g++.benjamin/17930.C.
+ * decl.c (check_initializer): Try to complete the type of an
+ array element before checking whether it's complete. Don't
+ complain about arrays with complete element types but an
+ unknown size.
+ (cp_finish_decl): Build the hierarchical constructor before
+ calling maybe_deduce_size_from_array_init.
- * typeck2.c (process_init_constructor): Return error if one argument
- is in error. Detected by g++.benjamin/13478.C.
+2001-11-14 Joseph S. Myers <jsm28@cam.ac.uk>
-1999-03-12 Martin von Löwis <loewis@informatik.hu-berlin.de>
+ * Make-lang.in: Change all uses of $(manext) to $(man1ext).
- * decl.c (select_decl): Allow class templates when we need types.
- * decl2.c (ambiguous_decl): Likewise.
+2001-11-13 Nathan Sidwell <nathan@codesourcery.com>
-1999-03-12 Mark Mitchell <mark@markmitchell.com>
+ PR g++/4206
+ * parse.y (already_scoped_stmt): Remove.
+ (simple_stmt, WHILE & FOR): Use implicitly_scoped_stmt.
- * lex.c (do_identifier): Correct call to enforce_access.
- * search.c (accessible_p): Tweak comment.
+2001-11-12 H.J. Lu <hjl@gnu.org>
-1999-03-10 Mark Mitchell <mark@markmitchell.com>
+ * cvt.c (ocp_convert): Don't warn the address of a weak
+ function is always `true'.
- * semantics.c (begin_class_definition): Call build_self_reference.
- (finish_member_declaration): Set DECL_CONTEXT for TYPE_DECLs.
+2001-11-09 Neil Booth <neil@daikokuya.demon.co.uk>
- * search.c (assert_canonical_unmarked): Fix typo in prototype.
+ * cp-lang.c (LANG_HOOKS_PRINT_DECL, LANG_HOOKS_PRINT_TYPE,
+ LANG_HOOKS_PRINT_STATISTICS, LANG_HOOKS_PRINT_XNODE,
+ LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_SET_YYDEBUG): Override.
+ * cp-tree.h (print_class_statistics): Remove.
+ (cxx_print_statistics, cxx_print_xnode, cxx_print_decl, cxx_print_type,
+ cxx_print_identifier, cxx_set_yydebug): New.
+ * lex.c (set_yydebug): Rename c_set_yydebug.
+ * ptree.c (print_lang_decl, print_lang_type, print_lang_identifier,
+ lang_print_xnode): Rename.
+ * tree.c (print_lang_statistics): Rename.
- * search.c (dfs_canonical_queue): New function.
- (dfs_assert_unmarked_p): Likewise.
- (assert_canonical_unmarked): Likewise.
- (access_in_type): Use it.
- (accessible_p): Likewise. Walk the whole tree when umarking.
+2001-11-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * sig.c (build_signature_table_constructor): Use accessible_p
- instead of compute_access.
+ * class.c (dump_array): Fix format specifier warning.
-1999-03-09 Jason Merrill <jason@yorick.cygnus.com>
+2001-11-09 Neil Booth <neil@daikokuya.demon.co.uk>
- * call.c (add_builtin_candidates): Handle overloaded conversion ops.
+ * cp-lang.c (LANG_HOOKS_NAME): Override.
+ (struct lang_hooks): Constify.
+ * lex.c (cxx_init_options): Update.
+ (lang_identify): Remove.
+ * parse.y (language_string): Remove.
-1999-03-09 Mark Mitchell <mark@markmitchell.com>
-
- * cp-tree.h (flag_access_control): Declare.
- (TREE_VIA_PPUBLIC): Document.
- (DECL_NONSTATIC_MEMBER_P): New macro.
- (enforce_access): Return an indication of whether or not access
- was permitted.
- (build_self_reference): Change prototype.
- (compute_access): Replace with ...
- (accessible_p): New function.
- (dfs_walk): Change prototype.
- (dfs_unmark): Likewise.
- (markedp): Likewise.
- * call.c (enforce_access): Use accessible_p.
- * class.c (build_self_reference): Insert the declaration into the
- list of members for this type, and make it public.
- * decl.c (xref_basetypes): Avoid ill-timed recursion.
- * init.c (build_offset_ref): Use lookup_member, not three separate
- name-lookups. Call enforce_access rather than checking for
- illegal accesses here.
- (resolve_offset_ref): Likewise.
- * lex.c (do_identifier): Likewise.
- * method.c (hack_identifier): Likewise.
- * parse.y (self_reference): Remove.
- (opt_component_decl_list): Don't use it.
- * parse.c: Regenerated.
- * pt.c (print_candidates): Generalize to handle lists of
- overloaded functions.
- (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's
- not set.
- (get_template_base): Use new calling convention for dfs_walk.
- * search.c: Include varray.h. Add prototypes.
- (dfs_walk): Accept a data pointer to pass to the work functions.
- All callers changed. All work functions changed.
- (breadth_first_search): Rename to bfs_walk, and make consistent
- with dfs_walk.
- (dfs_walk_real): New function.
- (canonical_binfo): New function.
- (context_for_name_lookup): Likewise.
- (shared_marked_p): Likewise.
- (shared_unmarked_p): Likewise.
- (lokup_field_queue_p): Likewise.
- (lookup_field_r): Generalize to handle both functions and fields.
- (lookup_field): Just call lookup_member.
- (lookup_fnfields): Likewise.
- (lookup_member): Move body of lookup_field here and generalize.
- (dfs_accessible_queue_p): Likewise.
- (dfs_accessible_p): Likewise.
- (dfs_access_in_type): Likewise.
- (access_in_type): Likewise.
- (compute_access): Remove, and replace with ...
- (accessible_p): New function.
- (vbase_types): Remove.
- (vbase_decl_ptr_intermediate): Likewise.
- (vbase_decl_ptr): Likewise.
- (vbase_init_result): Likewise.
- (closed_envelopes): Likewise.
- (bvtable): Likewise.
+2001-11-08 Andreas Franck <afranck@gmx.de>
-1999-03-09 Jason Merrill <jason@yorick.cygnus.com>
+ * Make-lang.in (CXX_INSTALL_NAME, GXX_CROSS_NAME,
+ DEMANGLER_CROSS_NAME): Handle program_transform_name the way
+ suggested by autoconf.
+ (GXX_TARGET_INSTALL_NAME, CXX_TARGET_INSTALL_NAME): Define.
+ (c++.install-common): Use the transformed target alias names.
- * call.c (add_function_candidate): Check for proper number of args
- before checking the validity of those args.
+2001-11-06 Neil Booth <neil@cat.daikokuya.demon.co.uk>
-1999-03-06 Jason Merrill <jason@yorick.cygnus.com>
+ * Make-lang.in: Update.
+ * cp-lang.c: Include langhooks-def.h.
- * cp-tree.h (struct lang_type): Add anon_union field.
- (ANON_UNION_TYPE_P): Use it instead of examining type.
- (SET_ANON_UNION_TYPE_P): New macro.
- * decl.c (check_tag_decl): Use it.
+2001-11-04 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * search.c (compute_access): Handle non-type contexts earlier, and
- handle NULL_TREE.
+ * pt.c (tsubst_copy): Call tsubst for TYPEOF_EXPR.
- * tree.c (build_exception_variant): Use copy_to_permanent.
+2001-11-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * decl2.c (setup_initp): Give statics with no priority the default
- priority here.
- (do_dtors, do_ctors, finish_file): Remove special handling of
- non-prioritized statics.
+ * lex.c (copy_lang_type): Add static prototype.
-1999-03-05 Mark Mitchell <mark@markmitchell.com>
+2001-11-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * cp-tree.h (ANON_UNION_TYPE_P): Robustify.
- * decl.c (make_typename_type): Don't issue an error if an
- immediate lookup fails; it migt be resolved later.
- * friend.c (is_friend): Add comment.
- * search.c (breadth_first_search): Add POSTFN and DATA
- parameters. Tidy. All callers changed.
- (lookup_field_queue_p): New function.
- (lookup_field_r): Likewise.
- (lookup_field_post): Likewise.
- (lookup_field): Use them, via breadth_first_search, instead of
- duplicating logic.
- (compute_access): Robustify.
- (lookup_fnfield_info): New structure.
+ * pt.c (unify): Handle SCOPE_REF.
-1999-03-05 Jason Merrill <jason@yorick.cygnus.com>
+2001-11-01 Jakub Jelinek <jakub@redhat.com>
- * pt.c (tsubst, case ARRAY_REF): Use tsubst_expr again.
+ * tree.c (cp_copy_res_decl_for_inlining): Adjust
+ DECL_ABSTRACT_ORIGIN for the return variable.
-1999-03-03 Jason Merrill <jason@yorick.cygnus.com>
+2001-10-31 Zack Weinberg <zack@codesourcery.com>
- * class.c, decl2.c, method.c, pt.c: Add 'static' to make SunOS 4
- cc happy.
+ * Make-lang.in: Replace $(INTL_TARGETS) with po-generated.
- * decl2.c (import_export_class): Also return if
- CLASSTYPE_INTERFACE_ONLY is set.
+2001-10-28 Joseph S. Myers <jsm28@cam.ac.uk>
-1999-03-03 Martin von Löwis <loewis@informatik.hu-berlin.de>
+ * ChangeLog.1, ChangeLog.2, ChangeLog, class.c, decl2.c, search.c,
+ semantics.c, spew.c: Fix spelling errors.
- * decl.c (push_overloaded_decl): Only overwrite the old binding if
- there was one.
- * decl2.c (do_local_using_decl): Fix loop termination.
+2001-10-27 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-1999-03-02 Mark Mitchell <mark@markmitchell.com>
+ * decl2.c (validate_nonmember_using_decl): Handle NAMESPACE_DECL.
- * cp-tree.h (determine_specialization): Don't declare.
- * pt.c (determine_specialization): Make it static. Eliminate
- complain parameter. Note that decl is always non-NULL now, and
- simplify accordingly.
+2001-10-25 Zack Weinberg <zack@codesourcery.com>
- * decl.c (maybe_push_to_top_level): Always call
- push_cp_function_context.
- (pop_from_top_level): Always call pop_cp_function_context.
+ * cp-lang.c: Redefine LANG_HOOKS_CLEAR_BINDING_STACK to
+ pop_everything.
-1999-02-26 Nathan Sidwell <nathan@acm.org>
+Tue Oct 23 14:00:20 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
- * typeck.c (complete_type_or_else): Add VALUE arg, for helpful
- diagnostics.
- * cp-tree.h (complete_type_or_else): Added VALUE parameter.
- * init.c (build_new_1): Extra arg to complete_type_or_else.
- (build_delete): Likewise.
- * typeck.c (require_complete_type): Likewise.
- (pointer_int_sum): Likewise.
- (pointer_diff): Likewise.
- (build_component_ref): Likewise.
+ * cp-lang.c (cxx_get_alias_set): New function.
+ Point LANG_HOOKS_GET_ALIAS_SET to it.
- * typeck2.c (incomplete_type_error): Always use cp_error.
- Show declaration of undefined type, if appropriate.
- Deal with UNKNOWN_TYPE nodes.
-
- * typeck.c (require_complete_type): Use TYPE_SIZE as
- size_zero_node to mean incomplete type.
- (require_complete_type_in_void): New function.
- (build_compound_expr): Call complete_type_in_void for LHS.
- (build_c_cast): Call complete_type_in_void for void cast.
- * cvt.c (ocp_convert): Call complete_type_in_void for void cast.
- * decl.c (cplus_expand_expr_stmt): Void expression checks moved to
- require_complete_type_in_void. Call it.
- * cp-tree.h (require_complete_type_in_void): Prototype new function.
-
- * typeck.c (convert_arguments): Use alternative format for
- function decls. Don't require_complete_type here. Simplify
- diagnostic printing.
- (convert_for_initialization): Don't require_complete_type on RHS yet.
- * call.c (convert_arg_to_ellipsis): Call require_complete_type.
-
- * call.c (build_over_call): Cope with qualified void return type.
- * semantics.c (finish_call_expr): Likewise.
- * typeck.c (build_function_call_real): Likewise.
- (c_expand_return): Likewise.
- * decl2.c (reparse_absdcl_as_expr): Cope with qualified void type.
+2001-10-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * call.c (print_z_candidates): Use alternate print format, to be
- consistent with (pt.c) print_candidates.
- * method.c (hack_identifier): List candidate members.
- * search.c (lookup_field): Build ambiguous list, and show it, if
- ambiguous.
+ * cp-tree.def (UNBOUND_CLASS_TEMPLATE): New tree node.
+ * cp-tree.h (make_unbound_class_template): Prototype new function.
+ * decl.c (make_unbound_class_template): New function.
+ * decl2.c (arg_assoc_template_arg): Handle UNBOUND_CLASS_TEMPLATE.
+ * error.c (dump_type): Likewise.
+ * mangle.c (write_type): Likewise.
+ * parse.y (template_parm): Likewise.
+ (template_argument): Use make_unbound_class_template.
+ * pt.c (convert_template_argument): Handle UNBOUND_CLASS_TEMPLATE.
+ (tsubst): Likewise.
+ (tsubst_copy): Likewise.
+ (unify): Likewise.
+ * tree.c (walk_tree): Likewise.
+ * typeck.c (comptypes): Likewise.
-1999-02-26 Mark Mitchell <mark@markmitchell.com>
+2001-10-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * typeck.c (decay_conversion): Don't confuse constant array
- variables with their initializers.
+ * xref.c (GNU_xref_member): Use safe-ctype macros and/or fold
+ extra calls into fewer ones.
- * decl.c (duplicate_decls): Copy DECL_TEMPLATE_INSTANTIATED when
- merging decls.
- * pt.c (regenerate_decl_from_template): Tweak for clarity.
- (instantiate_decl): Mark a decl instantiated before regenerating
- it to avoid recursion.
- * tree.c (mapcar): Don't call decl_constant_value unless we know
- something is TREE_READONLY_DECL_P.
+2001-10-18 Alexandre Oliva <aoliva@redhat.com>
- * class.c (check_for_override): Don't stop checking when we find
- the first overridden function. Delete #if 0'd code.
- * search.c (get_matching_virtual): Likewise.
+ * decl.c (duplicate_decls): Propagate DECL_UNINLINABLE.
+ Warn when merging inline with attribute noinline.
+ (start_decl, start_function): Warn if inline and attribute
+ noinline appear in the same declaration.
-1999-02-25 Richard Henderson <rth@cygnus.com>
+2001-10-16 H.J. Lu <hjl@gnu.org>
- * lang-specs.h: Define __FAST_MATH__ when appropriate.
+ * cp-tree.h (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): Defined
+ for tree checking disabled.
-1999-02-24 Mike Stump <mrs@wrs.com>
+2001-10-16 Hans-Peter Nilsson <hp@axis.com>
- * typeck.c (convert_for_assignment): Allow boolean integral constant
- expressions to convert to null pointer.
+ * cp-tree.h (VFIELD_NAME_FORMAT) [NO_DOLLAR_IN_LABEL &&
+ NO_DOT_IN_LABEL]: Adjust to match VFIELD_NAME.
-1999-02-24 Martin von Loewis <loewis@informatik.hu-berlin.de>
+2001-10-15 Richard Sandiford <rsandifo@redhat.com>
- * decl.c (lookup_namespace_name): Resolve namespace aliases.
+ * pt.c (UNIFY_ALLOW_MAX_CORRECTION): Define.
+ (unify): Only handle MINUS_EXPR specially if the above flag is set
+ and the subtracted constant is 1. Clear the flag on recursive calls.
+ Set it when unifying the maximum value in an INTEGER_TYPE's range.
- * class.c (push_nested_class): Allow namespaces.
+2001-10-15 Richard Sandiford <rsandifo@redhat.com>
- * decl2.c (set_decl_namespace): Add friendp parameter.
- * decl.c (grokfndecl): Pass it.
- (grokvardecl): Likewise.
- * cp-tree.h: Change declaration.
+ * decl.c (bad_specifiers): Don't allow exception specifications
+ on any typedefs.
-1999-02-24 Jason Merrill <jason@yorick.cygnus.com>
+2001-10-14 Neil Booth <neil@daikokuya.demon.co.uk>
- * pt.c (tsubst): Allow an array of explicit size zero.
+ * cp/lex.c (init_cp_pragma): Similarly.
-1999-02-23 Jason Merrill <jason@yorick.cygnus.com>
+2001-10-13 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * errfn.c: Change varargs code to look like toplev.c.
+ * pt.c (lookup_template_class): Build complete template arguments
+ for BOUND_TEMPLATE_TEMPLATE_PARM.
- * method.c (process_modifiers): Don't prepend 'U' for char or
- wchar_t.
+2001-10-12 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-1999-02-20 Craig Burley <craig@jcb-sc.com>
+ * cp-tree.h (TYPE_BINFO): Update comment.
+ (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK): New macro.
+ (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Use template_info.
+ (TYPENAME_TYPE_FULLNAME): Use TYPE_FIELDS.
+ (copy_type): Prototype new function.
+ * lex.c (copy_lang_decl): Gather tree node statistics.
+ (copy_lang_type): New function.
+ (copy_type): Likewise.
+ (cp_make_lang_type): Create lang_type for
+ BOUND_TEMPLATE_TEMPLATE_PARM. Set TYPE_BINFO for TYPENAME_TYPE
+ and BOUND_TEMPLATE_TEMPLATE_PARM.
+ * pt.c (tsubst): Use copy_type instead of copy_node.
+ * search.c (lookup_field_1): Ignore TYPENAME_TYPE.
- * Make-lang.in (cplib2.ready): Don't consider updating
- cplib2 stuff if the current directory isn't writable, as
- it won't work (such as during a `make install').
+2001-10-12 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-Sun Feb 21 20:38:00 1999 H.J. Lu (hjl@gnu.org)
+ * pt.c (determine_specialization): Ignore functions without
+ DECL_TEMPLATE_INFO.
- * decl2.c (start_objects): Make file scope constructors and
- destructors local to the file if ASM_OUTPUT_CONSTRUCTOR and
- ASM_OUTPUT_DESTRUCTOR are defined.
+2001-10-12 Nathan Sidwell <nathan@codesourcery.com>
-1999-02-19 Mark Mitchell <mark@markmitchell.com>
+ PR g++/4476
+ * typeck2.c (abstract_virtuals_error): Ignore incomplete classes.
- * cp-tree.h (CLASSTYPE_METHOD_VEC): Adjust comment.
- (fn_type_unification): Adjust prototype.
- (lookup_fnfields_1): Declare.
- * call.c (add_template_candidate_real): Adjust call to
- fn_type_unification.
- * class.c (add_method): Don't allow duplicate declarations of
- constructors or destructors.
- (resolve_address_of_overloaded_function): Remove unused variable.
- Adjust call to fn_type_unification.
- * decl.c (grokfndecl): Be more robust in the face of illegal
- specializations.
- * decl2.c (check_classfn): Remove hokey handling of member
- templates.
- * pt.c (determine_specialization): Improve comments. Adjust to
- handle template argument deduction as per the standard.
- (check_explicit_specialization): Fix comment spacing. Handle
- type-conversion operators correctly. Improve error-recovery.
- (fn_type_unification): Remove EXTRA_FN_ARG parameter.
- (get_bindings_real): Simplify handling of static members.
- * search.c (lookup_fnfields_1): Make it have external linkage.
- * typeck.c (compparms): Fix comment.
- (build_unary_op): Don't try to figure out which template
- specialization is being referred to when when the address-of
- operator is used with a template function.
+2001-10-11 Jason Merrill <jason_merrill@redhat.com>
-Thu Feb 18 23:40:01 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ * typeck2.c (store_init_value): Don't re-digest a bracketed
+ initializer.
- * cp-tree.h (lvalue_or_else): Qualify a char* with the `const'
- keyword to match an analogous change at the top level.
+ * class.c (finish_struct_anon): Use TYPE_ANONYMOUS_P instead of
+ ANON_AGGR_TYPE_P.
- * tree.c (lvalue_or_else): Likewise.
+2001-10-11 Richard Henderson <rth@redhat.com>
-1999-02-17 Mark Mitchell <mark@markmitchell.com>
+ * class.c (build_vtable_entry_ref): Create a VTABLE_REF instead
+ of an asm statement.
+ (build_vtbl_ref_1): Split out from build_vtbl_ref.
+ (build_vfn_ref): Use it to handle vtable descriptors before
+ calling build_vtable_entry_ref.
+ * decl2.c (output_vtable_inherit): Use assemble_vtable_inherit.
- * decl.c (xref_basetypes): Comment.
- * pt.c (instantiate_class_template): Use xref_basetypes.
+2001-10-10 Richard Henderson <rth@redhat.com>
-1999-02-16 Mark Mitchell <mark@markmitchell.com>
+ * parse.y (asm_operand): Allow named operands.
+ * semantics.c (finish_asm_stmt): Tweek for changed location
+ of the operand constrant.
- * cp-tree.h (tsubst): Change prototype.
- (tsubst_expr): Likewise.
- (tsubst_copy): Likewise.
- (type_unification): Remove prototype.
- * call.c (convert_default_arg): Adjust call to tsubst_expr.
- * class.c (resolve_address_of_overloaded_function): Just use
- fn_type_unification.
- * decl.c (grokdeclarator): Adjust call to tsubst.
- * method.c (build_template_parm_names): Likewise.
- * pt.c (GTB_VIA_VIRTUAL): New macro.
- (GTB_IGNORE_TYPE): Likewise.
- (resolve_overloaded_unification): Add `complain' parameter.
- (try_one_overload): Likewise.
- (tsubst_template_arg_vector): Likewise.
- (tsubst_template_parms): Likewise.
- (tsubst_aggr_type): Likewise.
- (tsubst_arg_types): Likewise.
- (tsubst_call_declarator_parms): Likewise.
- (unify): Remove explicit_mask.
- (type_unification_real): Likewise.
- (get_template_base_recursive): Likewise.
- (coerce_template_template_parms): Provide prototype.
- (tsubst_function_type): Likewise.
- (try_class_unification): New function.
- All callers changed to use new complain parameter.
- (get_template_base): Use try_class_unification.
- (unify): Adjust handling of classes derived from template types.
- (fn_type_unification): Substitute explicit arguments before
- unification.
+2001-10-09 Jason Merrill <jason_merrill@redhat.com>
-1999-02-16 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
+ * call.c (standard_conversion): Add bad conversion between
+ integers and pointers.
+ (convert_like_real): Don't use convert_for_initialization for bad
+ conversions; complain here and use cp_convert.
+ (build_over_call): Don't handle bad conversions specially.
+ (perform_implicit_conversion): Allow bad conversions.
+ (can_convert_arg_bad): New fn.
+ * cp-tree.h: Declare it.
+ * typeck.c (convert_for_assignment): Use it.
+ (ptr_reasonably_similar): Any target type is similar to void.
- * decl.c (pushdecl): Remove dead code.
+2001-10-08 Alexandre Oliva <aoliva@redhat.com>
-1999-02-16 Jason Merrill <jason@yorick.cygnus.com>
+ * Make-lang.in (CXX_OBJS): Added cp-lang.o.
+ (cp/cp-lang.o): New rule.
+ * cp-tree.h: Declare hooks.
+ * tree.c: Make hooks non-static.
+ (init_tree): Don't initialize hooks here.
+ * lex.c: Likewise. Move definition of lang_hooks to...
+ * cp-lang.c: ... new file.
- * decl2.c (finish_objects): Fix code I missed in previous change.
+2001-10-08 Richard Henderson <rth@redhat.com>
-1999-02-13 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (struct lang_decl_flags): Remove declared_inline.
+ (DECL_DECLARED_INLINE_P): Use the bit in struct c_lang_decl.
- * decl.c (grokfndecl): Return NULL_TREE instead of error_mark_node.
- (grokdeclarator): Don't expect error_mark_node from grokfndecl.
+2001-10-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * pt.c (maybe_process_partial_specialization): Complain about
- 'template <>' on non-specialization.
+ * class.c (build_vtable_entry_ref): Const-ify.
+ * decl.c (predefined_identifier,
+ initialize_predefined_identifiers): Likewise.
+ * init.c (build_new_1): Likewise.
+ * lex.c (cplus_tree_code_type, cplus_tree_code_length, resword):
+ Likewise.
-1999-02-10 Jason Merrill <jason@yorick.cygnus.com>
+2001-10-05 Alexandre Oliva <aoliva@redhat.com>
+
+ * optimize.c (struct inline_data): Moved to ../tree-inline.c.
+ (INSNS_PER_STMT): Likewise.
+ (remap_decl, remap_block, copy_scopy_stmt, copy_body_r): Likewise.
+ (copy_body, initialize_inlined_parameters): Likewise.
+ (declare_return_variable, inlinable_function_p): Likewise.
+ (expand_call_inline, expand_calls_inline): Likewise.
+ (optimize_inline_calls, clone_body): Likewise.
+ * tree.c (walk_tree): Moved to ../tree-inline.c.
+ (walk_tree_without_duplicates): Likewise.
+ (copy_tree_r, remap_save_expr): Likewise.
+
+2001-10-04 Alexandre Oliva <aoliva@redhat.com>
+
+ * Make-lang.in (cp/decl.o, cp/tree.o): Depend on tree-inline.h.
+ (cp/pt.o, cp/semantics.o, cp/optimize.o): Likewise.
+ * cp-tree.h (lang_decl): Moved inlined_fns to tree_decl.
+ (TREE_READONLY_DECL_P, DECL_INLINED_FNS): Moved to ../tree.h.
+ (flag_inline_trees): Moved declaration to ../tree-inline.h.
+ (walk_tree): Moved declaration to ../tree-inline.h.
+ (walk_tree_without_duplicates, copy_tree_r): Likewise.
+ (remap_save_expr): Likewise.
+ * decl.c: Include tree-inline.h.
+ (lang_mark_tree): Don't mark inlined_fns.
+ * decl2.c (flag_inline_trees): Moved defn to ../tree-inline.c.
+ * optimize.c: Include tree-inline.h.
+ (optimize_inline_calls): Move declaration to ../tree.h, as
+ non-static.
+ (remap_decl): Use language-independent constructs and hooks.
+ (remap_block, copy_body_r, declare_return_variable): Likewise.
+ (inlinable_function_p): Likewise. Don't test for
+ DECL_LANG_SPECIFIC before DECL_INLINED_FNS as inlined_fns is
+ no longer language-specific.
+ (optimize_inline_calls): Likewise. Make it non-static. Moved
+ call of dump_function to...
+ (optimize_function): Here...
+ (clone_body): New function, extracted from...
+ (maybe_clone_body): ... here. Build decl_map locally and pass
+ it on to clone_body.
+ * pt.c, semantics.c: Include tree-inline.h.
+ * tree.c: Likewise.
+ (cp_walk_subtrees): New language-specific hook for tree inlining.
+ (cp_cannot_inline_tree_fn, cp_add_pending_fn_decls,
+ cp_is_overload_p, cp_auto_var_in_fn_p,
+ cp_copy_res_decl_for_inlining): Likewise.
+ (walk_tree): Move language-specific constructs into...
+ (cp_walk_subtrees): this new function.
+ (copy_tree_r): Use language-independent constructs and hooks.
+ (init_tree): Initialize tree inlining hooks.
+ (remap_save_expr): Adjust prototype so that the declaration
+ does not require the definition of splay_tree.
- * decl.c (grokdeclarator): Catch wierd declarators.
- * decl2.c (finish_file): Don't abort because of namespace parsing
- failure.
- (check_decl_namespace): Remove.
+2001-10-03 John David Anglin <dave@hiauly1.hia.nrc.ca>
-1999-02-09 Mark Mitchell <mark@markmitchell.com>
+ * rtti.c (get_tinfo_decl): Call typeinfo_in_lib_p with the type used
+ to build the declaration instead of the declaration itself.
- * cp-tree.h (get_template_base): Don't declare.
- (dfs_walk): Declare.
- (dfs_unmark): Likewise.
- (markedp): Likewise.
- * pt.c (unify): Remove duplicate declaration. Pass tparms and
- targs to get_template_base.
- (get_template_base_recursive): Move here from search.c. Check to
- see that the base found can be instantiated to form the desired
- type.
- (get_template_base): Likewise.
- (get_class_bindings): Simplify.
- * search.c (get_template_base_recursive): Move to pt.c.
- (get_template_base): Likewise.
- (markedp): Make it global.
- (dfs_walk): Likewise.
- (dfs_unmark): Likewise.
+2001-10-02 Jason Merrill <jason_merrill@redhat.com>
-1999-02-07 Jason Merrill <jason@yorick.cygnus.com>
+ * decl2.c (cxx_decode_option): Add 'else'.
- * pt.c (maybe_process_partial_specialization): Complain about
- specialization in wrong namespace.
- * tree.c (decl_namespace_context): New fn.
+ * spew.c (end_input): No longer static.
+ * cp-tree.h: Declare it.
+ * parse.y (datadef): Add "error END_OF_SAVED_INPUT" expansion.
-1999-02-06 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
+2001-10-02 Joseph S. Myers <jsm28@cam.ac.uk>
- * decl2.c (arg_assoc_type): Handle TEMPLATE_TEMPLATE_PARM.
- * pt.c (coerce_template_template_parms): Handle nested
- template template parameters.
+ * call.c (build_over_call), typeck.c (build_function_call_real):
+ Pass type attributes to check_function_format rather than name or
+ assembler name. Don't require there to be a name or assembler
+ name to check formats.
-Sat Feb 6 18:08:40 1999 Jeffrey A Law (law@cygnus.com)
+2001-10-02 Joseph S. Myers <jsm28@cam.ac.uk>
- * typeck2.c: Update email addresses.
+ * decl.c (init_decl_processing): Don't call
+ init_function_format_info. Initialize lang_attribute_table
+ earlier.
+ (builtin_function): Call decl_attributes.
+ (insert_default_attributes): New.
-1999-02-04 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
+2001-10-01 Jason Merrill <jason_merrill@redhat.com>
- * pt.c (unify): Call coerce_template_parms with the COMPLAIN flag
- turned off.
+ * decl.c (grokdeclarator): Copy array typedef handling from C
+ frontend.
-1999-02-04 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (grokdeclarator): Copy too-large array handling from C
+ frontend.
- * lex.c (retrofit_lang_decl): Split out...
- (build_lang_decl): From here.
- * decl.c (pushdecl): Call it for functions generated by the middle
- end that don't have DECL_LANG_SPECIFIC.
+2001-09-29 Alexandre Oliva <aoliva@redhat.com>
+
+ * config-lang.in (target_libs): Added target-gperf, so that we
+ don't try to build it if C++ is disabled.
+
+2001-09-23 Zack Weinberg <zack@codesourcery.com>
+
+ * Make-lang.in (CXX_OBJS): Take out cp/errfn.o.
+ (cp/errfn.o): Delete rule.
+ (cp/error.o): Depend on flags.h.
+ * errfn.c: Delete file.
+ * cp-tree.h: Declare warn_deprecated. Remove definitions of
+ TFF_NAMESPACE_SCOPE, TFF_CLASS_SCOPE, TFF_CHASE_NAMESPACE_ALIAS,
+ and TFF_TEMPLATE_DEFAULT_ARGUMENTS. #define cp_error, cp_warning,
+ cp_pedwarn, and cp_compiler_error to error, warning, pedwarn, and
+ internal_error respectively. Make cp_deprecated into a macro.
+ Don't define cp_printer typedef or declare cp_printers.
+ * error.c: Include flags.h.
+ Delete: struct tree_formatting_info, print_function_argument_list,
+ print_declaration, print_expression, print_function_declaration,
+ print_function_parameter, print_type_id, print_cv_qualifier_seq,
+ print_type_specifier_seq, print_simple_type_specifier,
+ print_elaborated_type_specifier, print_rest_of_abstract_declarator,
+ print_parameter_declaration_clause, print_exception_specification,
+ print_nested_name_specifier, and definition of cp_printers.
+ (locate_error): New function.
+ (cp_error_at, cp_warning_at, cp_pedwarn_at): Moved here and
+ rewritten in terms of locate_error and diagnostic.c.
+ (cp_tree_printer): Rename cp_printer; wire up to *_to_string
+ instead of deleted print_* routines. Handle %C, %L, %O, %Q also.
+ (init_error): Adjust to match.
+
+Sat Sep 22 09:15:31 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * Make-lang.in (CXX_C_OBJS): Add attribs.o.
+
+2001-09-21 Richard Henderson <rth@redhat.com>
+
+ * class.c (set_vindex): Mind TARGET_VTABLE_USES_DESCRIPTORS.
+ (build_vtbl_initializer): Likewise.
+ (build_vfn_ref): New.
* cp-tree.h: Declare it.
+ * call.c (build_over_call): Use it.
+ * decl2.c (mark_vtable_entries): Mark FDESC_EXPR.
+ * typeck.c (get_member_function_from_ptrfunc): Mind descriptors.
- * decl2.c: Remove flag_init_priority. Always enable initp stuff.
- (start_objects, finish_objects): Only use special
- init_priority code if the user specified a priority.
- (do_ctors, do_dtors): Use DEFAULT_INIT_PRIORITY for the non-initp
- objects.
+Fri Sep 21 08:16:19 2001 J"orn Rennecke <amylaar@redhat.com>
-Wed Feb 3 22:50:17 1999 Marc Espie <Marc.Espie@liafa.jussieu.fr>
+ * decl.c (grokdeclarator): Use C syntax for attr_flags declaration.
- * Make-lang.in (GXX_OBJS): Remove choose-temp.o, pexecute.o and
- mkstemp.o. Get them from libiberty now.
- (DEMANGLER_PROG): Simlarly, remove getopt.o getopt1.o.
+2001-09-21 Joseph S. Myers <jsm28@cam.ac.uk>
-Tue Feb 2 22:38:48 1999 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
-
- * decl2.c (lang_decode_option): Use read_integral_parameter.
+ Table-driven attributes.
+ * decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
+ * decl2.c (cplus_decl_attributes): Only take one attributes
+ parameter.
+ * cp-tree.c (cplus_decl_attributes): Update prototype.
+ * class.c (finish_struct), decl.c (start_decl, start_function),
+ decl2.c (grokfield), friend.c (do_friend), parse.y
+ (parse_bitfield): Update calls to cplus_decl_attributes.
+ * decl.c (grokdeclarator): Take a pointer to a single ordinary
+ attribute list.
+ * decl.h (grokdeclarator): Update prototype.
+ * decl2.c (grokfield): Take a single ordinary attribute list.
+ * friend.c (do_friend): Likewise.
+ * decl.c (shadow_tag, groktypename, start_decl,
+ start_handler_parms, grokdeclarator, grokparms, start_function,
+ start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
+ parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
+ (process_template_parm, do_decl_instantiation): Pass single
+ ordinary attribute lists around.
+ * decl.c (grokdeclarator): Correct handling of nested attributes.
+ Revert the patch
+ 1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (grokdeclarator): Embedded attrs bind to the right,
+ not the left.
+ .
+ * cp-tree.h (cp_valid_lang_attribute): Remove declaration
+ (cp_attribute_table): Declare.
+ * decl.c (valid_lang_attribute): Don't define.
+ (lang_attribute_table): Define.
+ (init_decl_processing): Initialize lang_attribute_table instead of
+ valid_lang_attribute.
+ * tree.c (cp_valid_lang_attribute): Remove.
+ (handle_java_interface_attribute, handle_com_interface_attribute,
+ handle_init_priority_attribute): New functions.
+ (cp_attribute_table): New array.
+ * decl2.c (import_export_class): Don't use
+ targetm.valid_type_attribute.
+
+2001-09-15 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
+
+ * Make-lang.in (cp/error.o): Depend on real.h
+ * error.c: #include "real.h"
+
+2001-09-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * mangle.c (mangle_conv_op_name_for_type): Use concat in lieu of
+ xmalloc/strcpy/strcat.
+
+2001-09-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl.c (warn_extern_redeclared_static, cp_make_fname_decl):
+ Const-ification.
+ * pt.c (tsubst_decl): Likewise.
+
+2001-09-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl2.c (lang_f_options): Const-ification.
+ * lex.c (cplus_tree_code_name): Likewise.
+ * spew.c (yyerror): Likewise.
+
+2001-09-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/3986
+ * class.c (force_canonical_binfo_r): Check & move an indirect
+ primary base first.
+ (force_canonical_binfo): Check that it's not already
+ canonical.
+ (mark_primary_virtual_base): Remove BINFO parameter.
+ (mark_primary_bases): Adjust, set BINFO_LOST_PRIMARY_P here.
+
+2001-09-06 Nathan Sidwell <nathan@codesourcery.com>
+
+ Remove TYPE_NONCOPIED_PARTS.
+ * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Map onto
+ CLASSTYPE_PURE_VIRTUALS.
+ (TYPE_RAISES_EXCEPTIONS): Map onto TYPE_BINFO.
+ * class.c (duplicate_tag_error): Remove TYPE_NONCOPIED_PARTS.
+ (layout_class_type): Don't call fixup_inline_methods here ...
+ (finish_struct_1): ... call it here.
+
+2001-09-04 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (duplicate_decls): Remove code deadling with
+ DECL_SAVED_INSNS.
+ * decl2.c (finish_file): Likewise.
+ * pt.c (instantiate_decl): Likewise.
+ * semantics.c (expand_body): Don't defer local functions if
+ they wouldn't be deferred for some other reason. Don't
+ generate RTL for functions that will not be emitted.
+ (genrtl_start_function): Remove code deadling with
+ DECL_SAVED_INSNS.
+ (genrtl_finish_function): Likewise.
-1999-02-01 Mark Mitchell <mark@markmitchell.com>
+2001-09-04 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (tsubst, case TYPENAME_TYPE): Check TYPE_BEING_DEFINED
- before calling complete_type_or_else.
+ PR c++/4203
+ * call.c (build_over_call): Do not optimize any empty base
+ construction.
-Mon Feb 1 09:49:52 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+2001-08-31 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * input.c (inline): Don't define, its handled by system.h.
+ * error.c (dump_template_decl): Output template parameters
+ together with their specifiers.
+ Output `class' prefix for template template parameter.
+ (dump_decl): Fix formatting.
-Sun Jan 31 20:34:29 1999 Zack Weinberg <zack@rabi.columbia.edu>
+2001-08-30 Kurt Garloff <garloff@suse.de>
- * decl2.c: Don't define flag_no_ident here. Don't process
- -f(no-)ident here.
- * cp-tree.h: Don't declare flag_no_ident here.
- * lang-specs.h: Map -Qn to -fno-ident.
+ * optimize.c (inlinable_function_p): Allow only smaller single
+ functions. Halve inline limit after reaching recursive limit.
-1999-01-28 Jason Merrill <jason@yorick.cygnus.com>
+2001-08-30 Joern Rennecke <amylaar@redhat.com>
+ Jason Merrill <jason_merrill@redhat.com>
- * cp-tree.h (struct tree_binding): Replace scope field with a union.
- (BINDING_SCOPE): Adjust.
- * decl.c (BINDING_LEVEL): Adjust.
+ * class.c (build_vtable_entry_ref): Subtract in char*, not
+ ptrdiff_t.
-1999-01-26 Jason Merrill <jason@yorick.cygnus.com>
+2001-08-23 Jason Merrill <jason_merrill@redhat.com>
- * pt.c (instantiate_class_template): Set up the DECL_INITIAL of
- member constants.
+ * tree.c (cp_build_qualified_type_real): Use get_qualified_type.
+ (build_cplus_array_type): Use cp_build_qualified_type, not
+ TYPE_MAIN_VARIANT, to get an unqualified version.
- * init.c (expand_member_init): Pull out TYPE_MAIN_VARIANT in
- a ctor initializer.
+ * decl2.c (grok_alignof): Lose.
+ (build_expr_from_tree): Use expr_sizeof and c_alignof_expr.
+ * typeck.c (c_alignof): Lose.
+ * semantics.c (finish_sizeof, finish_alignof): New.
+ * parse.y: Use them.
+ * cp-tree.h: Declare them.
- * tree.c (equal_functions): Fix name in prototype.
+2001-08-22 Jason Merrill <jason_merrill@redhat.com>
- * decl.c (push_local_binding): Add FLAGS argument.
- (pushdecl, push_overloaded_decl): Pass it.
- * decl2.c (do_local_using_decl): Likewise.
- * cp-tree.h: Adjust prototype.
- * decl.c (poplevel): Fix logic.
+ * pt.c (tsubst_expr): Hand off to the TREE_CHAIN of a statement.
+ Don't loop in COMPOUND_STMT, FOR_STMT or TRY_BLOCK.
+ * tree.c (cp_statement_code_p): A TAG_DEFN is a statement.
- * decl.c (push_local_binding): Also wrap used decls in a TREE_LIST.
- (poplevel): Handle that. Fix logic for removing TREE_LISTs.
- (cat_namespace_levels): Don't loop forever.
+2001-08-19 Jakub Jelinek <jakub@redhat.com>
-1999-01-25 Richard Henderson <rth@cygnus.com>
+ * typeck2.c (add_exception_specifier): Only require complete type if
+ not in processing template declaration.
- * typeck.c (build_reinterpret_cast): Fix typo in duplicated test.
+2001-08-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-1999-01-25 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c: Cast argument to size_t, not HOST_WIDE_INT, in calls to
+ GNU_xref_start_scope and GNU_xref_end_scope.
- * class.c (resolve_address_of_overloaded_function): Mark the
- chosen function used.
+ * tree.c (TYPE_HASH): Moved to ../tree.h.
- * call.c (build_call): Make sure that a function coming in has
- been marked used already.
- * decl.c (expand_static_init): Call mark_used instead of
- assemble_external.
- * except.c (call_eh_info, do_pop_exception, expand_end_eh_spec,
- alloc_eh_object, expand_throw): Likewise.
- * init.c (build_builtin_delete_call): Likewise.
- * rtti.c (call_void_fn, get_tinfo_fn, build_dynamic_cast_1,
- expand_si_desc, expand_class_desc, expand_ptr_desc, expand_attr_desc,
- expand_generic_desc): Likewise.
+2001-08-16 Mark Mitchell <mark@codesourcery.com>
-1999-01-25 Martin von Löwis <loewis@informatik.hu-berlin.de>
+ * cvt.c (convert_to_void): Preserve TREE_SIDE_EFFECTS
+ on COMPOUND_EXPRs.
- * tree.c (equal_functions): New function.
- (ovl_member): Call it.
+2001-08-14 Richard Henderson <rth@redhat.com>
-1999-01-24 Jason Merrill <jason@yorick.cygnus.com>
+ * class.c, cp-tree.h (build_vfn_ref): Remove.
+ * call.c, rtti.c: Replace all refernces with build_vtbl_ref.
- * cvt.c (cp_convert_to_pointer): Fix conversion of 0 to pmf.
+2001-08-13 Mark Mitchell <mark@codesourcery.com>
-1999-01-25 Martin von Loewis <loewis@informatik.hu-berlin.de>
+ * call.c (build_over_call): Mark COMPOUND_EXPRs generated for
+ empty class assignment as having side-effects to avoid
+ spurious warnings.
- * decl.c (decls_match): Return 1 if old and new are identical.
- (push_overloaded_decl): Set OVL_USED when PUSH_USING.
+2001-08-13 Zack Weinberg <zackw@panix.com>
-1999-01-24 Jason Merrill <jason@yorick.cygnus.com>
+ * Make-lang.in (cp/except.o): Add libfuncs.h to dependencies.
+ * except.c: Include libfuncs.h.
- * decl.c (start_function): Make member functions one_only on windows.
- * decl2.c (import_export_decl): Likewise.
+2001-08-11 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
- * decl.c (grokdeclarator): Don't complain about implicit int in
- a system header. Change same-name field check to not complain in
- a system header instead of within extern "C".
+ * decl.c (grokdeclarator): Clarify diagnostic message.
-1999-01-21 Mark Mitchell <mark@markmitchell.com>
+2001-08-13 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * cp-tree.h (PUSH_GLOBAL): New macro.
- (PUSH_LOCAL): Likewise.
- (PUSH_USING): Likewise.
- (namespace_bindings_p): Declare.
- (push_overloaded_decl): Likewise.
- * decl.c (push_overloaded_decl): Don't make it static. Check for
- illegal declarations after using declarations here.
- (namespace_bindings_p): Likewise.
- (duplicate_decls): Don't consider declarations from different
- namespaces to be the same.
- (pushdecl): Use symbolic PUSH_ constants in calls to
- push_overloaded_decl.
- (push_overloaded_decl_1): Likewise.
- * decl2.c (validate_nonmember_using_decl): Tweak `std' handling.
- (do_nonmember_using_decl): Check for illegal using declarations
- after ordinary declarations here.
- (do_local_using_decl): Call pushdecl to insert declarations.
+ * decl2.c (do_nonmember_using_decl): Replace using directive
+ with using declaration in the error message.
-1999-01-21 Jason Merrill <jason@yorick.cygnus.com>
+2001-08-11 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * decl.c (grokdeclarator): Fix lang_c -> lang_name_c typo.
+ * pt.c (maybe_fold_nontype_arg): Use TREE_TYPE of ARG as the
+ criterion to avoid rebuilding expression tree instead of
+ processing_template_decl.
-1999-01-21 Mark Mitchell <mark@markmitchell.com>
+2001-08-07 Jason Merrill <jason_merrill@redhat.com>
- * tree.c (build_cplus_array_type_1): Don't call build_array_type
- for types involving template parameters.
+ Support named return value optimization for inlines, too.
+ * decl.c (finish_function): Nullify returns here.
+ * semantics.c (genrtl_start_function): Not here.
+ (cp_expand_stmt): Don't mess with CLEANUP_STMTs.
+ (nullify_returns_r): No longer static. Just clear RETURN_EXPR.
+ Also nullify the CLEANUP_STMT for the nrv.
+ * cp-tree.h: Declare it.
+ * optimize.c (declare_return_variable): Replace the nrv with the
+ return variable.
+ * typeck.c (check_return_expr): Be more flexible on alignment check.
+ Ignore cv-quals when checking for a matching type.
- * cp-tree.h (PARM_DECL_EXPR): Delete.
- (convert_default_arg): Change prototype.
- (check_default_argument): Declare.
- (search_tree): Likewise.
- * call.c (convert_default_arg): Take the function to which the
- default argument belongs as a parameter, and do any necessary
- instantiation here, instead of ...
- (build_over_call): Here.
- * decl.c (local_variable_p): New function.
- (check_default_argument): Likewise, split out and tidied from ...
- (grokparms): Here.
- * error.c (dump_expr): Don't set PARM_DECL_EXPR.
- * pt.c (tsubst_call_declarator_parms): New function.
- (for_each_template_parm): Handle ARRAY_REFs. Do the obvious thing
- with CALL_EXPRs, rather than trying to be clever.
- (tsubst): Use tsubst_call_declarator_parms.
- * tree.c (search_tree): Don't make it static.
- * typeck.c (convert_arguments): Use new interface to
- convert_default_arg.
+2001-08-09 Richard Henderson <rth@redhat.com>
-1999-01-20 Mark Mitchell <mark@markmitchell.com>
+ * decl2.c (finish_objects): Use target hooks instead of
+ assemble_constructor and assemble_destructor.
- * error.c (dump_function_decl): Don't print the argument types for
- a function when the verbosity level is negative.
+2001-08-08 John David Anglin <dave@hiauly1.hia.nrc.ca>
- * call.c (build_over_call): Check format attributes at call-time.
+ * g++spec.c (lang_specific_driver): Quote argument after `-Xlinker'.
- * pt.c (tsubst_copy): Fix comment.
- (unify): Don't allow unification with variable-sized arrays.
+2001-08-07 Nathan Sidwell <nathan@codesourcery.com>
- * semantics.c (finish_stmt_expr): When processing a template make
- the BIND_EXPR long-lived.
+ PR c++/3820
+ Stop using TYPE_NONCOPIED_PARTS.
+ * call.c (build_over_call): Be careful when copy constructing
+ or assigning to an empty class.
+ * class.c (check_bases_and_members): It has a
+ COMPLEX_ASSIGN_REF if it has a vptr.
+ (layout_class_type): Don't add empty class padding to
+ TYPE_NONCOPIED_PARTS.
+ (finish_struct_1): Don't add the VFIELD either.
+ * cp-tree.h (TYPE_HAS_TRIVIAL_INIT_REF): Mention _copy_
+ initialization.
-1999-01-19 Jason Merrill <jason@yorick.cygnus.com>
+2001-08-07 Jason Merrill <jason_merrill@redhat.com>
- * decl2.c (finish_vtable_vardecl): Make vtables comdat here.
- (import_export_vtable): Not here.
+ * tree.c (walk_tree): Walk siblings even if !walk_subtrees.
-1999-01-18 Jason Merrill <jason@yorick.cygnus.com>
+2001-08-06 Richard Henderson <rth@redhat.com>
- * typeck.c (build_component_ref): Wrap an OVERLOAD around a unique
- non-static member function.
+ * decl2.c (finish_objects): Pass a symbol_ref and priority to
+ assemble_{constructor,destructor}. Remove priority handling.
-1999-01-18 Nathan Sidwell <nathan@acm.org>
+2001-08-05 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
- * class.c (instantiate_type): Only diagnose illegal address of member
- function if complaining.
+ Don't allow template-id in using-declaration.
+ * decl2.c (validate_nonmember_using_decl): Handle template-ids.
+ (do_class_using_decl): Likewise.
- * decl.c (lookup_name_real): Remove duplicate code.
+2001-08-04 Neil Booth <neil@cat.daikokuya.demon.co.uk>
-1999-01-18 Jason Merrill <jason@yorick.cygnus.com>
+ * cp/spew.c (read_token): No need to pop buffers.
- * tree.c (copy_template_template_parm): Use permanent_obstack.
+2001-08-02 Stan Shebs <shebs@apple.com>
-1999-01-18 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
+ * cp-tree.h (FNADDR_FROM_VTABLE_ENTRY): Remove, no longer used.
+ (fnaddr_from_vtable_entry): Remove decl.
+ * method.c (use_thunk): Update comment.
- * pt.c (unify): Remove restrictions on deduction of argument
- of template template parameters.
+2001-08-01 Andrew Cagney <ac131313@redhat.com>
-1999-01-18 Nathan Sidwell <nathan@acm.org>
+ * repo.c (get_base_filename): Change return value to const char
+ pointer.
- * rtti.c (build_dynamic_cast_1): Resolve OFFSET_REF exprs.
+2001-08-02 Nathan Sidwell <nathan@codesourcery.com>
- * class.c (resolve_address_of_overloaded_function): Show list of
- all candidates, when none of them match.
+ Kill -fhonor-std.
+ * NEWS: Document.
+ * cp-tree.h (flag_honor_std): Remove.
+ (CPTI_FAKE_STD): Remove.
+ (std_node): Remove comment about it being NULL.
+ (fake_std_node): Remove.
+ * decl.c (in_fake_std): Remove.
+ (walk_namespaces_r): Remove fake_std_node check.
+ (push_namespace): Remove in_fake_std code.
+ (pop_namespace): Likewise.
+ (lookup_name_real): Remove fake_std_node check.
+ (init_decl_processing): Always create std_node. Always add
+ std:: things there.
+ (builtin_function): Always put non '_' fns in std.
+ * decl2.c (flag_honor_std): Remove.
+ (lang_f_options): Remove honor-std.
+ (unsupported_options): Add honor-std.
+ (set_decl_namespace): Remove fake_std_node check.
+ (validate_nonmember_using_decl): Likewise.
+ (do_using_directive): Likewise.
+ (handle_class_head): Likewise.
+ * dump.c (cp_dump_tree): Likewise.
+ * except.c (init_exception_processing): Adjust.
+ * init.c (build_member_call): Remove fake_std_node check.
+ (build_offset_ref): Likewise.
+ * lang-options.h: Remove -fhonor-std, -fno-honor-std.
+ * rtti.c (init_rtti_processing): Adjust.
-1999-01-18 Chip Salzenberg <chip@perlsupport.com>
+2001-07-31 Alexandre Petit-Bianco <apbianco@redhat.com>
- * typeck.c (comp_ptr_ttypes_reinterpret): Per ANSI, tighten up
- definition of 'casting away const' in reinterpret_cast<>.
+ * tree.c (cp_tree_equal): WITH_CLEANUP_EXPR node to use its second
+ operand while calling cp_tree_equal.
-1999-01-18 Graham <grahams@rcp.co.uk>
+2001-07-31 Nathan Sidwell <nathan@codesourcery.com>
- * cvt.c: Add include for decl.h, remove extern for
- static_aggregates which is now provided by decl.h.
+ The 3.0 ABI no longer has vbase pointer fields.
+ * cp-tree.h (VBASE_NAME, VBASE_NAME_FORMAT, VBASE_NAME_P,
+ FORMAT_VBASE_NAME): Remove.
+ * method.c (do_build_copy_constructor): Adjust.
+ (do_build_assign_ref): Adjust.
+ * search.c (lookup_field_r): Adjust.
+ * typeck.c (build_component_ref): Adjust.
- * Makefile.in (cvt.o): Add dependency for decl.h and missing
- dependencies for convert.h and flags.h.
+ The 3.0 ABI always has a vtable pointer at the start of every
+ polymorphic class.
+ * rtti.c (build_headof_sub): Remove.
+ (build_headof): Adjust.
+ (get_tinfo_decl_dynamic): No need to check flag_rtti
+ here. Adjust.
+ (create_real_tinfo_var): Explain why we need a hidden name.
-1999-01-18 Nathan Sidwell <nathan@acm.org>
+2001-07-31 Nathan Sidwell <nathan@codesourcery.com>
- * decl2.c (do_dtors): Set current location to that of the
- decl, for sensible diagnostics and debugging.
- (check_classfn): Issue `incomplete type' error, if
- class is not defined.
+ PR c++/3631
+ * class.c (update_vtable_entry_for_fn): The fixed adjustment
+ of a virtual thunk should be from declaring base.
-1999-01-16 Jason Merrill <jason@yorick.cygnus.com>
+2001-07-31 Nathan Sidwell <nathan@codesourcery.com>
- * cp-tree.h: Add prototype for bound_pmf_p.
+ * class.c (dfs_ctor_vtable_bases_queue_p): Always walk into
+ the shared virtual base, so preserving inheritance graph order.
-1999-01-16 Jason Merrill <jason@yorick.cygnus.com>
- Manfred Hollstein <manfred@s-direktnet.de>
+2001-07-30 Andreas Jaeger <aj@suse.de>
- * decl.c (grokdeclarator): Don't make 'main(){}' an error with only
- -Wreturn-type.
+ * decl2.c: Remove unused var global_temp_name_counter.
-1999-01-16 Nathan Sidwell <nathan@acm.org>
+2001-07-28 Richard Henderson <rth@redhat.com>
- * cp-tree.h (struct lang_type): Added has_mutable flag.
- (CLASSTYPE_HAS_MUTABLE): New macro to access it.
- (TYPE_HAS_MUTABLE_P): New macro to read it.
- (cp_has_mutable_p): Prototype for new function.
- * class.c (finish_struct_1): Set has_mutable from members.
- * decl.c (cp_finish_decl): Clear decl's TREE_READONLY flag, if
- it contains a mutable.
- * typeck.c (cp_has_mutable_p): New function.
+ * method.c (pending_inlines): Remove.
-1999-01-15 Mark Mitchell <mark@markmitchell.com>
+2001-07-27 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (process_template_parm): Ignore top-level qualifiers on
- non-type parameters.
+ * class.c (mark_primary_virtual_base): Don't adjust base
+ offsets here.
+ (dfs_unshared_virtual_bases): Adjust them here.
+ (mark_primary_bases): Explain why we adjust at the end.
- * decl.c (start_function): Use current_function_parms in the call
- to require_complete_type_for_parms, not the probably empty
- DECL_ARGUMENTS.
+2001-07-27 Nathan Sidwell <nathan@codesourcery.com>
-1999-01-14 Jason Merrill <jason@yorick.cygnus.com>
+ * class.c (finish_struct_1): When copying the primary base's
+ VFIELD, make sure we find it is at offset zero.
- * semantics.c (finish_asm_stmt): Don't warn about redundant volatile.
+2001-07-26 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * decl2.c (import_export_class): MULTIPLE_SYMBOL_SPACES only means
- that we don't suppress the other copies.
- * lex.c (handle_cp_pragma): Likewise.
+ * pt.c (tsubst_template_parms): Call maybe_fold_nontype_arg and
+ tsubst_expr for default template arguments.
-1999-01-13 Mark Mitchell <mark@markmitchell.com>
+2001-07-26 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (grokdeclarator): Undo 1998-12-14 change.
- * tree.c (build_cplus_array_type_1): Likewise.
- * pt.c (instantiate_class_template): Remove misleading comment.
- (tsubst_aggr_type): Substitute if there are template parameters,
- regardless of whether or not they use template arguments.
- (unify): Likewise, but for unification.
+ PR c++/3621
+ * spew.c (yylex): Only copy the token's lineno, if it is
+ non-zero.
-1999-01-12 Richard Henderson <rth@cygnus.com>
+2001-07-26 Nathan Sidwell <nathan@codesourcery.com>
- * cp-tree.h (flag_permissive): Declare extern.
+ PR c++/3624
+ * call.c (resolve_args): Simplify, call
+ convert_from_reference.
+ (build_new_op): Resolve and convert from reference ARG1
+ earlier. Adjust ARG2 & ARG3 resolve and conversion.
-1999-01-06 Mark Mitchell <mark@markmitchell.com>
+2001-07-26 Nathan Sidwell <nathan@codesourcery.com>
- * cp-tree.h (IDENTIFIER_TYPENAME_P): Use OPERATOR_TYPENAME_FORMAT
- here.
- (lang_type): Add is_partial_instantiation. Decrease width of
- dummy.
- (PARTIAL_INSTANTIATION_P): New macro.
- (OPERATOR_TYPENAME_P): Remove.
- * decl.c (unary_op_p): Use IDENTIFIER_TYPENAME_P, not
- OPERATOR_TYPENAME_P.
- (grok_op_properties): Likewise.
- * friend.c (do_friend): Handle friends that are member functions
- correctly.
- * lex.c (init_parse): Use OPERATOR_TYPENAME_FORMAT.
- * pt.c (instantiate_class_template): Rework for clarity. Avoid
- leaving TYPE_BEING_DEFINED set in obscure cases. Don't do
- any more partial instantiation than is absolutely necessary for
- implicit typename. Set PARTIAL_INSTANTIATION_P.
- (tsubst_decl): Use IDENTIFIER_TYPENAME_P.
- * semantics.c (begin_class_definition): Handle partial
- specializations of a type that was previously partially
- instantiated.
+ * decl.c (last_function_parm_tags): Remove.
+ (current_function_parm_tags): Remove.
+ (init_decl_processing): Adjust.
+ (start_function): Adjust.
+ (store_parm_decls): Adjust.
-Wed Jan 6 03:18:53 1999 Mark Elbrecht <snowball3@usa.net.
+ PR c++/3152
+ * decl.c (grokdeclarator): Detect when a function typedef is
+ declaring a function, and create last_function_parms correctly.
- * g++spec.c (LIBSTDCXX): Provide default definition.
- (lang_specific_driver): Use LIBSTDCXX instead of "-lstdc++".
+2001-07-25 Jason Merrill <jason_merrill@redhat.com>
-Tue Jan 5 22:11:25 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ * call.c (joust): Only prefer a non-builtin candidate to a builtin
+ one if they have the same signature.
- * Make-lang.in (g++.o): Depend on prefix.h.
+ * cvt.c (build_up_reference): Take DECL parm. Check TREE_STATIC on
+ it rather than toplevel_bindings_p. Give it a mangled name if static.
+ (convert_to_reference): Adjust.
+ * decl2.c (get_temp_name): Lose.
+ * mangle.c (mangle_ref_init_variable): New fn.
+ (mangle_guard_variable): Strip the ref-init header.
+ * cp-tree.h: Adjust.
+ * decl.c (cp_finish_decl): Add the DECL_STMT after processing the
+ initializer.
+ (grok_reference_init): Always use DECL_INITIAL.
-1999-01-04 Jason Merrill <jason@yorick.cygnus.com>
+2001-07-25 Nathan Sidwell <nathan@codesourcery.com>
- * tree.c (bound_pmf_p): New fn.
- * typeck.c (build_c_cast): Use it.
+ PR c++/3416
+ * call.c (build_conditional_expr): Recheck args after
+ conversions.
+ * cp-tree.h (build_conditional_expr): Move to correct file.
+ * typeck.c (decay_conversion): Diagnose any unknown types
+ reaching here.
+ (build_binary_op): Don't do initial decay or default
+ conversions on overloaded functions.
+ (build_static_cast): Don't do a decay conversion here.
+
+2001-07-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/3543
+ * typeck.c (condition_conversion): Resolve an OFFSET_REF.
+ * expr.c (cplus_expand_expr): An OFFSET_REF should never get here.
+
+2001-07-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (build_vtbl_or_vbase_field): Remove, move into ...
+ (create_vtbl_ptr): ... here.
+
+2001-07-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (build_vbase_offset_vbtl_entries): Look for
+ non-primary base of which we are a sub vtable.
+
+2001-07-24 Phil Edwards <pme@sources.redhat.com>
+
+ * semantics.c (finish_this_expr): Remove unused code.
+
+2001-07-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ Simplify rtti, now we've only one ABI.
+ * cp-tree.h (cp_tree_index): Remove CPTI_TINFO_DECL_ID,
+ CPTI_TINFO_VAR_ID.
+ (tinfo_decl_id, tinfo_var_id): Remove.
+ (get_typeid_1): Remove.
+ * rtti.c
+ (init_rtti_processing): Remove tinfo_decl_id & tinfo_var_id.
+ (typeid_ok_p): New function.
+ (build_type_id): Call typeid_ok_p. Don't call tinfo_from_decl.
+ (get_tinfo_decl): Remove old abi documentation.
+ (tinfo_from_decl): Remove.
+ (get_type_id): Call typeid_ok_p. Absorb get_typeid_1.
+ (get_typeid_1): Remove.
+ (get_base_offset): Remove.
+ (synthesize_tinfo_var): Absorb get_base_offset.
+ (create_real_tinfo_var): Don't use tinfo_decl_id.
+
+2001-07-23 Graham Stott <grahams@redhat.com>
+
+ * cp/class.c (type_requires_array_cookie): Fix use of uninitialised
+ variable has_two_argument_delete_p.
+
+2001-07-21 Nathan Sidwell <nathan@codesourcery.com>
+
+ Remove flag_vtable_thunk. It is always on for the 3.0 ABI.
+ * cp-tree.h (CPTI_DELTA2_IDENTIFIER): Remove.
+ (CPTI_INDEX_IDENTIFIER): Remove.
+ (CPT_PFN_OR_DELTA2_IDENTIFIER): Remove.
+ (delta2_identifier): Remove.
+ (index_identifier): Remove.
+ (pfn_or_delta2_identifier): Remove.
+ (flag_vtable_thunks): Remove.
+ (VTABLE_DELTA2_NAME): Remove.
+ (VTABLE_INDEX_NAME): Remove.
+ (FNADDR_FROM_VTABLE_ENTRY): Adjust.
+ (vfunc_ptr_type_node): Adjust.
+ (VTABLE_NAME_PREFIX): Adjust.
+ (build_vfn_ref): Lose first parameter.
+ (fixup_all_virtual_upcast_offsets): Remove.
+ * decl.c (initialize_predefined_identifiers): Remove
+ delta2_identifier, index_identifier, pfn_or_delta2_identifier.
+ (init_decl_processing): Remove no-vtable-thunk code.
+ * decl2.c (flag_vtable_thunks): Remove.
+ (mark_vtable_entries): Remove no-vtable-thunk code.
+ * error.c (dump_decl): Remove no-vtable-thunk code.
+ (dump_expr): Adjust ptr to member function code.
+ * init.c (initialize_vtable_ptrs): Remove no-vtable-thunk
+ code.
+ * rtti.c (build_headof): Remove no-vtable-thunk code.
+ (get_tinfo_decl_dynamic): Adjust build_vfn_ref call.
+ * search.c (get_base_distance): Remove expand_upcast_fixups case.
+ (virtual_context) Remove.
+ (expand_upcast_fixups): Remove.
+ (fixup_virtual_upcast_offsets): Remove.
+ (fixup_all_virtual_upcast_offsets): Remove.
+ * typeck.c (get_member_function_from_ptrfunc): Remove
+ no-vtable-thunk code.
+ * call.c (build_over_call): Adjust call to build_vfn_ref.
+ * class.c (build_vfn_ref): Lose first parameter. Remove
+ no-vtable-thunk code.
+ (build_rtti_vtbl_entries): Remove no-vtable-thunk code.
+ (build_vtable_entry): Remove no-vtable-thunk code.
+
+2001-07-20 Nathan Sidwell <nathan@codesourcery.com>
+
+ Remove old-abi remnants. Remove comments about old abi
+ behaviour. Remove references to 'new-abi' in comments.
+ * cp-tree.h: Adjust comments.
+ (vbase_offsets_in_vtable_p): Delete.
+ (vcall_offsets_in_vtable_p): Delete.
+ (vptrs_present_everywhere_p): Delete.
+ (all_overridden_vfuns_in_vtables_p): Delete.
+ (merge_primary_and_secondary_vtables_p): Delete.
+ (TYPE_CONTAINS_VPTR_P): Adjust.
+ (VTT_NAME_PREFIX): Remove.
+ (CTOR_VTBL_NAME_PREFIX): Remove.
+ (init_vbase_pointers): Remove.
+ * class.c: Adjust coments.
+ (build_vbase_pointer_fields): Delete.
+ (build_vbase_pointer): Remove old-abi code.
+ (build_secondary_vtable): Likewise.
+ (modify_all_vtables): Likewise.
+ (create_vtable_ptr): Likewise.
+ (layout_class_type): Likewise.
+ (finish_struct_1): Likewise.
+ (finish_vtbls): Likewise.
+ (dfs_finish_vtbls): Delete.
+ (build_vbase_offset_vtbl_entries): Remove old-abi code.
+ * cvt.c: Adjust comments.
+ * decl.c: Adjust comments.
+ * decl2.c: Adjust comments.
+ * init.c: Adjust comments.
+ (construct_virtual_bases): Remove old-abi code.
+ * lang-specs.h: Remove -fno-new-abi.
+ * mangle.c: Adjust comments.
+ * rtti.c: Adjust comments.
+ (get_base_offset): Remove old-abi-code.
+ * search.c: Adjust comments.
+ (dfs_init_vbase_pointers): Remove.
+ (dfs_vtable_path_unmark): Remove.
+ (init_vbase_pointers): Remove.
+ * semantics.c: Adjust comments.
+ (emit_associated_thunks): Remove old-abi code.
+ * typeck.c: Adjust comments.
+
+2001-07-20 Daniel Berlin <dan@cgsoftware.com>
+
+ * Make-lang.in (cp/optimize.o): Depend on $(PARAMS_H), not
+ params.h.
+
+2001-07-19 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (finish_struct_anon): Forbid nested classes.
+
+2001-07-19 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * decl2.c: Don't include dwarfout.h and dwarf2out.h.
+ * optimize.c: Include debug.h.
+ (maybe_clone_body): Use debug hook.
+ * semantics.c: Include debug.h.
+ (expand_body): Use debug hook.
+
+2001-07-19 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * spew.c (read_token, yyerror): Remove CPP_INT, CPP_FLOAT cases.
+
+2001-07-18 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (type_requires_array_cookie): New function.
+ (check_methods): Don't try to figure out whether the type needs a
+ cookie here.
+ (check_bases_and_members): Set TYPE_VEC_NEW_USES_COOKIE here.
+ * cp-tree.h (TYPE_VEC_DELETE_TAKES_SIZE): Remove.
+ (TYPE_VEC_NEW_USES_COOKIE): Reimplement.
+ * pt.c (instantiate_class_template): Don't set
+ TYPE_VEC_DELETE_TAKES_SIZE.
+ * NEWS: Document ABI changes from GCC 3.0.
- * decl.c (grok_op_properties): Use same_type_p.
+2001-07-18 Xavier Delacour <xavier@fmaudio.net>,
+ Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
-Tue Dec 22 15:09:25 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ * NEWS (Changes in GCC 3.0): Fix typo.
- * Makefile.in (cvt.o): Depend on toplev.h.
+2001-07-13 Joseph S. Myers <jsm28@cam.ac.uk>
- * cp-tree.h (check_template_shadow, pod_type_p): Add prototypes.
+ * decl2.c (cplus_decl_attributes): Take a pointer to the node to
+ which attributes are to be attached, and a flags argument. Update
+ call to decl_attributes.
+ (grokfield): Update call to decl_attributes.
+ * class.c (finish_struct): Update call to cplus_decl_attributes.
+ * cp-tree.h (cplus_decl_attributes): Update prototype.
+ * decl.c (start_decl, grokdeclarator, start_function): Update
+ calls to decl_attributes and cplus_decl_attributes.
+ * friend.c (do_friend): Update call to cplus_decl_attributes.
+ * parse.y (parse_bitfield): Update call to cplus_decl_attributes.
- * cvt.c: Include toplev.h.
+2001-07-12 Mark Mitchell <mark@codesourcery.com>
- * except.c (get_eh_caught, get_eh_handlers): Hide prototypes and
- definitions.
+ * decl.c (make_rtl_for_nonlocal_decl): Set DECL_C_HARD_REGISTER
+ for `register' variables with an asm-specification.
- * init.c (expand_vec_init): Initialize variable `itype'.
+2001-07-11 Mark Mitchell <mark@codesourcery.com>
- * lex.c (yyerror): Cast the argument passed to a ctype function to
- an unsigned char.
+ * semantics.c (finish_asm_stmt): Mark the output operands
+ to an asm addressable, if necessary.
- * method.c (build_mangled_C9x_name): Wrap prototype and definition
- in "HOST_BITS_PER_WIDE_INT >= 64".
+2001-07-11 Ben Elliston <bje@redhat.com>
- * typeck.c (build_binary_op): Mark parameter `convert_p' with
- ATTRIBUTE_UNUSED.
+ * Revert this change -- there is a subtle bug.
-1998-12-22 Mark Mitchell <mark@markmitchell.com>
+ PR c++/80
+ * decl.c (finish_enum): New "attributes" argument; pass it to
+ cplus_decl_attributes. Use a narrower type if the enum is packed.
+ * cp-tree.h (finish_enum): Adjust prototype.
+ * parse.y (enum_head): New non-terminal.
+ (structsp): Use it. Enums now may be preceded or followed by
+ optional attributes -- pass their chained tree to finish_enum().
+ * pt.c (tsubst_enum): Pass NULL_TREE for the new argument.
- * cp-tree.h (TYPE_RAISES_EXCEPTIONS): Improve documentation.
- * tree.c (build_exception_variant): Don't crash on empty throw
- specs.
+2001-07-10 Mark Mitchell <mark@codesourcery.com>
-1998-12-18 DJ Delorie <dj@cygnus.com>
+ * pt.c (tsubst_decl): Set DECL_CONTEXT for namespace-scope
+ variables.
- * cvt.c (convert_to_reference): Check for both error_mark_node
- and NULL_NODE after call to convert_for_initialization.
+2001-07-10 Jason Merrill <jason_merrill@redhat.com>
-1998-12-17 Jason Merrill <jason@yorick.cygnus.com>
+ * semantics.c (cp_expand_stmt): Fix for null
+ current_function_return_value.
- * error.c (interesting_scope_p): New fn.
- (dump_simple_decl): Use it.
- (dump_expr, case CONSTRUCTOR): Force a & for a PMF.
- (dump_expr, case OFFSET_REF): Print ->* if appropriate.
+2001-07-10 Jan van Male <jan.vanmale@fenk.wau.nl>
-1998-12-16 Mark Mitchell <mark@markmitchell.com>
+ * call.c (build_op_delete_call): Initialize fn.
+ (convert_like_real): Delete conditional.
+ (joust): Initialize *w and *l.
+ * class.c: Add prototype for binfo_ctor_vtable.
+ (get_primary_binfo): Initialize result.
+ * init.c (build_java_class_ref): Initialize name.
- * class.c (resolve_address_of_overloaded_function): Do conversion
- to correct type here, rather than ...
- (instantiate_type): Here.
+2001-07-09 Erik Rozendaal <dlr@acm.org>
- * cp-tree.h (DECL_TEMPLATE_PARM_P): New macro.
- (DECL_TEMPLATE_TEMPLATE_PARM_P): Use it.
- (decl_template_parm_p): Remove.
- * decl.c (pushdecl): Don't set DECL_CONTEXT for a template
- parameter.
- * lex.c (do_identifier): Use DECL_TEMPLATE_PARM_P.
- * pt.c (push_inline_template_parms_recursive): Set it.
- (decl_template_parm_p): Remove.
- (check_template_shadow): Use DECL_TEMPLATE_PARM_P.
- (process_template_parm): Set it.
+ * typeck.c (unary_complex_lvalue): Do not duplicate the
+ argument to modify, pre-, or post-increment when used as an
+ lvalue and when the argument has side-effects.
-Wed Dec 16 16:33:58 1998 Dave Brolley <brolley@cygnus.com>
+2001-07-08 Joseph S. Myers <jsm28@cam.ac.uk>
- * lang-specs.h (default_compilers): Pass -MD, -MMD and -MG to cc1plus
- if configured with cpplib.
+ * decl.c (start_decl): Don't call SET_DEFAULT_DECL_ATTRIBUTES.
+ (start_function): Don't call SET_DEFAULT_DECL_ATTRIBUTES. Call
+ cplus_decl_attributes even if attrs is NULL.
+ * friend.c (do_friend): Don't call SET_DEFAULT_DECL_ATTRIBUTES.
-1998-12-15 Mark Mitchell <mark@markmitchell.com>
+2001-07-08 Joseph S. Myers <jsm28@cam.ac.uk>
- * decl.c (poplevel): Make sure ns_binding is initialized.
+ * decl.c (grokdeclarator), decl2.c (cplus_decl_attributes): Update
+ calls to decl_attributes.
- * decl.c (finish_function): Undo inadvertent change in previous
- patch.
+2001-07-06 Ira Ruben <ira@apple.com>
-1998-12-14 Mark Mitchell <mark@markmitchell.com>
+ * cp-tree.def (TEMPLATE_DECL): Update comment. DECL_RESULT should
+ be DECL_TEMPLATE_RESULT.
- * class.c (pushclass): Tweak handling of class-level bindings.
- (resolve_address_of_overloaded_function): Update pointer-to-member
- handling.
- (instantiate_type): Likewise.
- * cvt.c (cp_convert_to_pointer): Likewise.
- * decl.c (pop_binding): Take the DECL to pop, not just the name.
- Deal with `struct stat' hack.
- (binding_level): Add to documentation.
- (push_binding): Clear BINDING_TYPE.
- (add_binding): New function.
- (push_local_binding): Use it.
- (push_class_binding): Likewise.
- (poplevel): Adjust calls to pop_binding.
- (poplevel_class): Likewise.
- (pushdecl): Adjust handling of TYPE_DECLs; add bindings for hidden
- declarations to current binding level.
- (push_class_level_binding): Likewise.
- (push_overloaded_decl): Adjust handling of OVERLOADs in local
- bindings.
- (lookup_namespace_name): Don't crash when confronted with a
- TEMPLATE_DECL.
- (lookup_name_real): Do `struct stat' hack in local binding
- contexts.
- (build_ptrmemfunc_type): Adjust documentation.
- (grokdeclarator): Don't avoid building real array types when
- processing templates unless really necessary.
- (finish_method): Adjust calls to pop_binding.
- * decl2.c (reparse_absdcl_as_expr): Recursively call ourselves,
- not reparse_decl_as_expr.
- (build_expr_from_tree): Deal with a template-id as the function to
- call in a METHOD_CALL_EXPR.
- * pt.c (convert_nontype_argument): Tweak pointer-to-member handling.
- (maybe_adjust_types_For_deduction): Don't do peculiar things with
- METHOD_TYPEs here.
- (resolve_overloaded_unification): Handle COMPONENT_REFs. Build
- pointer-to-member types where necessary.
- * tree.c (build_cplus_array_type_1): Don't avoid building real
- array types when processing templates unless really necessary.
- (build_exception_variant): Compare the exception lists correctly.
-
-1998-12-13 Mark Mitchell <mark@markmitchell.com>
-
- * cp-tree.def (CPLUS_BINDING): Update documentation.
- * cp-tree.h (LOCAL_BINDING_P): New macro.
- (lang_identifier): Rename local_value to bindings.
- (tree_binding): Make `scope' of type `void*', not `tree'.
- (BINDING_SCOPE): Update documentation.
- (IDENTIFIER_LOCAL_VALUE): Remove.
- (IDENTIFIER_CLASS_VALUE): Document.
- (IDENTIFIER_BINDING): New macro.
- (IDENTIFIER_VALUE): Likewise.
- (TIME_IDENTIFIER_TIME): Likewise.
- (TIME_IDENTIFIER_FILEINFO): Likewise.
- (IMPLICIT_TYPENAME_P): Likewise.
- (set_identifier_local_value): Remove.
- (push_local_binding): New function.
- (push_class_binding): Likewise.
- * class.c (pushclass): Update comments; use push_class_binding.
- * decl.c (set_identifier_local_value_with_scope): Remove.
- (set_identifier_local_value): Likewise.
- (push_binding): New function.
- (pop_binding): Likewise.
- (binding_level): Update documentation. Remove shadowed.
- (BINDING_LEVEL): New macro.
- (free_binding_nodes): New variable.
- (poplevel): Adjust for new name-lookup scheme. Don't mess up
- BLOCK_VARs when doing for-scope extension. Remove effectively
- dead code.
- (pushlevel_class): Tweak formatting.
- (poplevel_class): Adjust for new name-lookup scheme.
- (print_binding_level): Likewise.
- (store_bindings): Likewise.
- (pushdecl): Likewise.
- (pushdecl_class_level): Likewise.
- (push_class_level_binding): Likewise.
- (push_overloaded_decl): Update comments. Adjust for new
- name-lookup scheme.
- (lookup_name_real): Likewise.
- (lookup_name_current_level): Likewise.
- (cp_finish_decl): Likewise.
- (require_complete_types_for_parms): Likewise. Remove misleading
- #if 0'd code.
- (grok_parms): Likewise. Don't call
- require_complete_types_for_parms here.
- (grok_ctor_properties): Don't treat templates as copy
- constructors.
- (grop_op_properties): Or as assignment operators.
- (start_function): Document. Adjust for new name-lookup scheme.
- (finish_function): Likewise.
- * decl2.c (do_local_using_decl): Use push_local_binding.
- * lex.c (begin_definition_of_inclass_inline): New function, split
- out from ...
- (do_pending_inlines): Here, and ...
- (process_next_inline): Here.
- (get_time_identifier): Use TIME_IDENTIFIER_* macros.
- (init_filename_times): Likewise.
- (extract_interface_info): Likewise.
- (ste_typedecl_interface_info): Likewise.
- (check_newline): Likewise.
- (dump_time_statistics): Likewise.
- (handle_cp_pragma): Likewise.
- (do_identifier): Adjust for new name-lookup scheme.
- * parse.y (function_try_block): Return ctor_initializer_opt value.
- (fndef): Use it.
- (fn.defpen): Pass appropriate values to start_function.
- (pending_inline): Use functor_try_block value, and pass
- appropriate values to finish_function.
- * pt.c (is_member_template): Update documentation; remove handling
- of FUNCTION_DECLs. As per name, this function should deal only in
- TEMPLATE_DECLs.
- (decl_template_parm_p): Change name of olddecl parameter to decl.
- (check_template_shadow): Adjust for new name-lookup scheme.
- (lookup_template_class): Likewise.
- (tsubst_decl): Tweak so as not to confuse member templates with
- copy constructors and assignment operators.
- (unify): Handle UNION_TYPEs.
- * ptree.c (print_lang_identifier): Adjust for new name-lookup scheme.
- (lang_print_xnode): Adjust for new name-lookup scheme.
- * typeck.c (mark_addressable): Likewise.
- (c_expand_return): Likewise.
+2001-07-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-1998-12-08 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (copy_template_template_parm): Rename to ...
+ (bind_template_template_parm): ... here.
+ * tree.c (copy_template_template_parm): Rename to ...
+ (bind_template_template_parm): ... here. Remove the case when
+ NEWARGS is NULL_TREE.
+ (copy_tree_r): Don't copy TEMPLATE_TEMPLATE_PARM and
+ BOUND_TEMPLATE_TEMPLATE_PARM.
+ * pt.c (lookup_template_class): Adjust.
- * decl.c (grokdeclarator): Allow field with same name as class
- in extern "C".
+2001-07-05 Jason Merrill <jason_merrill@redhat.com>
- * decl.c (lookup_name_real): Don't limit field lookup to types.
- * class.c (check_member_decl_is_same_in_complete_scope): No error
- if icv and x are the same.
- * lex.c (do_identifier): Tweak error message.
+ * cvt.c (convert_lvalue): New fn.
+ * cp-tree.h: Declare it.
+ * method.c (do_build_assign_ref): Use it.
+ (do_build_copy_constructor): Convert parm to base types
+ before calling base constructors.
-1998-12-10 Mark Mitchell <mark@markmitchell.com>
+ * typeck.c (check_return_expr): Check DECL_ALIGN instead of
+ DECL_USER_ALIGN. Check flag_elide_constructors instead of
+ optimize.
+ * semantics.c (cp_expand_stmt): Don't destroy the named return value.
- * decl.c (start_enum): Use push_obstacks, not
- end_temporary_allocation.
- (finish_enum): Call pop_obstacks.
+2001-07-02 Nathan Sidwell <nathan@codesourcery.com>
-1998-12-10 Mark Mitchell <mark@markmitchell.com>
+ * optimize.c (optimize_inline_calls): New function, broken out
+ of ...
+ (optimize_function): ... here. Call it. Don't inline if it is
+ a thunk.
+ (dump_function): Print name of dump flag causing this dump.
+ * semantics.c (expand_body): Move thunk inline check to
+ optimize_function.
- * class.c (instantiate_type): Return error_mark_node rather than
- junk.
+2001-06-29 Joseph S. Myers <jsm28@cam.ac.uk>
-1998-12-09 Mark Mitchell <mark@markmitchell.com>
+ * typeck.c (COMP_TYPE_ATTRIBUTES): Don't define.
+ (comptypes): Use target.comp_type_attributes.
- * cp-tree.h (most_specialized_instantiation): New function.
- (print_candidates): Likewise.
- * class.c (validate_lhs): Remove.
- (resolve_address_of_overloaded_function): New function, split out
- and then substantially reworked, from ...
- (instantiate_type): Use it. Simplify.
- * cvt.c (convert_to_reference): Complain when caller has indicated
- that's the right thing to do. Don't crash if instantiate_type
- fails.
- * pt.c: Substitute `parameters' for `paramters' throughout.
- (print_candidates): Don't make it static.
- (most_specialized_instantiation): Split out from ...
- (most_specialized): Here.
+2001-06-29 Nathan Sidwell <nathan@codesourcery.com>
-Wed Dec 9 15:33:01 1998 Dave Brolley <brolley@cygnus.com>
+ * cp-tree.h (flag_dump_class_layout): Remove unneeded declaration.
- * lex.c (lang_init_options): Initialize cpplib.
- * decl2.c (parse_options,cpp_initialized): Removed.
- (lang_decode_option): Move initialization of cpplib to
- lang_init_options.
+2001-06-28 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
-1998-12-09 Mark Mitchell <mark@markmitchell.com>
+ * error.c (lang_print_error_function): Add a `diagnostic_context *'
+ parameter. Tweak.
- * decl.c (grokdeclarator): Update the name of the TEMPLATE_DECL, as
- well as the TYPE_DECL, when a typedef name is assigned to a
- previously anonymous type.
+2001-06-27 Neil Booth <neil@cat.daikokuya.demon.co.uk>
-1998-12-08 Andrew MacLeod <amacleod@cygnus.com>
+ * decl2.c (import_export_class): Update.
- * cp/except.c (call_eh_info): Use __start_cp_handler instead of
- __cp_eh_info for getting the eh info pointer. Add table_index to
- field list.
- (push_eh_cleanup): Don't increment 'handlers' data field.
- (process_start_catch_block): Don't set the 'caught' field.
+2001-06-26 Gabriel Dos Reis <gdr@codesourcery.com>
- * cp/exception.cc (CP_EH_INFO): New macro for getting the
- exception info pointer within library routines.
- (__cp_eh_info): Use CP_EH_INFO.
- (__start_cp_handler): Get exception info pointer, set caught field,
- and increment the handlers field. Avoids this being done by handlers.
- (__uncatch_exception, __check_eh_spec): Use CP_EH_INFO macro.
- (uncaught_exception): Use CP_EH_INFO macro.
+ * error.c (init_error): Adjust settings.
-Tue Dec 8 10:48:21 1998 Jeffrey A Law (law@cygnus.com)
+2001-06-26 Gabriel Dos Reis <gdr@codesourcery.com>
- * Make-lang.in (cxxmain.o): Depend on $(DEMANGLE_H), not demangle.h
+ * error.c (init_error): Adjust settings.
-Mon Dec 7 17:56:06 1998 Mike Stump <mrs@wrs.com>
+2001-06-19 Richard Sandiford <rsandifo@redhat.com>
- * lex.c (check_newline): Add support for \ as `natural'
- characters in file names in #line to be consistent with #include
- handling. We support escape processing in the # 1 "..." version of
- the command. See also support in cp/lex.c.
+ * except.c (initialize_handler_parm): Expect __cxa_begin_catch to
+ return pointers to data members by reference rather than by value.
-1998-12-07 Zack Weinberg <zack@rabi.phys.columbia.edu>
+2001-06-18 Jason Merrill <jason_merrill@redhat.com>
- * cp/decl2.c: s/data/opts/ when initializing cpp_reader
- structure.
+ Implement the Named Return Value optimization.
+ * cp-tree.h (struct cp_language_function): Add x_return_value.
+ (current_function_return_value): Now a macro.
+ * decl.c: Don't define it.
+ (define_label, finish_case_label): Don't clear it.
+ (init_decl_processing): Don't register it with GC.
+ * semantics.c (genrtl_finish_function): Don't check it for
+ no_return_label. Copy the RTL from the return value to
+ current_function_return_value and walk, calling...
+ (nullify_returns_r): ...this new fn.
+ * typeck.c (check_return_expr): Set current_function_return_value.
-1998-12-07 Jason Merrill <jason@yorick.cygnus.com>
+2001-06-15 Jason Merrill <jason_merrill@redhat.com>
- * decl.c (build_typename_type): Set DECL_ARTIFICIAL.
+ * class.c (dfs_accumulate_vtbl_inits): Just point to the base we're
+ sharing a ctor vtable with. Merge code for cases 1 and 2.
+ (binfo_ctor_vtable): New fn.
+ (build_vtt_inits, dfs_build_secondary_vptr_vtt_inits): Use it.
- * error.c (dump_simple_decl): Also print namespace context.
- (dump_function_decl): Likewise.
+2001-06-14 Jason Merrill <jason_merrill@redhat.com>
- * decl2.c (ambiguous_decl): Don't print old value if it's
- error_mark_node.
+ * class.c (dfs_find_final_overrider): Fix logic.
- * decl.c (lookup_name_real): Fix handling of local types shadowed
- by a non-type decl. Remove obsolete code.
- * cp-tree.h (DECL_FUNCTION_SCOPE_P): New macro.
+ * class.c (update_vtable_entry_for_fn): Uncomment optimization to use
+ virtual thunk instead of non-virtual.
+ (get_matching_virtual): Uncomment.
- * lang-options.h: Add -fpermissive.
- * decl2.c: Likewise.
- * cp-tree.h: Add flag_permissive.
- * decl.c (init_decl_processing): If neither -fpermissive or -pedantic
- were specified, set flag_pedantic_errors.
- * call.c (build_over_call): Turn dropped qualifier messages
- back into pedwarns.
- * cvt.c (convert_to_reference): Likewise.
- * typeck.c (convert_for_assignment): Likewise.
+ * pt.c (unify): Don't recurse between the POINTER_TYPE and the
+ OFFSET_TYPE. If we're adding cv-quals, the extra ones would be on
+ PARM, not ARG.
-1998-12-05 Jason Merrill <jason@yorick.cygnus.com>
+2001-06-14 Nathan Sidwell <nathan@codesourcery.com>
- * decl2.c (coerce_new_type): Use same_type_p.
- (coerce_delete_type): Likewise.
+ * class.c (dfs_accumulate_vtbl_inits): For case 2 & 3, make sure
+ we've not emerged from the hierarchy of RTTI_BINFO on reaching
+ a non-virtual base.
- * call.c (check_dtor_name): Return 1, not error_mark_node.
+2001-06-13 Mark Mitchell <mark@codesourcery.com>
-1998-12-04 Jason Merrill <jason@yorick.cygnus.com>
+ * NEWS: Update release number.
- * lex.c (handle_cp_pragma): Disable #pragma interface/implementation
- if MULTIPLE_SYMBOL_SPACES.
+2001-06-12 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (check_template_shadow): New fn.
- * decl2.c (grokfield): Use it.
- * decl.c (pushdecl): Likewise.
- (pushdecl_class_level): Likewise.
- (start_method): Likewise.
- (xref_tag): Don't try to use 't' if we're defining.
+ PR c++/3130, c++/3131, c++/3132
+ * cp-tree.h (BINFO_UNSHARED_MARKED): New #define.
+ * class.c (force_canonical_binfo_r): Move
+ BINFO_UNSHARED_MARKED, BINFO_LOST_PRIMARY_P. Don't move
+ virtual bases unless they're primary and what they're primary
+ too has been moved.
+ (dfs_unshared_virtual_bases): Use BINFO_UNSHARED_MARKED. Cope
+ with morally virtual bases. Duplicate BINFO_LOST_PRIMARY_P and
+ BINFO_PRIMARY_BASE_OF. Clear BINFO_VTABLE for all but the most
+ derived binfo.
+ (mark_primary_bases): Use BINFO_UNSHARED_MARKED.
+ (layout_nonempty_base_or_field): Add most derived type
+ parameter. Adjust.
+ (layout_empty_base): Likewise.
+ (build_base_field): Likewise.
+ (build_base_fields): Likewise.
+ (propagate_binfo_offsets): Add most derived type
+ parameter. Skip non canonical virtual bases too.
+ (dfs_set_offset_for_unshared_vbases): Don't skip primary
+ bases. Do skip canonical bases.
+ (layout_virtual_bases): Adjust.
+ (layout_class_type): Adjust.
+ (dfs_get_primary_binfo): Build list of virtual primary base
+ candidates.
+ (get_primary_binfo): Check that the shared virtual primary
+ base candidate was found first.
+ (accumulate_vtbl_inits): Don't do anything for non-vptr
+ containing binfos. For case 1 primary virtual bases, keep
+ checking that we've not emerged from the hierarchy of RTTI_BINFO.
- * call.c (check_dtor_name): Just return an error_mark_node.
- * pt.c (lookup_template_class): Complain about using non-template here.
- * parse.y (apparent_template_type): Not here.
+2001-06-12 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (check_explicit_specialization): Complain about specialization
- with C linkage.
+ PR c++/3089
+ * class.c (dfs_accumulate_vtbl_inits): Always walk down the
+ hierarchy looking for primary bases for a ctor
+ vtable. Recursively call oneself, if we meet our primary via
+ this route and haven't met it yet via inheritance graph order.
- * lang-options.h: Add -f{no-,}implicit-inline-templates.
+2001-06-11 Mark Mitchell <mark@codesourcery.com>
- * pt.c (convert_nontype_argument): Don't assume that any integer
- argument is intended to be a constant-expression.
+ * lang-options.h: Emit documentation for -fno-honor-std, not
+ -fhonor-std.
-1998-12-03 Mark Mitchell <mark@markmitchell.com>
+2001-06-10 Alexandre Oliva <aoliva@redhat.com>
+
+ * typeck.c (get_member_function_from_ptrfunc) [vbit_in_delta]:
+ Don't clobber delta.
+ (expand_ptrmemfunc_cst) [ptrmemfunc_vbit_in_delta]: Adjust pfn.
+
+2001-06-10 Mark Mitchell <mark@codesourcery.com>
+ Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * Make-lang.in (cp/call.o): Depend on diagnostic.h
+ (cp/typeck.o): Depend on diagnostic.h
+ (cp/typeck2.o): Depend on diagnostic.h
+ (cp/repo.o): Depend on dignostic.h
+ * typeck.c: #include diagnostic.h
+ (convert_for_initialization): Remove extern declaration for
+ warningcount and errorcount.
+
+ * call.c: #include diagnostic.h
+ (convert_like_real): Remove extern declaration for warnincount and
+ errorcount.
+
+ * repo.c: #include diagnostic.h
+ * typeck2.c: #include diagnostic.h
+
+2001-06-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (duplicate_decls): Fix DECL_TEMPLATE_RESULT thinko
+ in previous change.
+
+2001-06-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/2929
+ * friend.c (do_friend): Use push_decl_namespace for classes at
+ namespace scope.
+
+2001-06-08 Nathan Sidwell <nathan@codesourcery.com>
+ Jason Merrill <jason_merrill@redhat.com>
+
+ PR c++/3061
+ * class.c (build_secondary_vtable): Use assert, rather than an error
+ message.
+ (dfs_fixup_binfo_vtbls): BINFO_VTABLE might be NULL.
+ (dfs_accumulate_vtbl_inits): A lost primary virtual base may
+ be between ORIG_BINFO and RTTI_BINFO, but neither of them.
+ Don't set BINFO_VTABLE for a primary virtual base.
+
+2001-06-07 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (duplicate_decls): Update source position information
+ when a template function is defined.
+
+2001-06-07 Phil Edwards <pme@sources.redhat.com>
+
+ * lang-specs.h: Move -D_GNU_SOURCE to config/linux.h.
+
+2001-06-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/2914
+ * decl.c (pushtag): Don't push into a complete type's scope.
+
+2001-06-06 Jason Merrill <jason_merrill@redhat.com>
+
+ * cp-tree.h (THUNK_GENERATE_WITH_VTABLE_P): Lose.
+ (struct lang_decl_flags): Lose generate_with_vtable_p.
+ (BV_GENERATE_THUNK_WITH_VTABLE_P): Lose.
+ * class.c (copy_virtuals): Adjust.
+ * decl2.c (mark_vtable_entries): Adjust.
+ * method.c (make_thunk, build_vtable_entry): Adjust.
+ * class.c (update_vtable_entry_for_fn): Only look as far as the
+ first defining class.
+ (build_vtbl_initializer): Put nothing in the slot for a function only
+ defined in a lost primary virtual base.
+ (add_vcall_offset_vtbl_entries_1): Use the same code for
+ the lost primary case and the normal case.
+ (dfs_unshared_virtual_bases): Don't lose a non-virtual primary base.
+ (get_vfield_offset, get_derived_offset): Lose.
+ (dfs_find_final_overrider): Use look_for_overrides_here.
+ (get_matching_virtual): New fn.
+ * semantics.c (emit_associated_thunks): Check BV_USE_VCALL_INDEX_P,
+ not BV_VCALL_INDEX.
+ * search.c (look_for_overrides_here): Split out from...
+ (look_for_overrides_r): Here.
- * class.c (handle_using_decl): Fix comment. Don't lookup
- constructors in base classes.
- (validate_lhs): Fix typo in comment.
- * search.c (lookup_field_1): Don't return a USING_DECL.
+ * class.c (find_final_overrider): Return error_mark_node on error.
- * cp-tree.h (DECL_ACCESS): Improve documentation.
+ * decl2.c (key_method): #if 0 accidental change.
- * decl.c (expand_static_init): Don't set the initialization-done
- flag until the initialization is done.
+2001-06-06 John David Anglin <dave@hiauly1.hia.nrc.ca>
-1998-12-02 Mark Mitchell <mark@markmitchell.com>
+ * call.c (convert_default_arg): Use INTEGRAL_TYPE_P.
+ (build_over_call): Likewise.
+ * decl.c (grokparms): Likewise.
+ * pt.c (tsubst_decl): Likewise.
+ * typeck.c (convert_arguments): Likewise.
- * decl2.c (validate_nonmember_using_decl): Complain about using
- declarations for class members.
+2001-06-05 Mark Mitchell <mark@codesourcery.com>
-1998-11-29 Jason Merrill <jason@yorick.cygnus.com>
+ * semantics.c (begin_class_definition): Robustify.
- * typeck2.c (process_init_constructor): Use same_type_p.
+ * pt.c (instantiate_decl): Tell the repository code about the
+ clones, not the cloned functions.
+ * repo.c (repo_template_used): Explicitly instantiate the cloned
+ function, not the clones.
- * decl.c (check_tag_decl): Don't warn about null decl inside a
- class.
+2001-06-05 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (unify, case OFFSET_TYPE): Pass down 'strict' rather than
- UNIFY_ALLOW_NONE.
- (convert_nontype_argument): Use TYPE_PTRMEMFUNC_FN_TYPE.
- (resolve_overloaded_unification): Strip baselinks.
+ * call.c (build_user_type_conversion_1): Set ICS_USER_FLAG and
+ ICS_BAD_FLAG on created conversion.
+ (compare_ics): Break out rank.
-Fri Nov 27 13:07:23 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+2001-06-05 Nathan Sidwell <nathan@codesourcery.com>
- * g++spec.c: Don't prototype xmalloc.
+ * decl.c (xref_tag): Remove extraneous %s on dependent name
+ lookup warning.
-1998-11-25 Jason Merrill <jason@yorick.cygnus.com>
+2001-06-05 Nathan Sidwell <nathan@codesourcery.com>
- * except.c (expand_throw): Use TYPE_PTR_P to check for pointers.
+ * class.c (layout_vtable_decl): Fix off by one error on
+ build_index_type.
+ (build_vtt): Likewise.
+ (build_ctor_vtbl_group): Likewise.
- * decl.c (check_tag_decl): Do complain about null friend decl at
- file scope.
+2001-06-05 Nathan Sidwell <nathan@codesourcery.com>
-1998-11-25 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+ * class.c (maybe_indent_hierarchy): New function.
+ (dump_class_hierarchy_r): Add flags. Dump extra binfo
+ information, if enabled. Use maybe_indent_hierarchy. Adjust
+ output format.
+ (dump_class_hierarchy): Adjust prototype. Adjust output format.
+ (dump_array, dump_vtable, dump_vtt): New functions.
+ (finish_struct_1): Adjust hierarchy dumping.
+ (initialize_vtable): Call dump_vtable.
+ (build_vtt): Call dump_vtt.
+ (build_ctor_vtbl_group): Call dump_vtable.
+ * decl2.c (flag_dump_class_layout): Remove.
+ (cxx_decode_option): Remove dump translation unit
+ and dump class hierarchy check. Call dump_switch_p.
+ (finish_file): Adjust dumping.
+ (dump.c): Only dump base classes if not TDF_SLIM.
+ Only dump namespace members if not TDF_SLIM.
+ * optimize.c (dump_function): New function.
+ (optimize_function): Call dump_function.
+ * semantics.c (expand_body): Use dump_enabled_p.
- * lex.c (make_lang_type): Clear the whole struct lang_type, not
- only the first multiple of sizeof (int).
+2001-06-01 Nathan Sidwell <nathan@codesourcery.com>
-1998-11-24 Jason Merrill <jason@yorick.cygnus.com>
+ PR g++/2936
+ Part missed from first commit
+ * decl2.c (finish_anon_union): Copy context.
- * decl.c (start_decl): An explicit specialization of a static data
- member is only a definition if it has an initializer.
+2001-05-30 Nathan Sidwell <nathan@codesourcery.com>
- * except.c (expand_throw): Use cp_finish_decl for the throw temp.
- * cvt.c (build_up_reference): Pass DIRECT_BIND down into
- cp_finish_decl.
- * init.c (expand_default_init): Check for DIRECT_BIND instead of
- DECL_ARTIFICIAL.
+ PR g++/2936
+ * optimize.c (remap_decl): Remap anonymous aggregate members too.
- * call.c (build_over_call): Use build_decl.
+2001-05-26 Nathan Sidwell <nathan@codesourcery.com>
- * except.c (expand_throw): Just use convert, not
- build_reinterpret_cast.
+ PR g++/2823
+ * semantics.c (expand_body): Don't optimize thunks.
- * lex.c (handle_generic_pragma): Use token_buffer.
+2001-05-25 Sam TH <sam@uchicago.edu>
- * decl.c (check_tag_decl): Don't complain about null friend decl.
+ * cp-tree.h lex.h: Fix header include guards.
-1998-11-24 Dave Pitts <dpitts@cozx.com>
+2001-05-25 Mark Mitchell <mark@codesourcery.com>
- * Make-lang.in (DEMANGLER_PROG): Move the output arguments to the
- first position.
- * lex.c (check_newline): Use ISALPHA.
- (readescape): Use ISGRAPH.
- (yyerror): Use ISGRAPH.
+ * decl.c (init_decl_processing): Tweak.
-1998-11-24 Nathan Sidwell <nathan@acm.org>
+2001-05-24 Mark Mitchell <mark@codesourcery.com>
- * search.c (get_abstract_virtuals): Do not use initial
- CLASSTYPE_ABSTRACT_VIRTUALS.
- * typeck2.c (abstract_virtuals_error): Show location of abstract
- declaration.
- * call.c (build_new_method_call): Use
- CLASSTYPE_ABSTRACT_VIRTUAL, rather than recalculate.
- * class.c (finish_struct_bits): Don't bother working out whether
- get_abstract_virtuals will do anything, just do it.
+ * decl.c (duplicate_decls): Tidy.
+ (init_decl_processing): Always set flag_no_builtin.
-1998-11-24 Graham <grahams@rcp.co.uk>
+2001-05-24 Nathan Sidwell <nathan@codesourcery.com>
- * typeck.c (build_component_ref): Remove unused statement.
+ PR c++/2184
+ * decl2.c (do_local_using_decl): Push the decls, even in a
+ template.
-1998-11-24 Jason Merrill <jason@yorick.cygnus.com>
+2001-05-22 Mark Mitchell <mark@codesourcery.com>
- * class.c (add_method): Catch invalid overloads.
+ * optimize.c (initialize_inlined_parameters): Don't set
+ TREE_READONLY for a VAR_DECL taking the place of an inlined
+ PARM_DECL.
- * class.c (add_method): Build up OVERLOADs properly for conversion ops.
- * search.c (lookup_conversions): Handle getting real OVERLOADs.
- (add_conversions): Likewise. Revert last change.
- * call.c (add_conv_candidate): Pass totype to add_candidate instead
- of fn. Don't add a new candidate if the last one was for the same
- type.
- (print_z_candidates): Handle getting a type as a function.
- (joust): If we got two conversion candidates to the same type,
- just pick one.
- (build_object_call): Lose 'templates'.
- (build_user_type_conversion_1): Handle getting real OVERLOADs.
+2001-05-22 Jason Merrill <jason_merrill@redhat.com>
-1998-11-23 Jason Merrill <jason@yorick.cygnus.com>
+ * class.c, cp-tree.h, rtti.c: Remove com_interface attribute support.
+ * tree.c (cp_valid_lang_attribute): Warn about use of com_interface
+ attribute.
- * typeck2.c (process_init_constructor): If there are elements
- that don't have initializers and they need to have constructors
- run, supply them with initializers.
+2001-05-22 Joseph S. Myers <jsm28@cam.ac.uk>
- * class.c (finish_struct_1): A class with a 0-width bitfield is
- still empty.
+ * parse.y: Refer to compound literals as such, not as
+ constructor-expressions.
-1998-11-23 Mark Mitchell <mark@markmitchell.com>
+2001-05-21 Mark Mitchell <mark@codesourcery.com>
- * pt.c (instantiate_class_template): Don't try to figure out what
- specialization to use for a partial instantiation. Correct
- typos in a couple of comments. Avoid calling uses_template_parms
- multiple times.
+ * call.c (build_op_delete_call): Ignore exception-specifications
+ when looking for matching delete operators.
+ * init.c (build_new_1): Compute whether or not the allocation
+ function used is a placement allocation function or not, and
+ communicate this information to build_op_delete_call.
-1998-11-23 Benjamin Kosnik <bkoz@cygnus.com>
+2001-05-21 Jason Merrill <jason_merrill@redhat.com>
- * method.c (process_overload_item): Add call to
- build_mangled_C9x_name for intTI_type_nodes.
- (build_mangled_C9x_name): Add prototype, define.
- * decl.c (init_decl_processing): Add names for
- TImode_type_node.
+ * class.c (build_vtable_entry_ref): Lose vtbl parm. Fix for new abi.
+ (build_vtbl_ref): Adjust.
+ (dfs_accumulate_vtbl_inits): Set TREE_CONSTANT on the vtable address.
+ * decl2.c (lang_f_options): Remove huge-objects, vtable-thunks.
+ Re-add vtable-gc.
+ (unsupported_options): Correspondingly.
-1998-11-23 Jason Merrill <jason@yorick.cygnus.com>
+ * decl2.c (maybe_make_one_only): Check flag_weak, not
+ supports_one_only().
- * parse.y (named_class_head): Update CLASSTYPE_DECLARED_CLASS.
+ * cp-tree.def (START_CATCH_STMT): Lose.
+ * dump.c (cp_dump_tree): Don't dump it. Do dump HANDLER_PARMS.
+ * tree.c (cp_statement_code_p): Don't case it.
+ * semantics.c (cp_expand_stmt): Likewise.
+ * cp-tree.h (START_CATCH_TYPE): Lose.
+ (HANDLER_TYPE): New.
+ * except.c (expand_start_catch_block): Don't start any blocks.
+ Return the type.
+ (expand_end_catch_block): Don't end any blocks.
+ * parse.y (handler): Don't pass anything from finish_handler_parms
+ to finish_handler.
+ * pt.c (tsubst_expr): Likewise.
+ * semantics.c (begin_handler): Call note_level_for_catch here.
+ (finish_handler_parms): Don't return anything.
+ (genrtl_catch_block, begin_catch_block): Lose.
+ (genrtl_handler): Call expand_start_catch here.
- * class.c (finish_struct_1): Set things up for 0-width bitfields
- like we do for others.
+2001-05-18 Jason Merrill <jason_merrill@redhat.com>
- * decl.c (check_tag_decl): New fn.
- (shadow_tag): Split out from here.
- * decl2.c (grok_x_components): Call it.
+ * class.c (build_vtable): Set DECL_ASSEMBLER_NAME for vtables here.
+ (get_vtable_decl, build_vtt): Not here.
-1998-11-22 Jason Merrill <jason@yorick.cygnus.com>
+2001-05-20 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c: Lose warn_about_return_type.
- (grokdeclarator): Always complain about implicit int, except for
- `main () { ... }'.
+ PR c++/2781
+ * optimize.c (update_cloned_parm): Copy addressability and other
+ flags.
- * decl.c (tag_name): New fn.
- (xref_tag): Complain about using typedef-name after class-key.
+2001-05-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * init.c (expand_vec_init): Also keep going if from_array.
+ * pt.c (determine_specialization): Ignore artificial functions.
- * tree.c (is_overloaded_fn): Also handle the output of
- build_offset_ref.
+2001-05-20 Neil Booth <neil@daikokuya.demon.co.uk>
- * decl.c (grokdeclarator): Use constructor_name when comparing
- field name against enclosing class.
- * class.c (finish_struct_anon): Likewise.
+ * cp-tree.h (struct lang_identifier, C_RID_YYCODE): Update.
+ (C_RID_CODE): Remove.
+ * lex.c (cxx_init_options): Call set_identifier_size. Update.
+ (init_parse): Don't do it here.
-1998-11-22 Mark Mitchell <mark@markmitchell.com>
+2001-05-18 Diego Novillo <dnovillo@redhat.com>
- * decl.c (poplevel): Remove code to handle KEEP == 2.
- (finish_function): Don't confuse BLOCK-order when
- processing a destructor.
+ * decl2.c (finish_objects): Use the original SYMBOL_REF from the
+ function declaration to avoid stripping the symbol's attributes.
-1998-11-21 Jason Merrill <jason@yorick.cygnus.com>
+2001-05-18 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (require_complete_types_for_parms): Call layout_decl
- after we've completed the type.
+ * decl.c (pushdecl): Adjust error string.
+ (xref_tag): Adjust friend class injection warning. Remove the
+ inherited name from the class shadowed scope.
-1998-11-21 Martin von Löwis <loewis@informatik.hu-berlin.de>
+2001-05-17 Mark Mitchell <mark@codesourcery.com>
- * decl2.c (validate_nonmember_using_decl): Allow using templates
- from the global namespace.
+ * except.c (cp_protect_cleanup_actions): New function.
+ (init_exception_processing): Don't set protect_cleanup_actions
+ here. Do set lang_protect_cleanup_actions.
-1998-11-21 Jason Merrill <jason@yorick.cygnus.com>
+2001-05-16 Nathan Sidwell <nathan@codesourcery.com>
- Handle specifying template args to member function templates.
- * tree.c (build_overload): Always create an OVERLOAD for a template.
- * search.c (add_conversions): Handle finding an OVERLOAD.
- * decl2.c (check_classfn): Likewise.
- * lex.c (identifier_type): See through a baselink.
- * parse.y (do_id): Don't call do_identifier if we got a baselink.
- * class.c (instantiate_type, case TREE_LIST): Recurse.
+ * spew.c (read_token): Call yyerror on all unexpected tokens.
- * decl.c (grokdeclarator): Allow a boolean constant for array
- bounds, odd as that sounds.
+2001-05-16 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (unify): Be more strict about non-type parms, except for
- array bounds.
- (UNIFY_ALLOW_INTEGER): New macro.
+ * init.c (member_init_ok_or_else): Take a tree rather than
+ string for name.
+ (expand_member_init): Adjust.
-1998-11-19 Manfred Hollstein <manfred@s-direktnet.de>
+2001-05-14 Nick Clifton <nickc@cambridge.redhat.com>
- * Make-lang.in (mandir): Replace all uses of $(mandir) by $(man1dir).
+ * decl.c (duplicate_decls): Suppress warning about duplicate
+ decls if the first decl is a friend.
-1998-11-19 Jason Merrill <jason@yorick.cygnus.com>
+2001-05-12 Zack Weinberg <zackw@stanford.edu>
- * semantics.c (begin_class_definition): Call
- maybe_process_partial_specialization before push_template_decl.
- Don't call push_template_decl for a specialization.
- * search.c (lookup_field): Do return a member template class.
- * decl2.c (handle_class_head): Handle member template classes.
+ * except.c (choose_personality_routine): Export. Add
+ explanatory comment. Take an enum languages, not a boolean.
+ (initialize_handler_parm): Adjust to match.
+ * cp-tree.h: Prototype choose_personality_routine.
+ * lex.c (handle_pragma_java_exceptions): New function.
+ (init_cp_pragma): Register #pragma GCC java_exceptions.
- * decl.c (grokdeclarator): A parm type need not be complete.
+2001-05-12 Neil Booth <neil@cat.daikokuya.demon.co.uk>
- * pt.c (convert_nontype_argument): Fix thinko.
+ * method.c (build_mangled_C99_name): Remove unused prototype.
-1998-11-18 Mark Mitchell <mark@markmitchell.com>
+2001-05-12 Alexandre Oliva <aoliva@redhat.com>
- * cp-tree.h (PTRMEM_CST_CLASS): Fix typo.
- (global_delete_fndecl): New variable.
- * decl.c (global_delete_fndecl): Define it.
- (init_decl_processing): Set it.
- * init.c (build_builtin_delete_call): Use it.
- * tree.c (mapcar): Recursively call mapcar for the type of EXPR
- nodes.
+ * cp-tree.h (ptrmemfunc_vbit_where_t): Declare type.
+ * typeck.c (get_member_function_from_ptrfunc,
+ build_ptrmemfunc, expand_ptrmemfunc_cst): Take
+ TARGET_PTRMEMFUNC_VBIT_LOCATION into account.
-1998-11-18 Jason Merrill <jason@yorick.cygnus.com>
+ Reverted Geoff Keating's 2001-05-03's patch.
- * decl.c (cplus_expand_expr_stmt): Always complain about unresolved
- type.
+2001-05-11 Ira Ruben <ira@apple.com>
- * tree.c (lvalue_p_1): An INDIRECT_REF to a function is an lvalue.
- * call.c (build_object_call): Also support references to functions.
- * typeck.c (convert_for_initialization): Don't decay a function
- if the target is a reference to function.
+ * cp/cp-tree.h (C_EXP_ORIGINAL_CODE): Delete; declared in c-common.h.
- * search.c (add_conversions): Get all the overloads from a class.
+2001-05-11 Neil Booth <neil@daikokuya.demon.co.uk>
- * decl.c (grok_ctor_properties): Complain about any constructor
- that will take a single arg of the class type by value.
+ * cp-tree.h (finish_label_expr, lookup_label): Delete.
+ * parse.y: Update for '&&'; don't issue warning here.
+ * semantics.c (finish_label_expr): Delete.
- * typeck2.c (build_functional_cast): Can't create objects of
- abstract classes this way.
- * cvt.c (ocp_convert): Likewise.
+2001-05-07 Mark Mitchell <mark@codesourcery.com>
- * decl.c (grokfndecl): Member functions of local classes are not
- public.
+ * splay-tree.h (splay_tree_max): New function.
+ (splay_tree_min): Likewise.
-1998-11-18 Mark Mitchell <mark@markmitchell.com>
+2001-05-03 Geoffrey Keating <geoffk@redhat.com>
- * Make-lang.in (cc1plus): Add dependency on hash.o.
+ * cp-tree.h (enum cp_tree_index): Add CPTI_PFN_VFLAG_IDENTIFIER.
+ (pfn_vflag_identifier): Define.
+ Update comment about layout of pointer functions.
+ (build_ptrmemfunc1): Update prototype.
+ (expand_ptrmemfunc_cst): Update prototype.
+ * decl.c (initialize_predefined_identifiers): Initialize
+ pfn_vflag_identifier.
+ (build_ptrmemfunc_type): When FUNCTION_BOUNDARY < 16, add
+ an extra field to the type.
+ * expr.c (cplus_expand_constant): Pass 'flag' between
+ expand_ptrmemfunc_cst and build_ptrmemfunc1.
+ * typeck.c (get_member_function_from_ptrfunc): When
+ FUNCTION_BOUNDARY < 16, look at additional field to determine
+ if a pointer-to-member is a real pointer or a vtable offset.
+ (build_ptrmemfunc1): Add new parameter to contain extra field.
+ (build_ptrmemfunc): Pass the extra field around.
+ (expand_ptrmemfunc_cst): Add new parameter to return extra field.
+ (pfn_from_ptrmemfunc): Ignore the extra field.
-1998-11-18 Jason Merrill <jason@yorick.cygnus.com>
+2001-05-03 Mark Mitchell <mark@codesourcery.com>
- * search.c (get_abstract_virtuals): Complain about virtuals with
- no final overrider.
- * typeck2.c (abstract_virtuals_error): Remove handling for virtuals
- with no final overrider.
- * class.c (override_one_vtable): Don't set DECL_ABSTRACT_VIRTUAL_P
- on virtuals with no final overrider.
+ * cp-tree.h (flag_inline_trees): Update documentation.
+ * decl.c (init_decl_processing): Adjust handling of
+ flag_inline_functions and flag_inline_trees to support -O3.
+ (grokfndecl): Set DECL_INLINE on all functions if that's what
+ the user requested.
+ (save_function_data): Clear DECL_INLINE in
+ current_function_cannot_inline is non-NULL.
+ * decl2.c (flag_inline_trees): Update documentation.
- * lex.c (reinit_parse_for_block): Add a space after the initial ':'.
+2001-05-03 Nathan Sidwell <nathan@codesourcery.com>
- * class.c (finish_struct_1): Don't remove zero-width bit-fields until
- after layout_type.
+ * dump.c (cp_dump_tree, USING_STMT case): New case.
+ * tree.c (cp_statement_code_p): Add USING_STMT.
+ * decl2.c (do_using_directive): Add the using directive statement.
- * friend.c (do_friend): Don't set_mangled_name_for_decl.
+ * tree.c (walk_tree): Reformat an if block.
- * class.c (finish_struct_anon): Complain about non-fields.
- * decl2.c (build_anon_union_vars): Likewise.
+2001-05-02 Mark Mitchell <mark@codesourcery.com>
- * decl.c (grokdeclarator): Normal data members can't have the same
- name as the class, either.
- * class.c (finish_struct_anon): Neither can members of an
- anonymous union.
+ * decl.c (compute_array_index_type): Don't try to do anything with
+ the indices when processing a template.
-1998-11-17 Mark Mitchell <mark@markmitchell.com>
+2001-05-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses.
- (TYPE_BINFO): Likewise.
- (IS_AGGR_TYPE): Tweak.
- (SET_IS_AGGR_TYPE): New macro.
- (CLASS_TYPE_P): Tweak.
- (lang_type): Group mark bitfields together. Remove linenum.
- (CLASSTYPE_SOURCE_LINE): Remove macro.
- (CLASSTYPE_MARKED_N): New macro.
- (SET_CLASSTYPE_MARKED_N): Likewise.
- (CLEAR_CLASSTYPE_MARKED_N): Likewise.
- (CLASS_TYPE_MARKED_*): Use them.
- (SET_CLASSTYPE_MARKED_*): Likewise.
- (CLEAR_CLASSTYPE_MARKED_*): Likewise.
- (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise.
- (TYPE_TEMPLATE_INFO): Handle TEMPLATE_TEMPLATE_PARMs as well.
- (TYPENAME_TYPE_FULLNAME): Use TYPE_BINFO rather than CLASSTYPE_SIZE.
- * class.c (class_cache_obstack): New variable.
- (class_cache_firstobj): Likewise.
- (finish_struct): Don't set CLASSTYPE_SOURCE_LINE.
- (pushclass): Free the cache, when appropriate.
- (popclass): Tidy.
- (maybe_push_cache_obstack): Use class_cache_obstack.
- * decl.c (include hash.h).
- (typename_hash): New function.
- (typename_compare): Likewise.
- (build_typename_type): Check the hash table to avoid creating
- duplicates.
- (build_ptrmemfunc_type): Use SET_IS_AGGR_TYPE.
- (grokdeclarator): Use CLASS_TYPE_P.
- (xref_basetypes): Likewise.
- (start_function): Likewise. Don't put current_class_ref on the
- permanent obstack.
- * error.c (dump_type_real): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO
- and TYPE_TI_ARGS.
- * lex.c (note_got_semicolon): Use CLASS_TYPE_P.
- (make_lang_type): Don't create TYPE_LANG_SPECIFIC and associated
- fields for types other than class types. Do clear TYPE_ALIAS_SET
- for types other than class types, though.
- * method.c (build_overload_identifier): Use CLASS_TYPE_P and
- TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
- * pt.c (process_template_parm): Don't set
- CLASSTYPE_GOT_SEMICOLON.
- (lookup_template_class): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
- Coerce arguments on the momentary obstack.
- (for_each_template_parm): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
- (instantiate_class_template): Calculate template arguments on the
- momentary obstack. Tidy.
- (tsubst_template_arg_vector): Use make_temp_vec.
- (tsubst_aggr_type): Put template arguments on the momentary
- obstack.
- (tsubst_decl): Likewise.
- (tsubst): Copy the array bounds index to the permanent obstack
- before building index types. Use new macros.
- (unify): Use new macros.
- (do_type_instantiation): Likewise.
- * search.c (lookup_fnfields_1): Use new macros.
- (dfs_pushdecls): Build envelopes on the cache obstack.
- (dfs_compress_decls): Use new macros.
- (push_class_decls): Build on the cache obstack.
- * semantics.c (finish_typeof): Don't set CLASSTYPE_GOT_SEMICOLON.
- * sign.c (build_signature_pointer_or_reference_type): Use
- SET_IS_AGGR_TYPE.
- * tree.c (make_binfo): Check CLASS_TYPE_P.
- (copy_template_template_parm): Adjust.
- (make_temp_vec): Use push_expression_obstack.
- * typeck.c (complete_type): Use new macros.
- (comptypes): Likewise.
+ * call.c: NULL_PTR -> NULL.
+ * class.c: Likewise.
+ * cvt.c: Likewise.
+ * decl.c: Likewise.
+ * decl2.c: Likewise.
+ * except.c: Likewise.
+ * init.c: Likewise.
+ * rtti.c: Likewise.
+ * search.c: Likewise.
+ * tree.c: Likewise.
+ * typeck.c: Likewise.
+ * typeck2.c: Likewise.
-1998-11-17 Jason Merrill <jason@yorick.cygnus.com>
+2001-05-02 Mark Mitchell <mark@codesourcery.com>
- * pt.c (tsubst): Add diagnostics for invalid array, reference
- and pointer to member types.
+ * decl2.c (do_using_directive): Revert previous patch.
-1998-11-16 Jason Merrill <jason@yorick.cygnus.com>
+2001-05-01 Nathan Sidwell <nathan@codesourcery.com>
- * typeck2.c (my_friendly_abort): Don't fatal twice in a row.
+ * cp-tree.def (USING_STMT): New statement node.
+ * cp-tree.h (USING_STMT_NAMESPACE): New macro.
+ * decl2.c (do_using_directive): Add USING_STMT to statement
+ tree. Don't emit errors when processing template decl.
+ * pt.c (tsubst_expr, USING_STMT case): New case.
+ * semantics.c (cp_expand_stmt, USING_STMT case): New case.
- * typeck.c (c_expand_start_case): Use build_expr_type_conversion.
- Simplify.
+2001-05-01 Nathan Sidwell <nathan@codesourcery.com>
- * parse.y (structsp): Fix cut-and-paste error.
+ * call.c (build_new_op): Convert args from reference here.
+ (build_conditional_expr): Don't convert here.
- * init.c (build_new): Complain about non-integral size.
+2001-05-01 Nathan Sidwell <nathan@codesourcery.com>
- * parse.y (unary_expr): Complain about defining types in sizeof.
+ * spew.c (last_token_id): New static variable.
+ (read_token): Set it here.
+ (yyerror): Use it here.
- * typeck.c (expr_sizeof): Complain about sizeof an overloaded fn.
+2001-04-30 Richard Henderson <rth@redhat.com>
- * rtti.c (build_x_typeid): Complain about typeid without
- including <typeinfo>.
- (get_typeid): Likewise. Complain about typeid of incomplete type.
- (get_tinfo_fn_dynamic): Likewise.
- (get_typeid_1): Not static anymore.
- * except.c (build_eh_type_type): Use get_typeid_1.
+ * cvt.c: Downcase C_PROMOTING_INTEGER_TYPE_P invocations.
+ * decl.c: Likewise.
- * rtti.c (build_dynamic_cast_1): Give errors for dynamic_cast to
- ambiguous or private bases. Fix warning for reference cast.
+2001-04-30 Mark Mitchell <mark@codesourcery.com>
-1998-11-16 Mark Mitchell <mark@markmitchell.com>
+ * gxxint.texi: Remove.
+ * Make-lang.in: Remove all traces of gxxint.texi.
- * cp-tree.h (DECL_TEMPLATE_INSTANTIATED): New macro.
- * decl.c (duplicate_decls): Remove special-case code to deal with
- template friends, and just do the obvious thing.
- * pt.c (register_specialization): Tweak for clarity, and also to
- clear DECL_INITIAL for an instantiation before it is merged with a
- specialization.
- (check_explicit_specialization): Fix indentation.
- (tsubst_friend_function): Handle both definitions in friend
- declaration and outside friend declarations.
- (tsubst_decl): Don't clear DECL_INITIAL for an instantiation.
- (regenerate_decl_from_template): Tweak accordingly.
- (instantiate_decl): Likewise.
+Mon Apr 30 16:14:10 2001 Mark P Mitchell <mark@codesourcery.com>
-1998-11-16 Jason Merrill <jason@yorick.cygnus.com>
+ * decl2.c (start_static_initialization_or_destruction): Correct
+ logic to handle the -fno-use-cxa-atexit case.
- * decl.c (cplus_expand_expr_stmt): Promote warning about naked
- member function reference to error.
- * cvt.c (ocp_convert): Complain about converting an overloaded
- function to void.
+2001-04-30 Mark Mitchell <mark@codesourcery.com>
- * init.c (build_offset_ref): Just return a lone static member
- function.
+ * optimize.c (update_cloned_parm): New function.
+ (maybe_clone_body): Use it. Update the `this' parameter too.
- * decl.c (cp_finish_decl): Only complain about real CONSTRUCTORs,
- not internal ones.
+2001-04-29 Joseph S. Myers <jsm28@cam.ac.uk>
- * typeck.c (build_binary_op_nodefault): Improve error handling.
+ * decl2.c (unsupported_options): Add new-abi.
+ * lang-options.h: Remove no longer supported options.
- * decl.c (grokfndecl): Complain about making 'main' a template.
+2001-04-27 Nathan Sidwell <nathan@codesourcery.com>
- * typeck.c (string_conv_p): Don't convert from wchar_t[] to char*.
+ * except.c (can_convert_eh): Don't check template parms,
+ typename types etc.
- * call.c (build_method_call): Handle a BIT_NOT_EXPR around a
- TYPE_DECL in a template.
+2001-04-27 Nathan Sidwell <nathan@codesourcery.com>
-1998-11-15 Jason Merrill <jason@yorick.cygnus.com>
+ * optimize.c (maybe_clone_body): Copy parameter names and locations.
- * typeck2.c (my_friendly_abort): Add URL in the other case, too.
+2001-04-27 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (struct cp_function): Add named_label_uses.
- (push_cp_function_context): Save it.
- (pop_cp_function_context): Restore it.
- (define_label): Also complain about jumping into the scope of
- non-POD objects that don't have constructors.
- * tree.c (pod_type_p): New fn.
+ * cp-tree.h (adjust_clone_args): Prototype new function.
+ * class.c (adjust_clone_args): New function.
+ * decl.c (start_function): Call it for in charge ctors.
- * pt.c (instantiate_class_template): Clear TYPE_BEING_DEFINED sooner.
- * rtti.c (synthesize_tinfo_fn): Call import_export_decl here.
- (get_tinfo_fn): Not here.
- * repo.c (repo_get_id): Abort if we get called for an incomplete
- type.
+2001-04-26 Mark Mitchell <mark@codesourcery.com>
-1998-11-13 Mark Mitchell <mark@markmitchell.com>
+ * method.c (use_thunk): Make sure that thunks really are emitted
+ when requested.
- * except.c (expand_throw): Make sure first argument to
- __cp_push_exception is of type `void*' to avoid spurious error
- messages.
+2001-04-26 Nathan Sidwell <nathan@codesourcery.com>
-1998-11-11 Jason Merrill <jason@yorick.cygnus.com>
+ * mangle.c (write_chars): New macro.
+ (hwint_to_ascii): New function
+ (write_number): Use it.
+ (write_integer_cst): Deal with really big numbers.
- * pt.c (try_one_overload): Take orig_targs again. Only check for
- mismatches against them; we don't care what a previous call found.
- (resolve_overloaded_unification): Adjust.
+2001-04-25 Mark Mitchell <mark@codesourcery.com>
- * search.c (lookup_field): Don't return anything for a non-type
- field from a dependent type.
- * decl.c (grokdeclarator): Resolve SCOPE_REFs of the current class
- in an array declarator.
- (start_decl): Push into the class before looking for the field.
+ * optimize.c (maybe_clone_body): Copy TREE_PUBLIC before emitting
+ the clone.
-1998-11-08 Mark Mitchell <mark@markmitchell.com>
+2001-04-25 Nathan Sidwell <nathan@codesourcery.com>
- * method.c (build_overload_value): Handle REFERENCE_TYPE.
+ * decl.c (grokdeclarator): Set context of namespace scope
+ TYPE_DECLS.
-1998-11-08 Martin von Löwis <loewis@informatik.hu-berlin.de>
+2001-04-24 Zack Weinberg <zackw@stanford.edu>
- * decl.c (grokdeclarator): Allow namespace-scoped members if they
- are friends.
+ * cp/optimize.c: Include hashtab.h.
+ (struct inline_data): Add tree_pruner.
+ (expand_call_inline, expand_calls_inline): Use it when calling
+ walk_tree.
+ (optimize_function): Initialize and free tree_pruner.
-1998-11-08 Jason Merrill <jason@yorick.cygnus.com>
+2001-04-24 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (tsubst_decl): Don't mess with the global value of an
- un-mangled DECL_ASSEMBLER_NAME.
+ Lazy __FUNCTION__ generation.
+ * cp-tree.def (FUNCTION_NAME): Remove.
+ * cp-tree.h (function_name_declared_p): Remove.
+ (cp_fname_init): Prototype.
+ * decl.c (init_decl_processing): Don't generate __FUNCTION__ et al ids,
+ don't call declare_function_name. Call start_fname_decls.
+ (cp_make_fname_decl): Adjust parameters. Generate the name. Don't
+ clobber the line number.
+ (cp_fname_init): New function.
+ (start_function): Call start_fname_decls.
+ (finish_function): Call finish_fname_decls.
+ * lex.c (reswords): Add slots for __FUNCTION__ et al.
+ (rid_to_yy): Add mappings for __FUNCTION__ et al.
+ * optimize.c (maybe_clone_body): Remove function_name_declared_p.
+ * parse.y (VAR_FUNC_NAME): New token.
+ (primary): Add VAR_FUNC_NAME.
+ * pt.c (tsubst_decl): Adjust a DECL_PRETTY_FUNCTION_P's
+ generation.
+ (tsubst, FUNCTION_NAME case): Remove.
+ (tsubst_copy, FUNCTION_NAME case): Remove.
+ (tsubst_expr, DECL_STMT case): Be careful with a
+ DECL_PRETTY_FUNCTION_P.
+ (instantiate_decl): Remove function_name_declared_p.
+ * semantics.c (begin_compound_statement): Don't call
+ declare_function_name here.
+ (setup_vtbl_ptr). Don't save & restore function_name_declared_p.
+ (finish_translation_unit): Call finish_fname_decls.
+ (expand_body): Remove function_name_declared_p.
+ * typeck2.c (digest_init): Allow any ERROR_MARK.
-1998-11-03 Christopher Faylor <cgf@cygnus.com>
+2001-04-24 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (init_decl_processing): Remove CYGWIN conditional
- since CYGWIN is now able to deal with trapping signals.
+ * pt.c (tsubst_decl): Use VOID_TYPE_P.
+ * semantics.c: Fix some typos.
-Sat Nov 7 15:48:02 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+2001-04-23 Phil Edwards <pme@sources.redhat.com>
- * cp-tree.h: Don't include gansidecl.h.
- * exception.cc: Include gansidecl.h (since we don't include config.h)
- * g++spec.c: Don't include gansidecl.h.
+ * cp/decl2.c (flag_honor_std): Always initialize to 1.
-1998-11-06 Mark Mitchell <mark@markmitchell.com>
+2001-04-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * cp-tree.h (lang_decl_flags): Add defined_in_class. Decrease
- size of dummy.
- (DECL_DEFINED_IN_CLASS_P): New macro.
- (TEMPLATE_PARMS_FOR_INLINE): Document.
- (check_static_variable_definition): New function.
- * decl.c (cp_finish_decl): Set DECL_DEFINED_IN_CLASS_P, if
- appropriate.
- (check_static_variable_definition): Split out from ...
- (grokdeclarator): Here.
- * pt.c (check_default_tmpl_args): New function, split out from ...
- (push_template_decl_real): Here.
- (instantiate_template): Fix comment.
+ * xref.c (GNU_xref_file): Use concat in lieu of xmalloc/sprintf.
-1998-11-04 Mark Mitchell <mark@markmitchell.com>
+2001-04-23 Jason Merrill <jason_merrill@redhat.com>
- * cp-tree.h (CP_TYPE_CONST_P): Make {0,1}-valued.
- (CP_TYPE_VOLATILE_P): Likewise.
- (CP_TYPE_RESTRICT_P): Likewise.
+ * except.c (build_throw): Wrap the initialization of the exception
+ object in a MUST_NOT_THROW_EXPR.
+ (do_free_exception): #if 0.
-1998-11-03 Mark Mitchell <mark@markmitchell.com>
+2001-04-20 Mark Mitchell <mark@codesourcery.com>
- * pt.c (tsubst): Use build_index_type, not build_index_2_type.
+ * cp-tree.h (finish_enum): Change prototype.
+ * decl.c (finish_enum): Reorganize.
+ * parse.y (structsp): Adjust calls to finish_enum.
-1998-11-02 Jason Merrill <jason@yorick.cygnus.com>
+2001-04-20 Nathan Sidwell <nathan@codesourcery.com>
- * class.c (instantiate_type): Be more helpful.
+ * tree.c (cp_tree_equal): Adjust final switch formatting. Add
+ 't' case.
- * decl2.c (import_export_decl): Call import_export_class.
+2001-04-20 Nathan Sidwell <nathan@codesourcery.com>
- * cp-tree.h (EMPTY_CONSTRUCTOR_P): Check !TREE_HAS_CONSTRUCTOR.
- * decl2.c (build_expr_from_tree): Propagate TREE_HAS_CONSTRUCTOR.
- * pt.c (tsubst_copy): Likewise.
+ * class.c (dfs_unshared_virtual_bases): Add ATTRIBUTE_UNUSED.
+ (layout_empty_base): Return at end flag.
+ (build_base_field): Likewise.
+ (build_base_fields): Likewise.
+ (layout_virtual_bases): Don't add 1 to eoc value.
+ (end_of_class): Use full size for empty bases.
+ (layout_class_type): Clear CLASSNEARLY_EMPTY_P if we appended
+ empty bases. Don't add 1 to eoc value. Only add trailing padding
+ if we're an empty class with no empty bases.
+ (dump_class_hierarchy): Dump size and alignment.
-1998-11-02 Mark Mitchell <mark@markmitchell.com>
+2001-04-20 Jakub Jelinek <jakub@redhat.com>
- * init.c (expand_vec_init): Fix off-by-one error.
+ * call.c (maybe_handle_ref_bind): Copy ICS_USER_FLAG and
+ ICS_BAD_FLAG.
-1998-11-02 Alexandre Oliva <oliva@dcc.unicamp.br>
+2001-04-20 Jakub Jelinek <jakub@redhat.com>
- * parse.y (apparent_template_type): New type.
- (named_complex_class_head_sans_basetype): Use it.
- * Makefile.in (CONFLICTS): One new conflict.
- * parse.c: Regenerated.
+ * search.c (lookup_field_r): If looking for type and non-TYPE_DECL
+ is found, look first if name does not match the structure name.
-1998-11-01 Mark Mitchell <mark@markmitchell.com>
+2001-04-19 Mark Mitchell <mark@codesourcery.com>
- * cp-tree.h (COMPARE_STRICT): New macro.
- (COMPARE_BASE): Likewise.
- (COMPARE_RELAXED): Likewise.
- (COMPARE_REDECLARATION): Likewise.
- (same_type_p): Likewise.
- (same_or_base_type_p): Likewise.
- * call.c (standard_conversion): Use them, in place of comptypes
- with numeric arguments.
- (reference_binding): Likewise.
- (convert_like): Likewise.
- (build_over_call): Likewise.
- (is_subseq): Likewise.
- (is_properly_derived_from): Likewise.
- (compare_ics): Likewise.
- (joust): Likewise.
- * class.c (delete_duplicate_fields_1): Likewise.
- (resolves_to_fixed_type_p): Likewise.
- (instantiate_type): Likewise. Remove #if 0'd code.
- * decl.c (decls_match): Likewise. Use COMPARE_REDECLARATION here.
+ * cp-tree.h (DECL_LANGUAGE): Don't assume DECL_LANG_SPECIFIC is
+ set.
+ (SET_DECL_LANGUAGE): New macro.
+ * decl.c (duplicate_decls): Use SET_DECL_LANGUAGE.
(pushdecl): Likewise.
- (lookup_name_real): Likewise.
- (grokdeclarator): Likewise. Check for illegal array declarations.
- (grokparms): Likewise.
- (grok_op_properties): Likewise.
- * decl2.c (check_classfn): Likewise.
- * friend.c (is_friend): Likewise.
- (make_friend_class): Likewise.
- * init.c (expand_aggr_init): Likewise.
- (expand_vec_init): Likewise.
- * pt.c (is_member_template_class): Remove declaration.
- (is_specialization_of): Use COMPARE_* and new macros.
- (comp_template_parms): Likewise.
- (convert_nontype_argument): Likewise.
- (coerce_template_template_parms): Likewise.
- (template_args_equal): Likewise.
- (lookup_template_class): Likewise.
- (type_unification_real): Likewise.
- (unify): Likewise.
- (get_bindings_real): Likewise.
- * search.c (covariant_return_p): Likewise.
- (get_matching_virtual): Likewise.
- * sig.c (match_method_types): Likewise.
- * tree.c (vec_binfo_member): Likewise.
- (cp_tree_equal): Likewise.
- * typeck.c (common_type): Likewise.
- (comp_array_types): Likewise. Get issues involving unknown array
- bounds right.
- (comptypes): Update comments. Use new flags.
- (comp_target_types): Use new macros.
- (compparms): Likewise.
- (comp_target_parms): Likewise.
- (string_conv_p): Likewise.
- (build_component_ref): Likewise.
- (build_indirect_ref): Likewise.
- (build_conditional_expr): Likewise.
- (build_static_cast): Likewise.
- (build_reinterpret_cast): Likewise.
- (build_const_cast): Likewise.
- (build_modify_expr): Likewise.
- (convert_for_assignment): Likewise.
- (comp_ptr_ttypes_real): Likewise.
- (ptr_reasonably_similar): Likewise.
- (comp_ptr_ttypes_const): Likewise.
-
-1998-10-31 Jason Merrill <jason@yorick.cygnus.com>
-
- * rtti.c (build_dynamic_cast_1): Fix cut-and-paste error.
-
-1998-10-30 Mark Mitchell <mark@markmitchell.com>
-
- * decl2.c (delete_sanity): Pass integer_zero_node, not
- integer_two_node, to build_vec_delete.
- * init.c (build_array_eh_cleanup): Remove.
- (expand_vec_init_try_block): New function.
- (expand_vec_init_catch_clause): Likewise.
- (build_vec_delete_1): Don't deal with case that auto_delete_vec
- might be integer_two_node anymore.
- (expand_vec_init): Rework for initialization-correctness and
- exception-correctness.
- * typeck2.c (process_init_constructor): Make mutual exclusivity
- of cases more obvious.
-
-1998-10-29 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (lookup_name_real): OK, only warn if not lexing.
- Simplify suggested fix.
-
- * cp-tree.h (IDENTIFIER_MARKED): New macro.
- * search.c (lookup_conversions): Use breadth_first_search.
- (add_conversions): Avoid adding two conversions to the same type.
- (breadth_first_search): Work with base binfos, rather
- than binfos and base indices.
- (get_virtual_destructor): Adjust.
- (tree_has_any_destructor_p): Adjust.
- (get_matching_virtual): Adjust.
-
- * pt.c (push_template_decl_real): Generalize check for incorrect
- number of template parms.
- (is_member_template_class): #if 0.
-
-1998-10-29 Richard Henderson <rth@cygnus.com>
-
- * Makefile.in (cc1plus): Put CXX_OBJS, and thence @extra_cxx_objs@,
- last.
-
-1998-10-28 Zack Weinberg <zack@rabi.phys.columbia.edu>
-
- * lex.c: Call check_newline from lang_init always. After
- calling cpp_start_read, set yy_cur and yy_lim to read from the
- cpplib token buffer.
-
-1998-10-28 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (instantiate_type): Don't consider templates for a normal
- match.
-
- * class.c (finish_struct_1): Don't complain about non-copy
- assignment ops in union members.
-
- * class.c (build_vtable): Don't pass at_eof to import_export_vtable.
- (prepare_fresh_vtable): Likewise.
- (finish_struct_1): Don't call import_export_class.
- * decl2.c (finish_vtable_vardecl): Do import/export stuff.
- (finish_prevtable_vardecl): Lose.
- (finish_file): Don't call it.
- * pt.c (instantiate_class_template): Likewise.
- * cp-tree.h: Remove it.
-
- * init.c (build_delete): Reset TYPE_HAS_DESTRUCTOR here.
- * decl.c (finish_function): Not here.
- (start_function): Do set DECL_INITIAL.
-
- * pt.c (push_template_decl_real): Complain about default template
- args for enclosing classes.
-
- * call.c (add_function_candidate): Treat conversion functions
- as coming from the argument's class.
- * cp-tree.h (DECL_CONV_FN_P): New fn.
- (DECL_DESTRUCTOR_P): Also check DECL_LANGUAGE.
- * class.c (add_method): Use DECL_CONV_FN_P.
- * decl2.c (check_classfn): Likewise.
- * error.c (dump_function_name): Likewise.
- (dump_function_decl): Likewise.
- * pt.c (fn_type_unification): Likewise.
- * search.c (add_conversions): Likewise.
-
-1998-10-27 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (do_identifier): Also generate LOOKUP_EXPR for RESULT_DECL.
- * method.c (hack_identifier): Also check for using RESULT_DECL
- from outer context.
-
-1998-10-27 Mark Mitchell <mark@markmitchell.com>
-
- * decl.c (grokdeclarator): Use type_quals, rather than constp,
- consistently.
-
-1998-10-27 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (standard_conversion): instantiate_type here.
- (reference_binding): And here.
- (implicit_conversion): Not here.
- (build_op_delete_call): No need to cons up an OVERLOAD.
- * cvt.c (cp_convert_to_pointer): instantiate_type here.
- (convert_to_reference): And here.
- * decl.c (grok_reference_init): Not here.
- (grokparms): Or here.
- * typeck2.c (digest_init): Or here.
- * typeck.c (decay_conversion): Take the address of overloaded
- functions, too.
- (require_instantiated_type): Lose.
- (convert_arguments): Don't handle unknown types here.
- (build_c_cast): Likewise.
- (build_binary_op): Gut.
- (build_conditional_expr): Don't require_instantiated_type.
- (build_modify_expr): Likewise.
- (build_static_cast): Don't instantiate_type.
- (build_reinterpret_cast): Likewise.
- (build_const_cast): Likewise.
- (convert_for_initialization): Likewise.
- (build_ptrmemfunc): Use type_unknown_p.
- (convert_for_assignment): Also do default_conversion on overloaded
- functions. Hand them off to ocp_convert.
+ (build_library_fn_1): Likewise.
+ (build_cp_library_fn): Likewise.
+ (grokfndecl): Likewise.
+ (grokvardecl): Mark `extern "C"' variables as having C linkage.
+ * decl2.c (grokclassfn): Use SET_DECL_LANGUAGE.
+ * lex.c (retrofit_lang_decl): Likewise.
+ * mangle.c (mangle_decl_string): Don't mangle the names of
+ variables declared with C language linkage.
+ * semantics.c (finish_member_declaration): Use SET_DECL_LANGUAGE.
+
+2001-04-18 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * semantics.c (simplify_aggr_init_exprs_r): Don't restore
+ flag_access_control from uninitialized storage.
+
+2001-04-15 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (TYPE_PTRMEM_CLASS_TYPE): Improve documentation.
+ * mangle.c (write_pointer_to_member_type): Fix mangling of
+ pointers to cv-qualified member function types.
+
+ * init.c (build_delete): Create a SAVE_EXPR for the address if
+ we're going to use it more than once.
+
+2001-04-13 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (DELTA2_FROM_PTRMEMFUNC): Remove.
+ (expand_ptremfunc_cst): Change prototype.
+ (delta2_from_ptrmemfunc): Remove.
+ * expr.c (cplus_expand_constant): Adjust call to
+ expand_ptrmemfunc_cst.
+ * typeck.c (build_ptrmemfunc1): Simplify.
+ (build_ptrmemfunc): Make sure that casting a PTRMEM_CST still
+ results in a constant.
+ (expand_ptrmemfunc_cst): Remove idx and delta2 parameters.
+ (delta2_from_ptrmemfunc): Remove.
+ (pfn_from_ptrmemfunc): Adjust call to expand_ptrmemfunc_cst.
+
+2001-04-12 Jason Merrill <jason_merrill@redhat.com>
+
+ * cp-tree.h (decl_namespace_list): New macro.
+ (struct saved_scope): Add decl_ns_list.
+ * decl.c (mark_saved_scope): Mark it.
+ * decl2.c: Lose static decl_namespace_list.
+ (init_decl2): Don't save it.
+
+2001-04-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h (warn_return_type, yylex): Delete redundant
+ declarations.
-1998-10-26 Mark Mitchell <mark@markmitchell.com>
+ * decl.c (current_class_depth, global_namespace): Likewise.
- * error.c (dump_decl): Deal with TEMPLATE_DECLs that are
- VAR_DECLs. Handle vtables whose DECL_CONTEXT is not a type.
+ * decl2.c (current_class_depth, flag_gnu_xref): Likewise
- * class.c (finish_struct_1): Use build_cplus_array_type to build
- array types.
- * decl.c (init_decl_processing): Likewise.
- * except.c (expand_end_eh_spec): Likewise.
- * search.c (expand_upcast_fixups): Simplify very slightly.
+ * repo.c (flag_use_repository): Likewise.
-1998-10-26 Jason Merrill <jason@yorick.cygnus.com>
+2001-04-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * decl.c (grokdeclarator): Complain about a variable using
- constructor syntax coming back null from start_decl.
+ * cp-tree.h (pedantic, convert, global_bindings_p, insert_block,
+ set_block, pushdecl, getdecls, gettags, init_decl_processing,
+ maybe_build_cleanup, copy_lang_decl, prep_stmt, lvalue_p,
+ lvalue_or_else, print_lang_statistics, comp_target_types,
+ unsigned_type, signed_type, signed_or_unsigned_type,
+ build_function_call, mark_addressable, incomplete_type_error):
+ Delete redundant declarations.
- * friend.c (make_friend_class): Complain about trying to make
- a non-class type a friend.
+2001-04-11 Jason Merrill <jason_merrill@redhat.com>
- * decl.c (grokfndecl): Set DECL_INITIAL for a defn here.
- (start_function): Not here.
+ * cp-tree.h (TYPE_LINKAGE_IDENTIFIER): New macro.
+ (TYPE_ANONYMOUS_P): New macro.
+ (TAGGED_TYPE_P): New macro.
+ * decl.c (check_tag_decl): Use TYPE_ANONYMOUS_P.
+ (grokfndecl, grokvardecl, grokdeclarator): Likewise.
+ * tree.c (no_linkage_helper): Likewise.
+ * semantics.c (begin_class_definition): Likewise.
+ * pt.c (convert_template_argument): Likewise.
+ * lex.c (check_for_missing_semicolon): Likewise.
-1998-10-26 Brendan Kehoe <brendan@cygnus.com>
+2001-04-12 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (grokdeclarator): Disallow `explicit' in a friend declaration.
+ * class.c (dfs_unshared_virtual_bases): New function.
+ (mark_primary_bases): Call it.
+ (check_bases): Ignore virtual bases when determining
+ nearly-emptiness.
-1998-10-26 Jason Merrill <jason@yorick.cygnus.com>
+2001-04-12 Nathan Sidwell <nathan@codesourcery.com>
- * typeck2.c (process_init_constructor): Only skip anonymous fields
- if they are bitfields.
+ * method.c (make_thunk): Clear DECL_CLONED_FUNCTION.
- * cp-tree.def (TYPEOF_TYPE): New code.
- * error.c (dump_type_real): Handle it.
- * pt.c (tsubst): Likewise.
- * tree.c (search_tree): Likewise.
- * semantics.c (finish_typeof): New fn.
- * parse.y (typespec): Use it.
- * cp-tree.h: Declare it.
+2001-04-11 Mark Mitchell <mark@codesourcery.com>
-1998-10-26 Manfred Hollstein <manfred@s-direktnet.de>
+ * optimize.c (maybe_clone_body): Copy DECL_NUM_STMTS from the
+ cloned function to the clone.
- * cp-tree.h (FORMAT_VBASE_NAME): Make definition unconditional.
+2001-04-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-1998-10-26 Jason Merrill <jason@yorick.cygnus.com>
+ * Make-lang.in (cp/semantics.o): Depend on $(EXPR_H).
- * typeck.c (convert_arguments): Don't handle pmf references
- specially.
+ * semantics.c: Include expr.h.
- * init.c (build_member_call): Don't try to convert to the base type
- if it's ambiguous or pedantic.
+2001-04-11 Nathan Sidwell <nathan@codesourcery.com>
- * typeck2.c (check_for_new_type): Only depend on pedantic for
- C-style casts.
+ * method.c (implicitly_declare_fn): Commonize code for copy ctor
+ and assignment op. Set TREE_USED for parameter.
-1998-10-25 Mark Mitchell <mark@markmitchell.com>
+2001-04-10 Mark Mitchell <mark@codesourcery.com>
- * decl.c (grokdeclarator): Set DECL_NONCONVERTING_P for all
- non-converting constructors.
+ * class.c (find_final_overrider_data): Add `candidates'.
+ (dfs_find_final_overrider): Don't issue error messages
+ prematurely.
+ (find_final_overrider): Issue error messages here.
+ (build_base_field): Don't warn about amgibuous direct bases here.
+ (warn_about_ambiguous_direct_bases): New function.
+ (layout_class_type): Use it.
-1998-10-24 Martin von Löwis <loewis@informatik.hu-berlin.de>
+2001-04-10 Richard Henderson <rth@redhat.com>
- * gxxint.texi: Correct documentation for n, N, Q, and B.
+ * typeck.c (build_array_ref): Push the array reference inside
+ COMPOUND_EXPR and COND_EXPR.
-1998-10-23 Martin von Löwis <loewis@informatik.hu-berlin.de>
+2001-04-05 Mark Mitchell <mark@codesourcery.com>
- * parse.y (condition): Convert VAR_DECL from reference to indirect
- reference.
-
-1998-10-23 Andrew MacLeod <amacleod@cygnus.com>
-
- * exception.cc (__cp_pop_exception): Free the original exception
- value, not the potentially coerced one.
-
-1998-10-23 Mark Mitchell <mark@markmitchell.com>
-
- * Makefile.in (hash.h): Run gperf when necessary.
-
- * cp-tree.h (CP_TYPE_READONLY): Remove.
- (CP_TYPE_VOLATILE): Likewise.
- (CP_TYPE_QUALS): New macro.
- (CP_TYPE_CONST_P): Likewise.
- (CP_TYPE_VOLATILE_P): Likewise.
- (CP_TYPE_RESTRICT_P): Likewise.
- (CP_TYPE_CONST_NON_VOLATILE_P): Likewise.
- (cp_build_type_variant): Rename to ...
- (cp_build_qualified_type): New function.
- (c_apply_type_quals_to_decl): Declare.
- (SIGNATURE_POINTER_NAME_FORMAT): Modify to allow `restrict'.
- (SIGNATURE_REFERENCE_NAME_FORMAT): Likewise.
- (cp_type_qual_from_rid): New function.
- (compparms): Remove unused parameter. All callers changed.
- (cp_type_quals): New function.
- (at_least_as_qualified_p): Likewise.
- (more_qualified_p): Likewise.
-
- * call.c (standard_conversion): Replace calls to
- cp_build_type_variant with cp_build_qualified_type. Use
- CP_TYPE_QUALS to get qualifiers and at_least_as_qualified_p to
- compare them. Use CP_TYPE_* macros to check qualifiers.
- (reference_binding): Likewise.
- (implicit_conversion): Likewise.
- (add_builtin_candidates): Likewise.
- (build_over_call): Likewise.
- * class.c (overrides): Compare all qualifiers, not just `const',
- on method declarations.
- * cvt.c (convert_to_reference): More CP_TYPE_QUALS conversion, etc.
- (convert_pointer_to_real): Likewise.
- (type_promotes_to): Likewise.
- * decl.c (check_for_uninitialized_const_var): New function.
- (init_decl_processing): More CP_TYPE_QUALS conversion, etc.
- (cp_finish_decl): Use check_for_uninitialized_const_var.
- (grokdeclarator): More CP_TYPE_QUALS conversion, etc. Update to
- handle `restrict'.
- (grok_ctor_properties): Likewise.
- (grok_op_properties): Likewise.
+ * cp-tree.h (DECL_THIS_INLINE): Rename to DECL_DECLARED_INLINE_P.
+ * decl.c (duplicate_decls): Adjust accordingly.
+ (maybe_commonize_var): Likewise.
+ (grokfndecl): Likewise.
(start_function): Likewise.
- (rever_static_member_fn): Likewise.
- * decl2.c (grok_method_quals): Likewise.
- (grokfield): Likewise.
- * error.c (dump_readonly_or_volatile): Rename to ...
- (dump_qualifiers): New function. Handle `restrict'.
- (dump_type_real): Use it.
- (dump_aggr_type): Likewise.
- (dump_type_prefix): Likewise.
- (dump_type_suffix): Likewise.
- (dump_function_decl): Likewise.
- (cv_as_string): Likewise.
- * gxx.gperf: Add __restrict and __restrict__.
- * gxxint.texi: Document `u' as used for `__restrict', and a few
- other previously undocumented codes.
- * hash.h: Regenerated.
- * init.c (expand_aggr_init): More CP_TYPE_QUALS conversion, etc.
- (build_member_call): Likewise.
- (build_new_1): Likewise.
- * lex.c (init_parse): Add entry for RID_RESTRICT.
- (cons_up_default_function): More CP_TYPE_QUALS conversion, etc.
- (cp_type_qual_from_rid): Define.
- * lex.h (enum rid): Add RID_RESTRICT.
- * method.c (process_modifiers): Deal with `restrict'.
- * parse.y (primary): More CP_TYPE_QUALS conversion, etc.
- * parse.c: Regenerated.
- * pt.c (convert_nontype_argument): More CP_TYPE_QUALS conversion, etc.
- (tsubst_aggr_type): Likewise.
- (tsubst): Likewise.
- (check_cv_quals_for_unify): Likewise.
- (unify): Likewise.
- * rtti.c (init_rtti_processing): Likewise.
- (build_headof): Likewise.
- (get_tinfo_var): Likewise.
- (buidl_dynamic_cast_1): Likewise. Fix `volatile' handling.
- (expand_class_desc): Likewise.
- (expand_attr_desc): Likewise.
- (synthesize_tinfo_fn): Likewise.
- * search.c (covariant_return_p): Likewise. Fix `volatile' handling.
- (get_matching_virtual): Likewise.
- (expand_upcast_fixups): Likewise.
- * sig.c (build_signature_pointer_or_reference_name): Take
- type_quals, not constp and volatilep.
- (build_signature_pointer_or_reference_type): Likewise.
- (match_method_types): More CP_TYPE_QUALS conversion, etc.
- (build_signature_pointer_constructor): Likewise.
- (build_signature_method_call): Likewise.
- * tree.c (build_cplus_array_type): Likewise.
- (cp_build_type_variant): Rename to ...
- (cp_build_qualified_type): New function. Deal with `__restrict'.
- (canonical_type_variant): More CP_TYPE_QUALS conversion, etc.
- (build_exception_variant): Likewise.
- (mapcar): Likewise.
- * typeck.c (qualif_type): Likewise.
- (common_type): Likewise.
- (comptypes): Likewise.
- (comp_cv_target_types): Likewise.
- (at_least_as_qualified_p): Define.
- (more_qualified_p): Likewise.
- (comp_cv_qualification): More CP_TYPE_QUALS conversion, etc.
- (compparms): Likewise.
- (inline_conversion): Likewise.
- (string_conv_p): Likewise.
- (build_component_ref): Likewise.
- (build_indirect_ref): Likewise.
- (build_array_ref): Likewise.
- (build_unary_op): Likewise.
- (build_conditional_expr): Likewise.
- (build_static_cast): Likewise.
- (build_c_cast): Likewise.
- (build_modify_expr): Likewise.
- (convert_For_assignment): Likewise.
- (comp_ptr_ttypes_real): Likewise.
- (cp_type_quals): New function.
-
-1998-10-23 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h (CP_TYPE_READONLY): New macro to handle arrays.
- (CP_TYPE_VOLATILE): Likewise.
- * decl.c (grokdeclarator): Use them.
- * tree.c (canonical_type_variant): Likewise.
-
-1998-10-22 Martin von Löwis <loewis@informatik.hu-berlin.de>
-
- * parse.y (named_class_head): Push into class while parsing the
- base class list.
- * decl2.c (push_scope, pop_scope): New functions.
- * cp-tree.h: Declare them.
- * init.c (build_new_1): Delay cleanup until end of full expression.
-
-1998-10-21 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_component_ref): Use of a type here is an error.
-
-1998-10-19 Jason Merrill <jason@yorick.cygnus.com>
+ (start_method): Likewise.
+ * decl2.c (key_method): Likewise.
+ (import_export_decl): Likewise.
+ * method.c (implicitly_declare_fn): Likewise.
+ * optimize.c (maybe_clone_body): Likewise.
+
+2001-04-05 Benjamin Kosnik <bkoz@redhat.com>
+
+ * lang-specs.h: Add __DEPRECATED.
+
+Thu Apr 5 16:54:29 2001 J"orn Rennecke <amylaar@redhat.com>
+
+ * search.c (get_dynamic_cast_base_type): When building a new
+ constant, set its type to ssizetype.
+
+2001-04-04 Jakub Jelinek <jakub@redhat.com>
+
+ * optimize.c (expand_call_inline): Only add newly inlined statements
+ into inlined_stmts.
+
+2001-04-03 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (OPERATOR_ASSIGN_FORMAT): Remove.
+ (OPERATOR_FORMAT): Likewise.
+ (OPERATOR_TYPENAME_FORMAT): Likewise.
+ * operators.def: Remove old name-mangling information.
+ * decl.c (grok_op_properties): Adjust accordingly.
+ * lex.c (init_operators): Likewise.
+ * rtti.c (get_tinfo_decl): Issue error messages about types that
+ have variable size.
+
+2001-04-03 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (import_export_decl): Don't call import_export_class
+ when processing an inline member function.
+ * semantics.c (expand_body): Call import_export_decl before
+ emitting inline functions.
+
+2001-03-28 Richard Henderson <rth@redhat.com>
+
+ IA-64 ABI Exception Handling:
+ * cp-tree.def (EH_SPEC_BLOCK): New.
+ (MUST_NOT_THROW_EXPR): New.
+ * cp-tree.h: Update changed function declarations.
+ (CPTI_PUSH_EXCEPTION_IDENTIFIER): Remove.
+ (CPTI_CALL_UNEXPECTED): New.
+ (struct cp_language_function): Rename x_eh_spec_try_block
+ to x_eh_spec_block.
+ (EH_SPEC_STMTS, EH_SPEC_RAISES): New.
+ * decl.c (current_binding_level): If no current function
+ bindings, revert to scope_chain.
+ (initialize_predefined_identifiers): Remove __cp_push_exception.
+ (store_parm_decls): Use begin_eh_spec_block.
+ (finish_function): Use finish_eh_spec_block.
+ (mark_lang_function): Update for name changes.
+ * decl2.c (finish_file): No mark_all_runtime_matches.
+ * dump.c (cp_dump_tree): Handle new tree codes.
+ * error.c (dump_expr) [BIND_EXPR]: Fix typo.
+ * except.c (catch_language_init, catch_language): Remove.
+ (init_exception_processing): Don't set language code.
+ Initialize call_unexpected_node, protect_cleanup_actions,
+ eh_personality_libfunc, lang_eh_runtime_type.
+ (call_eh_info, push_eh_info, get_eh_info, get_eh_value): Remove.
+ (get_eh_type, get_eh_caught, get_eh_handlers): Remove.
+ (prepare_eh_type): Split out type canonicalizations ...
+ (build_eh_type_type): ... from here.
+ (build_eh_type_type_ref): Remove.
+ (mark_all_runtime_matches): Remove.
+ (build_exc_ptr): New.
+ (do_begin_catch, do_end_catch): New.
+ (do_pop_exception): Remove.
+ (build_terminate_handler): Remove.
+ (choose_personality_routine): Split out language choice from ...
+ (initialize_handler_parm): ... here.
+ Use MUST_NOT_THROW_EXPR.
+ (expand_start_catch_block): Use do_begin_catch. Simplify Java
+ exception object handling.
+ (expand_start_eh_spec, expand_end_eh_spec): Remove.
+ (expand_exception_blocks, alloc_eh_object): Remove.
+ (begin_eh_spec_block, finish_eh_spec_block): New.
+ (do_allocate_exception, do_free_exception): New.
+ (expand_throw): Merge into ...
+ (build_throw): ... here. Update for abi.
+ * expr.c (cplus_expand_expr): No expand_internal_throw.
+ Handle MUST_NOT_THROW_EXPR.
+ * pt.c (tsubst_expr): Handle EH_SPEC_BLOCK.
+ * semantics.c (*) Update for except.h name changes.
+ (genrtl_try_block): No protect_with_terminate.
+ (genrtl_eh_spec_block): New.
+ (genrtl_handler): Don't emit the goto here.
+ (cp_expand_stmt): Handle EH_SPEC_BLOCK.
+ (genrtl_finish_function): Don't expand_exception_blocks.
+ * tree.c (cp_statement_code_p): Handle EH_SPEC_BLOCK.
+
+2001-03-28 Richard Henderson <rth@redhat.com>
+
+ * decl.c (struct named_label_list): Rename eh_region to
+ in_try_scope, add in_catch_scope.
+ (struct binding_level): Rename eh_region to is_try_scope,
+ add is_catch_scope.
+ (note_level_for_try): Rename from note_level_for_eh.
+ (note_level_for_catch): New.
+ (poplevel): Copy both is_try_scope and is_catch_scope to
+ the named_label_list struct.
+ (check_previous_goto_1): Don't check for catch block via
+ DECL_ARTIFICIAL; use in_try_scope instead.
+ (check_goto): Likewise.
+ * cp-tree.h (note_level_for_try, note_level_for_catch): Declare.
+ * except.c (expand_start_catch_block): Call note_level_for_catch.
+ * semantics.c (begin_compound_stmt): Update for note_level_for_try.
+
+2001-03-27 Richard Henderson <rth@redhat.com>
+
+ * except.c: Use USING_SJLJ_EXCEPTIONS instead of
+ exceptions_via_longjmp.
+
+2001-03-27 Phil Edwards <pme@sources.redhat.com>
+
+ * pt.c (check_default_tmpl_args): Make error messages clearer.
+
+2001-03-26 Phil Edwards <pme@sources.redhat.com>
+
+ * error.c: Also undefine 'A' macro used for cp_printers definition.
+
+2001-03-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Make-lang.in: Depend on $(SYSTEM_H), not system.h.
+
+2001-03-26 Mike Yang <yang@research.att.com>
+ Mark Mitchell <mark@codesourcery.com>
+
+ * dump.c (dump_access): New function.
+ (cp_dump_tree): Use it. Dump basetype information for class
+ types.
- Revamp references to member functions.
- * method.c (hack_identifier): Call build_component_ref for a
- reference to a member function.
- * typeck.c (build_component_ref): Only return a single function
- if it's static. Otherwise, return a COMPONENT_REF.
- (build_x_function_call): Handle a COMPONENT_REF.
- (build_unary_op): Handle all unknown-type things.
- * decl2.c (arg_assoc): Handle COMPONENT_REF.
- * class.c (instantiate_type): Complain if the function we get is a
- nonstatic member function. Remove code for finding "compatible"
+2001-03-26 Mark Mitchell <mark@codesourcery.com>
+
+ * Makefile.in (optimize.o): Depend on params.h.
+ (duplicate_decls): Copy DECL_NUM_STMTS, not DECL_FRAME_SIZE.
+ (init_decl_processing): Set flag_no_inline when doing
+ inlining-on-trees.
+ * optimize.c: Include params.h.
+ (struct inline_data): Improve documentation of FNS. Add
+ FIRST_INLINED_FN, INLINED_STMTS, and CLONING_P.
+ (INSNS_PER_STMT): New macro.
+ (remap_block): Use CLONING_P.
+ (inlinable_function_p): Don't inline big functions.
+ (expand_call_inline): Keep track of how much inlining we've done.
+ (optimize_function): Set FIRST_INLINED_FN.
+ (maybe_clone_body): Set CLONING_P.
+ * semantics.c (simplify_aggr_init_exprs_r): Fix typing problems in
+ tree nodes.
+ (genrtl_finish_function): Clear DECL_DEFER_OUTPUT before calling
+ rest_of_compilation. Clear DECL_RTL for local variables
+ afterwards.
+ (clear_decl_rtl): New function.
+
+2001-03-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ Implement DR 209
+ * cp-tree.h (skip_type_access_control,
+ reset_type_access_control): Prototype.
+ * decl.c (grokdeclarator): Access of friends is not checked.
+ * parse.y (component_decl_list): Reset type access control.
+ * semantics.c (decl_type_access_control): Clear
+ current_type_lookups.
+ (save_type_access_control): Don't save if not deferring.
+ (skip_type_access_control, reset_type_access_control): New
functions.
- * pt.c (tsubst_copy): Handle NOP_EXPR.
- * tree.c (build_dummy_object): New fn.
- (maybe_dummy_object): New fn.
- (is_dummy_object): New fn.
- * cp-tree.h: Declare them.
- * cvt.c (cp_convert_to_pointer): Use maybe_dummy_object.
- * error.c (dump_expr, case OFFSET_REF): Use is_dummy_object.
- * init.c (build_member_call): Use maybe_dummy_object and
- is_dummy_object.
- (build_offset_ref): Use maybe_dummy_object.
- (resolve_offset_ref): Use is_dummy_object.
- * typeck.c (build_x_function_call): Call build_dummy_object.
- (unary_complex_lvalue): Call is_dummy_object.
-
- * typeck.c (build_component_addr): Make sure field is a field.
-
- * call.c (build_new_op): Delete obsolete code.
-
- * pt.c (tsubst, TEMPLATE*PARM*): Abort if we don't have any args.
-
-1998-10-18 Martin von Löwis <loewis@informatik.hu-berlin.de>
-
- * decl2.c (validate_nonmember_using_decl): Fix using-directives of
- std if std is ignored.
-
-1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokvardecl): Fix thinko.
-
- * decl.c (grokdeclarator): Embedded attrs bind to the right,
- not the left.
-
- * parse.y (fn.def2): Fix 'attrs' format.
-
-1998-10-18 Alastair J. Houghton <ajh8@doc.ic.ac.uk>
-
- * Makefile.in (CONFLICTS): Update.
- * parse.y (expr_or_declarator_intern): New rule.
- (expr_or_declarator, direct_notype_declarator, primary,
- functional_cast): Use it.
- (notype_declarator_intern): New rule.
- (notype_declarator, complex_notype_declarator): Use it.
-
-1998-10-17 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokfndecl): Set DECL_CONTEXT to namespace if appropriate.
- (grokvardecl): Likewise.
-
-Sat Oct 17 23:27:20 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * class.c (make_method_vec): Cast 1st argument of `bzero' to (PTR).
- (add_method): Likewise for arguments 1 & 2 of `bcopy'.
-
- * decl.c (signal_catch): Mark with ATTRIBUTE_NORETURN.
-
- * pt.c (process_partial_specialization): Cast 1st argument of
- `bzero' to (PTR).
-
- * tree.c (build_base_fields): Cast `base_align' to (int) when
- comparing against one.
-
-1998-10-16 Mark Mitchell <mark@markmitchell.com>
-
- * decl.c (lookup_name_real): Handle template parameters for member
- templates where said parameters have the same name as the
- surrounding class.
-
- * decl.c (expand_static_init): Build cleanups before entering the
- anonymous function used to do them to avoid access-checking
- confusion.
-
- * decl.c (grokfndecl): Add back call to cplus_decl_attributes
- accidentally removed by previous change, and make DECL_RTL here.
- * class.c (add_method): Don't make DECL_RTL here.
-
- * pt.c (for_each_template_parm): Don't examine uninstantiated
- default arguments.
+ (begin_class_definition): Do type access control for basetypes.
+ Start deferred access control.
+ (finish_class_definition): Resume immediate access control if
+ this is a local class.
-1998-10-16 Dave Brolley <brolley@cygnus.com>
+2001-03-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * lex.c (real_yylex): Fix unaligned access of wchar_t.
+ * class.c (add_method): Use memcpy/memmove, not bcopy.
-1998-10-16 Mark Mitchell <mark@markmitchell.com>
-
- * class.c (add_method): Fix documentation to reflect previous
- changes. Check for duplicate method declarations here.
- * decl.c (decls_match): Handle FUNCTION_DECL vs TEMPLATE_DECL
- correctly; such things never match.
- (grokfndecl): Don't look for duplicate methods here.
- * decl2.c (check_classfn): Don't assume names are mangled.
- Don't add bogus member function declarations to a class before the
- class type is complete.
- (grokfield): Reformat error message.
- * method.c (set_mangled_name_for_decl): Don't mangle names while
- processing_template_decl.
-
-1998-10-16 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_indirect_ref): Complain about a pointer to data
- member, too.
- * typeck2.c (build_m_component_ref): Don't indirect a pointer to
- data member.
- * init.c (resolve_offset_ref): Don't undo the above.
-
- * cp-tree.h (DECL_C_BIT_FIELD, SET_DECL_C_BIT_FIELD): New macros.
- (struct lang_decl_flags): Add `bitfield'.
- * class.c (finish_struct_1): Use DECL_C_BIT_FIELD instead of
- DECL_BIT_FIELD.
- * decl2.c (grokbitfield, grok_alignof): Likewise.
- * init.c (build_offset_ref): Likewise.
- * typeck.c (build_component_addr, expr_sizeof): Likewise.
- * cvt.c (build_up_reference): Don't crash if taking the address
- returns error_mark_node.
-
- * decl.c (grokfndecl): Also check ctype when checking for ::main().
-
-1998-10-15 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (duplicate_decls): Likewise.
- * decl.c (grokfndecl): ::main and __builtin_* get C linkage.
- Do mangling here.
- (grokdeclarator): Instead of here.
- * friend.c (do_friend): Lose special handling of ::main and
- __builtin_*.
- * cp-tree.h (DECL_MAIN_P): Check for C linkage.
+2001-03-23 Jakub Jelinek <jakub@redhat.com>
+
+ * mangle.c (write_discriminator): Use `_0' for discriminator 1,
+ not `_'.
+
+2001-03-23 Jakub Jelinek <jakub@redhat.com>
+
+ * decl.c (local_names): Define.
+ (push_local_name): New.
+ (grok_reference_init): Return init if initializing static reference
+ variable with non-constant instead of emitting it.
+ Move expand_static_init call to cp_finish_decl.
+ (layout_var_decl): Call push_local_name.
+ (maybe_commonize_var): Allow inlining functions even if they have
+ static local variables, use comdat_linkage for them if flag_weak.
+ (check_initializer): Call obscure_complex_init if
+ grok_reference_init returned non-zero.
+ (save_function_data): Clear x_local_names.
+ (pop_cp_function_context): Free x_local_names.
+ (mark_inlined_fns): Remove.
+ (mark_lang_function): Mark x_local_names.
+ (lang_mark_tree): Don't mark DECL_ACCESS for DECL_DISCRIMINATOR_P.
+ Mark inlined_fns as tree, remove call to mark_inlined_fns.
+ * class.c (alter_access): Ensure DECL_ACCESS is never set if
+ DECL_DISCRIMINATOR_P.
+ * cp-tree.h (cp_language_function): Add x_local_names.
+ (lang_decl_flags): Add discriminator into u2.
+ (lang_decl_inlined_fns): Remove.
+ (lang_decl): inlined_fns is now a TREE_VEC.
+ (DECL_DISCRIMINATOR_P, DECL_DISCRIMINATOR): Define.
+ * optimize.c (inlinable_function_p): DECL_INLINED_FNS is now a
+ TREE_VEC, not a custom structure.
+ (optimize_function): Likewise.
+ * mangle.c (discriminator_for_local_entity): Discriminate among
+ VAR_DECL local entities.
+ * search.c (dfs_access_in_type): If DECL_DISCRIMINATOR_P, DECL_ACCESS
+ is not valid.
+
+2001-03-22 Bryce McKinlay <bryce@albatross.co.nz>
+
+ Add support for Java interface method calls.
+ * cp-tree.h (struct lang_type): Add java_interface flag.
+ (TYPE_JAVA_INTERFACE): New macro.
+ * tree.c (cp_valid_lang_attribute): Handle "java_interface" attribute
+ by setting TYPE_JAVA_INTERFACE.
+ * call.c (java_iface_lookup_fn): New static.
+ (build_over_call): If calling a method declared in a
+ TYPE_JAVA_INTERFACE, call build_java_interface_fn_ref to generate the
+ expression which resolves the function address.
+ (build_java_interface_fn_ref): New function.
+
+2001-03-22 Richard Henderson <rth@redhat.com>
+
+ * Make-lang.in (cp/except.o): Don't depend on insn-flags.h.
+ * except.c: Don't include it.
+
+2001-03-22 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
+ based on an idea from Joe Buck <jbuck@synopsys.com>
+
+ * parse.y (bad_decl, template_arg_list_ignore, arg_list_ignore):
+ New nonterminals.
+ (data_def, component_decl): Add reductions to bad_decl.
+
+2001-03-22 Jakub Jelinek <jakub@redhat.com>
+
+ * method.c (do_build_assign_ref): Don't use build_modify_expr for
+ anonymous aggregates, since they don't have assignment operator
+ method.
+ * decl.c (fixup_anonymous_aggr): Disallow ctors, dtors and copy
+ assignment operators for anonymous structure fields.
+
+2001-03-21 Jason Merrill <jason@redhat.com>
+
+ * pt.c (instantiate_decl): Abort if we see a member constant
+ instantiation that doesn't already have its initializer.
+ Downgrade explicit instantiation without definition to pedwarn.
+
+ * cp-tree.h (DECL_TINFO_FN_P, SET_DECL_TINFO_FN_P): Remove.
+ * class.c (build_vtable_entry): Don't check DECL_TINFO_FN_P.
+ (import_export_decl): Check tinfo_decl_p, not DECL_TINFO_FN_P.
+
+ * cp-tree.h (CLASSTYPE_VTABLE_NEEDS_WRITING): Remove.
+ (pending_vtables): Remove.
+ * decl2.c (pending_vtables): Remove.
+ (import_export_vtable): Use CLASSTYPE_INTERFACE_ONLY, not
+ CLASSTYPE_VTABLE_NEEDS_WRITING.
+ (import_export_class): Likewise.
+ (init_decl2): Don't mark pending_vtables.
+ * lex.c (handle_pragma_vtable): Just sorry.
+ * pt.c (instantiate_class_template): Don't mess with
+ CLASSTYPE_VTABLE_NEEDS_WRITING.
+ (mark_class_instantiated): Likewise.
+ * ptree.c (print_lang_type): Don't print it.
+ * semantics.c (begin_class_definition): Don't set it.
+
+ * pt.c (template_tail): Replace with last_pending_template.
+ (maybe_templates, maybe_template_tail): Remove.
+ (add_pending_template): Adjust.
+ (instantiate_pending_templates): Adjust.
+
+ * cp-tree.h (struct saved_scope): Remove lang_stack field.
+ (current_lang_stack): Remove.
+ * decl.c (maybe_push_to_top_level): Don't initialize it.
+ (duplicate_decls): Use current_lang_depth.
+ (xref_basetypes): Likewise.
+ * class.c (current_lang_depth): New fn.
+ (push_lang_context): Use more varray functionality.
+ (pop_lang_context): Likewise.
- * spew.c (yylex): Clear looking_for_typename if we got
- 'enum { ... };'.
+ * error.c (GLOBAL_THING): Always use '__'.
-1998-10-15 Mark Mitchell <mark@markmitchell.com>
+2001-03-21 Mark Mitchell <mark@codesourcery.com>
- * class.c (maybe_warn_about_overly_private_class): Improve error
- messages for class with only private constructors.
+ * class.c (build_clone): Clear DECL_ASSEMBLER_NAME.
- * cp-tree.def (TYPENAME_TYPE): Add to documentation.
- * cp-tree.h (TYPENAME_TYPE_FULLNAME): Document.
- (build_typename_type): New function.
- * decl.c (build_typename_type): Broken out from ...
- (make_typename_type): Use it.
- * search.c (lookup_field): Likewise.
+ * mangle.c (mangle_decl_string): Mangle the names of overloaded
+ operators, even when they have `extern "C"' linkage.
-1998-10-14 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+2001-03-19 Mark Mitchell <mark@codesourcery.com>
- * pt.c (convert_nontype_argument): Check against type_referred_to.
- * decl.c (grokvardecl): Check for declarator name before building
+ * class.c (get_vtable_decl): Use SET_DECL_ASSEMBLER_NAME,
+ COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
+ where it's not necessary.
+ (add_method): Remove optimization involving comparison of
DECL_ASSEMBLER_NAME.
+ (build_vtbl_or_vbase_field): Use SET_DECL_ASSEMBLER_NAME,
+ COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
+ where it's not necessary.
+ (check_methods): Likewise.
+ (build_clone): Likewise.
+ (built_vtt): Likewise.
+ * cp-tree.h (DECL_NEEDED_P): Likewise.
+ * decl.c (pushtag): Likewise.
+ (duplicate_decls): Likewise.
+ (pushdecl): Likewise.
+ (builtin_function): Likewise.
+ (build_library_fn_1): Set DECL_LANGUAGE for library functions.
+ (build_cp_library_fn): Likewise.
+ (maybe_commonize_var): Use SET_DECL_ASSEMBLER_NAME,
+ COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
+ where it's not necessary.
+ (make_rtl_for_nonlocal_decl): Likewise.
+ (cp_finish_decl): Likewise.
+ (grokfndecl): Likewise.
+ (grokvardecl): Likewise.
+ (grokdeclarator): Likewise.
+ (start_function): Likewise.
+ (cp_missing_return_ok_p): Likewise.
+ * decl2.c (grokclassfn): Likewise.
+ (check_classfn): Likewise.
+ (finish_static_data_member_decl): Likewise.
+ (grokfield): Likewise.
+ * error.c (GLOBAL_IORD_P): Remove.
+ (dump_global_iord): Improve output.
+ (dump_decl): Avoid using DECL_ASSEMBLER_NAME.
+ * except.c (nothrow_libfn_p): Summarily reject any function not in
+ namespace-scope.
+ * init.c (build_java_class_ref): Don't explicitly set
+ DECL_ASSEMBLER_NAME after calling mangle_decl.
+ * mangle.c (mangle_decl_string): Handle extern "C" functions.
+ (mangle_decl): Set the DECL_ASSEMBLER_NAME for the decl.
+ * method.c (set_mangled_name_for_decl): Don't explicitly set
+ DECL_ASSEMBLER_NAME after calling mangle_decl.
+ (make_thunk): Explicitly set the DECL_ASSEMBLER_NAME and
+ IDENTIFIER_GLOBAL_VALUE for the thunk.
+ * pt.c (set_mangled_name_for_template_decl): Remove.
+ (check_explicit_specialization): Don't use it.
+ (looup_template_class): Don't set DECL_ASSEMBLER_NAME.
+ (tsubst_friend_function): Likewise.
+ (tsubst_decl): Likewise.
+ (regenerate_decl_from_template): Use COPY_DECL_ASSEMBLER_NAME.
+ * rtti.c (get_tinfo_decl): Use SET_DECL_ASSEMBLER_NAME,
+ COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
+ where it's not necessary.
+ (tinfo_base_init): Likewise.
+ (create_real_tinfo_var): Likewise.
+ * search.c (looup_field_1): Likewise.
+ * semantics.c (finish_named_return_value): Likewise.
+ * tree.c (init_tree): Set lang_set_decl_assembler_name.
-1998-10-14 Mark Mitchell <mark@markmitchell.com>
-
- * pt.c (lookup_template_class): Add comment.
- (instantiate_class_template): Don't mark the _TYPE node for
- member class templates as an instantiation.
-
-1998-10-14 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokfndecl): Fix my thinko.
-
-1998-10-13 Jason Merrill <jason@yorick.cygnus.com>
-
- * tinfo2.cc (fast_compare): Remove.
- (before): Just use strcmp.
- * tinfo.cc (operator==): Just use strcmp.
-
-1998-10-13 Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
-
- * decl.c (grokfndecl): Don't check for linkage in `extern "C"'
- declarations.
-
-1998-10-13 Mark Mitchell <mark@markmitchell.com>
-
- * cp-tree.h (specializations_of_same_template_p): Remove.
- * search.c (get_template_base): Don't use it.
- (get_template_base_recursive): Likewise.
- * pt.c (specializations_of_same_template_p): Remove.
- (unify): Don't use it.
- (lookup_template_class): Find the correct parent when setting
- CLASSTYPE_TI_TEMPLATE.
-
-1998-10-12 Jason Merrill <jason@yorick.cygnus.com>
-
- * tinfo.cc (operator==): Always compare names.
-
-1998-10-12 Herman ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
-
- * decl.c (start_function): Fix cut-and-paste error.
-
-1998-10-12 Jason Merrill <jason@yorick.cygnus.com>
-
- * inc/typeinfo: Add #pragma interface.
- (operator!=): Just call operator==.
- * tinfo.cc: Add #pragma implementation.
- (operator==): Move from inc/typeinfo and tinfo2.cc.
- Check __COMMON_UNRELIABLE instead of _WIN32.
-
- * typeck2.c (my_friendly_abort): Add URL.
-
-1998-10-12 Alastair J. Houghton <ajh8@doc.ic.ac.uk>
-
- * decl.c (start_method): Added extra parameter for attributes.
- * cp-tree.h (start_method): Update prototype.
- * parse.y (fn.def2): Update start_method parameter list.
-
-1998-10-11 Mark Mitchell <mark@markmitchell.com>
-
- * cp-tree.h (specializations_of_same_template_p): Declare.
- * pt.c (specializations_of_same_template_p): New function.
- (unify): Use it.
- * search.c (get_template_base): Use it.
- (get_template_base_recursive): Likewise.
-
-1998-10-10 Manfred Hollstein <manfred@s-direktnet.de>
-
- * decl2.c (start_objects): Add new variable `joiner' and
- initialize it properly.
-
-1998-10-09 Mark Mitchell <mark@markmitchell.com>
-
- * search.c (expand_upcast_fixups): Tweak to match 1998-10-07
- change to vtable types.
-
- * cvt.c (ocp_convert): Avoid infinite recursion caused by
- 1998-10-03 change.
-
-1998-10-08 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (resolve_overloaded_unification): New fn.
- (try_one_overload): Likewise.
- (unify): Don't fail on unknown type.
- (type_unification_real): Likewise. Use resolve_overloaded_unification
- to handle an overloaded argument.
- (template_args_equal): Split out...
- (comp_template_args): From here.
- (determine_specialization): Also allow a template with more
- parms than were explicitly specified.
- * cp-tree.h: Add template_args_equal.
- * call.c (resolve_args): Remove TEMPLATE_ID_EXPR code.
-
-Thu Oct 8 15:58:30 1998 Anthony Green <green@cygnus.com>
-
- * semantics.c (finish_asm_stmt): Revert my 1998-09-28
- change.
-
-Thu Oct 8 06:00:19 1998 Jeffrey A Law (law@cygnus.com)
-
- * typeck.c (unsigned_type): Only return TItype nodes when
- HOST_BITS_PER_WIDE_INT is >= 64 bits.
- (signed_type): Likewise.
- * decl.c (intTI_type_node, unsigned_intTI_type_node): Only declare
- when HOST_BITS_PER_WIDE_INT is >= 64 bits.
- (init_decl_processing): Only create TItype nodes when
- HOST_BITS_PER_WIDE_INT is >= 64 bits.
- * cp-tree.h (intTI_type_node, unsigned_intTI_type_node): Only declare
- when HOST_BITS_PER_WIDE_INT is >= 64 bits.
-
-Wed Oct 7 12:32:44 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (hash.h): Add -L KR-C -F ', 0, 0' flags to gperf.
- (gxx.gperf): Update comments describing invocation flags.
- (hash.h): Regenerate using gperf 2.7.1 (19981006 egcs).
-
-1998-10-07 Mark Mitchell <mark@markmitchell.com>
-
- * class.c (finish_struct_1): Add commentary on previous change.
-
- * cp-tree.h (vtbl_ptr_type_node): New variable.
- * class.c (build_vtbl_ref): Don't indirect through the vptr; it's
- already of the right type.
- (finish_struct_1): Make the vptr be of type vtbl_ptr_type_node.
- Simplify code to grow vtable.
- * decl.c (vtbl_ptr_type_node): Define.
- (init_decl_processing): Initialize it.
-
-1998-10-06 Mark Mitchell <mark@markmitchell.com>
-
- * cp-tree.def (PTRMEM_CST): New tree node.
- * cp-tree.h (ptrmem_cst): New type.
- (lang_type): Remove local_typedecls.
- (dummy): Increase to 12 bits from 11.
- (CLASSTYPE_LOCAL_TYPEDECLS): Remove.
- (PTRMEM_CST_CLASS): New macro.
- (PTRMEM_CST_MEMBER): Likewise.
- (current_access_specifier): New variable.
- (current_class_type): Remove duplicate declaration.
- (finish_struct): Change prototype.
- (unreverse_member_declarations): New function.
- (pushdecl_class_level): Change prototype.
- (grok_enum_decls): Remove.
- (fixup_anonymous_union): New function.
- (grok_x_components): Change prototype.
- (tsubst_chain): Remove.
- (finish_member_template_decl): Likewise.
- (check_explicit_specialization): Fix indentation.
- (finish_class_definition): Change prototype.
- (finish_member_class_template): Likewise.
- (finish_member_declaration): New function.
- (check_multiple_declarators): Likewise.
- * class.c (class_stack_node_t): New type.
- (current_class_base): Remove.
- (current_class_stack): Change type.
- (current_access_specifier): New variable.
- (grow_method): Remove.
- (check_member_decl_is_same_in_complete_scope): Break out from
- finish_struct.
- (make_method_vec): New function.
- (free_method_vec): Likewise.
- (add_implicitly_declared_members): Break out from finish_struct_1.
- (free_method_vecs): New variable.
- (add_method): Rework for direct use from parser.
- (handle_using_decl): Watch for NULL_TREE while iterating through
- CLASSTYPE_METHOD_VEC.
- (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here;
- just do some error-checking.
- (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC.
- (finish_struct_1): Simplify. Use add_implicitly_declared_members.
- (finish_struct): Change prototype. Simplify; fields and methods
- are already set up at this point.
- (init_class_processing): Set up current_class_stack.
- (pushclass): Save current_access_specifier.
- (popclass): Restore it.
- (currently_open_class): Simplify.
- (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS.
- * decl.c (saved_scope): Add access_specifier.
- (maybe_push_to_top_level): Save it.
- (pop_from_top_level): Restore it.
- (maybe_process_template_type_declaration): Use
- finish_member_declaration.
- (pushtag): Likewise.
- (pushdecl_class_level): Don't return a value.
- (fixup_anonymous_union): Break out from grok_x_components.
- (shadow_tag): Use it.
- (xref_tag): Complain about using an elaborated type specifier to
- reference a template type parameter or typedef name.
- (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS.
- (current_local_enum): Remove.
- (build_enumerator): Call finish_member_declaration.
- (grok_enum_decls): Remove.
- * decl2.c (grok_x_components): Simplify.
- (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC.
- (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS.
- (merge_functions): Add to comment.
- (arg_assoc_type): Prototype.
- (arg_assoc): Pass as many arguments as there are parameters.
- * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of
- OFFSET_REF.
- * expr.c (cpls_expand_expr): Remove dead code. Handle
- PTRMEM_CST.
- * friend.c (do_friend): Lookup friends when in nested classes.
- Change comments.
- * init.c (build_offset_ref): Do lookup even for classes that are
- only partially defined.
- (decl_constant_value): Remove dead code.
- * method.c (build_overload_value): Remove hack where by TYPE was
- not a TYPE. Handle PTRMEM_CST.
- (build_template_parm_names): Don't pass a PARM_DECL where a TYPE
- should go.
- * parse.y (components, notype_components, component_decl,
- component_decl_1, component_declarator, component_declarator0):
- Now all are itype rather than ttype. Rework to add members to
- classes on the fly.
- (typesqpecqual_reserved): Use check_multiple_declarators.
- (structsp): Update class to finish_class_definition.
- (do_xref_defn): Unsplit into named_class_head.
- (access_specifier): Set current_access_specifier.
- * pt.c (set_current_access_from_decl): New function.
- (finish_member_template_decl): Don't take the parameters.
- (comp_template_args): Make more robust.
- (lookup_template_class): Don't use current_local_enum.
- (for_each_template_parm): Handle PTRMEM_CST.
- (instantiate_class_template): Use set_current_access_from_decl,
- finish_member_declaration and unreverse_member_declarations. Set
- lineno/input_filename before generating implicit member functions.
- (type_unification_real): Don't assume back-unification happens
- only for the last argument.
- (regenerate_decl_from_template): Call pushclass a bit earlier.
- (tsubst_chain): Remove.
- (tsubst_enum): Use set_current_access_from_decl.
- (set_mangled_name_for_template_decl): Fix indentation.
- * search.c (lookup_fnfields_1): Change iteration through
- CLASSTYPE_METHOD_VEC.
- (dfs_pushdecls): Likewise.
- (dfs_compress_decls): Likewise.
- (add_conversions): Likewise.
- * semantics.c (finish_class_definition): Don't take components.
- Change call to finish_struct.
- (finish_member_declaration): New function.
- (finish_member_class_template): Don't take template parameters.
- Change call to grok_x_components. Call finish_member_template_decl.
- (check_multiple_declarators): New function.
- * sig.c (append_signature_fields): Work from the TYPE_METHODS, not
- a passed in fieldlist.
- * tree.c (search_tree): Handle PTRMEM_CST.
- (mapcar): Likewise.
- * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not
- INTEGER_CSTs, for pointer-to-data members.
-
- * call.c (resolve_args): Resolve template specializations, if
- possible.
-
-Tue Oct 6 07:57:26 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (spew.o): Depend on toplev.h.
-
- * call.c (compare_ics): Initialize variables `deref_from_type2',
- `deref_to_type1' and `deref_to_type2'.
-
- * except.c (get_eh_type): Hide prototype and definition.
- (process_start_catch_block_old): Remove unused static prototype.
+2001-03-15 Gabriel Dos Reis <gdr@codesourcery.com>
- * pt.c (tsubst_decl): Initialize variable `argvec'.
+ Correct semantics restrictions checking in throw-expression.
+ * except.c (is_admissible_throw_operand): New function.
+ (build_throw): Use it.
- * spew.c: Include toplev.h.
+2001-03-14 Mark Mitchell <mark@codesourcery.com>
-1998-10-05 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (cp_make_fnname_decl): Set DECL_IGNORED_P on __FUNCTION__
+ and its ilk.
- * pt.c (instantiate_decl): Do save and restore file position.
+2001-03-14 Mark Mitchell <mark@codesourcery.com>
-1998-10-05 Martin von Löwis <loewis@informatik.hu-berlin.de>
+ * class.c (build_clone): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
+ * cp-tree.h (DECL_IN_MEMORY_P): Likewise.
+ * decl.c (duplicate_decls): Likewise.
+ (builtin_function): Likewise.
+ (build_library_fn): Likewise.
+ (build_cp_library_fn): Likewise.
+ (check_initializer): Likewise.
+ (cp_finish_decl): Likewise.
+ * decl2.c (grokfield): Likewise.
+ (grok_function_init): Remove #if 0'd code.
+ (finish_anon_union): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
+ * friend.c (do_friend): Likewise.
+ * init.c (get_temp_regvar): Likewise.
+ * method.c (make_thunk): Likewise.
+ * pt.c (tsubst_friend_function): Likewise.
+ (tsubst_decl): Likewise.
+ (regenerate_decl_from_template): Likewise.
+ * semantics.c (genrtl_named_return_value): Likewise.
+ (expand_body): Likewise.
+ (genrtl_finish_function): Likewise.
+ * tree.c (cp_tree_equal): Likewise.
- * method.c (build_decl_overload_real): Clear
- numeric_output_need_bar after __.
+2001-03-12 Nathan Sidwell <nathan@codesourcery.com>
-1998-10-05 Nathan Sidwell <nathan@acm.org>
+ * call.c (convert_like_real): Add extra semantics to INNER
+ parameter. Don't convert to temporary if a user conversion
+ gives us an lvalue that we're about to bind to a reference.
+ Set INNER to indicate pending reference binding on recursive
+ calls.
- * call.c (build_new_method_call): Issue 'incomplete type' error,
- if class is not defined.
+2001-03-10 Neil Booth <neil@daikokuya.demon.co.uk>
-1998-10-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ * cp/lex.c: Delete duplicate pending_lang_change.
- * call.c (build_object_call): Move declaration of variable
- `fn' into the scope where it is used. Don't access variable
- `fn' when it is uninitialized, instead use `fns'.
+2001-03-10 Neil Booth <neil@daikokuya.demon.co.uk>
-1998-10-04 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
+ * cp/lex.c (handle_pragma_interface, handle_pragma_implementation):
+ Similarly.
+ * cp/repo.c (get_base_filename, open_repo_file): Similarly.
+ * cp/cp-tree.h: Remove file_name_nondirectory prototype.
- * errfn.c (cp_thing): Print buf as a string not as a printf format
- to avoid problems with the operator%. Consequently, `%%' sequences
- in format are copied as `%' in buf.
+2001-03-09 Zack Weinberg <zackw@stanford.edu>
-1998-10-04 Jason Merrill <jason@yorick.cygnus.com>
+ * Make-lang.in: Add dependencies on $(TM_P_H) as appropriate.
- * pt.c (pop_tinst_level): Call extract_interface_info.
- (instantiate_decl): Don't save and restore file position.
+2001-03-08 Stan Shebs <shebs@apple.com>
- * decl.c (cp_finish_decl): Make statics in extern inlines and
- templates common, if possible and the target doesn't support weak
- symbols.
+ * cp-tree.h (set_identifier_local_value): Remove unused decl.
- * decl.c (grokdeclarator): Remove redundant calls to
- build_type_variant and some duplicated code.
- * sig.c (build_signature_reference_type): Only take the type parm.
- (build_signature_pointer_type): Likewise.
- * tree.c (build_cplus_method_type): Adjust.
- * cp-tree.h: Update.
+2001-03-06 Zack Weinberg <zackw@stanford.edu>
-1998-10-04 Mark Mitchell <mark@markmitchell.com>
+ * spew.c: Remove references to CPP_OSTRING.
- * call.c (build_over_call): Make pedwarns about dropped qualifiers
- into full-fledged errors.
- * cvt.c (convert_to_reference): Likewise.
- * typeck.c (convert_for_assignment): Likewise.
-
- * search.c (expand_upcast_vtables): In addition to unsetting
- TREE_READONLY, remove top-level const type qualifier.
-
-1998-10-03 Mark Mitchell <mark@markmitchell.com>
-
- * class.c (current_class_ptr, current_class_ref): Clarify
- documentation.
- * cvt.c (ocp_convert): Don't expect fold to remove all trivial
- NOP type conversions.
- * decl.c (decls_match): Use comptypes directly; ignore
- qualifiers on the DECL.
- (duplicate_decls): Remove qualifier checks on DECL.
- (grokdeclarator): Make the type built up include top-level
- qualifiers.
- * decl2.c (do_dtors): Fix spelling error.
- * error.c (dump_simple_decl): Don't look at qualifiers on the decl
- when printing type information.
- * init.c (build_new_1): Add documentation. Deal with the fact
- that type of allocated memory now contains qualifiers.
- * lex.c (is_global): Improve error-recovery.
- * sig.c (build_member_function_pointer): Don't cast away const
- on fields of sigtable_entry_type.
- * tree.c (lvalue_type): Don't look at top-level qualifiers on
- expressions.
- * typeck.c (decay_conversion): Likewise.
- (build_component_ref): Make sure the type of the COMPONENT_REF
- contains top-level qualifiers, as appropriate. Improve
- error-handling.
- (build_indirect_ref): Simplify. Don't strip top-level qualifiers.
- (build_array_ref): Likewise.
- (build_unary_op): Improve error-recovery.
- (unary_complex_lvalue): Make taking the address a bound member
- function an error, not a sorry.
- (build_conditional_expr): Look at the type qualifiers, not the
- qualifiers on the expression itself.
+2001-03-06 Andrew Haley <aph@redhat.com>
-1998-10-03 Jason Merrill <jason@yorick.cygnus.com>
+ * typeck.c (convert_arguments): Check that we have an fndecl.
- * decl2.c (merge_functions): Remove duplicates.
+2001-03-05 Andrew Haley <aph@redhat.com>
- * decl2.c: Add -f{no-,}implicit-inline-templates.
- (import_export_decl): Check it.
+ * typeck.c (convert_arguments): Don't do ellipsis conversion for
+ __built_in_constant_p.
- * decl.c (lookup_name_real): Template parms also take precedence
- over implicit typename. Only warn if yylex.
+2001-03-02 Nathan Sidwell <nathan@codesourcery.com>
- * typeck.c (build_conditional_expr): Only fold if ifexp is an
- INTEGER_CST.
+ * typeck.c (build_static_cast): Allow enum to enum conversions
+ as per DR 128.
- * decl2.c (finish_vtable_vardecl): Check DECL_INTERFACE_KNOWN
- instead of linkage.
+2001-03-02 Nathan Sidwell <nathan@codesourcery.com>
-1998-10-01 Jason Merrill <jason@yorick.cygnus.com>
+ * class.c (check_field_decls): Pointers to member do not a
+ non-pod struct make, as per DR 148.
- * cp-tree.h (FORMAT_VBASE_NAME): New macro.
- * class.c (build_vbase_pointer): Use it.
- * rtti.c (expand_class_desc): Likewise.
- * tree.c (build_vbase_pointer_fields): Likewise.
-
-Thu Oct 1 10:43:45 1998 Nick Clifton <nickc@cygnus.com>
-
- * decl.c (start_decl): Add invocation of
- SET_DEFAULT_DECL_ATTRIBUTES, if defined.
- (start_function): Add invocation of
- SET_DEFAULT_DECL_ATTRIBUTES, if defined.
-
- * lex.c: Replace occurrences of HANDLE_SYSV_PRAGMA with
- HANDLE_GENERIC_PRAGMAS.
-
-1998-09-28 Anthony Green <green@cygnus.com>
-
- * semantics.c (finish_asm_stmt): Always permit volatile asms.
-
-1998-09-28 Mark Mitchell <mark@markmitchell.com>
-
- * decl.c (grokdeclarator): Tighten checks for invalid
- destructors. Improve error-messages and error-recovery.
- * decl2.c (check_classfn): Don't assume that mangled destructor
- names contain type information.
-
-1998-09-25 Jason Merrill <jason@yorick.cygnus.com>
-
- * search.c (get_base_distance): Remove assert.
-
- * decl2.c (build_anon_union_vars): Don't process a field with no
- name.
- (finish_anon_union): Also complain about local anon unions with no
- members.
-
-1998-09-25 Martin von Löwis <loewis@informatik.hu-berlin.de>
+2001-03-02 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (lookup_namespace_name): If the name is a namespace,
- return it immediately.
+ * call.c (joust): cp_pedwarn when using gnu extension concerning
+ worst conversion sequences.
-Fri Sep 25 11:45:38 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+2001-03-01 Zack Weinberg <zackw@stanford.edu>
- * cp-tree.h (define_case_label): Remove unused parameter.
- (check_java_method): Likewise.
- (grokclassfn): Likewise.
- (expand_aggr_init): Likewise.
- (build_x_delete): Likewise.
- (maybe_end_member_template_processing): Likewise.
- (unshare_base_binfos): Add prototype.
- (string_conv_p): Likewise.
- (my_friendly_abort): Mark with ATTRIBUTE_NORETURN.
+ * decl.c: Replace all uses of 'boolean' with 'bool'.
- * cvt.c (build_up_reference): Remove unused parameter
- `checkconst', all callers changed.
- (build_type_conversion): Mark parameter `code' with
- ATTRIBUTE_UNUSED.
- (build_expr_type_conversion): Initialize variable `conv'.
+2001-03-01 Zack Weinberg <zackw@stanford.edu>
- * decl.c (push_namespace): Initialize variable `d'.
- (define_case_label): Remove unused parameter `decl', all callers
- changed.
+ * lang-specs.h: Add zero initializer for cpp_spec field to
+ all array elements that need one. Don't put an #ifdef inside
+ the initializer list; set a default for CPLUSPLUS_CPP_SPEC and
+ use it.
- * decl2.c (lang_decode_option): If !USE_CPPLIB, mark parameter
- `argc' with ATTRIBUTE_UNUSED.
- (grokclassfn): Remove unused parameter `cname', all callers
- changed.
- (check_java_method): Likewise for parameter `ctype'.
- (copy_assignment_arg_p): Mark parameter `virtualp' with
- ATTRIBUTE_UNUSED.
- (finish_prevtable_vardecl): Likewise for parameter `prev'.
+2001-03-01 Nathan Sidwell <nathan@codesourcery.com>
- * expr.c (extract_init): Likewise for parameters `decl' and `init'.
+ Implement using decls inside template functions.
+ * decl2.c (validate_nonmember_using_decl): Don't special case
+ fake_std_node in the global namespace. Don't reject early when
+ processing a template.
+ (do_local_using_decl): Add to statement tree. Don't do further
+ processing when building a template.
+ * pt.c (tsubst_expr, DECL_STMT case): Deal with USING_DECLs.
- * init.c (expand_aggr_init_1): Remove unused parameter
- `alias_this', all callers changed.
- (expand_aggr_init): Likewise.
- (expand_default_init): Likewise.
- (build_new_1): Initialize variable `susp'.
- (build_x_delete): Remove unused parameter `type', all callers
- changed.
+2001-03-01 Nathan Sidwell <nathan@codesourcery.com>
- * lex.c (set_typedecl_interface_info): Mark parameter `prev' with
- ATTRIBUTE_UNUSED.
- (readescape): Use (unsigned) value in shift.
- (real_yylex): Likewise. Likewise. Also cast `sizeof' to int when
- comparing to a signed quantity.
+ * decl2.c (do_nonmember_using_decl): Don't complain if we find
+ same function. Do complain about ambiguating extern "C"
+ declarations.
- * pt.c (maybe_end_member_template_processing): Remove unused
- parameter `decl', all callers changed.
- (check_explicit_specialization): Add braces around empty body in
- an else-statement.
- (current_template_args): Initialize variable `args'.
- (lookup_template_class): Likewise for variable `prev_local_enum'.
- (tsubst_decl): Likewise for variable `r'.
- (set_mangled_name_for_template_decl): Initialize variable
- `context'.
+2001-02-28 Nathan Sidwell <nathan@codesourcery.com>
- * spew.c (scan_tokens): Change type of parameter `n' to unsigned.
- Likewise for variable `i'.
- (yylex): Initialize variable `trrr'.
+ Remove floating point and complex type template constant parms.
+ * pt.c (convert_nontype_argument): Remove REAL_TYPE and
+ COMPLEX_TYPE extensions.
+ (invalid_nontype_parm_type_p): Likewise.
- * typeck.c (compparms): Mark variable `strict' with
- ATTRIBUTE_UNUSED.
+2001-02-27 Jeffrey Oldham <oldham@codesourcery.com>
- * xref.c (simplify_type): Cast argument of ctype function to
- `unsigned char'.
+ * except.c (call_eh_info): Revert "match_function"'s type.
-1998-09-24 Mark Mitchell <mark@markmitchell.com>
+2001-02-27 Nathan Sidwell <nathan@codesourcery.com>
- * cp-tree.h (language_lvalue_valid): Remove.
- * decl.c (grokdeclarator): Don't disallow references to functions.
- * tree.c (lvalue_p_1): New function, combining duplicated
- code from ...
- (lvalue_p): Use it.
- (real_lvalue_p): Likewise.
- * typeck.c (language_lvalue_valid): Remove.
- (build_modify_expr): Treat FUNCTION_TYPEs as readonly, even though
- they don't have TREE_READONLY set.
- * typeck2.c (readonly_error): Add case for FUNCTION_DECLs.
-
-1998-09-24 Benjamin Kosnik <bkoz@loony.cygnus.com>
-
- * spew.c (yylex): Give diagnostic.
- * hash.h (is_reserved_word): Add export.
- * gxx.gperf: Likewise.
- * lex.h (rid): Add RID_EXPORT.
- * lex.c (init_parse): Likewise.
-
-Tue Sep 22 21:01:19 1998 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
-
- * friend.c (do_friend): Make warning a full sentence.
-
-1998-09-22 Mark Mitchell <mark@markmitchell.com>
-
- * parse.y (component_decl_list): Improve error-recovery.
-
-1998-09-22 Benjamin Kosnik <bkoz@loony.cygnus.com>
-
- * decl.c (make_typename_type): Move error to point where name
- variable can be used by dump_type.
-
-1998-09-22 Mark Mitchell <mark@markmitchell.com>
-
- * decl.c (grokfndecl): Improve error-recovery.
- * decl2.c (grokfield): Likewise.
- * pt.c (finish_member_template_decl): Likewise.
+ Fix ctor vtable vcall offsets.
+ * class.c (struct vtbl_init_data_s): Add rtti_binfo member.
+ (build_rtt_vtbl_entries): Lose RTTI_BINFO parameter.
+ (get_matching_base): Remove.
+ (get_original_base): New function.
+ (build_vtbl_initializer): Initialize vid.rtti_binfo.
+ Use a virtual thunk for a ctor vtable with an index
+ (add_vcall_offset_vtbl_entries_1): Check if binfo has lost a
+ primary base within a constructor vtable. Only set
+ BV_VCALL_INDEX when not a constructor vtable. Adjust vcall offset
+ when primary base has been lost.
+ * cp-tree.h (BINFO_VIRTUALS): Remove ambiguity from comment.
-1998-09-20 Martin von Löwis <loewis@informatik.hu-berlin.de>
+2001-02-26 Jeffrey Oldham <oldham@codesourcery.com>
- * method.c (hack_identifier): Finding multiple members is always
- an error.
+ * call.c (joust): Ensure more_specialized()'s argument length
+ parameter has correct value for constructors.
-1998-09-21 Per Bothner <bothner@cygnus.com>
+2001-02-26 Nathan Sidwell <nathan@codesourcery.com>
- * Make-lang.in (c++-filt): Link libiberty.a after cxxmain.o.
+ * except.c (call_eh_info): Cleanup generation of cp_eh_info struct.
-Mon Sep 21 01:53:05 1998 Felix Lee <flee@cygnus.com>
+ * decl.c (mark_inlined_fns): Prototype.
- * lex.c (init_lex): Use getenv ("LANG"), not GET_ENVIRONMENT ().
+2001-02-22 Mark Mitchell <mark@codesourcery.com>
-1998-09-20 Mark Mitchell <mark@markmitchell.com>
+ * spew.c (yylex): Correct handling of friends.
- * class.c (maybe_warn_about_overly_private_class): Reformat.
+2001-02-22 Mark Mitchell <mark@codesourcery.com>
-1998-09-17 Andrew MacLeod <amacleod@cygnus.com>
+ * mangle.c (write_encoding): Pass write_function_type the
+ FUNCTION_DECL for the function being encoded.
+ (write_function_type): Pass it along to write_bare_function_type.
+ (write_bare_function_type): Pass it along to write_method_parms.
+ (write_method_parms): Don't mangle the compiler-generated
+ parameters to a constructor or destructor.
- * exception.cc (__cplus_type_matcher): Realign some code.
+2001-02-22 Andreas Jaeger <aj@suse.de>
-1998-09-16 Mark Mitchell <mark@markmitchell.com>
+ * optimize.c: Include toplev.h for
+ note_deferral_of_defined_inline_function prototype.
- * Make-lang.in (tinfo.o): Use CXXFLAGS when compiling.
- (tinfo2.o): Likewise.
- (exception.o): Likewise.
- (new.o): Likewise.
- (opnew.o): Likewise.
- (opnewnt.o): Likewise.
- (opvnew.o): Likewise.
- (opvnewnt.o): Likewise.
- (opdel.o): Likewise.
- (opdelnt.o): Likewise.
- (opvdel.o): Likewise.
- (opvdelnt.o): Likewise.
+2001-02-22 Jakub Jelinek <jakub@redhat.com>
-1998-09-16 Richard Henderson <rth@cygnus.com>
+ * cp-tree.h (struct lang_decl_inlined_fns): New.
+ (struct lang_decls): Add inlined_fns.
+ (DECL_INLINED_FNS): New macro.
+ * optimize.c (struct inline_data): Add inlined_fns.
+ (declare_return_variable): Use VARRAY_ACTIVE_SIZE macro.
+ (inlinable_function_p): Likewise, fix typo in comment,
+ function is not inlinable if it already inlined function currently
+ being optimized.
+ (expand_call_inline): Add fn to inlined_fns if necessary.
+ (optimize_function): Initialize inlined_fns.
+ Save inlined_fns into DECL_INLINED_FNS after expanding inlines.
+ * decl.c (mark_inlined_fns): New function.
+ (lang_mark_tree): Call it.
- * decl.c (init_decl_processing): Kill __builtin_fp and __builtin_sp.
+2001-02-21 Jason Merrill <jason@redhat.com>
-1998-09-15 Alexandre Oliva <oliva@dcc.unicamp.br>
+ * cp-tree.h (struct lang_decl_flags): Remove uninlinable flag.
+ (DECL_UNINLINABLE): Move to middle-end.
- * call.c (build_field_call): Handle static data members too.
+ * class.c (clone_function_decl): Set DECL_ABSTRACT on original fn.
+ * decl.c (duplicate_decls): Preserve DECL_ABSTRACT.
+ * class.c (build_clone): Set DECL_ABSTRACT_ORIGIN for the clone.
+ * optimize.c (maybe_clone_body): Set DECL_ABSTRACT_ORIGIN for the
+ parms and outer BLOCK. note_deferral_of_defined_inline_function.
- * typeck.c (comptypes): When comparing pointer types, check
- whether referred types match even in strictest modes.
+ * method.c (implicitly_declare_fn): Don't set DECL_ARTIFICIAL on
+ second parm of op=.
-1998-09-15 Mark Mitchell <mark@markmitchell.com>
+2001-02-19 Mark Mitchell <mark@codesourcery.com>
- * cp-tree.h: Revert previous change.
- (finish_struct_methods): Remove declaration.
- * class.c: Revert previous change.
- (maybe_warn_about_overly_private_class): New function.
- (finish_struct_methods): Declare here, and make static. Remove
- unnecessary parameters. Tidy slightly. Use
- maybe_warn_about_overly_private_class.
- (finish_struct_1): Adjust. Remove check for private constructors,
- now done elsewhere.
- (finish_struct): Adjust.
+ * decl2.c (set_decl_namespace): Allow explicit instantiations in
+ any namespace.
-1998-09-15 Andrew MacLeod <amacleod@cygnus.com>
+2001-02-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * except.c (expand_start_catch_block): No need to check for new
- exception model.
- (process_start_catch_block_old): Deleted.
- (process_start_catch_block): Add call to start_decl_1().
- (expand_end_catch_block): Add call to end_catch_handler().
- * exception.cc (__cplus_type_matcher): Only check the exception
- language if there is an exception table.
+ * optimize.c (expand_call_inline): Don't walk subtrees of type
+ nodes.
-1998-09-15 Andrew MacLeod <amacleod@cygnus.com>
+2001-02-18 Mark Mitchell <mark@codesourcery.com>
- * search.c (expand_indirect_vtbls_init): Mark temporary stack slots
- as used to prevent conflicts with virtual function tables.
+ * class.c (add_vcall_offset_vtbl_entries_1): Only add one entry
+ for a destructor.
-1998-09-14 Mark Mitchell <mark@markmitchell.com>
+2001-02-18 Jason Merrill <jason@redhat.com>
- * cp-tree.h (lang_type): Add has_non_private_static_mem_fn.
- (CLASSTYPE_HAS_NON_PRIVATE_STATIC_MEM_FN): New macro, to access it.
- * class.c (maybe_class_too_private_p): New function.
- (finish_struct_methods): Use it.
- (finish_struct_1): Likewise.
- (finish_struct): Set CLASSTYPE_HAS_NON_PRIVATE_STATIC_MEM_FN if
+ Do put the VTT parameter in DECL_ARGUMENTS.
+ * cp-tree.h (struct cp_language_function): Add x_vtt_parm.
+ (current_vtt_parm): New macro.
+ (struct lang_decl_flags): Add has_vtt_parm_p, remove vtt_parm.
+ (DECL_HAS_VTT_PARM_P): New macro.
+ (DECL_VTT_PARM): Remove.
+ (FUNCTION_FIRST_USER_PARMTYPE, FUNCTION_FIRST_USER_PARM): New macros.
+ * decl.c (duplicate_decls): Only copy the operator code if
appropriate.
+ (start_function): Set current_vtt_parm.
+ (lang_mark_tree): Don't mark vtt_parm.
+ * decl2.c (maybe_retrofit_in_chrg): Do add the VTT parm to
+ DECL_ARGUMENTS. Set DECL_HAS_VTT_PARM_P.
+ * class.c (build_clone): Maybe remove the VTT parm.
+ * optimize.c (maybe_clone_body): Set up the VTT parm.
+ * pt.c (copy_default_args_to_explicit_spec): Preserve the VTT parm.
+ * call.c (build_over_call): Just allow the VTT arg.
+ * method.c (make_thunk): Don't set DECL_VTT_PARM.
+ (do_build_copy_constructor): Use FUNCTION_FIRST_USER_PARM.
+ (synthesize_method): Use FUNCTION_FIRST_USER_PARMTYPE.
+ * decl.c (grokdeclarator, copy_args_p, grok_ctor_properties): Likewise.
+ * error.c (dump_function_decl): Likewise.
+ * call.c (build_user_type_conversion_1, convert_like_real): Abort
+ if we try to call a constructor with in-charge or VTT parms.
+ * method.c (skip_artificial_parms_for): New fn.
+ * call.c (add_function_candidate, build_over_call): Call it.
+ * call.c (build_new_method_call): Use current_vtt_parm.
+ * init.c (expand_virtual_init): Likewise.
+ * class.c (same_signature_p): No longer static.
+ * cp-tree.h: Declare it.
+ * search.c (look_for_overrides_r): Use it.
+
+2001-02-17 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (new_abi_rtti_p): Remove.
+ (name_mangling_version): Likewise.
+ (flag_do_squangling): Likewise.
+ * class.c (build_rtti_vtbl_entries): Remove old ABI support.
+ * decl.c (grokfndecl): Likewise.
+ * decl2.c (name_mangling_version): Remove.
+ (flag_do_squangling): Likewise.
+ (lang_f_options): Remove `squangle'.
+ (unsupported_options): Add `squangle'.
+ (cxx_decode_option): Issue a warning about uses of
+ -fname-mangling-version.
+ (finish_file): Remove old ABI support.
+ * pt.c (check_explicit_specialization): Likewise.
+ (tsubst_decl): Likewise.
+ * rtti.c (init_rtti_processing): Likewise.
+ (build_headof): Likewise.
+ (get_tinfo_decl_dynamic): Likewise.
+ (tinfo_from_decl): Likewise.
+ (build_dynamic_cast_1): Likewise.
+ (synthesize_tinfo_var): Likewise.
+ * init.c (build_new): Allow enumeration types for the array-bounds
+ in a direct-new-declarator.
- * pt.c (check_specialization_scope): Fix spelling error.
- (check_explicit_specialization): Remove code to handle explicit
- specializations in class scope; they are now correctly diagnosed
- as errors.
-
-1998-09-10 Mark Mitchell <mark@markmitchell.com>
-
- * decl.c (pushdecl): Don't copy types if the
- DECL_ABSTRACT_ORIGIN of the new decl matches the TYPE_NAME of the
- type.
-
-1998-09-09 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
-
- * class.c (get_enclosing_class): New function.
- (is_base_of_enclosing_class): Likewise.
- * cp-tree.h (get_enclosing_class): Declare.
- (is_base_of_enclosing_class): Likewise.
- * pt.c (coerce_template_parms): Use them.
-
-1998-09-09 Jason Merrill <jason@yorick.cygnus.com>
-
- * g++spec.c (lang_specific_driver): Check whether MATH_LIBRARY is
- null to decide whether to use it.
-
- * error.c (dump_type_real): Handle NAMESPACE_DECL.
- * parse.y (base_class.1): Avoid crash on error.
+ * semantics.c (finish_typeof): Resolve OFFSET_REFs.
-1998-09-08 Martin von Löwis <loewis@informatik.hu-berlin.de>
+ * pt.c (check_explicit_specialization): Copy TREE_PRIVATE and
+ TREE_PROTECTED from the template being specialized.
- * decl.c (make_typename_type): If context is a namespace, the code
- is in error.
+2001-02-17 Jason Merrill <jason@redhat.com>
-1998-09-08 Mumit Khan <khan@xraylith.wisc.edu>
+ * decl2.c (build_artificial_parm): Set TREE_READONLY.
- * parse.y (nomods_initdcl0): Set up the parser stack correctly.
+ * decl.c (bad_specifiers): Allow throw specs on things with
+ pointer-to-function or -member-function type.
+ * init.c (build_default_init): Don't use a CONSTRUCTOR to initialize
+ a pmf.
-1998-09-08 Mark Mitchell <mark@markmitchell.com>
+2001-02-17 Mark Mitchell <mark@codesourcery.com>
- * cp-tree.h (anonymous_namespace_name): Declare.
- * decl.c: Define it.
- (push_namespace): Use anonymous_namespace_name, rather than local
- static anon_name.
- * error.c (dump_decl): If a namespace is named
- anonymous_namespace_name, call it {anonymous}.
+ * call.c (check_dtor_name): Handle template names correctly.
- * decl.c (grokparms): Distinguish between references and pointers
- in error message.
+2001-02-16 Jason Merrill <jason@redhat.com>
-1998-09-08 Richard Henderson <rth@cygnus.com>
- Mark Mitchell <mark@markmitchell.com>
+ * cp-tree.h (DECL_USE_VTT_PARM): Remove.
+ * decl2.c (maybe_retrofit_in_chrg): Don't create it.
+ * optimize.c (maybe_clone_body): Don't substitute it.
+ * call.c (build_new_method_call): Check in_chrg instead.
+ * init.c (expand_virtual_init): Likewise.
- * pt.c (process_partial_specialization): Consistently allocate
- and zero tpd.parms based on ntparms. Use tpd2.parms, not
- tpd.parms, where appropriate.
+2001-02-16 Gabriel Dos Reis <gdr@codesourcery.com>
-Sun Sep 6 00:00:51 1998 Jeffrey A Law (law@cygnus.com)
+ * decl.c (check_tag_decl): Make sure a typedef for an anonymous
+ class-type introduces at least a type-name.
- * Makefile.in (INCLUDES): Update after recent toplevel gcc
- reorganizations.
+2001-02-16 Jakub Jelinek <jakub@redhat.com>
-1998-09-05 Mark Mitchell <mark@markmitchell.com>
+ * call.c (convert_like_real): Create a temporary for non-lvalue.
- * cp-tree.h (TI_PENDING_SPECIALIZATION_FLAG): Remove.
- * class.c (finish_struct): Remove hackery to deal with explicit
- specializations in class scope.
- * decl.c (grokfndecl): Improve error-recovery.
- * decl2.c (grokfield): Likewise.
- * pt.c (check_specialization_scope): New function.
- (begin_specialization): Call it.
- (process_partial_specialization): New function, split out from
- push_template_decl. Check partial specializations more
- stringently.
- (push_template_decl): Call it.
- (check_explicit_specialization): Don't attempt to handle explicit
- specializations in class scope.
- (template_parm_data): Document. Add current_arg and
- arg_uses_template_parms.
- (mark_template_parm): Set it.
- (tsubst_arg_types): Remove unused variable.
- * semantics.c (begin_class_definition): Tweak.
-
-1998-09-04 Mark Mitchell <mark@markmitchell.com>
-
- * inc/typeinfo (type_info::type_info(const char*)): Make
- `explicit'.
-
- * cp-tree.h (hash_tree_cons_simple): New macro.
- * pt.c (tsubst_arg_types): New function. Use hash_tree_cons.
- (coerce_template_parms): Use make_temp_vec, instead of
- make_tree_vec. Document this behavior.
- (lookup_template_class): Likewise.
- (tsubst, cases METHOD_TYPE, FUNCTION_TYPE): Use tsubst_arg_types.
- Remove dead code (and add assertion to check its deadness). Fix
- bug w.r.t. exception specifications.
+2001-02-16 Jeffrey Oldham <oldham@codesourcery.com>
-1998-09-03 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h: Fix typos in comments.
- * decl2.c (import_export_vtable): Always make artificials comdat.
- (import_export_decl): Likewise.
- * pt.c (mark_decl_instantiated): Likewise.
+2001-02-16 Jason Merrill <jason@redhat.com>
-1998-09-03 Mark Mitchell <mark@markmitchell.com>
+ * optimize.c (remap_block): If we're compiling a clone, pass the
+ new block to insert_block.
- * cp-tree.h (finish_globally_qualified_member_call_expr):
- Rename to ...
- (finish_qualified_call_expr).
- * semantics.c: Likewise.
- * parse.y (primary): Use it.
- * method.c (hack_identifier): Remove redundant code.
+2001-02-16 Mark Mitchell <mark@codesourcery.com>
- * init.c (resolve_offset_ref): Call convert_from_reference to
- handle members of reference type. Improve error recovery.
+ * semantics.c (finish_asm_stmt): Robustify.
-1998-09-03 Benjamin Kosnik <bkoz@cygnus.com>
+2001-02-15 Mark Mitchell <mark@codesourcery.com>
- * cp-tree.h: Declare warn_nontemplate_friend.
- * decl2.c (lang_decode_option): Set.
- * lang-options.h: Add -Wnon-template-friend.
- * friend.c (do_friend): Use to toggle non-template function warning.
+ * pt.c (push_template_decl_real): Don't remangle the name of a
+ class template.
-1998-09-03 Mark Mitchell <mark@markmitchell.com>
+2001-02-15 Jim Meyering <meyering@lucent.com>
- * decl.c (finish_enum): Don't resolve CONST_DECLs to their
- corresponding INTEGER_CSTs when processing_template_decl.
- * pt.c (tsubst_enum): Tweak accordingly.
+ * Make-lang.in (c++.install-common): Depend on installdirs.
+ (c++.install-info): Likewise.
+ (c++.install-man): Likewise.
-1998-09-03 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+2001-02-15 Mark Mitchell <mark@codesourcery.com>
- * decl.c (pushdecl_class_level): Add warning here.
- (pushdecl): Tweak.
+ * typeck2.c (build_m_component_ref): Robustify.
-1998-09-02 Jason Merrill <jason@yorick.cygnus.com>
+2001-02-15 Alexandre Oliva <aoliva@redhat.com>
- * cvt.c (convert_pointer_to_real): Tidy.
- * search.c (get_base_distance_recursive): Simplify.
- (get_base_distance): Likewise.
+ * friend.c (do_friend): Don't take the nested [template] class
+ into account when deciding whether to warn about the friend
+ function not referring to a template function.
- * pt.c (unify): Only special-case INTEGER_TYPE if it uses template
- parms.
+2001-02-14 Jakub Jelinek <jakub@redhat.com>
-Wed Sep 02 09:25:29 1998 Nick Clifton <nickc@cygnus.com>
+ * typeck.c (build_unary_op): Clarify error message.
- * lex.c (check_newline): Call HANDLE_PRAGMA before
- HANDLE_SYSV_PRAGMA if both are defined. Generate warning messages
- if unknown pragmas are encountered.
- (handle_sysv_pragma): Interpret return code from
- handle_pragma_token (). Return success/failure indication rather
- than next unprocessed character.
- (pragma_getc): New function: retrieves characters from the
- input stream. Defined when HANDLE_PRAGMA is defined.
- (pragma_ungetc): New function: replaces characters back into the
- input stream. Defined when HANDLE_PRAGMA is defined.
+2001-02-08 Aldy Hernandez <aldyh@redhat.com>
-1998-09-01 Jason Merrill <jason@yorick.cygnus.com>
+ * parse.y (component_constructor_declarator): allow optional
+ parentheses around constructor class name.
- * decl2.c (output_vtable_inherit): Use %cDIGIT in the operands.
- * class.c (build_vtable_entry_ref): Likewise.
+2001-02-14 Nathan Sidwell <nathan@codesourcery.com>
-1998-09-01 Mark Mitchell <mark@markmitchell.com>
+ * cp-tree.h (setup_vtbl_ptr): Move prototype to semantics.c
+ section.
+ * init.c (emit_base_init): Remove incorrect comment about
+ virtual bases.
+ * method.c (make_thunk): Fix comment alignment.
- * cp-tree.h (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION): New macro.
- * decl2.c (import_export_decl): Likewise.
- * pt.c (instantiate_decl): Use it.
+2001-02-14 Nathan Sidwell <nathan@codesourcery.com>
-1998-09-01 Jason Merrill <jason@yorick.cygnus.com>
+ Kill remnants of this is variable.
+ * cp-tree.h (flag_this_is_variable): Remove.
+ * decl2.c (flag_this_is_variable): Remove.
+ * class.c (fixed_type_or_null): Add cdtor parm. Adjust.
+ (build_vbase_path): The path is non-static, even in a cdtor.
+ (resolves_to_fixed_type_p): Add additional return value.
+ * search.c (init_vbase_pointers): Adjust.
+ * tree.c (lvalue_p_1): Adjust.
+ * typeck.c (mark_addressable): Adjust.
- * decl.c (lookup_name_real): Also do implicit typename thing for
- artificial TYPE_DECLs.
- * search.c (lookup_field): Likewise.
- (lookup_fnfields, lookup_field): Adjust for implicit typename kludge.
- * semantics.c (begin_constructor_declarator): Use enter_scope_of.
- (enter_scope_of): Extract type from implicit typename.
- (begin_class_definition): Likewise.
- * lex.c (identifier_type): Handle implicit typename when checking
- for SELFNAME.
+2001-02-14 Nathan Sidwell <nathan@codesourcery.com>
- * cp-tree.h: Declare flag_strict_prototype.
- * lex.c (do_scoped_id, do_identifier): Don't implicitly_declare if
- -fstrict-prototype.
- * decl.c (init_decl_processing): If -f{no,-}strict-prototype wasn't
- specified, set it to the value of pedantic.
+ * pt.c (unify): Don't check cv quals of array types.
-1998-09-01 Mark Mitchell <mark@markmitchell.com>
+2001-02-14 Nathan Sidwell <nathan@codesourcery.com>
- * decl2.c (arg_assoc): Handle template-id expressions as arguments.
+ * tree.c (cp_build_qualified_type_real): Use CP_TYPE_QUALS to
+ check whether we already have the type.
-1998-08-31 Mark Mitchell <mark@markmitchell.com>
+2001-02-13 Mark Mitchell <mark@codesourcery.com>
- * decl.c (finish_enum): Handle member enums of classes declared in
- template functions.
+ * cp-tree.h (CLASSTYPE_DESTRUCTORS): Fix typo in comment.
+ * call.c (build_op_delete_call): Simplify to remove duplicate
+ code.
+ * class.c (clone_function_decl): Don't build the deleting variant
+ of a non-virtual destructor.
+ * decl.c (finish_destructor_body): Don't call delete if this is a
+ non-virtual destructor.
+ * init.c (build_delete): Explicitly call `operator delete' when
+ deleting an object with a non-virtual destructor.
- * decl2.c (grok_x_components): Strip attributes before calling
- groktypename.
+2001-02-13 Jason Merrill <jason@redhat.com>
-1998-08-31 Jason Merrill <jason@yorick.cygnus.com>
+ * lang-specs.h: Add more __EXCEPTIONS.
- * cp-tree.h, decl2.c: Remove support for -fall-virtual,
- -fenum-int-equivalence and -fno-nonnull-objects.
- * class.c (check_for_override): Remove support for -fall-virtual.
- (finish_struct_1): Likewise.
- * call.c (build_new_op): Remove support for -fenum-int-equivalence.
- * typeck.c (build_binary_op_nodefault): Likewise.
- * cvt.c (ocp_convert): Likewise.
- * call.c (build_vfield_ref): Remove support for -fno-nonnull-objects.
- * class.c (build_vbase_path): Likewise.
+2001-02-12 Nathan Sidwell <nathan@codesourcery.com>
-Sun Aug 30 22:16:31 1998 H.J. Lu (hjl@gnu.org)
+ * typeck2.c (process_init_constructor): Check
+ TREE_HAS_CONSTRUCTOR before issuing missing init warning.
- * Makefile.in (INTERFACE): New, set to 1.
+2001-02-12 Nathan Sidwell <nathan@codesourcery.com>
-1998-08-30 Mark Mitchell <mark@markmitchell.com>
+ * pt.c (maybe_adjust_types_for_deduction, DEDUCE_ORDER case):
+ Remove spurious information in comment. Allow further
+ adjustments of REFERENCE_TYPE args.
- * error.c (dump_decl): Use CP_DECL_CONTEXT, not DECL_CONTEXT, when
- comparing with global_namespace.
- (dump_aggr_type): Likewise.
+2001-02-12 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (grokfndecl): Issue error on declaration of friend
- templates with explicit template arguments.
+ * errfn.c (cp_deprecated): Tweak diagnostic text.
+ * parse.y (new_initializer): Deprecate initializer lists
+ extension.
- * pt.c (convert_template_argument): New function, split out
- from...
- (coerce_template_parms): Here.
- (tsubst): Attempt better error-recovery.
+2001-02-12 Mark Mitchell <mark@codesourcery.com>
-1998-08-28 Benjamin Kosnik <bkoz@loony.cygnus.com>
+ Remove old ABI support.
- * pt.c (decl_template_parm_p): Add checks for
- TEMPLATE_TEMPLATE_PARM.
+2001-02-11 Mark Mitchell <mark@codesourcery.com>
-1998-08-28 Mark Mitchell <mark@markmitchell.com>
+ * decl2.c (flag_vtable_thunks): Always set it to 1.
+ (flag_new_abi): Likewise.
+ * lang-specs.h: Remove conditional on ENABLE_NEW_GXX_ABI.
- * lex.c (do_identifier): Fix thinko in previous change.
+ * Makefile.in (g++spec.o): Fix typo.
-1998-08-28 Jason Merrill <jason@yorick.cygnus.com>
+2001-02-09 Jason Merrill <jason@redhat.com>
- * search.c (dfs_search, binfo_for_vtable, dfs_bfv_helper): New fns.
- * decl2.c (output_vtable_inherit): Call binfo_for_vtable.
+ * lang-specs.h: Restore definition of __EXCEPTIONS.
-1998-08-28 Richard Henderson <rth@cygnus.com>
+2001-02-08 Jason Merrill <jason@redhat.com>
- Add support for discarding unused virtual functions.
- * lang-options.h: Add -fvtable-gc.
- * cp-tree.h: Add flag_vtable_gc.
- * decl2.c (output_vtable_inherit): New fn.
- (finish_vtable_vardecl): Call it.
- * class.c (build_vtable_entry_ref): New fn.
- (build_vtbl_ref): Call it.
+ * search.c (shared_member_p): New function.
+ (lookup_field_r): Use it.
+ * cp-tree.h (SHARED_MEMBER_P): Remove.
-1998-08-28 Mark Mitchell <mark@markmitchell.com>
+ * method.c (process_overload_item): Handle template-dependent array
+ bounds.
+ * pt.c (type_unification_real): If we end up with undeduced nontype
+ parms, try again.
- * cp-tree.h (build_enumerator): Take the enumeration type as a
- parameter.
- * decl.c (finish_enum): Don't set the TREE_TYPE for the
- enumeration constant values if we're processing_template_decls.
- Don't set the type for the CONST_DECLs either; that's done in
- build_enumerator.
- (build_enumerator): Take the enumeration type as a
- parameter.
- * lex.c (do_identifier): Don't resolve enumeration constants while
- processing template declarations, even if they happen to be
- TEMPLATE_PARM_INDEXs.
-
- * parse.y (current_enum_type): New variable.
- (primary): Don't allow statement-expression in local classes just
- as we don't in global classes.
- (structsp): Use current_enum_type.
- (enum_list): Likewise.
- * pt.c (tsubst_enum): Don't check for NOP_EXPRs introduced by
- finish_enum; they no longer occur.
-
- * cp-tree.h (finish_base_specifier): New function.
- * parse.y (base_class): Use it.
- * semantics.c (finish_base_specifier): Define it.
-
- * parse.y (structsp): Warn on use of typename outside of template
- declarations.
+ * decl.c (lookup_name_real): Tweak warning to refer to decls, not
+ types.
-1998-08-27 Jason Merrill <jason@yorick.cygnus.com>
+ * typeck2.c (friendly_abort): Don't say anything if we have
+ earlier errors or sorries.
- * lex.c (handle_cp_pragma): Remove #pragma vtable.
- * lang-options.h: Remove +e options.
- * decl2.c (lang_decode_option): Likewise.
- (import_export_vtable): Don't check write_virtuals.
- (finish_vtable_vardecl, finish_file): Likewise.
- * search.c (dfs_debug_mark): Likewise.
- * semantics.c (begin_class_definition): Likewise.
- * class.c (build_vtable, finish_vtbls, finish_struct_1): Likewise.
-
- * call.c (build_over_call): Check flag_elide_constructors.
- * decl2.c: flag_elide_constructors defaults to 1.
- * typeck.c (convert_arguments): Remove return_loc parm.
- (build_function_call_real): Adjust.
-
- * search.c: Tear out all mi_matrix and memoize code.
- (lookup_field, lookup_fnfields): Use scratch_tree_cons.
- * lang-options.h: Remove documentation for -fhandle-exceptions,
- -fmemoize-lookups and -fsave-memoized.
- * cp-tree.h: Lose mi_matrix and memoize support.
- * decl2.c: Ignore -fmemoize-lookups and -fsave-memoized.
- * class.c: Lose struct class_level.
- (pushclass, popclass): Lose memoize support.
- * init.c (build_offset_ref): Likewise.
+ * decl.c (check_tag_decl): Notice attempts to redefine bool and
+ wchar_t. Ignore if in_system_header.
- Never change BINFO_INHERITANCE_CHAIN.
- * init.c (emit_base_init): Change modification of
- BINFO_INHERITANCE_CHAIN to an assert.
- * search.c (get_base_distance_recursive): Likewise.
- (get_base_distance): Likewise.
- (lookup_member): Likewise.
- (convert_pointer_to_single_level): Likewise.
- (lookup_field): Likewise. Lose setting TREE_VIA_* on TREE_LISTs.
- (lookup_fnfields): Likewise.
- * tree.c (propagate_binfo_offsets): Don't call unshare_base_binfos.
- (unshare_base_binfos): Don't call propagate_binfo_offsets.
- (layout_basetypes): Call propagate_binfo_offsets instead of
- unshare_base_binfos.
- * decl.c (xref_basetypes): Call unshare_base_binfos.
- * pt.c (instantiate_class_template): Likewise.
- * tree.c (reverse_path): Remove 'copy' parm; always make a
- temporary copy.
- * class.c (build_vbase_path): Just call it.
- * search.c (compute_access): Likewise. Don't re-reverse.
+ * decl.c (maybe_push_cleanup_level): New fn...
+ (start_decl_1): ...split out from here.
+ * cvt.c (build_up_reference): Use it.
+ * cp-tree.h: Declare it.
-1998-08-27 Mark Mitchell <mark@markmitchell.com>
+2001-02-07 Mark Mitchell <mark@codesourcery.com>
- * class.c (build_vbase_path): Use reverse_path.
- (finish_base_struct): Move warnings for inaccessible bases to
- layout_basetypes.
- (modify_one_vtable): Remove check of TREE_USED (binfo).
- (fixup_vtable_deltas1): Likewise.
- * cp-tree.h (BINFO_INHERITANCE_CHAIN): Document here.
- (xref_tag): Remove binfos parameter.
- (make_binfo): Remove chain parameter.
- (reverse_path): Add copy parameter.
- * decl.c (init_decl_processing): Change calls to xref_tag.
- (xref_tag): Remove binfos parameter.
- (xref_basetypes): Change calls to make_binfo.
- * decl2.c (grok_x_components): Change calls to xref_tag.
- (handle_class_head): Likewise.
- * friend.c (do_friend): Likewise.
- * lex.c (make_lang_type): Change calls to make_binfo.
- * parse.y (structsp): Change calls to xref_tag.
- (named_complex_class_head_sans_basetype): Likewise.
- (named_class_head): Likewise.
- * rtti.c (init_rtti_processing): Likewise.
- * search.c (compute_access): Change calls to reverse_path.
- (dfs_get_vbase_types): Change calls to make_binfo.
- (get_vbase_types): Remove dead code.
- * tree.c (unshare_base_binfos): Change calls to make_binfo.
- (layout_basetypes): Warn here about inaccessible bases.
- (make_binfo): Remove chain parameter.
- (reverse_path): Add copy parameter.
-
-1998-08-27 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c: #if 0 complete_type_p.
- * init.c (build_java_class_ref, build_new_1): Remove unused locals.
- * method.c (process_overload_item): Likewise.
- * typeck.c (comp_target_types): Likewise.
-
- Stop sharing binfos for indirect virtual bases.
- * tree.c (propagate_binfo_offsets): Unshare vbases, too.
- (layout_basetypes): Likewise.
- (unshare_base_binfos): Copy vbases, too.
- * cp-tree.h (BINFO_VIA_PUBLIC, BINFO_BASEINIT_MARKED,
- BINFO_VBASE_INIT_MARKED): Remove obsolete macros.
- (BINFO_PUSHDECLS_MARKED, SET_BINFO_PUSHDECLS_MARKED,
- CLEAR_BINFO_PUSHDECLS_MARKED): New macros.
- * search.c (lookup_field, lookup_fnfields, lookup_member): Remove
- reference to BINFO_VIA_PUBLIC.
- (marked_pushdecls_p, unmarked_pushdecls_p): New fns.
- (push_class_decls): Use them.
- (dfs_pushdecls): Use SET_BINFO_PUSHDECLS_MARKED.
- (dfs_compress_decls): Use CLEAR_BINFO_PUSHDECLS_MARKED.
+ * lang-specs.h: Use CPLUSPLUS_CPP_SPEC for the preprocessor
+ spec.
-1998-08-27 Mark Mitchell <mark@markmitchell.com>
+2001-02-06 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (build_enumerator): Set DECL_CONTEXT for the
- CONST_DECLs.
+ * pt.c (lookup_template_class): Make sure it's a primary
+ template or template_template_parm when called from the parser.
+ (instantiate_template_class): Add assertion.
-1998-08-26 Mark Mitchell <mark@markmitchell.com>
+2001-02-05 Alexandre Oliva <aoliva@redhat.com>
- * cp-tree.h (finish_enum): Change prototype.
- * decl.c (finish_enum): Use TYPE_VALUES, rather than taking a
- VALUES parameter. Don't try to compute mins/maxs if
- processing_template_decl.
- * parse.y (structsp): Use new calling sequence for finish_enum.
- * pt.c (tsubst_enum): Likewise. Take the new type as input.
- (lookup_template_class): Remove unused variables. Tweak.
- Register enums on instantiation list before substituting
- enumeration constants.
- (tsubst_decl): Remove unused variables.
- (regenerate_decl_from_template): Likewise.
-
- * decl.c (duplicate_decls): Don't obliterate the
- DECL_TEMPLATE_INFO for a template if we're not replacing it with
- anything.
-
- * lex.c (do_identifier): Fix typo in comment.
+ * method.c (build_mangled_name) [old abi]: Protect flush_repeats()
+ from error_mark_node.
-Wed Aug 26 10:54:51 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+2001-02-05 Nathan Sidwell <nathan@codesourcery.com>
- * errfn.c: Remove stdarg.h/varargs.h.
+ Fix specification and implementation bugs in V3 ABI
+ construction vtables.
+ * cp-tree.h (flag_dump_class_layout): New flag.
+ (BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P): Remove.
+ (BINFO_LOST_PRIMARY_P): New flag.
+ (SET_BINFO_NEW_VTABLE_MARKED): Adjust asserts.
+ (BINFO_PRIMARY_MARKED_P): Rename to ...
+ (BINFO_PRIMARY_P): ... here.
+ (binfo_via_virtual): New prototype.
+ * decl2.c (flag_dump_class_layout): New flag.
+ (cxx_decode_option): Set it. Adjust -fdump-translation-unit to
+ use `=' as a file name separator.
+ * init.c (dfs_initialize_vtbl_ptrs): Walk into virtual primary
+ bases.
+ (build_vtbl_address): If this is a virtual primary base, then
+ get the vtbl of what it is ultimately primary for.
+ * search.c (dfs_skip_nonprimary_vbases_unmarkedp): Adjust
+ for BINFO_PRIMARY_P.
+ (dfs_skip_nonprimary_vbases_markedp): Likewise.
+ (get_shared_vbase_if_not_primary): Likewise.
+ (dfs_get_pure_virtuals): Likewise.
+ (expand_upcast_fixups): Likewise.
+ (fixup_virtual_upcast_offsets): Likewise.
+ (dfs_find_vbase_instance): Likewise.
+ (find_vbase_instance): Likewise.
+ (binfo_from_vbase): Adjust comment to reflect reality.
+ (binfo_via_virtual): New function.
+ * class.c (VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P): New macros
+ for binfo walking during VTT construction.
+ (dfs_mark_primary_bases): Remove.
+ (force_canonical_binfo_r): New function.
+ (force_canonical_binfo): New function.
+ (mark_primary_virtual_base): New function.
+ (mark_primary_bases): Walk in inheritance graph order, use
+ mark_primary_virtual_base.
+ (determine_primary_base): Use some more intermediate variables.
+ (dfs_find_final_overrider): Don't check for overriding along a
+ virtual path.
+ (dfs_modify_vtables): Walk into primary virtual bases too.
+ (walk_subobject_offsets): Adjust for BINFO_PRIMARY_P.
+ (build_base_fields): Likewise.
+ (dfs_set_offset_for_unshared_vbases): Likewise.
+ (layout_virtual_bases): Likewise.
+ (end_of_class): Likewise.
+ (finish_struct_1): Call dump_class_hierarchy, if requested.
+ (dfs_get_primary_binfo): Use BINFO_TYPE for binfos.
+ (dump_class_hierarchy_r): Add stream parameter. Emit more information.
+ (dump_class_hierarchy): Add file parameter. Append to file, if
+ required.
+ (finish_vtbls): Adjust accumulate_vtbl_inits call.
+ Use canonical base for virtual bases.
+ (build_vtt): Add more comments. Adjust build_vtt_inits call.
+ (build_vtt_inits): Remove VIRTUAL_VTTS_P parm.
+ Only set BINFO_VPTR_INDEX on top level. Use VTT_TOP_LEVEL_P,
+ VTT_MARKED_BINFO_P for binfo walking. Use canonical vbase for
+ virtual VTTs.
+ (dfs_build_secondary_vptr_vtt_inits): Extract VTT_TOP_LEVEL_P
+ from DATA. We want virtual primary bases and all bases via virtual.
+ Only set BINFO_VPTR_INDEX for top level. Look up from a primary
+ virtual base when not a construction vtable.
+ (dfs_ctor_vtable_bases_queue_p): New DFS predicate.
+ (build_ctor_vtbl_group): Adjust accumulate_vtbl_inits call.
+ Use canonical bases when processing virtual bases.
+ (accumulate_vtbl_inits): We're interested in any base via a
+ virtual path.
+ (dfs_accumulate_vtbl_inits): If this is a primary virtual base
+ within a construction vtable, determine what is being overridden.
+ (build_vtbl_initializer): Add more comments
+ (add_vcall_offset_vtbl_entries_1): Adjust comment.
+ (build_rtti_vtbl_entries): Check if the base has lost its
+ primary.
+
+2001-02-05 Mark Mitchell <mark@codesourcery.com>
+
+ * Makefile.in (g++spec.o): Adjust use of DRIVER_DEFINES.
+
+Sun Feb 4 15:52:44 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * decl.c (pushdecl): Call abort instead of fatal.
+ * except.c (decl_is_java_type): Call fatal_error instead of fatal.
+ * init.c (build_new_1): Likewise.
+ (build_java_class_ref): Call internal_error and fatal_error, not fatal.
+ * decl.c (build_typename_type): hash_table_init now returns void.
+ decl.c (init_decl_processing): Make an error non-fatal.
+
+2001-02-04 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (CLASSTYPE_INTERFACE_UNKNOWN): Fix formatting.
+ Document.
+ (CLASSTYPE_INTERFACE_KNOWN): Likewise.
+ (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise.
+ (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise.
+ (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise.
+ * decl.c (maybe_commonize_var): Use the new name-mangling where
+ appropriate.
+ * decl2.c (comdat_linkage): Enhance comments. Make all
+ compiler-generated things static, if COMDAT is not available.
+ (get_tinfo_decl): Do not make typeinfo objects that belong in the
+ library COMDAT.
+ (tinfo_base_init): Use the correct mangled name for typeinfo
+ strings, and push them into the global scope.
+ (typeinfo_in_lib_p): New function.
+ (synthesize_tinfo_var): Use it.
+ (create_real_tinfo_var): Likewise.
+
+2001-02-03 Jakub Jelinek <jakub@redhat.com>
+
+ * decl.c (push_class_binding): Use context_for_name_lookup instead
+ of CP_DECL_CONTEXT.
+ * search.c (context_for_name_lookup): Remove static. Check for NULL
+ context in the loop.
+ * cp-tree.h (context_for_name_lookup): Add prototype.
+
+2001-02-02 Jakub Jelinek <jakub@redhat.com>
+
+ * cp-tree.h (build_expr_ptr_wrapper, can_free): Remove.
+ * tree.c (build_expr_ptr_wrapper, can_free, permanent_obstack):
+ Remove.
+ * call.c (convert_class_to_reference, build_user_type_conversion_1,
+ add_warning): Change build_expr_ptr_wrapper to build_ptr_wrapper.
+
+2001-02-02 Mark Mitchell <mark@codesourcery.com>
+
+ * Make-lang.in (g++spec.o): Add DRIVER_DEFINES to the list
+ of macros used when compiling g++spec.c.
+ * g++spec.c (lang_specific_driver): Link with the shared
+ libgcc by default.
+
+2001-01-29 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * decl2.c (build_expr_from_tree), lex.c (make_pointer_declarator,
+ make_reference_declarator, make_call_declarator), method.c
+ (implicitly_declare_fn), parse.y (namespace_using_decl,
+ notype_unqualified_id, expr_or_declarator, new_type_id,
+ after_type_declarator, direct_after_type_declarator,
+ notype_declarator, complex_notype_declarator,
+ complex_direct_notype_declarator, qualified_id,
+ notype_qualified_id, overqualified_id, direct_new_declarator,
+ absdcl, direct_abstract_declarator, conversion_declarator), pt.c
+ (tsubst), semantics.c (begin_constructor_declarator): Use build_nt
+ instead of build_parse_node.
+
+2001-01-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h (cp_tree_index): Delete CPTI_MINUS_ONE.
+ (minus_one_node): Moved to top level gcc directory. Renamed
+ to integer_minus_one_node.
+
+ * init.c (init_init_processing): Don't set minus_one_node.
+ (build_vec_init): Use integer_minus_one_node.
+
+ * rtti.c (get_tinfo_decl_dynamic): Likewise.
+
+2001-01-28 Jakub Jelinek <jakub@redhat.com>
+
+ * optimize.c (copy_body_r): If MODIFY_EXPR has both arguments
+ identical and they would be replaced with constant, remove
+ MODIFY_EXPR from the tree.
+
+2001-01-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Make-lang.in: Remove all dependencies on defaults.h.
+ * call.c: Don't include defaults.h.
+ * decl.c: Likewise.
+ * decl2.c: Likewise.
+ * except.c: Likewise.
+ * pt.c: Likewise.
+ * rtti.c: Likewise.
* tree.c: Likewise.
+ * typeck.c: Likewise.
-1998-08-25 Brendan Kehoe <brendan@cygnus.com>
-
- * pt.c (tsubst_copy): Only do typename overloading on an
- IDENTIFIER_NODE that happens to look like a typename if it actually
- has a type for us to use.
-
-1998-08-25 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (comp_cv_target_types): Split out...
- (comp_target_types): From here. Don't allow cv-qual changes under
- a pointer if nptrs == 0. Fix OFFSET_TYPE handling.
- (build_ptrmemfunc): Pass 1 to nptrs.
- * cvt.c (perform_qualification_conversions): Use comp_ptr_ttypes.
-
-1998-08-25 Mark Mitchell <mark@markmitchell.com>
-
- * search.c (dependent_base_p): Don't compare a binfo to
- current_class_type; use the TREE_TYPE of the binfo instead.
-
- * cp-tree.h (CLASS_TYPE_P): Revise definition.
-
-1998-08-25 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (duplicate_decls): Don't complain about different
- exceptions from an internal decl even if pedantic.
-
- * typeck.c (convert_for_assignment): Converting from pm of vbase
- to derived is an error, not a sorry.
-
- * call.c (build_over_call): Use convert_pointer_to_real for 'this'.
- * class.c (fixed_type_or_null): Rename from
- resolves_to_fixed_type_p. Return the dynamic type of the
- expression, if fixed, or null.
- (resolves_to_fixed_type_p): Use it. Return 0 if the dynamic type
- does not match the static type.
- (build_vbase_path): Rename 'alias_this' to 'nonnull'. Use
- resolves_to_fixed_type_p again.
-
-1998-08-24 Mark Mitchell <mark@markmitchell.com>
-
- * pt.c (tsubst_decl): Move special case code for dealing with
- tricky friend templates here from ...
- (regenerate_decl_from_template): Here.
+2001-01-25 Jakub Jelinek <jakub@redhat.com>
-1998-08-24 Jason Merrill <jason@yorick.cygnus.com>
+ * mangle.c (write_mangled_name, write_encoding): Mangle overloaded
+ operators even in "C" linkage.
+ * method.c (set_mangled_name_for_decl): Likewise.
+ * decl.c (grokfndecl): Call set_mangled_name_for_decl even for
+ overloaded operators in "C" linkage.
- * decl.c (start_decl): Remove redundant linkage check.
+2001-01-24 Nathan Sidwell <nathan@codesourcery.com>
-1998-08-24 Gavin Romig-Koch <gavin@cygnus.com>
+ * pt.c (tsubst_decl): Remove IN_DECL parameter.
+ (tsubst_arg_types): Check parameter is not void.
+ (tsubst): Adjust tsubst_decl call.
- * typeck.c (c_expand_return): Handle the case that valtype
- is wider than the functions return type.
+2001-01-24 Nathan Sidwell <nathan@codesourcery.com>
-1998-08-24 Mark Mitchell <mark@markmitchell.com>
-
- * cp-tree.h (CLASS_TYPE_P): New macro.
- * decl.c (grokdeclarator): Use it instead of IS_AGGR_TYPE.
- * pt.c (process_template_parm): Undo previous change.
-
-1998-08-24 Benjamin Kosnik <bkoz@cygnus.com>
-
- * cp-tree.h: Declare.
- * pt.c (decl_template_parm_p): New function.
- * decl.c (pushdecl): Check decls for redeclaring template parms.
- (xref_tag): Make redeclaration an error, print decl.
- * decl2.c (grokfield): Check field_decls for redeclaration as well.
-
-1998-08-24 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (primary): Fix up the type of string constants.
-
-1998-08-24 Mark Mitchell <mark@markmitchell.com>
-
- * typeck.c (convert_for_initialization): Move check for odd uses
- of NULL to avoid duplicate warnings.
-
-1998-08-24 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (lvalue_type): Fix for arrays.
- * typeck.c (string_conv_p): New fn.
- (convert_for_assignment): Use it.
- (build_unary_op): Use lvalue_type.
- * call.c (standard_conversion, convert_like): Use string_conv_p.
- (add_function_candidate): Use lvalue_type.
- * cvt.c (convert_to_reference): Likewise.
- * decl2.c (lang_decode_option): Ignore -traditional.
- * decl.c (init_decl_processing): flag_writable_strings inhibits
- flag_const_strings.
-
-1998-08-24 Andrew MacLeod <amacleod@cygnus.com>
-
- * lang-options.h (lang_options): Add fconst-strings to the list
- of valid options.
- * decl2.c (lang_f_options, lang_decode_option): Likewise.
-
-1998-08-24 Nathan Sidwell <nathan@acm.org>
-
- * lex.c (real_yylex): Don't warn about long long constants if
- we're allowing long long.
-
-1998-08-24 Martin von Löwis <loewis@informatik.hu-berlin.de>
-
- * decl.c (pushdecl): Use IDENTIFIER_NAMESPACE_VALUE instead of
- accessing bindings directly.
-
- * search.c (my_tree_cons): Reimplement.
-
- * lang-specs.h: Remove __HONOR_STD.
- * inc/exception, inc/new, inc/new.h, inc/typeinfo: Likewise.
-
-1998-08-23 Mark Mitchell <mark@markmitchell.com>
-
- * decl.c (grokdeclarator): Complain about in-class initialization
- of aggregates and/or references.
- * pt.c (process_template_parm): Clear IS_AGGR_TYPE for
- TEMPLATE_TYPE_PARMs.
-
- * decl2.c (grok_array_decl): Add comment.
- (mark_used): Don't instantiate an explicit instantiation.
- * friend.c (make_friend_class): Remove bogus comment. Fix check
- for partial specializations.
- * pt.c (check_explicit_specialization): Don't
- SET_DECL_EXPLICIT_INSTANTIATION here.
- (mark_decl_instantiated): Or here.
- (do_decl_instantiation): Do it here, instead. Add checks for
- duplicate explicit instantiations, etc. Tidy.
- (do_type_instantiation): Likewise.
- (instantiate_decl): Improve comments. Complain about explicit
- instantiations where no definition is available.
-
- * cp-tree.h (ansi_null_node): Remove.
- * call.c (build_over_call): Warn about converting NULL to an
- arithmetic type.
- * cvt.c (build_expr_type_conversion): Likewise. Use
- null_ptr_cst_p instead of expanding it inline.
- * decl.c (ansi_null_node): Remove.
- (init_decl_processing): Make null_node always have integral type.
- * except.c (build_throw): Warn about converting NULL to an
- arithmetic type.
- * lex.c (init_parse): Remove handling of ansi_null_node.
- * pt.c (type_unification_real): Don't convert NULL to void* type.
- * typeck.c (build_binary_op_nodefault): Fix NULL warnings.
- (convert_for_assignment): Warn about converting NULL to an
- arithmetic type.
- (convert_for_initialization): Likewise.
+ * call.c (add_builtin_candidate): Quote std properly, from
+ previous change.
-1998-08-20 Jason Merrill <jason@yorick.cygnus.com>
+2001-01-23 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * tree.c (search_tree, no_linkage_helper, no_linkage_check): New fn.
- * pt.c (coerce_template_parms): Use no_linkage_check.
- * decl.c (grokvardecl): Likewise.
- (grokfndecl): Likewise. Members of anonymous types have no linkage.
+ * pt.c (check_explicit_specialization): Clone constructors and
+ destructors.
- * method.c (process_overload_item): Remove useless code.
+2001-01-23 Nathan Sidwell <nathan@codesourcery.com>
-1998-08-20 Per Bothner <bothner@cygnus.com>
+ * decl.c (grokdeclarator): Don't presume DECL_LANG_SPECIFIC
+ indicates anything special about template depth. Make sure we
+ only count the user visible template classes.
- Handle new'ing of Java classes.
- * init.c (build_class_classref): New function.
- (build_new_1): If type is TYPE_FOR_JAVA: Call _Jv_AllocObject;
- constructor does not return this; don't need to exception-protect.
+2001-01-23 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (lookup_template_class): Copy TYPE_FOR_JAVA flag.
- * decl2.c (acceptable_java_type): Handle template-derived types.
+ * call.c (build_conv): Typo in comment.
+ (add_builtin_candidate): Add more explanation.
+ Remove extra test for ENUMERAL_TYPE in {PRE,POST}INCREMENT_EXPR.
+ Allow ENUMERAL_TYPEs for relops and eqops. Add both candidates
+ when we have enumeral types.
+ (add_builtin_candidates): Add more explanation. Add ENUMERAL_TYPE
+ candidates for relops and eqops.
+ (joust): Simplify control flow. Allow a non-template user
+ function to hide a builtin.
-1998-08-20 Per Bothner <bothner@cygnus.com>
+2001-01-22 Nathan Sidwell <nathan@codesourcery.com>
- * decl2.c (import_export_vtable): Suppress vtables for Java classes.
+ * cp-tree.h (unification_kind_t): Add DEDUCE_ORDER.
+ (more_specialized): Add deduction parameter.
+ * call.c (joust): Adjust more_specialized call.
+ * pt.c (UNIFY_ALLOW_OUTER_MORE_CV_QUAL,
+ UNIFY_ALLOW_OUTER_LESS_CV_QUAL): New unify flags.
+ (get_bindings_order): Remove.
+ (get_bindings_real): Add DEDUCE parameter.
+ (maybe_adjust_types_for_deduction): Return extra unify flags. Do
+ REFERENCE_TYPE jig for DEDUCE_ORDER.
+ (type_unification_real): Deal with DEDUCE_ORDER. Use result of
+ maybe_adjust_types_for_deduction.
+ (more_specialized): Add DEDUCE parameter. Call get_bindings_real
+ directly.
+ (try_one_overload): Use result of maybe_adjust_types_for_deduction.
+ (check_cv_quals_for_unify): Use new unify qualifier flags.
+ (unify): Clear new unify qualifier flags.
+ (get_bindings_real): Add DEDUCE parameter.
+ (get_bindings): Adjust call to get_bindings_real.
+ (get_bindings_overload): Likewise.
+ (most_specialized_instantiation): Adjust call to
+ more_specialized.
-1998-08-20 Mark Mitchell <mark@markmitchell.com>
+2001-01-19 Jason Merrill <jason@redhat.com>
- * decl.c (duplicate_decls): Always merge the old and new patterns
- for templates, regardless of whether or not the new one has
- DECL_INITIAL. Don't throw away specializations. Merge
- DECL_SAVED_TREE.
- * pt.c (tsubst_decl): Use the right pattern when calculating the
- complete args for a new template instance.
- (do_decl_instantiation): Fix typo in comment.
- (regenerate_decl_from_template): Deal with tricky friend template
- case.
- (instantiate_decl): Likewise.
+ * decl2.c (flag_vtable_thunks): Also depend on ENABLE_NEW_GXX_ABI.
-Thu Aug 20 09:09:45 1998 Jeffrey A Law (law@cygnus.com)
+ * decl.c (init_decl_processing): Just force -fvtable-thunks on if
+ -fnew-abi.
- * init.c (build_builtin_delete_call): Add missing assemble_external
- call.
+2001-01-19 Ute Pelkmann <scope.muc@t-online.de>
-1998-08-20 Jason Merrill <jason@yorick.cygnus.com>
+ * decl2.c (arg_assoc_class): Fix double iteration logic.
- * parse.y (notype_unqualified_id): Also accept ~A<int>.
+2001-01-19 Jason Merrill <jason@redhat.com>
-1998-08-19 Mark Mitchell <mark@markmitchell.com>
+ * init.c (build_delete): Always call convert_force to strip cv-quals.
- * typeck.c (build_binary_op_nodefault): Warn on use of NULL in
- arithmetic.
- * except.c (build_throw): Warn when NULL is thrown, even with
- -ansi. Use ansi_null_node, rather than integer_zero_node, in the
- thrown expression.
+ * decl2.c (flag_new_abi): Depend on ENABLE_NEW_GXX_ABI.
+ * lang-specs.h: Default ABI depends on ENABLE_NEW_GXX_ABI.
+ * g++spec.c: Don't look at ENABLE_NEW_GXX_ABI.
- * cp-tree.h (ansi_null_node): New variable.
- * decl.c (ansi_null_node): New variable.
- (init_decl_processing): Initialize its type.
- * lex.c (init_parse): Initialize its value. Use ansi_null_node
- for null_node in non-ANSI mode.
- * typeck.c (build_binary_op_nodefault): Use ansi_null_node in
- place of null_node to avoid spurious errors.
+2001-01-19 Nathan Sidwell <nathan@codesourcery.com>
-1998-08-17 Mark Mitchell <mark@markmitchell.com>
+ * search.c (get_vbase_1): Count only virtual bases.
- * cp-tree.h (enter_scope_of): New function.
- * parse.y (complex_direct_notype_declarator): Use it.
- * semantics.c (enter_scope_of): New function.
+2001-01-19 Nathan Sidwell <nathan@codesourcery.com>
-1998-08-17 Jason Merrill <jason@yorick.cygnus.com>
+ * class.c (duplicate_tag_error): Robustify flag clearing.
- * decl.c (grokparms): No, here.
+2001-01-19 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (grokdeclarator): Catch parm with pointer to array of
- unknown bound here...
- * method.c (process_overload_item): ...not here.
+ * cp-tree.h (lookup_template_class): Add complain parm.
+ * decl.c (lookup_namespace_name): Adjust call to
+ lookup_template_class.
+ (make_typename_type): Likewise.
+ * semantics.c (finish_template_type): Likewise.
+ * pt.c (lookup_template_class): Add complain parm. Adjust.
+ (tsubst_aggr_type): Pass COMPLAIN down to lookup_template_class.
+ (tsubst): Likewise.
- * gxxint.texi: Remove obsolete documentation of overloading code.
+2001-01-19 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (finish_enum): Also set TYPE_SIZE_UNIT.
- * class.c (finish_struct_bits): Likewise.
+ * pt.c (copy_default_args_to_explicit_spec): Preserve
+ object's CV quals. Reorganize.
- * tree.c (lvalue_type): Fix for arrays.
- * typeck.c (build_unary_op): Use lvalue_type.
- * call.c (add_function_candidate): Likewise.
- * cvt.c (convert_to_reference): Likewise.
+2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
- * decl2.c (lang_decode_option): Ignore -traditional.
+ * typeck.c (build_modify_expr): Say `initialization' for
+ INIT_EXPRs.
+ * init.c (build_default_init): Convert to enumeral type, if
+ needed.
- * init.c (build_offset_ref): Don't mess with error_mark_node.
- * lex.c (do_scoped_id): Use cp_error.
+2001-01-18 Jakub Jelinek <jakub@redhat.com>
- * rtti.c (get_tinfo_fn): Don't mess with the context for now.
+ * parse.y (nomods_initdcl0): Properly set things up for
+ initdcl0_innards.
-1998-08-17 Benjamin Kosnik <bkoz@loony.cygnus.com>
+2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (grokdeclarator): Allow anonymous types to be cv-qualified.
+ * pt.c (UNIFY_ALLOW_OUTER_LEVEL): New unify flag.
+ (type_unification_real): Set it.
+ (unify): Use it.
-Mon Aug 17 10:40:18 1998 Jeffrey A Law (law@cygnus.com)
+2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
- * cp-tree.h (set_identifier_local_value): Provide prototype.
+ * decl.c (finish_destructor_body): Convert to vbase pointer here.
- * decl2.c (do_namespace_alias): Remove unused variables `binding'
- and `old'.
+2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
-Fri Aug 14 16:42:27 1998 Nick Clifton <nickc@cygnus.com>
+ * semantics.c (begin_class_definition): Check we're not inside a
+ template parm list.
- * Makefile.in: Rename BBISON to BISON so that it can be properly
- inherited from the parent makefile.
+2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
-1998-08-13 Jason Merrill <jason@yorick.cygnus.com>
+ * tree.c (walk_tree, TREE_LIST): Don't walk the TREE_PURPOSE of
+ BASELINK_P.
- * lang-options.h: Add -finit-priority.
- * decl2.c: Likewise. Check flag_init_priority instead of
- USE_INIT_PRIORITY.
+2001-01-16 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * decl2.c (setup_initp): New fn.
- (start_objects, finish_objects, do_ctors): Handle init_priority.
- (do_dtors, finish_file): Likewise.
+ * typeck.c (build_function_call_real): Call fold on the CALL_EXPR.
+ * call.c (build_over_call): Add comment.
-1998-08-13 Jason Merrill <jason@yorick.cygnus.com>
+2001-01-16 Daniel Berlin <dberlin@redhat.com>
- * pt.c (tsubst_copy): Hush warning.
+ * cvt.c (ocp_convert): Handle vector type conversion
+ * typeck2.c (digest_init): Handle vector type initializations
- * rtti.c (get_tinfo_fn): Also set DECL_IGNORED_P.
+2001-01-16 Phil Edwards <pme@sources.redhat.com>
-1998-08-12 Mark Mitchell <mark@markmitchell.com>
+ * g++spec.c: Don't add libraries needlessly if -fsyntax-only
+ was given.
- * pt.c (print_template_context): Don't abort when instantiating a
- synthesized method.
+2001-01-15 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (grokdeclarator): Issue errors on namespace qualified
- declarators in parameter lists or in class scope.
+ * pt.c (check_nontype_parm): Rename to ...
+ (invalid_nontype_parm_type_p): ... here.
+ (process_template_parm): Adjust.
+ (convert_template_argument): Adjust.
-1998-08-09 Mark Mitchell <mark@markmitchell.com>
+2001-01-15 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (check_explicit_specialization): Don't abort on bogus
- explicit instantiations.
+ * pt.c (check_nontype_parm): New function.
+ (process_template_parm): Use it.
+ (convert_template_argument): Use it.
+ (convert_nontype_argument, RECORD_TYPE): Assert it's a ptr to
+ member.
-1998-08-07 Mark Mitchell <mark@markmitchell.com>
+2001-01-14 Jeffrey Oldham <oldham@codesourcery.com>
- * typeck.c (require_complete_type): Use complete_type_or_else.
- (complete_type_or_else): Always return NULL_TREE on failure, as
- documented.
+ * tree.c: Add defaults.h
+ (cp_valid_lang_attribute): Incorporate SUPPORTS_INIT_PRIORITY.
+ * Make-lang.in (cp/tree.o): Add defaults.h.
- * pt.c (tsubst_aggr_type): Prototype.
- (tsubst_decl): New function, split out from tsubst. Set
- input_filename and lineno as appropriate.
- (pop_tinst_level): Restore the file and line number saved in
- push_tinst_level.
- (instantiate_class_template): Set input_filename and lineno as
- appropriate.
- (tsubst): Move _DECL processing to tsubst_decl. Make sure the
- context for a TYPENAME_TYPE is complete.
+2001-01-13 Joseph S. Myers <jsm28@cam.ac.uk>
- * decl2.c (grokbitfield): Issue errors on bitfields declared with
- function type.
- (do_dtors): As in do_ctors, pretend to be a member of the same
- class as a static data member while generating a call to its
- destructor.
+ * Make-lang.in (CXX_C_OBJS): Add c-format.o.
- * cvt.c (cp_convert_to_pointer): Handle NULL pointer
- conversions, even in complex virtual base class hierarchies.
+2001-01-13 Joseph S. Myers <jsm28@cam.ac.uk>
-1998-08-06 Mark Mitchell <mark@markmitchell.com>
-
- * cp-tree.h (ENUM_TEMPLATE_INFO): New macro.
- (TYPE_TEMPLATE_INFO): Likewise.
- (SET_TYPE_TEMPLATE_INFO): Likewise.
- (ENUM_TI_TEMPLATE): Likewise.
- (ENUM_TI_ARGS): Likewise.
- (lookup_nested_type_by_name): Remove.
- * decl.c (maybe_process_template_type_declaration): Handle enums.
- (start_enum): Don't check for primary-template enum declarations
- here.
- (finish_enum): Clean up, document. Make sure template enum
- constants get the correct type.
- (build_enumerator): Copy initializers for template enumerations,
- too.
- (grok_enum_decls): Document.
- * lex.c (do_identifier): Document use of LOOKUP_EXPR a bit
- better. Build LOOKUP_EXPRs for local variables, even if they are
- TREE_PERMANENT.
- * pt.c (tsubst_enum): Remove field_chain parameter.
- (template_class_depth): Include the depth of surrounding function
- contexts.
- (push_template_decl): Check for primary-template enum declarations
- here. Deal with enumeration templates.
- (lookup_template_class): Likewise.
- (for_each_template_parm): Likewise.
- (instantiate_class_template): Don't call tsubst_enum directly,
- call tsubst instead, to instantiate enums. Deal with all
- field_chain issues here, not in tsubst_enum.
- (lookup_nested_type_by_name): Remove.
- (tsubst_aggr_type): Revise handling of enumeration types.
- (tsubst): Likewise.
- (tsubst_copy): Likewise.
- (tsubst_expr): Call tsubst, not tsubst_enum for TAG_DEFNs.
-
-1998-08-04 Mark Mitchell <mark@markmitchell.com>
-
- * decl.c (pushtag): Don't mangle the name of a TYPE_DECL if it
- uses template parameters.
- * method.c (build_template_parm_names): Use the full set of
- template arguments for tsubst'ing.
- (build_overload_identifier): Pass the full set of template
- arguments to build_template_parm_names, not just the
- innermost_args.
- * pt.c (TMPL_ARGS_DEPTH): Define using
- TMPL_ARGS_HAVE_MULTIPLE_LEVELS, for clarity.
- (NUM_TMPL_ARGS): New macro.
- (add_outermost_template_args): Deal with the case where the outer
- args will be completely discarded.
- (coerce_template_parms): Use the full set of template arguments
- for tsubst'ing. Simplify. Add some asserts. Improve
- error messages.
- (lookup_template_class): Pass the full set of template arguments
- to coerce_template_parms.
- (tsubst): Add assertion.
- (do_type_instantiation): Don't instantiate member template
- classes.
+ * g++.1: Change to be ".so man1/gcc.1".
- * init.c (build_offset_ref): Deal with a TEMPLATE_ID_EXPR whose
- name is a LOOKUP_EXPR, rather than an IDENTIFIER_NODE.
-
-1998-08-03 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (set_mangled_name_for_decl): Change return type to void.
-
- * decl.c (lookup_name_real): A namespace-level decl takes priority
- over implicit typename. Avoid doing the same lookup twice.
-
- * search.c (dependent_base_p): New fn.
- (dfs_pushdecls, dfs_compress_decls): Use it.
-
- * typeck.c (get_member_function_from_ptrfunc): Don't try to handle
- virtual functions if the type doesn't have any.
-
-1998-08-03 Mark Mitchell <mark@markmitchell.com>
-
- * decl2.c (grokfield): Don't mangle the name of a TYPE_DECL if it
- uses template parameters.
-
-1998-08-02 Mark Mitchell <mark@markmitchell.com>
-
- * cp-tree.def (LOOKUP_EXPR): Document. Remove second argument.
- * cp-tree.h (DECL_TI_TEMPLATE): Improve documentation.
- * lex.c (do_identifier): Don't use a second argument, or a type,
- when building LOOKUP_EXPRs.
- (do_identifier): Likewise.
- (do_scoped_id): Likewise.
- * method.c (hack_identifier): Improve error message.
- * pt.c (lookup_template_function): Don't needlessly call
- copy_to_permanent or build_min.
- (tsubst_copy): Remove #if 0'd code. tsubst into LOOKUP_EXPRs if
- necessary.
- (do_decl_instantiation): Improve error message.
- * tree.c (mapcar, case LOOKUP_EXPR): Don't be sorry; make a copy.
- (build_min): Copy the type to the permanent obstack, too.
-
-1998-08-01 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (init_init_processing): Remove BI* handling.
- (build_builtin_call): Remove.
- (build_builtin_delete_call): New fn.
- (build_delete): Use it.
-
-1998-07-31 Mark Mitchell <mark@markmitchell.com>
-
- * cp-tree.h (PROCESSING_REAL_TEMPLATE_DECL_P): New macro.
- (maybe_check_template_type): New function.
- * decl.c (maybe_process_template_type_declaration): New function,
- split out from pushtag Call maybe_check_template_type.
- (pushtag): Use it. Use PROCESSING_REAL_TEMPLATE_DECL_P.
- (xref_tag): Use PROCESSING_REAL_TEMPLATE_DECL_P.
- * friend.c (do_friend): Use PROCESSING_REAL_TEMPLATE_DECL_P.
- * pt.c (template_class_depth_real): Generalization of ...
- (template_class_depth): Use it.
- (register_specialization): Use duplicate_decls for duplicate
- declarations of specializations.
- (maybe_check_template_type): New function.
- (push_template_decl_real): Fix comment.
- (convert_nontype_argument): Likewise.
- (lookup_template_class): Likewise. Avoid an infinite loop on
- erroneous code.
- (tsubst_friend_function): Fix comment.
- (tsubst, case FUNCTION_DECL): Deal with a DECL_TI_TEMPLATE that is
- an IDENTIFIER_NODE.
- * semantics.c (begin_function_definition): Use
- reset_specialization to note that template headers don't apply
- directly to declarations after the opening curly for a function.
-
-1998-07-29 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (push_overloaded_decl): Use current_namespace instead of
- DECL_CONTEXT (decl) to determine where we go.
-
- * decl.c (lookup_name_real): Fix typo.
-
-1998-07-28 Mark Mitchell <mark@markmitchell.com>
-
- * friend.c (is_friend): Be lenient with member functions to deal
- with nested friends.
-
-1998-07-28 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (finish_struct_1): Convert integer_zero_node to
- ssizetype before passing it to set_rtti_entry.
- * typeck2.c (initializer_constant_valid_p): Allow conversion of 0
- of any size to a pointer.
-
-1998-07-27 Mark Mitchell <mark@markmitchell.com>
-
- * cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove.
- (build_template_decl_overload): Remove.
- (set_mangled_name_for_decl): New function.
- (innermost_args): Remove is_spec parameter.
- (most_specialized, most_specialized_class): Remove declarations.
- (lookup_template_class): Add entering_scope parameter.
- (maybe_process_partial_specialization): New function.
- (finish_template_decl): Likewise.
- (finish_template_type): Likewise.
- * class.c (finish_struct): Clean up processing of member template
- specializations.
- * decl.c (pushtag): Fix formatting.
- (lookup_tag): Improve handling of pseudo-global levels.
- (make_typename_type): Adjust call to lookup_template_class.
- (shadow_tag): Use maybe_process_partial_specialization.
- (xref_tag): Improve handling of member friends.
- (start_function): Call push_nested_class before
- push_template_decl. Don't call push_template_decl for
- specializations.
- * decl2.c (grok_x_components): Don't call xref_tag for
- template instantiations. Handle UNION_TYPEs like RECORD_TYPEs.
- (grokclassfn): Use set_mangled_name_for_decl.
- (arg_assoc_class): Adjust call to innermost_args.
- (mark_used): Don't call instantiate_decl for a TEMPLATE_DECL.
- * error.c (dump_function_name): Improve printing of template
- function names.
- * friend.c (is_friend): Don't compare types of decls to determine
- friendship, unless flag_guiding_decls.
- (make_friend_class): Partial specializations cannot be friends.
- (do_friend): Use set_mangled_name_for_decl. Call
- push_template_decl_real instead of push_template_decl.
- * method.c (build_decl_overload_real): Remove prototype. Give it
- external linkage.
- (build_overload_identififer): Adjust call to innermost_args.
- (build_template_decl_overload): Remove.
- (set_mangled_name_for_decl): New function.
- * parse.y (.finish_template_type): New non-terminal.
- (template_def): Use finish_template_decl. Use template_extdef
- instead of extdef.
- (template_extdef, template_datadef): New non-terminals, containing
- only those rules for things which can be templates.
- (datadef): Tidy.
- (template_type, self_template_type): Use .finish_template_type.
- (named_class_head): Use maybe_process_partial_specialization.
- * pt.c (mangle_class_name_for_template): Remove context parameter.
- (get_class_bindings): Remove outer_args parameter.
- (complete_template_args): Remove.
- (add_outermost_template_args): New function.
- (register_specialization): Return the specialization.
- (unregister_specialization): New function.
- (tsubst_template_parms): Likewise.
- (most_specialized, most_specialized_class): Prototype here as
- static.
- (original_template): Rename to most_general_template.
- (tsubst_template_parms): New function.
- (set_mangled_name_for_template_decl): Likewise.
- (TMPL_ARGS_DEPTH): New macro.
- (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Adjust.
- (TMPL_ARGS_LEVEL): New macro.
- (SET_TMPL_ARGS_LEVEL): Likewise.
- (TMPL_ARG): Likewise.
- (SET_TMPL_ARG): Likewise.
- (TMPL_ARGS_DEPTH): Likewise.
- (finish_member_template_decl): Use finish_template_decl.
- (maybe_process_partial_specialization): New function, split out
- from tsubst.
- (inline_needs_template_parms): Use TMPL_PARMS_DEPTH.
- (maybe_begin_member_template_processing): Use new macros.
- (is_member_template): Likewise.
- (is_member_template_class): Likewise.
- (add_to_template_args): Likewise. Deal with multiple levels of
- args.
- (maybe_process_partial_specialization): New function.
- (retrieve_specialization): Add consistency check.
- (determine_specialization): Return full argument list.
- (check_explicit_specialization): Tweak friend handling. Use full
- argument lists. Simplify.
- (current_template_args): Use new macros.
- (push_template_decl_real): Change ill-named mainargs to specargs.
- Check that a partial specialization actually specializes at least
- one parameter. Improve friend handling. Modify for full
- template arguments.
- (classtype_mangled_name): Don't mangle the names of
- specializations.
- (lookup_template_class): Add entering_scope parameter. Use it to
- avoid finding a template type when an instantiation is required.
- Simplify. Use full template arguments.
- (tsubst_friend_function): Use unregister_specialization. Use new
- macros. Use full template arguments.
- (tsubst_friend_class): Substitute, using tsubst_template_parms,
- into the template parameters before passing them to
- redeclare_class_template.
- (instantiate_class_template): Simplify. Use full template
- arguments. Adjust calls to get_class_bindings. Use
- SET_IDENTIFIER_TYPE_VALUE where needed. Improve friend handling.
- (innermost_args): Use new macros.
- (tsubst_aggr_type): New function, split out from tsubst.
- (tsubst): Use tsubst_aggr_type, tsubst_template_parms, new calling
- conventions for lookup_template_class. Refine handling of partial
- instantiations. Remove calls to complete_template_args.
- Simplify. Add consistency checks. Use set_mangled_name_for_decl
- and set_mangled_name_for_template_decl.
- (tsubst_copy): Use tsubst_aggr_type.
- (instantiate_template): Use full template arguments.
- (more_specialized): Improve formatting.
- (more_specialized_class): Adjust calls to get_class_bindings.
- (get_bindings_real): Don't call complete_template_args.
- (most_specialized): Don't overwrite input; create a new list.
- (most_specialized_class): Use most_general_template.
- (regenerate_decl_from_template): Use unregister_specialization.
- Use full template arguments.
- (instantiate_decl): Use full template arguments.
- (set_mangled_name_for_template_decl): New function.
- * semantics.c (begin_class_definition): Use
- maybe_process_partial_specialization.
- (finish_member_class_template): New function.
- (finish_template_decl): Likewise.
- (finish_template_type): Likewise.
- (typeck.c): Don't crash after issuing a compiler_error.
- * Makefile.in (CONFLICTS): Adjust; we removed a s/r conflict.
-
-1998-07-27 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck2.c (build_functional_cast): Handle default-initialization.
-
- * call.c (build_over_call): Pass 1 to popclass.
-
- * parse.y (direct_notype_declarator): Add precedence declaration
- to notype_unqualified_id case.
- * Makefile.in (EXPECT): Adjust.
-
- * tree.c (ovl_member): Fix for single function in OVL.
-
-1998-07-27 Dave Brolley <brolley@cygnus.com>
-
- * c-lex.c (yylex): Fix boundary conditions in character literal and
- string literal loops.
-
-1998-07-24 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (lookup_name_real): OK, do return the from_obj value
- unless got_object depends on template parms.
-
- * parse.y (nested_name_specifier_1): Pull out the TYPE_MAIN_VARIANT.
-
- * pt.c (coerce_template_parms): Also complain about local enums.
-
- * cp-tree.h: Add prototype for set_identifier_local_value.
- * decl.c (set_identifier_local_value_with_scope): Make static,
- prototype.
- * search.c (covariant_return_p): Likewise.
- * except.c (build_terminate_handler, alloc_eh_object): Likewise.
-
- * call.c (build_method_call): Only pull out the type of a destructor
- if it's a template type parm.
- * decl.c (lookup_name_real): Never return the from_obj value.
-
-1998-07-23 Jason Merrill <jason@yorick.cygnus.com>
-
- * except.c (process_start_catch_block_old): Call start_decl_1 for
- catch parm.
- * decl.c (start_decl_1): Avoid duplicate error.
-
- * init.c (expand_default_init): Only perform the initialization if
- it will do something.
-
-1998-07-23 H.J. Lu (hjl@gnu.org)
-
- * parse.y (base_class): Check for invalid base class.
-
-1998-07-23 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (import_export_template): Fold in...
- (import_export_class): ...to here. Handle dllimport/export.
-
- * class.c (build_vtable): Pass at_eof to import_export_vtable.
- (prepare_fresh_vtable): Likewise.
- * decl2.c (import_export_class): Split out...
- (finish_prevtable_vardecl): From here.
- * class.c (finish_struct_1): Call import_export_class if at_eof.
-
- * decl.c (start_function): #if 0 mysterious code I wrote and have
- forgotten why.
- * rtti.c (get_tinfo_fn): If this is for a class type, set
- DECL_CONTEXT.
+2001-01-13 Joseph S. Myers <jsm28@cam.ac.uk>
-1998-07-22 Jason Merrill <jason@yorick.cygnus.com>
+ * Make-lang.in (c++.info, c++.install-info): Build and install g++
+ internals info.
+ (c++.uninstall, c++.maintainer-clean): Remove g++ internals info.
+ ($(srcdir)/cp/g++int.info): New target.
+ * gxxint.texi: Add info directory entry. Use @@ in email address.
+ * .cvsignore: Update.
- * inc/exception: Change terminate and unexpected to ().
+2001-01-12 Nathan Sidwell <nathan@codesourcery.com>
- * parse.y (named_class_head_sans_basetype_defn): A
- named_class_head_sans_basetype followed by '{' or ':' is a defn.
+ * typeck.c (build_c_cast): Do template processing earlier.
+ Always pedwarn on array casts.
-1998-07-21 Jason Merrill <jason@yorick.cygnus.com>
+2001-01-12 Nathan Sidwell <nathan@codesourcery.com>
- * tree.c (canonical_type_variant): New fn to handle arrays.
- * cp-tree.h (CANONICAL_TYPE_VARIANT): Remove.
- * pt.c (unify, default case): Also fold arg. Fix array bounds case.
- * method.c (process_overload_item): Use build_overload_value for
- arrays.
+ * friend.c (make_friend_class): Make sure a templated class is
+ actually a template.
-1998-07-20 Dave Brolley <brolley@cygnus.com>
+2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
- * lex.c (mbchar.h): #include it.
- (GET_ENVIRONMENT): New macro.
- (init_parse): Set character set based on LANG environment variable.
- (real_yylex): Handle multibyte characters in character literals.
- (real_yylex): Handle multibyte characters in string literals.
+ * decl2.c (get_guard): Set linkage from guarded decl.
-1998-07-19 Jason Merrill <jason@yorick.cygnus.com>
+2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
- * lex.c (do_identifier): Look for class value even if we don't
- have a global value. Do implicit declaration if parsing is 2.
- * semantics.c (finish_call_expr): Pass 2 if we're doing Koenig
- lookup.
+ * call.c (convert_default_arg): Check for unprocessed
+ DEFAULT_ARG.
+ * cp-tree.h (replace_defarg): Move to spew.c.
+ (maybe_snarf_defarg, add_defarg_fn, do_pending_defargs): Move to
+ spew.c, which is where they really are.
+ (done_pending_defargs): Declare.
+ (unprocessed_defarg_fn): Declare.
+ * decl.c (replace_defarg): Move to spew.c
+ * parse.y (structsp): Call done_pending_defargs.
+ * spew.c (defarg_fns): Rearrange list structure.
+ (defarg_fnsdone): New static variable.
+ (defarg_depfns): New static variable.
+ (init_spew): Adjust.
+ (add_defarg_fn): Store the type in TREE_TYPE.
+ (do_pending_defargs): Detect and deal with ordering constraints
+ and circularity.
+ (done_pending_defargs): New function.
+ (unprocessed_defarg_fn): New function.
+ (replace_defarg): Moved from decl.c. Robustify. Don't save
+ if circularity detected.
-1998-07-19 Mark Mitchell <mark@markmitchell.com>
+2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (pushtag): Revert previous change.
- * pt.c (lookup_template_class): Don't put out debugging
- information for types that use template parameters.
+ * pt.c (unify): Check array has a domain, before checking
+ whether it is variable sized.
- * decl.c (pushtag): Don't put out debugging information for
- compiler-generated typedefs.
+2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
- * error.c (dump_type_real): Don't crash when presented with
- intQI_type_node or the like.
+ * decl.c (grokparms): Unobfuscate and get correct diagnostic for
+ parameters with pointers to arrays of unknown bound.
- * semantics.c (finish_translation_unit): Fix spelling error in
- comment.
+2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
-1998-07-17 Jason Merrill <jason@yorick.cygnus.com>
+ * parse.y (template_parm_header, template_spec_header): New
+ reductions. Split out from ...
+ (template_header): ... here. Use them.
+ (template_template_parm): Use template_parm_header.
+ * semantics.c (finish_template_template_parm): Add assert.
- * decl.c (lookup_name_real): Pull out single function here.
- (select_decl): Not here.
- (unqualified_namespace_lookup): Use CP_DECL_CONTEXT.
+2001-01-10 Mark Mitchell <mark@codesourcery.com>
- * decl.c (qualify_lookup): Tweak again.
+ * mangle.c (write_builtin_type): Fix thinko.
- * pt.c (lookup_template_class): Don't mess with the context of the
- instantiation.
- * decl2.c (current_decl_namespace): Remove special handling for
- templates.
+ * pt.c (copy_default_args_to_explicit_spec_1): New function.
+ (copy_default_args_to_explicit_spec): Likewise.
+ (check_explicit_specialization): Use it.
- * pt.c (tsubst, case FUNCTION_DECL): Fix getting complete args for
- a member template specialization.
+ * class.c (finish_struct_1): Remove last argument in call to
+ make_decl_rtl; use make_function_rtl instead of make_decl_rtl.
+ * decl.c (builtin_function): Likewise.
+ (build_cp_library_fn): Likewise.
+ (check_initializer): Likewise.
+ (make_rtl_for_nonlocal_decl): Likewise.
+ (cp_finish_decl): Likewise.
+ (start_function): Likewise.
+ * decl2.c (finish_anon_union): Likewise.
+ * friend.c (do_friend): Likewise.
+ * init.c (build_java_class_ref): Likewise.
+ * method.c (make_thunk): Likewise.
+ * pt.c (tsubst_friend_function): Likewise.
+ * semantics.c (expand_body): Likewise.
- * tree.c (ovl_member): Use decls_match to compare functions.
- * decl.c (decls_match): Check the context of a function.
+2001-01-10 Mark Mitchell <mark@codesourcery.com>
- * parse.y (primary): Use notype_unqualified_id instead of IDENTIFIER
- in Koenig lookup support rules.
- * semantics.c (finish_call_expr): Handle the new cases.
+ * cp-tree.h (DECL_CLONED_FUNCTION_P): Avoid wild reads by not
+ looking at DECL_CLONED_FUNCTION for non-functions.
- * typeck.c (build_x_function_call): Handle overloaded methods.
+2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (grokvardecl): Don't call build_static_name for extern "C".
+ * error.c (dump_template_parameter): Use parm to determine how
+ to print default value.
-1998-07-16 Mark Mitchell <mark@markmitchell.com>
+2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
- * semantics.c (finish_object_call_expr): Revert previous change.
- * call.c (build_new_method_call): Likewise. Instead, convert
- TYPE_DECLs to IDENTIFIERs here, in the presence of templates.
+ * class.c (duplicate_tag_error): Clear more flags.
-1998-07-16 Jason Merrill <jason@yorick.cygnus.com>
+2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (qualify_lookup): Handle templates.
+ * call.c (build_new_method_call): Use binfo_for_vbase.
- * decl2.c (do_using_directive): Don't pass ancestor.
- * decl.c (push_using_directive): Calculate ancestor.
+2001-01-10 Joseph S. Myers <jsm28@cam.ac.uk>
- * decl2.c (do_nonmember_using_decl): Allow for type shadowing.
- * decl.c (pushdecl): Move type shadowing handling from here...
- (duplicate_decls): ...to here.
- * decl.c (set_identifier_local_value_with_scope): New fn.
- (pushdecl): Use it.
- (set_identifier_local_value, lookup_type_current_level): New fns.
- * decl2.c (do_local_using_decl): Handle types and binding level
- stuff properly.
+ * cp-tree.h (flag_cond_mismatch): Don't declare.
+ * decl2.c (flag_cond_mismatch): Don't define.
+ (lang_f_options): Remove cond-mismatch.
+ (unsupported_options): Add cond-mismatch.
- * init.c (build_offset_ref): Don't call mark_used on an OVERLOAD.
- * decl.c (select_decl): Extract a lone function from an OVERLOAD.
- (lookup_namespace_name): Likewise.
- * typeck.c (build_unary_op): Not here anymore.
+2001-01-09 Nathan Sidwell <nathan@codesourcery.com>
- * decl2.c (do_class_using_decl): Make sure we get an identifier.
- * class.c (handle_using_decl): Ignore TYPE_DECLs.
+ * class.c (handle_using_decl): Reject using of constructor name
+ of sourcing class. Allow injecting of a method with same name as
+ nested class. Fixup error messages.
- * decl.c (qualify_lookup): New fn.
- (lookup_name_real): Use it.
+2001-01-09 Joseph S. Myers <jsm28@cam.ac.uk>
-1998-07-16 Martin v. Loewis <loewis@informatik.hu-berlin.de>
+ * decl2.c (lang_decode_option): Handle -Wformat=2.
- * decl2.c (add_using_namespace): When directly using a namespace
- that was indirect before, promote it.
+2001-01-08 Nathan Sidwell <nathan@codesourcery.com>
- * cp-tree.h (LOOKUP_PREFER_TYPES, LOOKUP_PREFER_NAMESPACES,
- LOOKUP_PREFER_BOTH, LOOKUP_NAMESPACES_ONLY, LOOKUP_TYPES_ONLY,
- LOOKUP_QUALIFIERS_ONLY, LOOKUP_TEMPLATES_EXPECTED): New macros.
- * decl.c (select_decl): Replace two flag parameters by one.
- (unqualified_namespace_lookup): Likewise, pass flag.
- (lookup_flags): New function.
- (lookup_name_real): Compute flags, pass them.
- (lookup_namespace_name): Call with zero-flag.
- * decl2.c (ambiguous_decl): Add flag parameter, complain only
- according to flags.
- (lookup_using_namespace, qualified_lookup_using_namespace):
- Add flag parameter, pass them through.
- * lex.c (do_scoped_id): Call with zero-flag.
+ * cp-tree.h (lang_decl_flags): Rename defined_in_class to
+ initialized_in_class.
+ (DECL_DEFINED_IN_CLASS_P): Rename to ...
+ (DECL_INITIALIZED_IN_CLASS_P): ... here, to reflect true meaning.
+ * decl.c (duplicate_decls): Preseve DECL_INITIALIZED_IN_CLASS_P.
+ (cp_finish_decl): Adjust for DECL_INITIALIZED_IN_CLASS_P.
+ * pt.c (check_default_tmpl_args): Adjust for
+ DECL_INITIALIZED_IN_CLASS_P.
+ (instantiate_class_template): Likewise.
+ (instantiate_decl): Check DECL_INITIALIZED_IN_CLASS_P.
-1998-07-16 Jason Merrill <jason@yorick.cygnus.com>
+ * class.c (finish_struct): Constify saved_filename.
- * typeck.c (convert_for_assignment): Use comptypes.
+2001-01-08 Nathan Sidwell <nathan@codesourcery.com>
-1998-07-16 Mark Mitchell <mark@markmitchell.com>
+ * class.c (duplicate_tag_error): Adjust diagnostic.
+ (finish_struct): Locally set location to start of struct.
+ * decl.c (fixup_anonymous_aggr): Use cp_error_at.
- * semantics.c (finish_object_call_expr): Move test for the
- function called being a TYPE_DECL to ...
- * call.c (build_new_method_call): Here.
+2001-01-08 Nathan Sidwell <nathan@codesourcery.com>
-1998-07-15 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (struct binding_level): Adjust class_shadowed comments
+ to reflect reality.
+ (push_class_level_binding): Adjust comments to reflect reality.
+ Set IDENTIFIER_CLASS_VALUE when replacing an existing binding.
+ Don't set TREE_VALUE on the class_shadowed list.
- * decl2.c (arg_assoc_class): Also look at template arguments, if any.
- (arg_assoc): Handle error_mark_node and multiple levels of TREE_LIST.
+2001-01-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
- * lex.c (looking_for_typename): Don't initialize.
+ * decl2.c (acceptable_java_type): Allow references too.
+ * init.c (build_java_class_ref): When using the new ABI, search
+ `class$' and have it mangled with `mangle_decl.'
+ * mangle.c (write_java_integer_type_codes): New function.
+ (write_builtin_type): Detect and mangle Java integer and real
+ types.
- * decl2.c (ambiguous_decl): Clarify error message.
+2001-01-07 Mark Mitchell <mark@codesourcery.com>
- * decl.c (push_using_directive): Iterate over namespaces used
- indirectly.
+ * decl2.c (grokfield): Don't accept `asm' specifiers for
+ non-static data members.
-1998-07-15 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+2001-01-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * decl2.c (add_using_namespace): Iterate over namespaces used
- indirectly.
+ * expr.c (cplus_expand_expr): Don't reset `target'.
- * decl.c (lookup_name_real): Accept namespace aliases as locals.
- (cat_namespace_levels): Ignore aliases.
- (duplicate_decls): Ignore duplicate aliases.
- * decl2.c (do_namespace_alias): Process block level namespace
- aliases. Store alias with pushdecl. Remove odr errors.
- * parse.y (namespace_alias): New non-terminal.
- (extdef): Use it.
+2001-01-07 Neil Booth <neil@daikokuya.demon.co.uk>
-1998-07-15 Jason Merrill <jason@yorick.cygnus.com>
+ * cp/decl2.c (cxx_post_options): Call cpp_post_options.
- * decl2.c (arg_assoc_type): Handle METHOD_TYPE like FUNCTION_TYPE.
- Handle TEMPLATE_TYPE_PARM.
- (arg_assoc): Rewrite.
+2001-01-05 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (complete_template_args): Don't look at the context unless
- we have to.
+ * parse.y (template_datadef): Check for error_mark_node.
- * method.c (build_decl_overload_real): Fix namespace handling.
+2001-01-05 Nathan Sidwell <nathan@codesourcery.com>
- * typeck.c (build_unary_op): Extract a lone function from an
- OVERLOAD.
+ * cp-tree.def (DEFAULT_ARG): Make `x' class.
- * call.c (build_scoped_method_call): Handle getting a namespace
- for basetype in a destructor call.
- (check_dtor_name): Handle enums.
+2001-01-04 Joseph S. Myers <jsm28@cam.ac.uk>
- * parse.y (using_directive): New nonterminal.
- (extdef, simple_stmt): Use it.
+ * decl.c (SIZE_TYPE, PTRDIFF_TYPE, WCHAR_TYPE): Don't define.
+ (record_builtin_type): Make non-static.
+ (flag_short_double): Don't declare.
+ (init_decl_processing): Remove the creation of many tree nodes now
+ in c_common_nodes_and_builtins.
+ (build_void_list_node): New function.
+ * decl2.c (flag_short_double, flag_short_wchar): Don't define.
+ * cp-tree.h (flag_short_wchar): Don't declare.
-1998-07-14 Martin von Löwis <loewis@informatik.hu-berlin.de>
+2001-01-04 Mark Mitchell <mark@codesourcery.com>
- * decl2.c (add_function): Move error message ...
- (arg_assoc_namespace): ... from here.
+ * call.c (build_conv): Don't use build1 for USER_CONV.
+ * pt.c (tsubst_copy): Or for PREINCREMENT_EXPR and similar nodes.
-1998-07-14 Jason Merrill <jason@yorick.cygnus.com>
+2001-01-03 Joseph S. Myers <jsm28@cam.ac.uk>
- * parse.y (namespace_qualifier): Fix multiple level handling.
- * decl2.c (namespace_ancestor): Use CP_DECL_CONTEXT.
- (arg_assoc): Don't skip the first argument of a function.
+ * lex.c (lang_init): Call c_common_lang_init.
-Tue Jul 14 20:09:22 1998 Jeffrey A Law (law@cygnus.com)
+2001-01-03 Nathan Sidwell <nathan@codesourcery.com>
- * search.c (my_tree_cons): Clean up.
+ * search.c (lookup_fnfields_here): Remove.
+ (look_for_overrides_r): Use lookup_fnfields_1.
+ Ignore functions from using declarations.
-1998-07-14 Jason Merrill <jason@yorick.cygnus.com>
+2001-01-03 Nathan Sidwell <nathan@codesourcery.com>
- * call.c (joust): Don't warn about "confusing" conversions to the
- same type.
+ Implement exceptions specifiers for implicit member functions.
+ * cp-tree.h (merge_exceptions_specifiers): Declare new function.
+ * method.c (synthesize_exception_spec): New function.
+ (locate_dtor, locate_ctor, locate_copy): New functions.
+ (implicitly_declare_fn): Generate the exception spec too.
+ * search.c (check_final_overrider): Check artificial functions
+ too.
+ * typeck2.c (merge_exception_specifiers): New function.
-1998-07-14 Martin von Löwis <loewis@informatik.hu-berlin.de>
+2001-01-03 Jason Merrill <jason@redhat.com>
- * class.c (push_nested_class): Complain about namespaces.
- * decl.c (start_decl): Enter the object's namespace.
- (cp_finish_decl): Leave it.
- (grokdeclarator): Likewise.
- * decl2.c (check_decl_namespace): New function.
- (finish_file): Call it.
- * parse.y (complex_direct_notype_declarator): Set complexity
- of namespace-qualified ids to -1, enter the namespace.
-
- * method.c (build_template_decl_overload): Expect _DECL as first
- parameter. Put context temporarily into current_namespace.
- * pt.c (check_explicit_specialization): Change caller.
+ * init.c (build_default_init): New fn.
+ (perform_member_init): Split out from here.
+ (build_new_1): Use it. Simplify initialization logic.
+ (build_vec_init): Take an array, rather than a pointer and maxindex.
+ Speed up simple initializations. Don't clean up if we're assigning.
+ * cp-tree.h: Adjust.
+ * decl2.c (do_static_initialization): Remove TREE_VEC case.
+ * parse.y (new_initializer): Return void_zero_node for ().
+ * typeck.c (build_modify_expr): Handle getting a CONSTRUCTOR.
+ * typeck2.c (digest_init): Only complain about user-written
+ CONSTRUCTORs.
+
+2000-12-22 Mike Stump <mrs@wrs.com>
+
+ * decl2.c: (max_tinst_depth): Increase to 50.
+
+2001-01-02 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (invalidate_class_lookup_cache): Zero the
+ previous_class_values.
+ * cp-tree.h (TMPL_PARMS_DEPTH): Use TREE_INT_CST_LOW, not
+ TREE_INT_CST_HIGH.
+ (CLASSTYPE_TEMPLATE_LEVEL): Likewise.
+ * decl.c (free_bindings): New variable.
+ (push_binding): Don't create a new binding if we have one on the
+ free list.
+ (pop_binding): Put old bindings on the free list.
+ (init_decl_processing): Use size_int, not build_int_2.
+ Register free_bindings as a GC root.
+ (cp_make_fname_decl): Use size_int, not build_int_2.
+ (push_inline_template_parms_recursive): Likewise.
+ (end_template_parm_list): Likewise.
+ (for_each_tempalte_parm): Do not use walk_tree_without_duplicates.
+ (tsubst_template_parms): Use size_int, not build_int_2.
(tsubst): Likewise.
+ * rtti.c (get_vmi_pseudo_type_info): Likewise.
- * init.c (build_offset_ref): Call mark_used and
- convert_from_reference for namespace members.
-
-Mon Jul 13 23:25:28 1998 Martin von Löwis <loewis@informatik.hu-berlin.de>
-
- * search.c (my_tree_cons): The bitfield is at index 2.
-
-Mon Jul 13 17:21:01 1998 Nick Clifton <nickc@cygnus.com>
-
- * lang-options.h: Format changed to work with new --help support
- in gcc/toplev.c
-
-1998-07-12 Martin von Löwis <loewis@informatik.hu-berlin.de>
-
- * decl2.c (build_expr_from_tree): Change calls of do_identifier.
- Do Koenig lookup in CALL_EXPR.
- (arg_assoc): Handle error_mark.
- * lex.c (is_global): New function.
- (do_identifier): Expect arguments for Koenig lookup.
- * parse.y (primary): Add rules for calls of unqualified function calls.
- (do_id): Change call of do_identifier.
- * pt.c (finish_stmt_expr): Likewise.
- * semantics.c (finish_id_expr): Likewise.
- (finish_call_expr): Add integer parameter to indicate
- argument-dependent lookup.
-
- * decl.c (struct binding_level): New field using_directives.
- (push_using_decl): Not sorry anymore.
- (push_using_directive): New function.
- (lookup_tag): Use CP_DECL_CONTEXT to iterate.
- (unqualified_namespace_lookup): New function, code from ...
- (lookup_name_real): ... here.
- * decl2.c (lookup_using_namespace): Pass using list instead of
- initial scope.
- (validate_nonmember_using_decl): New function.
- (do_nonmember_using_decl): New function.
- (do_toplevel_using_decl): Use them.
- (do_local_using_decl): New function.
- (do_using_directive): Support block-level directives.
- * parse.y (simple_stmt): Support using declarations and
- directives.
- (namespace_qualifier, namespace_using_decl): New non-terminals.
-
- * xref.c (classname): New function.
- (GNU_xref_hier): Change class and base parameters to tree.
- * decl.c (xref_baseypes): Change caller.
- * friend.c (make_friend_class): Likewise.
-
-1998-07-12 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
-
- * typeck.c (comptypes, case TEMPLATE_TEMPLATE_PARM): Add parameter
- comparison.
-
- * pt.c (for_each_template_parm, case TEMPLATE_DECL): If it is a
- template template parameter, record its use.
- (for_each_template_parm, case TEMPLATE_TEMPLATE_PARM): Traverse
- its template arguments if exists.
-
- * pt.c (coerce_template_template_parms): New function equivalent
- to coerce_template_parms when IS_TMPL_PARM is true.
- (coerce_template_parms): Use it. Remove the IS_TMPL_PARM parameter,
- all callers changed.
-
- (coerce_template_parms): Access ARGLIST properly when creating a
- new vector. Only accept implicit TYPE_DECL as valid argument for
- a template template parameter when it is a base class of
- current_class_type. Don't display error message when COMPLAIN is
- false.
-
-1998-07-12 Klaus Kaempf (kkaempf@progis.de)
-
- * repo.c (get_base_filename): Use file_name_nondirectory.
- (open_repo_file): Likewise.
- * cp-tree.h (file_name_nondirectory): Add prototype.
-
-1998-07-12 Jason Merrill <jason@yorick.cygnus.com>
-
- * friend.c (do_friend): Pull the identifier out of declarator.
- Use cp_error and friends.
- * decl2.c (qualified_lookup_using_namespace): Fix call to
- purpose_member.
- * decl.c (lookup_name_real): Don't call complete_type on a namespace.
- (grokvardecl): Use DECL_CLASS_SCOPE_P.
- * cvt.c (convert_pointer_to_real): Check for error_mark_node sooner.
- * class.c (warn_hidden): Fix for OVERLOAD.
- From grahams@rcp.co.uk:
- * cp-tree.h (DEFARG_NODE_CHECK): New macro.
- (DEFARG_LENGTH, DEFARG_POINTER): Use it.
-
-Sun Jul 12 01:20:57 1998 Jeffrey A Law (law@cygnus.com)
-
- * g++.1 (-traditional): Remove duplicated documentation.
-
-1998-07-11 Mark Mitchell <mark@markmitchell.com>
-
- * method.c (flush_repeats): Add nrepeats parameter.
- (issue_nrepeats): Likewise.
- (is_back_referenceable_type): New function. Don't back-reference
- TEMPLATE_TYPE_PARMs as well as simple types like integers.
- (build_mangled_name_for_type): Likewise.
- (build_mangled_name_for_type_with_Gcode): Likewise.
- (lasttype): Remove.
- (nrepeats): Likewise.
- (Nrepeats): Likewise.
- (start_squangling): Don't clear the variables removed above.
- (end_squangling): Likewise.
- (flush_repeats): Tidy. Use nrepeats parameter rather than
- Nrepeats global.
- (issue_nrepeats): Likewise, but with nrepeats global. Use
- is_backreferenceable_type.
- (build_overload_nested_name): Tidy. Add comment. Use
- build_mangled_name_for_type.
- (build_underscore_int): Comment.
- (build_overload_scope_ref): Use build_mangled_name_for_type.
- (build_overload_int): Likewise.
- (build_template_template_parm_names): Tidy.
- (build_template_parm_names): Use build_mangled_name_for_type.
- (build_overload_identifier): Add comments.
- (build_mangled_name_for_type_with_Gcode): Split out from
- build_mangled_name.
- (build_mangled_name_for_type): Use it.
- (build_mangled_name): Rework to use build_mangled_name_for_type
- and to not use global nrepeats/Nrepeats. Tidy.
- (process_modifiers): Tidy.
- (check_btype): Use is_backreferenceable_type. Add comment.
- Rename `node' to `type'.
- (process_overload_item): Set numeric_output_need_bar here.
- Use build_mangled_name_for_type. Tidy.
- (build_decl_overload_real): Tidy. Don't use Nrepeats. Use
- build_mangled_name_for_type.
-
- * pt.c (push_template_decl_real): Don't look at DECL_TEMPLATE_INFO
- for TYPE_DECLs.
-
-1998-07-08 Vladimir N. Makarov <vmakarov@cygnus.com>
-
- * cp-tree.h (warn_long_long): Define.
- * decl.c (grokdeclarator): Add flag `warn_long_long' as guard for
- warning "ANSI C++ does not support `long long'".
- * decl2.c (warn_long_long): Define.
- (lang_decode_option): Parse -Wlong-long, -Wno-long-long options.
-
-1998-07-07 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (xref_tag): Handle attributes between 'class' and name.
- * parse.y (aggr): Likewise.
- * semantics.c (finish_class_definition): Likewise.
- * Makefile.in (EXPECTED): Adjust.
-
- * cp-tree.h: Declare flag_optional_diags and warn_multichar.
- * decl2.c: Define them.
- (lang_decode_option): Handle them.
- * lang-options.h: Add -foptional-diags.
- * class.c (finish_struct): Don't complain about multiple meanings of
- name if -fno-optional-diags.
- * decl.c (pushdecl_class_level): Likewise.
- * lex.c (real_yylex): Check warn_multichar.
-
-1998-07-06 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (lookup_tag): Use CP_DECL_CONTEXT.
-
- * tree.c (make_binfo): Fix length.
-
-1998-06-30 Benjamin Kosnik <bkoz@bliss.nabi.net>
-
- * decl2.c (lang_decode_option): Remove warn_template_debugging.
- * lang-options.h: Likewise.
-
-Mon Jun 29 20:17:40 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * except.c (build_eh_type_type_ref): Remove unused variable `susp'.
- (process_start_catch_block): Likewise for variables
- `false_label_rtx', `call_rtx' and `return_value_rtx'.
-
-1998-06-29 Brendan Kehoe <brendan@cygnus.com>
-
- * tree.c (build_srcloc): Make sure we allocate this node on the
- permanent obstack.
-
-Sat Jun 27 23:34:18 1998 Fred Fish <fnf@ninemoons.com>
-
- * g++spec.c (NEED_MATH_LIBRARY): Define to 1 if not already defined.
- (lang_specific_driver): Initialize need_math with NEED_MATH_LIBRARY.
- (lang_specific_driver): Only add -lm automatically if need_math is
- nonzero.
-
-Sat Jun 27 12:22:56 1998 Jeffrey A Law (law@cygnus.com)
+2001-01-02 Richard Henderson <rth@redhat.com>
- * Make-lang.in (g++): Depend on mkstemp.o. Link in mkstemp.o
+ * parse.y (asm): Set ASM_INPUT_P.
-Sat Jun 27 07:36:09 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Makefile.in (EXPR_H): New dependency variable.
- (decl2.o): Depend on $(EXPR_H).
- (typeck.o): Likewise.
- (init.o): Likewise.
- (expr.o): Likewise.
-
-1998-06-25 Benjamin Kosnik <bkoz@lisa.cygnus.com>
-
- * decl.c (start_enum): Put local enums on permanent_obstack.
+2001-01-02 Jason Merrill <jason@redhat.com>
-1998-06-25 Mark Mitchell <mark@markmitchell.com>
+ * tree.c (cp_valid_lang_attribute): Don't set CLASSTYPE_COM_INTERFACE
+ for v3 ABI.
- * cp-tree.h (c_get_alias_set): Declare.
- * decl.c (init_decl_processing): Set lang_get_alias_set.
+ * typeck.c (cp_truthvalue_conversion): New fn.
+ * cvt.c (ocp_convert): Use it.
-1998-06-25 Andrew MacLeod <amacleod@cygnus.com>
-
- * cp-tree.h (mark_all_runtime_matches): Add function prototype.
- * except.c (mark_all_runtime_matches): Set TREE_SYMBOL_REFERENCED
- flag for all function decls which are in the exception table.
- * exception.cc (__cplus_type_matcher): Check for CATCH_ALL_TYPE match.
- * decl2.c (finish_file): Call mark_all_runtime_matches to make sure
- code is emitted for any referenced rtti function.
-
-1998-06-25 Dave Brolley <brolley@cygnus.com>
-
- * lang-specs.h: Use new | syntax to eliminate
- string concatenation.
-
-1998-06-25 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h (CP_DECL_CONTEXT): New macro.
- * decl2.c (is_namespace_ancestor, lookup_using_namespace): Use it.
- * method.c (build_overload_nested_name): Likewise.
- * sig.c (build_signature_pointer_or_reference_type): Don't set
- DECL_CONTEXT.
-
-1998-06-24 Martin v. Löwis <loewis@informatik.hu-berlin.de>
-
- Set DECL_CONTEXT for globals to NULL_TREE instead of global_namespace.
- * cp-tree.h (FROB_CONTEXT): New macro.
- (DECL_MAIN_P): ::main should have a DECL_CONTEXT of NULL_TREE.
- * decl.c (namespace_binding): Replace NULL_TREE with
- global_namespace.
- (set_namespace_binding, pop_namespace, lookup_name_real): Likewise.
- * decl2.c (is_namespace_ancestor, lookup_using_namespace):
- Likewise.
- * decl.c (pushtag): Use FROB_CONTEXT.
- (pushdecl, make_typename_type, define_function, grokdeclarator):
- Likewise.
- * decl2.c (set_decl_namespace, do_namespace_alias): Likewise.
- * pt.c (push_template_decl_real, lookup_template_class, tsubst):
- Likewise.
- * decl2.c (decl_namespace): Return global_namespace if no context.
- * method.c (build_overload_nested_name): Expect null as context.
- * pt.c (mangle_class_name_for_template): Do nothing for null
- contexts.
- (lookup_template_class): Allow for null id_context.
+ * cp-tree.h: Lose c-common.c decls.
-1998-06-25 Richard Henderson <rth@cygnus.com>
+ * typeck.c (build_unary_op): Restore old &a.f diagnostic code.
+ * cvt.c (convert_to_void): Use type_unknown_p.
- * method.c (emit_thunk): Set current_function_is_thunk for the
- ASM_OUTPUT_MI_THUNK case as well.
+ * typeck.c (strip_all_pointer_quals): Also strip quals from
+ pointer-to-member types.
-1998-06-23 Andrew MacLeod <amacleod@cygnus.com>
+ * Make-lang.in (cp/TAGS): Use --no-globals. Ignore parse.c, and treat
+ parse.y as C.
- * exception.cc (__cplus_type_matcher): Get a match_info pointer
- instead of an exception table entry as a parameter.
-
-1998-06-23 Andrew MacLeod <amacleod@cygnus.com>
-
- * parse.y (function_try_block): Don't call start_catch_handler.
- * except.c (call_eh_info): Remove coerced field from declaration.
- (build_eh_type_type_ref): New function to create an address of a
- rtti function for the new style exception tables.
- (expand_start_catch_block): Split function, this contains the
- common part.
- (process_start_catch_block_old): New function to perform the rest
- of expand_start_catch_block under old style exceptions.
- (process_start_catch_block_old): New function to perform the rest
- of expand_start_catch_block under new style exceptions.
- (expand_end_catch_block): Only pop the false label off the stack under
- the old style of exceptions.
- * semantics.c (finish_try_block): Don't call start_catch_handler.
- * exception.cc (struct cp_eh_info): Add original_value field.
- (__cplus_type_matcher): Perform type matching on the original exception
- value, and if we have a match, set the current value.
- (__cp_push_exception): Set the original exception value.
-
-1998-06-23 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (joust): Fix confusing conversion warning.
-
- * call.c (build_op_delete_call): Add placement parm. Check
- LOOKUP_SPECULATIVELY.
- * cp-tree.h, decl2.c, init.c: Adjust.
- * decl.c (finish_function): Use it.
-
- * pt.c (tsubst): Diagnose creating void fields or variables.
-
-Mon Jun 22 08:50:26 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * call.c (build_scoped_method_call): Remove unused variable `tmp'.
-
- * cp-tree.h (check_dtor_name): Add prototype.
-
- * init.c (expand_member_init): Remove unused variables
- `ptr_type_node', `parm' and `rval'.
-
- * ptree.c (print_lang_type): Use HOST_WIDE_INT_PRINT_DEC specifier
- in call to fprintf.
- (lang_print_xnode): Likewise.
-
- * typeck2.c (enum_name_string): Cast argument to sprintf to long
- and use %ld specifier.
-
- * xref.c (GNU_xref_end_scope): Use HOST_WIDE_INT_PRINT_DEC
- specifier in call to fprintf.
- (GNU_xref_member): Cast argument to sprintf to int.
+ * call.c (build_new_method_call): Do evaluate the object parameter
+ when accessing a static member.
+ * typeck.c (build_component_ref): Likewise.
-Fri Jun 19 23:22:42 1998 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
+2001-01-02 Andreas Jaeger <aj@suse.de>
- * typeck2.c (pop_init_level): Warn about implicit zero initialization
- of struct members.
+ * decl.c (cp_missing_noreturn_ok_p): New.
+ (init_decl_processing): Set lang_missing_noreturn_ok_p.
-Thu Jun 18 09:32:32 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+2000-12-29 Jakub Jelinek <jakub@redhat.com>
- * cp-tree.h: Prototype function `check_java_method'.
+ * decl.c (init_decl_processing): Fix sign of wchar_type_node.
-1998-06-17 Jason Merrill <jason@yorick.cygnus.com>
+2000-12-29 Mark Mitchell <mark@codesourcery.com>
- * class.c (finish_struct): Make conflicting use of id a pedwarn.
- * decl.c (pushdecl_class_level): Likewise.
+ * class.c (pushclass): Remove #if 0'd code.
+ * cp-tree.h (overload_template_name): Remove.
+ * decl.c (store_bindings): Simplify.
+ (pop_from_top_level): Likewise.
+ * pt.c (overload_template_name): Remove.
+ (instantiate_decl): Don't call push_to_top_level if it's not
+ needed.
-1998-06-17 Mark Mitchell <mark@markmitchell.com>
+2000-12-28 Mark Mitchell <mark@codesourcery.com>
- * pt.c (convert_nontype_argument): Issue an error when presented
- with an integer (real) constant that cannot be simplified to an
- INT_CST (REAL_CST).
+ * pt.c (register_local_specialization): Don't return a value.
+ (lookup_template_class): Use move-to-front heuristic when looking
+ up template instantiations.
+ (instantiate_decl): Only push_to_top_level when we're actually
+ going to instantiate the template.
- * cp-tree.h (c_get_alias_set): Remove declaration added in
- 1998-06-13 change that should never have been checked in.
+2000-12-29 Hans-Peter Nilsson <hp@bitrange.com>
-1998-06-17 Jason Merrill <jason@yorick.cygnus.com>
+ * search.c (binfo_for_vtable): Return least derived class, not
+ most. Handle secondary vtables.
- * typeck.c (build_binary_op_nodefault): Change % in format strings
- to %%.
+2000-12-22 Jason Merrill <jason@redhat.com>
- * decl.c (grokvardecl): Don't build_static_name for decls that
- aren't at namespace scope.
+ * pt.c (more_specialized): Don't optimize len==0.
+ (fn_type_unification): If we're adding the return type, increase len.
- * init.c (perform_member_init): Catch default-initialization of
- references.
+ * typeck.c (build_binary_op): Fix pmf comparison logic.
-1998-06-17 Mark Mitchell <mark@markmitchell.com>
+ * call.c (joust): Use DECL_NONSTATIC_MEMBER_FUNCTION_P, not
+ DECL_STATIC_FUNCTION_P.
- * errfn.c (cp_thing): Handle the `%%' formatting sequence.
+ * semantics.c (genrtl_finish_function): Don't try to jump to
+ return_label unless it exists.
-1998-06-17 Jason Merrill <jason@yorick.cygnus.com>
+ In partial ordering for a call, ignore parms for which we don't have
+ a real argument.
+ * call.c (joust): Pass len to more_specialized.
+ (add_template_candidate_real): Strip 'this', pass len.
+ * pt.c (more_specialized): Pass len down. Lose explicit_args parm.
+ (get_bindings_order): New fn. Pass len down.
+ (get_bindings_real): Strip 'this', pass len.
+ (fn_type_unification): Likewise.
+ (type_unification_real): Succeed after checking 'len' args.
+ (most_specialized_instantiation): Lose explicit_args parm.
+ * class.c (resolve_address_of_overloaded_function): Strip 'this',
+ pass len.
- * method.c (hack_identifier): Complain about getting a namespace
- or class template.
- * typeck.c (decay_conversion): Remove check for namespaces.
- * typeck2.c (incomplete_type_error): Likewise.
- * parse.y (template_arg): Add PTYPENAME expansion.
+2000-12-21 Jason Merrill <jason@redhat.com>
-1998-06-16 Andrew MacLeod <amacleod@cygnus.com>
+ * pt.c (tsubst_decl): A FUNCTION_DECL has DECL_RESULT, not
+ DECL_TEMPLATE_RESULT.
- * decl.c (grokvardecl): Don't build external assembler names for
- TYPENAMEs in other namespaces as there is no declarator.
- * error.c (cp_file_of, cp_line_of): Don't extract file or line number
- info from DECL_CONTEXT if it is NULL.
+ * search.c (lookup_field_r): Call lookup_fnfields_1, not
+ lookup_fnfields_here.
-1998-06-16 Jason Merrill <jason@yorick.cygnus.com>
+ * parse.y (typename_sub2): Return the TYPE_DECL, not the type.
- * call.c (check_dtor_name): Split out.
- (build_scoped_method_call): Use it.
- (build_method_call): Use it.
- * init.c (build_offset_ref): Use it.
+ * call.c (build_object_call): Also allow conversions that return
+ reference to pointer to function.
+ (add_conv_candidate): Handle totype being ref to ptr to fn.
+ (build_field_call): Also allow members of type reference to function.
+ Lose support for calling pointer to METHOD_TYPE fields.
- * typeck.c (build_static_cast): Fix handling of pointers to members.
+ * error.c (dump_expr): Handle *_CAST_EXPR.
- * decl.c (finish_function): Just return nothing from a constructor.
- * typeck.c (c_expand_return): Complain about returning a void
- expression from a destructor.
+ * typeck2.c (build_scoped_ref): Always convert to the naming class.
-1998-06-13 Mark Mitchell <mark@markmitchell.com>
+ * tree.c (break_out_cleanups): Lose.
+ * cp-tree.h: Remove prototype.
+ * typeck.c (build_component_ref): Don't break_out_cleanups.
+ (build_compound_expr): Likewise.
+ * semantics.c (finish_expr_stmt): Likewise.
- * class.c (alter_access): Accept a BINFO explaining how to get
- from the entity whose accessed is being altered to the type doing
- the altering.
- (handle_using_decl): New function containing code split out from ...
- (finish_struct_1): Here.
+2000-12-20 Richard Henderson <rth@redhat.com>
- * cp-tree.h (complete_type_or_else): Declare.
- * init.c (build_new_1, build_delete): Use it.
- * typeck.c (require_complete_type): Use complete_type, rather than
- expanding it inline.
- (complete_type_or_else): New function.
- (build_component_ref): Use it.
- (pointer_int_sum): Make sure the type pointed to is complete.
- (pointer_diff): Likewise.
+ * cp-tree.h: Update declarations.
+ * decl.c (finish_case_label): Return the new stmt node.
+ * semantics.c (finish_goto_stmt): Likewise.
+ (finish_expr_stmt, finish_return_stmt): Likewise.
+ (finish_break_stmt, finish_continue_stmt): Likewise.
+ (finish_asm_stmt): Likewise.
+ * parse.y (already_scoped_stmt): Set STMT_LINENO.
+ (compstmt, implicitly_scoped_stmt, stmt): Likewise.
+ (simple_if, simple_stmt): Return the new stmt node.
+ (save_lineno): New.
- * pt.c (for_each_template_parm): Traverse the TYPE_CONTEXT for
- types.
+2000-12-18 Joseph S. Myers <jsm28@cam.ac.uk>
- * search.c (get_matching_virtual): Note that member templates
- cannot override virtual functions.
+ * cp-tree.h: Don't declare warn_long_long.
-1998-06-12 Brendan Kehoe <brendan@cygnus.com>
+2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * pt.c (check_explicit_specialization): If DECLARATOR turned into
- an error_mark_node from lookup_template_function, return the same.
- (determine_specialization): Also make sure TEMPLATE_ID isn't an
- error_mark_node, before we try to read its operands.
- * decl.c (grokdeclarator): If we got an error_mark_node from
- check_explicit_specialization, just return it right back.
+ * tree.c (no_linkage_helper): Use CLASS_TYPE_P instead of
+ IS_AGGR_TYPE.
-1998-06-12 Mark Mitchell <mark@markmitchell.com>
+2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * class.c (instantiate_type): Don't treat template-ids that don't
- specify any template arguments as equivalent to ordinary
- identifiers. Use OFFSET_REF instead of SCOPE_REF to refer to
- pointer-to-members for member templates. Tidy slightly.
- * cp-tree.def (TEMPLATE_ID_EXPR): Revise documentation.
- * init.c (build_offset_ref): Handle template-ids like ordinary
- identifiers, for the most part, but store a TEMPLATE_ID_EXPR in the
- offset part of the OFFSET_REF.
- * typeck.c (build_unary_op): Change check for unknown types to
- look for OFFSET_REFs, not SCOPE_REFs.
+ * pt.c (unify): Handle when both ARG and PARM are
+ BOUND_TEMPLATE_TEMPLATE_PARM.
-1998-06-11 Mark Mitchell <mark@markmitchell.com>
+2000-12-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * pt.c (is_member_template_class): New function.
- (push_template_decl_real): Use it.
+ * pt.c (reduce_template_parm_level): Set DECL_ARTIFICIAL and
+ DECL_TEMPLATE_PARM_P.
-1998-06-11 Benjamin Kosnik <bkoz@elmo.cygnus.com>
+2000-12-15 Jason Merrill <jason@redhat.com>
- * friend.c (do_friend): Add support for nested classes using
- member functions of the enclosing class as friends.
+ * init.c (build_new_1): Reorganize. Now with 100% fewer SAVE_EXPRs!
-1998-06-10 Mark Mitchell <mark@markmitchell.com>
+ * init.c (build_new_1): Don't strip quals from type.
- * call.c (convert_default_arg): Make global, not static.
- (convert_arg_for_ellipsis): Split out from ...
- (build_over_call): Here.
- * cp-tree.h (convert_default_arg); Declare.
- (convert_arg_to_ellipsis): Likewise.
- (do_member_init): Remove.
- * init.c (do_member_init): Remove; this code is dead.
- (expand_member_init): Remove much of this code; it is dead.
- * typeck.c (convert_arguments): Use convert_default_arg and
- convert_arg_for_ellipsis, rather than duplicating here.
+ * decl.c (pushdecl): Don't check for linkage on a non-decl.
- * call.c (convert_like): Don't fail silently if
- build_user_type_conversion fails. Always return error_mark_node
- for failure.
+ * call.c (build_op_delete_call): See through ARRAY_TYPEs.
-1998-06-10 Jason Merrill <jason@yorick.cygnus.com>
+ * call.c (build_new_function_call): Lose space before paren in
+ error message.
+ (build_new_method_call): Likewise.
- * search.c (covariant_return_p): Complain about ambiguous base.
+ * typeck2.c (build_m_component_ref): Propagate quals from datum.
- * typeck.c (build_component_ref): Diagnose ref to nested type.
+2000-12-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-1998-06-10 Brendan Kehoe <brendan@cygnus.com>
+ * pt.c (check_explicit_specialization): Propagate default
+ function arguments to explicit specializations.
- * decl.c (grokparms): Check that INIT isn't an error_mark_node
- before giving error about invalid type for default arg.
+2000-12-13 DJ Delorie <dj@redhat.com>
-1998-06-10 Jason Merrill <jason@yorick.cygnus.com>
+ * typeck.c (build_binary_op): Do signed/unsigned warnings for >?
+ and <? operators.
- * call.c (build_method_call): Fix thinko.
+2000-12-08 Jason Merrill <jason@redhat.com>
-1998-06-10 Dave Brolley <brolley@cygnus.com>
+ * error.c (dump_function_name): Don't let the user see __comp_ctor.
- * decl2.c (lang_decode_option): New argc/argv interface.
- * cp-tree.h (lang_decode_option): New argc/argv interface.
- * lang-specs.h (default_compilers): Only call cpp if -E, -M or -MM is
- specified for cpplib-enabled compilers.
- * lex.c (lang_init): Don't check_newline for cpplib.
- (init_parse): Don't initialize cpplib here.
+ Clean up copy-initialization in overloading code.
+ * call.c (build_user_type_conversion_1): Die if we are asked to
+ convert to the same or a base type.
+ (implicit_conversion): Avoid doing so. Lose reference binding code.
+ (convert_like_real): Treat BASE_CONV and RVALUE_CONV as implicit
+ direct-initialization. Also do direct-init part of copy-init.
+ (build_user_type_conversion): Don't provide context to convert_like.
+ * cvt.c (ocp_convert): build_user_type_conversion will now provide
+ the constructor call for copy-init.
-1998-06-10 Brendan Kehoe <brendan@cygnus.com>
+ * pt.c (tsubst_decl): Call clone_function_decl here if this is an
+ instantiation of a member template.
+ (do_decl_instantiation): Not here.
- * typeck.c (build_component_ref): Make sure FIELD has a lang_specific
- piece before checking DECL_MUTABLE_P.
+2000-12-07 Nathan Sidwell <nathan@codesourcery.com>
-1998-06-10 John Carr <jfc@mit.edu>
+ * class.c (check_field_decls): Don't special case anonymous
+ fields in error messages.
+ (note_name_declared_in_class): Use %D on diagnostic.
- * tree.c (debug_binfo): Make printf format match arguments.
+ * tree.c (pod_type_p): Use strip_array_types.
+ (cp_valid_lang_attribute): Likewise.
+ * typeck.c (cp_type_quals): Strip arrays separately, to avoid
+ multiple evaluations.
+ (cp_has_mutable_p): Use strip_array_types.
- * error.c (OB_PUTI): Make printf format match arguments.
+2000-12-07 Nathan Sidwell <nathan@codesourcery.com>
-1998-06-10 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (sufficient_parms_p): Declare new function.
+ * call.c (sufficient_parms_p): New function, broken out of ...
+ (add_function_candidate): ... here. Use it.
+ (add_conv_candidate): Use it.
+ * decl.c (grok_ctor_properties): Use it.
- * init.c (perform_member_init): Handle default-initialization.
+2000-12-07 Jakub Jelinek <jakub@redhat.com>
- * except.c (build_throw): Handle throwing NULL.
+ * optimize.c (copy_body_r): Set STMT_IS_FULL_EXPR_P on EXPR_STMT.
- * typeck.c (build_x_function_call): Use resolve_offset_ref.
+2000-12-07 Joseph S. Myers <jsm28@cam.ac.uk>
- * search.c (compute_access): Only strip an anonymous union
- for a FIELD_DECL.
+ * decl2.c (lang_decode_option): Handle -Wformat-security.
- * call.c (add_builtin_candidates): Tweak.
+2000-12-06 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
- * cvt.c (build_expr_type_conversion): Restore code for conversion
- from class types.
- * decl2.c (delete_sanity): Use it. Clean up.
+ * pt.c (verify_class_unification): New function.
+ (get_class_bindings): Use it.
+ (try_class_unification): Tidy.
+ (unify): Handle when argument of a template-id is not
+ template parameter dependent.
+ (template_args_equal): Handle when TREE_CODE's do not match.
- * typeck.c (comp_ptr_ttypes_real): Fix cv-qual comparisons.
+2000-12-06 Alexandre Oliva <aoliva@redhat.com>
-1998-06-10 Branko Cibej <branko.cibej@hermes.si>
+ * lang-specs.h (c++): When invoking the stand-alone preprocessor
+ for -save-temps, pass all relevant -Defines to it, and then don't
+ pass them to cc1plus.
- * typeck.c (c_expand_return): Don't warn about void expressions on
- return statements in functions returning void.
+2000-12-05 Will Cohen <wcohen@redhat.com>
-1998-06-09 Mark Mitchell <mark@markmitchell.com>
+ * decl.c (finish_case_label): Cleared
+ more_cleanups_ok in surrounding function scopes.
+ (define_label): Likewise.
- * pt.c (fn_type_unification): Revise documentation. Tidy.
- (type_unification): Likewise.
+2000-12-05 Nathan Sidwell <nathan@codesourcery.com>
-1998-06-09 Andrew MacLeod <amacleod@cygnus.com>
+ * cp-tree.h (IDENTIFIER_VIRTUAL_P): Document.
+ (get_matching_virtual): Remove.
+ (look_for_overrides): Declare new function.
+ * decl.c (grokfndecl): Don't set IDENTIFIER_VIRTUAL_P or
+ DECL_VINDEX here.
+ * class.c (check_for_override): Move base class iteration code
+ to look_for_overrides.
+ * search.c (next_baselink): Remove.
+ (get_virtuals_named_this): Remove.
+ (get_virtual_destructor): Remove.
+ (tree_has_any_destructors_p): Remove.
+ (struct gvnt_info): Remove.
+ (check_final_overrider): Remove `virtual' from error messages.
+ (get_matching_virtuals): Remove. Move functionality to ...
+ (look_for_overrides): ... here, and ...
+ (look_for_overrides_r): ... here. Set DECL_VIRTUAL_P, if found
+ to be overriding.
- * semantics.c (finish_try_block): Rename expand_start_catch, and delete
- expand_end_catch.
- * parse.y (function_try_block): Rename expand_start_catch, and delete
- expand_end_catch.
- * except.c (expand_end_eh_spec): Rename expand_start_catch, and delete
- expand_end_catch.
+2000-12-05 Nathan Sidwell <nathan@codesourcery.com>
-1998-06-09 Jason Merrill <jason@yorick.cygnus.com>
+ * typeck.c (get_delta_difference): If via a virtual base,
+ return zero.
+ * cvt.c (cp_convert_to_pointer): If via a virtual base, do no
+ adjustment.
- * search.c (lookup_member): New fn.
- * class.c (finish_struct_1): Use it.
- * decl.c (lookup_name_real): Use it.
+2000-12-04 Richard Henderson <rth@redhat.com>
-Mon Jun 8 20:45:52 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ * error.c (dump_tree): Use output_add_string not OB_PUTS.
- * Makefile.in (decl2.o): Depend on dwarf2out.h and dwarfout.h.
+2000-12-04 Jason Merrill <jason@redhat.com>
- * cp-tree.h: Add prototype for `maybe_print_template_context' and
- `maybe_make_one_only'.
+ * mangle.c (write_type): Mangle VECTOR_TYPE with "U8__vector".
+ (write_builtin_type): Pass intSI_type_node and the like through
+ type_for_mode.
+ * method.c (process_overload_item): Mangle VECTOR_TYPEs with 'o'.
+ Pass intSI_type_node and the like through type_for_mode.
+ * decl2.c (arg_assoc_type): Handle VECTOR_TYPE like COMPLEX_TYPE.
+ * pt.c (tsubst, unify): Likewise.
+ * tree.c (walk_tree): Likewise.
+ * error.c (dump_type): Likewise.
+ (dump_type_prefix, dump_type_suffix): Don't bother with VECTOR_TYPE.
- * decl.c (auto_function): Remove unused variable `decl'.
+ * Make-lang.in: Tweak top comment for emacs.
+ (cp/TAGS): Restore.
- * decl2.c: Include dwarf2out.h and dwarfout.h.
+ * except.c (expand_throw): Use push_throw_library_fn for _Jv_Throw.
- * lex.c: Remove redundant declarations of `set_float_handler' and
- `asm_out_file'.
+ * class.c (clone_function_decl): Robustify.
-1998-06-08 Andrew MacLeod <amacleod@cygnus.com>
+2000-12-04 Michael Matz <matzmich@cs.tu-berlin.de>
- * except.c (init_exception_processing): Remove NEW_EH_MODEL compile
- time flag. Call __cp_eh_info instead of __cp_exception_info.
- * exception.cc (struct cp_eh_info): Remove NEW_EH_MODEL flag.
- (__cp_exception_info): Return offset into cp_eh_info structure to
- match what use to be the start of this structure.
- (__cp_eh_info): New function to return a pointer to cp_eh_info struct.
- (__cplus_type_matcher, __cp_push_exception): Remove NEW_EH_MODEL
- compile time flag.
- (__uncatch_exception, __check_eh_spec, std::uncaught_exception): Call
- __cp_eh_info instead of __cp_exception_info.
+ * decl.c (store_bindings): Only search in the non modified
+ old_bindings for duplicates.
-1998-06-08 Jason Merrill <jason@yorick.cygnus.com>
+2000-12-04 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (cp_finish_decl): Disable inlining of extern inlines
- with static variables.
+ * error.c (dump_function_decl): Use DECL_VIRTUAL_P, not
+ TYPE_POLYMORPHIC_P.
-1998-06-08 Mark Mitchell <mark@markmitchell.com>
+ * typeck.c (build_static_cast): Remove unused variable.
- * init.c (build_offset_ref): Correct previous change to use build,
- not build_min.
+2000-12-01 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-1998-06-07 Mark Mitchell <mark@markmitchell.com>
+ * pt.c: Fix typo in comment.
- * class.c (instantiate_type): Handle pointer-to-members where the
- member is a template.
- * init.c (build_offset_ref): Likewise.
- * typeck.c (build_unary_op): Likewise.
+2000-12-01 Joseph S. Myers <jsm28@cam.ac.uk>
-1998-06-07 Richard Henderson <rth@cygnus.com>
+ * decl2.c (warn_format): Remove definition.
+ (lang_decode_option): Handle -Wformat-nonliteral,
+ -Wno-format-extra-args and -Wno-format-y2k. Use set_Wformat.
- * lex.c (lang_init_options): New function.
- (lang_init): Remove flag_exceptions == 2 hack.
+2000-12-01 Joseph S. Myers <jsm28@cam.ac.uk>
-1998-06-05 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Don't define.
+ (init_decl_processing): Don't create string_type_node,
+ const_string_type_node, wint_type_node, intmax_type_node,
+ uintmax_type_node, default_function_type, ptrdiff_type_node and
+ unsigned_ptrdiff_type_node. Adjust position of call to
+ c_common_nodes_and_builtins.
+ (identifier_global_value): New function.
- * search.c (envelope_add_decl): Tweak for implicit typename.
+2000-12-01 Nathan Sidwell <nathan@codesourcery.com>
- * call.c (joust): Also warn about confusing conversion op/constructor
- overload resolution.
-
- * spew.c (yylex): Also return the TYPE_DECL if got_object.
- Don't clear got_object after '~'.
- * call.c (build_scoped_method_call): Tweak destructor handling.
- (build_method_call): Likewise.
- * pt.c (tsubst_copy, case METHOD_CALL_EXPR): Don't mess with
- TYPE_MAIN_VARIANT for destructors.
- * semantics.c (finish_object_call_expr): Complain about calling a
- TYPE_DECL.
-
-1998-06-05 Per Bothner <bothner@cygnus.com>
+ * call.c (standard_conversion): Reject pointer to member
+ conversions from ambiguous, inaccessible or virtual bases.
+ * typeck.c (build_static_cast): Don't check pointers to members
+ specially.
- * g++spec.c (lang_specific_pre_link, lang_specific_extra_ofiles):
- Define - update needed by gcc.c change.
+2000-11-30 Nathan Sidwell <nathan@codesourcery.com>
-1998-06-05 Jason Merrill <jason@yorick.cygnus.com>
+ * method.c (do_build_copy_constructor): Preserve cv
+ qualifications when accessing source object members.
+ (do_build_assign_ref): Likewise. Remove separate diagnostics for
+ unnamed fields.
- * error.c (cp_printers): Use 'o' instead of '_' for the null entry.
+2000-11-30 Nathan Sidwell <nathan@codesourcery.com>
-1998-06-05 Martin v. Loewis <loewis@informatik.hu-berlin.de>
+ * method.c (do_build_assign_ref): Construct appropriately
+ CV-qualified base reference. Don't allow const casts in base
+ conversion.
- * cp-tree.h (DECL_NAMESPACE_ALIAS, ORIGINAL_NAMESPACE): Declare.
- * decl.c (lookup_name_real): Add namespaces_only parameter.
- If set, return only NAMESPACE_DECLs.
- (select_decl): Likewise.
- (identifier_type_value): Give additional parameter.
- (lookup_name_nonclass): Likewise.
- (lookup_name): Likewise.
- (find_binding): Skip namespace aliases.
- (binding_for_name): Likewise.
- (push_namespace): Check for namespace aliases.
- (lookup_name_namespace_only): New function.
- (begin_only_namespace_names, end_only_namespace_names): New functions.
- * decl2.c (set_decl_namespace): Skip namespace aliases.
- (do_using_directive): Likewise.
- (do_namespace_alias): Produce namespace aliases, fix alias
- redeclaration.
- * error.c (dump_decl): Support SCOPE_REF.
- * parse.y (extdef): Wrap lookup with namespace_only for namespace
- aliases and using declarations.
+2000-11-30 Nathan Sidwell <nathan@codesourcery.com>
-1998-06-04 Jason Merrill <jason@yorick.cygnus.com>
+ * call.c (build_over_call): Use VOID_TYPE_P. Don't die on
+ incomplete return type.
- * tree.c (really_overloaded_fn): Only see through one TREE_LIST.
+2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
- * error.c (dump_expr): Clean up NEW_EXPR case.
+ * parse.y (base_class.1): Produce a _TYPE not a _DECL.
+ * semantics.c (finish_base_specifier): Accept a _TYPE not a
+ _DECL.
-1998-06-04 Martin von Löwis <loewis@informatik.hu-berlin.de>
+2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
- Suggested by Brendan Kehoe
- * decl2.c (do_toplevel_using_decl): When decl is a TYPE_DECL,
- treat it as using ::decl.
+ * spew.c (yyerror): Cope if yylval.ttype is NULL.
- * decl2.c (arg_assoc_type): Process unknown_type_node and OFFSET_TYPE.
+2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
- * tree.c (mapcar): Support NEW_EXPR.
+ * decl.c (grokdeclarator): Diagnose undefined template contexts.
- * error.c (dump_expr): Support NEW_EXPR.
+2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
-1998-06-03 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (grokdeclarator): Do type access control on friend
+ class.
- * method.c (make_thunk): Use overload machinery to make name.
- * search.c (covariant_return_p): New fn.
- (get_matching_virtual): Use it.
+2000-11-27 Nathan Sidwell <nathan@codesourcery.com>
- * init.c (build_new_1): Fix check for void.
+ * decl.c (grokfndecl): Undo COMPONENT_REF damage caused by
+ bison parser ickiness.
+ * pt.c (tsubst_friend_function): Enter namespace scope when
+ tsubsting the function name.
+ * cp-tree.h (DECL_TI_TEMPLATE): Update comment to reflect reality.
-1998-06-01 Per Bothner <bothner@cygnus.com>
+2000-11-27 Nathan Sidwell <nathan@codesourcery.com>
- * cp-tree.h (TYPE_FOR_JAVA): New macro.
- * decl.c, cp-tree.h (java_byte_type_node, java_short_type_node,
- java_int_type_node, java_long_type_node, java_float_type_node,
- java_double_type_node, java_char_type_node, java_boolean_type_node):
- New "primitive" types, with predefined names __java_byte etc.
- (record_builtin_java_type): New function.
- (init_decl_processing): Make Java types with record_builtin_java_type.
- (pushtag, grokdeclarator): Set TYPE_FOR_JAVA if in extern "JAVA".
- (xref_baseypes): If base class was TYPE_FOR_JAVA, so is this class.
- (grokfndecl): Call check_java_method for Java classes.
- * method.c (is_java_type): Removed. Replaced with TYPE_FOR_JAVA.
- (process_overload_item): Match types against specific
- java_XX_type_node types, rather than using is_java_type.
- * class.c (finish_struct_1): Don't add default copy constructor
- or operator= if TYPE_FOR_JAVA.
- (pop_lang_conext): Restore strict_prototyp proper if Java.
- * decl2.c (acceptable_java_type, check_java_method): New functions.
- * pt.c (instantiate_class_template): Copy TYPE_FOR_JAVA from pattern.
- (tsubst): Move common statement after if statement.
- * typeck.c (comptypes): If strict, TYPE_FOR_JAVA must match.
+ * cp-tree.h (binfo_from_vbase): Return the virtual base's binfo.
+ * cvt.c (cp_convert_to_pointer): Add force parameter.
+ Allow conversions via virtual base if forced.
+ (convert_to_pointer_force): Adjust call to cp_convert_to_pointer.
+ (ocp_convert): Likewise.
+ * search.c (binfo_from_vbase): Return the virtual base's binfo.
+ * typeck.c (get_delta_difference): Adjust handling of virtual
+ bases.
-1998-06-01 Jason Merrill <jason@yorick.cygnus.com>
+2000-11-26 Mark Mitchell <mark@codesourcery.com>
- * pt.c (for_each_template_parm): Use first_rtl_op.
+ * tree.c (struct list_hash): Remove.
+ (list_hash_table): Make it be an htab.
+ (struct list_proxy): New type.
+ (list_hash_eq): New function.
+ (list_hash_pieces): Renamed from ...
+ (list_hash): ... this.
+ (list_hash_lookup): Remove.
+ (list_hash_add): Remove.
+ (hash_tree_cons): Use the generic hashtable.
+ (mark_list_hash): Remove.
+ (init_tree): Create the hashtable.
- * tree.c (build_cplus_array_type_1): Also check index_type for
- template parms.
+2000-11-25 Joseph S. Myers <jsm28@cam.ac.uk>
-1998-05-31 Jason Merrill <jason@yorick.cygnus.com>
+ * method.c (build_mangled_C9x_name): Rename to
+ build_mangled_C99_name. Change C9X references in comments to
+ refer to C99.
- * pt.c (tsubst): Always copy BINFO_BASETYPES.
+2000-11-24 Nathan Sidwell <nathan@codesourcery.com>
-1998-05-29 scott snyder <snyder@d0sgif.fnal.gov>
+ * parse.y (unary_expr): Move VA_ARG from here ...
+ (primary): ... to here.
- * tree.c (layout_basetypes): If we change TYPE_SIZE, change
- TYPE_SIZE_UNIT too.
+2000-11-24 Nathan Sidwell <nathan@codesourcery.com>
-1998-05-29 Mark Mitchell <mark@markmitchell.com>
+ * semantics.c (finish_id_expr): If type is error_mark, return
+ error_mark.
- * decl.c (grokdeclarator): Don't complain about in-class
- initialization of static consts if we don't really know the type
- of the variable.
+2000-11-23 Nathan Sidwell <nathan@codesourcery.com>
-1998-05-29 Jason Merrill <jason@yorick.cygnus.com>
+ * pt.c (lookup_template_class): Simplify loop exit constructs.
+ Cope when there is no partial instantiation of a template
+ template member.
- * cp-tree.h (DECL_DESTRUCTOR_P): New macro.
- * method.c (build_destructor_name): New fn.
- * decl2.c (maybe_retrofit_in_chrg): Split out...
- (grokclassfn): From here. Reorganize.
- * decl.c (grok_ctor_properties): Make sure ctors for types with
- vbases have the in_chrg parm.
- * pt.c (instantiate_class_template): Update
- TYPE_USES_VIRTUAL_BASECLASSES from tsubsted bases. Don't call
- grok_*_properties.
- (tsubst): Call grok_ctor_properties and maybe_retrofit_in_chrg.
+Thu Nov 23 02:16:47 2000 J"orn Rennecke <amylaar@redhat.com>
-1998-05-28 Mark Mitchell <mark@markmitchell.com>
+ * Make-lang.in (g++spec.o, cxxmain.o): Depend on $(CONFIG_H).
- * pt.c (instantiate_decl): Make test for whether or not static
- variables should be instantiated early match its comment.
+2000-11-22 Mark Mitchell <mark@codesourcery.com>
-1998-05-28 Jason Merrill <jason@yorick.cygnus.com>
+ * mangle.c (mangle_conv_op_name_for_type): Don't use `__op'
+ prefix.
- * decl.c (start_decl): Always pedwarn about vacuously redeclaring
- a member.
- (start_function): Call check_default_args.
- * decl2.c (grokfield): Don't call check_default_args.
- (check_default_args): Use cp_error_at.
- * lex.c (do_pending_defargs): Call check_default_args.
+ * pt.c (do_decl_instantiate): Explicitly clone constructors and
+ destructors that haven't already been cloned.
-1998-05-27 Brendan Kehoe <brendan@cygnus.com>
+2000-11-20 Richard Henderson <rth@redhat.com>
- * call.c (build_method_call): Make sure get_type_value returns
- something before we try to use its TYPE_MAIN_VARIANT.
- (build_scoped_method_call): Likewise.
+ * parse.y (yyparse_1): Rename the parser entry point.
-1998-05-27 Jason Merrill <jason@yorick.cygnus.com>
+2000-11-20 Alex Samuel <samuel@codesourcery.com>
- * typeck2.c (digest_init): Complain about getting a TREE_LIST to
- initialize an array.
+ * mangle.c (write_name): Use <unscoped-name> for names directly in
+ function scope.
+ (write_unscoped_name): Accept names directly in function scope.
- * search.c (expand_upcast_fixups): Don't set DECL_CONTEXT and
- DECL_VIRTUAL_P.
+2000-11-20 Nathan Sidwell <nathan@codesourcery.com>
- * friend.c (do_friend): Clarify template warning.
+ * lex.c (rid_to_yy, RID_EXPORT): Make unique keyword.
+ * parse.y (extdef): Add EXPORT reduction.
+ * spew.c (yylex): Don't skip export here.
-1998-05-27 Mark Mitchell <mark@markmitchell.com>
+2000-11-19 Mark Mitchell <mark@codesourcery.com>
- * decl.c (shadow_label): Don't treat decls as identifiers.
- (maybe_push_to_top_level): Clear shadowed_labels.
+ * decl.c (init_decl_processing): Correct name of pure virtual
+ function under the new ABI.
+ * rtti.c (throw_bad_cast): Likewise, for bad cast function.
+ (throw_bad_typeid): Likewise for bad typeid function.
- * pt.c (instantiate_decl): Reset lineno and filename after calling
- regenerate_decl_from_template.
+2000-11-18 Mark Mitchell <mark@codesourcery.com>
- * decl.c (grokdeclarator): Don't try to use TYPE_OBSTACK on an
+ * decl.c (grokparms): Don't even function types of `void' type,
+ either.
+ * mangle.c (write_type): Don't crash when confronted with the
error_mark_node.
-1998-05-27 Kevin Buhr <buhr@stat.wisc.edu>
-
- * parse.y (base_class): Use is_aggr_type, not IS_AGGR_TYPE.
-
-1998-05-26 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
+ * decl.c (grokparms): Don't create parameters of `void' type.
- * pt.c (process_template_parm): Accept TYPENAME_TYPE nodes.
- (convert_nontype_argument): Handle cases when nontype template
- parameters become classes after substitution.
+2000-11-17 Zack Weinberg <zack@wolery.stanford.edu>
-1998-05-26 Mark Mitchell <mark@markmitchell.com>
+ * lex.c (mark_impl_file_chain): Delete.
+ (init_parse): Remove call to ggc_add_string_root. No need to
+ ggc_strdup a string constant. Do not add impl_file_chain to GC
+ roots.
+ (handle_pragma_implementation): No need to ggc_strdup main_filename.
- * friend.c (is_friend): Use comptypes, rather than == to compare
- types. Modify for new representation of template friends.
- (make_friend_class): Likewise.
- * pt.c (tsubst_friend_class): Undo 1998-05-21 change. Tweak.
- (instantiate_class_template): Deal with template friends.
+2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (store_parm_decls): Remove redundant call to
- expand_main_function.
+ * pt.c (tsubst_expr, DECL_STMT): Instantiate decl's type.
-1998-05-26 Benjamin Kosnik <bkoz@loony.cygnus.com>
+2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (start_decl): Check for DECL_LANG_SPECIFIC before
- DECL_USE_TEMPLATE.
+ * cp-tree.h (PARMLIST_ELLIPSIS_P): New macro.
+ * decl.c (grokdeclarator): Don't reject void parms here.
+ (require_complete_types_for_parms): Simplify, use
+ complete_type_or_else.
+ (grokparms): Remove bitrot. Remove funcdef parm.
+ Deal with ellipsis parm lists here.
+ * semantics.c (finish_parmlist): Don't append void_list_node
+ here. Set PARMLIST_ELLIPSIS_P.
-1998-05-26 Per Bothner <bothner@cygnus.com>
+2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
- * language_as_string: Handle lang_java.
+ * typeck2.c (incomplete_type_error): Reorganise to avoid
+ excessive diagnostics.
-1998-05-26 Jason Merrill <jason@yorick.cygnus.com>
+2000-11-16 Zack Weinberg <zack@wolery.stanford.edu>
- * decl.c (pushdecl): Don't copy the type_decl.
+ * lex.c (struct impl_files, internal_filename): Constify a char *.
-1998-05-26 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+2000-11-16 Mark Mitchell <mark@codesourcery.com>
- * class.c (pushclass): Always store TYPE_MAIN_VARIANT in
- current_class_type.
- * decl.c (grokdeclarator): Put typedefs on the type's obstack.
+ * mangle.c (write_special_name_constructor): Don't generate
+ assembler junk when confronted with an old-style constructor.
+ (write_special_name_destructor): Likewise.
+ (mangle_decl_string): Do it here instead.
- * parse.y (complex_direct_notype_declarator): Use $1 to access
- scope of notype_qualified_id.
+2000-11-16 Nathan Sidwell <nathan@codesourcery.com>
-1998-05-26 Dave Brolley <brolley@cygnus.com>
+ * call.c (op_error): Make error messages clearer.
- * lex.c (parse_options,yy_cur,yy_lim): Add for cpplib.
- (init_parse): Initialize cpplib interface.
+2000-11-15 Mark Mitchell <mark@codesourcery.com>
- * Makefile.in (CXX_OBJS): Make sure dependencies never end with an
- empty continuation.
+ * decl.c (wrapup_globals_for_namespace): Don't mark things
+ TREE_ASM_WRITTEN when they're not.
-1998-05-26 Mark Mitchell <mark@markmitchell.com>
+2000-11-15 Jason Merrill <jason@redhat.com>
- * decl.c (pushtag): Avoid crashing on erroneous input.
+ * typeck2.c (friendly_abort): Uncount the error before handing
+ off to fancy_abort.
-1998-05-25 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+2000-11-15 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (push_namespace): Only produce one unique name for
- anonymous namespaces.
- (get_unique_name): Remove.
+ * typeck.c (lookup_anon_field): Cope with qv qualifiers.
-1998-05-25 Mark Mitchell <mark@markmitchell.com>
+2000-11-14 Mark Mitchell <mark@codesourcery.com>
- * call.c (tourney): Don't do any extra comparisons.
+ * class.c (build_vtbl_initializer): Fix typo in comment.
+ * typeck.c (expr_sizeof): Don't crash on errors.
- * decl2.c (build_anon_union_vars): Don't crash on empty sub-unions.
+2000-11-14 Jim Wilson <wilson@redhat.com>
- * cp-tree.h (processing_template_parmlist): Declare.
- * decl.c (pushtag): Don't call push_template_decl when we
- shouldn't.
- * pt.c (processing_template_parmlist): New variable.
- (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): New macro.
- (complete_template_args): Use it.
- (add_to_template_args): Likewise.
- (innermost_args): Likewise.
- (tsubst): Likewise.
- (begin_template_parm_list): Use processing_template_parmlist.
- (end_template_parm_list): Likewise.
+ * lang-specs.h: Add %2 after %(cc1_options).
- * cp-tree.h (ANON_UNION_TYPE_P): New macro.
- * decl.c (grokdeclarator): Use it.
- * decl2.c (grok_x_components): Likewise.
- * init.c (initializing_context): Likewise.
- * method.c (do_build_copy_constructor): Likewise.
- (do_build_assign_ref): Likewise.
- * search.c (compute_access): Likewise.
- * typeck.c (build_component_ref): Likewise.
+2000-11-14 Richard Henderson <rth@redhat.com>
- * decl.c (grokdeclarator): Don't give a cv-qualified version of an
- unnamed type a typedef name "for linkage purposes".
+ * typeck.c (c_sizeof): Be strict about casting result value
+ back to c_size_type_node.
+ (expr_sizeof, c_sizeof_nowarn, c_alignof): Likewise.
- * pt.c (lookup_template_class): Don't look at
- IDENTIFIER_CLASS_VALUE when there's no current_class_type.
+2000-11-13 Joseph S. Myers <jsm28@cam.ac.uk>
- * method.c (build_overload_int): Handle error cases gracefully.
+ * typeck.c (build_unary_op): Use boolean_increment from
+ c-common.c, moving the relevant code there.
- * pt.c (instantiate_decl): Handle static member variables
- correctly.
-
- * pt.c (tsubst): Use the tsubst'd type when producing new
- TEMPLATE_PARM_INDEX nodes.
+2000-11-11 Jason Merrill <jason@redhat.com>
-1998-05-24 Mark Mitchell <mark@markmitchell.com>
+ * typeck.c (mark_addressable): Don't call put_var_into_stack.
- * tree.c (cp_tree_equal): Handle pointers to member functions.
+ * decl.c (maybe_commonize_var): Set DECL_UNINLINABLE for statics
+ in inlines.
- * call.c (maybe_handle_implicit_object): Handle QUAL_CONVs. Make
- sure the type of the REF_BIND is a reference type.
- (maybe_handle_ref_bind, compare_ics): Rename reference_type to
- target_type for clarity.
+2000-11-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * parse.y (xcond): Move call to condition_conversion ...
- * semantics.c (finish_for_cond): Here.
- * parse.c: Regenerated.
+ * decl.c (grokdeclarator, save_function_data): Use memcpy, not bcopy.
+ * lex.c (copy_lang_decl): Likewise.
-1998-05-24 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (push_namespace): Namespaces have type void.
- * typeck2.c (incomplete_type_error): Complain about namespace
- used as expression.
- * typeck.c (decay_conversion): Likewise.
+2000-11-09 Mark Mitchell <mark@codesourcery.com>
-1998-05-24 Martin von Löwis <loewis@informatik.hu-berlin.de>
+ * dump.c (cp_dump_tree): Don't dump function bodies here.
- * error.c (dump_expr): Support namespaces.
+ * Make-lang.in (CXX_C_OBJS): Add c-dump.o.
+ (dump.o): Update dependency list.
+ * cp-tree.h (DECL_MAYBE_TEMPLATE): Remove.
+ (flag_dump_translation_unit): Likewise.
+ (CP_TYPE_QUALS): Adjust definition.
+ (DECL_C_BIT_FIELD): Remove.
+ (SET_DECL_C_BIT_FIELD): Likewise.
+ (CLEAR_DECL_C_BIT_FIELD): Likewise.
+ (add_maybe_template): Likewise.
+ (strip_array_types): Likewise.
+ (dump_node_to_file): Likewise.
+ (cp_dump_tree): New function.
+ * decl.c (init_decl_processing): Set lang_dump_tree.
+ * decl2.c (flag_dump_translation_unit): Remove.
+ * dump.c: Move most of it to ../c-dump.c.
+ (cp_dump_tree): New function.
+ * pt.c (add_maybe_template): Remove.
+ * typeck.c (strip_array_types): Likewise.
-1998-05-23 Jason Merrill <jason@yorick.cygnus.com>
+2000-11-07 Eric Christopher <echristo@redhat.com>
- * cp-tree.def: Add SRCLOC.
- * cp-tree.h: Add struct tree_srcloc and accessor macros.
- * tree.c (build_srcloc, build_srcloc_here): New fns.
- * pt.c (add_pending_template): Use build_srcloc_here.
- (push_tinst_level): Update last_template_error_tick before erroring.
- (instantiate_decl): Restore lineno and input_filename before
- calling add_pending_template.
- * decl2.c (finish_file): Set up lineno and input_filename for
- pending templates.
-
-1998-05-22 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (lang_print_error_function): New fn.
- (init_decl_processing): Set print_error_function to use it.
- * errfn.c (cp_thing): Don't call maybe_print_template_context here.
-
- * call.c (maybe_handle_ref_bind): Propagate ICS_USER_FLAG and
- ICS_BAD_FLAG.
-
- * cvt.c (ocp_convert): Don't set LOOKUP_NO_CONVERSION for
- copy-initialization.
-
- * class.c (build_vtable_entry): Use int_fits_type_p.
- (build_vtable): Pass a signed offset to build_vtable_entry.
- (prepare_fresh_vtable, modify_one_vtable, fixup_vtable_deltas1,
- set_rtti_entry): Likewise.
-
-1998-05-22 Per Bothner <bothner@cygnus.com>
-
- * cp-tree.h: Add comments documenting which LANG_FLAGS are used.
- (C_TYPE_VARIABLE_SIZE, C_DECL_VARIABLE_SIZE): Removed, not used.
-
-1998-05-22 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (print_template_context): Use fprintf instead of cp_error.
-
- * pt.c (determine_specialization): Just return an error_mark_node.
- Also print the decl we want in error messages. If we complain,
- return error_mark_node.
- (tsubst_friend_function): Set lineno and input_filename so
- error messages will be useful.
- (instantiate_template): Just return an error_mark_node.
- (check_explicit_specialization): Don't mess with a returned
- error_mark_node.
-
- * pt.c (print_template_context): Add new argument.
- (maybe_print_template_context): New fn.
- (push_tinst_level): Increment tinst_level_tick.
- (pop_tinst_level): Likewise.
- * errfn.c (cp_thing): Call maybe_print_template_context. Use
- xrealloc instead of xmalloc.
+ * decl.c (init_decl_processing): Change definition of
+ __wchar_t to wchar_t. Remove artificial declaration of
+ wchar_t.
+ * lex.c: Change instances of __wchar_t to wchar_t.
- * typeck.c (build_unary_op, CONVERT_EXPR): Propagate TREE_CONSTANT.
+2000-11-09 Nathan Sidwell <nathan@codesourcery.com>
-1998-05-21 Jason Merrill <jason@yorick.cygnus.com>
+ * lex.c (do_identifier): Don't lookup_name for operators.
+ * parse.y (operator): Save looking_for_typename.
+ (unoperator): Restore it.
+ * spew.c (frob_opname): Use nth_token for lookahead.
- * pt.c (tsubst_friend_class): Don't call redeclare_class_template
- if the template we looked up is the same as the one we already
- have.
+2000-11-08 Nathan Sidwell <nathan@codesourcery.com>
-Thu May 21 11:54:44 1998 Dave Brolley <brolley@cygnus.com>
+ * decl.c (grok_op_properties): Always use coerce_new_type and
+ coerce_delete_type.
+ * decl2.c (coerce_new_type): Use c_size_type_node. Preserve
+ exception specification. Tidy up.
+ (coerce_delete_type): Preserve exception specification. Tidy up.
- * lex.c: (handle_sysv_pragma): FILE* parameter not used.
- (cpp_reader,parse_in): Add for cpplib.
- (check_newline): Call handle_sysv_pragma with new interface.
- (check_newline): Call GET_DIRECTIVE_LINE, not get_directive_line.
+2000-11-07 Joseph S. Myers <jsm28@cam.ac.uk>
- * input.c: (yy_cur,yy_lim,yy_get_token,GETC): Add for cpplib.
- (sub_getch): Call GETC for cpplib.
+ * class.c (duplicate_tag_error, build_vtbl_initializer), decl.c
+ (push_binding_level), error.c (cp_tree_printer), pt.c
+ (process_partial_specialization, tsubst_template_arg_vector),
+ search.c (lookup_member): Use memset () instead of bzero ().
- * cp-tree.h: (get_directive_line): Different prototype for cpplib.
- (GET_DIRECTIVE_LINE): Macro wrapper for get_directive_line.
+2000-11-07 Nathan Sidwell <nathan@codesourcery.com>
- * Makefile.in (CXX_OBJS): Add @extra_cxx_objs@ for cpplib.
+ * decl.c (build_ptrmemfunc_type): Allow error_mark_node.
-1998-05-21 Jason Merrill <jason@yorick.cygnus.com>
+2000-11-05 Joseph S. Myers <jsm28@cam.ac.uk>
- * decl2.c (maybe_make_one_only): New fn.
- (import_export_vtable): Use it.
- (import_export_decl): Likewise.
- * pt.c (mark_decl_instantiated): Likewise.
+ * Make-lang.in (c++.distdir): Remove.
-1998-05-21 Mark Mitchell <mmitchell@usa.net>
+2000-11-04 Mark Mitchell <mark@codesourcery.com>
- * decl2.c (find_representative_member): Rename to ...
- (build_anon_union_vars): New function.
- (finish_anon_union): Fix stupidity of previous change.
+ * decl2.c (do_nonmember_using_decl): Allow `extern "C"'
+ declarations from different namespaces to be combined.
-1998-05-20 Jason Merrill <jason@yorick.cygnus.com>
+2000-11-03 Zack Weinberg <zack@wolery.stanford.edu>
- * decl.c (grokfndecl): Handle definition of specialization in
- friend declaration.
+ * decl.c: Include tm_p.h.
- * error.c (dump_decl): Fix LOOKUP_EXPR handling.
+2000-11-03 Joseph S. Myers <jsm28@cam.ac.uk>
-1998-05-20 Mark Mitchell <mmitchell@usa.net>
+ * tree.c (cp_tree_equal): Use memcmp () instead of bcmp ().
- * class.c (delete_duplicate_fields_1): Use DECL_DECLARES_TYPE_P
- to look for type declarations.
- (finish_struct): Deal with templates on the CLASSTYPE_TAGS list.
- * cp-tree.h (DECL_DECLARES_TYPE_P): New macro.
- (finish_member_class_template): Declare.
- * decl.c (pushtag): Put member class templates on the
- CLASSTYPE_TAGS list, just as for ordinary member classes.
- (pushdecl_class_level): Use DECL_DECLARES_TYPE_P.
- (lookup_tag): Look for IDENTIFIER_CLASS_VALUEs, just as with
- IDENTIFIER_NAMESPACE_VALUEs.
- * parse.y (component_decl): Move code to ...
- * semantics.c (finish_member_class_template): New function.
- Don't put member class templates on the list of components for a
- class.
- * parse.c: Regenerated.
- * pt.c (classtype_mangled_name): Don't try DECL_CONTEXT on types.
- In fact, don't use DECL_CONTEXT at all here.
+2000-11-02 Joseph S. Myers <jsm28@cam.ac.uk>
-1998-05-20 Martin von Loewis <loewis@informatik.hu-berlin.de>
+ * dump.c (dequeue_and_dump), lex.c (interface_strcmp), method.c
+ (build_overload_value), repo.c (open_repo_file), xref.c
+ (open_xref_file): Use strchr () and strrchr () instead of index ()
+ and rindex ().
- * decl.c (record_unknown_type): New function.
- (init_decl_processing): Call it for the unknown and global type
- nodes.
+2000-11-01 Bernd Schmidt <bernds@redhat.co.uk>
-1998-05-20 Mark Mitchell <mmitchell@usa.net>
+ * call.c (build_over_call): Call fold on the CALL_EXPR.
- * decl2.c (find_representative_member): New function.
- (finish_anon_union): Use it.
+2000-11-01 Gabriel Dos Reis <gdr@codesourcery.com>
- * cp-tree.h (MAIN_NAME_P): New macro.
- (DECL_MAIN_P): Likwise.
- * decl.c (pushdecl): Avoid crashing on redefinitions of `main'.
- (grokfndecl): Use the new macros.
- (grokdeclarator): Likewise.
- (start_function): Likewise.
- (store_parm_decls): Likewise.
- (finsh_function): Likewise.
- * friend.c (do_friend): Likewise.
- * typeck.c (build_function_call_real): Likewise.
- (build_unary_op): Likewise.
+ * error.c (dump_template_decl): Separate template hearders with
+ space not comma.
-Wed May 20 02:16:01 1998 Jason Merrill <jason@yorick.cygnus.com>
+2000-10-31 Gabriel Dos Reis <gdr@codesourcery.com>
- * decl2.c (start_objects, finish_objects, do_dtors,
- do_ctors): Split out from...
- (finish_file): ...here.
+ * error.c: Move TFF_ macros into cp-tree.h. Throughout, replace
+ TS_* flags with corresponding TFF_*. Adjust prototypes of
+ functions (which used to take a tree_string_flags) to take an int.
-Tue May 19 20:36:23 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (enum tree_string_flags): Remove
+ (TFF_PLAIN_IDENTIFIER, TFF_NAMESPACE_SCOPE, TFF_CLASS_SCOPE,
+ TFF_CHASE_NAMESPACE_ALIAS, TFF_CHASE_TYPEDEF, TFF_DECL_SPECIFIERS,
+ TFF_CLASS_KEY_OR_ENUM, TFF_RETURN_TYPE,
+ TFF_FUNCTION_DEFAULT_ARGUMENTS, TFF_EXCEPTION_SPECIFICATION,
+ TFF_TEMPLATE_HEADER, TFF_TEMPLATE_DEFAULT_ARGUMENTS,
+ TFF_TEMPLATE_NAME, TFF_EXPR_IN_PARENS, TFF_SCOPE): New macros.
+ (type_as_string, decl_as_string, expr_as_string,
+ context_as_string): Adjust prototype.
- * tree.c (is_overloaded_fn): Don't abort on placeholders from
- push_class_decls.
+ * class.c (dump_class_hierarchy_r): Use TFF_PLAIN_IDENTIFIER
+ instead of TS_PLAIN.
-Tue May 19 15:16:22 1998 Brendan Kehoe <brendan@cygnus.com>
+ * pt.c (mangle_class_name_for_template): Use TFF_CHASE_TYPEDEF
+ instead of TF_CHASE_TYPEDEFS. Use TFF_PLAIN_IDENTIFIER instead of
+ plain `0'.
- * class.c (is_empty_class): Return 0 if TYPE is an error_mark_node.
+2000-10-30 Mark Mitchell <mark@codesourcery.com>
- * error.c (dump_expr): Handle an ARROW_EXPR.
+ * cp-tree.h (DECL_EXTERNAL_LINKAGE_P): New macro.
+ (linkage_kind): New enumeration.
+ (decl_linkage): New function.
+ * decl2.c (comdat_linkage): Extend comment.
+ * error.c (dump_function_decl): Print the arguments used to
+ instantiate a template, even when not printing the type of the
+ function.
+ * pt.c (convert_nontype_argument): Use DECL_EXTERNAL_LINKAGE_P,
+ not TREE_PUBLIC, to test for external linkage.
+ * tree.c (decl_linkage): New function.
-Tue May 19 15:13:39 1998 Mark Mitchell <mmitchell@usa.net>
+2000-10-28 Mark Mitchell <mark@codesourcery.com>
- * decl.c (saveable_obstack): Declare.
- (pushdecl): Copy TYPE_DECLs to the same obstack as the type they
- declare, if necessary.
+ * pt.c (instantiate_decl): Always instantiate static data members
+ initialized in-class.
-Tue May 19 14:50:27 1998 Mark Mitchell <mmitchell@usa.net>
+2000-10-27 Zack Weinberg <zack@wolery.stanford.edu>
- * call.c (compare_qual): Remove.
- (is_subseq): Tweak.
- (is_properly_derived_from): New function.
- (maybe_handle_ref_bind): Likewise.
- (maybe_handle_implicit_object): Likewise.
- (compare_ics): Modify substantially to bring into conformance with
- the standard.
- * cp-tree.h (TYPE_PTRMEMFUNC_OBJECT_TYPE): New macro.
- (comp_cv_qualification): Declare.
- (comp_cv_qual_signature): Likewise.
- * typeck.c (comp_cv_qualification): Likewise.
- (comp_cv_qual_signature): Likewise.
+ * Make-lang.in: Move all build rules here from Makefile.in,
+ adapt to new context. Wrap all rules that change the current
+ directory in parentheses. Expunge all references to $(P).
+ When one command depends on another and they're run all at
+ once, use && to separate them, not ;. Add OUTPUT_OPTION to
+ all object-file generation rules. Delete obsolete variables.
-Tue May 19 10:05:02 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ * Makefile.in: Delete.
+ * config-lang.in: Delete outputs= line.
- * Makefile.in (parse.o): Depend on toplev.h.
+2000-10-26 Gabriel Dos Reis <gdr@codesourcery.com>
- * class.c (typecode_p): Remove prototype and definition.
+ * error.c (dump_function_decl): Print no space between
+ `ptr-operator' the `type-specifier' of the return type.
+ (dump_type_prefix): Make sure we put space at the appropriate
+ place.
- * cp-tree.h (currently_open_class, is_empty_class, member_p):
- Add prototype.
+2000-10-23 Jason Merrill <jason@redhat.com>
- * decl.c (push_overloaded_decl_top_level): Remove prototype and
- definition.
+ * call.c (equal_functions): Also call decls_match for extern "C" fns.
- * errfn.c (cp_error): Cast function pointer `error' to (errorfn *)
- in call to `cp_thing'.
- (cp_warning): Likewise for function pointer `warning'.
+2000-10-22 Jason Merrill <jason@redhat.com>
- * except.c (do_function_call): Remove prototype and definition.
- (call_eh_info): Wrap variable `t1' in macro NEW_EH_MODEL.
+ * call.c (build_conditional_expr): Use ocp_convert to force
+ rvalue conversion.
- * method.c (is_java_type): Add prototype and make it static.
+2000-10-22 Mark Mitchell <mark@codesourcery.com>
- * parse.y: Include toplev.h.
+ * call.c (standard_conversion): Use RVALUE_CONVs for all
+ expressions that satisfy lvalue_p, not just those that satisfy
+ real_lvalue_p.
- * pt.c (type_unification): Remove unused variable `arg'.
- (instantiate_decl): Likewise for `save_ti'.
+ * optimize.c (copy_body_r): Don't treat CALL_EXPRs specially.
- * tree.c (propagate_binfo_offsets): Likewise for `base_binfos'.
+ * typeck.c (c_sizeof): Return an expression of `size_t' type,
+ not one with TYPE_IS_SIZETYPE set.
+ (dubious_conversion_warnings): Remove special-case code.
-Tue May 19 02:43:25 1998 Jason Merrill <jason@yorick.cygnus.com>
+2000-10-21 Geoffrey Keating <geoffk@cygnus.com>
- * init.c (build_member_call): Handle template_ids.
- * parse.y (primary): Add global_scope template_id.
+ * decl2.c (arg_assoc_type): Handle VECTOR_TYPE.
+ * error.c (dump_type): Handle VECTOR_TYPE like POINTER_TYPE.
+ (dump_type_prefix): Print vector-of-int as 'int vector'.
+ (dump_type_suffix): Handle VECTOR_TYPE like POINTER_TYPE.
+ * tree.c (walk_tree): Handle VECTOR_TYPE.
-Mon May 18 23:22:52 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (init_decl_processing): Call MD_INIT_BUILTINS.
- * decl2.c (get_sentry): Use end_temporary_allocation.
- Don't declare permanent_obstack.
+2000-10-21 Jason Merrill <jason@redhat.com>
-Mon May 18 12:28:44 1998 Mark Mitchell <mmitchell@usa.net>
+ * parse.y (operator): Set got_object from got_scope.
+ Set looking_for_typename.
+ * decl.c (lookup_name_real): Clear val after setting from_obj.
+ Reorganize diagnostic.
- * parse.y (.finish_new_placement): New non-terminal.
- (unary_expr, new_type_id): Use it.
- * parse.c: Regenerated.
+2000-10-20 Jason Merrill <jason@redhat.com>
-Mon May 18 12:20:27 1998 Brendan Kehoe <brendan@cygnus.com>
+ * tree.c (walk_tree): Don't walk into default args.
- * pt.c (redeclare_class_template): Say where the original definition
- of the template-parameter's default argument appeared.
+ * error.c (dump_expr): Use host_integerp.
-Mon May 18 03:00:57 1998 Jason Merrill <jason@yorick.cygnus.com>
+2000-10-20 David Edelsohn <edelsohn@gnu.org>
- * call.c (build_over_call): Tweak empty class handling.
+ * typeck2.c (abstract_virtuals_error): Use "because" instead of
+ "since" in error message.
- * decl.c (make_typename_type): Use currently_open_class.
+Fri Oct 20 13:54:59 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
- * class.c (instantiate_type): Don't abort on TREE_NONLOCAL_FLAG.
+ * typeck.c (dubious_conversion_warning): Suppress if TYPE_IS_SIZETYPE.
-Mon May 18 01:43:01 1998 Martin v. Loewis <loewis@informatik.hu-berlin.de>
+2000-10-20 Jeffrey Oldham <oldham@codesourcery.com>
- * decl.c (lookup_name_real): Don't look at IDENTIFIER_LOCAL_VALUE
- for a type unless it is one.
+ * decl.c (revert_static_member_fn): Fixed typo.
- * class.c (finish_struct_1): Use OVL_CURRENT in error message.
+2000-10-19 Mark Mitchell <mark@codesourcery.com>
-Mon May 18 01:24:08 1998 Jeffrey A Law (law@cygnus.com)
+ * class.c (subobject_offset_fn): New type.
+ (dfs_record_base_offsets): Remove.
+ (record_base_offsets): Likewise.
+ (dfs_search_base_offsets): Likewise.
+ (record_subobject_offset): New function.
+ (check_subobject_offset): Likewise.
+ (walk_subobject_offsets): Likewise.
+ (record_subobject_offsets): Likewise.
+ (layout_conflict_p): Reimplement.
+ (layout_nonempty_base_or_field): Correct handling of type
+ conflicts during layout.
+ (layout_empty_base): Likewise.
+ (build_base_field): Adjust to handle new representation of empty
+ base offset table.
+ (build_base_fields): Likewise.
+ (layout_virtual_bases): Likewise.
+ (splay_tree_compare_integer_csts): New function.
+ (layout_class_type): Use a splay_tree, rather than a varray, to
+ represent the offsets of empty bases.
- * Makefile.in (program_transform_name, objdir): Define.
+ * cp-tree.h (DECL_ANTICIPATED): Don't require a FUNCTION_DECL.
+ * decl.c (select_decl): Don't return declarations that are
+ DECL_ANTICIPATED.
- * Makefile.in (BISON): Use bison from the build tree if it exists.
- (FLEX): Likewise.
+2000-10-18 Mark Mitchell <mark@codesourcery.com>
-Sun May 17 14:52:08 1998 Martin v. Loewis <loewis@informatik.hu-berlin.de>
+ * cp-tree.h (cp_tree_index): Add CPTI_FAKE_STD.
+ (fake_std_node): New macro.
+ * decl.c (in_std): Rename to ...
+ (in_fake_std): ... this.
+ (flag_no_builtin): Remove.
+ (flag_no_nonansi_builtin): Likewise.
+ (walk_namespaces_r): Use fake_std_node.
+ (push_namespace): Use std_identifier.
+ (pop_namespace): Use in_fake_std.
+ (lookup_name_real): Use fake_std_node.
+ (init_decl_processing): When -fhonor-std, create the `std'
+ namespace. Don't create a dummy fake_std_node in that case.
+ Adjust call to c_common_nodes_and_builtins. Use std_identifier.
+ (builtin_function): Put builtins whose names don't begin
+ with `_' in the std namespace.
+ * decl2.c (flag_no_builtin): Remove.
+ (flag_no_nonansi_builtin): Likewise.
+ (set_decl_namespace): Use fake_std_node.
+ (validate_nonmember_using_decl): Likewise.
+ (do_using_directive): Likewise.
+ (handle_class_head): Likewise.
+ * dump.c (dequeue_and_dump): Likewise.
+ * except.c (init_exception_processing): Use std_identifier.
+ * init.c (build_member_call): Use fake_std_node.
+ * rtti.c (init_rtti_processing): Use std_identifier.
+
+2000-10-17 Mark Mitchell <mark@codesourcery.com>
- * typeck.c (type_unknown_p): Return true for TREE_LIST also.
+ * cp-tree.h (back_end_hook): Remove declaration.
+ * decl2.c (back_end_hook): Remove definition.
- * call.c (build_method_call): Use TYPE_MAIN_VARIANT on typedefs.
+ * dump.c (dequeue_and_dump): Dump TREE_USED.
-Sun May 17 14:51:41 1998 Jason Merrill <jason@yorick.cygnus.com>
+Tue Oct 17 20:19:06 2000 Brad Lucier <lucier@math.purdue.edu>
- * call.c (build_scoped_method_call): Likewise.
+ * spew.c (snarf_defarg): Cast 2nd arg to obstack_blank to (int).
-Sun May 17 13:53:48 1998 Mark Mitchell <mmitchell@usa.net>
+2000-10-17 Joseph S. Myers <jsm28@cam.ac.uk>
- * init.c (build_new_1): Call suspend_momentary around the creation
- of values that must be saved for exception handling.
- * parse.y (.build_new_placement): New non-terminal.
- (unary_expr, new_placement): Use it.
- * parse.c: Regenerated.
+ * decl.c (WINT_TYPE): Define.
+ (init_decl_processing): Create types unsigned_ptrdiff_type_node,
+ c_size_type_node, signed_size_type_node and wint_type_node.
-Sun May 17 12:32:08 1998 Jason Merrill <jason@yorick.cygnus.com>
+2000-10-17 Joseph S. Myers <jsm28@cam.ac.uk>
- * decl.c (duplicate_decls): Use CANONICAL_TYPE_VARIANT to compare
- old and new types.
+ * decl2.c (warn_missing_format_attribute): New variable.
+ (lang_decode_option): Decode -Wmissing-format-attribute.
- * pt.c (tsubst): Make sure that BINFO_TYPE of new binfos is the
- canonical type.
+2000-10-16 Mark Mitchell <mark@codesourcery.com>
- * call.c (build_over_call): Don't use IS_SIGNATURE on a namespace.
+ * typeck.c (qualify_type): Remove.
+ (composite_pointer_type): Fix handling of conversions to `cv void*'.
-Fri May 15 20:28:00 1998 Jason Merrill <jason@yorick.cygnus.com>
+2000-10-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * decl.c (start_decl): Revert problem change.
+ * Makefile.in (parse.c, parse.h): Fix think-o in last patch.
- * Makefile.in (CONFLICTS): Fix.
+2000-10-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-Fri May 15 15:34:02 1998 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+ * Makefile.in (parse.c, parse.h): Create atomically.
- * decl.c (duplicate_decls): Clean up, add DECL_DATA_AREA bits.
+2000-10-12 Mark Mitchell <mark@codesourcery.com>
-Fri May 15 00:46:05 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * class.c (current_obstack): Remove.
+ * decl.c (ggc_p): Remove.
+ (start_decl): Don't use decl_tree_cons.
+ (grokdeclarator): Don't use build_decl_list.
+ (start_function): Don't use decl_tree_cons.
+ (finish_function): Don't mess with obstacks.
+ * decl2.c (grok_x_components): Don't use build_decl_list.
+ * lex.c (make_call_declarator): Don't call decl_tree_cons.
+ (implicitly_declare_fn): Don't call build_decl_list.
+ * parse.y (frob_specs): Don't call build_decl_list or
+ decl_tree_cons.
+ (expr_or_declarator_intern): Don't call decl_tree_cons.
+ (primary): Don't call build_decl_list.
+ (fcast_or_absdcl): Likewise.
+ (typed_declspecs): Don't call decl_tree_cons.
+ (reserved_declspecs): Don't call build_decl_list.
+ (declmods): Likewise.
+ (reserved_typespecquals): Likewise.
+ (aggr): Likewise.
+ (new_type_id): Likewise.
+ (cv_qualifiers): Likewise.
+ (after_type_declarator_intern): Likewise.
+ (notype_declarator_intern): Likewise.
+ (absdcl_intern): Likewise.
+ (named_parm): Likewise.
+ * pt.c (most_specialized_class): Likewise.
+ * repo.c (temporary_obstack): Make it a structure, not a pointer.
+ (init_repo): Initialize it.
+ * search.c (current_obstack): Remove.
+ * typeck2.c (add_exception_specifier): Don't call build_decl_list.
- * class.c (finish_struct_1): Use BINFO_SIZE.
+2000-10-09 Richard Henderson <rth@cygnus.com>
- * decl.c (start_decl): Use 'tem'.
+ * Make-lang.in (CXX_EXTRA_HEADERS): Remove.
+ (c++ language support bits for libgcc): Remove.
+ (c++.clean): Remove cplib2.txt cleanup.
+ * config-lang.in (headers, lib2funcs): Remove.
-Thu May 14 16:30:47 1998 Andrew MacLeod <amacleod@cygnus.com>
+ * exception.cc, new.cc, new1.cc, new2.cc: Remove files.
+ * tinfo.cc, tinfo.h, tinfo2.cc, vec.cc: Remove files.
+ * inc/cxxabi.h, inc/exception, inc/new: Remove files.
+ * inc/new.h, inc/typeinfo: Remove files.
- * exception.cc: Include eh-common.h.
- (struct cp_eh_info): Add eh_info struct with NEW_EH_MODEL.
- (__cplus_type_matcher): First stab at new C++ runtime type matcher.
- (__cp_push_exception): Initialize eh_info struct as well.
- * except.c: Remove local structs and include eh-common.h.
- (init_exception_processing): Set language and version codes.
- (call_eh_info): Add presence of eh_info to runtime description of
- struct cp_eh_info.
- (expand_end_eh_spec): Call start_catch_block() and end_catch_block().
- * semantics.c (finish_try_block): Call start_catch_block() and
- end_catch_block().
- * parse.y (function_try_block): Call start_catch_block() and
- end_catch_block().
+2000-10-08 Joseph S. Myers <jsm28@cam.ac.uk>
-Thu May 14 12:27:34 1998 Brendan Kehoe <brendan@cygnus.com>
+ * decl.c (INTMAX_TYPE, UINTMAX_TYPE): Define if not already
+ defined.
+ (init_decl_processing): Initialize intmax_type_node and
+ uintmax_type_node.
- * typeck.c (original_type): New function.
- (common_type): Use it to get the DECL_ORIGINAL_TYPE for T1 and T2,
- to see if they're actually the same.
- * cp-tree.h (original_type): Declare.
+2000-10-06 Richard Henderson <rth@cygnus.com>
-Wed May 13 12:54:30 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ * cp-tree.h (struct cp_language_function): Remove x_result_rtx.
+ (original_result_rtx): Remove.
+ * decl.c (save_function_data): Don't clear x_result_rtx.
+ (mark_lang_function): Don't mark it either.
+ * expr.c (fixup_result_decl): Remove.
+ * semantics.c (genrtl_named_return_value): Frob the return decl
+ before calling emit_local_var.
+ (genrtl_finish_function): Don't call fixup_result_decl.
+ Always emit the jump to return_label.
- * Makefile.in (lex.o): Depend on output.h.
+2000-10-06 Nathan Sidwell <nathan@codesourcery.com>
- * call.c (add_function_candidate): Remove unused variable `cand'.
- (add_conv_candidate): Likewise.
- (build_builtin_candidate): Likewise.
+ * pt.c (lookup_template_class): Set current access for enum.
+ (tsubst_enum): Set file & line for enum decl.
- * cp-tree.h: Add prototype for `types_overlap_p'.
+ * spew.c (yylex): Remove unused variable.
- * decl.c (signal_catch): Mark parameter `sig' with ATTRIBUTE_UNUSED.
+2000-10-05 Richard Henderson <rth@cygnus.com>
- * decl2.c (merge_functions): Remove unused variables `tmp' and
- `tempn'.
+ * semantics.c (genrtl_finish_function): Don't init or check
+ can_reach_end; remove noreturn and return value checks.
- * error.c (expr_as_string): Mark parameter `v' with ATTRIBUTE_UNUSED.
- (code_as_string): Likewise.
- (language_as_string): Likewise.
- (parm_as_string): Likewise.
- (op_as_string): Likewise.
- (assop_as_string): Likewise.
- (cv_as_string): Likewise.
+2000-10-05 Tom Tromey <tromey@cygnus.com>
- * lex.c: Include output.h.
+ * init.c (build_java_class_ref): Use `build_static_name' with a
+ suffix, not a prefix, to build the class object's name.
- * pt.c (type_unification): Cast first argument of `bzero' to a char*.
+2000-10-05 Nathan Sidwell <nathan@codesourcery.com>
- * search.c (dfs_no_overlap_yet): Mark parameter `t' with
- ATTRIBUTE_UNUSED.
+ * cp-tree.h (access_kind): Fix comment typo.
+ * decl2.c (grokfield): Fix diagnostic typo.
+ * semantics.c (finish_template_type): Fix comment typo.
+ (finish_qualified_object_call_expr): Likewise.
- * tinfo.cc (__class_type_info::dcast): Change the type of variable
- `i' from int to size_t.
+2000-10-05 Nathan Sidwell <nathan@codesourcery.com>
- * typeck.c (language_lvalue_valid): Mark parameter `exp' with
- ATTRIBUTE_UNUSED.
+ * pt.c (tsubst_expr, DECL_STMT case): Don't process if
+ tsubsting fails.
-Tue May 12 21:37:49 1998 Jason Merrill <jason@yorick.cygnus.com>
+2000-10-05 Nathan Sidwell <nathan@codesourcery.com>
- * error.c (dump_simple_decl): Use DECL_CLASS_SCOPE_P and/or
- DECL_NAMESPACE_SCOPE_P.
- (lang_decl_name): Likewise.
- * pt.c (tsubst_friend_function, tsubst): Likewise.
- * decl.c (pushdecl, redeclaration_error_message, start_decl,
- cp_finish_decl, start_function): Likewise.
- * class.c (finish_struct_1): Likewise.
- * call.c (build_over_call): Likewise.
- (compare_ics): Use DERIVED_FROM_P.
+ * spew.c (frob_id): New static function.
+ (frob_opname): Use it.
+ (yylex): Use it.
+
+2000-10-01 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (lang_mark_false_label_stack): Remove.
+ * lex.c (cp_mang_lang_type): Use ggc_alloc_cleared.
+
+2000-09-30 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * gxxint.texi: Use @email for formatting email addresses.
+
+2000-09-29 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * error.c: Remove direct obstack manipulation. Replace with
+ output_buffer-based formatting. Adjust calls to removed macros.
+ (obstack_chunk_alloc, obstack_chunk_free): Remove.
+ (OB_INIT, OB_PUTC, OB_PUTC2, OB_PUTS, OB_PUTID, OB_PUTCP,
+ OB_FINISH, OB_PUTI, OB_END_TEMPLATE): Likewise.
-Tue May 12 07:24:18 1998 Mark Mitchell <mmitchell@usa.net>
+2000-09-24 Mark Mitchell <mark@codesourcery.com>
- * cp-tree.h (CANONICAL_TYPE_VARIANT): New macro.
- * method.c (build_mangled_name): Use it.
- (build_decl_overload_real): Likewise.
+ * ir.texi: Move to ../c-tree.texi.
- * error.c (dump_simple_decl): New function, broken out from ...
- (dump_decl): Use it.
+2000-09-20 Jason Merrill <jason@redhat.com>
-Mon May 11 11:38:07 1998 Mark Mitchell <mmitchell@usa.net>
+ * decl2.c (get_guard): Check DECL_FUNCTION_SCOPE_P.
- * ptree.c (lang_print_xnode): Add missing `break'.
+2000-09-21 Andreas Jaeger <aj@suse.de>
- * pt.c (tsubst): Remove duplicate check for IDENTIFIER_NODE.
+ * errfn.c: Move declaration of cp_printer and cp_printers to ...
+ * cp-tree.h: ... here.
- * call.c (add_template_candidate): Adjust for changes to
- fn_type_unification.
- (add_template_candidate_real): Likewise.
- (add_template_conv_candidate): Likewise.
- (build_user_type_conversion_1): Likewise.
- (build_new_function_call): Likewise.
- (build_object_call): Likewise.
- (build_new_op): Likewise.
- (build_new_method_call): Likewise.
- * class.c (instantiate_type): Likewise.
- * cp-tree.h (unification_kind_t): New type.
- (fn_type_unification): Adjust prototype.
- (type_unificaiton): Likewise.
- * pt.c (UNIFY_ALLOW_NONE): New macro.
- (UNIFY_ALLOW_MORE_CV_QUAL): Likewise.
- (UNIFY_ALLOW_LESS_CV_QUAL): Likewise.
- (UNIFY_ALLOW_DERIVED): Likewise.
- (unify): Change prototype.
- (maybe_adjust_types_for_deduction): New function.
- (check_cv_quals_for_unify): Likewise.
- (determine_specialization): Adjust.
- (fn_type_unification): Likewise.
- (type_unification): Likewise.
- (type_unification_real): Likewise. Use
- maybe_adjust_types_for_deduction. Fix mishandling of
- back-unification of template functions passed as arguments. Pass
- appropriate combination of UNIFY_ALLOW_* to unify.
- (unify): Remove unused NTPARMS parameter. Use
- check_cv_quals_for_unify. Remove bogus code that allowed
- too-generous unification in order to adhere more closely to standard.
- (get_bindings_real): Adjust.
- (get_class_bindings): Likewise.
-
- * method.c (build_overload_identifier): Only use the innermost
- template arguments when mangling.
- * pt.c (tsubst_template_argument_vector): New function.
- (complete_template_args): Deal with the situation where the
- extra_args contain more than one level of arguments.
- (lookup_template_class): Deal with member template classes, which
- may have more than one level of arguments.
- (tsubst): Don't tsbust into the TREE_TYPE of an IDENTIFIER_NODE.
- Improve handling of member template classes. Use
- DECL_PRIMARY_TEMPLATE instead of inline expansion. Use
- tsubst_template_argument_vector where appropriate.
- (regenerate_decl_from_template): Break out from ...
- (instantiate_decl): Here.
-
- * lex.c (yyprint): Remove TYPENAME_ELLIPSIS.
- * parse.h: Regenerated.
- * parse.c: Really regenerated.
-
- * cp-tree.h (finish_unary_op_expr): New function.
- (finish_id_expr): Likewise.
- (begin_new_placement): Likewise.
- (finish_new_placement): Likewise.
- (finish_declarator): Likewise.
- (finish_translation_unit): Likewise.
- (finish_parmlist): Likewise.
- (begin_class_definition): Likewise.
- (finish_class_definition): Likewise.
- (finish_default_args): Likewise.
- (finish_inline_definitions): Likewise.
- * parse.y (GCC_ASM_KEYWORD): Remove.
- (TYPENAME_ELLIPSIS): Likewise.
- * parse.c: Regenerated.
- Use new functions in semantics.c in the actions for many rules.
- * gxx.gperf (GCC_ASM_KEYWORD): Just use ASM_KEYWORD.
- * hash.h: Regenerated.
- * semantics.c (finish_expr_stmt): Allow NULL expr.
- (finish_unary_op_expr): New function, containing
- code previously in parse.y.
- (finish_id_expr): Likewise.
- (begin_new_placement): Likewise.
- (finish_new_placement): Likewise.
- (finish_declarator): Likewise.
- (finish_translation_unit): Likewise.
- (finish_parmlist): Likewise.
- (begin_class_definition): Likewise.
- (finish_class_definition): Likewise.
- (finish_default_args): Likewise.
- (finish_inline_definitions): Likewise.
-
-Sun May 10 23:43:13 1998 Mark Mitchell <mmitchell@usa.net>
-
- * typeck.c (build_c_cast): Don't decay arrays and functions to
- pointer type when converting to a class type.
-
-Sun May 10 22:53:56 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h (DECL_NAMESPACE_SCOPE_P): New macro.
- (DECL_CLASS_SCOPE_P): Likewise.
-
-Sun May 10 22:48:22 1998 H.J. Lu (hjl@gnu.org)
-
- * class.c (finish_struct_1): Use OVL_CURRENT on TREE_VEC_ELT.
- * decl2.c (constructor_name_full): Likewise.
+ * error.c: Remove declaration of cp_printer.
-Sun May 10 22:48:12 1998 Mike Stump <mrs@wrs.com>
-
- * tree.c (mapcar): Add OVERLOAD support.
-
- * init.c (resolve_offset_ref): We must use basetype_path before we
- destroy it with a call to convert_pointer_to.
-
-Sat May 9 14:44:37 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (currently_open_class): New fn.
- * decl.c (lookup_name_real): Use it.
- * search.c (lookup_field): Likewise.
-
-Fri May 8 23:32:42 1998 Martin von Loewis <loewis@informatik.hu-berlin.de>
-
- * cp-tree.def (OVERLOAD): New node.
- * cp-tree.h (BINDING_TYPE, SET_IDENTIFIER_GLOBAL_VALUE,
- SET_IDENTIFIER_NAMESPACE_VALUE): Define.
- (NAMESPACE_BINDING): Remove.
- (IDENTIFIER_GLOBAL_VALUE, IDENTIFIER_NAMESPACE_VALUE): Use
- namespace_binding.
- (OVL_FUNCTION, OVL_CHAIN, OVL_CURRENT, OVL_NEXT, OVL_USED):
- Define.
- (tree_overload): New struct.
- (IDENTIFIER_TYPE_VALUE): Use identifier_type_value.
- (REAL_IDENTIFIER_TYPE_VALUE): Define.
- (IDENTIFIER_HAS_TYPE_VALUE): Use IDENTIFIER_TYPE_VALUE.
- (lang_decl_flags): Remove in_namespace.
- (lang_decl): Remove chain.
- (DECL_CHAIN, DECL_NAMESPACE): Remove.
- (flag_honor_std): Declare extern.
- (identifier_type_value, pushdecl_namespace_level, push_using_decl,
- namespace_binding, set_namespace_binding,
- lookup_function_nonclass, cat_namespace_levels,
- set_decl_namespace, lookup_arg_dependent, binding_init, ovl_cons,
- scratch_ovl_cons, ovl_member, build_overload): Declare.
- (decl_list_length, get_namespace_id, current_namespace_id,
- overloaded_globals_p): Remove.
- (lookup_using_namespace, qualified_lookup_using_namespace): Change
- return type.
- (push_scratch_obstack): New macro.
- * call.c (add_function_candidate): Special-case type of OVERLOAD node.
- (build_user_conversions_1): Iterate using OVL_NEXT for ctors,
- convs, fns.
- (build_new_function_call): Iterate using OVL_CHAIN.
- Print DECL_NAME in when reporting ambiguities.
- (build_object_call): Iterate using OVL_NEXT for fns, convs.
- (build_new_op): Call lookup_function_nonclass.
- Iterate using OVL_NEXT.
- (build_op_delete_call): Change detection of members.
- Do not wrap TREE_LIST around fields and single global functions.
- (build_over_call): Don't push a class level if the context is a
- namespace.
- (build_new_method_call): Iterate using OVL_NEXT.
- * class.c (add_method): Chain overloaded members using
- build_overload. Remove copying of method.
- (grow_method): When iterating through the obstack, expect OVERLOAD
- nodes. Chain overload members.
- (finish_struct_methods): Chain overload members. Unpack OVERLOAD
- nodes in call to get_baselinks.
- (duplicate_tag_error): Expect OVERLOAD nodes when unchaining.
- (finish_struct_1): Iterate over ctor using OVL_NEXT. Handle
- fdecls that are OVERLOAD nodes.
- (validate_lhs): New function.
- (instantiate_type): Do not copy OVERLOAD nodes. Remove dead
- code. Use DECL_NAME in error messages. Split code between global
- and member function processing.
- * decl.c (global_type_node): New static variable.
- (in_std): New global.
- (struct binding_level): New field usings.
- (resume_binding_level): Assert that we are not in a class.
- (toplevel_bindings_p): Just check for namespace_p or
- pseudo_global.
- (resume_level): Remove.
- (find_binding): New function.
- (binding_for_name): Call it.
- (namespace_binding, set_namespace_binding): New functions.
- (push_namespace): Associate binding level with new namespace,
- resume_binding_level for existing namespace. Remove old code.
- Fake std by counting.
- (store_bindings): Use REAL_IDENTIFIER_TYPE_VALUE.
- (maybe_push_to_top_level): Save current namespace.
- (pop_from_top_level): Restore saved namespace.
- (pop_namespace): Call suspend_binding_level. Remove old code.
- (cat_namespace_levels): New function.
- (set_identifier_type_value_with_scope): For namespace bindings,
- set BINDING_TYPE, and use global_type_node.
- Use REAL_IDENTIFIER_TYPE_VALUE otherwise.
- (identifier_type_value): New function.
- (pushtag): If no context, use current_namespace.
- (duplicate_decls): Don't process DECL_CHAIN.
- (pushdecl): Set DECL_CONTEXT to current_namespace, if it is not
- already set. Never reset it to NULL_TREE. Lookup global variables
- in their namespace. Push overloaded templates if they are on
- namespace level.
- (pushdecl_namespace_level): New function.
- (pushdecl_top_level): Implement using pushdecl_namespace_level.
- (pushdecl_using_decl): New function.
- (overloaded_globals_p): Remove.
- (push_overloaded_decl): Create OVERLOAD nodes, and iterate through
- them. Use namespace_binding and set_namespace_value.
- (redeclaration_error_message): Complain if the declarations come
- from different namespaces.
- (lookup_tag): On namespace level, look in the BINDING_TYPE.
- (lookup_namespace_name): Pass tree_bindings from stack. Remove
- old code.
- (select_decl): New function.
- (lookup_name_real): Call it for qualified and unqualified lookup.
- Pass tree_bindings from the stack.
- If prefer_type is 1, also accept namespaces.
- (lookup_function_nonclass): New function.
- (init_decl_processing): Set the binding level of the global
- namespace to global_binding_level.
- Build a proper type list for __builtin_apply.
- Initialize std_node to "fake std" if flag_honor_std is set.
- Initialize global_type_node.
- Allocated bad_alloc in namespace std if flag_honor_std.
- (define_function): Set the DECL_CONTEXT to the current_namespace.
- (start_decl): A namespace is not considered as a context here. If
- the DECL_CONTEXT is a namespace, push the decl.
- (cp_finish_decl): Check for namespaces used as initializers.
- (grokfndecl): Add namespace parameter. Remove processing of
- DECL_CHAIN.
- (grokvardecl): Add namespace parameter.
- (grokdeclarator): Process SCOPEs that are namespaces. For
- mangling, temporarily set the DECL_CONTEXT on anonymous structs.
- (start_function): Check for contexts that are namespaces.
- Set context for declarations that have not been pushed.
- (store_parm_decls): Check for ::main only.
- (finish_function): Likewise.
- (start_method): Check for contexts that are namespaces.
- (start_method): Remove DECL_CHAIN processing.
- * decl2.c (flag_honor_std): Declare.
- (lang_decode_option): Set it if -fhonor-std or -fnew-abi is given.
- (decl_namespace_list): New static global.
- (grok_x_components): Ignore namespaces as type contexts.
- (check_classfn): Expect OVERLOAD nodes.
- (grokfield): Remove DECL_CHAIN processing.
- (finish_file): Call cat_namespace_levels.
- (merge_functions): New function.
- (ambiguous_decl): Rewrite.
- (lookup_using_namespace): Produce tree_bindings.
- (qualified_lookup_using_namespace): Likewise.
- (set_decl_namespace, decl_namespace, current_decl_namespace,
- push_decl_namespace, pop_decl_namespace): New functions.
- (arg_lookup): New struct.
- (add_function, arg_assoc_namespace, arg_assoc_class,
- arg_assoc_type, arg_assoc_args, arg_assoc, lookup_arg_dependent):
- New functions.
- (get_namespace_id, current_namespace_id): Remove.
- (do_toplevel_using_decl): Rewrite.
- (do_class_using_decl): Complain about namespace qualifiers.
- (do_using_directive): Sorry if not on namespace level. Complain
- about unknown namespaces.
- * error.c (dump_aggr_type): Check for namespace contexts.
- * except.c (init_exception_processing): Push terminate into std.
- * friend.c (is_friend): A namespace is not a context, here.
- * init.c (expand_member_init): Remove DECL_CHAIN processing.
- (build_offset_ref): Process OVERLOAD nodes.
- * lang-specs.h (__HONOR_STD): Define if -fnew-abi or -fhonor-std.
- * lex.c (identifier_type): Loop using OVL_CHAIN.
- (see_typename): Set looking_for_typename to 2.
- (real_yylex): Likewise.
- (do_identifier): Expect OVERLOAD nodes instead of TREE_LISTs.
- (do_scoped_id): Expect OVERLOAD nodes.
- Change calling convention for qualified_lookup_using_namespace.
- (build_lang_decl): Don't set in_namespace anymore.
- * method.c (typevec_size): New global.
- (build_overload_nested_name): Return if global_namespace.
- Otherwise, always expect a declaration context.
- (build_qualified_name): Likewise.
- Make sure we don't write beyond typevec_size.
- (build_decl_overload_real): Likewise.
- Allocate one extra slot for the namespace.
- (hack_identifier): Mark code dead.
- Process OVERLOAD and NAMESPACE_DECL nodes.
- * parse.y (program): Pop namespaces until in global namespace.
- (extdef): In a using-declaration, don't discard the identifier if
- there is no declaration.
- (left_curly): Ignore type contexts which are namespaces.
- (typename_sub2): Use IDENTIFIER_TYPE_VALUE to retrieve the type
- used as scope.
- * pt.c (template_class_depth): Expect types to be namespaces.
- (determine_specialization): Simplify by expecting OVERLOAD nodes.
- (push_template_decl): Push into namespace level.
- Reset ctx if it is a namespace.
- Set DECL_CONTEXT to current_namespace if not set already.
- Ignore real contexts that are namespaces.
- (mangle_class_name_for_template): Skip global_namespace.
- Mangle other namespaces as declarations.
- (lookup_template_function): Set type of OVERLOAD nodes to unknown.
- (lookup_template_class): Push into namespace of context.
- If the context is a namespace, set it to global_namespace.
- Use id_context for mangling.
- (for_each_template_parm): Handle OVERLOAD and NAMESPACE_DECL nodes.
- (tsubst_friend_function): Ignore namespace contexts.
- Push into namespace level.
- (tsubst): Handle NAMESPACE_DECL nodes.
- Remove DECL_CHAIN processing.
- (type_unification_real): Recognize OVERLOAD instead of TREE_LIST nodes.
- * ptree.c (print_lang_identifier): Print bindings.
- (lang_print_xnode): Print OVERLOAD nodes.
- * rtti.c (init_rtti_processing): Push type_info into std.
- * search.c (lookup_fnfields_here): Expect OVERLOAD nodes.
- (lookup_fnfields_1, get_virtuals_named_this, get_matching_virtual,
- dfs_debug_mark, dfs_pushdecls, dfs_compress_decls, add_conversions,
- lookup_fnfields_here): Likewise.
- Process all nodes, instead of going through TREE_CHAIN.
- * sig.c (build_signature_pointer_or_reference_type): Set context
- to global_namespace.
- (build_signature_table_constructor): Expect OVERLOAD nodes.
- * spew.c (yylex): Save old setting of looking_for_typename.
- * tree.c (decl_list_length): Remove.
- (binding_init): New function.
- (count_functions): Rewrite.
- (is_overloaded_fn): Expect OVERLOAD nodes.
- (really_overloaded_fn, get_first_fn, lvalue_type): Likewise.
- (ovl_cons, scratch_ovl_cons, build_overload, build_overload_after,
- ovl_member): New functions.
- * typeck.c (require_complete_type): Expect OVERLOAD nodes.
- (type_unknown_p): Likewise.
- (require_instantiated_type): Likewise.
- (build_component_ref): Declare code dead.
- (build_x_function_call): Create and expect OVERLOAD nodes.
- (build_function_call_real): Check for ::main only.
- (build_unary_op): Likewise. Expect OVERLOAD nodes.
- (convert_for_assignment): Check for TREE_LIST before accessing
- TREE_VALUE.
- * decl.c (duplicate_decls): Check for namespace bindings instead
- of global bindings.
- (pushdecl, push_overloaded_decl, lookup_tag, lookup_name_real,
- lookup_name_current_level, start_decl, xref_tag,
- finish_enum): Likewise.
- * init.c (build_offset_ref): Likewise.
- * search.c (lookup_field): Likewise.
- (lookup_fnfields): Likewise.
- (dfs_debug_mark): Likewise.
- * decl.c (poplevel): Use SET_IDENTIFIER_TYPE_VALUE.
- (poplevel_class, pop_from_top_level): Likewise.
- * decl2.c (finish_method): Likewise.
- * class.c (build_vtable): Use SET_IDENTIFIER_GLOBAL_VALUE.
- * decl.c (record_builtin_type): Likewise.
- (init_decl_processing, grokfndecl): Likewise.
- * lex.c (get_time_identifier, do_identifier, do_scoped_id): Likewise.
- (make_lang_type): Likewise.
- * parse.y (make_thunk): Likewise.
- * pt.c (tsubst): Likewise.
- * tree.c (debug_binfo): Likewise.
- * exception.cc, new.cc, new1.cc, new2.cc, tinfo.cc, tinfo.h,
- tinfo2.cc, inc/new.h: Add std qualifications.
- * inc/new: Wrap with namespace std if __HONOR_STD.
- * inc/typeinfo: Likewise.
+2000-09-20 Mark Mitchell <mark@codesourcery.com>
-Fri May 8 00:43:50 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * tree.c (mark_local_for_remap_r): Handle CASE_LABELs.
- * call.c (build_user_type_conversion_1): Handle second_conv
- properly for templates.
+2000-09-20 Hans-Peter Nilsson <hp@axis.com>
-Thu May 7 17:09:25 1998 Andrew MacLeod <amacleod@cygnus.com>
+ * except.c: Delete #if 0:d EXCEPTION_SECTION_ASM_OP-default and
+ users.
- * method.c (build_decl_overload_real): Set TREE_USED flag to
- zero for build_type_variants nodes as well.
+2000-09-18 Mark Mitchell <mark@codesourcery.com>
-Wed May 6 19:27:09 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (start_function): Robustify.
- * pt.c (tsubst): Don't tsubst the type of an IDENTIFIER_NODE.
+2000-09-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-Wed May 6 16:49:48 1998 Jim Wilson <wilson@cygnus.com>
+ * cp-tree.h (check_function_format): Accept a `status' parameter.
- * Makefile.in (call.o, class.o, decl.o, decl2.o, errfn.o, error.o,
- except.o, expr.o, friend.o, init.o, lex.o, method.o, pt.o, repo.o,
- rtti.o, search.o, semantics.o, sig.o, tree.o, typeck.o, typeck2.o,
- xref.o): Add toplev.h dependencies.
+ * call.c, typeck.c: Updates calls to `check_function_format'.
-Wed May 6 16:44:58 1998 Jeffrey A Law (law@cygnus.com)
+2000-09-17 Geoffrey Keating <geoffk@cygnus.com>
- * errfn.c (cp_error, cp_warning): Remove declarations for
- error and warning respectively.
+ * decl2.c (handle_class_head): Always push some scope even
+ in the error case.
-Wed May 6 14:28:18 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+2000-09-16 Mark Mitchell <mark@codesourcery.com>
- * error.c: Convert to using ctype macros defined in system.h.
- * method.c: Likewise.
- * xref.c: Likewise.
- * lex.c: Likewise. Also remove redundant system header stuff.
+ * cp-tree.h (struct cp_language_function): Remove
+ x_scope_stmt_stack and name_declared.
+ (current_scope_stmt_stack): Remove.
+ (function_name_declared_p): New macro.
+ (struct lang_decl_flags): Use c_lang_decl as a base class.
+ (context): Remove.
+ (struct lang_decl): Replace saved_tree with context.
+ (DECL_FRIEND_CONTEXT): Adjust accordingly.
+ (SET_DECL_FRIEND_CONTEXT): Likewise.
+ (DECL_VIRTUAL_CONTEXT): Likewise.
+ (DECL_SAVED_TREE): Remove.
+ (C_DECLARED_LABEL_FLAG): Likewise.
+ (cplus_expand_expr_stmt): Don't declare.
+ (add_decl_stmt): Likewise.
+ (add_scope_stmt): Likewise.
+ * decl.c (mark_stmt_tree): Remove.
+ (case_compare): Likewise.
+ (finish_case_label): Use c_add_case_label.
+ (init_decl_processing): Set more language-specific hooks.
+ (build_enumerator): Fix typo in comment.
+ (cplus_expand_expr_stmt): Remove.
+ (mark_lang_function): Use mark_c_language_function.
+ (lang_mark_tree): Use c_mark_lang_decl.
+ * decl2.c: Change order of inclusion.
+ * except.c: Likewise.
+ * expr.c (cplus_expand_expr): Remove handling of STMT_EXPR. Fall
+ back on c_expand_expr.
+ * friend.c: Include expr.h.
+ * init.c: Change order of inclusion.
+ * Makefile.in: Update dependencies.
+ * lex.h (free_lang_decl_chain): Remove.
+ * optimize.c (maybe_clone_body): Use function_name_declared_p.
+ * pt.c (build_template_decl): Don't copy DECL_VIRTUAL_CONTEXT if
+ it doesn't exist.
+ (instantiate_decl): Use function_name_declared_p.
+ * semantics.c (lang_expand_expr_stmt): Remove.
+ (set_current_function_name_declared): Likewise.
+ (current_function_name_declared): Likewise.
+ (begin_compound_stmt): Use function_name_declared_p.
+ (add_decl_stmt): Remove.
+ (setup_vtbl_ptr): Use function_name_declared_p.
+ (add_scope_stmt): Remove.
+ (current_scope_stmt_stack): New function.
+ (cp_expand_stmt): Don't handle SCOPE_STMTs.
+ (expand_body): Use function_name_declared_p.
+ * tree.c (cp_statement_code_p): Don't include SCOPE_STMT.
+ * typeck.c: Change order of includes.
+ (convert_sequence): Remove.
-Wed May 6 06:36:41 1998 Robert Lipe <robertl@dgii.com>
+2000-09-14 Joseph S. Myers <jsm28@cam.ac.uk>
- * call.c, class.c, decl.c, decl2.c, errfn.c, error.c, except.c,
- expr.c, friend.c, init.c, lex.c, method.c, pt.c, repo.c, rtti.c,
- search.c, semantics.c, sig.c, tree.c, typeck.c, typeck2.c,
- xref.c: Add include of toplev.h.
+ * lex.c (reswords): Add _Complex.
-Wed May 6 02:33:39 1998 Jason Merrill <jason@yorick.cygnus.com>
+Thu Sep 14 12:10:45 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
- * tree.c (perm_manip): Also regenerate the RTL of an extern.
- (copy_to_permanent): Use end_temporary_allocation.
+ * Make-lang.in (cplib2.txt): Depend on cp/Makefile.
-Tue May 5 23:54:04 1998 Jason Merrill <jason@yorick.cygnus.com>
+2000-09-13 J. David Anglin <dave@hiauly1.hia.nrc.ca>
- * init.c (expand_vec_init): The initialization of each array
- element is a full-expression.
+ * init.c (begin_init_stmts): Don't use // comments.
-Tue May 5 18:24:13 1998 Andrew MacLeod <amacleod@cygnus.com>
+2000-09-12 Jason Merrill <jason@redhat.com>
- * method.c (build_mangled_name): Add a call to build_type_variant
- to get the right type.
+ * decl.c (maybe_deduce_size_from_array_init): Set do_default for
+ all non-extern arrays.
-Tue May 5 01:25:03 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (grokdeclarator): Complain about 'friend T' for implicit
+ typenames, too. Downgrade complaint to pedwarn.
+ (xref_tag): Warn about surprising behavior of 'friend struct T'.
+ * decl2.c (handle_class_head): Generate a TYPENAME_TYPE for
+ 'class This::Inherited'.
+
+2000-09-12 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (finish_case_label): Given the LABEL_DECL a
+ DECL_CONTEXT.
- * Makefile.in: Add .SUFFIXES.
+2000-09-12 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * error.c (TFF_PLAIN_IDENTIFIER, TFF_NAMESPACE_SCOPE,
+ TFF_CLASS_SCOPE, TFF_CHASE_NAMESPACE_ALIAS, TFF_CHASE_TYPDEF,
+ TFF_DECL_SPECIFIERS, TFF_CLASS_KEY_OR_ENUM, TFF_RETURN_TYPE,
+ TFF_FUNCTION_DEFAULT_ARGUMENTS, TFF_EXCEPTION_SPECIFICATION,
+ TFF_TEMPLATE_HEADER, TFF_TEMPLATE_DEFAULT_ARGUMENTS, TFF_SCOPE):
+ New macros.
+ (sorry_for_unsupported_tree, print_scope_operator,
+ print_left_paren, print_right_paren, print_left_bracket,
+ print_right_bracket, print_whitespace): Likewise.
+ (aggr_variety): Rename to class_key_or_enum.
+ (print_type): Rename to print_type_id.
+ (print_type_specifier_seq, print_simple_type_specifier,
+ print_elaborated_type_specifier,
+ print_rest_of_abstract_declarator,
+ print_parameter_declaration_clause, print_exception_specification,
+ print_nested_name_specifier, print_template_id,
+ typedef_original_name, print_template_argument_list_start,
+ print_template_argument_list_end): New functions.
+
+2000-09-11 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * ir.texi: Add more documentation.
+
+2000-09-11 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (struct saved_scope): Remove x_function_parms.
+ (current_function_parms): Don't define.
+ (struct cp_language_function): Remove parms_stored.
+ (current_function_just_assigned_this): Don't define.
+ (current_function_parms_stored): Likewise.
+ (static_ctors): Declare.
+ (static_dtors): Likewise.
+ (SF_EXPAND): Don't define.
+ (expand_start_early_try_stmts): Remove declaration.
+ (store_parm_decls): Likewise.
+ * decl.c (static_ctors): Don't declare.
+ (static_dtors): Likewise.
+ (struct binding_level): Remove this_block.
+ (poplevel): Remove dead code.
+ (set_block): Likewise.
+ (mark_binding_level): Don't mark this_block.
+ (mark_saved_scope): Don't mark x_function_parms.
+ (init_decl_processing): Don't add current_function_parms as a GC
+ root.
+ (check_function_type): Change prototype.
+ (start_function): Remove RTL-generation code.
+ (expand_start_early_try_stmts): Remove.
+ (store_parm_decls): Give it internal linkage. Remove
+ RTL-generation code.
+ (finish_function): Remove RTL-generation code.
+ * decl2.c (static_ctors): Fix formatting.
+ (static_dtors): Likewise.
+ * method.c (use_thunk): Don't call store_parm_decls.
+ (synthesize_method): Likewise.
+ * optimize.c (maybe_clone_body): Likewise.
+ * parse.y (fn.def2): Likewise.
+ (.set_base_init): Likewise.
+ (nodecls): Likewise.
+ * pt.c (instantiate_decl): Likewise.
+ * rtti.c (synthesize_tinfo_fn): Likewise.
+ * semantics.c (genrtl_try_block): Simplify.
+ (expand_body): Use genrtl_start_function and
+ genrtl_finish_function.
+ (genrtl_start_function): New function.
+ (genrtl_finish_function): Likewise.
- * cp-tree.def: Remove NAMESPACE_DECL.
+2000-09-11 Nathan Sidwell <nathan@codesourcery.com>
-Sun May 3 01:32:14 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * error.c (cp_tree_printer, case 'P'): Append break.
- * call.c (build_over_call): Do evaluate arg even if it has empty
- class type.
- * decl.c (start_function): Don't push a member function.
+2000-09-11 Nathan Sidwell <nathan@codesourcery.com>
-Thu Apr 30 18:59:23 1998 Jim Wilson <wilson@cygnus.com>
+ * cp-tree.h (frob_opname): Declare.
+ * parse.y (saved_scopes): New static variable.
+ (cp_parse_init): Adjust.
+ (do_id): If lastiddecl is NULL, do do_identifier.
+ (operator): Save scope information.
+ (unoperator): New reduction. Restore scope information.
+ (operator_name): Append unoperator. Call frob_opname.
+ * spew.c (frob_opname): Define.
- * Makefile.in (g++FAQ.info): Put -o option before input file.
+2000-09-10 Zack Weinberg <zack@wolery.cumb.org>
-Thu Apr 30 13:05:33 1998 Andrew MacLeod <amacleod@cygnus.com>
+ * decl.c, rtti.c: Include defaults.h if not already included.
+ Don't define the *_TYPE_SIZE macros.
- * gxxint.texi: Add info for squangling codes K and B.
+2000-09-09 Mark Mitchell <mark@codesourcery.com>
-Tue Apr 28 13:22:01 1998 Mark Mitchell <mmitchell@usa.net>
+ * cp-tree.h (push_switch): Change prototype.
+ (check_cp_case_value): Remove declaration.
+ (decl_constant_value): Likewise.
+ * decl.c (struct cp_switch): Add switch_stmt and cases.
+ (case_compare): New function.
+ (push_switch): Set switch_stmt. Initialize cases.
+ (pop_switch): Clean up cases.
+ (define_case_label): Rename to ...
+ (finish_case_label): ... this. Do semantic analysis for case
+ labels here.
+ (start_function): Correct comment.
+ * decl2.c (check_cp_case_value): Remove.
+ * expr.c (do_case): Remove.
+ * pt.c (tsubst_expr): Adjust call to finish_case_label.
+ * semantics.c (genrtl_do_poplevel): Remove declaration.
+ (RECHAIN_STMTS): Remove.
+ (finish_break_stmt): Use build_break_stmt.
+ (finish_continue_stmt): Use build_continue_stmt.
+ (finish_switch_cond): Adjust condition here, rater than in
+ c_expand_start_case.
+ (finish_case_label): Remove.
+ * typeck.c (c_expand_return): Remove.
+ (c_expand_start_case): Likewise.
- * semantics.c (begin_stmt_expr): Avoid duplicating the effect of
- the expression in templates.
+2000-09-07 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * ir.texi: Document type nodes.
+
+2000-09-06 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (init_cp_semantics): Declare.
+ (genrtl_try_block): Don't declare.
+ (genrtl_handler): Likewise.
+ (genrtl_catch_block): Likewise.
+ (genrtl_ctor_stmt): Likewise.
+ (genrtl_subobject): Likewise.
+ (genrtl_do_poplevel): Likewise.
+ (genrtl_named_return_value): Likewise.
+ * lex.c (init_parse): Call init_cp_semantics.
+ * semantics.c (genrtl_try_block): Give it internal linkage.
+ (genrtl_handler): Likewise.
+ (genrtl_catch_block): Likewise.
+ (genrtl_ctor_stmt): Likewise.
+ (genrtl_subobject): Likewise.
+ (genrtl_do_poplevel): Likewise.
+ (genrtl_named_return_value): Likewise.
+ (lang_expand_stmt): Rename to ...
+ (cp_expand_stmt): ... this. Only handle C++-specific nodes.
+ (init_cp_semantics): Define.
+
+ * decl.c (initialize_local_var): Remove RTL-generating code.
+ * semantics.c (genrtl_try_block): Fix formatting.
+
+ Move statement-tree facilities from C++ to C front-end.
+ * cp-tree.h (cp_tree_index): Remove CPTI_VOID_ZERO.
+ (void_zero_node): Remove.
+ (stmt_tree): Likewise.
+ (scope_chain): Adjust.
+ (language_function): Rename to cp_language_function.
+ (cp_function_chain): Adjust.
+ (current_stmt_tree): Remove.
+ (last_tree): Likewise.
+ (last_expr_type): Likewise.
+ (struct lang_decl): Adjust.
+ (STMT_IS_FULL_EXPR_P): Remove.
+ (add_tree): Remove.
+ (begin_stmt_tree): Likewise.
+ (finish_stmt_tree): Likewise.
+ (walk_tree_fn): Likewise.
+ (walk_stmt_tree): Likewise.
+ * class.c (finish_struct): Replace use of add_tree with add_stmt.
+ * decl.c (mark_stmt_tree): Adjust type.
+ (init_decl_processing): Don't build void_zero_node.
+ (initialize_local_var): Adjust usage of current_stmt_tree.
+ (finish_enum): Use add_stmt, not add_tree.
+ (save_function_data): Adjust use of language_function.
+ (finish_constructor_body): Use add_stmt, not add_tree.
+ (finish_destructor_body): Likewise.
+ (push_cp_function_context): Adjust use of language_function.
+ (pop_cp_function_context): Likewise.
+ (mark_lang_function): Likewise.
+ (mark_cp_function_context): Likewise.
+ * init.c (build_aggr_init): Adjust use of current_stmt_tree.
+ (build_vec_init): Likewise.
+ * semantics.c (SET_LAST_STMT): Remove.
+ (RECHAIN_STMTS): Don't use it.
+ (stmts_are_full_exprs_p): Adjust use of current_stmt_tree.
+ (current_stmt_tree): Define.
+ (add_tree): Remove.
+ (finish_goto_stmt): Use add_stmt, not add_tree.
+ (finish_expr_stmt): Likewise.
+ (begin_if_stmt): Likewise.
+ (finish_then_clause): Likewise.
+ (begin_while_stmt): Likewise.
+ (begin_do_stmt): Likewise.
+ (finish_return_stmt): Likewise.
+ (begin_for_stmt): Likewise.
+ (finish_break_stmt): Likewise.
+ (finish_continue_stmt): Likewise.
+ (begin_switch_stmt): Likewise.
+ (finish_case_label): Likewise.
+ (begin_try_block): Likewise.
+ (begin_function_try_block): Likewise.
+ (begin_handler): Likewise.
+ (begin_catch_block): Likewise.
+ (begin_compound_stmt): Likewise.
+ (begin_asm_stmt): Likewise.
+ (finish_asm_stmt): Likewise.
+ (finish_label_stmt): Likewise.
+ (add_decl_stmt): Likewise.
+ (finish_subobject): Likewise.
+ (finish_decl_cleanup): Likewise.
+ (finish_named_return_value): Likewise.
+ (setup_vtbl_ptr): Likewise.
+ (add_scope_stmt): Likewise.
(finish_stmt_expr): Likewise.
+ (prune_unused_decls): Remove.
+ (begin_stmt_tree): Likewise.
+ (finish_stmt_tree): Likewise.
+ (prep_stmt): Adjust use of current_stmt_tree.
+ (lang_expand_stmt): Likewise.
+ * tree.c (statement_code_p): Remove.
+ (cp_statement_code_p): New function.
+ (walk_stmt_tree): Remove.
+ (init_tree): Set lang_statement_code_p.
+
+2000-09-06 Zack Weinberg <zack@wolery.cumb.org>
+
+ Integrated preprocessor.
+
+ * Make-lang.in, Makefile.in: Remove all references to input.c,
+ gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
+ * gxx.gperf, hash.h, input.c: Delete.
+ * lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
+ initialized properly.
+
+ * class.c (fixup_pending_inline): Take a tree, not a
+ struct pending_inline *. All callers changed.
+ (init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
+ RID_PROTECTED entries in ridpointers[] array here.
+ * decl.c (duplicate_decls): Do not refer to struct
+ pending_inline.
+ (record_builtin_type, init_decl_processing): Use RID_MAX not
+ CP_RID_MAX.
+ (grokdeclarator): Use C_IS_RESERVED_WORD.
+ * decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
+ cpplib.
+ (grok_x_components): Do not inspect pending_inlines chain.
+
+ * cp-tree.h (struct lang_identifier): Add rid_code entry.
+ (C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
+ (flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
+ (DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
+ TIME_IDENTIFIER_FILEINFO): Kill.
+ Update prototypes.
+ * lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
+ single 32-bit word.
+ * parse.y: Call do_pending_inlines unconditionally.
+ reinit_parse_for_method is now snarf_method. fn.defpen is no
+ longer necessary. Remove unnecessary <itype> annotation on
+ SCOPE. Do not refer to end_of_file or struct pending_inline.
+ * semantics.c (begin_inline_definitions): Call
+ do_pending_inlines unconditionally.
+
+ * lex.c: Remove all code now shared with C front end.
+ Initialize cpplib properly if USE_CPPLIB. Put reserved words
+ into the get_identifier table. Rewrite pragma handling to
+ work with the registry. Move code to save tokens for later
+ processing to spew.c.
+
+ * spew.c: Rewrite everything in terms of token streams instead
+ of text. Move routines here from lex.c / input.c as
+ appropriate. GC-mark trees hanging off the pending inlines
+ chain.
+
+2000-09-06 Mark Mitchell <mark@codesourcery.com>
+
+ * NEWS: Mention that the named return value extension has been
+ deprecated.
+ * cp-tree.h (original_result_rtx): Define.
+ (TREE_REFERENCE_EXPR): Remove.
+ (DECL_VPARENT): Likewise.
+ (pushdecl_nonclass_level): Likewise.
+ (store_return_init): Likewise.
+ (reinit_lang_specific): Likewise.
+ (genrtl_named_return_value): Change prototype.
+ * decl.c (original_result_rtx): Remove.
+ (cp_finish_decl): Don't build DECL_STMTs for RESULT_DECLs.
+ Do not generate RTL for local variables here.
+ (store_return_init): Remove.
+ * semantics.c (genrtl_named_return_value): Simplify. Fold in
+ store_return_init.
+ (finish_named_return_value): Adjust accordingly. Warn that this
+ extension is deprecated.
+ (lang_expand_stmt): Adjust call to genrtl_named_return_value.
-1998-04-28 Brendan Kehoe <brendan@cygnus.com>
-
- * decl2.c (ambiguous_decl): Fix NAME parm to be a tree, not int.
-
-Mon Apr 27 13:58:10 1998 Mark Mitchell <mmitchell@usa.net>
-
- * decl.c (maybe_push_to_top_level): Always clear
- current_template_parms and processing_template_decl.
- (pushtag): Remove check of current_class_type and some comments,
- since maybe_push_to_top_level no longer creates confusion.
-
-Sun Apr 26 12:10:18 1998 Mark Mitchell <mmitchell@usa.net>
-
- * cp-tree.h (CLASSTYPE_IS_TEMPLATE): New macro.
- (DECL_CLASS_TEMPLATE_P): Likewise.
- (DECL_PRIMARY_TEMPLATE): Likewise.
- (PRIMARY_TEMPLATE_P): Use it.
- (push_template_decl_real): New function.
- (redeclare_class_template): Take new template parameters as
- input.
- (is_specialization_of): New function.
- (comp_template_args): Declare.
- * decl.c (pushtag): Handle friend template classes.
- (xref_tag): Likewise. Use new calling convention for
- redeclare_class_template.
- * decl2.c (grok_x_components): Handle friend templates.
- * friend.c (is_friend): Use is_specialization_of where
- appropriate. Deal with friend class templates.
- (make_friend_class): Let a class template be friends with itself.
- * pt.c (comp_template_args): Remove declaration.
- (tsubst_friend_class): New function.
- (push_template_decl_real): New function.
- (push_template_decl): Use it.
- (redeclare_class_template): Adjust for new calling convention.
- (comp_template_args): Give it external linkage.
- (instantiate_class_type): Use tsubst_friend_class to deal
- with friend templates.
- * typeck.c (comptypes): Use comp_template_args, rather than
- expanding it inline.
- * parse.y (component_decl): Handle a nested template type
- like other component type declarations.
-
- * pt.c (check_explicit_specialization): Handle overloaded
- constructors correctly.
-
- * pt.c (mabybe_get_template_decl_from_type_decl): New function.
- (lookup_template_class): Use it.
-
-Thu Apr 23 21:19:06 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.def: Add WRAPPER. USER_CONV now only has two ops.
- * cp-tree.h: Add WRAPPER support.
- * call.c (add_candidate): Split out from add_*_candidate fns.
- (build_over_call): Take the candidate instead of function and args.
- Enforce access control here. Emit overload warnings here.
- (add_warning): New fn.
- (joust): Add WARN parm. If not set, call add_warning instead of
- printing a warning. Re-enable some warnings.
- (tourney): Pass it.
- (convert_like): Adjust.
- (build_new_op): Adjust.
- (build_new_function_call): Adjust.
- (build_user_type_conversion_1): Adjust.
- (USER_CONV_FN): Adjust.
- * tree.c (build_expr_wrapper, build_expr_ptr_wrapper,
- build_int_wrapper): New fns.
-
-Thu Apr 23 18:27:53 1998 Mark P. Mitchell <mmitchell@usa.net>
-
- * pt.c (unify): Fix typo in previous change.
-
-Thu Apr 23 09:32:58 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * error.c (dump_type_real): Declare canonical_name.
-
- * typeck.c (comp_target_types): Fix PMFs.
-
-Wed Apr 22 13:24:48 1998 Mark Mitchell <mmitchell@usa.net>
-
- * class.c (finish_struct): Set TREE_PRIVATE and TREE_PROTECTED for
- the DECL_RESULTs of a member TEMPLATE_DECL, not just the
- TEMPLATE_DECL.
-
- * pt.c (tsubst): Decrease the template-level of
- TEMPLATE_TEMPLATE_PARMS. Likewise for the DECL_INITIAL of a
- TEMPLATE_PARM_INDEX.
- (template_decl_level): New function.
- (unify): Make sure to record unifications for template
- parameters, even when the parameters exactly match the arguments.
- Combine duplicated code for TEMPLATE_TEMPLATE_PARMs and
- TEMPLATE_TYPE_PARMS. Don't try to unify template parameters that
- aren't from the level we're currently working on.
-
-Tue Apr 21 22:00:04 1998 Mark Mitchell <mmitchell@usa.net>
-
- * errfn.c (cp_thing): Use xrealloc, not xmalloc, to copy memory.
-
- * decl2.c (check_member_template): Set DECL_IGNORED for member
- class templates, too.
-
- * decl2.c (grokfield): Remangle the name of a member TYPE_DECL.
-
-Tue Apr 21 18:59:11 1998 Benjamin Kosnik <bkoz@rhino.cygnus.com>
-
- * decl.c (duplicate_decls): Only check DECL_FRIEND_P if function.
-
-Tue Apr 21 14:22:00 1998 Jeffrey A Law (law@cygnus.com)
-
- * cp-tree.h (intTI_type_node, unsigned_intTI_type_node): Declare.
- * decl.c (intTI_type_node, unsigned_intTI_type_node): Define.
- (init_decl_processing): Handle TI types.
- * typeck.c (unsigned_type, signed_type): Handle TI types.
-
-Sat Apr 18 15:25:21 1998 Jim Wilson <wilson@cygnus.com>
-
- * g++spec.c (lang_specific_driver): New argument in_added_libraries.
- New local added_libraries. Increment count when add library to
- arglist.
-
-Fri Apr 17 21:25:00 1998 Mark Mitchell <mmitchell@usa.net>
-
- * cp-tree.h (type_as_string_real): New function.
- * pt.c (mangle_class_name_for_template): Use it.
- * error.c (dump_aggr_type): Change prototype.
- (dump_type_prefix): Likewise.
- (dump_type_suffix): Likewise.
- (dump_type_real): Convert from dump_type. If desired, the
- "canonica" name of a typedef, i.e., the name of the underlying
- type, can be printed.
- (dump_type): Call dump_type_real.
-
-Fri Apr 17 14:30:45 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (lang_decode_option): -fnew-abi implies -fvtable-thunks.
-
- * typeck.c (comp_target_types): Tweak pedantic case.
- (comp_target_parms): Tweak pedantic case. Clean up somewhat.
- Return -1 or 1 instead of 1 or 2.
- (compparms): Remove STRICT handling.
- (convert_for_assignment): Fix handling of pmfs.
-
-Fri Apr 17 14:04:16 1998 Mark Mitchell <mmitchell@usa.net>
-
- * typeck.c (comp_target_types): Handle references like pointers.
- (comp_target_parms): Note that return code from comp_target_types
- can be negative to indicate failure.
-
-Fri Apr 17 09:10:52 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * Make-lang.in (c++.all.build): Don't depend on $(DEMANGLER_PROG),
- which requires a working target compiler to build.
-
-Fri Apr 17 08:57:35 1998 Jeffrey A Law (law@cygnus.com)
-
- * tree.c (avoid_overlap): Add prototype.
-
- * spew.c (num_tokens): Add prototype.
- (nth_noken, add_token, consume_token, debug_yychar): Likewise.
-
- * search.c (dfs_check_overlap): Add prototype.
- (dfs_no_overlap_yet): Likewise.
-
- * pt.c (original_template): Add prototype.
- (inline_needs_template_parms): Likewise.
- (push_inline_template_parms_recursive): Likewise.
- (retrieve_specialization, register_specialization): Likewise.
- (print_candidates, reduce_template_parm_level): Likewise.
- (build_template_decl, mark_template_parm): Likewise.
- (tsubst_friend_function, get_bindings_real): Likewise.
-
- * method.c (start_squangling): Add prototype.
- (end_squangling, check_ktype, issue_ktype): Likewise.
- (build_overloaded_scope_ref, check_btype): Likewise.
- (build_mangled_template_parm_index): Likewise.
-
- * lex.c (init_cpp_parse): Add prototype.
- (handle_cp_pragma, handle_sysv_pragma): Likewise.
- (reduce_cmp, token_cmp): Likewise.
-
- * except.c (call_eh_info): Add prototype.
- (push_eh_info, get_eh_info, get_eh_value, get_eh_type): Likewise.
- (get_eh_caught, get_eh_handlers, do_pop_exception): Likewise.
-
- * decl2.c (is_namespace_ancestor): Add prototype.
- (namespace_ancestor, add_using_namespace): Likewise.
- (ambiguous_decl): Likewise.
-
- * decl.c (indent): Add prototype.
-
- * call.c (add_template_candidate_real): Add prototype.
-
-Fri Apr 17 01:57:12 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (build_expr_from_tree): Just return a PMF.
-
-Fri Apr 17 00:45:12 1998 Mark Mitchell <mmitchell@usa.net>
-
- * typeck2.c (process_init_constructor): Don't strip cv-qualifiers
- when doing initializations.
-
- * pt.c (unify): Use comptypes to compare type args.
-
-Fri Apr 17 00:24:22 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (duplicate_decls): Fix check for when it's safe to free
- the new decl.
-
- * pt.c (mangle_class_name_for_template): Don't pass a typedef type
- to type_as_string.
-
-Thu Apr 16 17:47:30 1998 Jeffrey A Law (law@cygnus.com)
-
- * pt.c (build_template_parm_index): Add prototype.
-
- * search.c (my_tree_cons): Don't clear words outside the
- newly allocated node.
-
-Wed Apr 15 15:34:44 1998 Dave Brolley <brolley@cygnus.com>
-
- * lex.c (init_parse): Now returns char* containing the filename.
-
-Wed Apr 15 13:20:06 1998 John Carr <jfc@mit.edu>
- Jeff Law <law@cygnus.com>
-
- * errfn.c: Rework to avoid problems when HOST_WIDE_INT is longer
- than a pointer.
-
-Sun Apr 12 22:31:19 1998 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * cvt.c (cp_convert_to_pointer): Use TYPE_PRECISION.
+2000-09-06 Nathan Sidwell <nathan@codesourcery.com>
-Fri Apr 10 12:16:49 1998 Benjamin Kosnik <bkoz@loony.cygnus.com>
+ * pt.c (type_unification_real): Replace switch with if.
+ (unify): Tsubst non-type parms before comparing.
- * decl.c (duplicate_decls): Don't warn for redundant decls if
- friend: let add_friend take care of it.
+2000-09-06 Nathan Sidwell <nathan@codesourcery.com>
-Thu Apr 9 02:40:48 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * error.c (dump_typename): New function, broken out of ...
+ (dump_type): ... here. Use it.
+ * typeck.c (same_type_p): Use cp_tree_equal for TYPENAME_TYPE.
- * sig.c (build_signature_pointer_constructor): Don't set
- TREE_HAS_CONSTRUCTOR for a signature pointer.
- * cvt.c (ocp_convert): Don't force a temporary for internal structs.
- * init.c (resolve_offset_ref): Warn about implicit & on pmfs
- here, too.
- * typeck.c (build_unary_op): Only allow taking the address of a
- real constructor.
- * typeck2.c (digest_init): Simplify.
- (store_init_value): Don't pedwarn about using { } for pmfs.
+2000-09-06 Nathan Sidwell <nathan@codesourcery.com>
-Thu Apr 9 22:16:57 1998 Per Bothner <bothner@cygnus.com>
+ * init.c (build_offset_ref): Deal with namespace scoped
+ TEMPLATE_ID_EXPRs.
- * cp-tree.h (start_decl): Update prototype.
- * decl.c (start_decl): Like the C version, new parameters
- for the attributes. Call cplus_decl_attributes here,
- (pushdecl): Like C version, do build_type_copy if TYPE_DECL,
- (grokdeclarator): Pass NULL for new start_decl arguments.
- * pt.c (tsubst_expr): Likewise.
- * parse.y: Merge cplus_decl_attribute calls into start_decl calls.
- * typeck.c (common_type): Check TYPE_MAIN_VARIANT.
- * lex.c (build_lang_decl): Add lang_name_java.
- * class.c (push_lang_context): Add lang_name_java.
- * method.c (build_mangled_name): Check for is_java_type.
+2000-09-06 Nathan Sidwell <nathan@codesourcery.com>
-Thu Apr 9 22:16:57 1998 Benjamin Kosnik <bkoz@loony.cygnus.com>
+ * class.c (resolve_address_of_overloaded_function): Add
+ explanation message.
+ * decl.c (define_case_label): Reformat explanation.
+ * decl2.c (finish_static_data_member_decl): Likewise.
+ (grokfield): Likewise.
+ * friend.c (do_friend): Likewise.
- * decl.c (grokdeclarator): Check TYPE_MAIN_VARIANT.
- * call.c (build_scoped_method_call): Check for TREE_CODE for
- VOID_TYPE instead of type == void_type_node.
- (build_method_call): Likewise.
+2000-09-05 Zack Weinberg <zack@wolery.cumb.org>
+
+ * tree.c (walk_tree): Expose tail recursion.
+ (walk_stmt_tree): New function.
+ * cp-tree.h: Prototype walk_stmt_tree.
+ * semantics.c (prune_unused_decls): Operate on SCOPE_STMTs not
+ the BLOCKs directly. If a BLOCK has no variables after
+ pruning, discard it.
+ (finish_stmt_tree): Use walk_stmt_tree. No need to save and
+ restore the line number.
+
+2000-09-05 Mark Mitchell <mark@codesourcery.com>
+
+ * Makefile.in (CXX_TREE_H): Add dependency on HTAB_H.
+ (pt.o): Remove dependency on HTAB_H.
+ * cp-tree.h: Include hashtab.h.
+ (walk_tree): Change prototype.
+ (walk_tree_without_duplicates): New function.
+ * decl.c (check_default_argument): Use it.
+ * optimize.c (remap_decl): Adjust calls to walk_tree.
+ (copy_body): Likewise.
+ (expand_calls_inline): Likewise.
+ (calls_setjmp_p): Use walk_tree_without_duplicates.
+ * pt.c: Don't include hashtab.h.
+ (for_each_template_parm): Use walk_tree_without_duplicates.
+ * semantics.c (finish-stmt_tree): Likewise.
+ (expand_body): Likewise.
+ * tree.c (walk_tree): Add additional parameter.
+ (walk_tree_without_duplicates): New function.
+ (count_trees): Use it.
+ (verify_stmt_tree): Adjust call to walk_tree.
+ (find_tree): Use walk_tree_without_duplicates.
+ (no_linkage_check): Likewise.
+ (break_out_target_exprs): Adjust call to walk_tree.
+ (cp_unsave): Likewise.
+
+2000-09-04 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * cp-tree.def (BOUND_TEMPLATE_TEMPLATE_PARM): New tree code.
+ (TEMPLATE_TEMPLATE_PARM): Adjust comment.
+ * cp-tree.h (TYPE_BINFO): Adjust comment.
+ (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise.
+ (TEMPLATE_TYPE_PARM_INDEX): Likewise.
+ (IS_AGGR_TYPE): Use BOUND_TEMPLATE_TEMPLATE_PARM instead.
+ (TYPE_TEMPLATE_INFO): Likewise.
+ (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL): Likewise.
+ * class.c (push_nested_class): Likewise.
* decl.c (lookup_name_real): Likewise.
(grokdeclarator): Likewise.
- (start_decl): Likewise.
- (grokparms): Likewise.
- (start_function): Likewise.
- (finish_function): Likewise.
- (start_method): Likewise.
-
-Thu Apr 9 00:18:44 1998 Dave Brolley (brolley@cygnus.com)
-
- * lex.c (finput): New variable.
- (init_cpp_parse): Renamed from init_parse.
- (init_parse): Handle !USE_CPPLIB. Call init_cpp_parse when finished.
- (finish_parse): New function.
- * cp-tree.h (init_lex, init_parse): Remove declarations.
-
-Mon Apr 6 02:25:05 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_call): Still evaluate the actual argument.
- * class.c (is_empty_class): Update for -fnew-abi.
-
- * decl2.c: -fnew-abi implies -fsquangle.
-
- * method.c (do_build_assign_ref): Don't do anything to copy
- an empty class.
- (do_build_copy_constructor): Likewise.
- * call.c (build_over_call): Likewise.
-
-Sat Apr 4 18:43:58 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (avoid_overlap): Return a value.
-
-Sat Apr 4 12:52:35 1998 Jeffrey A Law (law@cygnus.com)
-
- * method.c (check_btype): Add missing argument to xrealloc.
- (check_ktype): Likewise.
-
-Fri Apr 3 02:22:59 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- Implement empty base optimization.
- * class.c (finish_struct_1): Add vbase fields earlier. Set
- CLASSTYPE_SIZE of an empty base to 0. Types with bases can be empty.
- * search.c (dfs_check_overlap, dfs_no_overlap_yet): New fns.
- (types_overlap_p): New fn.
- * tree.c (avoid_overlap): New fn.
- (build_base_fields): Use it to avoid overlapping empty bases.
- * cp-tree.h, decl2.c, lang-options.h: Add -fnew-abi.
-
- * decl.c (cplus_expand_expr_stmt): Strip unused INDIRECT_REFs.
-
- Re-implement allocation of base class subobjects.
- * tree.c (unshare_base_binfos): New fn.
- (layout_basetypes): Use it. Now handles offsets of both virtual and
- non-virtual bases, after layout_type.
- (layout_vbasetypes): Remove.
- (build_base_fields): Generate FIELD_DECLs for each non-virtual base.
- (build_vbase_pointer_fields): Split out from old layout_basetypes.
- * class.c (finish_base_struct): Lose offset handling code.
- Move nonvdtor warning here. Don't mess with t_binfo anymore.
- (finish_struct_1): Don't mess with t_binfo anymore. Use fns above.
- * cp-tree.h: Adjust.
-
-Thu Apr 2 14:25:13 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h: Lose CLASSTYPE_VBASE_SIZE, some unused stuff.
- * decl.c, decl2.c, pt.c, ptree.c, lex.c: Likewise.
- * class.c (duplicate_tag_error): Likewise.
- (finish_struct_1): Set CLASSTYPE_SIZE, CLASSTYPE_MODE, CLASSTYPE_ALIGN.
- * tree.c (layout_vbasetypes): Update from layout_record, remove
- var_size support, use CLASSTYPE_SIZE instead of CLASSTYPE_VBASE_SIZE.
- (layout_basetypes): Likewise.
-
-Wed Apr 1 18:22:25 1998 Jeffrey A Law (law@cygnus.com)
-
- * class.c, Make sure system.h is included just after config.h.
- Delete lingering stdio and errno references too.
- * decl.c, errfn.c, parse.y, ptree.c search.c, xref.c: Likewise.
-
-Wed Apr 1 15:38:36 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * friend.c (is_friend): Fix access control for local classes.
-
- * class.c (is_empty_class): New fn.
- * call.c (build_call): Don't pass empty class objects to a function.
-
-Wed Apr 1 14:58:35 1998 Mark Mitchell <mmitchell@usa.net>
-
- * call.c (build_over_call): Do name resolution for default
- arguments of function templates in the scope of the templates.
-
-Tue Mar 31 13:43:57 1998 Jeffrey A Law (law@cygnus.com)
-
- * call.c: Include system.h. Remove includes, declarations and
- defines provided by system.h.
- * class.c, cvt.c, decl.c, decl2.c, errfn.c error.c: Likewise.
- * except.c, expr.c friend.c, g++spec.c, init.c, input.c: Likewise.
- * lex.c, parse.y, pt.c, ptree.c repo.c rtti.c, search.c: Likewise.
- * semantics.c, sig.c, spew.c, tree.c, typeck.c: Likewise.
- * typeck2.c, xref.c: Likewise.
- * Makefile.in: Dependencies updated as appropriate.
- * Make-lang.in: Likewise.
-
-Mon Mar 30 12:15:00 1998 Mark Mitchell <mmitchell@usa.net>
-
- * pt.c (fn_type_unification): Allow incomplete unification without
- an immediate error message.
-
-Mon Mar 30 08:55:42 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (member_p): New fn.
- * decl2.c (finish_file): Only set DECL_STATIC_FUNCTION_P for
- initializing class members.
-
- * cp-tree.def (TEMPLATE_PARM_INDEX): Class 'x'.
- * ptree.c (lang_print_xnode): Handle TEMPLATE_PARM_INDEX.
-
- * call.c (build_method_call): Handle non-scoped destructors, too.
- * pt.c (tsubst_copy): Likewise.
-
- * pt.c (print_template_context): Split out...
- (push_tinst_level): ...from here.
-
- * friend.c (is_friend): Don't pass a type to decl_function_context.
-
- * typeck.c (convert_for_initialization): Always hand off
- conversions to class type.
-
-Sun Mar 29 20:01:59 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * friend.c (is_friend): Local classes have the same access as the
- enclosing function.
-
-Sun Mar 29 00:47:32 1998 Jeffrey A Law (law@cygnus.com)
-
- * typeck.c (expand_target_expr): Delete dead function.
-
- * search.c: Put various prototypes inside #ifdef MI_MATRIX.
-
- * repo.c (save_string): Delete dead function.
-
- * method.c (thunk_printable_name): Delete dead function.
-
- * lex.c (yynextch): Delete dead function.
-
- * expr.c (tree_extract_aggr_init): #if 0 out.
-
- * except.c (do_unwind): Delete dead function.
- (easy_expand_asm): Likewise.
-
- * cvt.c (build_conversion_type_1): Delete dead function.
-
- * cp-tree.h (push_expression_obstack): Declare.
-
- * call.c (source_type): #if 0 out.
-
- * class.c (alter_access): Remove unused label. Add braces
- around empty else clause.
-
- * lex.c (yyprint): Fix argument to printf.
-
-Sat Mar 28 17:43:52 1998 Mark Mitchell <mmitchell@usa.net>
-
- * pt.c (tsubst): Clear TREE_USED for new FUNCTION_DECLs.
-
- * pt.c (instantiate_class_template): Make sure template
- arguments are permanent.
- * init.c (resolve_offset_ref): Don't go looking around in
- template types.
-
- * semantics.c: Add routines to handle expressions, and some
- declaration processing.
- * parse.y: Use them.
- (current_class_depth): Move declaration to cp-tree.h.
- * parse.c: Regenerated.
- * cp-tree.h: Use them.
- (current_class_depth): Declare.
- * pt.c (tsubst_copy): Use begin_stmt_expr and finish_stmt_expr.
-
-Fri Mar 27 20:23:18 1998 Mark Mitchell <mmitchell@usa.net>
-
- * error.c (dump_decl): Be a bit more explicit with template
- type arguments, when verbose.
-
-Fri Mar 27 18:16:40 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * inc/exception: Reorder closing braces.
-
-Fri Mar 27 13:22:18 1998 Mark Mitchell <mmitchell@usa.net>
-
- * pt.c (redeclare_class_template): New function.
- * cp_tree.h (redeclare_class_template): Declare it.
- * decl.c (xref_tag): Use it.
-
-Thu Mar 26 11:16:30 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_over_call): Check IS_AGGR_TYPE, not
- TYPE_LANG_SPECIFIC.
- * typeck.c (convert_arguments): Likewise.
-
- * decl.c (grokdeclarator): Remove const and volatile from type after
- setting constp and volatilep.
-
- * class.c (finish_struct_1): Don't warn about bool bitfield larger
- than one bit.
-
-Thu Mar 26 10:25:52 1998 Mark Mitchell <mmitchell@usa.net>
-
- * pt.c (convert_nontype_argument): STRIP_NOPS where appropriate.
-
-Thu Mar 26 10:24:05 1998 Mark Mitchell <mmitchell@usa.net>
-
- * call.c (build_object_call): Complain about ambiguous operator(),
- rather that crashing.
- (build_new_op): Likewise.
- (build_op_delete_call): Likewise.
-
-Thu Mar 26 10:23:24 1998 Mark Mitchell <mmitchell@usa.net>
-
- * cvt.c (perform_qualification_conversions): Use comp_target_types
- instead of comp_ptr_ttypes.
-
-Wed Mar 25 16:10:50 1998 Mark Mitchell <mmitchell@usa.net>
-
- * cp-tree.h (enforce_access): Declare.
- * call.c (enforce_access): Make it extern, not static.
- * class.c (alter_access): Use enforce_access; modify code for ISO
- compliance, rather than ARM rules.
-
-Wed Mar 25 12:10:45 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
-
- * cp-tree.h: Fix typo.
-
-Wed Mar 25 02:01:02 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * expr.c (cplus_expand_expr): Only do PCC_STATIC_STRUCT_RETURN thing
- if (aggregate_value_p (type)).
-
- * decl2.c (constructor_name_full): Handle TYPENAME_TYPE.
-
-Tue Mar 24 16:12:01 1998 Mark Mitchell <mmitchell@usa.net>
-
- * tree.c (mapcar): When dealing with a DECL, use it's constant
- value, if any.
- * pt.c (lookup_template_class): Don't mangle the names of template
- classes whose arguments are unknown.
-
- * pt.c (tsubst_expr): Handle GOTO_STMT correctly.
-
-Tue Mar 24 12:21:55 1998 Benjamin Kosnik <bkoz@lisa.cygnus.com>
-
- * decl.c (init_decl_processing): Set TYPE_PRECISON for bools to 1.
-
-Tue Mar 24 12:21:48 1998 Jim Wilson <wilson@cygnus.com>
-
- * decl.c (init_decl_processing): Initialize TYPE_MAX_VALUE for
- boolean_type_node to 1.
-
-Tue Mar 24 10:23:47 1998 Mark Mitchell <mmitchell@usa.net>
-
- * error.c (dump_expr): Remove unused variable `l'.
-
- * pt.c (for_each_template_parm): New function, created by
- converting uses_template_parms.
- (tree_fn_t): New typedef.
- (uses_template_parms): Use it.
- (mark_template_parm): New function.
- (push_template_decl): Check that the argument list of a partial
- specialization uses all the template parameters.
-
- * Make-lang.in (c++filt): Don't delete cxxmain.c after we're done
- with it; we might want it for debugging.
- * cp-tree.h (type_unification): Change interface.
- * class.c (finish_struct_1): Skip nested template types, just like
- ordinary nested types.
- (instantiate_type): Use new interface to type_unification.
- * lex.c (init_lex): Add __sz as opname for sizeof.
- * method.c (build_overload_scope_ref): New function.
- (build_overload_int): Handle complex expressions. Set
- numeric_output_need_bar if necessary.
- (build_overload_value): Handle non-PARM_DECL nodes; this
- routine is now used by build_overload_int. Remove some
- assignments to numeric_output_need_bar. Use
- build_overload_scope_ref.
- (build_qualified_name): Note that some template mangled names end
- with digits, and set numeric_output_need_bar appropriately. Use
- build_underscore_int.
- * pt.c (unify): Change interface.
- (type_unification_real): Likewise.
- (determine_specialization): Use new interfaces.
- (tsubst): Deal gracefully with situations in which the argument
- vector is not fully filled.
- (fn_type_unification): Use new interfaces.
- (type_unification): Likewise. Remove NOP_EXPR hack.
- (type_unification_real): Likewise.
- (unify): Likewise. Deal with unification of complex expressions.
-
-Mon Mar 23 12:24:37 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (complete_template_args): Initialize skip properly.
-
- * decl.c (make_typename_type): Revert.
- (make_implicit_typename): Remove.
- (lookup_name_real): Don't call it. Call lookup_field if we see a
- TYPE_DECL from a template base.
- * search.c (lookup_field): Do implicit typename stuff.
-
-Sun Mar 22 00:50:42 1998 Nick Clifton <nickc@cygnus.com>
- Geoff Noer <noer@cygnus.com>
-
- * Makefile.in: Various fixes for building cygwin32 native toolchains.
- * Make-lang.in: Likewise.
-
-Fri Mar 20 18:07:39 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
-
- * pt.c (tsubst, TEMPLATE_TEMPLATE_PARM): Simplify.
-
-Fri Mar 20 10:42:07 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (make_implicit_typename): Rewrite removed code.
- (make_typename_type): Call it if the type we look up comes from
- a base that uses template parms.
-
- * pt.c (complete_template_args): Rewrite.
- (tsubst, FUNCTION_DECL): Use it.
-
-Fri Mar 20 08:12:43 1998 H.J. Lu (hjl@gnu.org)
-
- * semantics.c (finish_asm_stmt): Fix combine strings. Call
- c_expand_asm_operands () if output_operands, input_operands or
- clobbers is not NULL_TREE.
-
-Fri Mar 20 00:10:19 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
-
- * pt.c (complete_template_args): New function.
- (get_bindings): Deal with specializations of function templates
- with return type containing parameters from outer class
- templates.
- (tsubst, TEMPLATE_TEMPLATE_PARM): When reducing parameter level,
- substitute arguments and compose a new type.
-
-Thu Mar 19 19:01:48 1998 Mark Mitchell <mmitchell@usa.net>
-
- * pt.c (tsubst): Clear DECL_PENDING_INLINE_INFO for new
- FUNCTION_DECLs.
-
-Thu Mar 19 11:51:58 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (make_implicit_typename): Lose useless code.
-
- * call.c (standard_conversion): Handle A* -> const A* properly.
-
- * pt.c (get_bindings_real): Rename from get_bindings. Add
- check_rettype parm.
- (get_bindings): Pass 1.
- (get_bindings_overload): Pass 0.
-
-Wed Mar 19 09:08:12 1998 Mark Mitchell <mmitchell@usa.net>
-
- * pt.c (check_explicit_specialization): When reverting a static
- member function, also remove the `this' parameter from
- last_function_parms.
-
-Thu Mar 19 02:27:48 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst_copy, CONST_DECL): Don't bother tsubsting
- a function context.
-
- * decl.c (store_bindings): Use free_binding_vecs.
- (pop_from_top_level): Likewise.
-
-Wed Mar 18 12:41:43 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (make_implicit_typename): Only change the type of a
- TYPENAME_TYPE.
-
-Wed Mar 18 10:09:51 1998 Mark Mitchell <mmitchell@usa.net>
-
- * semantics.c: New file, containing routines to perform the
- semantic phase of parsing.
- * parse.y: Use it.
- * pt.c (tsubst_expr): Likewise.
- * cp-tree.h: Declare the various functions in semantics.c.
- Provide macros to access _STMT tree nodes.
- * cp-tree.def: Add ASM_STMT tree node.
- * Makefile.in, Make-lang.in: Add dependencies on and for
- semantics.c.
-
-Wed Mar 18 00:24:10 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (push_template_decl): Only check primary templates.
-
- * pt.c (check_explicit_specialization): Complain about default args
- in explicit specialization.
-
- * parse.y (nomods_initdcl0): Also call cp_finish_decl for a
- constructor_declarator.
-
-Tue Mar 17 14:44:54 1998 Mark Mitchell <mmitchell@usa.net>
-
- * typeck2.c (build_x_arrow): Don't crash when an aggregate type
- has no overloaded operator ->.
-
- * call.c (build_field_call): Don't crash when presented with a
- field that is actually a nested type.
-
- * decl.c (pushtag): Deal with friend class injection in local
- classes.
-
- * call.c (build_object_call): Don't crash if OBJ is a
- pointer-to-member-function.
-
-Tue Mar 17 11:40:26 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (push_template_decl): Complain about template with C linkage,
- anonymous template class.
-
-Mon Mar 16 12:10:39 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (pushclass): Only use the mi_matrix stuff #ifdef MI_MATRIX.
- * search.c: Likewise.
-
- * lex.c (do_pending_defargs): Only call
- maybe_{begin,end}_member_template_processing for FUNCTION_DECLs.
-
- * parse.y (initdcl0_innards): Move maybeasm back into initdcl0 et al.
-
-Mon Mar 16 10:47:22 1998 Mark Mitchell <mmitchell@usa.net>
-
- * parse.y: Deal with CONSTRUCTORS in new_initializers.
-
-Mon Mar 16 10:54:21 1998 Mark Mitchell <mmitchell@usa.net>
-
- * pt.c (tsubst_copy): Deal with BIND_EXPR in a way that more
- closely mimics the behavior in parse.y.
- (tsubst_expr): Return the resulting BLOCK when making a tsubst'ing
- into a compound statement.
-
-Sun Mar 15 02:07:26 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h (TEMPLATE_PARMS_FOR_INLINE): New macro.
- * pt.c (inline_needs_template_parms): New fn.
- (original_template): New fn.
- (push_inline_template_parms_recursive): New fn.
- (maybe_begin_member_template_processing): Use them.
- (maybe_end_member_template_processing): Likewise.
- (is_member_or_friend_template): Rename to is_member_template.
- Member functions of local classes are never member templates.
-
-Sun Mar 15 01:14:22 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
-
- * lex.c (do_identifier): Handle TEMPLATE_DECL that was
- added in the class scope to catch redefinition error.
-
- * pt.c (reduce_template_parm_level): Also copy
- the DECL_TEMPLATE_PARMS field.
-
-Sun Mar 15 10:54:08 1998 Mark Mitchell <mmitchell@usa.net>
-
- * pt.c (tsubst): Clear TYPE_REFERENCE_TO when creating a
- reduced-level template type parameter.
-
-Sun Mar 15 12:26:02 1998 Manfred Hollstein <manfred@s-direktnet.de>
-
- * cp-tree.h (struct lang_decl_flags): Add needs_final_overrider.
- (DECL_NEEDS_FINAL_OVERRIDER_P): New macro.
- * class.c (override_one_vtable): Set DECL_NEEDS_FINAL_OVERRIDER_P.
- * decl.c (duplicate_decls): Propagate it.
- * typeck2.c (abstract_virtuals_error): Use two loops to emit
- abstract virtual functions and virtual functions which need a
- final overrider separately.
-
-Thu Mar 12 09:39:40 1998 Manfred Hollstein <manfred@s-direktnet.de>
-
- * lang-specs.h: Properly put brackets around array elements in
- initializer.
-
- * typeck.c (build_binary_op_nodefault): Correctly place parens around
- && and || in expression.
-
-Thu Mar 12 09:26:04 1998 Manfred Hollstein <manfred@s-direktnet.de>
-
- * call.c (default_parm_conversions): Remove prototype definition.
- (build_method_call): Remove unused variable result.
-
- * cvt.c (ocp_convert): Remove unused variable conversion.
-
- * decl2.c (ambiguous_decl): Add explicit parameter definition for name.
-
- * except.c (do_unwind): #if 0 definition of unused variables fcall
- and next_pc.
-
- * expr.c (extract_scalar_init): #if 0 prototype and function
- definition.
-
- * init.c (expand_aggr_init_1): Remove unused variable init_type.
- (build_new_1): Remove unused variable t.
-
- * pt.c (instantiate_class_template): Remove unused variable newtag;
- cast called function return value to void.
- (do_decl_instantiation): Remove unused variables name and fn.
-
- * tree.c (get_type_decl): Add default return to shut up compiler from
- complaining control reaches end of non-void function.
-
- * typeck.c (build_x_conditional_expr): Remove unused variable rval.
-
-Thu Mar 12 09:12:15 1998 Manfred Hollstein <manfred@s-direktnet.de>
-
- * call.c (default_parm_conversions): Remove prototype definition.
- (build_method_call): Remove unused variable result.
- (build_over_call): Add default case in enumeration switch.
-
-Thu Mar 12 08:39:13 1998 Manfred Hollstein <manfred@s-direktnet.de>
-
- * decl2.c (lang_decode_option): Change j's type to size_t.
-
- * tree.c (layout_vbasetypes): record_align and desired_align are of
- type unsigned int; const_size and nonvirtual_const_size likewise.
-
-Wed Mar 11 07:25:20 1998 Mark Mitchell <mmitchell@usa.net>
-
- * parse.y (new_initializer): Make sure all initializers are
- lists.
-
-Tue Mar 10 07:32:36 1998 Mark Mitchell <mmitchell@usa.net>
-
- * decl2.c (import_export_decl): Mark tinfo functions for
- cv-qualified versions of class types as DECL_NOT_REALLY_EXTERN.
-
-Fri Mar 6 23:27:35 1998 Jeffrey A Law (law@cygnus.com)
-
- * method.c: Fix typo.
-
-Fri Mar 6 10:06:59 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * method.c: Include "system.h" to get stdlib.h, stdio.h,
- ctype.h, string.h, etc.
- (issue_nrepeats): Add default case in enumeration switch.
- (check_btype): Likewise.
- (process_overload_item): Likewise.
-
- * Makefile.in (method.o): Depend on system.h.
-
-Wed Mar 4 22:26:53 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * lex.c (do_scoped_id): Fix parenthesizing.
-
-Wed Mar 4 12:11:53 1998 Michael Tiemann <tiemann@axon.cygnus.com>
-
- * rtti.c (get_tinfo_fn_dynamic): If this function is called an
- FLAG_RTTI is unset, initialize type info machinery and continue
- with FLAG_RTTI enabled.
- (get_typeid): Likewise.
-
-Wed Mar 4 11:47:55 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (unary_complex_lvalue): &D::i has type B::* if i comes
- from B.
-
-Wed Mar 4 11:28:08 1998 Mark Mitchell <mmitchell@usa.net>
-
- * pt.c (finish_member_template_decl): Deal more gracefully with
- invalid declarations.
-
-Tue Mar 3 01:38:17 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c, decl.c, decl2.c, init.c, rtti.c, typeck.c, typeck2.c,
- cp-tree.h: Clean up more old overloading code, old RTTI code, and
- some formatting quirks.
-
- * call.c, class.c, cp-tree.h, cvt.c, decl.c, init.c, lex.c,
- method.c, pt.c, ptree.c, typeck.c: Remove support for
- -fno-ansi-overloading and overloading METHOD_CALL_EXPR.
- * class.h: Remove.
- * Makefile.in: Adjust.
-
- * pt.c (unify): Don't allow reduced cv-quals when strict.
-
- * call.c, class.c, pt.c, cp-tree.h: Remove nsubsts parm from
- *type_unification* and unify.
-
-Mon Mar 2 12:11:06 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (explicit_template_type): Remove TEMPLATE keyword.
- (nested_name_specifier): And add it before this use.
- (typename_sub0): And this use. Also add use without the keyword.
- (typename_sub1): Likewise.
- * pt.c (instantiate_class_template): Don't actually instantiate
- anything if our type uses template parms.
-
-Mon Mar 2 11:04:59 1998 Jim Wilson <wilson@cygnus.com>
-
- * decl.c (start_function): Don't call temporary_allocation for a
- nested function.
-
-Sun Mar 1 21:06:37 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Don't mess with friends if
- our type uses template parms.
-
-Sat Feb 28 12:06:44 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (nested_name_specifier): Use explicit_template_type.
- (typename_sub): Allow a template_type, an explicit_template_type,
- or an implicit template type at the end.
- * lex.c (yyprint): Handle a PTYPENAME being a TEMPLATE_DECL.
- * decl.c (make_typename_type): Handle template-id where the name
- is a TEMPLATE_DECL.
- * call.c (build_scoped_method_call): Handle member template
- destructor call.
- * pt.c (tsubst_copy, METHOD_CALL_EXPR): Don't assume a member
- destructor is represented by the type.
-
- * cp-tree.h (TYPENAME_TYPE_FULLNAME): New macro.
- * parse.y (nested_name_specifier): Add 'template' case.
- (explicit_template_type): New rule.
- (typename_sub): Use it.
- * decl.c (make_typename_type): Handle getting a template-id for NAME.
- * pt.c (tsubst): Likewise.
-
-Fri Feb 27 11:17:50 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (add_to_template_args): Fix thinko.
- (instantiate_class_template): Call it later.
-
- * pt.c (get_class_bindings): Add outer_args parm.
- (most_specialized_class): Likewise.
- (instantiate_class_template): Pass it.
- (more_specialized_class): Likewise.
- (lookup_template_class): Get context from template if none
- was specified.
- (finish_member_template_decl): Don't do anything with a
- partial specialization.
- * decl2.c (check_member_template): Use IS_AGGR_TYPE instead of
- AGGREGATE_TYPE_P.
- * class.c (finish_struct): Member class templates have already been
- checked for name clashes.
- * decl.c (pushdecl_with_scope): Handle pushing at class level.
-
-Fri Feb 27 02:25:16 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst, TEMPLATE_DECL): Support member class templates.
- (tsubst, *_PARM): Support multiple levels of template classes.
- (instantiate_class_template): Look up the pattern from the
- original template.
- (lookup_template_class): Handle getting a template for d1.
- (push_template_decl): Correct setting of 'primary'.
- (reduce_template_parm_level): Add 'levels' parm.
- (finish_member_template_decl): Support member class templates.
- (template_class_depth): Handle multiple levels.
- * parse.y (component_decl_1, fn.def2): Remove member template case.
- (component_decl): Add member template cases.
- * decl2.c (check_member_template): We now handle member template
- classes.
- * decl.c (pushtag): Handle member templates.
- * method.c (do_inline_function_hair): Don't touch
- IDENTIFIER_GLOBAL_VALUE.
- * init.c (build_offset_ref): If name isn't an identifier, just
- return it.
- * spew.c (yylex): Handle PTYPENAME like TYPENAME.
-
- * typeck.c (get_delta_difference): Do adjust for conversions to
- and from virtual base.
-
-Wed Feb 25 09:51:29 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (get_delta_difference): Give hard error for conversion
- from virtual base.
-
- * cp-tree.h: Tweak formatting.
-
-Wed Feb 25 00:35:33 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (push_namespace): Handle redeclaration error.
-
- * cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro.
- (IDENTIFIER_NAMESPACE_BINDINGS): New macro.
- (NAMESPACE_BINDING): New macro.
- (IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING.
- * *.c: Use them.
-
- * pt.c (push_template_decl): Use innermost_args.
-
- * decl.c (get_unique_name): Tweak from earlier in the name.
-
-Tue Feb 24 22:15:04 1998 Martin von Loewis <loewis@informatik.hu-berlin.de>
-
- * cp-tree.def: Add CPLUS_BINDING node.
- * cp-tree.h (tree_binding): New struct.
- (BINDING_SCOPE, BINDING_VALUE): New macros.
- (current_namespace, global_namespace): Declare extern.
- (struct lang_decl_flags): New field in_namespace.
- (DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): New macros.
- (DECL_NAMESPACE, SET_DECL_NAMESPACE): New macros.
- (TREE_INDIRECT_USING): New macro.
- * decl2.c (current_namespace, global_namespace): Declare. The
- value is a NAMESPACE_DECL now, not a TREE_LIST.
- (is_namespace_ancestor, namespace_ancestor): New static functions.
- (add_using_namespace, ambiguous_decl): Likewise.
- (lookup_using_namespace): New support function for lookup_name.
- (qualified_lookup_using_namespace): New support function for
- do_scoped_id and lookup_namespace_name.
- (get_namespace_id): Mark as obsolete.
- (current_namespace_id): Likewise.
- (do_namespace_alias): Implement.
- (do_using_directive): Implement as call to add_using_namespace.
- * decl.c (binding_for_name): New function.
- (push_namespace, pop_namespace): Implement.
- (push_decl): Don't install a FUNCTION_DECL in the global branch.
- (lookup_namespace_name): Implement using qualified lookup.
- (lookup_name_real): For global scoping, lookup in
- global_namespace. For namespace scoping, lookup in given
- namespace. For unscoped lookup, iterate over namespace,
- considering using directives.
- (init_decl_processing): Initialize global_namespace.
- (grokvardecl): Build assembler name as static name for globals.
- (grokdeclarator): Remove old namespace mangling.
- (xref_tag): When installing a global binding for the
- tag, make sure we have an identifier.
- * method.c (build_overload_nested_name): Mangle namespaces.
- (build_qualified_name): Likewise.
- (build_decl_overload_real): Likewise.
- * lex.c (build_lang_decl): Set namespace for new declaration to
- current_namespace.
- (do_scoped_id): Find global names in global or current
- namespace, or using qualified namespace lookup, depending on
- context.
- * init.c (build_member_call): When scope is namespace, use
- build_x_function_call instead.
- (build_offset_ref): When scope is namespace, collapse processing
- to lookup_namespace_name instead.
- * error.c (dump_decl): Support NAMESPACE_DECL.
- * decl.c (pushdecl): Bind globals to current namespace.
- (push_overloaded_decl): Likewise.
- (lookup_tag): Likewise.
- (lookup_name_current_level): Likewise.
+ (grok_op_properties): Likewise.
(xref_tag): Likewise.
- (start_function): Likewise.
- * lex.c (do_identifier): Likewise.
- (identifier_typedecl_value): Likewise.
- (real_yylex): Likewise.
- * method.c (do_inline_function_hair): Likewise.
- * parse.y (unscoped): Likewise.
- * pt.c (check_explicit_specialization): Likewise.
- (lookup_template_class): Likewise.
- * rtti.c (call_void_fn): Likewise.
- * sig.c (build_sigtable): Likewise.
- * ptree.c (lang_print_xnode): New function.
-
-Tue Feb 24 01:40:24 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Don't instantiate if pedantic
- and the args use template parms.
-
- * pt.c (push_tinst_level): If the instantiation uses template parms,
- fail silently.
- * decl.c (xref_basetypes): Do call complete_type for basetypes
- that involve template parameters.
-
-Tue Feb 24 00:36:43 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck2.c (process_init_constructor): Fix labeled init check.
-
-Mon Feb 23 05:08:55 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c, call.c, decl.c, method.c, cp-tree.h: Remove unused NARGS
- argument to tsubst and friends.
-
- * pt.c (tsubst, FUNCTION_DECL): Tidy.
-
- * typeck.c (build_x_function_call): Handle static member function
- templates like non-templates. Handle friend templates like normal
- function templates.
- * pt.c (tsubst, *_PARM): Don't use orig_level.
- (get_bindings): Don't call add_to_template_args.
- (instantiate_template): Likewise.
- (tsubst, FUNCTION_DECL): Call add_to_template_args as appropriate.
- * ptree.c (print_lang_type): Print index/level for template parms.
-
-Mon Feb 23 02:52:29 1998 Mark Mitchell <mmitchell@usa.net>
-
- * Make-lang.in (cc1plus): Note that cc1plus depends on
- cp/cp-tree.h and cp/cp-tree.def.
-
- * cp-tree.def (TEMPLATE_CONST_PARM): Remove.
- (TEMPLATE_PARM_INDEX): New tree code, used to indicate a
- position in a template parameter list.
- * cp-tree.h (template_parm_index): New structure, used as the tree
- structure for a TEMPLATE_PARM_INDEX.
- (TEMPLATE_PARM_IDX): New macro.
- (TEMPLATE_PARM_LEVEL): Likewise.
- (TEMPLATE_PARM_DESCENDANTS): Likewise.
- (TEMPLATE_PARM_ORIG_LEVEL): Likewise.
- (TEMPLATE_PARM_DECL): Likewise.
- (TEMPLATE_TYPE_PARM_INDEX): Likewise.
- (TEMPLATE_TYPE_ORIG_LEVEL): Likewise.
- (TEMPLATE_TYPE_DECL): Likewise.
- (TEMPLATE_CONST_IDX): Remove.
- (TEMPLATE_CONST_LEVEL): Likewise.
- (TEMPLATE_CONST_SET_INFO): Likewise.
- (TEMPLATE_TYPE_SET_INFO): Likewise.
- (TEMPLATE_TYPE_IDX): Redefine in terms of TEMPLATE_PARM_INDEX
- node.
- (TEMPLATE_TYPE_LEVEL): Likewise.
- * decl.c (decls_match): Call comp_template_parms, rather than
- expanding it inline.
- (duplicate_decls): If two template declarations are being merged,
- then their TEMPLATE_INFOs should be merged as well.
- (grokfndecl): Save template-id information when declaring a friend
- with explicit template arguments. Pass arguments to
- check_explicit_specialization via correct convention; at some
- point check_explicit_specialization changed, but these call-sites
- did not.
- (grokdeclarator): Tidy up slightly.
- * decl2.c (check_classfn): Tidy up slightly. Don't assume that
- two template functions with the same DECL_ASSEMBLER_NAME the same,
- since the names are not yet mangled.
- * error.c (dump_decl): Use TEMPLATE_PARM_INDEX instead of
- TEMPLATE_CONST_PARM.
- (dump_expr): Likewise. Use the TEMPLATE_PARM_DECL to get at the
- decl for a non-type parameter, rather than printing `<tparm ...>'.
- * friend.c (is_friend): Handle TEMPLATE_DECL friends.
- (do_friend): Deal with template friends.
- * lex.c (do_pending_inlines): Call
- maybe_begin_member_template_processing, rather than
- conditionally calling begin_member_template_processing.
- (process_next_inline): Likewise. Call
- maybe_end_member_template_processing, rather than
- conditionally calling end_member_template_processing.
- (do_pending_defargs): Likewise.
- (do_identifier): Use TEMPLATE_PARM_INDEX instead of
- TEMPLATE_CONST_PARM.
- * method.c (build_mangled_template_parm_index): New function.
- (build_overload_value): Use it.
- (build_overload_name): Likewise.
- * pt.c (finish_member_template_decl): Allow friend declarations.
- (template_class_depth): New function.
- (is_member_template): Rename, and modify, to become...
- (is_member_or_friend_template): New function.
- (end_member_template_processing): Rename, and modify, to become...
- (maybe_end_member_template_processing).
- (build_template_parm_index): New function.
- (reduce_template_parm_level): New function.
- (process_template_parm): Modify to use build_template_parm_index.
- (push_template_decl): Deal with friend templates.
- (uses_template_parms): Use TEMPLATE_PARM_INDEX instead of
- TEMPLATE_CONST_PARM.
- (tsubst_friend_function): New function.
- (instantiate_class_template): Generate the DECL_FRIENDLIST
- for a new instantiation by using tsubst_friend_function rather
- than just tsubst.
- (tsubst): Don't tsubst into a type which is a TEMPLATE_DECL.
- Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM, and the
- appropriate new macros. Use reduce_template_parm_level to
- generate lower-level template parameters. Handle tsubst'ing into
- TEMPLATE_DECLS that declare TEMPLATE_TEMPLATE_PARMS. Don't forget
- to tsubst the DECL_CONTEXT and DECL_CLASS_CONTEXT of newly created
- templates. Similarly for the template parameters for a new
- template.
- (tsubst_copy): Tidy up slightly. Use TEMPLATE_PARM_INDEX instead
- of TEMPLATE_CONST_PARM. Handle TYPE_DECLs by tsubsting into them.
- (unify): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM.
- (get_bindings): Call add_to_template_args if necessary.
- (instantiate_decl): Handle instantiations of friend templates.
- * search.c (lookup_field_1): Don't treat the TYPE_FIELDS of a
- TEMPLATE_TYPE_PARM as a list of fields; it's not!
- * spew.c (yylex): Do a little manual constant propagation to
- clarify the code.
-
-Sun Feb 22 19:53:29 1998 Jeffrey A Law (law@cygnus.com)
-
- * error.c: Include sys/types.h.
-
-Thu Feb 19 14:49:09 1998 Jeffrey A Law (law@cygnus.com)
-
- * method.c (build_mangled_name): Start CPP directives in column zero.
-
-Thu Feb 19 10:36:48 1998 Jason Merrill <jason@yorick.cygnus.com>
+ (xref_basetypes): Likewise.
+ * decl2.c (constructor_name_full): Likewise.
+ (arg_assoc_template_arg): Add TEMPLATE_TEMPLATE_PARM case.
+ (arg_assoc_type): Use BOUND_TEMPLATE_TEMPLATE_PARM instead.
+ * error.c (dump_type): Split TEMPLATE_TEMPLATE_PARM case.
+ (dump_type_prefix): Add BOUND_TEMPLATE_TEMPLATE_PARM.
+ (dump_type_suffix): Likewise.
+ * init.c (is_aggr_type): Use BOUND_TEMPLATE_TEMPLATE_PARM
+ instead.
+ (get_aggr_from_typedef): Likewise.
+ * mangle.c (write_type): Split TEMPLATE_TEMPLATE_PARM case.
+ (write_expression): Add BOUND_TEMPLATE_TEMPLATE_PARM.
+ (write_template_parm): Likewise.
+ (write_template_template_parm): Check tree code instead of
+ using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
+ * method.c (build_overload_nested_name): Add
+ BOUND_TEMPLATE_TEMPLATE_PARM.
+ (process_overload_item): Split TEMPLATE_TEMPLATE_PARM case.
+ * parse.y (bad_parm): Add BOUND_TEMPLATE_TEMPLATE_PARM.
+ * pt.c (convert_template_argument): Check tree code instead of
+ using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
+ (for_each_template_parm_r): Split TEMPLATE_TEMPLATE_PARM case.
+ (for_each_template_parm): Adjust comment.
+ (tsubst): Add BOUND_TEMPLATE_TEMPLATE_PARM. Reorganize.
+ (tsubst_copy): Add BOUND_TEMPLATE_TEMPLATE_PARM.
+ (unify): Add BOUND_TEMPLATE_TEMPLATE_PARM. Reorganize. Use
+ template_args_equal to compare template template parameter cases.
+ * ptree.c (print_lang_type): Add BOUND_TEMPLATE_TEMPLATE_PARM.
+ * search.c (lookup_field_1): Use BOUND_TEMPLATE_TEMPLATE_PARM
+ instead.
+ * tree.c (copy_template_template_parm): Decide whether to create
+ a TEMPLATE_TEMPLATE_PARM or BOUND_TEMPLATE_TEMPLATE_PARM node.
+ (walk_tree): Add BOUND_TEMPLATE_TEMPLATE_PARM.
+ (copy_tree_r): Likewise.
+ * typeck.c (comptypes): Likewise. Check tree code instead of
+ using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
- * typeck2.c (process_init_constructor): Sorry about non-trivial
- labeled initializers.
- * parse.y (initlist): Re-enable labeled initializers.
+2000-09-04 Mark Elbrecht <snowball3@bigfoot.com>
-Thu Feb 19 10:15:55 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
+ * decl.c (finish_function): Move the code for handling functions
+ marked with the constructor and destructor attributes inside the
+ expand_p block.
- * pt.c (coerce_template_parms): Add a new parameter, is_tmpl_parm,
- all callers changed. Rely on the new parameter instead of arg
- being a TREE_LIST when determine whether we are working inside
- template template parameter. Clean up is_type test.
+2000-09-04 Nathan Sidwell <nathan@codesourcery.com>
-Thu Feb 19 10:04:12 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * init.c (resolve_offset_ref): Deal with TEMPLATE_ID_EXPR.
- * cvt.c (cp_convert_to_pointer): Preserve TREE_CONSTANT.
- * typeck2.c (initializer_constant_valid_p): Allow conversions
- between pointers and references.
+2000-09-04 Nathan Sidwell <nathan@codesourcery.com>
-1998-02-19 Brendan Kehoe <brendan@cygnus.com>
+ * pt.c (lookup_template_class): Remove abort.
+ * tree.c (get_type_decl): Allow error_mark_node.
- * typeck.c (build_unary_op): Only warn about incr/decr a pointer
- if pedantic || warn_pointer_arith.
+2000-09-04 Nathan Sidwell <nathan@codesourcery.com>
-Thu Feb 19 09:37:21 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
+ * decl2.c (arg_assoc): Deal with COMPONENT_REFs inside
+ TEMPLATE_ID_EXPRs.
- * pt.c (unify): Handle TEMPLATE_DECL.
+2000-09-03 Mark Mitchell <mark@codesourcery.com>
-1998-02-18 Brendan Kehoe <brendan@cygnus.com>
+ * operators.def (ALIGNOF_EXPR, MAX_EXPR, MIN_EXPR): Change
+ new ABI mangling.
- * cp-tree.h (strip_attrs): Remove decl.
+2000-09-01 Nathan Sidwell <nathan@codesourcery.com>
-1998-02-18 Doug Evans <devans@cygnus.com>
+ * parse.y (named_class_head): Check for TYPENAME_TYPE. Simplify
+ union tag mismatch error reporting.
- * decl.c (duplicate_decls): Call merge_machine_decl_attributes.
- Update olddecl's attributes too.
- (strip_attrs): Remove function.
- * typeck.c (common_type): Call merge_machine_type_attributes.
+2000-09-01 Nathan Sidwell <nathan@codesourcery.com>
-Tue Feb 17 14:07:52 1998 Mark Mitchell <mmitchell@usa.net>
+ * call.c (build_scoped_method_call): Check it is not a namespace.
- * parse.y (initdcl0_innards): New grammar symbol.
- (nomods_initdecls, nomods_initdcl0): Change type from itype to
- none, since the resulting value is never used.
- (parse_decl): New function.
- (datadef): Remove redundant actions.
- (initdcl0, notype_initdcl0, nomods_initdcl0): Use initdcl0_innards.
- * parse.c: Regenerated.
+2000-08-30 Jason Merrill <jason@redhat.com>
-Tue Feb 17 11:54:16 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (LOCAL_CLASS_P): Use decl_function_context.
- * parse.y (simple_stmt): Use getdecls() to check for decl.
+ * tree.c (bot_manip): Check TREE_CONSTANT rather than
+ !TREE_SIDE_EFFECTS. Call break_out_target_exprs and
+ build_target_expr_with_type for the non-AGGR_INIT_EXPR case.
-Sat Feb 14 11:50:51 1998 Manfred Hollstein <manfred@s-direktnet.de>
+ * decl.c (start_function): Always call make_function_rtl.
- * Make-lang.in (DEMANGLER_INSTALL_NAME, DEMANGLER_CROSS_NAME): New
- macros.
- (c++.install-common): Install c++filt properly as native or as cross
- variant.
- (c++.uninstall): Add c++filt.
+2000-08-29 Zack Weinberg <zack@wolery.cumb.org>
-Fri Feb 13 14:55:37 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * semantics.c (prune_unused_decls): New function.
+ (finish_stmt_tree): Call it via walk_tree.
- * call.c (standard_conversion): Fix multi-level ptr conversions.
+2000-08-29 Zack Weinberg <zack@wolery.cumb.org>
-Fri Feb 13 14:06:22 1998 Mike Stump <mrs@wrs.com>
+ * class.c (build_secondary_vtable): Constify a char *.
+ * decl.c (init_decl_processing): Initialize function_id_node,
+ pretty_function_id_node, and func_id_node.
+ * input.c (struct input_source): Constify 'str'.
+ (feed_input): Constify first argument.
+ * mangle.c (write_identifier): Constify argument.
+ * pt.c (mangle_class_name_for_template): Constify argument.
- * init.c (build_new): Propagate error_mark_node up.
+2000-08-29 Mark Mitchell <mark@codesourcery.com>
-Fri Feb 13 13:24:32 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * typeck.c (mark_addressable): Remove code that pokes around in
+ RTL.
- * parse.y (simple_stmt): If the condition isn't a declaration,
- start the controlled block after the test.
+2000-08-28 Jason Merrill <jason@redhat.com>
-Fri Feb 13 02:26:10 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+ * lex.c (file_name_nondirectory): Move to toplev.c.
- * call.c (build_over_call): Convert builtin abs, labs and fabs to
- tree-codes.
- * decl.c (init_decl_processing): Re-enable abs, labs and fabs as
- builtins.
+ * cp-tree.h (LOCAL_CLASS_P): New macro.
+ * class.c (finish_struct_1): Use it.
-Fri Feb 13 01:36:42 1998 Jason Merrill <jason@yorick.cygnus.com>
+2000-08-27 Alex Samuel <samuel@codesourcery.com>
+
+ * mangle.c (CLASSTYPE_TEMPLATE_ID_P): Remove unexplained voodoo.
+ (write_encoding): Pass another argument to write_name.
+ (write_name): Add ignore_local_scope parameter. Fix handling of
+ local names.
+ (write_nested_name): Use write_unqualified_name.
+ (write_prefix): Likewise. Skip out on FUNCTION_DECLs.
+ (write_template_prefix): Use write_unqualified_name.
+ (write_component): Remove.
+ (write_local_name): Add parameter. Use direct local entity to
+ discriminator calculation.
+ (write_class_enum_type): Pass another argument to write_name.
+ (write_template_template_arg): Likewise.
+ (make_guard_variable): Likewise.
+
+2000-08-27 Jason Merrill <jason@redhat.com>
+
+ * decl.c (pushdecl): Matching decls for local externs are found in
+ the current level. Propagate linkage information from previous
+ declarations.
- * call.c (standard_conversion): A BASE_CONV replaces an RVALUE_CONV.
+2000-08-26 Gabriel Dos Reis <gdr@codesourcery.com>
-Fri Feb 13 00:21:59 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * ir.texi (Expressions): Fix typo.
- * cp-tree.h: Add access_protected_virtual_node.
- * class.c (init_class_processing): Initialize it.
- * decl.c (xref_basetypes): Use it.
- * parse.y (base_class_access_list): Likewise.
+2000-08-25 Greg McGary <greg@mcgary.org>
- * Make-lang.in (DEMANGLER_PROG): Add $(exeext).
- (c++.install-common): Install c++filt.
+ * tree.c (init_tree): Use ARRAY_SIZE.
-Thu Feb 12 12:46:51 1998 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+2000-08-25 Gabriel Dos Reis <gdr@codesourcery.com>
- * decl.c (shadow_tag): Give error for typedef-ing built-in types.
+ * error.c (cp_tree_printer): Rework.
-Wed Feb 11 23:28:05 1998 Mark Mitchell <mmitchell@usa.net>
+2000-08-25 Mark Mitchell <mark@codesourcery.com>
- * call.c (reference_binding): Use comptypes when comparing
- TYPE_MAIN_VARIANTS to handle non-canonical array/index types.
+ * Make-lang.in (CXX_LIB2FUNCS): Remove cp-demangle.o and
+ dyn-string.o.
+ (CXX_LIB2SRCS): Remove cp-demangle.c and dyn-string.c.
+ (cp-demangle.o): Remove target.
+ (dyn-string.o): Likewise.
-Wed Feb 11 16:42:04 1998 Mark Mitchell <mmitchell@usa.net>
+ * decl.c (grokfndecl): Require that `main' return an `int'.
+ * mangle.c (write_encoding): Don't mangle return types for
+ conversion functions.
- * tree.c (is_overloaded_fn): Use really_overloaded_fn.
- (really_overloaded_fn): Move check here from is_overloaded_fn.
- (get_first_fn): Use really_overloaded_fn and is_overloaded_fn.
+2000-08-25 Gabriel Dos Reis <gdr@codesourcery.com>
-Wed Feb 11 15:54:18 1998 Mark Mitchell <mmitchell@usa.net>
+ * error.c (tree_formatting_info): New data type.
+ (tree_being_formatted): New macro.
+ (tree_formatting_flags): Likewise.
+ (put_whitespace): Likewise.
+ (print_tree_identifier): Likewise.
+ (print_identifier): Likewise.
+ (cp_tree_printer, print_function_argument_list, print_declaration,
+ print_expression, print_function_declaration,
+ print_function_parameter, print_type, print_cv_qualifier): New
+ functions.
+ (init_error): Initialize lang_printer.
- * typeck.c (build_ptrmemfunc): Type-check pointer-to-member
- conversions.
+2000-08-24 Jason Merrill <jason@redhat.com>
-Mon Feb 9 22:23:31 1998 Mark Mitchell <mmitchell@usa.net>
-
- * cp-tree.h (push_template_decl): Return the decl passed in, or an
- equivalent duplicate.
- * decl.c (pushtag): Use the return value from push_template_decl.
- (duplicate_decls): When duplicating a template declaration, merge
- the DECL_TEMPLATE_RESULTs as well.
- (make_implicit_typename): Don't try to dive into typename types to
- find a context for making a new implicit typename.
- (start_decl): Use the return value from push_template_decl.
- (grokdeclarator): Complain about declarations list `const operator
- int'. Since we don't correctly handle in-class initializations of
- non-static data members, complain about this (now illegal)
- practice. Issue an error for initializations of non-const statics
- since that is illegal as well, and since we don't handle that case
- correctly either.
- (start_function): Use the return value from push_template_decl.
- (start_method): Likewise.
- * decl2.c (grokfield): Likewise. Since the change to
- grokdeclarator ensures that all initialized fields are in fact
- static, remove a redundant test for TREE_PUBLIC.
- * parse.y (initlist): Disable labeled initializers since they do
- not work as per the documentation, and since they do not use the
- same syntax as the C front end.
- * pt.c (push_template_decl): Return the decl passed in, or an
- equivalent duplicate.
- (lookup_template_class): When searching in a nested context,
- use the right arguments.
- (uses_template_parms): Handle the DECL_INITIAL for a CONST_DECL.
- * typeck.c (build_component_ref): Assign the correct type to the
- result of build_vfn_ref.
+ * typeck.c (build_ptrmemfunc): Just reinterpret if there's no
+ adjustment necessary.
-Tue Feb 10 23:56:46 1998 Jason Merrill <jason@yorick.cygnus.com>
+2000-08-24 Greg McGary <greg@mcgary.org>
- * pt.c (convert_nontype_argument): Fix typo.
- (check_explicit_specialization): Allow old-style specialization
- of class template members.
+ * cp-tree.h (MAIN_NAME_P): Remove macro.
-Tue Feb 10 20:36:52 1998 Jason Merrill <jason@yorick.cygnus.com>
- Manfred Hollstein <manfred@s-direktnet.de>
+2000-08-24 Gabriel Dos Reis <gdr@codesourcery.com>
- * decl.c (grokdeclarator): Use DECL_USE_TEMPLATE instead
- when deciding to override DECL_ASSEMBLER_NAME.
+ * error.c (print_instantiation_context): Don't forget to flush the
+ buffer.
-Tue Feb 10 15:30:55 1998 Andrew MacLeod <amacleod@torpedo.to.cygnus.com>
+2000-08-23 Jason Merrill <jason@redhat.com>
- * decl2.c (lang_f_options): Add -fsquangle to option processing list.
- * cp-tree.h (flag_do_squangling): Add declaration.
- * lang-options.h: Add -fsquangle and -fno-squangle.
- * method.c: Add macros and static variables for squangling.
- (build_overload_name): Rename to build_mangled_name, add logic for B
- compression, and split into process_modifiers and
- process_overload_item.
- (process_modifiers): New function, to handle constant, reference,
- and pointer types.
- (process_overload_item): New function, handles issue of type codes.
- (build_overload_name): New function, start squangling and call
- build_mangled_name.
- (ALLOCATE_TYPEVEC, DEALLOCATE_TYPEVEC): Remove macro and expand inline.
- (start_squangling): New function to initialize squangling structs.
- (end_squangling): New function to destroy squangling structs.
- (nrepeats): Rename variable to Nrepeats.
- (issue_nrepeats): New function for issuing 'n' type repeats.
- (check_ktype): New function to check for type K name compression.
- (build_overload_nested_name): Add a check for K name compression.
- (build_qualified_name): Add a check for K name compression and don't
- use DECL_ASSEMBLER_NAME when squangling is on.
- (check_btype): New function, checks for B type compression.
- (build_static_name, build_decl_overload_real): Initiate squangling.
- (build_typename_overload, build_overload_with_type): Initiate
- squangling
+ * typeck.c (build_ptrmemfunc): Save the input pmf.
-Sun Feb 8 23:47:38 1998 scott snyder <sss@d0linux01.fnal.gov>
+ * method.c (process_modifiers): Use same_type_p.
- * method.c (make_thunk): Avoid name buffer overflow.
+2000-08-23 Mark Mitchell <mark@codesourcery.com>
-Sat Feb 7 16:48:54 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (DECL_CLONED_FUNCTION_P): Check DECL_LANG_SPECIFIC.
+ * mangle.c (write_function_type): Change prototype.
+ (write_encoding): Don't mangle return types for
+ constructors or destructors.
+ (write_type): Adjust call to write_function_type.
+ * pt.c (instantiate_template): Instantiate alternate entry points
+ when instantiating the main function.
- * pt.c (instantiate_decl): Call cp_finish_decl for vars even if we
- don't define them yet.
+2000-08-23 Gabriel Dos Reis <gdr@codesourcery.com>
- * parse.y (nomods_initdcl0): Add constructor_declarator case.
+ * error.c (cp_print_error_function): Don't use embedded '\n' in
+ output_printf.
-Fri Feb 6 21:32:25 1998 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+2000-08-23 Gabriel Dos Reis <gdr@codesourcery.com>
- * config-lang.in (diff_excludes): Use basename only.
+ * decl.c (init_decl_processing): Remove bogus initialization.
+ * error.c (lang_print_error_function): Restore here.
+ (init_error): Initialize print_error_function.
-Thu Feb 5 19:10:40 1998 Jason Merrill <jason@yorick.cygnus.com>
+2000-08-22 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
- * tinfo2.cc: Add tinfo for signed char.
+ * decl2.c (arg_assoc): Revert my 2000-08-11 change.
-Thu Feb 5 14:38:23 1998 Mike Stump <mrs@wrs.com>
+2000-08-22 Gabriel Dos Reis <gdr@codesourcery.com>
- * search.c (compute_access): Handle protected constructors in derived
- classes as accessible.
+ * Makefile.in (error.o): Depends on diagnostic.h
-Wed Feb 4 01:26:49 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (problematic_instantiation_changed,
+ record_last_problematic_instantiation, current_instantiation,
+ print_instantiation_context): Declare.
+ (maybe_print_template_context): Remove.
- * expr.c (cplus_expand_expr, PCC_STATIC_STRUCT_RETURN code):
- Call convert_from_reference sooner.
+ * decl.c (init_decl_processing): Set print_error_function to NULL.
+ (lang_print_error_function): Remove, since we're using a new
+ machinery.
-Tue Feb 3 23:50:52 1998 Mark Mitchell <mmitchell@usa.net>
+ * error.c: #include diagnostic.h
+ (function_category): New function.
+ (cp_diagnostic_starter): Likewise.
+ (cp_diagnostic_finalizer): Likewise.
+ (cp_print_error_function): Likewise.
+ (maybe_print_instantiation_context): Likewise.
+ (print_instantiation_full_context): Likewise.
+ (print_instantiation_partial_context): Likewise.
+ (print_instantiation_context): Define.
+ (init_error): Initialize diagnostic pager and finalizer.
- * cvt.c (ocp_convert): Obtain the constant values from constant
- decls even if the destination type is the same as the type of the
- decl.
+ * pt.c (problematic_instantiation_changed): Define.
+ (record_last_problematic_instantiation): Likewise.
+ (current_instantiation): Likewise.
+ (maybe_print_template_context): Remove.
+ (print_template_context): Likewise.
+ (current_tinst_level): Make static to reflect Brendan Kehoe's
+ change of 1995-04-13.
+ (push_tinst_level): Call print_instantiation_context.
- * decl2.c (finish_file): Make sure that static inlines with
- definitions are not marked DECL_EXTERNAL before returning.
+2000-08-21 Nix <nix@esperi.demon.co.uk>
-Tue Feb 3 22:43:42 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * lang-specs.h: Do not process -o or run the assembler if
+ -fsyntax-only.
- * decl.c: Lose arg_looking_for_template.
- (lookup_name_real): Likewise.
- * parse.y: Lose processing_template_arg, template_arg1.
- (primary): Likewise.
- * spew.c (yylex): Set lastiddecl for PTYPENAMEs, too.
+2000-08-21 Joseph S. Myers <jsm28@cam.ac.uk>
-Tue Feb 3 22:04:01 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
+ * decl.c (flag_hosted, flag_noniso_default_format_attributes): New
+ variables.
+ * decl2.c (lang_decode_option): Disable gettext attributes for
+ -ansi.
- * error.c (dump_decl): Fix type of default arguments for template
- template parameters and nontype template parameters.
- * parse.y (template_parm): Handle invalid default template
- template arguments here.
+2000-08-21 Gabriel Dos Reis <gdr@codesourcery.com>
- * parse.y (template_parm): Use template_arg instead of PTYPENAME
- for default template template argument.
- * pt.c (coerce_template_parms): Merge default template argument
- codes. Can treat RECORD_TYPE as template name if it is implicitly
- created. Fix argument index in error message.
- * typeck.c (comptypes): Merge template argument comparison codes in
- TEMPLATE_TEMPLATE_PARM and RECORD_TYPE.
+ * lex.c (lang_init_options): Default diagnostic message maximum
+ length to 80, when line-wrapping.
-Tue Jan 6 01:42:44 1998 Mumit Khan <khan@xraylith.wisc.edu>
+2000-08-20 Mark Mitchell <mark@codesourcery.com>
- * lex.c (file_name_nondirectory): Also check for '/'.
+ * class.c (build_vtbl_initializer): Clear the entire
+ vtbl_init_data. Start keeping track of the functions for which we
+ have created vcall offsets here.
+ (dfs_build_vcall_offset_vtbl_entries): Remove.
+ (build_vcall_offset_vtbl_entries): Reimplement.
+ (add_vcall_offset_vtbl_entries_r): New function.
+ (add_vcall_offset_vtbl_entries_1): Likewise. Tweak logic for
+ computing when vcall offsets are necessary.
-Mon Feb 2 11:24:22 1998 Mark Mitchell <mmitchell@usa.net>
+2000-08-18 Nathan Sidwell <nathan@codesourcery.com>
- * parse.y (primary): Deal with statement-expressions in
- templates.
- * pt.c (tsubst_copy): Handle BIND_EXPR.
- * tree.c (mapcar): Likewise.
-
- * call.c (add_template_candidate_real): Pass extra parameter to
- fn_type_unification.
- * cp-tree.h (fn_type_unification): Add parameter.
- * pt.c (fn_type_unification): Add additional parameter to deal with
- static member functions.
- (get_bindings): Deal with static member functions.
-
- * cp-tree.h (DECL_NONSTATIC_MEMBER_FUNCTION_P): New macro.
- (revert_static_member_fn): Declare.
- * decl.c (revert_static_member_fn): Remove declaration. Change
- linkage from internal to external.
- (cp_finish_decl): Deal with virtual functions in classes local to
- template functions.
- * decl2.c (finish_file): Don't forget to emit increment/decrement
- expressions in initializers for file-scope variables.
- * parse.y (typename_sub2): If the typename doesn't names a
- template, rather than a type, issue an error message.
- * pt.c (check_explicit_specialization): Handle specializations of
- static member functions.
- (coerce_template_parms): Handle offset references to lists of
- member functions.
- * search.c (note_debug_info_needed): Don't crash when handed a
- type which is being defined.
- * typeck.c (complete_type): Don't crash when handed NULL_TREE;
- that can happen with some illegal code.
-
-Mon Feb 2 00:57:38 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * call.c (user_harshness): Initialize `code' to 0.
- (build_method_call): Initialize `candidates', `cp' and `len' to 0.
- (null_ptr_cst_p): Add parentheses around && within ||.
- (standard_conversion): Likewise.
- (z_candidate): Likewise.
- (build_user_type_conversion_1): Initialize `args' to NULL_TREE.
- (build_object_call): Likewise for `mem_args'.
- (build_new_op): Likewise for `mem_arglist'. Add `return' from
- default case in enumeration switch.
-
- * class.c (build_vtable_entry): Add explicit braces to avoid
- ambiguous `else'.
- (build_class_init_list): Likewise.
- (finish_struct_1): Initialize `width' to 0.
- (instantiate_type): Initialize `name' to NULL_TREE. Add
- explicit braces to avoid ambiguous `else'.
-
- * cvt.c (convert_to_aggr): Add explicit braces to avoid ambiguous
- `else'.
-
- * decl.c (grok_reference_init): Eliminate unused parameter, all
- callers changed.
- (record_builtin_type): Initialize `tdecl' to NULL_TREE.
- (init_decl_processing): Initialize `vb_off_identifier' to NULL_TREE.
- (cp_finish_decl): Initialize `ttype' to NULL_TREE.
- (grokdeclarator): Add parentheses around && within ||. Add
- explicit braces to avoid ambiguous `else'.
- (grokparms): Initialize `type' to NULL_TREE.
- (xref_tag): Remove unused label `just_return'.
- (finish_enum): Initialize `minnode' and `maxnode' to NULL_TREE.
- (finish_function): Initialize `cond' and `thenclause' to NULL_TREE.
- (hack_incomplete_structures): Add parentheses around assignment
- used as truth value.
-
- * decl2.c (coerce_delete_type): Hide definition of `e3'.
-
- * error.c: Include <stdlib.h>.
- (dump_expr): Change the type of `i' to size_t. Remove unused
- label `error'.
-
- * except.c (init_exception_processing): Remove unused variable `d'.
- (expand_throw): Likewise for `label'.
-
- * friend.c (add_friends): Add explicit braces to avoid ambiguous
- `else'.
-
- * init.c (sort_member_init): Initialize `last_field' to NULL_TREE.
- (sort_base_init): Likewise for `binfo'.
- (expand_member_init): Likewise for `rval'.
- (build_member_call): Add parentheses around assignment used as
- truth value.
- (build_offset_ref): Add explicit braces to avoid ambiguous `else'.
- (build_new): Initialize `nelts' to NULL_TREE. Initialize
- `old_immediate_size_expand' to 0.
- (build_new_1): Initialize `nelts' and `alloc_node' to NULL_TREE.
- (build_vec_delete_1): Remove unused variable `block'.
- (expand_vec_init): Initialize `itype' to NULL_TREE.
-
- * lex.c: Include <strings.h> if we don't have <string.h>. Protect
- declaration of `index' and `rindex' with autoconf macros.
- (reinit_parse_for_expr): Remove unused variables
- `look_for_semicolon' and `look_for_lbrac'.
- (cons_up_default_function): Initialize `args' to NULL_TREE.
- (readescape): Initialize `firstdig' to 0.
- (real_yylex): Add parentheses around assignment used as truth value.
-
- * method.c: Include <strings.h> if we don't have <string.h>.
- Protect declaration of `index' with autoconf macro.
-
- * parse.y (primary): Add explicit braces to avoid ambiguous `else'.
- Initialize `type' to NULL_TREE.
- (structsp): Remove unused variable `id'.
-
- * pt.c (coerce_template_parms): Add explicit braces to avoid
- ambiguous `else'.
- (lookup_template_class): Initialize `template' to NULL_TREE.
- (instantiate_class_template): Remove unused variable `name' and `e'.
- (tsubst): Likewise for `i'. Initialize `last' to NULL_TREE.
- (do_poplevel): Initialize `saved_warn_unused' to 0.
- (type_unification): Remove unused varable `parm'.
- (unify): Likewise for `j'.
-
- * repo.c (init_repo): Add parentheses around assignment used as
- truth value.
- (finish_repo): Remove unused varable `p'.
-
- * search.c (get_binfo): Initialize `type' to NULL_TREE.
- (get_base_distance): Likewise.
- (lookup_field): Initialize `rval_binfo_h', `type', `basetype_path'
- and `new_v' to NULL_TREE.
- (lookup_fnfields): Likewise for `rval_binfo_h'.
- (breadth_first_search): Add parentheses around assignment used as
- truth value.
- (get_template_base): Initialize `type' to NULL_TREE.
-
- * sig.c (append_signature_fields): Initialize `last_mfptr' to
- NULL_TREE.
- (build_signature_table_constructor): Likewise for
- `last_rhs_field', `pfn' and `vt_off'.
- (build_sigtable): Likewise for `init'.
-
- * tree.c (break_out_calls): Initialize `t2' to NULL_TREE.
- (propagate_binfo_offsets): Likewise for `delta'.
- (hash_tree_cons): Initialize hashcode to 0.
- (can_free): Likewise for `size'.
- (cp_tree_equal): Add explicit braces to avoid ambiguous `else'.
-
- * typeck.c (convert_sequence): Hide prototype.
- (common_type): Add explicit braces to avoid ambiguous `else'.
- (comp_target_types): Likewise.
- (build_x_function_call): Initialize `ctypeptr' to NULL_TREE.
- (build_function_call_real): Add explicit braces to avoid ambiguous
- `else'.
- (convert_arguments): Initialize `called_thing' to 0.
- (convert_for_initialization): Initialize `savew' and `savee' to 0.
-
- * typeck2.c (incomplete_type_error): Initialize `errmsg' to 0.
- (digest_init): Initialize `old_tail_contents' to NULL_TREE.
- (build_x_arrow): Likewise for `last_rval'.
-
- * xref.c (GNU_xref_decl): Initialize `cls' to 0.
-
-Sun Feb 1 12:45:34 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * decl.c (init_decl_processing): Use set_sizetype.
- * decl2.c (sizetype): Don't declare.
- * typeck.c (c_sizeof): Convert result of *_DIV_EXPR to sizetype.
- (c_sizeof_nowarn, build_binary_op_nodefault): Likewise.
- (build_component_addr, unary_complex_lvalue): Likewise.
- * rtti.c (expand_class_desc): Likewise.
- * class.c (get_vfield_offset): Likewise.
+ * decl.c (member_function_or_else): Use cp_error ... %T.
+ (grokdeclarator): Likewise.
+ (start_method): Likewise.
+ * friend.c (make_friend_class): Use cp_pedwarn ... %T.
+
+2000-08-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl2.c (grokfield): Set CLASSTYPE_GOT_SEMICOLON on class
+ TYPE_DECLs.
+
+2000-08-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (PTRMEM_OK_P): New macro.
+ (itf_ptrmem_ok): New enumeration value.
+ * class.c (resolve_address_of_overloaded_function): Add PTRMEM
+ argument. Diagnose implicit pointer to member.
+ (instantiate_type): Don't diagnose implicit pointer to member
+ here. Pass itf_ptrmem_ok if ok. Adjust calls to
+ resolve_address_of_overloaded_function.
+ * init.c (build_offset_ref): Set PTRMEM_OK_P.
+ (resolve_offset_ref): Don't diagnose implicit pointer to member here.
+ * semantics.c (finish_parenthesized_expr): Clear OFFSET_REFs here.
+ * typeck.c (build_x_unary_op): Calculate PTRMEM_OK_P.
+ (build_unary_op): Deal with single non-static member in
+ microsoft-land.
+
+2000-08-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl2.c (arg_assoc_type): Cope with TYPENAME_TYPE.
+
+2000-08-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (enum_name_string): Remove prototype.
+ (report_case_error): Remove prototype.
+ * cp/typeck2.c (enum_name_string): Remove.
+ (report_case_error): Remove.
+ * error.c (dump_expr): Deal with enum values directly.
+ Correctly negate integer constant.
+
+2000-08-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * inc/cxxabi.h (__cxa_vec_new2, __cxa_vec_new3): Declare.
+ (__cxa_vec_delete2, __cxa_vec_delete3): Declare.
+ * vec.cc (__cxa_vec_new2, __cxa_vec_new3): Implement.
+ (__cxa_vec_delete2, __cxa_vec_delete3): Implement.
+ (__cxa_vec_new): Use __cxa_vec_new2.
+ (__cxa_vec_delete): Use __cxa_vec_delete2.
+
+2000-08-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * vec.cc (__cxa_vec_new): Set "C" linkage.
+ (__cxa_vec_ctor): Likewise.
+ (__cxa_vec_cctor): Likewise.
+ (__cxa_vec_dtor): Likewise.
+ (__cxa_vec_delete): Likewise.
+ * inc/cxxabi.h (__cxa_vec_new): Set "C" linkage.
+ (__cxa_vec_ctor): Likewise.
+ (__cxa_vec_cctor): Likewise.
+ (__cxa_vec_dtor): Likewise.
+ (__cxa_vec_delete): Likewise.
+
+2000-08-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (instantiate_type): Reinstate local variable
+ deleted in previous change.
+
+ * cvt.c (cp_convert_to_pointer): Pass itf_complain, not
+ itf_no_attributes.
+
+2000-08-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (instantiate_type_flags): New enumeration.
+ (instantiate_type): Change parameter.
+ * class.c (instantiate_type): Adjust prototype. Adjust.
+ * call.c (standard_conversion): Adjust instantiate_type call.
+ (reference_binding): Likewise.
+ (build_op_delete_call): Likewise.
+ (convert_like_real): Likewise.
+ * cvt.c (cp_convert_to_pointer): Likewise.
+ (convert_to_reference): Likewise.
+ * pt.c (convert_nontype_argument): Likewise.
+ * typeck.c (build_binary_op): Likewise.
+ (build_ptrmemfunc): Likewise.
+ (convert_for_assignment): Likewise.
-Thu Jan 29 10:39:30 1998 Mark Mitchell <mmitchell@usa.net>
+2000-08-17 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (convert_nontype_argument): Move check for is_overloaded_fn
- early to avoid bogus error. Handle overloaded function
- names provided as template arguments correctly.
- (coerce_template_parms): Don't mishandle overloaded functions when
- dealing with template template parameters.
- (lookup_template_class): Issue an error message, rather than
- crashing, when the TYPE_DECL provided is not a template type.
+ * cp-tree.h (CPTR_AGGR_TAG): New global tree node.
+ (current_aggr): Define.
+ * decl.c (grokdeclarator): Make sure a friend class is an
+ elaborated type specifier.
+ * parse.y (current_aggr): Remove static definition.
+ (cp_parse_init): Adjust.
+ (structsp): Clear and restore current_aggr.
+ (component_decl_list): Clear current_aggr.
-Wed Jan 28 23:14:44 1998 Jason Merrill <jason@yorick.cygnus.com>
+ * error.c (dump_type, case TYPENAME_TYPE): Don't emit the
+ aggregate tag on the typename's context.
- * class.c (instantiate_type): Don't just return a known type if
- it's wrong.
+ * pt.c (tsubst_friend_class): Return error_mark_node, if
+ parms becomes NULL.
+ (instantiate_class_template): Ignore error_mark_node friend types.
-Wed Jan 28 11:04:07 1998 Mark Mitchell <mmitchell@usa.net>
+2000-08-14 Nathan Sidwell <nathan@codesourcery.com>
- * class.c (instantiate_type): Remove handling of FUNCTION_DECL
- since that code could never be reached.
+ * cvt.c (warn_ref_binding): New static function, broken out of ...
+ (convert_to_reference): ... here. Use it.
- * error.c (dump_decl): Avoid aborting in the midst of printing an
- error message about an illegal template declaration.
+2000-08-11 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
- * parse.y (structsp): Print an error message, rather than crashing,
- when a class-head does not name a class.
+ * parse.y (template_arg): Add rule for template qualified with
+ global scope.
- * pt.c (convert_nontype_argument): Allow REAL_TYPE and COMPLEX_TYPE
- template arguments as a g++ extension.
+2000-08-11 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
- * cp-tree.def (ALIGNOF_EXPR): New tree code.
- * decl2.c (grok_alignof): If processing_template_decl, just store
- the expression.
- * typeck.c (c_alignof): Likewise.
- * decl2.c (build_expr_from_tree): Handle ALIGNOF_EXPR.
- * error.c (dump_expr): Likewise.
- * pt.c (tsubst_copy): Likewise.
- * tree.c (cp_tree_equal): Likewise.
- * pt.c (uses_template_parms): Correctly determine whether or not a
- SIZEOF_EXPR/ALIGNOF_EXPR uses template parameters so that constant
- folding can be done.
-
- * cp-tree.h (grok_enum_decls): Remove type parameter.
- * decl.c (grok_enum_decls): Likewise.
- * decl2.c (grok_x_components): Call grok_enum_decls
- unconditionally, since it will do nothing if there is no
- current_local_enum. Use the new calling sequence.
- * pt.c (tsubst_enum): Use the new calling sequence for
- grok_enum_decls.
-
- * decl.c (start_function): Make member functions of local classes
- in extern inline functions have comdat linkage here...
- (grokdeclarator): Rather than here.
-
-Wed Jan 28 10:55:47 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (convert_nontype_argument): Use decl_constant_value.
-
-Tue Jan 27 16:42:21 1998 Mark Mitchell <mmitchell@usa.net>
-
- * call.c (add_template_candidate_real): New function.
- (add_template_candidate): Use it.
- (add_template_conv_candidate): Likewise.
- (joust): Pass extra argument to more_specialized.
- * class.c (instantiate_type): Handle a single FUNCTION_DECL.
- (is_local_class): Remove.
- (finish_struct): Check TI_PENDING_SPECIALIZATION_FLAG.
- * cp-tree.h (is_local_class): Remove.
- (perform_array_to_pointer_conversion): Likewise.
- (finish_member_template_decl): Add.
- (check_explicit_specialization): Return a tree, not an int.
- (more_specialized): Take additional argument.
- (get_bindings): Likewise.
- (TI_PENDING_SPECIALIZATION_FLAG): New macro.
- * cvt.c (perform_qualification_conversions): Use comp_ptr_ttypes.
- (perform_array_to_pointer_conversion): Remove.
- * decl.c (saved_scope): Add processing_specialization,
- processing_explicit_instantiation fields.
- (maybe_push_to_top_level): Save them.
- (pop_from_top_level): Restore them.
- (grokfndecl): Use new return value from
- check_explicit_specialization.
- (start_decl): Don't check flag_guiding_decls before pushing
- decls.
- (cp_finish_decl): Remove previous (bogus) change.
- (grok_declarator): Use decl_function_context rather than
- is_local_class.
- * decl2.c (finish_file): Pass extra argument to get_bindings.
- (build_expr_from_tree): Let build_x_component_ref check
- validity of arguments rather than doing it here.
- * lex.c (cons_up_default_function): Remove code fooling with
- processing_specialization, processing_explicit_instantiation
- flags, as that is now done in {maybe_push_top,pop_from}_top_level.
- * method.c (build_overload_identifier): Mangle local classes in
- template functions correctly.
- * parse.y (finish_member_template_decl): Move to pt.c.
- * pt.c (finish_member_template_decl): Moved here from parse.y.
- (print_candidates): New function.
- (determine_specialization): Change interface. Properly look for
- most specialized versions of template candidates.
- (check_explicit_specialization): Fully process explicit
- instantiations.
- (push_template_decl): Avoid looking at CLASSTYPE fields in
- FUNCTION_DECLS.
- (determine_overloaded_function): Remove.
- (convert_nontype_argument): Change name from
- convert_nontype_parameter. Use determine_overloaded_function
- instead of instantiate_type.
- (mangle_class_name_for_template): Handle type contexts as well as
- function contexts.
- (classtype_mangled_name): Likewise.
- (lookup_template_class): Likewise.
- (tsubst): Likewise.
- (more_specialized): Take explict template arguments as a
- parameter.
- (most_specialized): Likewise.
- (get_bindings): Likewise. Check that return types match before
- proclaiming a function a match.
- (do_decl_instantiation): Remove code searching for function to
- instantiate; that is now done in check_explicit_specialization.
- (add_maybe_template): Pass extra argument to get_bindings.
- * tree.c (really_overloaded_fn): Use is_overloaded_fn to simplify
- implementation.
- * typeck.c (build_component_ref): Check for invalid arguments.
-
-Tue Jan 27 01:44:02 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * expr.c (cplus_expand_expr, AGGR_INIT_EXPR): Don't check that
- return_target and call_target are equivalent.
-
- * pt.c (type_unification_real): Just accept function parms that
- don't use any template parms.
-
-Sun Jan 25 03:30:00 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (cp_finish_decl): When bailing on a comdat variable, also
- unset DECL_NOT_REALLY_EXTERN.
-
- * parse.y (typename_sub*): Fix std::.
-
-Sat Jan 24 12:13:54 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * error.c (dump_decl): Fix type default template args.
- (dump_type): Hand TEMPLATE_DECL off to dump_decl.
-
-Fri Jan 23 18:34:37 1998 Mumit Khan <khan@xraylith.wisc.edu>
-
- * lex.c (DIR_SEPARATOR): Define to be '/' if not already defined.
- (file_name_nondirectory): Use.
-
-Wed Jan 21 10:29:57 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
-
- * pt.c (coerce_template_parms): Don't access elements of ARGLIST
- that are not really present. Substitute default arguments in
- template template arguments. Correctly convert TEMPLATE_DECL to
- TEMPLATE_TEMPLATE_PARM.
- (comp_template_args): TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM
- are no longer treated specially here.
- * parse.y (template_template_parm): Fix copy error.
- * decl.c (grokdeclarator): Warn about missing `typename' for nested
- type created from template template parameters.
- * parse.y (bad_parm): Likewise
-
- * class.c (finish_struct): Handle TEMPLATE_TEMPLATE_PARM.
- (push_nested_class): Likewise.
- * cp-tree.def (TEMPLATE_TEMPLATE_PARM): New tree code.
- * cp-tree.h (DECL_TEMPLATE_TEMPLATE_PARM_P): New macro.
- (copy_template_template_parm): Declare.
- * decl.c (arg_looking_for_template): New variable.
- (lookup_name_real): Handle TEMPLATE_TEMPLATE_PARM.
- Try to return TEMPLATE_DECL or TEMPLATE_TEMPLATE_PARM
- node if arg_looking_for_template is nonzero.
- (pushdecl): Handle TEMPLATE_TEMPLATE_PARM.
- (grok_op_properties, xref_tag, xref_basetypes): Likewise.
- (grokdeclarator): Handle TEMPLATE_DECL.
- * decl2.c (constructor_name_full): Handle TEMPLATE_TEMPLATE_PARM.
- * error.c (dump_type): Add TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM.
- (dump_type_prefix, dump_type_suffix): Handle TEMPLATE_TEMPLATE_PARM.
- (dump_decl): Handle unnamed template type parameters.
- Handle template template parameters.
- (dump_function_name): Handle template template parameters.
- * init.c (is_aggr_typedef, is_aggr_type, get_aggr_from_typedef):
- Handle TEMPLATE_TEMPLATE_PARM.
- * method.c (build_template_template_parm_names): New function.
- (build_template_parm_names): Handle TEMPLATE_DECL.
- (build_overload_nested_name, build_overload_name):
- Handle TEMPLATE_TEMPLATE_PARM.
- * parse.y (maybe_identifier): New nonterminal.
- (template_type_parm): Use it.
- (template_template_parm, template_arg1): New nonterminal.
- (template_parm): Add template_template_parm rules.
- (template_arg): Set processing_template_arg.
- (template_arg1): Rules moved from template_arg.
- (primary, nonnested_type): Set arg_looking_for_template if we are
- processing template arguments.
- * pt.c (begin_member_template_processing): Handle TEMPLATE_DECL.
- (process_template_parm): Handle template template parameters.
- (coerce_template_parms, comp_template_args): Likewise.
- (mangle_class_name_for_template, lookup_template_class): Likewise.
- (uses_template_parms): Handle TEMPLATE_DECL and
- TEMPLATE_TEMPLATE_PARM.
- (current_template_args): Handle TEMPLATE_DECL.
- (tsubst, tsubst_copy, unify): Handle TEMPLATE_TEMPLATE_PARM.
- * search.c (dfs_walk, dfs_record_inheritance):
- Handle TEMPLATE_TEMPLATE_PARM.
- * tree.c (copy_template_template_parm): New function.
- (mapcar): Handle TEMPLATE_TEMPLATE_PARM.
- * typeck.c (comptypes): Handle TEMPLATE_TEMPLATE_PARM.
-
-Mon Jan 19 22:40:03 1998 Mark Mitchell <mmitchell@usa.net>
-
- * decl.c (start_decl): Don't allow duplicate definitions of static
- data members.
-
- * call.c (build_user_type_conversion_1): Handle user-defined
- template conversion operators correctly.
-
- * decl2.c (build_expr_from_tree): Issue an error message if the
- object in a COMPONENT_REF is a TEMPLATE_DECL.
-
- * typeck.c (incomplete_type_error): Handle TEMPLATE_TYPE_PARMs.
-
- * class.c (is_local_class): New function.
- * cp-tree.h (is_local_class): Declare it.
- (last_tree): Likewise.
- (begin_tree): Likewise.
- (end_tree): Likewise.
- (lookup_template_class): Change prototype.
- * decl.c (cp_finish_decl): Check for NULL where necessary.
- Consider FUNCTION_DECLS to declare objects with top-level binding,
- when calling make_decl_rtl.
- (grokdeclarator): Give members of local classes internal linkage.
- (start_function): Remove declaration of last_tree.
- (finish_function): Set flag_keep_inline_functions around call to
- rest_of_compilation if we are processing a member function in a
- local class.
- (start_method): Call push_template_decl for member functions of
- local classes in template functions.
- * decl2.c (import_export_decl): Don't give external linkage to
- instantiations of templates with internal linkage.
- * parse.y (last_tree): Remove declaration.
- (template_type): Pass extra parameter to lookup_template_class.
- (self_template_type): Likewise.
- (structsp): Move call to reset_specialization into left_curly.
- (left_curly): Call reset_specialization, and begin_tree.
- * pt.c (saved_trees): New variable.
- (mangle_class_name_for_template): Change prototype. Use
- additional function context to name local classes in templates
- correctly.
- (classtype_mangled_name): Pass the context.
- (push_template_decl): Handle local classes and templates, and
- member functions for such classes.
- (convert_nontype_parameter): Fix handling of pointer-to-member
- constants.
- (lookup_template_class): Handle local classes in templates.
- (tsubst): Likewise. Don't assume that template instantiations
- have external linkage; pay attention to the template declaration.
- (mark_decl_instantiated): Likewise.
- (begin_tree): New function.
- (end_tree): Likewise.
-
- * decl.c (xref_basetypes): Don't call complete_type for basetypes
- that involve template parameters; that can lead to infinite
- recursion unnecessarily.
-
- * pt.c (register_specialization): Do not register specializations
- that aren't ready to be registered yet.
- (check_explicit_specialization): Handle explicit specialization of
- constructors and destructors.
- (build_template_decl): New function.
- (push_template_delc): Handle out-of-class specializations of
- member templates.
-
- * pt.c (check_explicit_specialization): Set up the template
- information before registering the specialization.
- (coerce_template_parms): Fix thinko.
- (tsubst): Handle specializations of member templates correctly.
-
- * class.c (finish_struct_methods): Remove calls to
- check_explicit_specialization from here.
- (finish_struct): And insert them here.
- * cp-tree.h (perform_qualification_conversions): New function.
- (perform_array_to_pointer_conversion): Likewise.
- (begin_explicit_instantiation): Likewise.
- (end_explicit_instantiation): Likewise.
- (determine_specialization): Renamed from
- determine_explicit_specialization.
- (comp_template_parms): New function.
- (processing_explicit_instantiation): New variable.
- * cvt.c (perform_qualification_conversions): New function.
- (perform_array_to_pointer_conversion): Likewise.
- * decl.c (duplicate_decls): Don't consider template functions
- alike unless they have the same parameters. Refine handling of
- instantiation/specialization mismatches.
- (start_decl): Don't call pushdecl for template specializations,
- since they don't affect overloading.
- (start_function): Likewise.
- (grokfndecl): Call check_explicit_specialization a little later.
- Don't call duplicate_decls for memberm template specializations.
- (grokdeclarator): Don't update template_count for classes that are
- themselves specializations. Remove use of `2' as parameter to
- grokfndecl since that value isn't used.
- * lex.c (cons_up_default_function): Save and restore
- processing_explicit_instantiation around calls to grokfield.
- * parse.y (finish_member_template_decl): New function.
- (component_decl_1): Use it.
- (fn.def2): Likewise.
- (template_arg_list_opt): New nonterminal.
- (template_type): Use it.
- (self_template_type): Likewise.
- (template_id): Likewise.
- (object_template_id): Likewise.
- (notype_template_declarator): Likwise.
- (begin_explicit_instantiation): Likewise.
- (end_explicit_instantiation): Likewise.
- (explicit_instantiation): Use them.
- * pt.c (coerce_template_parms): Add parameters.
- (processing_explicit_instantiation): New variable.
- (convert_nontype_parameter): New function.
- (determine_overloaded_function): Likewise.
- (begin_explicit_instantiation): Likewise.
- (end_explicit_instantiation): Likewise.
- (retrieve_specialization): Likewise.
- (register_specialization): Likewise.
- (processing_explicit_specialization): Removed.
- (determine_specialization): Handle specializations of member
- functions of template class instantiations.
- (check_explicit_specialization): Refine to conform to standard.
- (comp_template_parms): New function.
- (coerce_template_parms): Call convert_nontype_parameter.
- (tsubst): Refine handling of member templates. Use
- register_specialization.
- (instantiate_template): Use retrieve_specialization.
- (do_decl_instantiation): Likewise.
- (instantiate_decl): Likewise.
- (type_unification): Improve handling of explict template
- arguments.
- * tree.c (mapcar): Return error_mark_node, rather than aborting,
- on VAR_DECLS, FUNCTION_DECLS, and CONST_DECLS.
- * typeck.c (build_unary_op): Call determine_specialization, rather
- than determine_explicit_specialization.
-
-Mon Jan 19 13:18:51 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (build_up_reference): A TARGET_EXPR has side effects.
-
-Fri Jan 16 11:40:50 1998 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
-
- * error.c (dump_decl): For enum tags, output the tag, not its value.
-
-1998-01-13 Brendan Kehoe <brendan@cygnus.com>
-
- * decl.c (init_decl_processing): Only call init_rtti_processing
- FLAG_RTTI is set.
-
-Mon Jan 12 01:35:18 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (build_new_1): Split out from build_new.
- (build_new): Just return a NEW_EXPR.
- * expr.c (cplus_expand_expr): Handle NEW_EXPR.
-
- * decl2.c (get_temp_regvar): Tweak.
-
- * cp-tree.h (TREE_CALLS_NEW): Comment out.
- * class.c (resolves_to_fixed_type_p): Remove use.
- * method.c (build_opfncall): Likewise.
- * call.c (build_new_op): Likewise.
-
-Wed Jan 7 23:47:13 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * exception.cc (__eh_alloc, __eh_free): New fns.
- (__cp_push_exception, __cp_pop_exception): Use them.
- (__uncatch_exception): Call terminate here if no exception.
- * except.c (build_terminate_handler): New fn.
- (expand_start_catch_block): Use it.
- (expand_exception_blocks): Likewise.
- (alloc_eh_object): New fn.
- (expand_throw): Use it. Protect exception init with terminate.
- * typeck.c (build_modify_expr): Remove code that ignores trivial
- methods.
-
-Mon Dec 22 11:36:27 1997 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * call.c (add_builtin_candidate): Add default case in enumeration
- switch.
- (build_new_op): Likewise.
- (convert_like): Likewise.
- * cvt.c (build_expr_type_conversion): Likewise.
- * tree.c (real_lvalue_p): Likewise.
- (lvalue_p): Likewise.
- (cp_tree_equal): Likewise.
- * typeck.c (comptypes): Likewise.
- (build_component_ref): Likewise.
- (build_function_call_real): Likewise.
- (build_binary_op_nodefault): Likewise.
- (build_unary_op): Likewise.
- (build_modify_expr): Likewise.
- * typeck2.c (initializer_constant_valid_p): Likewise.
+ * decl2.c (add_function): Reorganize.
+ (arg_assoc): Do not consider function template decls.
-Sun Dec 21 15:59:00 1997 Nick Clifton <nickc@cygnus.com>
+2000-08-11 Jason Merrill <jason@redhat.com>
- * decl2.c (lang_decode_option): Add support for -Wunknown-pragmas.
+ * decl.c (lookup_name_real): Don't forget the TYPENAME_TYPE we're
+ looking inside.
-Thu Dec 18 14:51:50 1997 Mark Mitchell <mmitchell@usa.net>
+2000-08-11 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (coerce_template_parms): Make sure to digest_init if
- possible.
+ * cp-tree.h (resolve_scope_to_name): Remove unused prototype.
+ (lookup_nested_tag): Likewise.
- * decl.c (duplicate_decls): Make the newdecl virtual if the
- olddecl was, just as is done with other attributes of olddecl.
+ * decl2.c (grokfield): Fix comment to reflect many types of _DECLs
+ can be produced.
-Thu Dec 18 14:43:19 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-08-11 Nathan Sidwell <nathan@codesourcery.com>
- * typeck.c (unary_complex_lvalue): Ignore op0 when taking the
- address of an OFFSET_REF.
+ * parse.y (named_complex_class_head_sans_basetype): Remove
+ always true if.
- * cp-tree.def: Add AGGR_INIT_EXPR.
- * error.c, tree.c, typeck.c: Replace uses of NEW_EXPR with
- AGGR_INIT_EXPR where appropriate.
- * expr.c (cplus_expand_expr): Likewise. Simplify.
+2000-08-11 Nathan Sidwell <nathan@codesourcery.com>
- * decl2.c (finish_file): Remove call to register_exception_table.
+ * decl2.c (build_expr_from_tree, case METHOD_CALL_EXPR): Build
+ explicit TEMPLATE_ID_EXPR args.
+ (build_expr_from_tree, case CALL_EXPR): Likewise.
-Wed Dec 17 17:08:52 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+2000-08-11 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (instantiate_class_template): Don't do injection when
- processing_template_decl is true, as pollutes current_binding_level
- for base classes.
+ * decl.c (check_tag_decl): Diagnose typename's which don't
+ declare anything.
-Wed Dec 17 21:17:39 1997 Peter Schmid <schmid@ltoi.iap.physik.tu-darmstadt.de>
+2000-08-10 Nathan Sidwell <nathan@codesourcery.com>
- * pt.c (maybe_fold_nontype_arg): Add prototype.
+ * init.c (build_aggr_init): Reject bogus array initializers
+ early.
-Tue Dec 16 10:31:20 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-08-09 Nathan Sidwell <nathan@codesourcery.com>
- * tree.c (mapcar): Handle TRY_CATCH_EXPR et al.
- * error.c (dump_expr): Likewise.
+ * rtti.c (build_dynamic_cast_1): Set "C" linkage for new abi
+ runtime.
+ * cp/tinfo.cc (__dynamic_cast): Likewise.
+ * cp/inc/cxxabi.h (__dynamic_cast): Likewise.
-Mon Dec 15 12:22:04 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-08-09 Nathan Sidwell <nathan@codesourcery.com>
- * typeck.c (build_function_call_real): Remove "inline called before
- definition" pedwarn.
+ * cvt.c (convert_to_pointer_force): Fix error message when
+ attempting to cast from ambiguous base.
- * pt.c (coerce_template_parms): Use maybe_fold_nontype_arg.
+2000-08-08 Jason Merrill <jason@redhat.com>
-Sun Dec 14 22:34:20 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * pt.c (tsubst_aggr_type): Bail if creating the argvec fails.
+ (tsubst_template_arg_vector): Likewise.
- * cvt.c (cp_convert_to_pointer): Fix base conversion of pm's.
+ * decl2.c (build_anon_union_vars): Choose the largest field; don't
+ assume that one will be as large as the union.
- * pt.c (type_unification_real): Change __null to type void* with
- a warning.
+2000-08-07 Kazu Hirata <kazu@hxi.com>
-Sun Dec 14 20:38:35 1997 Mark Mitchell <mmitchell@usa.net>
+ * cp-tree.h (CLASSTYPE_HAS_PRIMARY_BASE_P): Fix a comment typo.
+ * decl.c (pop_labels): Likewise.
- * call.c (implicit_conversion): Don't call
- build_user_type_conversion_1 with a NULL expr, since it will
- crash.
+2000-08-04 Jeffrey Oldham <oldham@codesourcery.com>
- * pt.c (unify): Don't try to unify array bounds if either array is
- unbounded.
+ * inc/cxxabi.h (__pbase_type_info): Changed member names to match
+ specifications.
+ (__pointer_to_member_type_info): Likewise.
+ (__base_class_info): Likewise.
+ (__class_type_info): Likewise.
+ (__si_class_type_info): Likewise.
+ (__vmi_class_type_info): Likewise.
+ * tinfo.cc (__si_class_type_info::__do_find_public_src):
+ Changed member names to match specifications.
+ (__vmi_class_type_info::__do_find_public_src): Likewise.
+ (__si_class_type_info::__do_dyncast): Likewise.
+ (__vmi_class_type_info::__do_dyncast): Likewise.
+ (__si_class_type_info::__do_upcast): Likewise.
+ (__vmi_class_type_info::__do_upcast): Likewise.
+ * tinfo2.cc (__pbase_type_info::__do_catch): Likewise.
+ (__pbase_type_info::__pointer_catch): Likewise.
+ (__pointer_type_info::__pointer_catch): Likewise.
+ (__pointer_to_member_type_info::__pointer_catch): Likewise.
+
+2000-08-04 Zack Weinberg <zack@wolery.cumb.org>
+
+ * Make-lang.in (cc1plus): Depend on $(BACKEND), not stamp-objlist.
+ * Makefile.in: Add C_OBJS, BACKEND; delete OBJS, OBJDEPS.
+ (cc1plus): Link with $(BACKEND) and $(C_OBJS).
+
+2000-08-04 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (add_method): Change prototype.
+ * class.c (add_method): Remove FIELDS parameter. Add ERROR_P.
+ Don't double the size of the method vector in the error case.
+ (handle_using_decl): Adjust call to add_method.
+ (add_implicitly_declared_members): Likewise.
+ (clone_function_decl): Likewise.
+ * decl2.c (check_classfn): Likewise.
+ * semantics.c (finish_member_declaration): Likewise.
-Fri Dec 12 16:09:14 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-08-04 Joseph S. Myers <jsm28@cam.ac.uk>
- * errfn.c (cp_pedwarn, cp_pedwarn_at, cp_error_at, cp_warning_at):
- Replace extern decls with casts.
+ * decl.c (flag_isoc94): New variable.
- * decl.c (expand_start_early_try_stmts): Don't mess with a sequence.
- Update last_parm_cleanup_insn.
- (store_after_parms): Remove.
- * cp-tree.h: Adjust.
+2000-08-02 Jason Merrill <jason@redhat.com>
-Thu Dec 11 22:18:37 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * pt.c (do_type_instantiation): Add complain parm; don't complain
+ if called recursively.
+ * cp-tree.h, parse.y: Adjust.
- * decl2.c (comdat_linkage): Also set DECL_COMDAT.
- (finish_file): Check DECL_COMDAT instead of weak|one_only.
- (import_export_vtable): Use make_decl_one_only instead of
- comdat_linkage for win32 tweak.
- (import_export_decl): Likewise.
- * pt.c (mark_decl_instantiated): Likewise.
+2000-08-02 Zack Weinberg <zack@wolery.cumb.org>
- * decl2.c (finish_file): Lose handling of templates in pending_statics.
+ * decl2.c: Silently ignore -Wstrict-prototypes; warn about
+ -Wno-strict-prototypes.
-Thu Dec 11 21:12:09 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * g++spec.c: Adjust type of second argument to
+ lang_specific_driver, and update code as necessary.
- * decl2.c (finish_file): Lose call to expand_builtin_throw.
- * except.c (expand_builtin_throw): Remove.
- * cp-tree.h: Remove ptr_ptr_type_node.
- * decl.c: Likewise.
+ * cp-tree.h: Don't prototype min_precision here.
+ (my_friendly_assert): Cast expression to void.
+ * semantics.c (do_poplevel): Initialize scope_stmts.
-Thu Dec 11 20:43:33 1997 Teemu Torma <tot@trema.com>
+2000-08-02 Mark Mitchell <mark@codesourcery.com>
- * decl.c (ptr_ptr_type_node): Define.
- (init_decl_processing): Initialize it.
- * cp-tree.h: Declare it.
- * exception.cc (__cp_exception_info): Use __get_eh_info.
- (__cp_push_exception): Likewise.
- (__cp_pop_exception): Likewise.
+ * cp-tree.h (DECL_NEEDED_P): Tweak.
- From Scott Snyder <snyder@d0sgif.fnal.gov>:
- * except.c (expand_builtin_throw): Use get_saved_pc_ref instead of
- saved_pc.
- (init_exception_processing): Removed saved_pc initialization.
+2000-07-28 Jason Merrill <jason@redhat.com>
-Wed Dec 10 11:04:45 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * lang-specs.h: Use %i in rule for .ii files.
- * pt.c (instantiate_decl): Defer all templates but inline functions.
+2000-07-31 Zack Weinberg <zack@wolery.cumb.org>
-Mon Dec 8 23:17:13 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * lang-specs.h: Rename cpp to cpp0 and/or tradcpp to tradcpp0.
- * init.c (expand_vec_init): Don't fold a list of parameters.
+2000-07-30 Mark Mitchell <mark@codesourcery.com>
- * decl.c (copy_args_p): Handle copy elision for types with virtual
+ Allow indirect primary bases.
+ * cp-tree.h (struct lang_type): Remove vfield_parent. Add
+ primary_base.
+ (CLASSTYPE_VFIELD_PARENT): Remove.
+ (CLASSTYPE_PRIMARY_BINFO): Reimplement.
+ (BINFO_PRIMARY_BINFO): Remove.
+ (CLASSTYPE_HAS_PRIMARY_BASE_P): Reimplement.
+ (BINFO_VBASE_PRIMARY_P): Likewise.
+ (BINFO_PRIMARY_BASE_OF): New macro.
+ (BINFO_INDIRECT_PRIMARY_P): Likewise.
+ (get_primary_binfo): New function.
+ * decl.c (lang_mark_tree): Make lang_type::primary_base.
+ * class.c (vcall_offset_data_s): Rename to ...
+ (vtbl_init_data_s): ... this. Rename primary_p to primary_vtbl_p,
+ and add ctor_vtbl_p.
+ (get_derived_offset): Use get_primary_binfo.
+ (dfs_mark_primary_bases): Adjust handling of virtual primary
bases.
- * call.c (build_over_call): Likewise.
-
-Sun Dec 7 22:38:12 1997 Mark Mitchell <mmitchell@usa.net>
-
- * pt.c (lookup_template_function): Copy the template arguments,
- not just the list containing them, to the permanent obstack.
-
-Sun Dec 7 15:53:06 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * except.c (expand_start_catch_block): suspend_momentary for the
- terminate handler.
-
- * error.c (dump_decl): Handle LOOKUP_EXPR.
-
-Sun Dec 7 15:45:07 1997 Mark Mitchell <mmitchell@usa.net>
-
- * rtti.c (build_dynamic_cast): Copy the cast-to type to the
- permanent obstack if we are processing a template decl.
- * typeck.c (build_static_cast): Likewise.
- (build_const_cast): Likewise.
- (build_reinterpret_cast): Likewise.
-
- * pt.c (coerce_template_parms): Coerce some expressions, even
- when processing_template_decl.
-
-Sun Dec 7 01:46:33 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
-
- * typeck.c (build_binary_op_nodefault, pointer_diff): Symmetric
- handling of pointer difference expressions.
-
- * typeck.c (comp_target_types): Comparison of function/method types
- is independent of nptrs.
-
-Sun Dec 7 01:40:27 1997 Mark Mitchell <mmitchell@usa.net>
-
- * pt.c (tsubst): Avoid creating pointer to reference and
- reference to reference types.
-
-Sat Dec 6 01:29:37 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (do_id): New nonterminal.
- (template_id): Use it.
-
-Fri Dec 5 01:17:34 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (template_id): do_identifier for PFUNCNAMEs, too.
- * spew.c (yylex): Don't do_identifier here.
- * decl2.c (build_expr_from_tree): Revert last change.
-
- * decl2.c (build_expr_from_tree): Expand the name for a method call.
- * parse.y (object_template_id): Don't try to take the DECL_NAME.
-
-Wed Dec 3 20:02:39 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (build_new): Use a TARGET_EXPR instead of SAVE_EXPR for
- alloc_expr.
- * call.c (build_op_delete_call): Adjust.
-
- * except.c (expand_end_catch_block): Lose rethrow region.
- (expand_start_catch_block): Likewise.
- (expand_end_catch_block): Don't expand_leftover_cleanups.
-
-Wed Dec 3 13:24:04 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
-
- * pt.c (tsubst): Remove tree_cons call (places redundant info into
- DECL_TEMPLATE_INSTANTIATION).
-
-Wed Dec 3 11:44:52 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (is_overloaded_fn): Handle getting a fn template.
- (really_overloaded_fn): Likewise.
- * error.c (dump_decl): Handle TEMPLATE_ID_EXPRs better.
- * pt.c (check_explicit_specialization): Tweak.
- (determine_explicit_specialization): Tweak.
-
- * tree.c, cp-tree.h (get_target_expr): New fn.
-
-Wed Dec 3 08:47:27 1997 Paul Eggert <eggert@twinsun.com>
-
- * pt.c (check_explicit_specialization): Fix misspelling in
- diagnostic: `preceeded'.
- * typeck.c (get_delta_difference): Fix misspelling in diagnostic:
- `conversiona'.
-
-1997-12-02 Mark Mitchell <mmitchell@usa.net>
-
- * pt.c (determine_explicit_specialization): Avoid an internal
- error for bad specializations.
-
- * method.c (build_overload_value): Handle SCOPE_REF.
-
-Tue Dec 2 19:18:50 1997 Mike Stump <mrs@wrs.com>
-
- * class.c (prepare_fresh_vtable): Enable even more complex MI
- vtable names.
-
-Tue Dec 2 01:37:19 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * exception.cc (__check_eh_spec): Optimize a bit.
-
- * exception.cc (__cp_pop_exception): Lose handler arg.
- * except.c (do_pop_exception): Likewise.
- (push_eh_cleanup): Let the cleanup mechanism supply the handler.
- (expand_end_catch_block): Likewise.
-
-Fri Nov 28 01:58:14 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (check_explicit_specialization): Complain about using a
- template-id for a non-specialization.
-
-Fri Nov 28 12:35:19 1997 Scott Christley <scottc@net-community.com>
-
- * repo.c: Prototype rindex only if needed.
- * xref.c: Likewise.
-
-Fri Nov 28 01:56:35 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
-
- * error.c (dump_decl): Handle TEMPLATE_ID_EXPR.
-
-Thu Nov 27 00:59:46 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_const_cast): Handle references here instead of
- handing off to convert_to_reference.
+ (mark_primary_bases): Likewise.
+ (set_primary_base): Take a binfo, not an integer, as a
+ representation of the primary base.
+ (indirect_primary_base_p): Remove.
+ (determine_primary_base): Adjust for indirect primary bases.
+ (dfs_find_final_overrider): Fix typo in coment.
+ (update_vtable_entry_for_fn): Use get_primary_binfo.
+ (layout_nonempty_base_or_field): Tweak.
+ (build_base_fields): Adjust for new primary base semantics.
+ (dfs_propagate_binfo_offsets): Remove.
+ (propagate_binfo_offsets): Rewrite.
+ (dfs_set_offset_for_shared_vbases): Remove.
+ (layout_virtual_bases): Don't use it.
+ (layout_class_type): Set CLASSTYPE_SIZE correctly under the new
+ ABI.
+ (finish_struct_1): Set CLASSTYPE_PRIMARY_BINFO, not
+ CLASSTYPE_VFIELD_PARENT.
+ (dfs_get_primary_binfo): New function.
+ (get_primary_binfo): Likewise.
+ (dump_class_hierarchy_r): Tweak printing of primary bases.
+ (build_vtbl_initializer): Fix typo in comments. Use
+ vtbl_init_data.
+ (build_vcall_and_vbase_vtbl_entries): Likewise.
+ (build_vbaes_offset_vtbl_entries): Likewise.
+ (dfs_build_vcall_offset_vtbl_entries): Adjust setting of
+ BV_VCALL_INDEX to handle indirect primary bases.
+ (build_vcall_offset_vtbl_entries): Use vtbl_init_data.
+ (build_rtti_vtbl_entries): Likewise.
+ * search.c (get_shared_vbase_if_not_primary): Tweak.
+ (find_vbase_instance): Likewise.
+ (binfo_for_vtable): Simplify.
+ * tree.c (unshare_base_binfos): Clear BINFO_PRIMARY_BASE_OF.
+ (make_binfo): Make it have 11 entries.
+
+2000-07-30 Alex Samuel <samuel@codesourcery.com>
+
+ * mangle.c (DECL_TEMPLATE_ID_P): Remove.
+ (CLASSTYEP_TEMPLATE_ID_P): Check template info, and context when
+ ascertaining primaryness.
+ (G): Remove template_args.
+ (decl_is_template_id): New function.
+ (write_encoding): Use decl_is_template_id.
+ (write_name): Likewise. Handle type_decls. Get main variant of
+ type decls.
+ (write_nested_name): Likewise.
+ (write_prefix): Likewise.
+ (write_template_prefix): Likewise.
+ (write_special_name_constructor): Remove defunct production from
+ comment.
+ (write_bare_function_type): Remove comment about absent parameter.
+ (write_template_template_arg): Add missing grammar production to
+ comment.
- * except.c: Lose Unexpected, SetTerminate, SetUnexpected,
- TerminateFunctionCall.
- (init_exception_processing): Likewise. Terminate et al are now
- the fns, not ADDR_EXPRs.
- (various): Lose redundant assemble_external calls.
- (do_unwind): s/BuiltinReturnAddress/builtin_return_address_fndecl/.
+2000-07-27 Jason Merrill <jason@redhat.com>
- * cp-tree.h (struct lang_decl_flags): Add comdat.
- (DECL_COMDAT): New macro.
- * decl.c (duplicate_decls): Propagate it.
- (cp_finish_decl): Handle it.
- * decl2.c (import_export_decl): Just set DECL_COMDAT on VAR_DECLs.
+ * decl.c (duplicate_decls): If common_type produces a non-typedef
+ type for a typedef, just use the old type.
- * class.c: Remove static pending_hard_virtuals.
- (add_virtual_function): Take pointers to pending_virtuals
- and pending_hard_virtuals.
- (finish_struct_1): Pass them. Declare pending_hard_virtuals.
+2000-07-27 Mark Mitchell <mark@codesourcery.com>
-Wed Nov 26 20:28:49 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (function_depth): Declare.
+ (verify_stmt_tree): Likewise.
+ (find_tree): Likewise.
+ * decl.c (function_depth): Give it external linkage.
+ * optimize.c (optimize_function): Increment and decrement it.
+ * tree.c (verify_stmt_tree_r): New function.
+ (verify_stmt_tree): Likewise.
+ (find_tree_r): Likewise.
+ (find_tree): Likewise.
- * decl2.c (import_export_vtable): If we support one_only but not
- weak symbols, mark instantiated template vtables one_only.
- (import_export_decl): Likewise for tinfo functions.
- (finish_vtable_vardecl): Also write out vtables from explicitly
- instantiated template classes.
- * pt.c (mark_class_instantiated): Revert last change.
+2000-07-27 Jason Merrill <jason@redhat.com>
- * except.c (expand_throw): Call mark_used on the destructor.
+ * pt.c (for_each_template_parm_r, case RECORD_TYPE): Use
+ TYPE_PTRMEMFUNC_P.
+ * cp-tree.h (TYPE_TEMPLATE_INFO): Check for TYPE_LANG_SPECIFIC.
-Wed Nov 26 15:13:48 1997 Jeffrey A Law (law@cygnus.com)
+2000-07-26 Mark Mitchell <mark@codesourcery.com>
- * lex.c (lang_init): Enable flag_exceptions by default if no
- command line switch was specified.
+ * decl.c (start_cleanup_fn): Mark the function as `inline'.
+ * decl2.c (get_guard): Call cp_finish_decl, not
+ rest_of_decl_compilation, for local guards.
+ * lex.c (do_identifier): Remove unused variable.
-1997-11-26 Mark Mitchell <mmitchell@usa.net>
+Wed Jul 26 15:05:51 CEST 2000 Marc Espie <espie@cvs.openbsd.org>
- * pt.c (unify): Handle `void' template parameters in
- specializations.
+ * parse.y: Add missing ';'.
-Wed Nov 26 01:11:24 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-07-26 Mark Mitchell <mark@codesourcery.com>
- * rtti.c (build_dynamic_cast): Handle template case here.
- (build_dynamic_cast_1): Not here.
+ * parse.y (empty_parms): Use `()', not `(...)', when in the scope
+ of `extern "C++"'.
- * typeck2.c (digest_init): Make copies where appropriate.
+2000-07-25 Nathan Sidwell <nathan@codesourcery.com>
- * decl2.c (delete_sanity): resolve_offset_ref.
-
- * except.c: Call terminate without caching so many bits.
+ Kill strict_prototype. Backwards compatibility only for
+ non NO_IMPLICIT_EXTERN_C systems.
+ * cp-tree.h (flag_strict_prototype): Remove.
+ (strict_prototype): Remove.
+ (strict_prototypes_lang_c, strict_prototypes_lang_cplusplus): Remove.
+ * decl.c (maybe_push_to_top_level): Adjust.
+ (pop_from_top_level): Adjust.
+ (decls_match): Only allow sloppy parm matching for ancient
+ system headers.
+ (init_decl_processing): Adjust.
+ (grokdeclarator): Adjust.
+ * decl2.c (flag_strict_prototype): Remove.
+ (strict_prototype): Remove.
+ (strict_prototypes_lang_c, strict_prototypes_lang_cplusplus): Remove.
+ (lang_f_options): Remove "strict-prototype".
+ (unsupported-options): Add "strict-prototype".
+ * lex.c (do_identifier): Adjust.
+ (do_scoped_id): Adjust.
+ * parse.y (empty_parms): Adjust.
+ * class.c (push_lang_context): Adjust.
+ (pop_lang_context): Adjust.
+ * typeck.c (comp_target_parms): Adjust.
- * except.c (expand_start_catch_block): Fix catching a reference
- to pointer.
+2000-07-25 Nathan Sidwell <nathan@codesourcery.com>
-Tue Nov 25 11:28:21 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (poplevel): Deal with anonymous variables at for scope.
+ (maybe_inject_for_scope_var): Likewise.
- * init.c (build_new): Copy size to the saveable obstack.
+2000-07-25 Zack Weinberg <zack@wolery.cumb.org>
- * init.c (build_new): Stick a CLEANUP_POINT_EXPR inside the
- TRY_CATCH_EXPR for now.
+ * decl.c: Remove all signal handling code, now done in toplev.c.
-Mon Nov 24 12:15:55 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-07-23 Mark Mitchell <mark@codesourcery.com>
- * typeck.c (mark_addressable): Don't assume a FUNCTION_DECL
- has DECL_LANG_SPECIFIC.
+ * decl.c (make_rtl_for_nonlocal_decl): Rework.
- * exception.cc (struct cp_eh_info): Add handlers field.
- (__cp_push_exception): Initialize it.
- (__cp_pop_exception): Decrement it. Don't pop unless it's 0.
- (__throw_bad_exception): Remove.
- * except.c (call_eh_info): Add handlers field.
- (get_eh_handlers): New fn.
- (push_eh_cleanup): Increment handlers.
+ * pt.c (lookup_template_class): Ensure that TYPE_CONTEXT is set
+ correctly.
-Fri Nov 21 12:22:07 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-07-20 Zack Weinberg <zack@wolery.cumb.org>
- * except.c (expand_start_eh_spec): Use the try/catch code.
- (expand_end_eh_spec): Likewise. Call __check_eh_spec instead of
- doing everything inline.
- (init_exception_processing): throw_type_match now takes
- const void pointers.
- * exception.cc (__check_eh_spec): New fn.
- * inc/exception: Neither terminate nor unexpected return.
- * decl.c: Make const_ptr_type_node public.
- * tinfo2.cc (__throw_type_match_rtti): Take the typeinfos constly.
+ * cp-tree.h: Use __FUNCTION__ not __PRETTY_FUNCTION__.
+ Define my_friendly_assert and my_friendly_abort as macros
+ which may call friendly_abort. Prototype friendly abort, not
+ my_friendly_abort or my_friendly_assert.
+ * decl.c (signal_catch): Report the signal caught in the error
+ message. Call fatal directly.
+ * typeck2.c (ack, my_friendly_assert): Delete.
+ (my_friendly_abort): Rename to friendly_abort. Expect file,
+ line, and function parameters. Report the abort code, then
+ call fancy_abort. Do not mask an abort if errors have
+ already occurred.
- * except.c (expand_start_catch_block): We only need the rethrow
- region for non-sjlj exceptions.
- (expand_end_catch_block): Likewise. Use outer_context_label_stack.
+2000-07-18 Nathan Sidwell <nathan@codesourcery.com>
-Thu Nov 20 14:40:17 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * typeck.c (comp_target_parms): Remove obsolete parameter.
+ (comp_target_types): Adjust.
- * Make-lang.in (CXX_LIB2FUNCS): Add new op new and op delete objs.
- (various.o): Likewise.
- * inc/new: Add placement deletes. Add throw specs for default new.
- * new.cc (set_new_handler): Move here from libgcc2.
- * new1.cc (new (nothrow)): Catch a bad_alloc thrown from the handler.
- (new): Move from libgcc2. Throw bad_alloc.
- * new2.cc: Move the rest of the op news and op deletes from libgcc2.
- * decl.c (init_decl_processing): Update exception specs on new and
- delete.
+2000-07-17 Jason Merrill <jason@redhat.com>
- * method.c (build_decl_overload_real): Don't mess with global
- placement delete.
+ * typeck.c (mark_addressable): Never set TREE_USED.
+ * call.c (build_call): Don't abort on calls to library functions
+ that have been declared normally.
- * init.c (build_new): Check for null throw spec, not nothrow_t.
+ * typeck.c (build_binary_op): Fix grammar in warning.
- * decl.c (duplicate_decls): Don't complain about different exceptions
- from an internal declaration.
+ * exception.cc (__eh_free): Fix prototype.
- * call.c (build_op_delete_call): Fix check for member fns again.
+ * decl2.c (finish_decl_parsing): Handle TEMPLATE_ID_EXPR.
- * decl2.c (import_export_decl): Interface hackery affects
- virtual synthesized methods.
+ * decl.c (pushdecl): Handle seeing an OVERLOAD in
+ IDENTIFIER_NAMESPACE_VALUE.
-Wed Nov 19 18:24:14 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-07-16 Mark Mitchell <mark@codesourcery.com>
- * decl.c (start_decl): Don't just complain about a mismatched
- scope, fix it.
+ * cp-tree.h (THUNK_VCALL_OFFSET): Update documentation.
+ * method.c (use_thunk): Correct handling of vcall offsets.
- * decl.c (make_implicit_typename): Handle case where t is not
- actually from context.
- * tree.c (get_type_decl): Lose identifier case.
- * spew.c (yylex): Lose useless call to identifier_typedecl_value.
- * parse.y (nonnested_type): Just use lookup_name.
- (complex_type_name): Just use IDENTIFIER_GLOBAL_VALUE.
+2000-07-14 Zack Weinberg <zack@wolery.cumb.org>
-Wed Nov 19 11:45:07 1997 Michael Tiemann <tiemann@axon.cygnus.com>
+ * .cvsignore: parse.h and parse.c have no cp- prefix.
- * error.c (dump_function_name): Test DECL_LANG_SPECIFIC in case
- T was built in C language context (for example, by
- output_func_start_profiler).
+2000-07-13 Mark Mitchell <mark@codesourcery.com>
-Wed Nov 19 10:39:27 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * .cvsignore: New file.
- * decl.c (make_implicit_typename): New fn.
- (lookup_name_real): Use it. Use current_class_type as the context.
+2000-07-13 Zack Weinberg <zack@wolery.cumb.org>
-Mon Nov 17 23:42:03 1997 Bruno Haible <haible@ilog.fr>
+ * lang-specs.h: Use the new named specs. Remove unnecessary braces.
- * pt.c (do_poplevel): Don't prohibit jumps into this contour.
+2000-07-12 Mark Mitchell <mark@codesourcery.com>
-Mon Nov 17 02:01:28 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * Makefile.in ($(PARSE_H)): Depend directly on parse.y.
+ * parse.c: Remove.
+ * parse.h: Likewise.
- * friend.c (do_friend): Warn about non-template friends in templates.
+2000-07-11 Mark Mitchell <mark@codesourcery.com>
- * call.c (build_op_delete_call): Fix handling of inherited delete.
+ * class.c (layout_class_type): Add pointers to virtual bases after
+ base classes under the old ABI.
- * search.c (dfs_record_inheritance): Ignore template type parms.
+2000-07-10 Benjamin Chelf <chelf@codesourcery.com>
-Sat Nov 15 00:30:51 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * semantics.c (finish_for_stmt): Remove call to emit_line_note.
+ (finish_continue_stmt): Likewise.
+ (begin_for_stmt): Remove call to note_level_for_for.
+ (finish_goto_stmt): Change call from build_min_nt
+ to build_stmt.
+ (finish_expr_stmt): Likewise.
+ (begin_if_stmt): Likewise.
+ (begin_while_stmt): Likewise.
+ (finish_while_stmt): Likewise.
+ (finish_return_stmt): Likewise.
+ (begin_for_stmt): Likewise.
+ (finish_for_stmt): Likewise.
+ (finish_break_stmt): Likewise.
+ (begin_switch_stmt): Likewise.
+ (finish_case_label): Likewise.
+ (genrtl_try_block): Likewise.
+ (begin_try_block): Likewise.
+ (begin_handler): Likewise.
+ (begin_compound_stmt): Likewise.
+ (finish_asm_stmt): Likewise.
+ (finish_label_stmt): Likewise.
+ (add_decl_stmt): Likewise.
+ (finish_subobject): Likewise.
+ (finish_decl_cleanup): Likewise.
+ (finish_named_return_value): Likewise.
+ (setup_vtbl_ptr): Likewise.
+ (add_scope_stmt): Likewise.
+ * decl.c (finish_constructor_body): Likewise.
+ (finish_destructor_body): Likewise.
+ * optimize.c (copy_body_r): Likewise.
+ (initialize_inlined_parameters): Likewise.
+ (declare_return_variable): Likewise.
+ (expand_call_inline): Likewise.
- * call.c (build_new_op): Fix copy error.
- (build_op_new_call): New fn.
- (build_op_delete_call): New fn.
- * cp-tree.h: Declare them.
- * init.c (build_new): Use them. Support placement delete.
- (build_x_delete): Use build_op_delete_call.
- (build_delete): Likewise.
- * decl2.c (delete_sanity): Likewise.
- (coerce_delete_type): Don't complain about placement delete.
+2000-07-10 Jakub Jelinek <jakub@redhat.com>
-Thu Nov 13 01:52:36 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * semantics.c (expand_body): Sync interface information
+ at the end of function body expansion.
- * call.c (build_new_function_call): Remove unused 'obj' parm.
- * cp-tree.h, typeck.c: Adjust.
+2000-07-09 Jason Merrill <jason@redhat.com>
- * init.c (build_new): Make the cleanup last longer.
- (expand_vec_init): Call do_pending_stack_adjust.
+ * init.c (build_new_1): Bail early if the call to new fails.
-Wed Nov 12 11:04:33 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (compute_array_index_type): Check specifically for
+ an INTEGER_CST, not just TREE_CONSTANT.
- * pt.c (do_type_instantiation): Fix typo.
- (mark_class_instantiated): If we support one_only but not weak
- symbols, don't mark this as known.
+ * decl.c (duplicate_decls): Don't call duplicate_decls on
+ the DECL_TEMPLATE_RESULT.
+ (decls_match): Return 0 if the DECL_TEMPLATE_RESULTs have different
+ codes.
- * init.c (build_new): Handle vec delete in EH cleanup.
+ * error.c (dump_template_bindings): Don't crash if we had an
+ invalid argument list.
-Wed Nov 12 08:11:55 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+ * typeck.c (c_expand_start_case): Do narrowing here.
+ * semantics.c (finish_switch_cond): Not here.
- * call.c (build_method_call): Call complete_type before checking
- for destructor.
+2000-07-09 Hidvegi Zoli <hzoli@austin.ibm.com>
-Sun Nov 9 01:29:55 1997 Jim Wilson (wilson@cygnus.com)
+ * parse.y (asm_clobbers): Do string concatenation.
- * decl.c (add_block_current_level): Delete.
- * init.c (build_vec_delete_1): Delete build_block and
- add_block_current_level calls.
+2000-07-09 Mark Mitchell <mark@codesourcery.com>
-Wed Nov 12 00:48:16 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (pushtag): Don't put local classes in template functions
+ on the local_classes list.
- * init.c (build_new): Handle freeing allocated memory when the
- constructor throws.
+2000-07-04 Scott Snyder <snyder@fnal.gov>
- * call.c (build_new_method_call): Fix flags arg.
+ * decl2.c (get_guard): Add missing return for old ABI local
+ variable case.
- * pt.c (do_type_instantiation): Don't try to instantiate
- member templates.
- (mark_decl_instantiated): If we support one_only but not
- weak symbols, mark this one_only.
- * decl2.c (import_export_vtable): Don't defer handling of vtables
- if MULTIPLE_SYMBOL_SPACES.
+2000-07-09 Mark Mitchell <mark@codesourcery.com>
-Tue Nov 11 12:02:12 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (char_type_p): New function.
+ * decl.c (init_decl_processing): Don't initialize
+ signed_wchar_type_node or unsigned_wchar_type_node.
+ (complete_array_type): Handle brace-enclosed string-constants.
+ * rtti.c (emit_support_tinfos): Remove #if 0'd code.
+ * tree.c (char_type_p): New function.
+ * typeck2.c (digest_init): Use char_type_p.
- * except.c (expand_end_catch_block): Lose call to __sjpopnthrow.
+2000-07-06 Nathan Sidwell <nathan@codesourcery.com>
-Tue Nov 11 02:53:44 1997 Jason Merrill <jason@lasher.cygnus.com>
+ * pt.c (tsubst): Don't layout type, if it's error_mark.
- * except.c (do_pop_exception): Return a value.
+2000-07-06 Nathan Sidwell <nathan@codesourcery.com>
-Mon Nov 10 20:25:31 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * pt.c (instantiate_pending_templates): Reset template level.
- * call.c (build_new_method_call): Handle getting a
- TEMPLATE_ID_EXPR around a TEMPLATE_DECL. Don't look for a field
- if we got template parms.
- * typeck.c (build_x_function_call): Remember the TEMPLATE_ID_EXPR,
- not just the args.
- * decl2.c (build_expr_from_tree): Tweak last change.
- * pt.c (tsubst_copy): Use get_first_fn instead of TREE_VALUE.
- (maybe_fold_nontype_arg): Split out from tsubst_copy.
- * tree.c (get_first_fn): Just return a TEMPLATE_ID_EXPR.
+2000-07-05 Jason Merrill <jason@redhat.com>
-Mon Nov 10 20:08:38 1997 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
+ * call.c (joust): Don't complain about `operator char *()' beating
+ `operator const char *() const'.
- * pt.c (tsubst_copy): Handle explicit template arguments in
- function calls.
- * typeck.c (build_x_function_call): Likewise.
- * decl2.c (build_expr_from_tree): Lookup function name if it
- hasn't been done.
+2000-07-04 scott snyder <snyder@fnal.gov>
+ Jason Merrill <jason@redhat.com>
- * pt.c (tsubst): Instantiate template functions properly when
- template parameter does not appear in function arguments and return
- type.
- (comp_template_args): Handle member templates required by tsubst.
+ * repo.c (repo_get_id): Handle the case where a class with virtual
+ bases has a null TYPE_BINFO_VTABLE.
-Mon Nov 10 20:08:38 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-07-04 Kevin Buhr <buhr@stat.wisc.edu>
+ Jason Merrill <jason@redhat.com>
- * decl.c (grokdeclarator): Tweak conditions for pedwarn in
- previous change.
+ * parse.y (member_init): Just pass in the type.
+ * init.c (expand_member_init): Handle getting a type.
-Mon Nov 10 20:08:29 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
+2000-07-04 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+ Jason Merrill <jason@redhat.com>
- * pt.c (coerce_template_parms): Tweak error message.
+ * decl.c (finish_function): Warn if a function has no return
+ statement.
+ Suggested by Andrew Koenig.
+ * typeck.c (check_return_expr): Do set current_function_returns_value
+ if we got an error_mark_node.
- * decl.c (grokdeclarator): If -Wreturn-type, warn everytime a
- return type defaults to `int', even if there are storage-class
- specifiers.
+2000-07-03 Nathan Sidwell <nathan@codesourcery.com>
-Mon Nov 10 03:04:20 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * decl2.c (push_decl_namespace): Push the original namespace.
- Complete nested exception support.
- * except.c (do_pop_exception): Split out...
- (push_eh_cleanup): From here. Handle the EH region by hand.
- (expand_start_catch_block): Add a new level for the catch parm.
- Move the rethrow region outside the two cleanup regions.
- Protect the initializer for the catch parm with terminate.
- (expand_end_catch_block): Likewise. End the region for the eh_cleanup.
- * exception.cc (__cp_pop_exception): Now takes two parms. Handle
- popping off the middle of the stack.
- * tree.c (lvalue_p, real_lvalue_p): Handle TRY_CATCH_EXPR,
- WITH_CLEANUP_EXPR, and UNSAVE_EXPR.
- (build_cplus_new): Only wrap CALL_EXPRs.
- * init.c (expand_default_init): Handle a TRY_CATCH_EXPR around
- the constructor call.
+2000-07-03 Nathan Sidwell <nathan@codesourcery.com>
-Sun Nov 9 18:00:26 1997 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+ * pt.c (instantiate_class_template): Set CLASSTYPE_VBASECLASSES.
+ * semantics.c (begin_class_definition): Clear it.
- * Make-lang.in (c++.distdir): Make inc subdirectory.
+2000-07-02 Benjamin Chelf <chelf@codesourcery.com>
-Fri Nov 7 11:57:28 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (genrtl_goto_stmt): Remove declaration.
+ (genrtl_expr_stmt): Likewise.
+ (genrtl_decl_stmt): Likewise.
+ (genrtl_if_stmt): Likewise.
+ (genrtl_while_stmt): Likewise.
+ (genrtl_do_stmt): Likewise.
+ (genrtl_return_stmt): Likewise.
+ (genrtl_for_stmt): Likewise.
+ (genrtl_break_stmt): Likewise.
+ (genrtl_continue_stmt): Likewise.
+ (genrtl_scope_stmt): Likewise.
+ (genrtl_switch_stmt): Likewise.
+ (genrtl_case_label): Likewise.
+ (genrtl_begin_compound_stmt): Likewise.
+ (genrtl_finish_compound_stmt): Likewise.
+ (genrtl_compound_stmt): Likewise.
+ (genrtl_asm_stmt): Likewise.
- * decl2.c (finish_file): Put back some code.
+ * init.c (begin_init_stmts): Remove call to
+ genrtl_begin_compound_stmt.
+ (finish_init_stmts): Remove call to genrtl_finish_compound_stmt.
-Thu Nov 6 11:28:14 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * semantics.c (lang_expand_stmt): Changed call to
+ genrtl_compound_stmt to ignore return value.
- * decl2.c (finish_file): Remove redundant code.
- * method.c (emit_thunk): Don't let the backend defer generic thunks.
+2000-07-02 Mark Mitchell <mark@codesourcery.com>
-Wed Nov 5 23:52:50 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * mangle.c (canonicalize_for_substitution): Return the canonical
+ variant of a type.
- * except.c (call_eh_info): Split out...
- (push_eh_info): From here.
- (expand_builtin_throw): Use it.
- (expand_start_catch_block): Move region start back.
+ * decl.c (duplicate_decls): Preserve DECL_ORIGINAL_TYPE for a
+ TYPE_DECL.
+ * typeck.c (commonparms): Remove obstack manipulations.
-Tue Nov 4 13:45:10 1997 Doug Evans <devans@canuck.cygnus.com>
+2000-07-01 Benjamin Chelf <chelf@codesourcery.com>
- * lex.c (MULTIBYTE_CHARS): #undef if cross compiling.
- (real_yylex): Record wide strings using target endianness, not host.
+ * Make-lang.in (cc1plus$(exeext)): Added c-semantics.o.
-1997-11-03 Brendan Kehoe <brendan@lisa.cygnus.com>
+ * Makefile.in (OBJS): Added ../c-semantics.o.
+ (OBJDEPS): Likewise.
- * repo.c (rindex): Add decl unconditionally.
- (get_base_filename, open_repo_file): Don't cast rindex.
- * xref.c (rindex): Add decl unconditionally.
- (index): Remove unused decl.
- (open_xref_file): Don't cast rindex.
+ * cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to
+ ../c-common.h.
+ (struct stmt_tree): Added comment.
+ (current_function_name_declared): Removed.
+ (stmts_are_full_exprs_p): Likewise.
+ (genrtl_do_pushlevel): Likewise.
+ (genrtl_clear_out_block): Likewise.
+ (COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h.
+ (DECL_ANON_UNION_ELEMS): Likewise.
+ (emit_local_var): Likewise.
+ (make_rtl_for_local_static): Likewise.
+ (do_case): Likewise.
+ (expand_stmt): Likewise.
+ (genrtl_decl_cleanup): Likewise.
+ (c_expand_asm_operands): Likewise.
+ (c_expand_return): Likewise.
+ (c_expand_start_case): Likewise.
-Sun Nov 2 15:04:12 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (make_rtl_for_local_static): Moved to c-semantics.c.
+ (emit_local_var): Likewise.
+ (initialize_local_var): Change reference to
+ stmts_are_full_exprs_p to call to stmts_are_full_exprs_p().
+ Change reference to stmts_are_full_exprs_p to
+ current_stmt_tree->stmts_are_full_exprs_p.
+ (push_cp_function_context): Likewise.
- * class.c (build_vbase_path): Propagate the result type properly.
+ * expect.c (expand_throw): Change reference to
+ stmts_are_full_exprs_p.
+
+ * init.c (build_aggr_init): Change reference to
+ stmts_are_full_exprs_p.
+ (build_vec_init): Likewise.
+
+ * optimize.c (maybe_clone_body): Change reference to
+ current_function_name_declared to
+ cp_function_chain->name_declared.
+
+ * pt.c (instantiate_decl): Change reference to
+ current_function_name_declared to
+ cp_function_chain->name_declared.
+
+ * semantics.c (expand_cond): Moved declaration to c-common.h.
+ (genrtl_do_pushlevel): Moved to c-semantics.c.
+ (genrtl_clear_out_block): Likewise.
+ (genrtl_goto_stmt): Likewise.
+ (genrtl_expr_stmt): Likewise.
+ (genrtl_decl_stmt): Likewise.
+ (gerntl_if_stmt): Likewise.
+ (genrtl_while_stmt): Likewise.
+ (genrtl_do_stmt): Likewise.
+ (genrtl_return_stmt): Likewise.
+ (genrtl_for_stmt): Likewise.
+ (genrtl_break_stmt): Likewise.
+ (genrtl_continue_stmt): Likewise.
+ (genrtl_scope_stmt): Likewise.
+ (genrtl_switch_stmt): Likewise.
+ (genrtl_case_label): Likewise.
+ (genrtl_begin_compound_stmt): Likewise.
+ (genrtl_finish_compound_stmt): Likewise.
+ (genrtl_compound_stmt): Likewise.
+ (genrtl_asm_stmt): Likewise.
+ (genrtl_decl_cleanup): Likewise.
+ (expand_cond): Likewise.
+ (expand_stmt): Renamed to ...
+ (lang_expand_stmt): ... this.
+ (lang_expand_expr_stmt): Initialize.
+ (set_current_function_name_declared): Likewise.
+ (stmts_are_full_exprs_p): Likewise.
+ (current_function_name_declared): Likewise.
+ (anon_aggr_type_p): Likewise.
+ (do_poplevel): Change reference to
+ stmts_are_full_exprs_p to call to stmts_are_full_exprs_p().
+ Change reference to stmts_are_full_exprs_p to
+ current_stmt_tree->stmts_are_full_exprs_p.
+ (add_tree): Likewise.
+ (finish_expr_stmt): Likewise.
+ (prep_stmt): Likewise.
+ (lang_expand_stmt): Likewise.
+ (begin_compound_stmt): Change reference to
+ current_function_name_declared to
+ cp_function_chain->name_declared and call to
+ current_function_name_declared().
+ (setup_vtbl_ptr): Likewise.
+ (genrtl_do_poplevel): Removed.
+
+2000-06-30 Jason Merrill <jason@redhat.com>
+
+ * init.c (init_init_processing): Go back to aligning like
+ double_type_node for old ABI.
+ (get_cookie_size): Make cookie larger if we get a type that needs
+ more alignment.
+ (build_vec_delete): Call it.
+
+ * typeck.c (qualify_type_recursive): New fn.
+ (composite_pointer_type): Use it.
+ (build_binary_op): Use composite_pointer_type.
+
+2000-06-24 Carlos O'Ryan <coryan@cs.wustl.edu>
+ Jason Merrill <jason@redhat.com>
+
+ * typeck.c (check_return_expr): Don't complain about returning
+ NULL from operator new if -fcheck-new.
+ * cp-tree.h: Declare flag_check_new here.
+ * init.c: Not here.
+
+2000-06-28 Alex Samuel <samuel@codesourcery.com>
+
+ * mangle.c (find_substitution): Use same_type_p.
+ (write_encoding): Don't check for substitutions.
+
+2000-06-30 Nathan Sidwell <nathan@codesourcery.com>
+
+ * parse.y (expr_no_comma_rangle): New non-terminal.
+ (template_parm): Use it for default parameter case.
+ (template_arg): Use it.
+ (expr_no_commas): Remove commented out undefined extensions.
+ * Makefile.in (CONFLICTS): Adjust to 33 s/r & 48 r/r.
+ * parse.h, parse.c: Rebuilt.
+
+2000-06-30 Mark Mitchell <mark@codesourcery.com>
+
+ * semantics.c (genrtl_asm_stmt): Don't decay input operands here.
+ (finish_asm_stmt): Do it here, instead.
+
+ * cp-tree.h (ridpointers): Don't declare.
+ * decl.c (record_builtin_type): Use CP_RID_MAX instead of RID_MAX.
+ (record_builtin_java_type): Likewise.
+ (init_decl_processing): Likewise.
+ * lex.c: Move inclusion of lex.h.
+ (ridpointers): Don't define.
+ (init_parse): Initialize ripdointers. Use CP_RID_MAX instead of
+ RID_MAX.
+ * lex.h (enum rid): Rename to ...
+ (enum cp_rid): ... this.
+ (ridpointers): Don't declare.
+ * parse.y: Move inclusion of lex.h.
+ * parse.c: Regenerated.
+ * spew.c: Move inclusion of lex.h.
+
+ * cp-tree.h (struct language_function): Remove temp_name_counter.
+ (temp_name_counter): Remove.
+ (get_temp_name): Change prototype.
+ (get_guard): New function.
+ (get_guard_cond): Likewise.
+ (set_guard): Likewise.
+ * cvt.c (build_up_reference): Adjust call to get_temp_name.
+ * decl.c (expand_static_init): Use get_guard and friends to
+ implement guard variables.
+ * decl2.c (get_temp_name): Assume that the variables created are
+ always static.
+ (get_sentry): Rename to ...
+ (get_guard): ... this. Implement new ABI guard variables.
+ (get_guard_bits): New function.
+ (get_guard_cond): Likewise.
+ (set_guard): Likewise.
+ (start_static_initialization_or_destruction): Use them.
+ (do_static_initialization): Replace sentry with guard throughout.
+ (do_static_destruction): Likewise.
+ * init.c (create_temporary_var): Add comment.
-1997-11-01 Brendan Kehoe <brendan@lisa.cygnus.com>
+2000-06-28 Alex Samuel <samuel@codesourcery.com>
- * except.c (expand_builtin_throw) [!DWARF2_UNWIND_INFO]: Replace
- remaining use of saved_throw_type with a call to get_eh_type.
+ * mangle.c (find_substitution): Use same_type_p.
+ (write_encoding): Don't check for substitutions.
-1997-10-31 Brendan Kehoe <brendan@lisa.cygnus.com>
+2000-06-30 Nathan Sidwell <nathan@codesourcery.com>
- * lex.c (FILE_NAME_NONDIRECTORY): Delete macro.
- (file_name_nondirectory): New function, doing the same as the macro.
- (set_typedecl_interface_info): Use it instead of the macro.
- (check_newline): Likewise.
- (handle_cp_pragma): Likewise.
-
- * repo.c (get_base_filename): Cast result of rindex to char*.
- (open_repo_file): Likewise.
- * xref.c (open_xref_file): Likewise.
- * error.c (dump_char): Make its arg int, not char.
-
- * except.c (push_eh_info): Pass the number of fields - 1 down, not
- the exact number of fields.
-
-Fri Oct 31 01:47:57 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- Support for nested exceptions.
- * tinfo2.cc (__is_pointer): New fn.
- * exception.cc (struct cp_eh_info): Define.
- (__cp_exception_info, __uncatch_exception): New fns.
- (__cp_push_exception, __cp_pop_exception): New fns.
- * except.c: Lose saved_throw_{type,value,cleanup,in_catch}.
- Lose empty_fndecl.
- (init_exception_processing): Likewise. __eh_pc is now external.
- (push_eh_info): New fn.
- (get_eh_{info,value,type,caught}): New fns.
- (push_eh_cleanup): Just call __cp_pop_exception.
- (expand_start_catch_block): Use push_eh_info. Start the eh region
- sooner.
- (expand_end_eh_spec): Use push_eh_info.
- (expand_throw): Call __cp_push_exception to set up the exception info.
- Just pass the destructor or 0 as the cleanup. Call __uncatch_exception
- when we rethrow.
- (expand_builtin_throw): Don't refer to empty_fndecl.
-
-Thu Oct 23 02:01:30 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_decl): SET_DECL_IMPLICIT_INSTANTIATION on new decl.
-
-1997-10-22 Brendan Kehoe <brendan@cygnus.com>
-
- * method.c (build_template_parm_names, build_decl_overload_real):
- Add static to definitions.
- * pt.c (add_to_template_args, note_template_header,
- processing_explicit_specialization, type_unification_real): Likewise.
- ({determine,check}_explicit_specialization): Use a single string for
- error messages.
-
-Mon Oct 20 12:06:34 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * except.c (expand_exception_blocks): Call do_pending_stack_adjust.
- (expand_end_catch_block): Likewise.
- (expand_end_eh_spec): Likewise.
-
-Mon Oct 20 11:44:20 1997 Mark Mitchell <mmitchell@usa.net>
-
- * decl.c (duplicate_decls): Handle template specializations
- correctly.
- * error.c (dump_function_name): Fix printing of specializations of
- member functions that are not member templates.
- * cp-tree.h (processing_specialization): Make global.
- * pt.c (processing_specialization): Likewise.
- * lex.c (cons_up_default_function): Save and restore
- processing_specialization to avoid confusion.
+ * parse.y (expr_no_comma_rangle): New non-terminal.
+ (template_parm): Use it for default parameter case.
+ (template_arg): Use it.
+ (expr_no_commas): Remove commented out undefined extensions.
+ * Makefile.in (CONFLICTS): Adjust to 33 s/r & 48 r/r.
+ * parse.h, parse.c: Rebuilt.
-Mon Oct 20 10:52:22 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-06-29 Mark Mitchell <mark@codesourcery.com>
- * decl.c (init_decl_processing): Give null_node unknown* type.
- * typeck.c (comp_target_types): Handle UNKNOWN_TYPE.
+ * cp-tree.h (flag_const_strings): Remove.
+ (warn_parentheses): Likewise.
+ (warn_format): Likewise.
(common_type): Likewise.
- * error.c (args_as_string): Recognize null_node.
-
-Sun Oct 19 09:13:01 1997 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * typeck.c (rationalize_conditional_expr): Handle {MIN,MAX}_EXPR.
- (unary_complex_lvalue): Call it for {MIN,MAX}_EXPR.
-
- * decl.c (init_decl_processing): Call using_eh_for_cleanups.
-
- * Make-lang.in (g++): Include prefix.o.
-
-Thu Oct 16 15:31:09 1997 Judy Goldberg <judygold@sanwafp.com>
-
- * pt.c (determine_explicit_specialization): Initialize "dummy"
- to keep Purify quiet.
-
-Thu Oct 16 00:14:48 1997 Jason Merrill <jason@yorick.cygnus.com>
+ (default_conversion): Likewise.
+ (build_binary_op): Likewise.
+ (cp_build_binary_op): New macro.
+ * call.c (build_new_op): Use cp_build_binary_op instead of
+ build_binary_op.
+ * class.c (build_vtable_entry_ref): Likewise.
+ * decl.c (expand_static_init): Likewise.
+ (compute_array_index_type): Likewise.
+ (build_enumerator): Likewise.
+ * decl2.c (delete_sanity): Likewise.
+ (start_static_initialization_or_destruction): Likewise.
+ * error.c (dump_type_suffix): Likewise.
+ * init.c (resolve_offset_ref): Likewise.
+ (build_new): Likewise.
+ (build_new_1): Likewise.
+ (build_vec_delete_1): Likewise.
+ (build_vec_init): Likewise.
+ (build_delete): Likewise.
+ * rtti.c (synthesize_tinfo_fn): Likewise.
+ (synthesize_tinfo_var): Likewise.
+ * search.c (expand_upcast_fixups): Likewise.
+ (fixup_all_virtual_upcast_offsets): Likewise.
+ * typeck.c (build_array_ref): Likewise.
+ (get_member_function_from_ptrfunc): Likewise.
+ (build_binary_op): Add parameter.
+ (pointer_int_sum): Use cp_build_binary_op.
+ (pointer_diff): Likewise.
+ (build_modify_expr): Likewise.
+ (get_delta_difference): Likewise.
+ (build_ptrmemfunc): Likewise.
- * method.c (build_overload_value): Handle TEMPLATE_CONST_PARMs here.
- (build_overload_int): Not here.
+2000-06-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (SET_DECL_ARTIFICIAL): Remove.
+ * decl.c (create_implicit_typedef): Adjust.
+ * decl2.c (build_artificial_parm): Adjust.
+ * method.c (implicitly_declare_fn): Adjust.
+ * pt.c (push_inline_template_parms_recursive): Adjust.
+ (process_template_parm): Adjust.
+ (overloaded_template_name): Adjust.
+ * semantics.c (finish_template_template_parm): Adjust.
+
+2000-06-28 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (CLEAR_BINFO_NEW_VTABLE_MARKED): Remove.
+ * class.c (update_vtable_entry_for_fn): Correct logic for deciding
+ where to emit thunks.
+ (build_vtt): Adjust call to build_vtt_inits.
+ (build_vtt_inits): Add parameter to indicate whether or not
+ sub-VTTs for virtual bases should be included. Adjust handling of
+ construction vtables.
+ (get_matching_base): New function.
+ (dfs_build_vtt_inits): Rename to ...
+ (dfs_build_secondary_vptr_vtt_inits): Adjust handling of
+ construction vtables.
+ (dfs_fixup_binfo_vtbls): Likewise.
+ (build_ctor_vtbl_groups): Build construction vtables for virtual
+ bases, too.
+ (accumulate_vtbl_inits): Tweak logic for deciding whether or not
+ to build construction vtbls.
+ (dfs_accumulate_vtbl_inits): Adjust handling of
+ construction vtables.
+
+ * pt.c (tsubst, case TEMPLATE_TEMPLATE_PARM): Handle cv-qualified
+ types correctly.
+
+2000-06-27 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (grokfndecl): Set DECL_CONTEXT for static functions too.
+
+2000-06-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ * search.c (hides): Remove.
+ (is_subobject_of_p): Add most_derived parameter. Use
+ CANONICAL_BINFO.
+ (lookup_field_queue_p): Adjust.
+ (lookup_field_r): Adjust.
+
+2000-06-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl2.c (handle_class_head): Bash typedefs to the type's main
+ decl.
-Wed Oct 15 00:35:28 1997 Mike Stump <mrs@wrs.com>
+2000-06-25 Mark Mitchell <mark@codesourcery.com>
- * class.c (build_type_pathname): Remove.
- (prepare_fresh_vtable): Fix problem with complex MI vtable names.
+ * cp-tree.h (genrtl_begin_stmt_expr): Rename to ...
+ (begin_global_stmt_expr): ... this.
+ (genrtl_finish_stmt_expr): Rename to ...
+ (finish_global_stmt_expr): ... this.
+ * init.c (begin_init_stmts): Adjust calls.
+ (finish_init_stmts): Likewise.
+ * semantics.c (genrtl_begin_stmt_expr): Rename to ...
+ (begin_global_stmt_expr): ... this.
+ (genrtl_finish_stmt_expr): Rename to ...
+ (finish_global_stmt_expr): ... this.
-1997-10-14 Brendan Kehoe <brendan@lisa.cygnus.com>
+2000-06-25 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
- * parse.y (unary_expr): Give a pedwarn if someone tries to use the
- &&label GNU extension.
+ * search.c (lookup_member): Fix typo in comment.
-Tue Oct 14 12:01:00 1997 Mark Mitchell <mmitchell@usa.net>
+2000-06-24 Jason Merrill <jason@redhat.com>
- * decl.c (pushtag): Unset DECL_ASSEMBLER_NAME before setting it,
- so as to avoid incorrect manglings.
- * method.c (build_decl_overload_real): Don't mangle return types
- for constructors.
+ * decl.c (pushdecl): Don't set DECL_CONTEXT from current_namespace.
+ (push_namespace): Set DECL_CONTEXT for a new NAMESPACE_DECL.
-Tue Oct 14 11:46:14 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-06-24 Martin v. Löwis <loewis@informatik.hu-berlin.de>
- * cp-tree.h (scratchalloc, build_scratch_list, make_scratch_vec,
- scratch_tree_cons): Define as macros for now.
- * call.c, class.c, cvt.c, decl.c, decl2.c, except.c, expr.c, init.c,
- lex.c, method.c, parse.y, pt.c, rtti.c, search.c, tree.c, typeck.c,
- typeck2.c: Use them and the expression_obstack variants.
+ * parse.y (complex_direct_notype_declarator): Support global_scope.
+ * Makefile.in: Adjust conflict count.
-Mon Oct 13 17:41:26 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+2000-06-23 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
- * decl.c (store_return_init): Allow classes with explicit ctors to
- be used with the named return values extension.
+ * parse.y (template_arg): Convert TEMPLATE_DECL
+ that is a template template parameter to
+ TEMPLATE_TEMPLATE_PARM here.
-Fri Oct 10 12:21:11 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.def (TEMPLATE_TEMPLATE_PARM): Adjust comment.
+ * cp-tree.h (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL): New macro.
+ (copy_template_template_parm): Adjust prototype.
+ * decl.c (grokdeclarator): Remove dead code.
+ * pt.c (process_template_parm): Tidy.
+ (lookup_template_class): Construct nodes in
+ copy_template_template_parm.
+ (tsubst): Pass TEMPLATE_DECL rather than IDENTIFIER_NODE to
+ lookup_template_class. Use TYPE_TI_TEMPLATE.
+ * tree.c (copy_template_template_parm): Add NEWARGS
+ parameter.
+ (mapcar): Adjust call to copy_template_template_parm.
+ * typeck.c (comptypes): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL.
+ * method.c (build_template_template_parm_names): Change error
+ code to avoid compilation warning.
+
+ * gxxint.texi: Document template template parameter
+ name mangling.
+
+2000-06-21 Alex Samuel <samuel@codesourcery.com>
+
+ * Make-lang.in (CXX_LIB2FUNCS): Add cp-demangle.o and dyn-string.o.
+ (CXX_LIB2SRCS): Add cp-demangle.c and dyn-string.c.
+ (cp-demangle.o): New rule.
+ (dyn-string.o): Likewise.
+ * inc/cxxabi.h (__cxa_demangle): New declaration.
+
+2000-06-22 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (BV_USE_VCALL_INDEX_P): New macro.
+ (BV_GENERATE_THUNK_WITH_VTABLE_P): Likewise.
+ (lang_decl_flags): Add generate_with_vtable_p. Make vcall_offset
+ a tree, not an int.
+ (THUNK_GENERATE_WITH_VTABLE_P): New macro.
+ (make_thunk): Change prototype.
+ (emit_thunk): Rename to use_thunk.
+ (mangle_thunk): Change prototype.
+ * class.c (get_derived_offset): Simplify.
+ (copy_virtuals): Clear BV_USE_VCALL_INDEX_P and
+ BV_GENERATE_THUNK_WITH_VTABLE_P.
+ (build_primary_vtable): Simplify.
+ (add_virtual_function): Use BV_FN, rather than TREE_VALUE.
+ (dfs_find_base): Remove.
+ (update_vtable_entry_for_fn): Correct bug in finding the base
+ where a virtual function was first declared. Figure out whether
+ or not to emit a vcall-thunk with the vtables in which it appears.
+ Correct logic for deciding whether to use an ordinary thunk, or a
+ vcall thunk.
+ (finish_struct_1): Remove unnecssary code.
+ (build_vtbl_initializer): Use ssize_int for the running counter of
+ negative indices.
+ (build_vtbl_initializer): Only use vcall thunks where necessary.
+ Mark thunks as needing to be emitted with their vtables, or not.
+ (build_vbase_offset_vtbl_entries): Adjust for use of ssize_int in
+ indices. Use size_binop.
+ (dfs_build_vcall_offset_vtbl_entries): Don't rely on
+ BINFO_PRIMARY_MARKED_P here. Use BV_FN consistently. Use
+ size_binop.
+ (build_rtti_vtbl_entries): Adjust call to build_vtable_entry.
+ (build_vtable_entry): Mark thunks as needing to be emitted with
+ their vtables, or not.
+ * decl.c (lang_mark_tree): Mark the vcall_offset in a thunk.
+ * decl2.c (mark_vtable_entries): Use use_thunk instead of
+ emit_thunk.
+ * dump.c (dequeue_and_dump): Remove dead code. Dump new thunk
+ information.
+ * error.c (dump_expr): Use BV_FN.
+ * mangle.c (mangle_thunk): Adjust now that vcall_offset is a tree,
+ not an int.
+ * method.c (make_thunk): Likewise.
+ (emit_thunk): Rename to use_thunk. Allow callers to decide
+ whether or not to actually emit the thunk. Adjust for changes in
+ representation of vcall offsets.
+ * search.c (dfs_get_pure_virtuals): Use BV_FN.
+ * semantics.c (emit_associated_thunks): New function.
+ (expand_body): Use it.
+ * ir.texi: Adjust decriptions of thunks.
- * pt.c (instantiate_decl): Fix previous change.
+2000-06-22 Jason Merrill <jason@redhat.com>
-Thu Oct 9 12:08:21 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * pt.c (tsubst_decl, case FUNCTION_DECL): Clear DECL_SAVED_TREE.
+ (tsubst_friend_function): Copy it here.
- * pt.c (tsubst): Fix thinko.
- (instantiate_decl): Really use the original template.
+ * decl.c (grok_op_properties): Fix typo.
- * call.c (build_new_method_call): Use simple constructor_name for
- error messages.
+ * decl2.c (delete_sanity): Clarify warning, avoid failure on
+ deleting void*.
-Wed Oct 8 22:44:42 1997 Jeffrey A Law <law@cygnus.com>
+ * pt.c (check_explicit_specialization): Clarify error.
- * method.c (build_underscore_int): Don't use ANSI specific
- features.
+ * decl.c (pushdecl): Also pull out one of the FUNCTION_DECLs from
+ an old OVERLOAD when we're declaring a non-function.
+ (pushdecl, destroy_local_var): Check for error_mark_node.
+ (warn_extern_redeclared_static): Also bail early if
+ we're a CONST_DECL.
+ (push_overloaded_decl): Ignore an old error_mark_node.
-Wed Oct 8 00:18:22 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-06-22 Nathan Sidwell <nathan@codesourcery.com>
- * decl2.c (finish_prevtable_vardecl): Check DECL_REALLY_EXTERN
- for our key method; it might have been inlined by -O3.
+ * call.c (build_x_va_arg): Check if in a template decl.
+ * pt.c (tsubst_copy, case VA_ARG_EXPR): Use build_x_va_arg.
-Tue Oct 7 23:00:12 1997 Mark Mitchell <mmitchell@usa.net>
+2000-06-20 Alexandre Petit-Bianco <apbianco@cygnus.com>
- * decl.c (make_typename_type): Do not try to call lookup_field for
- non-aggregate types.
+ * class.c (push_lang_context): TYPE_NAME gets you to the Java
+ types DECLs.
+ * decl.c (check_goto): Computed gotos assumed OK.
-Tue Oct 7 22:52:10 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-06-20 Jason Merrill <jason@redhat.com>
- * typeck.c (build_reinterpret_cast): Tweak.
+ * pt.c (tsubst_decl, case TYPE_DECL): Fix test for TYPE_DECLs
+ for which we don't need to look for instantiations.
-Tue Oct 7 22:45:31 1997 Alexandre Oliva <oliva@dcc.unicamp.br>
+2000-06-21 Nathan Sidwell <nathan@codesourcery.com>
- * typeck.c (build_reinterpret_cast): Converting a void pointer
- to function pointer with a reinterpret_cast produces a warning
- if -pedantic is issued.
+ * parse.y (program): Always call finish_translation_unit.
+ * parse.c, parse.h: Rebuilt.
-Tue Oct 7 22:43:43 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
+2000-06-20 Zack Weinberg <zack@wolery.cumb.org>
- * typeck.c (c_expand_return): Don't warn about returning a
- reference-type variable as a reference.
+ * method.c: Don't include hard-reg-set.h.
-Tue Oct 7 21:11:22 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-06-20 Nathan Sidwell <nathan@codesourcery.com>
- * method.c (build_static_name): Fix typo.
+ * rtti.c (get_base_offset): Cope when vbase field is in a base.
-1997-10-07 Brendan Kehoe <brendan@lisa.cygnus.com>
+2000-06-20 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (duplicate_decls): Make sure DECL_LANG_SPECIFIC is set on
- OLDDECL before we try to do DECL_USE_TEMPLATE.
+ * call.c (build_conditional_expr): Use VOID_TYPE_P.
+ * cvt.c (cp_convert_to_pointer): Likewise.
+ (convert_to_void): Likewise.
+ * error.c (dump_expr): Likewise.
+ * except.c (complete_ptr_ref_or_void_ptr_p): Likewise.
+ * init.c (build_delete): Likewise.
+ * method.c (emit_thunk): Likewise.
+ * optmize.c (declare_return_variable): Likewise.
+ * rtti.c (get_tinfo_decl_dynamic): Likewise.
+ (get_typeid): Likewise.
+ (build_dynamic_cast_1): Likewise.
+ * typeck.c (composite_pointer_type): Likewise.
+ (common_type): Likewise.
+ (build_indirect_ref): Likewise.
+ (build_binary_op): Likewise.
+ (build_x_compound_expr): Likewise.
+ (check_return_expr): Likewise.
+ * typeck2.c (add_exception_specifier): Likewise.
+
+ * mangle.c (write_method_parms): Use direct comparison for end
+ of parmlist.
+
+2000-06-19 Benjamin Chelf <chelf@codesourcery.com>
+
+ * cp-tree.h (genrtl_try_block): Declare function.
+ (genrtl_handler): Likewise.
+ (genrtl_catch_block): Likewise.
+ (genrtl_ctor_stmt): Likewise.
+ (genrtl_subobject): Likewise.
+ (genrtl_decl_cleanup): Likewise.
+ (genrtl_do_poplevel): Likewise.
+ (genrtl_do_pushlevel): Likewise.
+ (genrtl_clear_out_block): Likewise.
+ (genrtl_goto_stmt): Likewise.
+ (genrtl_expr_stmt): Likewise.
+ (genrtl_decl_stmt): Likewise.
+ (genrtl_if_stmt): Likewise.
+ (genrtl_while_stmt): Likewise.
+ (genrtl_do_stmt): Likewise.
+ (genrtl_return_stmt): Likewise.
+ (genrtl_for_stmt): Likewise.
+ (genrtl_break_stmt): Likewise.
+ (genrtl_continue_stmt): Likewise.
+ (genrtl_scope_stmt): Likewise.
+ (genrtl_switch_stmt): Likewise.
+ (genrtl_case_label): Likewise.
+ (genrtl_begin_compound_stmt): Likewise.
+ (genrtl_finish_compound_stmt): Likewise.
+ (genrtl_compound_stmt): Likewise.
+ (genrtl_asm_stmt): Likewise.
+ (genrtl_named_return_value): Likewise.
+ (genrtl_begin_stmt_expr): Likewise.
+ (genrtl_finish_stmt_expr): Likewise.
+ (finish_for_stmt): Removed first argument.
+ (finish_switch_stmt): Likewise.
+
+ * semantics.c (genrtl_try_block): Define function.
+ (genrtl_handler): Likewise.
+ (genrtl_catch_block): Likewise.
+ (genrtl_ctor_stmt): Likewise.
+ (genrtl_subobject): Likewise.
+ (genrtl_decl_cleanup): Likewise.
+ (genrtl_do_poplevel): Likewise.
+ (genrtl_do_pushlevel): Likewise.
+ (genrtl_clear_out_block): Likewise.
+ (genrtl_goto_stmt): Likewise.
+ (genrtl_expr_stmt): Likewise.
+ (genrtl_decl_stmt): Likewise.
+ (genrtl_if_stmt): Likewise.
+ (genrtl_while_stmt): Likewise.
+ (genrtl_do_stmt): Likewise.
+ (genrtl_return_stmt): Likewise.
+ (genrtl_for_stmt): Likewise.
+ (genrtl_break_stmt): Likewise.
+ (genrtl_continue_stmt): Likewise.
+ (genrtl_scope_stmt): Likewise.
+ (genrtl_switch_stmt): Likewise.
+ (genrtl_case_label): Likewise.
+ (genrtl_begin_compound_stmt): Likewise.
+ (genrtl_finish_compound_stmt): Likewise.
+ (genrtl_compound_stmt): Likewise.
+ (genrtl_asm_stmt): Likewise.
+ (genrtl_named_return_value): Likewise.
+ (genrtl_begin_stmt_expr): Likewise.
+ (genrtl_finish_stmt_expr): Likewise.
+ (finish_for_stmt): Removed first argument and generate rtl
+ specific code.
+ (finish_switch_stmt): Likewise.
+ (do_poplevel): Removed generate rtl specific code.
+ (do_pushlevel): Likewise.
+ (add_tree): Likewise.
+ (finish_goto_stmt): Likewise.
+ (finish_expr_stmt): Likewise.
+ (begin_if_stmt): Likewise.
+ (finish_if_stmt_cond): Likewise.
+ (finish_then_clause): Likewise.
+ (begin_else_clause): Likewise.
+ (finish_else_clause): Likewise.
+ (finish_if_stmt): Likewise.
+ (clear_out_block): Likewise.
+ (begin_while_stmt): Likewise.
+ (finish_while_stmt_cond): Likewise.
+ (finish_while_stmt): Likewise.
+ (begin_do_stmt): Likewise.
+ (finish_do_body): Likewise.
+ (finish_do_stmt): Likewise.
+ (finish_return_stmt): Likewise.
+ (begin_for_stmt): Likewise.
+ (finish_for_init_stmt): Likewise.
+ (finish_for_cond): Likewise.
+ (finish_for_expr): Likewise.
+ (finish_break_stmt): Likewise.
+ (finish_continue_stmt): Likewise.
+ (begin_switch_stmt): Likewise.
+ (finish_switch_cond): Likewise.
+ (finish_case_label): Likewise.
+ (begin_try_block): Likewise.
+ (begin_function_try_block): Likewise.
+ (finish_try_block): Likewise.
+ (finish_cleanup_try_block): Likewise.
+ (finish_cleanup): Likewise.
+ (finish_function_try_block): Likewise.
+ (finish_handler_sequence): Likewise.
+ (finish_function_handler_sequence): Likewise.
+ (begin_handler): Likewise.
+ (finish_handler_parms): Likewise.
+ (begin_catch_block): Likewise.
+ (finish_handler): Likewise.
+ (begin_compound_stmt): Likewise.
+ (finish_compound_stmt): Likewise.
+ (finish_asm_stmt): Likewise.
+ (finish_label_stmt): Likewise.
+ (finish_label_decl): Likewise.
+ (finish_subobject): Likewise.
+ (finish_decl_cleanup): Likewise.
+ (finish_named_return_value): Likewise.
+ (begin_stmt_expr): Likewise.
+ (finish_stmt_expr): Likewise.
-Tue Oct 7 00:48:36 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (initialize_local_var): Changed call to finish_expr_stmt
+ to call genrtl_expr_stmt when appropriate.
- * decl.c (duplicate_decls): Don't warn about template instances.
+ * init.c (begin_init_stmts): Changed calls to begin_stmt_expr and
+ begin_compound_expr to call genrtl_begin_stmt_expr and
+ genrtl_begin_compound_expr when appropriate.
+ (finish_init_stmts): Changed calls to finish_compound_expr and
+ finish_stmt_expr to call genrtl_finish_compound_expr and
+ genrtl_finish_stmt_expr when appropriate.
+ (expand_default_init): Changed call to finish_expr_stmt to call
+ genrtl_expr_stmt when appropriate.
+ (build_vec_init): Likewise.
- * typeck.c (mark_addressable): Lose ancient code that unsets
- DECL_EXTERNAL.
+ * parse.y (simple_stmt): Removed first argument from call to
+ finish_for_stmt. Removed first argument from call to
+ finish_switch_stmt.
- * pt.c (do_decl_instantiation): Lose support for instantiating
- non-templates.
+ * parse.c: Regenerated.
- * call.c (build_new_function_call): Fix handling of null explicit
- template args.
- (build_new_method_call): Likewise.
+ * pt.c (tsubst_expr): Removed first argument from call to
+ finish_for_stmt. Removed first argument from call to
+ finish_switch_stmt.
-Mon Oct 6 23:44:34 1997 Mark Mitchell <mmitchell@usa.net>
+2000-06-16 Benjamin Chelf <chelf@codesourcery.com>
- * method.c (build_underscore_int): Fix typo.
+ * cp-tree.h (enum cplus_tree_code): Changed __DUMMY to
+ CP_DUMMY_TREE_CODE. Remove #include "c-common.def".
-1997-10-06 Brendan Kehoe <brendan@lisa.cygnus.com>
+ * lex.c (cplus_tree_code_type[]): Removed #include "c-common.def".
+ (cplus_tree_code_length[]): Likewise.
+ (cplus_tree_code_name[]): Likewise.
+ (init_parse): Added call to add_c_tree_codes. Changed
+ LAST_AND_UNUSED_TREE_CODE to LAST_C_TREE_CODE.
- * tree.c (print_lang_statistics): #if 0 call to
- print_inline_obstack_statistics until its definition is checked in.
+2000-06-16 Mark Mitchell <mark@codesourcery.com>
-Mon Oct 6 09:27:29 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (finish_mem_initializers): Declare.
+ (count_trees): Likewise.
+ * parse.y (base_init): Use finish_mem_initializers.
+ * semantics.c (finish_mem_initializers): New function.
- * decl2.c (finish_file): Move dump_tree_statistics to end.
+ * tree.c (count_trees_r): Prototype. Use DATA parameter to store
+ the number of trees.
+ (n_trees): Remove.
+ (count_trees): Don't use it.
- * pt.c (instantiate_decl): Look for the original template.
- (tsubst): Set DECL_IMPLICIT_INSTANTIATION on partial instantiations
- of member templates.
+2000-06-15 Jason Merrill <jason@redhat.com>
-Wed Oct 1 08:41:38 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * tree.c (count_trees): New debugging function.
- * Makefile.in (g++FAQ.*): New rules.
- (CONFLICTS): Update.
- * g++FAQ.texi: Moved from libg++.
+ * typeck.c (build_x_function_call): Use DECL_FUNCTION_TEMPLATE_P.
+ * init.c (build_member_call): Pull out the name of a DECL.
- * parse.y (PFUNCNAME): Only specify the type once.
+ * Makefile.in (semantics.o, pt.o): Depend on TIMEVAR_H.
+ * semantics.c (expand_body): Push to TV_INTEGRATION here.
+ * optimize.c (optimize_function): Not here.
+ * pt.c (instantiate_decl): Push to TV_PARSE.
-1997-10-01 Brendan Kehoe <brendan@lasher.cygnus.com>
+2000-06-15 Mark Mitchell <mark@codesourcery.com>
- * lex.c (real_yylex): Clean up the code to fully behave the way
- the c-lex.c parser does for complex and real numbers.
+ * cp-tree.h (struct language_function): Remove x_base_init_list
+ and x_member_init_list.
+ (current_base_init_list): Remove.
+ (current_member_init_list): Likewise.
+ (setup_vtbl_ptr): Change prototype.
+ (emit_base_init): Likewise.
+ (expand_member_init): Likewise.
+ (reinit_parse_for_function): Remove.
+ * decl.c (save_function_data): Don't clear x_base_init_list and
+ x_member_init_list.
+ (mark_language_function): Don't mark them.
+ * init.c (perform_member_init): Tweak comment.
+ (sort_member_init): Take the list of initializers as an argument.
+ (sort_base_init): Likewise.
+ (emit_base_init): Likewise.
+ (expand_member_init): Return the initializer. Don't use global
+ variables.
+ * lex.c (reinit_parse_for_function): Remove.
+ * method.c (build_template_parm_names): Correct substitution.
+ (do_build_copy_constructor): Don't use current_member_init_list
+ and current_base_init_list.
+ (synthesize_method): Likewise.
+ * parse.y (base_init): Split mem-initializers into
+ base-initializers and field-initializers.
+ (member_init_list): Build up the list here.
+ (member_init): Return the initializer.
+ (fn.depfn): Don't use reinit_parse_for_function.
+ * parse.c: Regenerated.
+ * pt.c (convert_nontype_argument): Don't make an ADDR_EXPR of the
+ ERROR_MARK.
+ (tsubst_expr): Don't use current_member_init_list
+ and current_base_init_list.
+ (tsubst_expr_values): Rename to ...
+ (tsubst_initializer_list): ... this. Use convert_from_reference.
+ * semantics.c (setup_vtbl_ptr): Don't use current_member_init_list
+ and current_base_init_list.
+ (begin_function_definition): Don't call reinit_parse_for_function.
+
+ * dump.c (dequeue_and_dump): Use TREE_VEC_LENGTH with vectors.
+
+ * error.c (dump_expr): Handle ADDR_EXPRs with REFERENCE_TYPE
+ correctly.
-Tue Sep 30 08:51:36 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (DECL_PENDING_INLINE_P): Relax checking.
+
+2000-06-14 Benjamin Chelf <chelf@codesourcery.com>
+
+ * cp-tree.h (IF_COND): Move to c-common.h.
+ (THEN_CLAUSE): Likewise.
+ (ELSE_CLAUSE): Likewise.
+ (WHILE_COND): Likewise.
+ (WHILE_BODY): Likewise.
+ (DO_COND): Likewise.
+ (DO_BODY): Likewise.
+ (RETURN_EXPR): Likewise.
+ (EXPR_STMT_EXPR): Likewise.
+ (FOR_INIT_STMT): Likewise.
+ (FOR_COND): Likewise.
+ (FOR_EXPR): Likewise.
+ (FOR_BODY): Likewise.
+ (SWITCH_COND): Likewise.
+ (SWITCH_BODY): Likewise.
+ (CASE_LOW): Likewise.
+ (CASE_HIGH): Likewise.
+ (GOTO_DESTINATION): Likewise.
+ (COMPOUND_BODY): Likewise.
+ (ASM_CV_QUAL): Likewise.
+ (ASM_STRING): Likewise.
+ (ASM_OUTPUTS): Likewise.
+ (ASM_INPUTS): Likewise.
+ (ASM_CLOBBERS): Likewise.
+ (DECL_STMT_DECL): Likewise.
+ (STMT_EXPR_STMT): Likewise.
+ (LABEL_STMT_LABEL): Likewise.
+ (SCOPE_BEGIN_P): Likewise.
+ (SCOPE_END_P): Likewise.
+ (SCOPE_STMT_BLOCK): Likewise.
+ (SCOPE_NULLIFIED_P): Likewise.
+ (SCOPE_NO_CLEANUPS_P): Likewise.
+ (SCOPE_PARTIAL_P): Likewise.
+ (ASM_VOLATILE_P): Likewise.
+ (STMT_LINENO): Likewise.
+ (STMT_LINENO_FOR_FN_P): Likewise.
+
+ * cp-tree.def: Removed SRCLOC, SIZEOF_EXPR, ARROW_EXPR,
+ ALIGNOF_EXPR, EXPR_STMT, COMPOUND_STMT, DECL_STMT, IF_STMT,
+ FOR_STMT, WHILE_STMT, DO_STMT, RETURN_STMT, BREAK_STMT,
+ CONTINUE_STMT, SWITCH_STMT, GOTO_STMT, LABEL_STMT, ASM_STMT,
+ SCOPE_STMT, CASE_LABEL, STMT_EXPR.
+
+ * Makefile.in (CXX_TREE_H): Added $(srcdir)/../c-common.def.
+
+ * Make-lang.in (CXX_SRCS): Added $(srcdir)/c-common.def.
+ (cc1plus$(exeext)): Added $(srcdir)/c-common.def.
+
+ * lex.c (cplus_tree_code_type[]): Added '#include "c-common.def"'.
+ (cplus_tree_code_length[]): Added '#include "c-common.def"'.
+ (cplus_tree_code_name[]): Added '#include "c-common.def"'.
+
+2000-06-14 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (BINFO_OVERRIDE_ALONG_VIRTUAL_PATH): New macro.
+ * class.c (dfs_find_final_overrider): Set it appropriately.
+ (dfs_built_vtt_inits): Check BINFO_OVERRIDE_ALONG_VIRTUAL_PATH to
+ avoid unneeded secondary vptrs.
+
+2000-06-13 Jakub Jelinek <jakub@redhat.com>
+
+ * class.c (build_secondary_vtable): Set DECL_USER_ALIGN.
+ (check_bitfield_decl, check_field_decl): Likewise.
+ (build_vtbl_or_vbase_field, build_base_field): Likewise.
+ (layout_class_type): Set DECL_USER_ALIGN resp. CLASSTYPE_USER_ALIGN.
+ * decl.c (record_unknown_type): Set TYPE_USER_ALIGN.
+ (xfer_tag, finish_enum): Likewise.
+ * decl2.c (finish_builtin_type): Likewise.
+ * init.c (init_init_processing): Likewise.
+ * pt.c (instantiate_class_template): Likewise.
+ * rtti.c (get_tinfo_decl, synthesize_tinfo_fn): Set DECL_USER_ALIGN.
+ * cp-tree.h (struct lang_type): Add user_align member.
+ (CLASSTYPE_USER_ALIGN): Define.
- * method.c (build_decl_overload_real): Reformat.
+Tue Jun 13 15:48:03 2000 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-Tue Sep 30 00:18:26 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * Make-lang.in (c++.install-common): Install g++-cross in
+ $(gcc_tooldir)/bin as g++ and c++; g++ in $(bindir) as
+ $(target_alias)-g++ and $(target_alias)-c++.
- * method.c (synthesize_method): If at_eof, determine our linkage.
+2000-06-12 Mark Mitchell <mark@codesourcery.com>
-1997-09-29 Paul Eggert <eggert@twinsun.com>
+ * class.c (vcall_offset_data_s): Add last_init and fns.
+ (overrides): Rename to same_signature_p.
+ (dfs_find_final_overrider): Adjust accordingly.
+ (mark_overriders): Likewise.
+ (warn_hidden): Likewise.
+ (build_vtbl_initializer): Reorganize machinery for building things
+ at negative offsets.
+ (build_vcall_and_vbase_vtbl_entries): Likewise.
+ (build_vbase_offset_vtbl_entries): Likewise.
+ (dfs_build_vcall_offset_vtbl_entries): Correct order of vcall
+ offset entries. Do not create two entries for functions with the
+ same signature.
+ (build_vcall_offset_vtbl_entries): Initialize vod->fns.
+ (build_rtti_vtbl_entries): Reorganize machinery for building things
+ at negative offsets.
+
+ * optimize.c (expand_call_inline): Don't recurse into the code
+ used to initialize the parameters more than once.
+
+2000-06-11 Mark Mitchell <mark@codesourcery.com>
+
+ * mangle.c (NESTED_TEMPLATE_MATCH): Fix typo in comment.
+ (is_std_substitution): Don't check CLASSTYPE_USE_TEMPLATE here.
+ (find_substitution): Only use the `Sa' substitution for
+ std::allocator, not instantiations of it.
+ (write_template_prefix): Move comment. Only use a TREE_LIST to
+ represent substitutions for a member template.
+ (write_array_type): Mangle array dimensions correctly.
+ * optimize.c (maybe_clone_body): Copy more information from the
+ cloned function.
+ * pt.c (regenerate_decl_from_template): Preserve DECL_USE_TEMPLATE
+ on the regenerated declaration.
+
+2000-06-11 Chip Salzenberg <chip@valinux.com>
+ Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (build_vtable): Clarify comment.
+ (build_ctor_vtbl_group): Pass the most derived type to
+ build_vtable.
+
+2000-06-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl2.c (compare_options): Don't needlessly cast away const-ness.
+
+2000-06-10 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (add_binding): Handle duplicate declarations of external
+ variables.
- * lex.c (real_yylex): Treat `$' just like `_', except issue a
- diagnostic if !dollars_in_ident or if pedantic.
+2000-06-09 Chip Salzenberg <chip@valinux.com>
+ Mark Mitchell <mark@codesourcery.com>
- * lang-specs.h (@c++): -ansi no longer implies -$.
+ * mangle.c (write_number): Take an unsigned HOST_WIDE_INT as an
+ argument.
+ (write_signed_number): New macro.
+ (write_unsigned_number): Likewise.
+ (write_source_name): Use them.
+ (write_number): Handle signed and unsigned values.
+ (write_integer_cst): Use tree_int_cst_sgn, and use
+ write_unsigned_number or write_signed_number as appropriate.
+ (write_discriminator): Use write_unsigned_number or
+ write_signed_number as appropriate.
+ (write_template_arg_literal): Likewise.
+ (write_array_type): Use tree_low_cst.
+ (write_template_parm): Use write_unsigned_number or
+ write_signed_number as appropriate.
+ (write_substitution): Adjust call to write_number.
+ (write_type): Get the TYPE_MAIN_VARIANT before mangling it.
+ (write_expression): Handle non-type template arguments of
+ reference type correctly.
+ (mangle_thunk): Use write_signed_number.
- * decl2.c (lang_decode_option):
- -traditional and -ansi now do not mess with
- dollars_in_ident.
+2000-06-09 Chip Salzenberg <chip@valinux.com>
-Mon Sep 29 19:57:51 1997 H.J. Lu <hjl@gnu.ai.mit.edu>
+ * mangle.c (find_substition): Don't mangle objects with typename
+ substitutions (e.g. "cin" as "Si").
- * Makefile.in (parse.o, decl.o): Also depend on
- $(srcdir)/../except.h $(srcdir)/../output.h.
- (decl2.o): Also depend on $(srcdir)/../expr.h ../insn-codes.h
- $(srcdir)/../except.h $(srcdir)/../output.h.
- (typeck.o, init.o): Also depend on $(srcdir)/../expr.h
- ../insn-codes.h.
+2000-06-09 Zack Weinberg <zack@wolery.cumb.org>
- * call.c, cp-tree.h, decl.c, tree.c: Finish prototyping.
+ * call.c (add_candidate): Use ggc_alloc_cleared.
+ * decl.c (lookup_label): Likewise.
+ * lex.c (retrofit_lang_decl): Likewise.
- * expr.c (cplus_expand_expr): Make it static.
+2000-06-09 Jason Merrill <jason@casey.soma.redhat.com>
- * decl2.c, init.c, typeck.c: Include "expr.h".
- (expand_expr): Use proper values when calling the function.
+ * semantics.c (expand_body): Push to TV_EXPAND.
+ * optimize.c (optimize_function): Push to TV_INTEGRATION.
+ * decl.c (start_function): Always call announce_function.
-Mon Sep 29 11:05:54 1997 Alexandre Oliva <oliva@dcc.unicamp.br>
+ * tinfo2.cc: Just declare abort.
- * lang-options.h: New -Wold-style-cast flag.
- * cp-tree.h (warn_old_style_cast): New variable.
- * decl2.c (warn_old_style_cast): Likewise.
- (lang_decode_option): Support -Wold-style-cast.
- (reparse_absdcl_as_casts): Produce old-style-cast warning.
+2000-06-09 Gabriel Dos Reis <gdr@codesourcery.com>
-Mon Sep 29 09:20:53 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+ * lex.c (DEF_OPERATOR): Say `operator@' -not- `operator @'
+ whenever @ is a symbolic name.
- * decl.c (cp_finish_decl): Allow expand_aggr_init to set
- TREE_USED, reset value based on already_used.
+2000-06-08 Jakub Jelinek <jakub@redhat.com>
- * init.c (expand_member_init): Revert change.
+ * method.c (make_thunk): Clear DECL_VTT_PARM in thunk.
-Mon Sep 29 08:57:53 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-06-07 Mark Mitchell <mark@codesourcery.com>
- * cp-tree.h, decl.c, decl2.c, pt.c:
- Lose DECL_C_STATIC and DECL_PUBLIC. Don't pretend statics are public.
+ * decl.c (pushdecl): Look up functions by DECL_NAME, not
+ DECL_ASSEMBLER_NAME.
- * decl2.c (lang_decode_option): Add missing ;.
+2000-06-06 Mark Mitchell <mark@codesourcery.com>
-Sat Sep 27 16:22:48 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * decl2.c (c_language): Define.
- * friend.c (do_friend): Disable injection for all template-derived
- decls.
- * decl2.c (lang_decode_option): Handle -fguiding-decls.
- * parse.y (notype_template_declarator): New nonterminal.
- (direct_notype_declarator): Use it.
- (complex_direct_notype_declarator): Likewise.
- (object_template_id): Accept any kind of identifier after TEMPLATE.
- (notype_qualified_id): Don't add template declarators here.
+2000-06-06 Gabriel Dos Reis <gdr@codesourcery.com>
-Sat Sep 27 16:21:58 1997 Mark Mitchell <mmitchell@usa.net>
+ * lex.c (lang_init_options): Tweak.
- * call.c (add_template_candidate): Add explicit_targs parameter.
- (build_scoped_method_call): Use it.
- (build_overload_call_real): Likewise.
- (build_user_type_conversion_1): Likewise.
- (build_new_function_call): Likewise.
- (build_object_call): Likewise.
- (build_new_op): Likewise.
- (build_new_method_call): Likewise.
- (build_new_function_call): Handle TEMPLATE_ID_EXPR.
- (build_new_method_call): Likewise.
+ * decl2.c: Remove #inclusion of diagnostic.h
+ (lang_decode_option): Move diagnostic formatting options to
+ toplevel.
- * class.c (finish_struct_methods): Add specialization pass to
- determine which methods were specializing which other methods.
- (instantiate_type): Handle TEMPLATE_ID_EXPR.
+ * lang-options.h: Remove documentation for diagnostic options.
- * cp-tree.def (TEMPLATE_ID_EXPR): New tree code.
+ * Makefile.in (lex.o): Depends upon diagnostic.h
- * cp-tree.h (name_mangling_version): New variable.
- (flag_guiding_decls): Likewise.
- (build_template_decl_overload): New function.
- (begin_specialization): Likewise.
- (reset_specialization): Likewise.
- (end_specialization): Likewise.
- (determine_explicit_specialization): Likewise.
- (check_explicit_specialization): Likewise.
- (lookup_template_function): Likewise.
- (fn_type_unification): Add explicit_targs parameter.
- (type_unification): Likewise.
+2000-06-06 Mark Mitchell <mark@codesourcery.com>
- * decl.c (duplicate_decls): Add smarts for explicit
- specializations.
- (grokdeclarator): Handle TEMPLATE_ID_EXPR, and function
+ * decl.c (redeclaration_error_message): If two TEMPLATE_DECLs have
+ the same DECL_RESULT, it's not a redefinition.
+ * pt.c (tsubst_decl): Remove code to handle illegal
specializations.
- (grokfndecl): Call check_explicit_specialization.
-
- * decl2.c (lang_decode_option): Handle -fname-mangling-version.
- (build_expr_from_tree): Handle TEMPLATE_ID_EXPR.
- (check_classfn): Handle specializations.
-
- * error.c (dump_function_name): Print specialization arguments.
-
- * friend.c (do_friend): Don't call pushdecl for template
- instantiations.
-
- * init.c (build_member_call): Handle TEMPLATE_ID_EXPR.
-
- * lang-options.h: Add -fname-mangling-version, -fguiding-decls,
- and -fno-guiding-decls.
-
- * lex.c (identifier_type): Return PFUNCNAME for template function
- names.
- * method.c (build_decl_overload_real): New function.
- (build_template_parm_names): New function.
- (build_overload_identifier): Use it.
- (build_underscore_int): New function.
- (build_overload_int): Use it. Add levels for template
- parameters.
- (build_overload_name): Likewise. Also, handle TYPENAME_TYPEs.
- (build_overload_nested_names): Handle template type parameters.
- (build_template_decl_overload): New function.
-
- * parse.y (YYSTYPE): New ntype member.
- (nested_name_specifier): Use it.
- (nested_name_specifier_1): Likewise.
- (PFUNCNAME): New token.
- (template_id, object_template_id): New non-terminals.
- (template_parm_list): Note specializations.
- (template_def): Likewise.
- (structsp): Likewise.
- (fn.def2): Handle member template specializations.
- (component_decl_1): Likewise.
- (direct_notype_declarator): Handle template-ids.
- (component_decl_1): Likewise.
- (direct_notype_declarator): Handle template-ids.
- (primary): Handle TEMPLATE_ID_EXPR, and template-ids.
-
- * pt.c (processing_specializations): New variable.
- (template_header_count): Likewise.
- (type_unification_real): New function.
- (processing_explicit_specialization): Likewise.
- (note_template_header): Likewise.
- (is_member_template): Handle specializations.
- (end_template_decl): Call reset_specialization.
- (push_template_decl): Handle member template specializations.
- (tsubst): Likewise.
- (tsubst_copy): Handle TEMPLATE_ID_EXPR.
- (instantiate_template): Handle specializations.
- (instantiate_decl): Likewise.
- (fn_type_unification): Handle explicit_targs.
- (type_unification): Likewise. Allow incomplete unification
- without an error message, if allow_incomplete.
- (get_bindings): Use new calling sequence for fn_type_unification.
-
- * spew.c (yylex): Handle PFUNCNAME.
-
- * tree.c (is_overloaded_fn): Handle TEMPLATE_ID_EXPR.
- (really_overloaded_fn): Likewise.
- (get_first_fn): Handle function templates.
-
- * typeck.c (build_x_function_call): Use really_overloaded_fn.
- Handle TEMPLATE_ID_EXPR.
- (build_x_unary_op): Likewise.
- (build_unary_op): Likewise.
- (mark_addressable): Templates whose address is taken are marked
- as used.
-
-1997-09-25 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * decl.c (init_decl_processing): Declare __builtin_constant_p as
- accepting any kind of type, not only int.
-
-Fri Sep 26 00:22:56 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * search.c (get_matching_virtual): Notice virtual bases when sorrying
- about covariant returns.
-
- * parse.y (member_init): Also imply typename here. Remove ancient
- extension for initializing base members.
-
-Thu Sep 25 11:11:13 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- Handle multi-level typenames and implicit typename in base list.
- * parse.y (typename_sub{,[0-2]}): New rules.
- (structsp, rule TYPENAME_KEYWORD): Use typename_sub.
- (nonnested_type): New rule.
- (complete_type_name): Use it.
- (base_class.1): Use typename_sub and nonnested_type.
- (nested_name_specifier): Don't elide std:: here.
- * decl.c (make_typename_type): Handle getting a type for NAME.
- (lookup_name_real): Turn std:: into :: here.
-
- Rvalue conversions were removed in London.
- * call.c (is_subseq): Don't consider lvalue transformations.
- (build_conv): LVALUE_CONV and RVALUE_CONV get IDENTITY_RANK.
- (joust): Re-enable ?: kludge.
-
-1997-09-22 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (start_function): Up warning of no return type to be a
- pedwarn.
-
-Mon Sep 22 14:15:34 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
-
- * init.c (expand_member_init): Don't set TREE_USED.
- * decl.c (cp_finish_decl): Mark decls used if type has TREE_USED
- set,don't clear TREE_USED wholesale.
-
-Sat Sep 20 15:31:00 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_over_call): Do require_complete_type before
- build_cplus_new.
-
-Thu Sep 18 16:47:52 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * search.c (lookup_field): Call complete_type in all cases.
-
- * decl.c (finish_function): Just warn about flowing off the end.
-
-Wed Sep 17 10:31:25 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokparms): Don't bash a permanent list node if we're
- in a function.
-
-1997-09-17 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * Makefile.in (CONFLICTS): Fix s/r conflict count to 18.
-
-Tue Sep 16 14:06:56 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_new_op): Give better error for syntactically
- correct, but semantically invalid, use of undeclared template.
-
- * call.c (compare_qual): Handle pmfs.
-
- * decl.c (store_parm_decls): last_parm_cleanup_insn is the insn
- after the exception spec.
-
-Mon Sep 15 11:52:13 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (null_ptr_cst_p): Integer type, not integral type.
-
- * call.c (joust): Disable warnings until they can be moved to the
- right place.
-
-Fri Sep 12 16:11:13 1997 Per Bothner <bothner@cygnus.com>
-
- * Makefile.in, config-lang.in: Convert to autoconf.
-
-Thu Sep 11 17:14:55 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (lookup_name_real): Add implicit 'typename' to types from
- base classes.
-
- * pt.c (most_specialized_class): Fix typo.
- (tsubst): Move constant folding to TREE_VEC case.
-
-Thu Sep 11 10:08:45 1997 Mark Mitchell <mmitchell@usa.net>
-
- * pt.c (do_poplevel): Don't warn about unused local variables
- while processing_template_decl since we don't always know whether
- or not they will need constructing/destructing.
-
- * pt.c (uses_template_parms): Check the values of an enumeration
- type to make sure they don't depend on template parms.
-
- * decl.c (make_typename_type): Don't lookup the field if the
- context uses template parms, even if we're not
- processing_template_decl at the moment.
-
- * pt.c (coerce_template_parms): Avoid looking at the
- TYPE_LANG_DECL portion of a typename type, since there won't be
- one.
- (tsubst): Do constant folding as necessary to make sure that
- arguments passed to lookup_template_class really are constants.
-
-Wed Sep 10 11:21:55 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-06-06 Nathan Sidwell <nathan@codesourcery.com>
- * except.c (expand_builtin_throw): #ifndef DWARF2_UNWIND_INFO.
- * decl2.c (finish_file): Only register exception tables if we
- need to.
+ * exception.cc: (__eh_alloc, __eh_free): Moved to libgcc2.c
- * decl.c (init_decl_processing): Add __builtin_[fs]p.
+2000-06-05 Jason Merrill <jason@casey.soma.redhat.com>
-Tue Sep 9 19:49:38 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * search.c (maybe_suppress_debug_info): Don't check
+ CLASSTYPE_INTERFACE_ONLY if CLASSTYPE_INTERFACE_KNOWN isn't set.
- * pt.c (unify): Just return 0 for a TYPENAME_TYPE.
+ * pt.c (mark_decl_instantiated): Do SET_DECL_EXPLICIT_INSTANTIATION
+ here if extern_p.
-Tue Sep 9 17:57:25 1997 Mark Mitchell <mmitchell@usa.net>
+ Remember instantiation context in deferred instantiations.
+ * cp-tree.h (struct tinst_level): Remove.
+ (TINST_DECL, TINST_LINE, TINST_FILE): New macros.
+ * pt.c (current_tinst_level): Now a tree.
+ (print_template_context, push_tinst_level, pop_tinst_level,
+ tinst_for_decl): Adjust.
+ (reopen_tinst_level): New fn.
+ (init_pt): Register current_tinst_level as a root.
+ (add_pending_template): Put current_tinst_level in TREE_PURPOSE
+ of the pending templates list.
+ (instantiate_pending_templates): Adjust. Call reopen_tinst_level.
+ * lex.c (extract_interface_info): Adjust.
+ * decl2.c (warn_if_unknown_interface): Adjust.
- * error.c (dump_decl): Avoid crashing when presented with a
- uninitialized constant, as can occur with a template parameter.
- (dump_expr): Make sure that there are enough levels of
- current_template_parms before we start diving through them.
+2000-06-05 Mark Mitchell <mark@codesourcery.com>
-1997-09-09 Brendan Kehoe <brendan@lisa.cygnus.com>
+ * class.c (indirect_primary_base_p): New function.
+ (determine_primary_base): Use it.
- * typeck.c (build_indirect_ref): Heed FLAG_VOLATILE similar to
- c-typeck.c.
+2000-06-05 Nathan Sidwell <nathan@codesourcery.com>
-Tue Sep 9 09:36:39 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+ Update new-abi dynamic cast algorithm.
+ * tinfo.cc (__class_type_info::__dyncast_result): Add
+ whole_details. Adjust constructor.
+ (__vmi_class_type_info::__do_dyncast): Adjust for vmi_flags.
+ Avoid unnecessary searching.
+ (__dynamic_cast): Adjust for __dyncast_result::whole_details.
- * except.c (expand_throw): Call build_delete for all
- exception types, not just objects with destructors.
+Mon Jun 5 06:48:55 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-Mon Sep 8 02:33:20 1997 Jody Goldberg <jodyg@idt.net>
-
- * decl.c (current_local_enum): Remove static.
- * pt.c (tsubst_enum): Save and restore value of current_local_enum
- in case template is expanded in enum decl.
- (instantiate_class_template): Use new tsubst_enum signature.
- (tsubst_expr): Likewise.
-
-Mon Sep 8 01:21:43 1997 Mark Mitchell <mmitchell@usa.net>
-
- * pt.c (begin_member_template_processing): Take a function as
- argument, not a set of template arguments. Use the template
- parameters, rather than the arguments. Handle non-type parameters
- correctly. Push a binding level for the parameters so that multiple
- member templates using the same parameter names can be declared.
- (end_member_template_processing): Pop the binding level.
- (push_template_decl): Mark member templates as static when
- appropriate.
-
- * lex.c (do_pending_inlines): Pass the function, not its template
- arguments, to begin_member_template_processing.
- (process_next_inline): Likewise.
- (do_pending_defargs): Likewise.
-
- * error.c (dump_expr): Obtain the correct declaration for a
- TEMPLATE_CONST_PARM.
-
- * call.c (add_template_conv_candidate): New function.
- (build_object_call): Handle member templates, as done in the other
- build_ functions.
-
-Sat Sep 6 10:20:27 1997 Mark Mitchell <mmitchell@usa.net>
-
- * decl.c (replace_defag): Undo previous change.
- * lex.c (do_pending_defargs): Deal with member templates.
+ * decl.c (init_decl_processing): Don't call record_component_aliases.
+ * tree.c (build_cplus_array_type_1): Likewise.
- * pt.c (is_member_template): Avoid crashing when passed a
- non-function argument.
+2000-06-04 Mark Mitchell <mark@codesourcery.com>
+
+ * ir.texi: Correct typo.
+ * mangle.c (write_expression): Handle non-type template arguments
+ with reference type.
+ * method.c (build_overload_value): Likewise.
+ * pt.c (convert_nontype_argument): Explicitly represent conversion
+ to a reference with an ADDR_EXPR.
+ (unify): Always unify arguments in left-to-right order.
+
+2000-06-03 Alex Samuel <samuel@codesourcery.com>
+ Mark Mitchell <mark@codesourcery.com>
+
+ * Make-lang.in (CXX_SRCS): Add mangle.c.
+ * Makefile.in (CXX_OBJS): Add mangle.o.
+ (mangle.o): New rule.
+
+ * class.c (local_classes): New variable.
+ * class.c (get_vtable_name): Use mangle_vtable_for_type for new ABI.
+ (get_vtt_name): Use mangle_vtt_name for new ABI.
+ (init_class_processing): Initialize local_classes.
+ (build_ctor_vtbl_group): Use mangle_ctor_vtbl_for_type for new ABI.
+ * cp-tree.h (cp_tree_index): Add CPTI_STD_IDENTIFIER.
+ (std_identifier): New macro.
+ (DECL_VOLATILE_MEMFUNC_P): New macro.
+ (DECL_NAMESPACE_STD_P): Likewise.
+ (local_classes): Declare.
+ (get_mostly_instantiated_function_type): Declare.
+ (init_mangle): Declare.
+ (mangle_decl): Likewise.
+ (mangle_type_string): Likewise.
+ (mangle_type): Likewise.
+ (mangle_typeinfo_for_type): Likewise.
+ (mangle_typeinfo_string_for_type): Likewise.
+ (mangle_vtbl_for_type): Likewise.
+ (mangle_vtt_for_type): Likewise.
+ (mangle_ctor_vtbl_for_type): Likewise.
+ (mangle_thunk): Likewise.
+ (mangle_conv_op_name_for_type): Likewise.
+ (mangle_guard_variable): Likewise.
+ * decl.c (pushtag): Keep track of local classes.
+ (initialize_predefined_identifiers): Initialize std_identifier.
+ (init_decl_processing): Use std_identifier.
+ (start_decl): Don't treat instantiations as specializations.
+ (grokdeclarator): Likewise.
+ (grokvardecl): Call mangle_decl for new ABI. Only set mangled
+ name for fully-instantiated templates.
+ * decl2.c (grokclassfn): Use set_mangled_name_for_decl for
+ destructors with the new ABI.
+ (finish_static_data_member_decl): Use mangle_decl under the new ABI.
+ (grokfield): Use mangle_type for new ABI.
+ (grokoptypename): Use mangle_conv_op_for_type for new ABI.
+ (get_sentry): Use mangle_guard_variable for new ABI.
+ (start_static_initialization_or_destruction): Likewise.
+ * expr.c (extract_aggr_init): Remove.
+ (extract_scalar_init): Likewise.
+ (extract_init): Remove #if 0'd code.
+ * mangle.c: New function.
+ * method.c (build_mangled_name): Assert not flag_new_abi.
+ (build_static_name): Likewise.
+ (build_decl_overload_real): Likewise.
+ (build_typename_overload): Likewise.
+ (build_overload_with_type): Likewise.
+ (build_overload_name): Likewise.
+ (get_ctor_vtbl_name): Likewise.
+ (start_squangling): Likewise.
+ (get_id_2): Likewise.
+ (set_mangled_name_for_decl): Call mangle_decl for new ABI.
+ (init_method): Call init_mangle for new ABI.
+ (make_thunk): Call mangle_thunk for new ABI.
+ * operators.def: Correct new ABI manglings for the `%' operator.
+ Add `::' operator.
+ * pt.c (build_template_decl): Copy DECL_OVERLOADED_OPERATOR_P and
+ DECL_ASSIGNMENT_OPERATOR_P to the TEMPLATE_DECL.
+ (lookup_template_class): Call mangle_decl for new ABI.
+ (get_mostly_instantiated_function_type): New function.
+ (set_mangled_name_for_template_decl): Use it.
+ (tsubst_decl): Use set_mangled_name_for_decl for destructors with
+ the new ABI. Use mangle_conv_op_name_for_type for instantiated
+ conversion op names.
+ * rtti.c (tinfo_name): Call mangle_type_string for new ABI.
+ (get_tinfo_decl): Call mangle_typeinfo_for_type for new ABI.
+ (tinfo_base_init): Likewise. Mangle typeinfo string name with
+ mangle_typeinfo_string_for_type.
+
+2000-06-03 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (TMPL_ARGS_LEVEL): Clarify comment.
+ (INNERMOST_TEMPLATE_ARGS): New macro.
+ (innermost_args): Remove.
+ (get_innermost_template_args): New function.
+ * decl2.c (arg_assoc_class): Use INNERMOST_TEMPLATE_ARGS.
+ * error.c (dump_function_decl): Be caution when using
+ most_general_template.
+ * method.c (build_template_parm_names): Use
+ INNERMOST_TEMPLATE_ARGS.
+ * pt.c (add_to_template_args): Tidy comment
+ (get_innermost_template_args): New function.
+ (check_explicit_specialization): Clear DECL_INITIAL for a new
+ specialization.
+ (process_partial_specialization): Use INNERMOST_TEMPLATE_ARGS.
+ Tidy.
+ (push_template_decl): Always register specializations of the most
+ general template.
+ (convert_template_argument): Use INNERMOST_TEMPLATE_ARGS.
+ (coerce_template_parms): Likewise.
+ (lookup_template_class): Likewise.
+ (innermost_args): Remove.
+ (tsubst_decl): Use INNERMOST_TEMPLATE_ARGS.
+ (tsubst_decl): Handle tricky specializations. Use
+ get_innermost_template_args.
+ (instantiate_template): Simplify handling of partial
+ instantiations.
+ (get_class_bindings): Use INNERMOST_TEMPLATE_ARGS.
+ (most_general_template): Reimplement, in a more straightforward
+ manner.
+ (regenerate_decl_from_template): Tweak formatting. Use
+ TMPL_ARGS_DEPTH for clarity.
+ (set_mangled_name_for_template_decl): Use INNERMOST_ARGS.
-Fri Sep 5 17:27:38 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * dump.c (dequeue_and_dump): Dump information about thunks.
- * class.c (grow_method): Remove check for redeclaration.
+2000-06-01 Richard Henderson <rth@cygnus.com>
-Fri Sep 5 01:37:17 1997 Mark Mitchell <mmitchell@usa.net>
+ * decl.c (init_decl_processing): Set lang_get_alias_set first thing.
- * cp-tree.h (INNERMOST_TEMPLATE_PARMS): New macro.
- (DECL_INNERMOST_TEMPLATE_PARMS): Likewise.
- (PRIMARY_TEMPLATE_P): Use it.
- * call.c (build_overload_call_real): Use it.
- * class.c (instantiate_type): Likewise.
- * decl.c (decls_match): Likewise.
- * method.c (build_overload_identifier): Likewise.
- * pt.c (push_template_decl): Likewise.
- (classtype_mangled_name): Likewise.
- (lookup_template_class): Likewise.
+2000-06-01 Richard Henderson <rth@cygnus.com>
- * cp-tree.h (DECL_NTPARMS): Change name from DECL_NT_PARMS to
- DECL_NTPARMS to conform to usage elsewhere.
- * call.c (add_template_candidate): Likewise.
- * class.c (instantiate_type): Likewise.
- * pt.c (instantiate_template): Likewise.
- (get_bindings): Likewise.
+ * decl2.c (unsupported_options): Fix typo, make const.
+ (lang_decode_option): Fix bsearch argument order.
- * class.c (grow_method): Use DECL_FUNCTION_TEMPLATE_P instead of
- is_member_template.
+2000-06-01 Mark Mitchell <mark@codesourcery.com>
- * pt.c (unify): Undo changes to allow multiple levels of template
- parameters.
- (type_unification): Likewise.
- (fn_type_unification): Likewise.
- (get_class_bindings): Likewise.
- * cp-tree.h (Likewise).
+ * init.c (resolve_offset_ref): Remove check for TREE_ADDRESSABLE
+ on FIELD_DECLs.
- * decl.c (replace_defarg): Check that the type of the default
- parameter does not invlove a template type before complaining
- about the initialization.
+Wed May 31 14:09:00 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
- * error.c (dump_expr): Deal with template constant parameters in
- member templates correctly.
-
- * pt.c (is_member_template): Deal with class specializations
- correctly.
- (tsubst): Handle "partial instantiation" of member templates
- correctly.
+ * cp-tree.h (c_get_alias_set): Deleted.
+ * Makefile.in (decl.o): Include ../expr.h.
+ * decl.c (expr.h): Include.
+ (init_decl_processing): Call record_component_aliases for arrays.
+ (grokdeclarator): Likewise.
+ Set TREE_ADDRESSABLE for fields that aren't bitfields.
+ * tree.c (build_cplus_array_type_1): Call record_component_aliases.
-Wed Sep 3 12:30:24 1997 Mark Mitchell <mmitchell@usa.net>
+2000-05-31 Mark Mitchell <mark@codesourcery.com>
- * pt.c (type_unification): Change calling sequence to allow for
- multiple levels of template parameters.
- (tsubst_expr): Likewise.
- (tsubst): Likewise.
- (tsubst_copy): Likewise.
- (instantiate_template): Likewise.
- (unify): Likewise.
- * call.c (build_overload_call_real): Use it.
- (add_builtin_candidate): Use it.
- (build_new_method_call): Use it.
- * class.c (instantiate_type): Use it.
- * decl.c (grokdeclarator): Use it.
- * decl2.c (finish_file): Use it.
- * method.c (build_overload_identifier): Use it.
-
- * call.c (add_template_candidate): Add additional parameter for
- the function return type. Call fn_type_unification istead of
- type_unification.
- (build_user_type_conversion_1): Handle member templates.
+ Remove guiding declaration support.
+ * cp/cp-tree.h (flag_dump_translation_unit): Make it const.
+ (flag_guiding_decls): Remove.
+ * call.c (build_user_type_conversion_1): Remove support for
+ guiding decls.
(build_new_function_call): Likewise.
(build_new_op): Likewise.
(build_new_method_call): Likewise.
+ * decl.c (start_function): Likewise.
+ * friend.c (is_friend): Likewise.
+ (do_friend): Likewise.
+ * decl2.c ((flag_dump_translation_unit): Make it const.
+ (flag_guiding_decls): Remove.
+ (unsupported_options): New variable
+ (compare_options): New function.
+ (lang_decode_option): Use them.
- * class.c (grow_method): Don't give an error message indicating
- that two member templates with the same name are ambiguous.
- (finish_struct): Treat member template functions just like member
- functions.
-
- * cp-tree.h (check_member_template): Add declaration.
- (begin_member_template_processing): Likewise.
- (end_member_template_processing): Likewise.
- (fn_type_unification): Likewise.
- (is_member_template): Likewise.
- (tsubst): Change prototype.
- (tsubst_expr): Likewise.
- (tsubst_copy): Likewise.
- (instantiate_template): Likewise.
- (get_bindings): Likewise.
-
- * decl.c (decls_match): Handle multiple levels of template
- parameters.
- (pushdecl): Handle template type params just like other type
- declarations.
- (push_class_level_binding): Return immediately if the
- class_binding_level is NULL.
- (grokfndecl): If check_classfn() returns a member_template, use
- the result of the template, not the template itself.
-
- * decl2.c (check_member_template): New function. Check to see
- that the entity declared to be a member template can be one.
- (check_classfn): Allow redeclaration of member template functions
- with different types; the new functions can be specializations or
- explicit instantiations.
-
- * error.c (dump_decl): Handle multiple levels of template
- parameters.
- (dump_function_decl): Update to handle function templates.
-
- * lex.c (do_pending_inlines): Set up template parameter context
- for member templates.
- (process_next_inline): Likewise.
-
- * method.c (build_overload_identifier): Adjust for multiple levels
- of template parameters.
-
- * parse.y (fn.def2): Add member templates.
- (component_decl_1): Likewise.
+ * decl.c (build_cp_library_fn): Set DECL_CONTEXT.
- * pt.c (begin_member_template_processing): New function.
- (end_member_template_processing): Likewise.
- (is_member_template): Likewise.
- (fn_type_unification): Likewise.
- (current_template_parms): Return a vector of all the template
- parms, not just the innermost level of parms.
- (push_template_decl): Deal with the possibility of member
- templates.
- (lookup_template_class): Likewise.
- (uses_template_parms): Likewise.
- (tsubst): Modify processing to TEMPLATE_TYPE_PARM and
- TEMPLATE_CONST_PARM to deal with multiple levels of template
- arguments. Add processing of TEMPLATE_DECL to produce new
- TEMPLATE_DECLs from old ones.
- (do_decl_instantiation): Handle member templates.
-
- * search.c (lookup_fnfields_1): Handle member template conversion
+ * method.c (mangle_expression): Adjust test for legal expression
operators.
- * tree.c (cp_tree_equal): Check the levels, as well as the
- indices, of TEMPLATE_CONST_PARMs.
-
- * typeck.c (comptypes): Check the levels, as well as the indices,
- fo TEMPLATE_TYPE_PARMs.
- (build_x_function_call): Treat member templates like member
- functions.
-
-Wed Sep 3 11:09:25 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (c_expand_return): Always convert_for_initialization
- before checking for returning a pointer to local.
-
- * pt.c (type_unification): If strict and the function parm doesn't
- use template parms, just compare types.
-
-Wed Sep 3 10:35:49 1997 Klaus Espenlaub <kespenla@student.informatik.uni-ulm.de>
-
- * method.c (build_overloaded_value): Replace direct call
- to the floating point emulator with REAL_VALUE_TO_DECIMAL macro.
-
-Wed Sep 3 00:02:53 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (convert_arguments): Don't arbitrarily choose the first
- of a set of overloaded functions.
-
-Tue Sep 2 12:09:13 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (real_yylex): Don't elide __FUNCTION__.
-
- * method.c (build_overload_value): Add in_template parm.
- (build_overload_int): Likewise.
- (build_overload_identifier): Pass it.
-
- * decl.c (duplicate_decls): Don't bash a previous template
- definition with a redeclaration.
-
- * pt.c (unify): float doesn't match double.
-
- * pt.c (do_type_instantiation): Handle getting a _TYPE or a
- TYPE_DECL. Handle getting non-template types.
- * parse.y (explicit_instantiation): Use typespec instead of
- aggr template_type.
-
-Tue Sep 2 10:27:08 1997 Richard Henderson <rth@cygnus.com>
-
- * typeck.c (build_ptrmemfunc1): Clean up ptr->int cast warnings.
-
-Mon Sep 1 13:19:04 1997 Eugene Mamchits <eugin@ips.ras.ru>
-
- * call.c (add_builtin_candidate): Add missing TREE_TYPE.
- (compare_ics): Likewise.
-
-Mon Sep 1 13:19:04 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (joust): Warn about choosing one conversion op over
- another because of 'this' argument when the other return type is
- better.
- (source_type): New fn.
-
- * call.c (build_new_op): Strip leading REF_BIND from first operand
- to builtin operator.
-
- * decl2.c (mark_vtable_entries): Mark abort_fndecl as used when we
- use its RTL.
-
-Thu Aug 28 09:45:23 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (null_ptr_cst_p): Remove support for (void*)0.
-
-Wed Aug 27 02:03:34 1997 Jeffrey A Law <law@cygnus.com>
-
- * typeck.c (expand_target_expr): Make definition match declaration.
-
- * class.c (get_basefndecls): Make definition match declaration.
-
-Mon Aug 25 14:30:02 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * input.c (sub_getch): Eventually give up and release the input file.
-
- * decl.c (cp_finish_decl): If #p i/i, put inline statics in the
- right place.
-
- * call.c (joust): Tweak message.
-
-Sat Aug 23 18:02:59 1997 Mark Mitchell <mmitchell@usa.net>
-
- * error.c (type_as_string): Put const/volatile on template type
- parameters where appropriate.
-
-Sat Aug 23 17:47:22 1997 Jeffrey A Law <law@cygnus.com>
-
- * call.c (strictly_better): Make arguments unsigned ints.
-
-Thu Aug 21 18:48:44 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (real_yylex): Refer to __complex instead of complex.
-
-Thu Aug 21 22:25:46 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * lex.c (real_yylex): Don't use getc directly.
+ * pt.c (instantiate_decl): Save and restore the local
+ specializations list.
-Wed Aug 20 17:25:08 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-05-30 Jason Merrill <jason@decepticon.cygnus.com>
- * call.c (is_subseq): Don't try to be clever.
+ * decl.c (grok_reference_init): Pass LOOKUP_ONLYCONVERTING.
-Wed Aug 20 03:13:36 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
+2000-05-30 Mark Mitchell <mark@codesourcery.com>
- * parse.y, pt.c: Include "except.h".
- * call.c, class.c, class.h, cp-tree.h, cvt.c, decl.c, decl2.c,
- error.c, except.c, expr.c, friend.c, g++spec.c, init.c, input.c,
- lex.c, lex.h, method.c, parse.y, pt.c, repo.c, rtti.c, search.c,
- sig.c, spew.c, tree.c, typeck.c, typeck2.c, xref.c: Finish
- prototyping.
+ * call.c (add_template_candidate_real): Handle member template
+ constructors for classes with virtual bases.
+ (build_user_type_conversion_1): Use in_charge_arg_for_name.
+ (build_new_method_call): Use DECL_NONSTATIC_MEMBER_FUNCTION_P.
-Wed Aug 20 01:34:40 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * ir.texi: Update thunk documentation.
- * decl2.c (mark_vtable_entries): Instead of replacing pure
- virtuals with a reference to __pure_virtual, copy the decl and
- change the RTL.
+ * call.c (joust): Fix handling of overloaded builtin operators.
-Tue Aug 19 02:26:07 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-05-30 Zack Weinberg <zack@wolery.cumb.org>
- * pt.c (lookup_nested_type_by_name): Handle typedef wierdness.
+ * cp-tree.h (DECL_ANTICIPATED): New macro.
+ Document new use of DECL_LANG_FLAG_7.
+ * decl.c (builtin_function): Set DECL_ANTICIPATED on builtins
+ in the user namespace.
+ * lex.c (do_identifier): If the identifier's declaration has
+ DECL_ANTICIPATED on, it has not yet been declared. But do not
+ replace it with an ordinary implicit declaration.
- * typeck2.c (my_friendly_abort): Report bugs to egcs-bugs@cygnus.com.
+ * tinfo2.cc: Include stdlib.h.
- * pt.c (instantiate_class_template): Call repo_template_used
- before finish_prevtable_vardecl.
+2000-05-29 Mark Mitchell <mark@codesourcery.com>
- * call.c (is_subseq): New fn.
- (compare_ics): Use it.
+ * cp-tree.h (CLASSTYPE_ALIGN_UNIT): New macro.
+ * class.c (layout_empty_base): Use CLASSTYPE_ALIGN_UNIT, not
+ CLASSTYPE_ALIGN.
- * repo.c (finish_repo): Don't crash on no args.
+2000-05-28 Gabriel Dos Reis <gdr@codesourcery.com>
- * parse.y (named_complex_class_head_sans_basetype): Handle
- explicit global scope.
- * decl2.c (handle_class_head): New fn.
+ * decl2.c (lang_decode_option): Use skip_leading_substring instead
+ of plain strncmp.
- * pt.c (unify): Add CONST_DECL case.
+2000-05-28 Alexandre Oliva <aoliva@cygnus.com>
-Thu Aug 14 10:05:13 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+ * operators.def (<?): Duplicated, should have been...
+ (>?): this. Fixed.
- * rtti.c (permanent_obstack): Fix decl to not be a pointer.
+2000-05-27 Alex Samuel <samuel@codesourcery.com>
+ Mark Mitchell <mark@codesourcery.com>
- * cp-tree.h (report_type_mismatch): Add prototype.
- * call.c (build_overload_call_real): Remove erroneous fourth
- argument to report_type_mismatch.
- (build_user_type_conversion_1): Remove erroneous second arg to
- tourney.
- (build_new_function_call): Likewise.
- (build_object_call): Likewise.
+ * cp-tree.h (ansi_opname): Make it a macro.
+ (ansi_assopname): Likewise.
+ (struct lang_decl_flags): Add assignment_operator_p.
+ (struct lang_decl): Add operator_code.
+ (DECL_VTT_PARM): Adjust.
+ (DECL_OVERLOADED_OPERATOR_P): Return the operator_code for an
+ overloaded operator.
+ (SET_OVERLOADED_OPERATOR_CODE): New macro.
+ (DECL_ASSIGNMENT_OPERATOR_P): New macro.
+ (DECL_ARRAY_DELETE_OPERATOR_P): Adjust.
+ (opname_tab): Remove.
+ (assignop_tab): Likewise.
+ (operator_name_info_t): New type.
+ (operator_name_info): New variable.
+ (assignment_operator_name_info): Likewise.
+ (build_cp_library_fn): Remove declaration.
+ (push_cp_library_fn): Likewise.
+ (operator_name_string): Likewise.
+ (build_decl_overload): Likewise.
+ * call.c (print_z_candidates): Simplify.
+ (build_object_call): Adjust usage of ansi_opname. Use
+ DECL_OVERLOADED_OPERATOR_P.
+ (op_error): Adjust operator name lookup.
+ (build_conditional_expr): Adjust usage of ansi_opname.
(build_new_op): Likewise.
- (build_new_method_call): Likewise.
-
-Wed Aug 13 19:19:25 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * error.c (dump_decl): Don't bother processing a function with no
- DECL_LANG_SPECIFIC.
-
- * method.c (emit_thunk): Call init_function_start in the macro case.
-
-Wed Aug 13 10:46:19 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
-
- * decl2.c (DEFAULT_VTABLE_THUNKS): Define to be 0 if not
- defined and used to set flag_vtable_thunks.
-
-Tue Aug 12 20:13:57 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y: Don't clear the inlines from their obstack until they've
- all been processed.
-
- * decl.c (duplicate_decls): Don't complain about exception
- specification mismatch if flag_exceptions is off.
-
-Mon Aug 11 15:01:56 1997 Marc Lehmann <pcg@goof.com>
-
- * Make-lang.in (c++.distclean): Remove g++.c on make distclean.
-
-Sun Aug 10 12:06:09 1997 Paul Eggert <eggert@twinsun.com>
-
- * cp-tree.h: Replace STDIO_PROTO with PROTO in include files.
- * cvt.c, error.c, except.c, expr.c, friend.c, init.c, rtti.c:
- Include <stdio.h> before include files that formerly used STDIO_PROTO.
-
- * decl.c, g++spec.c, lex.c, method.c, repo.c:
- Include "config.h" first, as per autoconf manual.
-
-Fri Aug 8 11:47:48 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (duplicate_decls): Tweak wording.
- * lex.c (do_pending_defargs): Don't die if we see a default arg
- that isn't a DEFAULT_ARG.
- * error.c (dump_expr): Handle DEFAULT_ARG.
-
- * decl2.c (lang_decode_option): Handle -fhandle-exceptions.
- * lang-options.h: Add -fhandle-exceptions.
-
- * class.c (build_vtable): Vtables are artificial.
- (prepare_fresh_vtable): Likewise.
-
-Wed Aug 6 11:02:36 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (ocp_convert): After converting to the target type, set
- LOOKUP_NO_CONVERSION.
-
- * call.c (joust): Warn about potentially confusing promotion rules
- with -Wsign-promo.
- * cp-tree.h, lang-options.h, decl2.c: Support -Wsign-promo.
-
-Tue Aug 5 15:15:07 1997 Michael Meissner <meissner@cygnus.com>
-
- * exception.cc: Declare __terminate_func with noreturn attribute.
-
-Fri Aug 1 03:18:15 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y: Break out eat_saved_input, handle errors.
- (function_try_block): Use compstmt instead of compstmt_or_error.
-
-Thu Jul 31 17:14:04 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (build_cplus_new): Don't set TREE_ADDRESSABLE.
-
-Fri Jul 4 01:45:16 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * Make-lang.in (cplib2.txt, cplib2.ready): Instead of checking for
- existence of cc1plus check whether $(LANGUAGES) contains C++.
-
-Wed Jul 30 13:04:21 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * method.c (do_build_copy_constructor): When copying an anonymous
- union member loop around to handle nested anonymous unions. Use
- the offset of the member relative to the outer structure, not the
- union.
-
-Tue Jul 29 21:17:29 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (resolve_args): New fn.
- (build_new_function_call): Use it.
- (build_object_call): Likewise.
- (build_new_method_call): Likewise.
-
-Mon Jul 28 16:02:36 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_over_call): tsubst all default parms from templates.
-
-Wed Jul 23 13:36:25 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (struct cp_function): Add static_labelno.
- (push_cp_function_context): Save it.
- (pop_cp_function_context): Restore it.
-
-Tue Jul 22 14:43:29 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_component_ref_1): Convert from reference.
-
-Tue Jul 22 11:06:23 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (current_declspecs, prefix_attributes): Initialize to
- NULL_TREE.
-
- * parse.y (initdcl0): Make sure CURRENT_DECLSPECS is non-nil
- before we try to force it to be a TREE_LIST.
- (decl): Make sure $1.t is non-nil.
-
-Sun Jul 20 11:53:07 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (uses_template_parms): Handle template first-parse codes.
-
- * decl.c (cp_finish_decl): Only warn about user-defined statics.
-
-Fri Jul 18 17:56:08 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (unify): Handle BOOLEAN_TYPE.
-
- * cp-tree.h: Lose PARM_DEFAULT_FROM_TEMPLATE.
- * pt.c (tsubst): Don't set it.
- * call.c (build_over_call): Use uses_template_parms.
-
-Thu Jul 17 18:06:30 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (build_overload_nested_name): Use static_labelno
- instead of var_labelno.
- (build_qualified_name): New fn.
- (build_overload_name): Split out from here.
- (build_static_name): Use build_qualified_name.
- * decl.c (cp_finish_decl): Statics in extern inline functions
- have comdat linkage.
- (start_function): Initialize static_labelno.
-
-Thu Jul 17 11:20:17 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
-
- * class.c (finish_struct_methods): Add check of warn_ctor_dtor_privacy
- before "all member functions in class [] are private".
-
-Wed Jul 16 23:47:08 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (do_scoped_id): convert_from_reference.
- * init.c (build_offset_ref): Likewise.
-
-Wed Jul 16 12:34:29 1997 Benjamin Kosnik <bkoz@lisa.cygnus.com>
-
- * error.c (dump_expr): Check TREE_OPERAND before dump_expr_list.
-
-Mon Jul 14 03:23:46 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (get_member_function_from_ptrfunc): Promote index
- before saving it.
-
-Sun Jul 13 00:11:52 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (layout_basetypes): Move non-virtual destructor warning.
- * decl.c (xref_basetypes): Remove non-virtual destructor warning.
-
-Sat Jul 12 12:47:12 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokdeclarator): Call add_defarg_fn for the function
- type, too.
- * lex.c (add_defarg_fn): Adjust.
- (do_pending_defargs): Adjust. Don't skip the first parm.
-
-Fri Jul 11 01:39:50 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (build_enumerator): Global enumerators are also readonly.
-
- * rtti.c (build_dynamic_cast_1): Renamed from build_dynamic_cast.
- (build_dynamic_cast): Call it and convert_from_reference.
-
- * lex.c (add_defarg_fn): New fn.
- (snarf_defarg): Don't add to defarg_types.
- (do_pending_defargs): Lose defarg_types. All fns we process now
- have defargs.
- * decl.c (grokfndecl): Call add_defarg_fn.
-
- * Makefile.in (CONFLICTS): Expect 18 s/r conflicts.
- * cp-tree.def: Add DEFAULT_ARG.
- * spew.c (yylex): Call snarf_defarg as appropriate.
- * parse.y: New tokens DEFARG and DEFARG_MARKER.
- (defarg_again, pending_defargs, defarg, defarg1): New rules.
- (structsp): Use pending_defargs.
- (parms, full_parm): Use defarg.
- * lex.c (init_lex): Initialize inline_text_firstobj.
- (do_pending_inlines): Never pass the obstack to feed_input.
- (process_next_inline): Call end_input instead of restore_pending_input.
- (clear_inline_text_obstack, reinit_parse_for_expr, do_pending_defargs,
- finish_defarg, feed_defarg, snarf_defarg, maybe_snarf_defarg): New fns.
- * input.c (end_input): New fn.
- (sub_getch): At the end of some fed input, just keep returning EOF
- until someone calls end_input.
- Remove 'obstack' field from struct input_source.
- * decl.c (grokparms): Handle DEFAULT_ARG.
- (replace_defarg): New fn.
- * cp-tree.h (DEFARG_LENGTH, DEFARG_POINTER): New macros.
-
-Wed Jul 9 13:44:12 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (implicit_conversion): If nothing else works, try binding
- an rvalue to a reference.
-
-Wed Jul 9 13:04:38 1997 Geoffrey Noer <noer@cygnus.com>
-
- * decl.c (init_decl_processing): Fix Jun 30 patch -- move
- ifndef for Cygwin32 to include SIGSEGV.
-
-Thu Jul 3 01:44:05 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * 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 <noer@cygnus.com>
-
- * decl.c (init_decl_processing): 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 <jason@yorick.cygnus.com>
-
- * tree.c (mapcar, case CALL_EXPR): Handle all the parse node data.
-
-Fri Jun 27 15:18:49 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * 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 <jason@yorick.cygnus.com>
-
- * Make-lang.in (cplib2.ready): Add $(LANGUAGES) dependency.
-
-Thu Jun 19 16:49:28 1997 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (c_expand_return): Make sure we clean up temporaries at
- the end of return x;
-
-Thu Jun 19 12:28:43 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * lex.c (check_for_missing_semicolon): Also check for CV_QUALIFIER.
-
-Tue Jun 17 18:35:57 1997 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_builtin_throw): Add support
- -fno-sjlj-exceptions -fPIC exception handling on the SPARC.
-
-Mon Jun 16 01:24:37 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * repo.c (extract_string): Null-terminate.
-
- * cp-tree.h (TI_SPEC_INFO): New macro.
- (CLASSTYPE_TI_SPEC_INFO): New macro.
- * pt.c (push_template_decl): Correctly determine # of template parms
- for partial specs.
-
- * call.c (compare_ics): Really fix 'this' conversions.
-
- * pt.c (do_decl_instantiation): Don't crash on explicit inst of
- non-template fn.
-
- * pt.c (push_template_decl): Complain about mismatch in # of
- template parms between a class template and a member template.
-
-Sun Jun 15 02:38:20 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (synthesize_method): You can't call
- function_cannot_inline_p after finish_function.
- * decl.c (finish_function): Turn on flag_inline_functions and turn
- off DECL_INLINE before handing a synthesized method to the
- backend.
-
-Thu Jun 12 17:35:28 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (synthesize_method): Remove July 30 change to never set
- DECL_INLINE if at_eof.
-
-Thu Jun 12 15:25:08 1997 Mike Stump <mrs@cygnus.com>
-
- * xref.c (GNU_xref_member): Ensure that the node has a
- decl_lang_specific part before checking DECL_FRIEND_P.
-
-Thu Jun 12 12:36:05 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Diagnose non-class types used
- as bases.
-
-Wed Jun 11 17:33:40 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_conditional_expr): Use convert_for_initialization
- instead of convert_and_check.
-
-Wed Jun 11 12:31:33 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (typespec): Don't pedwarn for typeof.
-
-Tue Jun 10 00:22:09 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * repo.c (finish_repo): Only check changes if we would write a
- repo file.
-
- * call.c (compare_ics): Fix handling of 'this' conversions.
-
- * pt.c (do_decl_instantiation): Support static data too. Rename
- from do_function_instantiation.
- * cp-tree.h: Adjust.
- * parse.y: Adjust.
-
- * repo.c (extract_string): New fn.
- (get_base_filename): Use it.
- (init_repo): Compare old args with current args.
-
-Mon Jun 9 14:25:30 1997 Mike Stump <mrs@cygnus.com>
-
- * Makefile.in, Make-lang.in: Protect C-ls with a comment
- character, idea from Paul Eggert <eggert@twinsun.com>.
-
-Mon Jun 9 01:52:03 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (c_expand_return): Be more persistent in looking for
- returned temps.
-
- * cvt.c (build_up_reference): Use NOP_EXPR for switching from
- pointer to reference.
-
- * class.c (build_vbase_path): Don't do anything if PATH has no steps.
-
-Sun Jun 8 03:07:05 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (build_member_call, build_offset_ref):
- Use do_scoped_id instead of do_identifier.
-
- * cvt.c (convert): Remove bogosity.
-
-Sat Jun 7 20:50:17 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cvt.c (build_up_reference): Do checks of ARGTYPE and
- TARGET_TYPE before trying to use get_binfo.
-
-Fri Jun 6 17:36:39 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (build_up_reference): Call get_binfo to get access control.
-
- * decl2.c (import_export_decl): If we don't support weaks, leave
- statics undefined.
-
-Fri Jun 6 15:55:49 1997 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_builtin_throw): Add support for machines that
- cannot access globals after throw's epilogue when
- -fno-sjlj-exceptions is used.
-
-Thu Jun 5 16:28:43 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y: 'std::' becomes '::'.
- * lex.c (real_yylex): Remove 'namespace' warning.
- * init.c (build_member_call): Ignore 'std::'.
- (build_offset_ref): Likewise.
- * decl2.c (do_using_directive): Ignore 'using namespace std;'.
- (do_toplevel_using_decl): Ignore 'using std::whatever'.
- * decl.c (push_namespace): Just sorry.
- (pop_namespace): Nop.
- (init_decl_processing): Declare std namespace.
-
-Tue Jun 3 18:08:23 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * search.c (push_class_decls): A name which ambiguously refers to
- several instantiations of the same template just refers to the
- template.
-
-Tue Jun 3 12:30:40 1997 Benjamin Kosnik <bkoz@cirdan.cygnus.com>
-
- * decl.c (build_enumerator): Fix problem with unsigned long
- enumerated values being smashed to ints, causing overflow
- when computing next enumerated value (for enum values around
- MAX_VAL).
-
-Mon Jun 2 17:40:56 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_component_ref): Only call mark_used on a decl.
-
-Thu May 29 15:54:17 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * typeck.c (build_c_cast): Make the check for a ptr to function
- more specific before possible default_conversion call.
-
-Thu May 29 13:02:06 1997 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_exception_blocks): Simplify and fix and make
- sure we don't end a region in a sequence, as expand_end_bindings
- doesn't like it.
-
-Wed May 28 17:08:03 1997 Mike Stump <mrs@cygnus.com>
-
- * except.c (init_exception_processing): Mark terminate as not
- returning so that the optimizer can optimize better.
-
-Tue May 27 19:49:19 1997 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (convert): Don't do any extra work, if we can avoid it
- easily.
-
-Tue May 27 18:21:47 1997 Mike Stump <mrs@cygnus.com>
-
- * *.[chy]: Change cp_convert to ocp_convert, change convert to
- cp_convert. convert is now reserved for the backend, and doesn't
- have the semantics a frontend person should ever want.
-
-Fri May 23 10:58:31 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * lang-specs.h: Define __EXCEPTIONS if exceptions are enabled.
- Lose -traditional support.
-
-Thu May 22 15:41:28 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * rtti.c (get_tinfo_var): Use TYPE_PRECISION (sizetype).
-
- * parse.y (self_reference): Do it for templates, too.
- * class.c (pushclass): Don't overload_template_name; the alias
- generated by build_self_reference serves the same purpose.
-
- * tree.c (list_hash): Make static, take more args.
- (list_hash_lookup): Likewise.
- (list_hash_add): Make static.
- (list_hash_canon): Lose.
- (hash_tree_cons): Only build a new node if one isn't already in the
- hashtable.
- (hash_tree_chain): Use hash_tree_cons.
- * cp-tree.h: Adjust.
- * decl.c (grokfndecl): Just check IDENTIFIER_GLOBAL_VALUE instead
- of calling lookup_name.
-
-Wed May 21 18:24:19 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): TYPE_VALUES for an enum
- doesn't refer to the CONST_DECLs.
-
-Tue May 20 21:09:32 1997 Bob Manson <manson@charmed.cygnus.com>
-
- * rtti.c (get_tinfo_var): Either INT_TYPE_SIZE or 32, whichever
- is bigger.
- (expand_class_desc): Convert the last argument to a sizetype.
-
-Tue May 20 13:55:57 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * gxx.gperf (__complex, __complex__, __imag, __imag__, __real,
- __real__): Add reswords.
- * hash.h: Regenerate.
- * lex.h (rid): Add RID_COMPLEX.
- (RID_LAST_MODIFIER): Set to RID_COMPLEX.
- * lex.c (init_lex): Add building of RID_COMPLEX.
- (real_yylex): General cleanup in line with what c-lex.c also has,
- sans the cruft for traditional; add handling of SPEC_IMAG, complex
- types, and imaginary numeric constants.
- * parse.y (REALPART, IMAGPART): Add tokens.
- (unary_expr): Add REALPART and IMAGPART rules.
- * cp-tree.h (complex_{integer,float,double,long}_type_node): Declare.
- * decl.c (complex_{integer,float,double,long}_type_node): Define
- types.
- (init_decl_processing): Set up the types.
- (grokdeclarator): Add handling of RID_COMPLEX. Set and use
- DEFAULTED_INT instead of EXPLICIT_INT when we default to int type.
- * call.c (build_new_op): Add REALPART_EXPR and IMAGPART_EXPR cases.
- * cvt.c (cp_convert): Handle COMPLEX_TYPE.
- * error.c (dump_type_prefix, dump_type, dump_type_suffix): Add
- COMPLEX_TYPE case.
- * method.c (build_overload_name): Add handling of the different
- COMPLEX_TYPEs, prefixing them with `J'.
- * pt.c (process_template_parm): Don't let them use a COMPLEX_TYPE
- as a template parm.
- (uses_template_parms, tsubst, unify): Add COMPLEX_TYPE case.
- * tree.c (lvalue_p): Add REALPART_EXPR and IMAGPART_EXPR cases.
- (mapcar): Handle COMPLEX_CST.
- * typeck.c (build_binary_op_nodefault): Handle COMPLEX_TYPE.
- (common_type): Add code for complex types.
- (build_unary_op): Add REALPART_EXPR and IMAGPART_EXPR cases.
- (convert_for_assignment): Likewise.
- (mark_addressable): Add REALPART_EXPR and IMAGPART_EXPR cases.
-
-Mon May 19 12:26:27 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst): Don't pass the MINUS_EXPR for an array domain to
- tsubst_expr, as it might try to do overload resolution.
-
-Sat May 17 10:48:31 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Oops.
-
-Fri May 16 14:23:57 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.def: Add TAG_DEFN.
- * pt.c (tsubst_enum): New fn.
- (instantiate_class_template): Use it.
- (tsubst_expr): Support TAG_DEFN.
- (tsubst): Support local enums.
- (tsubst_copy): Likewise.
- * decl.c (finish_enum): Likewise.
- (start_enum): If this is a local enum, switch to permanent_obstack.
-
-Wed May 14 19:08:28 1997 Mike Stump <mrs@cygnus.com>
-
- * decl.c (store_parm_decls): Set last_parm_cleanup_insn here.
- (finish_function): Put the base init code for constructors just
- after the parm cleanup insns.
- (struct cp_function): Add last_parm_cleanup_insn.
- (push_cp_function_context): Likewise.
- (pop_cp_function_context): Likewise.
-
-Tue May 13 15:51:20 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst_copy): Handle BIT_NOT_EXPR.
-
-Wed May 7 11:17:59 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * method.c (emit_thunk) [ASM_OUTPUT_MI_THUNK]: Build up the RTL
- for THUNK_FNDECL before we switch to temporary allocation.
-
-Mon May 5 14:46:53 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_new_op): Handle null arg2 for ?:.
-
-Thu May 1 18:26:37 1997 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_exception_blocks): Ensure that we flow through
- the end of the exception region for the exception specification.
- Move exception region for the exception specification in, so that
- it doesn't protect the parm cleanup. Remove some obsolete code.
- * decl.c (store_parm_decls): Likewise.
- (finish_function): Likewise.
-
-Tue Apr 29 15:38:54 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (build_new): Fix nothrow handling.
-
-Tue Apr 29 14:29:50 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (emit_base_init): Don't warn about the initialization
- list for an artificial member.
-
-Fri Apr 25 17:47:59 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * expr.c (do_case): Handle !START case for the error msg.
+ (build_op_delete_call): Likewise.
+ (build_over_call): Likewise.
+ (joust): Use DECL_OVERLOADED_OPERATOR_P.
+ * decl.c (duplicate_decls): Copy operator_code.
+ (init_decl_processing): Adjust parameters to push_cp_library_fn.
+ (builtin_function): Adjust parameters to build_library_fn_1.
+ (build_library_fn_1): Accept an overloaded operator code.
+ (build_library_fn): Pass ERROR_MARK.
+ (build_cp_library_fn): Accept an overloaded operator code.
+ (push_cp_library_fn): Likewise.
+ (grokfndecl): Tweak.
+ (grokdeclarator): Simplify code to compute names of overloaded
+ operators. Adjust use of ansi_opname.
+ (ambi_op_p): Work on tree_codes, not identifiers.
+ (unary_op_p): Likewise.
+ (grok_op_properties): Likewise.
+ (start_function): Use DECL_OVERLOADED_OPERATOR_P.
+ (lang_mark_tree): Don't try to mark the operator_code.
+ * decl2.c (grok_function_init): Use DECL_OVERLOADED_OPERATOR_P.
+ * error.c (dump_decl): Remove special handling for operator
+ names.
+ (dump_function_name): Likewise.
+ (dump_expr): Adjust name lookup of operators.
+ (op_to_string): Simplify.
+ (assop_to_string): Likewise.
+ * init.c (build_new_1): Adjust use of ansi_opname.
+ * lex.c (opname_tab): Remove.
+ (assignop_tab): Likewise.
+ (ansi_opname): Likewise.
+ (ansi_assopname): Likewise.
+ (operator_name_string): Likewise.
+ (reinit_lang_specific): Likewise.
+ (operator_name_info): New variable.
+ (assignment_operator_name_info): Likewise.
+ (init_operators): New function.
+ (init_parse): Use it.
+ (do_identifier): Adjust use of ansi_opname.
+ * method.c (mangle_expression): Don't use ansi_opname for
+ mangling.
+ (build_decl_overload_real): Use DECL_OVERLOADED_OPERATOR_P.
+ (build_decl_overload): Remove.
+ (build_typename_overload): Use OPERATOR_TYPENAME_FORMAT directly.
+ (do_build_assign_ref): Adjust use of ansi_opname.
+ (synthesize_method): Likewise.
+ (implicitly_declare_fn): Likewise.
+ * operators.def: New file.
+ * parse.y (operator): Adjust use of ansi_opname.
+ * pt.c (tsubst_decl): Use IDENTIFIER_OPNAME_P.
+ (set_mangled_name_for_template_decl): Don't play games with
+ current_namespace.
+ (special_function_p): Adjust use of ansi_opname.
+ * typeck.c (check_return_expr): Likewise.
+ * Make-lang.in (cc1plus): Depend on operators.def.
+ * Makefile.in (lex.o): Likewise.
+ (decl.o): Likewise.
-Fri Apr 25 11:55:23 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-05-27 Zack Weinberg <zack@wolery.cumb.org>
- * decl2.c, lang-options.h: New option -Weffc++.
- * class.c, decl.c, init.c, typeck.c: Move Effective C++ warnings
- to -Weffc++.
+ * Make-lang.in (cplib2.ready): Eradicate.
- * decl2.c (finish_prevtable_vardecl): Change NO_LINKAGE_HEURISTICS
- to MULTIPLE_SYMBOL_SPACES.
+Sat May 27 11:25:46 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-Wed Apr 23 18:06:50 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * method.c (mangle_expression): Use TREE_CODE_LENGTH.
+ * tree.c (break_out_calls, build_min_nt): Use TREE_CODE_LENGTH.
+ (built_min, cp_tree_equal): Likewise.
- * method.c (emit_thunk, generic case): Set current_function_is_thunk.
+2000-05-26 Mark Mitchell <mark@codesourcery.com>
- * method.c (emit_thunk, macro case): Set up DECL_RESULT.
+ * class.c (layout_nonempty_base_or_field): Replace
+ `record_layout_info' with `record_layout_info_s'.
- * typeck.c (c_expand_return): Don't complain about returning void
- to void in an artificial function.
- * method.c (make_thunk): Change settings of READONLY/VOLATILE,
- don't set DECL_RESULT, set DECL_ARTIFICIAL.
- (emit_thunk, generic code): Also set up DECL_LANG_SPECIFIC.
+2000-05-26 Jason Merrill <jason@casey.soma.redhat.com>
-Wed Apr 23 14:43:06 1997 Mike Stump <mrs@cygnus.com>
+ Fix goto checking.
+ * cp-tree.h (struct language_function): x_named_labels is now
+ a struct named_label_list*.
+ * decl.c (struct named_label_use_list): Renamed from...
+ (struct named_label_list): ...this. New struct.
+ (push_binding_level): Don't set eh_region.
+ (note_level_for_eh): New fn.
+ (pop_label): Take label and old value directly.
+ (pop_labels): Adjust for new named_labels format.
+ (lookup_label): Likewise.
+ (poplevel): Note characteristics of a binding level containing a
+ named label. Mess with named label lists earlier.
+ (mark_named_label_lists): New fn.
+ (mark_lang_function): Call it.
+ (use_label): New fn, split out from...
+ (make_label_decl): ...here. Don't call it.
+ (decl_jump_unsafe, check_previous_goto, check_previous_goto_1,
+ check_previous_gotos): New fns, split out from...
+ (define_label): ...here.
+ (check_switch_goto): New fn.
+ (define_case_label): Call it.
+ (check_goto): New fn.
+ * semantics.c (finish_goto_stmt): Call it and use_label.
+ (begin_compound_stmt): If we're a try block, call note_level_for_eh.
+ (expand_stmt): Never pass 1 as DONT_JUMP_IN to expand_end_bindings.
+
+2000-05-26 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (build_vtable_entry_ref): Correct usage of
+ get_vtbl_decl_for_binfo.
+
+ * decl2.c (grokclassfn): Set DECL_LANGUAGE here.
+ * method.c (implicitly_declare_fn): Not here.
+
+2000-05-26 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (CPTI_PTMD_DESC_TYPE): Rename to ...
+ (CPTI_PTMD_DESC_TYPE): ... here.
+ (ptmd_desc_type_node): Rename to ...
+ (ptm_desc_type_node): ... here.
+ * decl.c: Likewise.
+ * rtti.c (ptmd_initializer): Rename to ...
+ (ptm_initializer): ... here.
+ (sythesize_tinfo_var): Adjust. Deal with pointer to member
+ function.
+ (create_tinfo_types): Adjust.
+
+2000-05-25 Mark Mitchell <mark@codesourcery.com>
+
+ Finish implementation of VTTs.
+ * cp-tree.h (cp_tree_index): Add CPTI_VTT_PARM_TYPE and
+ CPTI_VTT_PARM_IDENTIFIER.
+ (vtt_parm_identifier): New macro.
+ (vtt_parm_type): Likewise.
+ (BINFO_SUBVTT_INDEX): Likewise.
+ (BINFO_VPTR_INDEX): Likewise.
+ (struct lang_decl): Add vtt_parm.
+ (DECL_VTT_PARM): New macro.
+ (DECL_USE_VTT_PARM): Likewise.
+ (DECL_NEEDS_VTT_PARM_P): Likewise.
+ (get_vtt_name): Declare.
+ (build_artificial_parm): Likewise.
+ (fixup_all_virtual_upcast_offsets): Likewise.
+ (expand_indirect_vtbls_init): Remove.
+ * call.c (build_new_method_call): Pass the vtt to subobject
+ constructors and destructors.
+ * class.c (get_vtt_name): Give it external linkage.
+ (build_clone): Handle the magic VTT parameters for clones.
+ (clone_function_decl): Fix typo in comment.
+ (build_vtt): Keep track of the indices in the VTTs where various
+ entities are stored.
+ (build_vtt_inits): Likewise.
+ (dfs_build_vtt_inits): Likewise.
+ (build_ctor_vtbl_group): Tweak type of construction vtables.
+ (dfs_accumulate_vtbl_inits): Build vtables for all bases, even
+ primary bases, when building construction vtables.
+ * decl.c (duplicate_decls): Handle DECL_VTT_PARM.
+ (initialize_predefined_identifiers): Add vtt_parm_identifier.
+ (init_decl_processing): Initialize vtt_parm_type.
+ (grokfndecl): Use DECL_OVERLOADED_OPERATOR_P.
+ (lang_mark_tree): Make vtt_parm.
+ * decl2.c (build_artificial_parm): New function.
+ (maybe_retrofit_in_chrg): Use it. Add VTT parameters.
+ (grokclassfn): Use build_artificial_parm.
+ * init.c (initialize_vtbl_ptrs): Call
+ fixup_all_virtual_upcast_offsets directly.
+ (perform_member_init): Use the complete subobject destructor for
+ member cleanups.
+ (build_vtbl_address): New function.
+ (expand_virtual_init): Handle VTTs.
+ * optimize (maybe_clone_body): Likewise.
+ * search.c (fixup_all_virtual_upcast_offsets): Give it external
+ linkage.
+ (expand_indirect_vtbls_init): Remove.
+ * semantics.c (setup_vtbl_ptr): Fix typos in comment.
+ * tree.c (make_binfo): Make them bigger.
+
+2000-05-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ * inc/cxxabi.h (__pbase_type_info): Define, based on
+ __pointer_type_info.
+ (__pointer_type_info): Derive from __pbase_type_info. Adjust.
+ (__pointer_to_member_type_info): Likewise.
+ * tinfo2.cc (__pbase_type_info::~__pbase_type_info): Implement.
+ (__pointer_to_member_type_info::__is_pointer_p): Remove.
+ (__pointer_type_info::__do_catch): Rename to ...
+ (__pbase_type_info::__do_catch): ... here. Adjust.
+ (__pbase_type_info::__pointer_catch): Implement.
+ (__pointer_type_info::__pointer_catch): Adjust.
+ (__pointer_to_member_type_info::__pointer_catch): Adjust.
+
+2000-05-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ * tinfo.h (__user_type_info::contained_virtual_p): New
+ predicate.
+ * tinfo.cc (__user_type_info::do_upcast): Fix bug with diamond
+ shaped hierarchy.
+ (__vmi_class_type_info::__do_upcast): Fix bug with NULL pointer to
+ diamond shaped hierarchy. Add early out for mixed diamond and
+ duplicate shaped hierarchy.
+
+2000-05-24 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (build_delete): Change prototype.
+ (build_vec_delete): Likewise.
+ * call.c (build_scoped_method_call): Use special_function_kind
+ values to indicate the kind of destruction to be done.
+ (build_method_call): Likewise.
+ * decl.c (finish_destructor_body): Likewise.
+ (maybe_build_cleanup_1): Likewise. Rename to ...
+ (maybe_build_cleanup): ... this.
+ * decl2.c (delete_sanity): Use special_function_kind
+ values to indicate the kind of destruction to be done.
+ (build_cleanup): Likewise.
+ * init.c (perform_member_init): Likewise.
+ (build_vec_delete_1): Likewise.
+ (build_dtor_call): Simplify.
+ (build_delete): Use special_function_kind
+ values to indicate the kind of destruction to be done.
+ (build_vbase_delete): Likewise.
+ (build_vec_delete): Likewise.
- * init.c (init_decl_processing): Add support for setjmp/longjmp based
- exception handling.
- * except.c (init_exception_processing): Likewise.
- (expand_end_catch_block): Likewise.
- (expand_exception_blocks): Likewise.
- (expand_throw): Likewise.
- * exception.cc (__default_terminate): Likewise.
+ * init.c (sort_member_init): Fix typo in error message generation
+ code.
- * init.c (perform_member_init): Use new method of expr level
- cleanups, instead of cleanups_this_call and friends.
+Mon May 15 11:46:29 2000 Donald Lindsay <dlindsay@cygnus.com>
+
+ * semantics.c (begin_class_definition): make the packed
+ attribute be sensitive to the "-fpack-struct" command line flag
+
+2000-05-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ Update new-abi upcast algorithm.
+ * inc/cxxabi.h (__class_type_info::__do_upcast): Change
+ prototype and meaning of return value.
+ (__si_class_type_info::__do_upcast): Likewise.
+ (__vmi_class_type_info::__do_upcast): Likewise.
+ * tinfo.cc (__class_type_info::__upcast_result): Replace
+ whole2dst with part2dst. Adjust ctor.
+ (__class_type_info::__do_upcast): Adjust call of worker function.
+ (__class_type_info::__do_upcast): Adjust.
+ (__si_class_type_info::__do_upcast): Adjust. Use parent's
+ __do_upcast.
+ (__vmi_class_type_info::__do_upcast): Likewise. Fix private
+ virtual base in diamond hierarchy bug.
+
+2000-05-23 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (lang_decl_flags): Rename mutable_flag to uninlinable
+ and bitfield to tinfo_fn_p.
+ (DECL_TINFO_FN_P): Adjust.
+ (SET_DECL_TINFO_FN_P): Likewise.
+ (DECL_MUTABLE_P): Likewise.
+ (DECL_C_BIT_FIELD): Likewise.
+ (SET_DECL_C_BIT_FIELD): Likewise.
+ (CLEAR_DECL_C_BIT_FIELD): Likewise.
+ (DECL_UNINLINABLE): Likewise.
+ * class.c (alter_access): Call retrofit_lang_decl if ncessary.
+ (handle_using_decl): Remove assertion.
+ (build_vtbl_or_vbase_field): Use build_decl, not build_lang_decl,
+ to build FIELD_DECLs.
+ (build_base_field): Likewise.
+ (layout_class_type): Likewise.
+ * decl.c (init_decl_processing): Likewise.
+ (build_ptrmemfunc_type): Likewise.
+ (grokdeclarator): Likewise.
+ * decl2.c (grok_x_components): Likewise.
+ * except.c (call_eh_info): Likewise.
+ * init.c (init_init_processing): Likewise.
+ * rtti.c (expand_class_desc): Likewise.
+ (create_pseudo_type_info): Likewise.
+ (get_vmi_pseudo_type_info): Likewise.
+ (create_tinfo_types): Likewise.
+ * ptree.c (print_lang_decl): Adjust.
+ * typeck.c (build_component_ref): Don't check DECL_LANG_SPECIFIC
+ before checking DECL_MUTABLE_P.
+
+ * decl2.c (maybe_retrofit_in_chrg): Don't create in-charge
+ parameters for template functions.
+ * pt.c (tsubst_decl): Make sure we call maybe_retrofit_in_chrg for
+ destructors as well as constructors.
+
+2000-05-22 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (build_ctor_vtbl_group): Set inits.
+ * optimize.c (maybe_clone_body): Set DECL_INLINE and
+ DECL_THIS_INLINE appropriately for clones.
+
+ * cp-tree.h (IDENTIFIER_TYPENAME_P): Use a flag, not strncmp.
+ (DECL_CONV_FN_P): Simplify.
+ (DECL_OPERATOR): Remove.
+ (language_to_string): Declare.
+ * decl.c (duplicate_decls): Fix typo in comment.
+ (grokdeclarator): Adjust use of IDENTIFIER_TYPENAME_P.
+ (grok_op_properties): Use DECL_CONV_FN_P instead of
+ IDENTIFIER_TYPENAME_P.
+ * dump.c (dequeue_and_dump): Dump the language linkage of
+ declarations.
+ * error.c (language_to_string): Give it external linkage.
+ * method.c (build_typename_overload): Set IDENTIFIER_TYPENAME_P.
+ (implicitly_declare_fn): Set DECL_LANGUAGE.
+ * pt.c (check_explicit_specialization): Use DECL_CONV_FN_P, not
+ IDENTIFIER_TYPENAME_P.
+ (tsubst_decl): Likewise.
+ (tsubst_copy): Adjust use of IDENTIFIER_TYPENAME_P.
+ * semantics.c (finish_member_declaration): Don't mark members of
+ classes declared in an extern "C" region as extern "C".
+
+2000-05-22 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl2.c (qualified_lookup_using_namespace): Look through
+ namespace aliases.
+
+ * decl.c (push_using_decl): Return the old decl on namespace level.
+
+2000-05-21 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (SET_BINFO_NEW_VTABLE_MARKED): Add sanity checks.
+ (VTT_NAME_PREFIX): New macro.
+ (CTOR_VTBL_NAME_PREFIX): Likewise.
+ (get_ctor_vtbl_name): New function.
+ * class.c (get_vtable_name): Simplify.
+ (get_vtt_name): New function.
+ (get_vtable_decl): Don't set IDENTIFIER_GLOBAL_VALUE.
+ (dfs_mark_primary_bases): Update the CLASSTYPE_VBASECLASSES list
+ when a virtual base becomes primary.
+ (finish_struct_1): Set CLASSTYPE_VFIELDS a little earlier. Build
+ VTTs.
+ (finish_vtbls): Adjust calls to accumulate_vtbl_inits to pass in
+ additional parameters.
+ (dfs_finish_vtbls): Don't clear BINFO_NEW_VTABLE_MARKED.
+ (initialize_array): New function.
+ (build_vtt): Likewise.
+ (build_vtt_inits): Likewise.
+ (dfs_build_vtt_inits): Likewise.
+ (dfs_fixup_binfo_vtbls): Likewise.
+ (build_ctor_vtbl_group): Likewise.
+ (initialize_vtable): Use initialize_array.
+ (accumulate_vtbl_inits): Reimplement to handle construction
+ vtables.
+ (dfs_accumulate_vtbl_inits): Likewise.
+ (bulid_vtbl_initializer): Adjust parameter name.
+ * method.c (build_typename_overload): Remove #if 0'd code.
+ (get_ctor_vtbl_name): New function.
+ * search.c (dfs_walk_real): Use BINFO_N_BASETYPES.
+ (init_vbase_pointers): Don't mess with the TREE_CHAIN of a binfo.
+
+ * cp-tree.h (struct lang_type): Remove search_slot.
+ (CLASSTYPE_SEARCH_SLOT): Remove.
+ (emit_base_init): Change prototype.
+ (initialize_vtbl_ptrs): Likewise.
+ (expand_indirect_vtbls_init): Likewise.
+ (clear_search_slots): Remove.
+ * decl.c (lang_mark_tree): Don't mark search_slot.
+ * init.c (initialize_vtbl_ptrs): Simplify.
(emit_base_init): Likewise.
- (expand_aggr_vbase_init_1): Likewise.
- (expand_vec_init): Likewise.
- * decl.c (cp_finish_decl): Likewise.
- (expand_static_init): Likewise.
- (store_parm_decls): Likewise.
- (cplus_expand_expr_stmt): Likewise.
- * decl2.c (finish_file): Likewise.
-
- * Make-lang.in (exception.o): Ok to compile with -O now.
-
- * decl.c (maybe_build_cleanup_1): We no longer have to unsave, as
- we know it will be done later by the backend.
-
- * decl2.c (lang_f_options): Remove support for short temps.
- * lang-options.h: Likewise.
-
-Wed Apr 23 04:12:06 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (varargs_function_p): New fn.
- * method.c (emit_thunk): Replace broken generic code with code to
- generate a heavyweight thunk function.
-
-Tue Apr 22 02:45:18 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (process_template_parm): pedwarn about floating-point parms.
-
- * decl.c (grokdeclarator): inline no longer implies static.
-
- * spew.c (yylex): Always return the TYPE_DECL if we got a scope.
-
-Mon Apr 21 15:42:27 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (check_for_override): The signature of an overriding
- function is not changed.
-
- * call.c (build_over_call): Move setting of conv into the loop.
- Note: this change, along with the related changes of the 18th thru
- the 20th of April, fix an infinite loop problem in conversions.
-
-Sun Apr 20 16:24:29 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_user_type_conversion_1): Really ignore rvalue
- conversions when looking for a REFERENCE_TYPE.
-
- * cvt.c (build_up_reference): Eviscerate, use build_unary_op.
- * cp-tree.h (TREE_REFERENCE_EXPR): #if 0.
- * typeck.c (decay_conversion): Don't set TREE_REFERENCE_EXPR.
- (build_unary_op): Likewise.
- * call.c (build_over_call): See through a CONVERT_EXPR around the
- ADDR_EXPR for on a temporary.
- * typeck.c (c_expand_return): See through a CONVERT_EXPR around
- the ADDR_EXPR for a local variable.
-
-Fri Apr 18 12:11:33 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_user_type_conversion_1): If we're trying to
- convert to a REFERENCE_TYPE, only consider lvalue conversions.
- (build_new_function_call): Print candidates.
- (implicit_conversion): Try a temp binding if the lvalue conv is BAD.
- (reference_binding): Binding a temporary of a reference-related type
- is BAD.
-
-Thu Apr 17 14:37:22 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * inc/typeinfo (type_info::before): Add cv-qualifier-seq.
- * tinfo2.cc (type_info::before): Likewise.
-
-Mon Apr 14 12:38:17 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (implicit_conversion): Oops.
-
-Fri Apr 11 02:18:30 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (implicit_conversion): Try to find a reference conversion
- before binding a const reference to a temporary.
-
-Wed Apr 2 12:51:36 1997 Mike Stump <mrs@cygnus.com>
-
- * exception.cc (__default_unexpected): Call terminate by default,
- so that if the user overrides terminate, the correct function will
- be called.
-
-Wed Mar 19 14:14:45 1997 Mike Stump <mrs@cygnus.com>
-
- * parse.y (left_curly): Avoid trying to use any fields of
- error_mark_node, as there aren't any.
-
-Thu Mar 13 16:33:22 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (do_identifier): Avoid breaking on overloaded methods
- as default arguments.
-
-Wed Mar 12 13:55:10 1997 Hans-Peter Nilsson <Hans-Peter.Nilsson@axis.se>
-
- * call.c (add_template_candidate): Initialize the variable "dummy".
-
-Mon Mar 10 15:13:14 1997 Brendan Kehoe <brendan@canuck.cygnus.com>
-
- * decl.c (start_decl): Make sure TYPE isn't an error_mark_node
- before we try to use TYPE_SIZE and TREE_CONSTANT on it.
-
-Fri Mar 7 13:19:36 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.h (comp_ptr_ttypes, more_specialized): Add decl.
- (debug_binfo): Delete decl, not needed.
-
- * tree.c (fnaddr_from_vtable_entry, function_arg_chain,
- promotes_to_aggr_type): Delete fns.
- * cp-tree.h (FNADDR_FROM_VTABLE_ENTRY,
- SET_FNADDR_FROM_VTABLE_ENTRY, FUNCTION_ARG_CHAIN,
- PROMOTES_TO_AGGR_TYPE): Delete alternates to #if 1.
-
- * decl.c (pending_invalid_xref{,_file,_line}): Delete unused vars.
-
- * friend.c (is_friend_type): Delete fn.
- * cp-tree.h (is_friend_type): Delete decl.
-
- * decl.c (original_result_rtx, double_ftype_double,
- double_ftype_double_double, int_ftype_int, long_ftype_long,
- float_ftype_float, ldouble_ftype_ldouble, last_dtor_insn): Make static.
- * typeck.c (original_result_rtx, warn_synth): Delete extern decls.
+ * search.c (struct vbase_info): Document decl_ptr.
+ (convert_pointer_to_single_level): Remove.
+ (dfs_find_vbases): Remove.
+ (dfs_init_base_pointers): Simplify.
+ (dfs_clear_vbase_slots): Remove.
+ (dfs_vtable_path_unmark): New function.
+ (init_vbase_pointers): Simplify.
+ (expand_upcast_fixups): Don't rely on CLASSTYPE_SEARCH_SLOT.
+ (expand_indirect_vtbls_init): Simplify. Don't call
+ mark_all_temps_used.
+ * semantics.c (setup_vtbl_ptr): Adjust calls to emit_base_init and
+ initialize_vtbl_ptrs.
+
+2000-05-20 Zack Weinberg <zack@wolery.cumb.org>
+
+ * except.c: Add static prototypes.
+
+2000-05-20 H.J. Lu <hjl@gnu.org>
+
+ * Make-lang.in (cplib2.ready): Also depend on cc1plus$(exeext).
+
+2000-05-19 Mark Mitchell <mark@codesourcery.com>
+
+ Don't create a separate copy of virtual bases for the
+ CLASSTYPE_VBASECLASSES list.
+ * cp-tree.h (CLASSTYPE_VBASECLASSES): Change documentation.
+ (BINFO_FOR_VBASE): Remove.
+ (CANONICAL_BINFO): Adjust.
+ (binfo_for_vbase): New function.
+ * class.c (build_vbase_pointer_fields): Use binfo_for_vbase
+ instead of BINFO_FOR_VBASE.
+ (build_vbase_pointer): Likewise.
+ (build_secondary_vtable): Likewise.
+ (dfs_mark_primary_bases): Likewise.
+ (mark_primary_bases): Likewise.
+ (layout_nonempty_base_or_field): Likewise.
+ (dfs_set_offset_for_shared_vbases): Likewise.
+ (dfs_set_offset_for_unshared_vbases): Likewise.
+ (layout_virtual_bases): Likewise. Adjust for changes to the
+ CLASSTYPE_VBASECLASSES list.
+ (dump_class_hierarchy_r): Use binfo_for_vbase
+ instead of BINFO_FOR_VBASE.
+ (dump_class_hierarchy): Likewise.
+ (finish_vtbls): Likewise.
+ (build_vtbl_initializer): Adjust for changes to the
+ CLASSTYPE_VBASECLASSES list.
+ (build_vbase_offset_vtbl_entries): Use binfo_for_vbase.
+ * decl.c (finish_destructor_body): Adjust for changes to the
+ CLASSTYPE_VBASECLASSES list.
+ * init.c (sort_base_init): Use binfo_for_vbase.
+ (construct_virtual_bases): Adjust for changes to the
+ CLASSTYPE_VBASECLASSES list.
+ (expand_member_init): Use binfo_for_vbase.
+ (build_vbase_delete): Adjust for changes to the
+ CLASSTYPE_VBASECLASSES list.
+ * method.c (do_build_copy_constructor): Likewise.
+ * rtti.c (get_base_offset): Use binfo_for_vbase.
+ (expand_class_desc): Remove #if 0'd code.
+ * search.c (struct vbase_info): Remove vbase_types.
+ (get_base_distance): Use binfo_for_vbase.
+ (lookup_field_queue_p): Use CANONICAL_BINFO.
+ (get_shared_vbase_if_not_primary): Use binfo_for_vbase.
+ (get_pure_virtuals): Adjust for changes to the
+ CLASSTYPE_VBASECLASSES list.
+ (dfs_find_vbases): Use binfo_for_vbase.
+ (dfs_init_vbase_pointers): Likewise.
+ (init_vbase_pointers): Don't initialize vi.vbase_types.
+ (virtual_context): Use binfo_for_vbase.
+ (fixup_all_virtual_upcast_offsets): Adjust for changes to the
+ CLASSTYPE_VBASECLASSES list.
+ (expand_indirect_vtbls_init): Simplify.
+ (dfs_get_vbase_types): Don't replicate virtual bases.
+ (find_vbase_instance): Use binfo_for_vbase.
+ (binfo_for_vbase): New function.
+ * typeck.c (get_delta_difference): Use binfo_for_vbase.
+
+2000-05-17 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (finish_anon_union): Generalize error messages to handle
+ anonymous structures.
+ * init.c (perform_member_init): Remove `name' parameter.
+ (build_field_list): New function.
+ (sort_member_init): Handle anonymous union initialization order
+ correctly. Check for multiple initializations of the same union.
+ (emit_base_init): Don't look up fields by name here.
+ (expand_member_init): Record the result of name lookup for future
+ reference.
+ * typeck.c (build_component_ref): Fix formatting.
+
+Wed May 17 17:27:44 2000 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * decl.c (pop_label): Replace warn_unused with warn_unused_label.
+ * typeck.c (build_x_compound_expr): Replace warn_unused with
+ warn_unused_value.
+
+ * decl2.c (lang_decode_option): Update -Wall unused flags by
+ calling set_Wunused.
+
+2000-05-16 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-treeh (BINFO_NEW_VTABLE_MARKED): Update documentation.
+ * init.c (dfs_vtable_path_unmark): Remove.
+ * search.c (marked_new_vtable_p): Likewise.
+ (unmarked_new_vtable_p): Likewise.
+ (dfs_search_slot_nonempty_p): Likewise.
+ (dfs_mark): Likewise.
+ (dfs_vtable_path_unmark): Likewise.
+ (dfs_find_vbases): Don't set BINFO_NEW_VTABLE_MARKED.
+ (dfs_int_vbase_pointers): Don't clear BINFO_VTABLE_PATH_MARKED.
+ (dfs_init_vbase_pointers): Remove special-case new ABI code.
+ (dfs_clear_vbase_slots): Don't clear BINFO_NEW_VTABLE_MARKED.
+ (init_vbase_pointers): Simplify.
+ (expand_indirect_vtbls_init): Likewise.
+
+ * class.c (copy_virtuals): New function.
+ (build_primary_table): Use it.
+ (build_secondary_vtable): Likewise.
+ (modify_vtable_entry): Use NULL_TREE, not integer_zero_node, to
+ indicate that no vcall offset is required.
+ (add_virtual_function): Likewise.
+ (modify_all_vtables): Likewise.
+ (dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
+ (dfs_accumulate_vtbl_inits): Likewise.
+ (build_vtbl_initializer): Make changes to handle construction
+ vtables.
+ (dfs_build_vcall_offset_vtbl_entries): Likewise.
+ (build_rtti_vtbl_entries): Likewise.
+ (build_vtable_entries): Handle a NULL vcall_index.
+
+2000-05-15 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * decl2.c (lang_decode_option): Fix thinko.
+
+2000-05-14 Jason Merrill <jason@casey.cygnus.com>
+
+ * except.c (check_handlers): New fn.
+ * cp-tree.h: Declare it.
+ * semantics.c (finish_handler_sequence): Call it.
+ (finish_function_handler_sequence): Likewise.
+ (finish_handler_parms): Set TREE_TYPE on the handler.
+ * cp-tree.h (PUBLICLY_UNIQUELY_DERIVED_P): New macro.
+ * search.c (get_base_distance_recursive): If protect>1, ignore
+ special access.
+ (get_base_distance): Don't reduce watch_access.
+
+2000-05-13 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * lex.c: #include diagnostic.h.
+ (lang_init_options): Set default prefixing rules.
+
+ * lang-options.h: Add -fdiagnostics-show-location=.
+
+ * decl2.c: #include diagnostic.h.
+ (lang_decode_option): Handle -fdiagnostics-show-location=.
+
+2000-05-12 Nathan Sidwell <nathan@codesourcery.com>
+
+ * tinfo.cc: Revert my 2000-05-08 and 2000-05-07 changes.
+ * vec.cc: Revert my 2000-05-07 change.
+
+2000-05-11 Jason Merrill <jason@casey.cygnus.com>
+
+ * class.c (check_field_decls): Complain about non-static data
+ members with same name as class in class with constructor.
+
+2000-05-10 Jason Merrill <jason@casey.cygnus.com>
+
+ * decl.c (grokdeclarator): Allow non-static data members with
+ same name as class.
+
+2000-05-09 Zack Weinberg <zack@wolery.cumb.org>
+
+ * cp-tree.h: Constify tree_srcloc.filename, tinst_level.file,
+ and pending_inline.filename. Update prototypes.
+ * decl.c (define_label): Constify filename parameter.
+ * decl2.c (warn_if_unknown_interface): Constify local char *.
+ * input.c Constify input_source.filename. Don't declare
+ input_filename or lineno. Constify filename parameter to feed_input.
+ * lex.c (init_parse): Constify parameter and return value.
+ (cp_pragma_interface, cp_pragma_implementation): Constify
+ filename argument.
+ (reinit_parse_for_method, reinit_parse_for_block,
+ reinit_parse_for_expr, feed_defarg, handle_cp_pragma):
+ Constify local char *.
+ * pt.c: Don't declare lineno or input_filename.
+ (print_template_context, tsubst_friend_function, tsubst_decl,
+ tsubst, instantiate_decl): Constify local char *.
+ * semantics.c (expand_body): Constify local char *.
+ * tree.c (build_srcloc): Constify filename parameter.
+ * typeck.c (c_expand_asm_operands): Constify filename
+ parameter.
- * decl.c (push_overloaded_decl{,_top_level}): Make static, adding
- fwd decls.
- * cp-tree.h (push_overloaded_decl{,_top_level}): Delete decls.
+2000-05-08 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (pushdecl_nonclass_level): #if 0, unused.
- * cp-tree.h (pushdecl_nonclass_level): #if 0 decl.
+ * tinfo.cc (__dynamic_cast): Use a reinterpret_cast. Fix
+ offsetof expansion.
- * lex.c (reinit_lang_specific): #if 0, unused.
- * cp-tree.h (reinit_lang_specific): #if 0 decl.
+2000-05-08 Branko Cibej <branko.cibej@hermes.si>
- * decl.c (revert_static_member_fn): Make static, adding fwd decl.
- * cp-tree.h (revert_static_member_fn): Delete decl.
+ * inc/cxxabi.h: Fix typos in comment.
+ (__base_class_info::__offset): Use a static_cast.
- * class.c (root_lang_context_p): Delete fn.
- * cp-tree.h (root_lang_context_p): Delete decl.
+2000-05-07 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (set_current_level_tags_transparency): #if 0, unused.
- * cp-tree.h (set_current_level_tags_transparency): #if 0 decl.
+ * inc/cxxabi.h: Use __SIZE_TYPE_ and __PTRDIFF_TYPE__ in place
+ of std::size_t and std::ptrdiff_t respectively.
+ * tinfo.cc: Likewise.
+ * vec.cc: Likewise.
- * lex.c (set_vardecl_interface_info): Make static.
- * cp-tree.h (set_vardecl_interface_info): Delete decl.
+2000-05-06 Richard Henderson <rth@cygnus.com>
- * call.c (find_scoped_type): Make static.
- * cp-tree.h (find_scoped_type): Delete decl.
+ * typeck.c (build_c_cast): Don't warn integer->pointer size
+ mismatch for constants.
- * search.c (convert_pointer_to_vbase): Make static.
- * cp-tree.h (convert_pointer_to_vbase): Delete decl.
+2000-05-06 Nathan Sidwell <nathan@codesourcery.com>
- * decl.c (const_ptr_type_node): Likewise.
- * cp-tree.h (const_ptr_type_node): Delete decl.
+ * rtti.c (ptmd_initializer): Set non-public, if class is
+ incomplete.
- * typeck.c (common_base_type): Make static.
- * cp-tree.h (common_base_types): Delete erroneous decl.
+ * inc/cxxabi.h (__dynamic_cast): Explicitly say extern "C++".
+ (__cxa_vec_new, __cxa_vec_ctor, __cxa_vec_dtor,
+ __cxa_vec_delete): Likewise.
+ * tinfo.cc (__dynamic_cast): Likewise.
+ * vec.cc (__cxa_vec_new, __cxa_vec_ctor, __cxa_vec_dtor,
+ __cxa_vec_delete): Likewise.
- * pt.c (classtype_mangled_name): Make static.
- * cp-tree.h (classtype_mangled_name): Delete decl.
+2000-05-04 Mark Mitchell <mark@codesourcery.com>
- * lex.c (check_newline): Make static.
- * cp-tree.h (check_newline): Delete decl.
+ * cp-tree.h (DELTA_FROM_VTABLE_ENTRY): Remove.
+ (SET_FNADDR_FROM_VTABLE_ENTRY): Likewise.
+ (lang_decl_flags): Add vcall_offset.
+ (THUNK_VCALL_OFFSET): Use it.
+ * decl.c (lang_mark_tree): Don't mark DECL_ACCESS for a thunk.
+ * method.c (make_thunk): Create the lang_decl here, not in
+ emit_thunk.
+ (emit_thunk): Make generic thunks into ordinary functions once
+ they have been fed to expand_body.
+ * semantics.c (expand_body): Set current_function_is_thunk here.
- * typeck.c (build_x_array_ref): Delete fn, same idea as
- grok_array_decl.
- * cp-tree.h (build_x_array_ref): Delete decl.
+2000-05-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * lex.c (copy_decl_lang_specific): Delete fn, same idea as
- copy_lang_decl.
- * cp-tree.h (copy_decl_lang_specific): #if 0 decl.
+ * class.c (update_vtable_entry_for_fn): Prototype.
- * class.c (build_vtable_entry): Make static.
- * cp-tree.h (build_vtable_entry): Delete decl.
+ * pt.c (tsubst_decl): Initialize variables `argvec', `gen_tmpl'
+ and `tmpl'.
- * class.c (build_vbase_pointer): Make static.
- * cp-tree.h (build_vbase_pointer): Delete decl.
+ * search.c (dfs_build_inheritance_graph_order): Prototype.
- * sig.c (build_sptr_ref): Add forward decl and make static.
- * cp-tree.h (build_sptr_ref): Delete decl.
+2000-05-04 Mark Mitchell <mark@codesourcery.com>
- * call.c (build_new_method_call): Add forward decl and make static.
- * cp-tree.h (build_new_method_call): Delete decl.
+ * cp-tree.h (special_function_kind): Add various kinds of
+ destructors.
+ (special_function_p): New function.
+ * class.c (overrides): Don't let one kind of destructor override
+ another.
+ * decl2.c (mark_used): Use DECL_NON_THUNK_FUNCTION_P when deciding
+ whether or not to instantiate a template.
+ * tree.c (special_function_p): Define.
- * call.c (build_object_call): Make static.
- * class.c (check_for_override, complete_type_p, mark_overriders):
- Likewise.
- * decl.c (cp_function_chain): Likewise.
- * lex.c (set_typedecl_interface_info, reinit_parse_for_block):
- Likewise.
- * pt.c (comp_template_args, get_class_bindings, push_tinst_level):
- Likewise.
- * tree.c (build_cplus_array_type_1): Likewise.
- * typeck.c (comp_ptr_ttypes_{const,real,reinterpret}): Likewise.
- (comp_target_parms): Likewise.
+2000-05-03 Mark Mitchell <mark@codesourcery.com>
- * init.c (build_builtin_call): Make static.
- * cp-tree.h (build_builtin_call): Delete decl.
-
- * typeck.c (binary_op_error): Delete decl.
- * cp-tree.h (binary_op_error): Likewise.
-
-Thu Mar 6 16:13:52 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * call.c (build_method_call): Compare against error_mark_node
- directly, rather than the ERROR_MARK tree code.
- * cvt.c (cp_convert): Likewise.
- * decl.c (print_binding_level): Likewise.
+ * cp-tree.def (THUNK_DECL): Remove.
+ * cp-tree.h (DECL_THUNK_P): New macro.
+ (DECL_NON_THUNK_FUNCTION_P): Likewise.
+ (DECL_EXTERN_C_FUNCTION_P): Likewise.
+ (SET_DECL_THUNK_P): Likewise.
+ (DELTA_FROM_VTABLE_ENTRY): Use DECL_THUNK_P.
+ (FNADDR_FROM_VTABLE_ENTRY): Likewise.
+ (DECL_MAIN_P): Use DECL_EXTERN_C_FUNCTION_P.
+ * decl.c (decls_match): Use DECL_EXTERN_C_P.
(duplicate_decls): Likewise.
- (grokdeclarator): Likewise.
- (grokdeclarator): Likewise.
- * init.c (expand_aggr_init_1): Likewise.
- (decl_constant_value): Likewise.
- * method.c (build_opfncall): Likewise.
- (hack_identifier): Likewise.
- * typeck.c (build_modify_expr): Likewise.
-
- * typeck.c (build_c_cast): Don't decl TYPE as register tree.
-
-Sun Mar 2 02:54:36 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
-
- * pt.c (unify): Strip NOP_EXPR wrappers before unifying integer values.
-
- * pt.c (coerce_template_parms): Add new error message.
-
- * method.c (build_overload_value): Implement name mangling for
- floating-point template arguments.
-
- * method.c (build_overload_int, icat, dicat): Fix mangling of template
- arguments whose absolute value doesn't fit in a signed word.
-
-Mon Mar 3 12:14:54 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * friend.c: New file; put all of the friend stuff in here.
- * init.c: Instead of here.
- * Makefile.in (CXX_OBJS): Add friend.o.
- (friend.o): Add dependencies.
- * Make-lang.in (CXX_SRCS): Add $(srcdir)/cp/friend.c.
-
-Sun Mar 2 11:04:43 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_scoped_method_call): Complain if the scope isn't a
- base.
-
-Wed Feb 26 11:31:06 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (left_curly): Don't crash on erroneous type.
-
- * init.c (build_delete): Fix type of ref.
-
-Tue Feb 25 12:41:48 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * search.c (get_vbase_1): Renamed from get_vbase.
- (get_vbase): Wrapper, now non-static.
- (convert_pointer_to_vbase): Now static.
-
- * call.c (build_scoped_method_call): Accept a binfo for BASETYPE.
- * init.c (build_delete): Pass one.
- (build_partial_cleanup_for): Use build_scoped_method_call.
- * decl.c (finish_function): Pass a binfo.
-
-Mon Feb 24 15:00:12 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_over_call): Only synthesize non-trivial copy ctors.
-
- * typeck.c (build_c_cast): Lose other reference to flag.
-
- * call.c (build_field_call): Don't look for [cd]tor_identifier.
- * decl2.c (delete_sanity): Remove meaningless use of
- LOOKUP_HAS_IN_CHARGE.
- * decl.c (finish_function): Use build_scoped_method_call instead
- of build_delete for running vbase dtors.
- * init.c (build_delete): Call overload resolution code instead of
- duplicating it badly.
-
-Thu Feb 20 15:12:15 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_over_call): Call mark_used before trying to elide
- the call.
-
- * decl.c (implicitly_declare): Don't set DECL_ARTIFICIAL.
-
-Wed Feb 19 11:18:53 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * typeck.c (build_modify_expr): Always pedwarn for a cast to
- non-reference used as an lvalue.
-
-Wed Feb 19 10:35:37 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (cp_convert_to_pointer): Convert from 0 to a pmf properly.
-
-Tue Feb 18 15:40:57 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (handler): Fix template typo.
-
-Sun Feb 16 02:12:28 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * error.c (lang_decl_name): New fn.
- * tree.c (lang_printable_name): Use it.
-
-Fri Feb 14 16:57:05 1997 Mike Stump <mrs@cygnus.com>
-
- * g++spec.c: Include config.h so that we can catch bzero #defines
- from the config file.
-
-Tue Feb 11 13:50:48 1997 Mike Stump <mrs@cygnus.com>
-
- * new1.cc: Include a declaration for malloc, to avoid warning, and
- avoid lossing on systems that require one (ones that define malloc
- in xm.h).
-
-Mon Feb 10 22:51:13 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
-
- * decl2.c (max_tinst_depth): New variable.
- (lang_decode_option): Parse "-ftemplate-depth-NN" command line
- option.
- * pt.c (max_tinst_depth): Variable moved.
- * lang-options.h: Declare "-ftemplate-depth-NN" command line option
- as legal.
-
-Fri Feb 7 15:43:34 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (xref_basetypes): Allow a base class that depends on
- template parms to be incomplete.
-
- * decl2.c (build_expr_from_tree): Support typeid(type).
- * rtti.c (get_typeid): Support templates.
- (expand_si_desc, expand_class_desc): Fix string length.
- (expand_ptr_desc, expand_attr_desc, expand_generic_desc): Likewise.
-
-Tue Feb 4 11:28:24 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (unify, case TEMPLATE_CONST_PARM): Use cp_tree_equal.
-
- * pt.c (tsubst): Put it back for -fno-ansi-overloading.
-
-Mon Feb 3 18:41:12 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst, case FUNCTION_DECL): Lose obsolete code that
- smashes together template and non-template decls of the same
- signature.
-
-Thu Jan 30 19:18:00 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst): Don't recurse for the type of a TYPENAME_TYPE.
-
-Wed Jan 29 11:40:35 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (duplicate_decls): Next route, pedwarn about different
- exceptions if -pedantic *or* olddecl !DECL_IN_SYSTEM_HEADER.
-
-Tue Jan 28 20:43:29 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.h (HAS_DEFAULT_IMPLEMENTATION): Delete macro.
- (struct lang_type): Delete has_default_implementation member.
- Increase dummy to 21.
- * decl.c (start_method): Delete usage.
-
- * cp-tree.h (build_call, null_ptr_cst_p, in_function_p,
- store_after_parms, start_decl_1, auto_function): Add decls.
- (get_arglist_len_in_bytes, declare_implicit_exception,
- have_exceptions_p, make_type_decl, typedecl_for_tag,
- store_in_parms, pop_implicit_try_blocks, push_exception_cleanup,
- build_component_type_expr, cplus_exception_name,
- {make,clear}_anon_parm_name, dont_see_typename): Removed decls.
- * call.c (build_this): Make static.
- (is_complete): Likewise.
- (implicit_conversion): Likewise.
- (reference_binding): Likewise.
- (standard_conversion): Likewise.
- (strip_top_quals): Likewise.
- (non_reference): Likewise.
- (build_conv): Likewise.
- (user_harshness): Likewise.
- (rank_for_ideal): Likewise.
- * decl.c (start_decl_1): Delete forward decl.
- (push_decl_level): Make static.
- (resume_binding_level): Make static.
- (namespace_bindings_p): Make static.
- (declare_namespace_level): Make static.
- (lookup_name_real): Make static.
- (duplicate_decls): Make static. Take register off NEWDECL and
- OLDDECL parm decls.
- * decl2.c (get_sentry): Make static.
- (temp_name_p): Delete fn.
- * except.c (auto_function): Delete decl.
- * lex.c (handle_{cp,sysv}_pragma): Make static.
- (handle_sysv_pragma) [HANDLE_SYSV_PRAGMA]: Add forward decl.
- * method.c (do_build_{copy_constructor,assign_ref}): Make static.
- * pt.c (tsubst_expr_values): Make static.
- * rtti.c (combine_strings): Delete decl.
-
-Tue Jan 28 16:40:40 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (push_template_decl): Handle getting a typedef.
-
- * call.c (build_new_function_call): Complain about void arg.
-
-Tue Jan 28 15:25:09 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (duplicate_decls): Give pedwarn of different exceptions
- if -pedantic, instead of olddecl !DECL_IN_SYSTEM_HEADER.
-
-Mon Jan 27 19:21:29 1997 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Don't expand the cleanup tree here,
- since we are not going to write the rtl out. Fixes problem with
- -g -O on SPARC.
-
-Mon Jan 27 16:24:35 1997 Sean McNeil <sean@mcneil.com>
-
- * Make-lang.in: Add $(exeext) as necessary.
-
-Mon Jan 27 13:20:39 1997 Mike Stump <mrs@cygnus.com>
-
- * parse.y (handler_seq): Must have at least one catch clause.
-
-Sat Jan 25 12:00:05 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (add_builtin_candidate): Restore ?: hack.
-
- * decl.c (grok_op_properties): More warnings.
-
-Sat Jan 25 08:50:03 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (duplicate_decls): On second thought, do it as a pedwarn
- still but only if !DECL_IN_SYSTEM_HEADER (olddecl).
+ (pushdecl): Likewise. Adjust thunk handling.
+ (grokfndecl): Use DECL_EXTERN_C_P.
+ * decl2.c (mark_vtable_entries): Use DECL_THUNK_P.
+ * dump.c (dequeue_and_dump): Remove THUNK_DECL handling.
+ * except.c (nothrow_libfn_p): Use DECL_EXTERN_C_P.
+ * expr.c (cplus_expand_expr): Remove THUNK_DECL handling.
+ * method.c (make_thunk): Use SET_DECL_THUNK_P. Set
+ DECL_NO_STATIC_CHAIN.
+ (emit_thunk): Don't play games with TREE_CODE on thunks. Don't
+ set DECL_DESTRUCTOR_P or DECL_CONSTRUCTOR_P on a thunk.
+ * search.c (covariant_return_p): Remove THUNK_DECL handling.
+ * ir.texi: Update.
+
+2000-05-01 Jason Merrill <jason@casey.cygnus.com>
+
+ * tree.c (walk_tree): Set lineno.
+
+2000-05-01 Mark Mitchell <mark@codesourcery.com>
+
+ * exception.cc: Update license notice.
+ * new.cc: Likewise.
+ * new1.cc: Likewise.
+ * new2.cc: Likewise.
+ * tinfo.cc: Likewise.
+ * tinfo2.cc: Likewise.
+ * vec.cc: Likewise.
+ * inc/cxxabi.h: Likewise.
+ * inc/exception: Likewise.
+ * inc/new: Likewise.
+ * inc/new.h: Likewise.
+ * inc/typeinfo: Likewise.
- * decl.c (duplicate_decls): Scale back to a warning, and only do
- 'em if -pedantic.
+2000-05-01 Jason Merrill <jason@casey.cygnus.com>
-Fri Jan 24 17:52:54 1997 Mike Stump <mrs@cygnus.com>
+ * tree.c (build_target_expr_with_type): If we already have a
+ TARGET_EXPR, just return it.
- * decl.c (duplicate_decls): pedwarn mismatched exception
- specifications.
+ * optimize.c (initialize_inlined_parameters): Don't generate an
+ EXPR_STMT if we can just use DECL_INITIAL.
+ * decl.c (emit_local_var): Only make the initialization a
+ full-expression if stmts_are_full_exprs_p.
-Thu Jan 23 18:18:54 1997 Mike Stump <mrs@cygnus.com>
+2000-05-01 Mark Mitchell <mark@codesourcery.com>
- * call.c (build_new_method_call): Don't display the invisible
- argument for controlling virtual bases.
+ * cp-tree.h (same_type_ignoring_top_level_qualifiers_p): New
+ macro.
+ * call.c (standard_conversion): Use it.
+ (direct_reference_binding): Likewise.
+ (build_over_call): Likewise.
+ (is_properly_derived_from): Likewise.
+ (compare_ics): Likewise.
+ * class.c (resolves_to_fixed_type_p): Likewise.
+ * optimize.c (declare_return_variable): Likewise.
+ * pt.c (is_specialization_of): Likewise.
+ (unify): Likewise.
+ * typeck.c (comp_target_parms): Likeiwse.
+ (build_static_cast): Likewise.
+ (build_reinterpret_cast): Likewise.
+ (build_const_cast): Likewise.
+ (comp_ptr_ttypes_real): Likewise.
+ (comp_ptr_ttypes_const): Likewise.
+ * typeck2.c (process_init_constructor): Likewise.
-Thu Jan 23 16:48:10 1997 Mike Stump <mrs@cygnus.com>
+2000-04-30 Scott Snyder <snyder@fnal.gov>
- * new: Add nothrow new and delete, bad_alloc and throw specifications
- for delete.
- * decl.c (init_decl_processing): Add throw specification for delete.
- * new.cc (nothrow): Define.
- * lex.c (real_yylex): Removing warning that throw and friends are
- keywords.
- * new1.cc (operator new (size_t sz, const nothrow_t&)): Define.
- * new2.cc (operator new[] (size_t sz, const nothrow_t&): Define.
- * Make-lang.in: Add new{1,2}.{cc,o}.
+ * decl.c (finish_destructor_body): Use the base destructor when
+ destroying virtual bases.
-Thu Jan 23 16:39:06 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-04-30 Mark Mitchell <mark@codesourcery.com>
- * lex.c (cons_up_default_function): Fix return type of synth op=.
+ * expr.c (cplus_expand_expr): Preserve temporaries when expanding
+ STMT_EXPRs.
+ * optimize.c (struct inline_data): Add target_exprs field.
+ (declare_return_variable): When a function returns an aggregate,
+ use the variable declared in the TARGET_EXPR as the remapped
+ DECL_RESULT.
+ (expand_call_inline): Update the pending target_exprs stack.
+ (optimize_function): Initialize the stack.
- * init.c (emit_base_init): Add warnings for uninitialized members
- and bases.
+ * decl2.c (finish_file): Fix typo in comment.
- * decl.c (xref_basetypes): Add warning for non-polymorphic type
- with destructor used as base type.
+ * method.c (emit_thunk): Don't try to return a `void' value.
- * decl.c (grok_op_properties): Add warning for op= returning void.
- * typeck.c (c_expand_return): Add warning for op= returning anything
- other than *this.
+ * optimize.c (initialize_inlined_parameters): If the parameter is
+ addressable, we need to make a new VAR_DECL, even if the
+ initializer is constant.
- * class.c (finish_struct_1): Add warning for class with pointers
- but not copy ctor or copy op=.
+2000-04-28 Cosmin Truta <cosmint@cs.ubbcluj.ro>
- * cp-tree.h (TI_PENDING_TEMPLATE_FLAG): New macro.
- * pt.c (add_pending_template): Use it instead of LANG_FLAG_0.
- (instantiate_template): If -fexternal-templates, add this
- instantiation to pending_templates.
+ * decl.c (grok_op_properties): Add an extra check of argtypes.
- * decl2.c (copy_assignment_arg_p): Disable old hack to support
- Booch components.
+2000-04-27 Mark Mitchell <mark@codesourcery.com>
-Tue Jan 21 18:32:04 1997 Mike Stump <mrs@cygnus.com>
+ * optimize.c (copy_body_r): Use STRIP_TYPE_NOPS when copying
+ variables.
+ (initialize_inlined_parameters): Try to avoid creating new
+ VAR_DECLs.
- * cvt.c (cp_convert): pedwarn enum to pointer conversions.
+2000-04-27 Alex Samuel <samuel@codesourcery.com>
-Mon Jan 20 17:59:51 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * lex.c (my_get_run_time): Remove.
+ (init_filename_times): Use get_run_time instead of my_get_run_time.
+ (check_newline): Likewise.
+ (dump_time_statistics): Likewise.
+ * decl2.c (finish_file): Push and pop timevar TV_VARCONST instead
+ of computing elapsed time explicitly.
- * call.c (standard_conversion): Handle getting references. Tack
- on RVALUE_CONV here. Do it for non-class types, too.
- (reference_binding): Pass references to standard_conversion.
- (implicit_conversion): Likewise.
- (add_builtin_candidate): Disable one ?: kludge.
- (convert_like): Handle RVALUE_CONVs for non-class types.
- (joust): Disable the other ?: kludge.
+2000-04-26 Mark Mitchell <mark@codesourcery.com>
-Mon Jan 20 14:53:13 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+ * cp-tree.h (TREE_READONLY_DECL_P): Use DECL_P.
+ * init.c (decl_constant_value): Check TREE_READONLY_DECL_P.
+ * call.c (convert_like_real): Don't test TREE_READONLY_DECL_P
+ before calling decl_constant_value.
+ * class.c (check_bitfield_decl): Likewise.
+ * cvt.c (ocp_convert): Likewise.
+ (convert): Likewise.
+ * decl.c (compute_array_index_type): Likewise.
+ (build_enumerator): Likewise.
+ * decl2.c (check_cp_case_value): Likewise.
+ * pt.c (convert_nontype_argument): Likewise.
+ (tsubst): Likewise.
+ * typeck.c (decay_conversion): Likewise.
+ (build_compound_expr): Likewise.
+ (build_reinterpret_cast): Likewise.
+ (build_c_cast): Likewise.
+ (convert_for_assignment): Likewise.
- * decl.c (init_decl_processing): Add code to build up common
- function types beforehand, to avoid creation then removal of
- things already in the hash table.
+2000-04-26 Jason Merrill <jason@casey.cygnus.com>
-Mon Jan 20 14:43:49 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (finish_function): Don't play games with DECL_INLINE.
- * decl.c (finish_function): Also zero out DECL_INCOMING_RTL for
- the arguments.
+2000-04-25 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
- * error.c (dump_expr, TEMPLATE_CONST_PARM): Don't require
- current_template_parms.
+ * ir.texi: Correct typo.
-Fri Jan 17 10:25:42 1997 Jason Merrill <jason@yorick.cygnus.com>
+2000-04-25 Martin v. Löwis <loewis@informatik.hu-berlin.de>
- * search.c (lookup_field): Don't return a function, check want_type.
+ * decl.c (grokdeclarator): Reject VLAs as members.
-Thu Jan 16 18:14:35 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+2000-04-24 Gabriel Dos Reis <gdr@codesourcery.com>
- * init.c (build_new): Make sure PLACEMENT has a type.
+ * call.c (standard_conversion): Accept conversion between
+ COMPLEX_TYPEs.
-Thu Jan 16 17:40:28 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * cvt.c (ocp_convert): Handle conversion to COMPLEX_TYPE.
- * init.c (build_new): Support new (nothrow).
+2000-04-24 Zack Weinberg <zack@wolery.cumb.org>
-Wed Jan 15 12:38:14 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * decl2.c (finish_file): Remove double setup for accounting
+ compile time.
- * pt.c (instantiate_decl): Also do push_to_top_level before setting
- up DECL_INITIAL.
+2000-04-24 Robert Lipe <robertlipe@usa.net>
- * cp-tree.h (PARM_DEFAULT_FROM_TEMPLATE): New macro.
- * pt.c (tsubst): Defer instantiation of default args.
- * call.c (build_over_call): Until here.
+ * cp-tree.h (lang_type): Member `language' now ENUM_BITFIELD.
-Wed Jan 15 10:08:10 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+2000-04-23 Benjamin Kosnik <bkoz@cygnus.com>
- * search.c (lookup_field): Make sure we have an
- IDENTIFIER_CLASS_VALUE before we try to return it.
+ * new.cc (set_new_handler): Needs to be in std::.
-Thu Jan 9 07:19:01 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+2000-04-23 Mark Mitchell <mark@codesourcery.com>
- * call.c (build_method_call): Delete unused var PARM.
- (build_overload_call_real): Likewise.
- (build_object_call): Delete unused var P.
- (build_new_op): Likewise.
- * decl.c (builtin_type_tdescs_{arr, len, max}): #if 0 out static
- var definitions, which are never used.
- (shadow_tag): Delete unused var FN.
- * expr.c (cplus_expand_expr): Delete unused var ORIGINAL_TARGET.
- * init.c (build_new): Delete unused var ALLOC_TEMP.
- * method.c (hack_identifier): Delete unused var CONTEXT.
- (do_build_copy_constructor): Delete unused var NAME.
- (synthesize_method): Delete unused var BASE.
- * pt.c (lookup_template_class): Delete unused var CODE_TYPE_NODE.
- * rtti.c (build_headof): Delete unused var VPTR.
- (get_typeid): Delete unused var T.
- * typeck.c (build_conditional_expr): Delete unused vars ORIG_OP1
- and ORIG_OP2.
- (build_ptrmemfunc): Delete unused vars U and NINDEX.
- * typeck2.c (build_functional_cast): Delete unused var BINFO.
-
-Wed Jan 8 13:09:54 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * search.c (lookup_field): Use IDENTIFIER_CLASS_VALUE to look up
- things in a type being defined.
- * decl.c (finish_enum): Reverse the values so that they are in
- the correct order.
-
- * pt.c (instantiate_class_template): Don't initialize
- BINFO_BASETYPES until the vector is filled out.
- (unify): Don't abort on conflicting bindings, just fail.
- (instantiate_decl): Do push_tinst_level before any tsubsting.
-
- * method.c (build_overload_value): Handle getting a
- TEMPLATE_CONST_PARM for a pointer.
-
-Tue Jan 7 14:00:58 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (expand_member_init): Don't give 'not a base' error for
+ * cp-tree.h (lang_decl): Remove pretty_function_p.
+ (DECL_PRETTY_FUNCTION_P): Use TREE_LANG_FLAG_0, not a bit in the
+ language-specific node.
+ * decl.c (cp_make_fname_decl): Use build_decl, not
+ build_lang_decl, to build the variables.
+ (grokvardecl): Don't call build_lang_decl for local variables in
templates.
+ (grokdeclarator): Don't call build_lang_decl for local type
+ declarations in templates.
+ * lex.c (retrofit_lang_decl): Use ggc_alloc_obj to allocated
+ zero'd memory, rather than calling memset.
+ * pt.c: Include hashtab.h.
+ (local_specializations): New variable.
+ (retrieve_local_specialization): Use it.
+ (register_local_specialization): Likewise.
+ (tsubst_decl): Don't assume local variables have
+ DECL_LANG_SPECIFIC.
+ (instantiate_decl): Set up local_specializations.
+ * Makefile.in (HTAB_H): New variable.
- * pt.c (instantiate_decl): Call import_export_decl later.
-
- * pt.c (instantiate_class_template): Return a value.
-
- * parse.y (extension): New rule for __extension__.
- (extdef, unary_expr, decl, component_decl): Use it.
-
-Tue Jan 7 09:20:28 1997 Mike Stump <mrs@cygnus.com>
-
- * class.c (base_binfo): Remove unused base_has_virtual member.
- (finish_base_struct): Likewise.
- (finish_struct_1): Likewise.
-
-Tue Dec 31 20:25:50 1996 Mike Stump <mrs@cygnus.com>
-
- * search.c (expand_upcast_fixups): Fix bogus code generation
- problem where the generated code uses the wrong index into the
- runtime built vtable on the stack. Old code could clobber random
- stack values.
-
-Tue Dec 31 15:16:56 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (perform_member_init): Make sure the partial EH cleanups
- live on the function_obstack.
-
-Fri Dec 27 10:31:40 1996 Paul Eggert <eggert@twinsun.com>
-
- * Make-lang.in (g++spec.o): Don't use $< with an explicit target;
- this isn't portable to some versions of `make' (e.g. Solaris 2.5.1).
-
-Tue Dec 24 10:24:03 1996 Jeffrey A Law <law@cygnus.com>
-
- * decl.c (grokvardecl): Avoid ANSI style initialization.
-
-Sun Dec 22 04:22:06 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst): Tweak arg types for a FUNCTION_TYPE.
-
-Fri Dec 20 17:09:25 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Call grok_{ctor,op}_properties.
-
-Fri Dec 20 12:17:12 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * g++spec.c (lang_specific_driver): Put missing hyphen in front of
- arguments we compare against. Start the count of I at 1, not 0,
- since argv[0] is still the command.
-
-Thu Dec 19 11:53:57 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * lang-specs.h: Accept .cp as an C++ extension.
+2000-04-23 Richard Henderson <rth@cygnus.com>
-Mon Dec 16 22:43:31 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+ * typeck.c (c_expand_asm_operands): Restore the original
+ contents of the output list.
- * cp-tree.h (ptr_reasonably_similar): Add decl.
+2000-04-22 Gabriel Dos Reis <gdr@codesourcery.com>
-Thu Dec 12 15:00:35 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+ * ir.texi: Document complex number representation.
- * decl.c (grokvardecl): Change SPECBITS parm to be the SPECBITS_IN
- pointer. New local SPECBITS with the parm's value.
- (grokdeclarator): Pass &specbits down.
+2000-04-20 Nathan Sidwell <nathan@codesourcery.com>
- * parse.y (expr_no_commas): Make sure $$ is not an error_mark_node
- before we try to do C_SET_EXP_ORIGINAL_CODE on it.
+ * rtti.c (init_rtti_processing): Set tinfo_var_id in new-abi.
+ (target_incomplete_p): New function.
+ (tinfo_base_init): Create comdat NTBS name variable.
+ (ptr_initializer): Add non_public parameter. Calculate it.
+ (ptmd_initializer): Likewise.
+ (synthesize_tinfo_var): Adjust. Emit incomplete class tinfo.
+ (create_real_tinfo_var): Add non_public parameter. Use it.
+ Push proxy into global namespace.
+ * inc/cxxabi.h (__pointer_type_info::incomplete_class_mask):
+ New enumeration.
+ * inc/typeinfo (type_info::before, type_info::operator==):
+ Compare __name addresses.
- * search.c (envelope_add_decl): Check that the CLASSTYPE_CID of
- CONTEXT is not 0 before we try to use TYPE_DERIVES_FROM.
+ * tinfo2.cc: Remove new-abi builtins comment.
- * decl.c (cplus_expand_expr_stmt): Only expand the expr if EXP is
- not an error_mark_node.
+2000-04-20 Jason Merrill <jason@casey.cygnus.com>
-Sat Dec 7 17:20:22 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * typeck.c (build_x_function_call): Resolve an OFFSET_REF.
- * cp-tree.h (TYPE_MAIN_DECL): Use TYPE_STUB_DECL.
- * *.c: Use TYPE_MAIN_DECL instead of TYPE_NAME where appropriate.
+ * call.c (joust): Exit early if we get the same function, too.
-Fri Dec 6 14:40:09 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * decl2.c (key_method): Return NULL_TREE for template classes.
+ (import_export_class): Don't need to check for template classes.
- * decl.c (grokdeclarator): When giving an anonymous struct a name,
- replace TYPE_NAME instead of TYPE_IDENTIFIER (so TYPE_STUB_DECL is
- not affected).
+2000-04-18 Zack Weinberg <zack@wolery.cumb.org>
- * typeck2.c (build_m_component_ref): If component is a pointer
- to data member, resolve the OFFSET_REF now.
+ * lex.c: Remove references to cccp.c.
- * call.c (convert_like): Don't go into infinite recursion.
+2000-04-18 Mark Mitchell <mark@codesourcery.com>
- * pt.c (coerce_template_parms): Use tsubst_expr for non-type args.
+ * cp-tree.h (lang_decl_flags): Remove const_memfunc and
+ volatile_memfunc. Add destructor_attr. Adjust dummy.
+ (DECL_DESTRUCTOR_P): Use destructor_attr.
+ (DECL_CONST_MEMFUNC_P): Reimplement.
+ (DECL_VOLATILE_MEMFUNC_P): Remove.
+ * class.c (finish_struct_methods): Use CLASSTYPE_DESTRUCTORS.
+ (overrides): Use DECL_DESTRUCTOR_P.
+ (check_for_override): Likewise.
+ * decl.c (start_function): Likewise.
+ * decl2.c (grokfclassfn): Likewise.
+ (check_classfn): Likewise.
+ (grok_function_init): Likewise.
- * class.c (finish_struct_1): Set DECL_ARTIFICIAL on the vptr.
- * tree.c (layout_basetypes): And on the vbase ptr.
+2000-04-17 Mark Mitchell <mark@codesourcery.com>
-Thu Dec 5 02:11:28 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * decl2.c (grokfield): Issue error on illegal data member
+ declaration.
- * decl.c (BOOL_TYPE_SIZE): Define in terms of POINTER_SIZE or
- CHAR_TYPE_SIZE so bool is always the same size as another type.
+Mon Apr 17 17:11:16 2000 Mark P Mitchell <mark@codesourcery.com>
- * decl.c (pushtag): Set DECL_IGNORED_P for DWARF, too.
+ * method.c (make_thunk): Set DECL_CONTEXT for a THUNK_DECL.
-Tue Dec 3 23:18:37 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-04-16 Mark Mitchell <mark@codesourcery.com>
- * decl2.c (grok_x_components): Remove synthesized methods from
- TYPE_METHODS of an anonymous union, complain about member
+ * class.c (build_vtable_entry): Don't build thunks for type-info
functions.
- * decl.c (shadow_tag): Wipe out memory of synthesized methods in
- anonymous unions.
- (finish_function): Just clear the DECL_RTL of our arguments.
-
-Fri Nov 29 21:54:17 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_file): Emit DWARF debugging info for static data
- members.
-
- * pt.c (tsubst): If t is a stub decl, return the stub decl for type.
-
-Wed Nov 27 14:47:15 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (build_component_ref): Don't die if COMPONENT isn't a
- IDENTIFIER_NODE.
-
-Wed Nov 27 16:05:19 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * Make-lang.in (g++-cross$(exeext)): Fix typo.
-
-Wed Nov 27 08:14:00 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- Make the g++ driver now be a standalone program, rather than one
- that tries to run the gcc driver after munging up the options.
- * Make-lang.in (g++.c, g++spec.o): New rules.
- (g++.o): New rule, based on gcc.o with -DLANG_SPECIFIC_DRIVER
- added.
- (g++$(exeext)): New rule, based on xgcc rule.
- (g++-cross$(exeext)): Now just copies g++$(exeext) over.
- * g++spec.c: New file.
- * g++.c: Removed file.
-Tue Nov 26 19:01:09 1996 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (build_up_reference): Arrange for any temporary values
- that have been keep in registers until now to be put into memory.
-
-Mon Nov 25 15:16:41 1996 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in (c++.stage[1234]): Depend upon stage[1-4]-start, so
- that make -j3 bootstrap works better.
-
-Sun Nov 24 02:09:39 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (pushtag): Do pushdecl for anon tags.
-
-Thu Nov 21 16:30:24 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (c_expand_return): Fix logic.
- (unary_complex_lvalue): Avoid unused warning on address of INIT_EXPR.
-
-Wed Nov 20 18:47:31 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * g++.c (main): Make sure arglist has a final NULL entry. Add
- PEXECUTE_LAST to the flags passed to pexecute, as otherwise
- stdin/stdout of the invoked program are redirected to
- nowheresville.
-
-Tue Nov 19 16:12:44 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (implicitly_declare): Set DECL_ARTIFICIAL.
-
-Tue Nov 19 15:48:19 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (resolve_offset_ref): Handle obj.vfn better.
- * typeck.c (build_component_ref): Set TREE_TYPE on result from
- build_vfn_ref.
-
-Tue Nov 19 13:14:33 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (convert_for_assignment): Also handle anachronistic
- implicit conversions from (::*)() to cv void*.
- * cvt.c (cp_convert_to_pointer): Likewise.
-
-Mon Nov 18 17:05:26 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (handle_cp_pragma): Fix bogus warning.
-
-Mon Nov 18 16:10:43 1996 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (cp_convert_to_pointer): Avoid thinking a POINTER_TYPE
- (METHOD_TYPE) is a TYPE_PTRMEMFUNC_P.
-
-Thu Nov 14 23:18:17 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (finish_struct_1): Support DWARF2_DEBUG.
- * search.c (dfs_debug_mark): Likewise.
- * decl2.c (finish_vtable_vardecl): Likewise.
- * decl.c (pushtag, finish_enum): Likewise.
- * lex.c (check_newline): Use debug_* instead of calling *out
- functions directly.
-
-Thu Nov 14 15:21:46 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * Make-lang.in (cplib2.ready): Add else clause to avoid problems
- on some picky hosts.
-
-Wed Nov 13 12:32:07 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (finish_struct_1): A class has a non-trivial copy
- constructor if it has virtual functions.
-
- * cvt.c (cp_convert): Always call a constructor.
-
- * call.c (reference_binding): Still tack on a REF_BIND
- for bad conversions.
- (build_user_type_conversion_1): Propagate ICS_BAD_FLAG.
-
- * typeck.c (convert_arguments): Pass LOOKUP_ONLYCONVERTING.
- (c_expand_return): Likewise.
- * typeck2.c (digest_init): Likewise for { }.
- * init.c (expand_aggr_init_1): Keep the CONSTRUCTOR handling.
- * cvt.c (cp_convert): Handle failure better.
-
-Wed Nov 13 11:51:20 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * g++.c (main): Also set PEXECUTE_SEARCH, to make the invocation
- of GCC be path-relative.
-
-Wed Nov 13 11:27:16 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * Make-lang.in (g++-cross): G++-cross doesn't need version.o, but
- it does need choose-temp.o and pexecute.o.
-
-Wed Nov 13 07:53:38 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * g++.c (error) [!HAVE_VPRINTF]: Put error back for the only time
- that we still use it.
- (P_tmpdir, R_OK, W_OK, X_OK) [__MSDOS__]: Delete unnecessary macros.
-
-Wed Nov 13 02:00:26 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (expand_default_init): Avoid calling constructors to
- initialize reference temps.
+2000-04-16 Jason Merrill <jason@casey.cygnus.com>
+
+ * decl.c (decls_match): Allow a redeclaration of a builtin to
+ specify args while the builtin did not.
+
+2000-04-15 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.def (THUNK_DECL): Add to documentation.
+ * cp-tree.h (flag_huge_objects): Declare.
+ * class.c (modify_vtable_entry): Tidy.
+ (update_vtable_entry_for_fn): Split out from dfs_modify_vtables.
+ Calculate delta appropriately for the new ABI.
+ (dfs_modify_vtables): Use it.
+ (modify_all_vtables): Fix thinko in code to add overriding copies
+ of functions to primary vtables.
+ (build_clone): Fix typo in comment.
+ (clone_function_decl): Correct order of destructors in vtable.
+ (build_vbase_offset_vtbl_entries): Adjust comment.
+ (dfs_vcall_offset_queue_p): Remove.
+ (dfs_build_vcall_offset_vtbl_entries): Update BV_VCALL_INDEX.
+ (build_vcall_offset_vtbl_entries): Juse use dfs_skip_vbases.
+ (build_vtable_entry): Correct check for pure virtual functions.
+ Don't declare flag_huge_objects.
+ * decl.c (flag_huge_objects): Remove declaration.
+ * method.c (make_thunk): Tweak mangling for vcall offset thunks.
+ Use int_size_in_bytes.
+ (emit_thunk): Handle vcall offset thunks.
+
+Sat Apr 15 16:00:01 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * decl2.c (parse_time, varconst_time): Delete declarations.
+ (finish_file): Delete LINENO declaration.
+ START_TIME and THIS_TIME now long.
+
+2000-04-13 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (build_base_field): Reformat comment.
+
+ * inc/cxxabi.h (stddef.h): Comment inclusion.
+ (__base_class_info::__offset): Comment shift.
+
+2000-04-12 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (IDENTIFIER_CTOR_OR_DTOR_P): New macro.
+ (cp_tree_index): Add CPTI_PUSH_EXCEPTION_IDENTIFIER.
+ (cp_push_exception_identifier): New macro.
+ (DECL_COMPLETE_DESTRUCTOR_P): New macro.
+ (DECL_BASE_DESTRUCTOR_P): Likewise.
+ (DECL_DELETING_DESTRUCTOR_P): Likewise.
+ (get_vtbl_decl_for_binfo): Fix formatting.
+ (in_charge_arg_for_name): New macro.
+ (maybe_build_cleanup_and_delete): Remove declaration.
+ * call.c (build_field_call): Use IDENTIFIER_CTOR_OR_DTOR_P.
+ (in_charge_arg_for_name): New function.
+ (build_new_method_call): Use it. Handle cloned destructors.
+ (build_clone): Don't make the base constructor virtual.
+ Automatically defer generated functions.
+ (clone_function_decl): Handle destructors, too.
+ (clone_constructors_and_destructors): Likewise.
+ (create_vtable_ptr): Don't create a vtable entry for a cloned
+ function.
+ * decl.c (predefined_identifier): Add ctor_or_dtor_p.
+ (initialize_predefined_identifiers): Update appropriately.
+ (finish_destructor_body): Simplify.
+ (maybe_build_cleanup_and_delete): Remove.
+ * except.c (expand_throw): Handle new-ABI destructors.
+ * init.c (expand_cleanup_for_base): Use base_dtor_identifier.
+ (build_dtor_call): New function.
+ (build_delete): Use it. Simplify.
+ * optimize.c (maybe_clone_body): Handle destructors.
+ * search.c (lookup_field_queue_p): Use IDENTIFIER_CTOR_OR_DTOR_P.
+
+ * exception.cc (cleanup_fn): New typedef.
+ (CALL_CLEANUP): New macro.
+ (cp_eh_info): Use them.
+ (__cp_push_exception): Likewise.
+ (__cp_pop_exception): Likewise.
- * cvt.c (convert_to_reference): Fix.
+2000-04-11 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER.
+ (complete_dtor_identifier): New macro.
+ (CLASSTYPE_FIRST_CONVERSION): Remove.
+ (CLASSTYPE_CONSTRUCTOR_SLOT): New macro.
+ (CLASSTYPE_DESTRUCTOR_SLOT): Likewise.
+ (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise.
+ (CLASSTYPE_CONSTRUCTORS): Likewise.
+ (CLASSTYPE_DESTRUCTORS): Likewise.
+ (lang_decl): Add cloned_function.
+ (DECL_COMPLETE_CONSTRUCTOR_P): New macro.
+ (DECL_BASE_CONSTRUCTOR_P): Likewise.
+ (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise.
+ (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise.
+ (DECL_CLONED_FUNCTION_P): Likewise.
+ (DECL_CLONED_FUNCTION): Likewise.
+ (clone_function_decl): Declare.
+ (maybe_clone_body): Likewise.
+ * call.c (build_user_type_conversion_1): Call complete object
+ constructors in the new ABI.
+ (build_new_method_call): Don't add in-charge parameters under the
+ new ABI.
+ * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P,
+ DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and
+ CLASSTYPE_DESTRUCTOR_SLOT.
+ (build_clone): New function.
+ (clone_function_decl): Likewise.
+ (clone_constructors_and_destructors): Likewise.
+ (check_bases_and_members): Use it.
+ * decl.c (iniitialize_predefined_identifiers): Initialize
+ complete_dtor_identifier.
+ (finish_function): Don't add extra code to a clone.
+ (lang_mark_tree): Mark cloned_function.
+ * decl2.c (mark_used): Don't bother trying to instantiate things
+ we synthesized.
+ * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice.
+ * method.c (set_mangled_name_for_decl): Don't treat clones as
+ constructors.
+ (synthesize_method): Sythesize cloned functions, not the clones.
+ * optimize.c (inline_data): Update comment on ret_label.
+ (remap_block): Don't assume DECL_INITIAL exists.
+ (copy_body_r): Allow ret_label to be NULL.
+ (maybe_clone_body): Define.
+ * pt.c (tsubst_decl): Handle clones.
+ (instantiate_clone): New function.
+ (instantiate_template): Use it.
+ (set_mangled_name_for_template_decl): Don't treat clones as
+ constructors.
+ * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT,
+ CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT.
+ * semantics.c (expand_body): Clone function bodies as necessary.
+
+ * optimize.c (remap_decl): Avoid sharing structure for arrays
+ whose size is only known at run-time.
+ * tree.c (copy_tree_r): Don't copy PARM_DECLs.
+
+ * cp-tree.h (lang_decl_flags): Rename constructor_for_vbase_attr
+ to has_in_charge_parm_p.
+ (DECL_CONSTRUCTOR_FOR_VBASE_P): Rename to ...
+ (DECL_HAS_IN_CHARGE_PARM_P): ... this.
+ (DECL_COPY_CONSTRUCTOR_P): New macro.
+ * call.c (add_function_candidate): Use DECL_HAS_IN_CHARGE_PARM_P.
+ (build_user_type_conversion_1): Likewise.
+ (convert_like_real): Likewise.
+ (build_over_call): Likeiwse. Use DECL_COPY_CONSTRUCTOR_P.
+ * decl.c (grokdeclarator): Use DECL_HAS_IN_CHARGE_PARM_P.
+ (copy_args_p): Likewise.
+ (grok_ctor_properties): Likewise.
+ (start_function): Likewise.
+ * decl2.c (maybe_retrofit_in_charge): Likewise. Set it.
+ * error.c (dump_function_decl): Use DECL_HAS_IN_CHARGE_PARM_P.
+ * init.c (emit_base_init): Use DECL_COPY_CONSTRUCTOR_P.
+ * method.c (do_build_copy_constructor): Use
+ DECL_HAS_IN_CHARGE_PARM_P.
+ (synthesize_method): Likewise.
+ * pt.c (instantiate_template): Remove goto.
+ * tree.c (build_cplus_method_type): Remove mention of obstacks in
+ comment.
-Tue Nov 12 19:10:07 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tre.h (finish_function): Change prototype.
+ * decl.c (end_cleanup_fn): Adjust caller.
+ (finish_function): Take only one parameter.
+ * decl2.c (finish_objects): Adjust caller.
+ (finish_static_storage_duration_function): Likewise.
+ * method.c (emit_thunk): Likewise.
+ * parse.y: Likewise.
+ * parse.c: Regenerated.
+ * pt.c (instantiate_decl): Likewise.
+ * rtti.c (synthesize_tinfo_fn): Likewise.
+ * semantics.c (expand_body): Likewise.
- * cvt.c (cp_convert): Simplify for flag_ansi_overloading.
- (convert_to_reference): Likewise.
- * typeck.c (convert_for_initialization): Likewise.
- * init.c (expand_default_init): Likewise.
- (expand_aggr_init_1): Likewise.
- * cp-tree.h (CONV_NONCONVERTING): Lose.
- * typeck.c (build_c_cast): Lose allow_nonconverting parm.
- * *.c: Adjust.
- * call.c (build_user_type_conversion_1): Assume LOOKUP_ONLYCONVERTING.
+ * cp-tree.h (copy_decl): New function.
+ * class.c (finish_struct_1): Use it.
+ * lex.c (copy_decl): Define it.
+ * pt.c (tsubst_decl): Likewise.
+ * tree.c (copy_template_template_parm): Likewise.
-Tue Nov 12 16:29:04 1996 Brendan Kehoe <brendan@canuck.cygnus.com>
+ * cp-tree.h (lang_type): Remove has_nonpublic_ctor and
+ has_nonpublic_assign_ref.
+ (TYPE_HAS_NONPUBLIC_CTOR): Don't declare.
+ (TYPE_HAS_NONPUBLIC_ASSIGN_REF): Likewise.
+ * class.c (finish_struct_methods): Don't set
+ TYPE_HAS_NONPUBLIC_CTOR or TYPE_HAS_NONPUBLIC_ASSIGN_REF.
+ (interface_only): Don't declare.
+ (interface_unknown): Likewise.
- * pt.c (tsubst_expr): Reverse args to expand_start_catch_block.
+2000-04-11 Martin v. Löwis <loewis@informatik.hu-berlin.de>
-Tue Nov 12 15:26:17 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * tree.h (HAVE_TEMPLATES): Remove definition.
+ * lang-options.h (-fthis-is-variable): Remove documentation.
- * init.c (expand_aggr_init_1): Don't crash on non-constructor
- TARGET_EXPR.
+2000-04-10 Jason Merrill <jason@casey.cygnus.com>
-Tue Nov 12 14:00:50 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+ * class.c (instantiate_type): Handle object-relative template-id.
- * g++.c: Include gansidecl.h.
- (VPROTO, PVPROTO, VA_START): Delete.
- (choose_temp_base_try, choose_temp_base, perror_exec,
- run_dos) [__MSDOS__]: Delete fns.
- (pfatal_with_name): Delete fn.
- (temp_filename): Declare like in gcc.c.
- (pexecute, pwait, choose_temp_base): Declare from gcc.c.
- (error_count, signal_count): Define.
- (error): Delete both definitions.
- (PEXECUTE_{FIRST,LAST,SEARCH,VERBOSE}): Define from gcc.c.
- (pfatal_pexecute): Add fn from gcc.c.
- (main): Rename local VERBOSE var to VERBOSE_FLAG. Rewrite the
- code to use the pexecute stuff also used by gcc.c.
- (MIN_FATAL_STATUS): Define.
- * Make-lang.in (g++): Add dependency on and linking with
- choose-temp.o and pexecute.o.
+ * semantics.c (finish_expr_stmt): Call convert_to_void here.
+ * decl.c (cplus_expand_expr_stmt): Not here.
- * cp-tree.h: Include gansidecl.h.
- (STDIO_PROTO): Delete #undef/#define.
- * cvt.c (NULL): Delete #undef/#define.
- * expr.c (NULL): Likewise.
- * init.c (NULL): Likewise.
- * rtti.c (NULL): Likewise.
- * xref.c (NULL): Likewise.
+ * rtti.c (build_dynamic_cast_1): Call non_lvalue.
+ Initialize exprtype earlier.
- * cp-tree.h (build_user_type_conversion): Add prototype.
- * call.c (build_user_type_conversion): Delete prototype. Correct
- decl of FLAGS arg to be an int.
- * cvt.c (build_user_type_conversion): Likewise.
+ * parse.y (fn.def1): Check for defining types in return types.
-Tue Nov 12 12:16:20 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (check_tag_decl): Notice extra fundamental types.
+ Diagnose empty decls in classes, too.
- * cp-tree.def: Add TRY_BLOCK and HANDLER.
- * except.c (expand_start_catch_block): Support templates.
- * parse.y (try_block, handler_seq): Likewise.
- * pt.c (tsubst_expr): Support TRY_BLOCK and HANDLER.
+ * decl.c (grokdeclarator): Don't override an anonymous name if no
+ declarator was given.
-Mon Nov 11 13:57:31 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * cvt.c (convert_to_void): Call resolve_offset_ref.
- * pt.c (current_template_args): New fn.
- (push_template_decl): Use it.
- * decl.c (grokdeclarator): Use it.
+ * typeck.c (build_x_function_call): Abort if we get an OFFSET_REF.
- * decl2.c (build_expr_from_tree): Dereference ref vars.
+ * decl2.c (decl_namespace): Handle getting a type.
- * decl.c (grokdeclarator): Generalize handling of TYPENAME_TYPEs in
- the decl-specifier-seq.
+ * typeck.c (build_c_cast): Re-enable warning for cast between
+ pointer and integer of different size.
- * decl.c (grok_op_properties): Don't force the type of a conversion
- op to be complete. Don't warn about converting to the same type
- for template instantiations.
+2000-04-10 Nathan Sidwell <nathan@codesourcery.com>
- * decl2.c (finish_file): Don't call instantiate_decl on synthesized
- methods.
+ * inc/cxxabi.h (__pointer_type_info): Add restrict and
+ incomplete flags.
+ (__pointer_type_info::__pointer_catch): New virtual function.
+ (__pointer_to_member_type_info): Derive from
+ __pointer_type_info. Adjust.
+ (__pointer_to_member_type_info::__do_catch): Remove.
+ (__pointer_to_member_type_info::__is_pointer_p): Declare.
+ (__pointer_to_member_type_info::__pointer_catch): Declare.
+ * rtti.c (qualifier_flags): Add restrict flag.
+ (ptmd_initializer): Reorder members.
+ (create_tinfo_types): Expand comments. Reorder
+ ptmd_desc_type_node members.
+ * tinfo2.cc (__pointer_to_member_type_info::__is_pointer_p):
+ Implement.
+ (__pointer_type_info::__do_catch): Move specific code into
+ __pointer_catch. Call it.
+ (__pointer_type_info::__pointer_catch): Non-pointer-to-member
+ specific catch checking. Fix void conversion check.
+ (__pointer_to_member_type_info::__do_catch): Remove.
+ (__pointer_to_member_type_info::__pointer_catch): Implement.
-Mon Nov 11 13:20:34 1996 Bob Manson <manson@charmed.cygnus.com>
+2000-04-10 Martin v. Löwis <loewis@informatik.hu-berlin.de>
- * typeck.c (get_delta_difference): Remove previous bogusness.
- Don't give errors if force is set.
+ * lex.c (init_parse): Remove traces of classof and headof.
+ * decl2.c (flag_operator_names): Default to 1.
+ (lang_decode_option): Do not set it for -ansi.
-Fri Nov 8 17:38:44 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-04-09 Mark Mitchell <mark@codesourcery.com>
- * decl2.c (finish_file): Don't emit debug info.
- * decl.c (pushdecl): Lose obsolete code.
- (grokdeclarator): Still do the long long thing after complaining.
- * search.c (note_debug_info_needed): Don't do anything if we're in a
- template.
- * method.c (synthesize_method): For non-local classes,
- push_to_top_level first.
+ * cp-tree.h (struct lang_decl): Remove main_decl_variant.
+ (DECL_MAIN_VARIANT): Remove.
+ * decl.c (duplicate_decls): Don't set it.
+ (start_function): Likewise.
+ (lang_mark_tree): Don't mark it.
+ * decl2.c (defer_fn): Don't use it.
+ * lex.c (retrofit_lang_decl): Don't set it.
+ * pt.c (tsubst_decl): Likewise.
+ * ptree.c (print_lang_decl): Don't print it.
+ * typeck.c (mark_addressable): Don't use it.
+
+2000-04-09 Nathan Sidwell <nathan@codesourcery.com>
+
+ * vec.cc: Include <new> and <exception>.
+ (__cxa_vec_ctor): Use __cxa_vec_dtor for cleanup.
+ (__cxa_vec_dtor): Catch dtor exceptions, and rethrow or
+ terminate.
+ (__cxa_vec_delete): Catch dtor exceptions.
+
+2000-04-09 Nathan Sidwell <nathan@codesourcery.com>
+
+ Prepend __ to implementation defined names.
+ * inc/typeinfo (type_info): Rename _name to __name.
+ (type_info::type_info): Rename parameter.
+ (type_info::operator==, type_info::operator!=,
+ type_info::before): Likewise.
+ (type_info::is_pointer_p, type_info::is_function_p,
+ type_info::do_catch, type_info::do_upcast): Prepend __. Rename
+ parameters.
+ * inc/cxxabi.h
+ (__fundamental_type_info::__fundamental_type_info) Rename parameters.
+ (__pointer_type_info::__pointer_type_info): Likewise.
+ (__pointer_type_info::is_pointer_p,
+ __pointer_type_info::do_catch): Prepend __. Rename parameters.
+ (__array_type_info::__array_type_info): Rename parameters.
+ (__function_type_info::__function_type_info): Likewise.
+ (__function_type_info::is_function_p): Prepend __.
+ (__enum_type_info::__enum_type_info): Rename parameters.
+ (__pointer_to_member_type_info::__pointer_to_member_type_info):
+ Likewise.
+ (__pointer_to_member_type_info::do_catch): Prepend __. Rename
+ parameters.
+ (__base_class_info::is_virtual_p, is_public_p, offset): Prepend __.
+ (__class_type_info::__class_type_info): Rename parameters.
+ (__class_type_info::sub_kind): Prepend __. Adjust member names.
+ (__class_type_info::upcast_result,
+ __class_type_info::dyncast_result): Prepend __. Move definition
+ into tinfo.cc.
+ (__class_type_info::do_upcast, __class_type_info::do_catch,
+ __class_type_info::find_public_src,
+ __class_type_info::do_dyncast,
+ __class_type_info::do_find_public_src): Prepend __. Rename
+ parameters.
+ (__si_class_type_info::__si_class_type_info): Rename parameters.
+ (__si_class_type_info::do_upcast, __si_class_type_info::do_dyncast,
+ __si_class_type_info::do_find_public_src): Prepent __. Rename
+ parameters.
+ (__vmi_class_type_info::__vmi_class_type_info): Rename parameters.
+ (__vmi_class_type_info::do_upcast, __vmi_class_type_info::do_dyncast,
+ __vmi_class_type_info::do_find_public_src): Prepent __. Rename
+ parameters.
+ (__dynamic_cast): Rename parameters.
+ * tinfo.cc (type_info::is_pointer_p, type_info::is_function_p,
+ type_info::do_catch, type_info::do_upcast): Prepend __.
+ (contained_p, public_p, virtual_p, contained_public_p,
+ contained_nonpublic_p, contained_nonvirtual_p): Adjust.
+ (__class_type_info::do_catch,
+ __class_type_info::do_upcast): Prepend __. Adjust.
+ (__class_type_info::__upcast_result,
+ __class_type_info::__dyncast_result): Move from inc/cxxabi.h.
+ Adjust.
+ (__class_type_info::find_public_src): Prepend __. Adjust.
+ (__class_type_info::do_find_public_src,
+ __si_class_type_info::do_find_public_src,
+ __vmi_class_type_info::do_find_public_src): Likewise.
+ (__class_type_info::do_dyncast,
+ __si_class_type_info::do_dyncast,
+ __vmi_class_type_info::do_dyncast): Likewise.
+ (__class_type_info::do_upcast,
+ __si_class_type_info::do_upcast,
+ __vmi_class_type_info::do_upcast): Likewise.
+ (__dynamic_cast): Adjust.
+ * tinfo2.cc (__pointer_type_info::is_pointer_p): Prepend __.
+ (__function_type_info::is_function_p): Likewise.
+ (__pointer_type_info::do_catch): Likewise. Adjust.
+ (__pointer_to_member_type_info::do_catch): Likewise. Adjust.
+ (__throw_type_match_rtti_2): Adjust.
+ (__is_pointer): Adjust.
+
+2000-04-08 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (cp_tree_index): Add CPTI_COMPLETE_CTOR_IDENTIFIER.
+ (complete_ctor_identifier): New macro.
+ (special_function_kind): Add sfk_copy_constructor and
+ sfk_assignment_operator.
+ (LOOKUP_HAS_IN_CHARGE): Remove.
+ (cons_up_default_function): Rename to ...
+ (implicitly_declare_fn): ... this.
+ * call.c (build_new_method_call): Add in-charge parameters for
+ constructors here.
+ * class.c (add_implicitly_declared_members): Change parameter name
+ from cant_have_assignment to cant_have_const_assignment.
+ Replace calls to cons_up_default_function to implicitly_declare_fn.
+ * cvt.c (ocp_convert): Use complete_ctor_identifier.
+ * decl.c (initialize_predefined_identifiers): Initialize it.
+ (start_function): Use DECL_CONSTRUCTOR_FOR_VBASE_P instead of
+ complex expression.
+ * init.c (expand_default_init): Don't calculate the in-charge
+ parameter here.
+ (build_new_1): Likewise.
+ * lex.c (cons_up_default_function): Move to method.c.
+ * method.c (synthesize_method): Use DECL_DESTRUCTOR_P.
+ (implicitly_declare_fn): New function.
+ * typeck.c (build_static_cast): Use complete_ctor_identifier.
+ (build_modify_expr): Likewise.
+ * typeck2.c (build_functional_cast): Likewise.
-Fri Nov 8 11:52:28 1996 Bob Manson <manson@charmed.cygnus.com>
+ Under the new ABI, constructors don't return `this'.
+ * cp-tree.h (warn_reorder): Declare.
+ (special_function_kind): New enum.
+ (global_base_init_list): Remove declaration.
+ (emit_base_init): Don't return a value.
+ (check_base_init): Don't declare.
+ (is_aggr_typedef): Likewise.
+ * decl.c (check_special_function_return_type): New function.
+ (return_types): Remove.
+ (grokdeclarator): Use check_special_function_return_type.
+ (start_function): Don't initialize ctor_label under the new ABI.
+ (finish_construtor_body): Don't create a corresponding LABEL_STMT.
+ * init.c (begin_init_stmts): Move to top of file.
+ (finish_init_stmts): Likewise.
+ (warn_reorder): Don't declare.
+ (emit_base_init): Don't create a STMT_EXPR here. Don't return a
+ value.
+ (check_base_init): Remove.
+ (is_aggr_typedef): Likewise.
+ (build_new_1): Don't use the return value of a constructor.
+ * semantics.c (setup_vtbl_ptr): Don't use the return value
+ of emit_base_init.
+ * typeck.c (check_return_expr): Don't magically convert return
+ statements into `return this' in constructors under the new ABI.
+
+ * cp-tree.h (cp_tree_index): Add CPTI_BASE_CTOR_IDENTIFIER,
+ CPTI_BASE_DTOR_IDENTIFIER, and CPTI_DELETING_DTOR_IDENTIFIER.
+ (base_ctor_identifier): New macro.
+ (base_dtor_identifier): Likewise.
+ (deleting_dtor_identifier): Likewise.
+ * decl.c: Don't include obstack.h.
+ (obstack_chunk_alloc): Don't define.
+ (obstack_chunk_free): Likewise.
+ (struct predefined_identifier): New type.
+ (initialize_predefined_identifiers): New function.
+ (init_decl_processing): Use it.
+ (debug_temp_inits): Remove.
+ (start_method): Don't call preserve_data.
+ (hack_incomplete_structures): Update comment.
+ * init.c (init_init_processing): Don't initialize
+ nelts_identifier.
+ (build_offset_rf): Remove dead code.
+ (build_delete): Use CLASSTYPE_N_BASECLASSES.
+ * search.c (init_search_processing): Don't initialize
+ vptr_identifier.
+
+2000-04-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * typeck.c (build_binary_op): Call `tree_expr_nonnegative_p' to elide
+ some sign_compare warnings.
+
+2000-04-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ Rename abi::__vmi_class_type_info members.
+ * inc/cxxabi.h (__vmi_class_type_info): Rename details, n_bases,
+ base_list, detail_masks members to vmi_flags, vmi_base_count,
+ vmi_bases and vmi_flags_masks respectively.
+ (__vmi_class_type_info::vmi_flags_masks): Rename
+ details_unknown_mask to flags_unknown_mask.
+ * tinfo.cc (__class_type_info::do_upcast): Adjust.
+ (__vmi_class_type_info::do_find_public_src): Adjust.
+ (__vmi_class_type_info::do_dyncast): Adjust.
+ (__vmi_class_type_info::do_upcast): Adjust.
+
+2000-04-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ * tinfo.cc (convert_to_base): New function.
+ (get_vbase_offset): Remove. Move into convert_to_base.
+ (__vmi_class_type_info::do_find_public_src): Adjust.
+ (__vmi_class_type_info::do_dyncast): Adjust.
+ (__vmi_class_type_info::do_upcast): Adjust.
+
+2000-04-06 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tinfo.cc (operator=): Use __builtin_strcmp.
+ * tinfo2.cc (before): Likewise.
+
+2000-04-06 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (lang_decl_flags): Rename saved_inline to deferred.
+ (DECL_SAVED_INLINE): Rename to ...
+ (DECL_DEFERRED_FN): ... this.
+ (in_function_p): Remove declaration.
+ (mark_inline_for_output): Rename to ...
+ (defer_fn): ... this.
+ * decl.c (finish_function): Adjust call to mark_inline_for_output.
+ (in_function_p): Remove definition.
+ * decl2.c (saved_inlines): Rename to ...
+ (deferred_fns): ... this.
+ (saved_inlines_used): Rename to ...
+ (deferred_fns_used): ... this.
+ (mark_inline_for_output): Rename to ...
+ (defer_fn): ... this.
+ (finish_file): Adjust accordingly.
+ (init_decl2): Likewise.
+ * lex.c (cons_up_default_function): Likewise.
+ * pt.c (mark_decl_instantiated): Likewise.
+ (instantiate_decl): Don't set DECL_DEFER_OUTPUT under any
+ circumstances.
+ * rtti.c (get_tinfo_decl): Adjust call to mark_inline_for_output.
+ * semantics.c (expand_body): Defer more functions.
- * typeck.c (get_delta_difference): Add no_error parameter.
- (build_ptrmemfunc): Call get_delta_difference with no_error set;
- we don't want error messages when converting unrelated
- pointer-to-member functions.
+2000-04-06 Nathan Sidwell <nathan@codesourcery.com>
-Thu Nov 7 11:16:24 1996 Mike Stump <mrs@cygnus.com>
+ * vec.cc: New file.
+ * Make-lang.in (CXX_LIB2FUNCS): Add it.
+ (vec.o): Build it.
+ * inc/cxxabi.h (__cxa_vec_new, __cxa_vec_ctor, __cxa_vec_dtor,
+ __cxa_vec_delete): Declare.
- * error.c (dump_expr): Improve the wording on error messages that
- involve pointer to member functions.
+2000-04-06 Nathan Sidwell <nathan@codesourcery.com>
-Tue Nov 5 17:12:05 1996 Mike Stump <mrs@cygnus.com>
+ * rtti.c (dfs_class_hint_mark): New static function.
+ (dfs_class_hint_unmark): New static function.
+ (class_hint_flags): Use them.
- * cvt.c (cp_convert_to_pointer): Move code for conversions from
- (::*)() to void* or (*)() up a bit, so that we can convert from
- METHOD_TYPEs as well.
+2000-04-05 Benjamin Kosnik <bkoz@cygnus.com>
-Tue Nov 5 14:54:17 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * decl2.c: Make flag_honor_std dependent on ENABLE_STD_NAMESPACE.
- * rtti.c (get_tinfo_fn): Make sure 'type' is permanent.
- There are no 'member' types.
- (get_tinfo_fn_dynamic): Diagnose typeid of overloaded fn.
- (build_x_typeid): Handle errors.
+2000-04-05 Mark Mitchell <mark@codesourcery.com>
-Mon Nov 4 17:43:12 1996 Mike Stump <mrs@cygnus.com>
+ * cp-tree.h (instantiate_decl): Change prototype.
+ * decl2.c (mark_used): Adjust call.
+ * optimize.c (inlinable_function_p): Adjust handling of templates.
+ * pt.c (do_decl_instantiation): Adjust call to instantiate_decl.
+ (do_type_instantiation): Likewise.
+ (instantiate_decl): Defer more templates.
+ (instantiate_pending_templates): Adjust logic to handle inline
+ friend functions.
+
+ * Makefile.in (GGC_H): New variable. Use it throughout in place
+ of ggc.h.
+
+ * call.c: Don't include obstack.h. Include ggc.h.
+ (obstack_chunk_alloc): Don't define.
+ (obstack_chunk_free): Likewise.
+ (add_candidate): Allocate the z_candidate with ggc_alloc_obj.
+ * decl.c (push_switch): Use xmalloc to allocate the cp_switch.
+ (pop_switch): Free it.
+
+ * decl2.c (grokclassfn): Set TREE_READONLY for PARM_DECLs.
+
+ * dump.c (dequeue_and_dump): Don't try to print the bit_position
+ if we don't have a DECL_FIELD_OFFSET.
+
+Wed Apr 5 15:12:18 MET DST 2000 Jan Hubicka <jh@suse.cz>
+
+ * optimize.c (calls_setjmp_r): Use setjmp_call_p instead of
+ special_function_p.
+
+2000-04-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cfns.gperf (hash, libc_name_p): Prototype.
+
+ * rtti.c (build_dynamic_cast_1): Constification.
+
+ * search.c (dfs_debug_unmarkedp, dfs_debug_mark): Unhide prototypes.
+
+ * semantics.c (deferred_type_access_control): Prototype.
+
+2000-04-04 Mark Mitchell <mark@codesourcery.com>
+
+ Correct many new ABI issues regarding vbase and vcall offset
+ layout.
+ * cp-tree.h (BINFO_VTABLE): Document.
+ (struct lang_type): Tweak formatting.
+ (BINFO_PRIMARY_BINFO): Add to documentation.
+ (CLASSTYPE_VSIZE): Fix typo in comment.
+ (CLASSTYPE_VBASECLASSES): Update documentation.
+ (BINFO_VBASE_MARKED): Remove.
+ (SET_BINFO_VBASE_MARKED): Likewise.
+ (CLEAR_BINFO_VBASE_MARKED): Likewise.
+ (BINFO_FIELDS_MARKED): Remove.
+ (SET_BINFO_FIELDS_MARKED): Likewise.
+ (CLEAR_BINFO_FIELDS_MARKED): Likewise.
+ (enum access_kind): New enumeration.
+ (num_extra_vtbl_entries): Remove declaration.
+ (size_extra_vtbl_entries): Likewise.
+ (get_vtbl_decl_for_binfo): New function.
+ (dfs_vbase_unmark): Remove declaration.
+ (mark_primary_bases): Likewise.
+ * class.c (SAME_FN): Remove.
+ (struct vcall_offset_data_s): Move definition.
+ (build_vbase_pointer): Use `build', not `build_binary_op', to
+ access the vbase pointer under the new ABI.
+ (build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
+ (build_primary_vtable): Likewise.
+ (dfs_mark_primary_bases): Move here from search.c.
+ (mark_primary_bases): Likewise.
+ (determine_primary_bases): Under the new ABI, don't make a base
+ class a primary base just because we don't yet have any virtual
+ functions.
+ (layout_vtable_decl): Use get_vtbl_decl_for_binfo.
+ (num_vfun_entries): Remove.
+ (dfs_count_virtuals): Likewise.
+ (num_extra_vtbl_entries): Likewise.
+ (size_extra_vtbl_entries): Likewise.
+ (layout_virtual_bases): Iterate in inheritance graph order under
+ the new ABI.
+ (finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
+ indicate that a vfield is present.
+ (init_class_processing): Initialize access_public_node, etc., from
+ ak_public, etc.
+ (get_vtbl_decl_for_binfo): New function.
+ (dump_class_hierarchy_r): Likewise.
+ (dump_class_hierarchy): Use it.
+ (finish_vtbls): Build the vtbls in inheritance graph order.
+ (dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
+ (initialize_vtable): Use get_vtbl_decl_for_binfo.
+ (accumulate_vtbl_inits): Add comments explaining why a pre-order
+ walk is required.
+ (dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
+ where the vptr points, even for primary vtables.
+ (build_vtbl_initializer): Adjust handling of vbase and vcall
+ offsets.
+ (build_vcall_and_vbase_vtable_entries): New function.
+ (dfs_build_vbase_offset_vtbl_entries): Remove.
+ (build_vbase_offset_vtbl_entries): Reimplement.
+ (dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
+ were already handled in a primary base class vtable.
+ (build_vcall_offset_vtbl_entries): Adjust.
+ (build_rtti_vtbl_entries): Adjust.
+ * decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
+ * init.c (expand_virtual_init): Simplify.
+ * repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
+ * rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
+ * search.c (BINFO_ACCESS): New macro.
+ (SET_BINFO_ACCESS): Likewise.
+ (dfs_access_in_type): Manipulate access_kinds, not access nodes.
+ (access_in_type): Likewise.
+ (dfs_accessible_p): Likewise.
+ (protected_accessible_p): Likewise.
+ (lookup_fnfields_1): Adjust documentation.
+ (dfs_mark_primary_bases): Move to class.c
+ (mark_primary_bases): Likewise.
+ (dfs_vbase_unmark): Remove.
+ (virtual_context): Use BINFO_FOR_VBASE.
+ (dfs_get_vbase_types): Simplify.
+ (dfs_build_inheritance_graph_order): New function.
+ (get_vbase_types): Use it.
+ * tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
+
+ * tinfo.cc (get_vbase_offset): New function.
+ (__vmi_class_type_info::do_find_public_src): Use it.
+ (__vmi_class_type_info::do_dyncast): Likewise.
+ (__vmi_class_type_info::do_upcast): Likewise.
+
+2000-04-03 Zack Weinberg <zack@wolery.cumb.org>
+
+ * lang-specs.h: Pass -fno-show-column to the preprocessor.
+
+2000-03-30 Nathan Sidwell <nathan@codesourcery.com>
+
+ * rtti.c (class_hint_flags): Rename flags.
+ (class_initializer): Remove flags.
+ (synthesize_tinfo_var): Combine offset and flags. Add flags
+ for __vmi_class_type_info.
+ (create_tinfo_types): Remove flags from __class_type_info and
+ __si_class_type_info. Merge flags and offset from
+ base_class_type_info.
+ * inc/cxxabi.h (__base_class_info): Merge offset and vmi_flags.
+ (__base_class_info::is_virtual_p): Adjust.
+ (__base_class_info::is_public_p): Adjust.
+ (__base_class_info::offset): New accessor.
+ (__class_type_info::details): Remove member.
+ (__class_type_info::__class_type_info): Lose details.
+ (__class_type_info::detail_masks): Remove.
+ (__si_class_type_info::__si_class_type_info): Lose details.
+ (__vmi_class_type_info::details): New member.
+ (__vmi_class_type_info::__vmi_class_type_info): Adjust.
+ (__vmi_class_type_info::detail_masks): New member.
+ * tinfo.cc (__class_type_info::do_upcast): Initialize result
+ with unknown_details_mask.
+ (__vmi_class_type_info::do_find_public_src): Adjust
+ (__vmi_class_type_info::do_dyncast): Adjust.
+ (__vmi_class_type_info::do_upcast): Set result details, if
+ needed. Adjust.
+ (__dynamic_cast): Temporarily #if out optimization.
+
+2000-03-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ * rtti.c (get_tinfo_decl): Mark used.
+ (emit_tinfo_decl): Don't optimize polymorphic type_info. Only
+ mark as dealt with, if we output it.
+
+2000-03-28 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c: Reorganize to put virtual function table initialization
+ machinery at the end of the file.
+
+2000-03-28 Jason Merrill <jason@casey.cygnus.com>
+
+ * class.c (finish_struct): Use bitsize_zero_node.
+ * pt.c (instantiate_class_template): Likewise.
- * typeck.c (convert_for_assignment): Handle anachronistic implicit
- conversions from (::*)() to void* or (*)().
- * cvt.c (cp_convert_to_pointer): Likewise.
- (cp_convert_to_pointer_force): Remove cp_convert_to_pointer
- conversions from here.
- * decl2.c (lang_decode_option): Add -W{no-,}pmf-conversions.
- * lang-options.h: Likewise.
- * decl2.c (warn_pmf2ptr): Define.
- * cp-tree.h: Declare it.
- * typeck2.c (digest_init): Allow pmfs down into
- convert_for_initialization.
+2000-03-28 Mark Mitchell <mark@codesourcery.com>
+
+ Put RTTI entries at negative offsets in new ABI.
+ * class.c (dfs_build_vbase_offset_vtbl_entries): Put the first
+ vbase offset at index -3, not -1.
+ (build_vtabe_offset_vtbl_entries): Use unmarked_vtable_pathp, not
+ dfs_vtable_path_unmarked_real_bases_queue_p to walk bases.
+ (dfs_build_vcall_offset_vtbl_entries): Don't use skip_rtti_stuff.
+ (build_rtti_vtbl_entries): New function.
+ (set_rtti_entry): Remove.
+ (build_primary_vtable): Don't use it.
+ (build_secondary_vtable): Likewise.
+ (start_vtable): Remove.
+ (first_vfun_index): New function.
+ (set_vindex): Likewise.
+ (add_virtual_function): Don't call start_vtable. Do call
+ set_vindex.
+ (set_primary_base): Rename parameter.
+ (determine_primary_base): Likewise.
+ (num_vfun_entries): Don't use skip_rtti_stuff.
+ (num_extra_vtbl_entries): Include RTTI information.
+ (build_vtbl_initializer): Use build_rtti_vtbl_entries.
+ (skip_rtti_stuff): Remove.
+ (dfs_modify_vtables): Don't use it.
+ (modify_all_vtables): Don't use start_vtable. Do use set_vindex.
+ (layout_nonempty_base_or_field): Update size handling.
+ (create_vtable_ptr): Tweak.
+ (layout_class_type): Adjust parameter names.
+ (finish_struct_1): Simplify.
+ * cp-tree.h (CLASSTYPE_VSIZE): Tweak documentation.
+ (skip_rtti_stuff): Remove.
+ (first_vfun_index): New function.
+ (dfs_vtable_path_unmarked_real_bases_queue_p): Remove.
+ (dfs_vtable_path_marked_real_bases_queue_p): Remove.
+ (marked_vtable_pathp): Declare.
+ (unmarked_vtable_pathp): Likewise.
+ * error.c (dump_expr): Use first_vfun_index to calculate vtable
+ offsets.
+ * rtti.c (build_headof): Look for RTTI at negative offsets.
+ (get_tinfo_decl_dynamic): Likewise.
+ (tinfo_base_init): Don't take the address of the TINFO_VTABLE_DECL
+ here.
+ (create_pseudo_type_info): Do it here instead. Adjust so that
+ vptr points at first virtual function.
+ * search.c (marked_vtable_pathp): Make it global.
+ (unmarked_vtable_pathp): Likewise.
+ (dfs_vtable_path_unmarked_real_bases_queue_p): Remove.
+ (dfs_vtable_path_marked_real_bases_queue_p): Likewise.
+ (dfs_get_pure_virtuals): Don't use skip_rtti_stuff.
+ (get_pure_virtuals): Likewise.
+ (expand_upcast_fixups): Likewise.
+ * tree.c (debug_binfo): Likewise.
+ * tinfo.cc (__dynamic_cast): Look for vtable_prefix at appropriate
+ negative offset.
+
+Sun Mar 26 20:15:26 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * class.c (check_field_decl): Fix typo.
+ (build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
+ (check_methods): Likewise.
+ (check_field_decls): Likewise.
+ Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
+ * cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
+ Use DECL_RESULT_FLD, not DECL_RESULT.
+ * decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
+ * lex.c (identifier_type): Likewise.
+ * pt.c (determine_specialization, lookup_template_class): Likewise.
+ (tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
+ (resolve_overloaded_unification, more_specialized): Likewise.
+ * semantics.c (finish_member_declaration): Likewise.
+ * typeck.c (build_x_function_call): Likewise.
-Sun Nov 3 09:43:00 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-03-26 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (layout_empty_base): Handle empty bases with non-byte
+ alignment.
+ (build_base_field): Likewise.
+ (layout_virtual_bases): Likewise.
+
+ * class.c (finish_struct_1): Fix typo in this change:
+
+ Sat Mar 25 09:12:10 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+2000-03-25 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (grokdeclarator): Count partial specializations when
+ keeping track of how many template classes have been seen.
+
+ * dump.c (dequeue_and_dump): Dump DECL_TEMPLATE_RESULT.
+
+Sat Mar 25 09:12:10 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * class.c (build_vbase_pointer_fields): layout_field now place_field.
+ (get_vfield_offset): Use byte_position.
+ (set_rtti_entry): Set OFFSET to ssizetype zero.
+ (get_binfo_offset_as_int): Deleted.
+ (dfs_record_base_offsets): Use tree_low_cst.
+ (dfs_search_base_offsets): Likewise.
+ (layout_nonempty_base_or_field): Reflect changes in RLI format
+ and call byte_position.
+ (layout_empty_base): Convert offset to ssizetype.
+ (build_base_field): use rli_size_unit_so_far.
+ (dfs_propagate_binfo_offsets): Do computation in proper type.
+ (layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
+ (layout_class_type): Reflect changes in RLI names and fields.
+ (finish_struct_1): Set DECL_FIELD_OFFSET.
+ * dump.c (dequeue_and_dump): Call bit_position.
+ * expr.c (cplus_expand_constant): Use byte_position.
+ * rtti.c (expand_class_desc): Use bitsize_one_node.
+ * typeck.c (build_component_addr): Use byte_position and don't
+ special case for zero offset.
+
+2000-03-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (vtype_decl_p): Use TYPE_POLYMORPHIC_P.
+
+ * rtti.c (get_tinfo_decl): Set comdat linkage on new-abi
+ tinfo object.
+ (emit_tinfo_decl): Only emit polymorphic tinfo's when emitting
+ vtable.
+
+2000-03-20 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
+
+ * call.c (check_dtor_name, build_new_method_call): Use TYPE_P and
+ DECL_P macros.
+ * decl.c (push_class_binding, poplevel, pushtag, lookup_namespace_name,
+ make_typename_type, check_initializer, cp_finish_decl,
+ xref_tag): Likewise.
+ * decl2.c (grokfield, build_expr_from_tree, build_expr_from_tree,
+ decl_namespace, arg_assoc_template_arg, arg_assoc,
+ validate_nonmember_using_decl, do_class_using_decl): Likewise.
+ * error.c (dump_template_argument, dump_expr, cp_file_of, cp_line_of,
+ args_to_string): Likewise.
+ * friend.c (is_friend): Likewise.
+ * lex.c (note_got_semicolon, note_list_got_semicolon,
+ is_global): Likewise.
+ * method.c (build_overload_nested_name, build_overload_value,
+ build_qualified_name, build_qualified_name, hack_identifier): Likewise.
+ * parse.y (typename_sub, typename_sub1): Likewise.
+ * pt.c (push_inline_template_parms_recursive, check_template_shadow,
+ process_partial_specialization, convert_template_argument,
+ template_args_equal, add_pending_template, lookup_template_class,
+ for_each_template_parm_r, maybe_fold_nontype_arg,
+ tsubst, instantiate_template, type_unification_real, unify,
+ instantiate_pending_templates, set_mangled_name_for_template_decl):
+ Likewise.
+ * repo.c (repo_get_id, repo_template_used): Likewise.
+ * search.c (lookup_field_1): Likewise.
+ * tree.c (walk_tree, get_type_decl, cp_tree_equal, member_p): Likewise.
+ * xref.c (classname): Likewise.
+
+2000-03-22 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (BINFO_FOR_VBASE): Adjust documentation.
+ (CANONICAL_BINFO): New macro.
+ (BINFO_NEW_VTABLE_MARKED): Use it.
+ (SET_BINFO_NEW_VTABLE_MARKED): Likewise.
+ (CLEAR_BINFO_NEW_VTABLE_MARKED): Likewise.
+ * class.c (dfs_build_vbase_offset_vtbl_entries): Use BINFO_TYPE,
+ not TREE_TYPE.
+ (build_primary_vtable): Adjust usage of BINFO_NEW_VTABLE_MARKED.
+ (build_secondary_vtable): Likewise.
+ (dfs_finish_vtbls): Likewise.
+ (dfs_accumulate_vtbl_inits): Likewise.
+ (accumulate_vtbl_inits): New function.
+ (finish_vtbls): Make sure that virtual bases come after
+ non-virtual bases in the vtable group.
+ (record_base_offsets): Don't save and restore TREE_VIA_VIRTUAL.
+ (finish_struct_1): Adjust usage of BINFO_NEW_VTABLE_MARKED.
+ * search.c (struct vbase_info): Move definition.
+ (marked_new_vtable_p): Adjust usage of BINFO_NEW_VTABLE_MARKED.
+ (unmarked_new_vtable_p): Likewise.
+ (dfs_mark_vtable_path): Remove.
+ (dfs_mark_new_vtable): Remove.
+ (dfs_unmark_new_vtable): Likewise.
+ (dfs_clear_search_slot): Likewise.
+ (dfs_find_vbases): Adjust usage of BINFO_NEW_VTABLE_MARKED.
+ (dfs_clear_vbase_slots): Likewise.
+ (init_vbase_pointers): LIkewise.
+
+2000-03-22 Jason Merrill <jason@casey.cygnus.com>
+
+ * typeck.c (type_after_usual_arithmetic_conversions): Prefer a
+ SIZETYPE to a non-SIZETYPE.
+
+2000-03-21 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (layout_virtual_bases): Adjust names in conditionally
+ compiled code.
+
+ * class.c (record_base_offsets): New function.
+ (layout_conflict_p): Likewise.
+ (layout_nonempty_base_or_field): Use it.
+ (layout_empty_base): New function.
+ (build_base_field): Use it.
+ (build_base_fields): Update comment.
+ (layout_virtual_bases): Fold in a little code form
+ layout_basetypes. Use layout_empty_base.
+ (layout_basetypes): Remove.
+ (end_of_class): New function.
+ (layout_class_type): Use it. Adjust.
+
+ * cp-tree.h (CLASSTYPE_VBASECLASSES): Fix typo in comment.
+ (fntype_p): Remove.
+ * search.c (dfs_skip_nonprimary_vbases_unmarkedp): Fix typo in
+ comment.
+ (dfs_skip_nonprimary_vbases_markedp): Likewise.
+ * typeck.c (fntype_p): Remove.
+
+ * cp-tree.h (TI_SPEC_INFO): Remove.
+ (CLASSTYPE_TI_SPEC_INFO): Likewise.
+ * pt.c (process_partial_specialization): Likewise.
+
+ * class.c (build_base_field): Fix thinko in computation of binfo
+ offsets.
+
+ * tree.c (mark_local_for_remap_p): Mark variables declared in
+ TARGET_EXPRs as well.
+
+2000-03-21 Nathan Sidwell <nathan@codesourcery.com>
+
+ * typeck.c (require_complete_type, complete_type,
+ complete_type_or_else, c_sizeof, c_sizeof_nowarn,
+ build_array_ref, convert_arguments, pointer_diff,
+ build_x_unary_op, build_unary_op, build_c_cast,
+ build_modify_expr): Use COMPLETE_TYPE_P etc.
+ * call.c (is_complete, convert_like_real,
+ build_new_method_call): Likewise.
+ * class.c (build_vbase_pointer_fields, check_bases,
+ build_base_field, finish_struct_1, pushclass): Likewise.
+ * cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
+ * decl.c (maybe_process_template_type_declaration, pushtag,
+ pushdecl, redeclaration_error_message, start_decl, start_decl_1,
+ layout_var_decl, check_initializer, cp_finish_decl,
+ grokdeclarator, require_complete_types_for_parms,
+ grok_op_properties, xref_tag, xref_basetypes,
+ check_function_type): Likewise.
+ * decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
+ * friend.c (do_friend): Likewise.
+ * init.c (build_offset_ref): Likewise.
+ * parse.y (structsp): Likewise.
+ * pt.c (maybe_process_partial_specialization,
+ tsubst_friend_function, instantiate_class_template, tsubst,
+ do_type_instantiation, instantiate_pending_templates): Likewise.
+ * repo.c (repo_get_id): Likewise.
+ * rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
+ synthesize_tinfo_var, emit_support_tinfos): Likewise.
+ * search.c (lookup_fnfields_1, lookup_conversions): Likewise.
+ * semantics.c (begin_class_definition): Likewise.
+ * tree.c (build_cplus_method_type): Likewise.
+ * typeck2.c (digest_init, build_functional_cast,
+ add_exception_specifier): Likewise.
+ * parse.h, parse.c: Regenerated.
+
+2000-03-21 Nathan Sidwell <nathan@codesourcery.com>
+
+ * inc/cxxabi.h: New header file. Define new-abi entry points.
+ (__pointer_type_info::target): Rename member to ...
+ (__pointer_type_info::type): ... here.
+ (__base_class_info::type): Rename member to ...
+ (__base_class_info::base): ... here.
+ * Make-lang.in (CXX_EXTRA_HEADERS): Add cxxabi.h
+ * cp-tree.h (CPTI_ABI): New global tree enumeration.
+ (abi_node): New global tree node.
+ * decl.c (abi_node): Document.
+ (init_decl_processing): Initialize abi_node.
+ * rtti.c (build_dynamic_cast_1): Use abi_node for new-abi.
+ (get_vmi_pseudo_type_info): Likewise.
+ (create_tinfo_types): Likewise.
+ (emit_support_tinfos): Likewise.
+ * tinfo.h (cxxabi.h): Include for new-abi.
+ Move rtti class definitions to new header file.
+ * tinfo.cc (abi): Use the namespace.
+ (std): Move new abi rtti classes from here ...
+ (__cxxabiv1): ... to here.
+ * tinfo2.cc (cxxabi.h): Include for new-abi.
+ Move rtti class definitions to new header file.
+ (std): Move new abi rtti classes from here ...
+ (__cxxabiv1): ... to here.
+ * inc/typeinfo (__class_type_info): Move into __cxxabiv1
+ namespace.
- * typeck.c (c_expand_return): Fix for returning overloaded fn.
+2000-03-20 Jed Wing <jedwin@zloty.ugcs.caltech.edu>
+ Jason Merrill <jason@casey.cygnus.com>
-Fri Nov 1 08:53:17 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * method.c (build_overload_int): Use host_integerp.
- * cp-tree.h (DIRECT_BIND): Change from INDIRECT_BIND.
- * decl.c (grok_reference_init): Pass DIRECT_BIND.
- * cvt.c (build_up_reference): Don't mark 'this' addressable. Use
- DIRECT_BIND.
- * call.c (convert_like): Don't pass INDIRECT_BIND.
- * typeck.c (convert_arguments): Likewise.
- * typeck.c (mark_addressable): Allow &this if flag_this_is_variable.
+2000-03-20 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
-Thu Oct 31 17:08:49 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * init.c (build_offset_ref): Handle the case of a templated member
+ function.
- * typeck.c (mark_addressable): Support TARGET_EXPR, unify with
- similar code in build_up_ref.
- * cvt.c (build_up_reference): Drastically simplify.
+2000-03-19 Martin v. Löwis <loewis@informatik.hu-berlin.de>
-Mon Oct 28 12:45:05 1996 Jeffrey A Law <law@cygnus.com>
+ * except.c (expand_exception_blocks): Clear catch_clauses_last.
- * typeck.c (signed_or_unsigned_type): If the given type already
- as the correct signedness, then just return it.
+2000-03-18 Mark Mitchell <mark@codesourcery.com>
- * typeck.c ({un,}signed_type): If can't do anything, call
- signed_or_unsigned_type.
+ * cp-tree.h (CLEAR_DECL_C_BIT_FIELD): New macro.
+ * class.c (check_bitfield_decl): Turn illegal bitfields into
+ non-bitfields.
+ (dfs_propagate_binfo_offsets): Adjust for new size_binop
+ semantics.
+ (dfs_offset_for_unshared_vbases): Likewise.
+ * cvt.c (cp_convert_to_pointer): Convert NULL to a
+ pointer-to-member correctly under the new ABI.
+ * expr.c (cplus_expand_constant): Don't use cp_convert when
+ turning an offset into a pointer-to-member.
+ * init.c (resolve_offset_ref): Don't adjust pointers-to-members
+ when dereferencing them under the new ABI.
+ * typeck.c (get_member_function_from_ptrfunc): Tweak calculation
+ of pointers-to-members under the new ABI.
-Thu Oct 24 14:21:59 1996 Bob Manson <manson@charmed.cygnus.com>
+ * class.c (check_bitfield_decl): Remove restriction on really long
+ bitfields.
+ (layout_class_type): Implement new ABI handling of bitfields
+ longer than their types.
- * decl2.c (copy_assignment_arg_p): Don't buy the farm if
- current_class_type is NULL.
+2000-03-18 Martin v. Löwis <loewis@informatik.hu-berlin.de>
-Wed Oct 23 00:43:10 1996 Jason Merrill <jason@gerbil.cygnus.com>
+ * parse.y (extdefs): Call ggc_collect.
+ * parse.c: Regenerated.
- * class.c (finish_struct_1): Avoid empty structs by adding a field
- so layout_type gets the mode right.
+2000-03-18 Nathan Sidwell <nathan@codesourcery.com>
- * typeck.c (c_expand_return): Drastically simplify.
+ * class.c (build_base_field): Use TYPE_ALIGN to examine a type.
+ (note_name_declared_in_class): Use OVL_CURRENT to get at a
+ potential overload.
-Mon Oct 21 22:34:02 1996 Jason Merrill <jason@yorick.cygnus.com>
+Fri Mar 17 08:09:14 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
- * typeck.c (decay_conversion): Handle overloaded methods.
+ * class.c (build_vbase_path): Use integer_zerop.
+ (build_vtable_entry): Use tree_low_cst.
+ (get_vfield_offset): Use bit_position.
+ (dfs_modify_vtables): New variable vindex_val; `i' is HOST_WIDE_INT.
+ Use tree_low_cst.
+ (check_bitfield_decl): Set DECL_SIZE using convert.
+ (build_base_field): Set DECL_SIZE and DECL_SIZE_UNIT using size_binop.
+ (layout_virtual_bases): DSIZE is unsigned HOST_WIDE_INT.
+ Use tree_low_cst.
+ (finish_struct_1): Use bit_position.
+ (dump_class_hierarchy): Use tree_low_cst.
+ * cp-tree.h (min_precision): Add declaration.
+ * decl.c (xref_tag, xref_basetypes): Use tree_low_cst.
+ * error.c (dump_type_suffix): Use host_integerp and tree_low_cst.
+ (dump_expr): Use integer_zerop, host_integerp, and tree_low_cst.
+ * expr.c (cplus_expand_constant): Use bit_position.
+ * init.c (build_vec_init): Use host_integerp and tree_low_cst.
+ * rtti.c (get_base_offset): Use bit_position.
+ * typeck.c (build_binary_op): Use integer_zerop, compare_tree_int,
+ host_integerp, and tree_low_cst.
+ (pointer_int_sum): Use integer_zerop.
+ (build_component_addr): Use bit_position.
-Fri Oct 18 16:03:48 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-03-17 Nathan Sidwell <nathan@codesourcery.com>
- * call.c (build_over_call): A TARGET_EXPR has side-effects.
+ * typeck.c (require_complete_type): Don't assume size_zero_node.
+ (complete_type_or_else): Likewise.
-Thu Oct 17 11:31:59 1996 Mike Stump <mrs@cygnus.com>
+2000-03-16 Steven Grady <grady@digitaldeck.com>
+ Jason Merrill <jason@casey.cygnus.com>
- * cvt.c (convert_to_pointer_force): Add code to support pointer to
- member function to pointer to function conversions.
- * init.c (resolve_offset_ref): Add code to allow faked up objects,
- ignoring them if they are not used, and giving an error, if they
- are needed.
- * typeck.c (get_member_function_from_ptrfunc): Fold e1 to improve
- code, and so that we can give an error, if we needed an object,
- and one was not provided.
- (build_c_cast): Don't call default_conversion when we want to
- convert to pointer to function from a METHOD_TYPE.
+ * rtti.c (build_dynamic_cast_1): Improve diagnostics.
-Mon Oct 14 00:28:51 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-03-16 Nathan Sidwell <nathan@codesourcery.com>
- * Make-lang.in (cplib2.ready): Fix logic.
+ * decl2.c (grokfield): Bail out if type is error_mark_node.
- * decl.c (shadow_tag): Only complain about non-artificial function
- members.
+2000-03-15 Nathan Sidwell <nathan@codesourcery.com>
- * class.c (finish_struct_1): Add synthesized methods to TYPE_METHODS.
+ * tinfo2.cc (__ptr_to_member_data): Rename to ...
+ (__pointer_to_member_data): ... here. Adjust.
+ * rtti.c (create_tinfo_types): Adjust.
-Fri Oct 11 16:12:40 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-03-15 Nathan Sidwell <nathan@codesourcery.com>
- * expr.c (cplus_expand_expr): Pre-tweak call_target like
- expand_inline_function would.
+ * cp-tree.h (CPTI_REF_DESC_TYPE, ref_desc_type_node): Remove.
+ * decl.c (ref_desc_type_node): Undocument.
+ * rtti.c (ptr_ref_initializer): Rename to ...
+ (ptr_initializer): ... here. Adjust comments.
+ (ptmd_initializer): Fix comment thinko.
+ (synthesize_tinfo_var): Remove REFERENCE_TYPE case.
+ (create_tinfo_types): Remove ref_desc_type_node init.
+ * tinfo2.cc (__reference_type_info): Remove.
- * pt.c (mark_decl_instantiated): If extern_p, call
- mark_inline_for_output.
+2000-03-15 Nathan Sidwell <nathan@codesourcery.com>
-Thu Oct 10 15:58:08 1996 Mike Stump <mrs@cygnus.com>
+ * decl.c (cp_finish_decl): Remove obsolete comment.
- * typeck.c (unary_complex_lvalue): Add code to handle intermediate
- pmd conversions.
+ * typeck.c (build_ptrmemfunc1): Kill uninitialized warning.
- * typeck.c (get_delta_difference): Fix wording, as we can be used
- for pointer to data members.
+2000-03-14 Mark Mitchell <mark@codesourcery.com>
-Tue Oct 8 12:43:51 1996 Bob Manson <manson@charmed.cygnus.com>
+ * cp-tree.h: Tweak documentation.
+ * class.c (build_vbase_pointer_fields): Layout the fields, too.
+ (avoid_overlap): Remove.
+ (get_binfo_offset_as_int): New function.
+ (dfs_serach_base_offsets): Likewise.
+ (layout_nonempty_base_or_field): Likewise.
+ (build_base_field): Layout fields here. Avoid placing two objects
+ of the same type at the same address, under the new ABI.
+ (build_base_fields): Adjust accordingly.
+ (create_vtable_ptr): Return the new field, but don't attach it to
+ TYPE_FIELDS.
+ (remove_base_field): Remove.
+ (remove_base_fields): Remove.
+ (layout_basetypes): Adjust accordingly.
+ (layout_class_type): Call layout_field for each field, rather than
+ just making a wholesale call to layout_type.
- * pt.c (tsubst): If the function decl isn't a member of this
- template, return a copy of the decl (including copying the
- lang-specific part) so we don't hose ourselves later.
+2000-03-14 Jeff Sturm <jsturm@sigma6.com>
-Thu Oct 3 16:24:28 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * except.c (expand_throw): Fix typo in _Jv_Sjlj_Throw.
- * class.c (finish_struct): Remove DWARF-specific tag handling.
- * decl.c (pushtag): Likewise.
- (finish_function): Always clear DECL_ARGUMENTS on function decls with
- no saved RTX.
- * decl2.c (finish_file): Emit DWARF debugging info for static data
- members.
+2000-03-13 Jason Merrill <jason@casey.cygnus.com>
-Wed Oct 2 21:58:01 1996 Bob Manson <manson@charmed.cygnus.com>
+ * decl.c (grokfndecl): Set TREE_NOTHROW if TYPE_NOTHROW_P.
- * decl.c (duplicate_decls): Make sure the old DECL_LANG_SPECIFIC
- isn't the same as the new one before we whack it.
+ * except.c (dtor_nothrow): New fn.
+ (do_pop_exception): Use it. Take type parm.
+ (push_eh_cleanup): Take type parm.
+ (expand_start_catch_block): Pass it.
+ (build_eh_type_type_ref): Accept null type.
+
+2000-03-12 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (revert_static_member_fn): Change prototype.
+ * decl.c (grokfndecl): Adjust call to revert_static_member_fn.
+ (grok_op_properties): Likewise.
+ (start_function): Likewise.
+ (revert_static_member_fn): Simplify.
+ * pt.c (check_explicit_specialization): Adjust call to
+ revert_static_member_fn.
+
+2000-03-11 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (scope_kind): New type.
+ (tmpl_spec_kind): Likewise.
+ (declare_pseudo_global_level): Remove.
+ (pseudo_global_level_p): Rename to template_parm_scope_p.
+ (pushlevel): Remove declaration.
+ (begin_scope): New function.
+ (finish_scope): Likewise.
+ (current_tmpl_spec_kind): Likewise.
+ * decl.c (struct binding_level): Shorten parm_flag to 2 bits.
+ Shorten keep to 2 bits. Rename pseudo_global to template_parms_p.
+ Add template_spec_p.
+ (toplevel_bindings_p): Adjust.
+ (declare_pseudo_global_level): Remove.
+ (pseudo_global_level_p): Rename to template_parm_scope_p.
+ (current_tmpl_spec_kind): New function.
+ (begin_scope): Likewise.
+ (finish_scope): Likewise.
+ (maybe_push_to_top_level): Adjust.
+ (maybe_process_template_type_declaration): Likewise.
+ (pushtag): Likewise.
+ (pushdecl_nonclass_level): Likewise.
+ (lookup_tag): Likewise.
+ (grokfndecl): Handle member template specializations. Share
+ constructor and non-constructor code.
+ * decl2.c (check_classfn): Handle member template specializations.
+ * pt.c (begin_template_parm_list): Use begin_scope.
+ (begin_specialization): Likewise.
+ (end_specialization): Likewise.
+ (check_explicit_specialization): Use current_tmpl_spec_kind.
+ Handle member template specializations.
+ (end_template_decl): Use finish_scope. Remove call to
+ get_pending_sizes.
+ (push_template_decl_real): Remove bogus error message.
+ (tsubst_decl): Fix typo in code contained in comment.
+ (instantiate_template): Handle member template specializations.
+ (most_general_template): Likewise.
-Mon Sep 30 13:38:24 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-03-11 Gabriel Dos Reis <gdr@codesourcery.com>
- * class.c, cp-tree.h, cvt.c, decl.c, decl2.c, gxx.gperf, hash.h,
- lex.c, method.c, parse.y, typeck.c, typeck2.c: Remove
- warn_traditional and warn_strict_prototypes; remove ancient
- 'overload' code; remove references to flag_traditional.
+ * lex.c (whitespace_cr): Compress consecutive calls to warning().
+ (do_identifier): Ditto for error().
-Mon Sep 30 12:58:40 1996 Mike Stump <mrs@cygnus.com>
+ * pt.c (convert_nontype_argument): Ditto for cp_error().
+ (convert_template_argument): Ditto for cp_pedwarn().
- * input.c (sub_getch): Handle 8-bit characters in string literals.
+2000-03-11 Jason Merrill <jason@casey.cygnus.com>
-Sun Sep 29 03:12:01 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * exception.cc (__check_null_eh_spec): New fn.
+ * except.c (expand_end_eh_spec): Call it if the spec is throw().
- * tree.c (mapcar): Handle CONSTRUCTORs.
- (copy_to_permanent): Handle expression_obstack properly.
+2000-03-10 Jason Merrill <jason@casey.cygnus.com>
- * Make-lang.in (cplib2.txt): Also depend on the headers.
+ * decl.c (push_throw_library_fn): Take the FUNCTION_TYPE.
+ * except.c (expand_end_eh_spec): Add the return type.
+ * rtti.c (throw_bad_cast): Add the parmtypes.
+ (throw_bad_typeid): Likewise.
- * rtti.c (get_tinfo_var): Don't assume that POINTER_SIZE ==
- INT_TYPE_SIZE.
- (expand_class_desc): Use USItype for offset field.
- * tinfo.h (struct __class_type_info): Likewise.
+ * semantics.c (expand_stmt): Only leave out rtl for unused
+ artificials, and set DECL_IGNORED_P on them as well.
+ * decl.c (wrapup_globals_for_namespace): Likewise.
- * method.c (build_overload_int): TYPE_PRECISION should be applied
- to types.
+2000-03-09 Nathan Sidwell <nathan@codesourcery.com>
-Sat Sep 28 14:44:50 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (maybe_commonize_var): Skip all artificial decls.
+ * pt.c (tsubst_decl): Don't copy TREE_ASM_WRITTEN.
- * call.c (build_new_op): A COND_EXPR involving void must be a
- builtin.
+2000-03-10 Jason Merrill <jason@casey.cygnus.com>
-Fri Sep 27 16:40:30 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * lang-options.h, decl2.c: Add -fno-enforce-eh-specs.
+ * cp-tree.h: Declare flag_enforce_eh_specs.
+ * decl.c (store_parm_decls, finish_function): Check it.
- * typeck.c (build_x_component_ref): New fn.
- (build_object_ref): Use it.
- * parse.y (primary): Use it.
- * decl2.c (build_expr_from_tree): Use it.
+ C library functions don't throw.
+ * Makefile.in (cfns.h): New target.
+ (except.o): Depend on it.
+ * Make-lang.in (cc1plus): Depend on cfns.gperf.
+ * cfns.gperf: New file.
+ * cfns.h: Generated.
+ * except.c: Include it.
+ (nothrow_libfn_p): New fn.
+ * decl.c (grokfndecl): Use it.
* cp-tree.h: Declare it.
- * decl.c (start_decl): Variable-sized arrays cannot be initialized.
- * error.c (dump_type_suffix): Handle variable arrays.
-
-Fri Sep 27 13:14:05 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * Make-lang.in (exception.o): Put back compiling it with -fPIC.
-
-Fri Sep 27 03:00:09 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (lookup_name_real): Don't try to look up anything in a
- TYPENAME_TYPE.
-
- * tinfo2.cc (__throw_type_match_rtti): Oops.
-
-Thu Sep 26 22:11:05 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * Make-lang.in (exception.o): Use -fno-PIC for now.
-
-Thu Sep 26 10:59:00 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * rtti.c (build_dynamic_cast): Pass tinfo fns rather than
- calling them.
- (get_tinfo_fn_dynamic): Extracted from build_typeid.
- * tinfo2.cc (__dynamic_cast): Adjust.
-
- * rtti.c (build_typeid): Use resolves_to_fixed_type_p.
- (build_x_typeid): Likewise.
-
- * parse.y: Call build_x_typeid instead of build_typeid.
- * cp-tree.def: Add TYPEID_EXPR.
- * pt.c (tsubst_copy): Handle typeid.
- * decl2.c (build_expr_from_tree): Likewise.
- * rtti.c (build_x_typeid): Throw bad_typeid from here.
- (build_typeid): Not here.
- * cp-tree.h: Declare build_x_typeid.
-
-Wed Sep 25 17:26:16 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (convert_like): Pull out constant values.
-
- * tree.c (mapcar): Use build_cplus_array_type, not build_array_type.
-
-Wed Sep 25 17:28:53 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * decl.c (init_decl_processing): Create short int types before
- creating size_t in case a machine description needs to use
- unsigned short for size_t.
-
-Tue Sep 24 18:18:44 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * Make-lang.in (exception.o): Turn off pic.
-
- * tinfo2.cc (__throw_type_match_rtti): Fix cv-variants of the same
- type, multi-level ptr conversions.
-
- * rtti.c (call_void_fn): Renamed and genericized from throw_bad_cast.
- (throw_bad_cast): Use it.
- (throw_bad_typeid): New fn.
- (build_typeid): Throw bad_typeid as needed.
- Use build_call.
- (synthesize_tinfo_fn): Handle functions and arrays before checking
- for cv-quals.
-
- * Remove .h from standard C++ headers, add new.h, move into inc
- subdirectory.
-
- * exception*: Remove pointer from object, constructors. Add
- default exception::what that uses type_info::name. Add
- __throw_bad_typeid.
-
- * init.c (build_new): Don't add a cookie to new (void *) T[2].
-
-Mon Sep 23 15:21:53 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * Make-lang.in: Building C++ code depends on cc1plus.
-
-Mon Sep 23 12:38:40 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (struct saved_scope): Declare PROCESSING_TEMPLATE_DECL as
- a HOST_WIDE_INT, not a tree.
+ * decl.c (push_overloaded_decl_1, auto_function,
+ define_function): Lose.
+ (build_library_fn_1): New static fn.
+ (builtin_function): Use it.
+ (get_atexit_node): Use build_library_fn_ptr.
+ (build_library_fn, build_cp_library_fn, build_library_fn_ptr,
+ build_cp_library_fn_ptr, push_library_fn, push_cp_library_fn,
+ push_void_library_fn, push_throw_library_fn): New fns.
+ * cp-tree.h: Declare them.
+ (cp_tree_index): Remove CPTI_BAD_CAST, CPTI_BAD_TYPEID.
+ (throw_bad_cast_node, throw_bad_typeid_node): Lose.
+ * except.c (init_exception_processing, call_eh_info, do_pop_exception,
+ (expand_end_eh_spec, alloc_eh_object, expand_throw): Use above fns.
+ * rtti.c (build_runtime_decl): Lose.
+ (throw_bad_cast, throw_bad_typeid, get_tinfo_decl,
+ build_dynamic_cast_1, expand_si_desc, expand_class_desc,
+ expand_ptr_desc, expand_attr_desc, expand_generic_desc): Use above fns.
+
+ * call.c (build_call): Remove result_type parm.
+ Call mark_used on unused artificial fns.
+ * init.c, method.c, typeck.c, except.c, rtti.c: Adjust.
+
+2000-03-09 Jason Merrill <jason@casey.cygnus.com>
+
+ * call.c (build_call): Set TREE_NOTHROW on the CALL_EXPR as
+ appropriate.
+ * decl.c (define_function): Set TREE_NOTHROW on the FUNCTION_DECL.
+ * except.c (call_eh_info, alloc_eh_object, expand_throw): Set
+ TREE_NOTHROW or TREE_THIS_VOLATILE on the function as appropriate.
+ * rtti.c (build_runtime_decl, get_tinfo_decl, build_dynamic_cast_1,
+ expand_si_desc, expand_class_desc, expand_ptr_desc, expand_attr_desc,
+ expand_generic_desc): Likewise.
-Mon Sep 23 12:36:02 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-03-08 Nathan Sidwell <nathan@codesourcery.com>
- * exception.cc: Don't include <stdlib.h>.
+ * exception.cc (__cp_pop_exception): Cleanup the original object.
- * Make-lang.in (c++.clean): Remove cplib2.*.
+2000-03-08 Nathan Sidwell <nathan@codesourcery.com>
-Mon Sep 23 09:42:19 1996 Doug Evans <dje@canuck.cygnus.com>
+ * decl.c (grok_op_properties): Merge conversion to void warning
+ with other silly op warnings.
- * parse.y (component_decl_1, component_costructor_declarator case):
- Pass attributes/prefix_attributes in tree list.
+2000-03-08 Jason Merrill <jason@casey.cygnus.com>
-Mon Sep 23 01:18:50 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * typeck2.c (process_init_constructor): Set TREE_PURPOSE of
+ array CONSTRUCTOR elements. Don't use expr_tree_cons.
- * tinfo{,2}.cc: #include <stddef.h> instead of <stdlib.h>.
+2000-03-08 Nathan Sidwell <nathan@codesourcery.com>
-Sun Sep 22 05:31:22 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (cp_make_fname_decl): New function.
+ (wrapup_globals_for_namespace): Don't emit unused static vars.
+ (init_decl_processing): Remove comment about use of
+ array_domain_type. Set make_fname_decl.
+ (cp_finish_decl): Remove __FUNCTION__ nadgering.
+ * semantics.c (begin_compound_stmt): Remove
+ current_function_name_declared flagging.
+ (expand_stmt): Don't emit unused local statics.
+ * typeck.c (decay_conversion): Don't treat __FUNCTION__ decls
+ specially.
- * lex.c (do_identifier): Don't do deferred lookup in a template
- header.
+2000-03-08 Nathan Sidwell <nathan@codesourcery.com>
- * typeck2.c (store_init_value): Oops.
+ * typeck.c (convert_for_assignment): Don't look at array
+ initializer.
+ * call.c (convert_like_real): Likewise.
- * new.{h,cc}, exception.{h,cc}, typeinfo.h, tinfo{2.cc,.cc,.h}:
- New files for C++ lang-support library.
- * Make-lang.in (CXX_EXTRA_HEADERS): Define.
- (CXX_LIB2FUNCS): Define.
- And rules for building the C++ lang-support code.
- * config-lang.in (headers): Define.
- (lib2funcs): Define.
+2000-03-07 Jason Merrill <jason@casey.cygnus.com>
-Sat Sep 21 19:17:28 1996 Jason Merrill <jason@yorick.cygnus.com>
+ Add initial support for '\uNNNN' specifier.
+ * lex.c (read_ucs): New fn.
+ (readescape, skip_white_space): Call it.
+ (is_extended_char, is_extended_char_1): New fns.
+ (utf8_extend_token): New fn, #if 0'd out.
+ (real_yylex): Treat extended chars like letters.
- * decl2.c (build_expr_from_tree): If CONSTRUCTOR has a type, call
- digest_init.
- * pt.c (tsubst_copy): Compute type for CONSTRUCTOR.
- * typeck2.c (store_init_value): Check for initializing pmf with { }
- here.
- (process_init_constructor): Not here.
+ * search.c (note_debug_info_needed): Walk the bases even if we
+ weren't deferring the type itself.
-Thu Sep 19 16:41:07 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-03-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * pt.c (begin_template_parm_list): Increment
- processing_template_decl here.
- (end_template_parm_list): Not here.
- (process_template_parm): No need to add 1 to it now.
- * *.c: Use processing_template_decl instead of current_template_parms
- to check for being in a template.
+ * decl2.c (finish_objects): Constify a char*.
- * pt.c (uses_template_parms): Handle SCOPE_REF. Fix CONSTRUCTOR.
- (tsubst_copy): Handle CONSTRUCTOR.
- (instantiate_decl): Set up context properly for variables.
- * decl2.c (build_expr_from_tree): Handle CONSTRUCTOR.
- * class.c (finish_struct): Reverse CLASSTYPE_TAGS.
+ * method.c (emit_thunk): Likewise.
-Wed Sep 18 13:30:20 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+2000-03-06 Nathan Sidwell <nathan@codesourcery.com>
- * lex.c (enum tree_node_kind) [GATHER_STATISTICS]: Put the enum back.
+ * typeck.c (dubious_conversion_warnings): Look through
+ REFERENCE_TYPE.
-Wed Sep 18 04:24:07 1996 Jason Merrill <jason@yorick.cygnus.com>
+Mon Mar 6 08:46:47 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
- * method.c (make_thunk): Call comdat_linkage before setting the
- TREE_CODE.
+ * class.c (dfs_modify_vtables): I is now unsigned.
+ (check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
+ (build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
+ * error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
+ * init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
+ * method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
+ * typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
+ Call integer_all_onesp.
+ * typeck2.c (process_init_constructor): Use compare_tree_int.
- * decl2.c (comdat_linkage): Use make_decl_one_only.
- (import_export_decl): Likewise.
- * decl.c (init_decl_processing): Check supports_one_only instead of
- SUPPORTS_WEAK.
+ * lang-specs.h (as): Don't call if -syntax-only.
-Sat Sep 14 08:34:41 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-03-06 Mark Mitchell <mark@codesourcery.com>
- * decl2.c (grokfield): Tighten checking for access decls.
+ * expr.c (cplus_expand_expr, case STMT_EXPR): Don't set
+ RTL_EXPR_HAS_NO_SCOPE after all.
- * decl.c (make_typename_type): Resolve references to
- current_class_type. Set CLASSTYPE_GOT_SEMICOLON.
- (lookup_name_real): Types that depend on a template parameter get
- an implicit 'typename' unless they're in the current scope.
- (start_decl_1): We don't care about incomplete types that depend
- on a template parm.
- (grokdeclarator): Resolve 'typename's in the type specifier that
- refer to members of the current scope.
+2000-03-05 Mark Mitchell <mark@codesourcery.com>
- * call.c (build_over_call): Remove 'inline called before
- definition' diagnostic.
- (build_method_call): Likewise.
- * decl.c (duplicate_decls): Downgrade 'used before declared
- inline' to a warning, only with -Winline.
+ * expr.c (cplus_expand_expr, case STMT_EXPR): Use
+ expand_start_stmt_expr and expand_end_stmt_expr directly. Set
+ RTL_EXPR_HAS_NO_SCOPE.
-Fri Sep 13 17:31:40 1996 Stan Shebs <shebs@andros.cygnus.com>
+ * pt.c (instantiate_decl): Clear TI_PENDING_TEMPLATE_FLAG a little
+ later.
- * mpw-make.sed: Fix include paths, add @DASH_C_FLAG@ to compile.
+ * dump.c (dequeue_and_dump): Dump SCOPE_NO_CLEANUPS_P.
+
+2000-03-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ * call.c (convert_like): Macrofy.
+ (convert_like_with_context): New macro.
+ (convert_like_real): Renamed from convert_like. Add calling
+ context parameters, for diagnostics. Add recursive flag. Call
+ dubious_conversion_warnings for outer conversion.
+ (build_user_type_conversion): Use convert_like_with_context.
+ (build_over_call): Likewise. Don't warn about dubious
+ conversions here. Adjust convert_default_arg calls.
+ (convert_default_arg): Add context parameters for diagnostics.
+ Pass through to convert_like_with_context.
+ * cp-tree.h (convert_default_arg): Add context parameters.
+ (dubious_conversion_warnings): Prototype new function.
+ * typeck.c (convert_arguments): Adjust convert_default_arg call.
+ (dubious_conversion_warnings): New function, broken
+ out of convert_for_assignment.
+ (convert_for_assignment): Adjust.
+
+2000-03-03 Jason Merrill <jason@casey.cygnus.com>
+
+ * decl2.c (key_method): Break out from...
+ (import_export_vtable, import_export_class): ...here.
+
+ * decl.c (finish_function): Don't mess with flag_keep_inline_functions.
+ * decl2.c (finish_vtable_vardecl): Don't check decl_function_context.
+
+ * search.c (note_debug_info_needed, dfs_debug_mark,
+ dfs_debug_unmarkedp): Uncomment. Adjust for new scheme.
+ * decl2.c (finish_vtable_vardecl): Call note_debug_info_needed.
+
+2000-03-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (cp_finish_decl): Remove obsolete obstack comments, fix
+ typos.
+
+2000-03-02 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (TYPE_NEEDS_DESTRUCTOR): Rename to ...
+ (TYPE_HAS_NONTRIVIAL_DESTRUCTOR): ... this.
+ (TYPE_HAS_TRIVIAL_DESTRUCTOR): New macro.
+ (lang_type): Split gets_new into has_new and has_array_new.
+ (TYPE_VEC_NEW_USES_COOKIE): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR.
+ (TYPE_GETS_NEW): Split into ...
+ (TYPE_HAS_NEW_OPERATOR): ... this, and ...
+ (TYPE_HAS_ARRAY_NEW_OPERATOR): ... this.
+ (DECL_ARRAY_DELETE_OPERATOR_P): New macro
+ (build_op_new_call): Don't declare.
+ (build_new_1): Likewise.
+ * call.c (build_op_new_call): Remove.
+ * class.c (check_bases): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR
+ instead of TYPE_NEEDS_DESTRUCTOR.
+ (finish_struct_bits): Likewise.
+ (add_implicitly_declared_members): Likewise.
+ (check_field_decl): Likewise.
+ (check_methods): Set TYPE_VEC_DELETE_TAKES_SIZE here, and set it
+ correctly under the new ABI.
+ * decl.c (start_decl_1): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR
+ instead of TYPE_NEEDS_DESTRUCTOR.
+ (initialize_local_var): Likewise.
+ (destroy_local_var): Likewise.
+ (cp_finish_decl): Likewise.
+ (register_dtor_fn): Likewise.
+ (grok_op_properties): Set TYPE_HAS_NEW_OPERATOR and
+ TYPE_HAS_ARRAY_NEW_OPERATOR, not TYPE_HAS_NEW. Don't set
+ TYPE_VEC_DELETE_TAKES_SIZE here.
+ (xref_basetypes): Set TYPE_HAS_NEW_OPERATOR and
+ TYPE_HAS_ARRAY_NEW_OPERATOR, not TYPE_HAS_NEW.
+ (store_parm_decls): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR.
+ (finish_destructor_body): Likewise.
+ (maybe_build_cleanup_1): Likewise.
+ * decl2.c (do_static_destruction): Likewise.
+ * init.c (build_new_1): Make it static.
+ (perform_member_init): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR.
+ (expand_cleanup_for_base): Likewise.
+ (get_cookie_size): New function.
+ (build_new_1): Handle array-new cookies correctly under the new
+ ABI.
+ (build_vec_delete_1): Likewise.
+ (build_vec_init): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR.
+ (build_delete): Likewise.
+ (build_vec_delete): Handle array-new cookies correctly under the new
+ ABI.
+ * lex.c (do_identifier): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR.
+ * pt.c (instantiate_class_template): Set TYPE_HAS_NEW_OPERATOR and
+ TYPE_HAS_ARRAY_NEW_OPERATOR.
+ * ptree.c (print_lang_type): Check them.
+ * search.c (context_for_name_lookup): Fix typo in comment.
+ (tree_has_any_destructor_p): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR.
+ * tree.c (break_out_cleanups): Likewise.
+ (build_cplus_array_test_1): Likewise.
+ (cp_build_qualified_type_real): Likewise.
+ * typeck.c (complete_type): Likewise.
-Wed Sep 11 22:38:13 1996 Gerald Baumgartner <gb@cs.purdue.edu>
+ * g++spec.c (lang_specific_driver): Add -fnew-abi at the start of
+ the command-line, not the end.
- * call.c (build_method_call): When calling a signature
- default implementation, as in other cases, let instance_ptr simply
- be instance.
+2000-03-01 Jason Merrill <jason@casey.cygnus.com>
-Wed Sep 11 22:14:44 1996 Mike Stump <mrs@cygnus.com>
+ * pt.c (instantiate_decl): Clear TI_PENDING_TEMPLATE_FLAG.
- * parse.y (simple_stmt): Cleanup and use do_poplevel ().
+2000-03-02 Tom Tromey <tromey@cygnus.com>
-Wed Sep 11 22:10:48 1996 Mike Stump <mrs@cygnus.com>
+ * cp-tree.h (build_java_class_ref): Declare.
+ * init.c (build_java_class_ref): No longer static.
+ * except.c (expand_throw): Generate a Java-style `throw' if the
+ thrown object is a "Java" object.
+ (initialize_handler_parm): Generate a Java-style lookup of
+ exception info if the caught object is a "Java" object.
+ (catch_language, catch_language_init): New globals.
+ (decl_is_java_type): New function.
+ (expand_start_catch_block): Don't call push_eh_info() or
+ push_eh_cleanup() when handling a Java-style "catch". Pass Java
+ class reference to build_catch_block.
- * except.c (expand_start_catch_block): Add a pushlevel so that -g
- works on hppa and SPARC.
+Thu Mar 2 13:32:01 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-Wed Sep 11 10:18:06 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+ * typeck.c (comptypes): Treat sizetype like its language equivalent.
- * typeck.c (build_indirect_ref): Catch PTR being an error_mark_node.
+2000-03-01 Bernd Schmidt <bernds@cygnus.co.uk>
-Mon Sep 9 19:51:14 1996 Gerald Baumgartner <gb@cs.purdue.edu>
+ * typeck.c (maybe_warn_about_returning_address_of_local): Reorganize
+ to merge reference/pointer code and fix incorrect warnings.
- * call.c (build_over_call): Check first whether DECL_CONTEXT exists
- before testing whether it's a signature.
+2000-02-29 Jason Merrill <jason@casey.cygnus.com>
-Sun Sep 8 16:06:57 1996 Gerald Baumgartner <gb@cs.purdue.edu>
+ * search.c (protected_accessible_p): Use context_for_name_lookup.
- * 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.
+ * init.c (construct_virtual_bases): Fix thinko.
+ * typeck.c (expand_ptrmemfunc_cst): Fix thinko.
-Thu Sep 5 16:51:28 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-03-01 Martin von Loewis <loewis@informatik.hu-berlin.de>
- * typeck.c (build_c_cast): Don't tack a non_lvalue_expr onto a
- target_expr.
+ * decl.c (current_function_decl): Move to toplev.c.
-Thu Sep 5 10:05:38 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+2000-02-29 Nathan Sidwell <nathan@codesourcery.com>
- * cvt.c (convert_to_reference): Use %#T, not %#D, for error.
+ * pt.c (fn_type_unification): Unify return type, whenever
+ provided.
+ (get_bindings_real): Only pass return type when necessary.
+ Remove explicit return type check.
+ * class.c (resolve_address_of_overloaded_function): Pass desired
+ return type to fn_type_unification.
-Wed Sep 4 17:16:09 1996 Bob Manson <manson@charmed.cygnus.com>
+Mon Feb 28 08:15:23 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
- * except.c (expand_start_try_stmts): Move to except.c in the backend.
- (expand_end_try_stmts): Remove.
+ * class.c (build_vtbl_or_vbase_field, check_methods): Don't clear
+ DECL_FIELD_SIZE.
+ (check_bitfield_decl, check_field_decls): Set DECL_SIZE, not
+ DECL_FIELD_SIZE.
+ * rtti.c (expand_class_desc): Likewise.
+ * cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name.
+ (THUNK_VCALL_OFFSET): Likewise.
+ (THUNK_DELTA): Reflect changes in ../tree.h.
+
+2000-02-28 Jason Merrill <jason@casey.cygnus.com>
+
+ * search.c (protected_accessible_p): Also allow the access if
+ the member is public in DERIVED. Lose TYPE parm.
+ (friend_accessible_p): Lose TYPE parm.
+ (accessible_p): Adjust.
+
+Sun Feb 27 16:40:33 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * class.c (dfs_build_vtable_offset_vtbl_entries): Don't use size_binop
+ on things that are not sizes; ssize_binop deleted.
+ Call size_diffop when appropriate.
+ (dfs_build_vcall_offset_vtbl_entries): Likewise.
+ (build_primary_vtable, build_secondary_vtable): Likewise.
+ (dfs_set_offset_for_unshared_vbases, dfs_modify_vtables): Likewise.
+ Variable I is HOST_WIDE_INT.
+ (get_vfield_offset): Pass proper types to size_binop.
+ (size_extra_vtbl_entries, layout_virtual_bases): Likewise.
+ (finish_struct_1): Likewise.
+ (skip_rtti_stuff): Arg N is now pointer to signed.
+ (layout_class_type): Use size_zero_node.
+ * cp-tree.h (skip_rtti_stuff): Arg N is pointer to signed.
+ * cvt.c (cp_convert_to_pointer): Pass proper types to size_binop.
+ * decl.c (complete_arry_type): Pass proper types to size_binop.
+ (xref_basetypes): BINFO_OFFSET is sizetype.
+ * error.c (dump_expr): Don't use size_binop non-sizes.
+ * expr.c (cplus_expand_constant): Pass proper types to size_binop.
+ * init.c (construct_virtual_bases): Fix type error.
+ (build_vec_delete_1): Pass proper type to size_binop and don't
+ fold result.
+ * lex.c (cp_make_lang_type): BINFO_OFFSET is sizetype.
+ * rtti.c (get_base_offset): Pass proper type to size_binop.
+ * search.c (dfs_find_vbases): Fix type error.
+ (expand_upcast_fixups): Arg to skip_rtti_stuff is pointer to signed.
+ (dfs_get_vbase_types): BINFO_OFFSET is sizetype.
+ * tree.c (debug_binfo): Variable N is signed.
+ Use HOST_WIDE_INT_PRINT_DEC.
+ * typeck.c (comptypes): sizetype is same as equivalent integer type.
+ (c_sizeof, c_sizeof_nowarn, expr_sizeof): Use TYPE_SIZE_UNIT,
+ size_one_node and size_zero_node.
+ (c_alignof): Use size_one_node.
+ (build_component_addr): Pass proper types to size_binop.
+ (expand_ptrmemfunc_cst): Don't use size_binop on non-sizes.
+
+2000-02-26 Jason Merrill <jason@casey.cygnus.com>
+
+ Implement class scope using-declarations for functions.
+ * class.c (handle_using_decl): Call add_method for used functions.
+ Use IDENTIFIER_CLASS_VALUE to check for conflicts.
+ (add_method): Used functions are hidden by local functions.
+ (check_bases_and_members): Handle using-decls before finalizing
+ CLASSTYPE_METHOD_VEC.
+ * call.c (add_function_candidate): Add ctype parm; if non-zero,
+ override the type of 'this' accordingly.
+ (add_template_candidate, add_template_candidate_real): Add ctype parm.
+ (convert_class_to_reference, build_user_type_conversion_1,
+ build_new_function_call, build_object_call, build_new_op,
+ build_new_method_call): Pass ctype parm.
+
+ * search.c (lookup_member): Put rval_binfo, not basetype_path, in
+ the baselink.
+ * call.c (convert_class_to_reference, build_user_type_conversion_1,
+ build_new_function_call, build_object_call, build_new_op,
+ build_new_method_call, build_op_delete_call): Don't get basetype_path
+ from a baselink.
+ * typeck.c (build_component_ref): Likewise.
+ * init.c (build_offset_ref): Likewise.
+ (resolve_offset_ref): Don't call enforce_access.
+ Call build_scoped_ref.
+ * typeck2.c (build_scoped_ref): Simplify. Do nothing if it
+ would cause an error or if -pedantic.
+ * class.c (alter_access): Lose binfo parm.
- * init.c (perform_member_init): Use add_partial_entry () instead
- of directly manipulating lists.
- (emit_base_init): Likewise.
+2000-02-26 Mark Mitchell <mark@codesourcery.com>
-Wed Sep 4 12:14:36 1996 Mike Stump <mrs@cygnus.com>
+ * semantics.c (simplify_aggr_init_exprs_p): Don't walk into
+ types.
- * except.c (expand_exception_blocks): Always make sure USE and
- CLOBBER insns that came at the end still do, the backend relies
- upon this.
+2000-02-25 Alfred Minarik <a8601248@unet.univie.ac.at>
-Wed Sep 4 07:44:48 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * rtti.c (get_vmi_pseudo_type_info): Move __vmi_class_type_info
+ pseudo_type_info creation into the std namespace
- * call.c (build_over_call): We can only use a TARGET_EXPR of the
- right type.
+2000-02-26 Mark Mitchell <mark@codesourcery.com>
-Tue Sep 3 19:26:05 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (DECL_NEEDED_P): Tweak to correct usage before EOF.
+ (import_export_class): Remove declaration.
+ * decl2.c (import_export_class): Make it static.
+ * dump.c (dequeue_and_dump): Handle PREDECREMENT_EXPR,
+ PREINCREMENT_EXPR, POSTDECREMENT_EXPR, POSTINCREMENT_EXPR,
+ EXPR_WITH_FILE_LOCATION.
+ * lex.c (check_newline): Tweak filename/lineno setting.
+ * semantics.c (begin_while_stmt): Fix typo in comment.
- * cvt.c (convert_to_reference): Revert last change, don't complain
- about temp without target decl.
+Sat Feb 26 19:50:23 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-Tue Sep 3 10:22:56 1996 Mike Stump <mrs@cygnus.com>
+ * lang-options.h (-fmessage-length=): Add missing option.
- * decl.c (grokdeclarator): Don't core dump when void() is given.
+ * Make-lang.in (CXX_SRCS): Add .h files and sort list.
-Tue Sep 3 02:38:56 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-02-26 Zack Weinberg <zack@wolery.cumb.org>
- * decl.c (copy_args_p): Don't crash.
+ * Make-lang.in: Delete refs to LIBGCC2_DEPS.
-Fri Aug 30 14:26:57 1996 Mike Stump <mrs@cygnus.com>
+Fri Feb 25 14:52:33 2000 Jim Wilson <wilson@cygnus.com>
- * pt.c (tsubst): And support template args inside the exception
- specification.
+ * optimize.c (expand_call_inline): Emit the return label before
+ evaluating the return value.
- * pt.c (tsubst): Add support for exception specifications in
- template functions.
+2000-02-24 Mark Mitchell <mark@codesourcery.com>
-Fri Aug 30 10:01:55 1996 Mike Stump <mrs@cygnus.com>
+ * lex.c (check_newline): Use push_srcloc and pop_srcloc, rather
+ than duplicating functionality here.
+ * optimize.c: Include input.h.
+ (expand_call_inline): Use push_srcloc and pop_srcloc.
+ * parse.y (maybe_cv_qualifier): Remove calls to emit_line_note.
+ * parse.c: Regenerated.
+ * Makefile.in (lex.o): Depend on input.h.
+ (optimize.o): Likewise.
+
+2000-02-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (grokdeclarator): Diagnose qualifiers on non-member
+ function type, rather than ICE.
+
+2000-02-23 Jason Merrill <jason@casey.cygnus.com>
+
+ * decl.c (grokdeclarator): Call decl_type_access_control.
+ * parse.y (parse_end_decl): Don't call decl_type_access_control if
+ decl is null.
+
+2000-02-23 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (decls_match): Remove obsolete static member nadgering.
+
+2000-02-21 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (grokdeclarator): Change ANSI to ISO.
+ * lex.c (consume_string, readescape, do_identifier): Likewise.
+ (parse_float, real_yylex): Likewise.
+ * parse.y (paren_expr_or_null, paren_cond_or_null): Likewise.
+ (unary_expr, new_initializer, cast_expr, primary, primary_no_id,
+ new_type_id, maybe_label_decls, simple_stmt,
+ for.init.statement): Likewise.
+ * pt.c (do_decl_instantiation, do_type_instantiation): Likewise.
+ * semantics.c (finish_named_return_value): Likewise.
+ * parse.c: Regenerate.
+
+2000-02-21 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (CPTI_VTABLE_INDEX_TYPE): New macro.
+ (CPTI_CLASS_STAR_TYPE): Remove.
+ (vtable_index_type): Likewise.
+ (class_star_type_node): Remove.
+ (TYPE_PTRMEMFUNC_FN_TYPE): Adjust for the new ABI.
+ (build_binary_op_nodefault): Remove.
+ * call.c (build_new_op): Use build_binary_op instead of
+ build_binary_op_nodefault.
+ * decl.c (init_decl_processing): Remove class_star_type_node
+ initialization. Make delta_type_node ptrdiff_type_node under the
+ new ABI. Initialize vtable_index_type.
+ (build_ptrmemfunc_type): Build different structures for the new
+ ABI.
+ (build_enumerator): Use build_binary_op instead of
+ build_binary_op_nodefault.
+ * method.c (build_overload_value): Mangle pointers-to-members
+ appropriately under the new ABI.
+ * typeck.c (build_array_ref): Use build_binary_op instead of
+ build_binary_op_nodefault.
+ (get_member_function_from_ptrfunc): Adjust for the new ABI.
+ (build_binary_op_nodefault): Rename to ...
+ (build_binary_op): ... this. Remove old version. Adjust for
+ pointer-to-member comparisons under the new ABI.
+ (build_ptrmemfunc1): Remove dead code. Adjust for the new ABI.
+ (build_ptrmemfunc): Adjust for the new ABI.
+ (expand_ptrmemfunc_cst): Likewise.
+ (delta2_from_ptrmemfunc): Assert that we're not using the new ABI.
+ (pfn_from_ptrmemfunc): Adjust for the new ABI.
+
+2000-02-21 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * call.c (build_object_call): Compress consecutive calls to
+ cp_error.
+ (build_conditional_expr): Say 'ISO C++' not 'ANSI C++'.
+ (build_op_delete_call): Adjust message formatting.
+
+ * class.c (check_bases): Compress consecutive calls to
+ cp_pedwarn.
+ (finish_struct_anon): Say 'ISO C++'.
+
+ * decl.c (start_decl): Same here.
+ (grok_reference_init): Likewise.
+ (grokfndecl): Correct message formatting.
+ (grokfndecl): Improve diagnostic.
+ (check_static_variable_definition): Likewise. Say 'ISO C++'
+ (compute_array_index_type): Say 'ISO C++'
+ (create_array_type_for_decl): Compress consecutive calls to
+ cp_error.
+ (grokdeclarator): Say 'ISO C++'
+ (grok_op_properties): Likewise.
- * 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 grammar
- 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.
+ * decl2.c (delete_sanity): Clairify diagnostic.
+ (check_member_template): Same here.
+ (grok_function_init): Use consistent terminology.
+
+ * expr.c (do_case): Say 'ISO C++'
+
+ * friend.c (do_friend): Compress consecutive calls to warning.
+
+2000-02-20 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (merge_primary_and_secondary_vtables_p): New macro.
+ * class.c (build_secondary_vtable): Reorganize. Don't create a
+ new vtable under the new ABI.
+ (layout_vtable_decl): Don't add num_extra_vtbl_entries when
+ computing the size.
+ (build_vtbl_initializer): Don't return a CONSTRUCTOR; just return
+ the initializing elements.
+ (initialize_vtable): New function.
+ (dfs_finish_vtbls): Use it.
+ (dfs_accumulate_vtbl_inits): New function.
+ (finish_vtbls): Merge primary and secondary vtables under the new
+ ABI.
+ (finish_struct_1): Remove redundant call to layout_vtable_decl.
+ * init.c (expand_virtual_init): Deal with BINFO_VTABLEs that
+ aren't VAR_DECLs.
+
+ * class.c (build_vtable): New function, split out from ...
+ (get_vtable_decl): ... here, and ...
+ (build_secondary_vtable): ... here.
+
+ * pt.c (tsubst_decl): Fix formatting.
+
+Sat Feb 19 18:43:13 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * class.c (build_primary_vtable, layout_vtable_decl): Likewise.
+ (avoid_overlap, build_base_field): Likewise.
+ (build_base_field, build_base_fields, is_empty_class):
+ Test DECL_SIZE with integer_zero.
+ (layout_class_type): Set CLASSTYPE_SIZE_UNIT.
+ * cp-tree.h (struct lang_type): New field size_unit.
+ (CLASSTYPE_SIZE_UNIT): New macro.
+ * decl.c (init_decl_processing): Set DECL_SIZE_UNIT.
+ (cp_finish_decl): Delete -Wlarger-than processing.
+ * optimize.c (remap_decl): Walk DECL_SIZE_UNIT.
+ * pt.c (tsubst_decl): Set DECL_SIZE_UNIT.
+ * tree.c (make_binfo): binfo vector is one entry longer.
+ (walk_tree): Walk DECL_SIZE_UNIT.
+
+2000-02-19 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (dfs_build_vcall_offset_vtbl_entries): Fix typo in
+ comment.
+ (build_vtable_entry): Don't assume all vtable entries are
+ functions.
+ (build_vtbl_initializer): Adjust accordingly.
+ (get_vtable_decl): Fix formatting.
+
+2000-02-18 Jason Merrill <jason@casey.cygnus.com>
+
+ * semantics.c (deferred_type_access_control): Walk the entire
+ type_lookups list.
+ (save_type_access_control): Rename from
+ initial_deferred_type_access_control. Just remember the value.
+ (decl_type_access_control): New fn.
+ (begin_function_definition): Use deferred_type_access_control, after
+ we've started the function. Set type_lookups to error_mark_node.
+ * parse.y (frob_specs, fn.def1): Adjust.
+ (parse_decl0, parse_field, parse_field0, parse_bitfield): New fns.
+ (parse_end_decl, parse_bitfield0, parse_method): New fns.
+ (fn.def2, initdcl, initdcl0_innards, nomods_initdcl0): Use them.
(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>
-
- * decl.c (start_function): Only check interface_* for templates
- with flag_alt_external_templates.
-
- * call.c (build_new_op): Check for comparison of different enum types.
- (build_over_call): Fix arg # output.
-
- * typeck.c (build_component_ref): Handle pre-found TYPE_DECL.
-
-Wed Aug 21 00:13:15 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_new_op): Check for erroneous args.
-
- * call.c (build_new_method_call): Add missing args to cp_error.
-
- * tree.c (error_type): Don't print reference-to-array.
-
- * typeck.c (convert_for_assignment): Don't say contravariance for
- removing const.
-
-Tue Aug 20 13:23:00 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_over_call): Diagnose bad convs for `this'.
-
- * lex.c (cons_up_default_function): Set DECL_ARTIFICIAL
- on _ctor_arg.
-
- * call.c (convert_like): Handle bad convs.
- (build_over_call): Handle bad convs better.
-
- * decl2.c: -fansi-overloading is now the default.
-
- * call.c (build_new_method_call): Check for erroneous args.
-
- * pt.c (instantiate_class_template): Propagate
- TYPE_USES_MULTIPLE_INHERITANCE.
-
-Tue Aug 20 13:09:57 1996 Mike Stump <mrs@cygnus.com>
-
- * call.c (enforce_access): Add static to routine.
-
-Sun Aug 18 14:35:54 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_user_type_conversion_1): Fix bad handling.
- (compare_ics): Likewise.
-
-Sat Aug 17 21:54:11 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (standard_conversion): Oops.
-
-Sat Aug 17 16:28:11 1996 Geoffrey Noer <noer@cygnus.com>
-
- * g++.c: Update test for win32 (&& ! cygwin32).
-
-Sat Aug 17 03:45:31 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (comp_ptr_ttypes_real): Handle OFFSET_TYPEs properly.
- (ptr_reasonably_similar): New fn.
- * call.c (BAD_RANK): New rank.
- (ICS_BAD_FLAG): New macro.
- (standard_conversion): Handle almost-right pointer conversions.
- (reference_binding): Handle bad rvalue bindings.
- (add_*_candidate): Stuff.
- (build_over_call): Pass bad conversions to convert_for_initialization.
- (compare_ics): Handle bad convs.
- (joust): Likewise.
-
-Fri Aug 16 15:02:19 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * init.c (expand_vec_init): Use ptrdiff_type_node instead of
- integer_type_node when computing pointer offsets.
-
-Fri Aug 16 01:28:32 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (lvalue_type): New fn.
- (error_type): New fn.
- * call.c (op_error): Use error_type.
- (add_conv_candidate): Use lvalue_type.
- (add_builtin_candidates): Likewise.
- * error.c (args_as_string): Use error_type.
-
-Thu Aug 15 17:27:13 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_decl): Evaluate DECL_INITIAL of a VAR_DECL here.
- (tsubst): Not here.
-
- * decl.c (init_decl_processing): With -ansi, __null's type is the
- signed integral type with the same number of bits as a pointer.
- Introduce a new variable null_node for it.
* cp-tree.h: Adjust.
- * call.c (null_ptr_cst_p): Adjust.
-
-Thu Aug 15 17:09:54 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (do_unwind): Mark %i7 as used on the SPARC so we can
- optimize.
-
-Thu Aug 15 01:36:49 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (import_export_decl): Ignore #pragma interface for tinfo
- fns of classes without virtual functions.
-
- * call.c (add_function_candidate): Handle `this' specially.
- (compare_ics): Likewise.
-
-Tue Aug 13 12:16:10 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_conditional_expr): Fix handling of __null.
-
- * decl2.c (comdat_linkage): New fn.
- (import_export_vtable): Use it.
- (import_export_decl): Use it.
- * method.c (make_thunk): Use it.
-
-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.
- * parse.y (template_header): Accept 'template <>'.
-
- * errfn.c: Allow 5 args.
-
-Sun Aug 11 15:20:58 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (make_temp_vec): New fn.
- * pt.c (push_template_decl): Handle partial specs.
- (instantiate_class_template): Likewise.
- (more_specialized): Use get_bindings.
- (more_specialized_class): New fn.
- (get_class_bindings): New fn.
- (most_specialized_class): New fn.
- (do_function_instantiation): List candidates for ambiguous case.
- * decl.c (duplicate_decls): Lose reference to DECL_TEMPLATE_MEMBERS.
- (shadow_tag): Call push_template_decl for partial specializations.
- * parse.y: Likewise.
- * cp-tree.h (DECL_TEMPLATE_SPECIALIZATIONS): Replaces
- DECL_TEMPLATE_MEMBERS.
- * call.c (print_z_candidates): Reduce duplication.
-
-Fri Aug 9 14:36:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (lang_decode_option): Allow -fansi-overloading.
-
-Thu Aug 8 17:04:18 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (get_bindings): New fn.
- (most_specialized): Likewise.
- (do_function_instantiation): Use them.
- (add_maybe_template): New fn.
- * cp-tree.h (DECL_MAYBE_TEMPLATE): New macro.
- * call.c (build_new_op): Handle guiding decls.
- (build_new_function_call): Likewise.
- * decl2.c (finish_file): Likewise.
-
- * decl2.c (mark_used): Do synthesis here.
- * call.c (build_method_call): Not here.
- (build_over_call): Or here.
- * typeck.c (build_function_call_real): Or here.
- * tree.c (bot_manip): Call mark_used on functions used in default
- args.
-
-Thu Aug 8 17:48:16 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * decl2.c (import_export_vtable): Delete code that disabled vtable
- heuristic on systems with ASM_OUTPUT_EXTERNAL.
-
-Wed Aug 7 12:44:11 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_x_function_call): Handle static call context
- better.
-
- * decl.c (finish_function): Set the DECL_CONTEXT of the result to
- the function, not its outer block.
-
- * call.c (build_field_call): Pass fields on to build_opfncall
- regardless of TYPE_OVERLOADS_CALL_EXPR.
- (build_method_call): Pass on to build_new_method_call sooner.
-
- * typeck.c (build_ptrmemfunc): Just return what instantiate_type
- gives us.
- * class.c (instantiate_type): Don't put a POINTER_TYPE to
- METHOD_TYPE on an expression. Also make a copy of rhs instead of
- modifying it.
-
-Tue Aug 6 12:58:46 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (compare_ics): Handle qual_conv after lvalue_conv.
- (add_builtin_candidate): Don't take enums for ++.
- (build_new_method_call): Handle non-aggregates and field calls.
- Move new overloading code from...
- * cvt.c: Here.
-
- * decl.c (grokparms): Don't check default args in templates.
-
-Mon Aug 5 17:17:06 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (build_new_op): Fix args to build_unary_op.
- (add_builtin_candidates): Don't call type_promotes_to on float.
-
- * decl.c (grokparms): Check the type of the default arg.
-
- * cvt.c (build_new_op): Pass non-overloaded cases on rather than
- returning NULL_TREE.
-
- * typeck.c (build_x_binary_op): Avoid doing extra work.
- (build_x_unary_op): Likewise.
- (build_x_conditional_expr): Likewise.
- * cvt.c (build_over_call): Return.
- (add_builtin_candidate): Fix MEMBER_REF.
- (build_new_op): Likewise.
-
-Mon Aug 5 17:07:47 1996 Mike Stump <mrs@cygnus.com>
-
- * method.c (build_overload_name): Put bug fix into code but leave
- disabled for now so we can be bug compatible with older releases
- that do repeats incorrectly. In the future, we can enable it.
-
-Mon Aug 5 13:46:28 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (convert_like): Don't call build_cplus_new twice.
-
- * call.c, cp-tree.h, cvt.c, decl2.c, init.c, method.c, pt.c, typeck.c:
- Control new overloading code with -fansi-overloading.
-
-Sun Aug 4 15:29:11 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (build_over_call): Call build_cplus_new.
- * call.c (build_method_call): Likewise.
- * typeck.c (build_function_call_real): Likewise.
- (build_conditional_expr): If both operands are TARGET_EXPRs, wrap
- the COND_EXPR in a TARGET_EXPR so they use the same slot.
-
- * cvt.c (build_up_reference): Propagate INDIRECT_BIND to
- recursive calls.
- * typeck.c (complete_type): Propagate
- TYPE_NEEDS_{CONSTRUCTING,DESTRUCTOR}.
-
-Sat Aug 3 14:05:07 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (joust): More ?: kludging. Sigh.
- (build_over_call): Don't try to synthesize global fns.
-
- * search.c (lookup_conversions): Use binfo marking.
-
-Sat Aug 3 12:33:42 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * search.c (build_mi_matrix): Use the correct value of cid
- when determining the new mi_size.
-
-Sat Aug 3 01:27:41 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (add_builtin_candidates): Do consider type conversion ops
- for the first parms of += et al.
- (strip_top_quals): New fn.
- (reference_binding): Use it instead of TYPE_MAIN_VARIANT.
- (implicit_conversion): Likewise.
- (add_builtin_candidates): Be careful about arrays.
- (build_new_method_call): Handle vtable optimization.
-
-Fri Aug 2 01:26:59 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h (LOOKUP_NO_TEMP_BIND): New flag.
- * cvt.c (reference_binding): Use it.
- (implicit_conversion): Use it.
- (add_builtin_candidate, COND_EXPR): Use it.
-
- * cvt.c (build_new_function_call): Check for error args.
-
- * typeck.c (comptypes): Just check DERIVED_FROM_P, not UNIQUELY.
-
- * gxx.gperf: Add __null.
- * hash.h: Regenerate.
- * lex.h: Add RID_NULL.
- * lex.c (init_lex): Create null_pointer_node here, stick it in
- RID_NULL.
- * decl.c (init_decl_processing): Still set its type here.
- * cvt.c (cp_convert_to_pointer): Don't produce null_pointer_node.
- (convert_to_pointer_force): Likewise.
- (null_ptr_cst_p): Check for null_pointer_node; only accept (void*)0
- if (! pedantic).
- * call.c (convert_harshness): Use null_ptr_cst_p.
- * typeck.c (convert_for_assignment): Likewise. Don't produce
- null_pointer_node.
-
- * error.c (args_as_string): Handle lists of actual args, too.
- * cvt.c (null_ptr_cst): Support (void*)0 for now.
- (build_user_type_conversion_1): Improve diagnostics.
- (build_new_function_call): Likewise.
- (build_object_call): Likewise.
- (build_new_method_call): Likewise. Move call before def diagnostic...
- (build_over_call): Here.
-
- * cvt.c (build_new_method_call): Don't complain about no match if
- LOOKUP_SPECULATIVELY.
- (build_over_call): Fix 'this' for virtual fn.
- (build_new_method_call): Add diagnostic.
-
-Thu Aug 1 16:45:09 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (add_function_candidate): Expect 'this' and 'in_chrg' for
- constructors to be passed in.
- (build_over_call): Likewise.
- (build_user_type_conversion_1): Pass them in.
- (convert_like): Likewise.
- (build_object_call): Handle overloaded conversions.
- (build_over_call): Pass the right args to build_vfn_ref.
- (standard_conversion): Fix pmf convs.
- (joust): Handle comparing statics and non-statics.
- (build_new_method_call): New fn.
- * call.c (build_method_call): Call it if NEW_OVER.
-
-Thu Aug 1 16:06:14 1996 Mike Stump <mrs@cygnus.com>
-
- * lex.c (do_identifier): Don't use %O on IDENTIFIER_OPNAME_Ps, use
- %D instead.
-
-Thu Aug 1 15:24:02 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Use maybe_build_cleanup_and_delete
- instead of just maybe_build_cleanup so that we deallocate the
- thrown object.
-
-Thu Aug 1 15:18:00 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl2.c (finish_prevtable_vardecl): Make non-static for pt.c's use.
- * cp-tree.h (finish_prevtable_vardecl): Add decl.
-
-Thu Aug 1 11:53:51 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * pt.c (instantiate_class_template): Call complete_type. Also, if
- we're at the end of the file and we just instantiated a template
- class with a vtable, call finish_prevtable_vardecl.
-
- * error.c (dump_decl): Don't explode (or explode more gracefully
- as appropriate) if the object being dumped has a null type.
- (dump_expr): Likewise.
-
- * search.c (build_mi_matrix): Ensure that mi_size is large enough,
- by counting the number of nodes that we'll need before allocating
- the array.
- (lookup_fnfields): Fix comment.
- (breadth_first_search): Fix comment.
-
-Wed Jul 31 09:57:05 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Propagate TYPE_PACKED and
- TYPE_ALIGN.
- * class.c (finish_struct): Call cplus_decl_attributes here.
- (finish_struct_1): Not here.
- * cp-tree.h: Adjust.
-
- * pt.c (type_unification): New parameter STRICT.
- (unify): If STRICT, don't allow cv addition or base deduction.
- * call.c, class.c, cvt.c, cp-tree.h: Adjust.
-
-Tue Jul 30 13:06:13 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * search.c (get_template_base{_recursive}): New fns.
- * pt.c (more_specialized): New fn.
- (do_function_instantiation): Use it.
- (unify): Handle base deduction.
- * cvt.c (joust): Use more_specialized.
- Don't arbitrarily choose between non-builtin candidates.
- (build_over_call): Call require_complete_type.
-
- * decl.c (start_function): Statics are static even in a #pragma
- interface file.
-
- * decl2.c (import_export_vtable): Disable vtable heuristic on
- systems with ASM_OUTPUT_EXTERNAL.
-
- * cvt.c (compare_ics): Fix comparison of PMEM_CONV and BASE_CONV.
- (standard_conversion): No std conv to enum type.
-
- * cvt.c (standard_conversion): Fix order of args to DERIVED_FROM_P
- for ptm's.
-
- * cvt.c (reference_binding): Bind directly to a base subobject of
- a class rvalue.
-
- * cvt.c (build_new_op): Enforce access control.
-
-Tue Jul 30 09:22:53 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck2.c (process_init_constructor): When scanning the
- union for a named field, skip things that aren't FIELD_DECLs.
-
- * method.c (synthesize_method): Don't scan fndecl's rtl if
- we're at the end of the file; just assume the function can't
- be inlined.
-
-Mon Jul 29 15:48:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (build_builtin_candidate): Stick a dummy conversion in if
- it failed.
-
- * cvt.c (build_user_type_conversion_1): Handle overloaded
- conversion ops.
-
- * cvt.c (add_builtin_candidates): Don't consider type conversion
- operators for the first parameter of operator=.
-
-Mon Jul 29 15:33:55 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (complete_type): Only call layout_type if we're not
- expanding a template.
-
-Mon Jul 29 14:40:38 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (compare_ics): Oops.
-
- * cvt.c (op_error): Oops.
-
- * cp-tree.def: Add RVALUE_CONV, rename EXACT_CONV to IDENTITY_CONV.
- * cvt.c: Add IDENTITY_RANK before others. Use real_lvalue_p.
- (build_conv): Use them.
- (implicit_conversion): Use them.
- (convert_like): Handle them.
- (build_new_op): Handle builtin COND_EXPR again.
- (add_builtin_candidates): Strip cv-quals. Fix oops. Include enums
- in lists of types for COND_EXPR.
- (add_builtin_candidate): Add enum candidates for COND_EXPR.
-
-Mon Jul 29 12:05:40 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (build_modify_expr): Always attempt to build a call to
- the assignment operator, even if we're using a default one.
- (convert_for_initialization): Call complete_type.
-
-Mon Jul 29 11:25:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (reference_binding): A REF_BIND gets the reference type.
- (implicit_conversion): Likewise.
- (convert_like): Likewise.
- (compare_ics): Likewise.
- (compare_qual): Likewise.
- (print_z_candidates): Handle no candidates.
- (build_new_op): Don't handle builtin COND_EXPR for now.
-
-Sat Jul 27 11:27:47 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * cvt.c (build_builtin_candidate): Init local var in an ANSI way.
-
-Fri Jul 26 01:07:22 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (joust): If the candidates are the same, arbitrarily pick one.
-
- * cvt.c (build_builtin_candidate): Oops.
- (build_new_op): Oops.
-
- * method.c (build_opfncall): Pass COND_EXPR on.
- * cvt.c (build_builtin_candidate): Reorganize, support COND_EXPR.
- (add_builtin_candidate{,s}): Likewise.
- (add_builtin_candidates): Likewise.
- (print_z_candidates, op_error, build_new_op): Likewise.
- (type_decays_to): New fn.
- * lex.c (init_lex): Just say ?: for COND_EXPR.
-
-Thu Jul 25 09:33:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (complete_type): Call layout_type rather than building
- a new array type.
-
- * cvt.c (add_builtin_candidate): Pointer arithmetic candidates
- only use ptrdiff_t.
-
-Wed Jul 24 12:45:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c: Always compile the new overloading code (but don't use it).
- (implicit_conversion): Add a BASE_CONV when converting to
- the same class type.
- (convert_like): Handle BASE_CONV.
-
-Tue Jul 23 12:46:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (build_new_op): Support {MAX,MIN}_EXPR.
- (add_builtin_candidate): Likewise.
-
- NEW_OVER changes:
- * typeck.c (build_x_function_call): Try an operator function
- whenever we call an object of class type.
- * method.c (build_opfncall): Pass CALL_EXPRs through.
- * cvt.c (implicit_conversion): Do const-ref case first.
- (add_conv_candidate, build_object_call, op_error): New fns.
- (ptr_complete_ob, TYPE_PTROB_P): void is not an object type.
- ({add,build}_builtin_candidate{,s}, print_z_candidates): Display
- builtin candidates.
- (build_new_op): Handle CALL_EXPR. Don't try to decay void.
- Fall back on preincrement handling. Use op_error.
- Handle warn_synth.
- (convert_like): Pass INDIRECT_BIND. Don't try to do anything with
- an error_mark_node.
- (build_over_call): Handle PROMOTE_PROTOTYPES and ellipsis promotions
- properly.
-
-Mon Jul 22 16:21:55 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * pt.c (tsubst_expr): Handle CONTINUE_STMT.
-
-Mon Jul 22 15:38:58 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_component_ref_1): Use build_component_ref
- instead of open coding it here.
-
-Mon Jul 22 12:18:54 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * g++.c (main): Don't link with -lg++.
-
- NEW_OVER changes:
- * cvt.c (convert_to_reference): Don't use convert_from_reference on
- result of build_type_conversion.
- (cp_convert): Only call build_method_call for ctors if
- build_type_conversion failed.
- (ptr_complete_ob): New function.
- (TYPE_PTR{,OB,MEM}_P): New macros.
- ({add,build}_builtin_candidate{,s}): New functions.
- (print_z_candidates): Handle builtins.
- (build_user_type_conversion_1): Don't use conversion fns for
- converting to a base type.
- (build_user_type_conversion_1): Set ICS_USER_FLAG on AMBIG_CONVs.
- (build_user_type_conversion): Use convert_from_reference.
- (build_new_op): New function.
- (build_over_call): Fix handling of methods.
- (compare_ics): Handle AMBIG_CONV properly.
- * typeck2.c: Increment abort count.
- * method.c (build_opfncall): Forward most requests to build_new_op.
- * cp-tree.h (IS_OVERLOAD_TYPE): Tweak.
-
-Fri Jul 19 17:59:29 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * error.c (dump_expr, case CONSTRUCTOR, case CAST_EXPR): Take out
- invalid second argument to dump_expr_list.
-
-Fri Jul 19 14:04:05 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (lookup_name_real): Make sure we do obj->X::i correctly.
-
-Thu Jul 18 14:48:23 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * decl2.c (import_export_vtable): ASM_OUTPUT_EXTERNAL, not
- ASSEMBLE_EXTERNAL.
-
-Mon Jul 15 17:48:43 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck2.c (process_init_constructor): New pedwarn for using { }
- to initialize a pointer to member function.
- * typeck.c (build_ptrmemfunc1): Avoid use of digest_init so that
- we can avoid the new error.
-
-Mon Jul 15 15:42:03 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_ptrmemfunc1): New function to hide details of
- pointer to member functions better.
-
-Mon Jul 15 14:23:02 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (resolve_offset_ref): Resolve OFFSET_REFs that are
- methods into the actual method, as we know the implied object is
- not used.
-
-Mon Jul 15 13:08:29 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (maybecomma_warn): Only emit the pedwarn if we're not
- inside a system header.
-
-Fri Jul 12 16:30:05 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * call.c (build_method_call): Call complete_type on the
- instance type.
-
-Thu Jul 11 17:16:40 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_component_ref): Always build up an OFFSET_REF
- for obj_ptr->func so that we can know which object to use in a
- method call.
-
-Wed Jul 10 19:36:37 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_ptrmemfunc): Remove sorry, now we can cast
- around things. Also improve maintainability.
-
-Wed Jul 10 18:20:11 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * decl.c (grokdeclarator): Check for overflow when evaluating an
- array dimension.
-
-Wed Jul 10 17:26:19 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (cp_convert): Don't check for ambiguity with constructor
- if NEW_OVER.
-
- * typeck.c (build_x_function_call): Pass function overload
- questions to new overloading code if NEW_OVER.
- * init.c (expand_aggr_init_1): Only check for type conversion ops
- if we're doing copy-initialization (i.e. LOOKUP_ONLYCONVERTING).
- Don't check for ambiguity with constructor if NEW_OVER.
- * cvt.c (convert_to_reference): Dereference the result of a type
- conversion operator.
- (build_conv): Propagate ICS_USER_FLAG.
- (implicit_conversion): Call instantiate_type.
- Pass LOOKUP_ONLYCONVERTING instead of LOOKUP_NORMAL.
- (add_function_candidate): Fix cv-quals on argtype.
- (print_z_candidates): New function.
- (build_new_function_call): Call it.
- (build_user_type_conversion_1): If LOOKUP_ONLYCONVERTING, don't
- consider non-converting constructors.
- Call print_z_candidates.
- Return an AMBIG_CONV for an ambiguous conversion.
- (build_user_type_conversion): Handle AMBIG_CONV.
- (convert_like): Fix test for building TARGET_EXPR.
- Call instantiate_type.
- Handle AMBIG_CONV and LVALUE_CONV.
- (build_over_call): Handle 0 args and ellipsis.
- * cp-tree.def: Add AMBIG_CONV.
-
-Tue Jul 9 17:48:48 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (lookup_name_real): If we find mem in obj when parsing
- `obj->mem', make sure we return the right value.
-
-Tue Jul 9 16:11:28 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * search.c (get_base_distance): Call complete_type.
-
-Tue Jul 9 12:46:34 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (store_bindings): Make static.
-
-Mon Jul 8 16:42:31 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (expand_aggr_init_1): Don't check type conversions if
- NEW_OVER.
-
- * cvt.c (z_candidate): Put back template field.
- (add_function_candidate): Set it.
- (add_template_candidate): Likewise.
- (joust): Use it.
- (compare_qual): Handle references and pointers to members.
- (compare_ics): Handle reference bindings.
-
- * decl.c (duplicate_decls): Propagate DECL_ONE_ONLY.
-
-Mon Jul 8 16:18:56 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * call.c (compute_conversion_costs): Call complete_type.
-
- * tree.c (vec_binfo_member): Use comptypes instead of comparing
- pointers, so we can handle template parameters.
-
-Fri Jul 5 16:51:53 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * cvt.c (cp_convert_to_pointer): We have to call complete_type
- here; let's make it explicit instead of a side effect of an
- error check.
-
-Wed Jul 3 16:29:51 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (z_candidate): Remove template field.
- (reference_binding): Handle binding to temporary.
- (implicit_conversion): Likewise.
- (add_function_candidate): Handle artificial constructor parms.
- Handle functions with too few parms.
- (add_template_candidate): New function.
- (build_user_type_conversion_1): Handle constructors.
- (convert_like): Likewise.
- (build_over_call): Likewise.
- (build_new_function_call): Support templates.
- (compare_ics): Fix reference, inheritance handling.
-
-Mon Jul 1 22:58:18 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * decl.c: Add signed_size_zero_node.
- (init_decl_processing): Build it.
- * class.c (prepare_fresh_vtable): Use it instead of size_zero_node
- when we're trying to make a negative delta.
-
-Mon Jul 1 17:56:19 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- Stop doing this damn index==strchr variable name confusion.
- * class.c (add_virtual_function): Change local var INDEX to be
- named IDX.
- (add_method): Likewise.
- * lex.c (print_parse_statistics): Likewise.
- * search.c (make_memoized_table_entry): Likewise.
- (lookup_fnfields_here): Likewise.
- (lookup_field): Likewise.
- (lookup_fnfields): Likewise.
- (get_baselinks): Likewise.
- * sig.c (build_signature_table_constructor): Likewise.
- (build_signature_method_call): Likewise.
- * typeck.c (build_x_array_ref): Change INDEX parm to be named IDX.
- (get_member_function_from_ptrfunc): Likewise.
- (build_ptrmemfunc): Change local var INDEX to be IDX.
- (c_expand_start_case): Likewise.
-
-Sat Jun 29 14:05:46 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (cp_convert_to_pointer): Move user-defined type conversion
- handling to before extraction of TYPE_PTRMEMFUNC_FN_TYPE.
- (convert_to_reference): Use build_type_conversion to convert to
- the reference type directly.
- (standard_conversion): Fix void* case, non-conversions.
- (reference_binding): Fix expr == 0 case, non-conversions.
- (convert_like): Support REF_BIND.
- (compare_qual): Split out from compare_ics.
- (compare_ics): Use it, handle icses with only a qual_conv.
-
- * init.c (expand_vec_init): Don't crash if decl is NULL.
-
-Fri Jun 28 11:52:51 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw-config.in: New file, configury for Mac MPW.
- * mpw-make.sed: New file, makefile editing for MPW.
-
-Thu Jun 27 15:18:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Call repo_template_used.
-
- * search.c (lookup_conversions): Only lookup conversions in
- complete types.
-
-Thu Jun 27 12:59:53 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.def: Renamed from tree.def, to avoid confusion with
- gcc's tree.def.
- * cp-tree.h, lex.c: Include cp-tree.def.
- * Makefile.in (CXX_TREE_H): Reference cp-tree.def.
-
-Wed Jun 26 18:29:47 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * init.c (build_vec_delete_1): Call complete_type.
-
-Mon Jun 24 17:17:32 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (start_anon_func): Make sure anonymous functions are
- never external.
-
-Fri Jun 21 15:10:58 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (finish_function): If function_depth > 1, set nested.
-
- * decl2.c (grokbitfield): Revert Bob's change.
- * class.c (finish_struct_1): Fix handling of named bitfield widths.
-
-Thu Jun 20 23:35:38 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (add_pending_template): Handle types.
- (lookup_template_class): With -fexternal-templates, just add the class
- to pending_templates instead of instantiating it now.
- * decl2.c (finish_file): Handle types in pending_templates.
-
-Thu Jun 20 14:08:40 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * decl2.c (grokbitfield): Handle constant decls appropriately.
- Give an appropriate error message now instead of spewing core
- later.
-
-Thu Jun 20 13:01:51 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c: Don't turn on thunks by default for now.
-
-Wed Jun 19 11:37:04 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (complete_type): Handle error_mark_node.
- (common_type, OFFSET_TYPE): Handle template_type_parms.
-
-Tue Jun 18 10:02:15 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_decl): If at_eof, call import_export_decl
- regardless of DECL_INLINE.
-
- * typeck.c (mark_addressable): Set TREE_ADDRESSABLE on CONSTRUCTORs.
-
- * class.c (finish_struct_bits): Copy TYPE_SIZE.
-
- * rtti.c (build_dynamic_cast): Support templates.
- * tree.def: Support DYNAMIC_CAST_EXPR.
- * pt.c (tsubst_copy): Likewise.
- * decl2.c (build_expr_from_tree): Likewise.
-
-Mon Jun 17 15:23:36 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_static_cast): Support templates.
- (build_const_cast): Likewise.
- * tree.def: Support CONST/STATIC_CAST_EXPR.
- * pt.c (tsubst_copy): Likewise.
- * decl2.c (build_expr_from_tree): Likewise.
-
-Sun Jun 16 12:33:57 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_vtable_vardecl): Don't trust
- TREE_SYMBOL_REFERENCED for vtables of local classes.
-
-Fri Jun 14 18:13:36 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst_copy): Handle operator T.
-
-Wed Jun 12 17:52:40 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (build_delete): Move creation of PARMS inside test of
- TYPE_HAS_DESTRUCTOR, since it's never used outside of that block.
-Tue Jun 11 15:09:18 1996 Bob Manson <manson@charmed.cygnus.com>
+ * decl.c (redeclaration_error_message): Allow redeclaration of
+ namespace-scope decls.
- * typeck.c (build_conditional_expr): Don't assume that
- the arguments to ?: are always pointers or records.
-
-Tue Jun 11 13:56:23 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (import_export_decl): Still emit static/weak/comdat
- copies of inline template functions with -fno-implicit-templates.
-
-Tue Jun 11 11:42:13 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * init.c (build_delete): Determine the complete basetype
- path to the destructor we're calling.
-
-Fri Jun 7 15:30:10 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * decl.c (build_enumerator): Always copy the INTEGER_CST used to
- initialize the enum, because we really and truly don't know where
- it came from.
- (start_enum): Don't copy integer_zero_node because
- build_enumerator will do it.
-
-Fri Jun 7 11:11:09 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (finish_function): Do access control on base destructors.
-
- * pt.c (tsubst, case FUNCTION_DECL): Set up
- IDENTIFIER_GLOBAL_VALUE for member functions so pushdecl doesn't
- hose us.
-
-Fri Jun 7 10:37:33 1996 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (build_up_reference): If we have already extended the
- lifetime of the temporary, don't try it again.
- * typeck.c (c_expand_return): Don't try and convert the return
- value twice when we want a reference, once is enough.
-
-Tue Jun 4 15:41:45 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst_expr, case DECL_STMT): Don't pass
- LOOKUP_ONLYCONVERTING at all for now.
-
- * search.c (add_conversions): Put the conversion function in
- TREE_VALUE, the basetype in TREE_PURPOSE.
- * cvt.c (build_type_conversion): Adjust.
- * cvt.c (build_expr_type_conversion): Adjust.
- * call.c (user_harshness): Adjust.
-
-Mon Jun 3 15:30:52 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (emit_thunk): Pretend this is a FUNCTION_DECL for the
- backend's benefit.
-
-Mon Jun 10 18:58:19 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_start_catch_block): Add a dummy region, if we
- get an error, so that we can avoid core dumping later.
-
-Fri May 31 14:56:13 1996 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (OFFSET_REF): Remove.
- * tree.def (CP_OFFSET_REF): Rename to OFFSET_REF.
- * expr.c (cplus_expand_expr): Cleanup callers of expand_expr.
- * init.c (expand_aggr_init_1): Likewise.
- (build_new): Likewise.
- * typeck.c (expand_target_expr): Likewise.
-
-Fri May 31 14:22:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_modify_expr): Don't use TREE_VALUE on a
- TARGET_EXPR.
-
-Wed May 29 17:04:33 1996 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (build_up_reference): Redo how and when temporaries are
- created.
- * decl.c (grok_reference_init): Don't try and be smart about
- running cleanups.
-
-Wed May 29 16:02:08 1996 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (build_up_reference): Add NULL_TREE to all calls to build
- (TARGET_EXPR...), now that it has 4 arguments.
- * tree.c (build_cplus_new): Likewise.
-
-Thu May 23 16:40:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * error.c (dump_expr, case CAST_EXPR): Handle T() properly.
-
- * pt.c (instantiate_decl): Don't call push/pop_cp_function_context.
- * decl.c (struct saved_scope): Remove named_labels,
- {base,member}_init_list.
- (maybe_push_to_top_level): Don't set them. Call
- push_cp_function_context if appropriate.
- (pop_from_top_level): Likewise.
-
- * method.c (do_build_assign_ref): Remove obsolete check of
- TYPE_HAS_ASSIGN_REF (basetype).
-
- * decl.c (grokfndecl): Diagnose user definition of
- implicitly-declared methods.
-
-Thu May 23 12:13:08 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * method.c (do_build_copy_constructor): Add code to give
- meaningful error messages instead of crashing.
- (do_build_assign_ref): Don't synthesize assignment operators for
- classes containing reference or const members.
-
- * class.c (struct base_info): Remove cant_synth_copy_ctor
- and cant_synth_asn_ref.
- (finish_base_struct): Remove the code that tries to conditionalize
- synthesis of copy constructors & assignment operators based on
- access permissions. Instead, let it fail when it tries to
- synthesize the copy constructor. This will give meaningful error
- messages instead of silently generating code to perform a bitcopy.
-
-Wed May 22 11:45:19 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * lex.c (real_yylex): Remove old-n-crufty #if 0 code for
- determining types for constant values.
-
- * decl.c (struct named_label_list): Use instead of stuffing
- random items into a TREE_LIST node.
- (named_label_uses): Use the new struct.
- (poplevel): Likewise.
- (lookup_label): Likewise.
- (define_label): Add an error message to tell the user the line
- where the goto is located in addition to the destination of the
- goto.
- (init_decl_processing): Use NULL instead of NULL_TREE to initialize
- named_label_uses.
- (finish_function): Likewise.
-
- (start_decl): Complain about defining a static data member
- in a different type from which it was declared.
-
-Wed May 22 09:33:23 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (build_expr_type_conversion): Adjust.
-
-Tue May 21 11:21:56 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_method_call): Always convert 'this' to the
- appropriate type.
-
- * search.c (add_conversions): Put the conversion function in
- TREE_VALUE, the type in TREE_PURPOSE.
- * cvt.c (build_type_conversion): Adjust.
- * call.c (user_harshness): Adjust.
-
- * method.c (emit_thunk): Call temporary_allocation and
- permanent_allocation around the ASM_OUTPUT_MI_THUNK case, too.
-
- * tree.c (build_cplus_array_type): Handle tweaking of
- TYPE_MAIN_VARIANT here.
- * typeck.c (common_type): Not here.
-
- * typeck.c (complete_type): Only try to complete an array type if
- it has a domain.
-
-Mon May 20 14:55:59 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokvardecl): Call complete_type.
- (grokdeclarator): Call complete_type for PARM_DECLs.
-
-Fri May 17 16:41:17 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Re-set
- CLASSTYPE_GOT_SEMICOLON after calling finish_struct_1.
-
-Fri May 17 14:56:55 1996 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (cp_expand_decl_cleanup): Remove, the backend is now
- smart enough to do it right.
- * tree.c (cp_expand_decl_cleanup): Likewise.
- * decl.c (cp_finish_decl): Use expand_decl_cleanup instead of
- cp_expand_decl_cleanup.
- (store_parm_decls): Likewise.
- (hack_incomplete_structures): Likewise.
- * except.c (push_eh_cleanup): Likewise.
-
-Fri May 17 13:13:51 1996 Mike Stump <mrs@cygnus.com>
-
- * expr.c (expand_expr, cond UNSAVE_EXPR): Move from the C++
- frontend to the backend where it belongs.
- * tree.c (unsave_expr): Likewise.
- (unsave_expr_now): Likewise.
- * tree.def (UNSAVE_EXPR): Likewise.
- * cp-tree.h (unsave_expr): Likewise.
- (unsave_expr_now): Likewise.
-
-Fri May 17 11:02:41 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (emit_base_init): Make sure the partial EH cleanups live
- on the function_obstack.
-
-Thu May 16 15:29:33 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * expr.c (do_case): Don't try to dereference null TREE_TYPEs
- when checking for pointer types.
-
-Thu May 16 13:38:58 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Remove obsolete check for
- access declarations.
-
-Thu May 16 13:34:15 1996 Mike Stump <mrs@cygnus.com>
+2000-02-18 Martin von Loewis <loewis@informatik.hu-berlin.de>
- * call.c (build_overload_call): Simplify calls to
- build_overload_call by removing last parameter.
- (build_method_call): Likewise.
- * cp-tree.h: Likewise.
- * method.c (build_opfncall): Likewise.
- * typeck.c (build_x_function_call): Likewise.
+ * typeck2.c (my_friendly_abort): Use GCCBUGURL.
-Thu May 16 13:15:43 1996 Mike Stump <mrs@cygnus.com>
+2000-02-17 Mark Mitchell <mark@codesourcery.com>
- * call.c (default_parm_conversions): Factor out common code.
- (build_method_call): Use it.
- (build_overload_call_real): Use it.
+ * class.c (add_method): Don't set DECL_VIRTUAL_CONTEXT.
+ * decl2.c (grokclassfn): Likewise.
-Wed May 15 14:46:14 1996 Mike Stump <mrs@cygnus.com>
+ * ir.texi: Document DECL_TEMPLATE_INSTANTIATIONS.
- * call.c (build_method_call): Allow implicit & on METHOD_TYPEs,
- but pedwarn as the code is bogus.
- * typeck.c (decay_conversion): Likewise.
- (build_function_call_real): Use build_addr_func instead of
- default_conversion. Don't allow pointer-to-method functions down
+ * decl2.c (lang_decode_option): Don't set default message length
here.
- (build_unary_op): Use real pointer-to-member functions instead of
- fake ones.
- (build_ptrmemfunc): Use build_addr_func instead of build_unary_op.
- (convert_for_assignment): Removed some obsolete code.
- * decl2.c (reparse_absdcl_as_expr): Pass current_class_ref to
- build_x_function_call instead of current_class_ptr. Only call
- digest_init once on an initializer, we do this just checking
- TREE_TYPE.
- (build_expr_from_tree): Pass current_class_ref to
- build_x_function_call instead of current_class_ptr.
- * init.c (build_member_call): Likewise.
- * pase.y: Likewise.
- * error.c (dump_expr): Handle OFFSET_REFs better.
- * pt.c (unify): Handle pointer-to-member functions better.
- * decl.c (finish_function): Clear out current_class_ref just like
- we do for current_class_ptr.
-
- * typeck.c (get_delta_difference): Handle virtual bases better.
-
-Tue May 14 16:37:37 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * sig.c (build_signature_table_constructor): Use the delta for
- the original basetype for this virtual function with thunks.
- (build_signature_method_call): We still need to adjust 'this'
- with thunks.
-
-Tue May 14 16:27:25 1996 Mike Stump <mrs@cygnus.com>
-
- * call.c (build_addr_func): New routine. Used to get the `real'
- address of a function or a method. Needed to avoid getting a
- pointer-to-member function.
- (build_call): New routine to build CALL_EXPRs.
- (build_method_call): Use it.
- * cvt.c (convert_to_aggr): Likewise.
- * typeck.c (build_function_call_real): Likewise.
- * sig.c (build_signature_table_constructor): Use build_addr_func.
- * cp-tree.h (build_call, build_addr_func): Declare them.
-
-Tue May 14 12:47:47 1996 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (LOOKUP_AGGR): Remove, unused.
- * parse.y: Remove uses of LOOKUP_AGGR.
-
-Tue May 14 12:07:51 1996 Mike Stump <mrs@cygnus.com>
-
- * *.[chy]: Rename current_class_decl to current_class_ptr, and
- C_C_D to current_class_ref.
-
-Mon May 13 16:55:23 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (convert_harshness): Tighten up pointer conversions.
-
-Sat May 11 04:33:50 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * decl2.c (finish_vtable_vardecl): Surround DECL_ONE_ONLY with ifdef.
- (finish_file): Likewise.
-
-Fri May 10 11:09:57 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (convert_fn_ptr): We don't use thunks for pmfs.
-
- * method.c (emit_thunk): Set flag_omit_frame_pointer in default
- code.
-
-Thu May 9 18:18:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c: Turn on thunks by default where supported.
-
-Tue May 7 20:39:57 1996 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (build_overload_call_maybe): Removed.
- * call.c (build_overload_call_real): Invert meaning of last arg to
- be require_complete.
- (build_overload_call): Likewise.
- * typeck.c (build_x_function_call): Use build_overload_call_real
- instead of build_overload_call_maybe.
-
-Mon May 6 01:23:32 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_file): Don't try to emit functions that haven't
- been compiled.
-
-Fri May 3 09:30:13 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_vtable_vardecl): Oops.
-
- * decl.c (maybe_push_to_top_level): Do save previous_class_*.
- Also store the bindings from previous_class_values.
- (pop_from_top_level): Restore them.
-
-Thu May 2 21:56:49 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_vtable_vardecl): Only write out vtable if its
- symbol has been referenced.
- (finish_file): Re-join synthesis/vtable loop with inline emission
- loop, disable inlining when an inline is output.
-
-Thu May 2 17:20:02 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (init_exception_processing): Setup saved_in_catch.
- (push_eh_cleanup): Reset __eh_in_catch.
- (expand_start_catch_block): Set __eh_in_catch.
-
-Thu May 2 16:21:17 1996 Mike Stump <mrs@cygnus.com>
+ * lex.c (lang_init_options): Set it here.
+
+2000-02-16 Mark Mitchell <mark@codesourcery.com>
+
+ Make DECL_CONTEXT mean the class in which a member function was
+ declared, even for a virtual function.
+ * cp-tree.h (DECL_CLASS_CONTEXT): Adjust.
+ (DECL_FRIEND_CONTEXT): New macro.
+ (DECL_REAL_CONTEXT): Remove.
+ (SET_DECL_FRIEND_CONTEXT): Likewise.
+ (DECL_VIRTUAL_CONTEXT): Adjust.
+ (DECL_CLASS_SCOPE_P): Use TYPE_P.
+ (add_friends): Remove.
+ (hack_decl_function_context): Likewise.
+ * call.c (build_new_function_call): Replace DECL_REAL_CONTEXT with
+ CP_DECL_CONTEXT.
+ (build_over_call): Fix indentation. Use DECL_CONTEXT
+ instead of DECL_CLASS_CONTEXT.
+ * class.c (dfs_build_vcall_offset_vtbl_entries): Likewise.
+ (add_method): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT.
+ (strictly_overrides): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
+ (build_vtbl_or_vbase_field): Don't set DECL_CLASS_CONTEXT.
+ (build_base_field): Likewise.
+ (finish_struct_1): Likewise.
+ (build_self_reference): Likewise.
+ * decl.c (push_class_binding): Use CP_DECL_CONTEXT, not
+ DECL_REAL_CONTEXT.
+ (pushtag): Use decl_function_context, not
+ hack_decl_function_context.
+ (decls_match): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT.
+ (duplicate_decls): Use DECL_VIRTUAL_CONTEXT.
+ (pushdecl): Remove bogus code.
+ (start_decl): Use DECL_CONTEXT rather than DECL_CLASS_CONTEXT.
+ (cp_finish_decl): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT.
+ (grokfndecl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
+ Use decl_function_context, nothack_decl_function_context.
+ (grokvardecl): Don't set DECL_CLASS_CONTEXT.
+ (grokdeclarator): Likewise. Use decl_function_context, not
+ hack_decl_function_context.
+ (copy_args_p): Document. Don't use DECL_CLASS_CONTEXT.
+ (start_function): Use DECL_FRIEND_CONTEXT, not
+ DECL_CLASS_CONTEXT. Use decl_function_context, not
+ hack_decl_function_context.
+ (finish_function): Use decl_function_context, not
+ hack_decl_function_context.
+ (maybe_retrofit_in_chrg): Use DECL_CONTEXT, not
+ DECL_CLASS_CONTEXT.
+ (grokclassfn): Set DECL_VIRTUAL_CONTEXT, not DECL_CONTEXT.
+ (finish_static_data_member_decl): Don't set DECL_CLASS_CONTEXT.
+ (grokfield): Likewise.
+ (finish_builtin_type): Likewise.
+ (finish_vtable_vardec): Use decl_function_context, not
+ hack_decl_function_context.
+ (import_export_decl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
+ (start_static_initialization_or_destruction): Likewise.
+ (finish_static_initialization_or_destruction): Likewise.
+ (mark_used): Adjust logic for deciding when to synthesize methods.
+ * dump.c (dequeue_and_dump): Use CP_DECL_CONTEXT, not
+ DECL_REAL_CONTEXT.
+ * error.c (dump_function_decl): Use DECL_CONTEXT, not
+ DECL_CLASS_CONTEXT.
+ * friend.c (is_friend): Likewise.
+ (add_friends): Remove.
+ (do_friend): Use SET_DECL_FRIEND_CONTEXT.
+ * lex.c (begin_definition_of_inclass_inline): Use
+ decl_function_context, not hack_decl_function_context.
+ (process_next_inline): Likewise.
+ (do_identifier): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT.
+ * method.c (set_mangled_name_for_decl): Use DECL_CONTEXT, not
+ DECL_CLASSS_CONTEXT.
+ (hack_identifier): Likewise.
+ (synthesize_method): Use decl_function_context, not
+ hack_decl_function_context.
+ * pt.c (template_class_depth_real): Use CP_DECL_CONTEXT, not
+ DECL_REAL_CONTEXT.
+ (is_member_template): Use decl_function_context, not
+ hack_decl_function_context. Use DECL_CONTEXT, not
+ DECL_CLASS_CONTEXT.
+ (build_template_decl): Set DECL_VIRTUAL_CONTEXT, not
+ DECL_CLASS_CONTEXT.
+ (check_default_tmpl_args): Use CP_DECL_CONTEXT, not
+ DECL_REAL_CONTEXT.
+ (push_template_decl_real): Likewise.
+ (instantiate_class_template): Don't call add_friends.
+ (tsubst_default_argument): Use DECL_CONTEXT, not
+ DECL_REAL_CONTEXT.
+ (tsubst_decl): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT.
+ Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
+ (set_meangled_name_for_template_decl): Use DECL_CONTEXT, not
+ DECL_CLASS_CONTEXT.
+ * repo.c (repo_inline_used): Likewise.
+ * search.c (current_scope): Adjust for new _CONTEXT macros.
+ (context_for_name_lookup): Use CP_DECL_CONTEXT, not
+ DECL_REAL_CONTEXT.
+ (friend_accessible_p): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
+ (lookup_fnfields_here):Likewise.
+ (check_final_overrider): Likewise.
+ (init_vbase_pointers): Likewise.
+ (virtual_context): Likewise.
+ * semantics.c (finish_member_declaration): Just set DECL_CONTEXT.
+ (expand_body): Use decl_function_context, not
+ hack_decl_function_context.
+ * tree.c (hack_decl_function_context): Remove.
+ * typeck.c (build_x_function_call): Use DECL_CONTEXT, not
+ DECL_CLASS_CONTEXT.
+ * typeck2.c (error_not_base_type): Likewise.
- * except.c (push_eh_cleanup): Add tracking for whether or not we
- have an active exception object.
- (expand_builtin_throw): Use it to make sure a rethrow without an
- exception object is caught.
+2000-02-15 Jason Merrill <jason@casey.cygnus.com>
-Thu May 2 11:26:41 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (xref_tag): Don't SET_IDENTIFIER_NAMESPACE_VALUE.
- * decl.c (maybe_push_to_top_level): Clear out class-level bindings
- cache.
+2000-02-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-Wed May 1 11:26:52 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * Make-lang.in (g++spec.o): Depend on $(GCC_H), not gcc.h.
- * decl2.c (finish_file): Also use sentries for vars with
- DECL_ONE_ONLY or DECL_WEAK set (should any such happen to be
- created).
+2000-02-15 Jonathan Larmour <jlarmour@redhat.co.uk>
- * lex.c (handle_cp_pragma): Disable #pragma
- interface/implementation if SUPPORTS_ONE_ONLY > 1.
+ * lang-specs.h: Add new __GNUC_PATCHLEVEL__ define to default spec.
-Tue Apr 30 11:25:46 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-01-16 Gabriel Dos Reis <gdr@codesourcery.com>
- * method.c (emit_thunk): Wrap default case in
- temporary/permanent_allocation.
+ * decl2.c (lang_decode_option): Enable automatic line wrapping.
- * method.c (make_thunk): Use DECL_ONE_ONLY.
- (emit_thunk): Call assemble_end_function.
+2000-02-13 Jason Merrill <jason@casey.cygnus.com>
-Mon Apr 29 15:38:29 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * parse.y (frob_specs): Split out...
+ (parse_decl): From here.
+ (fn.def2): Call initial_deferred_type_access_control.
+ (after_type_component_declarator0): Call frob_specs.
+ (notype_component_declarator0): Likewise.
+ * search.c (friend_accessible_p): Nested classes are friends of their
+ enclosing classes.
- * decl2.c (import_export_vtable): Use DECL_ONE_ONLY.
- (import_export_decl): Likewise.
- (finish_prevtable_vardecl): Disable vtable hack if
- SUPPORTS_ONE_ONLY > 1.
+2000-02-10 Mark Mitchell <mark@codesourcery.com>
-Mon Apr 29 14:32:47 1996 Mike Stump <mrs@cygnus.com>
+ * ir.texi (ADDR_EXPR): Document the fact that an ADDR_EXPR can be
+ used to create an implicit temporary.
- * typeck.c (build_modify_expr): PREINCREMENT_EXPR and
- PREDECREMENT_EXPRs take two arguments, not one.
+ * class.c (dfs_modify_vtables): Tweak calculation of functions to
+ override.
-Mon Apr 29 00:27:53 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-02-08 Nathan Sidwell <nathan@acm.org>
- * class.c (build_vtable_entry): Don't build thunks for abstract
+ * typeck.c (strip_all_pointer_quals): Use TYPE_MAIN_VARIANT, to
+ strip array element qualifiers too.
+
+2000-02-07 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (store_parm_decls): Don't build cleanups for parameters
+ while processing_template_decl.
+
+2000-02-07 Jason Merrill <jason@casey.cygnus.com>
+
+ * cp-tree.h (struct saved_scope): Add incomplete field.
+ (namespace_scope_incomplete): New macro.
+ * decl.c (pushdecl): Use it.
+ (hack_incomplete_structures): Use it. See through artificial
+ binding levels.
+ (mark_saved_scope): Mark it.
+
+ Implement access control for nested types.
+ * search.c (type_access_control): New fn.
+ (accessible_p): Now we do perform access control for types.
+ * semantics.c (deferred_type_access_control): New fn.
+ (initial_deferred_type_access_control): New fn.
+ (begin_function_definition): Call it. Add lookups parm.
+ * decl.c (struct binding_level): Add this_class field.
+ (pushlevel_class): Set it.
+ (mark_binding_level): Mark it.
+ (lookup_name_real): Use it. Call type_access_control.
+ (mark_saved_scope): Mark lookups field.
+ * cp-tree.h (flagged_type_tree): Add lookups field.
+ (struct saved_scope): Add lookups field.
+ (type_lookups): New macro.
+ * parse.y (declmods): Now <ftype>.
+ (parse_decl): Add lookups parm. Call
+ initial_deferred_type_access_control.
+ (lang_extdef): Clear type_lookups.
+ (typed_declspecs, declmods, typespec): Set lookups field.
+ (initdcl): Call deferred_type_access_control.
+ (fn.def1, fn.def2, typed_declspecs1, initdcl0_innards, nomods_initdcl0,
+ component_decl_1, named_parm): Adjust.
+ * friend.c (is_friend): Nested classes are friends of their
+ enclosing classes.
+
+ * class.c (currently_open_derived_class): New fn.
+ * method.c (hack_identifier): Use it.
+
+ * lex.c (do_identifier): Remove obsolete code.
+
+ * parse.y (typed_typespecs): Propagate new_type_flag properly.
+
+2000-02-05 Zack Weinberg <zack@wolery.cumb.org>
+
+ * tinfo.h: Remove apostrophes from C++ comment (xgettext
+ thinks this file is plain C).
+
+2000-02-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (call.o): Depend on $(EXPR_H).
+
+ * call.c: Include "expr.h".
+
+ * class.c (dump_class_hierarchy): Add prototype.
+
+ * search.c (dfs_get_pure_virtuals): Likewise.
+
+2000-02-1 Ulrich Drepper <drepper@redhat.com>
+
+ * parse.y (simple_stmt): Allow :: token in asm parameter list.
+ * parse.c: Rebuilt.
+
+Mon Jan 31 15:35:29 2000 Jim Wilson <wilson@cygnus.com>
+
+ * class.c (build_vtbl_or_vbase_field): New parameter fcontext.
+ Store it in DECL_FCONTEXT.
+ (build_vbase_pointer_fields, create_vtable_ptr): Fix callers.
+
+2000-01-31 Jason Merrill <jason@casey.cygnus.com>
+
+ * tinfo.h (old abi): #include "tconfig.h".
+ * tinfo.cc (convert_to_base): Move into old abi section.
+
+2000-01-31 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (BINFO_VIRTUALS): Tweak documentation.
+ (CLASSTYPE_PRIMARY_BINFO): Use BINFO_PRIMARY_BINFO.
+ (BINFO_PRIMARY_BINFO): New macro.
+ (BF_DELTA): Rename to ...
+ (BV_DELTA): ... this.
+ (BF_VCALL_INDEX): Rename to ...
+ (BV_VCALL_INDEX): ... this.
+ (BF_FN): Rename to ...
+ (BV_FN): ... this.
+ * class.c (build_vbase_path): Adjust for changes to reverse_path.
+ (set_rtti_entry): Rename BF_ macros to BV_ variants.
+ (modify_vtable_entry): Simplify.
+ (add_virtual_function): Rename BF_ macros to BV_ variants.
+ (build_vtable_initializer): Likewise.
+ (get_class_offset_1): Remove.
+ (dfs_get_class_offset): Likewise.
+ (get_class_offset): Likewise.
+ (dfs_find_final_overrider): New function.
+ (find_final_overrider): Likewise.
+ (modify_one_vtable): Remove.
+ (dfs_find_base): New function.
+ (dfs_modify_vtables): Fold modify_one_vtable in here. Use
+ find_final_overrider.
+ (modify_all_vtables): Adjust. Set BV_VCALL_INDEX on new
virtuals.
+ (dfs_fixup_vtable_deltas): Remove.
+ (override_one_vtable): Remove.
+ (merge_overrides): Likewise.
+ (layout_virtual_bases): Make sure BINFO_OFFSET is set right for
+ unreal chilren of virtual bases.
+ (finish_struct_1): Don't use merge_overrides. Don't use
+ dfs_fixup_vtable_deltas.
+ * tree.c (reverse_path): Return a TREE_LIST, not a chain of
+ BINFOs.
+
+2000-01-31 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
+ Jason Merrill <jason@yorick.cygnus.com>
+
+ * tinfo.h: Rename USItype to myint32, depend on BITS_PER_UNIT.
+
+2000-01-31 Alfred Minarik <a8601248@unet.univie.ac.at>
+
+ * exception.cc (__throw_bad_typeid): Add missing std::.
+
+2000-01-31 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h (make_thunk): PROTO -> PARAMS.
+
+2000-01-31 Nathan Sidwell <sidwell@codesourcery.com>
+
+ * cp-tree.h (new_abi_rtti_p): Use flag_new_abi.
+
+ Runtime support for new-abi rtti.
+ * inc/typeinfo (type_info::operator!=): Define in class.
+ (type_info::before, type_info::name, type_info::operator==,
+ type_info::operator!=): Define new ABI implementations.
+ (type_info::is_pointer_p, type_info::is_function_p): Declare
+ new virtual functions.
+ (type_info::do_catch, type_info::do_upcast): Likewise.
+
+ * tinfo.h (__base_class_info): Define new class.
+ (__class_type_info): Likewise.
+ (__si_class_type_info): Likewise.
+ (__vmi_class_type_info): Likewise.
+ (__dynamic_cast): Prototype.
+
+ * tinfo.cc: Conditionalize old and new rtti mechanisms.
+ (type_info::is_pointer_p): Define new function.
+ (type_info::is_function_p): Likewise.
+ (type_info::do_catch): Likewise.
+ (type_info::do_upcast): Likewise.
+ (vtable_prefix): New structure for vtable access.
+ (adjust_pointer): Define new template function.
+ (contained_p, public_p, virtual_p, contained_public_p,
+ contained_nonpublic_p, contained_nonvirtual_p): Define new
+ functions.
+ (nonvirtual_base_type): New local variable.
+ (__class_type_info::~__class_type_info): Define.
+ (__si_class_type_info::~__si_class_type_info): Likewise.
+ (__vmi_class_type_info::~__vmi_class_type_info): Likewise.
+ (__class_type_info::do_catch): Define new function.
+ (__class_type_info::do_upcast): Likewise.
+ (__class_type_info::find_public_src): Likewise.
+ (__class_type_info::do_find_public_src): Likewise.
+ (__si_class_type_info::do_find_public_src): Likewise.
+ (__vmi_class_type_info::do_find_public_src): Likewise.
+ (__class_type_info::do_dyncast): Likewise.
+ (__si_class_type_info::do_dyncast): Likewise.
+ (__vmi_class_type_info::do_dyncast): Likewise.
+ (__class_type_info::do_upcast): Likewise.
+ (__si_class_type_info::do_upcast): Likewise.
+ (__vmi_class_type_info::do_upcast): Likewise.
+ (__dynamic_cast): Likewise.
+
+ * tinfo2.cc (__fundamental_type_info): Define new class.
+ (__pointer_type_info): Likewise.
+ (__reference_type_info): Likewise.
+ (__array_type_info): Likewise.
+ (__function_type_info): Likewise.
+ (__enum_type_info): Likewise.
+ (__ptr_to_member_type_info): Likewise.
+ (__fundamental_type_info::~__fundamental_type_info): Define.
+ (__pointer_type_info::~__pointer_type_info): Likewise.
+ (__reference_type_info::~__reference_type_info): Likewise.
+ (__array_type_info::~__array_type_info): Likewise.
+ (__function_type_info::~__function_type_info): Likewise.
+ (__enum_type_info::~__enum_type_info): Likewise.
+ (__ptr_to_member_type_info::~__ptr_to_member_type_info): Likewise.
+ (__pointer_type_info::do_catch): Define new function.
+ (__ptr_to_member_type_info::do_catch): Define new function.
+
+ (__throw_type_match_rtti_2): Use new ABI interface, if enabled.
+ (__is_pointer): Likewise.
+
+ * exception.cc (__cplus_type_matcher): Deal with new-abi rtti.
+
+2000-01-30 Mark Mitchell <mark@codesourcery.com>
+
+ * cp/class.c (build_vtable): Rename to build_primary_vtable.
+ (prepare_fresh_vtable): Rename to build_secondary_vtable.
+ (make_new_vtable): New function.
+ (modify_vtable_entry): Handle generation of new vtables correctly.
+ (modify_one_vtable): Remove unused parameter.
+ (dfs_fixup_vtable_deltas): Likewise.
+ (override_one_vtable): Use build_secondary_vtable.
+ (finish_struct_1): Use build_primary_vtable and
+ build_secondary_vtable.
+
+2000-01-28 Ulrich Drepper <drepper@redhat.com>
+
+ * cp/decl.c: Adjust variable names, comments, help strings.
+
+2000-01-29 Nathan Sidwell <nathan@acm.org>
+
+ * new2.cc (operator delete[]): Use operator delete, don't assume
+ implementation.
- * lex.c (real_yylex): Fix handling of __PRETTY_FUNCTION__ like C
- frontend.
-
-Sat Apr 27 16:45:35 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (set_rtti_entry): Use size_zero_node.
- (build_vtable): Likewise.
+2000-01-29 Nathan Sidwell <sidwell@codesourcery.com>
+
+ * class.c (build_vtbl_initializer): Add argument to
+ build_vtable_entry call.
+
+2000-01-27 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.def (THUNK_DECL): Discuss vcall indices.
+ * cp-tree.h (BINFO_VIRTUALS): Update documentation.
+ (BF_DELTA): New macro.
+ (BF_VCALL_INDEX): Likewise.
+ (BF_FN): Likewise.
+ (THUNK_VCALL_OFFSET): Likewise.
+ (make_thunk): Change prototype.
+ * class.c (build_vtable_entry): Integrate
+ build_vtable_entry_for_fn. Handle vcall indices.
+ (build_vtable_entry_for_fn): Remove.
+ (set_rtti_entry): Handle vcall indices. Use BF_DELTA,
+ BF_VCALL_INDEX, BF_FN.
+ (modify_vtable_entry): Integrate common code from
+ modify_one_vtable and dfs_fixup_vtable_deltas.
+ (add_virtual_function): Set BF_VCALL_INDEX.
+ (build_vtbl_initializer): Simplify. Use BF_DELTA, BF_VCALL_INDEX,
+ and BF_FN.
+ (modify_one_vtable): Simplify.
+ (dfs_fixup_vtable_deltas): Likewise.
+ (override_one_vtable): Use BF_DELTA, BF_VCALL_INDEX, BF_FN.
+ * method.c (make_thunk): Handle vcall indices.
+
+2000-01-28 Nathan Sidwell <sidwell@codesourcery.com>
+
+ Compiler side new abi rtti (not enabled).
+ * cp-tree.h (new_abi_rtti_p): New macro.
+ (emit_support_tinfos): Prototype new function.
+ (tinfo_decl_p): Likewise.
+ (emit_tinfo_decl): Likwise.
+ * rtti.c (TINFO_PSEUDO_TYPE, TINFO_VTABLE_DECL): New accessor
+ macros.
+ (doing_runtime): New local static.
+ (init_rtti_processing): Add new-abi initializer.
+ (get_tinfo_decl): Add new-abi logic.
+ (tinfo_from_decl): Likewise.
+ (build_dynamic_cast_1): Likewise.
+ (qualifier_flags): New static function.
+ (tinfo_base_init): Likewise.
+ (generic_initializer): Likewise.
+ (ptr_ref_initializer): Likewise.
+ (ptmd_initializer): Likewise.
+ (class_hint_flags): Likewise.
+ (class_initializer): Likewise.
+ (synthesize_tinfo_var): Likewise.
+ (create_real_tinfo_var): Likewise.
+ (create_pseudo_type_info): Likewise.
+ (get_vmi_pseudo_type_info): Likewise.
+ (create_tinfo_types): Likewise.
+ (emit_support_tinfos): New global function.
+ (tinfo_decl_p): New global predicate.
+ (emit_tinfo_decl): New global function.
+ * class.c (set_rtti_entry): Generalize for old and new rtti.
+ (build_vtbl_initializer): Likewise.
+ * decl2.c (finish_file): Likewise.
-Sat Apr 27 14:48:57 1996 Jason Merrill <jason@phydeaux.cygnus.com>
+Thu Jan 27 20:53:36 2000 Jim Wilson <wilson@cygnus.com>
- * class.c (finish_struct_1): Pass size_zero_node to set_rtti_entry.
- (prepare_fresh_vtable): Likewise.
+ * optimize.c (remap_decl): Add walk_tree calls for DECL_SIZE (t)
+ and TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (t))).
-Fri Apr 26 13:14:14 1996 Jason Merrill <jason@yorick.cygnus.com>
+Thu Jan 27 13:54:12 2000 Mike Stump <mrs@wrs.com>
- * method.c (emit_thunk): Call mark_used on the target function.
+ * decl.c (pushdecl): Fix up shadow warnings with respect to implicit
+ for scopes.
- * call.c (build_method_call): Don't warn about pending templates.
+2000-01-26 Jason Merrill <jason@casey.cygnus.com>
-Thu Apr 25 14:55:44 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * pt.c (unify): Use fold, not maybe_fold_nontype_arg.
- * decl2.c (finish_file): Fix list walking logic.
+Wed Jan 26 22:19:14 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
- * typeck2.c (check_for_new_type): Only warn if -pedantic.
+ * optimize.c (calls_setjmp_r): Supply new argument
+ to special_function_p.
-Wed Apr 24 15:41:15 1996 Bob Manson <manson@charmed.cygnus.com>
+2000-01-26 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * class.c (finish_struct_1): Remove old code for
- dont_allow_type_definitions.
+ * call.c: PROTO -> PARAMS.
+ * class.c: Likewise.
* cp-tree.h: Likewise.
- * spew.c: Make sure cp-tree.h is included before parse.h, so the
- definition of flagged_type_tree is found before it is used.
+ * cvt.c: Likewise.
+ * decl.c: Likewise.
+ * decl.h: Likewise.
+ * decl2.c: Likewise.
+ * dump.c: Likewise.
+ * errfn.c: Likewise.
+ * error.c: Likewise.
+ * except.c: Likewise.
+ * expr.c: Likewise.
+ * init.c: Likewise.
+ * input.c: Likewise.
* lex.c: Likewise.
- * parse.y: Added the ftype member to the type union, and changed a
- number of rules to use it instead of ttype. Added calls to
- check_for_new_type() as appropriate.
- * typeck2.c (check_for_new_type): New function for checking
- if a newly defined type appears in the specified tree.
- * cp-tree.h: Add new type flagged_type_tree. Add a prototype
- for check_for_new_type().
-
-Wed Apr 24 00:36:21 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_file): Only use a sentry if the decl is public.
-
- * pt.c (tsubst_expr, DECL_STMT): If we don't have an initializer,
- don't pass LOOKUP_ONLYCONVERTING.
-
-Tue Apr 23 17:18:47 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (common_type): Fix the ARRAY_TYPE case so it
- properly keeps track of const and volatile type modifiers.
-
-Tue Apr 23 10:52:56 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (cp_tree_equal): C++ version of simple_cst_equal.
- * pt.c (comp_template_args): Use it.
-
- * rtti.c (get_tinfo_fn, build_dynamic_cast, expand_*_desc): Call
- assemble_external for artificial function decls.
-
- * decl.c (cp_finish_decl): Oops.
-
-Mon Apr 22 17:28:27 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (import_export_decl): Put static data member templates
- into common storage, or make them weak, depending on whether they
- are dynamically or statically initialized.
- (get_sentry): New function.
- (finish_file): Do import_export_decl for static data members before
- building the init/fini functions. Don't init/fini a variable that's
- EXTERNAL. Use a sentry for variables in common. Fix mismatching
- push/pop_temp_slots.
- * decl.c (cp_finish_decl): If DECL_NOT_REALLY_EXTERN, do the
- expand_static_init thang.
- * method.c (get_id_2): New function.
-
-Mon Apr 22 15:32:45 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * parse.y (empty_parms): Make sure we use C++-style prototypes
- when we're declaring member functions.
-
-Sun Apr 21 10:08:22 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * Makefile.in (CONFLICTS): 16 s/r conflicts.
- * parse.y (self_template_type): New nonterminal.
-
-Thu Apr 18 08:56:54 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (make_typename_type): Handle getting a TYPE_DECL for a
- name.
- * parse.y (base_class.1): Allow 'typename foo::bar'.
-
- * lex.c (check_newline): Remove #pragma code that plays with the
- input stream, since we now deal with tokens. Clear nextchar when
- we're done.
- (handle_cp_pragma): Use real_yylex.
- (handle_sysv_pragma): Don't do skipline here. Only call real_yylex
- in one place.
-
- * lex.c (check_for_missing_semicolon): Handle SELFNAME.
-
- * lex.c (handle_cp_pragma): Fix "#pragma implementation".
-
-Wed Apr 17 16:51:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y: New token SELFNAME for potential constructor.
- * spew.c (yylex): Handle it.
- * lex.c (identifier_type): Produce it.
-
- * parse.y (complete_type_name): In :: case, don't push class binding.
- (complex_type_name): Likewise.
-
-Wed Apr 17 15:02:40 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_reinterpret_cast): Handle pointer to member
- functions.
-
-Wed Apr 17 12:28:26 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * lex.c (handle_cp_pragma): New function, with decl, doing the cc1plus
- pragmas.
- (check_newline): Put the vtable/unit/implementation/interface pragma
- code into handle_cp_pragma, replacing it with a call.
- (handle_sysv_pragma): Give int return type, and take FINPUT and TOKEN
- args. Get the next token after handling the pragma token.
-
-Wed Apr 17 10:28:34 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (cp_convert_to_pointer): Avoid doing base analysis on pmfs.
- (convert_to_pointer_force): Likewise.
-
- * init.c (build_new): Fix array new without -fcheck-new.
-
-Tue Apr 16 13:44:58 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h, call.c, class.c, decl.c, parse.y, pt.c, rtti.c,
- tree.c: Lose TYPE_NESTED_NAME.
-
- * parse.y (nested_name_specifier_1): Don't treat non-identifiers
- as identifiers.
-
- * tree.def: Add VEC_INIT_EXPR.
- * expr.c (cplus_expand_expr): Handle it.
- * init.c (build_new): Use it instead of the RTL_EXPR nastiness and
- the extra file-scope symbol nastiness.
-
-Mon Apr 15 16:21:29 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (make_thunk): Thunks are static.
- (emit_thunk): Use ASM_OUTPUT_MI_THUNK if it's defined.
-
- * decl2.c (mark_vtable_entries): Emit thunks as needed.
- (finish_file): Don't emit them here.
-
-Sun Apr 14 11:34:39 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * lex.h: Likewise.
+ * method.c: Likewise.
+ * optimize.c: Likewise.
+ * parse.y: Likewise.
+ * pt.c: Likewise.
+ * repo.c: Likewise.
+ * rtti.c: Likewise.
+ * search.c: Likewise.
+ * semantics.c: Likewise.
+ * spew.c: Likewise.
+ * tree.c: Likewise.
+ * typeck.c: Likewise.
+ * typeck2.c: Likewise.
+ * xref.c: Likewise.
- * rtti.c (build_dynamic_cast): Handle null pointers.
- (ifnonnull): New function.
+2000-01-25 Richard Henderson <rth@cygnus.com>
-Fri Apr 12 09:08:27 1996 Bob Manson <manson@charmed.cygnus.com>
+ * typeck.c (build_binary_op_nodefault): Remove UNNE_EXPR.
- * call.c (build_method_call): Remember the original basetype we
- were called with. Give an error message instead of trying
- (incorrectly) to call a non-static member function through a
- non-inherited class.
+2000-01-25 Mark Mitchell <mark@codesourcery.com>
- * search.c (expand_upcast_fixups): Mark the new fixup as
- DECL_ARTIFICIAL.
+ * cp-tree.h (vcall_offset_in_vtable_p): New macro.
+ * class.c (build_vbase_offset_vtbl_entries): Fix typo in commment.
+ (struct vcall_offset_data_s): New type.
+ (dfs_vcall_offset_queue_p): New function.
+ (dfs_build_vcall_offset_vtbl_entries): Likewise.
+ (build_vcall_offset_vtbl_entries): Likewise.
+ (layout_vtable_decl): Likewise.
+ (num_vfun_entries): Likewise.
+ (num_extra_vtbl_entries): Add the entries for vcall offsets.
+ (build_vtbl_initializer): Likewise.
+ (dfs_finish_vtabls): Use layout_vtable_decl.
+ (modify_one_vtables): Always duplicate vtables under the new ABI.
+ (finish_struct_1): Use layout_vtable_decl.
-Thu Apr 11 03:57:09 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-01-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * init.c (build_new): Use a TARGET_EXPR for alloc_expr.
+ * decl.c (member_function_or_else): Change third arg from a format
+ specifier to an `enum overload_flags'. Callers changed.
- * class.c (set_rtti_entry): Fix for thunks.
+2000-01-25 Gabriel Dos Reis <gdr@codesourcery.com>
- * decl2.c (import_export_decl): Still emit typeinfo fns for
- cv-variants of builtin types.
+ * typeck.c (composite_pointer_type, c_sizeof, expr_sizeof,
+ build_binary_op_nodefault, build_unary_op, build_reinterpret_cast,
+ build_const_cast, get_delta_difference, check_return_expr): Avoid
+ ANSI string concatenation usage.
- * rtti.c (expand_class_desc): Set up base_info_type_node here.
- (init_rtti_processing): Instead of here.
+2000-01-24 Mark Mitchell <mark@codesourcery.com>
-Wed Apr 10 14:17:13 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * class.c (layout_class_type): Put the fields required to make a
+ class non-empty at the end, not the beginning, of the TYPE_FIELDs
+ list.
- * rtti.c (init_rtti_processing): Do init regardless of -frtti.
- (build_typeid): Only complain about taking dynamic typeid without
- -frtti.
+2000-01-24 Jason Merrill <jason@casey.cygnus.com>
- * decl2.c: flag_rtti defaults to 1.
+ * pt.c (maybe_fold_nontype_arg): Do nothing if we're not in a
+ template.
- * rtti.c (get_tinfo_var): The general class case is now smaller.
- (init_rtti_processing): Pack the latter three fields of base_info
- into 32 bits.
+ * decl2.c (mark_used): Do instantiate inlines that have been
+ explicitly instantiated.
-Wed Apr 10 13:50:14 1996 Mike Stump <mrs@cygnus.com>
+2000-01-24 Richard Henderson <rth@cygnus.com>
- * init.c (expand_member_init): Don't dump if name is NULL_TREE.
+ * call.c (build_over_call): Use expand_tree_builtin.
+ * typeck.c (build_function_call_real): Likewise.
+ (build_binary_op_nodefault): Handle unordered compares.
+
+2000-01-24 Nathan Sidwell <sidwell@codesourcery.com>
+
+ * cp-tree.h (CPTI_BAD_CAST, CPTI_BAD_TYPEID, CPTI_DCAST): New
+ cp_tree_index values.
+ (throw_bad_cast_node, throw_bad_typeid_node, dynamic_cast_node):
+ New global node #defines for them.
+ * rtti.c (call_void_fn): Replace with ...
+ (build_runtime_decl): ... new static function.
+ (throw_bad_cast): Use throw_bad_cast_node and build_runtime_decl.
+ (throw_bad_typeid): Use throw_bad_typeid_node and build_runtime_decl.
+ (build_dynamic_cast_1): Always produce correctly typed result.
+ Explicitly produce type_info addresses. Use dynamic_cast_node.
+ * exception.cc (__throw_bad_cast): Return `void *'.
+ (__throw_bad_typeid): Return `const type_info &'.
+
+2000-01-24 Nathan Sidwell <sidwell@codesourcery.com>
+
+ * cp-tree.h (get_vtable_decl): Prototype new function.
+ * class.c (get_vtable_decl): New function. Broken out from ...
+ (build_vtable): ... here. Use it.
+ * decl2.c (finish_vtable_vardecl): Ignore dummy vtables created
+ by get_vtable_decl.
+
+2000-01-24 Nathan Sidwell <sidwell@codesourcery.com>
+
+ * cp-tree.h (CPTI_TP_DESC_TYPE, CPTI_ACCESS_MODE_TYPE,
+ CPTI_USER_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_ATTR_DESC_TYPE,
+ CPTI_PTMF_DESC_TYPE): Remove cp_tree_index enumerations.
+ (CPTI_TI_DESC_TYPE, CPTI_REF_DESC_TYPE, CPTI_ARY_DESC_TYPE,
+ CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE,
+ CPTI_VMI_CLASS_DESC_TYPE, CPTI_BASE_DESC_TYPE): New enumerations.
+ (CPTI_TINFO_FN_ID, CPTI_TINFO_FN_TYPE): Rename to ...
+ (CPTI_TINFO_DECL_ID, CPTI_TINFO_DECL_TYPE): ... here.
+ (CPTI_TINFO_VAR_ID): New enumeration.
+ (__tp_desc_type_node, __access_mode_type_node,
+ __bltn_desc_type_node, __user_desc_type_node,
+ __class_desc_type_node, __ptr_desc_type_node,
+ __attr_desc_type_node, __func_desc_type_node,
+ __ptmf_desc_type_node, __ptmd_desc_type_node): Remove #defines.
+ (ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node,
+ ref_desc_type_node, ary_desc_type_node, func_desc_type_node,
+ enum_desc_type_node, class_desc_type_node,
+ si_class_desc_type_node, vmi_class_desc_type_node,
+ ptmd_desc_type_node, base_desc_type_node): New #defines.
+ (tinfo_fn_id, tinfo_fn_type): Rename to ...
+ (tinfo_decl_id, tinfo_decl_type): ... here. Adjust.
+ (tinfo_var_id): New enumeration.
+ (DECL_TINFO_FN_P): Augment comment.
+ * decl.c (cp_global_trees): Adjust documentation.
+ * rtti.c (init_rtti_processing): Adjust for tinfo_decl_id,
+ tinfo_decl_type and tinfo_var_id.
+ (get_tinfo_decl_dynamic): Adjust for tinfo_decl_type.
+ (build_typeid): Remove unused variable.
+ (get_tinfo_var): Use tinfo_var_id.
+ (tinfo_name): New static function.
+ (get_tinfo_decl): Adjust for tinfo_decl_id and tinfo_decl_type.
+ (tinfo_from_decl): Likewise.
+ (get_base_offset): New static function, broken out of
+ expand_class_desc.
+ (expand_si_desc): Use tinfo_name.
+ (expand_class_desc): Likewise. Lose local static variable.
+ Use base_desc_type_node. Use get_base_offset.
+ (expand_ptr_desc): Use tinfo_name.
+ (expand_attr_desc): Likewise.
+ (expand_generic_desc): Likewise.
-Wed Apr 10 12:56:02 1996 Mike Stump <mrs@cygnus.com>
+ * tinfo.cc (__GXX_ABI_VERSION): Test value and existence.
+ * tinfo.h (__GXX_ABI_VERSION): Test value and existence.
- * search.c (make_memoized_table_entry): Undefer the pop, if necessary.
- (push_memoized_context): Split out code to undefer pop_type_level to
- (clear_memoized_cache): here.
- (pop_memoized_context): We can only handle one layer of deferral of
- pop_type_level so clear the cache, if there was a previous level.
+2000-01-23 Mark Mitchell <mark@codesourcery.com>
-Tue Apr 9 23:06:09 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (__eprintf): Remove declaration.
+ * tree.c (__eprintf): Remove definition.
- * rtti.c (init_rtti_processing): Build up base_info_type_node.
- (expand_class_desc): Use one pointer to an array of base_info
- structs, passed using a CONSTRUCTOR.
+2000-01-23 Zack Weinberg <zack@rabi.columbia.edu>
+ Mark Mitchell <mark@codesourcery.com>
-Tue Apr 9 14:20:57 1996 Mike Stump <mrs@cygnus.com>
+ * cp-tree.h (CLASSTYPE_MARKED_N, SET_CLASSTYPE_MARKED_N,
+ CLEAR_CLASSTYPE_MARKED_N): Avoid signed vs. unsigned warnings.
- * class.c (build_vbase_path): Remove block extern for
- flag_assume_nonnull_objects here.
- (build_vfn_ref): Split out functionality into build_vtbl_ref.
- (build_vtbl_ref): New routine.
- (build_vtable): Set up rtti info here.
- (add_virtual_function): Note in CLASSTYPE_RTTI the best
- place where we can get the rtti pointers from to avoid having to
- search around for a place.
- (finish_base_struct): Likewise.
- (finish_struct_1): Likewise. Never create totally new vtables
- with totally new vtable pointers for rtti. Disable code to layout
- vtable pointers better until we want to break binary
- compatibility.
- * rtti.c (build_headof_sub): New routine to convert down to a
- sub-object that has an rtti pointer in the vtable.
- (build_headof): Use it. Also, use build_vtbl_ref now to be more
- maintainable.
- (build_dynamic_cast): Make sure we have saved it, if we need to.
- * search.c (dfs_init_vbase_pointers): Disable code that deals with
- a more efficient vtable layout, enable later.
- * call.c (flag_assume_nonnull_objects): Moved declaration to
- * cp-tree.h: here. Declare build_vtbl_ref.
- * pt.c (instantiate_class_template): Use NULL_TREE instead of 0 in
- function calls that want a tree.
+2000-01-23 Brad Lucier <lucier@math.purdue.edu>
-Tue Apr 9 12:10:26 1996 Jason Merrill <jason@yorick.cygnus.com>
+ * class.c (dump_class_hierarchy): Print HOST_WIDE_INT properly.
- * rtti.c (build_dynamic_cast): Handle downcasting to X* given
- other X subobjects in the most derived type. Ack.
+2000-01-23 Mark Mitchell <mark@codesourcery.com>
- * rtti.c (build_dynamic_cast): No need to strip cv-quals here,
- get_typeid will do it for us.
- (get_typeid_1): Break out call-building for expand_*_desc to use.
- (get_typeid): Call it.
- (expand_*_desc): Likewise.
- * decl.c (init_decl_processing): Don't set TYPE_BUILT_IN on char *
- and void *.
- (init_decl_processing): Lose builtin_type_tdescs lossage.
- * decl2.c (finish_vtable_vardecl): Remove obsolete code.
+ * cp-tree.h (register_dtor_fn): New function.
+ * decl.c (destroy_local_static): Rename to ...
+ (register_dtor_fn): ... this. Give it external linkage.
+ (expand_static_init): Use it.
+ * decl2.c (do_static_initialization): Likewise, if using
+ __cxa_atexit.
+ (do_static_destruction): Check that __cxa_atexit is not in use.
+ (finish_file): Don't call do_static_destruction if using
+ __cxa_atexit.
-Mon Apr 8 17:23:23 1996 Bob Manson <manson@charmed.cygnus.com>
+ * typeck.c (convert_arguments): Restore two-message error
+ reporting.
- * pt.c (tsubst): When calling set_nested_typename, use
- TYPE_NESTED_NAME (current_class_type) instead of
- current_class_name.
+2000-01-20 Nathan Sidwell <sidwell@codesourcery.com>
- * decl.c (pushdecl): Likewise.
- (pushdecl_class_level): Likewise.
- (grokdeclarator): Use NULL_TREE instead of 0 in the call to
- set_nested_typename.
+ Remap dynamic cast hint values to be consistent across ABIs.
+ * search.c (dynamic_cast_base_recurse): Remap generated value.
+ (get_dynamic_cast_base_type): Adjust documentation.
+ * tinfo.h (__user_type_info::dyncast): Likewise.
+ (__user_type_info::find_public_subobj): Remap BOFF meaning.
+ * tinfo.cc (__si_type_info::do_dyncast): Remap BOFF meaning.
+ (__class_type_info::do_dyncast): Likewise.
+ (__class_type_info::do_find_public_subobj): Likewise.
+ * tinfo2.cc (__dynamic_cast): Remap BOFF parameter.
-Sun Apr 7 10:44:31 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-01-19 Gabriel Dos Reis <gdr@codesourcery.com>
- * rtti.c (synthesize_tinfo_fn): Handle arrays.
+ * typeck.c (build_unary_op): Use cp_pedwarn, not pedwarn.
- * cp-tree.h (DECL_REALLY_EXTERN): New macro.
+ * typeck2.c (incomplete_type_error): Restore previous
+ cp_error and cp_error_at call sequence.
-Sat Apr 6 13:56:27 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-01-20 Brad Lucier <lucier@math.purdue.edu>
- * rtti.c (throw_bad_cast): Use entry point __throw_bad_cast.
- (init_rtti_processing): Lose bad_cast_type.
- (build_dynamic_cast): Use throw_bad_cast.
+ * class.c (dump_class_hierarchy): Make format agree with argument;
+ cast pointer to unsigned long and print with %lx.
- * rtti.c (synthesize_tinfo_fn): Handle enums and pmfs.
+2000-01-19 Gabriel Dos Reis <gdr@codesourcery.com>
- * decl2.c (finish_file): Don't synthesize artificial functions
- that are external and not inline.
+ * decl2.c (lang_decode_option): Set default line-wrap length to 72.
- * rtti.c (get_tinfo_fn): If at_eof, call import_export_decl.
+ * typeck.c (composite_pointer_type, common_type,
+ comp_target_parms, c_sizeof, expr_sizeof, build_array_ref,
+ build_function_call_real, convert_arguments,
+ build_binary_op_nodefault, pointer_int_sum, pointer_diff,
+ build_unary_op, mark_addressable, build_compound_expr,
+ build_static_cast, build_reinterpret_cast, build_const_cast,
+ build_c_cast, build_modify_expr, get_delta_difference,
+ build_ptrmemfunc, check_return_expr): Replace 'ANSI C++' with
+ 'ISO C++'. Fusion consecutive calls to diagnostic message routines
+ into a single one.
+ * typeck2.c (readonly_error, abstract_virtuals_error,
+ process_init_constructor, check_for_new_type): Likewise.
- * decl2.c (finish_file): Handle having new inlines added to
- saved_inlines by synthesis.
+2000-01-19 Mark Mitchell <mark@codesourcery.com>
- * rtti.c (get_bad_cast_node): Don't require <typeinfo>.
+ * tree.c (bot_manip): Set DECL_CONTEXT for newly created
+ VAR_DECLs.
-Fri Apr 5 17:02:09 1996 Jason Merrill <jason@yorick.cygnus.com>
+2000-01-18 Nathan Sidwell <sidwell@codesourcery.com>
- RTTI rewrite to initialize nodes as needed, not require that
- users #include <typeinfo>, complete functionality and reduce wasted
- space.
- * rtti.c (init_rtti_processing): New fn.
- (build_typeid): The vtable entry is now a function.
- (get_tinfo_var): New fn.
+ * cp-tree.h (get_tinfo_fn_dynamic): Remove prototype.
+ (build_x_typeid): Likewise.
(get_tinfo_fn): Likewise.
- (get_typeid): Use it.
- (build_dynamic_cast): Declare and use entry point __dynamic_cast.
- (build_*_desc): Rename to expand_*_desc and rewrite to use entry
- points __rtti_*.
- (add_uninstantiated_desc, get_def_to_follow, build_t_desc): Lose.
- (synthesize_tinfo_fn): New fn.
- * method.c (build_t_desc_overload): Lose.
- (build_overload_with_type): More generic.
- * decl.c (init_decl_processing): Call init_rtti_processing.
- * class.c (set_rtti_entry): Use get_tinfo_fn.
- * decl2.c (mark_vtable_entries): Mark the rtti function.
- (finish_prevtable_vardecl): Don't build_t_desc.
- (import_export_decl): Handle tinfo functions.
- (finish_file): Likewise.
- * typeck.c (inline_conversion): New fn.
- (build_function_call_real): Use it.
- * cp-tree.h: Add decls.
-
- * method.c (hack_identifier): Also convert component_refs from
- references.
-
- * lex.c (cons_up_default_function): Use the type, not the name, in
- declspecs.
-
- * decl2.c (import_export_vtable): Fix weak vtables.
-
-Fri Apr 5 13:30:17 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * search.c (get_base_distance_recursive): Fix access checks for
- protected bases.
-
-Fri Apr 5 11:02:06 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * call.c (unary_complex_lvalue): Delete unneeded decl, it's in
- cp-tree.h.
- (convert_harshness): Add prototypes wrapped by PROTO.
- * decl2.c (grok_function_init): Likewise.
- (do_toplevel_using_decl): Change to void return type.
- * class.c (build_vtable_entry): Remove decl of make_thunk.
- (merge_overrides): Fix order of arg definitions.
- (finish_vtbls): Likewise.
- (fixup_vtable_deltas): Likewise.
- (modify_all_direct_vtables): Likewise.
- (modify_all_indirect_vtables): Likewise.
- * search.c (get_base_distance_recursive): Likewise.
- (get_abstract_virtuals_1): Likewise.
- (fixup_virtual_upcast_offsets): Likewise.
- (lookup_fnfields_1): Add prototypes wrapped by PROTO.
- * init.c (perform_member_init): Fix order of arg definitions.
- (expand_aggr_init_1): Add prototypes wrapped by PROTO.
- * cp-tree.h (make_thunk): Add decl.
- (overload_template_name, push_template_decl): Add decls.
- (do_toplevel_using_decl): Change to void return type.
- (vec_binfo_member): Add decl.
-
-Thu Apr 4 13:33:10 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * typeck.c (mark_addressable, convert_for_assignment,
- convert_for_initialization, pointer_int_sum, pointer_diff,
- unary_complex_lvalue): Add prototypes wrapped by PROTO.
- (convert_sequence): #if 0 fn decl, since definition also is.
-
-Thu Apr 4 11:00:53 1996 Mike Stump <mrs@cygnus.com>
-
- * rtti.c (build_dynamic_cast): Make sure we strip qualifiers on
- cast to pointer types for type searching.
-
-Wed Apr 3 17:10:57 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * typeck.c (get_delta_difference): Use cp_error, not error, in the
- case where BINFO == 0.
-
-Wed Apr 3 12:01:02 1996 Mike Stump <mrs@cygnus.com>
-
- * call.c (build_method_call): Fix wording of error messages so
- constructors come out right.
-
-Tue Apr 2 16:06:59 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * decl.c (push_overloaded_decl): Don't warn about hidden
- constructors when both the type and the function are declared
- in a system header file.
-
-Mon Apr 1 09:03:13 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * class.c (finish_struct_1): Propagate the TYPE_PACKED
- flag for the type to the type's fields.
-
-Sat Mar 30 12:14:33 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (complex_parmlist, ELLIPSES): Take out ARM-based warning.
-
-Fri Mar 29 15:51:36 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * class.c (base_info, finish_base_struct): Replace
- needs_virtual_dtor with base_has_virtual.
-
- (finish_struct_1): Remove the old code that tried to make default
- destructors virtual. Use base_has_virtual when checking if we need
- to add a vtable entry for the rtti code.
-
-Fri Mar 29 14:02:36 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (push_template_decl): Complain about template decl with
- inappropriate declaration.
-
-Fri Mar 29 12:15:35 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (build_x_unary_op): Remove bogus check for taking
- the address of a member function.
-
-Fri Mar 29 11:56:02 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (constructor_declarator): Only push the class if
- we are not already in the class.
-
-Fri Mar 29 09:41:02 1996 Jeffrey A. Law <law@cygnus.com>
-
- * method.c (emit_thunk): Remove current_call_is_indirect nonsense.
- Add additional argument to INIT_CUMULATIVE_ARGS.
-
-Thu Mar 28 16:41:39 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (shadow_tag): Fix error about anon union with methods.
-
- * parse.y (self_reference): Only generate a self-reference if this
- is a non-template class.
- (opt.component_decl_list): Only use it if it was generated.
-
- * parse.y (component_decl_1): Use constructor_declarator.
- (fn.def2): Likewise.
- (notype_component_declarator0): Likewise.
-
-Thu Mar 28 15:11:35 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (build_x_unary_op): Add checks for taking the address
- of a TARGET_EXPR or of a member function, and give appropriate
- warnings.
-
-Thu Mar 28 14:49:26 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (process_template_parm): Allow template type parms to be
- used as types for template const parms.
-
-Wed Mar 27 15:51:19 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (expand_vec_init): Ensure the eh cleanups are on the
- function_obstack.
-
-Wed Mar 27 10:14:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (lookup_name_real): Be even more picky about the
- ambiguous lookup warning.
- (grokdeclarator): Tweak SCOPE_REF constructor declarators here.
- * parse.y (constructor_declarator): Rather than here.
-
- * parse.y (constructor_declarator): New nonterminal.
- (fn.def1): Use it.
- (explicit_instantiation): Likewise.
-
-Tue Mar 26 13:41:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- Add implicit declaration of class name at class scope.
- * decl.c (lookup_name_real): Restrict pedwarn about ambiguous lookup.
- * parse.y (self_reference): New nonterminal.
- (opt.component_decl_list): Use it.
- (fn.def1): Add nested_name_specifier type_name cases.
- * class.c (build_self_reference): New function.
- (finish_struct): Handle access_default later, move self-reference
- decl to the end.
- * pt.c (lookup_template_class): Handle getting a TYPE_DECL.
- * cp-tree.h: Adjust.
-
- * pt.c (do_function_instantiation): Separate handling of member
- functions and non-member functions properly.
-
-Mon Mar 25 14:23:22 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (process_template_parm): Improve error for 'volatile class K'.
-
- * class.c (finish_struct_1): Check the right slot for destructors.
-
- * decl.c (start_enum): Complain about enum templates.
-
-Mon Mar 25 13:25:31 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (resolve_offset_ref): Offset pointers to member data by one.
- * typeck.c (unary_complex_lvalue): Likewise.
-
-Mon Mar 25 13:30:42 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (c_expand_return): Check for a returned local
- array name, similar to the check for an ADDR_EXPR.
-
-Mon Mar 25 13:07:19 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (cp_finish_decl): Don't build cleanups for static
- variables here.
-
-Fri Mar 22 17:57:55 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_modify_expr): Fix error messages to be more
- accurate.
- * cp-tree.h (assop_as_string): Parallel to op_as_string, but for
- assignment operators.
- * error.c (assop_as_string): Likewise. Add support for `%Q' for
- assignment operators.
-
-Fri Mar 22 13:48:29 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokdeclarator): Call bad_specifiers for typedefs. Also
- give an error if initialized. pedwarn about nested type with the
- same name as its enclosing class.
-
- * pt.c (tsubst, case TYPE_DECL): Set DECL_CONTEXT.
-
- * typeck.c (require_complete_type): Be sure to instantiate the
- MAIN_VARIANT of the type.
-
- * decl2.c (finish_file): Instantiate pending templates before
- processing static constructors and destructors.
-
- * pt.c (instantiate_decl): Don't instantiate functions at toplevel
- unless at_eof.
-
-Fri Mar 22 09:30:17 1996 Bob Manson <manson@beauty.cygnus.com>
-
- * decl2.c (delete_sanity): If error_mark_node is passed
- in as an expression, quit while we're ahead.
-
- * decl.c (grokdeclarator): Give an error message if `friend'
- is combined with any storage class specifiers.
-
-Wed Mar 20 14:51:55 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (named_complex_class_head_sans_basetype): Don't crash on
- definition of nonexistent nested type.
-
- * error.c (dump_decl, case TYPE_DECL): Fix decision for whether or
- not to say 'typedef'.
-
-Wed Mar 20 00:11:47 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.h (struct lang_type): Make search_slot a tree, not a char*.
- * search.c (dfs_walk, dfs_init_vbase_pointers,
- expand_upcast_fixups): Remove cast of CLASSTYPE_SEARCH_SLOT.
- (dfs_find_vbases): Remove cast for CLASSTYPE_SEARCH_SLOT init.
-
-Tue Mar 19 17:56:03 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * except.c (build_throw): Support minimal parse.
- * pt.c (tsubst_copy): Support THROW_EXPR.
- * decl2.c (build_expr_from_tree): Likewise.
-
- * pt.c (mangle_class_name_for_template): Always allocate
- scratch_firstobj.
-
-Tue Mar 19 16:34:31 1996 Bob Manson <manson@beauty.cygnus.com>
-
- * cvt.c (cp_convert_to_pointer): Give an appropriate error
- when trying to cast from an incomplete type.
-
-Tue Mar 19 16:00:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Don't bother setting up
- CLASSTYPE_TAGS explicitly, as the nested types will add
- themselves.
-
-Tue Mar 19 15:48:43 1996 Bob Manson <manson@beauty.cygnus.com>
-
- * decl.c (shadow_tag): Remove old error check for usage of
- an enum without a previous declaration.
- (xref_tag): Add error message about usage of enums without a
- previous declaration.
-
-Tue Mar 19 09:21:35 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (do_identifier): Only do name consistency check if we're
- parsing.
-
- * pt.c (push_template_decl): Don't crash if we get a member defn
- that doesn't match.
-
- * decl.c (xref_tag_from_type): New function to do an xref without
- always having to figure out code_type_node.
- * cp-tree.h: Declare it.
- * pt.c (instantiate_class_template): Use it for friend classes.
- (lookup_template_class): Use it.
-
- * typeck2.c (build_functional_cast): Pull out a single parm before
- passing it to build_c_cast.
-
-Tue Mar 19 09:07:15 1996 Bob Manson <manson@beauty.cygnus.com>
-
- * expr.c (do_case): Give an error message if a pointer is
- given as a case value.
-
-Mon Mar 18 21:57:54 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_c_cast): Don't pull single TEMPLATE_DECL out of
- an overload list.
-
- * lex.c (cons_up_default_function): Really, now, interface hackery
- does not apply to synthesized methods.
-
-Mon Mar 18 18:20:57 1996 Mike Stump <mrs@cygnus.com>
-
- * call.c (build_method_call): Ctors and dtors now have special names
- with respect to lookups.
- * class.c (add_method): Likewise.
- (grow_method): Likewise.
- (finish_struct_methods): Likewise.
- (warn_hidden): Likewise.
- (finish_struct_1): Likewise.
- * cvt.c (convert_to_reference): Likewise.
- (convert_to_aggr): Likewise.
- (cp_convert): Likewise.
- * decl2.c (check_classfn): Likewise.
- * init.c (expand_member_init): Likewise.
- (expand_default_init): Likewise.
- (expand_aggr_init_1): Likewise.
- (build_offset_ref): Likewise.
- (build_new): Likewise.
- (build_delete): Likewise.
- * lex.c (do_inline_function_hair): Likewise.
- * search.c (lookup_field_1): Likewise.
- (lookup_fnfields_here): Likewise.
- (lookup_field): Likewise.
- (lookup_fnfields): Likewise.
- (get_virtual_destructor): Likewise.
- (dfs_debug_mark): Likewise.
- (dfs_pushdecls): Likewise.
- (dfs_compress_decls): Likewise.
- * tree.c (layout_basetypes): Likewise.
- * typeck.c (build_component_ref): Likewise.
- (build_x_function_call): Likewise.
- (build_modify_expr): Likewise.
- (convert_for_initialization): Likewise.
- (build_functional_cast): Likewise.
- * cp-tree.h (CLASSTYPE_FIRST_CONVERSION): Likewise.
- (CTOR_NAME): New.
- (DTOR_NAME): New.
- * decl.c (ctor_identifier): New.
- (dtor_identifier): New.
- (init_decl_processing): Set them.
-
-Mon Mar 18 18:00:51 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_component_ref): Don't get confused by fields whose
- context has no type name, like pointer to member functions.
-
-Mon Mar 18 13:19:03 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokdeclarator): Handle typedef without declarator.
-
- * pt.c (tsubst): Handle SCOPE_REF in declarator.
-
- * parse.y (bad_parm): Catch another case of missing `typename'.
-
- * lex.c (yyprint): Handle TYPE_DECLs.
-
- * decl.c (start_function): Don't try to be clever.
-
- * lex.c: Lose compiler_error_with_decl.
- * typeck2.c: Lose error_with_aggr_type.
- (incomplete_type_error): Use cp_* instead of old functions.
- (readonly_error): Likewise.
- * typeck.c (convert_arguments): Likewise.
- * search.c (lookup_nested_field): Likewise.
- * method.c (make_thunk): Likewise.
- * decl.c (grokparms): Likewise.
- * cp-tree.h: Update.
-
- * tree.c (min_tree_cons): Call copy_to_permanent for the purpose
- and value.
-
-Mon Mar 18 11:25:52 1996 Bob Manson <manson@beauty.cygnus.com>
-
- * method.c (build_opfncall): When deleting a pointer to an
- array, build a new pointer to the tree past any ARRAY_TYPE
- nodes.
-
-Mon Mar 18 10:11:46 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (lookup_name_real): Initialize local var TYPE to NULL_TREE.
-
-Fri Mar 15 11:03:57 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_decl): Only call import_export_decl if at_eof
- and ! DECL_INLINE.
-
- * decl.c (finish_function): Don't set nested based on
- hack_decl_function_context.
- * parse.y (function_try_block): Check for nested function.
- (pending_inlines): Likewise.
-
- * decl2.c (build_expr_from_tree): If a unary op already has a
- type, just return it.
-
- * decl2.c (finish_prevtable_vardecl): Use ADJUST_VTABLE_LINKAGE.
-
- * decl2.c (walk_vtables): vardecl_fn returns int; return 1 if it does.
- (finish_file): Check the return value of walk_vtables.
- (finish_prevtable_vardecl): Return int.
- (finish_vtable_vardecl): Likewise.
- (prune_vtable_vardecl): Likewise.
- * lex.c (set_vardecl_interface_info): Likewise.
- * cp-tree.h: Adjust return types.
-
- * class.c (delete_duplicate_fields_1): Don't complain about
- duplicate nested types if they're the same type.
- (finish_struct): Remove check for duplicate.
- * decl2.c (grokfield): Don't check for typedef of anonymous type.
-
-Thu Mar 14 10:00:19 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h: Lose SIGNATURE_GROKKING_TYPEDEF.
-
- * decl.c (grokdeclarator): Lose special handling of class-level
- typedef. Lose SIGNATURE_GROKKING_TYPEDEF. Set
- SIGNATURE_HAS_OPAQUE_TYPEDECLS later.
-
- * cvt.c (convert_pointer_to_real): Retain cv-quals in conversion.
-
- * pt.c (tsubst_copy): Strip cv-quals from destructor name types.
-
- * search.c (compute_access): Fix handling of anonymous union
- members.
- * class.c (finish_struct_anon): Propagate TREE_{PRIVATE,PROTECTED}
- from anonymous unions to their members.
-
- * typeck.c (build_x_function_call): For static member functions,
- hand off to build_member_call.
-
-Wed Mar 13 14:03:34 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_component_ref): Handle OFFSET_REFs.
-
- * init.c (expand_vec_init): Fix init == 0 case.
-
-Tue Mar 12 14:36:02 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (build_new): pedwarn about init and array new.
- (expand_vec_init): Handle lists, use convert_for_initialization.
-
- * typeck.c (convert_for_initialization): Pass LOOKUP_NO_CONVERSION
- when converting to an aggregate type.
- * cvt.c (cp_convert): Pass it through.
-
- * typeck.c (build_conditional_expr): Handle user-defined
- conversions to slightly different types.
-
- * decl.c (grokdeclarator): Force an array type in a parm to be
- permanent.
-
- * decl2.c (do_using_directive): Sorry.
- (do_namespace_alias): Likewise.
- * lex.c (real_yylex): Warn about using the `namespace' keyword.
-
-Sun Mar 10 22:26:09 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (datadef): Move call to note_list_got_semicolon up.
-
-Fri Mar 8 11:47:26 1996 Mike Stump <mrs@cygnus.com>
-
- * tree.c (unsave_expr): Don't unsave, UNSAVE_EXPRs.
-
-Fri Mar 8 11:29:06 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (cp_finish_decl): The exception regions have to be
- nested, not overlapping. We start the exception region for a
- decl, after it has been fully built, and all temporaries for it
- have been cleaned up.
-
-Thu Mar 7 17:46:06 1996 Mike Stump <mrs@cygnus.com>
-
- * tree.c (vec_binfo_member): Don't core dump if we have no bases.
-
-Thu Mar 7 14:11:49 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.def: Add RETURN_INIT.
- * pt.c (instantiate_decl): Handle RETURN_INIT.
- * decl.c (store_return_init): Handle minimal_parse_mode.
-
- * tree.c (cp_build_type_variant): Just return an error_mark_node.
- * decl.c (make_typename_type): Don't try to get the file and line
- of an identifier.
- * typeck.c (comptypes): Handle TYPENAME_TYPE.
-
-Wed Mar 6 18:47:50 1996 Per Bothner <bothner@kalessin.cygnus.com>
-
- * decl.c (poplevel): Make sure we clear out and restore old local
- non-VAR_DECL values by default when they go out of scope.
-
-Wed Mar 6 09:57:36 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (build_overload_value): Use DECL_ASSEMBLER_NAME in
- referring to addresses of variables and functions.
-
- * error.c (dump_expr): Support SIZEOF_EXPR.
-
- * init.c (do_friend): Use the return value of check_classfn.
-
- * typeck.c (convert_arguments): Call complete_type.
-
- * method.c (hack_identifier): After giving an error, set value to
- error_mark_node.
-
-Tue Mar 5 16:00:15 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (hack_decl_function_context): Kludge around DECL_CONTEXT
- lossage for local classes.
- * cp-tree.h: Declare it.
- * decl.c (lookup_name_real): Evil, painful hack for local classes.
- (grokfndecl): Set DECL_CLASS_CONTEXT and DECL_NO_STATIC_CHAIN here.
- Use hack_decl_function_context.
- (grokdeclarator): Don't set DECL_NO_STATIC_CHAIN here.
- (start_function): Use hack_decl_function_context.
- (finish_function): Likewise.
- * method.c (synthesize_method): Likewise.
- * lex.c (process_next_inline): Likewise.
- (do_pending_inlines): Likewise.
- * decl2.c (finish_file): Unset DECL_STATIC_FUNCTION_P when we're
- done with it.
-
-Mon Mar 4 22:38:39 1996 Gerald Baumgartner <gb@alexander.cs.purdue.edu>
-
- * sig.c (build_signature_pointer_or_reference_type): Align
- signature pointers/references on 8-byte boundaries so they can be
- grabbed 2 words at a time on a Sparc.
-
-Tue Mar 5 10:21:01 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (hack_identifier): Requiring a static chain is now a
- hard error.
- * decl.c (grokdeclarator): Set DECL_NO_STATIC_CHAIN on nested
- functions.
-
-Mon Mar 4 20:03:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (build_offset_ref): Call complete_type.
-
- * decl.c (pop_from_top_level): Always pop previous_class_type.
-
- * parse.y: Handle multiple decls in a for-init-statement.
- * pt.c (tsubst_expr): Likewise.
-
- * pt.c (tsubst): Use tsubst_expr for the second operand of an
- ARRAY_REF.
-
- * decl.c (maybe_push_to_top_level): Don't save previous_class_type.
- (poplevel_class): Set it here.
- (pop_from_top_level): Pop it here if we're returning to class scope.
- * class.c (pushclass): Don't set it here.
-
- * decl.c (maybe_push_to_top_level): Save current_template_parms,
- and clear it if !pseudo.
- (pop_from_top_level): Restore it.
-
- * decl2.c (finish_file): Push the dummy each time we walk the list
- of vtables.
-
- * error.c (dump_expr): Support LOOKUP_EXPR and actually do
- something for CAST_EXPR.
-
-Mon Feb 19 14:49:18 1996 Rusty Russell <rusty@adelaide.maptek.com.au>
-
- * cvt.c (cp_convert): Warn about implicit conversion of the
- address of a function to bool, as it is always true.
-
-Fri Feb 23 23:06:01 1996 Rusty Russell <rusty@adelaide.maptek.com.au>
-
- * typeck.c (c_expand_return): Fix warning for local externs returned.
-
-Mon Mar 4 15:03:11 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (mapcar): Propagate const and volatile properly.
-
- * typeck.c (complete_type): Be sure to instantiate the
- MAIN_VARIANT of the type.
-
- * method.c (synthesize_method): Class interface hackery does not
- apply to synthesized methods.
-
-Mon Mar 4 14:05:23 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (comp_template_args): Use comptypes rather than just
- checking for TEMPLATE_TYPE_PARM equivalence.
-
- * typeck.c (build_x_function_call): Call complete_type before
- checking TYPE_OVERLOADS_CALL_EXPR.
-
-Mon Mar 4 18:48:30 1996 Manfred Hollstein <manfred@lts.sel.alcatel.de>
-
- * g++.c (main): Check also for new define ALT_LIBM.
-
-Fri Mar 1 13:09:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): If we don't have a pattern
- yet, that's OK.
- (coerce_template_parms): If we see a local class, bail.
-
- * decl.c (grok_reference_init): Make sure there's a type before
- checking its code.
-
- * pt.c (do_function_instantiation): Avoid crashing on invalid decls.
- (push_template_decl): Likewise.
-
- * parse.y (named_class_head): Set
- CLASSTYPE_TEMPLATE_SPECIALIZATION here if we have basetypes.
-
- * decl.c (xref_tag): Diagnose redeclaration of template
- type-parameter name.
-
- * error.c (dump_type): Handle anonymous template type parms.
-
- * pt.c (instantiate_template): Use TYPE_MAIN_DECL instead of
- TYPE_STUB_DECL.
- (coerce_template_parms): Likewise.
-
-Thu Feb 29 16:26:01 1996 Mike Stump <mrs@cygnus.com>
-
- * class.c (instantiate_type, case {ARRAY,INDIRECT}_REF,
- case ADDR_EXPR): Don't modify rhs if a subinstantiation fails.
-
-Thu Feb 29 08:20:25 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_template): Take the MAIN_VARIANT of the type
- before trying to get its STUB_DECL.
- (coerce_template_parms): Likewise.
-
- * parse.y (template_type_parm): If they didn't use 'class',
- pretend they did after giving an error.
-
- * pt.c (coerce_template_parms): Diagnose use of local class.
-
- * decl.c (grok_reference_init): Use instantiate_type.
-
- * error.c (dump_expr): Handle TEMPLATE_DECLs.
-
- * parse.y (named_class_head): Diagnose mismatching types and tags.
-
- * decl.c (pushdecl): Type decls and class templates clash with
- artificial type decls, not hide them.
-
- * decl.c (redeclaration_error_message): Diagnose redefinition of
- templates properly.
- (duplicate_decls): Diagnose disallowed overloads for template
- functions, too.
-
- * decl.c (start_decl): Call complete_type before checking for a
- destructor.
-
- * pt.c (tsubst): Use tsubst_expr on the elts of a VEC.
-
- * decl.c (xref_tag): A TEMPLATE_TYPE_PARM is a match.
-
-Wed Feb 28 09:28:44 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grok_op_properties): Don't check for operator++(int) in
- a template.
-
- * tree.c (perm_manip): Return a copy of variable and function
- decls with external linkage.
-
- * tree.def: Change some of the min tree codes to type "1".
- * pt.c (uses_template_parms): Handle 'e's, return 1 for LOOKUP_EXPRs.
- * method.c (build_overload_int): Emit something arbitrary for
- anything but an INTEGER_CST if we're in a template.
-
- * decl.c (cp_finish_decl): Call complete_type before deciding
- whether or not to lay out the decl.
-
- * lex.c (do_identifier): Check for DECL_INITIAL before using it.
-
-Tue Feb 27 16:35:32 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck2.c (build_x_arrow): Call complete_type.
-
- * pt.c (add_pending_template): Broken out.
- (lookup_template_class): If -fexternal-templates, call it for all
- the methods of implemented types.
- (instantiate_class_template): Instead of instantiating them here.
- (instantiate_decl): Handle -fexternal-templates earlier.
-
-Tue Feb 27 15:51:32 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * search.c, lex.c, decl.c, class.c, cp-tree.h: Don't wrap the
- memoized lookup stuff inside GATHER_STATISTICS.
-
-Tue Feb 27 10:38:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (start_decl): Complain about array of incomplete type
- here.
- (grokdeclarator): Not here.
-
- * parse.y (template_parm): Expand full_parm inline so we can set
- the rule's precedence.
-
- * pt.c (tsubst_expr): If we're in a template, just do tsubst_copy.
- (tsubst): tsubst_expr the DECL_INITIAL of FIELD_DECLs.
- * decl2.c (grokbitfield): Don't check for integer constant here.
- * class.c (finish_struct_1): Check here.
-
- * decl.c (define_label): Make the min decl go on permanent_obstack.
-
- * pt.c (unify): Don't handle CONST_DECLs.
- (uses_template_parms): Don't check DECL_INITIAL on a CONST_DECL.
- (tsubst_copy): Likewise.
-
- * lex.c (do_identifier): Do pull the DECL_INITIAL out of a
- CONST_DECL for a template parm.
-
-Mon Feb 26 12:48:18 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokdeclarator): Complain about array of incomplete type
- here.
- (start_decl_1): Not here.
-
- * pt.c (tsubst): Handle pointer-to-function declarators.
-
- * method.c (hack_identifier): If pedantic, diagnose local class
- methods that require a static chain.
-
- * decl.c (grok_op_properties): No longer static.
- * cp-tree.h: Declare it.
- * pt.c (tsubst): Call it for operators.
- Use tsubst_copy for TREE_VECs.
-
- * parse.y (template_arg): The expr has precedence like '>'.
-
-Fri Feb 23 14:51:52 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (coerce_template_parms): Don't coerce an expression using
- template parms.
- (uses_template_parms): Also check DECL_INITIAL in CONST_DECLs.
- (tsubst): Don't use build_index_2_type if the max_value uses template
- parms.
- * method.c (build_overload_int): Emit something arbitrary for an
- expression using template parms.
-
- * parse.y (template_close_bracket): New non-terminal to catch use
- of '>>' instead of '> >' in template class names.
- (template_type): Use it.
- * Makefile.in (CONFLICTS): Causes one more r/r conflict.
-
- * tree.def: Add CAST_EXPR.
- * typeck2.c (build_functional_cast): Use CAST_EXPR instead of
- CONVERT_EXPR for minimal_parse_mode.
- * typeck.c (build_c_cast): Likewise.
- * pt.c (tsubst_copy): Likewise.
- * decl2.c (build_expr_from_tree): Likewise.
- * error.c (dump_expr): Likewise.
-
-Fri Feb 23 10:36:46 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * except.c (SetTerminate, SetUnexpected): Put back global vars.
- (init_exception_processing): Put back decl/init of
- set_unexpected_fndecl and set_terminate_fndecl, needed to get the
- fns from libstdc++.
-
- * decl.c (struct binding_level): Delete ACCEPT_ANY bitfield.
- (declare_uninstantiated_type_level, uninstantiated_type_level_p):
- Delete unused fns.
- * cp-tree.h (declare_uninstantiated_type_level,
- uninstantiated_type_level_p): Delete prototypes.
-
-Thu Feb 22 19:36:15 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst_expr): Add default return.
-
-Thu Feb 22 16:47:24 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * error.c (fndecl_as_string): Delete unused arg CNAME.
- * sig.c (build_signature_table_constructor,
- build_signature_method_call): Fix calls.
-
- * class.c (the_null_vtable_entry): Delete var definition.
- (init_class_processing): Delete tree the_null_vtable_entry init.
- * decl.c (no_print_{functions, builtins}): Declare as static.
- (__tp_desc_type_node): #if 0 var definition.
- (init_type_desc): #if 0 init of __tp_desc_type_node.
- (vb_off_identifier): Move var decl into init_decl_processing.
- (current_function_assigns_this): Declare as static.
- (int_ftype_ptr_ptr_int, void_ftype_ptr_int_int): Delete var decls.
- (init_decl_processing): Delete init of void_ftype_ptr_ptr_int.
- Move decls of string_ftype_ptr_ptr and int_ftype_string_string here.
- * decl2.c (delete_sanity): Delete definition/mod of local var ELT_SIZE.
- * init.c (BI_header_type, BI_header_size): Declare as static.
- * pt.c (template_classes): Delete unused var.
- (add_pending_template): Delete decl for non-existent fn.
- (lookup_template_class): Delete vars CODE and TAG_CODE.
- (instantiate_template): Delete unused var TARGS.
- * cp-tree.h (vb_off_identifier, current_function_assigns_this):
- Delete decls.
- (__tp_desc_type_node): #if 0 var decl.
- (fndecl_as_string): Fix prototype.
-
-Thu Feb 22 15:56:19 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.def: Add GOTO_STMT.
- * pt.c (tsubst_expr): Support goto and labels.
- * decl.c (define_label): Support minimal parsing.
- * parse.y (simple_stmt): Likewise.
-
-Thu Feb 22 15:30:12 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * xref.c (GNU_xref_member): Only define/set var I if
- XREF_SHORT_MEMBER_NAMES is defined, to match when it's actually
- used.
- (GNU_xref_end_scope): Delete unused fifth arg TRNS.
- (GNU_xref_end): Fix call.
- * decl.c (poplevel, poplevel_class, finish_method): Fix calls.
- * cp-tree.h (GNU_xref_end_scope): Fix prototype.
-
- * tree.c (build_exception_variant): Delete unused vars I, A, T,
- T2, and CNAME.
- (layout_vbasetypes): Delete unused var NONVIRTUAL_VAR_SIZE.
- (mapcar): Delete unused var CODE.
- (build_cplus_new): Delete unused arg WITH_CLEANUP_P.
- (break_out_cleanups): Fix call.
- (bot_manip): Likewise.
- * call.c (build_method_call): Likewise.
- * cvt.c (build_up_reference, convert_to_reference, cp_convert):
- Likewise.
- * typeck.c (unary_complex_lvalue, build_modify_expr,
- convert_for_initialization): Likewise.
- * typeck2.c (build_functional_cast): Likewise.
- * cp-tree.h (build_cplus_new): Fix prototype.
-
- * repo.c (open_repo_file): Delete unused var Q.
- (repo_compile_flags, repo_template_declared,
- repo_template_defined, repo_class_defined, repo_inline_used,
- repo_vtable_used, repo_tinfo_used): #if 0 unused fns.
- (repo_get_id, repo_vtable_used): Declare as static.
- * cp-tree.h (mark_{decl,class}_instantiated, finish_repo): Add
- prototypes.
-
-Thu Feb 22 14:53:35 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (pending_inlines): Add function_try_block case.
-
- * pt.c (unify): Fix for template const parms.
-
-Thu Feb 22 13:24:15 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * lex.c (extract_interface_info): Delete forward decl.
- (default_copy_constructor_body, default_assign_ref_body): Delete
- decls for non-existent functions.
- (synth_firstobj, inline_text_firstobjs): Delete unused vars.
- (init_lex): Delete setting them.
- (cons_up_default_function): Delete unused vars FUNC_BUF,
- FUNC_LEN, and COMPLEX. Delete code setting COMPLEX. Delete old
- #if 0'd synth code.
- (toplevel, expression_obstack): Delete unused extern decls.
- (tree_node_kind): Delete unused enum.
- (tree_node_counts, tree_node_sizes): Wrap with #ifdef
- GATHER_STATISTICS.
- (tree_node_kind_names): Delete unused extern decl.
- (synth_obstack): Delete unused var.
- (init_lex): Don't set it.
- (init_parse): Add decl before use.
- (reduce_count): Only define #ifdef GATHER_STATISTICS && REDUCE_LENGTH.
- (current_unit_{name, language}): Delete unused vars.
- (check_newline): Don't bother setting them, just accept the #pragma.
- * cp-tree.h (init_repo, peek_yylex): Add prototypes.
- (current_unit_{name, language}): Delete decls.
-
- * search.c: Wrap all of the memoized functions, macros, and
- variables inside #ifdef GATHER_STATISTICS.
- (lookup_field, lookup_fnfields): Likewise.
- (init_search_processing): Likewise.
- (reinit_search_statistics): Wrap whole function.
- * lex.c (reinit_lang_specific): Wrap call to reinit_search_statistics.
-
- * decl.c (finish_function): Only call pop_memoized_context if
- GATHER_STATISTICS is defined.
- (start_function): Likewise for push_memoized_context.
- * class.c (pushclass, popclass): Likewise.
-
- * cp-tree.h (CLASSTYPE_MTABLE_ENTRY): Move definition from here...
- * search.c (CLASSTYPE_MTABLE_ENTRY): ... to here.
-
- * cvt.c (cp_convert): Delete unused local var FORM.
- * cp-tree.h (can_convert, can_convert_arg, real_lvalue_p): Add
- prototypes.
-
-Thu Feb 22 13:19:44 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (do_poplevel): Oops; really return what we get from
- poplevel this time.
-
-Thu Feb 22 11:41:44 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.h (is_aggr_type): Add prototype.
-
- * cp-tree.h ({push,pop}_cp_function_context): Add decls.
- * method.c ({push,pop}_cp_function_context): Delete decls.
- * except.c (start_eh_unwinder, end_eh_unwinder): Declare as void.
- (SetUnexpected, SetTerminate): Delete unused vars.
- (init_exception_processing): Don't set SetUnexpected or
- SetTerminate. Don't set SET_UNEXPECTED_FNDECL or SET_TERMINATE_FNDECL.
- (output_exception_table_entry): Delete unused array LABEL.
- (expand_internal_throw): Delete unused var PARAMS.
- (expand_start_catch_block): Delete unused var CLEANUP.
- (emit_exception_table): Delete unused var EH_NODE_DECL.
- (expand_builtin_throw): Delete unused vars UNWIND_AND_THROW and
- GOTO_UNWIND_AND_THROW. Don't set them.
- (end_eh_unwinder): Add top decl.
- (pop_rtl_from_perm): Delete unused decl of PERMANENT_OBSTACK.
- (exception_section, push_rtl_perm, do_function_call,
- lang_interim_eh, push_eh_cleanup, eh_outer_context,
- expand_end_eh_spec, end_eh_unwinder): Declare as static.
- (saved_pc, saved_throw_type, saved_throw_value, saved_cleanup,
- throw_used): Likewise.
- * cp-tree.h (expand_end_eh_spec): Delete prototype.
-
- * search.c (dfs_mark, dfs_mark_vtable_path,
- dfs_unmark_vtable_path, dfs_mark_new_vtable,
- dfs_unmark_new_vtable, dfs_clear_search_slot,
- dfs_search_slot_nonempty_p, bfs_markedp, bfs_unmarkedp,
- bfs_marked_vtable_pathp, bfs_unmarked_vtable_pathp,
- bfs_marked_new_vtablep, bfs_unmarked_new_vtablep): #if 0 unused
- functions.
- (n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1,
- n_calls_lookup_fnfields, n_calls_lookup_fnfields_1,
- n_calls_get_base_type, n_outer_fields_searched, n_contexts_saved):
- Only define #ifdef GATHER_STATISTICS.
- (reinit_search_statistics): Only init some vars if GATHER_STATISTICS
- is defined.
- (vbase_decl): Delete var definition.
- (init_search): Delete old decl.
- (init_vbase_pointers): Delete building of VBASE_DECL, since it's
- never actually used.
- (expand_indirect_vtbls_init): Delete init of VBASE_DECL.
- (get_base_distance_recursive): Delete unused fourth arg
- BASETYPE_PATH. Fix call .
- (get_base_distance): Fix call.
- (push_class_decls): Delete unused var ID.
- (make_memoized_table_entry): Declare as static.
- (breadth_first_search): Declare as static.
- (tree_has_any_destructor_p): Declare as static.
- (pop_class_decls): Delete unused arg pop_class_decls.
- * class.c (popclass): Fix call to pop_class_decls.
- * cp-tree.h (make_memoized_table_entry, breadth_first_search,
- tree_has_any_destructor_p): Delete prototypes.
-
- * rtti.c (build_ptmf_desc): Delete unused arg TYPE.
- (build_t_desc): Fix call. Delete unused vars ELEMS and TT.
- (build_dynamic_cast): Delete unused local vars TMP1 and RETVAL.
- (build_user_desc): Delete unused var T.
- (build_class_desc): Delete unused vars T and OFF.
- (build_t_desc): Delete unused var NAME_STRING.
- (build_headof): Make static.
- (get_bad_cast_node): Likewise.
- (get_def_to_follow): Likewise.
- * cp-tree.h (init_type_desc): Add prototype.
- (build_headof): Remove prototype.
-
-Thu Feb 22 00:54:22 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst): Only look for matching decls at file scope for
- non-member functions.
-
- * call.c (build_scoped_method_call): Handle scoped destructor
- calls in templates.
-
- * decl.c (*_top_level): Also save previous_class_values.
-
- * pt.c (tsubst_expr): Support do {} while loops.
- * parse.y (simple_stmt): Likewise.
- * tree.def: Likewise.
-
- * method.c (build_overload_identifier): For a class nested in a
- template class, don't mangle in the template parms from our
- context.
-
- * lex.c, cp-tree.h: Remove support for template instantiations in
- the pending_inlines code.
- * pt.c: Remove dead functions and unused arguments.
- (uses_template_parms): TYPENAME_TYPEs always use template parms.
- * parse.y: Stop passing anything to end_template_decl.
- * tree.c (print_lang_statistics): Only print tinst info #ifdef
- GATHER_STATISTICS.
-
-Wed Feb 21 16:57:33 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (expand_recursive_init{,_1}): Delete decls.
- (sort_member_init): Delete unused var INIT.
- (emit_base_init): Delete unused var X.
- (build_offset_ref): Delete unused var CNAME.
- (sort_member_init): Delete unused var FIELDS_TO_UNMARK.
- (emit_base_init): Delete unused local var BASE. Delete extern
- decl of IN_CHARGE_IDENTIFIER.
- (build_delete): Delete unused local var VIRTUAL_SIZE.
-
- * init.c (build_vec_delete): Delete unused third arg ELT_SIZE.
- (build_delete): Fix call.
- * decl2.c (delete_sanity): Likewise.
- * cp-tree.h (build_vec_delete): Update prototype.
-
- * typeck.c (common_base_type): Delete unused var TMP.
- (build_binary_op): Delete local var ARGS_SAVE.
- (build_array_ref): Delete unused var ITYPE.
- (c_expand_return): Delete unused var USE_TEMP.
-
- * typeck.c (compexcepttypes): Delete unused arg STRICT.
- (comptypes): Fix calls.
- * decl.c (duplicate_decls): Likewise.
- * cp-tree.h (compexcepttypes): Delete extra arg.
-
- * decl2.c (check_classfn): Delete unused second arg CNAME.
- * decl.c (start_decl, grokfndecl): Fix calls.
- * init.c (do_friend): Likewise.
- * cp-tree.h (check_classfn): Update prototype.
-
- * cp-tree.h (signature_error, import_export_vtable,
- append_signature_fields, id_in_current_class, mark_used,
- copy_assignment_arg_p): Add decls.
- * decl2.c (mark_used): Delete decl.
-
- * class.c (n_*): Wrap with #ifdef GATHER_STATISTICS.
-
- * class.c (get_vtable_entry): Disable unused function.
- (doing_hard_virtuals): Delete unused static global var.
- (finish_struct_1): Don't init DOING_HARD_VIRTUALS.
- (prepare_fresh_vtable): Delete unused vars PATH and RESULT.
- (overrides): Delete unused vars RETTYPE and BASE_RETTYPE.
- (modify_one_vtable): Delete unused var OLD_RTTI.
- (finish_struct_anon): Delete unused vars OFFSET and X.
- (finish_struct_bits): Delete unused var METHOD_VEC.
- (get_basefndecls): Delete unused var PURPOSE. Delete unused
- for-scope local variable METHODS.
-
- * call.c (user_harshness): Delete unused/unneeded arg PARM.
- (ideal_candidate): Delete unused args BASETYPE and PARMS.
- (build_method_call): Delete unused args passed into ideal_candidate.
- (build_overload_call_real): Likewise. Delete unused var OVERLOAD_NAME.
- * cp-tree.h (synthesize_method): Add decl.
-
- * decl.c (note_level_for_for): Give void return type.
- (pushdecl_nonclass_level): Likewise.
- (finish_function): Delete unused vars VFIELDS and ALLOCATED_THIS.
- (poplevel): Delete unused var IMPLICIT_TRY_BLOCK.
- (suspend_binding_level): Delete unused var LEVEL.
- (duplicate_decls): Delete unused var CTYPE.
- (duplicate_decls): Delete unused var PREVIOUS_C_DECL.
- (init_decl_processing): Delete unused vars FLOAT_ENDLINK and
- PTR_ENDLINK.
- (grokdeclarator): Delete unused var C.
- (grokdeclarator): Delete unused var SIZE_VARIES.
- (grokparms): Delete unused var SAW_VOID.
- (start_function): Delete unused var OLDDECL.
- (cplus_expand_expr_stmt): Delete unused var
- REMOVE_IMPLICIT_IMMEDIATELY.
-
- * cp-tree.h (pushdecl_nonclass_level): Fix prototype.
-
- * Makefile.in (CONFLICTS): Update to 12 shift/reduce.
-
-Wed Feb 21 00:06:17 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (build_min): Set TREE_COMPLEXITY to lineno.
- (build_min_nt): Likewise.
- * pt.c (do_pushlevel): Emit line note.
- (do_poplevel): Return what we get from poplevel.
- (tsubst_expr): Set lineno from TREE_COMPLEXITY in stmt nodes.
- * parse.y: Use do_pushlevel and do_poplevel.
- * cp-tree.h: Declare do_poplevel.
-
- * cp-tree.h: Declare at_eof.
- * decl.c (cp_finish_decl): Pass it to rest_of_decl_compilation.
- * decl2.c (import_export_decl): Renamed from import_export_inline.
- (finish_file): Call it to do interface handling for statics.
- * pt.c (tsubst_copy): Call mark_used on variables and functions
- used here.
-
- * decl2.c (finish_file): Don't emit statics we can't generate.
- * pt.c (instantiate_decl): Don't set interface on instantiations
- we can't generate.
-
- * cp-tree.h (struct tinst_level): Change 'classname' to 'decl'.
- * tree.c (print_lang_statistics): Print max template depth.
- * pt.c (push_tinst_level): Dump entire instantiation context.
- (instantiate_class_template): Use it and pop_tinst_level.
- (instantiate_decl): Likewise.
-
- * call.c class.c cp-tree.h decl.c decl2.c error.c lex.c method.c
- pt.c ptree.c tree.def: Remove all traces of UNINSTANTIATED_P_TYPE.
-
-Tue Feb 20 18:21:51 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c class.c cp-tree.h cvt.c decl.c decl2.c error.c expr.c
- init.c lex.c method.c parse.y pt.c repo.c search.c spew.c tree.c
- tree.def typeck.c typeck2.c xref.c: Massive, systemic changes for
- the new template implementation.
-
-Tue Feb 20 17:14:29 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl2.c (check_cp_case_value): Use STRIP_TYPE_NOPS.
-
-Thu Feb 15 18:44:42 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (cp_finish_decl): Delay emitting the debug information for
- a typedef that has been installed as the canonical typedef, if the
- type has not yet been defined.
-
-Thu Feb 15 09:39:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (grokfield): Still call pop_nested_class for access decls.
-
-Wed Feb 14 17:30:04 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (lookup_label): Call label_rtx.
-
- * decl.c (make_binding_level): New function.
- (pushlevel, pushlevel_class): Call it instead of explicit
- duplicate calls to xmalloc.
-
- * decl.c (init_decl_processing): Delete useless build_pointer_type
- call.
-
- * decl.c (float_ftype_float, ldouble_ftype_ldouble): Add definitions.
- (sizet_ftype_string): Delete variable.
- (init_decl_processing): Add built-in functions fabsf, fabsl,
- sqrtf, sqrtl, sinf, sin, sinl, cosf, cos, cosl. New local
- variable strlen_ftype, used for strlen.
-
-Wed Feb 14 16:21:25 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (push_to_top_level): Start from current_binding_level
- again for now; the stl hacks depend on g++ being broken in this
- way, and it'll be fixed in the template rewrite.
-
- * tree.def: Add USING_DECL.
- * decl2.c (do_class_using_decl): Implement.
- (grokfield): Pass access decls off to do_class_using_decl instead of
- grokdeclarator.
- * error.c (dump_decl): Handle USING_DECLs.
- * decl.c (grokdeclarator): Remove code for handling access decls.
- * class.c (finish_struct_1): Adjust accordingly, treat using-decls
- as access decls for now.
- (finish_struct): Don't check USING_DECLs for other uses of the name.
-
- * search.c (get_matching_virtual): Use cp_error_at.
-
-Wed Feb 14 10:36:58 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * typeck.c (comptypes): Default COMP_TYPE_ATTRIBUTES to 1, to
- match c-typeck.c.
- (self_promoting_args_p): Move the check that TYPE is non-nil
- before trying to look at its main variant.
- (unsigned_type, signed_type): Add checking of DI/SI/HI/QI nodes.
-
- * cp-tree.h (DECL_WAITING_FRIENDS, SET_DECL_WAITING_FRIENDS):
- Delete macros.
- * init.c (xref_friend, embrace_waiting_friends): Delete functions.
- (do_friend): Delete call to xref_friend.
- * class.c (finish_struct_1): Delete call to embrace_waiting_friends.
-
- * typeck.c (convert_sequence): #if 0 unused function.
-
- * cp-tree.h (DECL_IN_MEMORY_P): New macro w/ the check that used to
- be in decl_in_memory_p.
- (decl_in_memory_p): Delete decl.
- * expr.c (decl_in_memory_p): Delete fn.
- * typeck.c (mark_addressable): Use DECL_IN_MEMORY_P.
-
- * decl.c (cp_finish_decl): Use DECL_IN_MEMORY_P.
-
-Tue Feb 13 12:51:21 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (finish_struct_1): Check for a pure-specifier on a
- non-virtual function here.
-
- * decl2.c (grok_function_init): Don't check whether the function
- is virtual here.
- (grokfield): Don't call check_for_override here.
-
- * decl.c (push_to_top_level): Start from inner_binding_level,
- check class_shadowed in class levels.
-
-Mon Feb 12 17:46:59 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (resume_level): Ignore things that don't have names, instead
- of core dumping.
-
-Mon Feb 12 15:47:44 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl2.c (grokfield): Set DECL_VINDEX properly for FUNCTION_DECLs.
-
-Sat Feb 10 17:59:45 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (finish_struct_1): Set DECL_VINDEX properly on a
- synthesized dtor.
-
- * parse.y (complete_type_name): Bind global_scope earlier.
- (complex_type_name): Likewise.
- (qualified_type_name): Remove.
-
-Thu Feb 8 15:15:14 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokfndecl): Move code that looks for virtuals in base
- classes...
- * class.c (check_for_override): ... to a new function.
- (finish_struct_1): Call it.
-
- * cp-tree.h: Declare warn_sign_compare.
-
- * typeck.c (build_binary_op_nodefault): Check warn_sign_compare
- rather than extra_warnings to decide whether to warn about
- comparison of signed and unsigned.
-
- * decl2.c (lang_decode_option): Handle warn_sign_compare. -Wall
- implies -Wsign-compare. -Wall doesn't imply -W.
-
-Wed Feb 7 15:27:57 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_component_ref): Fix to handle anon unions in base
- classes as well.
-
-Wed Feb 7 14:29:12 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * class.c (resolves_to_fixed_type_p): Delete code dealing with
- a WITH_CLEANUP_EXPR, since we don't generate them any more.
- * cvt.c (build_up_reference): Likewise.
- * decl.c (grok_reference_init): Likewise.
- (cp_finish_decl): Likewise.
- * error.c (dump_expr): Likewise.
- * tree.c (real_lvalue_p): Likewise.
- (lvalue_p): Likewise.
- (build_cplus_new): Likewise.
- (unsave_expr_now): Likewise.
- * typeck.c (unary_complex_lvalue, build_modify_expr,
- c_expand_return): Likewise.
-
-Tue Feb 6 13:39:22 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- Make the C++ front-end pay attention to attributes for structures.
- * class.c (finish_struct): New argument ATTRIBUTES, passed down into
- finish_struct_1.
- (finish_struct_1): New argument ATTRIBUTES; call cplus_decl_attributes.
- Take out old round_up_size use and setting the DECL_ALIGN possibly
- using it. Take out setting of TYPE_ALIGN to round_up_size, which
- can override what the attribute set.
- * cp-tree.h (finish_struct): Update prototype.
- * parse.y (template_instantiate_once): Pass a NULL_TREE for the
- attributes to finish_struct.
- (structsp): For a CLASS decl, add maybe_attribute to rule and pass that
- value down into finish_struct.
- * Makefile.in (CONFLICTS): Switch to 7 shift/reduce conflicts.
-
-Tue Feb 6 13:12:15 1996 Per Bothner <bothner@kalessin.cygnus.com>
-
- * decl.c (poplevel): Re-word dead for local handling.
- (pushdecl): Remove useless DECL_DEAD_FOR_LOCAL test.
- (cp_finish_decl): If is_for_scope, check for duplicates so
- we can disable is_for_scope. Otherwise, preserve_temp_slots.
-
- * lex.c (do_identifier): Use global binding in preference of
- dead for local variable.
-
-Mon Feb 5 17:46:46 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (initializing_context): Handle anon union changes, the
- context where fields of anon unions can be initialized now has to be
- found by walking up the TYPE_CONTEXT chain.
-
-Fri Feb 2 14:54:04 1996 Doug Evans <dje@charmed.cygnus.com>
-
- * decl.c (start_decl): #ifdef out code to set DECL_COMMON
- if ASM_OUTPUT{,_ALIGNED}_BSS is defined.
- (obscure_complex_init): If bss is supported, always set
- DECL_INITIAL to error_mark_node.
-
-Thu Feb 1 16:19:56 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (is_friend): Make sure there's a context before we see if
- it's an aggr type.
-
-Thu Feb 1 15:44:53 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (is_friend): Classes are not friendly with nested classes.
-
-Thu Feb 1 15:27:37 1996 Doug Evans <dje@charmed.cygnus.com>
-
- * lex.c (check_newline): Pass last character read to HANDLE_PRAGMA,
- and record its result.
-
-Thu Feb 1 09:27:01 1996 Mike Stump <mrs@cygnus.com>
-
- * class.c (finish_struct_anon): Switch around code to not move anon
- union elements around, nor mess up their contexts, nor offsets,
- instead we now build up the right number of COMPONENT_REFs for all
- the anon unions that may be present at build_component_ref time.
- * typeck.c (lookup_anon_field): New routine to handle field lookup
- on fields without names. We find them, based upon their unique type
- instead.
- * typeck.c (build_component_ref): Allow FIELD_DECL components.
- Handle finding components in anonymous unions, and ensure that a
- COMPONENT_REF is built for each level as necessary.
-
-Tue Jan 30 18:18:23 1996 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (build_up_reference): Make the INDIRECT_BIND case come after
- code that ensures that copy ctors are used if appropriate.
-
-Tue Jan 30 17:35:14 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (build_vec_delete): Only give an error if base isn't an
- error_mark_node.
-
-Mon Jan 29 17:09:06 1996 Mike Stump <mrs@cygnus.com>
-
- * spew.c (do_aggr): `new struct S;' isn't a forward declaration.
- (yylex): If we see `new', keep slurping.
-
-Thu Jan 25 18:31:36 1996 Mike Stump <mrs@cygnus.com>
-
- * class.c (finish_struct_1): Move code for handling anon unions...
- (finish_struct_anon): to here. Fixup so that we do the offset
- calculations right, and so that the fields are physically moved to
- the containers's chain.
-
-Thu Jan 25 18:27:37 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokdeclarator): Avoid trying to get an operand off an
- identifier node.
-
-Wed Jan 24 11:25:30 1996 Jim Wilson <wilson@chestnut.cygnus.com>
-
- * typeck.c (pointer_int_sum): Use TYPE_PRECISION (sizetype) not
- POINTER_SIZE to agree with expr.c.
-
-Thu Jan 25 13:01:23 1996 Mike Stump <mrs@cygnus.com>
-
- * search.c (lookup_field): Don't report ambiguities if protect is 0,
- instead return NULL_TREE.
-
-Wed Jan 24 13:01:26 1996 Mike Stump <mrs@cygnus.com>
-
- * class.c (finish_struct_1): Call warn_hidden if we want warnings
- about overloaded virtual functions.
- (warn_hidden): New routine to warn of virtual functions that are
- hidden by other virtual functions, that are not overridden.
- (get_basefndecls): New routine, used by warn_hidden.
- (mark_overriders): New routine, used by warn_hidden.
- * search.c (get_matching_virtual): Remove old warning that just
- isn't very useful.
-
-Tue Jan 23 12:26:10 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (output_builtin_tdesc_entries): #if 0 the function definition.
-
- * typeck.c (null_ptr_cst_p): Delete unused fn.
- (build_function_call_maybe): Delete unused fn.
-
- * expr.c (extract_init): #if 0 the code after unconditional return 0
- for now.
+ (get_tinfo_fn_unused): Rename to ...
+ (get_tinfo_decl): ... here.
+ * rtti.c (build_headof): Replace logic error with assertion.
+ (get_tinfo_fn_dynamic): Rename to ...
+ (get_tinfo_decl_dynamic): ... here. Make static. Use
+ complete_type_or_else.
+ (build_x_typeid): Move into ...
+ (build_typeid): ... here. Adjust call to
+ get_tinfo_decl_dynamic. Use tinfo_from_decl. Simplify
+ throw_bad_typeid expression.
+ (get_tinfo_fn_unused): Rename to ...
+ (get_tinfo_decl): ... here. Adjust comment.
+ (get_tinfo_fn): Delete.
+ (tinfo_from_decl): New static function.
+ (get_typeid_1): Call get_tinfo_decl and tinfo_from_decl.
+ (get_typeid): Use complete_type_or_else.
+ (build_dynamic_cast_1): Adjust calls to
+ get_tinfo_decl_dynamic. Simplify throw_bad_cast expression.
+ * parse.y (primary): Adjust call to build_typeid.
+ * except.c (build_eh_type_type_ref): Adjust call to
+ get_tinfo_decl. Mark as used.
+ * class.c (set_rtti_entry): Adjust call to get_tinfo_decl.
+ * decl2.c (build_expr_from_tree): Adjust call to build_typeid.
+ * parse.c: Regenerated.
- Delete old cadillac code.
- * edsel.c: Remove file.
- * Make-lang.in (CXX_SRCS): Take edsel.c off the list.
- * Makefile.in (CXX_OBJS): Delete edsel.o.
- (edsel.o): Delete rule.
- * cp-tree.h (flag_cadillac): Delete var decl.
- * lang-options.h: Delete "-fcadillac" and "-fno-cadillac".
- * decl2.c (flag_cadillac): Delete var definition.
- (lang_decode_option): Delete handling of -fcadillac and -fno-cadillac.
- (grokfield): Delete code depending on flag_cadillac.
- (finish_anon_union): Likewise.
- * class.c (finish_struct_1): Likewise.
- (pushclass): Likewise.
- (popclass): Likewise.
- (push_lang_context): Likewise.
- (pop_lang_context): Likewise.
- * decl.c (init_decl_processing): Likewise.
- (start_decl): Likewise.
- (cp_finish_decl): Likewise.
- (xref_tag): Likewise.
- (finish_enum): Likewise.
+2000-01-17 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (fixed_type_or_null): Don't clear NONNULL. Document
+ calling convention.
+ (resolves_to_fixed_type_p): Document calling convention.
+ * rtti.c (build_x_typeid): Initialize NONNULL.
+
+ * cp-tree.h (build_shared_int_cst): New function.
+ * call.c (build_over_call): Use DECL_VIRTUAL_CONTEXT, for clarity.
+ * class.c (modify_vtable_entry): Likewise.
+ (add_virtual_function): Split out code to generated shared
+ INTEGER_CSTs to build_share_int_cst.
+ (modify_all_vtables): Handle all the overridden functions here.
+ Add overridden functions from non-primary virtual bases to the
+ primary vtable.
+ (finish_struct_1): Adjust call to modify_all_vtables. Add
+ overridden functions from non-primary bases to the vtable.
+ * tree.c (build_shared_int_cst): New function.
+
+ * cp-tree.h (scratchalloc): Remove.
+ (build_scratch_list): Likewise.
+ * call.c (convert_class_to_reference): Replace build_scratch_list
+ and build_expr_list with build_tree_list.
+ (add_candidate): Replace scratchalloc with expralloc. Note memory
+ leak.
+ (build_user_type_conversion_1): Replace build_scratch_list
+ and build_expr_list with build_tree_list.
+ (build_new_op): Likewise.
+ (build_op_delete_call): Likewise.
+ (convert_like): Likewise.
+ * cvt.c (ocp_convert): Likewise.
+ * decl.c (start_decl): Likewise.
(start_function): Likewise.
- (finish_function): Likewise.
- (finish_stmt): Likewise.
- * lex.c (lang_init): Likewise.
- (check_newline): Likewise.
-
- * lex.c (do_pending_inlines): Delete synthesized method kludge.
-
- Delete defunct, ancient garbage collection implementation.
- * rtti.c: New file with the RTTI stuff from gc.c.
- * gc.c: Removed file (moved the remaining stuff into rtti.c).
- * Makefile.in (CXX_OBJS): Replace gc.o with rtti.o.
- (rtti.o): New rule, replacing gc.o.
- * Make-lang.in (CXX_SRCS): Replace gc.c with rtti.c.
- * cp-tree.h: Delete gc-related fn decls.
- (DECL_GC_OFFSET): Delete macro.
- (flag_gc): Delete extern decl.
- * decl.c (current_function_obstack_index): Delete var decl.
- (current_function_obstack_usage): Delete var decl.
- (start_function): Delete clearing of current_function_obstack_index
- and current_function_obstack_usage.
- (init_decl_processing): Delete code relying on -fgc.
- Delete call to init_gc_processing.
- (cp_finish_decl): Delete calls to build_static_gc_entry and
- type_needs_gc_entry. Delete gc code setting DECL_GC_OFFSET.
- (store_parm_decls): Delete -fgc calls to cp_expand_decl_cleanup
- and to expand_expr of a __gc_main call.
- (maybe_gc_cleanup): Delete var decl.
- (finish_function): Delete call to expand_gc_prologue_and_epilogue.
- * decl2.c (flag_gc): Delete var decl.
- (lang_f_options): Delete offering of -fgc.
- (lang_decode_option): Delete -fgc and -fno-gc handling.
- (get_temp_regvar): Delete gc code.
- * init.c (build_new): Delete gc code.
- * lex.c (init_lex): Delete checking of flag_gc.
-
- * typeck.c (convert_arguments): Delete gc code.
- (build_component_addr): Delete -fgc warning.
- (build_modify_expr): Delete gc code.
-
- * decl2.c (build_push_scope): Delete fn.
- * cp-tree.h (build_push_scope): Delete decl.
-
- * search.c (clear_search_slots): Delete fn.
- * cp-tree.h (clear_search_slots): Delete decl.
-
- * search.c (tree_needs_constructor_p): Delete fn.
- * cp-tree.h (tree_needs_constructor_p): Delete decl.
-
- * tree.c (id_cmp): Delete fn.
-
- * tree.c (set_fnaddr_from_vtable_entry): Delete fn.
- * cp-tree.h (set_fnaddr_from_vtable_entry): Delete decl.
-
- * tree.c (decl_value_member): Delete fn.
- * cp-tree.h (decl_value_member): Delete decl.
-
- * tree.c (list_hash_lookup_or_cons): Delete fn.
- * cp-tree.h (list_hash_lookup_or_cons): Delete decl.
-
- * method.c (cplus_exception_name): Delete fn.
- (EXCEPTION_NAME_{PREFIX, LENGTH}): Delete macros.
-
- * spew.c (shift_tokens): Delete fn.
-
-Mon Jan 22 17:49:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * except.c (init_exception_processing): Pass 1 to needs_pop in calls
- to cp_finish_decl.
- * parse.y: Likewise.
-
-Mon Jan 22 17:34:29 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * tree.c (build_cplus_staticfn_type): Delete function definition;
- never used.
- * cp-tree.h (build_cplus_staticfn_type): Delete decl.
-
- * tree.c (virtual_member): Delete function definition; never used.
- * cp-tree.h (virtual_member): Delete decl.
-
-Fri Jan 19 18:03:14 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_component_ref): Handle getting vbase pointers
- out of complex multiple inheritance better.
-
-Fri Jan 19 16:27:40 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_object_ref): Make sure we use the real type, not
- any reference type.
-
-Fri Jan 19 16:01:47 1996 Mike Stump <mrs@cygnus.com>
-
- * tree.c (build_exception_variant): Don't create new types if we
- don't have to, also build new types on the right obstack.
-
-Fri Jan 19 14:09:44 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (store_bindings): Split out from push_to_top_level.
- (push_to_top_level): Call it for b->type_shadowed on class binding
- levels.
-
-Fri Jan 19 13:53:14 1996 Mike Stump <mrs@cygnus.com>
-
- * search.c (expand_upcast_fixups): Fix so that offsets stored in
- vbase_offsets are always right. Fixes a problem where virtual base
- upcasting and downcasting could be wrong during conversions on this
- during virtual function dispatch at ctor/dtor time when dynamic
- vtable fixups for deltas are needed. This only sounds easier than
- it is. :-)
- (fixup_virtual_upcast_offsets): Change to reflect new calling
- convention for expand_upcast_fixups.
-
-Fri Jan 19 12:23:08 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl2.c (grokbitfield): Strip the NOPs from WIDTH before we
- check that it's usable as the bitfield width.
-
-Wed Jan 17 21:22:40 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl2.c (grokfield): Call cplus_decl_attributes with the attrlist.
- Pass a null tree to grokdeclarator for its ATTRLIST arg, since it's
- only ever used for functions in it.
-
-Wed Jan 17 12:10:38 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (qualified_type_name): Use the TYPE_DECL, not the type.
- (nested_type): Likewise.
- (nested_name_specifier): Use lastiddecl.
-
- * decl.c (grokdeclarator): Adjust accordingly.
- * init.c (expand_member_init): Likewise.
- * parse.y (base_class): Likewise.
- * typeck2.c (build_functional_cast): Likewise.
-
- * typeck2.c (build_functional_cast): Fill in name after we've
- checked for non-aggr type.
-
-Wed Jan 17 10:18:01 1996 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (warn_pointer_arith): Default to on.
-
-Tue Jan 16 12:45:38 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (is_rid): New function.
- * decl.c (grokdeclarator): Diagnose reserved words used as
- declarator-ids.
-
-Tue Jan 16 11:39:40 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (get_decl_list): Don't lose cv-quals.
-
- * decl.c (grokdeclarator): Fix SCOPE_REF handling and diagnose
- typespecs used as declarator-ids.
-
-Tue Jan 16 11:09:42 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (poplevel): When poping a level, don't give a warning for
- any subblocks that already exist.
-
-Tue Jan 16 00:25:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_object_ref): Finish what I started.
-
- * parse.y (qualified_type_name): Don't check TYPE_BUILT_IN.
-
- * decl2.c (constructor_name_full): Handle TEMPLATE_TYPE_PARMs.
-
- * decl.c (grokdeclarator): Also accept TEMPLATE_TYPE_PARM as a
- scope.
-
-Mon Jan 15 16:19:32 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (xref_tag): Handle passing a type in directly.
-
- * parse.y (qualified_type_name): Pull out the type.
- (nested_type): Likewise.
- Take types directly instead of as identifiers.
- * call.c (build_scoped_method_call): Take types directly instead of
- as identifiers.
- * decl.c (xref_basetypes): Likewise.
- * init.c (expand_member_init): Likewise.
- (build_member_call): Likewise.
- (build_offset_ref): Likewise.
- * typeck2.c (build_scoped_ref): Likewise, remove bogus code.
- * method.c (do_build_assign_ref): Likewise.
- * decl.c (grokdeclarator): Handle a type appearing as the
- declarator-id for constructors.
- * method.c (do_build_copy_constructor): current_base_init_list now
- uses the types directly, not their names.
- * init.c (sort_base_init): Likewise.
- (expand_member_init): Likewise.
- * init.c (is_aggr_type): New function, like is_aggr_typedef.
-
-Mon Jan 15 08:45:01 1996 Jeffrey A Law <law@cygnus.com>
-
- * tree.c (layout_basetypes): Call build_lang_field_decl instead
- of build_lang_decl if first arg is a FIELD_DECL.
-
-Thu Jan 11 14:55:07 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (cp_finish_decl): Only clear TREE_USED if DECL_NAME is
- non-empty.
- * except.c (expand_start_catch_block): Set TREE_USED to avoid
- warnings about the catch handler.
-
-Mon Jan 8 17:35:12 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_modify_expr): Use a COMPOUND_EXPR instead of
- expand_target_expr.
-
-Thu Jan 4 12:30:32 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- Fix access control to use trees rather than integers.
- * class.c (access_{default, public, protected, private,
- default_virtual, public_virtual, private_virtual}_node): Add
- definitions.
- (init_class_processing): Do creation of those nodes.
- * cp-tree.h (access_type): Delete enum decl.
- (access_{default, public, protected, private, default_virtual,
- public_virtual, private_virtual}_node): Add decls.
- (compute_access): Change return type.
- * search.c (compute_access): Have tree return type, instead of enum.
- (lookup_field): Declare THIS_V and NEW_V to be tree nodes.
- * lex.c (real_yylex): Use yylval.ttype for giving the value of the
- access_* node for each of RID_{PUBLIC, PRIVATE, PROTECTED}.
- * parse.y (VISSPEC): Make ttype rather than itype.
- (base_class_access_list): Likewise.
- * *.[cy]: Change all refs of `access_public' to `access_public_node',
- etc.
- * call.c (build_method_call): Make ACCESS be a tree.
- * class.c (alter_access, finish_struct_1, filter_struct): Likewise.
- * cvt.c (convert_to_aggr): Likewise.
- * init.c (build_offset_ref, resolve_offset_ref, build_delete):
- Likewise.
- * method.c (hack_identifier): Likewise.
- * typeck.c (build_component_ref_1, build_component_ref): ): Likewise.
-
-Thu Jan 4 11:02:20 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (pointer_int_sum, pointer_diff): Make code agree with C
- frontend, and make it more consistent with respect to
- warn_pointer_arith.
-
-Tue Jan 2 00:13:38 1996 Rusty Russell <rusty@adelaide.maptek.com.au>
-
- * decl.c (pushdecl): Check for duplicate parameter names.
-
-Wed Jan 3 09:25:48 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (expand_static_init): Call assemble_external for atexit.
-
-Wed Jan 3 07:55:19 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (do_unwind): Remove some generated dead code.
- (eh_outer_context): New routine, factor out some common code from
- expand_builtin_throw and end_eh_unwinder. Add code to do return
- address masking for the PA.
- (expand_builtin_throw): Use eh_outer_context instead of open coding
- it here.
- (end_eh_unwinder): Likewise.
-
-Tue Jan 2 17:00:56 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Call assemble_external for __empty, if we
- use it.
-
-Thu Dec 28 11:13:15 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_builtin_throw): Use RETURN_ADDR_OFFSET instead of
- NORMAL_RETURN_ADDR_OFFSET.
- (end_eh_unwinder): Likewise.
-
-Wed Dec 27 22:18:16 1995 Mike Stump <mrs@cygnus.com>
-
- * gc.c (build_dynamic_cast): Make sure we don't cast away const
- when dealing with references, and make sure we handle dynamic
- casting to a cv qualified reference.
-
-Thu Dec 21 23:50:35 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (struct eh_context): New structure top hold eh context
- information.
- (push_eh_context): New routine.
- (pop_eh_context): Likewise.
- * decl.c (push_cp_function_context): Use them.
- (pop_cp_function_context): Likewise.
-
-Wed Dec 20 12:42:51 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_file): Also prune uninteresting functions in the
- inline emission loop.
-
-Wed Dec 20 02:32:07 1995 Jeffrey A Law <law@cygnus.com>
-
- * sig.c (build_signature_table_constructor): Mark functions
- in the signature as referenced.
-
-Tue Dec 19 22:36:56 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_file): Do all the vtable/synthesis stuff before
- the inline emission stuff.
-
-Mon Dec 18 15:51:33 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h, decl2.c (flag_weak): New flag to control the use of
- weak symbols.
- * lang-options.h: Add -f{no-,}weak.
- * decl.c (init_decl_processing): If the target does not support weak
- symbols, don't use them.
- * decl2.c, pt.c: s/SUPPORTS_WEAK/flag_weak/.
-
-Sun Dec 17 21:13:23 1995 Rusty Russell <rusty@adelaide.maptek.com.au>
-
- * init.c (expand_member_init): warning for base init after members.
-
-Fri Dec 15 15:32:18 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (build_expr_type_conversion): Don't convert to a reference
- type.
-
-Thu Dec 14 16:05:58 1995 Mike Stump <mrs@cygnus.com>
-
- * method.c (report_type_mismatch): Improve wording for volatile
- mismatches.
-
-Thu Dec 14 14:16:26 1995 Mike Stump <mrs@cygnus.com>
-
- * init.c (expand_aggr_init_1): Use expand_aggr_init_1 instead of
- expand_assignment, as the later doesn't handle things that have
- copy constructors well. The compiler would do bitwise copying,
- instead of ctor calling in some cases.
-
-Wed Dec 13 17:05:54 1995 Paul Eggert <eggert@twinsun.com>
-
- * g++.c (my_strerror): Return "cannot access" if errno is 0.
- (pfatal_with_name, perror_exec): Don't assume that
- the returned value from my_strerror contains no '%'s.
- (concat): Remove.
- (sys_nerror): Declare only if HAVE_STRERROR is not defined.
-
-Wed Dec 13 16:22:38 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- Lose CLASSTYPE_METHODS/DECL_NEXT_METHOD chain; make
- TYPE_METHODS/TREE_CHAIN mean what they used to.
- * decl2.c (constructor_name_full): Refer to CLASSTYPE_METHOD_VEC
- instead of TYPE_METHODS.
- * decl.c (duplicate_decls): Lose references to DECL_NEXT_METHOD.
- * tree.c (tree_copy_lang_decl_for_deferred_output): Likewise.
- * cp-tree.h (CLASSTYPE_METHODS): Lose.
- (CLASSTYPE_METHOD_VEC): Point to lang_spec->methods instead of
- TYPE_METHODS.
- (struct lang_decl): Lose next_method field.
- (DECL_NEXT_METHOD): Lose.
- * class.c (finish_struct_methods): Don't mess with TYPE_METHODS.
- (finish_struct): Just use TYPE_METHODS; we don't need fn_fields
- anymore.
- (finish_struct_methods): Don't mess with the TREE_CHAINs in
- fn_fields.
-
- * search.c (add_conversions): Don't use TREE_CHAIN to traverse method
- vector.
-
- * call.c (build_method_call): Synthesize here even when not inlining.
- * typeck.c (build_function_call_real): Likewise.
-
-Wed Dec 13 15:02:39 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * cp/lex.c (check_newline): If DBX_DEBUGGING_INFO and write_symbols
- == DBX_DEBUG, call dbxout_start_new_source_file and
- dbxout_resume_previous_source_file when appropriate.
-
-Tue Dec 12 20:38:55 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (start_anon_func): Push to the top level.
- (end_anon_func): Pop from the top level.
-
-Mon Dec 11 18:56:14 1995 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (build_cleanup): New routine to build cleanups.
- * decl.c (expand_static_init): Use build_cleanup to build a cleanup
- call at ctor time and use atexit to run it later.
- * decl2.c (build_cleanup): New routine, taken from finish_file.
- (finish_file): Use build_cleanup instead, and don't put function
- local statics in global dtor list.
-
-Wed Dec 6 14:34:29 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Ensure that we have cleanups, if we try
- and expand cleanups.
-
-Wed Dec 6 11:48:21 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Add logic to manage dynamic cleanups for
- the EH object.
- (expand_end_catch_block): Use the magic of expand_goto, instead of
- emit_jump so that we get the cleanup for any catch clause parameter
- and the cleanup for the exception object. Update to reflect label
- changes.
- (push_eh_cleanup): New routine to register a cleanup for an
- exception object.
- (empty_fndecl): Used to default cleanup actions to
- nothing.
- (init_exception_processing): Setup empty_fndecl. Setup
- saved_cleanup.
- (expand_start_catch_block): Update to reflect label changes. Call
- push_eh_object to register the cleanup for the EH object.
- (start_anon_func): New routine to start building lambda expressions
- from trees.
- (end_anon_func): New routine to end them.
- (struct labelNode): Change so that we can use tree labels, or rtx
- labels.
- (saved_cleanup): Object to check for dynamic cleanups for the
- exception handling object.
- (push_label_entry): Change so that we can use tree labels, or rtx
- labels.
- (pop_label_entry): Likewise.
- (top_label_entry): Likewise.
- (expand_start_all_catch): Use tree label instead of rtx label, so
- that we can get the magic of expand_goto.
- (expand_end_all_catch): Update to reflect label changes.
-
- * class.c (build_vfn_ref): Remove building_cleanup logic, as we now
- use UNSAVE_EXPRs.
- * typeck.c (get_member_function_from_ptrfunc): Remove remnants of
- building_cleanup logic, as we now use UNSAVE_EXPRs.
- * cp-tree.h (unsave_expr): Declare it.
- * decl.c (building_cleanup): Remove.
- (maybe_build_cleanup): Remove building_cleanup logic, and use
- UNSAVE_EXPR instead.
-
-Sun Dec 3 01:34:58 1995 Mike Stump <mrs@cygnus.com>
-
- * gc.c (build_t_desc): Update error message to say <typeinfo>.
-
-Thu Nov 30 12:30:05 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (pushdecl): Only warn about shadowing a local variable if
- warn_shadow is true.
-
-Sun Nov 26 16:06:55 1995 Rusty Russell <rusty@adelaide.maptek.com.au>
-
- * typeck.c (build_binary_op_nodefault): Added warning about
- comparisons between different enum types with -Wall, unless
- -fenum-int-equiv set.
-
-Wed Nov 22 15:44:02 1995 Mike Stump <mrs@cygnus.com>
-
- * class.c (finish_struct_1): Skip down to the inner type in
- multidimensional arrays. Ensures ctors will be made for types that
- need constructing.
-
-Wed Nov 22 14:19:22 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (last_dtor_insn): New to track the last compiler generated
- insn in a dtor.
- (store_parm_decls): Set it.
- (finish_function): Use it to see if the dtor is empty. Avoid doing
- vtable setup all the time, if we can.
- (struct cp_function): Add last_dtor_insn.
- (push_cp_function_context): Save it.
- (pop_cp_function_context): Restore it.
-
-Wed Nov 22 11:52:19 1995 Paul Russell <Rusty.Russell@adelaide.maptek.com.au>
-
- * typeck.c (build_unary_op): Set TREE_NO_UNUSED_WARNING to avoid
- warnings.
-
-Tue Nov 21 17:15:23 1995 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (expand_target_expr): Make sure targets get put into the
- current temp_slot_level, so that the free_temp_slots call will reuse
- them.
-
-Tue Nov 21 13:32:03 1995 Mike Stump <mrs@cygnus.com>
-
- * class.c (finish_struct_1): Delay delta fixups for virtual bases
- until after we have done the hard virtuals, to avoid a bogus `every
- virtual function must have a unique final overrider' for virtual
- functions that are only overridden by hard virtuals.
-
-Thu Nov 9 13:35:30 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (do_function_instantiation): Don't try to find a file-scope
- template for a member function.
-
-Tue Nov 14 06:20:35 1995 Mike Stump <mrs@cygnus.com>
-
- * g++.c (main): Add handling of -nodefaultlibs.
-
-Mon Nov 13 15:45:34 1995 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (INDIRECT_BIND): Add a way for the frontend to
- distinguish between direct bindings of reference variables, and
- indirect bindings of reference variables.
- * cvt.c (build_up_reference): Use it.
- * typeck.c (convert_arguments): Use it to indicate this is an
- indirect binding.
- * decl.c (cp_finish_decl): Ensure that we reuse stack slots as fast
- as they are unused.
- (expand_static_init): Likewise.
- (cplus_expand_expr_stmt): Likewise.
- * decl2.c (finish_file): Likewise.
+ (finish_destructor_body): Likewise.
+ (maybe_build_cleanup_1): Likewise.
+ * decl2.c (reparse_decl_as_expr): Likewise.
* init.c (perform_member_init): Likewise.
- (emit_base_init): Likewise.
- (expand_aggr_vbase_init_1): Likewise.
-
-Fri Nov 10 09:18:09 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (push_namespace): Rewrite to use build_lang_decl, so we
- get a DECL_LANG_SPECIFIC node.
- * cp-tree.h (lang_decl_flags): Add new member `level'.
- (NAMESPACE_LEVEL): Don't use decl.arguments, instead use the
- decl_flags level member.
-
-Mon Nov 6 18:36:13 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * call.c (build_method_call): Make sure instance has a
- TYPE_LANG_SPECIFIC node before we dive into it.
-
-Sat Nov 4 20:01:52 1995 Jason Molenda <crash@phydeaux.cygnus.com>
-
- * method.c (make_thunk): Use TREE_SET_CODE to set thunk's tree code.
-
-Thu Nov 2 17:56:57 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (duplicate_decls): When smashing decls, smash staticness in
- the usual way.
-
-Thu Nov 2 16:44:02 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (poplevel): Handle the merging of subblocks of cleanups
- when finishing blocks that have already been created (usually due to
- the fixup goto code). Fixes bad debugging information.
-
-Wed Nov 1 12:33:53 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (hack_identifier): Don't abort when we get a TREE_LIST
- that's not a list of overloaded functions.
-
-Wed Nov 1 11:38:58 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl2.c (mark_vtable_entries): Check DECL_LANG_SPECIFIC on fn
- before trying to use DECL_ABSTRACT_VIRTUAL_P.
-
-Tue Oct 31 11:56:55 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (mark_used): New function for hooking into setting of
- TREE_USED on decls.
- * call.c (build_method_call): Use it.
- * class.c (instantiate_type): Likewise.
- * init.c (build_offset_ref): Likewise. Don't call assemble_external
- for all like-named functions.
- * method.c (hack_identifier): Likewise.
- (emit_thunk): Don't call assemble_external.
- (make_thunk): Create thunk as a FUNCTION_DECL so that it
- gets the right mode and ENCODE_SECTION_INFO works.
-
- * parse.y: Use mark_used. Pass operator names to do_identifier.
- * lex.c (do_identifier): Handle operator names.
-
- * decl2.c (grokclassfn): Tweak __in_chrg attributes.
-
-Thu Oct 26 16:45:58 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * errfn.c: Include stdio.h.
- (cp_sprintf): Take out decl of sprintf, and cast sprintf to errorfn*.
+ (expand_cleanup_for_base): Likewise.
+ (build_builtin_delete_call): Likewise.
+ (build_new_1): Likewise.
+ (build_delete): Likewise.
+ * method.c (do_build_assign_ref): Likewise.
+ * parse.y (already_scoped_stmt): Likewise.
+ (nontrivial_exprlist): Likewise.
+ (net_initializer): Likewise.
+ (initlist): Likewise.
+ * parse.c: Regenerated.
+ * rtti.c (build_x_typeid): Likewise.
+ (build_dynamic_cast_1): Likewise.
+ * typeck.c (build_x_compound_expr): Likewise.
+ (build_static_cast): Likewise.
+ (build_modify_expr): Likewise.
-Wed Oct 25 18:58:41 1995 Mike Stump <mrs@cygnus.com>
+ * cp-tree.h (DECL_VINDEX): Add documentation.
+ * class.c (build_vtable_entry): Likewise.
+ (start_vtable): Add comment.
+ (add_virtual_function): Replace pending_hard_virtuals with
+ overridden_virtuals and pending_virtuals with new_virtuals.
+ Replace redundant assignments with assertions.
+ (check_for_override): Add comment.
+ (check_bases_and_members): Replace pending_hard_virtuals with
+ overridden_virtuals and pending_virtuals with new_virtuals.
+ (create_vtbl_ptr): Likewise.
+ (layout_class_type): Likewise.
+ (finish_struct_1): Likewise. Add comments.
+
+2000-01-16 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (finish_struct_1): Replace redundant code with
+ assertions.
+
+ * cp-tree.h (flag_new_abi): Move.
+ (flag_use_cxa_atexit): Likewise.
+ (flag_honor_std): Likewise.
+ (flag_rtti): Likewise.
+ (vbase_offsets_in_vtable_p): Define.
+ (vptrs_present_everywhere_p): Likewise.
+ (TYPE_CONTAINS_VPTR_P): Likewise.
+ (dfs_walk_real): Declare.
+ * class.c (build_vbase_pointer_fields): Check
+ vbase_offsets_in_vtable_p.
+ (dfs_build_vbase_offset_vtbl_entries): Record the vbase indices in
+ BINFO_VPTR_FIELD.
+ (build_vbase_offset_vtbl_entries): Simplify.
+ (build_vbase_offset_vtbl_entries): Adjust.
+ (build_vbase_pointer): Add ability to look up vbase offsets in
+ vtable.
+ (start_vtable): New function.
+ (add_virtual_function): Use it.
+ (determine_primary_base): Use TYPE_CONTAINS_VPTR_P.
+ (num_extra_vtbl_entries): Use vbase_offsets_in_vtable_p.
+ (build_vtbl_initializer): Take the type of the complete object as
+ input. Use it to correctly calculate vbase offsets.
+ (dfs_finish_vtbls): Pass the complete type to
+ build_vtbl_initializer.
+ (check_bases_and_members): Use TYPE_CONTAINS_VPTR_P.
+ (create_vtable_ptr): Create a vtable even if there are no
+ new virtual functions, under the new ABI.
+ (finish_struct_1): Likewise.
+ (get_vfield_name): Use TYPE_CONTAINS_VPTR_P.
+ * decl.c (exapnd_static_init): Remove call to
+ preserve_initializer.
+ * decl2.c (mark_vtable_entries): Tweak to handle vbase offsets in
+ vtables.
+ * init.c (initialize_vtbl_ptrs): Initialize them in pre-order.
+ (expand_virtual_init): Use vbase_offsets_in_vtable_p.
+ (construct_virtual_bases): Don't initialize virtual base pointers
+ under the new ABI.
+ (build_aggr_init): Clean up comment.
+ (expand_aggr_init_1): Likewise.
+ * rtti.c (expand_class_desc): Store the virtual function table
+ index where the vbase offset lives in the offset field.
+ * search.c (dfs_walk_real): Make it global.
+ (dfs_debug_mark): Use TYPE_CONTAINS_VPTR_P.
+ * tree.c (make_binfo): Don't clear BINFO_VPTR_FIELD.
+
+ * tinfo.h (USItype): Make it signed under the new ABI.
+ * tinfo.cc (convert_to_base): New function. Encapsulate base
+ conversion logic here.
+ (__class_type_info::do_upcast): Use it.
+ (__class_type_info::do_dyncast): Likewise.
+ (__class_type_info::do_find_public_subobj): Likewise.
+
+ * init.c (construct_virtual_bases): Don't look up the addresses of
+ virtual bases at run-time.
+
+ * class.c (build_vbase_pointer): Relocate.
+ (build_vbase_pointer_fields): Likewise.
+ (dfs_build_vbase_offset_vtbl_entries): Likewise.
+ (build_vbase_offset_vtbl_entries): Likewise.
+
+ * decl.c (init_decl_processing): Complain if -fnew-abi
+ -fno-vtable-thunks is used.
+
+ * decl2.c (lang_decode_option): Don't couple flag_honor_std to
+ flag_new_abi.
+
+2000-01-15 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (num_extra_vtbl_entries): New function.
+ (size_extra_vtbl_entries): Likewise.
+ (dfs_vtable_path_unmark): Likewise.
+ (dfs_vtable_path_unmarked_real_bases_queue_p): Likewise.
+ (dfs_vtable_path_marked_real_bases_queue_p): Likewise.
+ * class.c (num_extra_vtbl_entries): New function.
+ (size_extra_vtbl_entries): Likewise.
+ (dfs_build_vbase_offset_vtbl_entries): New function.
+ (build_vbase_offset_vtbl_entries): Likewise.
+ (build_vtbl_initializer): Use it.
+ (finish_struct_1): Adjust vtable sizes (using
+ num_extra_vtbl_entries).
+ * expr.c (cplus_expand_expr): Assert that the DECL_RTL for a
+ THUNK_DECL is non-NULL before expanding it.
+ * init.c (expand_virtual_init): Adjust the vtable pointer by
+ size_extra_vtbl_entries before storing it.
+ * search.c (get_shared_vase_if_not_primary): Adjust prototype.
+ Handle TREE_LIST parameters here, not in the dfs_* functions.
+ (dfs_unmarked_real_bases_queue_p): Adjust.
+ (dfs_marked_real_bases_queue_p): Likewise.
+ (dfs_vtable_path_unmarked_real_bases_queue_p): New function.
+ (dfs_vtable_path_marked_real_bases_queue_p): New function.
+ (dfs_vtable_path_unmark): Likewise.
+
+2000-01-14 Mark Mitchell <mark@codesourcery.com>
+
+ * optimize.c (copy_body_r): Clear the operand three of a
+ TARGET_EXPR when copying it.
+
+2000-01-14 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * method.c (build_decl_overload_real): Check whether we are in ::
+ before returning __builtin_new/delete.
+
+2000-01-13 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (tsubst_friend_function): Improve comment.
+ (instantiate_decl): Avoid crashing when a "nested" function is
+ instantiated from the top level.
+
+ * dump.c (dqeueue_and_dump): Dump
+ DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION.
+
+2000-01-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * call.c: If GATHER_STATISTICS, declare `n_build_method_call'.
+
+2000-01-13 Nathan Sidwell <sidwell@codesourcery.com>
+
+ * g++spec.c (lang_specific_driver): Add -fnew-abi if
+ ENABLE_NEW_GXX_ABI defined.
+ * Make-lang.in (tinfo.o, tinfo2.o, exception.o, new.o,
+ opnew.o, opnewnt.o, opvnew.o, opvnewnt.o, opdel.o, opdelnt.o,
+ opvdel.o, opvdelnt.o): Use GXX_ABI_FLAG switch.
+
+2000-01-12 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (start_cleanup_fn): Call pushdecl.
+
+ * call.c (convert_class_to_reference): Fix typos.
+ (build_conditional_expr): Handle errors gracefully.
+ * class.c (push_nested_class): Likewise.
+ * cp-tree.h (VAR_FUNCTION_OR_PARM_DECL_CHECK): New macro.
+ (DECL_THIS_EXTERN): Use it.
+ (DECL_THIS_STATIC): Likewise.
+ * cvt.c (convert_to_void): Handle errors gracefully.
+ (build_expr_type_conversion): Likewise.
+ * decl.c (maybe_push_decl): Likewise.
+ (start_decl_1): Likewise.
+ (require_complete_types_for_parms): Likewise.
+ * parse.y (structsp): Likewise.
+ (base_class): Likewise.
+ * parse.c: Regenerated.
+ * pt.c (finish_member_template_decl): Likewise.
+ * typeck.c (decay_conversion): Likewise.
- * typeck2.c (digest_init): Always convert initializers to the
- right type.
+ * cp-tree.h (dfs_skip_vbases): New function.
+ (find_vbase_instance): Likewise.
+ * class.c (determine_primary_base): Allow a nearly empty base to
+ serve as a primary base class under the new ABI.
+ (get_class_offset_1): Rename to ...
+ (dfs_get_class_offset): ... this. Simplify. Don't issue error
+ messages here.
+ (get_class_offset): Use it. Issue error messages here.
+ (dfs_modify_vtables): Rely on dfs_unmarked_real_bases_queue_p to
+ find the right copies of virtual bases.
+ (fixup_vtable_deltas1): Rename to ...
+ (dfs_fixup_vtable_deltas): ... this. Adjust to handle virtual
+ bases as primary bases.
+ (fixup_vtable_deltas): Remove.
+ (override_one_vtable): Handle virtual bases as primary bases.
+ (merge_overrides): Likewise.
+ (finish_struct_1): Likewise.
+ (dump_class_hierarchy): Dump primary-ness of bases as well.
+ * search.c (mark_primary_bases): Use a pre-order traversal to
+ handle primary virtual bases.
+ (dfs_skip_vbases): New fiunction.
+ (expand_upcast_fixups): Adjust to handle primary virtual bases.
+ (fixup_virtual_upcast_offsets): Likewise.
+ (fixup_all_virtual_upcast_offsets): Likewise.
+ (dfs_find_vbase_instances): New function.
+ (find_vbase_instance): Likewise.
+
+2000-01-11 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * lex.c (DIR_SEPARATOR): Delete macro.
+
+2000-01-12 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * decl2.c (lang_decode_option): Handle automatic line wrapping
+ option.
+
+2000-01-11 Mark Mitchell <mark@codesourcery.com>
+
+ * friend.c (do_friend): Don't resolve scopes when processing
+ template declarations, even if the qualifying scope doesn't
+ involve template parameters.
+
+2000-01-10 Mark Mitchell <mitchell@dumbledore.codesourcery.com>
+
+ * class.c (dfs_modify_vtables_queue_p): Remove.
+ (modify_all_vtables): Use dfs_unmarked_real_bases_queue_p
+ and dfs_marked_real_bases_queue_p instead of
+ dfs_modify_vtables_queue_p.
+
+ * class.c (build_vbase_path): Simplify.
+ (dfs_propagate_binfo_offsets): New function.
+ (propagate_binfo_offsets): Use it.
+ (remove_base_field): Simplify.
+ (dfs_set_offset_for_vbases): Remove.
+ (dfs_set_offset_for_shared_vbases): New function.
+ (dfs_set_offset_for_unshared_vbases): Likewise.
+ (layout_virtual_bases): Use them.
+ (layout_basetypes): Don't call propagate_binfo_offsets.
+ * search.c (dfs_get_vbase_types): Clone completely fresh binfos
+ for the vbases.
+
+ * class.c (build_base_field): New function, split out from ...
+ (build_base_fields): ... here. Use it. Allocate primary bases
+ first, under the new ABI.
+ (get_vtable_entry): Remove.
+ (remove_base_field): New function, split out from ...
+ (remove_base_fields): ... here. Adjust since primary bases come
+ first under the new ABI.
+
+ * cp-tree.h (expand_direct_vtbls_init): Remove declaration.
+ (initialize_vtbl_ptrs): New function.
+ (expand_indirect_vtbls_init): Change prototype.
+ (convert_pointer_to_vbase): Declare.
+ * init.c (expand_direct_vtbls_init): Remove.
+ (dfs_initialize_vtbl_ptrs): New function.
+ (initialize_vtbl_ptrs): Likewise.
+ (emit_base_init): Use initialize_vtbl_ptrs.
+ * search.c (convert_pointer_to_vbase): Make it global.
+ (expand_indirect_vtbls_init): Remove vtable initialization code.
+ * semantics.c (setup_vtbl_ptr): Use initialize_vtbl_ptrs.
+
+ * class.c (dfs_finish_vtbls): New function.
+ (finish_vtbls): Use it.
+ (dump_class_hierarchy): New function.
+
+ * cp-tree.h (BINFO_PRIMARY_MARKED_P): Change definition.
+ (BINFO_VBASE_PRIMARY_P): New macro.
+ (BINFO_VIRTUALS): Add to documentation.
+ (SET_BINFO_PRIMARY_MARKED_P): Remove.
+ (CLEAR_BINFO_PRIMARY_MARKED_P): Likewise.
+ (dfs_mark_primary_bases_queue_p): Likewise.
+ (dfs_unmarked_real_bases_queue_p): New function.
+ (dfs_marked_real_bases_queue_p): Likewise.
+ * search.c (dfs_mark_primary_bases): Adjust.
+ (mark_primary_bases): Likewise.
+ (get_shared_vbase_if_not_primary): New function.
+ (dfs_unmarked_real_bases_queue_p): Likewise.
+ (dfs_marked_real_bases_queue_p): Likewise.
+ (dfs_get_pure_virtuals): Simplify.
+ (get_pure_virtuals): Likewise.
+
+2000-01-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * lex.c: Include tm_p.h.
+
+2000-01-07 Nathan Sidwell <sidwell@codesourcery.com>
+
+ * lang-specs.h (__GXX_ABI_VERSION): New preprocessor macro.
+
+2000-01-06 Jason Merrill <jason@casey.cygnus.com>
+
+ * decl2.c (comdat_linkage): Don't set DECL_DEFER_OUTPUT.
+ * pt.c (instantiate_decl): Defer comdat templates that might not be
+ needed.
+
+ * cp-tree.h (DECL_NEEDED_P): Also true if !DECL_COMDAT.
+ * decl2.c (finish_vtable_vardecl): Don't check !DECL_COMDAT.
+ (finish_file): Likewise.
-Wed Oct 25 13:25:24 1995 Mike Stump <mrs@cygnus.com>
+ * decl2.c (import_export_class): Undo 12/14 change.
- * init.c (member_init_ok_or_else): Don't allow member initializers
- for indirect members, as it is invalid.
+ * error.c (dump_decl): operator new, not operatornew.
-Wed Oct 25 11:35:28 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+ * class.c (field_decl_cmp): A nontype is "greater" than a type.
+ * search.c (lookup_field_1): Look for the last field with the
+ desired name.
- * decl.c (grokdeclarator): Don't allow `friend signed ()'.
+2000-01-05 Nathan Sidwell <nathan@acm.org>
-Fri Oct 20 10:30:59 1995 Mike Stump <mrs@cygnus.com>
+ * decl2.c (lookup_arg_dependent): Deal with FNS not being a
+ FUNCTION_DECL.
- * parse.y (for.init.statement): Catch compound statements inside for
- initializations, if we're being pedantic.
+2000-01-05 Nathan Sidwell <nathan@acm.org>
-Fri Oct 20 10:03:42 1995 Mike Stump <mrs@cygnus.com>
+ * typeck.c (build_static_cast): Don't strip target qualifiers
+ when casting from a class.
- * decl.c (lookup_tag): Return NULL_TREE if we don't find what we are
- looking for.
+2000-01-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-Thu Oct 19 14:26:10 1995 Mike Stump <mrs@cygnus.com>
+ * class.c (warn_hidden): Initialize variable `fndecl'.
- * error.c (dump_expr): Don't core dump when a boolean expression is
- used as a default argument.
+2000-01-03 Ulrich Drepper <drepper@cygnus.com>
-Thu Oct 19 10:36:30 1995 Jason Merrill <jason@yorick.cygnus.com>
+ * decl.c (flag_isoc9x): New variable to be able to use code in
+ c-common.c. For now always zero.
- * class.c (finish_struct_bits): Check aggregate_value_p instead of
- RETURN_IN_MEMORY.
+2000-01-03 Mark Mitchell <mark@codesourcery.com>
-Wed Oct 18 18:12:32 1995 Jason Merrill <jason@yorick.cygnus.com>
+ * cp-tree.h (CLASSTYPE_VBASECLASSES): Improve documentation.
+ * class.c (layout_basetypes): Don't set BINFO_INHERITANCE_CHAIN
+ or unshare_base_binfos for virtual bases here.
+ * search.c (dfs_get_vbase_types): Do it here.
+ (get_vbase_types): Adjust.
- * class.c (finish_struct_bits): Also set TREE_ADDRESSABLE on a
- BLKmode type that would otherwise be returned in registers.
+2000-01-02 Mark Mitchell <mark@codesourcery.com>
-Mon Oct 16 12:32:19 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+ * cp-tree.h (CLASSTYPE_VFIELDS): Move definition.
+ (BINFO_PRIMARY_MARKED_P): Use flag 5.
+ (SET_BINFO_PRIMARY_MARKED_P): Likewise.
+ (CLEAR_BINFO_PRIMARY_MARKED_P): Likewise.
+ (unmark_primary_bases): Remove declaration.
+ (unmarkedp): Declare.
+ (dfs_vbase_unmark): Likewise.
+ * class.c (determine_primary_base): Return immediately if there
+ are no base classes. Call mark_primary_bases here.
+ (modify_all_direct_vtables): Remove.
+ (modify_all_indirect_vtables): Remove.
+ (dfs_modify_vtables_queue_p): New function.
+ (dfs_modify_vtables): New function.
+ (modify_all_vtables): Use them.
+ (build_base_fields): Build FIELD_DECLs for primary virtual base
+ classes.
+ (create_vtable_ptr): Don't call determine_primary_base here.
+ (dfs_mark_primary_bases_and_set_vbase_offsets): Rename to ...
+ (dfs_set_offset_for_vbases): ... this.
+ (layout_virtual_bases): Use it.
+ (layout_class_type): Call determine_primary_base here.
+ * search.c (unmarkedp): Make it global.
+ (shared_marked_p): Simplify.
+ (shared_unmarked_p): Likewise.
+ (dfs_primary_bases_queue_p): Remove.
+ (dfs_unmark_primary_bases): Likewise.
+ (unmark_primary_bases): Likewise.
+ (mark_primary_bases): Simplify.
+ (get_pure_virtuals): Don't call mark_primary_bases here.
+ (dfs_vbase_unmark): New function.
+ (get_vbase_types): Simplify.
+
+ * class.c (struct base_info): Remove.
+ (determine_primary_base): Take has_virtual_p rather than a
+ base_info as input. Don't calculate max_has_virtual.
+ (finish_struct_bits): Remove max_has_virtual argument.
+ (create_vtable_ptr): Remove max_has_virtual_p argument.
+ (layout_virtual_bases): Remove max argument.
+ (layout_basetypes): Likewise.
+ (layout_class_type): Remove max_has_virtual_p argument.
+ (finish_struct_1): Remove max_has_virtual.
+
+ * cp-tree.h (dfs_mark_primary_bases_queue_p): New function.
+ (layout_basetypes): Remove.
+ * class.c (propagate_binfo_offsets): Moved here from tree.c.
+ Update to handle primary virtual bases.
+ (remove_base_fields): New function, split out from
+ layout_basetypes.
+ (dfs_mark_primary_bases_and_set_vbase_offsets): New function.
+ (layout_virtual_bases): New function, split out from
+ layout_basetypes. Update to handle primary virtual bases.
+ (layout_basetypes): Moved here from tree.c. Use
+ remove_base_fields and layout_virtual_bases.
+ * search.c (dfs_mark_primary_bases_queue_p): New function.
+ (mark_primary_bases): Use it.
+ * tree.c (CEIL): Remove.
+ (propagate_binfo_offsets): Remove.
+ (layout_basetypes): Remove.
+
+2000-01-01 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (CLASSTYPE_N_BASECLASSES): Use BINFO_N_BASETYPES.
+ (BINFO_PRIMARY_MARKED_P): New macro.
+ (SET_BINFO_PRIMARY_MARKED_P): Likewise.
+ (CLEAR_BINFO_PRIMARY_MARKED_P): Likewise.
+ (mark_primary_bases): New function.
+ (unmark_primary_bases): Likewise.
+ * search.c (get_abstract_virtuals_1): Remove.
+ (dfs_mark_primary_bases): New function.
+ (mark_primary_bases): Likewise.
+ (dfs_unmark_primary_bases): Likewise.
+ (unmark_primary_bases): Likewise.
+ (dfs_get_pure_virtuals): Likewise.
+
+2000-01-01 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (skip_rtti_stuff): Adjust prototype.
+ * class.c (skip_rtti_stuff): Reorganize parameters and return value.
+ (modify_one_vtable): Adjust.
+ (fixup_vtable_deltas1): Likewise.
+ (override_one_vtable): Likewise.
+ * search.c (get_abstract_virtuals_1): Likewise.
+ (get_pure_virtuals): Likewise.
+ (expand_upcast_fixups): Likewise.
+ * tree.c (debug_binfo): Likewise.
- * g++.c (WITHLIBC): New macro.
- (main): Declare saw_libc. Use WITHLIBC if `-lc' was used; set
- saw_libc and pass it at the end if it was set.
+ * class.c (build_vtable): Don't return a value. Don't rebuild
+ vtables for bases that have already been handled.
+ (prepare_fresh_vtable): Don't rebuild vtables for bases that have
+ already been handled.
+ (modify_one_vtable): Adjust accordingly.
+ (fixup_vtable_deltas1): Likewise.
+ (finish_struct_1): Likewise.
-Wed Oct 11 16:30:34 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+2000-01-01 Martin v. Löwis <loewis@informatik.hu-berlin.de>
- * parse.y (fn.def1): Call split_specs_attrs in
- declmods notype_declarator case.
+ * call.c (build_new_method_call): Also check destructors.
diff --git a/contrib/gcc/cp/ChangeLog.1 b/contrib/gcc/cp/ChangeLog.1
new file mode 100644
index 0000000..b411f18
--- /dev/null
+++ b/contrib/gcc/cp/ChangeLog.1
@@ -0,0 +1,9451 @@
+Sun Nov 26 14:47:42 1995 Richard Kenner <kenner@mole.gnu.ai.mit.edu>
+
+ * Version 2.7.2 released.
+
+Mon Nov 20 14:05:00 1995 Mike Stump <mrs@cygnus.com>
+
+ * g++.c (pfatal_with_name): Add missing third argument to concat.
+
+Thu Oct 26 13:59:54 1995 Mike Stump <mrs@cygnus.com>
+
+ * init.c (expand_aggr_init): Handle cv qualifiers on the object's
+ type.
+
+Sat Nov 11 08:25:55 1995 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * Version 2.7.1 released.
+
+Thu Nov 2 17:02:47 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (convert_harshness): Handle references to arrays.
+
+Fri Oct 27 14:20:21 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (comp_target_types): Check multi-level pointer
+ conversions in both directions.
+
+Tue Oct 17 21:39:05 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (explicit_instantiation): Fix 'extern template' with no
+ return type.
+
+Mon Oct 16 14:35:20 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (explicit_instantiation): Support automatic instantiation
+ of constructors.
+ (named_class_head_*): Support out-of-class definition of nested
+ types.
+
+Wed Oct 11 12:20:56 1995 Mike Stump <mrs@cygnus.com>
+
+ * search.c (envelope_add_decl): New routine. Fix so that
+ methods are hidden in the same way that other members are.
+ (dfs_pushdecls): Cleanup and move functionality out of line,
+ into envelope_add_decl.
+
+Tue Oct 10 15:46:01 1995 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (mark_addressable): Only call assemble_external if we
+ have started the output file.
+
+Tue Oct 10 11:27:18 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (start_function): Fix earlier cv-quals change.
+
+Mon Oct 9 23:53:05 1995 Mike Stump <mrs@cygnus.com>
+
+ * parse.y (complex_direct_notype_declarator): Only push the class if
+ we are not already in the class.
+
+Mon Oct 9 11:22:03 1995 Doug Evans <dje@canuck.cygnus.com>
+
+ * decl.c (duplicate_decls): Call merge_machine_decl_attributes.
+ Update olddecl's attributes too.
+ (grokdeclarator): #if 0 out call to build_decl_attribute_variant.
+ * typeck.c (common_type): Call merge_machine_type_attributes.
+
+Fri Oct 6 14:44:27 1995 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (mark_addressable): Add missing call to
+ assemble_external.
+
+Wed Oct 4 15:06:39 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (store_parm_decls): Make sure the unwinder start comes
+ before the exception specification start.
+ * except.c (expand_exception_blocks): Make sure the unwinder end
+ comes after the terminate protected catch clause region and after
+ the end of the exception specification region.
+
+Wed Oct 4 12:47:02 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (real_yylex): Fix identifier case for linemode.
+ (handle_sysv_pragma): Don't abort when we see a pragma we don't
+ recognize.
+
+Tue Oct 3 14:09:46 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (store_parm_decls): Add a call to start_eh_unwinder.
+ * except.c (init_exception_processing): __throw doesn't take any
+ arguments.
+ (expand_builtin_throw): Likewise. Always use Pmode, instead of SImode
+ for all pointers. Use expand_builtin_return_addr to unwind the
+ first level off the stack.
+ (do_unwind): Always use Pmode, instead of SImode for all pointers.
+ (expand_exception_blocks): Add a call to end_eh_unwinder.
+ (start_eh_unwinder, end_eh_unwinder): New routines to build machine
+ independent stack unwinders for function/method calls.
+
+Mon Oct 2 17:20:42 1995 Mike Stump <mrs@cygnus.com>
+
+ * tree.c (unsave_expr_now): Make sure we process the argument list
+ of any called functions. Fixes incorrect code generation for
+ cleanups.
+
+Mon Oct 2 13:04:16 1995 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (get_member_function_from_ptrfunc): Save function if it
+ needs it. Cures core dump on things like (this->*(f()))().
+
+Sat Sep 23 22:51:25 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (start_function): Conform to gcc cv-quals convention (no
+ expression has a cv-qualified type) in RESULT_DECLs.
+ * method.c (make_thunk): Likewise.
+
+Fri Sep 22 10:21:13 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (pushtag): Add in the namespace name for the tag.
+
+Thu Sep 21 13:11:13 1995 Mike Stump <mrs@cygnus.com>
+
+ * parse.y (maybe_base_class_list, base_class_list, base_class,
+ base_class_access_list): Make sure we see the typenames for base
+ classes.
+ * lex.c (see_typename): Instead of failing to see a typename when
+ there is no next token, perfer a typename, and get the next token.
+
+Wed Sep 20 12:35:27 1995 Michael Meissner <meissner@cygnus.com>
+
+ * decl.c (init_decl_processing): Add __builtin_expect.
+
+Tue Sep 19 16:48:11 1995 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (cp_convert_to_pointer): Don't allow leftover conversions to
+ or from pointer to member functions, they must all be handled before
+ this point.
+
+Fri Sep 15 17:14:47 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * init.c (resolve_offset_ref): Fix wording of non-static member
+ being referenced as a static.
+
+Fri Sep 15 12:39:11 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_indirect_ref): Only bash pointer if we actually
+ call build_expr_type_conversion.
+
+Thu Sep 14 18:24:56 1995 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cvt.c (build_expr_type_conversion): Handle conversion from
+ reference.
+ * typeck.c (build_indirect_ref): Avoid infinite recursion.
+
+Thu Sep 14 17:23:28 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (expand_start_early_try_stmts): New routine to start a try
+ block at the start of the function, for function-try-blocks.
+ * cp-tree.h (expand_start_early_try_stmts): Declare it.
+ * parse.y (function_try_block): Use it, instead of doing it here, as
+ we don't want to include rtl.h here, as that conflicts with RETURN
+ in the parser.
+
+Wed Sep 13 18:32:24 1995 Mike Stump <mrs@cygnus.com>
+
+ * lex.c (reinit_parse_for_block): Support saving inline
+ function-try-blocks, uses peekyylex.
+ * parse.y (eat_saved_input): New rule, permit the parser to see that
+ END_OF_SAVED_INPUT is ok, as it can see this when parsing the
+ handlers of a function-try-block.
+ (fndef): Use it.
+ (component_decl): Make sure TRY and RETURN can come after fn.def2.
+ * spew.c (peekyylex): New routine to peek at what will come next.
+
+Wed Sep 13 16:52:06 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (comptypes): Tighten up comparisons of template type
+ parms.
+
+ * decl.c (duplicate_decls): Turn off whining about virtual functions
+ redeclared inline for now.
+
+Wed Sep 13 11:13:40 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (store_in_parms): New routine to put things before we
+ put base inits.
+ * cp-tree.h (store_in_parms): Declare it.
+ * decl.c (store_parm_decls): Use it to makr sure the starting of the
+ eh spec comes before base inits.
+ (finish_function): Use sequences instead of the obsolete
+ reorder_insns.
+ * parse.y (fndef): Enhance readability and maintainability. Update
+ to include function_try_block syntax.
+ (function_try_block): Add.
+
+Tue Sep 12 17:43:07 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * call.c (convert_harshness): Use comptypes, not ==, to check if
+ TYPE and PARMTYPE are equivalent on a function type.
+
+Tue Sep 12 17:31:33 1995 Douglas Rupp <drupp@cs.washington.edu>
+
+ * Make-lang.in (cc1plus): Removed unnecessary $(exeext).
+
+Mon Sep 11 23:24:07 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_throw): Never allocate storage for thrown pointer
+ to objects.
+
+Mon Sep 11 19:36:45 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_start_catch_block): Pointers to objects come
+ back from catch matching already dereferenced, don't dereference
+ again.
+
+Mon Sep 11 15:46:28 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_throw): Only decay the throw expression, don't do
+ any default conversions. This is so that one can throw and catch
+ characters, and not have them match integers.
+
+Mon Sep 11 13:46:45 1995 Mike Stump <mrs@cygnus.com>
+
+ * error.c (dump_aggr_type): Deal with anonymous unions that don't
+ have a TYPE_NAME.
+
+Fri Sep 8 20:40:27 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * lex.c (handle_sysv_pragma): Deal with getting a comma from yylex.
+
+Fri Sep 8 15:51:41 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_end_eh_spec): Handle empty EH specifications.
+
+Fri Sep 8 15:27:22 1995 Mike Stump <mrs@cygnus.com>
+
+ * cp-tree.h (expand_start_eh_spec): Declare new routine.
+ (expand_end_eh_spec): Likewise.
+ * decl.c (store_parm_decls): Call expand_start_eh_spec to process
+ exception specifications.
+ * except.c (expand_leftover_cleanups): Remove unused parameter.
+ (expand_end_catch_block): Likewise.
+ (expand_exception_blocks): Likewise.
+ (expand_start_eh_spec): New routine to mark the start of an
+ exception specification region.
+ (expand_end_eh_spec): New routine to mark the end of an exception
+ specification region.
+ (expand_exception_blocks): Call expand_end_eh_spec to process
+ exception specifications.
+
+Fri Sep 8 14:40:48 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * lex.c (do_identifier): Use global binding in preference of
+ dead for local variable.
+
+Wed Sep 6 19:32:59 1995 Mike Stump <mrs@cygnus.com>
+
+ * cp-tree.h (build_exception_variant): Remove used first argument.
+ * decl.c (duplicate_decls): Likewise.
+ (grokfndecl): Likewise.
+ (revert_static_member_fn): Likewise.
+ * decl2.c (grok_method_quals): Likewise.
+ * tree.c (build_exception_variant): Likewise.
+ * typeck.c (common_type): Likewise.
+ * decl2.c (grokclassfn): After changing the type, call
+ build_exception_variant, if necessary.
+
+Tue Sep 5 15:56:27 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_throw): Run cleanups for the throw expression.
+
+Wed Aug 30 15:24:38 1995 Stephen L. Favor <sfavor@tigger.intecom.com>
+
+ * except.c (expand_builtin_throw): Moved gen_label_rtx calls beyond
+ the store_parm_decls call which does initialization in the emit_*
+ code concerning label numbering.
+
+Thu Aug 31 09:01:07 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_internal_throw): Let the frontend be responsible
+ for managing all frontend EH parameters, the backend routine only
+ needs to deal with backend values. type and value are no longer
+ passed to __throw.
+ (init_exception_processing): Likewise.
+ (expand_start_all_catch): Likewise.
+ (expand_end_all_catch): Likewise.
+ (expand_leftover_cleanups): Likewise.
+ (expand_end_catch_block): Likewise.
+ (expand_builtin_throw): Likewise.
+ (expand_throw): Likewise.
+
+Tue Aug 29 15:04:36 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * cp-tree.h (DECL_REAL_CONTEXT): Give the real declaration context
+ for a decl.
+ * decl.c (cp_finish_decl): Use it.
+
+Tue Aug 29 10:30:27 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_internal_throw): Oops, almost forgot type and
+ value are now trees.
+
+Mon Aug 28 17:57:45 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ Fix the attribute handling to make sure they get noted before we
+ create the function's RTL, in case they can affect that.
+ * decl.c (grokfndecl): New arg ATTRLIST. Run
+ cplus_decl_attributes before creating the decl's rtl.
+ (grokdeclarator): New arg ATTRLIST, passed down into grokfndecl.
+ (shadow_tag, groktypename, start_decl, start_method): Pass a
+ NULL_TREE to grokdeclarator's new last arg.
+ * decl2.c (grokfield): New arg ATTRLIST, passed into grokdeclarator.
+ (grokbitfield, grokoptypename): Pass a NULL_TREE to
+ grokdeclarator's new last arg.
+ * except.c (expand_start_catch_block): Likewise.
+ * pt.c (process_template_parm, end_template_decl,
+ do_function_instantiation): Likewise.
+ * cp-tree.h (grokfield): Add arg.
+ (grokdeclarator): Move the prototype from here...
+ * decl.h: ...to here.
+ * lex.c (cons_up_default_function): Pass NULL_TREE to grokfield
+ ATTRLIST argument.
+ * parse.y: Create a list for the grokfield arg where appropriate,
+ and pass it down instead of calling cplus_decl_attributes.
+
+Mon Aug 28 15:07:24 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c: Always allow turning on exception handling. Allow cross
+ compilations to use EH.
+
+Thu Aug 24 17:39:24 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (saved_pc, saved_throw_type, saved_throw_value): Use
+ trees, instead of rtxs, and don't depend on using special machine
+ dependent registers.
+ (expand_internal_throw): Likewise.
+ (init_exception_processing): Likewise.
+ (expand_start_all_catch): Likewise.
+ (expand_end_all_catch): Likewise.
+ (expand_start_catch_block): Likewise.
+ (expand_leftover_cleanups): Likewise.
+ (expand_end_catch_block): Likewise.
+ (expand_builtin_throw): Likewise.
+ (expand_throw): Likewise.
+
+Wed Aug 23 17:25:51 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * cvt.c (build_expr_type_conversion): Handle conversions to
+ reference types.
+
+Wed Aug 23 15:33:59 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (do_unwind): Work around backend bug with -fpic.
+
+Tue Aug 22 17:20:07 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * decl2.c (flag_new_for_scope): Add a new mode that follows ANSI
+ for-scoping, but supports (and warns about) old programs.
+ Make the new mode (with value 1) the default.
+ (lang_f_options): The on-value for flag_new_for_scope is now 2.
+ * cp-tree.h (DECL_DEAD_FOR_LOCAL, DECL_ERROR_REPORTED): New macros
+ (DECL_SHADOWED_FOR_VAR): Likewise.
+ * decl.c (struct binding_level): New fields dead_vars_from_for
+ and is_for_scope.
+ (note_level_for_for): New function.
+ (poplevel): Special processing if is_for_scope.
+ (pushdecl): Warn if for-scope variable shadows local.
+ * lex.c (do_identifier): Handle old (non-ANSI) for scoping,
+ and warn if conflicts.
+ * parse.y (FOR): Call note_level_for_for.
+
+Mon Aug 21 10:28:31 1995 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl2.c (import_export_inline): Class interface hackery does not
+ apply to synthesized methods.
+
+Sun Aug 20 16:29:00 1995 Mike Stump <mrs@cygnus.com>
+
+ * search.c (virtual_context): Find the right context more often.
+ Solves a `recoverable compiler error, fixups for virtual function'
+ problem.
+
+Sun Aug 20 13:53:24 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_start_all_catch): Ensure that we always transfer
+ control to the right EH handler, by rethrowing the end label on the
+ region, instead of hoping we are nested and falling through.
+ (expand_leftover_cleanups): Likewise.
+ (end_protect): Since we now rethrow the end label, put a
+ nop after it, so that outer regions are recognized.
+ * init.c (build_vec_delete_1): New routine to handle most of vector
+ deleting, all code moved here from build_vec_delete.
+ (build_array_eh_cleanup): Use build_vec_delete_1 to do all the real
+ work.
+ (expand_vec_init): If the array needs partial destructing, setup an
+ EH region to handle it.
+ (build_vec_delete): Move lots of code to build_vec_delete_1, use
+ build_vec_delete_1 to do the grunt work.
+
+Sat Aug 19 14:25:33 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ Handle decl attributes properly for function definitions without
+ previous attribute-loaded declarations.
+ * decl.c (start_function): New arg ATTRS. Add a call to
+ cplus_decl_attributes with it before we create the RTL.
+ * cp-tree.h (start_function): Update prototype.
+ * parse.y (fn.def1): Pass ATTRS into start_function instead of
+ trying to call cplus_decl_attributes too late. Pass a NULL_TREE
+ for other use.
+ * decl2.c (finish_file): Pass NULL_TREE as fourth arg to
+ start_function.
+ * method.c (synthesize_method): Likewise.
+ * except.c (expand_builtin_throw): Likewise for start on __throw.
+
+Sat Aug 19 13:36:08 1995 Mike Stump <mrs@cygnus.com>
+
+ * class.c (set_rtti_entry): Turn on -fvtable-thunk -frtti support.
+ This changes -fvtable-thunks vtable layout, so a recompile will be
+ necessary, if you use -fvtable-thunks.
+ (get_vtable_entry): Use n, instead of i to be consistent with the
+ rest of the compiler.
+ (get_vtable_entry_n): Likewise.
+ (add_virtual_function): Add a slot for the tdesc, if -fvtable-thunks
+ are being used.
+ (finish_struct_1): Likewise.
+ (skip_rtti_stuff): New routine to collapse similar code from many
+ different parts of the compiler. I think I got them all.
+ (modify_one_vtable): Use it.
+ (fixup_vtable_deltas1): Likewise.
+ (override_one_vtable): Likewise.
+ * decl2.c (mark_vtable_entries): Likewise.
+ * tree.c (debug_binfo): Likewise.
+ * search.c (expand_upcast_fixups): Likewise.
+ (get_abstract_virtuals_1): Likewise. Use virtuals, instead of tmp to
+ consistent with the rest of the compiler.
+ (get_abstract_virtuals): Likewise.
+ * cp-tree.h (skip_rtti_stuff): New routine, declare it.
+ * gc.c (build_headof): Support -fvtable-thunk and -frtti together.
+ (build_typeid): Likewise.
+ (build_classof): Remove old style way of doing rtti. Remove support
+ for `classof' and `headof'.
+ * gxx.gperf: Likewise.
+ * hash.h: Likewise.
+ * parse.y: Likewise.
+
+Fri Aug 18 17:31:58 1995 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (start_function): Clear ctor_label and dtor_label.
+
+ * class.c (finish_struct_1): Fix handling of access decls.
+
+Tue Aug 15 19:21:54 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * class.c (finish_struct): Only do minimal processing here, so it
+ can be used for class template definitions, as well.
+ (finish_struct_1): New function with the rest of the code.
+
+Tue Aug 15 09:46:16 1995 Mike Stump <mrs@cygnus.com>
+
+ * class.c (prepare_fresh_vtable): On second though, always build the
+ offset (see Aug 10 change), unless -fvtable-thunks is given. It
+ does this by calling the new routine set_rtti_entry.
+ (finish_struct): Likewise.
+ (set_rtti_entry): New routine to update the rtti information at the
+ start of the vtable.
+
+Mon Aug 14 12:21:22 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * error.c (dump_decl, case IDENTIFIER_NODE): Only work on a dtor
+ if it's declared in the C++ language spec.
+ (dump_function_decl): Likewise.
+ (dump_function_name): Likewise.
+ (ident_fndecl): Make sure we got something back from lookup_name.
+ * decl.c (start_function): Likewise.
+
+Fri Aug 11 16:52:15 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (build_method_call): Don't call build_new when calling a
+ constructor without an instance.
+
+Thu Aug 10 20:00:17 1995 Mike Stump <mrs@cygnus.com>
+
+ * class.c (prepare_fresh_vtable): Always build the offset to the
+ complete object, as it doesn't cost much. This allows dynamic_cast
+ to void * to work when -frtti isn't given.
+ (finish_struct): Likewise.
+
+Thu Aug 10 16:31:28 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (build_eh_type): Split out some functionality to new
+ routine named build_eh_type_type.
+ (build_eh_type_type): New routine.
+ (expand_start_catch_block): Use build_eh_type_type, as we never want
+ the dynamic type of the catch parameter, just the static type.
+ Fixes core dumps when -frtti is used and one catchs pointers to
+ classes.
+
+Thu Aug 10 14:55:29 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_builtin_throw): Since we now use normal calling
+ conventions for __throw, we have to remove the first layer off the
+ stack, so that the next context we search for handlers is the outer
+ context instead of the context that had the call to __throw, if we
+ don't immediately find the desired context.
+
+Tue Aug 8 17:44:23 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * tree.c (cp_expand_decl_cleanup): Returns int, not tree.
+ * cp-tree.h: Update.
+
+ * parse.y (template_type_parm): Add support for `typename'.
+
+Tue Aug 8 12:06:31 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_internal_throw): New internal routine to throw a
+ value.
+ (expand_end_all_catch, expand_leftover_cleanups): All throwers
+ changed to use `expand_internal_throw' instead of jumping to throw
+ label.
+ (expand_end_catch_block, expand_throw): Likewise.
+ (throw_label): Removed.
+ (expand_builtin_throw): Changed so that EH parameters are passed by
+ normal function call conventions. Completes Aug 4th work.
+
+Fri Aug 4 17:17:08 1995 Mike Stump <mrs@cygnus.com>
+
+ * cp-tree.h (expand_builtin_throw): Declare it.
+ * decl2.c (finish_file): Call expand_builtin_throw.
+ * except.c (make_first_label): Remove.
+ (init_exception_processing): Don't use a LABEL_REF for throw_label,
+ instead use a SYMBOL_REF, this is so that we don't use LABEL_REFs in
+ other functions that don't really appear in those functions. This
+ solves a problem where cc1plus consumed exponential amounts of
+ memory when -Wall was used.
+ (expand_end_all_catch, expand_leftover_cleanups,
+ expand_end_catch_block, expand_throw): Change all uses of
+ throw_label to match new style.
+ (do_unwind): Rename parameter to inner_throw_label, as it is now
+ different from throw_label. Also, assume that our caller will wrap
+ the passed label with a LABEL_REF, if needed.
+ (expand_builtin_throw): Make external, change so that the generated
+ throw is now a real function.
+ (expand_exception_blocks): Never generate throw code inside another
+ function.
+
+Fri Aug 4 12:20:02 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (grokdeclarator): Move checking of mutable const objects
+ and mutable static objects down, as we might decide during parsing
+ to unset staticp or constp (for example, when const is part of the
+ object being pointed to).
+
+Thu Aug 3 17:13:43 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (output_exception_table_entry): Enhance portability to
+ weird machines.
+ (emit_exception_table): Likewise.
+
+Thu Aug 3 16:41:38 1995 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_ptrmemfunc): Handle casting of pointer to
+ non-virtual member functions.
+
+Wed Aug 2 11:58:25 1995 Mike Stump <mrs@cygnus.com>
+
+ * gc.c (build_typeid): Strip cv qualifiers so that const T&, T&, T
+ and const T all match.
+
+Wed Aug 2 11:25:33 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (build_eh_type): Strip cv qualifiers so that const T&,
+ T&, T and const T all match.
+
+Tue Aug 1 14:20:16 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c: Fix up comments, cleanup code and eliminate exceptNode,
+ exceptStack, exceptstack, push_except_stmts, pop_except_stmts,
+ new_except_stack, push_last_insn, pop_last_insn, insn_save_node and
+ InsnSave. Also, numerous speed improvements, and correctness
+ improvements. Double faulting in all situations should now be
+ handled correctly.
+ (expand_start_all_catch): Instead of having many terminate protected
+ regions, just have one.
+ (expand_start_catch_block): No longer have to protect
+ false_label_rtx, as it isn't used for EH region marking.
+ (expand_end_catch_block): Expand out EH cleanups here by using
+ expand_leftover_cleanups.
+ (expand_end_all_catch): Use sequences instead of playing with insn
+ links directly.
+ (expand_exception_blocks): Likewise. Also protect all catch clauses
+ with one terminate region.
+
+Mon Jul 31 13:24:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * method.c (report_type_mismatch): Don't talk about an object
+ parameter for non-methods.
+
+Sun Jul 30 13:13:02 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * class.c (finish_struct): Catch private and protected members of
+ anonymous unions here.
+ * decl2.c (finish_anon_union): And here.
+ * parse.y: Instead of here.
+
+ * errfn.c (ARGSLIST): Support passing four args.
+ * error.c (cv_as_string): New function.
+ (cp_printers): Add it.
+ * call.c (build_method_call): Report 'const' at end of pseudo-decl.
+
+ * method.c (report_type_mismatch): Deal with a bad_arg of 0.
+
+ * init.c (expand_aggr_init): Handle volatile objects, too.
+
+Sat Jul 29 13:42:03 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (struct binding_level): Keep list of incomplete decls.
+ (print_binding_level): Use list_length to count them.
+ (pushdecl): Build up the list.
+ (hack_incomplete_structures): Walk it and prune completed decls.
+
+Fri Jul 28 15:26:44 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (comp_target_types): Don't check const and volatile for
+ function types.
+ (comp_ptr_ttypes_real): Likewise.
+
+Thu Jul 27 15:40:48 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (comp_target_types): Fix.
+
+Thu Jul 27 15:10:48 1995 Mike Stump <mrs@cygnus.com>
+
+ * cp-tree.h (unsave_expr_now, build_unsave_expr,
+ cp_expand_decl_cleanup): Declare new routines.
+ * decl.c (cp_finish_decl, store_parm_decls,
+ hack_incomplete_structures): Change all cals from
+ expand_decl_cleanup to cp_expand_decl_cleanup.
+ * gc.c (protect_value_from_gc): Likewise.
+ * expr.c (cplus_expand_expr): Handle UNSAVE_EXPRs.
+ * tree.c (unsave_expr): New routine to build an UNSAVE_EXPR.
+ (unsave_expr_now): Backend routine used by tree expander.
+ (cp_expand_decl_cleanup): Wrap second argument in an UNSAVE_EXPR to
+ work around a limitation in the backend. The backend uses the
+ cleanups multiple times, on disjoint control flows, so we cannot
+ pass unsaved SAVE_EXPRs to the backend.
+ * tree.def (UNSAVE_EXPR): New tree code.
+ * typeck.c (c_expand_return): Move goto/return code up inside
+ conditional, as we don't always want to do this, we only want to do
+ this when we don't otherwise finish with this control flow.
+
+Thu Jul 27 10:38:43 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y (typespec): Only complain about typeof if we're not
+ getting it from a system header.
+
+Thu Jul 27 10:26:23 1995 Doug Evans <dje@canuck.cygnus.com>
+
+ Clean up prefix attribute handling.
+ * parse.y (reserved_declspecs): Link prefix attributes with declspecs.
+ (declmods): Likewise.
+ (all rules that reference typed_declspecs and declmods): Call
+ split_specs_attrs or strip_attrs to separate declspecs and attrs.
+ (lang_extdef): Delete resetting of prefix_attributes.
+ (template_def, notype_declarator rule): Use NULL_TREE for
+ prefix_attributes.
+ (condition): Use NULL_TREE for prefix_attributes.
+ (setattrs): Deleted.
+ (nomods_initdcl0): Set prefix_attributes to NULL_TREE.
+ (component_decl): Delete resetting of prefix_attributes.
+ (component_decl_1, notype_components rule): Use NULL_TREE for
+ prefix_attributes.
+ (simple_stmt): Delete resetting of prefix_attributes.
+
+Mon Jul 24 13:37:53 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (convert_harshness): Deal with reference conversions before
+ others. Actually do array->pointer decay. Call comp_target_types
+ with pointer types rather than their targets.
+
+ * typeck.c (comp_target_types): Avoid assigning D const * to B *.
+
+Mon Jul 24 08:54:46 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * pt.c (to_be_restored): Move decl to global scope.
+
+Sat Jul 22 12:22:11 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (start_decl): Put back clearing of DECL_IN_AGGR_P.
+
+Fri Jul 21 17:09:02 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (grokdeclarator): Downgrade error about 'extern int A::i'
+ to pedwarn.
+
+ * pt.c (instantiate_template): Also avoid instantiation if the
+ function has already been declared to be a specialization.
+
+ * decl2.c (check_classfn): Ignore cname argument, and return the
+ matching function.
+
+ * decl.c (start_decl): Handle declarations of member functions
+ outside of the class (i.e. specialization declarations).
+
+Thu Jul 20 10:34:48 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * class.c (finish_struct): Don't mess with the type of bitfields.
+
+ * various.c: s/TYPE_POINTER_TO/build_pointer_type/.
+
+Thu Jul 20 01:43:10 1995 Mike Stump <mrs@cygnus.com>
+
+ * init.c (expand_aggr_init): Assume LOOKUP_ONLYCONVERTING if init
+ is not a parameter list (TREE_LIST).
+ (expand_default_init): If LOOKUP_ONLYCONVERTING is set, then set
+ LOOKUP_NO_CONVERSION so that we don't allow two-level conversions,
+ but don't set it otherwise.
+
+Wed Jul 19 20:32:01 1995 Mike Stump <mrs@cygnus.com>
+
+ * init.c (expand_default_init): Don't allow two-level conversions
+ during construction.
+
+Wed Jul 19 18:06:37 1995 Mike Stump <mrs@cygnus.com>
+
+ * gc.c (build_headof): The type of dyncasting to a pointer to cv
+ void, should be pointer to cv void.
+
+Wed Jul 19 17:25:43 1995 Mike Stump <mrs@cygnus.com>
+
+ * gc.c (build_dynamic_cast): Allow casting in const.
+
+Wed Jul 19 16:34:27 1995 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_const_cast): If we are passed error_mark_node,
+ return it.
+
+Wed Jul 19 15:24:48 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * class.c (push_nested_class): Make sure TYPE is non-nil.
+
+ * cvt.c (type_promotes_to): Watch for error_mark_node on the
+ incoming TYPE.
+
+Wed Jul 19 13:23:12 1995 Gerald Baumgartner <gb@alexander.cs.purdue.edu>
+
+ * cp-tree.h (SIGTABLE_VT_OFF_NAME): Renamed from SIGTABLE_OFFSET_NAME.
+ (SIGTABLE_VB_OFF_NAME): New macro.
+ (vt_off_identifier): Renamed from offset_identifier.
+ (vb_off_identifier): Added extern declaration.
+
+ * decl.c (vt_off_identifier): Renamed from offset identifier.
+ (vb_off_identifier): New variable to hold the identifier for the
+ sigtable field vb_off.
+ (init_decl_processing): Initialize vb_off_identifier.
+ Renamed vt_off_identifier from offset_identifier.
+ * sig.c (build_signature_method_call): Renamed offset_identifier and
+ local variable offset to vt_off_identifier and vt_off, respectively.
+ * sig.c (build_signature_table_constructor): Renamed offset to vt_off.
+
+ * decl.c (init_decl_processing): Add vb_off field to
+ sigtable_entry_type. Reorder fields so that pfn gets properly
+ aligned at a 64 bit boundary on the Alpha.
+ * sig.c (build_signature_table_constructor): Build the constructor
+ according to the new layout. Set the vb_off field to -1 for now.
+
+ * decl.c (init_decl_processing): Align sigtable_entry_type on word
+ boundaries instead of double word boundaries to save space.
+
+Tue Jul 18 16:58:37 1995 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (cp_convert): Always call build_cplus_new for a ctor.
+
+Tue Jul 18 14:24:53 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y (opt.component_decl_list): Only forbid private/protected
+ in anonymous unions. We need to make this know when the type is
+ defined for an object, to not give the error.
+
+Mon Jul 17 14:22:44 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y (opt.component_decl_list): Don't allow access control
+ as private or protected for union members.
+
+Sun Jul 16 14:01:00 1995 Jim Wilson <wilson@chestnut.cygnus.com>
+
+ * lex.c (check_newline): For 'p' case, move goto skipline line to
+ before end brace for 'pragma'.
+
+Fri Jul 7 13:55:58 1995 Mike Stump <mrs@cygnus.com>
+
+ * g++.1: Tiny updates.
+
+Fri Jul 7 13:05:20 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (cp_finish_decl): Only destruct local static variables if
+ they are constructed, and only construct the first time control
+ passes completely through its declaration (if not initialized with a
+ constant-expression).
+ (expand_static_init): Likewise.
+
+Wed Jul 5 14:05:04 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * typeck.c (comptypes, case OFFSET_REF): If either offset basetype
+ is a TEMPLATE_TYPE_PARM, give a match.
+
+Fri Jun 30 15:42:57 1995 Mike Stump <mrs@cygnus.com>
+
+ * method.c (build_overload_value): Handle encoding of null pointer
+ constants (or any pointer with a constant numeric value) for
+ templates.
+
+Fri Jun 30 13:45:51 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * call.c (convert_harshness): Add QUAL_CODE when we're faced with
+ const vs non-const for void conversions.
+
+Fri Jun 30 10:19:52 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_start_all_catch): Fix problem with finding an
+ outer nested try block when there is no code to separate it from an
+ inner try block.
+
+Fri Jun 30 02:22:26 1995 Mike Stump <mrs@cygnus.com>
+
+ * search.c (dfs_pushdecls): Consume 2 or 3 orders of magnitude less
+ memory please when virtual bases are used.
+
+Thu Jun 29 19:03:47 1995 Mike Stump <mrs@cygnus.com>
+
+ * class.c (build_vbase_path): Avoid testing things that cannot be
+ null to see if they are null.
+ * cvt.c (convert_pointer_to_vbase): Remove code that doesn't work.
+ * decl.c (finish_function): Pass a type into the new
+ convert_pointer_to_vbase instead of a binfo.
+ * search.c (convert_pointer_to_vbase): Rewritten to use get_vbase
+ and convert_pointer_to_real.
+ (expand_indirect_vtbls_init): Use convert_pointer_to_vbase instead
+ of the more cryptic call to get_vbase.
+
+Thu Jun 29 09:35:05 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (BOOL_TYPE_SIZE): Fix broken SLOW_BYTE_ACCESS check.
+
+Thu Jun 29 03:43:55 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * pt.c (instantiate_template): Don't strip 'this' twice.
+
+ * pt.c (coerce_template_parms): Allow null pointer constants.
+
+ * decl.c (revert_static_member_fn): But only if DECL_ARGUMENTS is
+ set.
+
+Wed Jun 28 18:39:03 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (revert_static_member_fn): Also remove 'this' from
+ DECL_ARGUMENTS.
+ * decl2.c (check_classfn): Don't revert this function until we get a
+ match.
+
+Wed Jun 28 14:07:27 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y (component_decl): Clear PREFIX_ATTRIBUTES here.
+
+Wed Jun 28 11:05:13 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (finish_file): Handle global vector news.
+ * init.c (build_new): Encode vector news so that later we will know
+ how many elements there are.
+
+Mon Jun 26 13:38:06 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * expr.c (cplus_expand_expr): Don't mess with temp slots.
+
+ * decl2.c (warn_if_unknown_interface): Don't crash if tinst_for_decl
+ returns null.
+
+ * decl2.c (check_classfn): Use revert_static_member_fn.
+ * decl.c (revert_static_member_fn): Diagnose static member functions
+ declared const or volatile.
+
+ * decl2.c (grokfield): Check for missing default args here, too.
+ (check_default_args): Function to do the checking.
+ * decl.c (pushdecl): Use it.
+
+ * decl.c (pushdecl): Don't warn about shadowing a member of `this'
+ if there is no `this'.
+
+Sun Jun 25 11:34:25 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (build_method_call): Downgrade 'called before definition'
+ to a warning, as it ought to go away after Monterey.
+
+Sat Jun 24 14:18:42 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * pt.c (coerce_template_parms): Don't do extra checking on pointer
+ to member arguments.
+
+ * class.c (finish_struct): const and reference members don't prevent
+ a class from being an aggregate.
+
+ * class.c (finish_struct): Signatures are always aggregates.
+
+Fri Jun 23 17:20:29 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c (check_classfn): Improve error message.
+
+ * pt.c (tsubst): Handle PROMOTE_PROTOTYPES.
+
+Thu Jun 22 01:50:42 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (comptypes): Don't ignore method quals.
+
+ * class.c (finish_struct): Non-abstract virtuals are always USED.
+
+ * decl.c (build_ptrmemfunc_type): The underlying union type isn't
+ IS_AGGR_TYPE, either.
+ * class.c (finish_struct): Use CLASSTYPE_NON_AGGREGATE instead.
+ * cp-tree.h: Likewise.
+
+ * cp-tree.h (lang_type): Add aggregate.
+ (CLASSTYPE_AGGREGATE): New macro.
+ (TYPE_NON_AGGREGATE_CLASS): Likewise.
+ * class.c (finish_struct): Determine whether a class is an
+ aggregate.
+ * decl.c (cp_finish_decl): Check TYPE_NON_AGGREGATE_CLASS instead of
+ TYPE_NEEDS_CONSTRUCTING.
+ * typeck2.c (digest_init): Check TYPE_NON_AGGREGATE_CLASS for
+ subobjects, too.
+
+ * pt.c (tsubst, PARM_TYPE): Propagate DECL_ARTIFICIAL.
+
+ * decl.c (start_function): For pre-parsed functions, layout all of
+ the parm decls again.
+ (grokvardecl): TREE_PUBLIC depends on DECL_THIS_EXTERN, not
+ DECL_EXTERNAL.
+
+ * pt.c (coerce_template_parms): Improve checking for invalid
+ template parms.
+
+Wed Jun 21 12:01:16 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (grokdeclarator): Forbid declaration of a static member
+ with the same name as its enclosing class.
+
+Mon Jun 19 10:28:14 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (finish_function): Clear current_class_decl.
+
+ * typeck.c (build_conditional_expr): Use convert (boolean_type_node
+ instead of truthvalue_conversion.
+
+ * class.c (finish_struct): A data member with the same name as the
+ class doesn't suppress constructors.
+
+Fri Jun 16 18:11:39 1995 Gerald Baumgartner <gb@alexander.cs.purdue.edu>
+
+ * decl.c (start_function): If current_class_decl is a signature
+ pointer, don't dereference it but set C_C_D to current_class_decl.
+
+Fri Jun 16 17:06:28 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (duplicate_decls): Complain about virtual functions
+ redeclared to be inline.
+
+Fri Jun 16 13:20:38 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (get_unique_name): New routine to name unnamed namespaces.
+ (push_namespace): Use get_unique_name for naming unnamed namespaces.
+
+Thu Jun 15 15:00:41 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * parse.y: Call cplus_decl_attributes with prefix_attributes where
+ appropriate.
+
+Wed Jun 14 19:24:49 1995 Mike Stump <mrs@cygnus.com>
+
+ * search.c (get_vbase): New routine to switch hierarchies from the
+ CLASSTYPE_VBASECLASSES to the normal one.
+ (expand_indirect_vtbls_init): Use get_vbase to figure out how we
+ want to convert to a vbase pointer.
+
+Mon Jun 12 17:50:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * pt.c (instantiate_class_template): Add the new instantiation to
+ template_classes.
+ (do_pending_expansions): Call instantiate_member_templates on all of
+ the classes in template_classes.
+
+Mon Jun 12 12:36:59 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (complete_array_type): Fill in the TYPE_DOMAIN of our
+ TYPE_MAIN_VARIANT if it is not filled in.
+ * init.c (build_delete): If the TYPE_DOMAIN is not set, give an
+ error instead of core dumping.
+
+Mon Jun 12 10:41:40 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (can_convert): Also check for distance > 0.
+ (can_convert_arg): Likewise.
+ (user_harshness): Likewise.
+
+Fri Jun 9 19:17:21 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * g++.c (MATH_LIBRARY): Provide default.
+ (main): Always link with the math library if we link with libstdc++.
+
+ * decl.c (start_function): Complain about redefinition of a function
+ even when the pending_inline version is compiled after the other
+ version.
+
+Thu Jun 8 15:44:38 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * gc.c (build_dynamic_cast): Build up a reference to a parameter of
+ aggregate type.
+
+Wed Jun 7 15:31:57 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * init.c (build_vec_delete): Resolve an offset ref before we try to
+ use it.
+
+Wed Jun 7 14:19:32 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_modify_expr): If the class lacks a constructor or
+ assignment operator, return error_mark_node.
+ (common_type): Use build_cplus_array_type.
+
+Tue Jun 6 09:41:27 1995 Mike Stump <mrs@cygnus.com>
+
+ * class.c (dont_allow_type_definitions): New variable set when types
+ cannot be defined.
+ (finish_struct): Use it.
+ * cp-tree.h (dont_allow_type_definitions): Define it.
+ * parse.y (primary, handler_seq): Set it.
+
+Mon Jun 5 18:49:38 1995 Mike Stump <mrs@cygnus.com>
+
+ * method.c (build_opfncall): Use DECL_CHAIN, not TREE_CHAIN for
+ results from lookup_fnfields. Always give warning/error on bad
+ code.
+
+Mon Jun 5 11:39:37 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * init.c (member_init_ok_or_else): Don't allow initialization of
+ an ancestor's member from within a constructor.
+
+Mon Jun 5 11:20:34 1995 Gerald Baumgartner <gb@alexander.cs.purdue.edu>
+
+ * sig.c (build_signature_table_constructor): Use DECL_CONTEXT
+ instead of DECL_CLASS_CONTEXT for calculating the vfield offset so
+ abstract virtual functions are handled correctly.
+
+ * sig.c (build_signature_table_constructor): Store the correct
+ delta in signature table entries. It does not yet work for
+ classes with virtual base classes as implementations of signatures.
+ (build_signature_method_call): Add the delta to the object_ptr
+ before generating the function call.
+
+ * call.c (build_method_call): Make instance_ptr the signature
+ pointer itself instead of dereferencing the optr.
+ * sig.c (build_signature_method_call): Dereference the optr for the
+ direct and virtual calls.
+
+ * sig.c (build_signature_table_constructor): Make the tag for
+ default implementations -1 instead of 2.
+ (build_signature_method_call): Change the generated conditional
+ expression correspondingly.
+
+ * sig.c (build_signature_pointer_constructor): Deleted the sorry
+ message that said we can't handle multiple inheritance for
+ implementations of signatures
+ (build_signature_method_call): Use the offset from the sigtable
+ entry instead of the vptr field from the signature pointer for
+ building a virtual function call.
+
+ * class.c (build_vfn_ref): Deleted signature specific code, we don't
+ call this function anymore from build_signature_method_call.
+
+ * cp-tree.h (SIGNATURE_VPTR_NAME): Deleted. We use the right vptr
+ field in the object now instead of in the signature pointer/ref.
+ (build_vptr_ref): Deleted extern declaration.
+ * sig.c (build_vptr_ref): Deleted.
+ (build_signature_pointer_or_reference_type): Deleted construction of
+ the vptr field.
+ (build_signature_pointer_constructor): Deleted initialization of/
+ assignment to the vptr field.
+
+ * sig.c (build_signature_table_constructor): Convert the signature
+ table entry fields to their correct types.
+
+ * sig.c (build_signature_table_constructor): Don't call digest_init
+ for the fields of a sigtable entry, it's wasted time.
+
+ * sig.c (build_signature_table_constructor): Correctly set the
+ offset and index fields of a sigtable entry. Build the constructor
+ the way digest_init does, digest_init can't handle initializing an
+ anonymous union inside a struct.
+ (build_signature_method_call): Use the index field instead of the
+ delta field to get the vtable index.
+
+ * decl.c (init_decl_processing): Fix number of fields for building
+ sigtable_entry_type.
+
+ * cp-tree.h (tag_identifier, offset_identifier): Added extern decls.
+ (SIGTABLE_CODE_NAME): Renamed to SIGTABLE_TAG_NAME.
+ (SIGTABLE_PFN_NAME): Deleted, we'll use VTABLE_PFN_NAME instead.
+ * decl.c (tag_identifier, offset_identifier): New variables to
+ hold the identifiers for the sigtable fields tag and offset.
+ (init_decl_processing): Initialize these variables.
+ (init_decl_processing): Use these variables to build the
+ sigtable_entry_type structure. Rename the code and offset fields
+ to tag and delta, respectively; add offset and index fields. Changed
+ types of fields from short_integer_type_node to delta_type_node.
+ * sig.c (build_signature_table_constructor): Rename code and offset
+ to tag and delta, respectively.
+ (build_signature_method_call): Likewise. Use above variables.
+
+Thu Jun 1 17:03:51 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (lookup_name_real): Don't try to look anything up in an
+ erroneous object.
+
+Fri Jun 2 10:30:14 1995 Mike Stump <mrs@cygnus.com>
+
+ * method.c (build_overload_int): New routine. Break out
+ functionality from build_overload_value so we can reuse it.
+ (build_overload_value): Handle pointer to member functions as value
+ parameters for templates.
+ (build_overload_identifier): Since template parameters are shared
+ among all instantiations, we have to substitute in the real types
+ in TREE_TYPE (parm).
+ pt.c (coerce_template_parms): Likewise.
+ (push_template_decls): Likewise.
+ (grok_template_type): Deleted as template parameters are shared
+ among all instantiations.
+
+Wed May 31 19:10:32 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (grokdeclarator): Always give errors on constant overflow
+ for array indices.
+
+Wed May 31 11:39:43 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (commonparms): Don't abort if simple_cst_equal returns < 0.
+ (build_c_cast): Don't tack on a NON_LVALUE_EXPR when casting to
+ reference type.
+ (build_indirect_ref): Fix check for *&.
+
+Fri Jun 16 06:54:03 1995 Mike Stump <mrs@cygnus.com>
+
+ * Version 2.7.0 released.
+
+Fri Jun 16 15:07:29 1995 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * Make-lang.in (DEMANGLER_PROG): Add LIBS.
+
+Thu Jun 15 15:00:41 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (define_function): Don't set DECL_INTERFACE_KNOWN.
+
+Wed Jun 7 20:00:31 1995 Mike Stump <mrs@cygnus.com>
+
+ * *.[chy]: Change all callers of finish_decl to cp_finish_decl.
+ * decl.c (finish_decl): New routine to handle call backs from the
+ mid end (declare_hidden_char_array).
+
+Wed Jun 7 19:02:50 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (start_function): Handle setting C_C_D here.
+ (set_C_C_D): Removed.
+ (struct saved_scope): Remove class_decl.
+ (push_to_top_level): Don't save current_class_decl.
+ (pop_from_top_level): Don't restore current_class_decl or C_C_D.
+ (struct cp_function): Add C_C_D.
+ (push_cp_function_context): Save C_C_D.
+ (pop_cp_function_context): Restore C_C_D.
+
+Fri Jun 2 11:05:58 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (set_C_C_D): New function. suspend_momentary before
+ building C_C_D.
+ (pop_from_top_level): Call it.
+ (start_function): Likewise.
+ (pop_cp_function_context): Likewise.
+
+ * class.c, cp-tree.h, decl.c, decl2.c, parse.y: Lose all references
+ to current_vtable_decl, CLASSTYPE_INST_VAR and CLASSTYPE_VTBL_PTR.
+
+ * decl.c (push_cp_function_context): Save current_class_decl.
+ (pop_cp_function_context): Restore current_class_decl and set C_C_D.
+ (pop_from_top_level): Don't use CLASSTYPE_INST_VAR to set C_C_D.
+ (start_function): Likewise.
+
+ * class.c (popclass): Don't mess with current_class_decl,
+ current_vtable_decl, or C_C_D.
+
+Mon May 29 12:45:10 1995 Paul Eggert <eggert@twinsun.com>
+
+ * Make-lang.in (c++.mostlyclean): Remove $(DEMANGLER_PROG).
+
+Wed May 24 15:55:18 1995 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * decl.c (duplicate_decls): Check simple_cst_equal result against 0.
+ * decl2.c (finish_anon_union): Likewise.
+ * method.c (largest_union_member): Likewise.
+
+Wed May 24 14:41:11 1995 H.J. Lu <hjl@nynexst.com>
+
+ * Make-lang.in (cxxmain.o): Replace single quotes with backslashes.
+
+Mon May 22 17:38:48 1995 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * Make-lang.in (g++, g++-cross, cc1plus, DEMANGLER_PROG):
+ Use $@ instead of output name so works even if have .exe.
+ (cxxmain.o): Use cp if ln -s fails.
+ (c++.install-man): Use $(exeext) in executable names.
+ (c++.mostlyclean, stage[1-4]): Use $(objext) in object file names.
+ * Makefile.in (../cc1plus): Use $(exeext) in name of executable.
+
+Wed May 24 01:39:03 1995 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (build_method_call): Parms can be null, duh.
+
+Tue May 23 01:32:09 1995 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (build_method_call): If convert_arguments failed, just bail.
+
+Fri May 19 10:31:11 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * cvt.c (convert_force): Pass LOOKUP_NORMAL to cp_convert.
+
+ * tree.c (copy_to_permanent): Oops.
+
+Fri May 19 10:01:07 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-tree.h (break_out_target_exprs): Add decl.
+
+Thu May 18 13:02:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (start_function): Move *all* interface handling stuff after
+ the pushdecl.
+
+ * tree.c (mapcar): Renamed from make_deep_copy and generalized.
+ (perm_manip): Return t if permanent, otherwise 0.
+ (copy_to_permanent): Use them.
+ (bot_manip): Helper for break_out_target_exprs.
+ (break_out_target_exprs): New function. Uses mapcar.
+
+ * typeck.c (convert_arguments): Use it.
+
+ * method.c (hack_identifier): Use convert_from_reference to
+ dereference a reference.
+
+Wed May 17 17:54:54 1995 Mike Stump <mrs@cygnus.com>
+
+ * call.c (convert_harshness): Move reference bashing before pointer
+ to member bashing.
+
+Wed May 17 16:57:53 1995 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (convert_to_reference): Only complain, if complaints are
+ wanted.
+ * typeck.c (build_function_call_real): Likewise. If
+ LOOKUP_SPECULATIVELY is set and something won't work, return
+ NULL_TREE.
+ * cvt.c (cp_convert): Likewise. Pass flags down to build_method_call.
+ (convert): Pass LOOKUP_NORMAL to cp_convert.
+ * typeck.c (convert_for_assignment): Likewise.
+ (convert_force): Pass LOOKUP_COMPLAIN to cp_convert.
+ (convert_arguments): Get out early if we get an error_mark_node.
+ (convert_for_initialization): Use cp_convert instead of convert so
+ that we can pass flags down.
+ * cp-tree.h (LOOKUP_SPECULATIVELY): Added documentation.
+
+Wed May 17 01:43:58 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck2.c (store_init_value): Don't take the MAIN_VARIANT of the
+ decl type.
+
+ * class.c (finish_struct): Don't complain about a class with no
+ user-defined constructors but with a member that has no default
+ constructor, as this is OK for aggregates.
+
+ * expr.c (cplus_expand_expr, NEW_EXPR): If this is an explicit
+ constructor call, mark slot addressable.
+
+Tue May 16 18:37:51 1995 Douglas Rupp <drupp@cs.washington.edu>
+
+ * g++.c: Changed WINNT to _WIN32.
+
+Tue May 16 12:40:16 1995 Jason Merrill <jason@lisa.cygnus.com>
+
+ * lex.c (handle_sysv_pragma): Don't use token_buffer.
+
+Tue May 16 12:05:26 1995 Mike Stump <mrs@cygnus.com>
+
+ * call.c (resolve_scope_to_name): Add initial semantic support for
+ namespaces.
+ * class.c (finish_struct): Likewise.
+ * cp-tree.h (NAMESPACE_LEVEL): Likewise.
+ * cvt.c (build_up_reference, convert_to_reference): Likewise.
+ * decl.c (binding_level::namespace_p, suspend_binding_level): Likewise.
+ (resume_binding_level, toplevel_bindings_p): Likewise
+ (namespace_bindings_p, declare_namespace_level): Likewise.
+ (resume_level, push_namespace, pop_namespace): Likewise.
+ (pop_everything, pushtag, duplicate_decls, pushdecl): Likewise.
+ (implicitly_declare, lookup_namespace_name): Likewise.
+ (lookup_name_real, start_decl, make_temporary_for_reference): Likewise.
+ (obscure_complex_init, finish_decl, expand_static_init): Likewise.
+ (grokvardecl, grokdeclarator, parmlist_is_exprlist): Likewise.
+ (store_parm_decls, hack_incomplete_structures): Likewise.
+ * decl2.c (get_temp_name, finish_anon_union): Likewise.
+ (current_namespace, push_namespace, pop_namespace): Likewise.
+ (do_namespace_alias, do_toplevel_using_decl): Likewise.
+ (do_class_using_decl): Likewise.
+ * error.c (dump_decl): Likewise.
+ * init.c (build_member_call, build_offset_ref): Likewise.
+ * lex.c (identifier_type): Likewise.
+ * parse.y (lang_extdef, using_decl, extdef): Likewise.
+ (component_decl_1, nested_name_specifier_1): Likewise.
+ * spew.c (yylex): Likewise.
+ * tree.def (NAMESPACE_DECL): Likewise.
+
+Tue May 16 11:55:35 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (push_overloaded_decl): Return the new decl even if it
+ can't be pushed.
+
+Tue May 16 11:00:37 1995 Jason Merrill <jason@lisa.cygnus.com>
+
+ * typeck.c (decay_conversion): Split out from default_conversion.
+ (default_conversion): Call it.
+ (build_binary_op): Likewise.
+ (build_binary_op_nodefault): Use decay_conversion for truth ops.
+
+Mon May 15 12:47:56 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (warn_extern_redeclared_static): This is a pedwarn.
+ (duplicate_decls): Always use the old decl's linkage info. Don't
+ play with linkage of consts.
+ (pushdecl): Don't play with linkage of consts.
+ (redeclaration_error_message): Don't complain about an old public
+ decl and a new non-public decl here.
+ (grokvardecl): Handle linkage of consts here.
+ (grokdeclarator): An 'extern inline' is public. Pass constp to
+ grokvardecl.
+ (start_function): Wait until after the pushdecl to do some linkage
+ stuff.
+
+ * decl2.c (import_export_vtable): Make duplicates weak rather than
+ static if supported.
+ (import_export_inline): Likewise.
+ * pt.c (do_pending_expansions): Likewise.
+
+ * class.c (build_vbase_path): flag_assume_nonnull_objects only
+ affects reference conversion.
+
+ * init.c (emit_base_init): Build up an RTL_EXPR and add it to
+ rtl_expr_chain.
+ * decl.c, decl2.c: s/base_init_insns/base_init_expr/.
+
+Tue May 16 07:06:28 1995 Paul Eggert <eggert@twinsun.com>
+
+ * method.c (numeric_output_need_bar): Renamed from misspelling.
+
+ * typeck.c (build_ptrmemfunc): Fix misspellings in messages.
+
+Sun May 14 10:26:22 1995 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * lang-options.h, lang-specs.h: New files.
+
+Thu May 11 00:31:48 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (default_conversion): Don't check for BLKmode before
+ pulling out the decl_constant_value.
+
+ * decl.c (start_function): Clear named_labels and shadowed_labels.
+
+ * typeck.c (build_function_call_real): Also synthesize methods here.
+
+Wed May 10 00:55:59 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c (finish_file): Synthesize exported methods before the
+ reconsider loop.
+
+ * parse.y: Move declaration of flag_new_for_scope to file scope.
+
+Tue May 9 19:10:33 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c: Add flag_new_for_scope for new -ffor-scope flag.
+ * parse.y (FOR): Conditionalize the pushing and poping of scope for
+ the for-init-statement upon the new flag_new_for_scope.
+ * parse.y (try_block): Simplify and use compstmt.
+
+Mon May 8 12:41:52 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (define_function): Mark function decl artificial.
+
+Sun May 7 00:51:28 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * parse.y (simple_stmt, FOR): Put back push/pop for condition scope.
+
+ * decl2.c (grokclassfn): DECLs don't have cv-qualified types.
+ * tree.c (build_cplus_method_type): Likewise.
+
+ * cp-tree.h (SET_DECL_ARTIFICIAL): Just set DECL_ARTIFICIAL to 1.
+
+ * typeck.c (build_function_call_real): If convert_arguments failed,
+ just bail.
+ (convert_arguments): If one of the arguments is error_mark_node,
+ just bail.
+
+Sat May 6 02:39:41 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (duplicate_decls): Don't check DECL_NOT_REALLY_EXTERN for
+ decls that don't include it.
+
+Fri May 5 14:23:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (duplicate_decls): Decls that have DECL_INTERFACE_KNOWN or
+ DECL_NOT_REALLY_EXTERN set aren't extern decls.
+
+ * typeck.c (build_indirect_ref): Don't call default_conversion for a
+ parameter of reference_type.
+ * cvt.c (convert_from_reference): Just use build_indirect_ref.
+
+ * pt.c (do_type_instantiation): Only instantiate member functions
+ that actually come from templates.
+
+Fri May 5 09:46:05 1995 Mike Stump <mrs@cygnus.com>
+
+ * parse.y: Generalized cleanup of poplevels, and compound statements
+ and compound statements in try blocks. Rewritten `for' rule so that
+ the scope of variables declared in the for clause is shortened to
+ span just to the end of the statement, instead of the whole
+ containing block.
+
+Fri May 5 00:37:14 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (convert_harshness): Handle pointers to members better.
+
+Thu May 4 16:00:26 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c (delete_sanity): Do access control here.
+ * init.c (build_delete): Instead of here.
+
+ * Make-lang.in: Build c++filt.
+
+Wed May 3 02:59:53 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c (cplus_decl_attributes): If we just modified a TYPE_DECL,
+ update our IDENTIFIER_TYPE_VALUE.
+
+Fri Apr 28 07:58:41 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * lex.c (cons_up_default_function): Fix linkage of #pragma
+ implemented functions.
+
+Thu Apr 27 16:56:24 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * method.c (build_overload_name): Simplify and fix repeated type
+ folding.
+
+ * decl.c (grokdeclarator): Prohibit pointers to void or reference
+ members.
+
+Thu Apr 27 09:49:07 1995 Mike Stump <mrs@cygnus.com>
+
+ * typeck2.c (process_init_constructor): Make sure initializers are
+ fully digested.
+
+Thu Apr 27 01:11:55 1995 Jason Merrill <jason@python.cygnus.com>
+
+ * lex.c (cons_up_default_function): Always defer synthesis.
+
+Thu Apr 27 00:20:37 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c (mark_inline_for_output): Don't play with pending_inline
+ stuff.
+
+Wed Apr 26 17:48:24 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (user_harshness): New function; like build_type_conversion,
+ but doesn't actually build anything.
+ (compute_conversion_costs): Use it instead of build_type_conversion.
+
+Wed Apr 26 17:11:25 1995 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_function_call_real): Improve error message for
+ calling a non-function.
+
+ * method.c (hack_identifier): Lose check for calling a data member.
+
+Wed Apr 26 16:59:13 1995 Mike Stump <mrs@cygnus.com>
+
+ * typeck2.c (build_functional_cast): Remove very old cruft.
+ Seems like good code is generated without it.
+
+Wed Apr 26 00:47:16 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * method.c (do_build_assign_ref): Fix handling of anonymous unions.
+ (do_build_copy_constructor): Likewise.
+
+ * parse.y (simple_stmt, SWITCH): Call {push,pop}_switch.
+
+ * decl.c (push_switch): New function.
+ (pop_switch): Likewise.
+ (define_case_label): Check for jumping over initialization.
+
+ * call.c (build_method_call): Check for an inline function being
+ called before its definition has been seen.
+ * typeck.c (build_function_call_real): Likewise.
+
+ * decl.c (duplicate_decls): Check for a function being redeclared
+ inline after its address has been taken.
+
+ * typeck.c (build_conditional_expr): Handle related class lvalues.
+
+Tue Apr 25 13:20:45 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * pt.c (do_pending_expansions): Don't expand unused templates.
+
+ * parse.y (component_decl): Accept a lone semicolon.
+
+Tue Apr 25 00:25:56 1995 Jason Merrill <jason@rtl.cygnus.com>
+
+ * call.c (build_method_call): Don't allow an RTL_EXPR to serve as the
+ object parameter anymore.
+
+ * expr.c (cplus_expand_expr): Don't create RTL_EXPRs with no insns.
+
+Mon Apr 24 12:35:48 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * parse.y (simple_stmt, decl case): Clear prefix_attributes.
+ (lang_extdef): Likewise.
+
+ * parse.y (maybe_parmlist): New rule for use in declarators where
+ this could either be a list of expressions or parameters. Calls
+ suspend_momentary before deciding which.
+ (direct_after_type_declarator): Use it.
+ (complex_direct_notype_declarator): Use it.
+
+ * pt.c (tsubst): Propagate attributes const and noreturn.
+
+ * typeck.c (build_modify_expr): If warn_synth, call build_opfncall
+ before doing the default thing.
+
+Thu Apr 27 21:49:36 1995 Doug Evans <dje@cygnus.com>
+
+ * typeck.c (common_type): Call lookup_attribute instead of
+ value_member.
+
+Tue Apr 25 18:07:43 1995 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * Make-lang.in: Change "realclean" to "maintainer-clean".
+
+Sun Apr 23 12:32:38 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (finish_file): Fix broken linked list handling.
+
+Fri Apr 21 18:08:43 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * class.c (finish_base_struct): Don't set TYPE_HAS_COMPLEX_*_REF
+ as often.
+ (finish_struct): Likewise.
+
+ * various: Use TYPE_HAS_TRIVIAL_* instead of TYPE_HAS_COMPLEX_*.
+
+ * cp-tree.h (TYPE_HAS_TRIVIAL_INIT_REF): New macro.
+ (TYPE_HAS_TRIVIAL_ASSIGN_REF): New macro.
+
+Fri Apr 21 15:52:22 1995 Jason Merrill <jason@python.cygnus.com>
+
+ * typeck.c (c_expand_return): Only expand a returned TARGET_EXPR if
+ it is of the same type as the return value.
+
+Fri Apr 21 03:01:46 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c (finish_file): Reconsider if synthesizing a method wrote
+ out its assembly.
+
+ * typeck.c (convert_for_initialization): Don't call a trivial copy
+ constructor.
+
+ * typeck2.c (store_init_value): Only abort if the type has a
+ non-trivial copy constructor.
+
+ * typeck.c (c_expand_return): If we're returning in a register and
+ the return value is a TARGET_EXPR, expand it. Only do
+ expand_aggr_init if we're returning in memory.
+ (expand_target_expr): Function to expand a TARGET_EXPR.
+ (build_modify_expr): Use it.
+
+ * tree.c (build_cplus_new): Layout the slot.
+
+ * expr.c (cplus_expand_expr): Use expand_call to expand the call
+ under a NEW_EXPR, so the target is not discarded.
+
+Thu Apr 20 14:59:31 1995 Mike Stump <mrs@cygnus.com>
+
+ * gc.c (build_dynamic_cast): Tighten error checking.
+
+Thu Apr 20 11:23:54 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * expr.c (cplus_expand_expr): Only abort if the returned target is
+ different from what we expected if the type has a non-trivial copy
+ constructor.
+
+ * decl2.c (cplus_decl_attributes): Attributes applied to a template
+ really apply to the template's result.
+
+ * tree.c (lvalue_p): Check IS_AGGR_TYPE instead of TREE_ADDRESSABLE
+ to decide whether to consider a CALL_EXPR an lvalue.
+
+ * class.c (finish_struct_bits): Only set TREE_ADDRESSABLE if the
+ type has a non-trivial copy constructor.
+
+ * decl.c (start_function): If interface_known, unset
+ DECL_NOT_REALLY_EXTERN on the function.
+
+Wed Apr 19 16:53:13 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * pt.c (do_function_instantiation): Handle explicit instantiation of
+ member functions.
+ (do_type_instantiation): Handle 'inline template class foo<int>',
+ meaning just spit out the vtable.
+
+ * lex.c (cons_up_default_function): Set DECL_NOT_REALLY_EXTERN on
+ the consed functions.
+
+ * decl2.c (import_export_inline): Set DECL_INTERFACE_KNOWN.
+
+Wed Apr 19 16:28:17 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * call.c, class.c, decl2.c, gc.c, init.c, parse.y, pt.c, search.c,
+ typeck.c: Include output.h.
+
+Wed Apr 19 14:57:21 1995 Gerald Baumgartner <gb@alexander.cs.purdue.edu>
+
+ * call.c (build_method_call): Allow a signature member functions to
+ be called from a default implementation.
+
+Wed Apr 19 10:21:17 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * repo.c (finish_repo): Remember what directory we are in.
+
+ * search.c (expand_upcast_fixups): Don't mess with abort_fndecl.
+
+ * repo.c: Use obstacks instead of fixed-size buffers. Don't spit
+ out the second copy of the symbol name. Don't remember COLLECT_GCC.
+
+Wed Apr 19 02:32:40 1995 Mike Stump <mrs@cygnus.com>
+
+ * search.c (virtual_context): New function to get the virtual
+ context of a function.
+ (expand_upcast_fixups): New function to generate runtime vtables.
+ (fixup_virtual_upcast_offsets): Likewise.
+ (expand_indirect_vtbls_init): Use fixup_virtual_upcast_offsets to
+ ensure that the this offsets for upcasts from virtual bases into
+ other virtual bases or non-virtual bases are correct at construction
+ time and destruction time.
+ * class.c (fixup_vtable_deltas): Modify to fixup all offsets in all
+ vtables in all virtual bases, instead of just one vtable in each
+ virtual base.
+ (fixup_vtable_deltas1): Likewise.
+
+Tue Apr 18 03:57:35 1995 Michael Meissner <meissner@cygnus.com>
+
+ * Makefile.in (lex.o): Add dependency on c-pragma.h.
+
+ * lex.c (handle_sysv_pragma): Use NULL_PTR and NULL_TREE as
+ appropriate, instead of 0.
+
+Mon Apr 17 12:28:42 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (pushdecl): Use decls_match, not duplicate_decls, for
+ comparing local and global decls.
+
+Fri Apr 14 01:46:52 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (convert_arguments): Only prohibit passing to ... of
+ types with non-trivial copy constructors.
+
+ * repo.c (repo_template_used): Don't try to mess with no id.
+
+Fri Apr 14 23:32:50 1995 Per Bothner <bothner@rtl.cygnus.com>
+
+ * decl.c (duplicate_decls): Use cp_warning_at for redundant-decls.
+
+Thu Apr 13 15:37:42 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-tree.h (current_tinst_level): Delete declaration, since it's
+ static inside pt.c.
+
+ * typeck.c (build_modify_expr): Catch incompatible array assignment.
+
+ * parse.y (attribute_list, attrib): Rewrite actions to feed the
+ right stuff to decl_attributes.
+
+Thu Apr 13 11:24:10 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * search.c (dfs_debug_mark): Check for magic virtual like
+ import_export_vtable.
+
+ * typeck.c (build_binary_op_nodefault): Don't call cp_pedwarn with
+ four args.
+
+Wed Apr 12 12:02:57 1995 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl2.c (finish_file): Move prevtable pass before needs_messing_up
+ decision.
+
+Tue Apr 11 11:20:27 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (finish_decl): If we're writing out a static data member of
+ a class, we want the debug info for that class.
+
+ * gc.c (build_t_desc): Check linkage of a class properly.
+
+ * class.c (finish_struct): Set the 'headof' offset for the main
+ vtable properly.
+ (prepare_fresh_vtable): Fix typeinfo pointer here.
+ (modify_one_vtable): Instead of here.
+
+Mon Apr 10 12:15:59 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * repo.c (repo_get_id): New function to return the interesting
+ identifier for a repo entity.
+ (repo_template_used): Use it.
+ (repo_template_instantiated): Mark the id as chosen.
+ (init_repo): Record whether or not the id was chosen.
+ (finish_repo): Note if an id was newly chosen.
+
+ * pt.c (do_function_instantiation): Call repo_template_instantiated.
+ (do_type_instantiation): Likewise. Don't diagnose multiple
+ instantiation.
+
+ * decl2.c (finish_file): Use DECL_NOT_REALLY_EXTERN when deciding
+ whether or not to synthesize a method.
+
+ Undo these changes:
+ * class.c (finish_vtbls): Build more vtables if flag_rtti is on.
+ * class.c (modify_all_direct_vtables): Likewise.
+ * init.c (expand_direct_vtbls_init): Expand more vtables if
+ flag_rtti is on.
+
+Sat Apr 8 17:45:41 1995 Mike Stump <mrs@cygnus.com>
+
+ * gc.c (build_headof): Use ptrdiff_type_node instead of
+ integer_type_node on pointer arithmetic.
+
+Sat Apr 8 11:57:04 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_modify_expr): Undo previous change.
+
+Thu Apr 6 01:23:50 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * Makefile.in (compiler): Remove ../cc1plus before rebuilding it.
+
+ * repo.c (get_base_filename): Put the .rpo file in the directory
+ with the object file, not the source.
+
+ * typeck.c (build_conditional_expr): Handle pmf's better.
+
+ * repo.c (finish_repo): Also use ASM_OUTPUT_LABELREF to print out
+ the name of the symbol.
+
+Wed Apr 5 15:24:12 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * repo.c (open_repo_file): Make repo filename DOS-compliant.
+ (*): Also write a new repo file if some previously-used
+ templates are no longer used. Only remember the identifier.
+
+ * lex.c (cons_up_default_function): If this function belongs to a
+ template class, call repo_template_used for it.
+
+ * repo.c (repo_template_used): Using a class means using its vtable,
+ if any.
+ (finish_repo): Likewise.
+
+ * typeck.c (build_modify_expr): Only wrap TARGET_EXPRs in RTL_EXPRs
+ if the type has a complex copy constructor.
+
+ * decl2.c (lang_decode_option): -frepo implies
+ -fno-implicit-templates.
+
+ * decl.c (start_function): Clear current_{base,member}_init_list.
+
+ * lex.c (init_lex): Also unset *_eq if ! flag_operator_names.
+
+Tue Apr 4 16:11:08 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (struct cp_function): Add {base,member}_init_list.
+ (push_cp_function_context): Save current_{base,member}_init_list.
+ (pop_cp_function_context): Restore them.
+
+Mon Apr 3 16:55:08 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * repo.c (get_base_filename): Take filename parm, fix logic bug.
+
+ * typeck.c (build_compound_expr): Do not warn about a compound expr
+ in which the first expression has no side effects.
+ (build_x_compound_expr): Warn here instead.
+ (build_conditional_expr): Don't warn about a conditional expression
+ between an enum and the type it promotes to.
+
+ * init.c (build_new): Handle initialization of arrays of builtins
+ properly.
+
+Mon Apr 3 15:08:04 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * repo.c: Include config.h to get definitions of bcopy and rindex
+ on systems that don't have them (e.g., SVR4).
+
+Mon Apr 3 14:41:55 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (finish_table): Pass NULL_TREE instead of init to
+ finish_decl so that it won't try and do error checking on the
+ initializer.
+
+Mon Apr 3 10:45:50 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * repo.c (get_base_filename): Analyze COLLECT_GCC_OPTIONS to
+ determine whether this compile used -c -o.
+ (open_repo_file): Use get_base_filename. Remove the extension.
+ (finish_repo): Spit out the values of main_input_filename,
+ COLLECT_GCC and COLLECT_GCC_OPTIONS.
+
+ * parse.y (structsp): Add TYPENAME_KEYWORD complex_type_name.
+
+Sun Apr 2 23:43:51 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * search.c (compute_access): Don't try to do access control on
+ nested types.
+
+Fri Mar 31 10:14:23 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * repo.c: New file to handle things repo.
+
+ * pt.c (instantiate_template): Call repo_template_used if the
+ definition is accessible.
+ (mark_function_instantiated): Split out from
+ do_function_instantiation.
+ (mark_class_instantiated): Split out from do_type_instantiation.
+
+ * parse.y (template_instantiate_once): Call repo_template_used.
+
+ * lex.c (lang_init): Call init_repo.
+
+ * decl2.c: Handle flag_use_repository.
+ (finish_file): Call finish_repo.
+
+ * decl.c (start_method): Call repo_template_used if this is a
+ template method.
+
+ * Makefile.in (CXX_OBJS): Add repo.o.
+ (repo.o): Add dependencies.
+
+ * Make-lang.in (CXX_SRCS): Add repo.c.
+
+ * decl.c (start_function): If DECL_INTERFACE_KNOWN and
+ DECL_NOT_REALLY_EXTERN are both set, unset DECL_EXTERNAL.
+
+ * typeck.c (build_binary_op_nodefault): Identify the invalid operand
+ types used.
+
+ * decl.c (duplicate_decls): Propagate DECL_NOT_REALLY_EXTERN.
+
+Thu Mar 30 17:54:42 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_binary_op_nodefault): Tidy up use of build_type
+ and result_type. When checking for comparison between signed
+ and unsigned, use result_type rather than the (possibly shortened)
+ type of op0. Also, don't warn about equality comparison of a
+ signed operand to an unsigned constant that fits in the signed
+ type.
+
+ * method.c (do_build_copy_constructor): Reverse
+ current_base_init_list after we've built it up.
+
+Thu Mar 30 14:35:18 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (build_throw): Never warn about the value of throw not
+ being used.
+
+Thu Mar 30 13:16:54 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_start_catch_block): Check for bad catch parameter
+ declarations.
+
+Thu Mar 30 13:06:11 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (finish_function): Only set DECL_NOT_REALLY_EXTERN if
+ DECL_EXTERNAL is not already set.
+
+Thu Mar 30 11:26:24 1995 Mike Stump <mrs@cygnus.com>
+
+ * method.c (emit_thunk): Let poplevel know that the last level is
+ for a function so it can create a BLOCK_NODE and set DECL_INITIAL.
+
+Thu Mar 30 11:15:06 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c (import_export_inline): Don't set DECL_NOT_REALLY_EXTERN
+ here.
+
+ * decl.c (grokdeclarator): OK, don't abort if we see a decl with
+ METHOD_TYPE.
+ (finish_function): Set DECL_EXTERNAL and DECL_NOT_REALLY_EXTERN on
+ all deferred inlines.
+
+Wed Mar 29 19:35:02 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * cp-tree.h (DECL_THIS_INLINE): New macro.
+ (DECL_NOT_REALLY_EXTERN): New macro.
+ (DECL_THIS_STATIC): New macro.
+
+ * decl.c: Lose all references to current_extern_inline. Break
+ inline semantics into DECL_INLINE for actual inlining and
+ DECL_THIS_INLINE for the linkage wierdness. Use DECL_THIS_STATIC.
+ * decl2.c: Use DECL_NOT_REALLY_EXTERN to indicate that we want to
+ emit an inline here. Associated changes.
+ * lex.c: Likewise.
+ * pt.c: Likewise.
+ * typeck.c: Likewise.
+
+ * call.c (build_method_call): Don't bother trying to handle inlines
+ specially.
+ * cvt.c (convert_to_aggr): Likewise.
+
+ * pt.c (do_function_instantiation): Handle instantiation of
+ public inlines, too.
+
+Wed Mar 29 16:04:25 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (init_exception_processing): Change the interface for
+ __throw_type_match and add decl for new rtti matching routine
+ __throw_type_match_rtti.
+ (build_eh_type): New routine to build a run time descriptor for the
+ expression given.
+ (expand_start_catch_block): Update to use new calling convention for
+ the matcher.
+ (expand_throw): Update to use build_eh_type.
+
+Mon Mar 27 07:14:33 1995 Warner Losh <imp@village.org>
+
+ * g++.c: Removed __NetBSD__ from conditional.
+ Declare strerror if HAVE_STRERROR is defined; otherwise
+ declare sys_errlist and sys_nerr.
+ (my_strerror): New function.
+
+Tue Mar 28 14:16:35 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * search.c (get_binfo): Don't try to be so clever.
+
+ * tree.c (copy_to_permanent): Also suspend_momentary().
+
+ * cvt.c (cp_convert_to_pointer): Hand off to convert_fn_pointer even
+ if the types are the same.
+
+ * decl.c (start_function): Handle extern inlines more like C++ says
+ we should.
+
+ * init.c (build_member_call): Hand constructor calls off to
+ build_functional_cast.
+
+ * typeck2.c (build_functional_cast): Use DECL_NESTED_TYPENAME to get
+ the name of the type.
+
+Tue Mar 28 13:13:56 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (grokdeclarator): Check for the decl returned by
+ grokfndecl to be null before using build_decl_attribute_variant.
+
+Mon Mar 27 18:04:41 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * init.c (build_new): Use build_pointer_type instead of
+ TYPE_POINTER_TO.
+
+Fri Mar 24 12:11:24 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_conditional_expr): Handle pmfs.
+ (convert_for_assignment): Fix pmf support.
+
+ * cvt.c (convert_fn_ptr): Support !flag_vtable_thunks.
+ (cp_convert_to_pointer): Handle pmfs.
+ (cp_convert): Pass pmfs to cp_convert_to_pointer.
+
+ * typeck.c (common_type): Handle inheritance for pmfs.
+
+ * typeck2.c (build_m_component_ref): Do access control.
+
+ * typeck.c (comp_target_types): Check for conversion to void *
+ before checking trickier conversions.
+
+ * decl.c (duplicate_decls): Propagate DECL_ABSTRACT_VIRTUAL_P.
+
+ * pt.c (push_tinst_level): Complain if template instantiation depth
+ is greater than max_tinst_depth.
+
+ * typeck.c (common_type): Assume that we can call common_type to
+ unify the target type of a pointer.
+
+Thu Mar 23 00:48:44 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c (finish_file): Don't synthesize methods at
+ finish_vtable_prevardecl time. Do synthesize methods that are not
+ used, but are public and not external.
+
+ * cvt.c (build_type_conversion): Only give an error if for_sure.
+
+ * typeck.c (comp_target_types): Only support pointer conversions if
+ nptrs > 0.
+
+Wed Mar 22 19:30:15 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * init.c (build_new): Catch use of an initializer list where it
+ shouldn't be.
+
+Wed Mar 22 16:21:07 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * init.c (build_new): Wrap alloc_expr in an RTL_EXPR if nelts is
+ non-constant.
+
+ * decl2.c: temp_name_counter is now public.
+
+ * decl.c (struct cp_function): Add temp_name_counter field.
+ (push_cp_function_context): Save it.
+ (pop_cp_function_context): Restore it.
+
+ * typeck.c (common_type): Handle unifying function types, and unify
+ unmatched things to void* with a compiler_error, rather than
+ silently like before.
+
+Wed Mar 22 15:10:34 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (finish_prevtable_vardecl, finish_vtable_vardecl): Revert
+ Brendan's last change and fix latent problem that causes TD entries
+ to not come out when the things that need them has yet to be
+ expanded.
+
+Wed Mar 22 15:12:00 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_binary_op_nodefault, comparison ops): Update type0
+ and type1, since we might have changed op0 or op1.
+
+Wed Mar 22 13:33:45 1995 Jason Merrill <jason@python.cygnus.com>
+
+ * typeck.c (common_type): Don't mess up templates.
+
+Wed Mar 22 04:56:00 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (common_type): Handle ptms properly. Also handle
+ T* -> void*.
+ (build_binary_op_nodefault): New variable build_type controls what
+ type is given to the expression when it is created. Set this to
+ boolean_type_node for comparison ops instead of using result_type.
+ (comp_target_types): Allow T * -> void *.
+
+ * cvt.c (cp_convert_to_pointer): Do access control when converting
+ ptms, too.
+
+Tue Mar 21 17:25:06 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y (extern_lang_string): Catch use of linkage specs that
+ aren't all naming the same language.
+
+ * class.c (finish_struct): Delete accidental duplicate code.
+
+Tue Mar 21 14:00:57 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_binary_op_nodefault): Disable pedwarns about
+ comparing functions and incomplete types.
+
+ * decl.c (finish_function): Only unset current_function_decl if
+ !nested.
+ (duplicate_decls): Last change went too far; we only want to stop
+ checking for value/reference ambiguity.
+
+Tue Mar 21 01:26:39 1995 Mike Stump <mrs@cygnus.com>
+
+ * gc.c (build_generic_desc): Zap the DECL_SIZE so that we can lay it
+ out fresh, as the new type may be larger.
+
+Mon Mar 20 19:01:10 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * expr.c (extract_init): Try to expand the RTL for the
+ initialization and figure out what it will look like so we can avoid
+ run-time initialization. Disabled for now.
+ (extract_scalar_init): Helper for scalar initialization.
+ (extract_aggr_init): Helper for aggregate initialization.
+
+ * decl.c (duplicate_decls): Don't complain about ambiguous
+ declarations.
+ (obscure_complex_init): Now returns a tree. Call extract_init if
+ we're optimizing and this is a toplevel decl.
+ (finish_decl): Update accordingly.
+
+ * lex.c (check_newline): If we're just changing files (not pushing
+ or popping), update input_file_stack->name.
+
+Mon Mar 20 17:55:04 1995 Mike Stump <mrs@cygnus.com>
+
+ * pt.c (type_unification): Only TEMPLATE_DECLs are handled right now
+ in the transitive unification code.
+
+Mon Mar 20 16:07:50 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (shadow_tag): Don't allow inline, virtual, or explicit on
+ non-functions.
+ (grokdeclarator): Don't allow friends to be defined in local classes.
+
+Sat Mar 18 04:03:33 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c (finish_prevtable_vardecl): Use DECL_DECLARED_STATIC
+ rather than DECL_SAVED_INSNS to decide whether or not this method
+ was declared inline.
+
+ * method.c (synthesize_method): Turn off DECL_INLINE if
+ function_cannot_inline_p thinks we're too large.
+
+ * typeck.c (build_indirect_ref): Use build_expr_type_conversion.
+
+Fri Mar 17 17:47:36 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * class.c (instantiate_type): Handle pmfs.
+
+ * typeck.c (convert_for_assignment): Check types when assigning one
+ pmf to another.
+
+ * decl.c (define_label): Fix logic for printing out the name of the
+ label in an error message.
+
+ * error.c (dump_expr): Support ARRAY_REF.
+
+Fri Mar 17 17:43:02 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl2.c (finish_vtable_vardecl): Call build_t_desc here.
+ (finish_prevtable_vardecl): Instead of here.
+
+Fri Mar 17 14:40:45 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (expand_static_init): Also use expand_aggr_init if the
+ initializer is a TREE_LIST.
+ (grokdeclarator): Only pedwarn about extra qualification if -pedantic.
+
+ * pt.c (unify): Fix unification of return type.
+
+ * expr.c (fixup_result_decl): Use store_expr, rather than
+ emit_move_insn, to move the return value into the place where
+ callers will expect it.
+
+Thu Mar 16 22:05:25 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * init.c (build_offset_ref): Call assmble_external on functions.
+ * typeck.c (build_component_ref): Likewise.
+
+Thu Mar 16 20:28:16 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (struct saved_scope): Add members base_init_list and
+ member_init_list.
+ (push_to_top_level): Save current_base_init_list and
+ current_member_init_list to them.
+ (pop_from_top_level): Put it back.
+
+Thu Mar 16 19:21:14 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * pt.c (instantiate_template): Call assemble_external.
+
+Thu Mar 16 18:07:54 1995 Brendan Kehoe <brendan@phydeaux.cygnus.com>
+
+ * class.c: Include rtl.h, to get NULL_RTX.
+ (finish_struct): Also zero out DECL_SAVED_INSNS, to avoid problems
+ on hosts with different sizes for each part of the union.
+ * tree.c: Also include rtl.h.
+ (layout_basetypes): Same change for DECL_SAVED_INSNS.
+
+Thu Mar 16 13:57:36 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * pt.c (unify): Fix array domain unification for 64-bit targets.
+
+ * decl2.c (finish_file): Push bizarre type decl before walking the
+ vtables the first time.
+ (walk_vtables): OK, don't set prev to vars if the vardecl_fn messed
+ with TREE_CHAIN (prev).
+
+ * init.c (emit_base_init): Use convert_pointer_to_real instead of
+ convert_pointer_to when converting to a direct base.
+
+Wed Mar 15 20:26:29 1995 Mike Stump <mrs@cygnus.com>
+
+ * pt.c (type_unification): Handle transitive unification better.
+
+Wed Mar 15 13:56:16 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c (walk_vtables): Always set prev to vars.
+ (mark_vtable_entries): Call assemble_external on the vtable entries.
+
+ * class.c (finish_struct): Set the vtable's size to NULL_TREE before
+ calling layout_decl, so that it gets updated properly.
+
+ Finally re-enable dynamic synthesis. This time it works.
+ * method.c (synthesize_method): Pass decl_function_context (fndecl)
+ to {push,pop}_cp_function_context.
+ * decl.c (push_cp_function_context): Now takes a tree argument.
+ (pop_cp_function_context): Likewise.
+ * call.c (build_method_call): Enable synthesis.
+ * lex.c (cons_up_default_function): Likewise.
+
+Tue Mar 14 19:14:19 1995 Doug Evans <dje@chestnut.cygnus.com>
+
+ * parse.y (setattrs): Chain onto prefix_attributes rather than
+ setting it.
+
+Wed Mar 15 13:00:00 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (pushdecl): Check if the type of the VAR_DECL is an
+ error_mark_node before trying to read TYPE_LANG_SPECIFIC.
+
+Mon Mar 13 21:00:28 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (grokdeclarator, case ARRAY_REF): Wrap the exp with fold,
+ and convert the size and integer_one_node to the index type.
+
+Mon Mar 13 08:01:02 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (get_member_function_from_ptrfunc): Save the instance
+ argument, and tack it onto the front of the COND_EXPR to make the
+ semantics come out right. Grab the instance argument from
+ '*instance_ptrptr', rather than having it passed in separately.
+
+ * various: Change various consed-up comparison operations to have
+ boolean type. Remove the instance argument in calls to
+ get_member_function_from_ptrfunc.
+
+ * error.c (dump_expr): Dump true and false as "true" and "false".
+
+ * decl2.c (finish_file): Also set DECL_STATIC_FUNCTION_P on the
+ global init function.
+
+ * decl.c (finish_function): Only set DECL_EXTERNAL here if the
+ inline function is public.
+
+Sat Mar 11 00:58:03 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * init.c (is_friend): Be more careful about checking
+ DECL_CLASS_CONTEXT on non-member functions.
+
+ * decl2.c (finish_vtable_vardecl): Don't bother calling
+ assemble_external here.
+ (prune_vtable_vardecl): New function that just splices out the
+ vtable decl from the top-level decls.
+ (import_export_inline): Unset DECL_EXTERNAL at first.
+ (finish_file): Don't bother calling assemble_external here. Do
+ splice out all of the vtables.
+
+Fri Mar 10 14:42:29 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (finish_function): If we're not emitting the function yet,
+ call assemble_external for it.
+
+ * decl2.c (finish_prevtable_vardecl): Don't call mark_vtable_entries
+ here.
+ (finish_vtable_vardecl): Don't do the linkage deduction thing here.
+ Also don't splice out the current vtable if it is unused.
+ (finish_file): Move the second walk_vtables and the synthesis check
+ inside the 'reconsider' loop. Move thunk emission after the
+ 'reconsider' loop.
+
+Thu Mar 9 16:28:16 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * pt.c (tsubst): Don't bother calling cp_build_type_variant, since it
+ was passing bogus values for readonly and volatile from the original
+ template decl, not the resultant type of the tsubst call.
+
+ * class.c (duplicate_tag_error): Use cp_error_at to point out the
+ previous definition of the tag.
+
+Thu Mar 9 10:46:17 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (start_function): Clear base_init_insns and protect_list.
+ (struct cp_function): Add base_init_insns field.
+ (push_cp_function_context): Also save base_init_insns.
+ (pop_cp_function_context): Also restore base_init_insns.
+
+Wed Mar 8 13:31:44 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * init.c (member_init_ok_or_else): Check for initializing a static
+ member here.
+ (emit_base_init): Instead of here.
+
+Tue Mar 7 16:03:26 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (build_method_call): Disable synthesis as needed.
+ * lex.c (cons_up_default_function): Likewise.
+
+Tue Mar 7 10:14:29 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y: New rules to allow attributes in a prefix position.
+ (prefix_attributes): New variable. Pass it into cplus_decl_attributes.
+ (setattr): New rule.
+ (reserved_declspecs, declmods): Catch attributes here.
+ * decl2.c (cplus_decl_attributes): Add PREFIX_ATTRIBUTES argument.
+ * decl.c (duplicate_decls): Pass DECL_MACHINE_ATTRIBUTES to
+ descendent typedef.
+ (grokdeclarator): Added code to support machine attributes.
+ * Makefile.in (stamp-parse): Expect 5 shift/reduce failures.
+
+Mon Mar 6 15:07:02 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (build_method_call): Don't synthesize methods outside of a
+ function.
+
+ Make base initialization more re-entrant so that synthesis on the
+ fly will work (and, eventually, template instantiation on the fly).
+ * init.c (sort_member_init): Don't bother with members that can't be
+ initialized. Reorganize a bit. Don't initialize base members here.
+ (sort_base_init): New function, like sort_member_init, but for base
+ classes. Steals some code from emit_base_init.
+ (emit_base_init): Simplify. Call sort_{member,base}_init before
+ doing any initialization, so we don't have to save
+ current_{member,base}_init_list in push_cp_function_context.
+ (expand_aggr_vbase_init_1): Adjust for sort_base_init.
+ (expand_aggr_vbase_init): Simplify.
+ * decl.c (struct cp_function): Add protect_list field.
+ (push_cp_function_context): Also save protect_list.
+ (pop_cp_function_context): Also restore protect_list.
+ * call.c (build_method_call): Enable synthesis at point of call.
+ * lex.c (cons_up_default_function): Likewise.
+
+ * parse.y: Turn -ansi checks back into -pedantic checks.
+
+ * init.c (build_new): Fix -fcheck-new for array new.
+
+Sat Mar 4 15:55:42 1995 Fergus Henderson <fjh@cs.mu.oz.au>
+
+ * typeck.c (build_compound_expr): warn if left-hand operand of
+ comma expression has no side-effects.
+
+Fri Mar 3 15:16:45 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * parse.y (primary): Change 'object qualified_id *' rules to 'object
+ overqualified_id *'.
+
+Fri Mar 3 12:48:17 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y (unary_expr): Catch doing sizeof an overloaded function.
+ Make the error look the same as the one we issue in c_sizeof.
+
+ * typeck.c (build_binary_op_nodefault): Give an error for trying
+ to compare a pointer-to-member to `void *'.
+
+Fri Mar 3 11:28:50 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_unary_op): Handle bool increment with smoke and
+ mirrors here, rather than in expand_increment where it belongs,
+ because Kenner doesn't agree with me.
+
+Fri Mar 3 00:08:10 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (grokparms): Catch a PARM_DECL being used for a default
+ argument as well.
+
+Thu Mar 2 20:05:54 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * init.c (build_new): Don't allow new on a function type.
+
+ * parse.y (primary): Avoid a crash when seeing if the arg is of
+ the same type as that given for the typespec in an explicit dtor call.
+
+Thu Mar 2 00:49:38 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (finish_function): Change test for calling
+ mark_inline_for_output.
+
+Wed Mar 1 11:23:46 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_modify_expr): Complain if
+ build_default_binary_type_conversion fails.
+
+ * init.c (expand_default_init): Handle arguments of unknown type
+ properly.
+
+ * cvt.c (build_expr_type_conversion): Only complain about ambiguity
+ if 'complain'.
+ * various: Pass 'complain'.
+
+ * typeck.c (comptypes): Be more picky about comparing UPTs.
+
+Wed Mar 1 11:03:41 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (grokdeclarator): If declarator is null, say that the
+ type used has an incomplete type.
+
+Wed Mar 1 10:06:20 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * pt.c (instantiate_template): Copy the template arguments to the
+ permanent_obstack. Also use simple_cst_equal to compare them when
+ looking for a previous instantiation.
+
+ * tree.c (make_deep_copy): Support copying INTEGER_TYPEs (assuming
+ they are array domain types).
+
+Tue Feb 28 23:24:55 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * cp-tree.h: Define WANT_* constants for passing to
+ build_expr_type_conversion.
+ * cvt.c (build_expr_type_conversion): New function to build
+ conversion to one of a group of suitable types.
+ (build_default_binary_type_conversion): Use it.
+ * decl2.c (grok_array_decl): Likewise.
+ * typeck.c (build_unary_op): Likewise.
+ (build_array_ref): Tidy up a bit.
+ (build_binary_op): Likewise.
+
+Tue Feb 28 19:57:31 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (grokdeclarator): Don't allow decl of an argument as `void'.
+
+Tue Feb 28 17:23:36 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * parse.y (typed_declspecs1): Add 'typespec reserved_typespecquals
+ reserved_declspecs' rule.
+
+ * parse.y (expr_or_declarator): Remove notype_qualified_id rule.
+ (direct_notype_declarator): Likewise.
+ (complex_direct_notype_declarator): Add notype_qualified_id rule.
+
+ * lex.c (real_yylex): Handle :> digraph properly.
+
+Tue Feb 28 12:26:29 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (grokdeclarator): Check if it's a friend, not if it's
+ non-virtual, that's being initialized. Move the check up to
+ before FRIENDP would get cleared. Catch an unnamed var/field
+ being declared void. Say just `field' instead of `structure field'
+ in the error message. Only go for the operator name if DECLARATOR
+ is non-null.
+
+Tue Feb 28 00:08:01 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (start_function): Complain about abstract return type.
+ (grokdeclarator): Complain about declaring constructors and
+ destructors to be const or volatile. Complain about declaring
+ destructors to be static.
+
+ * pt.c (uses_template_parms): Handle pmfs.
+
+ * decl.c (grokdeclarator): Don't call variable_size for array bounds
+ that only depend on template constant parameters.
+
+Mon Feb 27 15:38:16 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * error.c (dump_decl): Only look to see if it's a vtable if we
+ actually have a name to check out.
+
+Mon Feb 27 13:37:53 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * cvt.c (convert_to_aggr): Lose misleading shortcut.
+
+Sun Feb 26 17:27:32 1995 Doug Evans <dje@canuck.cygnus.com>
+
+ * decl.c (set_nested_typename): Always set DECL_IGNORED_P,
+ not just for dwarf.
+
+Sun Feb 26 00:10:18 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (grokdeclarator): Don't allow a static member to be
+ declared `register'.
+
+ * init.c (make_friend_class): Move up to a pedwarn for the warning
+ about a class declaring friends with itself.
+
+ * decl.c (grokdeclarator): You can't do `volatile friend class foo'
+ or `inline friend class foo'. Only try to make a friend out of
+ TYPE if we didn't already reset it to integer_type_node.
+
+Sat Feb 25 22:32:03 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (grokdeclarator): Don't allow initialization of a
+ non-virtual function.
+
+ * decl.c (start_function): Do a pedwarn if we're changing `main'
+ to have an int return type.
+
+Sat Feb 25 00:02:05 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_modify_expr): Handle simple assignment from
+ TARGET_EXPRs by building up an RTL_EXPR to force expansion. Whew.
+
+Fri Feb 24 18:27:14 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (grokdeclarator): Also don't allow virtual outside of a
+ class decl for a scope method definition performed at global binding.
+
+ * init.c (build_offset_ref): Don't allow creation of an OFFSET_REF
+ of a bitfield.
+
+ * decl.c (grokdeclarator): Don't allow a const to be declared mutable.
+
+ * typeck.c (build_binary_op): Return an error_mark_node if either
+ one of the args turned into an error_mark_node when we tried to
+ use default_conversion.
+
+ * typeck.c (build_unary_op): Forbid using postfix -- on a bool.
+
+ * decl.c (grokdeclarator): Allow `signed' and `unsigned' to be
+ used on `__wchar_t'.
+
+Fri Feb 24 13:59:53 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (end_protect_partials): Do it the right way.
+
+Wed Feb 22 15:42:56 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_binary_op_nodefault): Upgrade warning about
+ comparing distinct pointer types to pedwarn.
+
+ * typeck2.c (digest_init): Cope with extra braces.
+
+ * typeck.c (build_binary_op_nodefault): Use tree_int_cst_sgn instead
+ of INT_CST_LT (..., interger_zero_node).
+
+Wed Feb 22 14:45:52 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * except.c [!TRY_NEW_EH] (end_protect_partials): Define dummy
+ function for systems that don't have EH.
+
+Tue Feb 21 19:18:31 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (can_convert_arg): Like can_convert, but takes an arg as
+ well.
+
+ * pt.c (type_unification): Allow implicit conversions for parameters
+ that do not depend on template parameters.
+
+Tue Feb 21 18:43:48 1995 Douglas Rupp <drupp@cs.washington.edu>
+
+ * Make-lang.in, config-lang.in: ($exeext): New macro.
+ * Make-lang.in: Try a "cp" if "ln" fails.
+ * cp-tree.h (decl_attributes): Added argument.
+ * decl2.c (cplus_decl_attribute): Add arg to decl_attributes.
+ * cp/g++.c: Added #ifdefs for sys/file.h and process.h for NT.
+ Modified spawnvp to have to correct number of arguments for OS/2, NT.
+
+Tue Feb 21 18:36:55 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (finish_function): Add calls to end_protect_partials to end
+ the exception region that protects constructors so that partially
+ constructed objects can be partially destructed when the constructor
+ throws an exception.
+ * init.c (perform_member_init, sort_member_init, emit_base_init):
+ Added support for partially constructed objects.
+ * init.c (build_partial_cleanup_for): New routine to do partial
+ cleanups of a base class.
+ * decl2.c (finish_file): Move the emitting of the exception table
+ down, after we emit all code that might have exception regions in
+ them.
+ * except.c (end_protect_partials, might_have_exceptions_p): New
+ routines.
+ (emit_exception_table): Always output table if called.
+ * cp-tree.h (protect_list, end_protect_partials,
+ might_have_exceptions_p, emit_exception_table): Added.
+
+Tue Feb 21 16:05:59 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * gc.c (build_typeid): Pass a NULL_TREE, not the bogus, unused
+ address of a local variable.
+ * class.c (build_vfn_ref): Only try to build the PLUS_EXPR if we
+ were given a non-null PTR_TO_INSTPTR.
+
+Tue Feb 21 01:53:18 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (duplicate_decls): Always lay out the merged decl.
+
+ * decl2.c (finish_vtable_vardecl): Don't do vtable hack on templates.
+ (finish_prevtable_vardecl): Likewise.
+
+ * method.c (synthesize_method): Set interface_{unknown,only}
+ according to the settings for our class, not the file where it comes
+ from.
+
+Sat Feb 18 12:26:48 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c: Handle systems that define __i386__ but not __i386.
+
+Fri Feb 17 15:31:31 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c (reparse_decl_as_expr): Support being called without a
+ type argument.
+
+ * parse.y (primary): Add '(' expr_or_declarator ')'. Adds 4 r/r
+ conflicts. Sigh.
+
+Fri Feb 17 12:02:06 1995 Mike Stump <mrs@cygnus.com>
+
+ * parse.y (template_def, fndef, fn.def1, return_init, condition,
+ initdcl0, initdcl, notype_initdcl0, nomods_initdcl0,
+ component_decl_1, after_type_component_declarator0,
+ notype_component_declarator0, after_type_component_declarator,
+ notype_component_declarator, after_type_component_declarator,
+ full_parm, maybe_raises, exception_specification_opt): Fix up,
+ include exception_specification_opt maybeasm maybe_attribute and
+ maybe_init if missing. Rename maybe_raises to
+ exception_specification_opt to match draft wording. Use maybe_init
+ to simplify rules.
+
+Fri Feb 17 01:54:46 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * init.c (build_new): Set TREE_NO_UNUSED_WARNING on COMPOUND_EXPRs
+ built for news of scalar types.
+
+Thu Feb 16 17:48:28 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_binary_op_nodefault): Update code for warning
+ about signed/unsigned comparisons from C frontend. Realize that the
+ code in the C frontend is, if anything, even more bogus. Fix it.
+ (build_binary_op): Undo default_conversion if it wasn't useful.
+
+ * typeck.c (build_unary_op, ADDR_EXPR): Lose bogus special case for
+ PRE*CREMENT_EXPR.
+
+ * decl2.c (import_export_vtable): Don't try the vtable hack
+ if the class doesn't have any real non-inline virtual functions.
+ (finish_vtable_vardecl): Don't bother trying to find a non-inline
+ virtual function in a non-polymorphic class.
+ (finish_prevtable_vardecl): Likewise.
+
+ * decl2.c (import_export_vtable): Use and set DECL_INTERFACE_KNOWN.
+
+ * cp-tree.h (DECL_INTERFACE_KNOWN): Use DECL_LANG_FLAG_5.
+
+ * init.c (expand_virtual_init): Always call assemble_external.
+
+ * class.c (build_vfn_ref): Always call assemble_external.
+ (build_vtable): Always call import_export_vtable.
+ (prepare_fresh_vtable): Likewise.
+ (add_virtual_function): Don't bother setting TREE_ADDRESSABLE.
+
+Thu Feb 16 03:28:49 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * class.c (finish_struct): Use TYPE_{MIN,MAX}_VALUE to determine
+ whether an enumerated type fits in a bitfield.
+
+Wed Feb 15 15:38:12 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * class.c (grow_method): Update method_vec after growing the class
+ obstack.
+
+Wed Feb 15 13:42:59 1995 Mike Stump <mrs@cygnus.com>
+
+ * parse.y (handler_seq): Push a level for the catch parameters.
+
+Wed Feb 15 12:42:57 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * init.c (emit_base_init): Update BINFO_INHERITANCE_CHAIN on my
+ bases, in case they've been clobbered.
+
+Wed Feb 15 12:07:29 1995 Mike Stump <mrs@cygnus.com>
+
+ * class.c (finish_base_struct): Set up BINFO_INHERITANCE_CHAIN here,
+ so that one day it will always be valid.
+ * tree.c (propagate_binfo_offsets, layout_vbasetypes): Likewise.
+
+ * cp-tree.h (copy_binfo): Removed, unused.
+ * tree.c (copy_binfo): Likewise.
+
+Wed Feb 15 00:05:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * init.c (build_new): Save the allocation before calling
+ expand_vec_init on it.
+
+ * decl.c (finish_enum): The TYPE_PRECISION of the enum type mush
+ match the TYPE_PRECISION of the underlying type for constant folding
+ to work.
+
+Tue Feb 14 15:31:25 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (push_eh_entry, expand_start_all_catch,
+ expand_leftover_cleanups, expand_end_catch_block): Keep track of
+ the context in which the exception region occurs.
+ (build_exception_table): If the region was not output, don't output
+ the entry in the eh table for it.
+
+Tue Feb 14 02:15:43 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * init.c (expand_default_init): Only use a previous constructor call
+ if it's a call to our constructor. Does the word "Duh" mean
+ anything to you?
+
+ * decl.c (grokparms): Fine, just don't call
+ convert_for_initialization at all. OK? Happy now?
+
+Mon Feb 13 02:23:44 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * cp-tree.h (CLASSTYPE_FIRST_CONVERSION): Make sure that the class
+ method vector has a second element before returning it.
+
+ * decl.c (grokparms): Don't strip REFERENCE_TYPE before calling
+ convert_for_initialization.
+
+Sun Feb 12 03:57:06 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_modify_expr): Compare function name to
+ constructor_name (current_class_type) instead of current_class_name.
+
+ * decl.c (grokparms): Don't do anything with the return value of
+ convert_for_initialization.
+
+ * error.c (dump_decl): Also dump_readonly_or_volatile on the decl.
+
+ * decl.c (duplicate_decls): Tweak error message.
+
+ * typeck.c (build_const_cast): Implement checking.
+ (build_reinterpret_cast): Implement some checking.
+
+ * cp-tree.h (CONV_FORCE_TEMP): Require a new temporary when
+ converting to the same aggregate type.
+ (CONV_STATIC_CAST): Include it.
+ (CONV_C_CAST): Likewise.
+ * cvt.c (convert_force): Use CONV_C_CAST instead of CONV_OLD_CONVERT.
+ (cp_convert): Only force a new temporary if CONV_FORCE_TEMP.
+
+Fri Feb 10 16:18:52 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_c_cast): Use non_lvalue to tack something on
+ where necessary.
+
+ * decl.c (auto_function): Now a function.
+ * except.c (init_exception_processing): terminate, unexpected,
+ set_terminate, and set_unexpected have C++ linkage.
+
+ * typeck.c (build_unary_op, TRUTH_NOT_EXPR): Use convert instead of
+ truthvalue_conversion for converting to bool, as it handles
+ user-defined conversions properly.
+ (condition_conversion): Likewise.
+
+ * except.c (expand_throw): Don't call convert_to_reference.
+ Pass the correct parameters to build_new.
+
+ * method.c (do_build_assign_ref): Don't use access control when
+ converting to a base reference here.
+ (do_build_copy_constructor): Or here.
+
+ * init.c (build_new): Unset TREE_READONLY on the dereferenced
+ pointer before assigning to it.
+
+ * decl.c (maybe_build_cleanup): Don't bother stripping const here.
+
+ * decl2.c (delete_sanity): You can now delete pointer to const.
+
+Fri Feb 10 13:28:38 1995 Jason Merrill <jason@python.cygnus.com>
+
+ * decl.c (finish_function): Don't rely on actual parameters being
+ evaluated left-to-right.
+ * except.c (expand_end_catch_block): Likewise.
+
+Fri Feb 10 00:52:04 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * tree.c (real_lvalue_p): Like lvalue_p, but class temps aren't
+ considered lvalues.
+ * cvt.c (convert_to_reference): Use real_lvalue_p instead of
+ lvalue_p.
+
+ * cvt.c (build_type_conversion_1): Don't call convert on aggregate
+ types.
+ (convert_to_reference): Fix erroneous text substitution.
+
+ * typeck2.c (initializer_constant_valid_p): Update from C frontend.
+ Add new argument to all callers.
+
+ * typeck.c (convert_arguments): Check for error_mark_node before
+ trying to do anything with the actual parameter.
+
+ * typeck.c (condition_conversion): Build up a CLEANUP_POINT_EXPR and
+ fold it.
+ (bool_truthvalue_conversion): Remove. Fix all callers to call
+ truthvalue_conversion instead.
+ (various): Fold CLEANUP_POINT_EXPRs.
+
+ * parse.y (conditions): Call condition_conversion rather than
+ building up a CLEANUP_POINT_EXPR.
+
+ * pt.c (end_template_decl): Don't warn_if_unknown_interface here
+ under -falt-external-templates.
+
+Thu Feb 9 05:24:10 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * init.c (build_new): Complain about new of const type without
+ initializer. Other cleanup.
+
+ * call.c (compute_conversion_costs): Don't call
+ build_type_conversion with a reference type; convert to the target
+ type and check its lvaluetude.
+ * cvt.c (convert_to_reference): Likewise.
+
+ * cvt.c (build_type_conversion_1): There will never be any need to
+ dereference references here now.
+
+Thu Feb 9 00:37:47 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_builtin_throw): Make sure we only `use' the
+ value of return_val_rtx.
+
+Wed Feb 8 15:45:55 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * parse.y (structsp): Don't complain about declaring a type being
+ defined to be a friend.
+
+ * decl2.c (warn_if_unknown_interface): Note the template in question
+ and the point of instantiation, for -falt-external-templates.
+ * lex.c (reinit_parse_for_method): Pass the decl to
+ warn_if_unknown_interface.
+ * pt.c (instantiate_template): Likewise.
+ (end_template_decl): Likewise.
+
+ * decl.c (set_nested_typename): Set IDENTIFIER_TYPE_VALUE on the
+ nested name again, to make local classes work a bit better.
+
+ * typeck.c (build_function_call_real): Dereference reference after
+ checking for incomplete type.
+
+ * init.c (build_new): Accept new of const and volatile types.
+
+Wed Feb 8 14:04:16 1995 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grokdeclarator): Fix error message.
+
+Wed Feb 8 03:16:15 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (convert_for_initialization): Do bash arrays when
+ converting to a reference to non-array.
+
+Tue Feb 7 15:50:33 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * cvt.c (cp_convert): Don't call convert_to_reference, or
+ automatically dereference references. Do pass reference conversions
+ to cp_convert_to_pointer.
+ (cp_convert_to_pointer): Support references.
+
+ * call.c (build_method_call): Don't build up a reference to the
+ parameter here; let build_overload_call handle that.
+
+ * typeck.c (build_c_cast): Call convert_to_reference directly if
+ converting to a reference type.
+ * method.c (do_build_copy_constructor): Likewise.
+ * method.c (do_build_copy_constructor): Likewise.
+ (do_build_assign_ref): Likewise.
+
+ * call.c (build_method_call): Dereference a returned reference.
+ * typeck.c (build_function_call_real): Likewise.
+
+ * decl.c (xref_basetypes): Check for unions with basetypes here.
+ (xref_tag): Instead of here.
+
+ * pt.c (process_template_parm): Template type parm decls are
+ artificial.
+
+Mon Feb 6 04:32:09 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * parse.y (typed_declspecs): Add missing semicolon.
+ (do_xref_defn): Resurrect.
+ (named_class_head_sans_basetype): Move template specialization
+ definition cases to named_class_head_sans_basetype_defn.
+
+ * decl2.c (grokfield): Call pushdecl_class_level after setting the
+ TYPE_NAME, not before.
+
+Sun Feb 5 02:50:45 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (convert_harshness): Don't call sorry here. Don't allow
+ conversions between function pointer types if pedantic.
+
+ * pt.c (overload_template_name): Pass globalize=1 to xref_tag.
+
+ * lex.c (cons_up_default_function): Use the full name for the return
+ type of op=.
+
+ * decl.c (set_nested_typename): Don't worry about anonymous types,
+ as they already have a unique name.
+ (pushdecl): Remove redundant set_nested_typename
+ (xref_tag): Split out base handling into xref_basetypes.
+
+ * cp-tree.h (TYPE_INCOMPLETE): New macro; TEMPLATE_TYPE_PARMs are
+ not considered incomplete even though their definition is unknown.
+
+ * decl.c (xref_defn_tag): Lose.
+ (xref_tag): xref_next_defn = ! globalize.
+ (pushdecl): Don't set DECL_NESTED_TYPENAME on artificial decls. The
+ ones that should have it set will have it set by pushtag.
+ (pushdecl_class_level): Likewise.
+ (pushtag): Tidy up a bit.
+ (set_nested_typename): Push a decl for the nested typename from
+ here, rather than from xref_defn_tag.
+
+ * parse.y (do_xref): Lose.
+ (named_class_head): If we see 'class foo:' we know it's a
+ definition, so don't worry about base lists for non-definitions.
+
+ * pt.c (push_template_decls): Template parm decls are artificial.
+
+ * decl.c (duplicate_decls): Restore check for qualifier
+ disagreement for non-functions.
+ (decls_match): Remove check for qualifier disagreement.
+
+Fri Feb 3 14:58:58 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (grok_reference_init): Convert initializer from
+ reference.
+ * typeck.c (convert_for_initialization): Likewise.
+
+ * decl.c (duplicate_decls): Propagate DECL_NESTED_TYPENAME.
+
+ * cvt.c (cp_convert): Don't convert to the same class type by just
+ tacking on a NOP_EXPR.
+ (convert_to_reference): Use comp_target_types instead of comptypes
+ so that we don't allow conversions two levels down.
+
+Thu Feb 2 15:07:58 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * class.c (build_vbase_path): Bash types to make the backend happy.
+ * cvt.c (build_up_reference): Bash the types bashed by
+ build_vbase_path to be reference types instead of pointer types.
+ (convert_to_reference): Likewise.
+
+ * typeck.c (build_c_cast): Don't strip NOPs if we're converting to a
+ reference type.
+
+ * parse.y (structsp): Put back error for 'struct B: public A;'.
+
+Wed Feb 1 23:02:06 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c: Add support for mips systems that don't define __mips
+ but do define mips, like Ultrix.
+
+Wed Feb 1 22:39:07 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c: Add support for exception handling on the Alpha.
+
+Wed Feb 1 10:12:14 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (finish_file): Fix bug in Jan 31st change.
+
+Tue Jan 31 16:59:15 1995 Gerald Baumgartner <gb@lorenzo.cs.purdue.edu>
+
+ * sig.c (build_signature_pointer_or_reference_type): Don't set
+ IS_AGGR_TYPE for signature pointers/reference so expand_default_init
+ doesn't expect to find a copy constructor.
+ * call.c (build_method_call): Treat signature pointers/reference
+ as if IS_AGGR_TYPE were set.
+
+Tue Jan 31 13:28:56 1995 Mike Stump <mrs@cygnus.com>
+
+ * gc.c (get_typeid): Pawn off error messages to build_t_desc.
+ (build_t_desc): Inform the user here if they try and build
+ with -frtti and don't include <typeinfo.h>.
+
+ * decl2.c (finish_prevtable_vardecl): Support rescanning.
+ (finish_file): Move finish_prevtable_vardecl up to before the global
+ initializers are done as tdecls are initialized in the global
+ initializer. Also Pick up any new tdecls or vtables needed by
+ synthesized methods.
+
+ * class.c (finish_struct): Simplify. We have to do rtti scanning at
+ end, so we might as well do all of it there.
+
+Tue Jan 31 05:35:02 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (build_method_call): Fix -fthis-is-variable for 32-bit
+ targets, too.
+
+Tue Jan 31 00:11:04 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (finish_prevtable_vardecl): New routine, mostly split from
+ finish_vtable_vardecl. It has the first half functionality from
+ that routine.
+ * decl2.c (finish_vtable_vardecl): Update to not include stuff not
+ in finish_prevtable_vardecl.
+ * decl2.c (finish_file): Call finish_prevtable_vardecl.
+ * gc.c (build_generic_desc): Allow it to be called when not at the
+ global binding layer, but behave as if we were.
+ (build_t_desc): Rearrange a bit so that it really works and is
+ easier to follow.
+ * class.c (finish_struct): Don't decide on tdecls here, as we have
+ to wait until the end of the file in general to decide whether or
+ not they come out.
+
+Mon Jan 30 01:00:40 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * init.c (build_delete): Check access to operator delete before
+ calling the destructor.
+ * method.c (build_opfncall, DELETE_EXPR): build_method is allowed to
+ return error_mark_node.
+ * call.c (build_method_call): Use the one-argument op delete even if
+ it's an error.
+
+ * init.c (build_new): Fix -fthis-is-variable support.
+ * call.c (build_method_call): Likewise.
+
+ * call.c (convert_harshness): Make conversion from a pointer to bool
+ worse than conversion to another pointer.
+
+Sat Jan 28 16:46:10 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * init.c (build_new): Check new return value if -fcheck-new.
+
+ * lex.c (check_newline): Clear end_of_file when we're done, too.
+
+Sat Jan 28 10:38:39 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (finish_vtable_vardecl): Make rtti TD tables follow
+ vtables whereever they go.
+
+ * gc.c (build_t_desc): Remove old way of setting it up, as it wasn't
+ right.
+
+Sat Jan 28 09:10:44 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (finish_vtable_vardecl): Now set the
+ interface/implementation of vtables on the first virtual function,
+ if one exists, otherwise we use the old method. This is a major win
+ in terms of cutting down the size of objects and executables in
+ terms of text space and data space. Now most of the savings that
+ #pragma interface/implementation gives is automatic in a fair number
+ of cases.
+
+Sat Jan 28 04:57:33 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (grokdeclarator): Discard the template parameters in a
+ template constructor declaration so that the function is always
+ named constructor_name (ctype).
+
+ * lex.c (check_newline): Use ungetc to put back the character before
+ calling HANDLE_PRAGMA.
+
+Fri Jan 27 17:23:47 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (check_classfn): If the cname is T<int> and fn_name is T,
+ make sure we still match them.
+
+Fri Jan 27 16:32:10 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * parse.y: Add END_OF_LINE token.
+
+ * lex.c (check_newline): Set linemode when we see a # directive, and
+ unset it when we're done. Turn all 'return's into 'goto skipline'.
+ Fix all uses of '\n', since we won't see it anymore. Put back the
+ character we read before checking for a sysv or target pragma.
+ (real_yylex): If we see an EOF in linemode, return END_OF_LINE.
+ (handle_sysv_pragma): Don't look at the input stream; quit when we
+ see an END_OF_LINE token.
+
+ * input.c (getch): Return EOF if we're in line mode and at the end
+ of a line.
+ (put_back): Don't put back an EOF.
+
+Thu Jan 26 19:26:34 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_throw): Do the newing of the exception object
+ before we load the type descriptor or the address so that we don't
+ wipe any of the values out.
+
+Thu Jan 26 19:20:00 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (init_exception_processing): Don't use r12 on the rs6000.
+
+Tue Jan 24 16:36:31 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (grokparms): Don't try to build up a reference at this point.
+
+ * typeck2.c (build_functional_cast): Don't assume that a NOP_EXPR
+ will suffice to convert from integer_zero_node.
+
+Wed Jan 25 15:02:09 1995 David S. Miller <davem@nadzieja.rutgers.edu>
+
+ * class.c (instantiate_type): Change error message text.
+ * typeck2.c (store_init_value): Likewise.
+
+Mon Jan 23 21:57:14 1995 Mike Stump <mrs@cygnus.com>
+
+ * pt.c (tsubst): When we copy a node, don't forget to copy
+ TREE_CHAIN, we use it later.
+
+Mon Jan 23 03:33:47 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (convert_for_assignment): Initialize variable before use.
+
+Fri Jan 20 01:17:59 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * g++.c (main): Link with both libstdc++ and libg++ if called as
+ something ending with "g++", otherwise only libstdc++. Move -lm to
+ the end of the line.
+
+Thu Jan 19 15:43:11 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (build_method_call): Don't mess with 'this' before calling
+ compute_conversion_costs.
+
+Wed Jan 18 15:40:55 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * search.c (get_matching_virtual): Give line number for previous
+ declaration.
+
+ * call.c (convert_harshness): Handle conversions to references
+ better.
+
+ * cvt.c (build_up_reference): OK, handle {MIN,MAX}_EXPR *properly*.
+
+Wed Jan 18 15:21:38 1995 Mike Stump <mrs@cygnus.com>
+
+ * class.c (instantiate_type): Use DECL_CHAIN to walk lists instead,
+ as the TREE_CHAIN for methods will take us to the next differently
+ named function, DECL_CHAIN won't.
+
+Wed Jan 18 14:26:59 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * tree.c (lvalue_p): Handle {MIN,MAX}_EXPR.
+
+ * decl2.c (lang_decode_option): -Wall implies -Wparentheses.
+ warn_parentheses defaults to 0.
+
+ * decl.c (grokparms): Put back call to require_instantiated_type.
+
+Tue Jan 17 19:56:15 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (exception_section): Use the data section on the rs6000.
+ Change calling convention for named_section.
+
+Wed Jan 17 18:20:57 1994 Fergus Henderson <fjh@munta.cs.mu.oz.au>
+
+ * cp-tree.h: Make if (x=0) warn with wall
+ * parse.y: Make if (x=0) warn with wall
+
+Tue Jan 17 14:12:00 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (BOOL_TYPE_SIZE): BITS_PER_WORD if SLOW_BYTE_ACCESS,
+ BITS_PER_UNIT otherwise.
+
+ * search.c (get_matching_virtual): Don't check the binfo if the
+ types are the same.
+
+ * cvt.c (cp_convert): Just call truthvalue_conversion to convert to
+ bool.
+
+Mon Jan 16 13:28:48 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * various: Use boolean_type_node, boolean_true_node,
+ boolean_false_node.
+
+ * search.c (get_matching_virtual): Allow covariant returns that
+ don't require pointer adjustment.
+
+ * typeck.c (build_conditional_expr): Don't call default_conversion
+ on ifexp.
+
+ * cvt.c (build_up_reference): Handle MIN_EXPR and MAX_EXPR.
+
+ * decl.c (grokdeclarator): Upgrade warning about &const to pedwarn.
+
+Sun Jan 15 22:17:32 1995 David Binderman <dcb@lovat.fmrco.COM>
+
+ * pt.c (do_function_instantiation): Free targs once we're done.
+
+Sun Jan 15 22:17:32 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (BOOL_TYPE_SIZE): Defaults to BITS_PER_WORD.
+ (init_decl_processing): Use BOOL_TYPE_SIZE instead of CHAR_TYPE_SIZE
+ for bool.
+
+Sat Jan 14 05:33:55 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c (finish_file): We need to mess up if there are any
+ variables in the list, not just if there is one with a constructor.
+
+Fri Jan 13 14:42:55 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (duplicate_decls): Propagate DECL_STATIC_{CON,DE}STRUCTOR.
+ (finish_function): Handle DECL_STATIC_{CON,DE}STRUCTOR.
+ (finish_function): Trust rest_of_compilation.
+
+ * decl2.c (finish_file): Also call functions designated as static
+ constructors/destructors.
+
+ * decl.c (grokdeclarator): Allow access decls of operator functions.
+ (grokparms): Only do convert_for_initialization if the initializer
+ has a type.
+ (duplicate_decls): Put back push_obstacks_nochange call.
+
+ * lex.c (real_yylex): Downgrade complaint about the escape sequence
+ being too large from pedwarn to warning.
+
+ * decl.c (grokdeclarator): Don't complain about long long in system
+ headers.
+
+ * lex.c (real_yylex): Handle digraphs.
+
+Thu Jan 12 12:17:24 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (init_decl_processing): -f{no-,}strict-prototype only
+ affects C linkage declarations now.
+
+ * typeck.c (comp_target_types): Grok simple contravariant conversions.
+ (common_type): t1 and t2 are interchangeable.
+
+ * various: Test return value of comp_target_types differently in
+ different places; it now returns -1 for a contravariant conversion
+ (which is fine in symmetric cases).
+
+ (common_type): Prefer long double to double even when
+ they have the same precision.
+
+ * decl.c (grokparms): Call convert_for_initialization to check
+ default arguments.
+
+ * init.c (build_new): void_type_node has a size (of 0).
+
+ * decl.c (decls_match): Also check for agreement of TREE_READONLY
+ and TREE_THIS_VOLATILE.
+ (push_class_level_binding): Properly handle shadowing of
+ nested tags by fields.
+
+ * search.c (dfs_pushdecls): Likewise.
+
+ * decl2.c (finish_file): Don't second-guess self-initialization.
+
+ * cvt.c (convert_to_reference): Work with expr directly, rather than
+ a copy.
+
+ * decl.c (push_overloaded_decl): Only shadow artificial TYPE_DECLs.
+
+ * init.c (add_friend): Downgrade duplicate friend message from
+ pedwarn to warning.
+
+ * decl.c (duplicate_decls): Push obstacks before calling common_type.
+
+Thu Jan 12 17:15:21 1995 Michael Ben-Gershon <mybg@cs.huji.ac.il>
+
+ * except.c (push_eh_entry): Set LABEL_PRESERVE_P flag for
+ exception table labels.
+ (expand_start_all_catch): Likewise.
+ (expand_leftover_cleanups): Likewise.
+ (expand_end_catch_block): Likewise.
+ * except.c (make_first_label): New function.
+ (expand_start_all_catch): Add a call to make_first_label() before
+ using a label as a jump destination.
+ (expand_end_all_catch): Likewise.
+ (expand_leftover_cleanups): Likewise.
+ (expand_end_catch_block): Likewise.
+ (expand_builtin_throw): Likewise.
+ (expand_throw): Likewise.
+ * except.c: Add ARM processor support for exception handling.
+
+Thu Jan 12 12:17:24 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ (complete_array_type): Copy code from C frontend.
+
+ * lex.c (real_yylex): Don't multiply the length of a wide string
+ literal by WCHAR_BYTES.
+
+ * decl.c (pushdecl): Check for redeclaration of wchar_t here.
+ (duplicate_decls): Instead of here.
+ (define_label): Complain about a label named wchar_t.
+ (grokdeclarator): Complain about declarations of
+ operator-function-ids as non-functions.
+
+ * typeck.c (unary_complex_lvalue): Also wrap prefix -- and ++ in
+ COMPOUND_EXPRs.
+ (build_unary_op): Wrap unary plus in a NON_LVALUE_EXPR.
+
+ * lex.c (real_yylex): Don't skip whitespace when reading the next
+ character after ->.
+
+Wed Jan 11 16:32:49 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c: Allow cc1plus to be built with native compiler on rs6000.
+ (expand_start_all_catch): Add assemble_external calls for various
+ routines we call.
+ (expand_leftover_cleanups): Likewise.
+ (expand_start_catch_block): Likewise.
+ (do_unwind): Likewise.
+ (expand_builtin_throw): Likewise.
+
+Wed Jan 11 01:05:42 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (pushtag): Only look for a previous decl in the current
+ binding level. Use explicit global scope in DECL_NESTED_TYPENAME.
+
+ * gxx.gperf: Add __signature__ and __sigof__ keywords.
+
+ * decl2.c (lang_decode_option): -ansi does not set flag_no_asm. It
+ does set flag_no_gnu_keywords and flag_operator_names.
+
+ * lex.c (init_lex): 'overload' is not a keyword unless -traditional.
+ Unset extension keywords if -fno-gnu-keywords.
+ Allow operator names ('bitand') if -foperator-names.
+ Never unset 'asm'; -fno-asm only affects 'typeof'.
+
+ * decl.c (lookup_name_real): The got_object special lookup only
+ applies to types.
+
+Tue Jan 10 18:07:51 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * spew.c (yylex): Also use DECL_NESTED_TYPENAME if got_object is set.
+
+ * parse.y (primary): Unset got_object after all rules that use the
+ 'object' nonterminal.
+ (object): Set got_object.
+
+ * lex.h: Declare got_object.
+
+ * decl.c (lookup_name_real): Also lookup names in the context of an
+ object specified.
+
+Tue Jan 10 14:30:30 1995 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (get_member_function_from_ptrfunc): Use ptrdiff_type_node
+ for things that have to be added to pointers, not size_type. Cures
+ problems with pointer to members on Alphas.
+ (build_binary_op_nodefault): Likewise.
+ (get_delta_difference_: Likewise.
+ (build_ptrmemfunc): Likewise.
+
+Tue Jan 10 01:49:25 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (pushtag): Stick the new decl in TYPE_NAME before pushing
+ it.
+
+ * typeck.c (build_component_ref): Don't build up a COMPONENT_REF
+ when dealing with overloaded member functions; just act like
+ build_offset_ref.
+ (commonparms): Remove misleading comment.
+
+ * decl.c (duplicate_decls): Complain about repeated default
+ arguments here.
+ (redeclaration_error_message): Instead of here.
+ (pushdecl): Complain about missing default arguments here.
+ (grokparms): Instead of here.
+ (lookup_name_current_level): Also match on DECL_ASSEMBLER_NAME.
+ (grok_reference_init): Do not complain about missing initializer if
+ declared 'extern'.
+
+ * search.c (lookup_field): Don't return a TYPE_DECL if there is a
+ function alternative and want_type is not set.
+
+Mon Jan 9 18:16:23 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (pushtag): Don't set TYPE_NAME to an identifier. Do push
+ the decl when the type has no TYPE_NAME.
+ (lookup_nested_type): Don't assume that type has TYPE_NAME set.
+ (lookup_name_real): Call lookup_field with want_type =
+ prefer_type.
+
+ * search.c (lookup_field): Handle want_type properly in the presence
+ of fields with the same name.
+
+ * decl.c (set_nested_typename): Set nested name for file-scope types
+ to include leading ::.
+ (pushdecl): Set the nested typename if the decl doesn't have one,
+ rather than if the type's canonical decl doesn't have one.
+
+Mon Jan 9 03:44:33 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (convert_for_assignment): Complain about contravariance
+ violation here.
+ (comp_target_types): Instead of here.
+ (build_unary_op): resolve_offset_ref before checking for a valid
+ type.
+
+ * spew.c (yylex): Decrement looking_for_typename after we see a
+ _DEFN.
+
+ * decl.c (pushdecl): Don't install an artificial TYPE_DECL in
+ IDENTIFIER_LOCAL_VALUE if we already have a decl with that name.
+
+ * typeck.c (convert_for_assignment): Converting pointers to bool
+ does not need a cast.
+
+Sun Jan 8 18:16:45 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * class.c (instantiate_type): Initialize nsubsts parm.
+
+ * pt.c (do_function_instantiation): Likewise.
+
+Sat Jan 7 14:37:05 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * pt.c (tsubst): Use TREE_STATIC instead of DECL_INLINE &&
+ DECL_SAVED_INSNS to determine whether or not we've seen a definition
+ of this function.
+ (instantiate_template): Likewise.
+
+ * call.c (convert_harshness): Allow const reference binding when
+ called from the overloading code, but not when called from
+ can_convert (since it isn't a conversion).
+ (convert_harshness): Put back some disabled code.
+
+Fri Jan 6 14:10:57 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (convert_harshness): There is no implicit conversion from
+ void* to other pointer types (unless the parameter is (void*)0).
+ (convert_harshness): Non-lvalues do not convert to reference types.
+
+ * class.c (finish_struct_methods): Still set
+ TYPE_HAS_{INT,REAL}_CONVERSION.
+
+ * call.c (can_convert): Don't use aggregate initialization.
+
+ * cp-tree.h: Declare lookup_conversions.
+
+Thu Jan 5 21:08:00 1995 Mike Stump <mrs@cygnus.com>
+
+ * parse.y (simple_stmt): Fix duplicate case value error messages to
+ be more readable.
+
+Wed Jan 4 16:44:19 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * cvt.c (build_type_conversion): Total rewrite to use
+ convert_harshness instead of reproducing conversion logic here. Now
+ much shorter.
+
+ * call.c (convert_harshness): Support conversions to bool.
+ (can_convert): Checks whether a conversion is less harsh
+ than USER_CODE, for build_type_conversion.
+
+ * search.c (add_conversions): Function for passing to dfs_walk which
+ adds all the type conversion operators in the current type to a list.
+ (lookup_conversions): Calls dfs_walk with add_conversions and return
+ the list.
+ (dfs_walk): Don't require a qfn.
+
+ * cp-tree.h: Lose CLASSTYPE_CONVERSIONS hackery.
+ (CLASSTYPE_FIRST_CONVERSION): Points to elt 1 of CLASSTYPE_METHOD_VEC.
+
+ * class.c (finish_struct_bits): Lose CLASSTYPE_CONVERSIONS hackery.
+ (grow_method): A separate function for building onto the growing
+ method vector.
+ (finish_struct_methods): Use it. Put all type conversion operators
+ right after the constructors. Perhaps we should sort the methods
+ alphabetically?
+
+Mon Jan 2 14:42:58 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (build_method_call): Lose another misleading shortcut.
+
+Fri Dec 30 17:57:30 1994 Mike Stump <mrs@cygnus.com>
+
+ * gc.c (build_bltn_desc): Handle bool as a built-in type.
+
+Fri Dec 30 14:20:21 1994 Mike Stump <mrs@cygnus.com>
+
+ * tree.c (layout_vbasetypes): Ensure that we don't loose alignment
+ on the complete type because of small virtual bases.
+
+Fri Dec 30 12:22:29 1994 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (n_incomplete): Bump n_incomplete up to int to match C
+ front end.
+ (pushdecl): Also count decls pushed that are of a type being defined
+ as incomplete things.
+ * class.c (finish_struct): Move hack_incomplete_structures up to
+ just after we set it as not being defined, so that the decls we
+ build for RTTI don't count as incomplete.
+
+Thu Dec 29 18:20:57 1994 Mike Stump <mrs@cygnus.com>
+
+ * pt.c (tsubst): Fix problem with defining constructors in templated
+ classes with virtual bases.
+
+Wed Dec 28 08:31:00 1994 Mike Stump <mrs@cygnus.com>
+
+ * parse.y (TYPEID): Strip top-level cv-qualifiers on typeid
+ expressions.
+ * gc.c (build_typeid): Likewise.
+
+Thu Dec 22 17:26:33 1994 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (build_up_reference): Fix breakage introduced on Nov 29,
+ don't assert on complex AGGR inits.
+
+Thu Dec 22 14:32:31 1994 Mike Stump <mrs@cygnus.com>
+
+ * method.c (build_overload_value): Handle pointer to members as
+ template arguments.
+
+Thu Dec 22 13:09:07 1994 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (unary_complex_lvalue): Don't call sorry if we know how
+ to do take the address of a data member for a pointer to data
+ member.
+
+Thu Dec 22 10:04:19 1994 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (grokdeclarator): Use the typedef name for linkage if the
+ type doesn't otherwise have a name.
+
+ * decl2.c (grokfield): Likewise.
+
+ * class.c (finish_struct): Since we reuse the TYPE_DECL for the
+ DECL_NAME of enums, structs and classes, we have to avoid trying to
+ put it in the TYPE_FIELDS again.
+
+Wed Dec 21 11:07:05 1994 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (check_classfn): Ignore this parameter on static functions
+ when checking to see if we match.
+
+Tue Dec 20 17:47:02 1994 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (unary_complex_lvalue): Handle address of non-left most
+ pointers to members by calling get_delta_difference.
+
+Mon Dec 19 22:40:53 1994 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (check_classfn): Don't use decls_match yet, as it modifies
+ static functions to early.
+
+Thu Dec 19 22:37:48 1994 Mike Stump <mrs@cygnus.com>
+
+ * method.c (make_thunk): Handle encoding of positive thunk offsets.
+
+Sat Dec 17 13:29:50 1994 Doug Evans <dje@canuck.cygnus.com>
+
+ * Make-lang.in (.PHONY): Tell GNU make C++ and c++ are phony targets.
+
+Thu Dec 15 16:32:12 1994 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (check_classfn): Use decls_match to check if this has
+ already been declared, as the DECL_ASSEMBLER_NAME may have been
+ changed via asm("new_name").
+ * decl.c (decls_match): Make public.
+
+Thu Dec 15 15:17:55 1994 Mike Stump <mrs@cygnus.com>
+
+ * *.[chy] (expand_aggr_init): Add fourth argument to handle
+ distinction between = init and (init) style of initializations.
+ * *.[chy] (finish_decl): Add fifth argument to handle
+ distinction between = init and (init) style of initializations.
+
+Tue Dec 13 19:16:05 1994 Mike Stump <mrs@cygnus.com>
+
+ Fix some random `explicit' bugs.
+
+ * cvt.c (convert_to_reference): Add third parameter to
+ convert_force.
+ (convert_force): Likewise.
+ * call.c (build_method_call): Likewise.
+ * decl2.c (setup_vtbl_ptr): Likewise.
+ * init.c (expand_virtual_init): Likewise.
+ (build_member_call): Likewise.
+ (build_delete): Likewise.
+ (build_vbase_delete): Likewise.
+ * typeck.c (build_component_addr): Likewise.
+ (build_c_cast): Likewise.
+ (build_modify_expr): Likewise.
+ * cp-tree.h (CONV_NONCONVERTING): Likewise. Add so that we can
+ distinguish the context in which the conversion appears. Add thrid
+ argument to build_c_cast.
+ * cvt.c (cp_convert): Pass whether or not we want to consider
+ non-converting constructors down to build_method_call.
+ * decl2.c (reparse_absdcl_as_casts): Add third argument to
+ build_c_cast.
+ * gc.c (build_m_desc): Likewise.
+ * init.c (build_new): Likewise.
+ * parse.y (expr_no_commas): Likewise.
+ (primary): Likewise.
+ * typeck.c (build_x_function_call): Likewise.
+ (build_static_cast): Likewise.
+ (build_reinterpret_cast): Likewise.
+ (build_const_cast): Likewise.
+ (build_c_cast): Likewise.
+ (build_ptrmemfunc): Likewise.
+ * typeck2.c (build_functional_cast): Likewise.
+ * init.c (expand_aggr_init): Added LOOKUP_ONLYCONVERTING to
+ expand_aggr_init_1 as inits are converted to the destination type.
+
+Tue Dec 13 16:18:57 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * Make-lang.in (cc1plus): Depends on c-pragma.o.
+
+ * Makefile.in (OBJ{DEP,}S): Add ../c-pragma.o.
+
+ * lex.c (check_newline): If the #pragma is not recognized by g++,
+ try machine-specific ones too.
+ (handle_sysv_pragma): Copied from c-lex.c.
+
+Mon Dec 12 23:53:06 1994 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_throw): Fix Dec 6th change, build_new likes a
+ reference better.
+
+Mon Dec 12 18:01:00 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_binary_op): Lose checks on TYPE_PTRMEMFUNC_P with
+ IS_AGGR_TYPE, since now they will not both be set on the same type.
+
+ * pt.c (do_pending_expansions): Don't clear TREE_PUBLIC on
+ instantiations controlled by -fexternal-templates.
+
+ * decl.c (duplicate_decls): Don't complain about different values of
+ __attribute__ ((const)) and ((noreturn)).
+
+Fri Dec 9 18:17:37 1994 Doug Evans <dje@cygnus.com>
+
+ * Makefile.in (BISONFLAGS): Delete --yacc.
+ (PARSE_H): Depend on $(PARSE_C), for parallel makes.
+ (PARSE_C): Undo last patch.
+
+Fri Dec 2 10:44:36 1994 Mike Stump <mrs@cygnus.com>
+
+ * Makefile.in (BISONFLAGS): Add --yacc so that output winds up in
+ y.tab.c.
+
+Thu Dec 8 17:39:46 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (finish_decl): Don't call obscure_complex_init for decls
+ of indeterminate size.
+
+Wed Dec 7 16:49:22 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (obscure_complex_init): Function to tweak the decl to
+ prevent expand_decl from tring to initialize it.
+ (finish_decl): Use it rather than writing the same code in three
+ different places.
+
+ * parse.y (bad_parm): Stop trying to support parms without types.
+
+Wed Dec 7 12:06:56 1994 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (grokfield): Make asm specs on static member functions
+ work.
+
+Tue Dec 6 15:43:20 1994 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_throw): Make a copy of the thrown object.
+
+Tue Dec 6 14:16:34 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * parse.y: : Has lower precedence than =.
+
+Tue Dec 6 12:46:17 1994 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (pushdecl): Use DECL_NAME of VAR_DECLs to avoid namespace
+ manglings.
+ (grokvardecl): Add namespace into variable name.
+
+Tue Dec 6 11:26:55 1994 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (current_namespace_id): New routine to transform a simple
+ name into a name in a namespace.
+ * decl.c (grokdeclarator): Use it.
+ * decl2.c (get_namespace_id): Find the name of the current
+ namespace.
+ (push_namespace, pop_namespace): Complete out missing
+ functionality.
+
+Mon Dec 5 17:11:51 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * class.c (finish_struct): Don't use LONG_LONG_TYPE_SIZE, as it may
+ not be defined. Fix warning message for enums and restore warning
+ for non-enums.
+
+ * decl2.c (push_namespace): Dummy function.
+ (pop_namespace): Likewise.
+ (do_namespace_alias): Likewise.
+ (do_using_decl): Likewise.
+ (do_using_directive): Likewise.
+
+ * parse.y: New token NSNAME for namespace names.
+ (extdef): Add namespace, using definitions.
+ (using_decl): New rule for using declarations.
+ (any_id): New rule for identifiers with any degree of scoping.
+ (identifier): Add NSNAME.
+ (notype_identifier): Likewise.
+ (component_decl): Add using_decl.
+ (nested_name_specifier): Add NSNAME SCOPE.
+
+ * typeck.c (convert_for_assignment): Handle conversions between
+ enums and bool.
+
+ * decl.c (duplicate_decls): Only propagate DECL_MAIN_VARIANT on
+ FUNCTION_DECLs.
+
+Mon Dec 5 13:03:16 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (finish_struct): Give an error if one tries to declare a
+ bit-field's size greater than a long long, as the backend will dump.
+ It is not an error to declare an enum bit-field greater than its
+ precision. Warn if an enum bit-field is too small to hold all
+ its values.
+
+Mon Dec 5 11:41:50 1994 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (convert_for_assignment): Use cp_convert instead of
+ convert so that we don't get static casts.
+
+Sun Dec 4 11:59:01 1994 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (cp_convert): Don't complain about int->enum conversion if
+ we are doing static casts.
+
+Fri Dec 2 18:32:41 1994 Mike Stump <mrs@cygnus.com>
+
+ * error.c (dump_expr): Do something more intelligent with SAVE_EXPRs
+ when dumping expressions in error messages.
+
+Fri Dec 2 17:04:27 1994 Mike Stump <mrs@cygnus.com>
+
+ * gc.c (build_dynamic_cast): Change interface to libg++, ensure that
+ the return type is the right type, and make references work.
+
+Fri Dec 2 16:36:43 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (poplevel): Don't be confused by function-scope
+ declarations of non-nested functions.
+ (duplicate_decls): Propagate DECL_MAIN_VARIANT.
+ (pushdecl): Use duplicate_decls to copy info from old decl into new
+ function-scope one rather than doing it here.
+
+ * decl2.c (mark_inline_for_output): Deal with the DECL_MAIN_VARIANT
+ of this decl, in case this is a function-scope declaration.
+
+ * decl.c (finish_enum): Make sure that the type has the right
+ precision when we call fixup_*_type.
+
+Tue Nov 29 19:12:07 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * cvt.c (build_up_reference): Strip superfluous NOP_EXPRs; we do
+ want to build up references to rvalues if possible.
+ (cp_convert): Stick on a NOP_EXPR when converting to the same type.
+
+Tue Nov 29 11:28:59 1994 Mike Stump <mrs@cygnus.com>
+
+ * parse.y (maybe_raises): Handle throw ().
+ * parse.y (ansi_raise_identifier): Grok type-ids in exception
+ specifications.
+ * tree.c (build_exception_variant): Use list compare to check if
+ two exception specifications match.
+ * decl.c (duplicate_decls, bad_specifiers): Enhance wording on error
+ messages.
+ * call.c (build_method_call): Remove TREE_RAISES.
+ * cvt.c (convert_to_aggr): Likewise.
+ * typeck.c (build_function_call_real, convert_arguments): Likewise.
+ * init.c (expand_aggr_init_1): Likewise.
+
+Tue Nov 29 09:50:39 1994 Mike Stump <mrs@cygnus.com>
+
+ * except.c: Add support for m68k and mips exception handling
+ support.
+
+Tue Nov 29 08:48:33 1994 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_end_all_catch): Throw into outer context, if we
+ fall off end of catch handlers.
+
+Mon Nov 28 16:44:41 1994 Mike Stump <mrs@cygnus.com>
+
+ * Makefile.in: Make is easier to decide where parse.[ch] will be
+ built.
+
+Thu Nov 17 20:11:24 1994 Doug Evans <dje@cygnus.com>
+
+ * cp/Make-lang.in (CXX_INSTALL_NAME): Use program_transform_name.
+ (GXX_INSTALL_NAME): Likewise.
+ (CXX_CROSS_NAME): Use program_transform_cross_name.
+ (GXX_CROSS_NAME): Likewise.
+ (c++.install-man): Use program_transform_name on g++.1.
+ (c++.uninstall): Likewise.
+
+Mon Nov 28 13:53:03 1994 Mike Stump <mrs@cygnus.com>
+
+ * parse.y (THROW): Fix precedence of throw expressions.
+
+Mon Nov 28 13:15:16 1994 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_unary_op): Allow promotions from bool to int on
+ unary ~.
+
+Sun Nov 27 00:16:21 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * method.c (build_overload_name): Use DECL_ASSEMBLER_NAME for
+ classes when appropriate.
+ (build_overload_nested_name): When dealing with a function context,
+ use ASM_FORMAT_PRIVATE_NAME to tweak the name of the function to
+ avoid conflicts between local classes of the same name.
+
+Wed Nov 23 17:59:42 1994 Mike Stump <mrs@cygnus.com>
+
+ * gxx.gperf, parse.y, lex.h, hash.h, lex.c (init_lex), delc.c
+ (duplicate_decls, grokdeclarator), cp-tree.h: Add support for
+ `explicit'.
+ * cvt.c (convert_to_reference, cp_convert, build_type_conversion_1,
+ build_type_conversion): Use LOOKUP_ONLYCONVERTING in
+ build_method_calls so that non-converting constructors are not used.
+ * call.c (build_method_call): If we shouldn't use a non-converting
+ constructor, then don't.
+
+Wed Nov 23 14:46:56 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (build_method_call): Don't try to synthesize methods yet.
+
+Tue Nov 22 12:45:21 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * pt.c (push_template_decls): Create CONST_DECLs for template
+ constant parameters, not VAR_DECLs.
+
+Sat Nov 19 15:28:31 1994 Jim Wilson <wilson@chestnut.cygnus.com>
+
+ * typeck.c (build_binary_op_nodefault): Can shorten shift only if
+ shift count is less than size in bits of arg0.
+
+Thu Nov 17 15:30:50 1994 Mike Stump <mrs@cygnus.com>
+
+ * gxx.gperf, hash.h, lex.c (init_lex, real_yylex), parse.y: Add new
+ ANSI keywords and, and_eq, bitand, bitor, explicit, namespace, not,
+ not_eq, or, or_eq, typename, using, xor, xor_eq to g++. Still need
+ to add support for explicit, namespace, typename, and using, support
+ for the rest is already in.
+
+Fri Nov 4 19:04:18 1994 Mike Stump <mrs@cygnus.com>
+
+ * gc.c (get_bad_cast_node): New routine to support compile time
+ throws of bad_cast.
+ * gc.c (build_dynamic_cast): Support throwing of bad_cast at compile
+ time.
+
+Fri Nov 4 11:12:00 1994 Mike Stump <mrs@cygnus.com>
+
+ * except.c: Add hppa support.
+
+Fri Nov 4 10:50:50 1994 Mike Stump <mrs@cygnus.com>
+
+ * except.c: Add rs6000 support.
+
+Thu Nov 3 14:24:23 1994 Mike Stump <mrs@cygnus.com>
+
+ * except.c (do_unwind): Add i[34]86 support.
+
+Thu Nov 3 00:10:46 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * pt.c (do_pending_expansions): Unset TREE_PUBLIC on implicit
+ instantiations.
+
+Wed Nov 2 15:08:24 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * decl.c (finish_function): Emit types used in method parameters
+ into symbol table.
+
+Wed Nov 2 15:05:47 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * pt.c (process_template_parm): Allow pointer to member function
+ template parameter types.
+ (uses_template_parms): Handle pointer to member function
+ CONSTRUCTORs.
+
+ * g++.c (main): Cast first argument of bzero to (char *).
+ Pass -lstdc++ instead of -lg++ unless we are invoked as 'g++'.
+
+Mon Oct 31 14:50:48 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * gc.c (build_dynamic_cast): Rewrite to make it work.
+ * class.c (finish_vtbls): Build more vtables if flag_rtti is on.
+ * class.c (modify_all_direct_vtables): Likewise.
+ * init.c (expand_direct_vtbls_init): Expand more vtables if
+ flag_rtti is on.
+ * decl.c (init_type_desc): Add default return.
+
+Tue Oct 25 17:13:09 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * tree.c (debug_binfo): Get rid of the initial size entry of
+ vtable.
+ * cp-tree.h: Change flag_dossier to flag rtti, define type
+ descriptor type nodes.
+ * decl.c (init_type_desc): New function to initialize type
+ descriptor type nodes.
+ * decl.c (record_builtin_type): Change flag_dossier to flag_rtti.
+ * lex.c (init_lex): Likewise.
+ * decl.c: Change variable flag_dossier to flag_rtti.
+ * decl.c (duplicate_decls): Get rid initial size entry of vtable.
+ * decl.c (hack_incomplete_structures): Take out assert 164.
+ * search.c (get_abstract_virtuals_1): Likewise.
+ * search.c (dfs_init_vbase_pointers): Change CLASSTYPE_DOSSIER to
+ CLASSTYPE_RTTI.
+ * parse.y: Likewise.
+ * class.c (prepare_fresh_vtable): For virtual bases, get right
+ offset.
+ * class.c (add_virtual_function): Change flag_dossier to
+ flag_rtti.
+ * class.c (modify_one_vtable): Modify the right rtti entry.
+ * class.c (override_one_vtable): Get rid of size entry.
+ * class.c (finish_struct): Change flag_dossier to flag_rtti, and
+ build extra vtables, build type descriptors for polymorphic
+ classes.
+ * gc.c (build_headof): Make headof() works correctly with new
+ rtti.
+ * gc.c (build_typeid): Make this function work with new rtti.
+ * gc.c (get_typeid): Make this function work with new rtti.
+ * gc.c (build_bltn_desc): New function for new rtti.
+ * gc.c (build_user_desc): Likewise.
+ * gc.c (build_class_desc): Ditto.
+ * gc.c (build_ptr_desc): Ditto.
+ * gc.c (build_attr_desc): Ditto.
+ * gc.c (build_func_desc): Ditto.
+ * gc.c (build_ptmf_desc): Ditto.
+ * gc.c (build_ptmd_desc): Ditto.
+ * gc.c (build_t_desc): Ditto.
+ * gc.c: Comment out old build_t_desc, build_i_desc, build_m_desc.
+
+Tue Oct 25 13:37:41 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (convert_harshness): Check for TREE_UNSIGNED differences
+ after checking for integral conversions.
+
+Wed Nov 30 19:13:50 1994 Mike Stump <mrs@cygnus.com>
+
+ * Version 2.6.3 released.
+
+Thu Nov 17 10:56:50 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck2.c (build_m_component_ref): Check the basetype of the
+ member pointer against the main variant of the object type.
+
+Mon Nov 14 14:21:52 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * cvt.c (convert_to_reference): Make sure that the original expr
+ gets its type back when converting a reference.
+
+ * method.c (build_overload_name): Clear numeric_outputed_need_bar here.
+ (build_decl_overload): Instead of here.
+
+Tue Nov 8 17:11:24 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * cvt.c (cp_convert): Don't build a TARGET_EXPR if we're not in a
+ function.
+
+ * typeck.c (convert_for_initialization): Handle initialization from
+ a TARGET_EXPR.
+
+Sun Nov 6 01:34:24 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * pt.c (lookup_nested_type_by_name): Fix list-walking logic.
+ (tsubst): When replacing a TEMPLATE_TYPE_PARM, propagate
+ TYPE_READONLY and TYPE_VOLATILE from the argument.
+ (unify): When unifying with a TEMPLATE_TYPE_PARM, remove cv-quals
+ present in parm from arg.
+ (type_unification): Strip REFERENCE_TYPE from the argument type.
+ (unify): Don't strip REFERENCE_TYPE from the argument type.
+
+Sat Nov 5 22:42:15 1994 Greg McGary <gkm@magilla.cichlid.com>
+
+ * pt.c (do_type_instantiation): Check to see if there's a
+ IDENTIFIER_TEMPLATE on a class before calling
+ instantiate_member_templates().
+
+Sat Nov 12 06:35:42 1994 Mike Stump <mrs@cygnus.com>
+
+ * Version 2.6.2 released.
+
+Thu Nov 3 18:48:19 1994 Paul Eggert <eggert@twinsun.com>
+
+ * Makefile.in (spew.o, lex.o, pt.o):
+ Depend on $(srcdir)/parse.h, not parse.h.
+
+Tue Nov 1 19:19:41 1994 Mike Stump <mrs@cygnus.com>
+
+ * Version 2.6.1 released.
+
+Sun Oct 23 13:19:55 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c: Declare flag_access_control.
+ (struct lang_f_options): Add access-control.
+ * expr.c (cplus_expand_expr, NEW_EXPR): Unset flag_access_control
+ for the call to expand_aggr_init to copy the object out of the
+ pcc_struct_return slot.
+ * search.c (compute_access): if (!flag_access_control) return
+ access_public.
+
+Fri Oct 21 00:32:54 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * lex.c (cons_up_default_function): Don't try to defer method
+ synthesis now.
+
+ * decl.c (init_decl_processing): Use __pure_virtual for abort_fndecl
+ instead of abort, since the OSF/1 dynamic linker doesn't like to see
+ relocation entries for abort.
+
+ * tree.c (array_type_nelts_total): Use sizetype, not
+ integer_type_node.
+ (array_type_nelts_top): Likewise.
+
+Thu Oct 20 15:48:27 1994 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (grokdeclarator): Added handling for catch parameters
+ (CATCHPARM).
+ * except.c (expand_start_catch_block): Use the new CATCHPARM context
+ instead of NORMAL.
+ * except.c (expand_throw): Don't let convert_to_reference complain
+ about what we are doing.
+
+Thu Oct 20 12:55:24 1994 Jim Wilson <wilson@cygnus.com>
+
+ * method.c (emit_thunk): Call instantiate_virtual_regs.
+
+Wed Oct 19 14:15:33 1994 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_exception_blocks): Make sure throw code doesn't
+ get put in function that won't be output.
+
+Mon Oct 17 18:03:15 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (init_decl_processing): Make alloca a builtin.
+
+Thu Oct 27 21:10:25 1994 Craig Burley <craig@burley>
+
+ * g++.c (main): Only decrement "added" and set "library" to
+ NULL when "library" != NULL (just like 940829 fix).
+
+Mon Oct 17 15:56:11 1994 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_start_catch_block): Make sure the false label
+ gets onto the permanent obstack, as it is used for the exception
+ table.
+
+Fri Oct 14 18:54:48 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (modify_one_vtable): Since the DECL_CONTEXT of fndecl can
+ be set just below, use current_fndecl instead.
+
+Fri Oct 14 15:12:22 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * init.c (expand_aggr_vbase_init_1): Don't call expand_aggr_init_1
+ with LOOKUP_SPECULATIVELY.
+ (expand_default_init): Abort if build_method_call returns NULL_TREE.
+
+ * typeck.c (build_modify_expr): Don't just build a MODIFY_EXPR if
+ the rhs is a TARGET_EXPR.
+
+ * parse.y (left_curly): Anonymous types are not affected by #pragma
+ interface/implementation.
+
+ * method.c (synthesize_method): Don't call setup_vtbl_ptr for the
+ default constructor if it isn't needed.
+
+ * lex.c (cons_up_default_function): Do synthesize methods for
+ anonymous types if necessary.
+
+Thu Oct 13 17:44:55 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * method.c (build_decl_overload): Set numeric_outputed_need_bar to 0.
+
+Wed Oct 12 13:27:57 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * typeck.c (build_modify_expr): Understand how to copy an aggregate.
+
+ * init.c (expand_default_init): Likewise. Also remove some of the
+ crufty code that assumes methods will not be synthesized properly.
+
+ * lex.c (cons_up_default_function): If the containing type has no
+ name, these functions should never need to be called, so just
+ declare them.
+
+ * lex.c (real_yylex): Use HOST_BITS_PER_WIDE_INT to determine the
+ bitmask for lexing character constants.
+
+ * call.c (build_method_call): Disable code that tries to do tricky
+ stuff with a default parameter that is a constructor call, but
+ actually does other tricky stuff that breaks things.
+
+Wed Oct 12 16:14:01 1994 Benoit Belley <belley@cae.ca>
+
+ * decl.c (finish_enum): Disable code which forces enums to be signed,
+ since this conflicts with their use as bitfields. type_promotes_to
+ handles promotion of enums of underlying unsigned types to signed
+ integer types.
+
+Wed Oct 12 13:24:03 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * cvt.c (type_promotes_to): Also promote enums to long if
+ appropriate.
+
+ * typeck.c (default_conversion): Don't expect type_promotes_to to
+ return a main variant.
+
+Wed Oct 12 12:19:45 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (build_scoped_method_call): Don't lose side effects in the
+ object expression when calling a non-existent destructor.
+
+Fri Sep 2 19:05:21 1994 Rohan Lenard <rjl@iassf.easams.com.au>
+
+ * call.c (build_scoped_method_call): Remove erroneous error message
+ when destructor call is written as a scoped call.
+
+Tue Oct 11 23:48:31 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * various: Cast pointer arguments to bzero and bcopy to char *.
+
+Tue Oct 11 19:34:32 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (get_derived_offset): Added a type parameter to limit how
+ far up the CLASSTYPE_VFIELD_PARENT chain we search.
+ * class.c (modify_one_vtable, fixup_vtable_deltas): When forming the
+ offset to put into the vtable for the this parameter, make sure we
+ don't offset from a parent of the DECL_CONTEXT of the function.
+
+Tue Oct 11 16:10:52 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * pt.c (do_function_instantiation): Set DECL_EXTERNAL and
+ TREE_STATIC when setting DECL_INTERFACE_KNOWN.
+ (do_type_instantiation): Likewise.
+
+ * lex.c (cons_up_default_function): Set DECL_INTERFACE_KNOWN,
+ DECL_EXTERNAL and TREE_STATIC as appropriate.
+
+ * decl2.c (finish_file): Also synthesize methods that don't have
+ DECL_EXTERNAL set. Set interface_unknown before doing so.
+
+ * decl.c (start_function): If DECL_INTERFACE_KNOWN is set on the
+ function decl, don't muck with TREE_PUBLIC and DECL_EXTERNAL.
+
+Mon Oct 10 00:56:53 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * lex.c (cons_up_default_function): Mark methods in a template class
+ as template instances. Store the values of interface_unknown and
+ interface_only for do_pending_inlines.
+ (do_pending_inlines): Use them.
+
+ * decl2.c (finish_file): If we haven't seen a definition of a
+ function declared static, make the decl non-PUBLIC so compile_file
+ can give an error.
+
+Sun Oct 9 02:42:29 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * method.c (do_build_copy_constructor): Handle anonymous unions.
+ (do_build_assign_ref): Likewise.
+ (largest_union_member): Move from lex.c.
+
+Sat Oct 8 14:59:43 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ Re-implement g++'s vague linkage independent of TREE_PUBLIC.
+ * pt.c (instantiate_member_templates): Lose redundant
+ -fexternal-templates handling.
+ (tsubst): Set TREE_PUBLIC and DECL_EXTERNAL on new decls. Don't set
+ TREE_STATIC or DECL_INTERFACE_KNOWN.
+ (do_pending_expansions): Predicate on DECL_INTERFACE_KNOWN instead
+ of DECL_EXTERNAL for explicit instantiations.
+ (do_function_instantiation): Do the new thing.
+ (do_type_instantiation): Likewise.
+ (instantiate_template): Deal with member templates defined in a .cc
+ file with -fexternal-templates.
+ * except.c (expand_exception_blocks): Use DECL_LINKAGE_KNOWN to
+ decide whether to stick builtin_throw here.
+ * decl2.c (import_export_inline): Predicate on DECL_INTERFACE_KNOWN
+ rather than TREE_PUBLIC. Generally fix rules.
+ (finish_file): Use DECL_INITIAL to determine whether or not a method
+ has been synthesized, rather than TREE_ASM_WRITTEN.
+ * decl.c (warn_extern_redeclared_static): Use DECL_PUBLIC instead of
+ TREE_PUBLIC.
+ (pushdecl): Likewise.
+ (duplicate_decls): Likewise. Deal with DECL_DECLARED_STATIC and
+ DECL_INTERFACE_KNOWN.
+ (redeclaration_error_message): Fix checking for conflicting linkage.
+ (define_function): Set DECL_INTERFACE_KNOWN.
+ (grokfndecl): Function decls are PUBLIC until we are sure about
+ their linkage. Set DECL_DECLARED_STATIC as needed.
+ (start_function): Deal with linkage. Move pushdecl after linkage
+ magic.
+ (finish_function): Don't set TREE_ASM_WRITTEN on discarded inlines.
+ * cp-tree.h (lang_decl_flags): Add interface_known and
+ declared_static.
+ (DECL_INTERFACE_KNOWN): New macro.
+ (DECL_DECLARED_STATIC): New macro.
+ (DECL_PUBLIC): New macro.
+
+ Clean up bogus use of TREE_PUBLIC.
+ * class.c (alter_access): Fix mistaken use of TREE_PUBLIC (it
+ doesn't correspond to TREE_PROTECTED and TREE_PRIVATE).
+ * init.c (do_friend): Don't arbitrarily set TREE_PUBLIC.
+
+Wed Oct 5 13:44:41 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * call.c (build_overload_call_real): Don't immediately do
+ array->pointer conversion.
+
+ * pt.c (type_unification): If not passing to a reference, strip
+ cv-quals. Also handle array->pointer conversion.
+
+Tue Oct 4 17:45:37 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (grokdeclarator): Don't warn about applying const to a
+ const typedef or template type parameter.
+
+ * decl2.c (finish_file): Also synthesize methods after walking the
+ vtables. Ugly ugly ugly.
+
+Mon Oct 3 15:02:41 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * various: Remove lingering remnants of old exception handling code.
+
+ * decl2.c (finish_file): Synthesize methods before walking the
+ vtables, so that the vtables get emitted as needed.
+
+ * decl.c (shadow_tag): Remove obsolete code for pushing tags and
+ dealing with exceptions.
+
+Mon Oct 3 13:05:27 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
+
+ * Make-lang.in (g++-cross): Depend upon version.o and $(LIBDEPS).
+
+Mon Oct 3 02:59:28 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c (finish_file): Fix inline handling.
+
+Sun Oct 2 00:21:56 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (grokdeclarator): Handle redundant scope even better.
+ ({push,pop}_cp_function_context): Take toplev parameter.
+
+ * method.c (synthesize_method): Pass toplev parameter to
+ {push,pop}_cp_function_context depending on decl_function_context
+ (fndecl).
+
+ * typeck.c (build_x_unary_op): Unary & on OFFSET_REFs is always the
+ built-in version.
+
+ * method.c (synthesize_method): Don't be confused by __in_chrg
+ parameter.
+
+ * class.c (popclass): Set C_C_D like start_function does.
+
+ * decl.c (grokdeclarator): Handle redundant scope better.
+
+ * parse.y (expr_or_declarator): Add '(' expr_or_declarator ')' rule.
+ (direct_notype_declarator): Likewise.
+ (complex_direct_notype_declarator): Remove it here.
+
+Sat Oct 1 21:42:18 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * init.c (resolve_offset_ref): Fix types used in resolving .*
+ expressions.
+
+Sat Oct 1 15:18:49 1994 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ Beginnings of work to synthesize methods only when needed.
+ * call.c (build_method_call): Synthesize methods as necessary
+ (currently never necessary).
+ * class.c (popclass): Don't try to set C_C_D here, as it'll end up
+ on the wrong obstack.
+ * decl.c (push_cp_function_context): Mostly copied from
+ push_c_function_context.
+ (pop_cp_function_context): Similarly.
+ (finish_function): Reverse order of poplevel and pop_nested_class so
+ that current_class_decl is restored properly.
+ (start_function): Likewise.
+ (finish_function): Add parameter 'nested'. Don't call
+ permanent_allocation if (nested).
+ * various: Pass extra parameter to finish_function.
+ * decl2.c (finish_file): Reorganize end-of-file inline handling,
+ synthesizing methods as necessary.
+ * lex.c (cons_up_default_function): Call mark_inline_for_output.
+ Only synthesize methods immediately if #pragma implementation
+ (currently disabled).
+ (do_pending_inlines): Call synthesize_method.
+ * method.c (synthesize_method): New function; all method synthesis
+ goes through here. Calls do_build_assign_ref and
+ do_build_copy_constructor.
+ (build_default_constructor): Remove.
+ (build_dtor): Likewise.
+ (build_assign_ref): Rename to do_build_assign_ref and remove stuff
+ done by synthesize_method.
+ (build_copy_constructor): Similarly.
+
+Thu Sep 29 16:58:52 1994 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (c_expand_return): Use magic so the backend can fixup the
+ assignment into the return register, so cleanups won't clobber it.
+
+Thu Sep 29 13:08:50 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * method.c (hack_identifier): Don't call assemble_external for
+ template decls.
+
+ * decl.c (finish_decl): Also end temporary allocation if the decl in
+ question has a type of error_mark_node.
+
+Wed Sep 28 21:45:00 1994 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_modify_expr): When optimizing ?: on lhs, make sure
+ that if the ?: was a reference type, that the subparts will be also.
+
+Wed Sep 28 16:14:04 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * except.c (register_exception_table): Use Pmode, not PTRmode.
+
+Fri Sep 23 13:54:27 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * lex.c (do_pending_inlines): Do method synthesis after the
+ pending_inlines have been reversed.
+
+Thu Sep 22 12:53:03 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * decl2.c (finish_file): Fix Brendan's fix: Only call
+ register_exception_table if there is a non-empty exception table.
+
+Thu Sep 22 12:03:46 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl2.c (finish_file): Only do register_exception_table if
+ -fhandle-exceptions is being used.
+
+Wed Sep 21 19:01:51 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * except.c (output_exception_table_entry): Simplify
+ by using assemble_integer.
+ (build_exception_table): Change to return a count.
+ Cleanup to use standard macros, instead of hard-wired
+ sparc asm format. Don't make __EXCEPTION_TABLE__ global.
+ (register_exception_table): New function. Generate call to builtin.
+ * decl2.c (finish_file): Call register_exception_table.
+ * cp-tree.h (build_exception_table): Fix prototype.
+
+Wed Sep 21 13:20:42 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * tree.c (break_out_calls): Don't try to duplicate the DECL_INITIAL.
+
+ * decl2.c (delete_sanity): Give an error at trying to delete a
+ function.
+
+Wed Sep 21 11:47:10 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * lex.c (cons_up_default_function): Mark synthesized destructors
+ inline.
+
+ * decl.c (duplicate_decls): Ignore redeclarations of wchar_t as
+ something other than __wchar_t, complaining if -pedantic and not in
+ a system header.
+
+Tue Sep 20 09:43:28 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (xref_tag): Set up BINFO_INHERITANCE_CHAIN on base binfos
+ here.
+
+ * typeck.c (build_modify_expr): Require complete type after checking
+ for error_mark_node.
+
+ * call.c (build_method_call): Print parmtypes when complaining of
+ ambiguous call.
+
+ * typeck.c (build_modify_expr): Handle assignment to array from
+ non-array.
+
+ * decl.c (lookup_name_real): Deal with got_scope == error_mark_node.
+
+ * call.c (build_method_call): Don't bother with the exact match.
+
+Mon Sep 19 00:51:39 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * init.c (expand_aggr_init): If we munge the type of the variable,
+ also munge the type of the initializer.
+
+ * decl.c (grokdeclarator): Use <= when comparing to RID_LAST_MODIFIER.
+ (init_decl_processing): Push artificial declaration of wchar_t so
+ people don't have to declare it before they can use it.
+
+ * error.c (cp_line_of): Return lineno in lieu of 0.
+
+ * typeck.c (convert_for_assignment): Handle conversion of pmfs to
+ int and bool.
+ (build_component_ref): Fold the COMPONENT_REF in case it can be
+ reduced.
+
+ * typeck2.c (store_init_value): Don't pedwarn about non-constant
+ bracketed initializers for automatic variables.
+
+Sun Sep 18 10:12:12 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * error.c (dump_decl): Don't say `typedef enum foo foo'.
+
+ * decl.c (start_decl): Don't set TREE_PUBLIC on template decls just
+ because they're affected by #pragma i/i. We'll deal with that when
+ they get instantiated.
+
+ * typeck.c (build_unary_op): Clean up cruft in ADDR_EXPR case.
+
+ * class.c (instantiate_type): Set TREE_CONSTANT on instantiated
+ ADDR_EXPRs if appropriate.
+
+ * decl.c (build_ptrmemfunc_type): Unset IS_AGGR_TYPE on pmf types.
+
+ * typeck.c (build_ptrmemfunc): Handle &overloaded_method as an
+ initializer properly.
+ * typeck2.c (digest_init): Likewise.
+
+ * tree.c (cp_build_type_variant): Like c_build_type_variant, except
+ it uses build_cplus_array_type.
+ * *.c: Use cp_build_type_variant instead of c_build_type_variant.
+
+ * pt.c (do_type_instantiation): Don't try to instantiate nested
+ enums.
+
+Tue Sep 13 10:56:58 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cvt.c (build_up_reference): Handle preincrement and predecrement
+ properly.
+
+Tue Sep 13 09:51:59 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (finish_decl): Only lay out the rtl for DECL if it is, in
+ fact, static.
+
+Mon Sep 12 14:40:30 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (finish_decl): Lay out the rtl for DECL before doing
+ grok_reference_init, in case it's static.
+
+Mon Sep 12 12:45:38 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * class.c (finish_struct): Don't synthesize constructors if the
+ class has a field with the same name as the class. Don't die on
+ classes with no constructors or destructors. Don't die if the head
+ and tail of the class are in different files.
+
+ * decl.c (grokdeclarator): Don't treat a function pointer field
+ with the same name as the class as a constructor.
+
+Fri Sep 9 13:17:00 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_c_cast): Pull constant values out of their
+ variables here.
+
+ * decl.c (duplicate_decls): Only propagate DECL_CHAIN in
+ FUNCTION_DECLs and TEMPLATE_DECLs.
+
+Thu Sep 8 10:07:48 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (duplicate_decls): Propagate DECL_CHAIN in all DECLs that
+ have it.
+
+ * pt.c (unify): REALs and INTEGERs only unify with their own genus.
+ (instantiate_member_templates): Don't muck with DECL_EXTERNAL and
+ TREE_PUBLIC unless -fexternal-templates.
+
+Wed Sep 7 13:17:10 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * pt.c (do_type_instantiation): Call instantiate_member_templates.
+ Deal with specializations.
+ (tsubst): Don't stick the mangled name in DECL_NAME for function
+ instantiations. Don't push them, either.
+
+ * decl2.c (grokfield): Move code for generating the
+ DECL_ASSEMBLER_NAME for static members from here.
+ * method.c (build_static_name): To here.
+ * decl.c (grokvardecl): Call build_static_name.
+ (duplicate_decls): Keep old DECL_ASSEMBLER_NAME.
+
+Mon Sep 5 12:49:18 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (build_method_call): If -Wsynth, warn when selecting
+ synthesized op= over user-supplied one cfront would select.
+ * decl2.c (lang_decode_option): Handle -Wsynth.
+
+Fri Sep 2 15:11:59 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (finish_enum): Overhaul to fix several bugs.
+ (start_enum): Disable useless code.
+
+Thu Sep 1 16:04:54 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (c_expand_return): Warn about returning a reference to a
+ temporary.
+ (convert_arguments): Increment argument counter when using default
+ arguments, too.
+
+Wed Aug 31 14:29:22 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (finish_decl): If the type of decl is error_mark_node,
+ don't bother trying to do anything.
+
+ * typeck.c (convert_for_initialization): If the rhs contains a
+ constructor call, pretend the lhs type needs to be constructed.
+
+ * init.c (expand_default_init): If we stick the object inside the
+ initializer, mark the initializer used.
+
+Tue Aug 30 13:50:18 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * method.c (build_assign_ref): Return *this;
+ (build_assign_ref): Fix base assignment order.
+ (build_copy_constructor): Fix member init order.
+
+Mon Aug 29 13:54:39 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * g++.c (main): Remember to clear out SAW_SPECLANG after we see
+ its argument.
+
+Sat Aug 27 09:36:03 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * method.c (build_copy_constructor): Also copy virtual bases.
+
+Fri Aug 26 17:05:15 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * lex.c (do_pending_inlines): Clear out pending_inlines before doing
+ any synthesis. Also first set deja_vu on all pending_inlines.
+
+ * method.c (build_assign_ref): Use build_member_call to invoke base
+ operator=, rather than build_modify_expr. And use
+ build_reference_type instead of TYPE_REFERENCE_TO.
+ (build_copy_constructor): Use TYPE_NESTED_NAME to identify the
+ basetype.
+
+ * decl2.c (grokfield): Don't complain about undefined local class
+ methods.
+
+ * class.c (finish_struct): Don't try to synthesize methods here.
+ * lex.c (do_pending_inlines): Instead, synthesize them here.
+ (init_lex): Initialize synth_obstack.
+ (cons_up_default_function): Stick synthesis request on
+ pending_inlines.
+
+Fri Aug 26 12:24:14 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * call.c (build_method_call) [PCC_STATIC_STRUCT_RETURN]: Also
+ accept an RTL_EXPR in what we're about to use for the instance,
+ since anything which would end up with pcc_struct_return set
+ inside cplus_expand_expr.
+
+ * cp-tree.h (cons_up_default_function): Note change of prototype.
+
+Thu Aug 25 23:05:30 1994 Gerald Baumgartner <gb@cs.purdue.edu>
+
+ * class.c (finish_struct): Undid change from Aug 21 testing
+ CLASSTYPE_INTERFACE and CLASSTYPE_VTABLE_NEEDS_WRITING.
+ * parse.y (left_curly): Likewise, undid change from Aug 21.
+ * decl.c (xref_tag): Undid change from Aug 21, set
+ CLASSTYPE_INTERFACE correctly, and added comments.
+
+Thu Aug 25 00:36:31 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ Rework approach to synthesized methods; don't go through the parser
+ anymore.
+ * class.c (finish_struct): Use new synthesis approach.
+ * lex.c (cons_up_default_function): Now just creates declaration,
+ not code.
+ (largest_union_member): #if 0 out.
+ (default_assign_ref_body): Likewise.
+ (default_copy_constructor_body): Likewise.
+ * method.c (build_default_constructor): New function to synthesize X().
+ (build_copy_constructor): Synthesize X(X&).
+ (build_assign_ref): Synthesize X::operator=(X&).
+ (build_dtor): Synthesize ~X().
+
+ * error.c (cp_line_of): If we're dealing with an artificial
+ TYPE_DECL, look at the type instead.
+
+Wed Aug 24 11:11:50 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * init.c (sort_member_init): Check warn_reorder.
+ * decl2.c (lang_decode_option): Handle -W{no-,}reorder.
+
+ * cp-tree.h (CLASSTYPE_SOURCE_LINE): New macro.
+ * error.c (cp_line_of): Use CLASSTYPE_SOURCE_LINE for aggregates.
+ * class.c (finish_struct): Set CLASSTYPE_SOURCE_LINE.
+
+Tue Aug 23 09:28:35 1994 Mike Stump <mrs@cygnus.com>
+
+ * error.c (dump_decl): Improve wording, so that error messages
+ dont't read template<, class foo>...
+
+Mon Aug 22 15:30:51 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y (label_colon): Also match a TYPENAME as a label name,
+ since they may have declared a class by that name but have also
+ tried to have a local label under the same name.
+
+ * pt.c (coerce_template_parms): Call cp_error, not cp_error_at,
+ for the message so they know at what point it was instantiated.
+
+Sun Aug 21 23:07:35 1994 Gerald Baumgartner <gb@cs.purdue.edu>
+
+ * class.c (finish_struct): Move setting of CLASSTYPE_INTERFACE and
+ CLASSTYPE_VTABLE_NEEDS_WRITING for signatures up to left_curly time.
+ * decl.c (xref_tag): Move setting of CLASSTYPE_INTERFACE and
+ CLASSTYPE_VTABLE_NEEDS_WRITING for signatures down to left_curly time.
+ * parse.y (left_curly): New final resting place for setting
+ CLASSTYPE_INTERFACE and CLASSTYPE_VTABLE_NEEDS_WRITING for signatures.
+
+ * class.c (finish_struct): Don't test for function/field name
+ conflicts in signatures, since all the fields are compiler-constructed.
+
+Fri Aug 19 14:04:47 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * method.c (build_overload_nested_name): In qualified name
+ mangling, the template with value instantiation will have numeric
+ at end and may mixed with the name length of next nested level.
+ Add a '_' in between.
+ * method.c (build_overload_name): Ditto.
+ * method.c (build_overload_identifier): Ditto.
+
+Thu Aug 18 16:24:43 1994 Mike Stump <mrs@cygnus.com>
+
+ * error.c (dump_decl): Handle NULL args.
+
+Thu Sep 29 16:15:36 1994 Michael I Bushnell <mib@churchy.gnu.ai.mit.edu>
+
+ * g++.c: Rework last change so it's done like collect.c (and
+ gcc.c).
+
+Wed Sep 14 10:17:27 1994 Michael I Bushnell <mib@churchy.gnu.ai.mit.edu>
+
+ * g++.c: Include <sys/errno.h> in case `errno' is a macro
+ as permitted by ANSI C.
+
+Thu Aug 18 12:48:09 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (finish_struct): Move setting of CLASSTYPE_INTERFACE and
+ CLASSTYPE_VTABLE_NEEDS_WRITING up to left_curly time.
+ * decl.c (xref_tag): Move setting of CLASSTYPE_INTERFACE and
+ CLASSTYPE_VTABLE_NEEDS_WRITING down to left_curly time.
+ * parse.y (left_curly): New final resting place for setting
+ CLASSTYPE_INTERFACE and CLASSTYPE_VTABLE_NEEDS_WRITING.
+
+Thu Aug 11 11:32:42 1994 H.J. Lu <hjl@nynexst.com>
+
+ * g++.c (main): Only decrement "added" and set "library" to
+ NULL when "library" != NULL.
+
+Sat Aug 13 00:14:52 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grokdeclarator): Don't set TREE_PUBLIC on a function decl
+ just because its class has a known interface.
+ (decls_match): Deal with new format of template parms.
+
+ * lex.c (cons_up_default_function): Don't play with TREE_PUBLIC and
+ DECL_EXTERNAL here.
+
+Fri Aug 12 01:55:15 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (pushtag): SET_DECL_ARTIFICIAL on gratuitous typedefs.
+ (xref_defn_tag): Likewise.
+ (pushdecl): Only allow artificial typedefs to be shadowed.
+
+ * init.c (emit_base_init): Pass the right binfos to
+ expand_aggr_init_1.
+
+ * class.c (delete_duplicate_fields_1): Make it work right.
+ (finish_struct): Catch function/field name conflict.
+
+ * decl2.c (check_classfn): Pass the function to cp_error, not just
+ the name.
+
+ * init.c (sort_member_init): Warn when order of member initializers
+ does not match order of member declarations.
+ (emit_base_init): Call expand_aggr_init_1 with LOOKUP_PROTECT.
+
+ * error.c (dump_expr): Handle lists of functions.
+
+ * decl.c (start_function): #pragma interface only affects functions
+ that would otherwise be static.
+ (finish_decl): Don't warn about an unused variable if it has both
+ constructor and destructor, since the 'resource allocation is
+ initialization' idiom is relatively common.
+
+ * typeck.c (comp_target_types): Don't handle TEMPLATE_TYPE_PARMs.
+ (comp_target_parms): Likewise.
+ (compparms): Never consider default parms.
+ (common_base_type): Don't choose a virtual baseclass if there is a
+ more derived class in common.
+ (build_conditional_expr): If pedantic, pedwarn about conversion to
+ common base in conditional expr.
+
+ * class.c (instantiate_type): Handle template instantiation better.
+
+ * typeck.c (convert_arguments): Don't try to get tricky and convert
+ to int directly when PROMOTE_PROTOTYPES is set, as it breaks
+ user-defined conversions.
+
+ * lex.c (check_for_missing_semicolon): Also give error at end of
+ file.
+
+ * call.c (build_method_call): Don't promote arrays to pointers here.
+
+ * typeck.c (convert_arguments): Don't require the actual parameter
+ to be of a complete type if the formal parameter is a reference.
+
+Thu Aug 11 15:21:40 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grokdeclarator): Soften 'static' on member function error
+ to pedwarn.
+
+ * init.c (build_new): Don't automatically save rval.
+ (build_offset_ref): Do field lookup with proper basetype_path.
+
+Thu Aug 11 12:46:54 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * errfn.c (cp_silent): Declare to mark when we should avoid
+ emitting warnings and errors.
+ (cp_error): Check it.
+ (cp_warning): Likewise.
+ (cp_pedwarn): Likewise.
+ (cp_compiler_error): Likewise.
+ (cp_error_at): Likewise.
+ (cp_warning_at): Likewise.
+ (cp_pedwarn_at): Likewise.
+ * call.c (compute_conversion_costs): Set CP_SILENT when we start
+ out, and make sure we turn it off before we leave.
+
+Thu Aug 11 00:02:54 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl2.c (grok_array_decl): Try computing *(A+B) if neither
+ argument is obviously an array.
+
+Wed Aug 10 15:32:04 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (c_expand_start_case): Do cleanups here.
+
+ * parse.y (xcond): Do bool conversion here, too.
+ (simple_stmt, SWITCH case): Don't do cleanups here.
+
+ * decl.c (duplicate_decls): Don't treat builtins that have been
+ explicitly declared specially.
+
+Tue Aug 9 01:16:09 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * tree.c (make_deep_copy): Support copying pointer, reference,
+ function, array, offset and method types.
+
+ * decl.c (init_decl_processing): Mark exit and abort as
+ BUILT_IN_NONANSI so that duplicate_decls is kinder about
+ redeclaration.
+ (duplicate_decls): Don't give two errors for redeclaring a C
+ function with the same parms but a different return type.
+
+ * parse.y (paren_cond_or_null): Do cleanup and bool conversion here.
+ (condition): Instead of here.
+ (simple_stmt, SWITCH case): Also do cleanup here.
+
+ * decl2.c (finish_anon_union): Only break out FIELD_DECLs.
+
+ * call.c (build_method_call): Don't throw away the side effects of
+ the object in a call to a non-existent constructor.
+ * parse.y (primary): Likewise.
+
+ * method.c (build_decl_overload): Oop.
+
+ * decl2.c (lang_decode_option): Deal with flag_no_nonansi_builtin,
+ warn about uselessness of specifying -fansi-overloading.
+
+ * method.c (build_decl_overload): Treat any non-member new with one
+ parameter as __builtin_new.
+
+ * decl.c (init_decl_processing): Setup built-in meanings of exit,
+ _exit and abort.
+
+Mon Aug 8 15:03:30 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * error.c (dump_readonly_or_volatile): Put a space between const and
+ volatile if both apply.
+
+ * init.c (perform_member_init): Clean up after this initialization.
+ (emit_base_init): Clean up after each base init, not after all have
+ been done.
+ (expand_aggr_vbase_init_1): Clean up after this init.
+
+Sun Aug 7 14:55:05 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (build_method_call): Deal with destroying references.
+
+ * parse.y (condition): Do bool_truthvalue_conversion here.
+ (paren_expr_or_null): And here.
+ (simple_if): Not here.
+ (simple_stmt): Or here.
+
+Sat Aug 6 22:29:45 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (paren_expr_or_null): Wrap the expression in a
+ CLEANUP_POINT_EXPR.
+ (condition): Likewise.
+
+Sat Aug 6 19:46:37 1994 Rohan Lenard <rjl@easams.com.au>
+
+ * call.c (build_scoped_method_call): Fix error message when
+ destructor call refers to a nonexistent type.
+
+Sat Apr 16 22:43:30 1993 Gerald Baumgartner <gb@cs.purdue.edu>
+
+ * lex.h (rid): Deleted RID_RAISES, it's never used.
+ Moved RID_PUBLIC, RID_PRIVATE, RID_PROTECTED, RID_EXCEPTION,
+ RID_TEMPLATE and RID_SIGNATURE to the end of the enumeration,
+ they don't need to be touched in `grokdeclarator.'
+ (RID_LAST_MODIFIER): Defined macro to be RID_MUTABLE.
+
+ * decl.c (grokdeclarator): Use RID_LAST_MODIFIER instead of
+ RID_MAX as loop limit for finding declaration specifiers.
+
+Sat Apr 3 21:59:07 1993 Gerald Baumgartner <gb@cs.purdue.edu>
+
+ * lex.c (debug_yytranslate): Moved to parse.y since it needs to
+ access `yytname,' which is static in parse.c.
+
+Fri Apr 2 23:36:57 1993 Gerald Baumgarnter <gb@cs.purdue.edu>
+
+ * cp-tree.h (GNU_xref_ref): Fixed typo in extern declaration, it
+ was `GNU_xref_def' instead of `GNU_xref_ref.'
+
+Fri Aug 5 14:20:16 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * pt.c (do_function_instantiation): Don't set TREE_PUBLIC and
+ DECL_EXTERNAL on 'extern' instantiations; wait until EOF to do that.
+ (do_type_instantiation): Likewise.
+
+ * decl2.c (import_export_inline): Decides at EOF what an inline's
+ linkage should be.
+ (finish_file): Call it.
+
+ * decl.c (start_function): Don't rely on the settings of TREE_PUBLIC
+ and DECL_EXTERNAL from do_*_instantiation. Only set
+ DECL_DEFER_OUTPUT on inlines whose linkage might actually change.
+ (finish_function): Use DECL_DEFER_OUTPUT to decide which inlines to
+ mark for later consideration, rather than DECL_FUNCTION_MEMBER_P.
+
+Fri Aug 5 01:12:20 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (get_class_offset_1, get_class_offset): New routine to
+ find the offset of the class where a virtual function is defined,
+ from the complete type.
+ * class.c (modify_one_vtable, fixup_vtable_deltas): Use
+ get_class_offset instead of virtual_offset as get_class_offset will
+ always provide the right answer.
+ * tree.c (virtual_offset): Remove. It only ever worked some of the
+ time.
+
+Tue Aug 2 12:44:21 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (build_method_call): Put back unary_complex_lvalue call
+ that I thought was redundant.
+
+ * typeck.c (c_expand_return): Fix a case I missed before.
+
+Sun Jul 31 17:54:02 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * pt.c (unify): Strip cv-quals from template type arguments (when
+ 'const T*' is matched to 'const char*', that does not mean that T is
+ 'const char').
+
+Fri Jul 29 01:03:06 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * pt.c (do_type_instantiation): Instantiate nested TAGS, not
+ typedefs. Third time's the charm?
+
+ * parse.y (template_parm): Support default template parms.
+ * pt.c (process_template_parm): Likewise.
+ (end_template_parm_list): Likewise.
+ (coerce_template_parms): Likewise.
+ (mangle_class_name_for_template): Likewise.
+ (push_template_decls): Likewise.
+ (unify): Likewise.
+ * method.c (build_overload_identifier): Likewise.
+ * error.c (dump_decl): Likewise.
+
+Wed Jul 27 17:47:00 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * pt.c (do_type_instantiation): Only instantiate nested *classes*.
+
+Tue Jul 26 13:22:40 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * search.c (note_debug_info_needed): Also emit debugging information
+ for the types of fields.
+
+Mon Jul 25 00:34:44 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * pt.c (lookup_template_class): Pass 'template' to
+ coerce_template_parms instead of 'in_decl', since it's a more
+ meaningful context.
+
+ * typeck.c (c_expand_return): Make sure any cleanups for the return
+ expression get run.
+ (build_c_cast): Use CONVERT_EXPR for conversion to void.
+
+ * pt.c (do_type_instantiation): Also instantiate nested types.
+
+ * typeck.c (convert_for_assignment): Don't die when comparing
+ pointers with different levels of indirection.
+
+ * decl.c (grokdeclarator): The sub-call to grokdeclarator for
+ class-local typedefs sets DECL_ARGUMENTS, so we need to clear it
+ out.
+
+ * decl2.c (finish_anon_union): Don't die if the union has no
+ members.
+
+ * decl.c (grokdeclarator): Undo changes to declspecs when we're done
+ so that 'typedef int foo, bar;' will work.
+
+ * decl2.c (finish_file): Don't call expand_aggr_init for
+ non-aggregates.
+
+Mon Jul 25 00:03:10 1994 Teemu Torma <tot@trema.fi>
+
+ * decl.c (finish_function): We can't inline constructors and
+ destructors under some conditions with -fpic, but don't unset
+ DECL_INLINE.
+
+Mon Jul 25 00:03:10 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_object_ref): Make sure 'datum' is a valid object.
+
+Sun Jul 24 14:19:31 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * class.c (finish_struct): Don't set DECL_FIELD_BITPOS on
+ non-fields.
+ (finish_struct_methods): Use copy_assignment_arg_p.
+
+ * cvt.c (cp_convert): If expr is an OFFSET_REF, resolve it instead
+ of giving an error.
+
+ * typeck.c (build_binary_op_nodefault): Don't set result_type if we
+ don't know how to compare the operands.
+
+ * decl.c (grokdeclarator): Avoid seg fault when someone uses '__op'
+ as a declarator-id in their program. Like the Linux headers do.
+ Arrgh.
+
+ * tree.c (lvalue_p): Treat calls to functions returning objects by
+ value as lvalues again.
+
+ * typeck.c (build_component_addr): Use convert_force to convert the
+ pointer in case the component type is also a private base class.
+
+ * search.c (get_matching_virtual): Fix bogus warning of overloaded
+ virtual.
+
+ * pt.c (overload_template_name): Set DECL_ARTIFICIAL on the created
+ TYPE_DECL to fix bogus shadowing warnings.
+
+Fri Jul 22 01:15:32 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * init.c (expand_aggr_init_1): const and volatile mismatches do not
+ prevent a TARGET_EXPR from initializing an object directly.
+
+Tue Jul 19 17:55:37 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cvt.c (build_up_reference): Allow building up references to
+ `this', don't warn about making references to artificial variables
+ (like `this').
+
+ * tree.c (lvalue_p): `this' is not an lvalue.
+
+ * call.c (build_method_call): Accept using a typedef name (or
+ template type parameter) for explicit destructor calls.
+
+Thu Jul 14 09:42:23 1994 Mike Stump <mrs@cygnus.com>
+
+ * Version 2.6.0 released.
+
+Wed Jul 13 03:57:54 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * method.c (hack_identifier): Put back old code so lists of
+ non-functions will be handled properly.
+
+ * cp-tree.h (TYPE_NEEDS_CONSTRUCTING): #if 0 out; this macro is now
+ defined in the language-independent tree.h.
+
+ * tree.c (count_functions): Avoid bogus warning when compiling this
+ function.
+
+Mon Jul 11 18:37:20 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grok_reference_init): Always save the initializer of a
+ reference.
+
+Fri Jul 8 17:41:46 1994 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (cplus_expand_expr_stmt): Wrap statement expressions inside
+ CLEANUP_POINT_EXPRs so that the stack slots can be reused.
+ (disabled for now)
+
+Fri Jul 8 12:59:38 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * method.c (hack_identifier): Fix for new overloading.
+
+ * typeck.c (build_binary_op_nodefault): Don't mess with division by
+ zero.
+
+Fri Jul 8 13:20:28 1994 Gerald Baumgartner <gb@cs.purdue.edu>
+
+ * decl2.c (finish_file): Only call walk_sigtables, if
+ flag_handle_signatures is turned on, don't waste time otherwise.
+
+Fri Jul 8 02:27:41 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (push_overloaded_decl): Don't create overloads of one when
+ shadowing a class type.
+ * typeck.c (build_x_function_call): Complain about overloads of one.
+
+ * decl.c (grokdeclarator): Don't try to treat a char* as a tree.
+ (grokdeclarator): Fix setting of TREE_STATIC.
+ (start_decl): Clear DECL_IN_AGGR_P after calling duplicate_decls.
+
+Thu Jul 7 22:20:46 1994 Gerald Baumgartner <gb@andros.cygnus.com>
+
+ * cp-tree.h (walk_sigtables): Created extern declaration.
+ * decl2.c (walk_sigtables): Created function, patterned after
+ walk_vtables, even though we only need it to write out sigtables.
+ (finish_sigtable_vardecl): Created function.
+ (finish_vtable_vardecl): Changed 0 to NULL_PTR.
+ (finish_file): Call walk_sigtables.
+
+ * sig.c (build_signature_table_constructor): Mark class member
+ function pointed to from signature table entry as addressable.
+
+Thu Jul 7 13:39:37 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (start_decl): Check new decl of static member variable
+ against the declaration in the class here.
+ (grokvardecl): Instead of here.
+
+ * class.c (prepare_fresh_vtable): Call import_export_vtable if not
+ -fvtable-thunks.
+ (build_vtable): Likewise.
+
+ * decl2.c (import_export_vtable): Move logic for deciding the
+ interface of a template class from here.
+ (import_export_template): To here.
+ (finish_vtable_vardecl): Call import_export_template before
+ import_export_vtable.
+
+Wed Jul 6 20:25:48 1994 Mike Stump <mrs@cygnus.com>
+
+ * except.c (init_exception_processing): Setup interim_eh_hook to
+ call lang_interim_eh.
+ * except.c (do_unwind): Propagate throw object value across
+ stack unwinding.
+ * except.c (saved_throw_value): Used to hold the value of the object
+ being thrown. It is always a reference to the real value.
+ * except.c (expand_start_catch_block): Add handling for the
+ value of the exception object.
+ * except.c (expand_start_catch_block): Add handler for the handler,
+ so that throws inside the handler go to the outer block.
+ * except.c (expand_end_catch_block): Likewise.
+ * parse.y (handler_args): Use parm instead, as the other doesn't yet
+ handle references correctly.
+
+Wed Jul 6 17:55:32 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * decl2.c (mark_vtable_entries): If -ftable-thunks, set the
+ vtable entry properly to abort.
+
+Tue Jul 5 14:07:54 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_binary_op_nodefault): Downgrade division by zero
+ errors to warnings.
+
+ * call.c (build_overload_call_real): Handle fnname being a list of
+ functions.
+ * typeck.c (build_x_function_call): Pass list of functions to
+ build_overload_call, not just the name.
+ * tree.c (count_functions): Complain when called for invalid
+ argument.
+
+ * decl.c (grokdeclarator): Fix settings of TREE_STATIC, TREE_PUBLIC
+ and DECL_EXTERNAL on static members and initialized const members.
+ * decl2.c (grokfield): Reflect this change.
+
+Fri Jul 1 09:35:51 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (init): ANSI C++ does not forbid { }.
+
+Thu Jun 30 00:35:22 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl2.c (lang_decode_option): Set warn_nonvdtor along with -Wall.
+ warn_nonvdtor defaults to off.
+
+ * class.c (instantiate_type): Use comptypes rather than relying on
+ types to satisfy ==.
+
+ * decl.c (start_function): Set DECL_DEFER_OUTPUT on all inlines that
+ might be static.
+
+ * tree.c (build_cplus_new): Never build WITH_CLEANUP_EXPRs.
+
+ * decl.c (grok_reference_init): Deal with ADDR_EXPRs of TARGET_EXPRs.
+
+ * cvt.c (cp_convert): Pass 0 to with_cleanup_p arg of
+ build_cplus_new.
+
+Wed Jun 29 22:31:09 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl2.c (finish_file): Maybe consider static inlines multiple
+ times, in case they reference each other.
+
+Tue Jun 28 11:58:38 1994 Gerald Baumgartner <gb@cs.purdue.edu>
+
+ * class.c (finish_struct): Don't `cons_up_default_function's
+ for signatures.
+ (finish_struct): Handle an empty method_vec correctly.
+
+ * decl.c (grokdeclarator): Don't warn about a signature being
+ empty in a signature pointer declaration if we only saw a
+ forward declaration of the signature. Changed `warning's into
+ `cp_warning's.
+
+ * sig.c (build_sigtable): Don't die if a null signature table
+ constructor is returned.
+ (build_signature_pointer_constructor): If the signature table
+ constructor is null, the _sptr field is set to a null pointer
+ and cast to the appropriate type. Make copies of all null
+ pointers so that the type null_pointer_node doesn't get changed.
+ (build_signature_table_constructor): Added comments.
+
+ * sig.c (build_signature_pointer_constructor): Complain if we
+ try to assign to/initialize a signature pointer/reference of
+ an undefined signature.
+
+Mon Jun 27 14:05:16 1994 Gerald Baumgartner <gb@cs.purdue.edu>
+
+ * typeck2.c (store_init_value): Don't be pedantic about
+ non-constant initializers of signature tables/pointers/references.
+
+Fri Jun 24 16:49:41 1994 Gerald Baumgartner <gb@cs.purdue.edu>
+
+ * decl.c (grokdeclarator): If we are grokking an opaque typedef
+ in a signature, don't complain about it begin static.
+
+Wed Jun 29 16:44:45 1994 Mike Stump <mrs@cygnus.com>
+
+ Fixes a problem of the this pointer being wrong in virtual calls to
+ methods that are not overridden in more derived classes.
+
+ * class.c (fixup_vtable_delta): New routine. It will fixup the
+ delta entries in vtables, wheever they need updating.
+ * class.c (finish_struct): Call the new routine for all virtual
+ bases, as they can have different offsets, than those used in base
+ classes that we derive our vtable from.
+
+Tue Jun 28 23:49:28 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_binary_op): Use the types before default
+ conversions in the error message.
+
+ * *.c: Use c_build_type_variant instead of build_type_variant where
+ the type might be an array.
+
+ * call.c (build_method_call): Call build_type_variant and
+ build_reference_type in the right order.
+ * decl.c (record_builtin_type): Likewise.
+
+Wed Jun 29 16:58:53 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (build_method_call): Call build_type_variant and
+ build_reference_type in the right order.
+ * decl.c (record_builtin_type): Likewise.
+
+Tue Jun 28 23:49:28 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_binary_op): Use the types before default
+ conversions in the error message.
+
+ * *.c: Use c_build_type_variant instead of build_type_variant where
+ the type might be an array.
+
+Sat Jun 25 11:50:54 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cvt.c (convert_to_reference): Try UDC's before doing the
+ reinterpret_cast thang, though.
+
+Fri Jun 24 01:24:01 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (c_expand_return): Don't USE the return value location
+ after we've expanded the jump.
+
+ * decl2.c (finish_file): Make sure DECL_SAVED_INSNS is not 0 before
+ trying to write out an inline.
+
+ * cvt.c (build_up_reference): Also do address adjustment when the
+ target type uses MI.
+ (convert_to_reference): Try UDCs only after built-in conversions.
+ (build_type_conversion_1): Don't play games with the argument to the
+ method.
+ (build_type_conversion): #if 0 out code for binding to reference.
+
+Thu Jun 23 00:22:28 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl2.c (finish_file): Use TREE_SYMBOL_REFERENCED to decide
+ whether to emit inlines.
+
+ * decl.c (grokdeclarator): Set explicit_int for decls that just
+ specify, say, 'long'.
+
+ * init.c (do_friend): Do overload C functions (or call pushdecl,
+ anyaway).
+
+Wed Jun 22 13:40:49 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cvt.c (build_up_reference): Don't call readonly_error.
+ (convert_to_reference): Propagate const and volatile from expr to
+ its type.
+
+ * tree.c (lvalue_p): Random CALL_EXPRs are not lvalues.
+
+ * cvt.c (build_up_reference): Break out WITH_CLEANUP_EXPR when
+ creating a temporary.
+ (convert_to_reference): Lose excessive and incorrect trickiness.
+ (cp_convert): Call build_cplus_new with with_cleanup_p set.
+
+ * typeck2.c (build_functional_cast): Likewise.
+
+Tue Jun 21 17:38:38 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grokdeclarator): signed, unsigned, long and short all
+ imply 'int'.
+
+ * decl.c (grokdeclarator): Allow "this is a type" syntax.
+ (grok_reference_init): Simplify and fix.
+
+Sun Jun 19 17:08:48 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grokdeclarator): pedwarn about a typedef that specifies no
+ type.
+
+Sat Jun 18 04:16:50 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (start_function): Move TREE_PUBLIC and DECL_EXTERNAL
+ tinkering to after call to pushdecl.
+
+Fri Jun 17 14:48:28 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (build_method_call): Handle destructors for non-aggregate
+ types properly.
+
+Thu Jun 16 16:48:05 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (build_method_call): Make sure that the name given for the
+ destructor matches the constructor_name of the instance.
+
+ * pt.c (do_function_instantiation): A non-extern instantiation
+ overrides a later extern one.
+ (do_type_instantiation): Likewise.
+
+Wed Jun 15 19:34:54 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * init.c (expand_aggr_init): Use TYPE_MAIN_VARIANT to get the
+ unqualified array type.
+
+ * cp-tree.h (EMPTY_CONSTRUCTOR_P): Tests whether NODE is a
+ CONSTRUCTOR with no elements.
+
+ * decl.c (various): Lose empty_init_node.
+ (finish_decl): Use EMPTY_CONSTRUCTOR_P, do the empty CONSTRUCTOR
+ thing depending on the value of DECL_COMMON instead of
+ flag_conserve_space, do the empty CONSTRUCTOR thing for types that
+ don't have constructors, don't treat a real empty CONSTRUCTOR
+ specially.
+
+ * typeck2.c (process_init_constructor): Don't treat empty_init_node
+ specially.
+
+Wed Jun 15 19:05:25 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (override_one_vtable): Don't forget to merge in an old
+ overrider when we wanted to reuse a vtable, but couldn't.
+
+Wed Jun 15 15:03:16 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (start_decl): Put statics in common again.
+
+ * decl.c (grokdeclarator): Return NULL_TREE for an error rather than
+ setting the type to error_mark_node.
+
+ * typeck.c (build_modify_expr): Build up a COMPOUND_EXPR for enum
+ bitfield assignments.
+
+Tue Jun 14 12:23:38 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grok_op_properties): Const objects can be passed by value.
+
+Mon Jun 13 03:10:59 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl2.c (import_export_vtable): Force implicit instantiations to
+ be interface_only when -fno-implicit-templates.
+
+ * decl.c (duplicate_decls): Redeclaring a class template name is an
+ error.
+
+ * pt.c (end_template_decl): Call GNU_xref_decl for class templates.
+ * xref.c (GNU_xref_decl): Support templates.
+
+Sat Jun 11 17:09:05 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grok_op_properties): Split out checking for whether this
+ function should suppress the default assignment operator.
+ * decl2.c (grok_function_init): Likewise.
+ (copy_assignment_arg_p): New function to do just that.
+ Now considers virtual assignment operators that take a base as an
+ argument to count as copy assignment operators.
+
+ * search.c (dfs_debug_mark): Lose checks for DWARF_DEBUG and
+ TREE_ASM_WRITTEN, as they are redundant.
+
+ * pt.c (end_template_decl): Don't try to set DECL_CLASS_CONTEXT on a
+ decl that has no LANG_SPECIFIC part.
+ (do_type_instantiation): Force the debugging information for this
+ type to be emitted.
+
+ * decl.c (start_decl): Clear up uses of various types of templates
+ (say sorry for static data members, rather than "invalid template").
+ (expand_static_init): Fix initialization of static data members of
+ template classes.
+
+Fri Jun 10 00:41:19 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grokdeclarator): Set DECL_CONTEXT on static data members.
+
+ * g++.c (main): Use -xc++-cpp-output for .i files.
+
+ * pt.c (tsubst): Give meaningful error about declaring template for
+ a copy constructor which was not declared in the class template.
+ (do_type_instantiation): Explicit instantiation before the class
+ template is an error.
+ (instantiate_template): Don't die if tsubst returns error_mark_node.
+
+Thu Jun 9 19:04:59 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ Don't synthesize the copy assignment operator if the one in a base
+ class is pure virtual.
+ * cp-tree.h (TYPE_HAS_ABSTRACT_ASSIGN_REF): New macro to indicate
+ whether the type has a pure virtual copy assignment operator.
+ * class.c (finish_base_struct): Don't generate the copy assignment
+ operator if a base class has a pure virtual one.
+ * decl.c (grok_op_properties): Add disabled code to set
+ TYPE_HAS_ABSTRACT_ASSIGN_REF with comment pointing to where it is
+ actually set.
+ * decl2.c (grok_function_init): Set TYPE_HAS_ABSTRACT_ASSIGN_REF.
+
+ * decl2.c (import_export_vtable): Always treat template
+ instantiations as if write_virtuals >= 2, and treat implicit
+ instantiations as external if -fno-implicit-templates.
+ (finish_file): Output all pending inlines if
+ flag_keep_inline_functions.
+
+Wed Jun 8 20:48:02 1994 Mike Stump <mrs@cygnus.com>
+
+ * tree.c (layout_vbasetypes): Align virtual base classes inside
+ complete objects, so that we don't core dump on machines such as
+ SPARCs when we access members that require larger than normal
+ alignments, such as a double. Also, we bump up the total alignment
+ on the complete type, as necessary.
+
+Wed Jun 8 16:18:14 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * gxxint.texi (Free Store): New section with code for examining
+ cookie.
+ (Limitations of g++): Remove operator delete entry, since it is no
+ longer accurate. Fix access control entry.
+
+ * typeck.c (build_unary_op): Pedwarn about taking the address of or
+ incrementing a cast to non-reference type.
+ (build_modify_expr): Use convert instead of convert_force again.
+
+ * search.c (get_base_distance): Use IS_AGGR_TYPE_CODE to check for
+ class type, not == RECORD_TYPE.
+
+ * decl.c (grokdeclarator): Cope with grokfndecl returning NULL_TREE.
+
+ * typeck2.c (report_case_error): #if 0 out.
+ * lex.c (real_yylex): Lose RANGE.
+ * parse.y: Likewise.
+
+Tue Jun 7 18:17:35 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (simple_stmt, case ranges): Use ELLIPSIS instead of RANGE.
+
+Mon Jun 6 19:39:57 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_c_cast): Don't shortcut conversions to the same
+ type. Don't replace consts with their values here, since that's now
+ done in cp_convert.
+
+ * cvt.c (cp_convert): When converting to bool, take
+ integer_zero_node to false_node and all other INTEGER_CSTs to
+ true_node.
+ (build_type_conversion): Don't complain about multiple conversions
+ to float if we're not really converting.
+
+Fri Jun 3 02:10:56 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ Implement 'extern template class A<int>;' syntax for suppressing
+ specific implicit instantiations.
+ * cp-tree.h: Update prototypes for do_*_instantiation.
+ * pt.c (do_pending_expansions): Don't compile 'extern' explicit
+ instantiations.
+ (do_function_instantiation): Set DECL_EXTERNAL on 'extern' explicit
+ instantiations.
+ (do_type_instantiation): Likewise.
+ * parse.y (explicit_instantiation): Support 'extern template class
+ A<int>;' syntax.
+ * decl.c (start_function): Don't modify the settings of TREE_PUBLIC
+ and DECL_EXTERNAL on explicit instantiations.
+
+ * cvt.c (cp_convert): Replace constants with their values before
+ converting.
+ (cp_convert): Consistently use 'e' instead of 'expr'.
+
+Thu Jun 2 03:53:30 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck2.c (build_x_arrow): Resolve OFFSET_REFs first.
+
+Wed Jun 1 18:57:35 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck2.c (digest_init): Handle initializing a pmf with an
+ overloaded method.
+ * typeck.c (build_ptrmemfunc): Handle overloaded methods.
+
+ * decl.c (pushtag): Use build_decl to make TYPE_DECLs.
+ (xref_defn_tag): Likewise.
+ * pt.c (process_template_parm): Likewise.
+ (lookup_template_class): Likewise.
+ (push_template_decls): Likewise.
+ (instantiate_class_template): Likewise.
+ (create_nested_upt): Likewise.
+ * class.c (finish_struct): Don't try to set DECL_CLASS_CONTEXT on
+ TYPE_DECLs.
+
+ * typeck.c (convert_arguments): Make sure type is not NULL before
+ checking its TREE_CODE.
+
+Wed Jun 1 17:40:39 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (get_derived_offset): New routine.
+ * class.c (finish_base_struct): Make sure we set BINFO_VTABLE and
+ BINFO_VIRTUALS when we choose a new base class to inherit from.
+ * class.c (modify_one_vtable): Use get_derived_offset to get the
+ offset to the most base class subobject that we derived this binfo
+ from.
+ * class.c (finish_struct): Move code to calculate the
+ DECL_FIELD_BITPOS of the vfield up, as we need might need it for
+ new calls to get_derived_offset in modify_one_vtable.
+
+Wed Jun 1 16:50:59 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * init.c (build_member_call): Use build_pointer_type instead of
+ TYPE_POINTER_TO.
+
+Wed Jun 1 11:11:15 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (grokdeclarator): Make sure we have a DNAME set before we
+ try to use it in an error.
+
+Wed Jun 1 09:48:49 1994 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (convert_arguments, convert_for_initialization): Don't
+ strip NOP_EXPRs, when we are converting to a reference.
+
+Wed Jun 1 01:11:38 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_modify_expr): Don't dereference references when
+ initializing them.
+
+ * decl2.c (grokfield): Don't check for grokdeclarator returning
+ error_mark_node any more.
+
+ * decl.c (grokfndecl): Return NULL_TREE instead of error_mark_node.
+ (start_method): Return void_type_node instead of error_mark_node.
+
+ * typeck.c (build_modify_expr): Resolve offset refs earlier.
+
+Tue May 31 16:06:58 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (build_method_call): Resolve OFFSET_REFs in the object.
+
+ * typeck.c (build_modify_expr): Dereference references before trying
+ to assign to them.
+
+ * call.c (build_method_call): Don't confuse type conversion
+ operators with constructors.
+ * typeck2.c (build_functional_cast): Just call build_c_cast if there
+ was only one parameter.
+ * method.c (build_typename_overload): Don't set
+ IDENTIFIER_GLOBAL_VALUE on these identifiers.
+ * decl.c (grok_op_properties): Warn about defining a type conversion
+ operator that converts to a base class (or reference to it).
+ * cvt.c (cp_convert): Don't try to use a type conversion operator
+ when converting to a base class.
+ (build_type_conversion_1): Don't call constructor_name_full on an
+ identifier.
+ * cp-tree.h (DERIVED_FROM_P): Should be self-explanatory.
+
+ * decl.c (start_decl): Don't complain that error_mark_node is an
+ incomplete type.
+ (finish_decl): Check for type == error_mark_node.
+
+Mon May 30 23:38:55 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (start_function): Set DECL_DEFER_OUTPUT on implicit
+ instantiations and inline members.
+
+ * spew.c (yylex): Set looking_for_template if the next token is a '<'.
+
+ * lex.h: Declare looking_for_template.
+
+ * decl.c (lookup_name_real): Use looking_for_template to arbitrate
+ between type and template interpretations of an identifier.
+
+Sat May 28 04:07:40 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * pt.c (instantiate_template): Zero out p if we found a
+ specialization.
+
+ * decl.c (grokdeclarator): Elucidate warning.
+ (grokdeclarator): If pedantic AND -ansi, complain about long long.
+
+ Make explicit instantiation work reasonably. It is now appropriate
+ to deprecate the use of -fexternal-templates.
+ * pt.c (instantiate_template): Set DECL_TEMPLATE_SPECIALIZATION or
+ DECL_IMPLICIT_INSTANTIATION on fndecl as appropriate.
+ (end_template_instantiation): Reflect changes in USE_TEMPLATE
+ semantics.
+ (do_pending_expansions): if (!flag_implicit_templates) DECIDE(0);
+ (do_function_instantiation): Don't set EXPLICIT_INST if
+ flag_external_templates is set. Do set TREE_PUBLIC and DECL_EXTERN
+ appropriately otherwise.
+ (do_type_instantiation): Set interface info for class. Set
+ TREE_PUBLIC and DECL_EXTERN for methods. Do none of this if
+ flag_external_templates is set.
+ * parse.y: Reflect changes in USE_TEMPLATE semantics.
+ * decl2.c: New flag flag_implicit_templates determines whether or
+ not implicit instantiations get emitted. This flag currently
+ defaults to true, and must be true for -fexternal-templates to work.
+ (finish_file): Consider flag_implement_inlines when
+ setting DECL_EXTERNAL. Consider flag_implicit_templates when
+ deciding whether or not to emit a static copy.
+ * decl.c (start_function): Set TREE_PUBLIC and DECL_EXTERNAL
+ properly for template instantiations.
+ (start_method): Set DECL_IMPLICIT_INSTANTIATION on methods of a
+ template class.
+ * cp-tree.h (CLASSTYPE_USE_TEMPLATE): Change semantics.
+ (DECL_USE_TEMPLATE): Parallel macro for FUNCTION and VAR_DECLs.
+ (various others): Accessor macros for the above.
+
+Fri May 27 13:57:40 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_binary_op_nodefault): Division by constant zero is
+ an error.
+
+Fri May 27 13:50:15 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (override_one_vtable): Don't modify things we don't own.
+
+Fri May 27 01:42:58 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (finish_decl): Don't postpone processing the initializer of
+ a decl with DECL_EXTERNAL set, and do call rest_of_compilation for a
+ PUBLIC const at toplevel.
+ (grokdeclarator): pedwarn about initializing non-const or
+ non-integral statics in the class body.
+
+ * decl.c (pushtag): Don't try to set DECL_CLASS_CONTEXT on a
+ TYPE_DECL.
+
+ * call.c (convert_harshness): Dereference reference on rhs before
+ proceeding, properly grok passing const things to non-const
+ references.
+
+ * typeck.c (build_unary_op): Soften error about taking the address
+ of main() to a pedwarn.
+
+ * lex.c (default_copy_constructor_body): Unambiguously specify base
+ classes (i.e. A((const class ::A&)_ctor_arg) ).
+ (default_assign_ref_body): Likewise.
+
+Thu May 26 13:13:55 1994 Gerald Baumgartner <gb@mexican.cygnus.com>
+
+ * decl2.c (grokfield): Don't complain about local signature
+ method declaration without definition.
+
+ * call.c (convert_harshness): If `type' is a signature pointer
+ and `parmtype' is a pointer to a signature, just return 0. We
+ don't really convert in this case; it's a result of making the
+ `this' parameter of a signature method a signature pointer.
+
+ * call.c (build_method_call): Distinguish calling the default copy
+ constructor of a signature pointer/reference from a signature
+ member function call.
+
+Thu May 26 12:56:25 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl2.c (grokfield): Don't set TREE_PUBLIC on member function
+ declarations.
+
+ * decl.c (duplicate_decls): A previous function declaration as
+ static overrides a subsequent non-static definition.
+ (grokdeclarator): Don't set TREE_PUBLIC on inline method
+ declarations.
+
+Wed May 25 14:36:38 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grokdeclarator): Handle initialization of static const
+ members.
+ (finish_decl): Likewise.
+
+ * decl2.c (grokfield): Allow initialization of static const members
+ even when pedantic.
+
+ * decl2.c (grokfield): Deal with grokdeclarator returning
+ error_mark_node.
+
+ * decl.c (grok_ctor_properties): Return 0 for A(A) constructor.
+ (grokfndecl): Check the return value of grok_ctor_properties.
+ (start_method): Likewise.
+
+ * parse.y (absdcl): Expand type_quals inline.
+
+Tue May 24 19:10:32 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (pushtag): Use IS_AGGR_TYPE rather than checking for a
+ RECORD_TYPE.
+
+Tue May 24 18:09:16 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * cp-tree.h (VTABLE_NAME_FORMAT): If flag_vtable_thunks,
+ always use "__vt_%s".
+ * decl2.c (finish_vtable_vardecl): Don't consider abstract virtuals
+ when looking for a "sentinal" method (to decide on emitting vtables).
+ * decl2.c (finish_file): Scan all decls for thunks that need
+ to be emitted.
+ * decl2.c (finish_vtable_vardecl): Don't bother calling emit_thunk.
+ * method.c (make_thunk): Use a more meaningful label. If there
+ exists a matching top-level THUNK_DECL re-use it; otherwise
+ create a new THUNK_DECL (and declare it).
+ * method.c (emit_thunk): Make thunk external/public depending
+ on the underlying method.
+
+Tue May 24 00:22:04 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * pt.c (tsubst): Use lookup_name_nonclass to find guiding decls, not
+ lookup_name.
+
+ * call.c (build_overload_call_real): Don't immediately pick a
+ function which matches perfectly.
+
+ * decl.c (grokdeclarator): Use c_build_type_variant for arrays.
+ (grokdeclarator): Warn about, and throw away, cv-quals attached to a
+ reference (like 'int &const j').
+
+ * typeck.c (convert_arguments): Don't mess with i for methods.
+ * call.c (build_method_call): Pass the function decl to
+ convert_arguments.
+
+ * typeck.c (comp_ptr_ttypes_real): New function. Implements the
+ checking for which multi-level pointer conversions are allowed.
+ (comp_target_types): Call it.
+ (convert_for_assignment): Check const parity on the ultimate target
+ type, too. And make those warnings pedwarns.
+
+Mon May 23 14:11:24 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * error.c (dump_char): Use TARGET_* for character constants.
+
+Mon May 23 13:03:03 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * tree.c (debug_no_list_hash): Make static.
+
+ * decl.c (decls_match): Say the types don't match if newdecl ends up
+ with a null type, after we've checked if olddecl does.
+ (pushdecl): Check if the decls themselves match before looking for
+ an extern redeclared as static, to avoid inappropriate and incorrect
+ warnings.
+
+Fri May 20 14:04:34 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grokdeclarator): Make warning about duplicate short, etc.
+ a pedwarn.
+
+ * typeck.c (build_c_cast): Casting to function or method type is an
+ error.
+
+ * class.c (finish_struct): Make warning for anonymous class with no
+ instances a pedwarn.
+
+ * Makefile.in (stamp-parse): Expect a s/r conflict.
+
+ * typeck.c (build_modify_expr): pedwarn about using a non-lvalue
+ cast as an lvalue.
+
+Thu May 19 12:08:48 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cvt.c (type_promotes_to): Make sure bool promotes to int rather
+ than unsigned on platforms where sizeof(char)==sizeof(int).
+
+Wed May 18 14:27:06 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_c_cast): Tack on a NOP_EXPR when casting to
+ another variant.
+ (build_modify_expr): Don't strip NOP_EXPRs, and don't get tricky
+ and treat them as lvalues.
+
+ * decl.c (shadow_tag): Do complain about forward declarations of
+ enums and empty declarations.
+ * parse.y: Don't complain about forward declarations of enums and
+ empty declarations.
+
+ * typeck.c (convert_for_assignment): Complain about changing
+ the signedness of a pointer's target type.
+
+ * parse.y (stmt): Move duplicated code for checking case values from
+ here.
+ * decl2.c (check_cp_case_value): To here. And add a call to
+ constant_expression_warning.
+
+ * typeck.c (convert_for_assignment): Don't complain about assigning
+ a negative value to bool.
+
+ * decl.c (init_decl_processing): Make bool unsigned.
+
+ * class.c (finish_struct): Allow bool bitfields.
+
+Wed May 18 12:35:27 1994 Ian Lance Taylor <ian@tweedledumb.cygnus.com>
+
+ * Make-lang.in (c++.install-man): Get g++.1 from $(srcdir)/cp.
+
+Wed May 18 03:28:35 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cvt.c (build_type_conversion): Lose special handling of
+ truthvalues.
+
+ * search.c (dfs_pushdecls): Improve shadowing warning.
+
+Tue May 17 13:34:46 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * init.c (build_delete): Throw away const and volatile on `this'.
+
+ * decl.c (finish_enum): Put the constants in TYPE_VALUES again,
+ rather than the enumerators.
+ (pushtag): s/cdecl/c_decl/g
+
+Mon May 16 23:04:01 1994 Stephen R. van den Berg <berg@pool.informatik.rwth-aachen.de>
+
+ * cp/typeck.c (common_type): Attribute merging.
+ (comp_types): Utilise COMP_TYPE_ATTRIBUTES macro.
+
+ * cp/parse.y: Revamp attribute parsing.
+
+Mon May 16 01:40:34 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (shadow_tag): Also check for inappropriate use of auto and
+ register.
+
+ * method.c (build_overload_name): Clarify that the illegal case is a
+ pointer or reference to array of unknown bound.
+
+ * error.c (dump_type_prefix): Print references to arrays properly.
+
+ * typeck.c (various): Be more helpful in pointer
+ comparison diagnostics.
+
+ * tree.c (lvalue_p): MODIFY_EXPRs are lvalues again. Isn't this
+ fun?
+
+ * parse.y: Also catch an error after valid stmts.
+
+ * search.c (dfs_init_vbase_pointers): Don't abort because `this' is
+ const.
+
+ * typeck.c (convert_for_initialization): If call to
+ convert_to_reference generated a diagnostic, print out the parm
+ number and function decl if any.
+
+ * errfn.c (cp_thing): Check atarg1 to determine whether or not we're
+ specifying a line, not atarg.
+
+ * tree.c (build_cplus_method_type): Always make `this' const.
+
+ * decl2.c (grokclassfn): If -fthis-is-variable and this function is
+ a constructor or destructor, make `this' non-const.
+
+ * typeck.c (build_modify_expr): Don't warn specially about
+ assignment to `this' here anymore, since it will be caught by the
+ usual machinery.
+
+ * various: Disallow specific GNU extensions (variable-size arrays,
+ etc.) when flag_ansi is set, not necessarily when pedantic is set,
+ so that people can compile with -pedantic-errors for tighter const
+ checking and such without losing desirable extensions.
+
+ * typeck2.c (build_functional_cast): Call build_method_call with
+ LOOKUP_PROTECT.
+ (process_init_constructor): Only process FIELD_DECLs.
+
+ * decl.c (finish_decl): Also force static consts with no explicit
+ initializer that need constructing into the data segment.
+
+ * init.c (build_delete): Undo last patch, as it interferes with
+ automatic cleanups.
+
+Sat May 14 01:59:31 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c, class.h, cp-tree.h, cvt.c, decl2.c: Lose old overloading
+ code.
+
+ * init.c (build_delete): pedwarn about using plain delete to delete
+ an array.
+
+Fri May 13 16:45:07 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (comp_target_types): Be more helpful in contravariance
+ warnings, and make them pedwarns.
+
+ * decl.c (grokdeclarator): Use decl_context to decide whether or not
+ this is an access declaration.
+
+ * class.c (finish_struct_bits): Set TYPE_HAS_INT_CONVERSION if it
+ has a conversion to enum or bool, too.
+
+Fri May 13 16:31:27 1994 Mike Stump <mrs@cygnus.com>
+
+ * method.c (emit_thunk): Make declaration for
+ current_call_is_indirect local (needed for hppa).
+
+Fri May 13 16:16:37 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * pt.c (uses_template_parms): Grok BOOLEAN_TYPE.
+ (tsubst): Likewise.
+
+Fri May 13 16:23:32 1994 Mike Stump <mrs@cygnus.com>
+
+ * pt.c (tsubst): If there is already a function for this expansion,
+ use it.
+ * pt.c (instantiate_template): Likewise.
+
+Fri May 13 10:30:42 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y (implicitly_scoped_stmt, simple_stmt case): Use
+ kept_level_p for MARK_ENDS argument to expand_end_bindings, to avoid
+ generating debug info for unemitted symbols on some systems.
+
+ * cp-tree.h (build_static_cast, build_reinterpret_cast,
+ build_const_cast): Add declarations.
+
+Fri May 13 09:50:31 1994 Mike Stump <mrs@cygnus.com>
+
+ * search.c (expand_indirect_vtbls_init): Fix breakage from Apr 27
+ fix. We now try get_binfo, and if that doesn't find what we want,
+ we go back to the old method, which still sometimes fails.
+
+Fri May 13 01:43:18 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (initdcl): Call cplus_decl_attributes on the right
+ variable.
+ * decl2.c (cplus_decl_attributes): Don't call decl_attributes for
+ void_type_node.
+
+ * typeck.c (build_binary_op_nodefault): Change result_type for
+ comparison ops to bool.
+ (build_binary_op): Convert args of && and || to bool.
+ * cvt.c (build_default_binary_type_conversion): Convert args of &&
+ and || to bool.
+ (build_default_unary_type_conversion): Convert arg of ! to bool.
+ (type_promotes_to): bool promotes to int.
+
+Fri May 13 01:43:18 1994 Mike Stump <mrs@cygnus.com>
+
+ Implement the new builtin `bool' type.
+ * typeck.c (build_binary_op_nodefault): Convert args of && and || to
+ bool.
+ (build_unary_op): Convert arg of ! to bool.
+ * parse.y: Know true and false. Use bool_truthvalue_conversion.
+ * method.c (build_overload_value): Know bool.
+ (build_overload_name): Likewise.
+ * lex.c (init_lex): Set up RID_BOOL.
+ * gxx.gperf: Add bool, true, false.
+ * error.c (*): Know bool.
+ * decl.c (init_decl_processing): Set up bool, true, false.
+ * cvt.c (cp_convert): Handle conversion to bool.
+ (build_type_conversion): Likewise.
+ * *.c: Accept bool where integers and enums are accepted (use
+ INTEGRAL_CODE_P macro).
+
+Thu May 12 19:13:54 1994 Richard Earnshaw <rwe11@cl.cam.ac.uk>
+
+ * g++.c: Use #ifdef for __MSDOS__, not #if.
+
+Thu May 12 18:05:18 1994 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (lang_f_options): Handle -fshort-temps. -fshort-temps
+ gives old behavior , and destroys temporaries earlier. Default
+ behavior now conforms to the ANSI working paper.
+
+Thu May 12 14:45:35 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_modify_expr): Understand MODIFY_EXPR as an lvalue.
+ Use convert_force to convert the result of a recursive call when we
+ are dealing with a NOP_EXPR. Don't automatically wrap MODIFY_EXPRs
+ in COMPOUND_EXPRs any more.
+ (various): Lose pedantic_lvalue_warning.
+ (unary_complex_lvalue): Understand MODIFY_EXPR.
+
+ * cvt.c (convert_to_reference): Allow DECL to be error_mark_node if
+ we don't know what we're initializing.
+
+Wed May 11 01:59:36 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cvt.c (convert_to_reference): Modify to use convtype parameter.
+ Only create temporaries when initializing a reference, not when
+ casting.
+ (cp_convert): New main function.
+ (convert): Call cp_convert.
+ * cvt.c, decl.c, typeck.c: Fix calls to convert_to_reference.
+ * cp-tree.h (CONV_*): New constants used by conversion code for
+ selecting conversions to perform.
+
+ * tree.c (lvalue_p): MODIFY_EXPRs are no longer lvalues.
+
+ * typeck.c (build_{static,reinterpret,const_cast): Stubs that just
+ call build_c_cast.
+ * parse.y: Add {static,reinterpret,const}_cast.
+ * gxx.gperf: Likewise.
+
+ * typeck.c (common_type): Allow methods with basetypes of different
+ UPTs.
+ (comptypes): Deal with UPTs.
+ (build_modify_expr): Wrap all MODIFY_EXPRs in a COMPOUND_EXPR.
+
+ * pt.c (end_template_decl): Check for multiple definitions of member
+ templates.
+
+ * call.c (build_method_call): Complain about calling an abstract
+ virtual from a constructor.
+
+ * typeck.c (pointer_int_sum): Check for the integer operand being 0
+ after checking the validity of the pointer operand.
+
+ * typeck2.c (digest_init): Pedwarn about string initializer being
+ too long.
+
+Tue May 10 12:10:28 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (push_overloaded_decl): Only throw away a builtin if the
+ decl in question is the artificial one.
+
+ * parse.y (simple_stmt, switch): Use implicitly_scoped_stmt because
+ expand_{start,end}_case cannot happen in the middle of a block.
+
+ * cvt.c (build_type_conversion_1): Use convert again.
+
+Tue May 10 11:52:04 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * typeck2.c (digest_init): Make sure we check for signed and
+ unsigned chars as well when warning about string initializers.
+
+ * init.c (emit_base_init): Check if there's a DECL_NAME on the
+ member before trying to do an initialization for it.
+
+Tue May 10 11:34:37 1994 Mike Stump <mrs@cygnus.com>
+
+ * except.c: Don't do anything useful when cross compiling.
+
+Tue May 10 03:04:13 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (duplicate_decls): Fix up handling of builtins yet again.
+ (push_overloaded_decl): Likewise.
+
+ * cvt.c (convert): Don't look for void type conversion.
+
+Mon May 9 18:05:41 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * init.c (do_friend): Only do a pushdecl for friends, not
+ pushdecl_top_level.
+
+Mon May 9 13:36:34 1994 Jim Wilson <wilson@sphagnum.cygnus.com>
+
+ * decl.c (lookup_name_current_level): Put empty statement after
+ the label OUT to make the code valid C.
+
+Mon May 9 12:20:57 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_binary_op_nodefault): Only complain about
+ comparing void * and a function pointer if void * is smaller.
+
+Sun May 8 01:29:13 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (lookup_name_current_level): Move through temporary binding
+ levels.
+
+ * parse.y (already_scoped_stmt): Revive.
+ (simple_stmt): Use it again.
+
+ * decl.c (poplevel): Always call poplevel recursively if we're
+ dealing with a temporary binding level.
+
+Sat May 7 10:52:28 1994 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (finish_decl): Make sure we run cleanups for initial values
+ of decls. Cures memory leak.
+ * decl.c (expand_static_init): Likewise for static variables.
+ * decl2.c (finish_file): Likewise for globals.
+
+Sat May 7 03:57:44 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (commonparms): Don't complain about redefining default
+ args.
+
+ * decl.c (duplicate_decls): Don't complain twice about conflicting
+ function decls.
+ (decls_match): Don't look at default args.
+ (redeclaration_error_message): Complain about redefining default
+ args.
+
+ * call.c (build_overload_call_real): Also deal with guiding
+ declarations coming BEFORE the template decl.
+
+ * pt.c (unify): Allow different parms to have different
+ cv-qualifiers.
+ (unify): Allow trivial conversions on non-template parms.
+
+Fri May 6 03:53:23 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * pt.c (tsubst): Support OFFSET_TYPEs.
+ (unify): Likewise.
+
+ * decl2.c (finish_decl_parsing): Call push_nested_class with a type.
+
+ * init.c (build_offset_ref): Fix error message.
+ * search.c (lookup_field): Likewise.
+
+ * call.c (build_scoped_method_call): Pass binfo to
+ build_method_call.
+ * typeck.c (build_object_ref): Likewise.
+
+ * typeck2.c (binfo_or_else): Don't return a _TYPE.
+
+ * class.c (finish_struct): Don't complain about re-use of inherited
+ names or shadowing of type decls.
+ * decl.c (pushdecl_class_level): Likewise.
+
+ * decl.c (finish_enum): Set the type of all the enums.
+
+ * class.c (finish_struct): Don't get confused by access decls.
+
+ * cp-tree.h (TYPE_MAIN_DECL): New macro to get the _DECL for a
+ _TYPE. You can stop using TYPE_NAME for that now.
+
+ * parse.y: Lose doing_explicit (check $0 instead).
+ * gxx.gperf: 'template' now has a RID.
+ * lex.h (rid): Likewise.
+ * lex.c (init_lex): Set up the RID for 'template'.
+
+ * parse.y (type_specifier_seq): typed_typespecs or
+ nonempty_type_quals. Use it.
+ (handler_args): Fix bogus syntax.
+ (raise_identifier{,s}, optional_identifier): Lose.
+ * except.c (expand_start_catch_block): Use grokdeclarator to parse
+ the catch variable.
+ (init_exception_processing): The second argument to
+ __throw_type_match is ptr_type_node.
+
+ Fri May 6 07:18:54 1994 Chip Salzenberg <chip@fin.uucp>
+
+ [ change propagated from c-decl.c of snapshot 940429 ]
+ * cp/decl.c (finish_decl): Setting asmspec_tree should not
+ zero out the old RTL.
+
+Fri May 6 01:25:38 1994 Mike Stump <mrs@cygnus.com>
+
+ Add alpha exception handling support to the compiler.
+ Quick and dirty backend in except.c.
+
+ * cp/*: Remove most remnants of old exception handling support.
+ * decl.c (finish_function): Call expand_exception_blocks to put
+ the exception hanlding blocks at the end of the function.
+ * dec.c (hack_incomplete_structures): Make sure expand_decl_cleanup
+ comes after expand_decl_init.
+ * except.c: Reimplementation.
+ * expr.c (cplus_expand_expr): Handle THROW_EXPRs.
+ * lex.c (init_lex): Always have catch, try and throw be reserved
+ words, so that we may always parse exception handling.
+ * parse.y: Cleanup to support new interface into exception handling.
+ * tree.def (THROW_EXPR): Add.
+
+Thu May 5 17:35:37 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (simple_stmt, for loops): Use implicitly_scoped_stmt.
+ (various): Lose .kindof_pushlevel and partially_scoped_stmt.
+
+Thu May 5 16:17:27 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * parse.y (already_scoped_stmt): Move expand_end_binding() to
+ fix the unmatched LBB/LBE in stabs.
+
+Thu May 5 14:36:17 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (set_nested_typename): Set TREE_MANGLED on the new
+ identifiers.
+ (pushdecl): Check TREE_MANGLED.
+ (xref_tag): Likewise.
+ * cp-tree.h (TREE_MANGLED): This identifier is a
+ DECL_NESTED_TYPENAME (named to allow for future use to denote
+ mangled function names as well).
+
+ Implement inconsistency checking specified in [class.scope0].
+ * decl.c (lookup_name_real): Don't set ICV here after all.
+ (finish_enum): Also set the type of the enumerators themselves.
+ (build_enumerator): Put the CONST_DECL in the list instead of its
+ initial value.
+ (pushdecl_class_level): Check inconsistent use of a name in the
+ class body.
+ * class.c (finish_struct): Check inconsistent use of a name in the
+ class body. Don't set DECL_CONTEXT on types here anymore.
+ * parse.y (qualified_type_name): Note that the identifier has now
+ been used (as a type) in the class body.
+ * lex.c (do_identifier): Note that the identifier has now been used
+ (as a constant) in the class body.
+ * error.c (dump_decl): Print type and enum decls better.
+
+Thu May 5 09:35:35 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * typeck.c (build_modify_expr): Warn about assignment to `this'.
+
+Wed May 4 15:55:49 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * init.c (build_delete): Use the global operator delete when
+ requested.
+
+ * decl.c (lookup_name_real): If we find the type we're looking in a
+ base class while defining a class, set IDENTIFIER_CLASS_VALUE for
+ the type.
+
+ * class.c (finish_struct): Remove a couple of dependencies on
+ language linkage.
+
+ * decl.c (pushtag): Classes do nest in extern "C" blocks.
+ (pushdecl): Only set DECL_NESTED_TYPENAME on the canonical one for
+ the type.
+ (pushtag): Remove another dependency on the language linkage.
+
+ * lex.c (cons_up_default_function): Don't set DECL_CLASS_CONTEXT to
+ a const-qualified type.
+
+ * decl.c (push_overloaded_decl): Throw away built-in decls here.
+ (duplicate_decls): Instead of here.
+
+Wed May 4 15:27:40 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * typeck.c (get_member_function_from_ptrfunc): Do The Right
+ Thing (I hope) if we're using thunks.
+
+Wed May 4 13:52:38 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (specialization): aggr template_type_name ';'.
+ (named_class_head_sans_basetype): Use it.
+ (explicit_instantiation): Likewise.
+ (tmpl.2): Revert.
+
+ * cvt.c (build_type_conversion_1): Use convert_for_initialization,
+ rather than convert, to do conversions after the UDC.
+
+ * cp-tree.h (SHARED_MEMBER_P): This member is shared between all
+ instances of the class.
+
+ * search.c (lookup_field): If the entity found by two routes is the
+ same, it's not ambiguous.
+
+Wed May 4 12:10:00 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * decl.c (lookup_name_real): Check for a NULL TREE_VALUE,
+ to prevent the compiler from crashing ...
+
+Wed May 4 11:19:45 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (build_method_call): If we don't have an object, check
+ basetype_path to figure out where to look up the function.
+
+ * typeck.c (convert_for_initialization): Pass TYPE_BINFO (type) to
+ build_method_call in case exp is NULL_TREE.
+
+Tue May 3 16:02:53 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ Give a vtable entries a unique named type, for the sake of gdb.
+ * class.c (build_vtable_entry): The addres of a thunk now has
+ type vtable_entry_type, not ptr_type_node.
+ * method.c (make_thunk): Fix type of THUNK_DECL.
+ * class.c (add_virtual_function, override_one_vtable): Use
+ vfunc_ptr_type_node, instead of ptr_type_node.
+ * cp-tree.h (vfunc_ptr_type_node): New macro.
+ * decl.c (init_decl_processing): Make vtable_entry_type
+ be a unique type of pointer to a unique function type.
+
+Tue May 3 09:20:44 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (do_explicit): Sets doing_explicit to 1.
+ (explicit_instantiation): Use do_explicit rather than TEMPLATE
+ directly, add "do_explicit error" rule.
+ (datadef): Set doing_explicit to 0 after an explicit instantiation.
+ (tmpl.2): Don't instantiate if we see a ';' unless we're doing an
+ explicit instantiation.
+ (named_class_head_sans_basetype): Remove aggr template_type_name
+ ';' again.
+
+Mon May 2 23:17:21 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * search.c (lookup_nested_tag): Lose.
+
+ * decl2.c (grokfield): Set DECL_CONTEXT on TYPE_DECLs.
+ (lookup_name_nonclass): Lose.
+
+ * decl.c (poplevel_class): Add force parameter.
+ (lookup_name_real): Fix handling of explicit scoping which specifies
+ a class currently being defined. Add 'nonclass' argument.
+ (lookup_name, lookup_name_nonclass): Shells for lookup_name_real.
+
+ * class.c (finish_struct): Don't unset IDENTIFIER_CLASS_VALUEs here.
+ (popclass): Force clearing of IDENTIFIER_CLASS_VALUEs if we're being
+ called from finish_struct.
+
+Mon May 2 19:06:21 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * decl.c (init_decl_processing), cp-tree.h: Removed memptr_type.
+ (It seeems redundant, given build_ptrmemfunc_type.)
+ * typeck.c (get_member_function_from_ptrfunc), gc.c (build_headof,
+ build_classof): Use vtable_entry_type instead of memptr_type.
+ * method.c (emit_thunk): Call poplevel with functionbody==0
+ to prevent DECL_INITIAL being set to a BLOCK.
+
+Mon May 2 15:02:11 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (named_class_head_sans_basetype): Add "aggr
+ template_type_name ';'" rule for forward declaration of
+ specializations.
+
+Mon May 2 15:02:11 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * class.c (instantiate_type): Deal with pmf's.
+
+ * Make-lang.in (cc1plus): Don't depend on OBJS or BC_OBJS, since
+ stamp-objlist does.
+
+ * Makefile.in (../cc1plus): Depend on OBJDEPS.
+ (OBJDEPS): Dependency version of OBJS.
+
+Mon May 2 12:51:31 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * search.c (dfs_debug_mark): Unmark TYPE_DECL_SUPPRESS_DEBUG, not
+ DECL_IGNORED_P.
+
+Fri Apr 29 12:29:56 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * class.c (finish_struct): Clear out memory of local tags. And
+ typedefs.
+
+ * decl2.c (grokclassfn): Don't set DECL_CONTEXT to a cv-qualified
+ type.
+ * search.c (get_matching_virtual): Be more helpful in error message.
+
+ * *: Use DECL_ARTIFICIAL (renamed from DECL_SYNTHESIZED).
+
+ * lex.c (default_assign_ref_body): Expect TYPE_NESTED_NAME to work.
+ (default_copy_constructor_body): Likewise.
+
+ * class.c (finish_struct): Don't gratuitously create multiple decls
+ for nested classes.
+
+Thu Apr 28 23:39:38 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ Avoid clobbering the arg types of other functions when reverting
+ static member functions.
+ * decl.c (revert_static_member_fn): Rearrange arguments, don't
+ require values for 'fn' and 'argtypes', add warning to comment
+ above.
+ (decls_match): Rearrange arguments in call to rsmf.
+ (grok_op_properties): Don't pass values for fn and argtypes.
+ * pt.c (instantiate_template): Don't pass values for fn and argtypes.
+
+Thu Apr 28 16:29:11 1994 Doug Evans <dje@canuck.cygnus.com>
+
+ * Make-lang.in (cc1plus): Depend on stamp-objlist.
+ * Makefile.in (BC_OBJS): Delete.
+ (OBJS): Cat ../stamp-objlist to get language independent files.
+ Include ../c-common.o.
+ (../cc1plus): Delete reference to BC_OBJS.
+
+Thu Apr 28 02:12:08 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * search.c (compute_access): No really, deal with static members
+ properly. Would I lie to you?
+
+ Implement lexical hiding of function declarations.
+ * pt.c (tsubst): Use lookup_name to look for function decls to guide
+ instantiation.
+ * method.c (build_opfncall): Use lookup_name_nonclass to look for
+ non-member functions.
+ * init.c (do_friend): Use lookup_name_nonclass to look for
+ functions.
+ * error.c (ident_fndecl): Use lookup_name to look for functions.
+ * decl2.c (lookup_name_nonclass): New function, skips over
+ CLASS_VALUE.
+ * decl.c (struct binding_level): Lose overloads_shadowed field.
+ (poplevel): Don't deal with overloads_shadowed.
+ (push_overloaded_decl): Do lexical hiding for functions.
+ * class.c (instantiate_type): Don't check non-members if we have
+ members with the same name.
+ * call.c (build_method_call): Use lookup_name_nonclass instead of
+ IDENTIFIER_GLOBAL_VALUE to check for non-member functions.
+ (build_overload_call_real): Likewise.
+
+ * decl.c (duplicate_decls): Check for ambiguous overloads here.
+ (push_overloaded_decl): Instead of here.
+
+ * decl.c (pushdecl): Back out Chip's last change.
+
+ * decl.c (grok_op_properties): Operators cannot be static members.
+
+ * cp-tree.h (DECL_SYNTHESIZED): DECL_SOURCE_LINE == 0
+ (SET_DECL_SYNTHESIZED): DECL_SOURCE_LINE = 0
+ * lex.c (cons_up_default_function): Use SET_DECL_SYNTHESIZED.
+
+ * method.c (do_inline_function_hair): Don't put friends of local
+ classes into global scope, either.
+
+ * typeck2.c (build_functional_cast): Don't look for a function call
+ interpretation.
+
+Thu Apr 28 15:19:46 1994 Mike Stump <mrs@cygnus.com>
+
+ * cp-tree.h: Disable use of backend EH.
+
+Wed Apr 27 21:01:24 1994 Doug Evans <dje@canuck.cygnus.com>
+
+ * Make-lang.in (c++.distdir): mkdir tmp/cp first.
+ * Makefile.in (INCLUDES): Move definition to same place as
+ parent makefile.
+ (ALLOCA): Define.
+ (OLDAR_FLAGS): Delete.
+ (OLDCC): Define.
+ (DIR): Delete.
+ (CLIB): Define.
+ (####site): Delete.
+ (SUBDIR_USE_ALLOCA): Don't use ALLOCA if compiling with gcc.
+
+Wed Apr 27 19:10:04 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * decl.c (xref_tag): Not to use strstr(), it's not available on
+ all platforms.
+
+Wed Apr 27 18:10:12 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * class.c (finish_struct): Resolve yet another class/pmf confusion.
+
+ * call.c (build_overload_call_real): Don't take the single-function
+ shortcut if we're dealing with an overloaded operator.
+
+Wed Apr 27 17:35:37 1994 Mike Stump <mrs@cygnus.com>
+
+ * search.c (get_base_distance): Search the virtual base class
+ binfos, incase someone wants to convert to a real virtual base
+ class.
+ * search.c (expand_indirect_vtbls_init): Use convert_pointer_to_real
+ instead of convert_pointer_to, as it now will work.
+
+Wed Apr 27 15:36:49 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cvt.c (convert_to_reference): Don't complain about casting away
+ const and volatile.
+
+ * typeck.c (build_unary_op): References are too lvalues.
+
+Wed Apr 27 13:58:05 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (override_one_vtable): We have to prepare_fresh_vtable
+ before we modify it, not after, also, we cannot reuse an old vtable,
+ once we commit to a new vtable. Implement ambiguous overrides in
+ virtual bases as abstract. Hack until we make the class
+ ill-formed.
+
+Wed Apr 27 01:17:08 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (unary_expr): Expand new_placement[opt] and
+ new_initializer[opt] inline.
+
+ * search.c (lookup_fnfields): Don't throw away the inheritance
+ information here, either.
+ (compute_access): Handle static members properly.
+
+ * init.c (build_member_call): Always set basetype_path, and pass it
+ to lookup_fnfields.
+
+ * search.c (lookup_field): Deal properly with the case where
+ xbasetype is a chain of binfos; don't throw away the inheritance
+ information.
+ (compute_access): protected_ok always starts out at 0.
+
+ * init.c (resolve_offset_ref): Don't cast `this' to the base type
+ until we've got our basetype_path.
+
+ * cp-tree.h (IS_OVERLOAD_TYPE): aggregate or enum.
+
+ * cvt.c (build_up_reference): Use build_pointer_type rather than
+ TYPE_POINTER_TO.
+
+ * call.c (convert_harshness_ansi): Call type_promotes_to for reals
+ as well.
+
+ * cvt.c (type_promotes_to): Retain const and volatile, add
+ float->double promotion.
+
+ * decl.c (grokdeclarator): Don't bash references to arrays into
+ references to pointers in function parms. Use type_promotes_to.
+
+Tue Apr 26 23:44:36 1994 Mike Stump <mrs@cygnus.com>
+
+ Finish off Apr 19th work.
+
+ * class.c (finish_struct_bits): Rename has_abstract_virtuals to
+ might_have_abstract_virtuals.
+ * class.c (strictly_overrides, override_one_vtable,
+ merge_overrides): New routines to handle virtual base overrides.
+ * class.c (finish_struct): Call merge_overrides to handle overrides
+ in virtual bases.
+
+Tue Apr 26 12:45:53 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_function_call): Call build_function_call_real with
+ LOOKUP_NORMAL.
+
+ * *: Don't deal with TYPE_EXPRs.
+
+ * tree.c (lvalue_p): If the type of the expression is a reference,
+ it's an lvalue.
+
+ * cvt.c (convert_to_reference): Complain about passing const
+ lvalues to non-const references.
+ (convert_from_reference): Don't arbitrarily throw away const and
+ volatile on the target type.
+
+ * parse.y: Simplify and fix rules for `new'.
+
+ * decl.c (grok_op_properties): operator void is illegal.
+
+Mon Apr 25 02:36:28 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (components): Anonymous bitfields can still have declspecs.
+
+ * decl.c (pushdecl): Postpone handling of function templates like we
+ do C functions.
+
+ * search.c (expand_indirect_vtbls_init): Fix infinite loop when
+ convert_pointer_to fails.
+
+ * call.c (compute_conversion_costs_ansi): A user-defined conversion
+ by itself is better than that UDC followed by standard conversions.
+ Don't treat integers and reals specially.
+
+ * cp-tree.h: Declare flag_ansi.
+
+ * typeck.c (c_expand_return): pedwarn on return in void function
+ even if the expression is of type void.
+ (build_c_cast): Don't do as much checking for casts to void.
+ (build_modify_expr): pedwarn about array assignment if this code
+ wasn't generated by the compiler.
+
+ * tree.c (lvalue_p): A comma expression is an lvalue if its second
+ operand is.
+
+ * typeck.c (default_conversion): Move code for promoting enums and
+ ints from here.
+ * cvt.c (type_promotes_to): To here.
+ * call.c (convert_harshness_ansi): Use type_promotes_to. Also fix
+ promotion semantics for reals.
+
+Sun Apr 24 16:52:51 1994 Doug Evans <dje@canuck.cygnus.com>
+
+ * Make-lang.in (c++.install-common): Check for g++-cross.
+ * Makefile.in: Remove Cygnus cruft.
+ (config.status): Delete.
+ (RTL_H): Define.
+ (TREE_H): Use complete pathname, some native makes have minimal
+ VPATH support.
+ (*.o): Use complete pathname to headers in parent dir.
+ (doc, info, dvi): Delete.
+
+Sun Apr 24 16:52:51 1994 Doug Evans <dje@canuck.cygnus.com>
+
+ * Make-lang.in (c++.install-common): Check for g++-cross.
+ * Makefile.in: Remove Cygnus cruft.
+ (config.status): Delete.
+ (RTL_H): Define.
+ (TREE_H): Use complete pathname, some native makes have minimal
+ VPATH support.
+ (*.o): Use complete pathname to headers in parent dir.
+ (doc, info, dvi): Delete.
+
+Sun Apr 24 00:47:49 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (pushdecl): Avoid redundant warning on redeclaring function
+ with different return type.
+ (decls_match): Compare return types strictly.
+
+Fri Apr 22 12:55:42 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cvt.c (build_type_conversion): Do try to convert through other
+ pointers. This will fail if the class defines multiple pointer
+ conversions.
+
+ * error.c (dump_type_prefix): Print out pointers to arrays properly.
+ (dump_type_suffix): Likewise. (was 'int *[]', now 'int (*)[]')
+
+ * typeck.c (build_unary_op): Disallow ++/-- on pointers to
+ incomplete type.
+
+ * decl.c (duplicate_decls): Check mismatched TREE_CODES after
+ checking for shadowing a builtin. If we're redeclaring a builtin
+ function, bash the old decl to avoid an ambiguous overload.
+
+ * cvt.c (convert_to_reference): Don't force arrays to decay here.
+
+ * tree.c (lvalue_p): A MODIFY_EXPR is an lvalue.
+
+ * decl.c (duplicate_decls): Don't assume that the decls will have
+ types.
+
+ Mon Apr 18 11:35:32 1994 Chip Salzenberg <chip@fin.uucp>
+
+ [ cp/* changes propagated from c-* changes in 940318 snapshot ]
+ * c-decl.c (pushdecl): Warn if type mismatch with another external decl
+ in a global scope.
+
+ Fri Apr 22 06:38:56 1994 Chip Salzenberg <chip@fin.uucp>
+
+ * cp/typeck2.c (signature_error): Use cp_error for "%T".
+
+ Mon Apr 18 11:59:59 1994 Chip Salzenberg <chip@fin.uucp>
+
+ [ cp/* changes propagated from c-* changes in 940415 snapshot ]
+ * cp/decl.c (duplicate_decls, pushdecl, builtin_function):
+ Use DECL_FUNCTION_CODE instead of DECL_SET_FUNCTION_CODE.
+
+ Mon Apr 18 11:55:18 1994 Chip Salzenberg <chip@fin.uucp>
+
+ [ cp/* changes propagated from c-* changes in 940409 snapshot ]
+ * cp/decl.c (duplicate_decls): Put new type in same obstack as
+ old ones, or permanent if old ones in different obstacks.
+
+ Mon Apr 18 11:48:49 1994 Chip Salzenberg <chip@fin.uucp>
+
+ [ cp/* changes propagated from c-* changes in 940401 snapshot ]
+ * cp/parse.y (attrib): Handle string args as expressions,
+ merging the two rules. `mode' attribute now takes a string arg.
+ Delete the rule for an identifier as arg.
+
+ Mon Apr 18 11:24:00 1994 Chip Salzenberg <chip@fin.uucp>
+
+ [ cp/* changes propagated from c-* changes in 940312 snapshot ]
+ * cp/typeck.c (pointer_int_sum): Multiplication should be done signed.
+ (pointer_diff): Likewise the division.
+
+ Sun Mar 6 19:43:39 1994 Chip Salzenberg <chip@fin.uucp>
+
+ [ cp/* changes propagated from c-* changes in 940304 snapshot ]
+ * cp/decl.c (finish_decl): Issue warning for large objects,
+ if requested.
+
+ Sat Feb 19 22:20:32 1994 Chip Salzenberg <chip@fin.uucp>
+
+ [ cp/* changes propagated from c-* changes in 940218 snapshot ]
+ * cp/parse.y (attrib): Handle attribute ((section ("string"))).
+ * cp/decl.c (duplicate_decls): Merge section name into new decl.
+
+ Tue Feb 8 09:49:17 1994 Chip Salzenberg <chip@fin.uucp>
+
+ [ cp/* changes propagated from c-* changes in 940206 snapshot ]
+ * cp/typeck.c (signed_or_unsigned_type): Check for any
+ INTEGRAL_TYPE_P not just INTEGER_TYPE.
+
+ Mon Dec 6 13:35:31 1993 Norbert Kiesel <norbert@i3.INformatik.rwth-aachen.DE>
+
+ * cp/decl.c (finish_enum): Start from 0 when determining precision
+ for short enums.
+
+ Fri Dec 3 17:07:58 1993 Ralph Campbell <ralphc@pyramid.COM>
+
+ * cp/parse.y (unary_expr): Look at $1 for tree_code rather than
+ casting $$.
+
+ Wed Nov 17 19:22:09 1993 Chip Salzenberg <chip@fin.uucp>
+
+ * cp/typeck.c (build_binary_op_nodefault): Propagate code
+ from C front-end to optimize unsigned short division.
+ (build_conditional_expr): Fix bug in "1 ? 42 : (void *) 8".
+
+ Wed Nov 17 19:17:18 1993 Chip Salzenberg <chip@fin.uucp>
+
+ * cp/call.c (convert_harshness_ansi): Given an (e.g.) char
+ constant, prefer 'const char &' to 'int'.
+
+ Wed Feb 3 13:11:48 1993 Chip Salzenberg <chip@fin.uucp>
+
+ * cp/class.c (finish_struct_methods): Handle multiple
+ constructors in fn_fields list.
+
+Fri Apr 22 12:48:10 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * class.c (finish_struct): Use TYPE_DECL_SUPPRESS_DEBUG to flag
+ types not to be dumped in stabs, like types in #pragma interface.
+ * decl.c (init_decl_processing): Use TYPE_DECL_SUPPRESS_DEBUG to
+ mark unknown type.
+
+Fri Apr 22 03:27:26 1994 Doug Evans <dje@cygnus.com>
+
+ * Language directory reorganization.
+ See parent makefile.
+
+Thu Apr 21 18:27:57 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * cp-tree.h (THUNK_DELTA): It is normally negative, so
+ use signed .i variant of frame_size rather than unsigned .u.
+ * cp-tree.h (VTABLE_NAME_FORMAT): If flag_vtable_thunks,
+ use "VT" rather than "vt" due to binary incompatibility.
+ * class.c (get_vtable_name): Use strlen of VTABLE_NAME_FORMAT,
+ rather than sizeof, since it is now an expression.
+ * class.c (modify_one_vtable): Modify to skip initial element
+ containing a count of the vtable.
+
+Thu Apr 21 00:09:02 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * lex.c (check_newline): Force interface_unknown on main input file.
+
+ * pt.c (do_pending_expansions): Always emit functions that have been
+ explicitly instantiated.
+ (do_function_instantiation): Set DECL_EXPLICITLY_INSTANTIATED.
+ (do_type_instantiation): Set CLASSTYPE_VTABLE_NEEDS_WRITING and
+ DECL_EXPLICITLY_INSTANTIATED on all my methods.
+ * parse.y (explicit_instantiation): Call do_type_instantiation for
+ types.
+ * decl2.c (finish_vtable_vardecl): Call import_export_vtable.
+ * decl.c (start_function): Don't set DECL_EXTERNAL on a function
+ that has been explicitly instantiated.
+ * cp-tree.h (DECL_EXPLICITLY_INSTANTIATED): Alias for
+ DECL_LANG_FLAG_4.
+ * class.c: Move import_export_vtable to decl2.c, and comment out all
+ uses.
+
+Wed Apr 20 16:51:06 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * lex.c (process_next_inline): Don't muck with DECL_INLINE.
+ (do_pending_inlines): Likewise.
+
+Tue Apr 19 22:25:41 1994 Mike Stump <mrs@cygnus.com>
+
+ Reimplement vtable building, and most vtable pointer setting.
+ Allows for earier maintenance, easier understandability, and most
+ importantly, correct semantics.
+
+ * class.c (build_vtable): Removed unneeded
+ SET_BINFO_VTABLE_PATH_MARKED.
+ * class.c (prepare_fresh_vtable): Likewise. Added argument.
+ * class.c (modify_vtable_entry): General cleanup.
+ * class.c (related_vslot, is_normal, modify_other_vtable_entries,
+ modify_vtable_entries): Removed.
+ * class.c (add_virtual_function): General cleanup.
+ * class.c (finish_base_struct): Setup BINFO_VTABLE and
+ BINFO_VIRTUALS as early as we can, so that modify_all_vtables can
+ work.
+ * class.c (finish_vtbls): New routine, mostly from
+ unmark_finished_struct.
+ * class.c (overrides): New routine.
+ * class.c (modify_one_vtable): New routine, mostly from
+ modify_other_vtable_entries and modify_vtable_entries.
+ * class.c (modify_all_direct_vtables, modify_all_indirect_vtables,
+ modify_all_vtables): New routines.
+ * class.c (finish_struct): Added arguemnt to prepare_fresh_vtable
+ call. General cleanup on how pending_hard_virtuals are handled.
+ General cleanup on modifying vtables. Use finish_vtbls, instead of
+ unmark_finished_struct.
+ * cp-tree.h (init_vtbl_ptrs, expand_direct_vtbls_init,
+ get_first_matching_virtual, get_matching_virtual,
+ expand_vbase_vtables_init, expand_indirect_vtbls_init): Update.
+ * cvt.c (convert_pointer_to_real): Cleanup error message.
+ * decl.c (grokfndecl): General cleanup.
+ * decl.c (finish_function): Change init_vtbl_ptrs call to
+ expand_direct_vtbls_init. Change expand_vbase_vtables_init call to
+ expand_indirect_vtbls_init.
+ * init.c (expand_virtual_init): Remove unneeded argument.
+ * init.c (init_vtbl_ptrs): Rename to expand_direct_vtbls_init, added
+ two arguments to make more general. Made more general. Now can be
+ used for vtable pointer initialization from virtual bases.
+ * init.c (emit_base_init): Change expand_vbase_vtables_init call to
+ expand_indirect_vtbls_init. Change init_vtbl_ptrs call to
+ expand_direct_vtbls_init.
+ * init.c (expand_virtual_init): General cleanup.
+ * init.c (expand_default_init): Change expand_vbase_vtables_init
+ call to expand_indirect_vtbls_init.
+ * init.c (expand_recursive_init_1): Change expand_vbase_vtables_init
+ call to expand_indirect_vtbls_init.
+ * init.c (expand_recursive_init): Change expand_vbase_vtables_init
+ call to expand_indirect_vtbls_init.
+ * search.c (get_first_matching_virtual): Rename to
+ get_matching_virtual. General cleanup and remove setting of
+ DECL_CONTEXT. That is now done in a cleaner way in
+ modify_vtable_entry and add_virtual_function.
+ * search.c (expand_vbase_vtables_init): Rename to
+ expand_indirect_vtbls_init. General cleanup. Use
+ expand_direct_vtbls_init to do hard work. Ensures that _all_ vtable
+ pointers from virtual bases are set up.
+ * search.c (bfs_unmark_finished_struct, unmark_finished_struct):
+ Removed.
+
+ * *.[chy]: Remove support for VTABLE_USES_MASK.
+
+Tue Apr 19 12:51:59 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cvt.c (convert_to_reference): Use NOP_EXPRs to switch between
+ reference and pointer types instead of bashing the types directly.
+
+ * call.c (build_overload_call_real): Use the TREE_CODE to determine
+ whether the function is overloaded or not, rather than
+ TREE_OVERLOADED.
+ * *: Remove all uses of TREE_OVERLOADED.
+
+ * decl.c (grokdeclarator): Only complain about initializing const
+ fields when -ansi or -pedantic.
+
+Tue Apr 19 12:42:42 1994 Doug Evans <dje@canuck.cygnus.com>
+
+ * cp-tree.h (THUNK_DELTA): frame_size is now a union.
+
+Mon Apr 18 00:17:13 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ Do overloading on a block-by-block basis, not function-by-function.
+ * decl.c: Lose overloads_to_forget.
+ (struct binding_level): Add overloads_shadowed field.
+ (poplevel): Restore overloads_shadowed.
+ (push_overloaded_decl): Use overloads_shadowed instead of
+ overloads_to_forget.
+ (finish_function): Don't look at overloads_to_forget.
+
+ Copy enum_overflow logic from c-decl.c.
+ * decl.c (start_enum): Initialize enum_overflow.
+ (build_enumerator): Use enum_overflow. Also use current_scope().
+
+ * search.c (current_scope): Move Brendan's comment from
+ build_enumerator here.
+
+ * typeck.c (convert_for_assignment): Change warnings to pedwarns for
+ discarding const/volatile.
+
+Sat Apr 16 01:18:21 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (comp_target_parms): Accept TEMPLATE_TYPE_PARMs on the rhs.
+ (comp_target_types): Likewise.
+
+ * decl.c (lookup_name): Don't unset got_scope here.
+
+ * spew.c (yylex): Only replace yylval with the TYPE_NESTED_NAME if
+ got_scope != NULL_TREE.
+
+Fri Apr 15 16:36:33 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ Horrible kludge to prevent templates from being instantiated by
+ their base classes.
+ * parse.y (template_instantiate_once): Unset TYPE_BEING_DEFINED
+ before we get to left_curly.
+ * pt.c (instantiate_class_template): Set TYPE_BEING_DEFINED.
+
+ * error.c (dump_decl): If it's a typedef, print out the name of the
+ decl, not just the underlying type.
+
+ * decl.c (pushdecl): If the old duplicate decl was a TYPE_DECL,
+ update the IDENTIFIER_TYPE_VALUE of its name.
+
+ * decl2.c (finish_file): When processing the initializer for a
+ static member, pretend that the dummy function is a member of the
+ same class.
+
+Fri Apr 15 15:56:35 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * class.c (build_vtable_entry): Revert Apr 4 change.
+ * decl2.c (mark_vtable_entries): Replace pure virtual function
+ decl with abort's.
+
+Fri Apr 15 13:49:33 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_conditional_expr): Pedwarn on pointer/integer
+ mismatch, and don't pedwarn on 0/function pointer mismatch.
+
+ * typeck2.c (digest_init): Lose code for special handling of unions.
+ (process_init_constructor): Since they're handled just fine here.
+ Pedwarn on excess elements.
+
+ * decl2.c (grokfield): Complain about local class method declaration
+ without definition.
+
+Fri Apr 15 13:19:40 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * method.c (emit_thunk): Add extern declaration for
+ current_call_is_indirect (needed for hppa).
+
+Thu Apr 14 16:12:31 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ Improve local class support; allow classes in different blocks to
+ have the same name.
+ * decl.c (pushtag): Support local classes better.
+ (pushdecl_nonclass_level): New function for pushing mangled decls of
+ nested types into the appropriate scope.
+ (xref_defn_tag): Use pushdecl_nonclass_level instead of
+ pushdecl_top_level.
+ (grokfndecl): Don't mess with IDENTIFIER_GLOBAL_VALUE for local
+ class methods.
+ * method.c (do_inline_function_hair): Likewise.
+
+ * class.c (finish_struct): It is legal for a class with no
+ constructors to have nonstatic const and reference members.
+
+Thu Apr 14 07:15:11 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (push_overloaded_decl): Avoid giving errors about
+ built-ins, since duplicate_decls will have given warnings/errors
+ for them.
+
+Thu Apr 14 03:45:12 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cvt.c (convert_to_reference): Warn about casting pointer type to
+ reference type when this is probably not what they wanted.
+
+Wed Apr 13 13:12:35 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * decl.c (finish_decl): Don't mindlessly set TREE_USED for
+ static consts any more (toplev.c has now been modified to
+ not emit warnings if they are unused).
+
+Wed Apr 13 00:22:35 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grok_op_properties): If op new/delete get here with
+ METHOD_TYPEs, do a revert_static_member_fn.
+
+ * cp-tree.h (IDENTIFIER_CLASS_TYPE_VALUE): Lose.
+ * init.c (is_aggr_typedef): Don't look at
+ IDENTIFIER_CLASS_TYPE_VALUE.
+ (get_aggr_from_typedef): Likewise.
+ (get_type_value): Likewise.
+ * call.c (build_scoped_method_call): Don't rely on overloaded
+ template names having IDENTIFIER_CLASS_VALUE set.
+
+ * parse.y (component_decl_1, fn.def2): Revert rules for
+ constructors.
+ (component_decl_1, fn.def2): Use $1 instead of $$, since $$ is being
+ clobbered.
+
+ * decl.c (start_function): Only warn about `void main()' if pedantic
+ || warn_return_type.
+
+Tue Apr 12 02:14:17 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ Clean up overloading of the template name.
+ * class.c (pushclass): Overload the template name whenever pushing
+ into the scope of a template class, not just if it is
+ uninstantiated.
+ (popclass): Correspondingly.
+ * search.c (push_class_decls): Don't overload_template_name.
+ * pt.c (overload_template_name): Don't set IDENTIFIER_LOCAL_VALUE or
+ DECL_CONTEXT on things.
+ * parse.y (left_curly): Don't overload_template_name.
+ * class.c (finish_struct): Don't undo_template_name_overload.
+
+ * method.c (build_opfncall): Only pass one argument to global op
+ delete.
+
+ * call.c (build_method_call): Use TYPE_VEC_DELETE_TAKES_SIZE to
+ decide how many arguments to use for vec delete.
+
+ * decl.c (grok_op_properties): Be consistent in modifying
+ current_class_type.
+ (grokdeclarator): Only complain about function decls with no return
+ type if we're being pedantic.
+
+Mon Apr 11 00:10:53 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ Add support for operator new [] and operator delete [].
+
+ * tree.def: Add VEC_NEW_EXPR and VEC_DELETE_EXPR.
+ * ptree.c (print_lang_type): Indicate vec new/delete.
+ * parse.y: Support vec new/delete.
+ * method.c (build_decl_overload): Deal with vec new/delete.
+ (build_opfncall): Likewise.
+ * lex.c (init_lex): Set up values of ansi_opname and opname_tab for
+ vec new/delete. vec new uses "__vn", and vec delete uses "__vd".
+ * init.c (init_init_processing): Set up BIVN and BIVD.
+ (do_friend): Don't clean up after mistaken setting of TREE_GETS_NEW,
+ since it doesn't happen any more.
+ (build_new): Support vec new. Always call something.
+ (build_x_delete): Support vec delete.
+ (build_vec_delete): Lose dtor_dummy argument, add use_global_delete,
+ and pass it to build_x_delete.
+ * decl2.c (delete_sanity): Don't change behavior by whether or not
+ the type has a destructor. Pass use_global_delete to
+ build_vec_delete.
+ (coerce_delete_type): Make sure that the type returned has a first
+ argument of ptr_type_node.
+ * decl.c (init_decl_processing): Also declare the global vec
+ new/delete.
+ (grokdeclarator): Also force vec new/delete to be static.
+ (grok_op_properties): Note presence of vec new/delete, and play with
+ their args. If vec delete takes the optional size_t argument, set
+ TYPE_VEC_DELETE_TAKES_SIZE.
+ * cp-tree.h (TYPE_GETS_{REG,VEC}_DELETE): New macros to simplify
+ checking for one delete or the other.
+ (lang_type): gets_new and gets_delete are now two bits long. The
+ low bit is for the non-array version. Lose gets_placed_new.
+ (TYPE_VEC_DELETE_TAKES_SIZE): New macro indicating that the vec
+ delete defined by this class wants to know how much space it is
+ deleting.
+ (TYPE_VEC_NEW_USES_COOKIE): New macro to indicate when vec new must
+ add a header containing the number of elements in the vector; i.e.
+ when the elements need to be destroyed or vec delete wants to know
+ the size.
+ * class.c (finish_struct_methods): Also check for overloading vec
+ delete.
+ * call.c (build_method_call): Also delete second argument for vec
+ delete.
+
+ * decl.c (grokdeclarator): Correct complaints again.
+ (grokdeclarator): Fix segfault on null declarator.
+ (decls_match): Also accept redeclaration with no arguments if both
+ declarations were in C context. Bash TREE_TYPE (newdecl) here.
+ (duplicate_decls): Instead of here.
+
+ * parse.y (nested_name_specifier_1): Lose rules for dealing with
+ syntax errors nicely, since they break parsing of 'const i;'.
+
+ * decl.c (lookup_name): if (got_scope == current_class_type)
+ val = IDENTIFIER_CLASS_VALUE (name).
+
+ * search.c (lookup_nested_tag): Look in enclosing classes, too.
+
+ * spew.c (yylex): Only look one character ahead when checking for a
+ SCOPE.
+
+ * lex.c (check_newline): Read first nonwhite char before
+ incrementing lineno.
+
+ * decl.c (grokdeclarator): Don't claim that typedefs are variables
+ in warning.
+
+ * parse.y: Divide up uses of unqualified_id into
+ notype_unqualified_id and unqualified_id, so that TYPENAME can be
+ used as an identifier after an object.
+
+ * class.c (push_nested_class): Don't push into non-class scope.
+
+ * decl.c (grokdeclarator): If an identifier could be a type
+ conversion operator, but has no associated type, it's not a type
+ conversion operator.
+
+ * pt.c (unify): Check for equality of constants better.
+
+ * decl.c (grokdeclarator): Don't complain about access decls.
+
+Sun Apr 10 02:39:55 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grokdeclarator): pedwarn about data definitions without
+ types here.
+
+ * parse.y (datadef): Don't pedwarn about decls without types here,
+ since that is valid for functions.
+ (fn.def2, component_decl): Support constructors with declmods again.
+ (nomods_initdecls): For decls without any mods, so that we don't try
+ to get declspecs from some arbitrary $0.
+
+ * search.c (lookup_field): Use cp_error.
+
+ * parse.y (nested_name_specifier_1): Don't check aggr/non-aggr type
+ here; it breaks destructors for non-aggr types.
+
+ * decl.c (lookup_name): Only look for TYPE_DECLs in base classes of
+ a type being defined, like the comment says.
+ If got_scope is not an aggregate, just return NULL_TREE.
+
+ * pt.c (create_nested_upt): Kung's code for creating types nested
+ within uninstantiated templates now lives here (it used to live in
+ hack_more_ids). It needs to be expanded.
+
+ * parse.y: Stop calling see_typename so much.
+
+ * decl.c (lookup_name): Deal with TTPs and UPTs.
+
+ * lex.c (real_yylex): Don't set looking_for_typename just because we
+ saw a 'new'.
+ (dont_see_typename): #if 0 out.
+
+ * spew.c (yylex): Increment looking_for_typename if the next
+ character is SCOPE, rather than setting it to 1; this way, the value
+ from seeing an aggr specifier will not be lost. This kinda relies
+ on looking_for_typename never being < 0, which is now true.
+
+ * parse.y (nested_name_specifier_1): Accept TEMPLATE_TYPE_PARMs,
+ too.
+ (named_class_head_sans_basetype): Accept template types, too. Oops.
+
+Fri Apr 8 16:39:35 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl2.c (reparse_decl_as_expr1): Handle SCOPE_REFs.
+
+ * parse.y: Lose START_DECLARATOR.
+
+ * search.c (lookup_nested_tag): New function to scan CLASSTYPE_TAGS
+ for a class.
+
+ * parse.y: Simplify fn.def2 and component_decl. Support 'enum
+ A::foo' syntax. Catch invalid scopes better.
+
+ * parse.y, lex.c: Lose TYPENAME_COLON.
+
+ * decl2.c (groktypefield): #if 0 out.
+
+ * decl.c (lookup_name): If the type denoted by got_scope is
+ currently being defined, look in CLASSTYPE_TAGS rather than FIELDS.
+
+ * class.c (push_nested_class): Don't try to push into
+ error_mark_node.
+
+Fri Apr 8 07:26:36 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * Makefile.in (stamp-parse): Update count of conflicts to 33.
+
+Thu Apr 7 17:47:53 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ A saner implementation of nested types that treats template types
+ no differently from non-template types. There are still some
+ shortcomings of our system; most notably, it is difficult to look
+ for a nested type that is hidden by another name, because of the way
+ we keep track of hidden types. But this shouldn't be a problem for
+ just about anyone. Perhaps lookup_field should be fixed up a bit.
+
+ * spew.c: Moved handling of nested types/scoping from the lexer
+ into the parser. Removed variable template_type_seen_before_scope.
+ Removed functions frob_identifier, hack_more_ids, and various cruft
+ that was #if 0'd out in the past, reducing the size of the file from
+ 1146 lines to 450 lines. We can't quite do away with spew.c yet,
+ though; we still need it for do_aggr () and checking for SCOPE after
+ the current identifier. And setting lastiddecl.
+
+ * parse.y: Moved handling of nested types/scoping from the lexer
+ into the parser, using a new global variable `got_scope'. Reduced
+ the number of states by 53. Implemented all uses of explicit global
+ scope. Removed terminals SCOPED_TYPENAME and SCOPED_NAME. Removed
+ nonterminals tmpl.1, scoped_base_class, id_scope, typename_scope,
+ scoped_typename. Added nonterminals nested_type,
+ qualified_type_name, complete_type_name, qualified_id, ptr_to_mem,
+ nested_name_specifier, global_scope, overqualified_id, type_name.
+ Changed many others. Added 9 new reduce/reduce conflicts, which are
+ nested type parallels of 9 that were already in the grammar for
+ non-nested types. Eight of the now 33 conflicts should be removed
+ in the process of resolving the late binding between variable and
+ function decls.
+
+ * gxxint.texi (Parser): Update.
+
+ * cp-tree.h (IS_AGGR_TYPE_CODE): Add UNINSTANTIATED_P_TYPE.
+
+ * lex.h: Add decl for got_scope.
+
+ * lex.c (see_typename): Claim to be the lexer when calling
+ lookup_name.
+
+ * decl.c (lookup_name): When called from the lexer, look at
+ got_scope and looking_at_typename; otherwise don't.
+
+Thu Apr 7 22:05:47 1994 Mike Stump <mrs@cygnus.com>
+
+ 31th Cygnus<->FSF merge.
+
+Thu Apr 7 17:47:53 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl2.c (mark_vtable_entries): Call this to mark all the
+ entries in the vtable addressable.
+ (finish_decl_parsing): Handle SCOPE_REFs.
+
+ * decl.c (decls_match): Always call compparms with strict == 1.
+ Handle the special case of C function redecl here.
+ (duplicate_decls): Only keep the old type if the new decl takes no
+ arguments.
+
+ * typeck.c (compparms): Also allow t1 to be ... if strict == 0.
+
+Thu Apr 7 16:17:50 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (build_vtable_entry): Fix breakage introduced Apr 5
+ 17:48:41.
+
+Wed Apr 6 16:05:10 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * init.c (build_virtual_init), search.c (build_vbase_vtables_init),
+ ch-tree.h: Every place these functions were called, the result was
+ immediately passed to expand_expr_stmt. Reduce redundancy by
+ calling expand_expr_init *inside* these functions. These
+ makes for a simpler interface, and we don't have to build
+ compound expressions. Hence, rename these function to:
+ expand_virtual_init and expand_vbase_vtables_init respectively.
+ * init.c, decl.c: Change callers of these functions.
+ * init.c, cp-tree.h (expand_virtual_init): Make static.
+
+ * decl2.c (finish_file): Check TREE_PUBLIC||TREE_ADDRESSABLE
+ rather than DECL_SAVED_INSNS before emitting inlines.
+
+Wed Apr 6 13:06:39 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * spew.c (init_spew): #if 0 out stuff used by arbitrate_lookup.
+
+ * decl.c (duplicate_decls): If this is a new declaration of an
+ extern "C" function, keep the type (for the argtypes).
+ (redeclaration_error_message): Don't check DECL_LANGUAGE here.
+ (decls_match): Call compparms with a value of strict dependent on
+ the value of strict_prototypes for DECL_LANGUAGE (oldecl).
+
+ * typeck.c (compparms): ... is only equivalent to non-promoting
+ parms if we're not being strict.
+
+ * parse.y (empty_parms): Don't check flag_ansi || pedantic here.
+
+ * decl.c (init_decl_processing): if (flag_ansi || pedantic)
+ strict_prototypes_lang_c = strict_prototypes_lang_cplusplus;
+
+ * decl2.c (grok_function_init): Don't set DECL_INITIAL on pure
+ virtuals.
+
+Tue Apr 5 17:48:41 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ Support for implementing vtables with thunks.
+ * tree.def (THUNK_DECL): New TREE_CODE.
+ * cp-tree.h (FNADDR_FROM_VTABLE_ENTRY), tree.c
+ (fnaddr_from_vtable_entry): Handle flag_vtable_thunks case.
+ * cp-tree.h (memptr_type): New variable.
+ * class.c (build_vtable_entry): Build thunk if necessary.
+ * class.c (build_vfn_ref): If using thunks, don't need
+ to add delta field from vtable (there is none!).
+ * decl.c: Add memptr_type as well as vtable_entry_type.
+ If using thunks, the latter is just ptr_type_node.
+ * gc.c, typeck.c: Use memptr_typeChange, not vtable_entry_type.
+ * decl2.c (finish_vtable_vardecl): Handle thunks.
+ * expr.c (cplus_expand_expr): Support THUNK_DECL.
+
+ * decl.c (grokdeclarator): Set DECL_THIS_EXTERN if "extern".
+ * decl.c (start_function): Set current_extern_inline based on
+ DECL_THIS_EXTERN, not TREE_PUBLIC.
+ * decl.c (finish_function): Call mark_inline_for_output if needed,
+
+ Improve intelligence about when to emit inlines.
+ * cp-tree.h (lang_decl_flags): New field saved_inline.
+ * cp-tree.h (DECL_SAVED_INLINE): New macro.
+ * class.c (add_virtual_function): Don't set TREE_ADDRESSABLE.
+ * decl.h, decl.c (pending_addressable_inlines): Removed.
+ * decl2.c (pending_addressable_inlines): Renamed to saved_inlines.
+ * decl2.c (mark_inline_for_output): Do nothing if
+ DECL_SAVED_INLINE; otherwise set it (and add to saved_inlines list).
+ * decl2.c (finish_vtable_vardecl): SET_CLASSTYPE_INTERFACE_KNOWN
+ and set CLASSTYPE_INTERFACE_ONLY if there is a non-inline virtual.
+ * decl2.c (finish_file): Writing out inlines later, so we can
+ also handle the ones needed for vtbales.
+ * decl2.c (write_vtable_entries, finish_vtable_typedecl): Removed.
+
+ * cp-tree.h, class.c, decl2.c, search.c: Remove -fvtable-hack
+ and flag_vtable_hack. Use -fvtable-thunks and flag_vtable_thunks
+ instead. (The rationale is that these optimizations both break binary
+ compatibility, but should become the default in a future release.)
+
+Wed Apr 6 10:53:56 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (modify_vtable_entries): Never reset the DECL_CONTEXT
+ of a fndecl, as we might not be from that vfield.
+
+Tue Apr 5 17:43:35 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * class.c (add_virtual_function): Fix bug for pure virtual, so
+ that DECL_VINDEX of the dummy decl copied won't be error.
+ (see also Apr 4 change)
+
+Tue Apr 5 17:23:45 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * typeck.c (c_expand_return): Before checking that we're not
+ returning the address of a local, make sure it's a VAR_DECL.
+ (And don't worry about it being a TREE_LIST.)
+
+Tue Apr 5 13:26:42 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (YYDEBUG): Always define.
+ * lex.c (YYDEBUG): Likewise.
+
+Mon Apr 4 11:28:17 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * class.c (finish_struct): Backup out the change below, put the
+ new change for the same purpose. The change below breaks code.
+
+ * class.c (finish_struct): If pure virtual, copy node and make
+ RTL point to abort, then put in virtual table.
+ * decl2.c (grok_function_iit): Reinstate Mar 31 change.
+
+Sat Apr 2 03:12:58 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * init.c (build_new): pedwarn about newing const and volatile
+ types.
+
+ * tree.c (get_identifier_list): Only do the special handling
+ thing if we're dealing with the main variant of the record type.
+
+ * cvt.c (convert_to_reference): When converting between
+ compatible reference types, use the pointer conversion machinery.
+ Don't just blindly overwrite the old type.
+
+Fri Apr 1 17:14:42 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (build_method_call): When looking at global functions,
+ be sure to use instance_ptr for the first argument, not some version
+ of it that has been cast to a base class. Also do this before
+ comparing candidates.
+
+Thu Mar 31 19:50:35 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (build_method_call): Constructors can be called for
+ const objects.
+
+Thu Mar 31 16:20:16 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * decl2.c (grok_func_init): Do not abort as rtl for pur virtual
+ fucntions. They can be defined somewhere else.
+
+Sat Jan 23 23:23:26 1994 Stephen R. van den Berg <berg@pool.informatik.rwth-aachen.de>
+
+ * decl.c (init_decl_processing): Declare __builtin_return_address
+ and __builtin_frame_address for C++ as well.
+
+Thu Mar 31 12:35:49 1994 Mike Stump <mrs@cygnus.com>
+
+ * typeck2.c (store_init_value): Integral constant variables are
+ always constant, even when doing -fpic.
+
+Sat Jan 23 23:23:26 1994 Stephen R. van den Berg <berg@pool.informatik.rwth-aachen.de>
+
+ * decl.c (redeclaration_error_message): Pass the types to
+ comptypes.
+
+Wed Mar 30 21:29:25 1994 Mike Stump <mrs@cygnus.com>
+
+ Cures incorrect errors about pure virtuals in a class, when they
+ have been overridden in a derived class.
+
+ * search.c (get_abstract_virtuals): Reimplement.
+ * search.c (get_abstract_virtuals_1): New routine.
+
+Wed Mar 30 14:10:04 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * pt.c (push_template_decls): Make the pushed level pseudo
+ global.
+
+ * parse.y (extdefs): Don't pop everything if the current binding
+ level is pseudo_global.
+
+ * decl.c (pop_everything): Stop on reaching a pseudo-global
+ binding level.
+
+ * cp-tree.h (DECL_FUNCTION_MEMBER_P): Change to more reliable test.
+
+ * decl.c (duplicate_decls): Only copy DECL_SOURCE_{FILE_LINE} if
+ the old decl actually had an initializer.
+
+ * {various}: Clean up gcc -W complaints.
+
+ * cp-tree.h (DECL_FUNCTION_MEMBER_P): Currently defined to be
+ (DECL_CONTEXT (NODE) != NULL_TREE).
+
+ * parse.y (lang_extdef): Call pop_everything if necessary.
+
+ * decl.c (pop_everything): New function for popping binding
+ levels left over after a syntax error.
+ (pushdecl): Use DECL_FUNCTION_MEMBER_P to decide whether or not
+ a function is a member.
+
+Wed Mar 30 14:20:50 1994 Mike Stump <mrs@cygnus.com>
+
+ Cures calling a more base base class function, when a more derived
+ base class member should be called in some MI situations.
+
+ * search.c (make_binfo): Use more the more specialized base
+ binfos from the binfo given as the second argument to make_binfo,
+ instead of the unspecialized ones from the TYPE_BINFO.
+ * class.c (finish_base_struct): Likewise, update callers.
+ * search.c (dfs_get_vbase_types): Likewise.
+ * tree.c (propagate_binfo_offsets, layout_vbasetypes): Likewise.
+ * decl.c (xref_tag): Use NULL_TREE instead of 0.
+ * lex.c (make_lang_type): Likewise.
+
+Wed Mar 30 14:10:04 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (pushdecl): If pushing a C-linkage function, only do a
+ push_overloaded_decl.
+ (duplicate_decls): Standard overloading does not shadow built-ins.
+
+Tue Mar 29 00:54:18 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * pt.c (end_template_decl): Don't call push_overloaded_decl.
+
+ * init.c (do_friend): Don't call push_overloaded_decl.
+
+ * decl.c (pushdecl): Call push_overloaded_decl for functions and
+ function templates.
+ (duplicate_decls): Functions and function templates are not
+ duplicates, but don't complain about calling this function to
+ compare them.
+ (push_overloaded_decl): Don't deal with linkage. Call
+ duplicate_decls.
+ (redeclaration_error_message): Deal with linkage.
+
+ * decl.c (start_function): If push_overloaded_decl returns an
+ older version of the function, deal with it.
+
+ * decl.c (start_function): Be sure only to push_overloaded_decl
+ for non-members.
+
+ * decl.c (grokfndecl): Put back clearing of DECL_CHAIN for
+ methods.
+ (start_function): Lose broken and redundant code for checking old
+ decl.
+
+ * init.c (add_friend): Give line numbers of both friend decls
+ when warning about re-friending.
+
+ * pt.c (tsubst): Use comptypes rather than == to compare the
+ types of the method as declared and as defined, since default
+ parameters may be different.
+
+ * call.c (build_method_call): Use brendan's candidate printing
+ routine.
+
+ * decl.c (start_method): Methods defined in the class body are
+ inline whether or not it's a template class.
+
+Mon Mar 28 16:39:26 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (initdcl0): Add "extern" to current_declspecs if
+ have_extern_spec && ! used_extern_spcec.
+
+ * tree.c (really_overloaded_fn): A fn with more than one
+ overload.
+
+ * pt.c (end_template_decl): Use really_overloaded_fn.
+
+ * decl.c (duplicate_decls): When smashing a decl into a previous
+ definition, keep the old file and line.
+ Don't deal with overloaded functions.
+ Lose old code for checking arg types of functions.
+ Check for overloaded C functions.
+ (pushdecl): Deal with overloaded functions.
+ (start_decl): Expect pushdecl to return an appropriate function decl.
+ (start_function): Likewise.
+ (push_overloaded_decl): Don't check for overloaded C functions.
+
+ * *.c: Stop using DECL_OVERLOADED, it being archaic.
+ TREE_OVERLOADED should probably go, too.
+
+Mon Mar 28 14:00:45 1994 Ron Guilmette <rfg@netcom.com>
+
+ * typeck.c (comp_target_types): Call comp_target_parms with
+ strict == 1.
+
+Sun Mar 27 00:07:45 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (empty_parms): Don't parse () as (...) in extern "C"
+ sections if we're compiling with -ansi or -pedantic.
+
+ * decl.c (decls_match): Don't treat (int) and (int&) as matching.
+
+ * decl2.c (grokfield): Don't pedwarn twice about initializing
+ field.
+
+ * decl.c (push_overloaded_decl): Warn about shadowing
+ constructor.
+ (redeclaration_error_message): Don't allow 'int a; int a;'
+
+ * cvt.c (build_up_reference): Only check for valid upcast if
+ LOOKUP_PROTECT is set, not just any flag.
+
+Fri Mar 25 01:22:31 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * lex.c (check_newline): When we see a #pragma implementation,
+ also set it for the main input file.
+
+ * init.c (build_new): Convert array size argument to size_t.
+
+ * parse.y (primary): If we're doing a parenthesized type-id, call
+ groktypename before passing it to build_new.
+
+ * call.c (build_method_call): Deal properly with const and
+ volatile for instances of reference type.
+
+ * decl.c (store_return_init): Change 'if (pedantic) error' to 'if
+ (pedantic) pedwarn'.
+
+ * decl.c (grokdeclarator): Don't complain about putting `static'
+ and `inline' on template function decls.
+
+Thu Mar 24 23:18:19 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (build_method_call): Preserve const & volatile on
+ `this'.
+
+Thu Mar 24 16:21:52 1994 Mike Stump <mrs@cygnus.com>
+
+ * init.c (build_new, build_vec_delete): Use global new and delete
+ for arrays.
+ * decl2.c (delete_sanity): Likewise.
+
+Thu Mar 24 02:10:46 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cvt.c (convert_to_reference): If i is an lvalue,
+ (int &)i -> *(int*)&i, as per 5.2.8p9 of the latest WP.
+ (convert_force): Call convert_to_reference with LOOKUP_COMPLAIN.
+
+Wed Mar 23 17:45:37 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (duplicate_decls): Also propagate DECL_TEMPLATE_MEMBERS
+ and DECL_TEMPLATE_INSTANTIATIONS.
+
+ * init.c (build_new): Handle array typedefs properly.
+
+Wed Mar 23 18:23:33 1994 Mike Stump <mrs@cygnus.com>
+
+ 30th Cygnus<->FSF merge.
+
+Wed Mar 23 00:46:24 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (modify_vtable_entries): Avoid running off the end of the
+ virtuals list when processing a virtual destructor.
+ * class.c (get_vtable_entry): Likewise.
+
+Wed Mar 23 00:23:59 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (duplicate_decls): If two template decls don't match,
+ just return 0.
+
+Tue Mar 22 23:49:41 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (convert_for_assignment): Don't pedwarn about
+ converting function pointer to void *.
+
+Tue Mar 22 22:23:19 1994 Mike Stump <mrs@cygnus.com>
+
+ Major revamp of pointer to member functions. Cures major
+ nonfunctionality when used in casts, and MI situations.
+
+ * cvt.c (convert_force): Update call site of build_ptrmemfunc.
+ * typeck.c (convert_for_assignment): Likewise.
+ * typeck2.c (digest_init): Likewise.
+ * typeck2.c (process_init_constructor): Simplify by moving code into
+ digest_init.
+ * typeck2.c (digest_init): Do default_conversions on init value, if
+ we are processing pointer to member functions.
+ * class.c (get_vfield_offset): Now non-static. Convert bit offset
+ into byte offset.
+ * cp-tree.h (get_vfield_offset): Likewise.
+ * typeck.c (get_member_function_from_ptrfunc): Convert down to right
+ instance, before fetching vtable pointer.
+ * typeck.c (get_delta_difference): New routine.
+ * typeck.c (build_ptrmemfunc): Revamp to handle casting better, also
+ get vtable pointer out of right subobject.
+
+Tue Mar 22 17:56:48 1994 Mike Stump <mrs@cygnus.com>
+
+ * search.c (get_binfo): Return NULL instead of aborting, when
+ passed a UNION_TYPE.
+
+Tue Mar 22 12:44:54 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ These patches implement handling of redefinition/redeclaration of
+ templates.
+
+ * typeck.c (comptypes): Simplify. All TEMPLATE_TYPE_PARMs are
+ considered compatible.
+
+ * parse.y (template_def): Pass defn argument to end_template_decl.
+
+ * pt.c (end_template_decl): Add defn argument. Check for
+ redefinition. Simplify.
+
+ * error.c (OB_UNPUT): New macro, to remove mistakes.
+ (aggr_variety): Subroutine of dump_aggr_type.
+
+ * decl.c (decls_match): Support templates.
+ (duplicate_decls): No longer static. Don't try to lay out template
+ decls.
+ (pushdecl): Simplify.
+
+ * cp-tree.h (DECL_TEMPLATE_MEMBERS): Use DECL_SIZE instead of
+ DECL_INITIAL.
+
+Mon Mar 21 11:46:55 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * error.c (dump_decl): Support class template decls.
+ (dump_type): Don't adorn template type parms.
+
+ * decl.c (duplicate_decls): Save DECL_TEMPLATE_INFO from old decl
+ if it was a definition.
+ (redeclaration_error_message): Do the cp_error thang, and reject
+ redefinition of templates.
+
+Mon Mar 21 19:36:06 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * decl.c (grokdeclarator): Set TREE_PUBLIC for METHOD_TYPE
+ in FIELD context, when appropriate. Also,
+ CLASSTYPE_INTERFACE_ONLY is irrelevant to setting TREE_PUBLIC.
+ Also, simplify check for bogus return specifiers.
+
+Mon Mar 21 11:46:55 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (after_type_declarator1): Expand type_quals.
+ (notype_declarator1): Likewise.
+ (absdcl1): Likewise.
+
+Sat Mar 19 01:05:17 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grokdeclarator): Treat class-local typedefs like static
+ members; i.e. 'typedef int f();' means that f is a function type,
+ not a method type.
+
+ * parse.y (decl): Change direct_* back to *.
+ (type_id): Change direct_abstract_declarator to absdcl.
+ (direct_declarator, direct_initdecls, direct_initdcl0): Remove again.
+
+Fri Mar 18 12:47:59 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ These two patches fix crashes on instantiating a template inside a
+ function with C linkage or containing labels.
+
+ * class.c (current_lang_stacksize): No longer static.
+
+ * decl.c (struct saved_scope): Add lang_base, lang_stack,
+ lang_name, lang_stacksize, and named_labels.
+ (push_to_top_level): Save them.
+ (pop_from_top_level): Restore them.
+
+ * gxxint.texi (Parser): Update.
+
+ These two patches finish moving the task of expr/declarator
+ ambiguity resolution from the lexer to the parser, and add one more
+ r/r conflict. START_DECLARATOR can now be nuked.
+
+ * parse.y (decl): Add "direct_" in typespec X rules.
+ (direct_declarator): New nonterminal for
+ direct_after_type_declarator and direct_notype_declarator.
+ (direct_initdecls): Like initdecls, but uses direct_initdcl0.
+ (direct_initdcl0): Like initdcl0, but uses direct_declarator.
+ (named_parm): Add typespec direct_declarator rule.
+
+ * spew.c (yylex): #if 0 out START_DECLARATOR insertion.
+
+ These two patches disable some excessive cleverness on the part of
+ g++; a non-class declaration always hides a class declaration in the
+ same scope, and g++ was trying to unhide it depending on the
+ enclosing expression.
+
+ * spew.c (arbitrate_lookup): #if 0 out.
+
+ * decl.c (lookup_name): Never call arbitrate_lookup.
+
+ * parse.y (complex_notype_declarator1): Add '*'
+ complex_notype_declarator1 and '&' complex_notype_declarator1 rules.
+
+ * parse.y (complex_direct_notype_declarator): Restore id_scope
+ see_typename TYPENAME rule, remove all other rules beginning with
+ those tokens.
+ (notype_unqualified_id): Add '~' see_typename IDENTIFIER rule.
+
+Thu Mar 17 17:30:01 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ These changes fix the compiler's handling of the functional cast/
+ object declaration ambiguities in section 6.8 of the ARM. They also
+ add 11 reduce/reduce conflicts. Sigh.
+
+ * parse.y: Add precedence decls for OPERATOR and '~'.
+ (notype_unqualified_id): New nonterminal, encompasses all of the
+ ANSI unqualified-id nonterminal except TYPENAMEs.
+ (expr_or_declarator): New nonterminal to delay parsing of code like
+ `int (*a)'.
+ (primary): Use notype_unqualified_id.
+ (decl): Add typespec initdecls ';' and typespec declarator ';'
+ rules.
+ (initdcl0): Deal with the above.
+ (complex_notype_declarator1): A notype_declarator that is not also
+ an expr_or_declarator.
+ (complex_direct_notype_declarator): A direct_notype_declarator that
+ doesn't conflict with expr_or_declarator. Use
+ notype_unqualified_id. Remove id_scope see_typename TYPENAME rule.
+ (functional_cast): New nonterminal, for the three functional cast
+ rules. So that they can be moved after
+ complex_direct_notype_declarator.
+ (see_typename): Don't accept type_quals any more.
+
+ * decl2.c (reparse_decl_as_expr): New function to deal with parse
+ nodes for code like `int (*a)++;'.
+ (reparse_decl_as_expr1): Recursive subroutine of the above.
+ (finish_decl_parsing): New function to deal with parse nodes for
+ code like `int (*a);'. See the difference?
+
+Thu Mar 17 12:16:10 1994 Mike Stump <mrs@cygnus.com>
+
+ These changes break binary compatibility in code with classes
+ that use virtual bases.
+
+ * search.c (dfs_get_vbase_types): Simplify and correct to make
+ sure virtual bases are initialized in dfs ordering.
+ * search.c (get_vbase_types): Simplify and make readable.
+
+Thu Mar 17 12:01:10 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y: s/ typename / type_id /g
+
+Wed Mar 16 17:42:52 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * parse.y (typespec): Add SCOPE TYPENAME for global scoped
+ type. e.g. ::B x.
+
+ * decl.c (complete_array_type): Fix a bug that in -pendantic
+ mode even there's no initializer, it will continue to build
+ default index.
+
+Wed Mar 16 17:43:07 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (direct_notype_declarator): Add PTYPENAME rule, remove
+ all of the scoped PTYPENAME rules.
+
+Wed Mar 16 16:39:02 1994 Mike Stump <mrs@cygnus.com>
+
+ * init.c (build_offset_ref): The value of A::typedef_name is
+ always the TYPE_DECL, and never an error.
+
+Tue Mar 15 20:02:35 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * search.c (get_base_distance_recursive): Two binfos can only
+ represent the same object if they are both via_virtual.
+
+ * class.c (finish_base_struct): Check vbases for ambiguity, too.
+
+ * search.c (get_vbase_types): Accept binfo argument, too.
+
+Tue Mar 15 19:22:05 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * decl.c (complete_array_type): Complete TYPE_DOMAIN of the
+ initializer also, because back-end requires it.
+
+Tue Mar 15 15:33:31 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * error.c (dump_expr): Support member functions (which show up as
+ OFFSET_REFs).
+
+Mon Mar 14 16:24:36 1994 Mike Stump <mrs@cygnus.com>
+
+ * init.c (build_new): Set the return type of multidimensional
+ news correctly.
+
+Fri Mar 11 15:35:39 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * call.c (build_method_call): If basetype not equal to type
+ of the instance, use the type of the instance in building
+ destructor.
+
+Thu Mar 10 17:07:10 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * parse.y (direct_notype_declarator): Add push_nested_type for
+ 'template_type SCOPED_NAME' rule.
+
+Tue Mar 8 00:19:58 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (parm): Add typed_declspec1 {absdcl, epsilon} rules.
+
+Sat Mar 5 04:47:48 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (regcast_or_absdcl): New nonterminal to implement late
+ reduction of constructs like `int ((int)(int)(int))'.
+ (cast_expr): Use it.
+ (sub_cast_expr): Everything that can come after a cast.
+ (typed_declspecs1): typed_declspecs that are not typed_typespecs.
+ (direct_after_type_declarator): Lose PAREN_STAR_PAREN rule.
+ (direct_abstract_declarator): Replace '(' parmlist ')' rule with
+ '(' complex_parmlist ')' and regcast_or_absdcl.
+ (parmlist): Split
+ (complex_parmlist): Parmlists that are not also typenames.
+ (parms_comma): Enabler.
+ (named_parm): A parm that is not also a typename. Use declarator
+ rather than dont_see_typename abs_or_notype_decl. Expand
+ typed_declspecs inline.
+ (abs_or_notype_decl): Lose.
+ (dont_see_typename): Comment out.
+ (bad_parm): Break out abs_or_notype_decl into two rules.
+
+Fri Mar 4 18:22:39 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl2.c (reparse_decl_as_casts): New function to change parse
+ nodes for `(int)(int)(int)' from "function taking int and returning
+ function taking int and returning function taking int" to "... cast
+ to int, cast to int, cast to int".
+
+ * decl2.c (reparse_decl_as_expr): Recursive function to change
+ parse nodes for `A()()' from "function returning function returning
+ A" to "A().operator()".
+
+ * parse.y (primary): Replace `typespec LEFT_RIGHT' rule with
+ `typespec fcast_or_absdcl' rule.
+ (fcast_or_absdcl): New nonterminal to implement late reduction of
+ constructs like `A()()()()'.
+ (typename): Replace `typespec absdcl1' rule with
+ `typespec direct_abstract_declarator' rule.
+ (direct_abstract_declarator): Replace `LEFT_RIGHT type_quals' rule
+ with `fcast_or_absdcl type_quals' rule.
+
+Fri Mar 4 16:18:03 1994 Mike Stump <mrs@cygnus.com>
+
+ * tree.c (lvalue_p): Improve OFFSET_REF handling, so that it
+ matches Section 5.5.
+
+Fri Mar 4 14:01:59 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * error.c (dump_type_prefix): Don't print basetype twice for
+ pmfs.
+
+Fri Mar 4 13:24:33 1994 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (convert_arguments): Handle setHandler(A::handlerFn)
+ so that it is like setHandler(&A::handlerFn). Cures an `invalid
+ lvalue in unary `&''.
+
+Fri Mar 4 11:15:59 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * gxxint.texi (Copying Objects): New section discussing default
+ op= problems with virtual inheritance.
+
+ * decl2.c (grokoptypename): Just does grokdeclarator and
+ build_typename_overload, since the parser can't call grokdeclarator
+ directly.
+
+ * method.c (build_typename_overload): Set IDENTIFIER_GLOBAL_VALUE
+ and TREE_TYPE on generated identifiers.
+
+ * decl.c (grokdeclarator): Don't deal with TYPE_EXPRs anymore.
+
+ * parse.y (parm): Convert `const char *' to `__opPCc' here.
+
+ * error.c (dump_decl): Say sorry rather than my_friendly_aborting
+ if we can't figure out what to do.
+ (dump_type*): Likewise.
+
+ * typeck2.c (build_m_component_ref): 'component' is an expr, not
+ a decl. Also move the IS_AGGR_TYPE check after the stripping of
+ REFERENCE_TYPE.
+
+Fri Mar 4 04:46:05 1994 Mike Stump <mrs@cygnus.com>
+
+ * call.c (build_method_call): Handle b->setHandler(A::handlerFn)
+ so that it is like b->setHandler(&A::handlerFn). Cures an `invalid
+ lvalue in unary `&''.
+
+Thu Mar 3 12:38:15 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y: Add precedence specification for START_DECLARATOR.
+ (type_quals): Move before primary.
+ (typename): Move before typed_declspecs, add 'typespec absdcl1' rule.
+
+ * decl2.c (grokoptypename): Lose.
+
+ * decl.c (grokdeclarator): Parse TYPE_EXPRs in the initial scan,
+ rather than waiting until later.
+
+Wed Mar 2 14:12:23 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (unary_expr): Use 'typename' in 'new' rules, rather
+ than expanding it inline.
+ (typename): Expand empty option of (former) absdcl inline.
+ (abs_or_notype_decl): Likewise.
+ (absdcl): Lose empty rule.
+ (conversion_declarator): New nonterminal for 'typename' of 'operator
+ typename'.
+ (operator_name): Use it instead of absdcl.
+
+ * parse.y: Add precedence declarations for SCOPED_TYPENAME,
+ TYPEOF, and SIGOF.
+ (typed_declspecs): Accept typed_typespecs, rather than typespec
+ directly. Add rules with reserved_typespecquals.
+ (reserved_declspecs): Don't accept typespecqual_reserved at the
+ beginning of the list. The typed_declspecs rule will deal with this
+ omission.
+ (declmods): Accept nonempty_type_quals, rather than TYPE_QUAL
+ directly.
+
+ * parse.y (direct_notype_declarator,
+ direct_after_type_declarator, direct_abstract_declarator): Split up
+ the declarator1 nonterminals to match the draft standard and avoid
+ ambiguities.
+ (new_type_id, new_declarator, direct_new_declarator,
+ new_member_declarator): New nonterminals to implement the subset of
+ 'typename' allowed in new expressions.
+ (unary_expr): Use new_type_id instead of typename.
+ (after_type_declarator1, absdcl1): Fix semantics of member pointers.
+ (abs_member_declarator, after_type_member_declarator): Lose.
+
+ * parse.y (absdcl1): Don't require parens around
+ abs_member_declarator.
+ (abs_member_declarator): Lose see_typename from rules.
+ (after_type_member_declarator): Likewise.
+
+ * tree.c (get_identifier_list): New function, containing code
+ previously duplicated in get_decl_list and list_hash_lookup_or_cons.
+ (get_decl_list): Use it.
+ (list_hash_lookup_or_cons): Likewise.
+
+ * parse.y (typed_declspecs, declmods): It's not necessary to hash
+ the declspecs on class_obstack, so don't. This way typed_typespecs
+ can reduce to typed_declspecs.
+
+Wed Mar 2 14:29:18 1994 Jason Merrill <jason@cygnus.com>
+
+ * cvt.c (build_up_reference): If we aren't checking visibility,
+ also allow base->derived conversions.
+
+Mon Feb 28 15:14:29 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * typeck.c (build_c_cast): Remove bogus hack when converting
+ to a reference type.
+
+ * cp-tree.h (lang_decl::vbase_init_list, DECL_VBASE_INIT_LIST):
+ Removed, not used.
+ (lang_stype::methods, lang_decl::next_method): New fields.
+ (CLASSTYPE_METHODS, DECL_NEXT_METHOD): New macros.
+ * decl.c (duplicate_decls): Preserve DECL_NEXT_METHOD.
+
+ * cp-tree.h, decl2.c (flag_vtable_hack): New flag.
+ * decl2.c (finish_vtable_vardecl): If flag_vtable_hack,
+ and !CLASSTYPE_INTERFACE_KNOWN, try to use the presence of
+ a non-inline virtual function to control emitting of vtables.
+ * class.c (finish_struct): Build CLASSTYPE_METHODS list.
+ * search.c (build_vbase_vtables_init): Don't assemble_external
+ (yet) if flag_vtable_hack.
+ * class.c (build_vfn_ref): Likewise.
+
+Mon Feb 28 14:54:13 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (component_decl): Don't include "typed_declspecs
+ declarator ';'" speedup, since it breaks enums.
+
+Fri Feb 25 15:43:44 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * class.c (finish_struct): Minor optimization for building
+ fn_fields list.
+
+Fri Feb 25 15:23:42 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (start_function): Fix detection of function overloading.
+
+Thu Feb 24 22:26:19 1994 Mike Stump <mrs@cygnus.com>
+
+ * lex.c (check_newline): #pragma interface can take a string
+ argument, just like #pragma implementation. #pragma implementation
+ checks for garbage on the line, line #pragma interface does. Main
+ input files do not auto implement like named files, #pragma
+ implementation must be used explicitly.
+
+Thu Feb 24 17:09:01 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y (components): Handle list of one again.
+ (notype_components): Likewise.
+ (after_type_declarator1): Take maybe_raises out again.
+
+ * gxxint.texi (Parser): Document additional r/r conflict.
+
+Wed Feb 23 14:42:55 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * gxxint.texi (Parser): Add node.
+
+ * Makefile.in (stamp-parse): Update expected conflict count.
+
+ * parse.y (various): Replace "declmods declarator" with "declmods
+ notype_declarator". The comment saying that "declmods declarator ';'"
+ corresponds to "int i;" was wrong; it corresponds to "const i;".
+ (component_decl): Add "typed_declspecs declarator ';'" rule; this
+ *does* correspond to "int i;". Change "declmods components" to
+ "declmods notype_components".
+ (components): Don't deal with a list of one anymore.
+ (notype_components): New nonterminal, corresponds to notype_declarator.
+ ({after_,no}type_component_decl{,0}): More new nonterminals.
+ ({after_,no}type_declarator): Fold in START_DECLARATOR token.
+ Eliminates four reduce/reduce conflicts.
+
+ (expr): Depend on nontrivial_exprlist instead of nonnull_exprlist.
+ (nontrivial_exprlist): New nonterminal: A list of at least two
+ expr_no_commas's.
+ (nonnull_exprlist): Depend on nontrival_exprlist.
+ Eliminates four reduce/reduce conflicts.
+
+ (named_class_head): Move intermediate code block into separate
+ nonterminal so that we can stick %prec EMPTY on it.
+
+ Add more %prec EMPTY's to eliminate remaining shift/reduce
+ conflicts.
+
+ (after_type_declarator): Add maybe_raises to fndecl rules.
+ (after_type_declarator_no_typename): Remove.
+ For correctness.
+
+ Document remaining reduce/reduce conflicts.
+
+Tue Feb 22 12:10:32 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * search.c (get_base_distance): Only bash BINFO_INHERITANCE_CHAIN
+ (TYPE_BINFO (type)) if we care about the path.
+
+ * tree.c (lvalue_p): A COND_EXPR is an lvalue if both of the
+ options are.
+
+Mon Feb 21 19:59:40 1994 Mike Stump <mrs@cygnus.com>
+
+ * Makefile.in (mostlyclean): lex.c is a source file, don't
+ remove.
+
+Sat Feb 19 01:27:14 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * parse.y: Eliminate 20 shift/reduce conflicts.
+
+Fri Feb 18 11:49:42 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * pt.c (type_unification): Add subr argument; if set, it means
+ that we are calling ourselves recursively, so a partial match is OK.
+ (unify): Support pointers to methods and functions.
+ (tsubst): Support method pointers.
+ * decl.c (build_ptrmemfunc_type): No longer static, so that
+ tsubst can get at it.
+
+ * init.c (is_aggr_typedef): Pretend template type parms are
+ aggregates.
+ * decl2.c (build_push_scope): If cname refers to a template type
+ parm, just grin and nod.
+
+ * call.c (build_overload_call_real): Pass subr argument to
+ type_unification.
+ * pt.c (do_function_instantiation): Likewise.
+ * class.c (instantiate_type): Likewise.
+
+ * search.c (get_base_distance): If BINFO is a binfo, use it and
+ don't mess with its BINFO_INHERITANCE_CHAIN.
+
+ * cvt.c (convert_to_reference): Fix temporary generation.
+ If ambiguous, return error_mark_node.
+
+ * init.c (build_new): Put back some necessary code.
+
+Thu Feb 17 15:39:47 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * init.c (build_new): Deal with array types properly.
+
+ * search.c (get_binfo): Become a shell for get_base_distance.
+ (get_binfo_recursive): Lose.
+ (get_base_distance_recursive): Find the path to the via_virtual base
+ that provides the most access.
+ (get_base_distance): Likewise.
+
+ * parse.y (explicit_instantiation): Syntax is 'template class
+ A<int>', not 'template A<int>'.
+
+ * typeck.c (convert_for_initialization): Remove bogus warning.
+
+ * parse.y (datadef): Revert patch of Oct 27.
+
+Thu Feb 17 15:12:29 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * class.c (build_vfn_ref): Cast delta field to ptrdiff_type_node,
+ rather than integer_type_node. Does wonders for the Alpha.
+
+Thu Feb 17 13:36:21 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (build_ptrmemfunc_type): Make sure that the pmf type
+ goes onto the same obstack as its target type.
+
+Wed Feb 16 00:34:46 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cvt.c (convert_to_reference): If converting via constructor
+ on local level, go back to build_cplus_new approach.
+
+ * tree.c (build_cplus_new): If with_cleanup_p, set cleanup slot
+ to error_mark_node to prevent expand_expr from building a cleanup
+ for this variable.
+
+ * lex.c (default_assign_ref_body): Return *this from the memcpy
+ version, too.
+
+ * decl.c (grok_reference_init): Just return if called with
+ error_mark_node, don't worry about initializing non-const reference
+ with temporary.
+
+ * cvt.c (convert_to_reference): Do the right thing for
+ non-aggregate reference conversions, pedwarn when generating a
+ non-const reference to a temporary.
+
+ * class.c (finish_struct): TYPE_HAS_COMPLEX_{INIT,ASSIGN}_REF and
+ TYPE_NEEDS_CONSTRUCTING all depend on TYPE_USES_VIRTUAL_BASECLASSES
+ again.
+
+Tue Feb 15 19:47:19 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grok_reference_init): Pawn off a lot of the work on
+ convert_to_reference. Generally do the right thing.
+
+ * cvt.c (convert_to_reference): Conform to the initial comment;
+ i.e. don't create temps if decl != error_mark_node. Handle
+ cleanups better for temps that do get created. Don't pretend
+ that we can use an 'A' to initialize a 'const double &' just by
+ tacking on a NOP_EXPR. Support LOOKUP_SPECULATIVELY.
+
+ * call.c (build_method_call): Set TREE_HAS_CONSTRUCTOR on
+ constructor calls.
+
+Mon Feb 14 14:50:17 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grok_reference_init): Make a temporary for initializing
+ const reference from constant expression.
+
+Mon Feb 14 11:31:31 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * cp-tree.h, decl.c (set_identifier_local_value): Deleted function.
+ * decl.c (pushdecl): Define decl in correct binding_level
+ (which isn't always the inner_binding_level).
+
+ * cvt.c (build_up_reference): Don't ever call expand_aggr_init.
+ It's ugly, and I don't think it's the right thing to do.
+
+ * cp-tree.h, class.c, decl.c, decl2.c, sp/search.c:
+ Remove NEW_CLASS_SCOPING, assuming it is always 1.
+ * decl.c (pop_decl_level): Removed; manually inlined.
+
+Sun Feb 13 19:04:56 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * class.h (candidate): Add basetypes field.
+
+ * call.c (build_method_call): Do access checking after choosing a
+ function, not before.
+
+ * Makefile.in (cvt.o, call.o, method.o): Depend on class.h.
+ (mostlyclean): Remove ../cc1plus.
+
+Fri Feb 11 11:52:26 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * class.c (finish_struct): Don't allow adjusting access to a field
+ of a base class if a local field has the same name.
+
+ * error.c (dump_type_prefix): Output basetype for METHOD_TYPEs.
+
+Thu Jan 13 17:55:51 1994 Gnanasekaran Swaminathan <gs4t@virginia.edu>
+
+ * cp-tree.h (DESTRUCTOR_NAME_P): Do not confuse AUTO_TEMP names
+ with destructor names when either NO_DOLLAR_IN_LABEL or
+ NO_DOT_IN_LABEL are not defined.
+
+ Now `template <class T, T f(T&), const T*> class A {...}' works.
+
+ * pt.c (grok_template_type): Substitute template parm types
+ with actual types in complex type as well.
+ (coerce_template_parms): Update the grok_template_type ()
+ function call.
+
+ * pt.c (tsubst): Traverse method list using DECL_CHAIN.
+
+ * decl.c (grok_op_properties): Allow operator++/-- to have
+ default arguments.
+
+ * typeck2.c (store_init_value): Don't abort when called to
+ initialize a type that needs constructing with a CONSTRUCTOR.
+
+ * init.c (expand_aggr_init_1, CONSTRUCTOR case): If
+ store_init_value fails, build and expand an INIT_EXPR. If
+ store_init_value succeeds, call expand_decl_init.
+
+Fri Feb 11 02:49:23 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (build_vbase_path): Use complete_type_p instead of
+ resolves_to_fixed_type_p to determine if the virtual bases are in
+ their right place for the type of expr. Cures problem of thinking a
+ virtual base class is one place, when it is in fact someplace else.
+
+Fri Feb 11 00:26:46 1994 Mike Stump <mrs@cygnus.com>
+
+ * init.c (resolve_offset_ref): Make sure we first convert to
+ intermediate type, if given, when dealing with members off `this'.
+ Solves an incorrrect `type `foo' is not a base type for type
+ `multiple'' when it is infact, a base type.
+
+Thu Feb 10 21:49:35 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (modify_other_vtable_entries): Use get_binfo, instead
+ of binfo_value. Solves problem with compiler giving a `base class
+ `B' ambiguous in binfo_value (compiler error)' on complex MI
+ herarchies, when a virtual function is first defied in a virtual
+ base class.
+
+Thu Feb 10 17:19:32 1994 Mike Stump <mrs@cygnus.com>
+
+ * class.c (build_vbase_path): Don't complain about ambiguous
+ intermediate conversion when converting down to a virtual base
+ class, even if they might seem to be ambiguous.
+
+Thu Feb 10 12:18:26 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck2.c (build_functional_cast): #if 0 out constructor
+ inheritance code, improve error messages.
+
+ * class.c (finish_base_struct): Complain about base with only
+ non-default constructors in derived class with no constructors.
+
+ * decl.c (grokdeclarator): Fix detection of virtual new/delete.
+
+Wed Feb 9 22:02:32 1994 Mike Stump <mrs@cygnus.com>
+
+ * search.c (build_mi_virtuals, add_mi_virtuals,
+ report_ambiguous_mi_virtuals): Removed unneeded code.
+ * class.c (finish_struct_bits): Likewise.
+
+Wed Feb 9 11:27:17 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * pt.c (end_template_instantiation): Push decl before
+ pop_from_top_level.
+
+ * typeck2.c (build_m_component_ref): Make sure datum is of
+ aggregate type.
+
+ * init.c (get_type_value): New function, returns
+ IDENTIFIER_TYPE_VALUE or IDENTIFIER_CLASS_TYPE_VALUE or NULL_TREE.
+
+ * call.c (build_method_call): Don't die on call to destructor for
+ non-type.
+
+ * decl.c (grokdeclarator): Complain about virtual op new and op
+ delete, make static virtuals unvirtual instead of unstatic.
+
+ * typeck.c (build_c_cast): Also call default_conversion on
+ methods.
+
+ * decl.c (grokdeclarator): Don't complain about anonymous
+ bitfields.
+
+ * parse.y (simple_stmt, for loops): Move the continue point after
+ the cleanups.
+
+ * class.c (finish_struct): Fix setting of
+ TYPE_HAS_COMPLEX_INIT_REF.
+
+Tue Feb 8 13:21:40 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * init.c (build_new): Deal with `new double (1)'.
+
+ * class.c (finish_struct): TYPE_HAS_COMPLEX_*_REF are supersets of
+ TYPE_HAS_REAL_*_REF, but TYPE_HAS_COMPLEX_INIT_REF is independent of
+ TYPE_NEEDS_CONSTRUCTING.
+
+ * decl.c (duplicate_decls): Propagate access decls.
+
+ * typeck2.c (process_init_constructor): Accept empty_init_node
+ for initializing unions.
+
+ * class.c, lex.c, cp-tree.h: Use
+ TYPE_HAS_COMPLEX_ASSIGN_REF where TYPE_HAS_REAL_ASSIGN_REF was used
+ before, use TYPE_HAS_COMPLEX_INIT_REF for TYPE_NEEDS_CONSTRUCTING in
+ some places.
+
+ * decl.c (finish_decl): Don't complain about uninitialized const
+ if it was initialized before.
+
+Mon Feb 7 18:12:34 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * lex.c (default_assign_ref_body): Don't deal with vbases for
+ now.
+
+ * decl.c (finish_decl): Fix reversed logic for objects and other
+ things that need to be constructed but have no initializer.
+
+ * class.c (finish_struct): Don't set TYPE_HAS_* flags that are
+ set by grok_op_properties or finish_decl.
+
+ * decl.c: Don't warn about extern redeclared inline unless
+ -Wextern-inline is given.
+ * decl2.c (lang_decode_option): Likewise.
+ * cp-tree.h: Likewise.
+
+Mon Feb 7 17:29:24 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * decl.c (pushdecl_with_scope): Fix thinko. Add forward
+ declaration.
+
+ * decl.c (pushdecl_with_scope): New function.
+ * decl.c (pushdecl_top_level): Use new function.
+ * decl.c (pushtag): Initialize newdecl.
+ * decl.c (pushtag): Push new type decl into correct scope.
+
+Mon Feb 7 14:42:03 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c, cvt.c, init.c, search.c, cp-tree.h:
+ Eradicate LOOKUP_PROTECTED_OK.
+
+Mon Feb 7 13:57:19 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * decl.c (pushtag, xref_tag), cp-tree.h: Add extra parameter
+ 'globalize' to signify implicit declarations.
+ * decl.c (globalize_nested_type, maybe_globalize_type): Removed.
+ * decl.c (set_identifier_type_value_with_scope): New function.
+ * decl.c (set_identifier_local_value): Simplify.
+ * spew.c (yylex, do_addr): Modify to return a _DEFN if a
+ forward declaration (followed by ';' and not preceded by 'friend').
+ * class.c, decl.c, except.c, init.c, parse.y,
+ pt.c, search.c: Add new argument to calls to xref_tag and
+ pushtag.
+
+Mon Feb 7 00:22:59 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-tree.h (ACCESSIBLY_UNIQUELY_DERIVED_P): New macro, means what
+ ACCESSIBLY_DERIVED_FROM_P meant before.
+ (ACCESSIBLY_DERIVED_FROM_P): Now disregards ambiguity.
+
+ * cvt.c (build_up_reference): Call get_binfo with PROTECT == 1.
+
+ * search.c (get_base_distance_recursive): Members and friends of
+ a class X can implicitly convert an X* to a pointer to a private or
+ protected immediate base class of X.
+ (get_binfo_recursive): Likewise.
+ (get_base_distance): Ignore ambiguity if PROTECT < 0.
+ (get_binfo): Lose multiple values of PROTECT.
+ (compute_access): Protected is OK if the start of the
+ search is an accessible base class of current_class_type.
+
+ * method.c (build_opfncall): Do check access on operator new here.
+
+ * decl.c (finish_function): Don't check access on operator new
+ here.
+
+Sun Feb 6 14:06:58 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (xref_tag): The base of a derived struct is NOT always
+ public. Duh.
+
+ * pt.c (do_explicit_instantiation): New function, called from
+ parser to do explicit function instantiation.
+ (type_unification): Allow the args list to be terminated with
+ void_list_node.
+ (do_pending_expansions): Look at i->interface for non-member
+ templates.
+
+ * parse.y (datadef): Move explicit_instantiation here.
+ (structsp): From here.
+ (datadef): Complain about `int;'.
+
+Sun Feb 6 12:33:18 1994 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * pt.c (end_template_instantiation), cp-tree.h: Remove unused
+ second parameter, and simplify first from a TREE_LIST where
+ we only care about its TREE_VALUE to just the value (an IDENTIFIER).
+ * pt.c (instantiate_member_templates): Simplify argument list
+ from a TREE_LIST to just an IDENTIFIER.
+ * lex.c (yyprint): PRE_PARSED_CLASS_DECL is now just an IDENTIFIER.
+ * parse.y (template_instantiate_once): Simplify accordingly.
+ * decl.c (inner_binding_level): New. Use various places to
+ simplify.
+
+Sun Feb 6 02:49:37 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck2.c (build_functional_cast): int() -> int(0).
+
+Sat Feb 5 00:53:21 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * class.c (finish_struct): Don't do a bitwise copy for op= if the
+ class has a virtual function table.
+
+ * typeck.c (convert_for_initialization): Restore warnings about
+ not using defined op=. Should really be my_friendly_aborts, I
+ s'pose.
+
+Fri Feb 4 14:21:00 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * class.c (finish_struct): Tidy up conditions for doing bitwise
+ copies of objects.
+
+ * decl.c (build_default_constructor): #if 0 out.
+
+ * *: Eradicate TYPE_GETS_{ASSIGNMENT,ASSIGN_REF,CONST_ASSIGN_REF,
+ CONST_INIT_REF}, TYPE_HAS_REAL_CONSTRUCTOR.
+
+ * decl.c (grokdeclarator): Don't return void_type_node for
+ friends being defined here.
+
+ * init.c (perform_member_init): Only do the init if it's useful.
+
+ * lex.c (default_copy_constructor_body): If we don't need to do
+ memberwise init, just call __builtin_memcpy.
+ (default_assign_ref_body): Likewise.
+
+ * decl.c (grokdeclarator): If friendp && virtualp, friendp = 0.
+
+Fri Feb 4 13:02:56 1994 Mike Stump <mrs@cygnus.com>
+
+ * lex.c (reinit_parse_for_method, cons_up_default_function):
+ Don't give warn_if_unknown_interface warning when it came from a
+ system header file.
+ * pt.c (end_template_decl, instantiate_template): Likewise.
+ * decl.c (start_decl): Likewise.
+
+Fri Feb 4 00:41:21 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grokdeclarator): Don't try to set TYPE_WAS_ANONYMOUS on
+ enums.
+
+ * decl2.c (constructor_name_full): Use IS_AGGR_TYPE_CODE instead of
+ IS_AGGR_TYPE, since we don't know it's a type.
+
+Thu Feb 3 11:36:46 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grokdeclarator): Don't complain about anonymous unions.
+
+ * cp-tree.h (TYPE_WAS_ANONYMOUS): This struct was originally
+ anonymous, but had a name given to it by a typedef.
+
+ * decl.c (grokdeclarator): When renaming an anonymous struct, set
+ TYPE_WAS_ANONYMOUS.
+
+ * decl2.c (constructor_name_full): Use TYPE_WAS_ANONYMOUS.
+
+ * cp-tree.h (DECL_UNDEFINED_FRIENDS): #if 0 out.
+
+ * init.c (xref_friend): Don't set up DECL_UNDEFINED_FRIENDS.
+ (embrace_waiting_friends): Don't use DECL_UNDEFINED_FRIENDS.
+
+ * decl.c (grokdeclarator): Set TYPE_NESTED_NAME properly on nested
+ anonymous structs that get typedef'd.
+
+ * decl.c (grokdeclarator): Always return void_type_node for
+ friends.
+
+ * error.c (dump_function_decl): Don't use DECL_CLASS_CONTEXT for
+ friends.
+ (dump_function_decl): Don't print out default args for
+ a function used in an expression.
+
+ * decl.c (grokdeclarator): Give error on abstract declarator used
+ in an invalid context (i.e. `void (*)();').
+
+ * error.c (cp_line_of): Support _TYPE nodes.
+ (cp_file_of): Likewise.
+
+ * cvt.c (build_up_reference): Don't abort if passed a SAVE_EXPR;
+ it can happen for the RHS of an assignment stmt where the LHS is
+ a COND_EXPR.
+
+ * init.c (expand_aggr_init_1): Deal with bracketed initializer
+ lists properly.
+
+ * class.c (finish_struct): Deal with enumerators and typedefs
+ again.
+
+Wed Feb 2 11:30:22 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * class.c (finish_struct): Tidy up loop over fields.
+
+ * errfn.c (cp_thing): Don't advance twice after a format.
+
+ * class.c (finish_struct): Complain about needing a constructor
+ if a member has only non-default constructors, and don't try to
+ generate a default constructor.
+
+ * decl.c (finish_decl): Also do the constructor thing if
+ TYPE_NEEDS_CONSTRUCTING is set (for arrays).
+
+ * search.c (unuse_fields): New function: mark all fields in this
+ type unused.
+ (dfs_unuse_fields): Helper function.
+
+ * class.c (pushclass): If the new class is the same as the old
+ class, still unuse the fields.
+ (unuse_fields): Move to search.c.
+
+ * decl.c (grok_op_properties): Add friendp argument.
+ (grokfndecl): Pass it.
+ (start_method): Likewise.
+
+ * decl2.c (delete_sanity): Add use_global_delete parameter to catch
+ ::delete calls.
+
+ * parse.y (unary_expr): Pass new parameter to delete_sanity.
+
+ * lex.c (default_copy_constructor_body): Don't choke if the union
+ has no fields.
+ (default_assign_ref_body): Likewise.
+
+ * call.c (compute_conversion_costs_ansi): Do the right thing for
+ ellipsis matches.
+
+ * decl.c (push_to_top_level): Optimize.
+
+ * decl.c (start_function): Look for the lexical scope of a friend
+ in DECL_CLASS_CONTEXT.
+
+ * init.c (do_friend): Set DECL_CLASS_CONTEXT on global friends.
+
+Tue Feb 1 15:59:24 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-tree.h (TREE_GETS_PLACED_NEW): New macro.
+
+ * init.c (init_init_processing): Don't assign BIN/BID to the
+ IDENTIFIER_GLOBAL_VALUEs of their respective operators.
+ (build_new): Check TREE_GETS_PLACED_NEW.
+
+ * decl.c (grok_op_properties): Don't set TREE_GETS_NEW for a decl of
+ op new with placement, set TREE_GETS_PLACED_NEW.
+
+ * cp-tree.h (ANON_UNION_P): New macro. Applies to decls.
+
+ * class.c (finish_struct): Don't treat anonymous unions like
+ other aggregate members. Do synthesize methods for unions without
+ a name, since they may or may not be "anonymous unions".
+
+ * decl2.c (grok_x_components): Wipe out memory of synthesized methods
+ in anonymous unions.
+
+ * lex.c (default_copy_constructor_body): Support unions.
+ (default_assign_ref_body): Likewise.
+
+Mon Jan 31 12:07:30 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-tree.h: Fix documentation of LOOKUP_GLOBAL, add prototypes.
+
+ * error.c (args_as_string): New function (%A), like type_as_string
+ except NULL_TREE -> "..."
+
+ * call.c (build_overload_call_real): Fix for new overloading.
+
+ * decl.c (grok_op_properties): Set all of the TYPE_OVERLOADS_* flags
+ here.
+
+ * parse.y (operator_name): Instead of here.
+
+ * typeck2.c (build_functional_cast): Treat a TREE_LIST as a list
+ of functions.
+
+ * call.c (build_overload_call_real): Support LOOKUP_SPECULATIVELY.
+
+ * method.c (build_opfncall): Don't need to massage return value
+ any more, call build_overload_call with all flags.
+
+ * typeck.c (build_x_binary_op): Put back speculative call to
+ build_opfncall.
+ (build_x_unary_op): Likewise.
+ (build_x_conditional_expr): Likewise.
+
+Mon Jan 31 10:00:30 1994 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (build_type_conversion_1): Change call to pedwarn into
+ warning, and conditionalize upon warn_cast_qual.
+
+Fri Jan 28 11:48:15 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * search.c (lookup_field): If xbasetype is a binfo, copy it to
+ avoid clobbering its inheritance info.
+
+ * call.c (build_method_call): Don't overwrite basetype_path with
+ TYPE_BINFO (inst_ptr_basetype) if they have the same type.
+
+ * search.c (compute_access): Fix handling of protected inheritance
+ and friendship with the enclosing class.
+
+ * typeck2.c (store_init_value): Allow passing of TREE_CHAIN for
+ initialization of arbitrary variable.
+
+ * typeck2.c (build_functional_cast): Only try calling a method if
+ one exists.
+
+ * decl.c (grokdeclarator): Move handling of constructor syntax
+ initialization into first loop for generality.
+ (parmlist_is_random): Lose.
+
+ * lex.c (cons_up_default_function): Set TREE_PARMLIST on arguments
+ to default function.
+
+Thu Jan 27 19:26:51 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (grokparms): Abort if we get called with something we don't
+ expect.
+
+Thu Jan 27 17:37:25 1994 Mike Stump <mrs@cygnus.com>
+
+ * call.c (build_overload_call_real): Change argument complain to
+ flags to match style of rest of code. Pass it down to
+ build_function_call_real as necessary.
+ * call.c (build_overload_call, build_overload_call_maybe): Change
+ argument complain to flags to match style of rest of code.
+ * cp-tree.h (build_function_call_real): Added fourth flags
+ argument.
+ * cvt.c (convert_to_reference): Only give warning messages, if
+ LOOKUP_COMPLAIN is set.
+ * typeck.c (build_x_function_call): Change simple complain
+ argument to build_overload_call_maybe and build_overload_call, to
+ LOOKUP_COMPLAIN to match style of rest of code.
+ * typeck2.c (build_functional_cast): Likewise.
+ * typeck.c (build_function_call_real): Add flags, so that we can
+ not complain, if we don't want to complain. Complain about
+ arguments, if we are complaining, otherwise don't.
+ * typeck.c (build_function_call, build_function_call_maybe):
+ Stick in flags argument.
+ * typeck.c (build_x_binary_op, build_x_unary_op,
+ build_x_conditional_expr, build_x_compound_expr): Follow style of
+ build_x_indirect_ref, as it is more correct and more common.
+
+Thu Jan 27 14:36:20 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (build_method_call): Don't check for being called with
+ a pointer.
+
+ * decl2.c (finish_file): Don't play with DECL_CLASS_CONTEXT for the
+ static initializer function.
+
+ * init.c (build_member_call): Use convert_force here, too.
+
+ * search.c (compute_access): Only treat static members specially
+ if they are referenced directly.
+
+Wed Jan 26 18:28:14 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * gxxint.texi (Access Control): New node.
+
+ * search.c (current_scope): New function; returns whichever of
+ current_class_type and current_function_decl is the most nested.
+ (compute_access): Total overhaul to make it clearer and more
+ correct. Don't use the cache for now; in the only situation where
+ it was used before, it gained nothing. This frees up three of the
+ DECL_LANG_FLAGs for possible other use!
+
+ * cp-tree.h: #if 0 out DECL_PUBLIC & friends.
+
+ * typeck.c (build_component_ref_1): Don't check DECL_PUBLIC.
+
+ * call.c (build_method_call): Use convert_force to cast `this' --
+ rely on the access checking for the method itself.
+
+ * init.c (is_friend): Do the nesting thing, handle types. I am
+ my own friend.
+ (is_friend_type): Become a shell for is_friend.
+ (add_friend): Never stick in ctype.
+ Why are the friendship functions in init.c, anyway?
+
+Wed Jan 26 17:50:00 1994 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (build_type_conversion_1): Don't conditionalize call to
+ pedwarn upon pedantic.
+
+Wed Jan 26 17:20:46 1994 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (convert_to_reference): Add 8.4.3 checking so that one
+ gets a warning if one tries to initialize a non-const & from a
+ non-lvalue.
+ * cvt.c (convert_to_reference): Use %P format for argument
+ numbers in warnings.
+
+Wed Jan 26 14:35:06 1994 Mike Stump <mrs@cygnus.com>
+
+ * init.c (build_delete): Follow style in call.c to construct the
+ virtual call to the desctructor, as that code is right. Fixes a
+ problem of the compiler saying a pointer conversion is ambiguous.
+
+Wed Jan 26 11:28:14 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-tree.h (VTABLE_NAME_P): Change other occurrence of
+ VTABLE_NAME_FORMAT to VTABLE_NAME.
+
+ * *: s/visibility/access/g
+
+Tue Jan 25 18:39:12 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_modify_expr): Don't smash references if INIT_EXPR.
+
+Tue Jan 25 13:54:29 1994 Mike Stump <mrs@cygnus.com>
+
+ * init.c (build_delete): Back out Jan 17th & 18th pacthes, as
+ they break libg++.
+
+Tue Jan 25 13:11:45 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * decl.c (duplicate_decls): Fix pointer arithmetic.
+
+Mon Jan 24 15:50:06 1994 Chip Salzenberg <chip@fin.uucp>
+
+ [ cp-* changes propagated from c-* changes in 940114 snapshot ]
+ * cp-parse.y (maybe_attribute): Allow multiple __attribute__
+ clauses on a declaration.
+
+Mon Jan 24 17:06:23 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * class.c (finish_struct): Do synthesize methods for anon
+ structs, just not unions.
+
+Mon Jan 24 13:50:13 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * decl.c (xref_tag): Handle anonymous nested type.
+ * decl.c (globalize_nested_type): Add no globalize bit check.
+ * spew.c (hack_more_ids): Templated nested decl not push top
+ level.
+
+ * parse.y: Get rid of 'goto do_components'. It is much better
+ for debugging.
+
+ * decl.c (is_anon_name): Get rid of the function and use the
+ macro ANON_AGGRNAME_P.
+ * pt.c: Ditto.
+
+Fri Jan 21 14:06:02 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * class.c (finish_struct): Don't synthesize any methods for
+ anonymous structs/unions.
+
+ * typeck.c (build_modify_expr): Don't treat pmf's as class objects.
+
+Thu Jan 20 18:56:46 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * method.c (build_opfncall): Call build_indirect_ref on
+ synthesized instance for operator delete.
+
+ * pt.c (type_unification): Don't abort if called with a list of
+ types in ARGS.
+
+ * class.c (instantiate_type): Deal with function templates.
+
+Thu Jan 20 16:55:35 1994 Jim Wilson <wilson@sphagnum.cygnus.com>
+
+ * Makefile.in (CC): Default to cc not gcc.
+
+Thu Jan 20 13:47:54 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_modify_expr): Call constructor if appropriate.
+
+ * decl.c (push_to_top_level): Clear out class-level bindings cache.
+
+Wed Jan 19 13:51:22 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * call.c (resolve_scope_to_name): Work recursively (previously only
+ looked down one level).
+
+ * lex.c (do_pending_inlines): If we're still dealing with the last
+ batch of inlines, don't start working on a new one.
+
+ * Makefile.in (stamp-parse): Update conflict count.
+ (TAGS): Fix.
+
+ * parse.y (explicit_instantiation): New rule; implements
+ 'template A<int>' syntax (though not 'template foo(int)' yet).
+ (structsp): Add explicit_instantiation.
+
+Tue Jan 18 13:53:05 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * class.c (finish_struct, etc.): Simplify decision to synthesize
+ a destructor.
+
+ * call.c, class.c, cp-tree.h, decl.c, init.c,
+ ptree.c, search.c, typeck.c, typeck2.c: Nuke
+ TYPE_NEEDS_CONSTRUCTOR (change all calls to TYPE_NEEDS_CONSTRUCTING).
+ * init.c (expand_aggr_init_1): Don't try non-constructor methods
+ of initializing objects.
+ (build_new): Don't try other methods if the constructor lookup fails.
+
+ * class.c (finish_base_struct): Set cant_have_default_ctor and
+ cant_synth_copy_ctor properly.
+ (finish_struct): Likewise.
+
+Mon Jan 17 13:58:18 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * typeck.c (build_modify_expr_1): #if 0 out again.
+ (build_modify_expr): #if 0 out memberwise init code again.
+
+ * lex.c (default_copy_constructor_body): Be const-correct.
+ (default_assign_ref_body): Likewise.
+
+ * init.c (perform_member_init): Use TYPE_HAS_CONSTRUCTOR to decide
+ whether or not to use it, rather than TYPE_NEEDS_CONSTRUCTING.
+ (expand_aggr_init): Disable silent conversion from initializer list
+ to list of args for a constructor.
+
+ * class.c (base_info): Lose needs_default_ctor.
+ (finish_base_struct): Likewise.
+ (finish_struct): Likewise.
+
+ * decl.c (init_decl_processing): Don't turn off flag_default_inline
+ just because flag_no_inline is on.
+ (finish_decl): Use TYPE_HAS_CONSTRUCTOR to decide to use
+ constructor.
+
+ * class.c (finish_struct): Synthesize default ctor whenever
+ allowed.
+
+ * Makefile.in (TAGS): Don't try to run etags on cp-parse.y.
+
+Sat Jan 15 18:34:33 1994 Mike Stump <mrs@cygnus.com>
+
+ * Makefile.in, configure: Handle the C++ front-end in a
+ subdirectory.
+ * cp-*: Move C++ front-end to cp/*.
+
+Fri Jan 14 14:09:37 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-typeck.c (build_function_call_real): Modify to match other
+ instances of taking the address of the function.
+
+ * cp-class.c (finish_struct): Set TYPE_HAS_REAL_CONSTRUCTOR to 1 if
+ there are non-synthesized constructors.
+ Only set TYPE_NEEDS_CONSTRUCTOR if TYPE_HAS_REAL_CONSTRUCTOR.
+ Always generate copy constructor if possible.
+
+ * cp-tree.h (lang_type): Add has_real_constructor bitfield.
+ (TYPE_HAS_REAL_CONSTRUCTOR): Define.
+
+ * cp-lex.c (default_copy_constructor_body): Use init syntax
+ for all bases.
+
+ * cp-type2.c (store_init_value): Only give error for initializer list
+ if TYPE_HAS_REAL_CONSTRUCTOR.
+
+Thu Jan 13 15:38:29 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-tree.h (DECL_SYNTHESIZED): Add defn.
+ (lang_decl): Add synthesized bitfield to decl_flags.
+
+ * cp-lex.c (cons_up_default_function): Use DECL_SYNTHESIZED to mark
+ artificial methods, rather than a line # of 0.
+
+Fri Jan 14 18:25:29 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * cp-decl (xref_tag): Fix a bug in conflict type.
+ * cp-parse.y: Add SCOPED_NAME for uninstantiated template nested
+ type reference.
+ * cp-spew.c (yylex): Generated SCOPED_NAME token.
+ * cp-lex.c (yyprint): Handle SCOPED_NAME.
+
+Fri Jan 14 17:00:29 1994 Mike Stump <mrs@cygnus.com>
+
+ * cp-decl.c (pushdecl): Revert patch from Jan 11 19:33:03, as it is
+ not right.
+
+Thu Jan 13 14:00:35 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * cp-decl2.c (grok_x_components): Fix a bug that enum type does not
+ have type_flags.
+
+Thu Jan 13 11:39:34 1994 Mike Stump <mrs@cygnus.com>
+
+ Ensure that all vtable pointers are initialized with all the right
+ values.
+
+ * cp-class.c (is_normal): Changed to reflect new meaning of
+ CLASSTYPE_VFIELD_PARENT.
+ * cp-class.c (maybe_fixup_vptrs): Use of
+ CLASSTYPE_NEEDS_VIRTUAL_REINIT here is misguided. Use
+ BINFO_MODIFIED instead.
+ * cp-class.c (finish_struct): Changed to reflect new meaning of
+ CLASSTYPE_VFIELD_PARENT.
+ * cp-decl.c (get_binfo_from_vfield): Removed, unneeded now.
+ * cp-decl.c (finish_function): Use init_vtbl_ptrs, instead of open
+ coding it here.
+ * cp-init.c (init_vfields): Changed name to init_vtbl_ptrs, and
+ re-implement.
+ * cp-init.c (emit_base_init): Use new name init_vtbl_ptrs.
+ * cp-tree.h (vfield_parent): Changed to integer.
+ * cp-tree.h (CLASSTYPE_VFIELD_PARENT): Changed docs to reflect new
+ meaning.
+ * cp-tree.h (init_vtbl_ptrs): Added init_vtbl_ptrs.
+
+Wed Jan 12 18:24:16 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * cp-decl.c (xref_tag): Re-implement globalize nested type.
+ * cp-decl2.c (grok_x_components): Ditto.
+ * cp-parse.y: Ditto.
+ * cp-tree.h (lang_type): Add no_globalize bit in type_flags.
+
+Wed Jan 12 14:08:09 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-decl.c (grokdeclarator): Don't set TREE_PUBLIC on friend
+ decls with a definition attached.
+
+ * cp-typeck.c (build_modify_expr): Undo previous change in the case
+ of INIT_EXPRs.
+
+Tue Jan 11 19:33:03 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-typeck.c (build_modify_expr): Replace code for generating
+ assignment semantics for classes with an error.
+ (build_modify_expr_1): #if 0 out.
+
+ * cp-decl.c (pushdecl): Patch bogus design of pushdecl
+ behavior for overloaded functions (it doesn't push anything).
+
+ * cp-class.c (finish_struct): When generating default op=,
+ set TYPE_HAS_ASSIGNMENT.
+
+Mon Jan 10 18:48:06 1994 Mike Stump <mrs@cygnus.com>
+
+ * cp-cvt.c (convert): Make {double, clashing enum} -> enum
+ invalid.
+ * cp-typeck.c (convert_for_assignment): Simplify.
+ * cp-decl2.c (warn_enum_clash): Removed.
+ * invoke.texi (-Wenum-clash): Removed.
+ * toplev.c (-Wenum-clash): Removed.
+
+Mon Jan 10 17:48:37 1994 Kung Hsu <kung@mexican.cygnus.com>
+
+ * cp-decl.c (finish_decl): Fix incorrect popclass call.
+
+ * cp-decl.c (is_anon_name): New function, check whether the name
+ is anonymous name generated by compiler.
+ * cp-decl.c (grokdeclarator): Allow nested SCOPE_REF
+ * cp-spew.c (hack_more_ids): Handle nested type in template.
+ * cp-parse.y: Handle nested type reference in uninstantiated
+ template.
+ * cp-call.c (build_method_call): Handle uninstantiated template
+ case.
+ * cp-pt.c (search_nested_type_in_tmpl): New function, search nested
+ type in template.
+ * cp-pt.c (lookup_nested_type_by_name): New function, lookup nested
+ type by name.
+ * cp-pt.c (tsubst): Handle nested type search by name.
+
+Mon Jan 10 14:32:18 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-init.c (build_member_call): Propagate qualifiers to new type.
+
+ * cp-call.c (build_method_call): Count functions the new way.
+
+Fri Jan 7 19:03:26 1994 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-decl.c (pushtag): Set DECL_ASSEMBLER_NAME for nested classes,
+ too.
+
+Tue Jan 4 16:45:51 1994 Kung Hsu <kung@cirdan.cygnus.com>
+
+ * cp-parse.y: Change to handle whether to globalize nested class.
+ * cp-decl.c (xref_tag, maybe_globalize_type): Likewise.
+
+Mon Jan 3 22:22:32 1994 Gerald Baumgartner <gb@cygnus.com>
+
+ * Makefile.in cp-call.c cp-class.c cp-cvt.c cp-decl.c cp-decl2.c
+ cp-error.c cp-init.c cp-lex.c cp-lex.h cp-method.c cp-parse.y
+ cp-spew.c cp-tree.c cp-tree.h cp-type2.c cp-typeck.c cp-xref.c
+ gplus.gperf toplev.c: Incorporated C++ signature extension.
+ * cp-sig.c: New file, contains most of signature processing.
+ * cp-hash.h: Regenerated from gplus.gperf.
+
+ * gcc.1 g++.1: Added explanation for the `-fhandle-signatures'
+ and `-fno-handle-signatures' command line flags.
+
+ * gcc.texi: Changed the last-modification date.
+ * invoke.texi: Added `-fhandle-signatures' in the list of
+ C++ language options. Added explanation for this option.
+
+Tue Dec 28 21:10:03 1993 Mike Stump <mrs@cygnus.com>
+
+ * cp-init.c (expand_vec_init): Remove comptypes test, as it is too
+ harsh here.
+
+Tue Dec 28 13:42:22 1993 Mike Stump <mrs@cygnus.com>
+
+ * cp-pt.c (do_pending_expansions): Decide to expand a template
+ member function, based upon it's class type, not the class type of
+ the first place it was declared.
+
+Tue Dec 28 05:42:31 1993 Mike Stump <mrs@cygnus.com>
+
+ * cp-class.c (is_normal): New routine, use to determine when the
+ given binfo is the normal one. (The one that should have the simple
+ vtable name.)
+ * cp-class.c (modify_other_vtable_entries): Use DECL_ASSEMBLER_NAME
+ to check if two fndecls are `the same'. Sometimes this routine can
+ modify the main vtable, and normal should be 1, in that case, so use
+ is_normal() to determine if this is the main vtable for the class.
+ Don't recurse down virtual bases, as they are shared, and we take
+ care of them elsewhere.
+ * cp-class.c (modify_vtable_entries): If we have already updated the
+ vtable with the new virtual, don't do it again.
+ * cp-class.c (finish_struct): Set CLASSTYPE_VFIELD_PARENT as
+ appropriate. Do virtual function overriding in virtual bases, after
+ normal overriding, so that the base function list in DECL_VINDEX is
+ not overridden, before we have a chance to run through the list.
+ Use DECL_ASSEMBLER_NAME to check if two fndecls are `the same'.
+ Make sure we pass the right address into modify_vtable_entries.
+ * cp-tree.h (CLASSTYPE_VFIELD_PARENT): New field to indicate which
+ binfo is the one that has the vtable that we based our vtable on.
+
+Fri Dec 24 09:40:52 1993 Michael Tiemann <tiemann@blues.cygnus.com>
+
+ * cp-typeck.c (c_expand_start_case): Use default_conversion to
+ convert expression from reference type if necessary.
+
+Wed Dec 22 17:58:43 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-typeck.c (build_unary_op): Make sure that it's a TREE_LIST before
+ trying to read its TREE_VALUE.
+
+ * cp-class.c (finish_struct_methods): Clear DECL_IN_AGGR_P here.
+ (finish_struct): Instead of here.
+
+Tue Dec 21 14:34:25 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-tree.c (list_hash_lookup_or_cons): Make sure the type doesn't
+ have TYPE_PTRMEMFUNC_P set before we try to build its
+ CLASSTYPE_ID_AS_LIST.
+ (get_decl_list): Likewise, when trying to read it.
+
+ * cp-tree.h (VTABLE_NAME): No def with NO_{DOLLAR,DOT} defined.
+ (VTABLE_NAME_P): Use it instead of VTABLE_NAME_FORMAT.
+
+Mon Dec 20 13:35:03 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-typeck.c (rationalize_conditional_expr): New function.
+ (unary_complex_lvalue): Use it.
+ (build_modify_expr): Use it, since trying to do an ADDR_EXPR of it
+ with build_unary_op won't cut it. Don't wrap the COND_EXPR with a
+ SAVE_EXPR either.
+
+ * cp-decl2.c (explicit_warn_return_type): Deleted variable.
+ (lang_decode_option): Set warn_return_type, not explicit_*, for
+ -Wreturn-type and -Wall. This is what rest_of_compilation uses to
+ decide if it should go into jump_optimize or not.
+ * cp-tree.h (explicit_warn_return_type): Deleted.
+ * cp-decl.c (grokdeclarator): Use warn_return_type, not explicit_*.
+ (finish_function): Also complain about no return in a non-void fn if
+ we're being pedantic (don't rely on use of -Wreturn-type).
+
+Fri Dec 17 15:45:46 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-decl.c (grokdeclarator): Forbid declaration of a function as
+ static if it's being done inside another function.
+
+ * cp-search.c (compute_visibility): Check for friendship both ways.
+
+Fri Dec 17 14:28:25 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-cvt.c (build_default_binary_type_conversion): Make error
+ messages more helpful.
+
+ * cp-error.c (op_as_string): New function, returns "operator =="
+ given EQ_EXPR or suchlike.
+
+Fri Dec 17 13:28:11 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-call.c (print_n_candidates): New function.
+ (build_overload_call_real): Use it when we complain about a call
+ being ambiguous.
+
+Fri Dec 17 12:41:17 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-call.c (build_method_call): Fix checking for static call
+ context.
+
+ * cp-method.c (build_opfncall): Call build_indirect_ref on argument
+ to operator new.
+
+ * cp-init.c (build_new): Don't mess with rval when building
+ indirect ref.
+
+Thu Dec 16 16:48:05 1993 Kung Hsu <kung@cirdan.cygnus.com>
+
+ * cp-lex.c (default_assign_ref_body): Add check when TYPE_NESTED_
+ NAME(type) may not be exist. It's not a problem for old compiler.
+
+Thu Dec 16 14:46:06 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-tree.h (CLASSTYPE_ALTERS_VISIBILITIES_P): Delete macro, it's
+ never used for anything.
+ (struct lang_type, member type_flags): Delete field
+ `alters_visibility', and up `dummy' by 1.
+ * cp-class.c (finish_base_struct): Delete code that copies the
+ setting of CLASSTYPE_ALTERS_VISIBILITIES_P.
+ (finish_struct): Delete code that sets it.
+
+Thu Dec 16 14:44:39 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-decl.c, cp-init.c, cp-typeck.c: Fix arguments to
+ build_method_call that I messed up before.
+
+ * cp-search.c (get_base_distance): If protect > 1, allow immediate
+ private base.
+
+ * cp-class.c (finish_base_struct): Set cant_synth_* correctly.
+ (finish_struct): Likewise. Well, nigh-correctly; it won't deal
+ properly with the case where a class contains an object of an
+ ambiguous base class which has a protected op=. Should be fixed
+ when the access control code gets overhauled.
+ (finish_struct_methods): Set TYPE_HAS_NONPUBLIC_* correctly.
+
+Thu Dec 16 12:17:06 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-lex.c (real_yylex): Turn the code back on that deals with
+ __FUNCTION__ and __PRETTY_FUNCTION__. Don't use lookup_name, to
+ avoid the ambiguity problems that led to it being turned off in the
+ first place.
+
+ * cp-method.c (hack_identifier): Also check for a TYPE_PTRMEMFUNC_P
+ to see if something is a method.
+
+Wed Dec 15 18:35:58 1993 Mike Stump <mrs@cygnus.com>
+
+ * cp-typeck.c (build_modify_expr): Avoid error messages on small
+ enum bit fields.
+ * cp-typeck.c (convert_for_assignment): Add missing argument to
+ cp_warning and cp_pedwarn calls.
+
+Wed Dec 15 18:25:32 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-parse.y (member_init): ANSI C++ doesn't forbid old-style base
+ initializers; it's just anachronistic.
+
+ * cp-decl.c (finish_decl): Don't require external-linkage arrays
+ to have a complete type at declaration time when pedantic.
+
+Tue Dec 14 11:37:23 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-decl.c (pushdecl): Don't set DECL_CONTEXT if it's already set.
+
+ * cp-call.c (build_method_call): Don't dereference pointer given
+ as instance.
+
+ * cp-decl.c (finish_function): Don't pass pointer to
+ build_method_call.
+ (finish_function): Likewise.
+
+ * cp-typeck.c (build_x_function_call): Likewise.
+
+ * cp-method.c (build_component_type_expr): Likewise.
+
+ * cp-init.c (build_member_call): Likewise.
+ (build_new): Likewise.
+
+Mon Dec 13 18:04:33 1993 Kung Hsu <kung@cirdan.cygnus.com>
+
+ * cp-decl.c (xref_tag): Fix regression created by changes made
+ in Dec. 7 1993.
+ * cp-decl.c (xref_defn_tag): Fix parallel nested class problem.
+
+Fri Dec 10 12:40:25 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-call.c (compute_conversion_costs_ansi) [DEBUG_MATCHING]: Print
+ out the final evaluation of the function, so we can see if ELLIPSIS,
+ USER, and EVIL were set at the end.
+
+ * cp-call.c (convert_harshness_ansi): When the parm isn't an lvalue,
+ only go for setting TRIVIAL_CODE if we are dealing with types that
+ are compatible.
+
+Thu Dec 9 18:27:22 1993 Mike Stump <mrs@cygnus.com>
+
+ * cp-decl.c (flag_huge_objects): New flag to allow large objects.
+ * toplev.c (lang_options): Likewise.
+ * cp-decl2.c (flag_huge_objects, lang_f_options): Likewise.
+ * cp-decl.c (delta_type_node): New type for delta entries.
+ * cp-tree.h (delta_type_node): Likewise.
+ * cp-decl.c (init_decl_processing): Setup delta_type_node.
+ * cp-decl.c (init_decl_processing, build_ptrmemfunc_type): Use
+ delta_type_node instead of short_integer_type_node.
+ * cp-class.c (build_vtable_entry): Likewise.
+
+Thu Dec 9 16:19:05 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-tree.h (OPERATOR_TYPENAME_P): Define outside of
+ NO_{DOLLAR,DOT} macro checks, so it always gets defined.
+ (VTABLE_NAME_P): Define for NO_DOT && NO_DOLLAR_IN_LABEL.
+
+Wed Dec 8 17:38:06 1993 Mike Stump <mrs@cygnus.com>
+
+ * cp-decl.c (finish_decl): Make sure things that can go into
+ "common", do go into common, if -fcommon is given.
+
+Wed Dec 8 13:01:54 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-call.c (print_harshness) [DEBUG_MATCHING]: New function.
+ (compute_conversion_costs_ansi) [DEBUG_MATCHING]: Print out
+ argument matching diagnostics to make instantly clear what the
+ compiler is doing.
+
+ * cp-call.c (convert_harshness_ansi): If the parm isn't an lvalue,
+ then check to see if the penalty was increased due to
+ signed/unsigned mismatch, and use a TRIVIAL_CODE if it wasn't.
+
+Tue Dec 7 18:29:14 1993 Kung Hsu <kung@cirdan.cygnus.com>
+
+ * cp-decl.c (xref_tag, pushtag): Fix nested class search/resolution
+ problem.
+
+Tue Dec 7 16:09:34 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-class.c (finish_struct): Before synthesizing methods, if no
+ methods have yet been declared then set nonprivate_method. Don't
+ set non_private method after synthesizing a method.
+
+ * cp-lex.c (extract_interface_info): If flag_alt_external_templates
+ is set, tie emitted code to the location of template instantiation,
+ rather than definition.
+
+ * cp-tree.h: Declare flag_alt_external_templates.
+
+ * cp-decl2.c (lang_decode_option): Support -falt-external-templates.
+
+ * toplev.c (lang_options): Likewise.
+
+Mon Oct 4 12:50:02 1993 Chip Salzenberg <chip@fin.uucp>
+
+ [changes propagated from 930810 snapshot]
+ * cp-decl.c (init_decl_processing): Make long long available for use
+ as SIZE_TYPE and PTRDIFF_TYPE.
+ (finish_decl): Allow file-scope static incomplete array.
+ (grokdeclarator): Don't pass on const and volatile fron function
+ value type to function type.
+ Warn here for volatile fn returning non-void type.
+ * cp-parse.y (attrib): Accept attributes `volatile' with alias
+ `noreturn', and `const'.
+ * cp-typeck.c (default_conversion): Don't lose const and volatile.
+ (build_binary_op_nodefault): Generate pedantic warning for comparison
+ of complete pointer type with incomplete pointer type.
+ (build_c_cast): Be careful that null pointer constant be INTEGER_CST.
+
+Tue Dec 7 10:46:48 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-init.c (expand_vec_init): When creating a temporary for copying
+ arrays, use the type of the source, not the target.
+
+ * cp-cvt.c (convert): Pass an argument for errtype to
+ convert_to_reference.
+
+ * cp-error.c (dump_expr, COMPONENT_REF & CALL_EXPR): Deal with
+ methods, -> and `this'.
+
+Mon Dec 6 17:12:33 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-error.c (parm_as_string): New function; returns `this' or arg
+ number. Corresponds to %P.
+ (dump_expr): Deal with method calls.
+
+ * cp-cvt.c (convert_to_reference): Stop using warn_for_assignment.
+ * cp-typeck.c (convert_for_assignment): Likewise.
+ (warn_for_assignment): Lose.
+
+Mon Dec 6 11:33:35 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-call.c (ideal_candidate_ansi): Delete code that was never
+ doing anything useful. Instead, sort once, and DO NOT wipe
+ out any codes with EVIL_CODE, since that's what we use as a
+ marker for the end of the list of candidates.
+
+ * cp-cvt.c (convert_to_aggr): Make sure to always set H_LEN.
+
+Mon Dec 6 12:49:17 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-init.c (get_aggr_from_typedef): New function, like
+ is_aggr_typedef but returns the _TYPE.
+
+ * cp-call.c, cp-init.c, cp-method.c: Eradicate err_name.
+
+Sun Dec 5 18:12:48 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-lex.c (readescape): Pedwarn when a hex escape is out of range.
+
+Thu Nov 25 23:50:19 1993 Chip Salzenberg <chip@fin.uucp>
+
+ Delay language context change until beginning of next decl.
+
+ * cp-lex.h (c_header_level): Removed.
+ (pending_lang_change): Declared.
+ * cp-lex.c (c_header_level): Renamed from in_c_header, made static.
+ (pending_lang_change): Defined.
+ (check_newline): Rework code that recognizes line number and
+ filename changes. Instead of pushing and popping lang context,
+ increment and decrement pending_lang_change.
+ (do_pending_lang_change): Push and pop lang context according
+ to value of pending_lang_change.
+ * cp-parse.y (extdefs): Use lang_extdef instead of extdef.
+ (extdef): Same as extdef, but call do_pending_lang_change() first.
+
+Mon Nov 15 15:39:15 1993 Chip Salzenberg <chip@fin.uucp>
+
+ * cp-typeck.c (build_binary_op_nodefault): Warn for ordered
+ compare of ptr with 0 only if pedantic in both cases.
+
+Thu Nov 25 13:31:37 1993 Chip Salzenberg <chip@fin.uucp>
+
+ Reinstate the below patch, which got lost in the Cygnus merge:
+ Tue Nov 23 13:59:24 1993 Hallvard B Furuseth (hbf@durin.uio.no)
+ * cp-parse.y (maybe_type_qual): Don't fail to set $$.
+
+Wed Nov 17 19:03:30 1993 Chip Salzenberg <chip@fin.uucp>
+
+ * cp-parse.y (attrib): Allow "ident(ident)" like the C front end.
+
+Fri Oct 22 20:43:37 1993 Paul Eggert <eggert@twinsun.com>
+
+ * cp-lex.c (real_yylex): Diagnose floating point constants
+ that are too large.
+
+Wed Nov 17 19:10:37 1993 Chip Salzenberg <chip@fin.uucp>
+
+ * cp-type2.c (build_functional_cast): ARM page 16: When a class
+ and an object, function or enumerator are declared in the same
+ scope with the same name, the class name is hidden.
+
+Wed Nov 17 19:07:18 1993 Chip Salzenberg <chip@fin.uucp>
+
+ * cp-call.c (convert_harshness_ansi): Distinguish float, double,
+ and long double from each other when overloading.
+ (compute_conversion_costs_{ansi,old}, build_method_call,
+ build_overlay_call_real, convert_to_aggr): Always set and
+ always use H_LEN member of candidate structure.
+
+Mon Oct 11 23:10:53 1993 Chip Salzenberg <chip@fin.uucp>
+
+ * cp-decl.c (duplicate_decls): Note redeclarations of library
+ functions, and generate distinct warnings for them.
+
+Mon Oct 4 12:26:49 1993 Chip Salzenberg <chip@fin.uucp>
+
+ Support format warnings in G++.
+
+ * cp-tree.h: Protect against multiple inclusion.
+ Declare all public functions in c-common.c (copy from c-tree.h).
+ (STDIO_PROTO): Define.
+ (warn_format): Declare.
+ (record_format_info): Remove declaration.
+ * cp-decl.c (init_decl_processing): Call init_function_format_info.
+ * cp-decl2.c (lang_decode_option): Make "-Wall" include warn_format.
+ * cp-typeck.c (build_function_call_real): Call check_function_format.
+ (record_format_info): Remove -- obsolete stub.
+
+Sat Jul 24 12:04:29 1993 Chip Salzenberg <chip@fin.uucp>
+
+ * cp-decl.c (duplicate_decls): Don't warn for non-extern var decl
+ following an extern one (for -Wredundant-decls).
+ * cp-parse.y (primary): In statement expression case, if compstmt
+ returns something other than a BLOCK, return it unchanged.
+
+Thu Dec 2 20:44:58 1993 Chip Salzenberg <chip@fin.uucp>
+
+ * cp-decl.c (warn_extern_redeclared_static): New function made
+ from code extracted from pushdecl.
+ (duplicate_decls, pushdecl): Call new function.
+ (lookup_name_current_level): Allow for IDENTIFIER_GLOBAL_VALUE
+ to be a TREE_LIST when function is declared in 'extern "C" {}'.
+
+Fri Dec 3 16:01:10 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-class.c (duplicate_tag_error): Use cp_error.
+ (finish_base_struct): Check for ambiguity with direct base, and don't
+ generate op= or copy ctor if it exists.
+
+Fri Dec 3 15:32:34 1993 Kung Hsu <kung@cirdan.cygnus.com>
+
+ * cp-init.c (expand_member_init): When initializer name is null,
+ don't try to build it now because emit_base_init will handle it.
+
+Fri Dec 3 12:28:59 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-lex.c (init_lex): Initialize input_filename to "<internal>" for
+ code such as ExceptionHandler::operator=.
+
+Fri Dec 3 10:32:08 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-decl.c (grokdeclarator): Don't try to print out dname when
+ complaining about arrays of references if decl_context==TYPENAME,
+ since it will be null.
+
+ * cp-decl2.c: Default to flag_ansi_overloading.
+
+Thu Dec 2 18:05:56 1993 Kung Hsu <kung@cirdan.cygnus.com>
+
+ * cp-call.c (build_method_call): Use binfo from instance if it's
+ different from binfo (basetype_path) passed from above.
+
+Wed Nov 17 19:14:29 1993 Chip Salzenberg <chip@fin.uucp>
+
+ cp-error.c (dump_expr): Use unsigned chars to output a
+ TREE_REAL_CST in hex.
+
+Thu Dec 2 11:05:48 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-class.c (finish_struct): Fix typo in setting
+ cant_synth_asn_ref.
+
+ * cp-tree.h (TYPE_NESTED_NAME): New macro, does
+ DECL_NESTED_TYPENAME (TYPE_NAME (NODE)).
+
+ * cp-lex.c (default_copy_constructor_body): Change
+ DECL_NAME (TYPE_NAME (btype)) to TYPE_NESTED_NAME (btype).
+ (default_assign_ref_body): Likewise.
+ (default_copy_constructor_body): Call operator= explicitly for
+ base classes that have no constructor.
+
+Thu Dec 2 10:47:15 1993 Michael Tiemann <tiemann@blues.cygnus.com>
+
+ * cp-call.c (build_method_call): If the instance variable is
+ converted to error_mark_node when we're trying to convert it to the
+ base type of a method we're looking up, return error_mark_node.
+
+Thu Dec 2 10:41:16 1993 Torbjorn Granlund <tege@cygnus.com>
+
+ * cp-typeck.c (build_binary_op_nodefault): In *_DIV_EXPR *_MOD_EXPR
+ cases, tests for unsigned operands by peeking inside a NOP_EXPR.
+
+Wed Dec 1 13:33:34 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-call.c (compute_conversion_costs_ansi): Use the size of struct
+ harshness_code, not the size of short, for clearing out the
+ ansi_harshness.
+
+ * cp-call.c (print_candidates): New function.
+ (build_method_call): When we had some candidates, but didn't get a
+ usable match, don't report that we got an error with the first
+ candidate. Instead, say there were no matches, and list the
+ candidates with print_candidates. In the second pass, make sure we
+ clear out ever_seen, so we can accurately count the number of
+ functions that qualified.
+
+Wed Dec 1 09:53:59 1993 Torbjorn Granlund <tege@cygnus.com>
+
+ * cp-typeck.c (build_binary_op_nodefault): Shorten for *_MOD_EXPR
+ only if op1 is known to be != -1.
+ (build_binary_op_nodefault): Handle *_DIV_EXPR likewise.
+
+Tue Nov 30 14:07:26 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-method.c (hack_identifier): If the field itself is private, and
+ not from a private base class, say so.
+
+Mon Nov 29 03:00:56 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-decl.c (grokdeclarator): Always warn on initialization of
+ const member.
+
+Wed Nov 24 00:49:35 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-class.c (finish_struct): Set TYPE_GETS_CONST_* properly.
+ (finish_base_struct): Set cant_synth_asn_ref properly.
+
+ * cp-lex.c (cons_up_default_function): Add section for operator=.
+ (default_assign_ref_body): New function, mostly cribbed from
+ default_copy_constructor_body.
+
+ * cp-class.c (base_info): Add members cant_synth_copy_ctor,
+ cant_synth_asn_ref, no_const_asn_ref.
+ (finish_base_struct): Update no_const_asn_ref, note that you should
+ update cant_synth_*, propagate TYPE_GETS_ASSIGN_REF.
+ (finish_struct): Add decls for cant_synth_*, no_const_asn_ref, and
+ initialize them properly. Set no_const_asn_ref properly. Set
+ cant_synth_* in some of the situations where they should be set.
+ Propagate TYPE_GETS_ASSIGN_REF. Use cant_synth_copy_ctor. Add call
+ to cons_up_default_function for operator=.
+
+Tue Nov 23 20:24:58 1993 Mike Stump <mrs@cygnus.com>
+
+ * cp-cvt.c (convert_force): Add code to perform casting of pointer
+ to member function types.
+ * cp-typeck.c (build_ptrmemfunc): Add FORCE parameter to indicate
+ when the conversion should be done, regardless.
+ * cp-tree.h (build_ptrmemfunc): Likewise.
+ * cp-type2.c (digest_init): Likewise.
+ * cp-typeck.c (convert_for_assignment): Likewise.
+
+Tue Nov 23 18:06:58 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-error.c (dump_expr): Do the right thing for variables of
+ reference type.
+
+ * cp-decl.c (grok_op_properties): Set TYPE_HAS_ASSIGN_REF
+ and its kin properly.
+ (xref_tag): Propagate TYPE_GETS_ASSIGN_REF.
+
+Tue Nov 23 12:26:13 1993 Mike Stump <mrs@cygnus.com>
+
+ * cp-method.c (build_opfncall): Don't count pointer to member
+ functions as aggregates here, as we don't want to look up methods in
+ them. The compiler would core dump if we did, as they don't have
+ normal names.
+ * cp-typeck.c (build_indirect_ref): Improve wording on error
+ message.
+
+Mon Nov 22 14:22:23 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-decl.c (grok_op_properties): Allow operator?: with pedwarn
+ (since it's supported in other compiler bits).
+
+ * cp-method.c (report_type_mismatch): Use cp_error; ignore err_name
+ argument.
+
+ * cp-error.c (dump_function_decl): Don't print return type for
+ constructors and destructors.
+
+ * cp-cvt.c (cp_convert_to_pointer): Import code from
+ convert_to_pointer so we can return error_mark_node in the case of an
+ error, and to allow more meaningful error messages.
+ (build_type_conversion): Don't go through void* when trying
+ to convert to a pointer type.
+
+ * cp-decl.c (grokfndecl): Move call to grok_op_properties back
+ after grokclassfn so that it's dealing with the right decl.
+ (grok_op_properties): Don't assert !methodp for op new and op delete.
+
+ * cp-init.c (build_delete): Don't use TYPE_BUILT_IN (there are now
+ no uses of it in the compiler).
+
+ * cp-call.c (build_scoped_method_call): Fix for destructors of simple
+ types.
+ (build_method_call): Likewise.
+
+Fri Nov 19 12:59:38 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-tree.c (count_functions): Abstraction function.
+
+ * cp-call.c (build_overload_call_real): Deal with new overloading
+ properly, remove dead code.
+
+ * gcc.c (default_compilers): Generate and use .ii files in the
+ intermediate stage of compiling C++ source.
+
+Fri Nov 19 11:26:09 1993 Jim Wilson <wilson@sphagnum.cygnus.com>
+
+ * cp-expr.c (cplus_expand_expr): Make call_target a valid memory
+ address before using it, so it can be later safely compared.
+
+Fri Nov 12 15:30:27 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-pt.c (tsubst): Deal with new overloading.
+
+ * cp-typeck.c (fntype_p): Is the arg function type?
+ (comp_target_parms): pedwarn on conversion from (anything) to (...).
+ (build_x_function_call): Deal with new overloading.
+
+ * cp-tree.c (decl_list_length): Deal with new overloading.
+ (decl_value_member): Like value_member, but for DECL_CHAINs.
+
+ * cp-decl.c (duplicate_decls): Deal with new overloading.
+ (start_decl): Likewise.
+
+ * cp-class.c (instantiate_type): Deal with new overloading.
+
+ * cp-call.c (convert_harshness_ansi): Deal with new overloading.
+ (convert_harshness_old): Deal with new overloading.
+ (build_overload_call_real): Likewise.
+
+Mon Nov 8 13:50:49 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-tree.c (get_unique_fn): New function; returns FUNCTION_DECL
+ if unambiguous, NULL_TREE otherwise.
+ (get_first_fn): Returns the first appropriate FUNCTION_DECL.
+ (is_overloaded_fn): Returns whether or not the passed tree is
+ a function or list of functions.
+
+ * cp-init.c (init_init_processing): Use `get_first_fn' to find
+ the FUNCTION_DEFN for new and delete.
+
+ * cp-decl.c (push_overloaded_decl): Use new overloading strategy, cut
+ code size in half (I spit on special cases).
+
+Tue Sep 7 20:03:33 1993 Jason Merrill <jason@deneb.cygnus.com>
+
+ * cp-decl.c: Allow references and template type parameters as well
diff --git a/contrib/gcc/cp/ChangeLog.2 b/contrib/gcc/cp/ChangeLog.2
new file mode 100644
index 0000000..179d6d7
--- /dev/null
+++ b/contrib/gcc/cp/ChangeLog.2
@@ -0,0 +1,20675 @@
+1999-12-31 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (VF_NORMAL_VALUE): Remove.
+ * class.c (struct base_info): Remove vfield, vfields, and rtti.
+ (set_primary_base): New function, split out from ...
+ (finish_base_struct): ... here. Rename to ...
+ (determine_primary_base): ... this. Simplify.
+ (create_vtable_ptr): Tweak accordingly.
+ (finish_struct_1): Simplify.
+
+ * cp-tree.h (CLASSTYPE_VBASECLASSES): Update documentation.
+ (CLASSTYPE_N_BASECLASSES): Likewise.
+ (BINFO_FOR_VBASE): New macro.
+ (get_vbase_types): Change prototype.
+ * class.c (build_vbase_path): Use BINFO_FOR_VBASE.
+ (prepare_fresh_vtable): Likewise.
+ (finish_vtbls): Likewise.
+ (get_class_offset_1): Likewise.
+ (modify_all_indirect_vtables): Likewise.
+ (build_vbase_pointer_fields): Likewise.
+ * decl.c (xref_basetypes): Don't set CLASSTYPE_VBASECLASSES here.
+ * init.c (sort_base_init): Use BINFO_FOR_VBASE.
+ (expand_member_init): Likewise.
+ * search.c (get_base_distance): Likewise.
+ (lookup_field_queue_p): Likewise.
+ (virtual_context): Likewise.
+ (get_vbase_types): Don't return a value. Set
+ CLASSTYPE_VBASECLASSES here.
+ * typeck.c (get_delta_difference): Use BINFO_FOR_VBASE.
+
+1999-12-30 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (fixup_inline_methods): Clear CLASSTYPE_INLINE_FRIENDS.
+
+1999-12-29 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (create_vtable_ptr): Put the vtable at the beginning of
+ the class, not the end, in the new ABI.
+ * tree.c (propagate_binfo_offsets): Do the right thing for the new
+ ABI.
+
+1999-12-29 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (lang_type): Add nearly_empty_p. Adjust dummy.
+ (CLASSTYPE_NEARLY_EMPTY_P): New macro.
+ * class.c (check_bases): Update CLASSTYPE_NEARLY_EMPTY_P.
+ (check_field_decls): Likewise.
+ (check_bases_and_members): Likewise.
+
+1999-12-28 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (do_inline_function_hair): Remove.
+ * class.c (layout_class_type): New function, split out from
+ finish_struct_1.
+ (fixup_pending_inline): Likewise.
+ (fixup_inline_methods): New function.
+ * method.c (fixup_pending_inline): Remove.
+ (do_inline_function_hair): Likewise.
+
+ * decl.c (BOOL_TYPE_SIZE): Bools always have size `1' under the
+ new ABI.
+
+ * cp-tree.h (lang_type): Replace abstract_virtuals with pure_virtuals.
+ (CLASSTYPE_ABSTRACT_VIRTUALS): Rename to ...
+ (CLASSTYPE_PURE_VIRTUALS): ... this.
+ (lang_decl_flags): Replace abstract_virtual with pure_virtual.
+ (DECL_ABSTRACT_VIRTUAL_P): Rename to ...
+ (DECL_PURE_VIRTUAL_P): ... this.
+ (get_abstract_virtuals): Rename to ...
+ (get_pure_virtuals): ... this.
+ * call.c (build_new_method_call): Replace DECL_PURE_VIRTUAL_P with
+ DECL_ABSTRACT_VIRTUAL_P. Replace CLASSTYPE_ABSTRACT_VIRTUALS with
+ CLASSTYPE_PURE_VIRTUALS.
+ * class.c (build_vtable_entry): Likewise.
+ (finish_struct_bits): Likewise. Call get_pure_virtuals, not
+ get_abstract_virtuals.
+ (build_vtbl_initializer): Likewise.
+ (override_one_vtable): Likewise.
+ (check_methods): Likewise.
+ * decl.c (duplicate_decls): Likewise.
+ (redeclaration_error_message): Likewise.
+ (lang_mark_tree): Likewise.
+ * decl2.c (grok_function_init): Likewise.
+ (import_export_vtable): Likewise.
+ (import_expor_class): Likewise.
+ * typeck2.c (abstract_virtuals_error): Likewise.
+ * xref.c (GNU_xref_member): Likewise.
+ * search.c (get_abstract_virtuals): Rename to get_pure_virtuals.
+
+1999-12-26 Zack Weinberg <zack@wolery.cumb.org>
+
+ * cp-tree.h: Replace ENABLE_CHECKING with ENABLE_TREE_CHECKING
+ throughout.
+
+1999-12-26 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (store_return_init): Use mode of old RTL generated for
+ DECL_RESULT, not the mode of DECL_RESULT itself.
+ * semantics.c (finish_named_return_value): Set DECL_UNINLINABLE
+ for functions that used named return values.
+
+1999-12-24 Mark Mitchell <mark@codesourcery.com>
+
+ * semantics.c (expand_body): Use
+ note_deferral_of_defined_inline_function.
+
+1999-12-22 Mark Mitchell <mark@codesourcery.com>
+
+ * dump.c (dequeue_and_dump): Handle CTOR_STMTs.
+
+1999-12-22 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
+
+ * error.c (dump_decl): Support named return values.
+
+1999-12-20 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (CLASSTYPE_VFIELD_PARENT): Update comments.
+ (CLASSTYPE_HAS_PRIMARY_BASE_P): New macro.
+ (CLASSTYPE_PRIMARY_BINFO): Likewise.
+ * class.c (check_methods): Don't set TYPE_HAS_COMPLEX_INIT_REF,
+ TYPE_NEEDS_CONSTRUCTING, and CLASSTYPE_NON_AGGREGATE here.
+ (check_bases_and_members): Set them here instead.
+ (create_vtable_ptr): New function, split out from ...
+ (finish_struct_1): ... here. Use it. Tidy. Use
+ CLASSTYPE_HAS_PRIMARY_BASE_P and CLASSTYPE_PRIMARY_BINFO.
+ * search.c (dfs_init_vbase_pointers): Handle seeing TYPE_VFIELD as
+ the first field in the class.
+ * tree.c (layout_basetypes): Use CLASSTYPE_N_BASECLASSES. Handle
+ seeing TYPE_VFIELD as the first field in the class.
+
+ * cp-tree.h (TYPE_VIRTUAL_P): Rename to ...
+ (TYPE_POLYMORPHIC_P): ... this.
+ (TYPE_USES_COMPLEX_INHERITANCE): Rename to ...
+ (TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P): ... this.
+ (TREE_CALLS_NEW): Remove.
+ (TREE_MANGLED): Likewise.
+ * call.c (build_vfield_ref): Use TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P,
+ and TYPE_POLYMORPHIC_P.
+ * class.c (check_bases): Likewise.
+ (finish_base_struct): Likewise.
+ (finish_struct_bits): Likewise.
+ (check_for_override): Likewise.
+ (finish_struct_1): Likewise.
+ (get_vfield_name): Likewise.
+ * decl.c (xref_basetypes): Likewise.
+ * decl2.c (import_export_class): Likewise.
+ (import_export_decl): Likewise.
+ * error.c (dump_function_decl): Likewise.
+ * pt.c (instantiate_class_template): Likewise.
+ * repo.c (repo_inline_used): Likewise.
+ * rtti.c (build_headof): Likewise.
+ (get_tinfo_fn_dynamic): Likewise.
+ (build_x_typeid): Likewise.
+ (get_tinfo_var): Likewise.
+ (build_dynamic_cast_1): Likewise.
+ (synthesize_tinfo_fn): Likewise.
+ * search.c (lookup_field_1): Likewise.
+ (dfs_debug_mark): Likewise.
+ (maybe_suppress_debug_info): Likewise.
+ * typeck.c (build_component_ref): Likewise.
+ (build_component_addr): Likewise.
+ * typeck2.c (process_init_constructor): Likewise.
+
+1999-12-20 Nathan Sidwell <nathan@acm.org>
+
+ * typeck.c (strip_all_pointer_quals): New static function.
+ (build_static_cast): Use it. Don't use at_least_as_qualified_p.
+
+1999-12-16 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (cp_tree_index): Add CPTI_DSO_HANDLE.
+ (dso_handle_node): New macro.
+ (flag_use_cxa_atexit): New variable.
+ (declare_global_var): New function.
+ (start_anon_func): Remove declaration.
+ (end_anon_func): Likewise.
+ * decl.c (get_atexit_node): New function, split out from
+ destroy_local_static. Handle flag_use_cxa_atexit.
+ (get_dso_handle_node): Likewise.
+ (start_cleanup_fn): Renamed from start_anon_func. Moved here from
+ except.c. Handle flag_use_cxa_atexit.
+ (end_cleanup_fn): Renamed from end_anon_func. Moved here from
+ except.c.
+ (declare_global_var): New variable.
+ (destroy_local_static): Handle flag_use_cxa_atexit.
+ * decl2.c (flag_use_cxa_atexit): New variable.
+ (lang_f_options): Likewise.
+ * except.c (start_anon_func): Remove.
+ (end_anon_func): Liekwise.
+ * lang-options.h: Add -fuse-cxa-atexit and -fno-use-cxa-atexit.
+ * rtti.c (get_tinfo_var): Use declare_global_var.
+
+1999-12-16 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (check_field_decls): Don't return a value.
+ (avoid_overlap): Moved here from tree.c.
+ (build_base_fields): Likewise.
+ (check_bases): New function, split out from finish_base_struct.
+ (check_bases_and_members): New function, split out from
+ finish_struct_1.
+ (struct base_info): Remove cant_have_default_ctor,
+ cant_have_const_ctor, cant_have_asn_ref.
+ (finish_base_struct): Split semantic analysis into check_bases.
+ (finish_struct_methods): Fix bogus assertion.
+ (check_field_decls): Call finish_struct_anon here.
+ (build_vbase_pointer_fields): Use CLASSTYPE_N_BASECLASSES.
+ (finish_struct_1): Use check_bases_and_members. Reorganize.
+ * cp-tree.h (CLASSTYPE_VBASECLASSES): Improve documentation.
+ (build_base_fields): Don't declare.
+ * tree.c (avoid_overlap): Remove.
+ (build_base_fields): Likewise.
+
+ * optimize.c (struct inline_data): Remove scope_stmt.
+ (remap_block): Don't use insert_block_after_note. Don't update
+ scope_stmt.
+ (expand_call_inline): Don't update scope_stmt.
+ (optimize_function): Don't initialize scope_stmt.
+ * semantics.c (expand_stmt): Set NOTE_BLOCK for newly emitted
+ NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END notes.
+
+1999-12-15 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (handle_using_decl): Get TYPE_FIELDS and TYPE_METHODS
+ out of the class, rather than taking them as parameters.
+ (build_vbase_pointer_fields): Move here from tree.c.
+ (build_vtbl_or_vbase_field): New function.
+ (check_methods): Likewise.
+ (remove_zero_width_bitfields): Likewise.
+ (add_virtual_function): Use tree_cons instead of temp_tree_cons.
+ (delete_duplicate_fields_1): Tidy. Don't delete duplicate
+ USING_DECLs here.
+ (finish_struct_methods): Handle the case where there are no
+ methods here.
+ (get_basefndecls): Use tree_cons instead of temp_tree_cons.
+ (check_field_decls): Call delete_duplicate_fields here.
+ (finish_struct_1): Tidy. Use check_methods and
+ remove_zero_width_bitfields.
+ * cp-tree.h (build_vbase_pointer_fields): Remove.
+ * decl.c (grokdeclarator): Use tree_cons instead of
+ temp_tree_cons.
+ * decl2.c (qualified_lookup_using_namespace): Use tree_cons
+ instead of temp_tree_cons.
+ * lex.c (cons_up_default_function): Remove dead code.
+ * method.c (fixup_pending_inline): New function, split out from ...
+ (do_inline_function_hair): ... here.
+ * tree.c (build_vbase_pointer_fields): Remove.
+
+1999-12-15 Jason Merrill <jason@casey.cygnus.com>
+
+ * tree.c (walk_tree): Walk operand subtrees in forward order.
+ * optimize.c (expand_call_inline): Likewise.
+ (optimize_function): Initialize id->scope_stmt to something useful.
+ (remap_block): Assume id->scope_stmt has a useful value.
+
+1999-12-15 Nathan Sidwell <nathan@acm.org>
+
+ * typeck.c (build_c_cast): Expand warning message. Move pointer
+ alignment warning to after the cast. Don't warn about pointer
+ alignment when given a pointer to incomplete.
+
+1999-12-15 Richard Henderson <rth@cygnus.com>
+
+ * cp-tree.h (make_aggr_type): Declare.
+ * lex.c (cp_make_lang_type): Don't SET_IS_AGGR_TYPE.
+ (make_aggr_type): New.
+
+ * decl.c (build_typename_type, init_decl_processing): Use it.
+ (build_ptrmemfunc_type, xref_tag): Likewise.
+ * except.c (call_eh_info): Likewise.
+ * init.c (init_init_processing): Likewise.
+ * pt.c (process_template_parm, lookup_template_class): Likewise.
+ * rtti.c (expand_class_desc): Likewise.
+ * semantics.c (begin_class_definition, finish_typeof): Likewise.
+ * tree.c (copy_template_template_parm): Likewise.
+
+1999-12-15 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.def (TEMPLATE_PARM_INDEX): Calculate size using
+ sizeof (struct tree_common).
+
+1999-12-14 Jason Merrill <jason@casey.cygnus.com>
+
+ * optimize.c (expand_call_inline): Set BLOCK_ABSTRACT_ORIGIN on the
+ outermost block to point to the inlined function decl.
+
+ * error.c (dump_decl): operator==, not operator ==.
+ (op_to_string): Likewise.
+
+ * decl.c (compute_array_index_type): Handle null name.
+
+ * decl2.c (ambiguous_decl): Fix to match comment.
+ (lookup_using_namespace): Adjust.
+
+ * decl2.c (import_export_class): Don't ignore dllimport.
+
+1999-12-14 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (check_field_decls): Split out from ...
+ (finish_struct_1): ... here. Use it. Tidy.
+
+ * cp-tree.h (remap_save_expr): Add walk_subtrees parameter.
+ * optimize.c (copy_body_r): Pass it.
+ * tree.c (remap_save_expr): Clear walk_subtrees for an
+ already-handled SAVE_EXPR.
+ (cp_unsave_r): Pass walk_subtrees to remap_save_expr.
+
+ * dump.c (dequeue_and_dump): Dump DECL_NAMESPACE_ALIAS.
+ * ir.texi (DECL_NAMESPACE_ALIAS): Document it.
+
+ * error.c (dump_expr): Handle EXPR_WITH_FILE_LOCATION.
+
+1999-12-14 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * class.c (finish_base_struct): Allow multiple COM base classes
+ as well as non-COM bases as long as it's not the leftmost.
+
+1999-12-13 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * lex.c (saving_parse_to_obstack): New global.
+ (reinit_parse_for_block): Use.
+ (reinit_parse_for_expr): Use.
+ (check_newline): Use.
+
+1999-12-13 Mark Mitchell <mark@codesourcery.com>
+
+ * optimize.c (initialize_inlined_parameters): Take FN to which the
+ parameters belong as an argument.
+ (expand_call_inline): Expand calls into the parameter
+ initializations before pushing the function onto the list of
+ functions we are presently expanding.
+
+1999-12-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * class.c (get_vtable_name): Use a literal format string and
+ VTABLE_NAME_PREFIX macro instead of VTABLE_NAME_FORMAT.
+ (prepare_fresh_vtable): Likewise.
+
+ * cp-tree.h (VTABLE_NAME_PREFIX): Define this instead of
+ VTABLE_NAME_FORMAT.
+
+ * decl.c (make_rtl_for_local_static): Remove unused variable `type'.
+
+ * init.c (build_vec_init): Initialize variable `try_body'.
+
+ * lex.c (yyerror): Don't call a variadic function with a
+ non-literal format string.
+
+ * optimize.c (optimize_function): Call memset, not bzero.
+
+ * pt.c (for_each_template_parm_r): Add static prototype.
+
+1999-12-09 Andreas Jaeger <aj@suse.de>
+
+ * except.c (expand_throw): Add static attribute to match
+ prototype.
+
+ * Makefile.in (semantics.o): Add dependency on output.h.
+ * semantics.c: Include output.h for declaration of
+ make_function_rtl.
+
+1999-12-09 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (init_decl_processing): Reenable inlining on trees.
+ (finish_function): Likewise.
+ * expr.c (cplus_expand_expr): Don't handle AGGR_INIT_EXPR here.
+ * semantics.c (simplify_aggr_init_exprs): New function.
+ (expand_body): Use it.
+ * tree.c (walk_tree): Special-case TARGET_EXPRs since they
+ sometimes present the same sub-tree twice.
+
+ * dump.c (dequeue_and_dump): Abbreviate `class' as `cls', not
+ `csl'.
+
+ * semantics.c (finish_switch_cond): Do conversions here, not ...
+ * typeck.c (c_expand_start_case): Here.
+
+ * semantics.c (do_poplevel): Remove unused variable.
+
+1999-12-06 Mark Mitchell <mark@codesourcery.com>
+
+ * tree.c (walk_tree): Don't recurse into DECL_INITIAL or DECL_SIZE
+ unless we're declaring the variable in question.
+
+1999-12-06 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (init_decl_processing): #if 0 last patch.
+ (finish_function): Likewise.
+
+1999-12-05 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (init_decl_processing): Set flag_inline_trees if
+ !flag_no_inline.
+
+ * cp-tree.h (calls_setjmp_p): Declare.
+ * decl.c (finish_function): Mark functions that call setjmp as
+ uninlinable.
+ * optimize.c (calls_setjmp_r): New function.
+ (calls_setjmp_p): Likewise.
+
+1999-12-04 Mark Mitchell <mark@codesourcery.com>
+
+ * optimize.c (expand_call_inline): Wrap the expanded call in an
+ EXPR_WITH_FILE_LOCATION node to get correct line numbers for
+ inlined functions.
+
+ * optimize.c (inline_data): Remove fns_top. Add scope_stmt. Add
+ in_target_cleanup_p.
+ (remap_decl): New function.
+ (remap_block): Likewise.
+ (copy_scope_stmt): Likewise.
+ (copy_body_r): Use remap_decl and copy_scope_stmt.
+ (copy_body): Use VARRAY_TOP_TREE.
+ (initialize_inlined_parameters): Likewise.
+ (declare_return_variable): Likewise.
+ (inlinable_function_p): Check flag_inline_trees.
+ (expand_call_inline): Handle SCOPE_STMTs and TARGET_EXPRs
+ specially. Use VARRAY_PUSH_TREE. Create a BLOCK for the
+ parameters of the inlined function.
+ (optimize_function): Prevent recursion into partially complete
+ functions.
+
+ * cp-tree.def (SCOPE_STMT): Take one operand.
+ * cp-tree.h (SCOPE_STMT_BLOCK): New macro.
+ (SCOPE_NULLIFIED_P): Redefine.
+ (SCOPE_NO_CLEANUPS_P): New macro.
+ (add_scope_stmt): Change prototype.
+ * decl.c (poplevel): Tidy. Warn about unused variables here.
+ Record SCOPE_STMT_BLOCKs.
+ (finish_function): Keep DECL_INITIAL for functions that might be
+ inlined.
+ * ir.texi: Document SCOPE_NO_CLEANUPS_P.
+ * semantics.c: Include rtl.h.
+ (add_scope_stmt): Return the new scope statement and, for an
+ end-of-scope statement, its matching begin statement. Don't set
+ SCOPE_NULLIFIED_P.
+ (do_pushlevel): Simplify, now that we are always
+ function-at-a-time.
+ (do_poplevel): Likewise. Record SCOPE_STMT_BLOCKs.
+ (expand_stmt): Don't call expand_start_bindings or
+ expand_end_bindings for a scope with SCOPE_NO_CLEANUPS_P set.
+ * tree.c (copy_tree_r): Clear SCOPE_STMT_BLOCK rather than setting
+ SCOPE_NULLIFIED_P.
+ * Makefile.in (semantics.o): Depend on RTL_H.
+
+ * decl2.c (pending_statics_used): Make it a macro.
+ (saved_inlines_used): Likewise.
+ (finish_static_data_member_decl): Use VARRAY_PUSH_TREE.
+ (mark_inline_for_output): Likewise.
+ (ssdf_decls_used): Remove.
+ (start_static_storage_duration_function): Use VARRAY_PUSH_TREE.
+ (generate_ctor_or_dtor_function): Adjust accordingly.
+
+1999-11-24 Geoffrey Keating <geoffk@cygnus.com>
+ Greg McGary <gkm@gnu.org>
+
+ * decl.c (duplicate_decls): Merge
+ DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT,
+ DECL_NO_CHECK_MEMORY_USAGE, DECL_NO_LIMIT_STACK.
+
+1999-12-02 Mike Stump <mrs@wrs.com>
+
+ * init.c (perform_member_init): Handle parse errors better.
+
+1999-12-01 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (min_tree_cons): Remove.
+ (scratch_ovl_cons): Likewise.
+ * decl.c (saveable_obstack): Don't declare.
+ (duplicate_decls): Tweak error-message.
+ (initialize_local_var): Explicitly mark the definition as static.
+ (finish_function): Call permanent_allocation, just so
+ that the middle-end sees the obstacks it expects.
+ (mark_cp_function_context): Likewise.
+ * init.c (build_new): Don't use min_tree_cons.
+ * lex.c (permanent_obstack): Don't declare.
+ (current_obstack, saveable_obstack): Likewise.
+ * spew.c (current_obstack, saveable_obstack): Likewise.
+ * tree.c (current_obstack, saveable_obstack): Likewise.
+ (scratch_ovl_cons): Remove.
+ (build_min_nt): Don't mess with obstacks.
+ (build_min): Likewise.
+ (min_tree_cons): Remove
+ * typeck.c (build_component_ref): Don't use scratch_ovl_cons.
+ (build_x_function_call): Likewise.
+ (build_c_cast): Don't use min_tree_cons.
+
+1999-11-29 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (tsubst_decl): Robustify.
+
+1999-11-27 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (finish_file): Call expand_body for inline functions
+ that will be written out but that do not yet have RTL.
+ * semantics.c (expand_body): Do not generate RTL For inline
+ functions that do not yet need to be written out.
+
+1999-11-25 Mark Mitchell <mark@codesourcery.com>
+
+ * Make-lang.in (CXX_SRCS): Add optimize.c.
+ * Makefile.in (CXX_OBJS): Add optimize.o.
+ (CXX_TREE_H): Add splay-tree.h, system.h, and $(CONFIG_H).
+ (spew.o, lex.o, decl.o, decl2.o, typeck2.o, typeck.o): Adjust.
+ (class.o, call.o, friend.o, init.o, method.o, cvt.o): Likewise.
+ (search.o, tree.o, ptree.o, rtti.o, except.o, expr.o): Likewise.
+ (xref.o, pt.o, error.o, errfn.o, repo.o, semantics.o): Likewise.
+ (dump.o): Likewise.
+ (optimize.o): New target.
+ * class.c: Don't include splay-tree.h.
+ * cp-tree.def (CTOR_COMPLETE): Rename to CTOR_STMT.
+ * cp-tree.h: Include splay-tree.h.
+ (DECL_UNINLINABLE): New macro.
+ (CTOR_BEGIN_P, CTOR_END_P): New macros.
+ (flag_inline_trees): New variable.
+ (local_variable_p): New function.
+ (nonstatic_local_decl_p): Likewise.
+ (optimize_function): Likewise.
+ (cplus_unsave_expr_now): Remove.
+ (copy_tree_r): Declare.
+ (remap_save_expr): Likewise.
+ * decl.c (local_variable_p): Don't
+ make it static.
+ (local_variable_p_walkfn): New function.
+ (make_rtl_for_local_static): Remove code to try to avoid writing
+ out static constants.
+ (emit_local_var): Fix indentation.
+ (nonstatic_local_decl_p): New function.
+ (check_default_argument): Use local_variable_p_walkfn, not
+ local_variable_p, when walking the tree.
+ (start_function): Set the DECL_CONTEXT for automatically generated
+ labels.
+ (finish_constructor_body): Use CTOR_STMT to mark the end of a
+ constructor.
+ * decl2.c: Don't include splay-tree.h.
+ (flag_inline_trees): Define.
+ * dump.c: Don't include
+ splay-tree.h.
+ * except.c (expand_end_catch_block): Fix comment formatting.
+ (expand_end_eh_spec): Set DECL_CONTEXT on temporary variables.
+ (expand_throw): Tidy comment.
+ * init.c (build_vec_delete_1): Use create_temporary_var.
+ * lex.c (cplus_tree_code_type): Make it static.
+ (cplus_tree_code_length): Likewise.
+ (cplus_tree_code_name): Likewise.
+ * optimize.c: New file.
+ * semantics.c (finish_goto_stmt): Set DECL_UNLINABLE for functions
+ with computed gotos.
+ (setup_vtbl_ptr): Mark the beginnings of constructors with
+ CTOR_STMT.
+ (expand_stmt): Handle CTOR_STMT, not CTOR_COMPLETE.
+ (expand_body): Call optimize_function. Save bodies if we're doing
+ inlining on trees.
+ * tree.c: Don't include splay-tree.h. Include insn-config.h and
+ integrate.h.
+ (copy_tree_r): Make it public.
+ (statement_code_p): New function.
+ (mark_local_for_remap_r): Likewise.
+ (cp_usave_r): Likewise.
+ (cp_unsave): Likewise.
+ (build_cplus_new): Set DECL_CONTEXT for temporary variables.
+ (walk_tree): Walk into `s' class nodes. Walk statement chains.
+ (copy_tree_r): Handle 's' class nodes. Restore chains for
+ statements. Nullify scopes. Don't copy types.
+ (init_tree): Set lang_unsave to cp_unsave.
+ (remap_save_expr): Define.
+ * ir.texi: Document CTOR_STMT.
+
+1999-11-24 Jason Merrill <jason@casey.cygnus.com>
+
+ * search.c (note_debug_info_needed): Do perform this optimization
+ for dwarf2.
+ (maybe_suppress_debug_info): Likewise. Start by clearing
+ TYPE_DECL_SUPPRESS_DEBUG.
+
+1999-11-24 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (tsubst_decl): Copy TREE_ASM_WRITTEN for VAR_DECLs.
+
+ * decl2.c (finish_vtable_vardecl): Don't prune vtables here.
+
+1999-11-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl.c (pushdecl, grokdeclarator): Don't call a variadic
+ function with a non-literal format string.
+
+ * lex.c (do_identifier): Likewise.
+
+ * typeck.c (build_unary_op): Likewise.
+
+1999-11-23 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (DECL_NEEDED_P): Tweak to match documentation.
+
+1999-11-22 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.def (CTOR_COMPLETE): New tree node.
+ * decl.c (finish_constructor_body): Add it, to mark the end of the
+ constructor.
+ (finish_function): Don't call end_protect_partials here.
+ * ir.texi (CTOR_COMPLETE): Document it.
+ * semantics.c (expand_stmt): Handle it.
+
+ * cp-tree.def (FUNCTION_NAME): New tree node.
+ * cp-tree.h (current_function_name_declared): Tweak documentation.
+ (lang_decl_flags): Add pretty_function_p, adjust dummy.
+ (DECL_PRETTY_FUNCTION_P): New macro.
+ * decl.c (cp_finish_decl): Handle declarations of __FUNCTION__,
+ etc., in a template function. Use at_function_scope_p instead of
+ expanding it inline.
+ * pt.c (tsubst_decl): Handle DECL_PRETTY_FUNCTION_P declarations
+ specially.
+ (tsubst): Handle FUNCTION_NAME.
+ (tsubst_copy): Likewise.
+ (instantiate_decl): Prevent redeclarations of __PRETTY_FUNCTION__,
+ etc. in instantiation.
+ * semantics.c (begin_compound_stmt): Declare __FUNCTION__, etc.,
+ even in template functions.
+ (setup_vtbl_ptr): Don't declare __PRETTY_FUNCTION in the
+ conditional scope at the top of a destructor.
+
+ * error.c (dump_function_decl): Use `[ with ... ]' syntax for
+ specializations too.
+
+1999-11-22 Nathan Sidwell <nathan@acm.org>
+
+ * semantics.c (finish_unary_op_expr): Only set TREE_NEGATED_INT
+ when actually negative.
+
+ * typeck.c (convert_for_assignment): Expand comment about
+ strange NULL check, moved from ...
+ (convert_for_initialization): ... here. Remove unneeded
+ code.
+
+1999-11-21 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
+
+ * cp-tree.h (build_vec_delete): Remove `auto_delete' argument.
+ * init.c (build_vec_delete, build_vec_delete_1): Likewise.
+ Always destruct virtual bases of array components, but never
+ delete them.
+ (build_vec_init): Adjust invocations.
+ (build_delete): Likewise.
+ * decl2.c (delete_sanity): Likewise.
+
+1999-11-19 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (grok_method_quals): Return this pointer qualifiers.
+ * decl.c (grokdeclarator): Adjust calls to grok_method_quals.
+ * decl2.c (grok_method_quals): Accept `restrict' as applying to
+ the object pointer. Return such qualifiers.
+ (grokclassfn): Apply this pointer qualifiers. Cleanup unused
+ variables.
+
+1999-11-18 Mark Mitchell <mark@codesourcery.com>
+
+ * except.c (expand_end_catch_block): Fix typo.
+ (expand_exception_blocks): Simplify. Don't call
+ expand_leftover_cleanups.
+
+1999-11-15 Jason Merrill <jason@casey.cygnus.com>
+
+ * cp-tree.h, decl.c (compute_array_index_type): Make nonstatic.
+ * pt.c (tsubst, case INTEGER_TYPE): Call it.
+ Check uses_template_parms.
+
+ * class.c (finish_struct): If we're a local class in a template
+ function, add a TAG_DEFN.
+ * pt.c (lookup_template_class): If this is a local class in a
+ template function, call pushtag.
+ (tsubst_expr, case TAG_DEFN): Handle classes, too.
+
+ Emit debug info with the vtable.
+ * search.c (maybe_suppress_debug_info): New function...
+ * class.c (finish_struct_1): ...split out from here.
+ * cp-tree.h: Declare it.
+ * decl2.c (finish_vtable_vardecl): Override TYPE_DECL_SUPPRESS_DEBUG
+ if we're writing out the vtable.
+ * decl.c, search.c (dfs_debug_mark, dfs_debug_unmarked_p,
+ note_debug_info_needed): #if 0 out.
+
+1999-11-14 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro.
+ * call.c (equal_functions): Use DECL_LOCAL_FUCNTION_P, not
+ TREE_PERMANENT.
+ * decl.c (pushdecl): Set DECL_LOCAL_FUNCTION_P.
+ * decl2.c (lookup_arg_dependent): Use it.
+
+ * cp-tree.h (cp_finish_decl): Change prototype.
+ (finish_static_data_member_decl): Likewise.
+ (push_permanent_obstack): Remove declaration.
+ (push_expression_obstack): Likewise.
+ (push_scratch_obstack): Likewise.
+ (DECL_TEMPLATE_PARM_P): Robustify.
+ (SET_DECL_TEMPLATE_PARM_P): New macro.
+ * class.c (add_method): Don't manipulate obstacks.
+ (finish_vtbls): Likewise.
+ * cvt.c (build_up_reference): Adjust calls to cp_finish_decl.
+ * decl.c (binding_for_name): Don't manipulate obstacks.
+ (maybe_push_to_top_level): Likewise.
+ (pop_from_top_level): Likewise.
+ (duplicate_decls): Likewise.
+ (pushdecl): Likewise.
+ (implicitly_declare): Likewise.
+ (build_typename_type): Likewise.
+ (start_decl): Likewise.
+ (cp_finish_decl): Likewise.
+ (finish_decl): Likewise.
+ (destroy_local_static): Likewise.
+ (expand_static_init): Likewise.
+ (complete_array_type): Likewise.
+ (grokvardecl): Likewise.
+ (build_ptrmemfnc_type): Likewise.
+ (grokdeclarator): Likewise.
+ (xref_tag): Likewise.
+ (xref_basetypes): Likewise.
+ (start_enum): Likewise.
+ (finish_enum): Likewise.
+ (start_function): Likewise.
+ (finish_function): Likewise.
+ (start_method): Adjust call to cp_finish_decl.
+ * decl2.c (finish_static_data_member_decl): Don't manipulate
+ obstacks.
+ (grokfield): Likewise.
+ (grokbitfield): Likewise.
+ (get_temp_name): Likewise.
+ (get_sentry): Likewise.
+ (fnish_file): Likewise.
+ (lookup_arg_dependent): Likewise.
+ * except.c (call_eh_info): Likewise.
+ (push_eh_info): Likewise.
+ (do_pop_exception): Likewise.
+ (initialize_handler_parm): Likewise.
+ (expand_end_eh_spec): Likewise.
+ (alloc_eh_object): Likewise.
+ (expand_throw): Likewise.
+ * expr.c (extract_scalar_init): Likewise.
+ * init.c (build_java_class_ref): Likewise.
+ * lex.c (get_time_identifier): Likewise.
+ (snarf_defarg): Likewise.
+ (add_defarg_fn): Likewise.
+ (is_global): Simplify.
+ (do_identifier): Don't check TREE_PERMANENT.
+ * method.c (emit_thunk): Don't manipulate obstacks.
+ * parse.y (condition): Adjust call to cp_finish_decl.
+ (primary): Likewise.
+ (initdcl): Likewise.
+ (initdcl0_innards): Likewise.
+ (nomods_initdcl0): Likewise.
+ * pt.c (push_inline_template_parms_recursive): Use
+ SET_DECL_TEMPLATE_PARM_P.
+ (process_template_parm): Likewise.
+ (lookup_template_class): Don't manipulate obstacks.
+ (instantiate_class_template): Adjust call to
+ finish_static_data_member_decl.
+ (tsubst_decl): Don't manipulate obstacks.
+ (tsubst_expr): Likewise.
+ (instantiate_template): Likewise.
+ (instantiate_decl): Adjust calls to cp_finish_decl.
+ * rtti.c (call_void_fn): Don't manipulate obstacks.
+ (get_tinfo_var): Likewise.
+ (get_tinfo_fn_unused): Likewise.
+ (build_dynamic_cast_1): Likewise.
+ (expand_si_desc): Likewise.
+ (expand_class_desc): Likewise.
+ (expand_ptr_desc): Likewise.
+ (expand_attr_desc): Likewise.
+ (expand_generic_desc): Likewise.
+ (synthesize_tinfo_fn): Likewise.
+ * search.c (expand_upcast_fixups): Likewise.
+ * semantics.c (finish_asm_stmt): Likewise.
+ (finish_named_return_value): Likewise.
+ (begin_class_definition): Likewise.
+ (finish_class_definition): Likewise.
+ (finish_typeof): Likewise.
+ * tree.c (build_cplus_method_type): Likewise.
+ (reverse_path): Likewise.
+ (copy_template_template_parm): Likewise.
+ (build_expr_ptr_wrapper): Likewise.
+ (push_expression_obstack): Remove.
+ (push_permanent_obstack): Likewise.
+ * typeck.c (mark_addressable): Likewise.
+
+1999-11-13 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_conditional_expr): Use build_target_expr_with_type.
+ (convert_like): Likewise.
+ (build_over_call): Likewise.
+ * cp-tree.h (build_target_expr): Remove.
+ (build_target_expr_with_type): New function.
+ * cvt.c (build_up_reference): Use get_target_expr.
+ * decl.c (build_target_expr): Move to ...
+ * tree.c (build_target_expr): Here. Make it static.
+ (build_target_expr_with_type): New function. Set DECL_CONTEXT on
+ the temporary VAR_DECLs.
+ (get_target_expr): Use it.
+
+1999-11-13 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (duplicate_decls): Propagate DECL_DEFER_OUTPUT.
+ * decl2.c (comdat_linkage): Set DECL_DEFER_OUTPUT.
+ * rtti.c (get_tinfo_fn_unused): Split out from get_tinfo_fn.
+ * class.c (set_rtti_entry): Use it.
+
+1999-11-12 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (cplus_expand_expr_stmt): Don't call break_out_cleanups
+ here.
+ * semantics.c (finish_expr_stmt): Call it here instead. Move
+ default_conversion logic to semantic-analysis time.
+
+1999-11-12 Jason Merrill <jason@yorick.cygnus.com>
+
+ * rtti.c (synthesize_tinfo_fn): Set DECL_DEFER_OUTPUT.
+
+Fri Nov 12 12:56:32 MST 1999 Diego Novillo <dnovillo@cygnus.com>
+
+ * init.c (init_init_processing): Re-instated Nov 11 patch after
+ approval.
+
+Fri Nov 12 10:42:02 MST 1999 Diego Novillo <dnovillo@cygnus.com>
+
+ * init.c (init_init_processing): Undo patch from Nov 11, 1999.
+ Patch had not been approved yet.
+
+1999-11-12 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (compute_array_index_type): New function, split out from
+ grokdeclarator.
+ (create_array_type_for_decl): Likewise.
+ (grokdeclarator): Use them.
+
+ * semantics.c (expand_stmt): Don't suspend_momentary or
+ resume_momentary.
+
+Thu Nov 11 12:42:11 MST 1999 Diego Novillo <dnovillo@cygnus.com>
+
+ * init.c (init_init_processing): Header information for
+ arrays allocated via `new' should have the same alignment used by
+ malloc.
+
+1999-11-10 Mark Mitchell <mark@codesourcery.com>
+
+ * error.c (dump_function_name): Don't crash if given a friend
+ pseudo-instantiation.
+
+ * cp-tree.h (build_enumerator): Change prototype.
+ * decl.c (enum_next_value): Remove.
+ (enum_overflow): Likewise.
+ (init_decl_processing): Don't register enum_next_value as a root.
+ (start_enum): Clear TYPE_VALUES for a redefined enum.
+ (finish_enum): Reset the type of enumeration constants.
+ (build_enumerator): Fix indentation. Don't copy CONST_DECLs when
+ we don't need to. Maintain the TYPE_VALUES list and look there
+ for the previously defined enumeration constant. Let enumeration
+ constants have the type of their values until the enumeration type
+ is complete.
+ * parse.y (enumlist_opt, enumlist, enumerator): Don't return a value.
+ (structsp): Adjust.
+ * parse.c: Regenerated.
+ * pt.c (tsubst_enum): Adjust according to build_enumerator changes.
+
+Wed Nov 10 12:43:21 1999 Philippe De Muyter <phdm@macqel.be>
+ Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h: Test `GCC_VERSION', not `HAVE_GCC_VERSION'.
+
+1999-11-09 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (language_function): Remove x_last_dtor_insn and
+ x_last_parm_cleanup_insn.
+ * decl.c (last_dtor_insn): Remove.
+ (last_parm_cleanup_insn): Likewise.
+ (expand_start_early_try_stmts): Don't set them.
+ (store_parm_decls): Likewise.
+ (save_function_data): Or save them.
+ (mark_lang_function): Or mark them.
+
+1999-11-08 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (store_parm_decls): Generate cleanup code at
+ semantic-analysis time. Destroy objects in the correct order.
+
+1999-11-07 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (begin_new_placement): Remove.
+ (finish_new_placement): Likewise.
+ * class.c (finish_struct_1): Don't suspend_momentary or
+ resume_momentary.
+ * decl.c (grokdeclarator): Likewise.
+ (maybe_build_cleanup_1): Likewise.
+ * except.c (push_eh_cleanup): Likewise.
+ (build_terminate_handler): Likewise.
+ * init.c (build_new_1): Likewise.
+ * parse.y (parse_decl): Change prototype.
+ (initdecls, notype_initdecls, initdcl): Don't return int.
+ (initdcl0, notype_initdcl0, initdcl0_innards): Likewise.
+ (.begin_new_placement): Remove.
+ (.finish_new_placement): Likewise.
+ (nonmomentary_expr): Likewise.
+ (suspend_mom): Likewise.
+ (condition): Don't suspend_momentary, resume_momentary, or keep
+ track of need to resume.
+ (unary_expr): Likewise.
+ (new_placement): Likewise.
+ (decl): Likewise.
+ (structsp): Likewise.
+ (new_type_id): Likewise.
+ (maybe_parmlist): Likewise.
+ (direct_after_type_declaration): Likewise.
+ (direct_new_declarator): Likewise.
+ (direct_abstract_declaration): Likewise.
+ * parse.c: Regenerated.
+ * pt.c (tsubst_expr): Don't suspend_momentary or resume_momentary.
+ * semantics.c (begin_new_placement): Remove.
+ (finish_new_placement): Likewise.
+
+1999-11-05 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * cp-tree.h (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK): New macro.
+ (DECL_TEMPLATE_INFO): Use it.
+ * decl.c (warn_extern_redeclared_static): Do nothing for
+ TEMPLATE_DECLs.
+ * decl2.c (mark_used): Explicitly check for function or variable.
+ * semantics.c (finish_unary_op_expr): Check whether result is also
+ an INTEGER_CST.
+
+1999-11-05 Mark Mitchell <mark@codesourcery.com>
+
+ * Makefile.in (typeck2.o): Depend on output.h.
+ * typeck2.c: Include output.h.
+
+ * decl.c (flag_ansi): Remove declaration.
+
+ * pt.c (tinst_level_tick): Make it static.
+ (last_template_error_tick): Likewise.
+
+ * cp-tree.h (mapcar): Remove declaration.
+ (search_tree): Likewise.
+ (walk_tree_fn): New typedef.
+ (walk_tree): New function.
+ * tree.c (bot_manip): Change prototype. Adjust to be called via
+ walk_tree.
+ (bot_replace): Likewise.
+ (no_linkage_helper): Likewise.
+ (copy_tree_r): New function.
+ (search_tree): Rename, and adjust, to become ...
+ (walk_tree): New function.
+ (mapcar): Remove.
+ (target_remap): Remove.
+ (target_remap_count): Likewise.
+ (break_out_target_exprs): Use walk_tree.
+ * decl.c (local_variable_p): Change prototype.
+ (check_default_argument): Use walk_tree.
+ * pt.c (for_each_template_parm_r): New function, split out from ...
+ (for_each_template_parm): Here. Use it, via walk_tree.
+
+1999-11-03 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (check_bitfield_decl): New function, split out from
+ finish_stuct_1.
+ (check_field_decl): Likewise. Recursively examine members of
+ anonymous structs.
+ (finish_struct_1): Use them.
+ * cp-tree.h (ANON_UNION_TYPE_P): New macro.
+
+1999-11-02 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (grokfndecl): Remove dead code.
+
+ * dump.c (dequeue_and_dump): Fix thinko for catch-clauses.
+
+1999-11-02 Scott Snyder <snyder@fnal.gov>
+
+ * decl2.c (build_expr_from_tree): Handle REALPART_EXPR and
+ IMAGPART_EXPR.
+ * pt.c (tsubst_copy): Likewise.
+
+1999-11-01 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (maybe_make_one_only): Always make things comdat on
+ ELF targets, too.
+
+1999-10-31 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (finish_function): Call free_after_parsing for functions
+ we are not immediately turning into RTL.
+
+1999-10-31 Brendan Kehoe <brendan@cygnus.com>
+
+ * cp-tree.h (flag_dump_translation_unit): Add decl.
+
+Sat Oct 30 22:42:50 1999 Stephen L Moshier <moshier@mediaone.net>
+
+ * lex.c (yylex): Accept 'f' in mantissa of hex float constant.
+
+1999-10-30 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (pop_cp_function_context): Don't call free on a NULL
+ pointer.
+ * semantics.c: Include ggc.h.
+ (expand_body): Do garbage-collection after processing a template
+ function. Clear DECL_SAVED_TREE after generating RTL for a
+ function.
+ * Makefile.in (semantics.o): Depend on ggc.h.
+
+1999-10-29 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (make_typename_type): Change prototype.
+ * decl.c (make_typename_type): Only complain if so requested.
+ * parse.y (nested_name_specifier): Adjust calls.
+ (typename_sub0): Likewise.
+ (typename_sub1): Likewise.
+ * parse.c: Regenerated.
+ * pt.c (convert_template_argument): Pass complain to
+ make_typename_type.
+ (tsubst): Likewise.
+
+1999-10-28 Mark Mitchell <mark@codesourcery.com>
+
+ * semantics.c (finish_handler): End the scope of the handler
+ before attaching it to the statement-tree.
+
+1999-10-28 Ian Lance Taylor <ian@zembu.com>
+
+ * rtti.c (build_dynamic_cast_1): Give a better error message for
+ an attempt to dynamic_cast from a non-polymorphic type.
+
+1999-10-27 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (make_temp_vec): Remove.
+ (make_scratch_vec): Likewise.
+ * call.c (add_function_candidate): Use make_tree_vec.
+ (add_conv_candidate): Likewise.
+ (build_builtin_candidate): Likewise.
+ (add_template_candidate_real): Likewise.
+ * class.c (resolve_address_of_overloaded_function): Likewise.
+ * decl.c (start_function): Don't fool with the momentary obstack.
+ (finish_function): Likewise.
+ * init.c (expand_direct_vtbls_init): Likewise.
+ (begin_init_stmts): Likewise.
+ (finish_init_stmts): Likewise.
+ * pt.c (add_to_template_args): Use make_tree_vec.
+ (check_explicit_specialization): Likewise.
+ (coerce_template_parms): Likewise.
+ (lookup_template_class): Don't fool with the momentary obstack.
+ (instantiate_class_template): Likewise.
+ (tsubst_template_arg_vector): Use make_tree_vec.
+ (tsubst_aggr_type): Don't fool with the momentary obstack.
+ (tsubst_decl): Likewise. Use make_tree_vec.
+ (try_one_overload): Likewise.
+ (try_class_unification): Don't fool with the momentary obstack.
+ (get_bindings_real): Use make_tree_vec.
+ (set_mangled_name_for_template_decl): Likewise.
+ * rtti.c (synthesize_tinfo_fn): Don't fool with the momentary obstack.
+ * semantics.c (finish_expr_stmt): Likewise.
+ (finish_do_stmt): Likewise.
+ (finish_for_expr): Likewise.
+ (finish_switch_cond): Likewise.
+ (do_pushlevel): Likewise.
+ (do_poplevel): Likewise.
+ * tree.c (make_temp_vec): Remove.
+
+ * dump.c (dequeue_and_dump): Dump HANDLERs and SAVE_EXPRs. Dump
+ CLEANUP_P for a TRY_BLOCK.
+ * ir.texi: Document SAVE_EXPR.
+
+Tue Oct 26 23:29:56 1999 Jeffrey A Law (law@cygnus.com)
+
+ * call.c (build_over_call): Check that the built-in function is
+ of class BUILT_IN_NORMAL before trying to recongize it as BUILT_IN_ABS.
+ * typeck.c (build_function_call_real): Similarly.
+
+1999-10-26 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (poplevel): Don't set BLOCK_TYPE_TAGS. Don't call
+ remember_end_note.
+
+1999-10-24 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (push_overloaded_decl_1): Use pushdecl.
+
+ * decl.c (auto_function): Replace #ifdef'd __inline with just
+ plain inline.
+ * lex.c (my_get_run_time): Likeise.
+ (yyprint): Likewise.
+ (identifier_type): Likewise.
+ * method.c (start_squangling): Likewise.
+ (end_squangling): Likewise.
+ (icat): Likewise.
+ (old_backref_index): Likewise.
+ (flush_repeats): Likewise.
+ (issue_ktype): Likewise.
+ * parse.y (empty_parms): Likewise.
+ * parse.c: Regenerated.
+
+1999-10-21 Mark Mitchell <mark@codesourcery.com>
+
+ * dump.c (dequeue_and_dump): Replace several uses of
+ queue_and_dump_index with dump_child.
+
+1999-10-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * expr.c: Include tm_p.h.
+
+1999-10-21 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (SCOPE_PARTIAL_P): New macro.
+ (pushlevel_temporary): Remove.
+ (add_scope_stmt): New function.
+ * decl.c (pushlevel_temporary): Remove.
+ (poplevel): Use add_scope_stmt.
+ (start_decl_1): Likewise.
+ * semantics.c (add_scope_stmt): New function.
+ (do_pushlevel): Use it.
+ (do_poplevel): Use it.
+ (expand_stmt): Check SCOPE_PARTIAL_P.
+
+ * cp-tree.def (EMPTY_CLASS_EXPR): New tree node.
+ * call.c (build_call): Use EMPTY_CLASS_EXPR instead of RTL_EXPR.
+ * expr.c (cplus_expand_expr): Expand it.
+ * ir.texi: Document EMPTY_CLASS_EXPR.
+
+1999-10-20 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (DECL_NAMESPACE_SCOPE_P): Don't treat template
+ parameters as having namespace scope.
+
+1999-10-19 Mark Mitchell <mark@codesourcery.com>
+
+ * method.c (PARM_CAN_BE_ARRAY_TYPE): Remove.
+ (mangling_flags): New type.
+ (build_overload_int): Change prototype.
+ (build_overload_value): Likewise.
+ (numeric_output_need_bar): Improve comment.
+ (mangle_expression): New function, broken out from ...
+ (build_overload_int): Here.
+ (build_overload_value): Adjust for use of mangling flags. Don't
+ warn about real-valued template parameters here. Do handle
+ complex expressions involving real-valued template parameters.
+ (build_template_parm_names): Encase non-type template parameters
+ in underscores, if necessary.
+ (process_overload_item): Remove conditional on
+ PARM_CAN_BE_ARRAY_TYPE.
+
+1999-10-17 Mark Mitchell <mark@codesourcery.com>
+
+ * dump.c (dequeue_and_dump): Handle CLEANUP_POINT_EXPR.
+
+ * ir.texi: Clean up documentation of RETURN_INIT.
+
+1999-10-15 Greg McGary <gkm@gnu.org>
+
+ * lex.c (lang_init_options): Set flag_bounds_check as "unspecified".
+ (lang_init): Set default for flag_bounds_check if still "unspecified".
+
+1999-10-13 Andrew Haley <aph@cygnus.com>
+
+ * class.c (finish_struct_1): Force alignment of non-bitfields to
+ BITS_PER_UNIT.
+
+Wed Oct 13 22:01:35 1999 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * typeck2.c (process_init_constructor): Handle empty constructors.
+
+1999-10-13 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (lang_mark_tree): Mark NAMESPACE_LEVEL.
+
+ * pt.c (tsubst, case INTEGER_TYPE): Be more explicit in zero-size
+ array error.
+
+1999-10-13 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (make_rtl_for_local_static): Don't create register RTL
+ for addressable constants.
+
+1999-10-13 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (build_x_va_arg): Prototype new function.
+ * call.c (build_x_va_arg): Define it.
+ * parse.y (unary_expr): Call build_x_va_arg.
+
+ * cp-tree.h (convert_type_from_ellipsis): Prototype new function.
+ * call.c (convert_type_from_ellipsis): Define it.
+ * decl.c (init_decl_processing): Set lang_type_promotes_to.
+
+ * tree.c (lvalue_p_1): Accept VA_ARG_EXPR with aggregates.
+
+1999-10-11 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (fixed_type_or_null): Always set *nonnull.
+
+1999-10-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h: Use HAVE_GCC_VERSION instead of explicitly testing
+ __GNUC__ and __GNUC_MINOR__.
+
+1999-10-09 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (make_rtl_for_local_static): New function.
+ * decl.c (make_rtl_for_nonlocal_decl): Move code to create RTL for
+ local statics ...
+ (make_rtl_for_local_static): Here.
+ * semantics.c (expand_stmt): Use make_rtl_for_local_static.
+
+1999-10-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * method.c: Include tm_p.h.
+
+1999-10-7 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
+
+ * cp-tree.h (cp_make_lake_type): Renamed from make_lang_type.
+ * lex.c (cp_make_lake_type): Likewise.
+ * tree.c (init_tree): Init make_lang_type_fn.
+
+1999-10-07 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (tsubst_expr): Set DECL_TEMPLATE_INSTANTIATED for a catch
+ parameter.
+
+ * semantics.c (expand_stmt): Don't pretend to have asmspecs for
+ local statics if we don't really have them.
+
+ * ir.texi: Improve documentation for STMT_EXPR. Describe
+ CLEANUP_POINT_EXPR.
+
+1999-10-07 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (build_vtable_entry_ref): Use finish_asm_stmt.
+
+1999-10-07 Greg McGary <gkm@gnu.org>
+
+ * class.c (finish_struct_1): Use simpler method of
+ removing elements of a singly-linked list which doesn't
+ lose for classes without data members.
+
+1999-10-07 Mark Mitchell <mark@codesourcery.com>
+
+ * friend.c (make_friend_class): Robustify.
+
+ * semantics.c (finish_object_call_expr): Reject calls to template
+ types.
+
+1999-10-06 Mark Mitchell <mark@codesourcery.com>
+
+ * dump.c (dequeue_and_dump): Dump all three operands to a COND_EXPR.
+
+ * cp-tree.h (CLASSTYPE_VFIELD): Remove.
+ * call.c (build_vfield_ref): Use TYPE_VFIELD, not
+ CLASSTYPE_VFIELD.
+ * class.c (get_vfield_offset): Likewise.
+ (finish_base_struct): Likewise.
+ (modify_one_vtable): Likewise.
+ (fixup_vtable_deltas): Likewise.
+ (finish_struct_1): Likewise.
+ * init.c (expand_virtual_init): Likewise.
+ * search.c (lookup_field_1): Likewise.
+ (expand_upcast_fixups): Likewise.
+ * typeck.c (build_component_ref): Likewise.
+ (build_binary_op_nodefault): Likewise.
+
+ * dump.c (dqueue_and_dump): Dump TYPE_VFIELD.
+ * ir.texi: Document TYPE_VFIELD.
+
+1999-10-06 Brendan Kehoe <brendan@cygnus.com>
+
+ * decl.c (grokdeclarator): Only warn about non-zero arrays if
+ !in_system_header (linux socketbits.h can give this for
+ __cmsg_data, which is using a GNU extension).
+
+1999-10-05 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (start_static_storage_duration_function): Push the
+ function declaration so it ends up in namespace scope.
+
+ * dump.c (DUMP_CHILDREN): Remove.
+ (DUMP_BINFO): Adjust.
+ (struct dump_node_info): Remove dump_children_p.
+ (queue_and_dump_type): Remove dump_children_p parameter.
+ (queue): Don't set dump_children_p.
+ (dump_child): Pass DUMP_NONE, instead of DUMP_CHILDREN, to
+ queue_and_dump_index.
+ (dequeue_and_dump): Unconditionally print children. Adjust calls
+ to functions mentioned above.
+ (dump_node): Pass DUMP_NONE, instead of DUMP_CHILDREN to queue.
+
+ * ir.texi: Document BIND_EXPR, LOOP_EXPR, and EXIT_EXPR.
+ * dump.c (dequeue_and_dump): Dump them.
+
+ * method.c (synthesize_method): Call setup_vtbl_ptr for destructors.
+
+ * decl.c (start_function): Set current_in_charge_parm for
+ constructors, too, where appropriate.
+ * search.c (fixup_all_virtual_upcast_offsets): New function.
+ (expand_indirect_vtbls_init): Use it.
+
+1999-10-04 Nathan Sidwell <nathan@acm.org>
+
+ * decl2.c (grok_alignof): Don't decay lvalues.
+
+ * init.c (build_new): Remove unused variable.
+
+1999-10-04 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (struct language_function): Remove static_labelno.
+ (static_labelno): Remove macro.
+ * method.c (build_overload_nested_name): Make static_labelno
+ static here.
+
+ * pt.c (instantiate_decl): Use DECL_SAVED_TREE, not DECL_INITIAL,
+ to decide whether or not a function is defined.
+
+ * call.c (build_over_call): Don't set TREE_SIDE_EFFECTS for
+ situations where make_node will do it automatically.
+ * decl.c (grok_reference_init): Likewise.
+ (expand_static_init): Likewise.
+ (do_static_initialization): Likewise.
+ * init.c (perform_member_init): Likewise.
+ (expand_aggr_init_1): Likewise.
+ (build_new_1): Likewise.
+ * method.c (do_build_copy_constructor): Likewise.
+ (do_build_assign_ref): Likewise.
+ * search.c (expand_upcast_fixups): Likewise.
+ * semantics.c (finish_stmt_expr): Likewise.
+ * typeck.c (build_unary_op): Likewise.
+ (check_return_expr): Likewise.
+
+1999-10-04 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (build_vec_delete_1): Fold COND_EXPRs.
+
+1999-10-03 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.def (VEC_INIT_EXPR): Remove.
+ * cp-tree.h (struct stmt_tree): New type.
+ (struct saved_scope): Remove firstobj. Add x_saved_tree,
+ x_stmt_tree.
+ (class_cache_firstobj): Remove.
+ (struct language_function): Remove stmts_are_full_exprs_p,
+ x_last_tree, and x_last_expr_type. Add x_stmt_tree.
+ (current_stmt_tree): New macro.
+ (last_tree): Adjust.
+ (last_expr_type): Likewise.
+ (doing_semantic_analysis_p): Simplify.
+ (stmts_are_full_exprs_p): Adjust.
+ (begin_tree): Remove prototype.
+ (end_tree): Likewise.
+ (begin_stmt_tree): Change prototype.
+ (finish_stmt_tree): Likewise.
+ (building_stmt_tree): Simplify.
+ * decl.c (mark_stmt_tree): New function.
+ (mark_saved_scope): Use it.
+ (start_function): Rearrange slightly to call begin_stmt_tree
+ earlier.
+ (save_function_data): Tweak.
+ (finish_function): Adjust call to finish_stmt_tree.
+ (mark_lang_function): Use mark_stmt_tree.
+ * expr.c (cplus_expand_expr): Don't handle VEC_INIT_EXPR.
+ * init.c (build_new_1): Remove creation of VEC_INIT_EXPR.
+ (build_vec_init): Remove creation of stand-in initializer.
+ * pt.c (begin_tree): Remove.
+ (end_tree): Likewise.
+ * semantics.c (SET_LAST_STMT): New macro. Use it throughout.
+ (begin_compound_stmt): Handle a compound-statement outside of a
+ function.
+ (begin_stmt_expr): Handle a statement-expression outsidef of a
+ function.
+ (finish_stmt_expr): Likewise.
+ (begin_class_definition): Don't call begin_tree.
+ (finish_inline_definitions): Don't call end_tree.
+ (begin_stmt_tree): Take a pointer to tree, not a function as input.
+ (finish_stmt_tree): Likewise.
+ * tree.c (search_tree): Don't handle VEC_INIT_EXPR.
+ (mapcar): Likewise.
+
+ * parse.y (simple_stmt): Don't call finish_stmt unnecessarily.
+ * parse.c: Regenerated.
+
+ * dump.c (dqueue_and_dump): Dump bitfieldness.
+
+ * tree.c (lvalue_p_1): Use DECL_C_BIT_FIELD to check for
+ bitfields, rather than DECL_BIT_FIELD.
+ * ir.texi: Document how to tell whether or not a field is a
+ bitfield.
+
+ * lex.c (make_lang_type): Fix typo in comment.
+
+1999-10-01 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (decay_conversion): Strip cv-quals from non-class rvalues.
+
+1999-10-01 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (tsubst_decl): If the type of a template instantiation is
+ bogus, so is the whole instantiation.
+
+1999-09-30 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (initialize_local_var): Handle static variables here.
+ (cp_finish_decl): Tweak handling of function-scope static
+ variables.
+ * semantics.c (expand_stmt): Handle DECL_STMTs for static
+ variables.
+
+ * method.c (emit_thunk): Don't crash when -fsyntax-only.
+
+ * cp-tree.h (lang_decl_flags): Add global_ctor_p and
+ global_dtor_p. Add init_priority.
+ (DECL_ACCESS): Adjust accordingly.
+ (DECL_GLOBAL_CTOR_P, DECL_GLOBAL_DTOR_P): New macros.
+ (GLOBAL_INIT_PRIORITY): Likewise.
+ * decl.c (lang_mark_tree): Adjust accordingly.
+ (start_objects): Set DECL_GLOBAL_CTOR_P, DECL_GLOBAL_DTOR_P,
+ and GLOBAL_INIT_PRIORITY.
+ * dump.c (dequeue_and_dump): Print them.
+ * ir.texi: Document them.
+
+ * decl2.c (struct priority_info_s): Remove initialization_sequence
+ and destruction_sequence.
+ (start_static_storage_duration_function): Return the body of the
+ function. Convert for function-at-a-time mode.
+ (generate_inits_for_priority): Remove.
+ (finish_static_storage_duration_function): Change prototype.
+ Adjust for function-at-a-time mode.
+ (do_static_initialization): Likewise.
+ (do_static_destruction): Likewise.
+ (do_static_initialization_and_destruction): Remove.
+ (start_static_initialization_or_destruction): New function.
+ (finish_static_initialization_or_destruction): Likewise.
+ (get_priority_info): Don't manipulation initialization_sequence or
+ destruction_sequence.
+ (prune_vars_needing_no_initialization): New function.
+ (write_out_vars): Likewise.
+ (finish_file): Use the various new functions instead of the old.
+
+Thu Sep 30 00:13:27 1999 Dirk Zoller <duz@rtsffm.com>
+
+ * cp-tree.h (warn_float_equal): Declare.
+ * decl2.c (warn_float_equal): Define.
+ (lang_decode_option): Recognize -W[no-]float-equal.
+ * typeck.c (build_binary_op_nodefault): Conditionally warn
+ about equality tests of floating point types.
+
+1999-09-29 Jason Merrill <jason@yorick.cygnus.com>
+
+ Support normal type_info-based EH mechanisms with -fno-rtti.
+ * except.c (build_eh_type_type): Remove special -fno-rtti handling.
+ (build_eh_type_type_ref): Likewise.
+ (build_eh_type): Remove.
+ (expand_throw): Call build_eh_type_type, not build_eh_type.
+ * decl2.c (import_export_decl): Don't associate the tinfo fn with
+ the vtable if -fno-rtti.
+ * decl.c (init_decl_processing): Always init_rtti_processing.
+
+ * rtti.c (get_typeid): Don't complain about -fno-rtti.
+
+ * class.c (class_cache_obstack, class_obstack): Remove.
+ (init_class_processing): Don't initialize class_obstack.
+ (push_cache_obstack): Remove.
+ (pushclass): Don't call it.
+ * cp-tree.h: Remove prototype for push_cache_obstack.
+ * decl.c (decl_obstack, decl_stack, push_decl_level): Remove.
+ (pushlevel_class): Don't push_decl_level.
+ (poplevel_class): Don't pop_stack_level.
+ (push_class_level_binding): Don't push_cache_obstack.
+ (init_decl_processing): Don't initialize decl_obstack.
+ * search.c (push_class_decls): Don't push_cache_obstack.
+ * tree.c (list_hash_add): Put hash node on permanent_obstack.
+ (hash_tree_cons): Don't mess with obstacks.
+ (print_lang_statistics): Don't print stats for class_obstack and
+ decl_obstack.
+
+1999-09-29 Mark Mitchell <mark@codesourcery.com>
+
+ * dump.c (dequeue_and_dump): Dump DECL_EXTERNAL.
+ * ir.texi: Document DECL_EXTERNAL.
+
+ * dump.c (dequeue_and_dump): Improve support for dumping THUNK_DECLs.
+ * ir.texi: Document THUNK_DECLs.
+
+ * cp-tree.h (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Move here from pt.c.
+ (TMPL_ARGS_DEPTH, TMPL_ARGS_LEVEL, SET_TMPL_ARGS_LEVEL): Likewise.
+ (TMPL_ARG, SET_TMPL_ARG, NUM_TMPL_ARGS, TMPL_PARMS_DEPTH): Likewise.
+ * error.c (dump_template_bindings): Remove unused parameter.
+ Handle multiple levels of template parameters.
+ (dump_template_decl): Use `parms', not `args', for template
+ parameters. Fix thinko.
+ (dump_function_decl): Use DECL_TEMPLATE_INSTANTIATION. Don't pass
+ flags to dump_template_bindings.
+ * pt.c (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Move to cp-tree.h.
+ (TMPL_ARGS_DEPTH, TMPL_ARGS_LEVEL, SET_TMPL_ARGS_LEVEL): Likewise.
+ (TMPL_ARG, SET_TMPL_ARG, NUM_TMPL_ARGS, TMPL_PARMS_DEPTH): Likewise.
+ (tsubst_copy): Clarify variable name.
+ (most_general_template): Robustify.
+
+1999-09-29 Nathan Sidwell <nathan@acm.org>
+
+ * error.c (dump_template_parms): Don't use TS_PEDANTIC_NAME
+ to change primary template rendering.
+
+1999-09-29 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (UPT_TEMPLATE): Remove.
+ (UPT_PARMS): Likewise.
+ (DECL_NEEDED_P): New macro.
+ * decl2.c (finish_vtable_vardecl): Use it.
+ (finish_objects): Don't crash with -fsyntax-only.
+ (finish_file): Use DECL_NEEDED_P. Don't prune vtables when
+ -fsyntax-only.
+ * pt.c (tsubst_friend_function): Remove FIXME that talks about
+ obstacks.
+ (tsubst_expr): Correct handling of function try-blocks.
+ * semantics.c: Include flags.h.
+ (expand_body): Don't do RTL generation if -fsyntax-only.
+ * Makefile.in (semantics.o): Depends on flags.h.
+
+1999-09-28 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * pt.c (most_general_template): Adjust declaration.
+
+ * cp-tree.h: (most_general_template): Declare.
+
+ * error.c (dump_template_value): Rename to ...
+ (dump_template_argument): This.
+ (dump_template_argument_list): New function.
+ (dump_type): Use it.
+ (dump_template_parameter): New function.
+ (dump_template_decl): Use it.
+ (dump_template_bindings): New function.
+ (dump_function_decl): Use it. Pretty print function template
+ instantiations.
+
+1999-09-28 Nathan Sidwell <nathan@acm.org>
+
+ * decl.c (grokdeclarator): Distinguish parameter context for
+ diagnostics. Tidy up missing type diagnostic.
+ Diagnose `explicit' in one place. Diagnose `mutable' in one place.
+
+1999-09-28 Mark Mitchell <mark@codesourcery.com>
+
+ * ir.texi: Improve documentation for TARGET_EXPR.
+
+1999-09-27 Nathan Sidwell <nathan@acm.org>
+
+ Augment stringification of trees.
+ * cp-tree.h (tree_string_flags): New error stringifying enumeration.
+ (fndecl_as_string, type_as_string_real, args_as_string,
+ code_as_string, language_as_string, parm_as_string,
+ op_as_string, assop_as_string, cv_as_string): Remove.
+ (type_as_string, decl_as_string, expr_as_string): Adjust prototype.
+ (context_as_string): Declare new function.
+ * error.c (cp_printers): Move definition.
+ (OB_UNPUT): Remove.
+ (OB_END_TEMPLATE_ID): Adjust.
+ (interesting_scope_p): Remove.
+ (dump_scope): New static function.
+ (dump_qualifiers): Adjust prototype, reimplement.
+ (dump_template_value): Use tree_string_flags.
+ (dump_type_real): Move back to dump_type.
+ (dump_type): Adjust prototype. Use tree_string_flags.
+ (dump_aggr_type): Likewise. Use dump_template_parms.
+ (dump_type_prefix): Adjust prototype. Use tree_string_flags.
+ Return pad flag.
+ (dump_type_suffix): Adjust prototype. Use tree_string_flags.
+ (dump_simple_decl): Likewise.
+ (dump_decl): Likewise. Use dump_template_decl.
+ (dump_template_decl): New static function broken out of dump_decl.
+ (dump_function_decl): Adjust prototype. Use tree_string_flags.
+ (dump_parameters): Likewise. Prefix space.
+ (dump_exception_spec): Adjust prototype. Use tree_string_flags.
+ (dump_function_name): Likewise. Use dump_template_parms.
+ (dump_template_parms): New static function broken out of
+ dump_function_name.
+ (dump_expr_list): Adjust prototype. Use tree_string_flags.
+ (dump_expr): Likewise.
+ (fndecl_as_string): Removed
+ (type_as_string_real): Removed
+ (dump_binary_op): Adjust prototype. Use tree_string_flags.
+ (dump_unary_op): Likewise.
+ (type_as_string): Likewise.
+ (expr_as_string): Likewise.
+ (decl_as_string): Likewise.
+ (context_as_string): New function.
+ (lang_decl_name): Adjust.
+ (decl_to_string): New static print callback.
+ (expr_to_string): Likewise.
+ (fndecl_to_string): Likewise.
+ (code_as_string): Renamed to ...
+ (code_to_string): ... here. Adjust.
+ (language_as_string): Renamed to ...
+ (language_to_string): ... here. Adjust.
+ (parm_as_string): Renamed to ...
+ (parm_to_string): ... here.
+ (op_as_string): Renamed to ...
+ (op_to_string): ... here.
+ (assop_as_string): Renamed to ...
+ (assop_to_string): ... here.
+ (type_to_string): New static print callback.
+ (args_as_string): Renamed to ...
+ (args_to_string): ... here. Adjust.
+ (cv_as_string): Renamed to ...
+ (cv_to_string): ... here. Adjust.
+ * pt.c (mangle_class_name_for_template): Use tree_string_flags.
+ (print_template_context): Likewise.
+
+1999-09-26 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (expand_throw): Remove prototype.
+ * except.c (expand_throw): Make it static. Use tree-generation
+ functions, rather than RTL-generation functions.
+ (build_throw): Use it.
+ * expr.c: Include except.h.
+ (cplus_expand_expr): Don't call expand_throw here.
+ * Makefile.in (expr.o): Depend on except.h.
+ * ir.texi: Update documentation for THROW_EXPR.
+
+ * decl.c (start_function): Set x_dont_save_pending_sizes rather
+ than calling get_pending_sizes.
+ * init.c (build_new): Don't save and restore
+ immediate_size_expand; instead, assert that it has the expected
+ value already.
+
+1999-09-26 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * lex.c (compiler_error): Add missing call to va_end().
+
+1999-09-25 Mark Mitchell <mark@codesourcery.com>
+
+ * dump.c (dequeue_and_dump): Handle RESULT_DECL.
+ * ir.texi: Document RESULT_DECL and DECL_RESULT.
+
+ * cp-tree.h (check_return_expr): New function.
+ * decl.c (finish_constructor_body): New function.
+ (pushdecl): Put global friend functions in namespace binding
+ level, not the class binding level.
+ (finish_destructor_body): Make sure the dtor_label is always
+ defined. Fix typo in comment.
+ (finish_function): Move generation of constructor-termination code
+ to semantic-analysis time. Move generation of implicit `main'
+ return value to semantic-analysis time.
+ * semantics.c (finish_return_stmt): Generate goto's to
+ ctor_label/dtor_label here. Use check_return_expr to do semantic
+ analysis on the returned expression.
+ * typeck.c (maybe_warn_about_returning_address_of_local): New
+ function split out from c_expand_return.
+ (check_return_expr): Likewise.
+ (c_expand_return): Just generate the RTL for the return.
+
+1999-09-24 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (CPTI_CLEANUP_TYPE): New macro.
+ (cleanup_type): Likewise.
+ (search_tree): Change prototype.
+ * decl.c (local_variable_p): Adjust for new interface to
+ search_tree.
+ (check_default_argument): Likewise.
+ * error.c (dump_expr): Handle INIT_EXPR.
+ * except.c (expand_throw): Don't make cleanup_type a local static.
+ * expr.c (cplus_expand_expr): Don't handle NEW_EXPR.
+ * init.c (build_new): Call build_new_1 directly, rather than
+ building a NEW_EXPR.
+ (build_new_1): Tidy. Don't build a VEC_INIT_EXPR except when
+ processing file-scope initializers.
+ * lex.c (init_parse): Add an opname_tab entry for INIT_EXPR.
+ * tree.c: Include splay-tree.h
+ (no_linkage_helper): Adjust for new interface to search_tree.
+ (search_tree): Pass around pointers to tree nodes, rather than the
+ nodes themselves. Handle VEC_INIT_EXPR.
+ (no_linkage_check): Adjust for new interface to search_tree.
+ (mapcar): Handle VEC_INIT_EXPR.
+ (target_remap): New variable.
+ (bot_manip): Use it.
+ (bot_replace): New function.
+ (break_out_target_exprs): Use it to remap all variables used in a
+ default argument expression.
+ * typeck.c (build_modify_expr): Don't crash when outside a
+ function and presented with an INIT_EXPR assignment
+ * Makefile.in (tree.o): Depend on splay-tree.h.
+
+Fri Sep 24 10:48:10 1999 Bernd Schmidt <bernds@cygnus.co.uk>
+
+ * decl.c (duplicate_decls): Use DECL_BUILT_IN_CLASS rather than
+ DECL_BUILT_IN.
+ (builtin_function): New arg CLASS. Arg CODE now of type int. All
+ callers changed.
+ Set the builtin's DECL_BUILT_IN_CLASS.
+
+1999-09-24 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (pushdecl): Don't make local declarations of extern
+ variables give the variable a DECL_CONTEXT for the function.
+ (make_rtl_for_nonlocal_decl): Don't fuss with obstacks. Simplify.
+ Don't accidentally make RTL for local declarations.
+ (emit_local_var): Handle declarations with asm-specifiers here.
+
+1999-09-23 Mark Mitchell <mark@codesourcery.com>
+
+ * ir.texi: Improve documentation for TARGET_EXPRs. Discuss
+ STMT_IS_FULL_EXPR_P.
+
+ * cp-tree.h (language_function): Add cannot_inline.
+ * decl.c (start_function): Restore current_function_cannot_inline
+ from the saved value.
+ (save_function_data): Save current_function_cannot_inline.
+ * decl2.c (start_objects): Change prototype. Build the function
+ in function-at-a-time mode.
+ (finish_objects): Likewise.
+ (generate_ctor_or_dtor_function): Adjust accordingly.
+
+ * cp-tree.h (DECL_ANON_UNION_ELEMS): New macro.
+ * decl2.c (finish_anon_union): Set DECL_ANON_UNION_ELEMS.
+ Don't call expand_anon_union_decl here
+ * semantics.c (exapnd_stmt): Call it here, instead.
+ * typeck.c (mark_addressable): Addressed variables are implicitly
+ used.
+
+1999-09-23 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): New macro.
+ (RECORD_OR_UNION_TYPE_CHECK, LANG_IDENTIFIER_CAST): Likewise.
+ (DEFARG_NODE_CHECK): Remove; replace with DEFAULT_ARG_CHECK.
+ * cp-tree.h: Add tree checking macros to various tree access
+ macros.
+ * ptree.c (print_lang_decl): Test for function or variable
+ before accessing template info.
+
+1999-09-23 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c: Get WCHAR_TYPE_SIZE from wchar_type_node.
+ * lang-specs.h: If -fshort-wchar, override __WCHAR_TYPE__.
+ * decl2.c (lang_f_options): Add -fshort-wchar.
+ * cp-tree.h: Declare flag_short_wchar.
+ * decl.c (init_decl_processing): If -fshort-wchar, use 'short unsigned
+ int' for wchar_t.
+
+1999-09-23 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * ir.texi: Fix formatting errors and typos.
+
+1999-09-22 Mark Mitchell <mark@codesourcery.com>
+
+ * ir.texi: Document CLEANUP_STMT, SCOPE_STMT, and START_CATCH_STMT.
+
+ * decl.c (pushdecl): Do create a binding for extern "C" functions,
+ but not for their DECL_ASSEMBLER_NAMEs.
+ (lookup_name_current_level): Fix formatting.
+ (xref_tag): Likewise.
+ * decl2.c (start_objects): Mark static constructors and
+ destructors as used.
+
+1999-09-22 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (define_case_label): Don't crash if we're not in a switch.
+
+ * decl2.c (lang_decode_option): Don't bother explicitly ignoring flags.
+ * lang-options.h: Restore -fthis-is-variable. Remove help strings
+ for unsupported flags.
+
+1999-09-21 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (lang_decode_option): Accept and ignore -finit-priority.
+ Accept and warn about -fthis-is-variable.
+
+1999-09-21 Mark Mitchell <mark@codesourcery.com>
+
+ * dump.c (dequeue_and_dump): Handle START_CATCH_STMT,
+ CLEANUP_STMT, and SCOPE_STMT.
+
+ * decl2.c (lang_decode_option): Adjust, in the wake of recent
+ changes to option processing.
+
+1999-09-21 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * typeck.c (get_member_function_from_ptrfunc): Allow extraction of
+ function pointer from pmfs with no object given.
+ (convert_for_assignment): Do not return error when converting
+ pmfs.
+
+1999-09-21 Alex Samuel <samuel@codesourcery.com>
+
+ * lex.c (internal_filename): New variable.
+ (INTERNAL_FILENAME): New macro.
+ (init_parse): Allocate internal_filename and mark as root. Use it
+ instead of a string constant.
+
+1999-09-21 Nathan Sidwell <nathan@acm.org>
+
+ Reimplement dynamic cast and catch matching.
+ * cp-tree.h (get_dynamic_cast_base_type): Prototype new function
+ * search.c (dynamic_cast_base_recurse): New function.
+ (get_dynamic_cast_base_type): New function for dynamic cast.
+ * rtti.c (build_dynamic_cast_1): Determine source and target
+ class relationship. Call __dynamic_cast_2.
+ * tinfo.h (__user_type_info::upcast): New catch dispatcher.
+ (__user_type_info::dyncast): New dynamic cast dispatcher.
+ (__user_type_info::sub_kind): New nested enumeration.
+ (__user_type_info::contained_p): sub_kind predicate.
+ (__user_type_info::contained_public_p): Likewise.
+ (__user_type_info::contained_nonpublic_p): Likewise.
+ (__user_type_info::contained_nonvirtual_p: Likewise.
+ (__user_type_info::upcast_result): New nested struct.
+ (__user_type_info::dyncast_result): New nested struct.
+ (*::do_upcast): New catch function.
+ (*::do_dyncast): New dynamic cast function.
+ (__user_type_info::find_public_subobj): New dynamic cast
+ helper dispatcher.
+ (*::do_find_public_subobj): New dynamic cast helper function.
+ * tinfo.cc (__user_type_info::upcast): Define catch dispatcher.
+ (__user_type_info::dyncast): Define dynamic cast dispatcher.
+ (*::do_upcast): Define catch function.
+ (*::do_dyncast): Define dynamic cast function.
+ (*::do_find_public_subobj): Define dynamic cast helper function.
+ * tinfo2.cc (__throw_type_match_rtti_2): Use upcast.
+ (__dynamic_cast): Backwards compatibility wrapper. Use dyncast.
+ (__dynamic_cast_2): New dynamic cast runtime.
+
+1999-09-20 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (finish_stmt_expr): Change prototype.
+ * expr.c (cplus_expand_expr): Adjust call accordingly.
+ * init.c (finish_init_stmts): Likewise.
+ * parse.y (primary): Likewise.
+ * pt.c (tsubst_copy): Likewise.
+ * semantics.c (finish_stmt_expr): Don't take two parameters.
+ Don't remove generated BLOCKs from the block-tree.
+
+ Remove support for assigning to `this'.
+ * NEWS: Note that fact.
+ * class.c (build_vbase_path): Don't check flag_this_is_variable.
+ * cp-tree.h (EXPR_STMT_ASSIGNS_THIS): Remove.
+ (language_function): Remove assigns_this, just_assigned_this, and
+ x_base_init_expr. Add x_vcalls_possible_p. Add vtbls_set_up_p.
+ (base_init_expr): Remove.
+ (current_vcalls_possible_p): New macro.
+ (vtbls_set_up_p): Likewise.
+ (emit_base_init): Change prototype.
+ * decl.c (finish_destructor_body): New function, split out from
+ finish_function.
+ (current_function_assigns_this): Remove.
+ (current_function_just_assigned_this): Likewise.
+ (start_function): Don't set them.
+ (finish_function): Don't check them. Don't emit
+ base-initialization code here. Generate code for destructors when
+ doing semantic analysis.
+ (finish_stmt): Don't check current_function_just_assigned_this.
+ * decl2.c (lang_f_options): Remove this-is-variable.
+ (lang_decode_option): Likewise.
+ (grokclassfn): Don't check flag_this_is_variable.
+ * init.c (emit_base_init): Return the expression generated.
+ (construct_virtual_bases): Don't push/pop obstacks. Fix
+ typo.
+ (build_new_1): Don't check flag_this_is_variable.
+ (get_temp_regvar): Don't set DECL_REGISTER.
+ (build_vec_init): Don't call use_variable.
+ * lang-options.h: Remove "-fthis-is-variable" and
+ "-fno-this-is-variable".
+ * pt.c (tsubst_expr): Don't check EXPR_STMT_ASSIGNS_THIS.
+ * search.c (expand_upcast_fixups): Use finish_expr_stmt, not
+ expand_expr_stmt.
+ * semantics.c (finish_expr_stmt_real): Rename to ...
+ (finish_expr_stmt): This. Remove assigned_this parameter.
+ (begin_if_stmt): Call do_pushlevel before starting the statement.
+ (begin_compound_stmt): Don't declare __FUNCTION__ in scope-less
+ blocks.
+ (setup_vtbl_ptr): Emit initialization code for bases and members
+ at semantic-analysis time. Emit code to initialize vtables in
+ destructors here.
+ (expand_stmt): Use finish_expr_stmt, not finish_expr_stmt_real.
+ Don't handle CTOR_INITIALIZER any more.
+ * typeck.c (build_modify_expr): Don't check for assignments to
+ this.
+ (c_expand_return): Don't suggest assigning to `this'.
+
+ * Makefile.in (decl.o): Depend on RTL_H.
+ (decl2.o): Likewise.
+ (class.o): Likewise.
+ (call.o): Likewise.
+ (method.o): Likewise.
+ (search.o): Likewise.
+ (tree.o): Likewise.
+ (pt.o): Likewise.
+
+ * decl.c (duplicate_decls): When a builtin function is redeclared
+ as static, make sure it is mangled correctly.
+
+ * ir.texi (CTOR_INITIALIZER): Remove mention. Fix typo. Add
+ detail about the statement-tree.
+
+1999-09-20 Nathan Sidwell <nathan@acm.org>
+
+ * parse.y (primary): Use build_functional_cast for CV_QUALIFIER.
+
+1999-09-20 Nick Clifton <nickc@cygnus.com>
+
+ * decl2.c (lang_decode_option): Extend comment.
+
+Mon Sep 20 10:49:05 1999 Bernd Schmidt <bernds@cygnus.co.uk>
+
+ * typeck.c: Include "tm_p.h".
+
+1999-09-19 Mark Mitchell <mark@codesourcery.com>
+
+ * ir.texi: New file.
+
+1999-09-19 Paul Burchard <burchard@pobox.com>
+
+ * semantics.c (expand_stmt): Initialize return value.
+
+1999-09-18 Paul Burchard <burchard@pobox.com>
+
+ * gxxint.texi: G++ now implements namespaces.
+
+1999-09-18 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (pop_label): Don't warn about unused labels more than
+ once.
+ * semantics.c (finish_goto_stmt): Always marked used labels as
+ used.
+
+ * decl.c (layout_var_decl): Change prototype. Call layout_decl
+ even when the declaration is external.
+ (cp_finish_decl): Adjust call to layout_var_decl.
+ * pt.c (tsubst_expr): Make sure to initialize stmt before using it.
+
+1999-09-18 Martin von Loewis <loewis@informatik.hu-berlin.de>
+
+ * typeck.c (get_member_function_from_ptrfunc): Always consider
+ virtuality inside member pointer.
+
+1999-09-17 Mark Mitchell <mark@codesourcery.com>
+
+ Turn on function-at-a-time processing.
+ * cp-tree.h (doing_semantic_analysis_p): New macro.
+ (SF_DEFAULT): Define to zero, not SF_EXPAND.
+ (start_handler_parms): Change prototype.
+ (expand_start_catch_block): Likewise.
+ (expand_end_catch_block): Likewise.
+ (expand_start_eh_spec): Likewise.
+ (expand_end_eh_spec): Declare.
+ (finish_handler_parms): Change prototype.
+ (begin_catch_block): Declare.
+ (finish_handler): Change prototype.
+ (do_pushlevel): Declare.
+ (do_poplevel): Likewise.
+ * decl.c (pushlevel): Don't create
+ binding levels when not doing semantic analysis.
+ (poplevel): Don't pop them.
+ (pushdecl): Assert that we are never called when not doing
+ semantic analysis.
+ (pushdecl_top_level): Use push_to_top_level.
+ (make_label_decl): Don't fiddle with obstacks. Make RTL For the
+ label when expanding.
+ (cp_finish_decl): Only inject for-scope variables when doing
+ semantic analysis. Add comments.
+ (start_handler_parms): Return the handler parm.
+ (start_function): Reorganize. Don't clear DECL_INITIAL if it is
+ already set. Reinitialize from saved function data if available.
+ Don't pushlevel when not doing semantic analysis.
+ (store_parm_decls): Only generate RTL when expanding. Only
+ pushdecl when doing semantic analysis. Set
+ current_eh_spec_try_block if appropriate.
+ (finish_function): Simplify. Use do_pushlevel and do_poplevel.
+ Combine common code. Don't poplevel when not doing semantic
+ analysis.
+ (push_cp_function_context): Don't expand functions without an
+ explicit call to expand_body.
+ (mark_lang_function): Make eh_spec_try_block and
+ x_scope_stmt_stack.
+ * except.c (expand_end_eh_spec): Don't
+ declare.
+ (process_start_catch_block): Likewise.
+ (push_eh_cleanup): Use finish_decl_cleanup.
+ (initialize_handler_parm): New function.
+ (expand_start_catch_block): Use it.
+ (expand_end_catch_block): Use tree-generation functions, not
+ RTL-generation functions.
+ (expand_start_eh_spec): Likewise.
+ (expand_end_eh_spec): Likewise.
+ (expand_exception_blocks): Simplify.
+ (start_anon_func): Use do_pushlevel.
+ (end_anon_func): Use do_poplvel. Call expand_body for the
+ function.
+ * expr.c (do_case): Don't call define_case_label.
+ * init.c (create_temporary_var): Set DECL_CONTEXT for local
+ variables.
+ * method.c (emit_thunk): Call expand_body for the
+ thunk.
+ (sythesize_method): Likewise.
+ * parse.y (handler_args): Give it ttype.
+ (eat_saved_input): Call expand_body.
+ (base_init): Use do_pushlevel.
+ (pending_inline): Call expand_body.
+ (handler): Adjust calls to finish_handler_parms and
+ finish_handler.
+ (handler_args): Don't call expand_start_catch_block. Return the
+ catch parameter. * pt.c (tsubst_expr): Adjust HANDLER handling.
+ * parse.c: Regenerated.
+ * rtti.c (synthesize_tinfo_fn): Call finish_function.
+ * semantics.c (do_pushlevel): Give it external linkage. Build
+ SCOPE_STMTs.
+ (do_poplevel): Likewise.
+ (finish_case_label): Call define_case_label when doing semantic
+ analysis.
+ (finish_goto_stmt): Create RTL for labels.
+ (finish_function_try_block): Set in_function_try_handler
+ unconditionally.
+ (finish_function_handler_sequence): Unset it.
+ (finish_handler_parms): Use expand_start_catch_block even when
+ building a statement-tree.
+ (begin_catch_block): New function.
+ (finish_handler): Move a little RTL-generation logic here.
+ (finish_decl_cleanup): Allow cleanups for empty declarations.
+ (finish_named_return_value): Don't pushdecl when not doing
+ semantic analysis.
+ (expand_stmt): Don't do semantic analysis for variable
+ declarations. Handle START_CATCH_STMT. Call expand_label
+ directly for a LABEL_STMT. Tweak handling of GOTO_STMT. Adjust
+ HANDLERs. Handle SCOPE_STMT, CTOR_INITIALIZER, and RETURN_INIT.
+ (expand_body): Let expand_stmt handle CTOR_INITIALIZER,
+ RETURN_INIT and function try blocks.
+
+ * cp-tree.h (language_function): Add x_eh_spec_try_block. Add
+ x_scope_stmt_stack. Add x_in_charge_parm.
+ (current_eh_spec_try_block): New macro.
+ (current_scope_stmt_stack): Likewise.
+ (current_in_charge_parm): Likewise.
+ * decl.c (start_function): Initialize current_in_charge_parm.
+ (finish_function): Use current_in_charge_parm rather than looking
+ up __in_chrg.
+ * search.c (expand_indirect_vtbls_init): Likewise.
+
+ * cp-tree.def (CLEANUP_STMT): Fix spelling in dumps.
+ (TRY_BLOCK): Likewise.
+ (HANDLER): Likewise.
+ (START_CATCH_STMT): New tree node.
+ (SCOPE_STMT): Likewise.
+ * cp-tree.h (SCOPE_BEGIN_P): New macro.
+ (SCOPE_NULLIFIED_P): Likewise.
+ (struct lang_decl_flags): Add pending_inline_p. Adjust dummy.
+ (struct lang_decl): Add saved_language_function.
+ (DECL_PENDING_INLINE_INFO): Adjust documentation.
+ (DECL_PENDING_INLINE_P): New macro.
+ (TYPE_TI_ARGS): Fix typo in comment.
+ (DECL_SAVED_TREE): Add to documentation.
+ (DECL_SAVED_FUNCTION_DATA): New macro.
+ (START_CATCH_TYPE): Likewise.
+ (SCOPE_END_P): New macro.
+ (declare_parm_level): Don't declare.
+ * decl.c (mark_lang_function): New function, split out from
+ mark_cp_function_context.
+ (save_function_data): New function.
+ (declare_parm_level): Remove.
+ (finish_function): Use save_function_data to squirrel away
+ important stuff for later use.
+ (mark_cp_function_context): Use mark_function_data.
+ (lang_mark_tree): Likewise.
+ * lex.c (begin_definition_of_inclass_inline): Set
+ DECL_PENDING_INLINE_P.
+ (store_pending_inline): Clear it.
+ * pt.c (tsubst_decl): Likewise.
+
+1999-09-17 Nathan Sidwell <nathan@acm.org>
+
+ * call.c (perform_implicit_conversion): Deal with error_mark_node.
+
+1999-09-17 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (warn_extern_redeclared_static): Don't get confused by
+ static member functions.
+ (duplicate_decls): Merge DECL_THIS_STATIC.
+
+ * decl.c (expand_static_init): Make sure assignments to local
+ statics actually occur.
+
+1999-09-17 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (poplevel_class): Declare.
+ * class.c (popclass): Use poplevel_class, not poplevel.
+ * decl.c (poplevel_class): Don't make it static. Don't return a
+ value.
+ (poplevel): Don't call poplevel_class; abort in a class
+ binding level is seen.
+ * semantics.c (finish_translation_unit): Use pop_everything.
+ * parse.y (member_init): Allow errors.
+ (pending_inline): Call finish_function.
+ * parse.c: Regenerated.
+ * Makefile.in (CONFLICTS): Adjust.
+
+1999-09-17 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * error.c: Reduce code duplication.
+ (dump_template_value): New function.
+ (dump_type_real): Use it.
+ (dump_decl): Likewise.
+ (dump_function_name): Likewise.
+ (dump_function_decl): Don't be too talkative about function return
+ type variety.
+
+1999-09-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * lex.c (init_cpp_parse): Call xcalloc, not malloc/bzero.
+
+ * xref.c (SALLOC): Call xstrdup, not xmalloc/strcpy.
+
+1999-09-16 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_file): Also call check_global_declarations for
+ the pending_statics list.
+
+1999-09-15 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (cp_pragma_implementation): Allow #pragma implementation
+ in header files.
+
+1999-09-15 Richard Henderson <rth@cygnus.com>
+
+ * lex.c (mark_impl_file_chain): Follow the next chain.
+
+1999-09-15 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (warn_extern_redeclared_static): Simplify. Catch
+ problems with extern "C" functions redeclared as static.
+ (duplicate_decls): When a builtin is redeclared static, make the
+ new function have internal linkage.
+
+1999-09-15 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (build_expr_from_tree): Handle VA_ARG_EXPR.
+ * pt.c (tsubst_copy): Likewise.
+ * tree.c (search_tree): Likewise.
+ (mapcar): Likewise.
+
+1999-09-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * typeck2.c (ack): Don't declare progname.
+
+1999-09-14 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
+
+ * lex.c (cp_pragma_interface, cp_pragma_implementation): Copy
+ filenames with ggc_alloc_string.
+
+1999-09-14 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (build_target_expr): Set TREE_SIDE_EFFECTS on the
+ TARGET_EXPR.
+ * call.c (build_over_call): Don't set TREE_SIDE_EFFECTS on
+ the TARGET_EXPR.
+ * cvt.c (build_up_reference): Likewise.
+ * tree.c (build_cplus_new): Likewise.
+ (get_target_expr): Likewise.
+
+Tue Sep 14 01:45:10 1999 Marc Espie <espie@cvs.openbsd.org>
+
+ * Makefile.in: Prepend $(SHELL) to move-if-change calls.
+
+1999-09-13 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (build_target_expr): New function.
+ * call.c (build_conditional_expr): Use build_target_expr.
+ (convert_like): Likewise.
+ (build_over_call): Likewise.
+ * cvt.c (build_up_reference): Likewise.
+ * decl.c (build_cleanup_on_safe_obstack): Fold into ...
+ (destroy_local_var): Here.
+ (build_target_expr): New function.
+ * tree.c (build_cplus_new): Use it.
+ (get_target_expr): Likewise.
+
+1999-09-13 Nathan Sidwell <nathan@acm.org>
+
+ * typeck.c (expr_sizeof): Don't decay arrays and functions.
+ Remove misleading comment.
+ (build_compound_expr): Don't decay arrays.
+
+1999-09-13 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_conditional_expr): Always use a TARGET_EXPR for
+ class rvalues again.
+
+Sun Sep 12 23:29:07 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Make-lang.in (g++spec.o): Depend on system.h and gcc.h.
+
+ * g++spec.c: Include gcc.h.
+ (lang_specific_driver): Constify a char*. Call xcalloc, not
+ xmalloc/bzero. All calls to the function pointer parameter now
+ explicitly call `fatal'.
+
+1999-09-12 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (implicit_conversion): Robustify. Handle OFFSET_REFs.
+ * cvt.c (ocp_convert): Complete the from and destination types.
+ Adjust warning about functions always being `true' in conditionals.
+ * decl.c (duplicate_decls): Don't play funny games with abort.
+ * error.c (dump_expr): Handle OVERLOADs.
+ * spew.c (probe_obstack): Remove.
+ * typeck.c (condition_conversion): Use perform_implicit_conversion.
+
+1999-09-12 Bernd Schmidt <bernds@cygnus.co.uk>
+
+ * cp-tree.h (auto_function, define_function): Adjust prototypes.
+ * decl.c (define_function): Lose FUNCTION_CODE arg. All callers
+ changed.
+ (auto_function): Likewise, for CODE arg.
+ Move code to set DECL_BUILT_IN and DECL_FUNCTION_CODE to...
+ (builtin_function): ... here.
+
+1999-09-11 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (add_decl_to_level): Remove TREE_PERMANENT assertion.
+ (init_decl_processing): Don't set TREE_PERMANENT for the
+ error_mark_node.
+ (start_decl): Don't rebuild non-permanent ARRAY_TYPEs.
+ (grokdeclarator): Likewise.
+ (grokparms): Don't check TREE_PERMANENT when building up lists.
+ * decl2.c (grokfield): Don't assert TREE_PERMANENT.
+ (mark_inline_for_output): Likewise.
+ * expr.c (cplus_expand_expr): Don't check TREE_PERMANENT.
+ * init.c (build_offset_ref): Don't check TREE_PERMANENT.
+ * lex.c (check_newline): Don't check ggc_p; it is always one.
+ * pt.c (process_template_parm): Don't check TREE_PERMANENT.
+ * spew.c (yylex): Don't copy_node or probe_obstacks for
+ non-permanent CONSTANTs and STRINGs.
+ * tree.c (build_cplus_array_type_1): Don't fuss with
+ TREE_PERMANENT on ARRAY_TYPEs.
+
+ * cp-tree.def (CLEANUP_STMT): New node.
+ * cp-tree.h (language_function): Add name_declared.
+ (current_function_name_declared): New macro.
+ (CLEANUP_DECL): New macro.
+ (CLEANUP_EXPR): Likewise.
+ (emit_local_var): Likewise.
+ (finish_decl_cleanup): New function.
+ * cvt.c (build_up_reference): Simplify.
+ (ocp_convert): Remove dead code.
+ * decl.c (start_decl): Remove call to add_decl_stmt.
+ (grok_reference_init): Adjust, to handle bindings temporaries to
+ references. Remove dead code.
+ (initialize_local_var): Don't generate RTL for
+ declarations here, or build cleanups here. Don't fuss with
+ obstacks. Replace expand_start_target_temps calls with explicit
+ setting of stms_are_full_exprs_p.
+ (destroy_local_var): New function.
+ (emit_local_var): Likewise.
+ (cp_finish_decl): Use them, as appropriate.
+ (start_function): Announce template functions.
+ (store_parm_decls): Don't call declare_function_name here.
+ (finish_stmt): Don't start emit base-initialization code when just
+ building the statement-tree.
+ * init.c (create_temporary_var): Move add_decl_stmt call ...
+ (get_temp_regvar): Here.
+ * pt.c (tsubst_expr): Make DECL_INITIAL look like what
+ cp_finish_decl would expect. Don't call add_decl_stmt.
+ * semantics.c (begin_compound_stmt): Call declare_function_name,
+ if appropriate.
+ (finish_decl_cleanup): New function.
+ (expand_stmt): Use emit_local_var to output variables.
+ (expand_body): Set current_function_name_declared.
+
+1999-09-10 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (finish_cleanup_try_block): New function.
+ * semantics.c (finish_cleanup_try_block): Add comment.
+
+Fri Sep 10 10:32:32 1999 Bernd Schmidt <bernds@cygnus.co.uk>
+
+ * cp-tree.h: Delete declarations for all tree nodes now moved to
+ global_trees.
+ * decl.c: Delete their definitions.
+ (SHORT_TYPE_SIZE, INT_TYPE_SIZE, LONG_TYPE_SIZE, LONG_LONG_TYPE_SIZE,
+ FLOAT_TYPE_SIZE, DOUBLE_TYPE_SIZE, LONG_DOUBLE_TYPE_SIZE): Don't
+ provide defaults.
+ (init_decl_processing): Call build_common_tree_nodes and
+ build_common_tree_nodes_2 instead of building their nodes here.
+ Don't add gc roots for them.
+
+1999-09-10 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (language_function): Rename expanding_p to
+ x_expanding_p. Rename named_label_uses to x_named_label_uses.
+ (expanding_p): Adjust accordingly.
+ (TREE_VIA_PRIVATE): Fix typo in comment.
+ (DECL_REFERENCE_SLOT): Remove.
+ (SET_DECL_REFERENCE_SLOT): Likewise.
+ * decl.c (named_label_uses): Adjust. Remove chicken comment.
+ (push_overloaded_decl): Don't truncate the chain of bindings when
+ adding an overloaded function.
+ (grok_reference_init): Don't use DECL_REFERENCE_SLOT.
+ (initialize_local_var): Fix typo in comment.
+ (store_parm_decls): Don't set DECL_REFERENCE_SLOT. Tidy up.
+ * decl2.c (start_objects): Make the fact that we are expanding
+ the generated function right away explicit.
+ (start_static_storage_duration_function): Likewise.
+ (finish_file): Fix typo in comment.
+ * init.c (build_vec_init): Correct bugs in handling cleanups.
+ * semantics.c (maybe_convert_cond): New function.
+ (FINISH_COND): Always store the condition, even if there's
+ a declaration.
+ (finish_if_stmt_cond): Use maybe_convert_cond.
+ (finish_while_stmt_cond): Likewise.
+ (finish_do_stmt): Likewise.
+ (finish_for_cond): Likewise.
+ (expand_cond): Adjust.
+
+ * cp-tree.h (FN_TRY_BLOCK_P): New macro.
+ * init.c (perform_member_init): Remove obstack machinations.
+ (expand_cleanup_for_base): Likewise.
+ (finish_init_stmts): Mark the statement-expression as used.
+ * method.c (emit_thunk): Use tree-generating functions, not
+ RTL.
+ (do_build_copy_constructor): Likewise.
+ (do_build_assign_ref): Likewise.
+ (synthesize_method): Likewise. Keep track of line numbers.
+ * pt.c (tsubst_expr): Handle various kinds of try blocks.
+ * semantics.c (expand_stmts): Remove.
+ (begin_function_try_block): Set FN_TRY_BLOCK_P.
+ (finish_function_try_block): Be careful rechaining
+ function try blocks.
+ (expand_stmt): Loop through all the statements at a given level.
+ (exapnd_body): Be careful with line-numbers here too. Prepare for
+ being called directly from the parser.
+
+ * cp-tree.h (finish_function): Adjust prototype.
+ * decl.c (finish_function): Return the function compiled.
+ * pt.c (instantiate_decl): Don't play games with obstacks.
+ * tree.c (mapcar): Handle OFFSET_REF and BIT_FIELD_REF.
+ (search_tree): Likewise.
+ * typeck.c: Fix typo in comment.
+ * typeck2.c (store_init_value): Add comment.
+
+ * cp-tree.h (CPTI_ATEXIT): New macro.
+ (atexit_node): Likewise.
+ * decl.c (destroy_local_static): New function, broken out from ...
+ (expand_static_init): Here.
+
+ * rtti.c (get_tinfo_var): These should always be global
+ (expand_si_desc): Use tree, not RTL, functions to generate code.
+ (expand_class_desc): Likewise.
+ (expand_ptr_desc): Likewise.
+ (expand_attr_desc): Likewise.
+ (expand_generic_desc): Likewise.
+ (synthesize_tinfo_fn): Likewise.
+
+1999-09-09 Mark Mitchell <mark@codesourcery.com>
+
+ * semantics.c (RECHAIN_STMTS): Remove `last' parameter.
+ (RECHAIN_STMTS_FROM_LAST): Remove. Replace all uses with
+ RECHAIN_STMTS.
+ (RECHAIN_STMST_FROM_CHAIN): Likewise.
+
+ * parse.y (simple_stmt): Fix typo in last change.
+
+ * cp-tree.h (EXPR_STMT_ASSIGNS_THIS): New macro.
+ (STMT_IS_FULL_EXPR_P): Likewise.
+ (STMT_LINENO_FOR_FN_P): Likewise.
+ (prep_stmt): New function.
+ (building_stmt_tree): Tweak for safety.
+ * pt.c (tsubst_expr): Use prep_stmt throughout.
+ (add_tree): Move it to semantics.c
+ * semantics.c (add_tree): Move it here.
+ (finish_expr_stmt_real): New function.
+ (finish_expr_stmt): Use it.
+ (finish_if_stmt_cond): Use FINISH_COND.
+ (finish_while_stmt_cond): Likewise.
+ (finish_for_cond): Likewise.
+ (finish_stmt_tree): Tweak line-number handling.
+ (prep_stmt): New function.
+ (expand_stmt): Use it.
+
+ * cp-tree.h (begin_switch_stmt): Adjust prototype.
+ (finish_switch_cond): Likewise.
+ * parse.y (simple_stmt): Adjust accordingly.
+ * parse.c: Regenerated.
+ * pt.c (tsubst_expr): Adjust accordingly.
+ * semantics.c (expand_cond): New function.
+ (FINISH_COND): New macro.
+ (begin_switch_stmt): Build the SWITCH_STMT here.
+ (finish_switch_stmt_cond): Not here.
+ (expand_stmt): Adjust calls to begin_switch_stmt and
+ finish_switch_cond. Use expand_cond throughout.
+
+ * dump.c (dequeue_and_dump): Dump types for constants.
+ Describe DECL_ARG_TYPE more intuitively.
+ Handle ARRAY_REF.
+
+ * decl.c (lang_mark_tree): Mark TYPE_LANG_SPECIFIC.
+ (lang_cleanup_tree): Remove.
+ * lex.c (make_lang_type): Use ggc_alloc to allocate
+ TYPE_LANG_SPECIFIC.
+
+ Reorganize per-function data.
+ * cp-tree.h (saved_scope): Add function_decl, bindings.
+ (language_function): Rename binding_level to bindings.
+ (cp_function_chain): Use the current_function, not the
+ outer_function_chain.
+ (current_class_ptr): Make it work, even when there's no
+ current function.
+ (current_class_ref): Likewise.
+ (SF_DEFAULT, SF_PRE_PARSED, SF_INCLASS_INLINE, SF_EXPAND): New
+ macros.
+ (clear_temp_name): Remove.
+ * decl.c (check_function_type): New function, broken out from
+ start_function.
+ (current_binding_level): Adjust definition.
+ (pushlevel): Simplify.
+ (poplevel): Don't use named_label_uses when we're outside
+ a function scope.
+ (mark_saved_scope): Mark function_decl and bindings.
+ (maybe_push_to_top_level): Don't unconditionally push a new
+ function context. Save bindings and the current_function_decl.
+ Don't clear named_labels.
+ (pop_from_top_level): Pop function context if appropriate.
+ (init_decl_processing): Set init_lang_status and free_lang_status,
+ rather than save_lang_status and restore_lang_status.
+ (start_function): Take SF_* flags. Don't clear per-function data.
+ Reorder and simplify to use new per-function data code. Add
+ asserts.
+ (store_parm_decls): Don't call init_function_start here.
+ (finish_function): Adjust for new handling of per-function data.
+ (push_cp_function_context): Simplify.
+ (mark_cp_function_context): Change binding_level to bindings.
+ * decl2.c (clear_temp_name): Remove.
+ (start_objects): Use SF flags to start_function.
+ (start_static_storage_duration_function): Likewise.
+ * except.c (start_anon_func): Remove redundant calls to
+ push_function_context_to. Use SF flags to start function.
+ (end_anon_func): Remove redundant call to pop_function_context
+ from.
+ * lex.c (reinit_parse_for_function): Don't initialize per-function
+ data.
+ * method.c (emit_thunk): Clear current_function after calling
+ assemble_end_function. Use SF flags for start_function.
+ (synthesize_method): Use SF flags for start_function.
+ * parse.c: Regenerated.
+ * parse.y (fn.defpen): Likewise.
+ (pending_inline): Clear current_function, even if something goes
+ wrong.
+ * pt.c (instantiate_decl): Use SF flags to start_function.
+ Don't save and restore expanding_p.
+ (add_tree): Handle the case where we are outside any function.
+ (end_tree): Likewise.
+ * rtti.c (sythesize_tinfo_fn): Use SF flags to start_function.
+ * semantics.c (begin_function_definition): Likewise.
+ (expand_body): Likewise.
+
+1999-09-09 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (convert_to_void): Prototype new function.
+ (require_complete_type_in_void): Remove prototype.
+ * cvt.c (convert_to_void): New function.
+ (ocp_convert): Use convert_to_void.
+ * decl.c (cplus_expand_expr_stmt): Likewise, for complete
+ expressions.
+ * typeck.c (require_complete_type_in_void): Remove function.
+ (build_compound_expr): Use convert_to_void.
+ (build_static_cast): Likewise.
+ (build_c_cast): Likewise.
+ * semantics.c (finish_expr_stmt): Do not decay full expressions.
+
+ * typeck.c (build_x_compound_expr): Add FIXME.
+
+1999-09-08 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (scratch_tree_cons): Remove.
+ * call.c: Replace all uses of expr_tree_cons, saveable_tree_cons,
+ and perm_tree_cons with plain tree_cons.
+ * class.c: Likewise.
+ * decl.c: Likewise.
+ * decl2.c: Likewise.
+ * except.c: Likewise.
+ * expr.c: Likewise.
+ * init.c: Likewise.
+ * lex.c: Likewise.
+ * method.c: Likewise.
+ * parse.y: Likewise.
+ * pt.c: Likewise.
+ * repo.c: Likewise.
+ * rtti.c: Likewise.
+ * search.c: Likewise.
+ * typeck.c: Likewise.
+ * parse.c: Regenerated.
+ * tree.c (build_srcloc): Simplify.
+
+1999-09-08 Bruce Korb autogen@linuxbox.com
+
+ * Makefile.in: Give the gperf user a hint about why "gperf -F" fails.
+
+1999-09-08 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (lang_decl_flags): Remove permanent_attr.
+ Remove next.
+ (LANG_DECL_PERMANENT): Remove.
+ * decl.c (duplicate_decls): Don't mess about with obstacks trying
+ to free memory.
+ (lang_mark_tree): Mark DECL_LANG_SPECIFIC.
+ * lex.c (free_lang_decl_chain): Remove.
+ (build_lang_decl): Don't use obstacks.
+ (retrofit_lang_decl): Likewise.
+ (copy_lang_decl): Likewise.
+
+ * cp-tree.h (saved_scope): Remove old_binding_level and
+ function_decl. Tidy up.
+ * decl.c (mark_saved_scope): Don't set them.
+ (maybe_push_to_top_level): Clear memory.
+
+ * decl.c (layout_var_decl): Change prototype. Don't complete
+ types for external objects.
+ (check_initializer): Likewise. Tidy.
+ (initialize_local_var): Complete types here.
+ (cp_finish_decl): Not here. Reorganize a little.
+ (grokvardecl): Don't complete types here.
+
+ * decl.c (start_function): Clear last_dtor_insn and
+ last_parm_cleanup_insn.
+ (push_cp_function_context): Just copy over a little of
+ the old context, not all of it.
+
+ * cp-tree.h (copy_to_permanent): Remove.
+ (permanent_p): Likewise.
+ * decl.c (building_typename_type): Don't use copy_to_permanent.
+ (start_decl): Likewise.
+ (grok_reference_init): Likewise.
+ (cp_finish_decl): Likewise.
+ * init.c (build_new_1): Don't use mapcar.
+ (build_vec_delete_1): Don't use copy_to_permanent.
+ (build_vec_init): Likewise.
+ * parse.y (primary): Likewise.
+ * parse.c: Regenerated.
+ * pt.c (push_template_decl_real): Don't use copy_to_permanent.
+ (lookup_template_class): Likewise.
+ (tsubst_friend_function): Likewise.
+ (instantiate_class_template): Likewise.
+ (tsubst_decl): Likewise.
+ (tsubst): Likewise.
+ (instantiate_template): Likewise.
+ (unify): Likewise.
+ * rtti.c (get_tinfo_fn): Likewise.
+ (build_dynamic_cast): Likewise.
+ * semantics.c (finish_if_stmt_cond): Likewise.
+ (finish_while_stmt_cond): Likewise.
+ (finish_do_stmt): Likewise.
+ (finish_for_cond): Likewise.
+ (finish_for_expr): Likewise.
+ (finish_cleanup): Likewise.
+ (add_decl_stmt): Likewise.
+ (finish_named_return_value): Likewise.
+ (finish_qualified_call_expr): Likewise.
+ * tree.c (perm_manip): Remove.
+ (build_exception_variant): Don't use copy_to_permanent.
+ (permanent_p): Remove.
+ (copy_to_permament): Remove.
+ (build_min_nt): Don't use copy_to_permanent.
+ (build_min): Likewise.
+ (min_tree_cons): Likewise.
+ * typeckc.c (build_static_cast): Likewise.
+ (build_reinterpret_cast): Likewise.
+ (build_const_cast): Likewise.
+
+1999-09-07 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (ggc_p): Set it to 1.
+ (mark_saved_scope): Add prototype.
+
+1999-09-07 Richard Henderson <rth@cygnus.com>
+
+ * cp-tree.h (C_PROMOTING_INTEGER_TYPE_P): Delete.
+ * typeck.c (self_promoting_args_p): Delete.
+
+1999-09-07 Jason Merrill <jason@yorick.cygnus.com>
+
+ * search.c (binfo_for_vtable): Use CLASSTYPE_VFIELD_PARENT.
+ (dfs_bfv_queue_p, dfs_bfv_helper, struct bfv_info): Remove.
+
+1999-09-07 Mark Mitchell <mark@codesourcery.com>
+
+ * Makefile.in (tree.o): Depend on ggc.h.
+ * class.c (make_method_vec): Remove.
+ (free_method_vec): Likewise.
+ (free_method_vecs): Remove.
+ (add_method): Don't use them.
+ * cp-tree.def (PTRMEM_CST): Make it longer.
+ (TEMPLATE_PARM_INDEX): Make it shorter.
+ * cp-tree.h (BINDING_HAS_LEVEL_P): New macro.
+ (template_parm_index): Remove RTL field.
+ (ptrmem_cst): Add RTL field.
+ (finish_function): Removed parameter.
+ (process_next_inline): Change prototype.
+ (init_cplus_unsave): Rename to init_tree.
+ (binding_init): Remove.
+ * decl.c (free_binding_nodes): Remove.
+ (push_binding): Don't use them. Set BINDING_HAS_LEVEL_P.
+ (pop_binding): Don't use free_binding_nodes.
+ (free_binding_vecs): Remove.
+ (store_bindings): Don't use them.
+ (pop_from_top_level): Likewise.
+ (lookup_namespace_name): Simplify.
+ (build_typename_type): Don't use obstack_free.
+ (unqualified_namespace_lookup): Simplify.
+ (lookup_name_real): Simplify.
+ (start_function): Remove comment about leaks.
+ (finish_function): Removed nested parameter. Call
+ expand_end_bindings even when building_stmt_tree.
+ Call ggc_push_context and ggc_pop_context around
+ rest_of_compilation, if necessary.
+ (mark_cp_function_context): Handle a NULL language-context.
+ (lang_mark_false_label_stack): Fix typo.
+ (lang_mark_tree): Handle CPLUS_BINDING, OVERLOAD,
+ TEMPLATE_PARM_INDEX. Handle the funny TYPE_LANG_SPECIFIC on
+ pointer to method types.
+ (lang_cleanup_tree): Use free to free TYPE_LANG_SPECIFIC.
+ * decl2.c (finish_objects): Adjust call to finish_function.
+ (finish_static_store_duration_function): Likewise.
+ (do_nonmember_using_decl): Remove call to binding_init.
+ * except.c (end_anon_func): Adjust call to finish_function.
+ * lex.c (mark_impl_file_chain): New function.
+ (init_parse): Call init_tree, not init_cplus_unsave.
+ Add GC roots.
+ (cp_pramga_interface): Use xmalloc, not permalloc.
+ (cp_pragma_implementation): Likewise.
+ (begin_definition_of_inclass_inline): Simplify.
+ (process_next_inline): Adjust prototype.
+ (do_scoped_id): Don't call binding_init.
+ (make_lang_type): Allocate TYPE_LANG_SPECIFIC with xmalloc.
+ * method.c (emit_thunk): Adjust call to finish_function.
+ (synthesize_method): Likewise.
+ * parse.y (%union): Add a new `pi' variant.
+ (PRE_PARSED_FUNCTION_DECL): Use it.
+ (fn.defpen): Likewise.
+ (fndef): Adjust call to finish_function.
+ * pt.c (instantiate_decl): Likewise.
+ * rtti.c (syntheisze_tinfo_fn): Likewise.
+ * semantics.c (expand_body): Likewise.
+ * tree.c: Include ggc.h.
+ (mark_list_hash): New function.
+ (binding_init): Remove.
+ (init_cplus_unsave): Rename to ...
+ (init_tree): This. Add GC roots.
+
+1999-09-05 Mark Mitchell <mark@codesourcery.com>
+
+ Get ready for garbage collection.
+ * Makefile.in (CXX_TREE_H): Add varray.h
+ (lex.o): Depend on ggc.h.
+ (decl.o): Likewise.
+ (decl2.o): Likewise.
+ (method.o): Likewise.
+ (search.o): Likewise.
+ (pt.o): Likewise.
+ (repo.o): Likewise.
+ * class.c: Include ggc.h.
+ (current_class_name): Remove.
+ (current_class_type): Likewise.
+ (current_access_specifier): Likewise.
+ (previous_class_type): Likewise.
+ (previous_class_values): Likewise.
+ (class_cache_firstobj): Likewise.
+ (current_lang_base): Likewise.
+ (current_lang_stack): Likewise.
+ (current_lang_stacksize): Likewise.
+ (lang_name_c): Likewise.
+ (lang_name_cplusplus): Likewise.
+ (lang_name_java): Likewise.
+ (current_lang_name): Likewise.
+ (base_layout_decl): Likewise.
+ (access_default_node): Likewise.
+ (access_public_node): Likewise.
+ (access_protected_node): Likewise.
+ (access_private_node): Likewise.
+ (access_default_virtual_node): Likewise.
+ (access_public_virtual_node): Likewise.
+ (access_protected_virtual_node): Likewise.
+ (access_private_virtual_node): Likewise.
+ (signed_zero_node): Likewise.
+ (init_class_processing): Don't build base_layout_decl.
+ (push_lang_context): Adjust now that current_lang_base is a varray.
+ (pop_lang_context): Likewise.
+ * cp-tree.h: Include varray.h.
+ (cp_global_trees): Add access_default, access_public,
+ access_protected, access_private, access_default_virtual,
+ access_public_virtual, access_protected_virtual,
+ access_private_virtual, ctor_identifier, delta2_identifier,
+ delta_identifier, dtor_identifier, in_charge_identifier,
+ index_identifier, nelts_identifier, this_identifier,
+ pfn_identifier, pfn_or_delta2_identifier, vptr_identifier,
+ lang_name_c, lang_name_cplusplus, lang_name_java,
+ empty_except_spec, null, jclass, minus_one, terminate.
+ (saved_scope): Move here from decl.c. Define globals in terms of
+ saved_scope: current_namespace, current_class_name,
+ current_class_type, current_access_specifier, current_lang_stack,
+ current_lang_base, current_lang_name, current_function_parms,
+ current_template_parms, processing_template_decl,
+ processing_specialization, processing_explicit_instantiation,
+ previous_class_type, previous_class_values, class_cache_firstobj.
+ (scope_chain): New variable.
+ (init_pt): New function.
+ * decl.c (current_namespace): Remove.
+ (this_identifier, in_charge_identifier, ctor_identifier): Likewise.
+ (dtor_identifier, pfn_identifier, index_identifier): Likewise.
+ (delta_identifier, delta2_identifier): Likewise.
+ (pfn_or_delta2_identifier, tag_identifier): Likewise
+ (vt_off_identifier, empty_except_spec, null_node): Likewise.
+ (current_function_parms, current_lang_base): Remove.
+ (current_lang_stack, previous_class_values): Remove.
+ (class_binding_level): Macroize.
+ (saved_scope): Remove.
+ (current_saved_scope): Rename to scope_chain.
+ (mark_saved_scope): Adjust for new scope structure.
+ (maybe_push_to_top_level): Likewise.
+ (pop_from_top_level): Likewise.
+ (duplicate_decls): Adjust now that current_lang_base is a varray.
+ (build_typename_type): Call ggc_add_tree_hash_table_root.
+ (init_decl_processing): Call init_pt. Call push_to_top_level to
+ set up globals. Add GC roots.
+ (xref_basetypes): Adjust now that current_lang_base is a varray.
+ * decl.h (this_identifier): Remove.
+ (in_charge_identifier): Likewise.
+ * decl2.c: Don't include varray.h.
+ (current_namespace): Remove.
+ (init_decl2): Add GC roots.
+ * except.c (Terminate): Remove.
+ (init_exception_processing): Use terminate_node instead.
+ (build_terminate_handler): Likewise.
+ * init.c (nc_nelts_field_id): Remove.
+ (minus_one): Likewise.
+ (init_init_processing): Use minus_one_node and nelts_identifier
+ instead. Add GC roots.
+ (jclass_node): Remove.
+ (build_new_1): Use nelts_identifier.
+ (build_vec_init): Likewise.
+ (build_vec_delete): Likewise.
+ * lex.c: Include ggc.h.
+ (defarg_fn): Move declaration early.
+ (defarg_parms): Likewise.
+ (init_parse): Add GC roots.
+ (handle_cp_pragma): Remove redundant declaration of
+ pending_vtables.
+ * method.c: Include ggc.h.
+ (btypelist): Make it a varray. All uses changed.
+ (ktypelist): Likewise.
+ (init_method): Add GC roots.
+ * pt.c: Don't include varray.h. Include ggc.h.
+ (current_template_parms): Remove.
+ (processing_template_decl): Likewise.
+ (processing_specialization): Likewise.
+ (processing_explicit_instantiation): Likewise.
+ (init_pt): New function.
+ * repo.c: Include ggc.h.
+ (init_repo): Add GC roots.
+ * search.c: Don't include varray.h.
+ (_vptr_name): Remove.
+ (lookup_field_1): Use vtpr_identifier instead.
+ (expand_indirect_vtbls_init): Remove redundant declaration of
+ in_charge_identifier.
+ (init_search_processing): Use vptr_identifier.
+
+1999-09-05 Richard Henderson <rth@cygnus.com>
+ Bernd Schmidt <bernds@cygnus.co.uk>
+ Mark Mitchell <mark@codesourcery.com>
+
+ * Makefile.in (parse.o): Depend on ggc.h.
+ (decl2.o): Depend on ggc.h.
+ (init.o): Depend on ggc.h.
+ * cp-tree.h (init_decl2): Declare.
+ (cp_parse_init): Likewise.
+ * decl.c (ggc_p): Define to zero.
+ (mark_saved_scope): New function.
+ (init_decl_processing): Call cp_parse_init, and cp_decl2.
+ Register GC roots.
+ (expand_static_init): Add GC roots.
+ * decl2.c: Include ggc.h.
+ (init_decl2): New function.
+ * init.c: Include ggc.h.
+ (init_init_processing): Add GC roots.
+ * parse.y: Include ggc.h.
+ (cp_parse_init): New function.
+
+1999-09-04 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (init_decl_processing): Set mark_lang_status.
+ (lang_mark_false_label_stack): Adjust prototype.
+ * decl2.c (grok_function_init): Remove extraneous declaration of
+ abort_fndecl.
+
+ * Make-lang.in (cc1plus): Remove dependency on GGC.
+ * Makefile.in (OBJS): Don't mention ggc-simple.o.
+ (OBJDEPS): Don't mention ggc-simple.o.
+
+ * Make-lang.in (cc1plus): Depend on $(GGC).
+ * Makefile.in (OBJS): Add ggc-simple.o.
+ (OBJDEPS): Likewise.
+ * cp-tree.h (language_function): Rename members to `x_' versions;
+ we now have x_named_labels, x_ctor_label, x_dtor_label,
+ x_base_init_list, x_member_init_list, x_base_init_expr,
+ x_current_class_ptr, x_current_class_ref, x_last_tree,
+ x_last_expr_type, x_last_dtor_insn, x_last_parm_cleanup_insn, and
+ x_result_rtx.
+ (dtor_label, ctor_label, current_base_init_list,
+ current_member_init_list, base_init_expr, current_class_ptr,
+ current_class_ref, last_tree, last_expr_type): Adjust accordingly.
+ * decl.c: Include ggc.h.
+ (last_dtor_insn): Adjust to use x_ names.
+ (last_parm_cleanup_insn): Likewise.
+ (original_result_rtx): Likewise.
+ (named_labels): Likewise.
+ (mark_binding_level): New function.
+ (mark_cp_function_context): Likewise.
+ (mark_false_label_stack): Likewise.
+ (lang_mark_tree): Likewise.
+ (lang_cleanup_tree): Likewise.
+
+1999-09-03 Mark Mitchell <mark@codesourcery.com>
+
+ * Makefile.in (CXX_TREE_H): Include function.h.
+ (decl.o): Don't depend on function.h.
+ (decl2.o): Likewise.
+ (typeck.o): Likewise.
+ (init.o): Likewise.
+ (method.o): Likewise.
+ * cp-tree.h: Include function.h.
+ (cp_function): Rename to language_function. Remove next.
+ (cp_function_chain): Make it a macro, not a variable.
+ (push_cp_function_context): Don't declare.
+ (pop_cp_function_context): Likewise.
+ * decl.c: Don't include function.h.
+ (push_cp_function_context): Make it static. Make it suitable for
+ a save_lang_status callback.
+ (pop_cp_function_context): Likewise.
+ (maybe_push_to_top_level): Call push_function_context_to, not
+ push_cp_function_context.
+ (pop_from_top_level): Call pop_function_context_from, not
+ pop_cp_function_context.
+ (init_decl_processing): Set save_lang_status and
+ restore_lang_status. Call push_function_context_to, not
+ push_cp_function_context.
+ (cp_function_chain): Remove.
+ * decl2.c: Don't include function.h.
+ * except.c: Don't include function.h.
+ (start_anon_func): Call push_function_context_to, not
+ push_cp_function_context.
+ (end_anon_func): Call pop_function_context_from, not
+ pop_cp_function_context.
+ * init.c: Don't include function.h.
+ * lex.c (begin_definition_of_inclass_inline): Call
+ push_function_context_to, not push_cp_function_context.
+ (process_next_inline): Call pop_function_context_from, not
+ pop_cp_function_context.
+ * method.c: Don't include function.h.
+ (synthesize_method): Call push_function_context_to, not
+ push_cp_function_context. Call pop_function_context_from, not
+ pop_cp_function_context.
+ * typeck.c: Don't include function.h.
+
+ * decl.c (expand_static_init): Tweak handling of static
+ initializations for objects without constructors.
+
+1999-09-03 Nathan Sidwell <nathan@acm.org>
+
+ * typeck.c (build_indirect_ref): Reject dereference of pointer to
+ void.
+
+1999-09-02 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (cp_function): Move here, from decl.c.
+ (cp_function_chain): Declare.
+ (dtor_label): New macro, instead of variable.
+ (ctor_label): Likewise.
+ (current_base_init_list): Likewise.
+ (current_member_init_list): Likewise.
+ (base_init_expr): Likewise.
+ (current_class_ptr): Likewise.
+ (current_class_ref): Likewise.
+ (last_tree): Likewise.
+ (last_expr_type): Likewise.
+ (current_function_returns_value): Likewise.
+ (current_function_returns_null): Likewise.
+ (current_function_just_assigned_this): Likewise.
+ (current_function_parms_stored): Likewise.
+ (temp_name_counter): Likewise.
+ (static_labelno): Likewise.
+ (expanding_p): Likewise.
+ (stmts_are_full_exprs_p): Likewise.
+ (in_function_try_handler): Likewise.
+ (lang_type): Remove nested type_flags. All uses changed.
+ * call.c (ctor_label): Remove.
+ (dtor_label): Likewise.
+ * class.c (current_class_ptr): Remove.
+ (current_class_ref): Likewise.
+ * decl.c (static_labelno): Remove.
+ (dtor_label): Likewise.
+ (last_dtor_insn): New macro, instead of variable.
+ (last_parm_cleanup_insn): Likewise.
+ (original_result_rtx): Likewise.
+ (in_function_try_handler): Remove.
+ (named_label_uses): New macro, instead of variable.
+ (named_labels): Likewise.
+ (current_function_returns_value): Remove.
+ (current_function_returns_null): Likewise.
+ (current_function_assigns_this): New macro, instead of variable.
+ (current_function_just_assigned_this): Likewise.
+ (current_binding_level): Likewise.
+ (init_decl_processing): Call push_cp_function_context.
+ (cp_function): Move to cp-tree.h
+ (cp_function_chain): Make it global.
+ (temp_name_counter): Remove.
+ (push_cp_function_context): Simplify.
+ (pop_cp_function_context): Likewise.
+ * decl2.c (temp_name_counter): Remove.
+ * init_c (current_base_init_list): Likewise.
+ (current_member_init_list): Likewise.
+ (base_init_expr): Likewise.
+ * method.c (static_labelno): Likewise.
+ * pt.c (last_tree): Likewise.
+ * semantics.c (expanding_p): Likewise.
+ (stmts_are_full_exprs_p): Likewise.
+ (last_expr_type): Likewise.
+ * typeck.c (dtor_label): Likewise.
+ (ctor_label): Likewise.
+
+1999-09-01 Alex Samuel <samuel@codesourcery.com>
+
+ * decl2.c (arg_assoc_template_arg): New prototype. New function.
+ (arg_assoc_class): Use arg_assoc_template_arg for template
+ arguments.
+ (arg_assoc): Likewise.
+ * pt.c (mangle_class_name_for_template): Allow member template
+ template arguments.
+
+1999-09-02 Nathan Sidwell <nathan@acm.org>
+
+ * call.c (build_conditional_expr): Warn on enum mismatches.
+ (convert_arg_to_ellipsis): Move non-pod check to after
+ conversion.
+
+1999-09-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * gxx.gperf (hash, is_reserved_word): Add prototypes.
+
+ * init.c (build_vec_init): Initialize variable `try_block'.
+
+ * lex.c (init_parse): Call memcpy, not bcopy, to avoid casts.
+ Likewise for bzero/memset.
+ (token_getch, token_put_back): Add static prototypes. Remove
+ `inline' from the definitions.
+ (retrofit_lang_decl): Call memset, not bzero, to avoid casts.
+
+1999-09-01 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (lang_type): Move align into type_flags.
+ (CLASSTYPE_ALIGN): Adjust accordingly.
+ * call.c (direct_reference_binding): Remove misleading comment.
+
+1999-08-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * parse.y (language_string): Constify.
+
+1999-08-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * repo.c (getpwd): Don't prototype.
+ * xref.c (getpwd): Likewise
+
+1999-08-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (LIBS, LIBDEPS): Link with & depend on libiberty.a.
+ Remove hacks for stuff which now comes from libiberty.
+
+1999-08-30 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (IS_AGGR_TYPE_2): Fix typo.
+
+1999-08-30 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (begin_init_stmts): Declare.
+ (finish_init_stmts): Likewise.
+ * cvt.c (build_up_reference): Wrap the declaration of a temporary
+ in a statement-expression so that we will see it when expanding
+ tree structure later.
+ * init.c (begin_init_stmts): Don't make it static.
+ (finish_init_stmts): Likewise.
+
+ * cp-tree.h (start_handler_parms): New function.
+ (expand_start_catch_block): Take only one parameter.
+ (start_handler_parms): New function.
+ * decl.c (start_handler_parms): Define it.
+ * except.c (process_start_catch_block): Take only one parameter.
+ Don't call grokdeclarator here.
+ (expand_start_catch_block): Don't call grokdeclarator here,
+ either.
+ * parse.y (handler_args): Adjust call to
+ expand_start_catch_block. Use start_handler_parms.
+ * pt.c (push_template_decl_real): Make permanent lists have
+ permanent elements.
+ (tsubst_expr): Adjust calls to expand_start_catch_block
+ appropriately.
+ * semantics.c (expand_stmt): Likewise.
+
+1999-08-29 Alex Samuel <samuel@codesourcery.com>
+
+ * pt.c (push_template_decl_real): Use template declaration from
+ class type if it exists.
+
+1999-08-29 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (TYPE_NEEDS_CONSTRUCTING): Remove #if 0'd definition.
+ (maybe_inject_for_scope_var): Declare it.
+ (initialize_local_var): Likewise.
+ * decl.c (maybe_inject_for_scope_var): Make it global.
+ (initialize_local_var): Likewise. Move cleanup handling here,
+ from cp_finish_decl.
+ (make_rtl_for_nonlocal_decl): Use
+ push_obstacks_nochange/pop_obstacks, rather than
+ end_temporary_allocation/resume_temporary_allocation.
+ (cp_finish_decl): Try to complete the type of a variable when it
+ is declared. Move cleanup-handling to initialize_local_var.
+ (expand_static_init): Use tree-building code, rather than
+ RTL-building code.
+ * decl2.c (get_temp_name): Assert non-initializedness of
+ temporaries.
+ * init.c (create_temporary_var): Move RTL-assigning code to ...
+ (get_temp_regvar): Here.
+ * pt.c (tsbust_expr): Fix indentation. Call cp_finish_decl here.
+ * semantics.c (expand_stmt): Don't call cp_finish_decl here. Just
+ call initialize_local_var to generate initialization code.
+
+1999-08-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h (fndecl_as_string, type_as_string,
+ type_as_string_real, args_as_string, decl_as_string,
+ expr_as_string, code_as_string, language_as_string,
+ parm_as_string, op_as_string, assop_as_string, cv_as_string,
+ lang_decl_name, cp_file_of, lang_printable_name): Constify a char*.
+
+ * errfn.c (cp_printer): Likewise.
+
+ * error.c (cp_printer, fndecl_as_string, type_as_string_real,
+ type_as_string, expr_as_string, decl_as_string, lang_decl_name,
+ cp_file_of, code_as_string, language_as_string, parm_as_string,
+ op_as_string, assop_as_string, args_as_string, cv_as_string):
+ Likewise.
+
+ * tree.c (lang_printable_name): Likewise.
+
+1999-08-28 Richard Henderson <rth@cygnus.com>
+
+ * decl2.c (arg_assoc_class): Bail if the class is a builtin type.
+
+1999-08-28 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (strip_array_types): New function.
+ * decl.c (maybe_deduce_size_from_array_init): New function, split
+ out from cp_finish_decl.
+ (layout_var_decl): Likewise.
+ (maybe_commonize_var): Likewise.
+ (maybe_inject_for_scope_var): Likewise.
+ (initialize_local_var): Likewise.
+ (build_cleanup_on_safe_obstack): Likewise.
+ (check_initializer): Likewise.
+ (make_rtl_for_nonlocal_decl): Likewise.
+ (cp_finish_decl): Use them.
+ * typeck.c (strip_array_types): New function.
+
+ * cp-tree.def (LABEL_STMT): New tree node.
+ * cp-tree.h (LABEL_STMT_LABEL): New macro.
+ (shadow_label): Remove.
+ (declare_local_label): New function.
+ (finish_label_decl): Likewise.
+ * decl.c (make_label_decl): New function, split out from
+ lookup_label.
+ (shadowed_labels): Remove.
+ (binding_level): Add shadowed_labels.
+ (clear_binding_level): Remove.
+ (push_binding_level): Just bzero the new binding level.
+ (pushlevel): Fix indentation.
+ (pop_label): New function.
+ (pop_labels): Likewise, split out from poplevel.
+ (poplevel): Pop local labels. Use pop_labels.
+ (maybe_push_to_top_level): Don't clear shadowed_labels.
+ (lookup_label): Use make_label_decl.
+ (shadow_label): Remove.
+ (declare_local_label): New function.
+ (define_label): Simplify.
+ (start_function): Don't clear shadowed_labels.
+ (cp_function): Remove shadowed_labels.
+ (push_cp_function_context): Don't save shadowed_labels.
+ (pop_cp_function_context): Don't restore it.
+ * dump.c (dequeue_and_dump): Handle LABEL_STMT.
+ * parse.y (label_decl): Use finish_label_decl.
+ * pt.c (tsubst_expr): Handle LABEL_STMTs, and local label
+ declarations.
+ * semantics.c (finish_label_stmt): Add a LABEL_STMT when
+ building_stmt_tree.
+ (finish_label_decl): New function.
+ (expand_stmt): Handle LABEL_STMTs and local label declarations.
+
+1999-08-26 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (lookup_label): Build labels on the permanent obstack
+ when building statement trees. Don't build RTL for labels when
+ building statement trees.
+ * semantics.c (finish_goto_stmt): Use LABEL_DECLs even when
+ building statement trees.
+ (finish_label_stmt): Likewise.
+ (expand_stmt): Adjust accordingly.
+ * pt.c (tsubst_expr); Likewise.
+ (do_decl_instantiation): Robustify.
+
+ * cp-tree.h (AGGR_INIT_VIA_CTOR_P): New macro.
+ * tree.c (build_cplus_new): Set it.
+ * expr.c (cplus_expand_expr): Use it.
+ * dump.c (deque_and_dump): Handle AGGR_INIT_EXPR.
+
+ * decl.c (store_parm_decls): Reset immediate_size_expand.
+ (finish_function): Likewise.
+
+ * tree.c (cplus_unsave_expr_now): Don't return a value.
+
+ * semantics.c (do_poplevel): Always initialize the return value.
+
+1999-08-26 Gavin Romig-Koch <gavin@cygnus.com>
+
+ * cp-tree.h (cplus_unsave_expr_now) : Correct return type.
+ * tree.h (cplus_unsave_expr_now) : Same.
+
+1999-08-25 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (grokdeclarator): Amend comment.
+ * except.c (expand_start_catch_block): Call push_template_decl for
+ catch-block parameters.
+ * method.c (synthesize_method): Build an empty compound statement
+ for the body of a constructor.
+
+1999-08-25 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (cp_build_qualified_type_real): If we're asking for the
+ same quals we already have, just return.
+
+1999-08-25 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.def (SUBOBJECT): New tree node.
+ * cp-tree.h (CLEANUP_P): New macro.
+ (SUBOBJECT_CLEANUP): Likewise.
+ (keep_next_level): Add parameter.
+ (get_temp_regvar): Don't declare.
+ (emit_base_init): Remove parameter.
+ (expand_aggr_init): Rename to build_aggr_init.
+ (expand_vec_init): Rename to build_vec_init.
+ (do_pushlevel): Remove.
+ (do_poplevel): Likewise.
+ (finish_cleanup): New function.
+ (finish_subobject): Likewise.
+ (stmts_are_full_exprs_p): New variable.
+ * decl.c (keep_next_level): Add parameter.
+ (cp_finish_decl): Use build_aggr_init, not
+ expand_aggr_init. Use finish_expr_stmt to expand the code.
+ (expand_static_init): Use tree-generating, not RTL-generating,
+ functions to handle the initialization.
+ (start_function): Remove dead code. Always have a momentary
+ obstack inside the function, even before hitting the first curly
+ brace.
+ (cplus_expand_expr_stmt): Move calls to
+ expand_{start,end}_target_temps into semantics.c.
+ (cp_function): Add stmts_are_full_exprs_p.
+ (push_cp_function_context): Save it.
+ (pop_cp_function_context): Restore it.
+ * decl2.c (get_temp_regvar): Move to init.c.
+ (do_static_initialization): Use build_{aggr,vec}_init.
+ (do_static_destruction): Fix typo in comment.
+ * dump.c (dequeue_and_dump): Handle INIT_EXPR.
+ * except.c (expand_throw): Use create_temporary_var.
+ * expr.c (cplus_expand_expr): Use build_{aggr,vec}_init.
+ * init.c (expand_vec_init_try_block): Remove.
+ (expand_vec_init_catch_clause): Likewise.
+ (get_temp_regvar): New function.
+ (begin_init_stmts): Likewise.
+ (finish_init_stmts): Likewise.
+ (perform_member_init): Use build_{aggr,vec}_init. Build up tree
+ structure here.
+ (emit_base_init): Likewise. Remove unused parameter.
+ (expand_virtual_init): Likewise.
+ (expand_cleanup_for_base): Use finish_subobject.
+ (expand_aggr_vbase_init_1): Simplify.
+ (construct_virtual_bases): Use tree-generating functions to build
+ up initialization.
+ (expand_aggr_init): Likewise. Rename to build_aggr_init.
+ (expand_default_init): Likewise.
+ (expand_aggr_init_1): Likewise.
+ (expand_vec_init): Rename to build_vec_init.
+ * method.c (do_build_copy_constructor): Use tree-generating
+ functions. Don't call clear_last_expr.
+ (do_build_assign_ref): Likewise.
+ (synthesize_method): Call clear_last_expr here.
+ * parse.y (base_init): Don't call clear_last_expr here.
+ (nodecls): Likewise.
+ * pt.c (tsubst_expr): Handle a TRY_BLOCK with CLEANUP_P set.
+ * semantics.c (do_pushlevel): Move to here.
+ (do_poplevel): Likewise.
+ (stmts_are_full_exprs_p): New variable.
+ (finish_expr_stmt): Handle logic for temoprary cleanup here.
+ (finish_for_stmt): Use finish_expr_stmt.
+ (finish_cleanup): New function.
+ (finish_function_try_block): Fix indentation.
+ (finish_subobject): New function.
+ (setup_vtbl_ptr): Call keep_next_level here.
+ (finish_stmt_expr): Handle a block with no scope inside the
+ statement-expression.
+ (expand_stmt): Handle a TRY_BLOCK with CLEANUP_P set. Handle
+ SUBOBJECT.
+ * tree.c (search_tree): Handle INIT_EXPR.
+ (mapcar): Likewise.
+ * typeck.c (build_modify_expr): Don't build an RTL_EXPR.
+ * typeck2.c (store_init_value): Change expand_aggr_init to
+ build_aggr_init in comment.
+
+1999-08-25 Mark Mitchell <mark@codesourcery.com>
+
+ * dump.c (dequeue_and_dump): Dump TARGET_EXPRs.
+
+1999-08-25 Nathan Sidwell <nathan@acm.org>
+
+ * decl2.c (handle_class_head): Be graceful about additional
+ scope qualifiers. Adjust comments to reflect reality.
+
+1999-08-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_conditional_expr): Fix typo.
+ * typeck.c (build_modify_expr, COND_EXPR): Make sure we've got an
+ lvalue before trying to mess with the sides.
+
+ * error.c (dump_expr, CONVERT_EXPR): Handle (void) properly.
+
+Mon Aug 23 22:17:20 1999 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * g++spec.c (lang_specific_driver): Add room for NULL in arglist.
+
+1999-08-23 Jason Merrill <jason@yorick.cygnus.com>
+
+ * exception.cc (__cplus_type_matcher): Call __throw_type_match_rtti_2.
+ Return arbitrary pointer or NULL.
+ (check_eh_spec): Call __throw_type_match_rtti_2.
+ * tinfo.h (*::dcast): Return int. Add valp parm.
+ * tinfo.cc (*::dcast): Likewise. Adjust to allow for null pointers.
+ * tinfo2.cc (__throw_type_match_rtti_2): Likewise.
+ (__throw_type_match_rtti): Now just a wrapper.
+
+ * except.c: Lose CatchMatch, FirstExceptionMatch, and Unwind.
+ (init_exception_processing): Don't initialize them.
+
+1999-08-23 Paul Burchard <burchard@pobox.com>
+
+ * decl.c (check_default_argument): Fix typo.
+
+1999-08-22 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.def (STMT_EXPR): Fix typo in node name.
+
+ * dump.c (dump_next_stmt): New function.
+ (dequeue_and_dump): Use it.
+
+ * pt.c (tsubst_copy): Make sure to initialize return value for a
+ STMT_EXPR, even when processing_template_decl.
+ * semantics.c (finish_stmt_expr): A statement-expression whose
+ last statement is not an expression-statement has type `void'.
+
+1999-08-20 Mark Mitchell <mark@codesourcery.com>
+
+ * semantics.c (finish_stmt_expr): Fix typo in comment.
+ * tree.c (search_tree): Handle EXIT_EXPR, LOOP_EXPR.
+ (mapcar): Likewise.
+ * init.c (build_vec_delete_1): Make the children of a permanent
+ BIND_EXPR permanent.
+ * pt.c (register_specialization): Don't register a specialization
+ more than once.
+
+1999-08-18 Andrew Haley <aph@cygnus.com>
+
+ * method.c (process_overload_item): Call build_mangled_C9x_name ()
+ for all integer parameter types larger than long long.
+
+1999-08-19 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (redeclare_class_template): Merge default template
+ arguments in both directions.
+
+ * typeck.c (common_type): Undo 1999-08-18 change. Remove
+ compiler_error message.
+
+1999-08-19 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h: Declare flag_use_repository.
+ * pt.c (do_decl_instantiation): Don't complain about duplicate
+ instantiation with -frepo.
+ (do_type_instantiation): Likewise.
+
+ * pt.c (push_template_decl_real): Complain about everything
+ that isn't a valid template.
+
+ * decl2.c (import_export_decl): If -fnew-abi, class linkage doesn't
+ affect inlines.
+
+1999-08-19 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.def (PSEUDO_DTOR_EXPR): New tree code.
+ * decl2.c (build_expr_from_tree): Handle it.
+ * error.c (dump_expr): Likewise.
+ * pt.c (for_each_template_parm): Likewise.
+ (tsubst_copy): Likewise.
+ * tree.c (search_tree): Likewise.
+ * semantics.c (finish_pseudo_destructor_call): Create it.
+
+1999-08-18 Mark Mitchell <mark@codesourcery.com>
+
+ * search.c (setup_class_bindings): Robustify.
+ * typeck.c (common_type): Use same_type_p, not pointer equality,
+ to compare types.
+
+ * cp-tree.h (build_lang_field_decl): Remove.
+ * class.c (build_vtable): Replace calls to build_lang_field_decl
+ with build_lang_decl.
+ (prepare_fresh_vtable): Likewise.
+ (finish_struct_1): Likewise.
+ (init_class_processing): Likewise.
+ * decl.c (push_using_decl): Likewise.
+ (init_decl_processing): Likewise.
+ (grokvardecl): Likewise.
+ (build_ptrmemfunc_type): Likewise.
+ (grokdeclarator): Likewise.
+ (build_enumerator): Likewise.
+ * decl2.c (grok_x_components): Likewise.
+ (do_class_using_decl): Likewise.
+ * except.c (call_eh_info): Likewise.
+ * init.c (init_init_processing): Likewise.
+ * rtti.c (expand_class_decl): Likewise.
+ * tree.c (build_base_fields): Likewise.
+ (build_vbase_pointer_fields): Likewise.
+ * lex.c (build_lang_decl): Build declarations on the permanent
+ obstack if we're building statmeent trees.
+ (retrofit_lang_decl): Handle both the full lang_decl and also the
+ smaller lang_decl_flags here.
+ (build_lang_field_decl): Remove.
+ * pt.c (push_template_decl_real): Issue errors for variable
+ declarations that are not static members.
+
+1999-08-18 Richard Henderson <rth@cygnus.com>
+
+ * tree.c (search_tree): Handle TRUTH_{AND,OR,XOR}_EXPR too.
+ (mapcar): Likewise.
+
+1999-08-17 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (back_end_hook): New variable.
+ * decl2.c (back_end_hook): Define it.
+ (finish_file): If it's non-NULL, call it.
+
+ * decl.c (add_decl_to_level): New function.
+ (push_local_binding): Use it.
+ (find_binding): Fix typo in comment.
+ (pushdecl): Use add_decl_to_level. Put templates on the
+ corresponding namespace-scope binding levels.
+ * dump.c (dequeue_and_dump): Print the specializations of a
+ template.
+ * pt.c (push_template_decl_real): Don't push a template multiple
+ times.
+
+1999-08-17 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (CALL_DECLARATOR_PARMS): New macro.
+ (CALL_DECLARATOR_QUALS): Likewise.
+ (CALL_DECARATOR_EXCEPTION_SPEC): Likewise.
+ * decl.c (grokdeclarator): Adjust to use them.
+ * decl2.c (grokfield): Likewise.
+ (reparse_absdcl_as_casts): Likewise.
+ * lex.c (make_call_declarator): Likewise.
+ (set_quals_and_spec): Likewise.
+ * pt.c (tsubst): Likewise.
+ * tree.c (mapcar): Remove special hack to handle third operand of
+ a CALL_EXPR.
+
+1999-08-16 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (CAN_HAVE_FULL_LANG_DECL_P): New macro.
+ * class.c (build_vtable): Use build_lang_field_decl to build the
+ VAR_DECLs for vtables.
+ (prepare_fresh_vtable): Likewise.
+ * decl.c (duplicate_decls): Only copy DECL_SAVED_TREE if
+ CAN_HAVE_FULL_LANG_DECL_P.
+ (push_using_decl): Use build_lang_decl to build USING_DECLs.
+ (grokdeclarator): Use build_lang_decl to build TYPE_DECLs.
+ * lex.c (retrofit_lang_decl): Check CAN_HAVE_FULL_LANG_DECL_P.
+ (build_lang_field_decl): Likewise.
+ (copy_lang_decl): Use CAN_HAVE_FULLLANG_DECL_P to decide how much
+ to copy.
+
+ * cp-tree.def (STMT_EXPR): New tree node.
+ * cp-tree.h (STMT_EXPR_STMT): New macro.
+ (store_return_init): Change prototype.
+ (finish_named_return_value): New function.
+ (expand_stmt): Likewise.
+ (expand_body): Likewise.
+ (begin_stmt_tree): Likewise.
+ (finish_stmt_tree): Likewise.
+ (expanding_p): New variable.
+ (last_expr_type): Likewise.
+ (building_stmt_tree): New macro.
+ * decl.c (start_function): Use building_stmt_tree, not
+ processing_template_decl, where appropriate.
+ (store_parm_decls): Likewise.
+ (store_return_init): Move most of the body to semantics.c.
+ (finish_function): Use building_stmt_tree.
+ (finish_stmt): Clear last_expr_type here.
+ (cp_function): Add expanding_p, last_tree, last_expr_type.
+ (push_cp_function_context): Save them.
+ (pop_cp_function_context): Restore them.
+ * decl2.c (setup_vtbl_ptr): Move to semantics.c.
+ * error.c (dump_expr): Handle STMT_EXPR.
+ * except.c (expand_start_catch_block): Use building_stmt_tree.
+ Use add_decl_stmt.
+ * expr.c (cplus_expand_expr): Handle STMT_EXPR.
+ (do_case): Move add_tree call to semantics.c.
+ * parse.y (return_init): Use finish_named_return_value.
+ (for.init.statement): Use finish_expr_stmt.
+ * parse.c: Regenerated.
+ * pt.c (do_pushlevel): Move to semantics.c.
+ (do_poplevel): Likewise.
+ (tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR.
+ (tsubst_expr): Don't expand all the way to RTL here. Handle
+ RETURN_INIT and CTOR_INITIALIZER.
+ (instantiate_decl): Call expand_body after tsubst'ing into
+ DECL_SAVED_TREE.
+ * semantics.c (expand_stmts): New function.
+ (expanding_p): New variable.
+ (last_expr_type): Likewise.
+ (finish_expr_stmt): Use building_stmt_tree.
+ (begin_if_stmt): Likewise.
+ (finish_if_stmt_cond): Likewise.
+ (finish_then_clause): Likewise.
+ (begin_else_clause): Likewise.
+ (finish_else_clause): Likewise.
+ (begin_while_stmt): Likewise.
+ (finish_while_stmt_cond): Likewise.
+ (finish_while_stmt): Likewise.
+ (finish_do_body): Likewise.
+ (finish_do_stmt): Likewise.
+ (finish_return_stmt): Likewise.
+ (begin_for_stmt): Likewise.
+ (fnish_for_init_stmt): Likewise.
+ (finish_for_cond): Likewise.
+ (finish_for_expr): Likewise.
+ (finish_for_stmt): Likewise.
+ (finish_break_stmt): Likewise.
+ (finish_continue_stmt): Likewise.
+ (finish_switch_cond): Likewise.
+ (finish_switch_stmt): Likewise.
+ (finish_case_label): Call add_tree here if necessary.
+ (finish_goto_statement): Use building_stmt_tree.
+ (begin_try_block): Likewise.
+ (begin_function_try_block): Likewise.
+ (finish_try_block): Likewise.
+ (finish_function_try_block): Likewise.
+ (finish_handler_sequence): Likewise.
+ (finish_function_handler_sequence): Likewise.
+ (begin_handler): Likewise.
+ (finish_handler_parms): Likewise.
+ (finish_handler): Likewise.
+ (begin_compound_stmt): Likewise.
+ (finish_compound_stmt): Likewise.
+ (finish_asm_stmt): Likewise.
+ (finish_label_stmt): Likewise.
+ (finish_named_return_value): New function.
+ (setup_vtbl_ptr): Moved here from decl2.c.
+ (do_pushlevel): Moved here from pt.c.
+ (do_poplevel): Likewise.
+ (begin_stmt_expr): Use building_stmt_tree.
+ (finish_stmt_expr): Likewise. Build a STMT_EXPR, not a BIND_EXPR,
+ when building_stmt_tree.
+ (begin_stmt_tree): New function.
+ (finish_stmt_tree): Likewise.
+ (expand_stmt): Likewise.
+ (expand_body): Likewise.
+ * tree.c (build_cplus_method_type): Make sure the argument types
+ end up on the same obstack as the METHOD_TYPE.
+ (search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR,
+ THROW_EXPR, STMT_EXPR.
+ (mapcar): Break out common cases. Handle COMPOUND_EXPR,
+ MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR. Abort, rather than
+ sorry, if an unsupported node is encountered.
+ * typeck.c (require_complete_type_in_void): Handle BIND_EXPR.
+ (c_expand_return): Don't call add_tree here.
+
+1999-08-15 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (check_default_tmpl_args): Don't check in local scopes.
+ (tsubst_decl): Make sure the declaration is on a saveable
+ obstack. Clear DECL_DEAD_FOR_LOCAL when making a copy of a local
+ variable.
+ (tsubst_expr): Adjust now that DECL_STMTs really contain DECLs.
+
+1999-08-14 Jason Merrill <jason@yorick.cygnus.com>
+
+ Speed up Koenig lookup.
+ * decl.c (unqualified_namespace_lookup): Nonstatic. Add spacep parm
+ to return namespaces we've looked at.
+ * decl2.c (lookup_using_namespace): Likewise.
+ (add_function): Don't call ovl_member.
+ (lookup_arg_dependent): Initialize k.namespaces to the list of
+ namespaces seen in unqualified lookup.
+ * call.c (equal_functions): Move here from tree.c.
+ (joust): Use it to handle duplicate candidates.
+ * tree.c (ovl_member): Use ==.
+
+1999-08-13 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.def (DECL_STMT): Make it smaller.
+ * cp-tree.h (lang_decl_flags): Move saved_tree to ...
+ (lang_decl): ... here. Add next.
+ (DECL_SAVED_TREE): Adjust accordingly.
+ (DECL_IMPLICIT_TYPEDEF_P): New macro.
+ (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise.
+ (DECL_STMT_DECL): Likewise.
+ (create_implicit_typedef): New function.
+ (maybe_push_decl): Likewise.
+ (tsubst_default_argument): New function.
+ (at_function_scope_p): Likewise.
+ (add_decl_stmt): Likewise.
+ (push_permanent_obstack): Likewise.
+ * call.c (convert_default_arg): Use tsubst_default_argument.
+ * class.c (add_method): Use push_permanent_obstack.
+ (build_self_reference): Create a TEMPLATE_DECL for the
+ self-reference, if necessary.
+ * decl.c (pseudo_global_level_p): Only look at the current binding
+ level.
+ (push_binding): Use push_permanent_obstack.
+ (create_implicit_typedef): New function.
+ (pushtag): Use it.
+ (duplicate_decls): Use push_permanent_obstack.
+ (maybe_push_decl): New function.
+ (start_decl): Use it. Remove dead code. Use add_decl_stmt.
+ (start_decl_1): Remove dead code.
+ (cp_finish_decl): Remove DECL_STMT handling here. Don't use
+ pseudo_global_level_p.
+ (grokvardecl): Create DECL_LANG_SPECIFIC for a VAR_DECL in a
+ template.
+ (grokdeclarator): Likewise, for TYPE_DECLs. Don't use
+ pseudo_global_level_p.
+ * decl2.c (grokfield): Call push_template_decl for a TYPE_DECL in
+ a template.
+ (get_sentry): Use push_permanent_obstack.
+ * dump.c (dequeue_and_dump): Enable DECL_STMT.
+ * except.c (call_eh_info): Use push_permanent_obstack.
+ (build_eh_type_ref): Likewise.
+ (do_pop_exception): Likewise.
+ (expand_eh_spec): Likewise.
+ (alloc_eh_object): Likewise.
+ (expand_throw): Likewise.
+ * init.c (build_java_class_ref): Likewise.
+ * lex.c (get_time_identifier): Likewise.
+ (free_lang_decl_chain): Correct type.
+ (retrofit_lang_decl): Adjust accordingly.
+ (build_lang_field_decl): Likewise.
+ * lex.h (free_lang_decl_chain): Likewise.
+ * parse.y (lang_extdef): Don't use pseudo_global_level_p.
+ * parse.c: Regenerated.
+ * pt.c (tsubst_default_arguments): New function.
+ (retrieve_local_specialization): Likewise.
+ (register_local_specialization): Likewise.
+ (push_template_decl_real): Use DECL_IMPLICIT_TYPEDEF_P. Just use
+ pseudo_global_level_p to determine whether or not a template is
+ primary.
+ (lookup_template_class): Likewise. Use create_implicit_typedef.
+ (instantiate_class_template): Call tsubst_default_arguments for
+ member functions, if appropriate.
+ (tsubst_default_argument): New function.
+ (tsubst_decl): Use it. Change TYPE_DECL handling to match VAR_DECLs.
+ * search.c (at_function_scope_p): New function.
+ * semantics.c (finish_asm_stmt): Use push_permanent_obstack.
+ (finish_label_stmt): Likewise.
+ (add_decl_stmt): New function.
+ (begin_class_definition): Likewise.
+ (finish_typeof): Likewise.
+ * tree.c (copy_template_template_parm): Likewise.
+ (copy_to_permanent): Likewise.
+ (push_permanent_obstack): Define.
+ (mark_addressable): Use it.
+ * typeck.c (mark_addressable): Likewise.
+
+1999-08-13 Gavin Romig-Koch <gavin@cygnus.com>
+
+ * cp-tree.h (init_cplus_unsave): New.
+ (cplus_unsave_expr_now): New.
+ * lex.c (init_parse): Call init_cplus_unsave.
+ * tree.c (init_cplus_unsave): New.
+ (cplus_unsave_expr_now): New.
+
+1999-08-13 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (tsubst): Back out 1999-08-06 patch. Use fold and
+ decl_constant_value to simplify array bounds.
+
+1999-08-11 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lang-options.h: Add -fms-extensions.
+ * cp-tree.h: Declare flag_ms_extensions.
+ * decl2.c: Define it.
+ * class.c (instantiate_type): Don't complain about taking the address
+ of a bound member function if -fms-extensions.
+ * typeck.c (build_unary_op): Likewise.
+ * decl.c (grokdeclarator): Or about implicit int.
+ * init.c (resolve_offset_ref): Or about implicit '&'.
+
+1999-08-11 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (minimal_parse_mode): Remove.
+ (finish_label_stmt): New function.
+ * decl.c (saved_scope): Remove minimal parse mode.
+ (maybe_push_to_top_level): Don't save it.
+ (pop_from_top_level): Don't restore it.
+ (define_label): Split out template-handling code to semantics.c.
+ (start_decl): Don't use minimal_parse_mode.
+ (cp_finish_decl): Likewise.
+ (start_function): Don't increment it.
+ (store_return_init): Don't use it.
+ (finish_function): Don't decrement it.
+ * parse.y (label_colon): Use finish_label_stmt throughout.
+ * parse.c: Regenerated.
+ * pt.c (minimal_parse_mode): Don't define it.
+ (tsubst_expr): Use finish_label_stmt.
+ * semantics.c (finish_label_stmt): New function.
+
+ * dump.c (queue): Be careful when computing bitmasks.
+ (dequeue_and_dump): Describe binfos as binfos, not as
+ vectors.
+
+ * parse.y (pedantic): Give it itype. Adjust usage accordingly
+ throughout.
+ * parse.c: Regenerated.
+
+ * Make-lang.in (CXX_SRCS): Remove sig.c.
+ * Makefile.in (CXX_OBJS): Remove sig.o.
+ (sig.o): Remove.
+ * cp-tree.h (CPTI_OPAQUE_TYPE): Remove.
+ (CPTI_SIGNATURE_TYPE): Likewise.
+ (CPTI_SIGTABLE_ENTRY_TYPE): Likewise.
+ (opaque_type_node): Likewise.
+ (signature_type_node): Likewise.
+ (sigtable_entry_type): Likewise.
+ (flag_handle_signatures): Likewise.
+ (lang_type): Remove is_signature, is_signature_pointer,
+ is_signature_reference, has_opaque_typedecls,
+ sigtables_has_been_generated. Adjust dummy. Remove signature,
+ signature_pointer_to, signature_reference_to.
+ (IS_SIGNATURE): Remove.
+ (SET_SIGNATURE): Remove.
+ (CLEAR_SIGNATURE): Remove.
+ (IS_SIGNATURE_POINTER): Remove.
+ (IS_SIGNATURE_REFERENCE): Remove.
+ (SIGNATURE_HAS_OPAQUE_TYPEDECLS): Remove.
+ (SIGTABLE_HAS_BEEN_GENERATED): Remove.
+ (CLASSTYPE_SIGNATURE): Remove.
+ (SIGNATURE_TYPE): Remove.
+ (SIGNATURE_METHOD_VEC): Remove.
+ (SIGNATURE_POINTER_TO): Remove.
+ (SIGNATURE_REFERENCE_TO): Remove.
+ (lang_decl_flags): Remove is_default_implementation. Rename
+ memfunc_pointer_to to saved_tree.
+ (IS_DEFAULT_IMPLEMENTATION): Remove.
+ (DECL_MEMFUNC_POINTER_TO): Remove.
+ (DECL_MEMFUNC_POINTING_TO): Remove.
+ (DECL_SAVED_TREE): Adjust definition.
+ (tag_types): Remove signature_type_node.
+ (SIGNATURE_FIELD_NAME): Remove.
+ (SIGNATURE_FIELD_NAME_FORMAT): Likewise.
+ (SIGNATURE_OPTR_NAME): Likewise.
+ (SIGNATURE_SPTR_NAME): Likewise.
+ (SIGNATURE_POINTER_NAME): Likewise.
+ (SIGNATURE_POINTER_NAME_FORMAT): Likewise.
+ (SIGNATURE_REFERENCE_NAME): Likewise.
+ (SIGNATURE_REFERNECE_NAME_FORMAT): Likewise.
+ (SIGTABLE_PTR_TYPE): Likewise.
+ (SIGTABLE_NAME_FORMAT): Likewise.
+ (SIGTABLE_NAME_FORMAT_LONG): Likewise.
+ (SIGTABLE_TAG_NAME): Likewise.
+ (SIGTABLE_VB_OFF_NAME): Likewise.
+ (SIGTABLE_VT_OFF_NAME): Likewise.
+ (finish_base_specifiers): Change prototype.
+ (build_signature_pointer_type): Remove.
+ (build_signature_reference_type): Remove.
+ (build_signature_pointer_constructor): Remove.
+ (build_signature_method_call): Remove.
+ (build_optr_ref): Likewise.
+ (append_signature_fields): Likewise.
+ (signature_error): Likewise.
+ * call.c (build_this): Remove signature support.
+ (build_over_call): Likewise.
+ (build_new_method_call): Likewise.
+ * class.c (add_implicitly_declared_members): Likewise.
+ (finish_struct_1): Likewise.
+ (finish_struct): Likewise.
+ * cvt.c (cp_convert_to_pointer): Likewise.
+ (convert_to_pointer_force): Likewise.
+ (ocp_convert): Likewise.
+ * decl.c (sigtable_decl_p): Remove.
+ (init_decl_processing): Remove support for signatures.
+ (cp_finish_decl): Likewise.
+ (grokdeclarator): Likewise.
+ (grokparms): Likewise.
+ (xref_tag): Likewise.
+ (start_function): Likewise.
+ (start_method): Likewise.
+ * decl2.c (finish_sigtable_vardecl): Remove.
+ (flag_handle_signatures): Remove.
+ (lang_f_options): Remove handle-signatures.
+ (grokfield): Remove support for signatures.
+ (grokbitfield): Likewise.
+ (finish_file): Likewise.
+ (reparse_absdcl_as_casts): Likewise.
+ * error.c (dump_type_real): Likewise.
+ (dump_function_decl): Likewise.
+ * friend.c (make_friend_class): Likewise.
+ * gxx.gperf: Remove __signature__, signature, __sigof__, sigof.
+ * hash.h: Regenerated.
+ * init.c (build_new_1): Remove support for signatures.
+ * lang-options.h: Remove -fhandle-signatures,
+ -fno-handle-signatures.
+ * lex.c (init_parse): Remove support for signatures.
+ (yyprint): Likewise.
+ * lex.h (rid): Remove RID_SIGNATURE.
+ * method.c (build_decl_overload_real): Remove support for
+ signatures.
+ (hack_identifier): Likewise.
+ * parse.y (base_class): Likewise.
+ (base_class.1): Likewise.
+ (access_specifier): Likewise.
+ * search.c (lookup_member): Likewise.
+ * semantics.c (finish_qualified_object_call_expr): Likewise.
+ (finish_template_type_parm): Likewise.
+ (begin_class_definition): Likewise.
+ (finish_base_specifier): Likewise.
+ * sig.c: Remove.
+ * tree.c (build_cplus_method_type): Remove support for signatures.
+ * typeck.c (require_complete_type): Likewise.
+ (c_sizeof): Likewise.
+ (c_alignof): Likewise.
+ (build_object_ref): Likewise.
+ (build_component_ref): Likewise.
+ (build_indirect_ref): Likewise.
+ (build_c_cast): Likewise.
+ (build_modify_expr): Likewise.
+ (convert_for_initialization): Likewise.
+ * typeck2.c (signature_error): Remove.
+ (store_init_value): Remove support for signatures.
+ (digest_init): Likewise.
+ (build_x_arrow): Likewise.
+ (build_functional_cast): Likewise.
+ * xref.c (GNU_xref_decl): Likewise.
+
+1999-08-10 Martin v. Loewis <martin@mira.isdn.cs.tu-berlin.de>
+
+ * lex.c (do_identifier): Remove unnecessary lookup of class field.
+
+1999-08-09 Martin v. Loewis <martin@mira.isdn.cs.tu-berlin.de>
+
+ * decl2.c (set_decl_namespace): Do not complain about non-matching
+ decls if processing a template.
+
+1999-08-09 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (build_ptrmemfunc_type): Handle qualified
+ pointer-to-member types here.
+ * tree.c (cp_build_qualified_type_real): Simplify handling here.
+
+1999-08-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * lex.c (lang_identify): Likewise.
+
+1999-08-09 Bernd Schmidt <bernds@cygnus.co.uk>
+
+ * Makefile.in: Update dependencies.
+ * class.c (finish_struct_1): Don't initialize DECL_SAVED_INSNS with
+ NULL_RTX.
+ * decl.c: Include "function.h"
+ (cleanup_label, return_label): Delete declarations.
+ (store_parm_decls): Don't initialize DECL_SAVED_INSNS with NULL_RTX.
+ (finish_function): Rename last_parm_insn variable to
+ fn_last_parm_insn. Don't compare DECL_SAVED_INSNS to NULL_RTX.
+ * decl2.c: Include "function.h".
+ (rtl_expr_chain): Delete declaration.
+ * method.c: Include "function.h"
+ * tree.c (build_vbase_pointer_fields): Don't initialize
+ DECL_SAVED_INSNS with NULL_RTX.
+ * typeck.c: Include "function.h"
+
+1999-08-09 Jason Merrill <jason@yorick.cygnus.com>
+
+ * semantics.c (begin_function_try_block, finish_function_try_block,
+ finish_function_handler_sequence): New fns.
+ * parse.y (function_try_block): Use them.
+ * pt.c (instantiate_decl): Likewise.
+
+ * cp-tree.h: Declare in_function_try_handler.
+ * decl.c: Define it.
+ (start_function): Clear it.
+ (struct cp_function, push_cp_function_context): Save it.
+ (pop_cp_function_context): Restore it.
+ * parse.y (function_try_block): Set and clear it.
+ * except.c (expand_end_catch_block): Rethrow if we reach the end
+ of a function-try-block handler in a ctor or dtor.
+ * typeck.c (c_expand_return): Complain about returning from a
+ function-try-block handler of a ctor.
+
+ * parse.y (function_try_block): Call end_protect_partials
+ before expand_start_all_catch.
+
+1999-08-08 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (struct binding_level): Add eh_region field.
+ (push_binding_level): Set it.
+ (define_label): Complain about jumping into an EH block.
+
+ * ptree.c (print_lang_type): Print the real type of a PMF.
+ Print what exceptions a fn type throws.
+
+1999-08-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * class.c (count_fields, add_fields_to_vec): Add static prototype.
+
+ * cp-tree.h (opname_tab, assignop_tab, operator_name_string,
+ get_id_2, composite_pointer_type, dump_node_to_file): Constify a
+ char*.
+
+ * decl.c (named_label_list, cp_finish_decl, grokdeclarator):
+ Constify a char*.
+
+ * decl2.c (finish_static_data_member_decl, grokfield): Constify a
+ char*.
+
+ * dump.c (queue_and_dump_index, dump_int, dump_string,
+ dump_string_field, dequeue_and_dump, dump_node_to_file): Constify
+ a char*.
+ (dump_stmt): Add static prototype.
+
+ * errfn.c (cp_thing): Constify a char*.
+
+ * error.c (dump_unary_op, dump_binary_op, aggr_variety,
+ dump_aggr_type, dump_global_iord, dump_decl, dump_function_name,
+ dump_expr): Constify a char*.
+
+ * lex.c (extend_token_buffer_to, pragma_getc, pragma_ungetc,
+ read_line_number): Add static prototype.
+ (opname_tab, assignop_tab, operator_name_string): Constify a char*.
+ (real_yylex): Move label `letter' into the scope where it is used.
+
+ * method.c (build_mangled_template_parm_index, build_overload_int,
+ build_decl_overload_real, get_id_2): Constify a char*.
+
+ * search.c (check_final_overrider): Make static.
+
+ * typeck.c (composite_pointer_type): Constify a char*.
+
+1999-08-06 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (maybe_get_template_decl_from_type_decl): Make sure that
+ we're looking at a class.
+
+ * decl.c (lookup_name_real): Set the complain flag if we're
+ looking for a namespace member.
+
+ * lex.c (real_yylex): We can have a number with no digits.
+
+ * cvt.c (cp_convert_to_pointer): Don't force pmf conversions.
+
+ * search.c (binfo_from_vbase): New fn.
+ * cp-tree.h: Declare it.
+ * cvt.c (cp_convert_to_pointer): Use it to diagnose conversion
+ from pointer to member of virtual base.
+ * typeck.c (get_delta_difference): Likewise.
+
+1999-08-06 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * pt.c (tsubst): Use build_index_type to build in-template array
+ index type. Fixes g++.oliva/dwarf1.C.
+ * decl.c (grokdeclarator): Likewise, just for consistency, as it
+ doesn't seem to trigger the bug without it.
+
+1999-08-06 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck2.c (add_exception_specifier): Use complete_type.
+
+1999-08-06 Mark Mitchell <mark@codesourcery.com>
+
+ * error.c (dump_expr): Handle EXACT_DIV_EXPR.
+ (dump_binary_op): Bulletproof.
+ * lex.c (init_parse): Set opname_tab[EXACT_DIV_EXPR].
+ * tree.c (search_tree): Don't enumerate all the nodes of classes
+ `1', `2', and `<'; handle them generically. Don't be sorry about
+ "unrecognized tree codes"; just abort.
+ (no_linkage_check): Don't do linkage checks for templates.
+
+ * tree.c (cp_build_qualified_type_real): Handle
+ pointer-to-member-function types correctly.
+
+1999-08-05 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (pushdecl): Only give an error for shadowing a parm
+ from *this* function.
+
+Thu Aug 5 02:40:42 1999 Jeffrey A Law (law@cygnus.com)
+
+ * typeck2.c: Update URLs and mail addresses.
+
+1999-08-04 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (empty_except_spec): New global var.
+ (compexcepttypes): Remove prototype.
+ (comp_except_specs): Prototype new global function.
+ (add_exception_specifier): Prototype new global function.
+ * decl.c (empty_except_spec): Define new global var.
+ (duplicate_decls): Use comp_except_specs, reword error message.
+ (init_decl_processing): Initialize empty_except_spec.
+ Adjust build_exception_variant calls.
+ * parse.y (exception_specification_opt): Use empty_except_spec.
+ (ansi_raise_identifier): Call check_for_new_type.
+ (ansi_raise_identifiers): Use add_exception_specifier.
+ * pt.c (tsubst): Use add_exception_specifier to build exception
+ specifier.
+ * search.c (check_final_overrider): New static function, broken
+ out of get_matching_virtual. Check throw specifiers, reword
+ diagnostics.
+ (get_matching_virtual): Use check_final_overrider.
+ * tree.c (build_exception_variant): Use comp_except_specs.
+ * typeck.c (compexcepttypes): Remove.
+ (comp_except_types): New static function, helper for
+ comp_except_specs. Compare two types as exception specifiers.
+ (comp_except_specs): New global function, compare two exception
+ specifiers.
+ (comptypes): Adjust for comp_except_specs.
+ * typeck2.c (add_exception_specifier): New global function.
+
+ * class.c (check_for_override): Reword error message.
+
+1999-08-03 Nathan Sidwell <nathan@acm.org>
+
+ * call.c (convert_arg_to_ellipsis): Use pod_type_p.
+ * cp-tree.h (struct lang_type): Added non_pod_class flag.
+ (CLASSTYPE_NON_POD_P): New macro to access it.
+ * class.c (finish_struct_1): Determine non-PODness.
+ Check for arrays of pointers (-Weffc++).
+ Remove array inspection duplicated code.
+ * tree.c (pod_type_p): Detect non-pod non-aggregate types.
+ Use CLASSTYPE_NON_POD_P.
+
+1999-08-03 Nathan Sidwell <nathan@acm.org>
+
+ * class.c (duplicate_tag_error): Preserve template information.
+
+1999-08-03 Nathan Sidwell <nathan@acm.org>
+
+ * decl.c (start_enum): Show location of previous definition.
+ * parse.y (enumlist_opt): New reduction.
+ (structsp): Simplify enum rules to use enumlist_opt.
+
+1999-08-03 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (yyprint): Handle PFUNCNAME.
+
+ * decl2.c (build_expr_from_tree, case METHOD_CALL_EXPR): Only
+ build_expr_from_tree on the args of a TEMPLATE_ID_EXPR.
+
+1999-08-03 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * decl.c (start_decl): Set attributes before duplicate_decls call.
+
+1999-08-02 Mark Mitchell <mark@codesourcery.com>
+
+ * Make-lang.in (CXX_SRCS): Add dump.c.
+ * Makefile.in (CXX_OBJS): Add dump.o.
+ (dump.o): New target.
+ * cp-tree.h (DECL_CONV_FN_P): Document.
+ (DECL_OVERLOADED_OPERATOR_P): New function.
+ (TYPE_PTRMEM_CLASS_TYPE): New macro.
+ (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise.
+ (PTRMEM_CST_CLASS): Use TYPE_PTRMEM_CLASS_TYPE.
+ (ASM_VOLATILE_P): New macro.
+ (STMT_LINENO): Likewise.
+ (cp_namespace_decls): New function.
+ (dump_node_to_file): New function.
+ * decl.c (cp_namespace_decls): New function.
+ (walk_namespaces_r): Use it.
+ (wrapup_globals_for_namespace): Likewise.
+ * decl2.c (flag_dump_translation_unit): New variable.
+ (lang_decode_option): Handle -fdump-translation-unit.
+ (finish_file): If flag_dump_translation_unit is set, dump the
+ translation unit.
+ * dump.c: New file.
+ * lang-options.h: Add -fdump-translation-unit.
+ * pt.c (tsubst_template_parms): Robustify.
+ (tsubst_decl): Use DECL_OVERLOADED_OPERATOR_P.
+ (tsubst_expr): Use STMT_LINENO.
+ * semantics.c (finish_asm_stmt): Eliminate duplicate code. Check
+ for invalid cv-qualifiers even while building templates.
+
+1999-08-02 Richard Henderson <rth@cygnus.com>
+
+ * call.c: Include defaults.h instead of expr.h.
+ * decl.c: Likewise.
+ * pt.c: Likewise.
+ * typeck.c: Include defaults.h.
+
+1999-08-02 Mark Mitchell <mark@codesourcery.com>
+
+ * lex.c (errorcount, sorrycount): Don't declare.
+ * repo.c (errorcount, sorrycount): Likewise.
+ * typeck2.c (errorcount, sorrycount): Likewise.
+
+1999-08-02 Jakub Jelinek <jj@ultra.linux.cz>
+
+ * call.c (convert_default_arg, build_over_call): Change all uses of
+ PROMOTE_PROTOTYPES, so that it tests it as a C expression.
+ Ensure expr.h is included.
+ * decl.c (grokparams): Ditto.
+ * pt.c (tsubst_decl): Ditto.
+ * typeck.c (convert_arguments): Ditto.
+
+1999-08-02 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (mark_overriders): Fix order of args to overrides.
+ (warn_hidden): Likewise. Fix for having virtual and non-virtual
+ functions with the same name.
+
+1999-08-02 Richard Henderson <rth@cygnus.com>
+
+ * cp-tree.h (TYPE_PTRMEMFUNC_P): Check TYPE_LANG_SPECIFIC non-null.
+
+1999-08-01 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_conditional_expr): Fix typo in comment.
+
+1999-08-01 Bernd Schmidt <bernds@cygnus.co.uk>
+
+ * decl.c (finish_stmt): Don't declare and test cond_stack, loop_stack,
+ case_stack; use in_control_zone_p.
+ * typeck.c (c_expand_return): Likewise.
+
+1999-07-31 Bernd Schmidt <bernds@cygnus.co.uk>
+
+ * except.c (catch_clauses): Delete declaration.
+
+1999-07-30 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_conditional_expr): Call convert_from_reference to
+ avoid reference/non-reference type confusion. Fix typo.
+
+1999-07-30 Richard Henderson <rth@cygnus.com>
+
+ * typeck2.c (initializer_constant_valid_p): Moved to c-common.c.
+ * cp-tree.h (initializer_constant_valid_p): Remove.
+
+1999-07-28 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (conditional_conversion): Don't build BASE_CONVs for
+ conversions between things that have the same type.
+ (build_conditional_expr): Tweak.
+ (convert_like): Some BASE_CONVs really do require the generation
+ of code.
+
+ * init.c (perform_member_init): Don't go through build_modify_expr
+ for simple initializations.
+
+1999-07-27 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (DECL_VIRTUAL_CONTEXT): New macro.
+ * typeck.c (expand_ptrmemfunc_cst): Calculate delta correctly for
+ virtual functions and MI. Simplify.
+
+ * method.c: Remove prototype for largest_union_member.
+ * pt.c (determine_specialization): Fix uninitialized warning.
+ * lex.c (real_yylex): Likewise.
+
+1999-07-27 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (override_one_vtable): Adjust the use of BINFO_VIRTUALS
+ here too.
+
+ * cp-tree.h (BINFO_VIRTUALS): Document new format.
+ * class.c (modify_one_vtable): Change prototype accordingly.
+ (modify_all_vtables): Likewise.
+ (modify_all_direct_vtables): Likewise.
+ (modify_all_indirect_vtables): Likewise.
+ (build_vtable_entry_for_fn): New function.
+ (set_rtti_entry): Simplify for new BINFO_VIRTUALS format.
+ (modify_vtable_entry): Likewise.
+ (add_virtual_function): Likewise.
+ (build_vtbl_initializer): New function.
+ (finish_vtbls): Simplify for new BINFO_VIRTUALS format.
+ (fixup_vtable_deltas1): Likewise.
+ (fixup_vtable_deltas): Likewise.
+ (override_one_vtable): Likewise.
+ (finish_struct_1): Likewise.
+
+ * error.c (dump_expr): Likewise.
+ * search.c (get_abstract_virtuals_1): Likewise.
+ (get_abstract_virtuals): Likewise.
+ (expand_upcast_fixups): Likewise.
+ * tree.c (debug_binfo): Likewise.
+ * decl2.c (mark_vtable_entries): Don't bash abstract virtuals to
+ __pure_virtual here.
+
+1999-07-26 Mark Mitchell <mark@codesourcery.com>
+
+ * tree.c (build_cplus_new): Adjust call to abstract_virtuals_error
+ as per 1999-07-26 change.
+
+ * typeck.c (c_sizeof): Don't allow non-static data members.
+ (expr_sizeof): Likewise.
+
+1999-07-26 Jason Merrill <jason@yorick.cygnus.com>
+
+ * input.c (feed_input): Only touch lineno and input_filename
+ if !USE_CPPLIB. Save the old values before setting the new ones.
+
+ * input.c (feed_input): Add file, line parms.
+ * lex.c (begin_definition_of_inclass_inline, feed_defarg): Adjust.
+ (real_yylex): Check linemode before input_redirected().
+
+ * typeck.c (c_expand_return): Downgrade pedwarn about returning NULL
+ from op new to warning.
+
+1999-07-26 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (ncp_convert): Rename to perform_implicit_conversion.
+ * call.c: All uses changed.
+ * typeck.c: Likewise.
+
+1999-07-26 Nathan Sidwell <nathan@acm.org>
+
+ * exception.cc (__cplus_type_matcher): Match __eh_matcher
+ prototype.
+
+1999-07-26 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (CP_INTEGRAL_TYPE_P): New macro.
+ (ARITHMETIC_TYPE_P): Adjust definition for standard conformance.
+ (strip_top_quals): Declare.
+ (ncp_convert): Likewise.
+ (type_after_usual_arithmetic_conversions): Likewise.
+ (composite_pointer_type): Likewise.
+ * call.c (strip_top_quals): Don't make it static.
+ (promoted_arithmetic_type_p): New function.
+ (conditional_conversion): Likewise.
+ (null_ptr_cst_p): Allow `false' as a NULL pointer constant.
+ (standard_conversion): Use same_type_p. Don't build BASE_CONVs
+ for converting a type to itself.
+ (reference_binding): Honor LOOKUP_NO_TEMP_BIND.
+ (implicit_conversion): Make sure the from and to types are
+ complete.
+ (add_builtin_candidate): Correct handling of ?: operator.
+ (add_builtin_candidates): Improve documentation.
+ (build_conditional_expr): New function.
+ (can_convert): Implement in terms of can_convert_arg.
+ (ncp_convert): New function.
+ * typeck.c (type_after_usual_arithmetic_conversions): New
+ function, split out from common_type.
+ (composite_pointer_type): New function, split out from
+ build_conditional_expr.
+ (common_type): Use type_after_usual_arithmetic_conversions.
+ Remove redundant attribute merging.
+ (comptypes): Tidy. Handle COMPLEX_TYPE.
+ (build_binary_op_nodefault): Use null_ptr_cst_p.
+ (build_conditional_expr): Remove.
+ (convert_for_assignment): Use new conversion functions.
+
+ * cp-tree.h (abstract_virtuals_error): Change declaration.
+ * typeck2.c (abstract_virtuals_error): Check to see if an error
+ occurred, and return a boolean value accordingly.
+ (build_functional_cast): Adjust accordingly.
+ * class.c (finish_struct_1): Likewise.
+ * cvt.c (ocp_convert): Likewise.
+ * decl.c (cp_finish_decl): Likewise.
+ (grokparams): Likewise.
+ (grok_op_properties): Likewise.
+ (start_function): Likewise.
+ * init.c (build_new_1): Likewise.
+
+ * pt.c (unify): Don't get confused by pointers-to-member functions.
+
+ * search.c (build_cplus_new): Robustify.
+
+1999-07-24 Richard Henderson <rth@cygnus.com>
+
+ * gxx.gperf (__builtin_va_arg): New.
+ * parse.y (VA_ARG): New token.
+ (unary_expr): Recognize it.
+
+Sun Jul 25 15:24:21 1999 Jeffrey A Law (law@cygnus.com)
+
+ * g++FAQ.texi: Deleted per Joe Buck's request.
+ * Makefile.in: Corresponding changes.
+
+1999-07-23 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c: Sync with C frontend.
+ (whitespace_cr): New fn.
+ (skip_white_space): Use it.
+ (init_parse): Reorder.
+ (yyprint): Support CONSTANT.
+ (pragma_getc, pragma_ungetc): Bring back.
+ (read_line_number): Change in_system_header directly.
+ (handle_generic_pragma, handle_cp_pragma, yyerror): Move up in file.
+ (parse_float): Update to C version.
+ (yylex): Handle '$' under the letter case.
+ Remove looking_for_typename handling.
+ Support hex floating point constants.
+ Follow C's lead for choosing type of integer constants.
+ Rearrange stuff to match C frontend.
+ (yyungetc, reinit_parse_for_block, yylex): Support indent_level.
+ * spew.c (yylex): Clear looking_for_typename if we see a TYPESPEC.
+
+1999-07-23 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (reference_binding): Tweak.
+ (mayble_handle_implicit_object): Use direct_reference_binding to
+ create the right implicit conversion sequence.
+
+1999-07-22 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (convert_nontype_argument): Don't call decl_constant_value
+ if we're converting to a reference type.
+
+ * call.c (NEED_TEMPORARY_P): New macro.
+ (standard_conversion): Set it, for derived-to-base conversions.
+ (reference_related_p): New function.
+ (reference_compatible_p): Likewise.
+ (convert_class_to_reference): Likewise.
+ (direct_reference_binding): Likewise.
+ (reference_binding): Rework for standards-compliance.
+ (convert_like): Adjust accordingly.
+ (maybe_handle_ref_bind): Simplify; the right conversion sequences
+ are now built up in reference_binding.
+ (initialize_reference): New function.
+ * cp-tree.h (ICS_USER_FLAG): Document.
+ (ICS_THIS_FLAG): Likewise.
+ (ICS_BAD_FLAG): Likewise.
+ (NEED_TEMPORARY_P): Likewise.
+ (cp_lvalue_kind): New type.
+ (real_lvalue_p): Return it.
+ * error.c (dump_expr): Provide more accurate representation for
+ AGGR_INIT_EXPRs.
+ * init.c (expand_default_init): Do not try to perform implicit
+ conversions for a brace-enclosed initializer.
+ * search.c (lookup_conversions): Document.
+ * tree.c (lvalue_p_1): Return a cp_lvalue_kind. Calculate
+ appropriately.
+ (real_lvalue_p): Adjust accordingly.
+ (lvalue_p): Likewise.
+ (build_cplus_new): Don't allow the creation of an abstract class.
+ * typeck.c (convert_for_initialization): Use initialize_reference.
+
+1999-07-21 Gavin Romig-Koch <gavin@cygnus.com>
+
+ * lex.c (real_yylex) : Correct the test for overflow when lexing
+ integer literals.
+
+1999-07-20 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (warn_extern_redeclared_static): Check DECL_ARTIFICIAL,
+ not DECL_BUILT_IN, to determine if a function is internally declared.
+ (duplicate_decls): Likewise. Improve handling of builtins.
+ (push_overloaded_decl): Remove special handling of builtins.
+
+ * cp-tree.h (ANON_AGGR_TYPE_P): Use CLASS_TYPE_P.
+
+ * decl.c (grokdeclarator): Pull out decl_constant_value in
+ templates, too.
+
+ * class.c (finish_struct, finish_struct_1): Remove 'warn_anon' parm.
+ * cp-tree.h, pt.c, semantics.c: Adjust.
+ * method.c (largest_union_member): Remove.
+
+ * lang-specs.h (c++-cpp-output): Pass -fpreprocessed.
+
+ * lex.c (token_getch, token_put_back): New fns.
+ (real_yylex): Use them.
+
+ * lex.c (lang_init): Generalize.
+ (lang_init_options): Tell cpplib this is C++.
+ (nextchar): Remove. Replace uses with put_back.
+ (skip_white_space): Handle linemode here. Optimize for cpplib.
+ (extend_token_buffer_to): New fn.
+ (extend_token_buffer): Use it.
+ (read_line_number, check_newline): Just deal with tokens.
+ (real_yylex): More cpplib optimizations. Simplify. Don't produce
+ EXTERN_LANG_STRING, LEFT_RIGHT or PAREN_STAR_PAREN here.
+ * spew.c (yylex): Produce LEFT_RIGHT and EXTERN_LANG_STRING.
+ * parse.y (PAREN_STAR_PAREN): Remove.
+ * input.c: Don't use the putback machinery with cpplib.
+ (sub_getch): Fold back into getch.
+ (getch): Don't handle linemode here.
+ (feed_input): Unget any text in the token buffer.
+
+ * lex.c (set_typedecl_interface_info, set_vardecl_interface_info,
+ nextyychar, nextyylval): Remove.
+
+1999-07-20 Michael Tiemann <tiemann@holodeck.cygnus.com>
+ Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (indent_level): New variable.
+ (init_parse): Set cpp_token to CPP_DIRECTIVE.
+ (consume_string): Make this smart about USE_CPPLIB.
+ (yyungetc): Use put_back function.
+ (pragma_getc, pragma_ungetc): Functions deleted.
+ (check_newline): Rewrite to be intelligent about USE_CPPLIB.
+ Also, call HANDLE_PRAGMA with getch, yyungetc, not pragma_getc and
+ pragma_ungetc.
+ (real_yylex): Rewrite to be intelligent about USE_CPPLIB.
+ Also, clean up cases where we redundantly set token_buffer[0].
+ (read_line_number): New fn.
+ * input.c (feed_input): Use integrated cpplib if USE_CPPLIB.
+ (end_input): Call cpp_pop_buffer if USE_CPPLIB.
+ (sub_getch): Conditionalize out code that's not appropriate if
+ USE_CPPLIB.
+ (put_back): Rewrite in case USE_CPPLIB is defined.
+ (input_redirected): Ditto.
+
+Tue Jul 20 11:24:19 1999 Bernd Schmidt <bernds@cygnus.co.uk>
+
+ * cp-tree.h: Delete lots of declarations of tree nodes; replaced by
+ c_global_trees and accessor macros defined in c-common.h.
+ (cp_tree_index): New enumeration.
+ (cp_global_trees): Declare new array. Add accessor macros for it, and
+ delete declarations of tree nodes replaced by it.
+ (builtin_function): Delete macro, add declaration for new function.
+ Include c-common.h.
+ * decl.c: Delete definitions for tree nodes that were replaced by
+ cp_global_trees and c_global_trees.
+ (init_decl_processing): Call c_common_nodes_and_builtins; delete code
+ to generate the common builtins here.
+ (builtin_function): New function.
+ * decl2.c (abort_fndecl): Delete declaration.
+ * except.c (expand_builtin_return_address): Delete declaration.
+ (builtin_return_address_fndecl): Delete variable.
+ (const_ptr_type_node): Delete declaration.
+ * lex.c (cons_up_default_function): Delete declaration of
+ void_list_node.
+ * parse.y (void_list_node): Delete declaration.
+ * rtti.c (type_info_type_node, tinfo_fn_id, tinfo_fn_type):
+ Delete variables.
+ (const_string_type_node): Delete declaration.
+ * search.c (abort_fndecl): Delete declaration.
+ * Makefile.in: Update dependencies.
+
+1999-07-19 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (check_default_tmpl_args): Move test for missing default
+ arguments here, from ...
+ (end_template_parm_list): Here.
+
+1999-07-18 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (lookup_nested_type): Remove.
+ (pushtag): Don't call it.
+
+Sat Jul 17 23:51:30 1999 Jeffrey A Law (law@cygnus.com)
+
+ * Makefile.in (INTERFACE): Bump to 2.
+
+1999-07-17 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * typeck2.c (my_friendly_abort): Updated URL with bug reporting
+ instructions to gcc.gnu.org. Removed e-mail address.
+
+1999-07-17 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (determine_specialization): Tighten error-checking.
+ (end_template_parm_list): Likewise.
+
+1999-07-14 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (check_default_tmpl_args): Handle friends defined in the
+ class just like member functions defined in the class.
+
+1999-07-09 Michael Tiemann <tiemann@happy.cygnus.com>
+ Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (struct lang_decl): Added field for storing sorted
+ FIELD_DECLs (used in TYPE_DECLs).
+ (DECL_PENDING_INLINE_INFO): Adjusted to use 'u' union.
+ (DECL_SORTED_FIELDS): New macro.
+ * class.c (method_name_cmp): New function.
+ (finish_struct_methods): Modified to support sorting and searching
+ methods.
+ (finish_struct_anon): Changed code in inner loop to use ELT rather
+ than UELT (which required an extra indirection for every reference).
+ (field_decl_cmp): New function to support sorting FIELD_DECLs.
+ (finish_struct_1): Sort fields.
+ * search.c (lookup_field_1): Use DECL_SORTED_FIELDS if we have them.
+ (lookup_fnfields_1): Search sorted methods in METHOD_VEC.
+ Also, switch to using array indexing rather than a changing pointer.
+ * ptree.c (print_lang_decl): Handle TYPE_DECLs that have
+ DECL_SORTED_FIELDS.
+
+1999-07-09 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (reparse_absdcl_as_casts): Don't warn about old-style
+ casts in system headers or extern "C" blocks.
+
+ * pt.c (do_decl_instantiation): Downgrade duplicate instantiation
+ errors to pedwarn.
+
+1999-07-09 Michael Tiemann <tiemann@happy.cygnus.com>
+
+ * decl2.c (write_virtuals): Deleted declaration.
+ * cp-tree.h (write_virtuals): Deleted extern declaration.
+ * class.c (finish_struct_1): Removed #if 0'd code that mentions
+ write_virtuals.
+ * semantics.c (begin_class_definition): Rewrite code to not depend
+ on write_virtuals.
+
+ * lex.c (cp_pragma_interface): New function.
+ (cp_pragma_implementation): Likewise.
+ (handle_cp_pragma): Call them.
+
+ * typeck.c (comptypes): Simplify C code in look_hard.
+
+ * xref.c (PALLOC): Use xcalloc, not calloc.
+ (SALLOC): Use xmalloc, not malloc.
+
+ * rtti.c (synthesize_tinfo_fn): Add missing call to pop_momentary.
+
+ * search.c (note_debug_info_needed): Don't search if WRITE_SYMBOLS
+ is NO_DEBUG.
+
+ * decl.c (duplicate_decls): If a redeclaration doesn't match the
+ initial declaration, then don't save the inline info and by all
+ means don't mark the function as a builtin function.
+
+ * decl.c (lookup_name_real): Set NONCLASS to 1 if
+ CURRENT_CLASS_TYPE is 0.
+
+ * class.c (duplicate_tag_error): Set TYPE_NONCOPIED_PARTS to
+ NULL_TREE.
+
+ * ptree.c (print_lang_type): Added vtable-needs-writing.
+
+Wed Jul 7 01:26:47 1999 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * decl2.c (mark_vtable_entries): Fix check for rtti offset.
+
+1999-07-06 Gavin Romig-Koch <gavin@cygnus.com>
+
+ * typeck.c (unsigned_type,signed_type,signed_or_unsigned_type) :
+ Merged into c-common.
+
+1999-07-05 Dave Brolley <brolley@cygnus.com>
+
+ * lex.c (errorcount): Declare it.
+ (finish_parse): Update errorcount for when using CPPLIB.
+
+1999-07-05 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (IS_AGGR_TYPE): Include instantiated template template
+ parameters.
+ (IMPLICIT_TYPENAME_TYPE_DECL_P): New macro.
+ * decl.c (push_class_binding): Use it.
+ (lookup_name_real): Likewise.
+
+1999-07-02 Gavin Romig-Koch <gavin@cygnus.com>
+
+ * cp-tree.h (widest_integer_literal_type_node,
+ widest_unsigned_literal_type) : New.
+ * decl.c (widest_integer_literal_type_node,
+ widest_unsigned_literal_type) : New.
+ (init_decl_processing): Handle/use the two new types.
+ * lex.c (real_yylex): Same.
+ * typeck.c (unsigned_type,signed_type,signed_or_unsigned_type) :
+ Same.
+
+1999-07-01 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (grokdeclarator): Don't give names "for linkage purposes"
+ to anonymous cv-qualified types.
+
+1999-07-01 Gavin Romig-Koch <gavin@cygnus.com>
+
+ * lex.c (real_yylex) : Change integer literal overflow handling to
+ be like c-lex.c.
+
+ * lex.c (real_yylex): Improve 'integer constant out of range' messages.
+
+1999-06-28 Richard Henderson <rth@cygnus.com>
+
+ * decl.c (cp_finish_decl): Fix typo in cp_warning_at call.
+
+1999-06-28 Jason Merrill <jason@yorick.cygnus.com>
+
+ * error.c (dump_type_real): Handle TREE_LIST again.
+
+ * typeck.c (comp_target_parms): Don't complain about
+ converting from () to (...) if !flag_strict_prototype.
+
+ * decl.c (grokdeclarator): Update the names of all variants when
+ de-anonymizing.
+
+1999-06-21 Mark Mitchell <mark@codesourcery.com>
+
+ * init.c (expand_aggr_vbase_init): Rename to
+ construct_virtual_bases. Conditionalize construction here,
+ rather than ...
+ (emit_base_init): Here.
+
+1999-06-19 Mark Mitchell <mark@codesourcery.com>
+
+ * semantics.c (finish_asm_stmt): Apply decay conversions to
+ input operands.
+
+ * decl.c (expand_static_init): When building an anonymous function
+ for use with atexit, compute its body before and after entering
+ the function.
+
+ * error.c (dump_expr): Handle BIND_EXPR, LOOP_EXPR, and
+ EXIT_EXPR.
+
+1999-06-18 Mark Mitchell <mark@codesourcery.com>
+
+ * init.c (expand_aggr_vbase_init): Add flag parameter.
+ (build_partial_cleanup_for): Remove, inlining into ..
+ (expand_cleanup_for_base): ... here. Take flag parameter.
+ (emit_base_init): Pass the in_chrg parameter to
+ emit_aggr_vbase_init.
+ (emit_aggr_vbase_init): Pass it to expand_cleanup_for_base.
+
+1999-06-16 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (import_export_decl): Use same_type_p, rather than
+ relying on pointer-equality for types.
+
+ * method.c (do_build_copy_constructor): Simplify.
+
+ * 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.
+ (expand_aggr_vbase_init): Use it.
+
+1999-06-15 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (class_cache_firstobj): Declare.
+ (maybe_push_cache_obstack): Rename to push_cache_obstack.
+ * class.c (permanent_obstack): Remove declaration.
+ (class_cache_firstobj): Make it global.
+ (add_method): Don't use permanent_obstack directly.
+ (pushclass): Only free the class_cache_obstack if we know how far
+ back to free it.
+ (maybe_push_cache_obstack): Rename to push_cache_obstack.
+ * decl.c: Remove dead comment.
+ (saved_scope): Add class_cache_firstobj.
+ (push_to_top_level): Save it.
+ (pop_from_top_level): Restore it.
+ (push_class_level_binding): Use push_cache_obstack, not
+ maybe_push_cache_obstack.
+ * search.c (push_class_decls): Likewise.
+
+1999-06-14 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * pt.c (tsubst_friend_function): Push into namespace of friend
+ function before pushdecl'ing it.
+
+1999-06-14 Nathan Sidwell <nathan@acm.org>
+
+ * call.c (build_new_op): Remove REF_BIND from all operands.
+
+1999-06-13 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * init.c (build_new_1): Look up operator delete even if there was
+ no explicit new placement.
+
+1999-06-08 Nathan Sidwell <nathan@acm.org>
+
+ * except.c (complete_ptr_ref_or_void_ptr_p): New function, broken out
+ of ...
+ (build_throw): ... here. Call it.
+ (process_start_catch_block): Call it.
+
+1999-06-07 Mark Mitchell <mark@codesourcery.com>
+
+ * search.c (convert_pointer_to_single_level): Reimplement without
+ using get_binfo.
+
+1999-06-06 Mark Mitchell <mark@codesourcery.com>
+
+ * method.c (is_back_referenceable_type): Back-reference bools when
+ not squangling.
+
+1999-06-07 Dave Brolley <brolley@cygnus.com>
+
+ * lex.c (real_yylex): Replace unused bytes from bad multibyte char.
+ * input.c (putback_buffer): New structure type.
+ (putback): Replaces putback_char member.
+ (putback): Replaces putback_char static variable.
+ (feed_input): Use putback.
+ (end_input): Use putback.
+ (sub_getch): Use putback.
+ (put_back): Use putback.
+
+1999-06-05 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (grokdeclarator): Fix typo in last change.
+
+1999-06-04 Jason Merrill <jason@yorick.cygnus.com>
+
+ * semantics.c (finish_if_stmt_cond): Copy cond to permanent_obstack.
+ (finish_while_stmt_cond, finish_do_stmt, finish_for_cond): Likewise.
+
+1999-06-04 Nathan Sidwell <nathan@acm.org>
+
+ * except.c (build_throw): Check throw expression validity.
+
+1999-06-03 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (grokdeclarator): Don't treat arbitrary types as unsigned
+ just because flag_signed_bitfields is false.
+
+1999-06-03 Nathan Sidwell <nathan@acm.org>
+
+ * semantics.c (begin_class_definition): Update the struct's
+ location here ...
+ * class.c (finish_struct): ... rather than here.
+
+ * decl.c (make_typename_type): Don't rely on uninitialized
+ variable.
+
+1999-05-31 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (ALL_CFLAGS): Add '-W -Wall'.
+
+1999-05-31 Mark Mitchell <mark@codesourcery.com>
+
+ * tree.c (build_cplus_array_type_1): Use push_obstacks_nochange
+ and friends rather than messing with current_obstack directly.
+ (cp_build_qualified_type_real): Rework ARRAY_TYPE
+ allocation to match practice throughout the rest of the
+ compiler.
+
+1999-05-30 Mark Mitchell <mark@codesourcery.com>
+
+ * lex.c (make_lang_type): Create TYPE_BINFO for
+ TEMPLATE_TYPE_PARMs just like for non-template types.
+
+ * decl.c (start_decl): Move checks on initialization to ...
+ (cp_finish_decl): Here. Tidy formatting slightly.
+
+1999-05-28 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (add_binding): Don't complain about a redeclaration of a
+ semantically identical typedef in a local scope.
+
+1999-05-28 Nathan Sidwell <nathan@acm.org>
+
+ * decl.c (complete_array_type): Allocate off same obstack. Fix
+ DO_DEFAULT comment to match reality.
+
+ * friend.c (make_friend_class): Fix diagnostic typo.
+
+1999-05-28 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (lookup_namespace_name): Handle getting a
+ TEMPLATE_ID_EXPR.
+ (expand_static_init): Don't call pushdecl for implicitly declared
+ `atexit' used to register destructors.
+
+1999-05-25 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (finish_vtbls): Copy BINFO_VIRTUALs before using it to
+ initialize a vtable.
+
+ * cp-tree.h (NAMESPACE_LEVEL): Reformat.
+ (lang_decl_flags): Document MEMFUNC_POINTER_TO. Save four bytes
+ by combining TEMPLATE_INFO and LEVEL into a single union.
+ (DECL_TEMPLATE_INFO): Reformat.
+ (DECL_SAVED_TREE): Document.
+ (DECL_TEMPLATE_INJECT): Remove.
+ * class.c (finish_struct): Remove code to deal with
+ DECL_TEMPLATE_INJECT.
+
+ * decl.c (maybe_process_template_type_declaration): Handle all new
+ types in templates uniformly.
+ * method.c (bulid_overload_identifier): Use CP_DECL_CONTEXT, not
+ DECL_CONTEXT.
+ * pt.c (lookup_template_class): Inject template instantiations of
+ forward-declarations.
+ (instantiate_class_template): Remove code processing
+ DECL_TEMPLATE_INJECT.
+
+ * pt.c (lookup_template_class): Tweak lookup to find member
+ templates.
+
+ * pt.c (tsubst_expr, case ASM_STMT): Don't tsubst into
+ ASM_CV_QUAL.
+ * semantics.c (finish_asm_stmt): Make strings permanent if they're
+ used in a template.
+
+1999-05-25 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (casts_away_constness, casts_away_constness_r): Strip both
+ parts of pointer to data member types.
+
+1999-05-24 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (mark_vtable_entries): Don't make a copy of a function,
+ and then make it look like `abort'. Just use `abort' instead.
+
+ * typeck.c (build_static_cast): Don't allow static_casts that cast
+ away constness.
+ (casts_away_constness_r): New function.
+ (casts_away_constness): Likewise.
+
+ * decl.c (lookup_tag): Remove code no longer needed after
+ name-lookup improvements.
+ * decl2.c (handle_class_head): Make error-recovery more robust.
+ * friend.c (make_friend_class): Reject templated typename types.
+ * lex.c (is_global): A template parameter isn't global.
+ * parse.y (class_head): Robustify.
+ * parse.c: Regenerated.
+
+1999-05-22 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (for_each_template_parm): Walk into TYPENAME_TYPEs,
+ INDIRECT_REFs, and COMPONENT_REFs. Handle FIELD_DECLs.
+
+ * cp-tree.h (push_nested_namespace): Declare.
+ (pop_nested_namespace): Likewise.
+ * decl.c (push_nested_namespace): New function.
+ (pop_nested_namespace): Likewise.
+ * pt.c (instantiate_class_template): Use them.
+
+ * tree.c (mapcar): Handle NON_LVALUE_EXPR.
+
+ * cp-tree.h (cplus_expand_constant): Declare.
+ * cvt.c (convert_to_pointer): Expand PTRMEM_CSTs when they're
+ converted from one pointer-to-object type to another.
+ * expr.c (cplus_expand_constant): Don't make it static.
+ * typeck.c (build_component_ref): Don't crash when presented with
+ a component which is a TEMPLATE_DECL.
+ (build_ptrmemfunc): Tidy. Clarify comment. Make sure that even a
+ cast from a pointer-to-member constant to its own type does not
+ result in a valid non-type template argument.
+
+1999-05-21 Mark Mitchell <mark@codesourcery.com>
+ Nathan Sidwell <nathan@acm.org>
+
+ * Make-lang.in (cc1plus): Make it depend on gxx.gperf.
+ * cp-tree.h: Fix typo in documentation on pointers-to-members.
+ (cp_build_qualified_type): Make it a macro.
+ (cp_build_qualified_type_real): Declare.
+ * decl.c (grokdeclarator): Remove misleading comment. Avoid
+ problem with template parameters and restrict-qualification.
+ * gxx.gperf: Replace NORID with RID_UNUSED throughout.
+ * hash.h: Regenerated.
+ * lex.h (rid): Move RID_FIRST_MODIFIER and RID_LAST_MODIFIER into
+ the enumeration.
+ (NORID): Remove definition.
+ * pt.c (tsubst_aggr_type): Use cp_build_qualified_type_real.
+ (tsubst): Likewise. Remove special handling for FUNCTION_TYPEs.
+ (fn_type_unification): Check that the function type resulting from
+ the deduction is legal.
+ (check_cv_quals_for_unify): Don't handle FUNCTION_TYPEs specially.
+ (unify): Use cp_build_qualified_type_real.
+ * tree.c (build_cplus_array_type_1): Handle error_marks as inputs.
+ (cp_build_qualified_type): Rename to ...
+ (cp_build_qualified_type_real): Add additional COMPLAIN parameter
+ and modify appropriately.
+
+ * typeck.c (build_ptrmemfunc): Handle PTRMEM_CSTs carefully to
+ reveal optimization opportunities.
+
+ * pt.c (tsubst): Don't issue error messages when we're not
+ complaining, even if we see a qualified function type.
+ (check_cv_quals_for_unify): Don't allow a qualified function
+ type.
+
+1999-05-20 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (instantiate_type): Downgrade errors for object-dependent
+ memfn refs to pedwarn.
+
+1999-05-20 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (grokdeclarator): Don't treat [] as indicating a
+ zero-sized array in a typedef.
+
+ * call.c (build_object_call): Don't look at DECL_NAME for a type.
+ (pt.c): Or CP_TYPE_QUALS for an ERROR_MARK.
+ (typeck.c): Or TYPE_MAIN_VARIANT for a type.
+
+ * pt.c (for_each_template_parm): Rework to match documentation.
+ Don't be fooled by a COMPONENT_REF with no TREE_TYPE.
+
+1999-05-20 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (finish_struct_1): Still check for ANON_AGGR_TYPE_P.
+
+ * class.c (finish_base_struct): Allow non-COM bases for COM classes
+ except at the leftmost position.
+ (modify_one_vtable, fixup_vtable_deltas1, override_one_vtable):
+ Pass the binfo's class, not the most derived, to skip_rtti_stuff.
+ * search.c (get_abstract_virtuals, expand_upcast_fixups): Likewise.
+
+ * tree.c (lvalue_p_1): A NOP_EXPR can be an lvalue.
+ (build_cplus_new): Make sure that what we return is of the right type.
+
+1999-05-20 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (make_ptrmem_cst): New function.
+ * expr.c (cplus_expand_constant): Split out from ...
+ (cplus_expand_expr): Here. Use cplus_expand_constant.
+ (init_cplus_expand): Set lang_expand_constant.
+ * pt.c (convert_nontype_argument): Use make_ptrmem_cst.
+
+ * tree.c (make_ptrmem_cst): Define.
+ * typeck.c (unary_complex_lvalue): Use make_ptrmem_cst.
+ * typeck2.c (initializer_constant_valid_p): Use make_ptrmem_cst.
+
+1999-05-19 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (build_template_decl): Copy DECL_NONCONVERTING_P.
+
+ * decl2.c (start_static_storage_duration_function): Fix comment.
+ (finish_file): Create static storage duration functions lazily.
+
+1999-05-19 Jason Merrill <jason@yorick.cygnus.com>
+
+ Implement anonymous structs.
+ * cp-tree.h (ANON_AGGR_TYPE_P): Rename from ANON_UNION_TYPE_P.
+ * class.c, decl.c, decl2.c, init.c, pt.c, search.c, typeck.c: Adjust.
+ * class.c (finish_struct_1): Remove redundant check for anon struct.
+ * decl.c (fixup_anonymous_aggr): Renamed from fixup_anonymous_union.
+ (check_tag_decl): Check for anonymous struct here.
+ * decl2.c (build_anon_union_vars): Catch anon struct at file scope.
+ * init.c (sort_member_init, emit_base_init): Handle getting fields
+ as well as names in current_member_init_list.
+ (perform_member_init): Handle getting an anon aggr.
+ * method.c (do_build_assign_ref): Don't descend into anon aggrs.
+ (do_build_copy_constructor): Likewise.
+
+1999-05-19 Mark Mitchell <mark@codesourcery.com>
+
+ * tree.c (cp_build_qualified_type): Don't allow qualified function
+ types.
+
+Wed May 19 02:50:53 1999 Arvind Sankar <arvinds@mit.edu>
+
+ * gxxint.texi: Fix typo.
+
+1999-05-19 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (find_scoped_type, resolve_scope_to_name): Lose.
+ * class.c (finish_struct_1): Use CLASS_TYPE_P.
+ * ptree.c (print_lang_type): Likewise.
+ * typeck.c (build_modify_expr, c_expand_asm_operands): Use
+ IS_AGGR_TYPE_CODE.
+ * typeck2.c (digest_init): Likewise.
+
+1999-05-18 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (joust): Compare the types of the conv ops, not the
+ target types of the conversions.
+
+Tue May 18 00:21:34 1999 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * lang-specs.h: Define __GNUC__ and __GNUC_MINOR__ only if -no-gcc
+ was not given.
+
+1999-05-17 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.def (TEMPLATE_ID_EXPR): Update documentation.
+ * decl.c (grokfndecl): Don't allow inline declarations of friend
+ template specializations, or friend template specializations with
+ default arguments.
+ * pt.c (tsubst): Handle substitution into array types that does
+ not yield a fixed upper bound, even when not processing a
+ template.
+ (tsubst_copy): Deal with the fact that the second operand to a
+ TEMPLATE_ID_EXPR may be NULL_TREE, a TREE_LIST, or a TREE_VEC.
+ * search.c (marked_pushdecls_p): Don't descend into
+ TEMPLATE_TYPE_PARMs and the like.
+ (unmarked_pushdecls_p): Likewise.
+
+ * call.c (build_over_call): Don't throw away
+ initializations/copies of empty classes; use MODIFY_EXPR and
+ INIT_EXPR as for non-empty classes.
+ * class.c (finish_struct_1): Put the padding byte for an empty
+ class on the TYPE_NONCOPIED_PARTS list for the class.
+
+1999-05-16 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (build_expr_from_tree): Handle COMPONENT_REFs that
+ indicate a reference to a field that is a qualified name.
+
+1999-05-16 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_objects): Don't use .?tors.* if we don't have
+ ASM_OUTPUT_CONSTRUCTOR.
+
+ * friend.c (do_friend): Add attrlist arg. Remove support for
+ getting a non-decl as 'decl'.
+ * decl.c (grokfndecl): Remove attrlist arg. Don't set attrs or
+ rtl.
+ (grokdeclarator): Adjust.
+ * cp-tree.h: Adjust.
+
+1999-05-16 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (permanent_p): New function.
+ * init.c (build_new_1): Use mapcar, not copy_node, to copy a
+ possibly complex tree node.
+ * tree.c (mapcar): Adjust comments, and follow coding standards in
+ conditional.
+ (permanent_p): New function.
+
+1999-05-13 Per Bothner <bothner@cygnus.com>
+
+ * class.c (push_lang_context): Turn off DECL_IGNORED_P for
+ primitive Java types, if we actually see `extern "Java"'.
+
+1999-05-10 18:21 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * lang-specs.h: Pass -$ to the preprocessor.
+
+1999-05-10 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (build_offset_ref): Wrap baselinks in OFFSET_REF, too.
+ Don't bother wrapping an OFFSET_TYPE around unknown_type_node.
+ (resolve_offset_ref): Don't handle a raw baselink.
+ * cvt.c (build_expr_type_conversion): Likewise.
+ * typeck.c (decay_conversion, build_c_cast, convert_for_assignment,
+ convert_for_initialization): Likewise.
+ * class.c (instantiate_type): Handle seeing a baselink under an
+ OFFSET_REF.
+ * error.c (dump_expr): Likewise.
+ * pt.c (for_each_template_parm): Likewise.
+ (resolve_overloaded_unification): Likewise.
+ * tree.c (is_overloaded_fn, really_overloaded_fn): Likewise.
+ * typeck.c (expr_sizeof): Also complain about other permutations
+ of overloaded functions.
+
+1999-05-07 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (resolve_offset_ref): Don't return a raw method.
+ Use BASELINK_P.
+ * typeck.c (decay_conversion): Don't handle a raw method.
+ Resolve all OFFSET_REFs.
+ (get_member_function_from_ptrfunc): 0 is a valid vtable index.
+ (build_binary_op_nodefault): Handle resolving overloaded fns. Use
+ same_type_p for pmf bits. Don't use build_binary_op to compare
+ raw pointers to methods.
+ (convert_for_assignment): Check for OFFSET_REF, not OFFSET_TYPE,
+ to decide when to call resolve_offset_ref.
+ (build_c_cast, convert_for_initialization): Likewise.
+ * cvt.c (build_expr_type_conversion): Likewise.
+
+1999-05-06 Nathan Sidwell <nathan@acm.org>
+
+ * call.c (build_new_method_call): Use TYPE_MAIN_VARIANT of class.
+
+1999-05-05 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (start_objects): Don't let static constructors and
+ destructors get inlined.
+
+ * parse.y (nested_name_specifier): Make sure ordinary types are
+ complete, just like template types.
+ * parse.c: Regenerated.
+
+ * pt.c (check_explicit_specialization): Improve error messages.
+
+1999-05-04 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * typeck.c (string_conv_p): Use same_type_p to check whether we
+ try to convert between char and wchar_t.
+
+1999-05-03 Mark Mitchell <mark@codesourcery.com>
+
+ * search.c (lookup_field_r): Set the TREE_TYPE of an ambiguous
+ lookup to error_mark_node here.
+ (lookup_member): Revise documentation. Add comments. Don't set
+ the TREE_TYPE to error_mark_node here, and don't build up an extra
+ TREE_LIST for ambiguous lookups.
+ (setup_class_bindings): Adjust accordingly.
+ (push_class_decls): Revise out-of-date comments.
+
+ * typeck.c (build_const_cast): Tighten checks for legality.
+
+1999-05-02 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * init.c (build_member_call): Lookup names coming from
+ namespace-scoped LOOKUP_EXPR.
+
+1999-05-03 Jim Blandy <jimb@zwingli.cygnus.com>
+
+ * gxxint.texi: Add documentation for 'I'.
+
+1999-05-02 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * tinfo.cc (operator==): Qualify type_info with std::.
+
+1999-05-02 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (lang_decl_flags): Remove comdat. Updated dummy.
+ (DECL_COMDAT): Remove definition.
+
+1999-05-01 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (wrapup_globals_for_namespace): Fix thinko in previous
+ change.
+
+1999-04-30 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (build_vtable): Use build_lang_decl when building
+ vtables, not just build_decl.
+ (prepare_fresh_vtable): Likewise.
+ * decl.c (wrapup_globals_for_namespace): Mark vtables as
+ DECL_EXTERNAL when calling wrapup_global_declarations.
+ * decl2.c (priority_info_s): Add initializations_p and
+ destructions_p members.
+ (finish_vtable_vardecl): Use TREE_SYMBOL_REFERENCED, not TREE_USED,
+ when deciding what vtables to write out.
+ (ssdf_decls): New variable.
+ (ssdf_decls_used): Likewise.
+ (start_static_storage_duration_function): Deal with being called
+ multiple times. Avoid inlining this function.
+ (generate_inits_for_priority): Deal with reuse of priority map.
+ (get_priority_info): Clear initializations_p and destructions_p.
+ (do_static_initialization): Tweak comment.
+ (do_static_destruction): Likewise. Fix condition on sentries for
+ destruction.
+ (generate_ctor_or_dtor_function): Call all of the static storage
+ duration functions.
+ (generate_ctor_or_dtor_function_for_priority): Check
+ initializations_p and destructions_p to see what priorities need
+ initialization functions.
+ (finish_file): Rework to generate multiple static storage duration
+ functions, rather than just one.
+
+ * typeck.c (build_const_cast): Tweak last change to handle
+ templates correctly.
+
+ * typeck.c (build_const_cast): Disallow use of const_cast to
+ anything but a pointer or reference type.
+
+1999-04-30 Nathan Sidwell <nathan@acm.org>
+
+ * decl.c (cp_finish_decl): Don't permit arrays of abstract or
+ signature type.
+
+1999-04-29 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (do_static_destruction): Remove obsolete FIXME comment.
+ (finish_file): Indent comments properly.
+
+1999-04-29 Richard Henderson <rth@cygnus.com>
+
+ * decl2.c (do_static_initialization): Call do_pending_stack_adjust.
+ (do_static_destruction): Likewise.
+
+1999-04-29 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (TYPE_NOTHROW_P): New macro.
+ * decl2.c (delete_sanity): Warn on deleting void *.
+ * init.c (build_new_1): Use TYPE_NOTHROW_P.
+ * typeck.c (c_expand_return): cp_pedwarn on returning NULL from
+ throwing operator new.
+
+1999-04-28 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (build_component_addr): Remove prototype.
+ * typeck.c (build_component_addr): Make static. Remove MSG
+ argument.
+ (build_component_addr): Remove MSG parameter, clean up
+ comment.
+ (build_x_function_call): Use cp_error.
+ (build_unary_op): Adjust call of build_component_addr.
+
+1999-04-28 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (tsubst_friend_class): Check for NULL.
+
+Wed Apr 28 11:42:22 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * search.c (binfo_for_vtable): Initialize bfvi.var.
+
+1999-04-27 Nathan Sidwell <nathan@acm.org>
+
+ * rtti.c (build_x_typeid): Check rtti is enabled.
+
+1999-04-26 Mark Mitchell <mark@codesourcery.com>
+
+ * search.c (is_subobject_of_p): Make sure we're looking at the
+ right baseclasses.
+
+1999-04-26 Marc Espie <espie@cvs.openbsd.org>
+
+ * Make-lang.in (cplib2.ready): Don't depend on phony targets.
+
+1999-04-23 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (finish_file): Tweak handling of extern inlines so that
+ they are not unnecessarily put out.
+
+ * search.c (is_subobject_of_p): Handle TEMPLATE_TYPE_PARMs and
+ such as base classes.
+
+1999-04-22 Brendan Kehoe <brendan@cygnus.com>
+
+ * tree.c (build_exception_variant): Fix typo: use the chain of U,
+ not trying V, while cycling through U.
+
+1999-04-22 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (lang_decl_flags): Remove returns_first_arg and
+ preserves_first_arg. Enlarge dummy accordingly.
+ (DECL_TINFO_FN_P): New macro.
+ (SET_DECL_TINFO_FN_P): Likeiwse.
+ (DECL_RETURNS_FIRST_ARG): Remove.
+ (DECL_PRESERVES_THIS): Likewise.
+ (DECL_INIT_PRIORITY): New macro.
+ (finish_struct_1): Change prototype.
+ (cat_namespace_levels): Remove prototype.
+ (vtable_decl_p): New prototype.
+ (vtype_decl_p): Likewise.
+ (sigtable_decl_p): Likewise.
+ (walk_globals_pred): New typedef.
+ (walk_globals_fn): Likewise.
+ (walk_globals): New prototype.
+ (walk_namespaces_fn): New typedef.
+ (walk_namespaces): New prototype.
+ (wrapup_globals_for_namespace): Likewise.
+ (walk_vtables): Remove prototype.
+ (walk_sigtables): Likewise.
+ (instantiate_pending_templates): New prototype.
+ * class.c (finish_struct_1): Don't return a value.
+ * decl.h (pending_statics): Remove declaration.
+ * decl.c (walk_namespaces_r): New function.
+ (walk_globals_r): Likewise.
+ (vtable_decl_p): Likewise.
+ (vtype_decl_p): Likewise.
+ (sigtable_decl_p): Likewise.
+ (walk_namespaces): Likewise.
+ (walk_globals_data): New type.
+ (walk_globals): New function.
+ (wrapup_globals_for_namespace): Likewise.
+ (expand_static_init): Remove assertion. Remove redundancy in
+ conditional. Don't put static data members in static_aggregates
+ Tidy.
+ (finish_function): Remove redundancy in conditional. Don't set
+ DECL_RETURNS_FIRST_ARG.
+ (cat_namespace_levels): Remove.
+ * decl2.c: Include splay-tree.h and varray.h.
+ (priority_info_s): New structure.
+ (finish_vtable_vardecl): Change prototype. Adjust for new calling
+ conventions.
+ (prune_vtable_vardecl): Likewise.
+ (finish_sigtable_vardecl): Likewise.
+ (setup_initp): Remove.
+ (do_dtors): Remove.
+ (do_ctors): Remove.
+ (start_static_storage_duration_function): New function.
+ (generate_inits_for_priority): Likewise.
+ (finish_static_storage_duration_function): Likewise.
+ (get_priority_info): Likewise.
+ (do_static_initialization): Likewise.
+ (do_static_destruction): Likewise.
+ (do_static_initialization_and_destruction): Likewise.
+ (generate_ctor_or_dtor_function): Likewise.
+ (generate_ctor_and_dtor_functions_for_priority): Likewise.
+ (pending_statics): Make it a varray.
+ (pending_statics_used): New variable.
+ (saved_inlines): Make it a varray.
+ (saved_inlines_used): New variable.
+ (finish_static_data_member): Change method of updating
+ pending_statics.
+ (mark_inline_for_output): Remove #if 0'd code. Change method of
+ updating saved_inlines.
+ (walk_vtables): Remove.
+ (walk_sigtables): Likewise.
+ (import_export_decl): Use DECL_TINFO_FN_P.
+ (pending_templates): Remove declaration.
+ (maybe_templates): Likewise.
+ (static_aggregates_initp): Likewise.
+ (setup_initp): Likewise.
+ (finish_objects): Simplify.
+ (INITIALIZE_P_IDENTIFIER): New macro.
+ (PRIORITY_IDENTIFIER): New macro.
+ (SSDF_IDENTIFIER): New macro.
+ (initialize_p_decl): New variable.
+ (priority_decl): Likewise.
+ (ssdf_decl): Likewise.
+ (priority_info_map): Likewise.
+ (finish_file): Recode output of static intializers and other
+ file-scope finalization tasks.
+ * error.c (OB_END_TEMPLATE_ID): New macro.
+ (dump_type_real): Use it.
+ (dump_decl): Likewise.
+ (dump_function_name): Likewise.
+ * lex.c (set_typedecl_interface_info): Adjust for new walk_globals
+ interface.
+ (check_newline): Use walk_globals, not walk_vtables.
+ * pt.c (pending_tempalte_expansions): Remove.
+ (set_vardecl_interface_info): Likewise.
+ (pending_templates): Make static.
+ (maybe_templates): Likewise.
+ (instantiate_class_template): Adjust call to finish_struct_1.
+ (instantiate_pending_templates): New function.
+ * rtti.c (get_tinfo_fn): Use SET_DECL_TINFO_FN_P.
+ * tree.c (static_aggregates_initp): Remove.
+ (cp_valid_lang_attribute): Don't use it; use DECL_INIT_PRIORITY
+ instead.
+ * Makefile.in (decl2.o): Depend on varray.h and splay-tree.h.
+
+ * gxx.gperf (RETURN): Rename to RETURN_KEYWORD to avoid clashes
+ with the RTL code RETURN.
+ * hash.h: Regenerated.
+ * lex.c (reinit_parse_for_block): Use RETURN_KEYWORD.
+ * parse.y: Replace RETURN with RETURN_KEYWORD throughout.
+ * parse.c: Regenerated.
+ * pt.c: Include varray.h. Include rtl.h since varray.h requires
+ it.
+ (inline_parm_levels): New variable.
+ (inline_parm_levels_used): Likewise.
+ (maybe_begin_member_template_processing): Update them.
+ (maybe_end_member_template_processing): Use them, rather than
+ guessing how many levels to pop.
+
+ * decl.c (make_typename_type): Tighten error-checking.
+
+1999-04-20 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (build_binary_op): Remove unneeded parameter.
+ * class.c (build_vrable_entry_ref): Adjust call to
+ build_binary_op.
+ * decl.c (expand_static_init): Likewise.
+ (grokdeclarator): Likewise.
+ (finish_function): Likewise.
+ * decl2.c (delete_sanity): Likewise.
+ (do_dtors): Likewise.
+ (do_ctors): Likewise.
+ * error.c (dump_type_suffix): Likewise.
+ * expr.c (cplus_expand_expr): Likewise.
+ * init.c (resolve_offset_ref): Likewise.
+ (build_new): Likewise.
+ (build_new_1): Likewise.
+ (build_vec_delete_1): Likewise.
+ (expand_vec_init_catch_clause): Likewise.
+ (build_delete): Likewise.
+ * pt.c (tsubst): Likewise.
+ * rtti.c (synthesize_tinfo_fn): Likewise.
+ * search.c (expand_upcast_fixups): Likewise.
+ (expand_direct_vtbls_init): Likewise.
+ * typeck.c (get_member_function_from_ptrfunc): Likewise.
+ (build_binary_op_nodefault): Likewise.
+ (point_int_sum): Likewise.
+ (pointer_diff): Likewise.
+ (build_unary_op): Likewise.
+ (build_modify_expr): Likewise.
+ (get_delta_difference): Likewise.
+ (build_ptrmemfunc): Likewise.
+ (expand_ptrmemfunc_cst): Likewise.
+
+1999-04-20 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokfndecl): Always call cplus_decl_attributes.
+ * decl2.c (grokfield): Pass attrlist to grokdeclarator.
+
+1999-04-19 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (finish_static_data_member_decl): New function.
+ * decl2.c (finish_static_data_member_decl): Split out from ...
+ (grokfield): Here.
+ * pt.c (instantiate_class_template): Use it here instead of
+ trying to fake it.
+ (tsubst_decl): Don't set DECL_ASSEMBLER_NAME;
+ finish_static_data_member_decl will do that. Explicit set
+ DECL_EXTERNAL to match non-template processing.
+
+1999-04-18 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (finish_class_definition): Add parameter.
+ * parse.y (structsp): Use it. Don't call pop_scope here.
+ * parse.c: Regenerated.
+ * semantics.c (finish_class_definition): Pop it here.
+
+1999-04-17 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (xref_tag): Revise handling of nested template
+ declarations.
+ * pt.c (check_explicit_specialization): Tweak handling of friend
+ templates in template classes.
+ (tsubst_friend_class): Handle friend declarations for nested
+ member template classes.
+
+1999-04-16 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (finish_struct): Remove unused variable.
+ (pushclass): Likewise.
+ (invalidate_class_lookup_cache): Likewise.
+ * cp-tree.def (TYPENAME_TYPE): Improve documentation.
+ * decl.c (build_typename_type): Make sure TYPENAME_TYPE_FULLNAME
+ doesn't get obliterated.
+ (make_typename_type): Handle template classes correctly.
+
+ * cp-tree.h (TREE_NONLOCAL_FLAG): Remove.
+ (storetags): Declare.
+ * class.c (finish_struct): Don't use TREE_NONLOCAL_FLAG.
+ (pushclass): Likewise. Use storetags to install tag declarations,
+ not pushtag.
+ (invalidate_class_lookup_cache): Don't use TREE_NONLOCAL_FLAG.
+ * decl.c (storetags): Make it global.
+ (push_class_binding): Set INHERITED_VALUE_BINDING_P for an
+ implicit typename declaration.
+ (pushtag): Tidy. Don't use TREE_NONLOCAL_FLAG.
+ * method.c (hack_identifier): Likewise.
+ * search.c (lookup_member): Likewise.
+
+ * decl.c (warn_about_implicit_typename_lookup): New function.
+ (lookup_name_real): Use it. Rework handling of implicit typename
+ extension.
+
+1999-04-15 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (lookup_nested_field): Remove.
+ * class.c (push_nested_class): Handle UNION_TYPEs.
+ (pop_nested_class): Likewise.
+ * decl.c (lookup_name_real): Don't call lookup_nested_field.
+ (start_decl): Use push_nested_class, not just pushclass.
+ (cp_finish_decl): Use pop_nested_class, not just popclass.
+ * search.c (lookup_nested_field): Remove.
+
+ * cp-tree.h (lang_type): Add documentation.
+ * decl2.c (handle_class_head): Create template declarations here,
+ as appropriate.
+ * parse.y (class_head): Return whether or not we entered a new
+ scope, as well as the type named.
+ (named_class_head): Likewise.
+ (named_complex_class_head_sans_basetype): Likewise.
+ (structsp): Adjust accordingly. Pop scope when required.
+ * parse.c: Regenerated.
+ * pt.c (check_default_tmpl_args): Robustify.
+ (redeclare_class_template): Likewise.
+ (instantiate_class_template): An instantiation of an
+ anonymous union is itself an anonymous union.
+ * semantics.c (begin_class_definition): Don't create template
+ declarations here.
+
+1999-04-15 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (after_type_declarator_intern): New nonterminal.
+ (after_type_declarator): Use it.
+ (direct_after_type_declarator): Likewise. Move above
+ nonnested_type to fix reduce/reduce conflict resolution.
+ (declmods): Reducing from just 'attributes' has EMPTY precedence.
+ * Makefile.in (CONFLICTS): Update.
+
+ * decl.c (define_label): Downgrade error for jumping over a
+ non-POD decl to pedwarn.
+
+1999-04-14 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (popclass): Change declaration.
+ (pop_nested_class): Likewise.
+ (poplevel_class): Remove declaration.
+ * call.c (convert_default_argument): Pass no arguments to
+ popclass.
+ * class.c (finish_struct_1): Likewise.
+ (finish_struct): Likewise.
+ (popclass): Remove argument. Simplify code accordingly.
+ (pop_nested_class): Likewise.
+ * decl.c (poplevel_class): Declare it here, and make it static.
+ (poplevel): Handle class scopes.
+ (poplevel_class): Don't take an rgument. Simplify.
+ (pop_everything): Pass no arguments to pop_nested_class.
+ (cp_finish_decl): Pass no arguments to popclass.
+ (grokdeclarator): Pass no arguments to pop_nested_class.
+ (finish_function): Likewise.
+ * decl2.c (grokfield): Likewise.
+ (pop_scope): Pass no arguments to popclass.
+ * lex.c (do_pending_defargs): Pass no arguments to pop_nested_class.
+ * pt.c (instantiate_class_template): Move call to pushclass, and
+ document. Pass no arguments to popclass.
+ (regenerate_decl_from_template): Likewise.
+
+1999-04-14 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_unary_op): Handle taking the address of a unique
+ bound non-static member function.
+
+1999-04-13 Martin von Loewis <loewis@informatik.hu-berlin.de>
+
+ * lang-options.h (-Wdeprecated): New flag.
+ * decl2.c (warn_deprecated): New flag.
+ (lang_decode_option): Deprecated this-is-variable,
+ external-templates, alt-external-templates.
+ Support -Wdeprecated.
+ * errfn.c (cp_deprecated): New function.
+
+1999-04-13 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (setup_initp): Compare DECL_ASSEMBLER_NAME instead
+ of the decls themselves.
+
+ * pt.c (tsubst_function_type): Copy attributes over.
+
+ * tree.c (cp_valid_lang_attribute): New fn. Handle init_priority
+ and com_interface.
+ * cp-tree.h: Add prototype.
+ * decl.c (init_decl_processing): Set valid_lang_attribute.
+
+1999-04-13 Mark Mitchell <mark@codesourcery.com>
+
+ * class.c (finish_struct_1): Look at the const-ness of the field's
+ type, not the TREE_READONLY-ness of the declaration.
+ * method.c (synthesize_method): Likewise.
+ * pt.c (tsubst_decl): Call c_apply_type_quals_to_decl when
+ creating new declarations.
+
+1999-04-13 Mike Stump <mrs@wrs.com>
+
+ * decl2.c (import_export_decl): Because vtables always reference
+ virtual functions, even if they are inlined, don't allow
+ -fno-implement-inlines to not emit them, instead, emit them with
+ the vtable.
+ * decl.c (start_function): Likewise.
+
+1999-04-12 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (struct lang_type): Add com_interface.
+ (CLASSTYPE_COM_INTERFACE): New macro.
+ * class.c (set_rtti_entry): COM interface classes have no RTTI
+ entries in their vtables; adjust.
+ (add_virtual_function, finish_base_struct, skip_rtti_stuff,
+ modify_one_vtable, fixup_vtable_deltas1, override_one_vtable,
+ finish_struct_1): Likewise.
+ * decl2.c (mark_vtable_entries): Likewise.
+ * rtti.c (build_headof, get_tinfo_fn_dynamic): Likewise.
+ * search.c (get_abstract_virtuals_1, get_abstract_virtuals,
+ expand_upcast_fixups): Likewise.
+ * tree.c (debug_binfo): Likewise.
+
+ * cp-tree.h (COMPARE_NO_ATTRIBUTES): New macro.
+ * typeck.c (comptypes): If we get it, ignore attributes.
+ * class.c (instantiate_type): Use BASELINK_P. Change complain
+ parameter to flags; 2 means ignore attributes.
+ * call.c (build_op_delete_call): Pass it.
+
+ * decl.c (xref_tag): Only complain once about using a typedef-name
+ with 'struct'. Downgrade to pedwarn.
+
+ * decl.c (grokdeclarator): Allow [] syntax for zero-length array.
+
+ * parse.y (absdcl_intern): New nonterminal.
+ (absdcl, direct_abstract_declarator): Use it.
+
+ * pt.c (lookup_template_class): Look through implict typename.
+
+1999-04-11 Mark Mitchell <mark@codesourcery.com>
+
+ * friend.c (add_friend): Deal gracefully with error_mark_node.
+ * method.c (build_overload_value): Handle pointers-to-members as
+ template parameters.
+
+ * decl.c (push_binding): Fix typo in comment.
+
+1999-04-10 Mark Mitchell <mark@codesourcery.com>
+
+ * error.c (dump_type_real): If a typename is a template-id, put
+ out the template arguments.
+ (dump_expr): Handle TEMPLATE_ID_EXPR.
+ * pt.c (lookup_template_class): Now that full arguments are
+ available everywhere, remove code that tried to guess them.
+
+1999-04-09 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (make_typename_type): Complain if we don't find a type
+ when trying to make a typename type for a non-template type.
+
+1999-04-09 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (start_decl): Pass attributes to grokdeclarator.
+ (grokdeclarator): Handle attributes on constructor-syntax
+ initializers.
+
+1999-04-08 Mark Mitchell <mark@codesourcery.com>
+
+ * error.c (dump_expr): Don't crash on INDIRECT_REFs whose operands
+ don't have types.
+
+ * search.c (template_self_reference_p): Tweak.
+
+1999-04-07 Mark Mitchell <mark@codesourcery.com>
+
+ * init.c (build_offset_ref): Don't build yet another weird data
+ structure to describe overloaded functions.
+
+1999-04-06 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (BASELINK_P): New macro.
+ (SET_BASELINK_P): Likewise.
+ * init.c (build_member_call): Remove needless assignment in if
+ statement.
+ * search.c (lookup_field_r): Fix handling when we are looking
+ specifically for a type; these are not hidden by functions and
+ variables.
+ (lookup_member): Use SET_BASELINK_P.
+ * tree.c (is_overloaded_fn): Use BASELINK_P.
+ (really_overloaed_fn): Likewise.
+ (get_first_fn): Likewise.
+
+1999-04-05 Mark Mitchell <mark@codesourcery.com>
+
+ * decl.c (lookup_name_current_level): Tweak, and improve
+ documentation.
+
+ * class.c (maybe_fixup_vptrs): Remove declaration.
+ (build_class_init_list): Likewise.
+ * decl.c (pushdecl_class_level): Call check_template_shadow here
+ ...
+ (push_class_level_binding): ... not here.
+ * search.c (dfs_push_type_decls): Only avoid
+ template-self-reference TYPE_DECLs if they are from base classes.
+
+1999-04-04 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (check_template_shadow): Don't treat OVERLOADs as _DECL
+ nodes. Tidy.
+
+1999-04-03 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (maybe_fixup_vptrs, build_class_init_list): Lose.
+ (finish_struct_1): Don't call build_class_init_list.
+
+1999-04-02 Mark Mitchell <mark@codesourcery.com>
+
+ * tinfo.h (__class_type_info): Fix illegal declaration.
+
+ * cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
+ * cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
+ (IDENTIFIER_CLASS_VALUE): Improve documentation.
+ (is_properly_derived_from): Declare.
+ (invalidate_class_lookup_cache): Likewise.
+ (maybe_maybe_note_name_used_in_class): Likewise.
+ (note_name_declared_in_class): Likewise.
+ (push_using_decl): Remove duplicate declaration.
+ (id_in_current_class): Remove declaration.
+ (push_class_binding): Change prototype.
+ (clear_identitifer_class_values): Declare.
+ * call.c (is_properly_derived_from): Make it global.
+ (build_new_function_call): Be careful about updating candidates.
+ (build_new_method_call): Handle COMPONENT_REFs. Don't crash when
+ asked to make illegal calls.
+ * class.c: Include splay-tree.h.
+ (class_stack_node): Add names_used slot.
+ (check_member_decl_is_same_in_complete_scope): Remove.
+ (add_method): Fix comment. Push the declaration into class
+ scope.
+ (finish_struct_1): When popping the class, pop the bindings too.
+ Remove check for data member/function member conflict.
+ (finish_struct): Remove calls to
+ check_member_decl_is_same_in_complete_scope. Change calls to
+ popclass.
+ (pushclass): Clear names_used in the class stack entry.
+ Use invalidate_class_lookup_cache to remove cached entries, rather
+ than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
+ before entering a new class. Remove dead code. Don't mess with
+ current_function_decl when pushing declarations.
+ (invalidate_class_lookup_cache): New function, split out from ...
+ (popclass): Here. Clean up names_used on our way out.
+ (instantiate_type): Adjust.
+ (build_self_reference): Don't push the declaration here.
+ (maybe_note_name_used_in_class): New function.
+ (note_name_declared_in_class): Likewise.
+ * decl.c (add_binding): Change prototype.
+ (find_class_binding_level): New function.
+ (innermost_nonclass_level): Likewise.
+ (current_binding_level): Update documentation.
+ (inner_binding_level): Remove. Replace with current_binding_level
+ throughout.
+ (push_binding_level): Remove special handling of
+ class_binding_level.
+ (pop_binding_level): Likewise. Use find_class_binding_level.
+ (suspend_binding_level): Likewise.
+ (global_bindings_p): Use innermost_nonclass_level.
+ (toplevel_bindings_p): Likewise.
+ (namespace_bindings_p): Likewise.
+ (pseudo_global_level_p): Likewise.
+ (push_binding): Clear INHERITED_VALUE_BINDING_P.
+ (add_binding): Check for illegal multiple declarations. Return a
+ value indicating whether or not the new binding was legal.
+ (push_local_binding): Skip over class binding levels. Check
+ return value from add_binding.
+ (push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
+ note_name_declared_in_class.
+ (pushlevel_class): Remove "fake out the rest of the compiler"
+ code.
+ (poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
+ (clear_identifier_class_values): New function.
+ (pop_from_top_level): Use it.
+ (pop_everything): Tweak.
+ (maybe_process_template_type_declaration): Don't push the
+ declaration for the template here.
+ (pushtag): Don't push tag declarations into class scope here.
+ (pushdecl): Apply DeMorgan's law for readability.
+ (pushdecl_class_level): Remove special-case code for
+ TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
+ (push_class_level_bindng): Deal with inherited bindings.
+ (lookup_name_real): Remove special-case code for
+ TYPE_BEING_DEFINED, and some implicit typename magic.
+ (grokdeclarator): Handle COMPONENT_REF for a template function.
+ (build_enumerator): Don't call pushdecl_class_level here.
+ (id_in_current_class): Remove.
+ * decl2.c (grokfield): Don't call pushdecl_class_level or
+ check_template_shadow.
+ * errfn.c (cp_file_of): Don't declare.
+ (cp_line_of): Likewise.
+ * error.c (dump_decl): Handle an OVERLOAD.
+ (cp_file_of): Likewise.
+ (cp_line_of): Likewise.
+ * init.c (build_member_call): Handle a COMPONENT_REF.
+ * lex.c (do_identifier): Call maybe_note_name_used_in_class, not
+ pushdecl_class_level.
+ * method.c (hack_identifier): Build COMPONENT_REFs for references
+ to member templates as well as member functions. Remove dead
+ code.
+ * parse.y (left_curly): Remove.
+ (nonnested_type): Call maybe_note_name_used_in_class, not
+ pushdecl_class_level.
+ * parse.c: Regenerated.
+ (nested_name_specifier_1): Likewise.
+ * pt.c (check_explicit_specialization): Adjust, for robustness.
+ (check_template_shadow): Handle OVERLOADs.
+ (build_template_decl): Set DECL_CONSTRUCTOR_P on the
+ TEMPLATE_DECL, if appropriate.
+ * search.c (envelope_add_decl): Remove.
+ (dfs_pushdecls): Likewise.
+ (dfs_compress_decls): Likewise.
+ (dfs_push_decls): New function.
+ (dfs_push_type_decls): Likewise.
+ (setup_class_bindings): Likewise.
+ (template_self_reference_p): Likewise.
+ (lookup_field_r): Use it.
+ (looup_member): Remove old comment. Deal with ambiguity.
+ (push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
+ and remove envelope processing.
+ * semantics.c (begin_class_definition): Let pushclass push
+ declarations for base classes.
+ (finish_member_declaration): Push declarations into class scope.
+ * typeck.c (build_component_ref): Just put an OVERLOAD into the
+ COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
+ (build_x_function_call): Deal with OVERLOAD. Handle template-ids.
+ * Makefile.in (class.o): Depend on splay-tree.h.
+
+Wed Mar 31 11:30:43 1999 Nathan Sidwell <nathan@acm.org>
+
+ * cvt.c (convert_pointer_to_real): Use same_type_p.
+ * typeck.c (comp_target_types): Use same_type_p.
+
+1999-03-31 Jason Merrill <jason@yorick.cygnus.com>
+
+ * semantics.c (begin_inline_definitions,
+ finish_inline_definitions): Rename from finish_default_args and
+ begin_inline_definitions, respectively, to something that isn't a
+ total lie. :)
+ * parse.y (structsp): Adjust.
+
+ * tree.c (hash_tree_cons): Remove obsolete via_* parms.
+ (list_hash_lookup): Likewise.
+ (hash_tree_chain): Adjust.
+ * pt.c (tsubst): Adjust.
+ (tsubst_arg_types): Use plain hash_tree_cons.
+ * cp-tree.h (hash_tree_cons_simple): Lose.
+ * parse.y (declmods, nonempty_cv_qualifiers): Use hash_tree_cons.
+
+Wed Mar 31 10:48:29 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (hash.h): Generate using gperf language 'C', not
+ 'KR-C', so gperf uses the `const' keyword on strings.
+
+ * gxx.gperf (resword): Const-ify a char*.
+
+1999-03-30 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (IDENTIFIER_AS_DESC, IDENTIFIER_AS_LIST,
+ CLASSTYPE_BASELINK_VEC, CLASSTYPE_N_SUPERCLASSES,
+ CLASSTYPE_N_BASECLASSES, CLASSTYPE_MAX_DEPTH,
+ CLASSTYPE_BASE_INIT_LIST, CLASSTYPE_AS_LIST, CLASSTYPE_ID_AS_LIST,
+ CLASSTYPE_BINFO_AS_LIST): Remove cruft.
+ * class.c, lex.c, parse.y, ptree.c, search.c, semantics.c,
+ tree.c: Adjust.
+
+1999-03-29 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (lang_decode_option): Remove -Wsign-promo from -Wall.
+
+1999-03-28 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (fn_type_unification): Ignore 'this' parm from conversion ops.
+
+1999-03-27 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (add_friend): Declare.
+ (add_friends): Likewise.
+ * friend.c (add_friend): Make it global. Don't add to
+ DECL_BEFRIENDING_CLASSES if the befriending class is a template.
+ (add_friends): Make it global.
+ (make_friend_class): Don't add to DECL_BEFRIENDING_CLASSES if the
+ befriending class is a template.
+ * parse.y (component_decl_1): Fix typo in comment.
+ * parse.c: Regenerated.
+ * pt.c (instantiate_class_template): Use add_friend and
+ add_friends rather that duplicating some of their functionality
+ here.
+
+1999-03-27 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_field_call): Unify 'this' and non-'this' cases.
+
+ * typeck.c (build_indirect_ref): Check for 'this' sooner.
+
+Fri Mar 26 10:20:34 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * call.c (op_error): Const-ify a char*.
+ (add_candidate, source_type, add_warning): Add static prototype.
+ (print_z_candidates): Const-ify a char*.
+
+ * class.c (resolve_address_of_overloaded_function,
+ fixed_type_or_null, build_vtable_entry_ref): Add static prototype.
+ (get_vtable_name, finish_struct_1): Const-ify a char*.
+
+ * cvt.c (convert_to_reference): Likewise.
+
+ * decl.c (redeclaration_error_message, record_builtin_type,
+ record_unknown_type, member_function_or_else, bad_specifiers):
+ Likewise.
+ (find_binding, select_decl, unqualified_namespace_lookup,
+ lookup_flags, qualify_lookup, record_builtin_java_type, tag_name):
+ Add static prototype.
+ (warn_extern_redeclared_static, duplicate_decls, pushdecl,
+ implicitly_declare, record_builtin_java_type, define_function,
+ grok_op_properties, tag_name): Const-ify a char*.
+
+ * cp-tree.h (FORMAT_VBASE_NAME): Allow parameter `BUF' to be const.
+ (define_function, finish_builtin_type): Const-ify a char*.
+ (cp_error, cp_error_at, cp_warning, cp_warning_at, cp_pedwarn,
+ cp_pedwarn_at, cp_compiler_error, cp_sprintf): Add prototype args.
+ (file_name_nondirectory): Const-ify a char*.
+ (init_filename_times): Don't prototype.
+ (compiler_error): Prototype.
+ (yyerror, init_repo): Const-ify a char*.
+ (build_srcloc): Don't prototype.
+ (build_x_indirect_ref, build_indirect_ref, build_component_addr):
+ Const-ify a char*.
+ (warn_for_assignment): Don't prototype.
+ (convert_for_initialization, readonly_error, check_for_new_type,
+ GNU_xref_begin, GNU_xref_file, GNU_xref_ref, GNU_xref_call):
+ Const-ify a char*.
+
+ * decl2.c (acceptable_java_type, output_vtable_inherit,
+ setup_initp, start_objects, finish_objects, do_dtors, do_ctors,
+ merge_functions, decl_namespace, validate_nonmember_using_decl,
+ do_nonmember_using_decl): Add static prototype.
+ (lang_f_options): Const-ify a char*.
+ (finish_builtin_type): Likewise.
+ (add_function, arg_assoc_namespace, arg_assoc_class): Add static
+ prototype.
+
+ * errfn.c: Include cp-tree.h.
+ (cp_thing): Add static prototype.
+ (compiler_error): Don't protoptype.
+ (cp_compiler_error): Cast `compiler_error' to `errorfn' before
+ passing it to `cp_thing'.
+
+ * error.c (interesting_scope_p): Add static prototype.
+
+ * except.c (build_eh_type_type, build_eh_type_type_ref): Const-ify
+ a char*.
+
+ * init.c (compiler_error): Don't prototype.
+ (member_init_ok_or_else): Const-ify a char*.
+ (build_java_class_ref): Add static prototype.
+
+ * lex.c (compiler_error): Don't prototype.
+ (get_time_identifier, interface_strcmp, extend_token_buffer,
+ handle_cp_pragma): Const-ify a char*.
+ (is_global, init_filename_times): Add static prototype.
+ (file_name_nondirectory, cplus_tree_code_name): Const-ify a char*.
+ (compiler_error): Change from fixed args to variable args.
+ (yyerror): Const-ify a char*.
+
+ * parse.y (cond_stmt_keyword): Const-ify a char*.
+ (parse_decl): Add static prototype.
+
+ * pt.c (template_args_equal, print_template_context): Likewise.
+ (print_candidates, check_default_tmpl_args): Const-ify a char*.
+ (instantiate_class_template): Likewise.
+
+ * repo.c (get_base_filename, open_repo_file, init_repo): Likewise.
+
+ * rtti.c (call_void_fn, expand_generic_desc, expand_si_desc,
+ expand_class_desc, expand_ptr_desc, expand_attr_desc): Likewise.
+
+ * search.c (lookup_field_info, lookup_member): Likewise.
+ (lookup_member): Cast the first argument of `bzero' to a PTR.
+
+ * sig.c (compiler_error): Don't prototype.
+ (build_signature_pointer_or_reference_nam): Const-ify a char*.
+ (get_sigtable_name, build_member_function_pointer): Likewise.
+
+ * tree.c (compiler_error): Don't prototype.
+ (no_linkage_helper, build_srcloc): Add static prototype.
+ (build_vbase_pointer_fields): Const-ify a char*.
+ (__eprintf): Don't unnecessarily handle `const' when !__STDC__.
+
+ * typeck.c (compiler_error): Don't prototype.
+ (convert_for_assignment): Const-ify a char*.
+ (comp_cv_target_types): Add static prototype.
+ (build_x_indirect_ref, build_indirect_ref, convert_arguments,
+ build_component_addr, build_unary_op, convert_for_initialization):
+ Const-ify a char*.
+
+ * typeck2.c (ack): Add static prototype and change from fixed args
+ to variable args.
+ (readonly_error, check_for_new_type): Const-ify a char*.
+
+ * xref.c (_XREF_FILE, find_file, filename, fctname, declname,
+ fixname, open_xref_file, classname, GNU_xref_begin): Likewise.
+ (GNU_xref_file): Likewise. Also use `xmalloc' instead of `malloc'.
+ (GNU_xref_end_scope, GNU_xref_ref, GNU_xref_decl, GNU_xref_call,
+ gen_assign, GNU_xref_member): Const-ify a char*.
+
+1999-03-25 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * gxxint.texi: Remove old discussion on copying virtual bases.
+
+1999-03-25 Zack Weinberg <zack@rabi.columbia.edu>
+
+ * Make-lang.in: Remove all references to g++.o/g++.c.
+ Link g++ from gcc.o.
+
+1999-03-25 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (comdat_linkage): Treat vtables like functions.
+
+1999-03-25 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (tsubst_decl): tsubst into DECL_BEFRIENDING_CLASSES.
+
+1999-03-25 Nathan Sidwell <nathan@acm.org>
+
+ * decl.c (init_decl_processing): Add `signed' type as a synonym
+ for `int'.
+
+1999-03-25 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (common_type): Handle cv-qual unification for pointers
+ to members.
+
+ * decl.c (unqualified_namespace_lookup): Return error_mark_node
+ on error.
+ (lookup_name_real): Set LOOKUP_COMPLAIN when *not* parsing.
+ * lex.c (do_identifier): If we got error_mark_node, call
+ lookup_name again.
+
+1999-03-24 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * class.c (finish_struct_1): Always reset TYPE_FIELDS for empty
+ classes.
+
+1999-03-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (lookup_name_real): Do nested field lookup regardless of
+ TYPE_BEING_DEFINED.
+
+1999-03-24 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (lang_type): Remove has_assignment and
+ has_real_assignment. Add befriending_classes.
+ (TYPE_HAS_ASSIGNMENT): Remove.
+ (TYPE_HAS_REAL_ASSIGNMENT): Likewise.
+ (CLASSTYPE_BEFRIENDING_CLASSES): New macro.
+ (lang_decl): Document.
+ (DECL_BEFRIENDING_CLASSES): New macro.
+ (FRIEND_NAME): Move declaration to more obvious location.
+ (FRIEND_DECLS): Likewise.
+ * class.c (finish_struct_1): Don't use TYPE_HAS_REAL_ASSIGNMENT.
+ * decl.c (duplicate_decls): Copy DECL_BEFRIENDING_CLASSES.
+ (fixup_anonymous_union): Don't use TYPE_HAS_ASSIGNMENT.
+ (grok_op_properties): Likewise.
+ * friend.c (is_friend): Use FRIEND_NAME and FRIEND_DECLS.
+ (add_friend): Likewise. Don't do weird things with assignment
+ operators. Update DECL_BEFRIENDING_CLASSES.
+ (add_friends): Don't do weird things with assignment operators.
+ (make_friend_class): Likewise. Update
+ CLASSTYPE_BEFRIENDING_CLASSES.
+ * pt.c (instantiate_class_template): Don't set
+ TYPE_HAS_ASSIGNMENT.
+ (tsubst_copy): Substitute the TREE_TYPE for more unary
+ expressions.
+ * ptree.c (print_lang_type): Don't look at TYPE_HAS_ASSIGNMENT.
+ * search.c (protected_accessible_p): New function.
+ (friend_accessible_p): Likewise.
+ (accessible_p): Use them.
+
+1999-03-23 Mark Mitchell <mark@codesourcery.com>
+
+ * pt.c (convert_nontype_argument): Don't create things that aren't
+ PTRMEM_CSTs when applying a qualification conversion to a
+ PTRMEM_CST.
+
+1999-03-23 Mark Mitchell <mark@codesourcery.com>
+
+ * Makefile.in (OBJS): Don't mention hash.o.
+ (OBJDEPS): Likewise.
+
+1999-03-23 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_file): Set at_eof to 2 after expanding ctors.
+ * decl.c (expand_static_init): Make sure we don't add any after
+ then.
+
+ * decl.c (cp_finish_decl): Move intelligence about handling
+ DECL_COMDAT for variables from here...
+ * decl2.c (comdat_linkage): ...to here.
+ (maybe_make_one_only): Tweak.
+ (import_export_decl): Call comdat_linkage for variables, too.
+ (finish_file): Handle template statics properly.
+
+1999-03-22 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (TYPE_PTRMEMFUNC_P): Use TYPE_PTRMEMFUNC_FLAG.
+ Document internals of pointer-to-member-functions.
+ (DELTA2_FROM_PTRMEMFUNC): Make it call delta2_from_ptrmemfunc.
+ (PFN_FROM_PTRMEMFUNC): Likewise.
+ (build_type_conversion): Remove unused parameter.
+ (build_ptrmemfunc1): Declare.
+ (expand_ptrmemfunc_cst): New function.
+ (delta2_from_ptrmemfunc): Likewise.
+ (pfn_from_ptrmemfunc): Likewise.
+ * cvt.c (cp_convert_to_pointer): Remove unused parameter to
+ build_type_conversion. Use TYPE_PTRMEM_P for readability.
+ (convert_to_reference): Remove unused parameter to
+ build_type_conversion.
+ (ocp_convert): Likewise.
+ (build_user_type_conversion): Likewise.
+ * error.c (dump_expr): Handle NULL pointer-to-member functions.
+ * expr.c (cplus_expand_expr): Handle PTRMEM_CSTs for functions.
+ * method.c (build_overload_value): Don't go splitting CONSTRUCTORs
+ open when handling pointer-to-member functions.
+ * pt.c (convert_nontype_argument): Clean up error messages. Be
+ more stringent with pointers-to-members.
+ * typeck.c (build_ptrmemfunc1): Don't declare. Make it global.
+ (build_unary_op): Tidy ever-so-slightly.
+ (build_conditional_expr): Remove extra parameter to
+ build_type_conversion.
+ (build_ptrmemfunc): Build PTRMEM_CSTs if we know what function
+ we're using.
+ (expand_ptrmemfunc_cst): Define.
+ (delta2_from_ptrmemfunc): Likewise.
+ (pfn_from_ptrmemfunc): Likewise.
+
+1999-03-19 Mark Mitchell <mark@codesourcery.com>
+
+ * init.c (build_member_call): Handle template-id expressions
+ correctly.
+ * typeck.c (build_x_function_call): Likewise.
+
+1999-03-19 Chip Salzenberg <chip@perlsupport.com>
+
+ * friend.c (make_friend_class): Avoid core dump when
+ not-yet-defined friend type lacks TYPE_LANG_SPECIFIC().
+
+1999-03-18 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (start_function): Suppress normal linkage heuristics
+ for #pragma interface under MULTIPLE_SYMBOL_SPACES.
+
+1999-03-19 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * Make-lang.in: ($(INTL_TARGETS)): Depend on cp/parse.c.
+ ($(srcdir)/cp/parse.c): Moved from ../Makefile.in.
+
+1999-03-17 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * parse.y (named_complex_class_head_sans_basetype):
+ Do not push a scope for error_mark_node.
+ (maybe_base_class_list): Likewise.
+
+ * decl.c (start_decl): Check for error_mark_node as a type.
+ Detected by g++.brendan/array-refs.C.
+ (start_decl_1): Likewise. Detected by g++.bugs/900322_01.C.
+ (maybe_build_cleanup_1): Likewise. Detected by
+ g++.jason/incomplete1.C.
+
+ * tree.c (build_dummy_object): Use void_zero_node instead of the
+ error_mark_node.
+ (is_dummy_object): Check for such a node.
+ Detected by g++.bob/inherit1.C
+
+1999-03-16 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (old_backref_index): Split out...
+ (flush_repeats): From here. Rename back from try_old_backref.
+ (build_mangled_name): Put back some old-style repeat handling.
+
+Mon Mar 15 21:57:16 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * lex.c: Don't include setjmp.h.
+ (parse_float): New static function.
+ (pf_args): New struct.
+ (real_yylex): Use them in call to `do_float_handler'.
+
+1999-03-15 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (xref_basetypes): Set CLASSTYPE_VBASECLASSES here.
+ * tree.c (layout_basetypes): Not here.
+ * search.c (dfs_search): Remove; no longer used.
+
+1999-03-12 Mark Mitchell <mark@markmitchell.com>
+
+ * decl2.c (validate_nonmember_using_decl): Issue sensible
+ error-messages on bogus qualifiers.
+
+1999-03-14 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (add_function_candidate): Fix uninitialized variable.
+
+ * Makefile.in (search.o): Add dependency on varray.h.
+
+1999-03-13 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (duplicate_decls): Use same_type_p.
+ * method.c (try_old_backref): Renamed from flush_repeats. Use
+ same_type_p. Don't try to handle repeats. Return success.
+ (is_back_referenceable_type): Return 0 if TYPE_FOR_JAVA. Support
+ calls from old-style code, too.
+ (check_ktype): Use same_type_p.
+ (check_btype): Use same_type_p. Don't pull out TYPE_MAIN_VARIANT.
+ (build_qualified_name): Simplify logic.
+ (process_overload_item): Strip typedefs and quals at the top.
+ (build_mangled_name_for_type_with_Gcode): Remove call to
+ type_canonical_variant.
+ (build_mangled_name): Likewise. Remove support for old-style
+ repeats, which have been disabled since 2.7.2. Don't mess with
+ TREE_USED.
+ (build_decl_overload_real): Don't mess with TREE_USED.
+
+1999-03-13 Nathan Sidwell <nathan@acm.org>
+
+ * error.c (cp_printers): Add 'F' escape character.
+ (dump_type_real): Remove TREE_LIST (fnargs) printing.
+ Functionality moved to dump_parameters.
+ (dump_type_suffix): Use dump_parameters and dump_exception_spec.
+ (dump_function_decl): Extend meaning of V parameter. Use
+ dump_parameters and dump_exception_spec.
+ (dump_parameters): New static function.
+ (dump_exception_spec): New static function.
+ (fndecl_as_string): Change argument semantics. Use
+ dump_function_decl directly.
+
+ * sig.c (build_signature_table_constructor): Use cp_error.
+
+1999-03-13 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * semantics.c (finish_switch_cond): Handle error cases gracefully.
+ Detected by g++.law/enum5.C.
+
+ * typeck.c (build_modify_expr): Check for errors after resolving
+ offsets. Detected by g++.brendan/static1.C.
+
+ * decl.c (complete_array_type): Ignore initial_value if it is an
+ error. Detected by g++.benjamin/17930.C.
+
+ * typeck2.c (process_init_constructor): Return error if one argument
+ is in error. Detected by g++.benjamin/13478.C.
+
+1999-03-12 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (select_decl): Allow class templates when we need types.
+ * decl2.c (ambiguous_decl): Likewise.
+
+1999-03-12 Mark Mitchell <mark@markmitchell.com>
+
+ * lex.c (do_identifier): Correct call to enforce_access.
+ * search.c (accessible_p): Tweak comment.
+
+1999-03-10 Mark Mitchell <mark@markmitchell.com>
+
+ * semantics.c (begin_class_definition): Call build_self_reference.
+ (finish_member_declaration): Set DECL_CONTEXT for TYPE_DECLs.
+
+ * search.c (assert_canonical_unmarked): Fix typo in prototype.
+
+ * search.c (dfs_canonical_queue): New function.
+ (dfs_assert_unmarked_p): Likewise.
+ (assert_canonical_unmarked): Likewise.
+ (access_in_type): Use it.
+ (accessible_p): Likewise. Walk the whole tree when umarking.
+
+ * sig.c (build_signature_table_constructor): Use accessible_p
+ instead of compute_access.
+
+1999-03-09 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (add_builtin_candidates): Handle overloaded conversion ops.
+
+1999-03-09 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (flag_access_control): Declare.
+ (TREE_VIA_PPUBLIC): Document.
+ (DECL_NONSTATIC_MEMBER_P): New macro.
+ (enforce_access): Return an indication of whether or not access
+ was permitted.
+ (build_self_reference): Change prototype.
+ (compute_access): Replace with ...
+ (accessible_p): New function.
+ (dfs_walk): Change prototype.
+ (dfs_unmark): Likewise.
+ (markedp): Likewise.
+ * call.c (enforce_access): Use accessible_p.
+ * class.c (build_self_reference): Insert the declaration into the
+ list of members for this type, and make it public.
+ * decl.c (xref_basetypes): Avoid ill-timed recursion.
+ * init.c (build_offset_ref): Use lookup_member, not three separate
+ name-lookups. Call enforce_access rather than checking for
+ illegal accesses here.
+ (resolve_offset_ref): Likewise.
+ * lex.c (do_identifier): Likewise.
+ * method.c (hack_identifier): Likewise.
+ * parse.y (self_reference): Remove.
+ (opt_component_decl_list): Don't use it.
+ * parse.c: Regenerated.
+ * pt.c (print_candidates): Generalize to handle lists of
+ overloaded functions.
+ (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's
+ not set.
+ (get_template_base): Use new calling convention for dfs_walk.
+ * search.c: Include varray.h. Add prototypes.
+ (dfs_walk): Accept a data pointer to pass to the work functions.
+ All callers changed. All work functions changed.
+ (breadth_first_search): Rename to bfs_walk, and make consistent
+ with dfs_walk.
+ (dfs_walk_real): New function.
+ (canonical_binfo): New function.
+ (context_for_name_lookup): Likewise.
+ (shared_marked_p): Likewise.
+ (shared_unmarked_p): Likewise.
+ (lokup_field_queue_p): Likewise.
+ (lookup_field_r): Generalize to handle both functions and fields.
+ (lookup_field): Just call lookup_member.
+ (lookup_fnfields): Likewise.
+ (lookup_member): Move body of lookup_field here and generalize.
+ (dfs_accessible_queue_p): Likewise.
+ (dfs_accessible_p): Likewise.
+ (dfs_access_in_type): Likewise.
+ (access_in_type): Likewise.
+ (compute_access): Remove, and replace with ...
+ (accessible_p): New function.
+ (vbase_types): Remove.
+ (vbase_decl_ptr_intermediate): Likewise.
+ (vbase_decl_ptr): Likewise.
+ (vbase_init_result): Likewise.
+ (closed_envelopes): Likewise.
+ (bvtable): Likewise.
+
+1999-03-09 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (add_function_candidate): Check for proper number of args
+ before checking the validity of those args.
+
+1999-03-06 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (struct lang_type): Add anon_union field.
+ (ANON_UNION_TYPE_P): Use it instead of examining type.
+ (SET_ANON_UNION_TYPE_P): New macro.
+ * decl.c (check_tag_decl): Use it.
+
+ * search.c (compute_access): Handle non-type contexts earlier, and
+ handle NULL_TREE.
+
+ * tree.c (build_exception_variant): Use copy_to_permanent.
+
+ * decl2.c (setup_initp): Give statics with no priority the default
+ priority here.
+ (do_dtors, do_ctors, finish_file): Remove special handling of
+ non-prioritized statics.
+
+1999-03-05 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (ANON_UNION_TYPE_P): Robustify.
+ * decl.c (make_typename_type): Don't issue an error if an
+ immediate lookup fails; it migt be resolved later.
+ * friend.c (is_friend): Add comment.
+ * search.c (breadth_first_search): Add POSTFN and DATA
+ parameters. Tidy. All callers changed.
+ (lookup_field_queue_p): New function.
+ (lookup_field_r): Likewise.
+ (lookup_field_post): Likewise.
+ (lookup_field): Use them, via breadth_first_search, instead of
+ duplicating logic.
+ (compute_access): Robustify.
+ (lookup_fnfield_info): New structure.
+
+1999-03-05 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst, case ARRAY_REF): Use tsubst_expr again.
+
+1999-03-03 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c, decl2.c, method.c, pt.c: Add 'static' to make SunOS 4
+ cc happy.
+
+ * decl2.c (import_export_class): Also return if
+ CLASSTYPE_INTERFACE_ONLY is set.
+
+1999-03-03 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (push_overloaded_decl): Only overwrite the old binding if
+ there was one.
+ * decl2.c (do_local_using_decl): Fix loop termination.
+
+1999-03-02 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (determine_specialization): Don't declare.
+ * pt.c (determine_specialization): Make it static. Eliminate
+ complain parameter. Note that decl is always non-NULL now, and
+ simplify accordingly.
+
+ * decl.c (maybe_push_to_top_level): Always call
+ push_cp_function_context.
+ (pop_from_top_level): Always call pop_cp_function_context.
+
+1999-02-26 Nathan Sidwell <nathan@acm.org>
+
+ * typeck.c (complete_type_or_else): Add VALUE arg, for helpful
+ diagnostics.
+ * cp-tree.h (complete_type_or_else): Added VALUE parameter.
+ * init.c (build_new_1): Extra arg to complete_type_or_else.
+ (build_delete): Likewise.
+ * typeck.c (require_complete_type): Likewise.
+ (pointer_int_sum): Likewise.
+ (pointer_diff): Likewise.
+ (build_component_ref): Likewise.
+
+ * typeck2.c (incomplete_type_error): Always use cp_error.
+ Show declaration of undefined type, if appropriate.
+ Deal with UNKNOWN_TYPE nodes.
+
+ * typeck.c (require_complete_type): Use TYPE_SIZE as
+ size_zero_node to mean incomplete type.
+ (require_complete_type_in_void): New function.
+ (build_compound_expr): Call complete_type_in_void for LHS.
+ (build_c_cast): Call complete_type_in_void for void cast.
+ * cvt.c (ocp_convert): Call complete_type_in_void for void cast.
+ * decl.c (cplus_expand_expr_stmt): Void expression checks moved to
+ require_complete_type_in_void. Call it.
+ * cp-tree.h (require_complete_type_in_void): Prototype new function.
+
+ * typeck.c (convert_arguments): Use alternative format for
+ function decls. Don't require_complete_type here. Simplify
+ diagnostic printing.
+ (convert_for_initialization): Don't require_complete_type on RHS yet.
+ * call.c (convert_arg_to_ellipsis): Call require_complete_type.
+
+ * call.c (build_over_call): Cope with qualified void return type.
+ * semantics.c (finish_call_expr): Likewise.
+ * typeck.c (build_function_call_real): Likewise.
+ (c_expand_return): Likewise.
+ * decl2.c (reparse_absdcl_as_expr): Cope with qualified void type.
+
+ * call.c (print_z_candidates): Use alternate print format, to be
+ consistent with (pt.c) print_candidates.
+ * method.c (hack_identifier): List candidate members.
+ * search.c (lookup_field): Build ambiguous list, and show it, if
+ ambiguous.
+
+1999-02-26 Mark Mitchell <mark@markmitchell.com>
+
+ * typeck.c (decay_conversion): Don't confuse constant array
+ variables with their initializers.
+
+ * decl.c (duplicate_decls): Copy DECL_TEMPLATE_INSTANTIATED when
+ merging decls.
+ * pt.c (regenerate_decl_from_template): Tweak for clarity.
+ (instantiate_decl): Mark a decl instantiated before regenerating
+ it to avoid recursion.
+ * tree.c (mapcar): Don't call decl_constant_value unless we know
+ something is TREE_READONLY_DECL_P.
+
+ * class.c (check_for_override): Don't stop checking when we find
+ the first overridden function. Delete #if 0'd code.
+ * search.c (get_matching_virtual): Likewise.
+
+1999-02-25 Richard Henderson <rth@cygnus.com>
+
+ * lang-specs.h: Define __FAST_MATH__ when appropriate.
+
+1999-02-24 Mike Stump <mrs@wrs.com>
+
+ * typeck.c (convert_for_assignment): Allow boolean integral constant
+ expressions to convert to null pointer.
+
+1999-02-24 Martin von Loewis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (lookup_namespace_name): Resolve namespace aliases.
+
+ * class.c (push_nested_class): Allow namespaces.
+
+ * decl2.c (set_decl_namespace): Add friendp parameter.
+ * decl.c (grokfndecl): Pass it.
+ (grokvardecl): Likewise.
+ * cp-tree.h: Change declaration.
+
+1999-02-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst): Allow an array of explicit size zero.
+
+1999-02-23 Jason Merrill <jason@yorick.cygnus.com>
+
+ * errfn.c: Change varargs code to look like toplev.c.
+
+ * method.c (process_modifiers): Don't prepend 'U' for char or
+ wchar_t.
+
+1999-02-20 Craig Burley <craig@jcb-sc.com>
+
+ * Make-lang.in (cplib2.ready): Don't consider updating
+ cplib2 stuff if the current directory isn't writable, as
+ it won't work (such as during a `make install').
+
+Sun Feb 21 20:38:00 1999 H.J. Lu (hjl@gnu.org)
+
+ * decl2.c (start_objects): Make file scope constructors and
+ destructors local to the file if ASM_OUTPUT_CONSTRUCTOR and
+ ASM_OUTPUT_DESTRUCTOR are defined.
+
+1999-02-19 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (CLASSTYPE_METHOD_VEC): Adjust comment.
+ (fn_type_unification): Adjust prototype.
+ (lookup_fnfields_1): Declare.
+ * call.c (add_template_candidate_real): Adjust call to
+ fn_type_unification.
+ * class.c (add_method): Don't allow duplicate declarations of
+ constructors or destructors.
+ (resolve_address_of_overloaded_function): Remove unused variable.
+ Adjust call to fn_type_unification.
+ * decl.c (grokfndecl): Be more robust in the face of illegal
+ specializations.
+ * decl2.c (check_classfn): Remove hokey handling of member
+ templates.
+ * pt.c (determine_specialization): Improve comments. Adjust to
+ handle template argument deduction as per the standard.
+ (check_explicit_specialization): Fix comment spacing. Handle
+ type-conversion operators correctly. Improve error-recovery.
+ (fn_type_unification): Remove EXTRA_FN_ARG parameter.
+ (get_bindings_real): Simplify handling of static members.
+ * search.c (lookup_fnfields_1): Make it have external linkage.
+ * typeck.c (compparms): Fix comment.
+ (build_unary_op): Don't try to figure out which template
+ specialization is being referred to when when the address-of
+ operator is used with a template function.
+
+Thu Feb 18 23:40:01 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h (lvalue_or_else): Qualify a char* with the `const'
+ keyword to match an analogous change at the top level.
+
+ * tree.c (lvalue_or_else): Likewise.
+
+1999-02-17 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (xref_basetypes): Comment.
+ * pt.c (instantiate_class_template): Use xref_basetypes.
+
+1999-02-16 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (tsubst): Change prototype.
+ (tsubst_expr): Likewise.
+ (tsubst_copy): Likewise.
+ (type_unification): Remove prototype.
+ * call.c (convert_default_arg): Adjust call to tsubst_expr.
+ * class.c (resolve_address_of_overloaded_function): Just use
+ fn_type_unification.
+ * decl.c (grokdeclarator): Adjust call to tsubst.
+ * method.c (build_template_parm_names): Likewise.
+ * pt.c (GTB_VIA_VIRTUAL): New macro.
+ (GTB_IGNORE_TYPE): Likewise.
+ (resolve_overloaded_unification): Add `complain' parameter.
+ (try_one_overload): Likewise.
+ (tsubst_template_arg_vector): Likewise.
+ (tsubst_template_parms): Likewise.
+ (tsubst_aggr_type): Likewise.
+ (tsubst_arg_types): Likewise.
+ (tsubst_call_declarator_parms): Likewise.
+ (unify): Remove explicit_mask.
+ (type_unification_real): Likewise.
+ (get_template_base_recursive): Likewise.
+ (coerce_template_template_parms): Provide prototype.
+ (tsubst_function_type): Likewise.
+ (try_class_unification): New function.
+ All callers changed to use new complain parameter.
+ (get_template_base): Use try_class_unification.
+ (unify): Adjust handling of classes derived from template types.
+ (fn_type_unification): Substitute explicit arguments before
+ unification.
+
+1999-02-16 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
+
+ * decl.c (pushdecl): Remove dead code.
+
+1999-02-16 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_objects): Fix code I missed in previous change.
+
+1999-02-13 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokfndecl): Return NULL_TREE instead of error_mark_node.
+ (grokdeclarator): Don't expect error_mark_node from grokfndecl.
+
+ * pt.c (maybe_process_partial_specialization): Complain about
+ 'template <>' on non-specialization.
+
+1999-02-10 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokdeclarator): Catch weird declarators.
+ * decl2.c (finish_file): Don't abort because of namespace parsing
+ failure.
+ (check_decl_namespace): Remove.
+
+1999-02-09 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (get_template_base): Don't declare.
+ (dfs_walk): Declare.
+ (dfs_unmark): Likewise.
+ (markedp): Likewise.
+ * pt.c (unify): Remove duplicate declaration. Pass tparms and
+ targs to get_template_base.
+ (get_template_base_recursive): Move here from search.c. Check to
+ see that the base found can be instantiated to form the desired
+ type.
+ (get_template_base): Likewise.
+ (get_class_bindings): Simplify.
+ * search.c (get_template_base_recursive): Move to pt.c.
+ (get_template_base): Likewise.
+ (markedp): Make it global.
+ (dfs_walk): Likewise.
+ (dfs_unmark): Likewise.
+
+1999-02-07 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (maybe_process_partial_specialization): Complain about
+ specialization in wrong namespace.
+ * tree.c (decl_namespace_context): New fn.
+
+1999-02-06 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
+
+ * decl2.c (arg_assoc_type): Handle TEMPLATE_TEMPLATE_PARM.
+ * pt.c (coerce_template_template_parms): Handle nested
+ template template parameters.
+
+Sat Feb 6 18:08:40 1999 Jeffrey A Law (law@cygnus.com)
+
+ * typeck2.c: Update email addresses.
+
+1999-02-04 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
+
+ * pt.c (unify): Call coerce_template_parms with the COMPLAIN flag
+ turned off.
+
+1999-02-04 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (retrofit_lang_decl): Split out...
+ (build_lang_decl): From here.
+ * decl.c (pushdecl): Call it for functions generated by the middle
+ end that don't have DECL_LANG_SPECIFIC.
+ * cp-tree.h: Declare it.
+
+ * decl2.c: Remove flag_init_priority. Always enable initp stuff.
+ (start_objects, finish_objects): Only use special
+ init_priority code if the user specified a priority.
+ (do_ctors, do_dtors): Use DEFAULT_INIT_PRIORITY for the non-initp
+ objects.
+
+Wed Feb 3 22:50:17 1999 Marc Espie <Marc.Espie@liafa.jussieu.fr>
+
+ * Make-lang.in (GXX_OBJS): Remove choose-temp.o, pexecute.o and
+ mkstemp.o. Get them from libiberty now.
+ (DEMANGLER_PROG): Simlarly, remove getopt.o getopt1.o.
+
+Tue Feb 2 22:38:48 1999 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
+
+ * decl2.c (lang_decode_option): Use read_integral_parameter.
+
+1999-02-01 Mark Mitchell <mark@markmitchell.com>
+
+ * pt.c (tsubst, case TYPENAME_TYPE): Check TYPE_BEING_DEFINED
+ before calling complete_type_or_else.
+
+Mon Feb 1 09:49:52 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * input.c (inline): Don't define, its handled by system.h.
+
+Sun Jan 31 20:34:29 1999 Zack Weinberg <zack@rabi.columbia.edu>
+
+ * decl2.c: Don't define flag_no_ident here. Don't process
+ -f(no-)ident here.
+ * cp-tree.h: Don't declare flag_no_ident here.
+ * lang-specs.h: Map -Qn to -fno-ident.
+
+1999-01-28 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (struct tree_binding): Replace scope field with a union.
+ (BINDING_SCOPE): Adjust.
+ * decl.c (BINDING_LEVEL): Adjust.
+
+1999-01-26 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_class_template): Set up the DECL_INITIAL of
+ member constants.
+
+ * init.c (expand_member_init): Pull out TYPE_MAIN_VARIANT in
+ a ctor initializer.
+
+ * tree.c (equal_functions): Fix name in prototype.
+
+ * decl.c (push_local_binding): Add FLAGS argument.
+ (pushdecl, push_overloaded_decl): Pass it.
+ * decl2.c (do_local_using_decl): Likewise.
+ * cp-tree.h: Adjust prototype.
+ * decl.c (poplevel): Fix logic.
+
+ * decl.c (push_local_binding): Also wrap used decls in a TREE_LIST.
+ (poplevel): Handle that. Fix logic for removing TREE_LISTs.
+ (cat_namespace_levels): Don't loop forever.
+
+1999-01-25 Richard Henderson <rth@cygnus.com>
+
+ * typeck.c (build_reinterpret_cast): Fix typo in duplicated test.
+
+1999-01-25 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (resolve_address_of_overloaded_function): Mark the
+ chosen function used.
+
+ * call.c (build_call): Make sure that a function coming in has
+ been marked used already.
+ * decl.c (expand_static_init): Call mark_used instead of
+ assemble_external.
+ * except.c (call_eh_info, do_pop_exception, expand_end_eh_spec,
+ alloc_eh_object, expand_throw): Likewise.
+ * init.c (build_builtin_delete_call): Likewise.
+ * rtti.c (call_void_fn, get_tinfo_fn, build_dynamic_cast_1,
+ expand_si_desc, expand_class_desc, expand_ptr_desc, expand_attr_desc,
+ expand_generic_desc): Likewise.
+
+1999-01-25 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * tree.c (equal_functions): New function.
+ (ovl_member): Call it.
+
+1999-01-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (cp_convert_to_pointer): Fix conversion of 0 to pmf.
+
+1999-01-25 Martin von Loewis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (decls_match): Return 1 if old and new are identical.
+ (push_overloaded_decl): Set OVL_USED when PUSH_USING.
+
+1999-01-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (start_function): Make member functions one_only on windows.
+ * decl2.c (import_export_decl): Likewise.
+
+ * decl.c (grokdeclarator): Don't complain about implicit int in
+ a system header. Change same-name field check to not complain in
+ a system header instead of within extern "C".
+
+1999-01-21 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (PUSH_GLOBAL): New macro.
+ (PUSH_LOCAL): Likewise.
+ (PUSH_USING): Likewise.
+ (namespace_bindings_p): Declare.
+ (push_overloaded_decl): Likewise.
+ * decl.c (push_overloaded_decl): Don't make it static. Check for
+ illegal declarations after using declarations here.
+ (namespace_bindings_p): Likewise.
+ (duplicate_decls): Don't consider declarations from different
+ namespaces to be the same.
+ (pushdecl): Use symbolic PUSH_ constants in calls to
+ push_overloaded_decl.
+ (push_overloaded_decl_1): Likewise.
+ * decl2.c (validate_nonmember_using_decl): Tweak `std' handling.
+ (do_nonmember_using_decl): Check for illegal using declarations
+ after ordinary declarations here.
+ (do_local_using_decl): Call pushdecl to insert declarations.
+
+1999-01-21 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokdeclarator): Fix lang_c -> lang_name_c typo.
+
+1999-01-21 Mark Mitchell <mark@markmitchell.com>
+
+ * tree.c (build_cplus_array_type_1): Don't call build_array_type
+ for types involving template parameters.
+
+ * cp-tree.h (PARM_DECL_EXPR): Delete.
+ (convert_default_arg): Change prototype.
+ (check_default_argument): Declare.
+ (search_tree): Likewise.
+ * call.c (convert_default_arg): Take the function to which the
+ default argument belongs as a parameter, and do any necessary
+ instantiation here, instead of ...
+ (build_over_call): Here.
+ * decl.c (local_variable_p): New function.
+ (check_default_argument): Likewise, split out and tidied from ...
+ (grokparms): Here.
+ * error.c (dump_expr): Don't set PARM_DECL_EXPR.
+ * pt.c (tsubst_call_declarator_parms): New function.
+ (for_each_template_parm): Handle ARRAY_REFs. Do the obvious thing
+ with CALL_EXPRs, rather than trying to be clever.
+ (tsubst): Use tsubst_call_declarator_parms.
+ * tree.c (search_tree): Don't make it static.
+ * typeck.c (convert_arguments): Use new interface to
+ convert_default_arg.
+
+1999-01-20 Mark Mitchell <mark@markmitchell.com>
+
+ * error.c (dump_function_decl): Don't print the argument types for
+ a function when the verbosity level is negative.
+
+ * call.c (build_over_call): Check format attributes at call-time.
+
+ * pt.c (tsubst_copy): Fix comment.
+ (unify): Don't allow unification with variable-sized arrays.
+
+ * semantics.c (finish_stmt_expr): When processing a template make
+ the BIND_EXPR long-lived.
+
+1999-01-19 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_vtable_vardecl): Make vtables comdat here.
+ (import_export_vtable): Not here.
+
+1999-01-18 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_component_ref): Wrap an OVERLOAD around a unique
+ non-static member function.
+
+1999-01-18 Nathan Sidwell <nathan@acm.org>
+
+ * class.c (instantiate_type): Only diagnose illegal address of member
+ function if complaining.
+
+ * decl.c (lookup_name_real): Remove duplicate code.
+
+1999-01-18 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (copy_template_template_parm): Use permanent_obstack.
+
+1999-01-18 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
+
+ * pt.c (unify): Remove restrictions on deduction of argument
+ of template template parameters.
+
+1999-01-18 Nathan Sidwell <nathan@acm.org>
+
+ * rtti.c (build_dynamic_cast_1): Resolve OFFSET_REF exprs.
+
+ * class.c (resolve_address_of_overloaded_function): Show list of
+ all candidates, when none of them match.
+
+1999-01-18 Chip Salzenberg <chip@perlsupport.com>
+
+ * typeck.c (comp_ptr_ttypes_reinterpret): Per ANSI, tighten up
+ definition of 'casting away const' in reinterpret_cast<>.
+
+1999-01-18 Graham <grahams@rcp.co.uk>
+
+ * cvt.c: Add include for decl.h, remove extern for
+ static_aggregates which is now provided by decl.h.
+
+ * Makefile.in (cvt.o): Add dependency for decl.h and missing
+ dependencies for convert.h and flags.h.
+
+1999-01-18 Nathan Sidwell <nathan@acm.org>
+
+ * decl2.c (do_dtors): Set current location to that of the
+ decl, for sensible diagnostics and debugging.
+ (check_classfn): Issue `incomplete type' error, if
+ class is not defined.
+
+1999-01-16 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h: Add prototype for bound_pmf_p.
+
+1999-01-16 Jason Merrill <jason@yorick.cygnus.com>
+ Manfred Hollstein <manfred@s-direktnet.de>
+
+ * decl.c (grokdeclarator): Don't make 'main(){}' an error with only
+ -Wreturn-type.
+
+1999-01-16 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (struct lang_type): Added has_mutable flag.
+ (CLASSTYPE_HAS_MUTABLE): New macro to access it.
+ (TYPE_HAS_MUTABLE_P): New macro to read it.
+ (cp_has_mutable_p): Prototype for new function.
+ * class.c (finish_struct_1): Set has_mutable from members.
+ * decl.c (cp_finish_decl): Clear decl's TREE_READONLY flag, if
+ it contains a mutable.
+ * typeck.c (cp_has_mutable_p): New function.
+
+1999-01-15 Mark Mitchell <mark@markmitchell.com>
+
+ * pt.c (process_template_parm): Ignore top-level qualifiers on
+ non-type parameters.
+
+ * decl.c (start_function): Use current_function_parms in the call
+ to require_complete_type_for_parms, not the probably empty
+ DECL_ARGUMENTS.
+
+1999-01-14 Jason Merrill <jason@yorick.cygnus.com>
+
+ * semantics.c (finish_asm_stmt): Don't warn about redundant volatile.
+
+ * decl2.c (import_export_class): MULTIPLE_SYMBOL_SPACES only means
+ that we don't suppress the other copies.
+ * lex.c (handle_cp_pragma): Likewise.
+
+1999-01-13 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (grokdeclarator): Undo 1998-12-14 change.
+ * tree.c (build_cplus_array_type_1): Likewise.
+ * pt.c (instantiate_class_template): Remove misleading comment.
+ (tsubst_aggr_type): Substitute if there are template parameters,
+ regardless of whether or not they use template arguments.
+ (unify): Likewise, but for unification.
+
+1999-01-12 Richard Henderson <rth@cygnus.com>
+
+ * cp-tree.h (flag_permissive): Declare extern.
+
+1999-01-06 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (IDENTIFIER_TYPENAME_P): Use OPERATOR_TYPENAME_FORMAT
+ here.
+ (lang_type): Add is_partial_instantiation. Decrease width of
+ dummy.
+ (PARTIAL_INSTANTIATION_P): New macro.
+ (OPERATOR_TYPENAME_P): Remove.
+ * decl.c (unary_op_p): Use IDENTIFIER_TYPENAME_P, not
+ OPERATOR_TYPENAME_P.
+ (grok_op_properties): Likewise.
+ * friend.c (do_friend): Handle friends that are member functions
+ correctly.
+ * lex.c (init_parse): Use OPERATOR_TYPENAME_FORMAT.
+ * pt.c (instantiate_class_template): Rework for clarity. Avoid
+ leaving TYPE_BEING_DEFINED set in obscure cases. Don't do
+ any more partial instantiation than is absolutely necessary for
+ implicit typename. Set PARTIAL_INSTANTIATION_P.
+ (tsubst_decl): Use IDENTIFIER_TYPENAME_P.
+ * semantics.c (begin_class_definition): Handle partial
+ specializations of a type that was previously partially
+ instantiated.
+
+Wed Jan 6 03:18:53 1999 Mark Elbrecht <snowball3@usa.net.
+
+ * g++spec.c (LIBSTDCXX): Provide default definition.
+ (lang_specific_driver): Use LIBSTDCXX instead of "-lstdc++".
+
+Tue Jan 5 22:11:25 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Make-lang.in (g++.o): Depend on prefix.h.
+
+1999-01-04 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (bound_pmf_p): New fn.
+ * typeck.c (build_c_cast): Use it.
+
+ * decl.c (grok_op_properties): Use same_type_p.
+
+Tue Dec 22 15:09:25 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (cvt.o): Depend on toplev.h.
+
+ * cp-tree.h (check_template_shadow, pod_type_p): Add prototypes.
+
+ * cvt.c: Include toplev.h.
+
+ * except.c (get_eh_caught, get_eh_handlers): Hide prototypes and
+ definitions.
+
+ * init.c (expand_vec_init): Initialize variable `itype'.
+
+ * lex.c (yyerror): Cast the argument passed to a ctype function to
+ an unsigned char.
+
+ * method.c (build_mangled_C9x_name): Wrap prototype and definition
+ in "HOST_BITS_PER_WIDE_INT >= 64".
+
+ * typeck.c (build_binary_op): Mark parameter `convert_p' with
+ ATTRIBUTE_UNUSED.
+
+1998-12-22 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (TYPE_RAISES_EXCEPTIONS): Improve documentation.
+ * tree.c (build_exception_variant): Don't crash on empty throw
+ specs.
+
+1998-12-18 DJ Delorie <dj@cygnus.com>
+
+ * cvt.c (convert_to_reference): Check for both error_mark_node
+ and NULL_NODE after call to convert_for_initialization.
+
+1998-12-17 Jason Merrill <jason@yorick.cygnus.com>
+
+ * error.c (interesting_scope_p): New fn.
+ (dump_simple_decl): Use it.
+ (dump_expr, case CONSTRUCTOR): Force a & for a PMF.
+ (dump_expr, case OFFSET_REF): Print ->* if appropriate.
+
+1998-12-16 Mark Mitchell <mark@markmitchell.com>
+
+ * class.c (resolve_address_of_overloaded_function): Do conversion
+ to correct type here, rather than ...
+ (instantiate_type): Here.
+
+ * cp-tree.h (DECL_TEMPLATE_PARM_P): New macro.
+ (DECL_TEMPLATE_TEMPLATE_PARM_P): Use it.
+ (decl_template_parm_p): Remove.
+ * decl.c (pushdecl): Don't set DECL_CONTEXT for a template
+ parameter.
+ * lex.c (do_identifier): Use DECL_TEMPLATE_PARM_P.
+ * pt.c (push_inline_template_parms_recursive): Set it.
+ (decl_template_parm_p): Remove.
+ (check_template_shadow): Use DECL_TEMPLATE_PARM_P.
+ (process_template_parm): Set it.
+
+Wed Dec 16 16:33:58 1998 Dave Brolley <brolley@cygnus.com>
+
+ * lang-specs.h (default_compilers): Pass -MD, -MMD and -MG to cc1plus
+ if configured with cpplib.
+
+1998-12-15 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (poplevel): Make sure ns_binding is initialized.
+
+ * decl.c (finish_function): Undo inadvertent change in previous
+ patch.
+
+1998-12-14 Mark Mitchell <mark@markmitchell.com>
+
+ * class.c (pushclass): Tweak handling of class-level bindings.
+ (resolve_address_of_overloaded_function): Update pointer-to-member
+ handling.
+ (instantiate_type): Likewise.
+ * cvt.c (cp_convert_to_pointer): Likewise.
+ * decl.c (pop_binding): Take the DECL to pop, not just the name.
+ Deal with `struct stat' hack.
+ (binding_level): Add to documentation.
+ (push_binding): Clear BINDING_TYPE.
+ (add_binding): New function.
+ (push_local_binding): Use it.
+ (push_class_binding): Likewise.
+ (poplevel): Adjust calls to pop_binding.
+ (poplevel_class): Likewise.
+ (pushdecl): Adjust handling of TYPE_DECLs; add bindings for hidden
+ declarations to current binding level.
+ (push_class_level_binding): Likewise.
+ (push_overloaded_decl): Adjust handling of OVERLOADs in local
+ bindings.
+ (lookup_namespace_name): Don't crash when confronted with a
+ TEMPLATE_DECL.
+ (lookup_name_real): Do `struct stat' hack in local binding
+ contexts.
+ (build_ptrmemfunc_type): Adjust documentation.
+ (grokdeclarator): Don't avoid building real array types when
+ processing templates unless really necessary.
+ (finish_method): Adjust calls to pop_binding.
+ * decl2.c (reparse_absdcl_as_expr): Recursively call ourselves,
+ not reparse_decl_as_expr.
+ (build_expr_from_tree): Deal with a template-id as the function to
+ call in a METHOD_CALL_EXPR.
+ * pt.c (convert_nontype_argument): Tweak pointer-to-member handling.
+ (maybe_adjust_types_For_deduction): Don't do peculiar things with
+ METHOD_TYPEs here.
+ (resolve_overloaded_unification): Handle COMPONENT_REFs. Build
+ pointer-to-member types where necessary.
+ * tree.c (build_cplus_array_type_1): Don't avoid building real
+ array types when processing templates unless really necessary.
+ (build_exception_variant): Compare the exception lists correctly.
+
+1998-12-13 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.def (CPLUS_BINDING): Update documentation.
+ * cp-tree.h (LOCAL_BINDING_P): New macro.
+ (lang_identifier): Rename local_value to bindings.
+ (tree_binding): Make `scope' of type `void*', not `tree'.
+ (BINDING_SCOPE): Update documentation.
+ (IDENTIFIER_LOCAL_VALUE): Remove.
+ (IDENTIFIER_CLASS_VALUE): Document.
+ (IDENTIFIER_BINDING): New macro.
+ (IDENTIFIER_VALUE): Likewise.
+ (TIME_IDENTIFIER_TIME): Likewise.
+ (TIME_IDENTIFIER_FILEINFO): Likewise.
+ (IMPLICIT_TYPENAME_P): Likewise.
+ (set_identifier_local_value): Remove.
+ (push_local_binding): New function.
+ (push_class_binding): Likewise.
+ * class.c (pushclass): Update comments; use push_class_binding.
+ * decl.c (set_identifier_local_value_with_scope): Remove.
+ (set_identifier_local_value): Likewise.
+ (push_binding): New function.
+ (pop_binding): Likewise.
+ (binding_level): Update documentation. Remove shadowed.
+ (BINDING_LEVEL): New macro.
+ (free_binding_nodes): New variable.
+ (poplevel): Adjust for new name-lookup scheme. Don't mess up
+ BLOCK_VARs when doing for-scope extension. Remove effectively
+ dead code.
+ (pushlevel_class): Tweak formatting.
+ (poplevel_class): Adjust for new name-lookup scheme.
+ (print_binding_level): Likewise.
+ (store_bindings): Likewise.
+ (pushdecl): Likewise.
+ (pushdecl_class_level): Likewise.
+ (push_class_level_binding): Likewise.
+ (push_overloaded_decl): Update comments. Adjust for new
+ name-lookup scheme.
+ (lookup_name_real): Likewise.
+ (lookup_name_current_level): Likewise.
+ (cp_finish_decl): Likewise.
+ (require_complete_types_for_parms): Likewise. Remove misleading
+ #if 0'd code.
+ (grok_parms): Likewise. Don't call
+ require_complete_types_for_parms here.
+ (grok_ctor_properties): Don't treat templates as copy
+ constructors.
+ (grop_op_properties): Or as assignment operators.
+ (start_function): Document. Adjust for new name-lookup scheme.
+ (finish_function): Likewise.
+ * decl2.c (do_local_using_decl): Use push_local_binding.
+ * lex.c (begin_definition_of_inclass_inline): New function, split
+ out from ...
+ (do_pending_inlines): Here, and ...
+ (process_next_inline): Here.
+ (get_time_identifier): Use TIME_IDENTIFIER_* macros.
+ (init_filename_times): Likewise.
+ (extract_interface_info): Likewise.
+ (ste_typedecl_interface_info): Likewise.
+ (check_newline): Likewise.
+ (dump_time_statistics): Likewise.
+ (handle_cp_pragma): Likewise.
+ (do_identifier): Adjust for new name-lookup scheme.
+ * parse.y (function_try_block): Return ctor_initializer_opt value.
+ (fndef): Use it.
+ (fn.defpen): Pass appropriate values to start_function.
+ (pending_inline): Use functor_try_block value, and pass
+ appropriate values to finish_function.
+ * pt.c (is_member_template): Update documentation; remove handling
+ of FUNCTION_DECLs. As per name, this function should deal only in
+ TEMPLATE_DECLs.
+ (decl_template_parm_p): Change name of olddecl parameter to decl.
+ (check_template_shadow): Adjust for new name-lookup scheme.
+ (lookup_template_class): Likewise.
+ (tsubst_decl): Tweak so as not to confuse member templates with
+ copy constructors and assignment operators.
+ (unify): Handle UNION_TYPEs.
+ * ptree.c (print_lang_identifier): Adjust for new name-lookup scheme.
+ (lang_print_xnode): Adjust for new name-lookup scheme.
+ * typeck.c (mark_addressable): Likewise.
+ (c_expand_return): Likewise.
+
+1998-12-08 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokdeclarator): Allow field with same name as class
+ in extern "C".
+
+ * decl.c (lookup_name_real): Don't limit field lookup to types.
+ * class.c (check_member_decl_is_same_in_complete_scope): No error
+ if icv and x are the same.
+ * lex.c (do_identifier): Tweak error message.
+
+1998-12-10 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (start_enum): Use push_obstacks, not
+ end_temporary_allocation.
+ (finish_enum): Call pop_obstacks.
+
+1998-12-10 Mark Mitchell <mark@markmitchell.com>
+
+ * class.c (instantiate_type): Return error_mark_node rather than
+ junk.
+
+1998-12-09 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (most_specialized_instantiation): New function.
+ (print_candidates): Likewise.
+ * class.c (validate_lhs): Remove.
+ (resolve_address_of_overloaded_function): New function, split out
+ and then substantially reworked, from ...
+ (instantiate_type): Use it. Simplify.
+ * cvt.c (convert_to_reference): Complain when caller has indicated
+ that's the right thing to do. Don't crash if instantiate_type
+ fails.
+ * pt.c: Substitute `parameters' for `paramters' throughout.
+ (print_candidates): Don't make it static.
+ (most_specialized_instantiation): Split out from ...
+ (most_specialized): Here.
+
+Wed Dec 9 15:33:01 1998 Dave Brolley <brolley@cygnus.com>
+
+ * lex.c (lang_init_options): Initialize cpplib.
+ * decl2.c (parse_options,cpp_initialized): Removed.
+ (lang_decode_option): Move initialization of cpplib to
+ lang_init_options.
+
+1998-12-09 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (grokdeclarator): Update the name of the TEMPLATE_DECL, as
+ well as the TYPE_DECL, when a typedef name is assigned to a
+ previously anonymous type.
+
+1998-12-08 Andrew MacLeod <amacleod@cygnus.com>
+
+ * cp/except.c (call_eh_info): Use __start_cp_handler instead of
+ __cp_eh_info for getting the eh info pointer. Add table_index to
+ field list.
+ (push_eh_cleanup): Don't increment 'handlers' data field.
+ (process_start_catch_block): Don't set the 'caught' field.
+
+ * cp/exception.cc (CP_EH_INFO): New macro for getting the
+ exception info pointer within library routines.
+ (__cp_eh_info): Use CP_EH_INFO.
+ (__start_cp_handler): Get exception info pointer, set caught field,
+ and increment the handlers field. Avoids this being done by handlers.
+ (__uncatch_exception, __check_eh_spec): Use CP_EH_INFO macro.
+ (uncaught_exception): Use CP_EH_INFO macro.
+
+Tue Dec 8 10:48:21 1998 Jeffrey A Law (law@cygnus.com)
+
+ * Make-lang.in (cxxmain.o): Depend on $(DEMANGLE_H), not demangle.h
+
+Mon Dec 7 17:56:06 1998 Mike Stump <mrs@wrs.com>
+
+ * lex.c (check_newline): Add support for \ as `natural'
+ characters in file names in #line to be consistent with #include
+ handling. We support escape processing in the # 1 "..." version of
+ the command. See also support in cp/lex.c.
+
+1998-12-07 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * cp/decl2.c: s/data/opts/ when initializing cpp_reader
+ structure.
+
+1998-12-07 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (build_typename_type): Set DECL_ARTIFICIAL.
+
+ * error.c (dump_simple_decl): Also print namespace context.
+ (dump_function_decl): Likewise.
+
+ * decl2.c (ambiguous_decl): Don't print old value if it's
+ error_mark_node.
+
+ * decl.c (lookup_name_real): Fix handling of local types shadowed
+ by a non-type decl. Remove obsolete code.
+ * cp-tree.h (DECL_FUNCTION_SCOPE_P): New macro.
+
+ * lang-options.h: Add -fpermissive.
+ * decl2.c: Likewise.
+ * cp-tree.h: Add flag_permissive.
+ * decl.c (init_decl_processing): If neither -fpermissive or -pedantic
+ were specified, set flag_pedantic_errors.
+ * call.c (build_over_call): Turn dropped qualifier messages
+ back into pedwarns.
+ * cvt.c (convert_to_reference): Likewise.
+ * typeck.c (convert_for_assignment): Likewise.
+
+1998-12-05 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (coerce_new_type): Use same_type_p.
+ (coerce_delete_type): Likewise.
+
+ * call.c (check_dtor_name): Return 1, not error_mark_node.
+
+1998-12-04 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (handle_cp_pragma): Disable #pragma interface/implementation
+ if MULTIPLE_SYMBOL_SPACES.
+
+ * pt.c (check_template_shadow): New fn.
+ * decl2.c (grokfield): Use it.
+ * decl.c (pushdecl): Likewise.
+ (pushdecl_class_level): Likewise.
+ (start_method): Likewise.
+ (xref_tag): Don't try to use 't' if we're defining.
+
+ * call.c (check_dtor_name): Just return an error_mark_node.
+ * pt.c (lookup_template_class): Complain about using non-template here.
+ * parse.y (apparent_template_type): Not here.
+
+ * pt.c (check_explicit_specialization): Complain about specialization
+ with C linkage.
+
+ * lang-options.h: Add -f{no-,}implicit-inline-templates.
+
+ * pt.c (convert_nontype_argument): Don't assume that any integer
+ argument is intended to be a constant-expression.
+
+1998-12-03 Mark Mitchell <mark@markmitchell.com>
+
+ * class.c (handle_using_decl): Fix comment. Don't lookup
+ constructors in base classes.
+ (validate_lhs): Fix typo in comment.
+ * search.c (lookup_field_1): Don't return a USING_DECL.
+
+ * cp-tree.h (DECL_ACCESS): Improve documentation.
+
+ * decl.c (expand_static_init): Don't set the initialization-done
+ flag until the initialization is done.
+
+1998-12-02 Mark Mitchell <mark@markmitchell.com>
+
+ * decl2.c (validate_nonmember_using_decl): Complain about using
+ declarations for class members.
+
+1998-11-29 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck2.c (process_init_constructor): Use same_type_p.
+
+ * decl.c (check_tag_decl): Don't warn about null decl inside a
+ class.
+
+ * pt.c (unify, case OFFSET_TYPE): Pass down 'strict' rather than
+ UNIFY_ALLOW_NONE.
+ (convert_nontype_argument): Use TYPE_PTRMEMFUNC_FN_TYPE.
+ (resolve_overloaded_unification): Strip baselinks.
+
+Fri Nov 27 13:07:23 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * g++spec.c: Don't prototype xmalloc.
+
+1998-11-25 Jason Merrill <jason@yorick.cygnus.com>
+
+ * except.c (expand_throw): Use TYPE_PTR_P to check for pointers.
+
+ * decl.c (check_tag_decl): Do complain about null friend decl at
+ file scope.
+
+1998-11-25 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * lex.c (make_lang_type): Clear the whole struct lang_type, not
+ only the first multiple of sizeof (int).
+
+1998-11-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (start_decl): An explicit specialization of a static data
+ member is only a definition if it has an initializer.
+
+ * except.c (expand_throw): Use cp_finish_decl for the throw temp.
+ * cvt.c (build_up_reference): Pass DIRECT_BIND down into
+ cp_finish_decl.
+ * init.c (expand_default_init): Check for DIRECT_BIND instead of
+ DECL_ARTIFICIAL.
+
+ * call.c (build_over_call): Use build_decl.
+
+ * except.c (expand_throw): Just use convert, not
+ build_reinterpret_cast.
+
+ * lex.c (handle_generic_pragma): Use token_buffer.
+
+ * decl.c (check_tag_decl): Don't complain about null friend decl.
+
+1998-11-24 Dave Pitts <dpitts@cozx.com>
+
+ * Make-lang.in (DEMANGLER_PROG): Move the output arguments to the
+ first position.
+ * lex.c (check_newline): Use ISALPHA.
+ (readescape): Use ISGRAPH.
+ (yyerror): Use ISGRAPH.
+
+1998-11-24 Nathan Sidwell <nathan@acm.org>
+
+ * search.c (get_abstract_virtuals): Do not use initial
+ CLASSTYPE_ABSTRACT_VIRTUALS.
+ * typeck2.c (abstract_virtuals_error): Show location of abstract
+ declaration.
+ * call.c (build_new_method_call): Use
+ CLASSTYPE_ABSTRACT_VIRTUAL, rather than recalculate.
+ * class.c (finish_struct_bits): Don't bother working out whether
+ get_abstract_virtuals will do anything, just do it.
+
+1998-11-24 Graham <grahams@rcp.co.uk>
+
+ * typeck.c (build_component_ref): Remove unused statement.
+
+1998-11-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (add_method): Catch invalid overloads.
+
+ * class.c (add_method): Build up OVERLOADs properly for conversion ops.
+ * search.c (lookup_conversions): Handle getting real OVERLOADs.
+ (add_conversions): Likewise. Revert last change.
+ * call.c (add_conv_candidate): Pass totype to add_candidate instead
+ of fn. Don't add a new candidate if the last one was for the same
+ type.
+ (print_z_candidates): Handle getting a type as a function.
+ (joust): If we got two conversion candidates to the same type,
+ just pick one.
+ (build_object_call): Lose 'templates'.
+ (build_user_type_conversion_1): Handle getting real OVERLOADs.
+
+1998-11-23 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck2.c (process_init_constructor): If there are elements
+ that don't have initializers and they need to have constructors
+ run, supply them with initializers.
+
+ * class.c (finish_struct_1): A class with a 0-width bitfield is
+ still empty.
+
+1998-11-23 Mark Mitchell <mark@markmitchell.com>
+
+ * pt.c (instantiate_class_template): Don't try to figure out what
+ specialization to use for a partial instantiation. Correct
+ typos in a couple of comments. Avoid calling uses_template_parms
+ multiple times.
+
+1998-11-23 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * method.c (process_overload_item): Add call to
+ build_mangled_C9x_name for intTI_type_nodes.
+ (build_mangled_C9x_name): Add prototype, define.
+ * decl.c (init_decl_processing): Add names for
+ TImode_type_node.
+
+1998-11-23 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (named_class_head): Update CLASSTYPE_DECLARED_CLASS.
+
+ * class.c (finish_struct_1): Set things up for 0-width bitfields
+ like we do for others.
+
+ * decl.c (check_tag_decl): New fn.
+ (shadow_tag): Split out from here.
+ * decl2.c (grok_x_components): Call it.
+
+1998-11-22 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c: Lose warn_about_return_type.
+ (grokdeclarator): Always complain about implicit int, except for
+ `main () { ... }'.
+
+ * decl.c (tag_name): New fn.
+ (xref_tag): Complain about using typedef-name after class-key.
+
+ * init.c (expand_vec_init): Also keep going if from_array.
+
+ * tree.c (is_overloaded_fn): Also handle the output of
+ build_offset_ref.
+
+ * decl.c (grokdeclarator): Use constructor_name when comparing
+ field name against enclosing class.
+ * class.c (finish_struct_anon): Likewise.
+
+1998-11-22 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (poplevel): Remove code to handle KEEP == 2.
+ (finish_function): Don't confuse BLOCK-order when
+ processing a destructor.
+
+1998-11-21 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (require_complete_types_for_parms): Call layout_decl
+ after we've completed the type.
+
+1998-11-21 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl2.c (validate_nonmember_using_decl): Allow using templates
+ from the global namespace.
+
+1998-11-21 Jason Merrill <jason@yorick.cygnus.com>
+
+ Handle specifying template args to member function templates.
+ * tree.c (build_overload): Always create an OVERLOAD for a template.
+ * search.c (add_conversions): Handle finding an OVERLOAD.
+ * decl2.c (check_classfn): Likewise.
+ * lex.c (identifier_type): See through a baselink.
+ * parse.y (do_id): Don't call do_identifier if we got a baselink.
+ * class.c (instantiate_type, case TREE_LIST): Recurse.
+
+ * decl.c (grokdeclarator): Allow a boolean constant for array
+ bounds, odd as that sounds.
+
+ * pt.c (unify): Be more strict about non-type parms, except for
+ array bounds.
+ (UNIFY_ALLOW_INTEGER): New macro.
+
+1998-11-19 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * Make-lang.in (mandir): Replace all uses of $(mandir) by $(man1dir).
+
+1998-11-19 Jason Merrill <jason@yorick.cygnus.com>
+
+ * semantics.c (begin_class_definition): Call
+ maybe_process_partial_specialization before push_template_decl.
+ Don't call push_template_decl for a specialization.
+ * search.c (lookup_field): Do return a member template class.
+ * decl2.c (handle_class_head): Handle member template classes.
+
+ * decl.c (grokdeclarator): A parm type need not be complete.
+
+ * pt.c (convert_nontype_argument): Fix thinko.
+
+1998-11-18 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (PTRMEM_CST_CLASS): Fix typo.
+ (global_delete_fndecl): New variable.
+ * decl.c (global_delete_fndecl): Define it.
+ (init_decl_processing): Set it.
+ * init.c (build_builtin_delete_call): Use it.
+ * tree.c (mapcar): Recursively call mapcar for the type of EXPR
+ nodes.
+
+1998-11-18 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (cplus_expand_expr_stmt): Always complain about unresolved
+ type.
+
+ * tree.c (lvalue_p_1): An INDIRECT_REF to a function is an lvalue.
+ * call.c (build_object_call): Also support references to functions.
+ * typeck.c (convert_for_initialization): Don't decay a function
+ if the target is a reference to function.
+
+ * search.c (add_conversions): Get all the overloads from a class.
+
+ * decl.c (grok_ctor_properties): Complain about any constructor
+ that will take a single arg of the class type by value.
+
+ * typeck2.c (build_functional_cast): Can't create objects of
+ abstract classes this way.
+ * cvt.c (ocp_convert): Likewise.
+
+ * decl.c (grokfndecl): Member functions of local classes are not
+ public.
+
+1998-11-18 Mark Mitchell <mark@markmitchell.com>
+
+ * Make-lang.in (cc1plus): Add dependency on hash.o.
+
+1998-11-18 Jason Merrill <jason@yorick.cygnus.com>
+
+ * search.c (get_abstract_virtuals): Complain about virtuals with
+ no final overrider.
+ * typeck2.c (abstract_virtuals_error): Remove handling for virtuals
+ with no final overrider.
+ * class.c (override_one_vtable): Don't set DECL_ABSTRACT_VIRTUAL_P
+ on virtuals with no final overrider.
+
+ * lex.c (reinit_parse_for_block): Add a space after the initial ':'.
+
+ * class.c (finish_struct_1): Don't remove zero-width bit-fields until
+ after layout_type.
+
+ * friend.c (do_friend): Don't set_mangled_name_for_decl.
+
+ * class.c (finish_struct_anon): Complain about non-fields.
+ * decl2.c (build_anon_union_vars): Likewise.
+
+ * decl.c (grokdeclarator): Normal data members can't have the same
+ name as the class, either.
+ * class.c (finish_struct_anon): Neither can members of an
+ anonymous union.
+
+1998-11-17 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses.
+ (TYPE_BINFO): Likewise.
+ (IS_AGGR_TYPE): Tweak.
+ (SET_IS_AGGR_TYPE): New macro.
+ (CLASS_TYPE_P): Tweak.
+ (lang_type): Group mark bitfields together. Remove linenum.
+ (CLASSTYPE_SOURCE_LINE): Remove macro.
+ (CLASSTYPE_MARKED_N): New macro.
+ (SET_CLASSTYPE_MARKED_N): Likewise.
+ (CLEAR_CLASSTYPE_MARKED_N): Likewise.
+ (CLASS_TYPE_MARKED_*): Use them.
+ (SET_CLASSTYPE_MARKED_*): Likewise.
+ (CLEAR_CLASSTYPE_MARKED_*): Likewise.
+ (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise.
+ (TYPE_TEMPLATE_INFO): Handle TEMPLATE_TEMPLATE_PARMs as well.
+ (TYPENAME_TYPE_FULLNAME): Use TYPE_BINFO rather than CLASSTYPE_SIZE.
+ * class.c (class_cache_obstack): New variable.
+ (class_cache_firstobj): Likewise.
+ (finish_struct): Don't set CLASSTYPE_SOURCE_LINE.
+ (pushclass): Free the cache, when appropriate.
+ (popclass): Tidy.
+ (maybe_push_cache_obstack): Use class_cache_obstack.
+ * decl.c (include hash.h).
+ (typename_hash): New function.
+ (typename_compare): Likewise.
+ (build_typename_type): Check the hash table to avoid creating
+ duplicates.
+ (build_ptrmemfunc_type): Use SET_IS_AGGR_TYPE.
+ (grokdeclarator): Use CLASS_TYPE_P.
+ (xref_basetypes): Likewise.
+ (start_function): Likewise. Don't put current_class_ref on the
+ permanent obstack.
+ * error.c (dump_type_real): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO
+ and TYPE_TI_ARGS.
+ * lex.c (note_got_semicolon): Use CLASS_TYPE_P.
+ (make_lang_type): Don't create TYPE_LANG_SPECIFIC and associated
+ fields for types other than class types. Do clear TYPE_ALIAS_SET
+ for types other than class types, though.
+ * method.c (build_overload_identifier): Use CLASS_TYPE_P and
+ TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
+ * pt.c (process_template_parm): Don't set
+ CLASSTYPE_GOT_SEMICOLON.
+ (lookup_template_class): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
+ Coerce arguments on the momentary obstack.
+ (for_each_template_parm): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
+ (instantiate_class_template): Calculate template arguments on the
+ momentary obstack. Tidy.
+ (tsubst_template_arg_vector): Use make_temp_vec.
+ (tsubst_aggr_type): Put template arguments on the momentary
+ obstack.
+ (tsubst_decl): Likewise.
+ (tsubst): Copy the array bounds index to the permanent obstack
+ before building index types. Use new macros.
+ (unify): Use new macros.
+ (do_type_instantiation): Likewise.
+ * search.c (lookup_fnfields_1): Use new macros.
+ (dfs_pushdecls): Build envelopes on the cache obstack.
+ (dfs_compress_decls): Use new macros.
+ (push_class_decls): Build on the cache obstack.
+ * semantics.c (finish_typeof): Don't set CLASSTYPE_GOT_SEMICOLON.
+ * sign.c (build_signature_pointer_or_reference_type): Use
+ SET_IS_AGGR_TYPE.
+ * tree.c (make_binfo): Check CLASS_TYPE_P.
+ (copy_template_template_parm): Adjust.
+ (make_temp_vec): Use push_expression_obstack.
+ * typeck.c (complete_type): Use new macros.
+ (comptypes): Likewise.
+
+1998-11-17 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst): Add diagnostics for invalid array, reference
+ and pointer to member types.
+
+1998-11-16 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck2.c (my_friendly_abort): Don't fatal twice in a row.
+
+ * typeck.c (c_expand_start_case): Use build_expr_type_conversion.
+ Simplify.
+
+ * parse.y (structsp): Fix cut-and-paste error.
+
+ * init.c (build_new): Complain about non-integral size.
+
+ * parse.y (unary_expr): Complain about defining types in sizeof.
+
+ * typeck.c (expr_sizeof): Complain about sizeof an overloaded fn.
+
+ * rtti.c (build_x_typeid): Complain about typeid without
+ including <typeinfo>.
+ (get_typeid): Likewise. Complain about typeid of incomplete type.
+ (get_tinfo_fn_dynamic): Likewise.
+ (get_typeid_1): Not static anymore.
+ * except.c (build_eh_type_type): Use get_typeid_1.
+
+ * rtti.c (build_dynamic_cast_1): Give errors for dynamic_cast to
+ ambiguous or private bases. Fix warning for reference cast.
+
+1998-11-16 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (DECL_TEMPLATE_INSTANTIATED): New macro.
+ * decl.c (duplicate_decls): Remove special-case code to deal with
+ template friends, and just do the obvious thing.
+ * pt.c (register_specialization): Tweak for clarity, and also to
+ clear DECL_INITIAL for an instantiation before it is merged with a
+ specialization.
+ (check_explicit_specialization): Fix indentation.
+ (tsubst_friend_function): Handle both definitions in friend
+ declaration and outside friend declarations.
+ (tsubst_decl): Don't clear DECL_INITIAL for an instantiation.
+ (regenerate_decl_from_template): Tweak accordingly.
+ (instantiate_decl): Likewise.
+
+1998-11-16 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (cplus_expand_expr_stmt): Promote warning about naked
+ member function reference to error.
+ * cvt.c (ocp_convert): Complain about converting an overloaded
+ function to void.
+
+ * init.c (build_offset_ref): Just return a lone static member
+ function.
+
+ * decl.c (cp_finish_decl): Only complain about real CONSTRUCTORs,
+ not internal ones.
+
+ * typeck.c (build_binary_op_nodefault): Improve error handling.
+
+ * decl.c (grokfndecl): Complain about making 'main' a template.
+
+ * typeck.c (string_conv_p): Don't convert from wchar_t[] to char*.
+
+ * call.c (build_method_call): Handle a BIT_NOT_EXPR around a
+ TYPE_DECL in a template.
+
+1998-11-15 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck2.c (my_friendly_abort): Add URL in the other case, too.
+
+ * decl.c (struct cp_function): Add named_label_uses.
+ (push_cp_function_context): Save it.
+ (pop_cp_function_context): Restore it.
+ (define_label): Also complain about jumping into the scope of
+ non-POD objects that don't have constructors.
+ * tree.c (pod_type_p): New fn.
+
+ * pt.c (instantiate_class_template): Clear TYPE_BEING_DEFINED sooner.
+ * rtti.c (synthesize_tinfo_fn): Call import_export_decl here.
+ (get_tinfo_fn): Not here.
+ * repo.c (repo_get_id): Abort if we get called for an incomplete
+ type.
+
+1998-11-13 Mark Mitchell <mark@markmitchell.com>
+
+ * except.c (expand_throw): Make sure first argument to
+ __cp_push_exception is of type `void*' to avoid spurious error
+ messages.
+
+1998-11-11 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (try_one_overload): Take orig_targs again. Only check for
+ mismatches against them; we don't care what a previous call found.
+ (resolve_overloaded_unification): Adjust.
+
+ * search.c (lookup_field): Don't return anything for a non-type
+ field from a dependent type.
+ * decl.c (grokdeclarator): Resolve SCOPE_REFs of the current class
+ in an array declarator.
+ (start_decl): Push into the class before looking for the field.
+
+1998-11-08 Mark Mitchell <mark@markmitchell.com>
+
+ * method.c (build_overload_value): Handle REFERENCE_TYPE.
+
+1998-11-08 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (grokdeclarator): Allow namespace-scoped members if they
+ are friends.
+
+1998-11-08 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst_decl): Don't mess with the global value of an
+ un-mangled DECL_ASSEMBLER_NAME.
+
+1998-11-03 Christopher Faylor <cgf@cygnus.com>
+
+ * decl.c (init_decl_processing): Remove CYGWIN conditional
+ since CYGWIN is now able to deal with trapping signals.
+
+Sat Nov 7 15:48:02 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h: Don't include gansidecl.h.
+ * exception.cc: Include gansidecl.h (since we don't include config.h)
+ * g++spec.c: Don't include gansidecl.h.
+
+1998-11-06 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (lang_decl_flags): Add defined_in_class. Decrease
+ size of dummy.
+ (DECL_DEFINED_IN_CLASS_P): New macro.
+ (TEMPLATE_PARMS_FOR_INLINE): Document.
+ (check_static_variable_definition): New function.
+ * decl.c (cp_finish_decl): Set DECL_DEFINED_IN_CLASS_P, if
+ appropriate.
+ (check_static_variable_definition): Split out from ...
+ (grokdeclarator): Here.
+ * pt.c (check_default_tmpl_args): New function, split out from ...
+ (push_template_decl_real): Here.
+ (instantiate_template): Fix comment.
+
+1998-11-04 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (CP_TYPE_CONST_P): Make {0,1}-valued.
+ (CP_TYPE_VOLATILE_P): Likewise.
+ (CP_TYPE_RESTRICT_P): Likewise.
+
+1998-11-03 Mark Mitchell <mark@markmitchell.com>
+
+ * pt.c (tsubst): Use build_index_type, not build_index_2_type.
+
+1998-11-02 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (instantiate_type): Be more helpful.
+
+ * decl2.c (import_export_decl): Call import_export_class.
+
+ * cp-tree.h (EMPTY_CONSTRUCTOR_P): Check !TREE_HAS_CONSTRUCTOR.
+ * decl2.c (build_expr_from_tree): Propagate TREE_HAS_CONSTRUCTOR.
+ * pt.c (tsubst_copy): Likewise.
+
+1998-11-02 Mark Mitchell <mark@markmitchell.com>
+
+ * init.c (expand_vec_init): Fix off-by-one error.
+
+1998-11-02 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * parse.y (apparent_template_type): New type.
+ (named_complex_class_head_sans_basetype): Use it.
+ * Makefile.in (CONFLICTS): One new conflict.
+ * parse.c: Regenerated.
+
+1998-11-01 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (COMPARE_STRICT): New macro.
+ (COMPARE_BASE): Likewise.
+ (COMPARE_RELAXED): Likewise.
+ (COMPARE_REDECLARATION): Likewise.
+ (same_type_p): Likewise.
+ (same_or_base_type_p): Likewise.
+ * call.c (standard_conversion): Use them, in place of comptypes
+ with numeric arguments.
+ (reference_binding): Likewise.
+ (convert_like): Likewise.
+ (build_over_call): Likewise.
+ (is_subseq): Likewise.
+ (is_properly_derived_from): Likewise.
+ (compare_ics): Likewise.
+ (joust): Likewise.
+ * class.c (delete_duplicate_fields_1): Likewise.
+ (resolves_to_fixed_type_p): Likewise.
+ (instantiate_type): Likewise. Remove #if 0'd code.
+ * decl.c (decls_match): Likewise. Use COMPARE_REDECLARATION here.
+ (pushdecl): Likewise.
+ (lookup_name_real): Likewise.
+ (grokdeclarator): Likewise. Check for illegal array declarations.
+ (grokparms): Likewise.
+ (grok_op_properties): Likewise.
+ * decl2.c (check_classfn): Likewise.
+ * friend.c (is_friend): Likewise.
+ (make_friend_class): Likewise.
+ * init.c (expand_aggr_init): Likewise.
+ (expand_vec_init): Likewise.
+ * pt.c (is_member_template_class): Remove declaration.
+ (is_specialization_of): Use COMPARE_* and new macros.
+ (comp_template_parms): Likewise.
+ (convert_nontype_argument): Likewise.
+ (coerce_template_template_parms): Likewise.
+ (template_args_equal): Likewise.
+ (lookup_template_class): Likewise.
+ (type_unification_real): Likewise.
+ (unify): Likewise.
+ (get_bindings_real): Likewise.
+ * search.c (covariant_return_p): Likewise.
+ (get_matching_virtual): Likewise.
+ * sig.c (match_method_types): Likewise.
+ * tree.c (vec_binfo_member): Likewise.
+ (cp_tree_equal): Likewise.
+ * typeck.c (common_type): Likewise.
+ (comp_array_types): Likewise. Get issues involving unknown array
+ bounds right.
+ (comptypes): Update comments. Use new flags.
+ (comp_target_types): Use new macros.
+ (compparms): Likewise.
+ (comp_target_parms): Likewise.
+ (string_conv_p): Likewise.
+ (build_component_ref): Likewise.
+ (build_indirect_ref): Likewise.
+ (build_conditional_expr): Likewise.
+ (build_static_cast): Likewise.
+ (build_reinterpret_cast): Likewise.
+ (build_const_cast): Likewise.
+ (build_modify_expr): Likewise.
+ (convert_for_assignment): Likewise.
+ (comp_ptr_ttypes_real): Likewise.
+ (ptr_reasonably_similar): Likewise.
+ (comp_ptr_ttypes_const): Likewise.
+
+1998-10-31 Jason Merrill <jason@yorick.cygnus.com>
+
+ * rtti.c (build_dynamic_cast_1): Fix cut-and-paste error.
+
+1998-10-30 Mark Mitchell <mark@markmitchell.com>
+
+ * decl2.c (delete_sanity): Pass integer_zero_node, not
+ integer_two_node, to build_vec_delete.
+ * init.c (build_array_eh_cleanup): Remove.
+ (expand_vec_init_try_block): New function.
+ (expand_vec_init_catch_clause): Likewise.
+ (build_vec_delete_1): Don't deal with case that auto_delete_vec
+ might be integer_two_node anymore.
+ (expand_vec_init): Rework for initialization-correctness and
+ exception-correctness.
+ * typeck2.c (process_init_constructor): Make mutual exclusivity
+ of cases more obvious.
+
+1998-10-29 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (lookup_name_real): OK, only warn if not lexing.
+ Simplify suggested fix.
+
+ * cp-tree.h (IDENTIFIER_MARKED): New macro.
+ * search.c (lookup_conversions): Use breadth_first_search.
+ (add_conversions): Avoid adding two conversions to the same type.
+ (breadth_first_search): Work with base binfos, rather
+ than binfos and base indices.
+ (get_virtual_destructor): Adjust.
+ (tree_has_any_destructor_p): Adjust.
+ (get_matching_virtual): Adjust.
+
+ * pt.c (push_template_decl_real): Generalize check for incorrect
+ number of template parms.
+ (is_member_template_class): #if 0.
+
+1998-10-29 Richard Henderson <rth@cygnus.com>
+
+ * Makefile.in (cc1plus): Put CXX_OBJS, and thence @extra_cxx_objs@,
+ last.
+
+1998-10-28 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * lex.c: Call check_newline from lang_init always. After
+ calling cpp_start_read, set yy_cur and yy_lim to read from the
+ cpplib token buffer.
+
+1998-10-28 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (instantiate_type): Don't consider templates for a normal
+ match.
+
+ * class.c (finish_struct_1): Don't complain about non-copy
+ assignment ops in union members.
+
+ * class.c (build_vtable): Don't pass at_eof to import_export_vtable.
+ (prepare_fresh_vtable): Likewise.
+ (finish_struct_1): Don't call import_export_class.
+ * decl2.c (finish_vtable_vardecl): Do import/export stuff.
+ (finish_prevtable_vardecl): Lose.
+ (finish_file): Don't call it.
+ * pt.c (instantiate_class_template): Likewise.
+ * cp-tree.h: Remove it.
+
+ * init.c (build_delete): Reset TYPE_HAS_DESTRUCTOR here.
+ * decl.c (finish_function): Not here.
+ (start_function): Do set DECL_INITIAL.
+
+ * pt.c (push_template_decl_real): Complain about default template
+ args for enclosing classes.
+
+ * call.c (add_function_candidate): Treat conversion functions
+ as coming from the argument's class.
+ * cp-tree.h (DECL_CONV_FN_P): New fn.
+ (DECL_DESTRUCTOR_P): Also check DECL_LANGUAGE.
+ * class.c (add_method): Use DECL_CONV_FN_P.
+ * decl2.c (check_classfn): Likewise.
+ * error.c (dump_function_name): Likewise.
+ (dump_function_decl): Likewise.
+ * pt.c (fn_type_unification): Likewise.
+ * search.c (add_conversions): Likewise.
+
+1998-10-27 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (do_identifier): Also generate LOOKUP_EXPR for RESULT_DECL.
+ * method.c (hack_identifier): Also check for using RESULT_DECL
+ from outer context.
+
+1998-10-27 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (grokdeclarator): Use type_quals, rather than constp,
+ consistently.
+
+1998-10-27 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (standard_conversion): instantiate_type here.
+ (reference_binding): And here.
+ (implicit_conversion): Not here.
+ (build_op_delete_call): No need to cons up an OVERLOAD.
+ * cvt.c (cp_convert_to_pointer): instantiate_type here.
+ (convert_to_reference): And here.
+ * decl.c (grok_reference_init): Not here.
+ (grokparms): Or here.
+ * typeck2.c (digest_init): Or here.
+ * typeck.c (decay_conversion): Take the address of overloaded
+ functions, too.
+ (require_instantiated_type): Lose.
+ (convert_arguments): Don't handle unknown types here.
+ (build_c_cast): Likewise.
+ (build_binary_op): Gut.
+ (build_conditional_expr): Don't require_instantiated_type.
+ (build_modify_expr): Likewise.
+ (build_static_cast): Don't instantiate_type.
+ (build_reinterpret_cast): Likewise.
+ (build_const_cast): Likewise.
+ (convert_for_initialization): Likewise.
+ (build_ptrmemfunc): Use type_unknown_p.
+ (convert_for_assignment): Also do default_conversion on overloaded
+ functions. Hand them off to ocp_convert.
+
+1998-10-26 Mark Mitchell <mark@markmitchell.com>
+
+ * error.c (dump_decl): Deal with TEMPLATE_DECLs that are
+ VAR_DECLs. Handle vtables whose DECL_CONTEXT is not a type.
+
+ * class.c (finish_struct_1): Use build_cplus_array_type to build
+ array types.
+ * decl.c (init_decl_processing): Likewise.
+ * except.c (expand_end_eh_spec): Likewise.
+ * search.c (expand_upcast_fixups): Simplify very slightly.
+
+1998-10-26 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokdeclarator): Complain about a variable using
+ constructor syntax coming back null from start_decl.
+
+ * friend.c (make_friend_class): Complain about trying to make
+ a non-class type a friend.
+
+ * decl.c (grokfndecl): Set DECL_INITIAL for a defn here.
+ (start_function): Not here.
+
+1998-10-26 Brendan Kehoe <brendan@cygnus.com>
+
+ * decl.c (grokdeclarator): Disallow `explicit' in a friend declaration.
+
+1998-10-26 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck2.c (process_init_constructor): Only skip anonymous fields
+ if they are bitfields.
+
+ * cp-tree.def (TYPEOF_TYPE): New code.
+ * error.c (dump_type_real): Handle it.
+ * pt.c (tsubst): Likewise.
+ * tree.c (search_tree): Likewise.
+ * semantics.c (finish_typeof): New fn.
+ * parse.y (typespec): Use it.
+ * cp-tree.h: Declare it.
+
+1998-10-26 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * cp-tree.h (FORMAT_VBASE_NAME): Make definition unconditional.
+
+1998-10-26 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (convert_arguments): Don't handle pmf references
+ specially.
+
+ * init.c (build_member_call): Don't try to convert to the base type
+ if it's ambiguous or pedantic.
+
+ * typeck2.c (check_for_new_type): Only depend on pedantic for
+ C-style casts.
+
+1998-10-25 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (grokdeclarator): Set DECL_NONCONVERTING_P for all
+ non-converting constructors.
+
+1998-10-24 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * gxxint.texi: Correct documentation for n, N, Q, and B.
+
+1998-10-23 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * parse.y (condition): Convert VAR_DECL from reference to indirect
+ reference.
+
+1998-10-23 Andrew MacLeod <amacleod@cygnus.com>
+
+ * exception.cc (__cp_pop_exception): Free the original exception
+ value, not the potentially coerced one.
+
+1998-10-23 Mark Mitchell <mark@markmitchell.com>
+
+ * Makefile.in (hash.h): Run gperf when necessary.
+
+ * cp-tree.h (CP_TYPE_READONLY): Remove.
+ (CP_TYPE_VOLATILE): Likewise.
+ (CP_TYPE_QUALS): New macro.
+ (CP_TYPE_CONST_P): Likewise.
+ (CP_TYPE_VOLATILE_P): Likewise.
+ (CP_TYPE_RESTRICT_P): Likewise.
+ (CP_TYPE_CONST_NON_VOLATILE_P): Likewise.
+ (cp_build_type_variant): Rename to ...
+ (cp_build_qualified_type): New function.
+ (c_apply_type_quals_to_decl): Declare.
+ (SIGNATURE_POINTER_NAME_FORMAT): Modify to allow `restrict'.
+ (SIGNATURE_REFERENCE_NAME_FORMAT): Likewise.
+ (cp_type_qual_from_rid): New function.
+ (compparms): Remove unused parameter. All callers changed.
+ (cp_type_quals): New function.
+ (at_least_as_qualified_p): Likewise.
+ (more_qualified_p): Likewise.
+
+ * call.c (standard_conversion): Replace calls to
+ cp_build_type_variant with cp_build_qualified_type. Use
+ CP_TYPE_QUALS to get qualifiers and at_least_as_qualified_p to
+ compare them. Use CP_TYPE_* macros to check qualifiers.
+ (reference_binding): Likewise.
+ (implicit_conversion): Likewise.
+ (add_builtin_candidates): Likewise.
+ (build_over_call): Likewise.
+ * class.c (overrides): Compare all qualifiers, not just `const',
+ on method declarations.
+ * cvt.c (convert_to_reference): More CP_TYPE_QUALS conversion, etc.
+ (convert_pointer_to_real): Likewise.
+ (type_promotes_to): Likewise.
+ * decl.c (check_for_uninitialized_const_var): New function.
+ (init_decl_processing): More CP_TYPE_QUALS conversion, etc.
+ (cp_finish_decl): Use check_for_uninitialized_const_var.
+ (grokdeclarator): More CP_TYPE_QUALS conversion, etc. Update to
+ handle `restrict'.
+ (grok_ctor_properties): Likewise.
+ (grok_op_properties): Likewise.
+ (start_function): Likewise.
+ (rever_static_member_fn): Likewise.
+ * decl2.c (grok_method_quals): Likewise.
+ (grokfield): Likewise.
+ * error.c (dump_readonly_or_volatile): Rename to ...
+ (dump_qualifiers): New function. Handle `restrict'.
+ (dump_type_real): Use it.
+ (dump_aggr_type): Likewise.
+ (dump_type_prefix): Likewise.
+ (dump_type_suffix): Likewise.
+ (dump_function_decl): Likewise.
+ (cv_as_string): Likewise.
+ * gxx.gperf: Add __restrict and __restrict__.
+ * gxxint.texi: Document `u' as used for `__restrict', and a few
+ other previously undocumented codes.
+ * hash.h: Regenerated.
+ * init.c (expand_aggr_init): More CP_TYPE_QUALS conversion, etc.
+ (build_member_call): Likewise.
+ (build_new_1): Likewise.
+ * lex.c (init_parse): Add entry for RID_RESTRICT.
+ (cons_up_default_function): More CP_TYPE_QUALS conversion, etc.
+ (cp_type_qual_from_rid): Define.
+ * lex.h (enum rid): Add RID_RESTRICT.
+ * method.c (process_modifiers): Deal with `restrict'.
+ * parse.y (primary): More CP_TYPE_QUALS conversion, etc.
+ * parse.c: Regenerated.
+ * pt.c (convert_nontype_argument): More CP_TYPE_QUALS conversion, etc.
+ (tsubst_aggr_type): Likewise.
+ (tsubst): Likewise.
+ (check_cv_quals_for_unify): Likewise.
+ (unify): Likewise.
+ * rtti.c (init_rtti_processing): Likewise.
+ (build_headof): Likewise.
+ (get_tinfo_var): Likewise.
+ (buidl_dynamic_cast_1): Likewise. Fix `volatile' handling.
+ (expand_class_desc): Likewise.
+ (expand_attr_desc): Likewise.
+ (synthesize_tinfo_fn): Likewise.
+ * search.c (covariant_return_p): Likewise. Fix `volatile' handling.
+ (get_matching_virtual): Likewise.
+ (expand_upcast_fixups): Likewise.
+ * sig.c (build_signature_pointer_or_reference_name): Take
+ type_quals, not constp and volatilep.
+ (build_signature_pointer_or_reference_type): Likewise.
+ (match_method_types): More CP_TYPE_QUALS conversion, etc.
+ (build_signature_pointer_constructor): Likewise.
+ (build_signature_method_call): Likewise.
+ * tree.c (build_cplus_array_type): Likewise.
+ (cp_build_type_variant): Rename to ...
+ (cp_build_qualified_type): New function. Deal with `__restrict'.
+ (canonical_type_variant): More CP_TYPE_QUALS conversion, etc.
+ (build_exception_variant): Likewise.
+ (mapcar): Likewise.
+ * typeck.c (qualif_type): Likewise.
+ (common_type): Likewise.
+ (comptypes): Likewise.
+ (comp_cv_target_types): Likewise.
+ (at_least_as_qualified_p): Define.
+ (more_qualified_p): Likewise.
+ (comp_cv_qualification): More CP_TYPE_QUALS conversion, etc.
+ (compparms): Likewise.
+ (inline_conversion): Likewise.
+ (string_conv_p): Likewise.
+ (build_component_ref): Likewise.
+ (build_indirect_ref): Likewise.
+ (build_array_ref): Likewise.
+ (build_unary_op): Likewise.
+ (build_conditional_expr): Likewise.
+ (build_static_cast): Likewise.
+ (build_c_cast): Likewise.
+ (build_modify_expr): Likewise.
+ (convert_For_assignment): Likewise.
+ (comp_ptr_ttypes_real): Likewise.
+ (cp_type_quals): New function.
+
+1998-10-23 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (CP_TYPE_READONLY): New macro to handle arrays.
+ (CP_TYPE_VOLATILE): Likewise.
+ * decl.c (grokdeclarator): Use them.
+ * tree.c (canonical_type_variant): Likewise.
+
+1998-10-22 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * parse.y (named_class_head): Push into class while parsing the
+ base class list.
+ * decl2.c (push_scope, pop_scope): New functions.
+ * cp-tree.h: Declare them.
+ * init.c (build_new_1): Delay cleanup until end of full expression.
+
+1998-10-21 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_component_ref): Use of a type here is an error.
+
+1998-10-19 Jason Merrill <jason@yorick.cygnus.com>
+
+ Revamp references to member functions.
+ * method.c (hack_identifier): Call build_component_ref for a
+ reference to a member function.
+ * typeck.c (build_component_ref): Only return a single function
+ if it's static. Otherwise, return a COMPONENT_REF.
+ (build_x_function_call): Handle a COMPONENT_REF.
+ (build_unary_op): Handle all unknown-type things.
+ * decl2.c (arg_assoc): Handle COMPONENT_REF.
+ * class.c (instantiate_type): Complain if the function we get is a
+ nonstatic member function. Remove code for finding "compatible"
+ functions.
+ * pt.c (tsubst_copy): Handle NOP_EXPR.
+ * tree.c (build_dummy_object): New fn.
+ (maybe_dummy_object): New fn.
+ (is_dummy_object): New fn.
+ * cp-tree.h: Declare them.
+ * cvt.c (cp_convert_to_pointer): Use maybe_dummy_object.
+ * error.c (dump_expr, case OFFSET_REF): Use is_dummy_object.
+ * init.c (build_member_call): Use maybe_dummy_object and
+ is_dummy_object.
+ (build_offset_ref): Use maybe_dummy_object.
+ (resolve_offset_ref): Use is_dummy_object.
+ * typeck.c (build_x_function_call): Call build_dummy_object.
+ (unary_complex_lvalue): Call is_dummy_object.
+
+ * typeck.c (build_component_addr): Make sure field is a field.
+
+ * call.c (build_new_op): Delete obsolete code.
+
+ * pt.c (tsubst, TEMPLATE*PARM*): Abort if we don't have any args.
+
+1998-10-18 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl2.c (validate_nonmember_using_decl): Fix using-directives of
+ std if std is ignored.
+
+1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokvardecl): Fix thinko.
+
+ * decl.c (grokdeclarator): Embedded attrs bind to the right,
+ not the left.
+
+ * parse.y (fn.def2): Fix 'attrs' format.
+
+1998-10-18 Alastair J. Houghton <ajh8@doc.ic.ac.uk>
+
+ * Makefile.in (CONFLICTS): Update.
+ * parse.y (expr_or_declarator_intern): New rule.
+ (expr_or_declarator, direct_notype_declarator, primary,
+ functional_cast): Use it.
+ (notype_declarator_intern): New rule.
+ (notype_declarator, complex_notype_declarator): Use it.
+
+1998-10-17 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokfndecl): Set DECL_CONTEXT to namespace if appropriate.
+ (grokvardecl): Likewise.
+
+Sat Oct 17 23:27:20 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * class.c (make_method_vec): Cast 1st argument of `bzero' to (PTR).
+ (add_method): Likewise for arguments 1 & 2 of `bcopy'.
+
+ * decl.c (signal_catch): Mark with ATTRIBUTE_NORETURN.
+
+ * pt.c (process_partial_specialization): Cast 1st argument of
+ `bzero' to (PTR).
+
+ * tree.c (build_base_fields): Cast `base_align' to (int) when
+ comparing against one.
+
+1998-10-16 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (lookup_name_real): Handle template parameters for member
+ templates where said parameters have the same name as the
+ surrounding class.
+
+ * decl.c (expand_static_init): Build cleanups before entering the
+ anonymous function used to do them to avoid access-checking
+ confusion.
+
+ * decl.c (grokfndecl): Add back call to cplus_decl_attributes
+ accidentally removed by previous change, and make DECL_RTL here.
+ * class.c (add_method): Don't make DECL_RTL here.
+
+ * pt.c (for_each_template_parm): Don't examine uninstantiated
+ default arguments.
+
+1998-10-16 Dave Brolley <brolley@cygnus.com>
+
+ * lex.c (real_yylex): Fix unaligned access of wchar_t.
+
+1998-10-16 Mark Mitchell <mark@markmitchell.com>
+
+ * class.c (add_method): Fix documentation to reflect previous
+ changes. Check for duplicate method declarations here.
+ * decl.c (decls_match): Handle FUNCTION_DECL vs TEMPLATE_DECL
+ correctly; such things never match.
+ (grokfndecl): Don't look for duplicate methods here.
+ * decl2.c (check_classfn): Don't assume names are mangled.
+ Don't add bogus member function declarations to a class before the
+ class type is complete.
+ (grokfield): Reformat error message.
+ * method.c (set_mangled_name_for_decl): Don't mangle names while
+ processing_template_decl.
+
+1998-10-16 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_indirect_ref): Complain about a pointer to data
+ member, too.
+ * typeck2.c (build_m_component_ref): Don't indirect a pointer to
+ data member.
+ * init.c (resolve_offset_ref): Don't undo the above.
+
+ * cp-tree.h (DECL_C_BIT_FIELD, SET_DECL_C_BIT_FIELD): New macros.
+ (struct lang_decl_flags): Add `bitfield'.
+ * class.c (finish_struct_1): Use DECL_C_BIT_FIELD instead of
+ DECL_BIT_FIELD.
+ * decl2.c (grokbitfield, grok_alignof): Likewise.
+ * init.c (build_offset_ref): Likewise.
+ * typeck.c (build_component_addr, expr_sizeof): Likewise.
+ * cvt.c (build_up_reference): Don't crash if taking the address
+ returns error_mark_node.
+
+ * decl.c (grokfndecl): Also check ctype when checking for ::main().
+
+1998-10-15 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokfndecl): ::main and __builtin_* get C linkage.
+ Do mangling here.
+ (grokdeclarator): Instead of here.
+ * friend.c (do_friend): Lose special handling of ::main and
+ __builtin_*.
+ * cp-tree.h (DECL_MAIN_P): Check for C linkage.
+
+ * spew.c (yylex): Clear looking_for_typename if we got
+ 'enum { ... };'.
+
+1998-10-15 Mark Mitchell <mark@markmitchell.com>
+
+ * class.c (maybe_warn_about_overly_private_class): Improve error
+ messages for class with only private constructors.
+
+ * cp-tree.def (TYPENAME_TYPE): Add to documentation.
+ * cp-tree.h (TYPENAME_TYPE_FULLNAME): Document.
+ (build_typename_type): New function.
+ * decl.c (build_typename_type): Broken out from ...
+ (make_typename_type): Use it.
+ * search.c (lookup_field): Likewise.
+
+1998-10-14 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * pt.c (convert_nontype_argument): Check against type_referred_to.
+ * decl.c (grokvardecl): Check for declarator name before building
+ DECL_ASSEMBLER_NAME.
+
+1998-10-14 Mark Mitchell <mark@markmitchell.com>
+
+ * pt.c (lookup_template_class): Add comment.
+ (instantiate_class_template): Don't mark the _TYPE node for
+ member class templates as an instantiation.
+
+1998-10-14 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokfndecl): Fix my thinko.
+
+1998-10-13 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tinfo2.cc (fast_compare): Remove.
+ (before): Just use strcmp.
+ * tinfo.cc (operator==): Just use strcmp.
+
+1998-10-13 Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
+
+ * decl.c (grokfndecl): Don't check for linkage in `extern "C"'
+ declarations.
+
+1998-10-13 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (specializations_of_same_template_p): Remove.
+ * search.c (get_template_base): Don't use it.
+ (get_template_base_recursive): Likewise.
+ * pt.c (specializations_of_same_template_p): Remove.
+ (unify): Don't use it.
+ (lookup_template_class): Find the correct parent when setting
+ CLASSTYPE_TI_TEMPLATE.
+
+1998-10-12 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tinfo.cc (operator==): Always compare names.
+
+1998-10-12 Herman ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
+
+ * decl.c (start_function): Fix cut-and-paste error.
+
+1998-10-12 Jason Merrill <jason@yorick.cygnus.com>
+
+ * inc/typeinfo: Add #pragma interface.
+ (operator!=): Just call operator==.
+ * tinfo.cc: Add #pragma implementation.
+ (operator==): Move from inc/typeinfo and tinfo2.cc.
+ Check __COMMON_UNRELIABLE instead of _WIN32.
+
+ * typeck2.c (my_friendly_abort): Add URL.
+
+1998-10-12 Alastair J. Houghton <ajh8@doc.ic.ac.uk>
+
+ * decl.c (start_method): Added extra parameter for attributes.
+ * cp-tree.h (start_method): Update prototype.
+ * parse.y (fn.def2): Update start_method parameter list.
+
+1998-10-11 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (specializations_of_same_template_p): Declare.
+ * pt.c (specializations_of_same_template_p): New function.
+ (unify): Use it.
+ * search.c (get_template_base): Use it.
+ (get_template_base_recursive): Likewise.
+
+1998-10-10 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * decl2.c (start_objects): Add new variable `joiner' and
+ initialize it properly.
+
+1998-10-09 Mark Mitchell <mark@markmitchell.com>
+
+ * search.c (expand_upcast_fixups): Tweak to match 1998-10-07
+ change to vtable types.
+
+ * cvt.c (ocp_convert): Avoid infinite recursion caused by
+ 1998-10-03 change.
+
+1998-10-08 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (resolve_overloaded_unification): New fn.
+ (try_one_overload): Likewise.
+ (unify): Don't fail on unknown type.
+ (type_unification_real): Likewise. Use resolve_overloaded_unification
+ to handle an overloaded argument.
+ (template_args_equal): Split out...
+ (comp_template_args): From here.
+ (determine_specialization): Also allow a template with more
+ parms than were explicitly specified.
+ * cp-tree.h: Add template_args_equal.
+ * call.c (resolve_args): Remove TEMPLATE_ID_EXPR code.
+
+Thu Oct 8 15:58:30 1998 Anthony Green <green@cygnus.com>
+
+ * semantics.c (finish_asm_stmt): Revert my 1998-09-28
+ change.
+
+Thu Oct 8 06:00:19 1998 Jeffrey A Law (law@cygnus.com)
+
+ * typeck.c (unsigned_type): Only return TItype nodes when
+ HOST_BITS_PER_WIDE_INT is >= 64 bits.
+ (signed_type): Likewise.
+ * decl.c (intTI_type_node, unsigned_intTI_type_node): Only declare
+ when HOST_BITS_PER_WIDE_INT is >= 64 bits.
+ (init_decl_processing): Only create TItype nodes when
+ HOST_BITS_PER_WIDE_INT is >= 64 bits.
+ * cp-tree.h (intTI_type_node, unsigned_intTI_type_node): Only declare
+ when HOST_BITS_PER_WIDE_INT is >= 64 bits.
+
+Wed Oct 7 12:32:44 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (hash.h): Add -L KR-C -F ', 0, 0' flags to gperf.
+ (gxx.gperf): Update comments describing invocation flags.
+ (hash.h): Regenerate using gperf 2.7.1 (19981006 egcs).
+
+1998-10-07 Mark Mitchell <mark@markmitchell.com>
+
+ * class.c (finish_struct_1): Add commentary on previous change.
+
+ * cp-tree.h (vtbl_ptr_type_node): New variable.
+ * class.c (build_vtbl_ref): Don't indirect through the vptr; it's
+ already of the right type.
+ (finish_struct_1): Make the vptr be of type vtbl_ptr_type_node.
+ Simplify code to grow vtable.
+ * decl.c (vtbl_ptr_type_node): Define.
+ (init_decl_processing): Initialize it.
+
+1998-10-06 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.def (PTRMEM_CST): New tree node.
+ * cp-tree.h (ptrmem_cst): New type.
+ (lang_type): Remove local_typedecls.
+ (dummy): Increase to 12 bits from 11.
+ (CLASSTYPE_LOCAL_TYPEDECLS): Remove.
+ (PTRMEM_CST_CLASS): New macro.
+ (PTRMEM_CST_MEMBER): Likewise.
+ (current_access_specifier): New variable.
+ (current_class_type): Remove duplicate declaration.
+ (finish_struct): Change prototype.
+ (unreverse_member_declarations): New function.
+ (pushdecl_class_level): Change prototype.
+ (grok_enum_decls): Remove.
+ (fixup_anonymous_union): New function.
+ (grok_x_components): Change prototype.
+ (tsubst_chain): Remove.
+ (finish_member_template_decl): Likewise.
+ (check_explicit_specialization): Fix indentation.
+ (finish_class_definition): Change prototype.
+ (finish_member_class_template): Likewise.
+ (finish_member_declaration): New function.
+ (check_multiple_declarators): Likewise.
+ * class.c (class_stack_node_t): New type.
+ (current_class_base): Remove.
+ (current_class_stack): Change type.
+ (current_access_specifier): New variable.
+ (grow_method): Remove.
+ (check_member_decl_is_same_in_complete_scope): Break out from
+ finish_struct.
+ (make_method_vec): New function.
+ (free_method_vec): Likewise.
+ (add_implicitly_declared_members): Break out from finish_struct_1.
+ (free_method_vecs): New variable.
+ (add_method): Rework for direct use from parser.
+ (handle_using_decl): Watch for NULL_TREE while iterating through
+ CLASSTYPE_METHOD_VEC.
+ (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here;
+ just do some error-checking.
+ (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC.
+ (finish_struct_1): Simplify. Use add_implicitly_declared_members.
+ (finish_struct): Change prototype. Simplify; fields and methods
+ are already set up at this point.
+ (init_class_processing): Set up current_class_stack.
+ (pushclass): Save current_access_specifier.
+ (popclass): Restore it.
+ (currently_open_class): Simplify.
+ (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS.
+ * decl.c (saved_scope): Add access_specifier.
+ (maybe_push_to_top_level): Save it.
+ (pop_from_top_level): Restore it.
+ (maybe_process_template_type_declaration): Use
+ finish_member_declaration.
+ (pushtag): Likewise.
+ (pushdecl_class_level): Don't return a value.
+ (fixup_anonymous_union): Break out from grok_x_components.
+ (shadow_tag): Use it.
+ (xref_tag): Complain about using an elaborated type specifier to
+ reference a template type parameter or typedef name.
+ (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS.
+ (current_local_enum): Remove.
+ (build_enumerator): Call finish_member_declaration.
+ (grok_enum_decls): Remove.
+ * decl2.c (grok_x_components): Simplify.
+ (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC.
+ (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS.
+ (merge_functions): Add to comment.
+ (arg_assoc_type): Prototype.
+ (arg_assoc): Pass as many arguments as there are parameters.
+ * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of
+ OFFSET_REF.
+ * expr.c (cpls_expand_expr): Remove dead code. Handle
+ PTRMEM_CST.
+ * friend.c (do_friend): Lookup friends when in nested classes.
+ Change comments.
+ * init.c (build_offset_ref): Do lookup even for classes that are
+ only partially defined.
+ (decl_constant_value): Remove dead code.
+ * method.c (build_overload_value): Remove hack where by TYPE was
+ not a TYPE. Handle PTRMEM_CST.
+ (build_template_parm_names): Don't pass a PARM_DECL where a TYPE
+ should go.
+ * parse.y (components, notype_components, component_decl,
+ component_decl_1, component_declarator, component_declarator0):
+ Now all are itype rather than ttype. Rework to add members to
+ classes on the fly.
+ (typesqpecqual_reserved): Use check_multiple_declarators.
+ (structsp): Update class to finish_class_definition.
+ (do_xref_defn): Unsplit into named_class_head.
+ (access_specifier): Set current_access_specifier.
+ * pt.c (set_current_access_from_decl): New function.
+ (finish_member_template_decl): Don't take the parameters.
+ (comp_template_args): Make more robust.
+ (lookup_template_class): Don't use current_local_enum.
+ (for_each_template_parm): Handle PTRMEM_CST.
+ (instantiate_class_template): Use set_current_access_from_decl,
+ finish_member_declaration and unreverse_member_declarations. Set
+ lineno/input_filename before generating implicit member functions.
+ (type_unification_real): Don't assume back-unification happens
+ only for the last argument.
+ (regenerate_decl_from_template): Call pushclass a bit earlier.
+ (tsubst_chain): Remove.
+ (tsubst_enum): Use set_current_access_from_decl.
+ (set_mangled_name_for_template_decl): Fix indentation.
+ * search.c (lookup_fnfields_1): Change iteration through
+ CLASSTYPE_METHOD_VEC.
+ (dfs_pushdecls): Likewise.
+ (dfs_compress_decls): Likewise.
+ (add_conversions): Likewise.
+ * semantics.c (finish_class_definition): Don't take components.
+ Change call to finish_struct.
+ (finish_member_declaration): New function.
+ (finish_member_class_template): Don't take template parameters.
+ Change call to grok_x_components. Call finish_member_template_decl.
+ (check_multiple_declarators): New function.
+ * sig.c (append_signature_fields): Work from the TYPE_METHODS, not
+ a passed in fieldlist.
+ * tree.c (search_tree): Handle PTRMEM_CST.
+ (mapcar): Likewise.
+ * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not
+ INTEGER_CSTs, for pointer-to-data members.
+
+ * call.c (resolve_args): Resolve template specializations, if
+ possible.
+
+Tue Oct 6 07:57:26 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (spew.o): Depend on toplev.h.
+
+ * call.c (compare_ics): Initialize variables `deref_from_type2',
+ `deref_to_type1' and `deref_to_type2'.
+
+ * except.c (get_eh_type): Hide prototype and definition.
+ (process_start_catch_block_old): Remove unused static prototype.
+
+ * pt.c (tsubst_decl): Initialize variable `argvec'.
+
+ * spew.c: Include toplev.h.
+
+1998-10-05 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_decl): Do save and restore file position.
+
+1998-10-05 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * method.c (build_decl_overload_real): Clear
+ numeric_output_need_bar after __.
+
+1998-10-05 Nathan Sidwell <nathan@acm.org>
+
+ * call.c (build_new_method_call): Issue 'incomplete type' error,
+ if class is not defined.
+
+1998-10-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * call.c (build_object_call): Move declaration of variable
+ `fn' into the scope where it is used. Don't access variable
+ `fn' when it is uninitialized, instead use `fns'.
+
+1998-10-04 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
+
+ * errfn.c (cp_thing): Print buf as a string not as a printf format
+ to avoid problems with the operator%. Consequently, `%%' sequences
+ in format are copied as `%' in buf.
+
+1998-10-04 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (pop_tinst_level): Call extract_interface_info.
+ (instantiate_decl): Don't save and restore file position.
+
+ * decl.c (cp_finish_decl): Make statics in extern inlines and
+ templates common, if possible and the target doesn't support weak
+ symbols.
+
+ * decl.c (grokdeclarator): Remove redundant calls to
+ build_type_variant and some duplicated code.
+ * sig.c (build_signature_reference_type): Only take the type parm.
+ (build_signature_pointer_type): Likewise.
+ * tree.c (build_cplus_method_type): Adjust.
+ * cp-tree.h: Update.
+
+1998-10-04 Mark Mitchell <mark@markmitchell.com>
+
+ * call.c (build_over_call): Make pedwarns about dropped qualifiers
+ into full-fledged errors.
+ * cvt.c (convert_to_reference): Likewise.
+ * typeck.c (convert_for_assignment): Likewise.
+
+ * search.c (expand_upcast_vtables): In addition to unsetting
+ TREE_READONLY, remove top-level const type qualifier.
+
+1998-10-03 Mark Mitchell <mark@markmitchell.com>
+
+ * class.c (current_class_ptr, current_class_ref): Clarify
+ documentation.
+ * cvt.c (ocp_convert): Don't expect fold to remove all trivial
+ NOP type conversions.
+ * decl.c (decls_match): Use comptypes directly; ignore
+ qualifiers on the DECL.
+ (duplicate_decls): Remove qualifier checks on DECL.
+ (grokdeclarator): Make the type built up include top-level
+ qualifiers.
+ * decl2.c (do_dtors): Fix spelling error.
+ * error.c (dump_simple_decl): Don't look at qualifiers on the decl
+ when printing type information.
+ * init.c (build_new_1): Add documentation. Deal with the fact
+ that type of allocated memory now contains qualifiers.
+ * lex.c (is_global): Improve error-recovery.
+ * sig.c (build_member_function_pointer): Don't cast away const
+ on fields of sigtable_entry_type.
+ * tree.c (lvalue_type): Don't look at top-level qualifiers on
+ expressions.
+ * typeck.c (decay_conversion): Likewise.
+ (build_component_ref): Make sure the type of the COMPONENT_REF
+ contains top-level qualifiers, as appropriate. Improve
+ error-handling.
+ (build_indirect_ref): Simplify. Don't strip top-level qualifiers.
+ (build_array_ref): Likewise.
+ (build_unary_op): Improve error-recovery.
+ (unary_complex_lvalue): Make taking the address a bound member
+ function an error, not a sorry.
+ (build_conditional_expr): Look at the type qualifiers, not the
+ qualifiers on the expression itself.
+
+1998-10-03 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (merge_functions): Remove duplicates.
+
+ * decl2.c: Add -f{no-,}implicit-inline-templates.
+ (import_export_decl): Check it.
+
+ * decl.c (lookup_name_real): Template parms also take precedence
+ over implicit typename. Only warn if yylex.
+
+ * typeck.c (build_conditional_expr): Only fold if ifexp is an
+ INTEGER_CST.
+
+ * decl2.c (finish_vtable_vardecl): Check DECL_INTERFACE_KNOWN
+ instead of linkage.
+
+1998-10-01 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (FORMAT_VBASE_NAME): New macro.
+ * class.c (build_vbase_pointer): Use it.
+ * rtti.c (expand_class_desc): Likewise.
+ * tree.c (build_vbase_pointer_fields): Likewise.
+
+Thu Oct 1 10:43:45 1998 Nick Clifton <nickc@cygnus.com>
+
+ * decl.c (start_decl): Add invocation of
+ SET_DEFAULT_DECL_ATTRIBUTES, if defined.
+ (start_function): Add invocation of
+ SET_DEFAULT_DECL_ATTRIBUTES, if defined.
+
+ * lex.c: Replace occurrences of HANDLE_SYSV_PRAGMA with
+ HANDLE_GENERIC_PRAGMAS.
+
+1998-09-28 Anthony Green <green@cygnus.com>
+
+ * semantics.c (finish_asm_stmt): Always permit volatile asms.
+
+1998-09-28 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (grokdeclarator): Tighten checks for invalid
+ destructors. Improve error-messages and error-recovery.
+ * decl2.c (check_classfn): Don't assume that mangled destructor
+ names contain type information.
+
+1998-09-25 Jason Merrill <jason@yorick.cygnus.com>
+
+ * search.c (get_base_distance): Remove assert.
+
+ * decl2.c (build_anon_union_vars): Don't process a field with no
+ name.
+ (finish_anon_union): Also complain about local anon unions with no
+ members.
+
+1998-09-25 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (lookup_namespace_name): If the name is a namespace,
+ return it immediately.
+
+Fri Sep 25 11:45:38 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h (define_case_label): Remove unused parameter.
+ (check_java_method): Likewise.
+ (grokclassfn): Likewise.
+ (expand_aggr_init): Likewise.
+ (build_x_delete): Likewise.
+ (maybe_end_member_template_processing): Likewise.
+ (unshare_base_binfos): Add prototype.
+ (string_conv_p): Likewise.
+ (my_friendly_abort): Mark with ATTRIBUTE_NORETURN.
+
+ * cvt.c (build_up_reference): Remove unused parameter
+ `checkconst', all callers changed.
+ (build_type_conversion): Mark parameter `code' with
+ ATTRIBUTE_UNUSED.
+ (build_expr_type_conversion): Initialize variable `conv'.
+
+ * decl.c (push_namespace): Initialize variable `d'.
+ (define_case_label): Remove unused parameter `decl', all callers
+ changed.
+
+ * decl2.c (lang_decode_option): If !USE_CPPLIB, mark parameter
+ `argc' with ATTRIBUTE_UNUSED.
+ (grokclassfn): Remove unused parameter `cname', all callers
+ changed.
+ (check_java_method): Likewise for parameter `ctype'.
+ (copy_assignment_arg_p): Mark parameter `virtualp' with
+ ATTRIBUTE_UNUSED.
+ (finish_prevtable_vardecl): Likewise for parameter `prev'.
+
+ * expr.c (extract_init): Likewise for parameters `decl' and `init'.
+
+ * init.c (expand_aggr_init_1): Remove unused parameter
+ `alias_this', all callers changed.
+ (expand_aggr_init): Likewise.
+ (expand_default_init): Likewise.
+ (build_new_1): Initialize variable `susp'.
+ (build_x_delete): Remove unused parameter `type', all callers
+ changed.
+
+ * lex.c (set_typedecl_interface_info): Mark parameter `prev' with
+ ATTRIBUTE_UNUSED.
+ (readescape): Use (unsigned) value in shift.
+ (real_yylex): Likewise. Likewise. Also cast `sizeof' to int when
+ comparing to a signed quantity.
+
+ * pt.c (maybe_end_member_template_processing): Remove unused
+ parameter `decl', all callers changed.
+ (check_explicit_specialization): Add braces around empty body in
+ an else-statement.
+ (current_template_args): Initialize variable `args'.
+ (lookup_template_class): Likewise for variable `prev_local_enum'.
+ (tsubst_decl): Likewise for variable `r'.
+ (set_mangled_name_for_template_decl): Initialize variable
+ `context'.
+
+ * spew.c (scan_tokens): Change type of parameter `n' to unsigned.
+ Likewise for variable `i'.
+ (yylex): Initialize variable `trrr'.
+
+ * typeck.c (compparms): Mark variable `strict' with
+ ATTRIBUTE_UNUSED.
+
+ * xref.c (simplify_type): Cast argument of ctype function to
+ `unsigned char'.
+
+1998-09-24 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (language_lvalue_valid): Remove.
+ * decl.c (grokdeclarator): Don't disallow references to functions.
+ * tree.c (lvalue_p_1): New function, combining duplicated
+ code from ...
+ (lvalue_p): Use it.
+ (real_lvalue_p): Likewise.
+ * typeck.c (language_lvalue_valid): Remove.
+ (build_modify_expr): Treat FUNCTION_TYPEs as readonly, even though
+ they don't have TREE_READONLY set.
+ * typeck2.c (readonly_error): Add case for FUNCTION_DECLs.
+
+1998-09-24 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * spew.c (yylex): Give diagnostic.
+ * hash.h (is_reserved_word): Add export.
+ * gxx.gperf: Likewise.
+ * lex.h (rid): Add RID_EXPORT.
+ * lex.c (init_parse): Likewise.
+
+Tue Sep 22 21:01:19 1998 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
+
+ * friend.c (do_friend): Make warning a full sentence.
+
+1998-09-22 Mark Mitchell <mark@markmitchell.com>
+
+ * parse.y (component_decl_list): Improve error-recovery.
+
+1998-09-22 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * decl.c (make_typename_type): Move error to point where name
+ variable can be used by dump_type.
+
+1998-09-22 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (grokfndecl): Improve error-recovery.
+ * decl2.c (grokfield): Likewise.
+ * pt.c (finish_member_template_decl): Likewise.
+
+1998-09-20 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * method.c (hack_identifier): Finding multiple members is always
+ an error.
+
+1998-09-21 Per Bothner <bothner@cygnus.com>
+
+ * Make-lang.in (c++-filt): Link libiberty.a after cxxmain.o.
+
+Mon Sep 21 01:53:05 1998 Felix Lee <flee@cygnus.com>
+
+ * lex.c (init_lex): Use getenv ("LANG"), not GET_ENVIRONMENT ().
+
+1998-09-20 Mark Mitchell <mark@markmitchell.com>
+
+ * class.c (maybe_warn_about_overly_private_class): Reformat.
+
+1998-09-17 Andrew MacLeod <amacleod@cygnus.com>
+
+ * exception.cc (__cplus_type_matcher): Realign some code.
+
+1998-09-16 Mark Mitchell <mark@markmitchell.com>
+
+ * Make-lang.in (tinfo.o): Use CXXFLAGS when compiling.
+ (tinfo2.o): Likewise.
+ (exception.o): Likewise.
+ (new.o): Likewise.
+ (opnew.o): Likewise.
+ (opnewnt.o): Likewise.
+ (opvnew.o): Likewise.
+ (opvnewnt.o): Likewise.
+ (opdel.o): Likewise.
+ (opdelnt.o): Likewise.
+ (opvdel.o): Likewise.
+ (opvdelnt.o): Likewise.
+
+1998-09-16 Richard Henderson <rth@cygnus.com>
+
+ * decl.c (init_decl_processing): Kill __builtin_fp and __builtin_sp.
+
+1998-09-15 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * call.c (build_field_call): Handle static data members too.
+
+ * typeck.c (comptypes): When comparing pointer types, check
+ whether referred types match even in strictest modes.
+
+1998-09-15 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h: Revert previous change.
+ (finish_struct_methods): Remove declaration.
+ * class.c: Revert previous change.
+ (maybe_warn_about_overly_private_class): New function.
+ (finish_struct_methods): Declare here, and make static. Remove
+ unnecessary parameters. Tidy slightly. Use
+ maybe_warn_about_overly_private_class.
+ (finish_struct_1): Adjust. Remove check for private constructors,
+ now done elsewhere.
+ (finish_struct): Adjust.
+
+1998-09-15 Andrew MacLeod <amacleod@cygnus.com>
+
+ * except.c (expand_start_catch_block): No need to check for new
+ exception model.
+ (process_start_catch_block_old): Deleted.
+ (process_start_catch_block): Add call to start_decl_1().
+ (expand_end_catch_block): Add call to end_catch_handler().
+ * exception.cc (__cplus_type_matcher): Only check the exception
+ language if there is an exception table.
+
+1998-09-15 Andrew MacLeod <amacleod@cygnus.com>
+
+ * search.c (expand_indirect_vtbls_init): Mark temporary stack slots
+ as used to prevent conflicts with virtual function tables.
+
+1998-09-14 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (lang_type): Add has_non_private_static_mem_fn.
+ (CLASSTYPE_HAS_NON_PRIVATE_STATIC_MEM_FN): New macro, to access it.
+ * class.c (maybe_class_too_private_p): New function.
+ (finish_struct_methods): Use it.
+ (finish_struct_1): Likewise.
+ (finish_struct): Set CLASSTYPE_HAS_NON_PRIVATE_STATIC_MEM_FN if
+ appropriate.
+
+ * pt.c (check_specialization_scope): Fix spelling error.
+ (check_explicit_specialization): Remove code to handle explicit
+ specializations in class scope; they are now correctly diagnosed
+ as errors.
+
+1998-09-10 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (pushdecl): Don't copy types if the
+ DECL_ABSTRACT_ORIGIN of the new decl matches the TYPE_NAME of the
+ type.
+
+1998-09-09 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
+
+ * class.c (get_enclosing_class): New function.
+ (is_base_of_enclosing_class): Likewise.
+ * cp-tree.h (get_enclosing_class): Declare.
+ (is_base_of_enclosing_class): Likewise.
+ * pt.c (coerce_template_parms): Use them.
+
+1998-09-09 Jason Merrill <jason@yorick.cygnus.com>
+
+ * g++spec.c (lang_specific_driver): Check whether MATH_LIBRARY is
+ null to decide whether to use it.
+
+ * error.c (dump_type_real): Handle NAMESPACE_DECL.
+ * parse.y (base_class.1): Avoid crash on error.
+
+1998-09-08 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (make_typename_type): If context is a namespace, the code
+ is in error.
+
+1998-09-08 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * parse.y (nomods_initdcl0): Set up the parser stack correctly.
+
+1998-09-08 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (anonymous_namespace_name): Declare.
+ * decl.c: Define it.
+ (push_namespace): Use anonymous_namespace_name, rather than local
+ static anon_name.
+ * error.c (dump_decl): If a namespace is named
+ anonymous_namespace_name, call it {anonymous}.
+
+ * decl.c (grokparms): Distinguish between references and pointers
+ in error message.
+
+1998-09-08 Richard Henderson <rth@cygnus.com>
+ Mark Mitchell <mark@markmitchell.com>
+
+ * pt.c (process_partial_specialization): Consistently allocate
+ and zero tpd.parms based on ntparms. Use tpd2.parms, not
+ tpd.parms, where appropriate.
+
+Sun Sep 6 00:00:51 1998 Jeffrey A Law (law@cygnus.com)
+
+ * Makefile.in (INCLUDES): Update after recent toplevel gcc
+ reorganizations.
+
+1998-09-05 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (TI_PENDING_SPECIALIZATION_FLAG): Remove.
+ * class.c (finish_struct): Remove hackery to deal with explicit
+ specializations in class scope.
+ * decl.c (grokfndecl): Improve error-recovery.
+ * decl2.c (grokfield): Likewise.
+ * pt.c (check_specialization_scope): New function.
+ (begin_specialization): Call it.
+ (process_partial_specialization): New function, split out from
+ push_template_decl. Check partial specializations more
+ stringently.
+ (push_template_decl): Call it.
+ (check_explicit_specialization): Don't attempt to handle explicit
+ specializations in class scope.
+ (template_parm_data): Document. Add current_arg and
+ arg_uses_template_parms.
+ (mark_template_parm): Set it.
+ (tsubst_arg_types): Remove unused variable.
+ * semantics.c (begin_class_definition): Tweak.
+
+1998-09-04 Mark Mitchell <mark@markmitchell.com>
+
+ * inc/typeinfo (type_info::type_info(const char*)): Make
+ `explicit'.
+
+ * cp-tree.h (hash_tree_cons_simple): New macro.
+ * pt.c (tsubst_arg_types): New function. Use hash_tree_cons.
+ (coerce_template_parms): Use make_temp_vec, instead of
+ make_tree_vec. Document this behavior.
+ (lookup_template_class): Likewise.
+ (tsubst, cases METHOD_TYPE, FUNCTION_TYPE): Use tsubst_arg_types.
+ Remove dead code (and add assertion to check its deadness). Fix
+ bug w.r.t. exception specifications.
+
+1998-09-03 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (import_export_vtable): Always make artificials comdat.
+ (import_export_decl): Likewise.
+ * pt.c (mark_decl_instantiated): Likewise.
+
+1998-09-03 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (finish_globally_qualified_member_call_expr):
+ Rename to ...
+ (finish_qualified_call_expr).
+ * semantics.c: Likewise.
+ * parse.y (primary): Use it.
+ * method.c (hack_identifier): Remove redundant code.
+
+ * init.c (resolve_offset_ref): Call convert_from_reference to
+ handle members of reference type. Improve error recovery.
+
+1998-09-03 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * cp-tree.h: Declare warn_nontemplate_friend.
+ * decl2.c (lang_decode_option): Set.
+ * lang-options.h: Add -Wnon-template-friend.
+ * friend.c (do_friend): Use to toggle non-template function warning.
+
+1998-09-03 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (finish_enum): Don't resolve CONST_DECLs to their
+ corresponding INTEGER_CSTs when processing_template_decl.
+ * pt.c (tsubst_enum): Tweak accordingly.
+
+1998-09-03 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * decl.c (pushdecl_class_level): Add warning here.
+ (pushdecl): Tweak.
+
+1998-09-02 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (convert_pointer_to_real): Tidy.
+ * search.c (get_base_distance_recursive): Simplify.
+ (get_base_distance): Likewise.
+
+ * pt.c (unify): Only special-case INTEGER_TYPE if it uses template
+ parms.
+
+Wed Sep 02 09:25:29 1998 Nick Clifton <nickc@cygnus.com>
+
+ * lex.c (check_newline): Call HANDLE_PRAGMA before
+ HANDLE_SYSV_PRAGMA if both are defined. Generate warning messages
+ if unknown pragmas are encountered.
+ (handle_sysv_pragma): Interpret return code from
+ handle_pragma_token (). Return success/failure indication rather
+ than next unprocessed character.
+ (pragma_getc): New function: retrieves characters from the
+ input stream. Defined when HANDLE_PRAGMA is defined.
+ (pragma_ungetc): New function: replaces characters back into the
+ input stream. Defined when HANDLE_PRAGMA is defined.
+
+1998-09-01 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (output_vtable_inherit): Use %cDIGIT in the operands.
+ * class.c (build_vtable_entry_ref): Likewise.
+
+1998-09-01 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION): New macro.
+ * decl2.c (import_export_decl): Likewise.
+ * pt.c (instantiate_decl): Use it.
+
+1998-09-01 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (lookup_name_real): Also do implicit typename thing for
+ artificial TYPE_DECLs.
+ * search.c (lookup_field): Likewise.
+ (lookup_fnfields, lookup_field): Adjust for implicit typename kludge.
+ * semantics.c (begin_constructor_declarator): Use enter_scope_of.
+ (enter_scope_of): Extract type from implicit typename.
+ (begin_class_definition): Likewise.
+ * lex.c (identifier_type): Handle implicit typename when checking
+ for SELFNAME.
+
+ * cp-tree.h: Declare flag_strict_prototype.
+ * lex.c (do_scoped_id, do_identifier): Don't implicitly_declare if
+ -fstrict-prototype.
+ * decl.c (init_decl_processing): If -f{no,-}strict-prototype wasn't
+ specified, set it to the value of pedantic.
+
+1998-09-01 Mark Mitchell <mark@markmitchell.com>
+
+ * decl2.c (arg_assoc): Handle template-id expressions as arguments.
+
+1998-08-31 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (finish_enum): Handle member enums of classes declared in
+ template functions.
+
+ * decl2.c (grok_x_components): Strip attributes before calling
+ groktypename.
+
+1998-08-31 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h, decl2.c: Remove support for -fall-virtual,
+ -fenum-int-equivalence and -fno-nonnull-objects.
+ * class.c (check_for_override): Remove support for -fall-virtual.
+ (finish_struct_1): Likewise.
+ * call.c (build_new_op): Remove support for -fenum-int-equivalence.
+ * typeck.c (build_binary_op_nodefault): Likewise.
+ * cvt.c (ocp_convert): Likewise.
+ * call.c (build_vfield_ref): Remove support for -fno-nonnull-objects.
+ * class.c (build_vbase_path): Likewise.
+
+Sun Aug 30 22:16:31 1998 H.J. Lu (hjl@gnu.org)
+
+ * Makefile.in (INTERFACE): New, set to 1.
+
+1998-08-30 Mark Mitchell <mark@markmitchell.com>
+
+ * error.c (dump_decl): Use CP_DECL_CONTEXT, not DECL_CONTEXT, when
+ comparing with global_namespace.
+ (dump_aggr_type): Likewise.
+
+ * decl.c (grokfndecl): Issue error on declaration of friend
+ templates with explicit template arguments.
+
+ * pt.c (convert_template_argument): New function, split out
+ from...
+ (coerce_template_parms): Here.
+ (tsubst): Attempt better error-recovery.
+
+1998-08-28 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * pt.c (decl_template_parm_p): Add checks for
+ TEMPLATE_TEMPLATE_PARM.
+
+1998-08-28 Mark Mitchell <mark@markmitchell.com>
+
+ * lex.c (do_identifier): Fix thinko in previous change.
+
+1998-08-28 Jason Merrill <jason@yorick.cygnus.com>
+
+ * search.c (dfs_search, binfo_for_vtable, dfs_bfv_helper): New fns.
+ * decl2.c (output_vtable_inherit): Call binfo_for_vtable.
+
+1998-08-28 Richard Henderson <rth@cygnus.com>
+
+ Add support for discarding unused virtual functions.
+ * lang-options.h: Add -fvtable-gc.
+ * cp-tree.h: Add flag_vtable_gc.
+ * decl2.c (output_vtable_inherit): New fn.
+ (finish_vtable_vardecl): Call it.
+ * class.c (build_vtable_entry_ref): New fn.
+ (build_vtbl_ref): Call it.
+
+1998-08-28 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (build_enumerator): Take the enumeration type as a
+ parameter.
+ * decl.c (finish_enum): Don't set the TREE_TYPE for the
+ enumeration constant values if we're processing_template_decls.
+ Don't set the type for the CONST_DECLs either; that's done in
+ build_enumerator.
+ (build_enumerator): Take the enumeration type as a
+ parameter.
+ * lex.c (do_identifier): Don't resolve enumeration constants while
+ processing template declarations, even if they happen to be
+ TEMPLATE_PARM_INDEXs.
+
+ * parse.y (current_enum_type): New variable.
+ (primary): Don't allow statement-expression in local classes just
+ as we don't in global classes.
+ (structsp): Use current_enum_type.
+ (enum_list): Likewise.
+ * pt.c (tsubst_enum): Don't check for NOP_EXPRs introduced by
+ finish_enum; they no longer occur.
+
+ * cp-tree.h (finish_base_specifier): New function.
+ * parse.y (base_class): Use it.
+ * semantics.c (finish_base_specifier): Define it.
+
+ * parse.y (structsp): Warn on use of typename outside of template
+ declarations.
+
+1998-08-27 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (handle_cp_pragma): Remove #pragma vtable.
+ * lang-options.h: Remove +e options.
+ * decl2.c (lang_decode_option): Likewise.
+ (import_export_vtable): Don't check write_virtuals.
+ (finish_vtable_vardecl, finish_file): Likewise.
+ * search.c (dfs_debug_mark): Likewise.
+ * semantics.c (begin_class_definition): Likewise.
+ * class.c (build_vtable, finish_vtbls, finish_struct_1): Likewise.
+
+ * call.c (build_over_call): Check flag_elide_constructors.
+ * decl2.c: flag_elide_constructors defaults to 1.
+ * typeck.c (convert_arguments): Remove return_loc parm.
+ (build_function_call_real): Adjust.
+
+ * search.c: Tear out all mi_matrix and memoize code.
+ (lookup_field, lookup_fnfields): Use scratch_tree_cons.
+ * lang-options.h: Remove documentation for -fhandle-exceptions,
+ -fmemoize-lookups and -fsave-memoized.
+ * cp-tree.h: Lose mi_matrix and memoize support.
+ * decl2.c: Ignore -fmemoize-lookups and -fsave-memoized.
+ * class.c: Lose struct class_level.
+ (pushclass, popclass): Lose memoize support.
+ * init.c (build_offset_ref): Likewise.
+
+ Never change BINFO_INHERITANCE_CHAIN.
+ * init.c (emit_base_init): Change modification of
+ BINFO_INHERITANCE_CHAIN to an assert.
+ * search.c (get_base_distance_recursive): Likewise.
+ (get_base_distance): Likewise.
+ (lookup_member): Likewise.
+ (convert_pointer_to_single_level): Likewise.
+ (lookup_field): Likewise. Lose setting TREE_VIA_* on TREE_LISTs.
+ (lookup_fnfields): Likewise.
+ * tree.c (propagate_binfo_offsets): Don't call unshare_base_binfos.
+ (unshare_base_binfos): Don't call propagate_binfo_offsets.
+ (layout_basetypes): Call propagate_binfo_offsets instead of
+ unshare_base_binfos.
+ * decl.c (xref_basetypes): Call unshare_base_binfos.
+ * pt.c (instantiate_class_template): Likewise.
+ * tree.c (reverse_path): Remove 'copy' parm; always make a
+ temporary copy.
+ * class.c (build_vbase_path): Just call it.
+ * search.c (compute_access): Likewise. Don't re-reverse.
+
+1998-08-27 Mark Mitchell <mark@markmitchell.com>
+
+ * class.c (build_vbase_path): Use reverse_path.
+ (finish_base_struct): Move warnings for inaccessible bases to
+ layout_basetypes.
+ (modify_one_vtable): Remove check of TREE_USED (binfo).
+ (fixup_vtable_deltas1): Likewise.
+ * cp-tree.h (BINFO_INHERITANCE_CHAIN): Document here.
+ (xref_tag): Remove binfos parameter.
+ (make_binfo): Remove chain parameter.
+ (reverse_path): Add copy parameter.
+ * decl.c (init_decl_processing): Change calls to xref_tag.
+ (xref_tag): Remove binfos parameter.
+ (xref_basetypes): Change calls to make_binfo.
+ * decl2.c (grok_x_components): Change calls to xref_tag.
+ (handle_class_head): Likewise.
+ * friend.c (do_friend): Likewise.
+ * lex.c (make_lang_type): Change calls to make_binfo.
+ * parse.y (structsp): Change calls to xref_tag.
+ (named_complex_class_head_sans_basetype): Likewise.
+ (named_class_head): Likewise.
+ * rtti.c (init_rtti_processing): Likewise.
+ * search.c (compute_access): Change calls to reverse_path.
+ (dfs_get_vbase_types): Change calls to make_binfo.
+ (get_vbase_types): Remove dead code.
+ * tree.c (unshare_base_binfos): Change calls to make_binfo.
+ (layout_basetypes): Warn here about inaccessible bases.
+ (make_binfo): Remove chain parameter.
+ (reverse_path): Add copy parameter.
+
+1998-08-27 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c: #if 0 complete_type_p.
+ * init.c (build_java_class_ref, build_new_1): Remove unused locals.
+ * method.c (process_overload_item): Likewise.
+ * typeck.c (comp_target_types): Likewise.
+
+ Stop sharing binfos for indirect virtual bases.
+ * tree.c (propagate_binfo_offsets): Unshare vbases, too.
+ (layout_basetypes): Likewise.
+ (unshare_base_binfos): Copy vbases, too.
+ * cp-tree.h (BINFO_VIA_PUBLIC, BINFO_BASEINIT_MARKED,
+ BINFO_VBASE_INIT_MARKED): Remove obsolete macros.
+ (BINFO_PUSHDECLS_MARKED, SET_BINFO_PUSHDECLS_MARKED,
+ CLEAR_BINFO_PUSHDECLS_MARKED): New macros.
+ * search.c (lookup_field, lookup_fnfields, lookup_member): Remove
+ reference to BINFO_VIA_PUBLIC.
+ (marked_pushdecls_p, unmarked_pushdecls_p): New fns.
+ (push_class_decls): Use them.
+ (dfs_pushdecls): Use SET_BINFO_PUSHDECLS_MARKED.
+ (dfs_compress_decls): Use CLEAR_BINFO_PUSHDECLS_MARKED.
+
+1998-08-27 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (build_enumerator): Set DECL_CONTEXT for the
+ CONST_DECLs.
+
+1998-08-26 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (finish_enum): Change prototype.
+ * decl.c (finish_enum): Use TYPE_VALUES, rather than taking a
+ VALUES parameter. Don't try to compute mins/maxs if
+ processing_template_decl.
+ * parse.y (structsp): Use new calling sequence for finish_enum.
+ * pt.c (tsubst_enum): Likewise. Take the new type as input.
+ (lookup_template_class): Remove unused variables. Tweak.
+ Register enums on instantiation list before substituting
+ enumeration constants.
+ (tsubst_decl): Remove unused variables.
+ (regenerate_decl_from_template): Likewise.
+
+ * decl.c (duplicate_decls): Don't obliterate the
+ DECL_TEMPLATE_INFO for a template if we're not replacing it with
+ anything.
+
+ * lex.c (do_identifier): Fix typo in comment.
+
+Wed Aug 26 10:54:51 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * errfn.c: Remove stdarg.h/varargs.h.
+ * tree.c: Likewise.
+
+1998-08-25 Brendan Kehoe <brendan@cygnus.com>
+
+ * pt.c (tsubst_copy): Only do typename overloading on an
+ IDENTIFIER_NODE that happens to look like a typename if it actually
+ has a type for us to use.
+
+1998-08-25 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (comp_cv_target_types): Split out...
+ (comp_target_types): From here. Don't allow cv-qual changes under
+ a pointer if nptrs == 0. Fix OFFSET_TYPE handling.
+ (build_ptrmemfunc): Pass 1 to nptrs.
+ * cvt.c (perform_qualification_conversions): Use comp_ptr_ttypes.
+
+1998-08-25 Mark Mitchell <mark@markmitchell.com>
+
+ * search.c (dependent_base_p): Don't compare a binfo to
+ current_class_type; use the TREE_TYPE of the binfo instead.
+
+ * cp-tree.h (CLASS_TYPE_P): Revise definition.
+
+1998-08-25 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (duplicate_decls): Don't complain about different
+ exceptions from an internal decl even if pedantic.
+
+ * typeck.c (convert_for_assignment): Converting from pm of vbase
+ to derived is an error, not a sorry.
+
+ * call.c (build_over_call): Use convert_pointer_to_real for 'this'.
+ * class.c (fixed_type_or_null): Rename from
+ resolves_to_fixed_type_p. Return the dynamic type of the
+ expression, if fixed, or null.
+ (resolves_to_fixed_type_p): Use it. Return 0 if the dynamic type
+ does not match the static type.
+ (build_vbase_path): Rename 'alias_this' to 'nonnull'. Use
+ resolves_to_fixed_type_p again.
+
+1998-08-24 Mark Mitchell <mark@markmitchell.com>
+
+ * pt.c (tsubst_decl): Move special case code for dealing with
+ tricky friend templates here from ...
+ (regenerate_decl_from_template): Here.
+
+1998-08-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (start_decl): Remove redundant linkage check.
+
+1998-08-24 Gavin Romig-Koch <gavin@cygnus.com>
+
+ * typeck.c (c_expand_return): Handle the case that valtype
+ is wider than the functions return type.
+
+1998-08-24 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (CLASS_TYPE_P): New macro.
+ * decl.c (grokdeclarator): Use it instead of IS_AGGR_TYPE.
+ * pt.c (process_template_parm): Undo previous change.
+
+1998-08-24 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * cp-tree.h: Declare.
+ * pt.c (decl_template_parm_p): New function.
+ * decl.c (pushdecl): Check decls for redeclaring template parms.
+ (xref_tag): Make redeclaration an error, print decl.
+ * decl2.c (grokfield): Check field_decls for redeclaration as well.
+
+1998-08-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (primary): Fix up the type of string constants.
+
+1998-08-24 Mark Mitchell <mark@markmitchell.com>
+
+ * typeck.c (convert_for_initialization): Move check for odd uses
+ of NULL to avoid duplicate warnings.
+
+1998-08-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (lvalue_type): Fix for arrays.
+ * typeck.c (string_conv_p): New fn.
+ (convert_for_assignment): Use it.
+ (build_unary_op): Use lvalue_type.
+ * call.c (standard_conversion, convert_like): Use string_conv_p.
+ (add_function_candidate): Use lvalue_type.
+ * cvt.c (convert_to_reference): Likewise.
+ * decl2.c (lang_decode_option): Ignore -traditional.
+ * decl.c (init_decl_processing): flag_writable_strings inhibits
+ flag_const_strings.
+
+1998-08-24 Andrew MacLeod <amacleod@cygnus.com>
+
+ * lang-options.h (lang_options): Add fconst-strings to the list
+ of valid options.
+ * decl2.c (lang_f_options, lang_decode_option): Likewise.
+
+1998-08-24 Nathan Sidwell <nathan@acm.org>
+
+ * lex.c (real_yylex): Don't warn about long long constants if
+ we're allowing long long.
+
+1998-08-24 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (pushdecl): Use IDENTIFIER_NAMESPACE_VALUE instead of
+ accessing bindings directly.
+
+ * search.c (my_tree_cons): Reimplement.
+
+ * lang-specs.h: Remove __HONOR_STD.
+ * inc/exception, inc/new, inc/new.h, inc/typeinfo: Likewise.
+
+1998-08-23 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (grokdeclarator): Complain about in-class initialization
+ of aggregates and/or references.
+ * pt.c (process_template_parm): Clear IS_AGGR_TYPE for
+ TEMPLATE_TYPE_PARMs.
+
+ * decl2.c (grok_array_decl): Add comment.
+ (mark_used): Don't instantiate an explicit instantiation.
+ * friend.c (make_friend_class): Remove bogus comment. Fix check
+ for partial specializations.
+ * pt.c (check_explicit_specialization): Don't
+ SET_DECL_EXPLICIT_INSTANTIATION here.
+ (mark_decl_instantiated): Or here.
+ (do_decl_instantiation): Do it here, instead. Add checks for
+ duplicate explicit instantiations, etc. Tidy.
+ (do_type_instantiation): Likewise.
+ (instantiate_decl): Improve comments. Complain about explicit
+ instantiations where no definition is available.
+
+ * cp-tree.h (ansi_null_node): Remove.
+ * call.c (build_over_call): Warn about converting NULL to an
+ arithmetic type.
+ * cvt.c (build_expr_type_conversion): Likewise. Use
+ null_ptr_cst_p instead of expanding it inline.
+ * decl.c (ansi_null_node): Remove.
+ (init_decl_processing): Make null_node always have integral type.
+ * except.c (build_throw): Warn about converting NULL to an
+ arithmetic type.
+ * lex.c (init_parse): Remove handling of ansi_null_node.
+ * pt.c (type_unification_real): Don't convert NULL to void* type.
+ * typeck.c (build_binary_op_nodefault): Fix NULL warnings.
+ (convert_for_assignment): Warn about converting NULL to an
+ arithmetic type.
+ (convert_for_initialization): Likewise.
+
+1998-08-20 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (search_tree, no_linkage_helper, no_linkage_check): New fn.
+ * pt.c (coerce_template_parms): Use no_linkage_check.
+ * decl.c (grokvardecl): Likewise.
+ (grokfndecl): Likewise. Members of anonymous types have no linkage.
+
+ * method.c (process_overload_item): Remove useless code.
+
+1998-08-20 Per Bothner <bothner@cygnus.com>
+
+ Handle new'ing of Java classes.
+ * init.c (build_class_classref): New function.
+ (build_new_1): If type is TYPE_FOR_JAVA: Call _Jv_AllocObject;
+ constructor does not return this; don't need to exception-protect.
+
+ * pt.c (lookup_template_class): Copy TYPE_FOR_JAVA flag.
+ * decl2.c (acceptable_java_type): Handle template-derived types.
+
+1998-08-20 Per Bothner <bothner@cygnus.com>
+
+ * decl2.c (import_export_vtable): Suppress vtables for Java classes.
+
+1998-08-20 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (duplicate_decls): Always merge the old and new patterns
+ for templates, regardless of whether or not the new one has
+ DECL_INITIAL. Don't throw away specializations. Merge
+ DECL_SAVED_TREE.
+ * pt.c (tsubst_decl): Use the right pattern when calculating the
+ complete args for a new template instance.
+ (do_decl_instantiation): Fix typo in comment.
+ (regenerate_decl_from_template): Deal with tricky friend template
+ case.
+ (instantiate_decl): Likewise.
+
+Thu Aug 20 09:09:45 1998 Jeffrey A Law (law@cygnus.com)
+
+ * init.c (build_builtin_delete_call): Add missing assemble_external
+ call.
+
+1998-08-20 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (notype_unqualified_id): Also accept ~A<int>.
+
+1998-08-19 Mark Mitchell <mark@markmitchell.com>
+
+ * typeck.c (build_binary_op_nodefault): Warn on use of NULL in
+ arithmetic.
+ * except.c (build_throw): Warn when NULL is thrown, even with
+ -ansi. Use ansi_null_node, rather than integer_zero_node, in the
+ thrown expression.
+
+ * cp-tree.h (ansi_null_node): New variable.
+ * decl.c (ansi_null_node): New variable.
+ (init_decl_processing): Initialize its type.
+ * lex.c (init_parse): Initialize its value. Use ansi_null_node
+ for null_node in non-ANSI mode.
+ * typeck.c (build_binary_op_nodefault): Use ansi_null_node in
+ place of null_node to avoid spurious errors.
+
+1998-08-17 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (enter_scope_of): New function.
+ * parse.y (complex_direct_notype_declarator): Use it.
+ * semantics.c (enter_scope_of): New function.
+
+1998-08-17 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokparms): No, here.
+
+ * decl.c (grokdeclarator): Catch parm with pointer to array of
+ unknown bound here...
+ * method.c (process_overload_item): ...not here.
+
+ * gxxint.texi: Remove obsolete documentation of overloading code.
+
+ * decl.c (finish_enum): Also set TYPE_SIZE_UNIT.
+ * class.c (finish_struct_bits): Likewise.
+
+ * tree.c (lvalue_type): Fix for arrays.
+ * typeck.c (build_unary_op): Use lvalue_type.
+ * call.c (add_function_candidate): Likewise.
+ * cvt.c (convert_to_reference): Likewise.
+
+ * decl2.c (lang_decode_option): Ignore -traditional.
+
+ * init.c (build_offset_ref): Don't mess with error_mark_node.
+ * lex.c (do_scoped_id): Use cp_error.
+
+ * rtti.c (get_tinfo_fn): Don't mess with the context for now.
+
+1998-08-17 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * decl.c (grokdeclarator): Allow anonymous types to be cv-qualified.
+
+Mon Aug 17 10:40:18 1998 Jeffrey A Law (law@cygnus.com)
+
+ * cp-tree.h (set_identifier_local_value): Provide prototype.
+
+ * decl2.c (do_namespace_alias): Remove unused variables `binding'
+ and `old'.
+
+Fri Aug 14 16:42:27 1998 Nick Clifton <nickc@cygnus.com>
+
+ * Makefile.in: Rename BBISON to BISON so that it can be properly
+ inherited from the parent makefile.
+
+1998-08-13 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lang-options.h: Add -finit-priority.
+ * decl2.c: Likewise. Check flag_init_priority instead of
+ USE_INIT_PRIORITY.
+
+ * decl2.c (setup_initp): New fn.
+ (start_objects, finish_objects, do_ctors): Handle init_priority.
+ (do_dtors, finish_file): Likewise.
+
+1998-08-13 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst_copy): Hush warning.
+
+ * rtti.c (get_tinfo_fn): Also set DECL_IGNORED_P.
+
+1998-08-12 Mark Mitchell <mark@markmitchell.com>
+
+ * pt.c (print_template_context): Don't abort when instantiating a
+ synthesized method.
+
+ * decl.c (grokdeclarator): Issue errors on namespace qualified
+ declarators in parameter lists or in class scope.
+
+1998-08-09 Mark Mitchell <mark@markmitchell.com>
+
+ * pt.c (check_explicit_specialization): Don't abort on bogus
+ explicit instantiations.
+
+1998-08-07 Mark Mitchell <mark@markmitchell.com>
+
+ * typeck.c (require_complete_type): Use complete_type_or_else.
+ (complete_type_or_else): Always return NULL_TREE on failure, as
+ documented.
+
+ * pt.c (tsubst_aggr_type): Prototype.
+ (tsubst_decl): New function, split out from tsubst. Set
+ input_filename and lineno as appropriate.
+ (pop_tinst_level): Restore the file and line number saved in
+ push_tinst_level.
+ (instantiate_class_template): Set input_filename and lineno as
+ appropriate.
+ (tsubst): Move _DECL processing to tsubst_decl. Make sure the
+ context for a TYPENAME_TYPE is complete.
+
+ * decl2.c (grokbitfield): Issue errors on bitfields declared with
+ function type.
+ (do_dtors): As in do_ctors, pretend to be a member of the same
+ class as a static data member while generating a call to its
+ destructor.
+
+ * cvt.c (cp_convert_to_pointer): Handle NULL pointer
+ conversions, even in complex virtual base class hierarchies.
+
+1998-08-06 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (ENUM_TEMPLATE_INFO): New macro.
+ (TYPE_TEMPLATE_INFO): Likewise.
+ (SET_TYPE_TEMPLATE_INFO): Likewise.
+ (ENUM_TI_TEMPLATE): Likewise.
+ (ENUM_TI_ARGS): Likewise.
+ (lookup_nested_type_by_name): Remove.
+ * decl.c (maybe_process_template_type_declaration): Handle enums.
+ (start_enum): Don't check for primary-template enum declarations
+ here.
+ (finish_enum): Clean up, document. Make sure template enum
+ constants get the correct type.
+ (build_enumerator): Copy initializers for template enumerations,
+ too.
+ (grok_enum_decls): Document.
+ * lex.c (do_identifier): Document use of LOOKUP_EXPR a bit
+ better. Build LOOKUP_EXPRs for local variables, even if they are
+ TREE_PERMANENT.
+ * pt.c (tsubst_enum): Remove field_chain parameter.
+ (template_class_depth): Include the depth of surrounding function
+ contexts.
+ (push_template_decl): Check for primary-template enum declarations
+ here. Deal with enumeration templates.
+ (lookup_template_class): Likewise.
+ (for_each_template_parm): Likewise.
+ (instantiate_class_template): Don't call tsubst_enum directly,
+ call tsubst instead, to instantiate enums. Deal with all
+ field_chain issues here, not in tsubst_enum.
+ (lookup_nested_type_by_name): Remove.
+ (tsubst_aggr_type): Revise handling of enumeration types.
+ (tsubst): Likewise.
+ (tsubst_copy): Likewise.
+ (tsubst_expr): Call tsubst, not tsubst_enum for TAG_DEFNs.
+
+1998-08-04 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (pushtag): Don't mangle the name of a TYPE_DECL if it
+ uses template parameters.
+ * method.c (build_template_parm_names): Use the full set of
+ template arguments for tsubst'ing.
+ (build_overload_identifier): Pass the full set of template
+ arguments to build_template_parm_names, not just the
+ innermost_args.
+ * pt.c (TMPL_ARGS_DEPTH): Define using
+ TMPL_ARGS_HAVE_MULTIPLE_LEVELS, for clarity.
+ (NUM_TMPL_ARGS): New macro.
+ (add_outermost_template_args): Deal with the case where the outer
+ args will be completely discarded.
+ (coerce_template_parms): Use the full set of template arguments
+ for tsubst'ing. Simplify. Add some asserts. Improve
+ error messages.
+ (lookup_template_class): Pass the full set of template arguments
+ to coerce_template_parms.
+ (tsubst): Add assertion.
+ (do_type_instantiation): Don't instantiate member template
+ classes.
+
+ * init.c (build_offset_ref): Deal with a TEMPLATE_ID_EXPR whose
+ name is a LOOKUP_EXPR, rather than an IDENTIFIER_NODE.
+
+1998-08-03 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (set_mangled_name_for_decl): Change return type to void.
+
+ * decl.c (lookup_name_real): A namespace-level decl takes priority
+ over implicit typename. Avoid doing the same lookup twice.
+
+ * search.c (dependent_base_p): New fn.
+ (dfs_pushdecls, dfs_compress_decls): Use it.
+
+ * typeck.c (get_member_function_from_ptrfunc): Don't try to handle
+ virtual functions if the type doesn't have any.
+
+1998-08-03 Mark Mitchell <mark@markmitchell.com>
+
+ * decl2.c (grokfield): Don't mangle the name of a TYPE_DECL if it
+ uses template parameters.
+
+1998-08-02 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.def (LOOKUP_EXPR): Document. Remove second argument.
+ * cp-tree.h (DECL_TI_TEMPLATE): Improve documentation.
+ * lex.c (do_identifier): Don't use a second argument, or a type,
+ when building LOOKUP_EXPRs.
+ (do_identifier): Likewise.
+ (do_scoped_id): Likewise.
+ * method.c (hack_identifier): Improve error message.
+ * pt.c (lookup_template_function): Don't needlessly call
+ copy_to_permanent or build_min.
+ (tsubst_copy): Remove #if 0'd code. tsubst into LOOKUP_EXPRs if
+ necessary.
+ (do_decl_instantiation): Improve error message.
+ * tree.c (mapcar, case LOOKUP_EXPR): Don't be sorry; make a copy.
+ (build_min): Copy the type to the permanent obstack, too.
+
+1998-08-01 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (init_init_processing): Remove BI* handling.
+ (build_builtin_call): Remove.
+ (build_builtin_delete_call): New fn.
+ (build_delete): Use it.
+
+1998-07-31 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (PROCESSING_REAL_TEMPLATE_DECL_P): New macro.
+ (maybe_check_template_type): New function.
+ * decl.c (maybe_process_template_type_declaration): New function,
+ split out from pushtag Call maybe_check_template_type.
+ (pushtag): Use it. Use PROCESSING_REAL_TEMPLATE_DECL_P.
+ (xref_tag): Use PROCESSING_REAL_TEMPLATE_DECL_P.
+ * friend.c (do_friend): Use PROCESSING_REAL_TEMPLATE_DECL_P.
+ * pt.c (template_class_depth_real): Generalization of ...
+ (template_class_depth): Use it.
+ (register_specialization): Use duplicate_decls for duplicate
+ declarations of specializations.
+ (maybe_check_template_type): New function.
+ (push_template_decl_real): Fix comment.
+ (convert_nontype_argument): Likewise.
+ (lookup_template_class): Likewise. Avoid an infinite loop on
+ erroneous code.
+ (tsubst_friend_function): Fix comment.
+ (tsubst, case FUNCTION_DECL): Deal with a DECL_TI_TEMPLATE that is
+ an IDENTIFIER_NODE.
+ * semantics.c (begin_function_definition): Use
+ reset_specialization to note that template headers don't apply
+ directly to declarations after the opening curly for a function.
+
+1998-07-29 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (push_overloaded_decl): Use current_namespace instead of
+ DECL_CONTEXT (decl) to determine where we go.
+
+ * decl.c (lookup_name_real): Fix typo.
+
+1998-07-28 Mark Mitchell <mark@markmitchell.com>
+
+ * friend.c (is_friend): Be lenient with member functions to deal
+ with nested friends.
+
+1998-07-28 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (finish_struct_1): Convert integer_zero_node to
+ ssizetype before passing it to set_rtti_entry.
+ * typeck2.c (initializer_constant_valid_p): Allow conversion of 0
+ of any size to a pointer.
+
+1998-07-27 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove.
+ (build_template_decl_overload): Remove.
+ (set_mangled_name_for_decl): New function.
+ (innermost_args): Remove is_spec parameter.
+ (most_specialized, most_specialized_class): Remove declarations.
+ (lookup_template_class): Add entering_scope parameter.
+ (maybe_process_partial_specialization): New function.
+ (finish_template_decl): Likewise.
+ (finish_template_type): Likewise.
+ * class.c (finish_struct): Clean up processing of member template
+ specializations.
+ * decl.c (pushtag): Fix formatting.
+ (lookup_tag): Improve handling of pseudo-global levels.
+ (make_typename_type): Adjust call to lookup_template_class.
+ (shadow_tag): Use maybe_process_partial_specialization.
+ (xref_tag): Improve handling of member friends.
+ (start_function): Call push_nested_class before
+ push_template_decl. Don't call push_template_decl for
+ specializations.
+ * decl2.c (grok_x_components): Don't call xref_tag for
+ template instantiations. Handle UNION_TYPEs like RECORD_TYPEs.
+ (grokclassfn): Use set_mangled_name_for_decl.
+ (arg_assoc_class): Adjust call to innermost_args.
+ (mark_used): Don't call instantiate_decl for a TEMPLATE_DECL.
+ * error.c (dump_function_name): Improve printing of template
+ function names.
+ * friend.c (is_friend): Don't compare types of decls to determine
+ friendship, unless flag_guiding_decls.
+ (make_friend_class): Partial specializations cannot be friends.
+ (do_friend): Use set_mangled_name_for_decl. Call
+ push_template_decl_real instead of push_template_decl.
+ * method.c (build_decl_overload_real): Remove prototype. Give it
+ external linkage.
+ (build_overload_identifier): Adjust call to innermost_args.
+ (build_template_decl_overload): Remove.
+ (set_mangled_name_for_decl): New function.
+ * parse.y (.finish_template_type): New non-terminal.
+ (template_def): Use finish_template_decl. Use template_extdef
+ instead of extdef.
+ (template_extdef, template_datadef): New non-terminals, containing
+ only those rules for things which can be templates.
+ (datadef): Tidy.
+ (template_type, self_template_type): Use .finish_template_type.
+ (named_class_head): Use maybe_process_partial_specialization.
+ * pt.c (mangle_class_name_for_template): Remove context parameter.
+ (get_class_bindings): Remove outer_args parameter.
+ (complete_template_args): Remove.
+ (add_outermost_template_args): New function.
+ (register_specialization): Return the specialization.
+ (unregister_specialization): New function.
+ (tsubst_template_parms): Likewise.
+ (most_specialized, most_specialized_class): Prototype here as
+ static.
+ (original_template): Rename to most_general_template.
+ (tsubst_template_parms): New function.
+ (set_mangled_name_for_template_decl): Likewise.
+ (TMPL_ARGS_DEPTH): New macro.
+ (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Adjust.
+ (TMPL_ARGS_LEVEL): New macro.
+ (SET_TMPL_ARGS_LEVEL): Likewise.
+ (TMPL_ARG): Likewise.
+ (SET_TMPL_ARG): Likewise.
+ (TMPL_ARGS_DEPTH): Likewise.
+ (finish_member_template_decl): Use finish_template_decl.
+ (maybe_process_partial_specialization): New function, split out
+ from tsubst.
+ (inline_needs_template_parms): Use TMPL_PARMS_DEPTH.
+ (maybe_begin_member_template_processing): Use new macros.
+ (is_member_template): Likewise.
+ (is_member_template_class): Likewise.
+ (add_to_template_args): Likewise. Deal with multiple levels of
+ args.
+ (maybe_process_partial_specialization): New function.
+ (retrieve_specialization): Add consistency check.
+ (determine_specialization): Return full argument list.
+ (check_explicit_specialization): Tweak friend handling. Use full
+ argument lists. Simplify.
+ (current_template_args): Use new macros.
+ (push_template_decl_real): Change ill-named mainargs to specargs.
+ Check that a partial specialization actually specializes at least
+ one parameter. Improve friend handling. Modify for full
+ template arguments.
+ (classtype_mangled_name): Don't mangle the names of
+ specializations.
+ (lookup_template_class): Add entering_scope parameter. Use it to
+ avoid finding a template type when an instantiation is required.
+ Simplify. Use full template arguments.
+ (tsubst_friend_function): Use unregister_specialization. Use new
+ macros. Use full template arguments.
+ (tsubst_friend_class): Substitute, using tsubst_template_parms,
+ into the template parameters before passing them to
+ redeclare_class_template.
+ (instantiate_class_template): Simplify. Use full template
+ arguments. Adjust calls to get_class_bindings. Use
+ SET_IDENTIFIER_TYPE_VALUE where needed. Improve friend handling.
+ (innermost_args): Use new macros.
+ (tsubst_aggr_type): New function, split out from tsubst.
+ (tsubst): Use tsubst_aggr_type, tsubst_template_parms, new calling
+ conventions for lookup_template_class. Refine handling of partial
+ instantiations. Remove calls to complete_template_args.
+ Simplify. Add consistency checks. Use set_mangled_name_for_decl
+ and set_mangled_name_for_template_decl.
+ (tsubst_copy): Use tsubst_aggr_type.
+ (instantiate_template): Use full template arguments.
+ (more_specialized): Improve formatting.
+ (more_specialized_class): Adjust calls to get_class_bindings.
+ (get_bindings_real): Don't call complete_template_args.
+ (most_specialized): Don't overwrite input; create a new list.
+ (most_specialized_class): Use most_general_template.
+ (regenerate_decl_from_template): Use unregister_specialization.
+ Use full template arguments.
+ (instantiate_decl): Use full template arguments.
+ (set_mangled_name_for_template_decl): New function.
+ * semantics.c (begin_class_definition): Use
+ maybe_process_partial_specialization.
+ (finish_member_class_template): New function.
+ (finish_template_decl): Likewise.
+ (finish_template_type): Likewise.
+ (typeck.c): Don't crash after issuing a compiler_error.
+ * Makefile.in (CONFLICTS): Adjust; we removed a s/r conflict.
+
+1998-07-27 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck2.c (build_functional_cast): Handle default-initialization.
+
+ * call.c (build_over_call): Pass 1 to popclass.
+
+ * parse.y (direct_notype_declarator): Add precedence declaration
+ to notype_unqualified_id case.
+ * Makefile.in (EXPECT): Adjust.
+
+ * tree.c (ovl_member): Fix for single function in OVL.
+
+1998-07-27 Dave Brolley <brolley@cygnus.com>
+
+ * c-lex.c (yylex): Fix boundary conditions in character literal and
+ string literal loops.
+
+1998-07-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (lookup_name_real): OK, do return the from_obj value
+ unless got_object depends on template parms.
+
+ * parse.y (nested_name_specifier_1): Pull out the TYPE_MAIN_VARIANT.
+
+ * pt.c (coerce_template_parms): Also complain about local enums.
+
+ * cp-tree.h: Add prototype for set_identifier_local_value.
+ * decl.c (set_identifier_local_value_with_scope): Make static,
+ prototype.
+ * search.c (covariant_return_p): Likewise.
+ * except.c (build_terminate_handler, alloc_eh_object): Likewise.
+
+ * call.c (build_method_call): Only pull out the type of a destructor
+ if it's a template type parm.
+ * decl.c (lookup_name_real): Never return the from_obj value.
+
+1998-07-23 Jason Merrill <jason@yorick.cygnus.com>
+
+ * except.c (process_start_catch_block_old): Call start_decl_1 for
+ catch parm.
+ * decl.c (start_decl_1): Avoid duplicate error.
+
+ * init.c (expand_default_init): Only perform the initialization if
+ it will do something.
+
+1998-07-23 H.J. Lu (hjl@gnu.org)
+
+ * parse.y (base_class): Check for invalid base class.
+
+1998-07-23 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (import_export_template): Fold in...
+ (import_export_class): ...to here. Handle dllimport/export.
+
+ * class.c (build_vtable): Pass at_eof to import_export_vtable.
+ (prepare_fresh_vtable): Likewise.
+ * decl2.c (import_export_class): Split out...
+ (finish_prevtable_vardecl): From here.
+ * class.c (finish_struct_1): Call import_export_class if at_eof.
+
+ * decl.c (start_function): #if 0 mysterious code I wrote and have
+ forgotten why.
+ * rtti.c (get_tinfo_fn): If this is for a class type, set
+ DECL_CONTEXT.
+
+1998-07-22 Jason Merrill <jason@yorick.cygnus.com>
+
+ * inc/exception: Change terminate and unexpected to ().
+
+ * parse.y (named_class_head_sans_basetype_defn): A
+ named_class_head_sans_basetype followed by '{' or ':' is a defn.
+
+1998-07-21 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (canonical_type_variant): New fn to handle arrays.
+ * cp-tree.h (CANONICAL_TYPE_VARIANT): Remove.
+ * pt.c (unify, default case): Also fold arg. Fix array bounds case.
+ * method.c (process_overload_item): Use build_overload_value for
+ arrays.
+
+1998-07-20 Dave Brolley <brolley@cygnus.com>
+
+ * lex.c (mbchar.h): #include it.
+ (GET_ENVIRONMENT): New macro.
+ (init_parse): Set character set based on LANG environment variable.
+ (real_yylex): Handle multibyte characters in character literals.
+ (real_yylex): Handle multibyte characters in string literals.
+
+1998-07-19 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (do_identifier): Look for class value even if we don't
+ have a global value. Do implicit declaration if parsing is 2.
+ * semantics.c (finish_call_expr): Pass 2 if we're doing Koenig
+ lookup.
+
+1998-07-19 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (pushtag): Revert previous change.
+ * pt.c (lookup_template_class): Don't put out debugging
+ information for types that use template parameters.
+
+ * decl.c (pushtag): Don't put out debugging information for
+ compiler-generated typedefs.
+
+ * error.c (dump_type_real): Don't crash when presented with
+ intQI_type_node or the like.
+
+ * semantics.c (finish_translation_unit): Fix spelling error in
+ comment.
+
+1998-07-17 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (lookup_name_real): Pull out single function here.
+ (select_decl): Not here.
+ (unqualified_namespace_lookup): Use CP_DECL_CONTEXT.
+
+ * decl.c (qualify_lookup): Tweak again.
+
+ * pt.c (lookup_template_class): Don't mess with the context of the
+ instantiation.
+ * decl2.c (current_decl_namespace): Remove special handling for
+ templates.
+
+ * pt.c (tsubst, case FUNCTION_DECL): Fix getting complete args for
+ a member template specialization.
+
+ * tree.c (ovl_member): Use decls_match to compare functions.
+ * decl.c (decls_match): Check the context of a function.
+
+ * parse.y (primary): Use notype_unqualified_id instead of IDENTIFIER
+ in Koenig lookup support rules.
+ * semantics.c (finish_call_expr): Handle the new cases.
+
+ * typeck.c (build_x_function_call): Handle overloaded methods.
+
+ * decl.c (grokvardecl): Don't call build_static_name for extern "C".
+
+1998-07-16 Mark Mitchell <mark@markmitchell.com>
+
+ * semantics.c (finish_object_call_expr): Revert previous change.
+ * call.c (build_new_method_call): Likewise. Instead, convert
+ TYPE_DECLs to IDENTIFIERs here, in the presence of templates.
+
+1998-07-16 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (qualify_lookup): Handle templates.
+
+ * decl2.c (do_using_directive): Don't pass ancestor.
+ * decl.c (push_using_directive): Calculate ancestor.
+
+ * decl2.c (do_nonmember_using_decl): Allow for type shadowing.
+ * decl.c (pushdecl): Move type shadowing handling from here...
+ (duplicate_decls): ...to here.
+ * decl.c (set_identifier_local_value_with_scope): New fn.
+ (pushdecl): Use it.
+ (set_identifier_local_value, lookup_type_current_level): New fns.
+ * decl2.c (do_local_using_decl): Handle types and binding level
+ stuff properly.
+
+ * init.c (build_offset_ref): Don't call mark_used on an OVERLOAD.
+ * decl.c (select_decl): Extract a lone function from an OVERLOAD.
+ (lookup_namespace_name): Likewise.
+ * typeck.c (build_unary_op): Not here anymore.
+
+ * decl2.c (do_class_using_decl): Make sure we get an identifier.
+ * class.c (handle_using_decl): Ignore TYPE_DECLs.
+
+ * decl.c (qualify_lookup): New fn.
+ (lookup_name_real): Use it.
+
+1998-07-16 Martin v. Loewis <loewis@informatik.hu-berlin.de>
+
+ * decl2.c (add_using_namespace): When directly using a namespace
+ that was indirect before, promote it.
+
+ * cp-tree.h (LOOKUP_PREFER_TYPES, LOOKUP_PREFER_NAMESPACES,
+ LOOKUP_PREFER_BOTH, LOOKUP_NAMESPACES_ONLY, LOOKUP_TYPES_ONLY,
+ LOOKUP_QUALIFIERS_ONLY, LOOKUP_TEMPLATES_EXPECTED): New macros.
+ * decl.c (select_decl): Replace two flag parameters by one.
+ (unqualified_namespace_lookup): Likewise, pass flag.
+ (lookup_flags): New function.
+ (lookup_name_real): Compute flags, pass them.
+ (lookup_namespace_name): Call with zero-flag.
+ * decl2.c (ambiguous_decl): Add flag parameter, complain only
+ according to flags.
+ (lookup_using_namespace, qualified_lookup_using_namespace):
+ Add flag parameter, pass them through.
+ * lex.c (do_scoped_id): Call with zero-flag.
+
+1998-07-16 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (convert_for_assignment): Use comptypes.
+
+1998-07-16 Mark Mitchell <mark@markmitchell.com>
+
+ * semantics.c (finish_object_call_expr): Move test for the
+ function called being a TYPE_DECL to ...
+ * call.c (build_new_method_call): Here.
+
+1998-07-15 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (arg_assoc_class): Also look at template arguments, if any.
+ (arg_assoc): Handle error_mark_node and multiple levels of TREE_LIST.
+
+ * lex.c (looking_for_typename): Don't initialize.
+
+ * decl2.c (ambiguous_decl): Clarify error message.
+
+ * decl.c (push_using_directive): Iterate over namespaces used
+ indirectly.
+
+1998-07-15 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl2.c (add_using_namespace): Iterate over namespaces used
+ indirectly.
+
+ * decl.c (lookup_name_real): Accept namespace aliases as locals.
+ (cat_namespace_levels): Ignore aliases.
+ (duplicate_decls): Ignore duplicate aliases.
+ * decl2.c (do_namespace_alias): Process block level namespace
+ aliases. Store alias with pushdecl. Remove odr errors.
+ * parse.y (namespace_alias): New non-terminal.
+ (extdef): Use it.
+
+1998-07-15 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (arg_assoc_type): Handle METHOD_TYPE like FUNCTION_TYPE.
+ Handle TEMPLATE_TYPE_PARM.
+ (arg_assoc): Rewrite.
+
+ * pt.c (complete_template_args): Don't look at the context unless
+ we have to.
+
+ * method.c (build_decl_overload_real): Fix namespace handling.
+
+ * typeck.c (build_unary_op): Extract a lone function from an
+ OVERLOAD.
+
+ * call.c (build_scoped_method_call): Handle getting a namespace
+ for basetype in a destructor call.
+ (check_dtor_name): Handle enums.
+
+ * parse.y (using_directive): New nonterminal.
+ (extdef, simple_stmt): Use it.
+
+1998-07-14 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl2.c (add_function): Move error message ...
+ (arg_assoc_namespace): ... from here.
+
+1998-07-14 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (namespace_qualifier): Fix multiple level handling.
+ * decl2.c (namespace_ancestor): Use CP_DECL_CONTEXT.
+ (arg_assoc): Don't skip the first argument of a function.
+
+Tue Jul 14 20:09:22 1998 Jeffrey A Law (law@cygnus.com)
+
+ * search.c (my_tree_cons): Clean up.
+
+1998-07-14 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (joust): Don't warn about "confusing" conversions to the
+ same type.
+
+1998-07-14 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * class.c (push_nested_class): Complain about namespaces.
+ * decl.c (start_decl): Enter the object's namespace.
+ (cp_finish_decl): Leave it.
+ (grokdeclarator): Likewise.
+ * decl2.c (check_decl_namespace): New function.
+ (finish_file): Call it.
+ * parse.y (complex_direct_notype_declarator): Set complexity
+ of namespace-qualified ids to -1, enter the namespace.
+
+ * method.c (build_template_decl_overload): Expect _DECL as first
+ parameter. Put context temporarily into current_namespace.
+ * pt.c (check_explicit_specialization): Change caller.
+ (tsubst): Likewise.
+
+ * init.c (build_offset_ref): Call mark_used and
+ convert_from_reference for namespace members.
+
+Mon Jul 13 23:25:28 1998 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * search.c (my_tree_cons): The bitfield is at index 2.
+
+Mon Jul 13 17:21:01 1998 Nick Clifton <nickc@cygnus.com>
+
+ * lang-options.h: Format changed to work with new --help support
+ in gcc/toplev.c
+
+1998-07-12 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl2.c (build_expr_from_tree): Change calls of do_identifier.
+ Do Koenig lookup in CALL_EXPR.
+ (arg_assoc): Handle error_mark.
+ * lex.c (is_global): New function.
+ (do_identifier): Expect arguments for Koenig lookup.
+ * parse.y (primary): Add rules for calls of unqualified function calls.
+ (do_id): Change call of do_identifier.
+ * pt.c (finish_stmt_expr): Likewise.
+ * semantics.c (finish_id_expr): Likewise.
+ (finish_call_expr): Add integer parameter to indicate
+ argument-dependent lookup.
+
+ * decl.c (struct binding_level): New field using_directives.
+ (push_using_decl): Not sorry anymore.
+ (push_using_directive): New function.
+ (lookup_tag): Use CP_DECL_CONTEXT to iterate.
+ (unqualified_namespace_lookup): New function, code from ...
+ (lookup_name_real): ... here.
+ * decl2.c (lookup_using_namespace): Pass using list instead of
+ initial scope.
+ (validate_nonmember_using_decl): New function.
+ (do_nonmember_using_decl): New function.
+ (do_toplevel_using_decl): Use them.
+ (do_local_using_decl): New function.
+ (do_using_directive): Support block-level directives.
+ * parse.y (simple_stmt): Support using declarations and
+ directives.
+ (namespace_qualifier, namespace_using_decl): New non-terminals.
+
+ * xref.c (classname): New function.
+ (GNU_xref_hier): Change class and base parameters to tree.
+ * decl.c (xref_baseypes): Change caller.
+ * friend.c (make_friend_class): Likewise.
+
+1998-07-12 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
+
+ * typeck.c (comptypes, case TEMPLATE_TEMPLATE_PARM): Add parameter
+ comparison.
+
+ * pt.c (for_each_template_parm, case TEMPLATE_DECL): If it is a
+ template template parameter, record its use.
+ (for_each_template_parm, case TEMPLATE_TEMPLATE_PARM): Traverse
+ its template arguments if exists.
+
+ * pt.c (coerce_template_template_parms): New function equivalent
+ to coerce_template_parms when IS_TMPL_PARM is true.
+ (coerce_template_parms): Use it. Remove the IS_TMPL_PARM parameter,
+ all callers changed.
+
+ (coerce_template_parms): Access ARGLIST properly when creating a
+ new vector. Only accept implicit TYPE_DECL as valid argument for
+ a template template parameter when it is a base class of
+ current_class_type. Don't display error message when COMPLAIN is
+ false.
+
+1998-07-12 Klaus Kaempf (kkaempf@progis.de)
+
+ * repo.c (get_base_filename): Use file_name_nondirectory.
+ (open_repo_file): Likewise.
+ * cp-tree.h (file_name_nondirectory): Add prototype.
+
+1998-07-12 Jason Merrill <jason@yorick.cygnus.com>
+
+ * friend.c (do_friend): Pull the identifier out of declarator.
+ Use cp_error and friends.
+ * decl2.c (qualified_lookup_using_namespace): Fix call to
+ purpose_member.
+ * decl.c (lookup_name_real): Don't call complete_type on a namespace.
+ (grokvardecl): Use DECL_CLASS_SCOPE_P.
+ * cvt.c (convert_pointer_to_real): Check for error_mark_node sooner.
+ * class.c (warn_hidden): Fix for OVERLOAD.
+ From grahams@rcp.co.uk:
+ * cp-tree.h (DEFARG_NODE_CHECK): New macro.
+ (DEFARG_LENGTH, DEFARG_POINTER): Use it.
+
+Sun Jul 12 01:20:57 1998 Jeffrey A Law (law@cygnus.com)
+
+ * g++.1 (-traditional): Remove duplicated documentation.
+
+1998-07-11 Mark Mitchell <mark@markmitchell.com>
+
+ * method.c (flush_repeats): Add nrepeats parameter.
+ (issue_nrepeats): Likewise.
+ (is_back_referenceable_type): New function. Don't back-reference
+ TEMPLATE_TYPE_PARMs as well as simple types like integers.
+ (build_mangled_name_for_type): Likewise.
+ (build_mangled_name_for_type_with_Gcode): Likewise.
+ (lasttype): Remove.
+ (nrepeats): Likewise.
+ (Nrepeats): Likewise.
+ (start_squangling): Don't clear the variables removed above.
+ (end_squangling): Likewise.
+ (flush_repeats): Tidy. Use nrepeats parameter rather than
+ Nrepeats global.
+ (issue_nrepeats): Likewise, but with nrepeats global. Use
+ is_backreferenceable_type.
+ (build_overload_nested_name): Tidy. Add comment. Use
+ build_mangled_name_for_type.
+ (build_underscore_int): Comment.
+ (build_overload_scope_ref): Use build_mangled_name_for_type.
+ (build_overload_int): Likewise.
+ (build_template_template_parm_names): Tidy.
+ (build_template_parm_names): Use build_mangled_name_for_type.
+ (build_overload_identifier): Add comments.
+ (build_mangled_name_for_type_with_Gcode): Split out from
+ build_mangled_name.
+ (build_mangled_name_for_type): Use it.
+ (build_mangled_name): Rework to use build_mangled_name_for_type
+ and to not use global nrepeats/Nrepeats. Tidy.
+ (process_modifiers): Tidy.
+ (check_btype): Use is_backreferenceable_type. Add comment.
+ Rename `node' to `type'.
+ (process_overload_item): Set numeric_output_need_bar here.
+ Use build_mangled_name_for_type. Tidy.
+ (build_decl_overload_real): Tidy. Don't use Nrepeats. Use
+ build_mangled_name_for_type.
+
+ * pt.c (push_template_decl_real): Don't look at DECL_TEMPLATE_INFO
+ for TYPE_DECLs.
+
+1998-07-08 Vladimir N. Makarov <vmakarov@cygnus.com>
+
+ * cp-tree.h (warn_long_long): Define.
+ * decl.c (grokdeclarator): Add flag `warn_long_long' as guard for
+ warning "ANSI C++ does not support `long long'".
+ * decl2.c (warn_long_long): Define.
+ (lang_decode_option): Parse -Wlong-long, -Wno-long-long options.
+
+1998-07-07 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (xref_tag): Handle attributes between 'class' and name.
+ * parse.y (aggr): Likewise.
+ * semantics.c (finish_class_definition): Likewise.
+ * Makefile.in (EXPECTED): Adjust.
+
+ * cp-tree.h: Declare flag_optional_diags and warn_multichar.
+ * decl2.c: Define them.
+ (lang_decode_option): Handle them.
+ * lang-options.h: Add -foptional-diags.
+ * class.c (finish_struct): Don't complain about multiple meanings of
+ name if -fno-optional-diags.
+ * decl.c (pushdecl_class_level): Likewise.
+ * lex.c (real_yylex): Check warn_multichar.
+
+1998-07-06 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (lookup_tag): Use CP_DECL_CONTEXT.
+
+ * tree.c (make_binfo): Fix length.
+
+1998-06-30 Benjamin Kosnik <bkoz@bliss.nabi.net>
+
+ * decl2.c (lang_decode_option): Remove warn_template_debugging.
+ * lang-options.h: Likewise.
+
+Mon Jun 29 20:17:40 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * except.c (build_eh_type_type_ref): Remove unused variable `susp'.
+ (process_start_catch_block): Likewise for variables
+ `false_label_rtx', `call_rtx' and `return_value_rtx'.
+
+1998-06-29 Brendan Kehoe <brendan@cygnus.com>
+
+ * tree.c (build_srcloc): Make sure we allocate this node on the
+ permanent obstack.
+
+Sat Jun 27 23:34:18 1998 Fred Fish <fnf@ninemoons.com>
+
+ * g++spec.c (NEED_MATH_LIBRARY): Define to 1 if not already defined.
+ (lang_specific_driver): Initialize need_math with NEED_MATH_LIBRARY.
+ (lang_specific_driver): Only add -lm automatically if need_math is
+ nonzero.
+
+Sat Jun 27 12:22:56 1998 Jeffrey A Law (law@cygnus.com)
+
+ * Make-lang.in (g++): Depend on mkstemp.o. Link in mkstemp.o
+
+Sat Jun 27 07:36:09 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (EXPR_H): New dependency variable.
+ (decl2.o): Depend on $(EXPR_H).
+ (typeck.o): Likewise.
+ (init.o): Likewise.
+ (expr.o): Likewise.
+
+1998-06-25 Benjamin Kosnik <bkoz@lisa.cygnus.com>
+
+ * decl.c (start_enum): Put local enums on permanent_obstack.
+
+1998-06-25 Mark Mitchell <mark@markmitchell.com>
+
+ * cp-tree.h (c_get_alias_set): Declare.
+ * decl.c (init_decl_processing): Set lang_get_alias_set.
+
+1998-06-25 Andrew MacLeod <amacleod@cygnus.com>
+
+ * cp-tree.h (mark_all_runtime_matches): Add function prototype.
+ * except.c (mark_all_runtime_matches): Set TREE_SYMBOL_REFERENCED
+ flag for all function decls which are in the exception table.
+ * exception.cc (__cplus_type_matcher): Check for CATCH_ALL_TYPE match.
+ * decl2.c (finish_file): Call mark_all_runtime_matches to make sure
+ code is emitted for any referenced rtti function.
+
+1998-06-25 Dave Brolley <brolley@cygnus.com>
+
+ * lang-specs.h: Use new | syntax to eliminate
+ string concatenation.
+
+1998-06-25 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (CP_DECL_CONTEXT): New macro.
+ * decl2.c (is_namespace_ancestor, lookup_using_namespace): Use it.
+ * method.c (build_overload_nested_name): Likewise.
+ * sig.c (build_signature_pointer_or_reference_type): Don't set
+ DECL_CONTEXT.
+
+1998-06-24 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ Set DECL_CONTEXT for globals to NULL_TREE instead of global_namespace.
+ * cp-tree.h (FROB_CONTEXT): New macro.
+ (DECL_MAIN_P): ::main should have a DECL_CONTEXT of NULL_TREE.
+ * decl.c (namespace_binding): Replace NULL_TREE with
+ global_namespace.
+ (set_namespace_binding, pop_namespace, lookup_name_real): Likewise.
+ * decl2.c (is_namespace_ancestor, lookup_using_namespace):
+ Likewise.
+ * decl.c (pushtag): Use FROB_CONTEXT.
+ (pushdecl, make_typename_type, define_function, grokdeclarator):
+ Likewise.
+ * decl2.c (set_decl_namespace, do_namespace_alias): Likewise.
+ * pt.c (push_template_decl_real, lookup_template_class, tsubst):
+ Likewise.
+ * decl2.c (decl_namespace): Return global_namespace if no context.
+ * method.c (build_overload_nested_name): Expect null as context.
+ * pt.c (mangle_class_name_for_template): Do nothing for null
+ contexts.
+ (lookup_template_class): Allow for null id_context.
+
+1998-06-25 Richard Henderson <rth@cygnus.com>
+
+ * method.c (emit_thunk): Set current_function_is_thunk for the
+ ASM_OUTPUT_MI_THUNK case as well.
+
+1998-06-23 Andrew MacLeod <amacleod@cygnus.com>
+
+ * exception.cc (__cplus_type_matcher): Get a match_info pointer
+ instead of an exception table entry as a parameter.
+
+1998-06-23 Andrew MacLeod <amacleod@cygnus.com>
+
+ * parse.y (function_try_block): Don't call start_catch_handler.
+ * except.c (call_eh_info): Remove coerced field from declaration.
+ (build_eh_type_type_ref): New function to create an address of a
+ rtti function for the new style exception tables.
+ (expand_start_catch_block): Split function, this contains the
+ common part.
+ (process_start_catch_block_old): New function to perform the rest
+ of expand_start_catch_block under old style exceptions.
+ (process_start_catch_block_old): New function to perform the rest
+ of expand_start_catch_block under new style exceptions.
+ (expand_end_catch_block): Only pop the false label off the stack under
+ the old style of exceptions.
+ * semantics.c (finish_try_block): Don't call start_catch_handler.
+ * exception.cc (struct cp_eh_info): Add original_value field.
+ (__cplus_type_matcher): Perform type matching on the original exception
+ value, and if we have a match, set the current value.
+ (__cp_push_exception): Set the original exception value.
+
+1998-06-23 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (joust): Fix confusing conversion warning.
+
+ * call.c (build_op_delete_call): Add placement parm. Check
+ LOOKUP_SPECULATIVELY.
+ * cp-tree.h, decl2.c, init.c: Adjust.
+ * decl.c (finish_function): Use it.
+
+ * pt.c (tsubst): Diagnose creating void fields or variables.
+
+Mon Jun 22 08:50:26 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * call.c (build_scoped_method_call): Remove unused variable `tmp'.
+
+ * cp-tree.h (check_dtor_name): Add prototype.
+
+ * init.c (expand_member_init): Remove unused variables
+ `ptr_type_node', `parm' and `rval'.
+
+ * ptree.c (print_lang_type): Use HOST_WIDE_INT_PRINT_DEC specifier
+ in call to fprintf.
+ (lang_print_xnode): Likewise.
+
+ * typeck2.c (enum_name_string): Cast argument to sprintf to long
+ and use %ld specifier.
+
+ * xref.c (GNU_xref_end_scope): Use HOST_WIDE_INT_PRINT_DEC
+ specifier in call to fprintf.
+ (GNU_xref_member): Cast argument to sprintf to int.
+
+Fri Jun 19 23:22:42 1998 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
+
+ * typeck2.c (pop_init_level): Warn about implicit zero initialization
+ of struct members.
+
+Thu Jun 18 09:32:32 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h: Prototype function `check_java_method'.
+
+1998-06-17 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (finish_struct): Make conflicting use of id a pedwarn.
+ * decl.c (pushdecl_class_level): Likewise.
+
+1998-06-17 Mark Mitchell <mark@markmitchell.com>
+
+ * pt.c (convert_nontype_argument): Issue an error when presented
+ with an integer (real) constant that cannot be simplified to an
+ INT_CST (REAL_CST).
+
+ * cp-tree.h (c_get_alias_set): Remove declaration added in
+ 1998-06-13 change that should never have been checked in.
+
+1998-06-17 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_binary_op_nodefault): Change % in format strings
+ to %%.
+
+ * decl.c (grokvardecl): Don't build_static_name for decls that
+ aren't at namespace scope.
+
+ * init.c (perform_member_init): Catch default-initialization of
+ references.
+
+1998-06-17 Mark Mitchell <mark@markmitchell.com>
+
+ * errfn.c (cp_thing): Handle the `%%' formatting sequence.
+
+1998-06-17 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (hack_identifier): Complain about getting a namespace
+ or class template.
+ * typeck.c (decay_conversion): Remove check for namespaces.
+ * typeck2.c (incomplete_type_error): Likewise.
+ * parse.y (template_arg): Add PTYPENAME expansion.
+
+1998-06-16 Andrew MacLeod <amacleod@cygnus.com>
+
+ * decl.c (grokvardecl): Don't build external assembler names for
+ TYPENAMEs in other namespaces as there is no declarator.
+ * error.c (cp_file_of, cp_line_of): Don't extract file or line number
+ info from DECL_CONTEXT if it is NULL.
+
+1998-06-16 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (check_dtor_name): Split out.
+ (build_scoped_method_call): Use it.
+ (build_method_call): Use it.
+ * init.c (build_offset_ref): Use it.
+
+ * typeck.c (build_static_cast): Fix handling of pointers to members.
+
+ * decl.c (finish_function): Just return nothing from a constructor.
+ * typeck.c (c_expand_return): Complain about returning a void
+ expression from a destructor.
+
+1998-06-13 Mark Mitchell <mark@markmitchell.com>
+
+ * class.c (alter_access): Accept a BINFO explaining how to get
+ from the entity whose accessed is being altered to the type doing
+ the altering.
+ (handle_using_decl): New function containing code split out from ...
+ (finish_struct_1): Here.
+
+ * cp-tree.h (complete_type_or_else): Declare.
+ * init.c (build_new_1, build_delete): Use it.
+ * typeck.c (require_complete_type): Use complete_type, rather than
+ expanding it inline.
+ (complete_type_or_else): New function.
+ (build_component_ref): Use it.
+ (pointer_int_sum): Make sure the type pointed to is complete.
+ (pointer_diff): Likewise.
+
+ * pt.c (for_each_template_parm): Traverse the TYPE_CONTEXT for
+ types.
+
+ * search.c (get_matching_virtual): Note that member templates
+ cannot override virtual functions.
+
+1998-06-12 Brendan Kehoe <brendan@cygnus.com>
+
+ * pt.c (check_explicit_specialization): If DECLARATOR turned into
+ an error_mark_node from lookup_template_function, return the same.
+ (determine_specialization): Also make sure TEMPLATE_ID isn't an
+ error_mark_node, before we try to read its operands.
+ * decl.c (grokdeclarator): If we got an error_mark_node from
+ check_explicit_specialization, just return it right back.
+
+1998-06-12 Mark Mitchell <mark@markmitchell.com>
+
+ * class.c (instantiate_type): Don't treat template-ids that don't
+ specify any template arguments as equivalent to ordinary
+ identifiers. Use OFFSET_REF instead of SCOPE_REF to refer to
+ pointer-to-members for member templates. Tidy slightly.
+ * cp-tree.def (TEMPLATE_ID_EXPR): Revise documentation.
+ * init.c (build_offset_ref): Handle template-ids like ordinary
+ identifiers, for the most part, but store a TEMPLATE_ID_EXPR in the
+ offset part of the OFFSET_REF.
+ * typeck.c (build_unary_op): Change check for unknown types to
+ look for OFFSET_REFs, not SCOPE_REFs.
+
+1998-06-11 Mark Mitchell <mark@markmitchell.com>
+
+ * pt.c (is_member_template_class): New function.
+ (push_template_decl_real): Use it.
+
+1998-06-11 Benjamin Kosnik <bkoz@elmo.cygnus.com>
+
+ * friend.c (do_friend): Add support for nested classes using
+ member functions of the enclosing class as friends.
+
+1998-06-10 Mark Mitchell <mark@markmitchell.com>
+
+ * call.c (convert_default_arg): Make global, not static.
+ (convert_arg_for_ellipsis): Split out from ...
+ (build_over_call): Here.
+ * cp-tree.h (convert_default_arg); Declare.
+ (convert_arg_to_ellipsis): Likewise.
+ (do_member_init): Remove.
+ * init.c (do_member_init): Remove; this code is dead.
+ (expand_member_init): Remove much of this code; it is dead.
+ * typeck.c (convert_arguments): Use convert_default_arg and
+ convert_arg_for_ellipsis, rather than duplicating here.
+
+ * call.c (convert_like): Don't fail silently if
+ build_user_type_conversion fails. Always return error_mark_node
+ for failure.
+
+1998-06-10 Jason Merrill <jason@yorick.cygnus.com>
+
+ * search.c (covariant_return_p): Complain about ambiguous base.
+
+ * typeck.c (build_component_ref): Diagnose ref to nested type.
+
+1998-06-10 Brendan Kehoe <brendan@cygnus.com>
+
+ * decl.c (grokparms): Check that INIT isn't an error_mark_node
+ before giving error about invalid type for default arg.
+
+1998-06-10 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_method_call): Fix thinko.
+
+1998-06-10 Dave Brolley <brolley@cygnus.com>
+
+ * decl2.c (lang_decode_option): New argc/argv interface.
+ * cp-tree.h (lang_decode_option): New argc/argv interface.
+ * lang-specs.h (default_compilers): Only call cpp if -E, -M or -MM is
+ specified for cpplib-enabled compilers.
+ * lex.c (lang_init): Don't check_newline for cpplib.
+ (init_parse): Don't initialize cpplib here.
+
+1998-06-10 Brendan Kehoe <brendan@cygnus.com>
+
+ * typeck.c (build_component_ref): Make sure FIELD has a lang_specific
+ piece before checking DECL_MUTABLE_P.
+
+1998-06-10 John Carr <jfc@mit.edu>
+
+ * tree.c (debug_binfo): Make printf format match arguments.
+
+ * error.c (OB_PUTI): Make printf format match arguments.
+
+1998-06-10 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (perform_member_init): Handle default-initialization.
+
+ * except.c (build_throw): Handle throwing NULL.
+
+ * typeck.c (build_x_function_call): Use resolve_offset_ref.
+
+ * search.c (compute_access): Only strip an anonymous union
+ for a FIELD_DECL.
+
+ * call.c (add_builtin_candidates): Tweak.
+
+ * cvt.c (build_expr_type_conversion): Restore code for conversion
+ from class types.
+ * decl2.c (delete_sanity): Use it. Clean up.
+
+ * typeck.c (comp_ptr_ttypes_real): Fix cv-qual comparisons.
+
+1998-06-10 Branko Cibej <branko.cibej@hermes.si>
+
+ * typeck.c (c_expand_return): Don't warn about void expressions on
+ return statements in functions returning void.
+
+1998-06-09 Mark Mitchell <mark@markmitchell.com>
+
+ * pt.c (fn_type_unification): Revise documentation. Tidy.
+ (type_unification): Likewise.
+
+1998-06-09 Andrew MacLeod <amacleod@cygnus.com>
+
+ * semantics.c (finish_try_block): Rename expand_start_catch, and delete
+ expand_end_catch.
+ * parse.y (function_try_block): Rename expand_start_catch, and delete
+ expand_end_catch.
+ * except.c (expand_end_eh_spec): Rename expand_start_catch, and delete
+ expand_end_catch.
+
+1998-06-09 Jason Merrill <jason@yorick.cygnus.com>
+
+ * search.c (lookup_member): New fn.
+ * class.c (finish_struct_1): Use it.
+ * decl.c (lookup_name_real): Use it.
+
+Mon Jun 8 20:45:52 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (decl2.o): Depend on dwarf2out.h and dwarfout.h.
+
+ * cp-tree.h: Add prototype for `maybe_print_template_context' and
+ `maybe_make_one_only'.
+
+ * decl.c (auto_function): Remove unused variable `decl'.
+
+ * decl2.c: Include dwarf2out.h and dwarfout.h.
+
+ * lex.c: Remove redundant declarations of `set_float_handler' and
+ `asm_out_file'.
+
+1998-06-08 Andrew MacLeod <amacleod@cygnus.com>
+
+ * except.c (init_exception_processing): Remove NEW_EH_MODEL compile
+ time flag. Call __cp_eh_info instead of __cp_exception_info.
+ * exception.cc (struct cp_eh_info): Remove NEW_EH_MODEL flag.
+ (__cp_exception_info): Return offset into cp_eh_info structure to
+ match what use to be the start of this structure.
+ (__cp_eh_info): New function to return a pointer to cp_eh_info struct.
+ (__cplus_type_matcher, __cp_push_exception): Remove NEW_EH_MODEL
+ compile time flag.
+ (__uncatch_exception, __check_eh_spec, std::uncaught_exception): Call
+ __cp_eh_info instead of __cp_exception_info.
+
+1998-06-08 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (cp_finish_decl): Disable inlining of extern inlines
+ with static variables.
+
+1998-06-08 Mark Mitchell <mark@markmitchell.com>
+
+ * init.c (build_offset_ref): Correct previous change to use build,
+ not build_min.
+
+1998-06-07 Mark Mitchell <mark@markmitchell.com>
+
+ * class.c (instantiate_type): Handle pointer-to-members where the
+ member is a template.
+ * init.c (build_offset_ref): Likewise.
+ * typeck.c (build_unary_op): Likewise.
+
+1998-06-07 Richard Henderson <rth@cygnus.com>
+
+ * lex.c (lang_init_options): New function.
+ (lang_init): Remove flag_exceptions == 2 hack.
+
+1998-06-05 Jason Merrill <jason@yorick.cygnus.com>
+
+ * search.c (envelope_add_decl): Tweak for implicit typename.
+
+ * call.c (joust): Also warn about confusing conversion op/constructor
+ overload resolution.
+
+ * spew.c (yylex): Also return the TYPE_DECL if got_object.
+ Don't clear got_object after '~'.
+ * call.c (build_scoped_method_call): Tweak destructor handling.
+ (build_method_call): Likewise.
+ * pt.c (tsubst_copy, case METHOD_CALL_EXPR): Don't mess with
+ TYPE_MAIN_VARIANT for destructors.
+ * semantics.c (finish_object_call_expr): Complain about calling a
+ TYPE_DECL.
+
+1998-06-05 Per Bothner <bothner@cygnus.com>
+
+ * g++spec.c (lang_specific_pre_link, lang_specific_extra_ofiles):
+ Define - update needed by gcc.c change.
+
+1998-06-05 Jason Merrill <jason@yorick.cygnus.com>
+
+ * error.c (cp_printers): Use 'o' instead of '_' for the null entry.
+
+1998-06-05 Martin v. Loewis <loewis@informatik.hu-berlin.de>
+
+ * cp-tree.h (DECL_NAMESPACE_ALIAS, ORIGINAL_NAMESPACE): Declare.
+ * decl.c (lookup_name_real): Add namespaces_only parameter.
+ If set, return only NAMESPACE_DECLs.
+ (select_decl): Likewise.
+ (identifier_type_value): Give additional parameter.
+ (lookup_name_nonclass): Likewise.
+ (lookup_name): Likewise.
+ (find_binding): Skip namespace aliases.
+ (binding_for_name): Likewise.
+ (push_namespace): Check for namespace aliases.
+ (lookup_name_namespace_only): New function.
+ (begin_only_namespace_names, end_only_namespace_names): New functions.
+ * decl2.c (set_decl_namespace): Skip namespace aliases.
+ (do_using_directive): Likewise.
+ (do_namespace_alias): Produce namespace aliases, fix alias
+ redeclaration.
+ * error.c (dump_decl): Support SCOPE_REF.
+ * parse.y (extdef): Wrap lookup with namespace_only for namespace
+ aliases and using declarations.
+
+1998-06-04 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (really_overloaded_fn): Only see through one TREE_LIST.
+
+ * error.c (dump_expr): Clean up NEW_EXPR case.
+
+1998-06-04 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ Suggested by Brendan Kehoe
+ * decl2.c (do_toplevel_using_decl): When decl is a TYPE_DECL,
+ treat it as using ::decl.
+
+ * decl2.c (arg_assoc_type): Process unknown_type_node and OFFSET_TYPE.
+
+ * tree.c (mapcar): Support NEW_EXPR.
+
+ * error.c (dump_expr): Support NEW_EXPR.
+
+1998-06-03 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (make_thunk): Use overload machinery to make name.
+ * search.c (covariant_return_p): New fn.
+ (get_matching_virtual): Use it.
+
+ * init.c (build_new_1): Fix check for void.
+
+1998-06-01 Per Bothner <bothner@cygnus.com>
+
+ * cp-tree.h (TYPE_FOR_JAVA): New macro.
+ * decl.c, cp-tree.h (java_byte_type_node, java_short_type_node,
+ java_int_type_node, java_long_type_node, java_float_type_node,
+ java_double_type_node, java_char_type_node, java_boolean_type_node):
+ New "primitive" types, with predefined names __java_byte etc.
+ (record_builtin_java_type): New function.
+ (init_decl_processing): Make Java types with record_builtin_java_type.
+ (pushtag, grokdeclarator): Set TYPE_FOR_JAVA if in extern "JAVA".
+ (xref_baseypes): If base class was TYPE_FOR_JAVA, so is this class.
+ (grokfndecl): Call check_java_method for Java classes.
+ * method.c (is_java_type): Removed. Replaced with TYPE_FOR_JAVA.
+ (process_overload_item): Match types against specific
+ java_XX_type_node types, rather than using is_java_type.
+ * class.c (finish_struct_1): Don't add default copy constructor
+ or operator= if TYPE_FOR_JAVA.
+ (pop_lang_conext): Restore strict_prototyp proper if Java.
+ * decl2.c (acceptable_java_type, check_java_method): New functions.
+ * pt.c (instantiate_class_template): Copy TYPE_FOR_JAVA from pattern.
+ (tsubst): Move common statement after if statement.
+ * typeck.c (comptypes): If strict, TYPE_FOR_JAVA must match.
+
+1998-06-01 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (for_each_template_parm): Use first_rtl_op.
+
+ * tree.c (build_cplus_array_type_1): Also check index_type for
+ template parms.
+
+1998-05-31 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst): Always copy BINFO_BASETYPES.
+
+1998-05-29 scott snyder <snyder@d0sgif.fnal.gov>
+
+ * tree.c (layout_basetypes): If we change TYPE_SIZE, change
+ TYPE_SIZE_UNIT too.
+
+1998-05-29 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (grokdeclarator): Don't complain about in-class
+ initialization of static consts if we don't really know the type
+ of the variable.
+
+1998-05-29 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (DECL_DESTRUCTOR_P): New macro.
+ * method.c (build_destructor_name): New fn.
+ * decl2.c (maybe_retrofit_in_chrg): Split out...
+ (grokclassfn): From here. Reorganize.
+ * decl.c (grok_ctor_properties): Make sure ctors for types with
+ vbases have the in_chrg parm.
+ * pt.c (instantiate_class_template): Update
+ TYPE_USES_VIRTUAL_BASECLASSES from tsubsted bases. Don't call
+ grok_*_properties.
+ (tsubst): Call grok_ctor_properties and maybe_retrofit_in_chrg.
+
+1998-05-28 Mark Mitchell <mark@markmitchell.com>
+
+ * pt.c (instantiate_decl): Make test for whether or not static
+ variables should be instantiated early match its comment.
+
+1998-05-28 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (start_decl): Always pedwarn about vacuously redeclaring
+ a member.
+ (start_function): Call check_default_args.
+ * decl2.c (grokfield): Don't call check_default_args.
+ (check_default_args): Use cp_error_at.
+ * lex.c (do_pending_defargs): Call check_default_args.
+
+1998-05-27 Brendan Kehoe <brendan@cygnus.com>
+
+ * call.c (build_method_call): Make sure get_type_value returns
+ something before we try to use its TYPE_MAIN_VARIANT.
+ (build_scoped_method_call): Likewise.
+
+1998-05-27 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck2.c (digest_init): Complain about getting a TREE_LIST to
+ initialize an array.
+
+ * search.c (expand_upcast_fixups): Don't set DECL_CONTEXT and
+ DECL_VIRTUAL_P.
+
+ * friend.c (do_friend): Clarify template warning.
+
+1998-05-27 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (shadow_label): Don't treat decls as identifiers.
+ (maybe_push_to_top_level): Clear shadowed_labels.
+
+ * pt.c (instantiate_decl): Reset lineno and filename after calling
+ regenerate_decl_from_template.
+
+ * decl.c (grokdeclarator): Don't try to use TYPE_OBSTACK on an
+ error_mark_node.
+
+1998-05-27 Kevin Buhr <buhr@stat.wisc.edu>
+
+ * parse.y (base_class): Use is_aggr_type, not IS_AGGR_TYPE.
+
+1998-05-26 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
+
+ * pt.c (process_template_parm): Accept TYPENAME_TYPE nodes.
+ (convert_nontype_argument): Handle cases when nontype template
+ parameters become classes after substitution.
+
+1998-05-26 Mark Mitchell <mark@markmitchell.com>
+
+ * friend.c (is_friend): Use comptypes, rather than == to compare
+ types. Modify for new representation of template friends.
+ (make_friend_class): Likewise.
+ * pt.c (tsubst_friend_class): Undo 1998-05-21 change. Tweak.
+ (instantiate_class_template): Deal with template friends.
+
+ * decl.c (store_parm_decls): Remove redundant call to
+ expand_main_function.
+
+1998-05-26 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * decl.c (start_decl): Check for DECL_LANG_SPECIFIC before
+ DECL_USE_TEMPLATE.
+
+1998-05-26 Per Bothner <bothner@cygnus.com>
+
+ * language_as_string: Handle lang_java.
+
+1998-05-26 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (pushdecl): Don't copy the type_decl.
+
+1998-05-26 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * class.c (pushclass): Always store TYPE_MAIN_VARIANT in
+ current_class_type.
+ * decl.c (grokdeclarator): Put typedefs on the type's obstack.
+
+ * parse.y (complex_direct_notype_declarator): Use $1 to access
+ scope of notype_qualified_id.
+
+1998-05-26 Dave Brolley <brolley@cygnus.com>
+
+ * lex.c (parse_options,yy_cur,yy_lim): Add for cpplib.
+ (init_parse): Initialize cpplib interface.
+
+ * Makefile.in (CXX_OBJS): Make sure dependencies never end with an
+ empty continuation.
+
+1998-05-26 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (pushtag): Avoid crashing on erroneous input.
+
+1998-05-25 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (push_namespace): Only produce one unique name for
+ anonymous namespaces.
+ (get_unique_name): Remove.
+
+1998-05-25 Mark Mitchell <mark@markmitchell.com>
+
+ * call.c (tourney): Don't do any extra comparisons.
+
+ * decl2.c (build_anon_union_vars): Don't crash on empty sub-unions.
+
+ * cp-tree.h (processing_template_parmlist): Declare.
+ * decl.c (pushtag): Don't call push_template_decl when we
+ shouldn't.
+ * pt.c (processing_template_parmlist): New variable.
+ (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): New macro.
+ (complete_template_args): Use it.
+ (add_to_template_args): Likewise.
+ (innermost_args): Likewise.
+ (tsubst): Likewise.
+ (begin_template_parm_list): Use processing_template_parmlist.
+ (end_template_parm_list): Likewise.
+
+ * cp-tree.h (ANON_UNION_TYPE_P): New macro.
+ * decl.c (grokdeclarator): Use it.
+ * decl2.c (grok_x_components): Likewise.
+ * init.c (initializing_context): Likewise.
+ * method.c (do_build_copy_constructor): Likewise.
+ (do_build_assign_ref): Likewise.
+ * search.c (compute_access): Likewise.
+ * typeck.c (build_component_ref): Likewise.
+
+ * decl.c (grokdeclarator): Don't give a cv-qualified version of an
+ unnamed type a typedef name "for linkage purposes".
+
+ * pt.c (lookup_template_class): Don't look at
+ IDENTIFIER_CLASS_VALUE when there's no current_class_type.
+
+ * method.c (build_overload_int): Handle error cases gracefully.
+
+ * pt.c (instantiate_decl): Handle static member variables
+ correctly.
+
+ * pt.c (tsubst): Use the tsubst'd type when producing new
+ TEMPLATE_PARM_INDEX nodes.
+
+1998-05-24 Mark Mitchell <mark@markmitchell.com>
+
+ * tree.c (cp_tree_equal): Handle pointers to member functions.
+
+ * call.c (maybe_handle_implicit_object): Handle QUAL_CONVs. Make
+ sure the type of the REF_BIND is a reference type.
+ (maybe_handle_ref_bind, compare_ics): Rename reference_type to
+ target_type for clarity.
+
+ * parse.y (xcond): Move call to condition_conversion ...
+ * semantics.c (finish_for_cond): Here.
+ * parse.c: Regenerated.
+
+1998-05-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (push_namespace): Namespaces have type void.
+ * typeck2.c (incomplete_type_error): Complain about namespace
+ used as expression.
+ * typeck.c (decay_conversion): Likewise.
+
+1998-05-24 Martin von Löwis <loewis@informatik.hu-berlin.de>
+
+ * error.c (dump_expr): Support namespaces.
+
+1998-05-23 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.def: Add SRCLOC.
+ * cp-tree.h: Add struct tree_srcloc and accessor macros.
+ * tree.c (build_srcloc, build_srcloc_here): New fns.
+ * pt.c (add_pending_template): Use build_srcloc_here.
+ (push_tinst_level): Update last_template_error_tick before erroring.
+ (instantiate_decl): Restore lineno and input_filename before
+ calling add_pending_template.
+ * decl2.c (finish_file): Set up lineno and input_filename for
+ pending templates.
+
+1998-05-22 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (lang_print_error_function): New fn.
+ (init_decl_processing): Set print_error_function to use it.
+ * errfn.c (cp_thing): Don't call maybe_print_template_context here.
+
+ * call.c (maybe_handle_ref_bind): Propagate ICS_USER_FLAG and
+ ICS_BAD_FLAG.
+
+ * cvt.c (ocp_convert): Don't set LOOKUP_NO_CONVERSION for
+ copy-initialization.
+
+ * class.c (build_vtable_entry): Use int_fits_type_p.
+ (build_vtable): Pass a signed offset to build_vtable_entry.
+ (prepare_fresh_vtable, modify_one_vtable, fixup_vtable_deltas1,
+ set_rtti_entry): Likewise.
+
+1998-05-22 Per Bothner <bothner@cygnus.com>
+
+ * cp-tree.h: Add comments documenting which LANG_FLAGS are used.
+ (C_TYPE_VARIABLE_SIZE, C_DECL_VARIABLE_SIZE): Removed, not used.
+
+1998-05-22 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (print_template_context): Use fprintf instead of cp_error.
+
+ * pt.c (determine_specialization): Just return an error_mark_node.
+ Also print the decl we want in error messages. If we complain,
+ return error_mark_node.
+ (tsubst_friend_function): Set lineno and input_filename so
+ error messages will be useful.
+ (instantiate_template): Just return an error_mark_node.
+ (check_explicit_specialization): Don't mess with a returned
+ error_mark_node.
+
+ * pt.c (print_template_context): Add new argument.
+ (maybe_print_template_context): New fn.
+ (push_tinst_level): Increment tinst_level_tick.
+ (pop_tinst_level): Likewise.
+ * errfn.c (cp_thing): Call maybe_print_template_context. Use
+ xrealloc instead of xmalloc.
+
+ * typeck.c (build_unary_op, CONVERT_EXPR): Propagate TREE_CONSTANT.
+
+1998-05-21 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst_friend_class): Don't call redeclare_class_template
+ if the template we looked up is the same as the one we already
+ have.
+
+Thu May 21 11:54:44 1998 Dave Brolley <brolley@cygnus.com>
+
+ * lex.c: (handle_sysv_pragma): FILE* parameter not used.
+ (cpp_reader,parse_in): Add for cpplib.
+ (check_newline): Call handle_sysv_pragma with new interface.
+ (check_newline): Call GET_DIRECTIVE_LINE, not get_directive_line.
+
+ * input.c: (yy_cur,yy_lim,yy_get_token,GETC): Add for cpplib.
+ (sub_getch): Call GETC for cpplib.
+
+ * cp-tree.h: (get_directive_line): Different prototype for cpplib.
+ (GET_DIRECTIVE_LINE): Macro wrapper for get_directive_line.
+
+ * Makefile.in (CXX_OBJS): Add @extra_cxx_objs@ for cpplib.
+
+1998-05-21 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (maybe_make_one_only): New fn.
+ (import_export_vtable): Use it.
+ (import_export_decl): Likewise.
+ * pt.c (mark_decl_instantiated): Likewise.
+
+1998-05-21 Mark Mitchell <mmitchell@usa.net>
+
+ * decl2.c (find_representative_member): Rename to ...
+ (build_anon_union_vars): New function.
+ (finish_anon_union): Fix stupidity of previous change.
+
+1998-05-20 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokfndecl): Handle definition of specialization in
+ friend declaration.
+
+ * error.c (dump_decl): Fix LOOKUP_EXPR handling.
+
+1998-05-20 Mark Mitchell <mmitchell@usa.net>
+
+ * class.c (delete_duplicate_fields_1): Use DECL_DECLARES_TYPE_P
+ to look for type declarations.
+ (finish_struct): Deal with templates on the CLASSTYPE_TAGS list.
+ * cp-tree.h (DECL_DECLARES_TYPE_P): New macro.
+ (finish_member_class_template): Declare.
+ * decl.c (pushtag): Put member class templates on the
+ CLASSTYPE_TAGS list, just as for ordinary member classes.
+ (pushdecl_class_level): Use DECL_DECLARES_TYPE_P.
+ (lookup_tag): Look for IDENTIFIER_CLASS_VALUEs, just as with
+ IDENTIFIER_NAMESPACE_VALUEs.
+ * parse.y (component_decl): Move code to ...
+ * semantics.c (finish_member_class_template): New function.
+ Don't put member class templates on the list of components for a
+ class.
+ * parse.c: Regenerated.
+ * pt.c (classtype_mangled_name): Don't try DECL_CONTEXT on types.
+ In fact, don't use DECL_CONTEXT at all here.
+
+1998-05-20 Martin von Loewis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (record_unknown_type): New function.
+ (init_decl_processing): Call it for the unknown and global type
+ nodes.
+
+1998-05-20 Mark Mitchell <mmitchell@usa.net>
+
+ * decl2.c (find_representative_member): New function.
+ (finish_anon_union): Use it.
+
+ * cp-tree.h (MAIN_NAME_P): New macro.
+ (DECL_MAIN_P): Likwise.
+ * decl.c (pushdecl): Avoid crashing on redefinitions of `main'.
+ (grokfndecl): Use the new macros.
+ (grokdeclarator): Likewise.
+ (start_function): Likewise.
+ (store_parm_decls): Likewise.
+ (finsh_function): Likewise.
+ * friend.c (do_friend): Likewise.
+ * typeck.c (build_function_call_real): Likewise.
+ (build_unary_op): Likewise.
+
+Wed May 20 02:16:01 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (start_objects, finish_objects, do_dtors,
+ do_ctors): Split out from...
+ (finish_file): ...here.
+
+Tue May 19 20:36:23 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (is_overloaded_fn): Don't abort on placeholders from
+ push_class_decls.
+
+Tue May 19 15:16:22 1998 Brendan Kehoe <brendan@cygnus.com>
+
+ * class.c (is_empty_class): Return 0 if TYPE is an error_mark_node.
+
+ * error.c (dump_expr): Handle an ARROW_EXPR.
+
+Tue May 19 15:13:39 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * decl.c (saveable_obstack): Declare.
+ (pushdecl): Copy TYPE_DECLs to the same obstack as the type they
+ declare, if necessary.
+
+Tue May 19 14:50:27 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * call.c (compare_qual): Remove.
+ (is_subseq): Tweak.
+ (is_properly_derived_from): New function.
+ (maybe_handle_ref_bind): Likewise.
+ (maybe_handle_implicit_object): Likewise.
+ (compare_ics): Modify substantially to bring into conformance with
+ the standard.
+ * cp-tree.h (TYPE_PTRMEMFUNC_OBJECT_TYPE): New macro.
+ (comp_cv_qualification): Declare.
+ (comp_cv_qual_signature): Likewise.
+ * typeck.c (comp_cv_qualification): Likewise.
+ (comp_cv_qual_signature): Likewise.
+
+Tue May 19 10:05:02 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (parse.o): Depend on toplev.h.
+
+ * class.c (typecode_p): Remove prototype and definition.
+
+ * cp-tree.h (currently_open_class, is_empty_class, member_p):
+ Add prototype.
+
+ * decl.c (push_overloaded_decl_top_level): Remove prototype and
+ definition.
+
+ * errfn.c (cp_error): Cast function pointer `error' to (errorfn *)
+ in call to `cp_thing'.
+ (cp_warning): Likewise for function pointer `warning'.
+
+ * except.c (do_function_call): Remove prototype and definition.
+ (call_eh_info): Wrap variable `t1' in macro NEW_EH_MODEL.
+
+ * method.c (is_java_type): Add prototype and make it static.
+
+ * parse.y: Include toplev.h.
+
+ * pt.c (type_unification): Remove unused variable `arg'.
+ (instantiate_decl): Likewise for `save_ti'.
+
+ * tree.c (propagate_binfo_offsets): Likewise for `base_binfos'.
+
+Tue May 19 02:43:25 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (build_member_call): Handle template_ids.
+ * parse.y (primary): Add global_scope template_id.
+
+Mon May 18 23:22:52 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (get_sentry): Use end_temporary_allocation.
+ Don't declare permanent_obstack.
+
+Mon May 18 12:28:44 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * parse.y (.finish_new_placement): New non-terminal.
+ (unary_expr, new_type_id): Use it.
+ * parse.c: Regenerated.
+
+Mon May 18 12:20:27 1998 Brendan Kehoe <brendan@cygnus.com>
+
+ * pt.c (redeclare_class_template): Say where the original definition
+ of the template-parameter's default argument appeared.
+
+Mon May 18 03:00:57 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_over_call): Tweak empty class handling.
+
+ * decl.c (make_typename_type): Use currently_open_class.
+
+ * class.c (instantiate_type): Don't abort on TREE_NONLOCAL_FLAG.
+
+Mon May 18 01:43:01 1998 Martin v. Loewis <loewis@informatik.hu-berlin.de>
+
+ * decl.c (lookup_name_real): Don't look at IDENTIFIER_LOCAL_VALUE
+ for a type unless it is one.
+
+ * class.c (finish_struct_1): Use OVL_CURRENT in error message.
+
+Mon May 18 01:24:08 1998 Jeffrey A Law (law@cygnus.com)
+
+ * Makefile.in (program_transform_name, objdir): Define.
+
+ * Makefile.in (BISON): Use bison from the build tree if it exists.
+ (FLEX): Likewise.
+
+Sun May 17 14:52:08 1998 Martin v. Loewis <loewis@informatik.hu-berlin.de>
+
+ * typeck.c (type_unknown_p): Return true for TREE_LIST also.
+
+ * call.c (build_method_call): Use TYPE_MAIN_VARIANT on typedefs.
+
+Sun May 17 14:51:41 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_scoped_method_call): Likewise.
+
+Sun May 17 13:53:48 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * init.c (build_new_1): Call suspend_momentary around the creation
+ of values that must be saved for exception handling.
+ * parse.y (.build_new_placement): New non-terminal.
+ (unary_expr, new_placement): Use it.
+ * parse.c: Regenerated.
+
+Sun May 17 12:32:08 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (duplicate_decls): Use CANONICAL_TYPE_VARIANT to compare
+ old and new types.
+
+ * pt.c (tsubst): Make sure that BINFO_TYPE of new binfos is the
+ canonical type.
+
+ * call.c (build_over_call): Don't use IS_SIGNATURE on a namespace.
+
+Fri May 15 20:28:00 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (start_decl): Revert problem change.
+
+ * Makefile.in (CONFLICTS): Fix.
+
+Fri May 15 15:34:02 1998 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * decl.c (duplicate_decls): Clean up, add DECL_DATA_AREA bits.
+
+Fri May 15 00:46:05 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (finish_struct_1): Use BINFO_SIZE.
+
+ * decl.c (start_decl): Use 'tem'.
+
+Thu May 14 16:30:47 1998 Andrew MacLeod <amacleod@cygnus.com>
+
+ * exception.cc: Include eh-common.h.
+ (struct cp_eh_info): Add eh_info struct with NEW_EH_MODEL.
+ (__cplus_type_matcher): First stab at new C++ runtime type matcher.
+ (__cp_push_exception): Initialize eh_info struct as well.
+ * except.c: Remove local structs and include eh-common.h.
+ (init_exception_processing): Set language and version codes.
+ (call_eh_info): Add presence of eh_info to runtime description of
+ struct cp_eh_info.
+ (expand_end_eh_spec): Call start_catch_block() and end_catch_block().
+ * semantics.c (finish_try_block): Call start_catch_block() and
+ end_catch_block().
+ * parse.y (function_try_block): Call start_catch_block() and
+ end_catch_block().
+
+Thu May 14 12:27:34 1998 Brendan Kehoe <brendan@cygnus.com>
+
+ * typeck.c (original_type): New function.
+ (common_type): Use it to get the DECL_ORIGINAL_TYPE for T1 and T2,
+ to see if they're actually the same.
+ * cp-tree.h (original_type): Declare.
+
+Wed May 13 12:54:30 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (lex.o): Depend on output.h.
+
+ * call.c (add_function_candidate): Remove unused variable `cand'.
+ (add_conv_candidate): Likewise.
+ (build_builtin_candidate): Likewise.
+
+ * cp-tree.h: Add prototype for `types_overlap_p'.
+
+ * decl.c (signal_catch): Mark parameter `sig' with ATTRIBUTE_UNUSED.
+
+ * decl2.c (merge_functions): Remove unused variables `tmp' and
+ `tempn'.
+
+ * error.c (expr_as_string): Mark parameter `v' with ATTRIBUTE_UNUSED.
+ (code_as_string): Likewise.
+ (language_as_string): Likewise.
+ (parm_as_string): Likewise.
+ (op_as_string): Likewise.
+ (assop_as_string): Likewise.
+ (cv_as_string): Likewise.
+
+ * lex.c: Include output.h.
+
+ * pt.c (type_unification): Cast first argument of `bzero' to a char*.
+
+ * search.c (dfs_no_overlap_yet): Mark parameter `t' with
+ ATTRIBUTE_UNUSED.
+
+ * tinfo.cc (__class_type_info::dcast): Change the type of variable
+ `i' from int to size_t.
+
+ * typeck.c (language_lvalue_valid): Mark parameter `exp' with
+ ATTRIBUTE_UNUSED.
+
+Tue May 12 21:37:49 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * error.c (dump_simple_decl): Use DECL_CLASS_SCOPE_P and/or
+ DECL_NAMESPACE_SCOPE_P.
+ (lang_decl_name): Likewise.
+ * pt.c (tsubst_friend_function, tsubst): Likewise.
+ * decl.c (pushdecl, redeclaration_error_message, start_decl,
+ cp_finish_decl, start_function): Likewise.
+ * class.c (finish_struct_1): Likewise.
+ * call.c (build_over_call): Likewise.
+ (compare_ics): Use DERIVED_FROM_P.
+
+Tue May 12 07:24:18 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * cp-tree.h (CANONICAL_TYPE_VARIANT): New macro.
+ * method.c (build_mangled_name): Use it.
+ (build_decl_overload_real): Likewise.
+
+ * error.c (dump_simple_decl): New function, broken out from ...
+ (dump_decl): Use it.
+
+Mon May 11 11:38:07 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * ptree.c (lang_print_xnode): Add missing `break'.
+
+ * pt.c (tsubst): Remove duplicate check for IDENTIFIER_NODE.
+
+ * call.c (add_template_candidate): Adjust for changes to
+ fn_type_unification.
+ (add_template_candidate_real): Likewise.
+ (add_template_conv_candidate): Likewise.
+ (build_user_type_conversion_1): Likewise.
+ (build_new_function_call): Likewise.
+ (build_object_call): Likewise.
+ (build_new_op): Likewise.
+ (build_new_method_call): Likewise.
+ * class.c (instantiate_type): Likewise.
+ * cp-tree.h (unification_kind_t): New type.
+ (fn_type_unification): Adjust prototype.
+ (type_unificaiton): Likewise.
+ * pt.c (UNIFY_ALLOW_NONE): New macro.
+ (UNIFY_ALLOW_MORE_CV_QUAL): Likewise.
+ (UNIFY_ALLOW_LESS_CV_QUAL): Likewise.
+ (UNIFY_ALLOW_DERIVED): Likewise.
+ (unify): Change prototype.
+ (maybe_adjust_types_for_deduction): New function.
+ (check_cv_quals_for_unify): Likewise.
+ (determine_specialization): Adjust.
+ (fn_type_unification): Likewise.
+ (type_unification): Likewise.
+ (type_unification_real): Likewise. Use
+ maybe_adjust_types_for_deduction. Fix mishandling of
+ back-unification of template functions passed as arguments. Pass
+ appropriate combination of UNIFY_ALLOW_* to unify.
+ (unify): Remove unused NTPARMS parameter. Use
+ check_cv_quals_for_unify. Remove bogus code that allowed
+ too-generous unification in order to adhere more closely to standard.
+ (get_bindings_real): Adjust.
+ (get_class_bindings): Likewise.
+
+ * method.c (build_overload_identifier): Only use the innermost
+ template arguments when mangling.
+ * pt.c (tsubst_template_argument_vector): New function.
+ (complete_template_args): Deal with the situation where the
+ extra_args contain more than one level of arguments.
+ (lookup_template_class): Deal with member template classes, which
+ may have more than one level of arguments.
+ (tsubst): Don't tsbust into the TREE_TYPE of an IDENTIFIER_NODE.
+ Improve handling of member template classes. Use
+ DECL_PRIMARY_TEMPLATE instead of inline expansion. Use
+ tsubst_template_argument_vector where appropriate.
+ (regenerate_decl_from_template): Break out from ...
+ (instantiate_decl): Here.
+
+ * lex.c (yyprint): Remove TYPENAME_ELLIPSIS.
+ * parse.h: Regenerated.
+ * parse.c: Really regenerated.
+
+ * cp-tree.h (finish_unary_op_expr): New function.
+ (finish_id_expr): Likewise.
+ (begin_new_placement): Likewise.
+ (finish_new_placement): Likewise.
+ (finish_declarator): Likewise.
+ (finish_translation_unit): Likewise.
+ (finish_parmlist): Likewise.
+ (begin_class_definition): Likewise.
+ (finish_class_definition): Likewise.
+ (finish_default_args): Likewise.
+ (finish_inline_definitions): Likewise.
+ * parse.y (GCC_ASM_KEYWORD): Remove.
+ (TYPENAME_ELLIPSIS): Likewise.
+ * parse.c: Regenerated.
+ Use new functions in semantics.c in the actions for many rules.
+ * gxx.gperf (GCC_ASM_KEYWORD): Just use ASM_KEYWORD.
+ * hash.h: Regenerated.
+ * semantics.c (finish_expr_stmt): Allow NULL expr.
+ (finish_unary_op_expr): New function, containing
+ code previously in parse.y.
+ (finish_id_expr): Likewise.
+ (begin_new_placement): Likewise.
+ (finish_new_placement): Likewise.
+ (finish_declarator): Likewise.
+ (finish_translation_unit): Likewise.
+ (finish_parmlist): Likewise.
+ (begin_class_definition): Likewise.
+ (finish_class_definition): Likewise.
+ (finish_default_args): Likewise.
+ (finish_inline_definitions): Likewise.
+
+Sun May 10 23:43:13 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * typeck.c (build_c_cast): Don't decay arrays and functions to
+ pointer type when converting to a class type.
+
+Sun May 10 22:53:56 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (DECL_NAMESPACE_SCOPE_P): New macro.
+ (DECL_CLASS_SCOPE_P): Likewise.
+
+Sun May 10 22:48:22 1998 H.J. Lu (hjl@gnu.org)
+
+ * class.c (finish_struct_1): Use OVL_CURRENT on TREE_VEC_ELT.
+ * decl2.c (constructor_name_full): Likewise.
+
+Sun May 10 22:48:12 1998 Mike Stump <mrs@wrs.com>
+
+ * tree.c (mapcar): Add OVERLOAD support.
+
+ * init.c (resolve_offset_ref): We must use basetype_path before we
+ destroy it with a call to convert_pointer_to.
+
+Sat May 9 14:44:37 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (currently_open_class): New fn.
+ * decl.c (lookup_name_real): Use it.
+ * search.c (lookup_field): Likewise.
+
+Fri May 8 23:32:42 1998 Martin von Loewis <loewis@informatik.hu-berlin.de>
+
+ * cp-tree.def (OVERLOAD): New node.
+ * cp-tree.h (BINDING_TYPE, SET_IDENTIFIER_GLOBAL_VALUE,
+ SET_IDENTIFIER_NAMESPACE_VALUE): Define.
+ (NAMESPACE_BINDING): Remove.
+ (IDENTIFIER_GLOBAL_VALUE, IDENTIFIER_NAMESPACE_VALUE): Use
+ namespace_binding.
+ (OVL_FUNCTION, OVL_CHAIN, OVL_CURRENT, OVL_NEXT, OVL_USED):
+ Define.
+ (tree_overload): New struct.
+ (IDENTIFIER_TYPE_VALUE): Use identifier_type_value.
+ (REAL_IDENTIFIER_TYPE_VALUE): Define.
+ (IDENTIFIER_HAS_TYPE_VALUE): Use IDENTIFIER_TYPE_VALUE.
+ (lang_decl_flags): Remove in_namespace.
+ (lang_decl): Remove chain.
+ (DECL_CHAIN, DECL_NAMESPACE): Remove.
+ (flag_honor_std): Declare extern.
+ (identifier_type_value, pushdecl_namespace_level, push_using_decl,
+ namespace_binding, set_namespace_binding,
+ lookup_function_nonclass, cat_namespace_levels,
+ set_decl_namespace, lookup_arg_dependent, binding_init, ovl_cons,
+ scratch_ovl_cons, ovl_member, build_overload): Declare.
+ (decl_list_length, get_namespace_id, current_namespace_id,
+ overloaded_globals_p): Remove.
+ (lookup_using_namespace, qualified_lookup_using_namespace): Change
+ return type.
+ (push_scratch_obstack): New macro.
+ * call.c (add_function_candidate): Special-case type of OVERLOAD node.
+ (build_user_conversions_1): Iterate using OVL_NEXT for ctors,
+ convs, fns.
+ (build_new_function_call): Iterate using OVL_CHAIN.
+ Print DECL_NAME in when reporting ambiguities.
+ (build_object_call): Iterate using OVL_NEXT for fns, convs.
+ (build_new_op): Call lookup_function_nonclass.
+ Iterate using OVL_NEXT.
+ (build_op_delete_call): Change detection of members.
+ Do not wrap TREE_LIST around fields and single global functions.
+ (build_over_call): Don't push a class level if the context is a
+ namespace.
+ (build_new_method_call): Iterate using OVL_NEXT.
+ * class.c (add_method): Chain overloaded members using
+ build_overload. Remove copying of method.
+ (grow_method): When iterating through the obstack, expect OVERLOAD
+ nodes. Chain overload members.
+ (finish_struct_methods): Chain overload members. Unpack OVERLOAD
+ nodes in call to get_baselinks.
+ (duplicate_tag_error): Expect OVERLOAD nodes when unchaining.
+ (finish_struct_1): Iterate over ctor using OVL_NEXT. Handle
+ fdecls that are OVERLOAD nodes.
+ (validate_lhs): New function.
+ (instantiate_type): Do not copy OVERLOAD nodes. Remove dead
+ code. Use DECL_NAME in error messages. Split code between global
+ and member function processing.
+ * decl.c (global_type_node): New static variable.
+ (in_std): New global.
+ (struct binding_level): New field usings.
+ (resume_binding_level): Assert that we are not in a class.
+ (toplevel_bindings_p): Just check for namespace_p or
+ pseudo_global.
+ (resume_level): Remove.
+ (find_binding): New function.
+ (binding_for_name): Call it.
+ (namespace_binding, set_namespace_binding): New functions.
+ (push_namespace): Associate binding level with new namespace,
+ resume_binding_level for existing namespace. Remove old code.
+ Fake std by counting.
+ (store_bindings): Use REAL_IDENTIFIER_TYPE_VALUE.
+ (maybe_push_to_top_level): Save current namespace.
+ (pop_from_top_level): Restore saved namespace.
+ (pop_namespace): Call suspend_binding_level. Remove old code.
+ (cat_namespace_levels): New function.
+ (set_identifier_type_value_with_scope): For namespace bindings,
+ set BINDING_TYPE, and use global_type_node.
+ Use REAL_IDENTIFIER_TYPE_VALUE otherwise.
+ (identifier_type_value): New function.
+ (pushtag): If no context, use current_namespace.
+ (duplicate_decls): Don't process DECL_CHAIN.
+ (pushdecl): Set DECL_CONTEXT to current_namespace, if it is not
+ already set. Never reset it to NULL_TREE. Lookup global variables
+ in their namespace. Push overloaded templates if they are on
+ namespace level.
+ (pushdecl_namespace_level): New function.
+ (pushdecl_top_level): Implement using pushdecl_namespace_level.
+ (pushdecl_using_decl): New function.
+ (overloaded_globals_p): Remove.
+ (push_overloaded_decl): Create OVERLOAD nodes, and iterate through
+ them. Use namespace_binding and set_namespace_value.
+ (redeclaration_error_message): Complain if the declarations come
+ from different namespaces.
+ (lookup_tag): On namespace level, look in the BINDING_TYPE.
+ (lookup_namespace_name): Pass tree_bindings from stack. Remove
+ old code.
+ (select_decl): New function.
+ (lookup_name_real): Call it for qualified and unqualified lookup.
+ Pass tree_bindings from the stack.
+ If prefer_type is 1, also accept namespaces.
+ (lookup_function_nonclass): New function.
+ (init_decl_processing): Set the binding level of the global
+ namespace to global_binding_level.
+ Build a proper type list for __builtin_apply.
+ Initialize std_node to "fake std" if flag_honor_std is set.
+ Initialize global_type_node.
+ Allocated bad_alloc in namespace std if flag_honor_std.
+ (define_function): Set the DECL_CONTEXT to the current_namespace.
+ (start_decl): A namespace is not considered as a context here. If
+ the DECL_CONTEXT is a namespace, push the decl.
+ (cp_finish_decl): Check for namespaces used as initializers.
+ (grokfndecl): Add namespace parameter. Remove processing of
+ DECL_CHAIN.
+ (grokvardecl): Add namespace parameter.
+ (grokdeclarator): Process SCOPEs that are namespaces. For
+ mangling, temporarily set the DECL_CONTEXT on anonymous structs.
+ (start_function): Check for contexts that are namespaces.
+ Set context for declarations that have not been pushed.
+ (store_parm_decls): Check for ::main only.
+ (finish_function): Likewise.
+ (start_method): Check for contexts that are namespaces.
+ (start_method): Remove DECL_CHAIN processing.
+ * decl2.c (flag_honor_std): Declare.
+ (lang_decode_option): Set it if -fhonor-std or -fnew-abi is given.
+ (decl_namespace_list): New static global.
+ (grok_x_components): Ignore namespaces as type contexts.
+ (check_classfn): Expect OVERLOAD nodes.
+ (grokfield): Remove DECL_CHAIN processing.
+ (finish_file): Call cat_namespace_levels.
+ (merge_functions): New function.
+ (ambiguous_decl): Rewrite.
+ (lookup_using_namespace): Produce tree_bindings.
+ (qualified_lookup_using_namespace): Likewise.
+ (set_decl_namespace, decl_namespace, current_decl_namespace,
+ push_decl_namespace, pop_decl_namespace): New functions.
+ (arg_lookup): New struct.
+ (add_function, arg_assoc_namespace, arg_assoc_class,
+ arg_assoc_type, arg_assoc_args, arg_assoc, lookup_arg_dependent):
+ New functions.
+ (get_namespace_id, current_namespace_id): Remove.
+ (do_toplevel_using_decl): Rewrite.
+ (do_class_using_decl): Complain about namespace qualifiers.
+ (do_using_directive): Sorry if not on namespace level. Complain
+ about unknown namespaces.
+ * error.c (dump_aggr_type): Check for namespace contexts.
+ * except.c (init_exception_processing): Push terminate into std.
+ * friend.c (is_friend): A namespace is not a context, here.
+ * init.c (expand_member_init): Remove DECL_CHAIN processing.
+ (build_offset_ref): Process OVERLOAD nodes.
+ * lang-specs.h (__HONOR_STD): Define if -fnew-abi or -fhonor-std.
+ * lex.c (identifier_type): Loop using OVL_CHAIN.
+ (see_typename): Set looking_for_typename to 2.
+ (real_yylex): Likewise.
+ (do_identifier): Expect OVERLOAD nodes instead of TREE_LISTs.
+ (do_scoped_id): Expect OVERLOAD nodes.
+ Change calling convention for qualified_lookup_using_namespace.
+ (build_lang_decl): Don't set in_namespace anymore.
+ * method.c (typevec_size): New global.
+ (build_overload_nested_name): Return if global_namespace.
+ Otherwise, always expect a declaration context.
+ (build_qualified_name): Likewise.
+ Make sure we don't write beyond typevec_size.
+ (build_decl_overload_real): Likewise.
+ Allocate one extra slot for the namespace.
+ (hack_identifier): Mark code dead.
+ Process OVERLOAD and NAMESPACE_DECL nodes.
+ * parse.y (program): Pop namespaces until in global namespace.
+ (extdef): In a using-declaration, don't discard the identifier if
+ there is no declaration.
+ (left_curly): Ignore type contexts which are namespaces.
+ (typename_sub2): Use IDENTIFIER_TYPE_VALUE to retrieve the type
+ used as scope.
+ * pt.c (template_class_depth): Expect types to be namespaces.
+ (determine_specialization): Simplify by expecting OVERLOAD nodes.
+ (push_template_decl): Push into namespace level.
+ Reset ctx if it is a namespace.
+ Set DECL_CONTEXT to current_namespace if not set already.
+ Ignore real contexts that are namespaces.
+ (mangle_class_name_for_template): Skip global_namespace.
+ Mangle other namespaces as declarations.
+ (lookup_template_function): Set type of OVERLOAD nodes to unknown.
+ (lookup_template_class): Push into namespace of context.
+ If the context is a namespace, set it to global_namespace.
+ Use id_context for mangling.
+ (for_each_template_parm): Handle OVERLOAD and NAMESPACE_DECL nodes.
+ (tsubst_friend_function): Ignore namespace contexts.
+ Push into namespace level.
+ (tsubst): Handle NAMESPACE_DECL nodes.
+ Remove DECL_CHAIN processing.
+ (type_unification_real): Recognize OVERLOAD instead of TREE_LIST nodes.
+ * ptree.c (print_lang_identifier): Print bindings.
+ (lang_print_xnode): Print OVERLOAD nodes.
+ * rtti.c (init_rtti_processing): Push type_info into std.
+ * search.c (lookup_fnfields_here): Expect OVERLOAD nodes.
+ (lookup_fnfields_1, get_virtuals_named_this, get_matching_virtual,
+ dfs_debug_mark, dfs_pushdecls, dfs_compress_decls, add_conversions,
+ lookup_fnfields_here): Likewise.
+ Process all nodes, instead of going through TREE_CHAIN.
+ * sig.c (build_signature_pointer_or_reference_type): Set context
+ to global_namespace.
+ (build_signature_table_constructor): Expect OVERLOAD nodes.
+ * spew.c (yylex): Save old setting of looking_for_typename.
+ * tree.c (decl_list_length): Remove.
+ (binding_init): New function.
+ (count_functions): Rewrite.
+ (is_overloaded_fn): Expect OVERLOAD nodes.
+ (really_overloaded_fn, get_first_fn, lvalue_type): Likewise.
+ (ovl_cons, scratch_ovl_cons, build_overload, build_overload_after,
+ ovl_member): New functions.
+ * typeck.c (require_complete_type): Expect OVERLOAD nodes.
+ (type_unknown_p): Likewise.
+ (require_instantiated_type): Likewise.
+ (build_component_ref): Declare code dead.
+ (build_x_function_call): Create and expect OVERLOAD nodes.
+ (build_function_call_real): Check for ::main only.
+ (build_unary_op): Likewise. Expect OVERLOAD nodes.
+ (convert_for_assignment): Check for TREE_LIST before accessing
+ TREE_VALUE.
+ * decl.c (duplicate_decls): Check for namespace bindings instead
+ of global bindings.
+ (pushdecl, push_overloaded_decl, lookup_tag, lookup_name_real,
+ lookup_name_current_level, start_decl, xref_tag,
+ finish_enum): Likewise.
+ * init.c (build_offset_ref): Likewise.
+ * search.c (lookup_field): Likewise.
+ (lookup_fnfields): Likewise.
+ (dfs_debug_mark): Likewise.
+ * decl.c (poplevel): Use SET_IDENTIFIER_TYPE_VALUE.
+ (poplevel_class, pop_from_top_level): Likewise.
+ * decl2.c (finish_method): Likewise.
+ * class.c (build_vtable): Use SET_IDENTIFIER_GLOBAL_VALUE.
+ * decl.c (record_builtin_type): Likewise.
+ (init_decl_processing, grokfndecl): Likewise.
+ * lex.c (get_time_identifier, do_identifier, do_scoped_id): Likewise.
+ (make_lang_type): Likewise.
+ * parse.y (make_thunk): Likewise.
+ * pt.c (tsubst): Likewise.
+ * tree.c (debug_binfo): Likewise.
+ * exception.cc, new.cc, new1.cc, new2.cc, tinfo.cc, tinfo.h,
+ tinfo2.cc, inc/new.h: Add std qualifications.
+ * inc/new: Wrap with namespace std if __HONOR_STD.
+ * inc/typeinfo: Likewise.
+
+Fri May 8 00:43:50 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_user_type_conversion_1): Handle second_conv
+ properly for templates.
+
+Thu May 7 17:09:25 1998 Andrew MacLeod <amacleod@cygnus.com>
+
+ * method.c (build_decl_overload_real): Set TREE_USED flag to
+ zero for build_type_variants nodes as well.
+
+Wed May 6 19:27:09 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst): Don't tsubst the type of an IDENTIFIER_NODE.
+
+Wed May 6 16:49:48 1998 Jim Wilson <wilson@cygnus.com>
+
+ * Makefile.in (call.o, class.o, decl.o, decl2.o, errfn.o, error.o,
+ except.o, expr.o, friend.o, init.o, lex.o, method.o, pt.o, repo.o,
+ rtti.o, search.o, semantics.o, sig.o, tree.o, typeck.o, typeck2.o,
+ xref.o): Add toplev.h dependencies.
+
+Wed May 6 16:44:58 1998 Jeffrey A Law (law@cygnus.com)
+
+ * errfn.c (cp_error, cp_warning): Remove declarations for
+ error and warning respectively.
+
+Wed May 6 14:28:18 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * error.c: Convert to using ctype macros defined in system.h.
+ * method.c: Likewise.
+ * xref.c: Likewise.
+ * lex.c: Likewise. Also remove redundant system header stuff.
+
+Wed May 6 06:36:41 1998 Robert Lipe <robertl@dgii.com>
+
+ * call.c, class.c, decl.c, decl2.c, errfn.c, error.c, except.c,
+ expr.c, friend.c, init.c, lex.c, method.c, pt.c, repo.c, rtti.c,
+ search.c, semantics.c, sig.c, tree.c, typeck.c, typeck2.c,
+ xref.c: Add include of toplev.h.
+
+Wed May 6 02:33:39 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (perm_manip): Also regenerate the RTL of an extern.
+ (copy_to_permanent): Use end_temporary_allocation.
+
+Tue May 5 23:54:04 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (expand_vec_init): The initialization of each array
+ element is a full-expression.
+
+Tue May 5 18:24:13 1998 Andrew MacLeod <amacleod@cygnus.com>
+
+ * method.c (build_mangled_name): Add a call to build_type_variant
+ to get the right type.
+
+Tue May 5 01:25:03 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * Makefile.in: Add .SUFFIXES.
+
+ * cp-tree.def: Remove NAMESPACE_DECL.
+
+Sun May 3 01:32:14 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_over_call): Do evaluate arg even if it has empty
+ class type.
+ * decl.c (start_function): Don't push a member function.
+
+Thu Apr 30 18:59:23 1998 Jim Wilson <wilson@cygnus.com>
+
+ * Makefile.in (g++FAQ.info): Put -o option before input file.
+
+Thu Apr 30 13:05:33 1998 Andrew MacLeod <amacleod@cygnus.com>
+
+ * gxxint.texi: Add info for squangling codes K and B.
+
+Tue Apr 28 13:22:01 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * semantics.c (begin_stmt_expr): Avoid duplicating the effect of
+ the expression in templates.
+ (finish_stmt_expr): Likewise.
+
+1998-04-28 Brendan Kehoe <brendan@cygnus.com>
+
+ * decl2.c (ambiguous_decl): Fix NAME parm to be a tree, not int.
+
+Mon Apr 27 13:58:10 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * decl.c (maybe_push_to_top_level): Always clear
+ current_template_parms and processing_template_decl.
+ (pushtag): Remove check of current_class_type and some comments,
+ since maybe_push_to_top_level no longer creates confusion.
+
+Sun Apr 26 12:10:18 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * cp-tree.h (CLASSTYPE_IS_TEMPLATE): New macro.
+ (DECL_CLASS_TEMPLATE_P): Likewise.
+ (DECL_PRIMARY_TEMPLATE): Likewise.
+ (PRIMARY_TEMPLATE_P): Use it.
+ (push_template_decl_real): New function.
+ (redeclare_class_template): Take new template parameters as
+ input.
+ (is_specialization_of): New function.
+ (comp_template_args): Declare.
+ * decl.c (pushtag): Handle friend template classes.
+ (xref_tag): Likewise. Use new calling convention for
+ redeclare_class_template.
+ * decl2.c (grok_x_components): Handle friend templates.
+ * friend.c (is_friend): Use is_specialization_of where
+ appropriate. Deal with friend class templates.
+ (make_friend_class): Let a class template be friends with itself.
+ * pt.c (comp_template_args): Remove declaration.
+ (tsubst_friend_class): New function.
+ (push_template_decl_real): New function.
+ (push_template_decl): Use it.
+ (redeclare_class_template): Adjust for new calling convention.
+ (comp_template_args): Give it external linkage.
+ (instantiate_class_type): Use tsubst_friend_class to deal
+ with friend templates.
+ * typeck.c (comptypes): Use comp_template_args, rather than
+ expanding it inline.
+ * parse.y (component_decl): Handle a nested template type
+ like other component type declarations.
+
+ * pt.c (check_explicit_specialization): Handle overloaded
+ constructors correctly.
+
+ * pt.c (mabybe_get_template_decl_from_type_decl): New function.
+ (lookup_template_class): Use it.
+
+Thu Apr 23 21:19:06 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.def: Add WRAPPER. USER_CONV now only has two ops.
+ * cp-tree.h: Add WRAPPER support.
+ * call.c (add_candidate): Split out from add_*_candidate fns.
+ (build_over_call): Take the candidate instead of function and args.
+ Enforce access control here. Emit overload warnings here.
+ (add_warning): New fn.
+ (joust): Add WARN parm. If not set, call add_warning instead of
+ printing a warning. Re-enable some warnings.
+ (tourney): Pass it.
+ (convert_like): Adjust.
+ (build_new_op): Adjust.
+ (build_new_function_call): Adjust.
+ (build_user_type_conversion_1): Adjust.
+ (USER_CONV_FN): Adjust.
+ * tree.c (build_expr_wrapper, build_expr_ptr_wrapper,
+ build_int_wrapper): New fns.
+
+Thu Apr 23 18:27:53 1998 Mark P. Mitchell <mmitchell@usa.net>
+
+ * pt.c (unify): Fix typo in previous change.
+
+Thu Apr 23 09:32:58 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * error.c (dump_type_real): Declare canonical_name.
+
+ * typeck.c (comp_target_types): Fix PMFs.
+
+Wed Apr 22 13:24:48 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * class.c (finish_struct): Set TREE_PRIVATE and TREE_PROTECTED for
+ the DECL_RESULTs of a member TEMPLATE_DECL, not just the
+ TEMPLATE_DECL.
+
+ * pt.c (tsubst): Decrease the template-level of
+ TEMPLATE_TEMPLATE_PARMS. Likewise for the DECL_INITIAL of a
+ TEMPLATE_PARM_INDEX.
+ (template_decl_level): New function.
+ (unify): Make sure to record unifications for template
+ parameters, even when the parameters exactly match the arguments.
+ Combine duplicated code for TEMPLATE_TEMPLATE_PARMs and
+ TEMPLATE_TYPE_PARMS. Don't try to unify template parameters that
+ aren't from the level we're currently working on.
+
+Tue Apr 21 22:00:04 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * errfn.c (cp_thing): Use xrealloc, not xmalloc, to copy memory.
+
+ * decl2.c (check_member_template): Set DECL_IGNORED for member
+ class templates, too.
+
+ * decl2.c (grokfield): Remangle the name of a member TYPE_DECL.
+
+Tue Apr 21 18:59:11 1998 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * decl.c (duplicate_decls): Only check DECL_FRIEND_P if function.
+
+Tue Apr 21 14:22:00 1998 Jeffrey A Law (law@cygnus.com)
+
+ * cp-tree.h (intTI_type_node, unsigned_intTI_type_node): Declare.
+ * decl.c (intTI_type_node, unsigned_intTI_type_node): Define.
+ (init_decl_processing): Handle TI types.
+ * typeck.c (unsigned_type, signed_type): Handle TI types.
+
+Sat Apr 18 15:25:21 1998 Jim Wilson <wilson@cygnus.com>
+
+ * g++spec.c (lang_specific_driver): New argument in_added_libraries.
+ New local added_libraries. Increment count when add library to
+ arglist.
+
+Fri Apr 17 21:25:00 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * cp-tree.h (type_as_string_real): New function.
+ * pt.c (mangle_class_name_for_template): Use it.
+ * error.c (dump_aggr_type): Change prototype.
+ (dump_type_prefix): Likewise.
+ (dump_type_suffix): Likewise.
+ (dump_type_real): Convert from dump_type. If desired, the
+ "canonica" name of a typedef, i.e., the name of the underlying
+ type, can be printed.
+ (dump_type): Call dump_type_real.
+
+Fri Apr 17 14:30:45 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (lang_decode_option): -fnew-abi implies -fvtable-thunks.
+
+ * typeck.c (comp_target_types): Tweak pedantic case.
+ (comp_target_parms): Tweak pedantic case. Clean up somewhat.
+ Return -1 or 1 instead of 1 or 2.
+ (compparms): Remove STRICT handling.
+ (convert_for_assignment): Fix handling of pmfs.
+
+Fri Apr 17 14:04:16 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * typeck.c (comp_target_types): Handle references like pointers.
+ (comp_target_parms): Note that return code from comp_target_types
+ can be negative to indicate failure.
+
+Fri Apr 17 09:10:52 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * Make-lang.in (c++.all.build): Don't depend on $(DEMANGLER_PROG),
+ which requires a working target compiler to build.
+
+Fri Apr 17 08:57:35 1998 Jeffrey A Law (law@cygnus.com)
+
+ * tree.c (avoid_overlap): Add prototype.
+
+ * spew.c (num_tokens): Add prototype.
+ (nth_noken, add_token, consume_token, debug_yychar): Likewise.
+
+ * search.c (dfs_check_overlap): Add prototype.
+ (dfs_no_overlap_yet): Likewise.
+
+ * pt.c (original_template): Add prototype.
+ (inline_needs_template_parms): Likewise.
+ (push_inline_template_parms_recursive): Likewise.
+ (retrieve_specialization, register_specialization): Likewise.
+ (print_candidates, reduce_template_parm_level): Likewise.
+ (build_template_decl, mark_template_parm): Likewise.
+ (tsubst_friend_function, get_bindings_real): Likewise.
+
+ * method.c (start_squangling): Add prototype.
+ (end_squangling, check_ktype, issue_ktype): Likewise.
+ (build_overloaded_scope_ref, check_btype): Likewise.
+ (build_mangled_template_parm_index): Likewise.
+
+ * lex.c (init_cpp_parse): Add prototype.
+ (handle_cp_pragma, handle_sysv_pragma): Likewise.
+ (reduce_cmp, token_cmp): Likewise.
+
+ * except.c (call_eh_info): Add prototype.
+ (push_eh_info, get_eh_info, get_eh_value, get_eh_type): Likewise.
+ (get_eh_caught, get_eh_handlers, do_pop_exception): Likewise.
+
+ * decl2.c (is_namespace_ancestor): Add prototype.
+ (namespace_ancestor, add_using_namespace): Likewise.
+ (ambiguous_decl): Likewise.
+
+ * decl.c (indent): Add prototype.
+
+ * call.c (add_template_candidate_real): Add prototype.
+
+Fri Apr 17 01:57:12 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (build_expr_from_tree): Just return a PMF.
+
+Fri Apr 17 00:45:12 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * typeck2.c (process_init_constructor): Don't strip cv-qualifiers
+ when doing initializations.
+
+ * pt.c (unify): Use comptypes to compare type args.
+
+Fri Apr 17 00:24:22 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (duplicate_decls): Fix check for when it's safe to free
+ the new decl.
+
+ * pt.c (mangle_class_name_for_template): Don't pass a typedef type
+ to type_as_string.
+
+Thu Apr 16 17:47:30 1998 Jeffrey A Law (law@cygnus.com)
+
+ * pt.c (build_template_parm_index): Add prototype.
+
+ * search.c (my_tree_cons): Don't clear words outside the
+ newly allocated node.
+
+Wed Apr 15 15:34:44 1998 Dave Brolley <brolley@cygnus.com>
+
+ * lex.c (init_parse): Now returns char* containing the filename.
+
+Wed Apr 15 13:20:06 1998 John Carr <jfc@mit.edu>
+ Jeff Law <law@cygnus.com>
+
+ * errfn.c: Rework to avoid problems when HOST_WIDE_INT is longer
+ than a pointer.
+
+Sun Apr 12 22:31:19 1998 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * cvt.c (cp_convert_to_pointer): Use TYPE_PRECISION.
+
+Fri Apr 10 12:16:49 1998 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * decl.c (duplicate_decls): Don't warn for redundant decls if
+ friend: let add_friend take care of it.
+
+Thu Apr 9 02:40:48 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * sig.c (build_signature_pointer_constructor): Don't set
+ TREE_HAS_CONSTRUCTOR for a signature pointer.
+ * cvt.c (ocp_convert): Don't force a temporary for internal structs.
+ * init.c (resolve_offset_ref): Warn about implicit & on pmfs
+ here, too.
+ * typeck.c (build_unary_op): Only allow taking the address of a
+ real constructor.
+ * typeck2.c (digest_init): Simplify.
+ (store_init_value): Don't pedwarn about using { } for pmfs.
+
+Thu Apr 9 22:16:57 1998 Per Bothner <bothner@cygnus.com>
+
+ * cp-tree.h (start_decl): Update prototype.
+ * decl.c (start_decl): Like the C version, new parameters
+ for the attributes. Call cplus_decl_attributes here,
+ (pushdecl): Like C version, do build_type_copy if TYPE_DECL,
+ (grokdeclarator): Pass NULL for new start_decl arguments.
+ * pt.c (tsubst_expr): Likewise.
+ * parse.y: Merge cplus_decl_attribute calls into start_decl calls.
+ * typeck.c (common_type): Check TYPE_MAIN_VARIANT.
+ * lex.c (build_lang_decl): Add lang_name_java.
+ * class.c (push_lang_context): Add lang_name_java.
+ * method.c (build_mangled_name): Check for is_java_type.
+
+Thu Apr 9 22:16:57 1998 Benjamin Kosnik <bkoz@loony.cygnus.com>
+
+ * decl.c (grokdeclarator): Check TYPE_MAIN_VARIANT.
+ * call.c (build_scoped_method_call): Check for TREE_CODE for
+ VOID_TYPE instead of type == void_type_node.
+ (build_method_call): Likewise.
+ * decl.c (lookup_name_real): Likewise.
+ (grokdeclarator): Likewise.
+ (start_decl): Likewise.
+ (grokparms): Likewise.
+ (start_function): Likewise.
+ (finish_function): Likewise.
+ (start_method): Likewise.
+
+Thu Apr 9 00:18:44 1998 Dave Brolley (brolley@cygnus.com)
+
+ * lex.c (finput): New variable.
+ (init_cpp_parse): Renamed from init_parse.
+ (init_parse): Handle !USE_CPPLIB. Call init_cpp_parse when finished.
+ (finish_parse): New function.
+ * cp-tree.h (init_lex, init_parse): Remove declarations.
+
+Mon Apr 6 02:25:05 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_call): Still evaluate the actual argument.
+ * class.c (is_empty_class): Update for -fnew-abi.
+
+ * decl2.c: -fnew-abi implies -fsquangle.
+
+ * method.c (do_build_assign_ref): Don't do anything to copy
+ an empty class.
+ (do_build_copy_constructor): Likewise.
+ * call.c (build_over_call): Likewise.
+
+Sat Apr 4 18:43:58 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (avoid_overlap): Return a value.
+
+Sat Apr 4 12:52:35 1998 Jeffrey A Law (law@cygnus.com)
+
+ * method.c (check_btype): Add missing argument to xrealloc.
+ (check_ktype): Likewise.
+
+Fri Apr 3 02:22:59 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ Implement empty base optimization.
+ * class.c (finish_struct_1): Add vbase fields earlier. Set
+ CLASSTYPE_SIZE of an empty base to 0. Types with bases can be empty.
+ * search.c (dfs_check_overlap, dfs_no_overlap_yet): New fns.
+ (types_overlap_p): New fn.
+ * tree.c (avoid_overlap): New fn.
+ (build_base_fields): Use it to avoid overlapping empty bases.
+ * cp-tree.h, decl2.c, lang-options.h: Add -fnew-abi.
+
+ * decl.c (cplus_expand_expr_stmt): Strip unused INDIRECT_REFs.
+
+ Re-implement allocation of base class subobjects.
+ * tree.c (unshare_base_binfos): New fn.
+ (layout_basetypes): Use it. Now handles offsets of both virtual and
+ non-virtual bases, after layout_type.
+ (layout_vbasetypes): Remove.
+ (build_base_fields): Generate FIELD_DECLs for each non-virtual base.
+ (build_vbase_pointer_fields): Split out from old layout_basetypes.
+ * class.c (finish_base_struct): Lose offset handling code.
+ Move nonvdtor warning here. Don't mess with t_binfo anymore.
+ (finish_struct_1): Don't mess with t_binfo anymore. Use fns above.
+ * cp-tree.h: Adjust.
+
+Thu Apr 2 14:25:13 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h: Lose CLASSTYPE_VBASE_SIZE, some unused stuff.
+ * decl.c, decl2.c, pt.c, ptree.c, lex.c: Likewise.
+ * class.c (duplicate_tag_error): Likewise.
+ (finish_struct_1): Set CLASSTYPE_SIZE, CLASSTYPE_MODE, CLASSTYPE_ALIGN.
+ * tree.c (layout_vbasetypes): Update from layout_record, remove
+ var_size support, use CLASSTYPE_SIZE instead of CLASSTYPE_VBASE_SIZE.
+ (layout_basetypes): Likewise.
+
+Wed Apr 1 18:22:25 1998 Jeffrey A Law (law@cygnus.com)
+
+ * class.c, Make sure system.h is included just after config.h.
+ Delete lingering stdio and errno references too.
+ * decl.c, errfn.c, parse.y, ptree.c search.c, xref.c: Likewise.
+
+Wed Apr 1 15:38:36 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * friend.c (is_friend): Fix access control for local classes.
+
+ * class.c (is_empty_class): New fn.
+ * call.c (build_call): Don't pass empty class objects to a function.
+
+Wed Apr 1 14:58:35 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * call.c (build_over_call): Do name resolution for default
+ arguments of function templates in the scope of the templates.
+
+Tue Mar 31 13:43:57 1998 Jeffrey A Law (law@cygnus.com)
+
+ * call.c: Include system.h. Remove includes, declarations and
+ defines provided by system.h.
+ * class.c, cvt.c, decl.c, decl2.c, errfn.c error.c: Likewise.
+ * except.c, expr.c friend.c, g++spec.c, init.c, input.c: Likewise.
+ * lex.c, parse.y, pt.c, ptree.c repo.c rtti.c, search.c: Likewise.
+ * semantics.c, sig.c, spew.c, tree.c, typeck.c: Likewise.
+ * typeck2.c, xref.c: Likewise.
+ * Makefile.in: Dependencies updated as appropriate.
+ * Make-lang.in: Likewise.
+
+Mon Mar 30 12:15:00 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (fn_type_unification): Allow incomplete unification without
+ an immediate error message.
+
+Mon Mar 30 08:55:42 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (member_p): New fn.
+ * decl2.c (finish_file): Only set DECL_STATIC_FUNCTION_P for
+ initializing class members.
+
+ * cp-tree.def (TEMPLATE_PARM_INDEX): Class 'x'.
+ * ptree.c (lang_print_xnode): Handle TEMPLATE_PARM_INDEX.
+
+ * call.c (build_method_call): Handle non-scoped destructors, too.
+ * pt.c (tsubst_copy): Likewise.
+
+ * pt.c (print_template_context): Split out...
+ (push_tinst_level): ...from here.
+
+ * friend.c (is_friend): Don't pass a type to decl_function_context.
+
+ * typeck.c (convert_for_initialization): Always hand off
+ conversions to class type.
+
+Sun Mar 29 20:01:59 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * friend.c (is_friend): Local classes have the same access as the
+ enclosing function.
+
+Sun Mar 29 00:47:32 1998 Jeffrey A Law (law@cygnus.com)
+
+ * typeck.c (expand_target_expr): Delete dead function.
+
+ * search.c: Put various prototypes inside #ifdef MI_MATRIX.
+
+ * repo.c (save_string): Delete dead function.
+
+ * method.c (thunk_printable_name): Delete dead function.
+
+ * lex.c (yynextch): Delete dead function.
+
+ * expr.c (tree_extract_aggr_init): #if 0 out.
+
+ * except.c (do_unwind): Delete dead function.
+ (easy_expand_asm): Likewise.
+
+ * cvt.c (build_conversion_type_1): Delete dead function.
+
+ * cp-tree.h (push_expression_obstack): Declare.
+
+ * call.c (source_type): #if 0 out.
+
+ * class.c (alter_access): Remove unused label. Add braces
+ around empty else clause.
+
+ * lex.c (yyprint): Fix argument to printf.
+
+Sat Mar 28 17:43:52 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (tsubst): Clear TREE_USED for new FUNCTION_DECLs.
+
+ * pt.c (instantiate_class_template): Make sure template
+ arguments are permanent.
+ * init.c (resolve_offset_ref): Don't go looking around in
+ template types.
+
+ * semantics.c: Add routines to handle expressions, and some
+ declaration processing.
+ * parse.y: Use them.
+ (current_class_depth): Move declaration to cp-tree.h.
+ * parse.c: Regenerated.
+ * cp-tree.h: Use them.
+ (current_class_depth): Declare.
+ * pt.c (tsubst_copy): Use begin_stmt_expr and finish_stmt_expr.
+
+Fri Mar 27 20:23:18 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * error.c (dump_decl): Be a bit more explicit with template
+ type arguments, when verbose.
+
+Fri Mar 27 18:16:40 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * inc/exception: Reorder closing braces.
+
+Fri Mar 27 13:22:18 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (redeclare_class_template): New function.
+ * cp_tree.h (redeclare_class_template): Declare it.
+ * decl.c (xref_tag): Use it.
+
+Thu Mar 26 11:16:30 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_over_call): Check IS_AGGR_TYPE, not
+ TYPE_LANG_SPECIFIC.
+ * typeck.c (convert_arguments): Likewise.
+
+ * decl.c (grokdeclarator): Remove const and volatile from type after
+ setting constp and volatilep.
+
+ * class.c (finish_struct_1): Don't warn about bool bitfield larger
+ than one bit.
+
+Thu Mar 26 10:25:52 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (convert_nontype_argument): STRIP_NOPS where appropriate.
+
+Thu Mar 26 10:24:05 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * call.c (build_object_call): Complain about ambiguous operator(),
+ rather that crashing.
+ (build_new_op): Likewise.
+ (build_op_delete_call): Likewise.
+
+Thu Mar 26 10:23:24 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * cvt.c (perform_qualification_conversions): Use comp_target_types
+ instead of comp_ptr_ttypes.
+
+Wed Mar 25 16:10:50 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * cp-tree.h (enforce_access): Declare.
+ * call.c (enforce_access): Make it extern, not static.
+ * class.c (alter_access): Use enforce_access; modify code for ISO
+ compliance, rather than ARM rules.
+
+Wed Mar 25 12:10:45 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
+
+ * cp-tree.h: Fix typo.
+
+Wed Mar 25 02:01:02 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * expr.c (cplus_expand_expr): Only do PCC_STATIC_STRUCT_RETURN thing
+ if (aggregate_value_p (type)).
+
+ * decl2.c (constructor_name_full): Handle TYPENAME_TYPE.
+
+Tue Mar 24 16:12:01 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * tree.c (mapcar): When dealing with a DECL, use it's constant
+ value, if any.
+ * pt.c (lookup_template_class): Don't mangle the names of template
+ classes whose arguments are unknown.
+
+ * pt.c (tsubst_expr): Handle GOTO_STMT correctly.
+
+Tue Mar 24 12:21:55 1998 Benjamin Kosnik <bkoz@lisa.cygnus.com>
+
+ * decl.c (init_decl_processing): Set TYPE_PRECISON for bools to 1.
+
+Tue Mar 24 12:21:48 1998 Jim Wilson <wilson@cygnus.com>
+
+ * decl.c (init_decl_processing): Initialize TYPE_MAX_VALUE for
+ boolean_type_node to 1.
+
+Tue Mar 24 10:23:47 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * error.c (dump_expr): Remove unused variable `l'.
+
+ * pt.c (for_each_template_parm): New function, created by
+ converting uses_template_parms.
+ (tree_fn_t): New typedef.
+ (uses_template_parms): Use it.
+ (mark_template_parm): New function.
+ (push_template_decl): Check that the argument list of a partial
+ specialization uses all the template parameters.
+
+ * Make-lang.in (c++filt): Don't delete cxxmain.c after we're done
+ with it; we might want it for debugging.
+ * cp-tree.h (type_unification): Change interface.
+ * class.c (finish_struct_1): Skip nested template types, just like
+ ordinary nested types.
+ (instantiate_type): Use new interface to type_unification.
+ * lex.c (init_lex): Add __sz as opname for sizeof.
+ * method.c (build_overload_scope_ref): New function.
+ (build_overload_int): Handle complex expressions. Set
+ numeric_output_need_bar if necessary.
+ (build_overload_value): Handle non-PARM_DECL nodes; this
+ routine is now used by build_overload_int. Remove some
+ assignments to numeric_output_need_bar. Use
+ build_overload_scope_ref.
+ (build_qualified_name): Note that some template mangled names end
+ with digits, and set numeric_output_need_bar appropriately. Use
+ build_underscore_int.
+ * pt.c (unify): Change interface.
+ (type_unification_real): Likewise.
+ (determine_specialization): Use new interfaces.
+ (tsubst): Deal gracefully with situations in which the argument
+ vector is not fully filled.
+ (fn_type_unification): Use new interfaces.
+ (type_unification): Likewise. Remove NOP_EXPR hack.
+ (type_unification_real): Likewise.
+ (unify): Likewise. Deal with unification of complex expressions.
+
+Mon Mar 23 12:24:37 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (complete_template_args): Initialize skip properly.
+
+ * decl.c (make_typename_type): Revert.
+ (make_implicit_typename): Remove.
+ (lookup_name_real): Don't call it. Call lookup_field if we see a
+ TYPE_DECL from a template base.
+ * search.c (lookup_field): Do implicit typename stuff.
+
+Sun Mar 22 00:50:42 1998 Nick Clifton <nickc@cygnus.com>
+ Geoff Noer <noer@cygnus.com>
+
+ * Makefile.in: Various fixes for building cygwin32 native toolchains.
+ * Make-lang.in: Likewise.
+
+Fri Mar 20 18:07:39 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
+
+ * pt.c (tsubst, TEMPLATE_TEMPLATE_PARM): Simplify.
+
+Fri Mar 20 10:42:07 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (make_implicit_typename): Rewrite removed code.
+ (make_typename_type): Call it if the type we look up comes from
+ a base that uses template parms.
+
+ * pt.c (complete_template_args): Rewrite.
+ (tsubst, FUNCTION_DECL): Use it.
+
+Fri Mar 20 08:12:43 1998 H.J. Lu (hjl@gnu.org)
+
+ * semantics.c (finish_asm_stmt): Fix combine strings. Call
+ c_expand_asm_operands () if output_operands, input_operands or
+ clobbers is not NULL_TREE.
+
+Fri Mar 20 00:10:19 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
+
+ * pt.c (complete_template_args): New function.
+ (get_bindings): Deal with specializations of function templates
+ with return type containing parameters from outer class
+ templates.
+ (tsubst, TEMPLATE_TEMPLATE_PARM): When reducing parameter level,
+ substitute arguments and compose a new type.
+
+Thu Mar 19 19:01:48 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (tsubst): Clear DECL_PENDING_INLINE_INFO for new
+ FUNCTION_DECLs.
+
+Thu Mar 19 11:51:58 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (make_implicit_typename): Lose useless code.
+
+ * call.c (standard_conversion): Handle A* -> const A* properly.
+
+ * pt.c (get_bindings_real): Rename from get_bindings. Add
+ check_rettype parm.
+ (get_bindings): Pass 1.
+ (get_bindings_overload): Pass 0.
+
+Wed Mar 19 09:08:12 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (check_explicit_specialization): When reverting a static
+ member function, also remove the `this' parameter from
+ last_function_parms.
+
+Thu Mar 19 02:27:48 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst_copy, CONST_DECL): Don't bother tsubsting
+ a function context.
+
+ * decl.c (store_bindings): Use free_binding_vecs.
+ (pop_from_top_level): Likewise.
+
+Wed Mar 18 12:41:43 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (make_implicit_typename): Only change the type of a
+ TYPENAME_TYPE.
+
+Wed Mar 18 10:09:51 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * semantics.c: New file, containing routines to perform the
+ semantic phase of parsing.
+ * parse.y: Use it.
+ * pt.c (tsubst_expr): Likewise.
+ * cp-tree.h: Declare the various functions in semantics.c.
+ Provide macros to access _STMT tree nodes.
+ * cp-tree.def: Add ASM_STMT tree node.
+ * Makefile.in, Make-lang.in: Add dependencies on and for
+ semantics.c.
+
+Wed Mar 18 00:24:10 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (push_template_decl): Only check primary templates.
+
+ * pt.c (check_explicit_specialization): Complain about default args
+ in explicit specialization.
+
+ * parse.y (nomods_initdcl0): Also call cp_finish_decl for a
+ constructor_declarator.
+
+Tue Mar 17 14:44:54 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * typeck2.c (build_x_arrow): Don't crash when an aggregate type
+ has no overloaded operator ->.
+
+ * call.c (build_field_call): Don't crash when presented with a
+ field that is actually a nested type.
+
+ * decl.c (pushtag): Deal with friend class injection in local
+ classes.
+
+ * call.c (build_object_call): Don't crash if OBJ is a
+ pointer-to-member-function.
+
+Tue Mar 17 11:40:26 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (push_template_decl): Complain about template with C linkage,
+ anonymous template class.
+
+Mon Mar 16 12:10:39 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (pushclass): Only use the mi_matrix stuff #ifdef MI_MATRIX.
+ * search.c: Likewise.
+
+ * lex.c (do_pending_defargs): Only call
+ maybe_{begin,end}_member_template_processing for FUNCTION_DECLs.
+
+ * parse.y (initdcl0_innards): Move maybeasm back into initdcl0 et al.
+
+Mon Mar 16 10:47:22 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * parse.y: Deal with CONSTRUCTORS in new_initializers.
+
+Mon Mar 16 10:54:21 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (tsubst_copy): Deal with BIND_EXPR in a way that more
+ closely mimics the behavior in parse.y.
+ (tsubst_expr): Return the resulting BLOCK when making a tsubst'ing
+ into a compound statement.
+
+Sun Mar 15 02:07:26 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (TEMPLATE_PARMS_FOR_INLINE): New macro.
+ * pt.c (inline_needs_template_parms): New fn.
+ (original_template): New fn.
+ (push_inline_template_parms_recursive): New fn.
+ (maybe_begin_member_template_processing): Use them.
+ (maybe_end_member_template_processing): Likewise.
+ (is_member_or_friend_template): Rename to is_member_template.
+ Member functions of local classes are never member templates.
+
+Sun Mar 15 01:14:22 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
+
+ * lex.c (do_identifier): Handle TEMPLATE_DECL that was
+ added in the class scope to catch redefinition error.
+
+ * pt.c (reduce_template_parm_level): Also copy
+ the DECL_TEMPLATE_PARMS field.
+
+Sun Mar 15 10:54:08 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (tsubst): Clear TYPE_REFERENCE_TO when creating a
+ reduced-level template type parameter.
+
+Sun Mar 15 12:26:02 1998 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * cp-tree.h (struct lang_decl_flags): Add needs_final_overrider.
+ (DECL_NEEDS_FINAL_OVERRIDER_P): New macro.
+ * class.c (override_one_vtable): Set DECL_NEEDS_FINAL_OVERRIDER_P.
+ * decl.c (duplicate_decls): Propagate it.
+ * typeck2.c (abstract_virtuals_error): Use two loops to emit
+ abstract virtual functions and virtual functions which need a
+ final overrider separately.
+
+Thu Mar 12 09:39:40 1998 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * lang-specs.h: Properly put brackets around array elements in
+ initializer.
+
+ * typeck.c (build_binary_op_nodefault): Correctly place parens around
+ && and || in expression.
+
+Thu Mar 12 09:26:04 1998 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * call.c (default_parm_conversions): Remove prototype definition.
+ (build_method_call): Remove unused variable result.
+
+ * cvt.c (ocp_convert): Remove unused variable conversion.
+
+ * decl2.c (ambiguous_decl): Add explicit parameter definition for name.
+
+ * except.c (do_unwind): #if 0 definition of unused variables fcall
+ and next_pc.
+
+ * expr.c (extract_scalar_init): #if 0 prototype and function
+ definition.
+
+ * init.c (expand_aggr_init_1): Remove unused variable init_type.
+ (build_new_1): Remove unused variable t.
+
+ * pt.c (instantiate_class_template): Remove unused variable newtag;
+ cast called function return value to void.
+ (do_decl_instantiation): Remove unused variables name and fn.
+
+ * tree.c (get_type_decl): Add default return to shut up compiler from
+ complaining control reaches end of non-void function.
+
+ * typeck.c (build_x_conditional_expr): Remove unused variable rval.
+
+Thu Mar 12 09:12:15 1998 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * call.c (default_parm_conversions): Remove prototype definition.
+ (build_method_call): Remove unused variable result.
+ (build_over_call): Add default case in enumeration switch.
+
+Thu Mar 12 08:39:13 1998 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * decl2.c (lang_decode_option): Change j's type to size_t.
+
+ * tree.c (layout_vbasetypes): record_align and desired_align are of
+ type unsigned int; const_size and nonvirtual_const_size likewise.
+
+Wed Mar 11 07:25:20 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * parse.y (new_initializer): Make sure all initializers are
+ lists.
+
+Tue Mar 10 07:32:36 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * decl2.c (import_export_decl): Mark tinfo functions for
+ cv-qualified versions of class types as DECL_NOT_REALLY_EXTERN.
+
+Fri Mar 6 23:27:35 1998 Jeffrey A Law (law@cygnus.com)
+
+ * method.c: Fix typo.
+
+Fri Mar 6 10:06:59 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * method.c: Include "system.h" to get stdlib.h, stdio.h,
+ ctype.h, string.h, etc.
+ (issue_nrepeats): Add default case in enumeration switch.
+ (check_btype): Likewise.
+ (process_overload_item): Likewise.
+
+ * Makefile.in (method.o): Depend on system.h.
+
+Wed Mar 4 22:26:53 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * lex.c (do_scoped_id): Fix parenthesizing.
+
+Wed Mar 4 12:11:53 1998 Michael Tiemann <tiemann@axon.cygnus.com>
+
+ * rtti.c (get_tinfo_fn_dynamic): If this function is called an
+ FLAG_RTTI is unset, initialize type info machinery and continue
+ with FLAG_RTTI enabled.
+ (get_typeid): Likewise.
+
+Wed Mar 4 11:47:55 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (unary_complex_lvalue): &D::i has type B::* if i comes
+ from B.
+
+Wed Mar 4 11:28:08 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (finish_member_template_decl): Deal more gracefully with
+ invalid declarations.
+
+Tue Mar 3 01:38:17 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c, decl.c, decl2.c, init.c, rtti.c, typeck.c, typeck2.c,
+ cp-tree.h: Clean up more old overloading code, old RTTI code, and
+ some formatting quirks.
+
+ * call.c, class.c, cp-tree.h, cvt.c, decl.c, init.c, lex.c,
+ method.c, pt.c, ptree.c, typeck.c: Remove support for
+ -fno-ansi-overloading and overloading METHOD_CALL_EXPR.
+ * class.h: Remove.
+ * Makefile.in: Adjust.
+
+ * pt.c (unify): Don't allow reduced cv-quals when strict.
+
+ * call.c, class.c, pt.c, cp-tree.h: Remove nsubsts parm from
+ *type_unification* and unify.
+
+Mon Mar 2 12:11:06 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (explicit_template_type): Remove TEMPLATE keyword.
+ (nested_name_specifier): And add it before this use.
+ (typename_sub0): And this use. Also add use without the keyword.
+ (typename_sub1): Likewise.
+ * pt.c (instantiate_class_template): Don't actually instantiate
+ anything if our type uses template parms.
+
+Mon Mar 2 11:04:59 1998 Jim Wilson <wilson@cygnus.com>
+
+ * decl.c (start_function): Don't call temporary_allocation for a
+ nested function.
+
+Sun Mar 1 21:06:37 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_class_template): Don't mess with friends if
+ our type uses template parms.
+
+Sat Feb 28 12:06:44 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (nested_name_specifier): Use explicit_template_type.
+ (typename_sub): Allow a template_type, an explicit_template_type,
+ or an implicit template type at the end.
+ * lex.c (yyprint): Handle a PTYPENAME being a TEMPLATE_DECL.
+ * decl.c (make_typename_type): Handle template-id where the name
+ is a TEMPLATE_DECL.
+ * call.c (build_scoped_method_call): Handle member template
+ destructor call.
+ * pt.c (tsubst_copy, METHOD_CALL_EXPR): Don't assume a member
+ destructor is represented by the type.
+
+ * cp-tree.h (TYPENAME_TYPE_FULLNAME): New macro.
+ * parse.y (nested_name_specifier): Add 'template' case.
+ (explicit_template_type): New rule.
+ (typename_sub): Use it.
+ * decl.c (make_typename_type): Handle getting a template-id for NAME.
+ * pt.c (tsubst): Likewise.
+
+Fri Feb 27 11:17:50 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (add_to_template_args): Fix thinko.
+ (instantiate_class_template): Call it later.
+
+ * pt.c (get_class_bindings): Add outer_args parm.
+ (most_specialized_class): Likewise.
+ (instantiate_class_template): Pass it.
+ (more_specialized_class): Likewise.
+ (lookup_template_class): Get context from template if none
+ was specified.
+ (finish_member_template_decl): Don't do anything with a
+ partial specialization.
+ * decl2.c (check_member_template): Use IS_AGGR_TYPE instead of
+ AGGREGATE_TYPE_P.
+ * class.c (finish_struct): Member class templates have already been
+ checked for name clashes.
+ * decl.c (pushdecl_with_scope): Handle pushing at class level.
+
+Fri Feb 27 02:25:16 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst, TEMPLATE_DECL): Support member class templates.
+ (tsubst, *_PARM): Support multiple levels of template classes.
+ (instantiate_class_template): Look up the pattern from the
+ original template.
+ (lookup_template_class): Handle getting a template for d1.
+ (push_template_decl): Correct setting of 'primary'.
+ (reduce_template_parm_level): Add 'levels' parm.
+ (finish_member_template_decl): Support member class templates.
+ (template_class_depth): Handle multiple levels.
+ * parse.y (component_decl_1, fn.def2): Remove member template case.
+ (component_decl): Add member template cases.
+ * decl2.c (check_member_template): We now handle member template
+ classes.
+ * decl.c (pushtag): Handle member templates.
+ * method.c (do_inline_function_hair): Don't touch
+ IDENTIFIER_GLOBAL_VALUE.
+ * init.c (build_offset_ref): If name isn't an identifier, just
+ return it.
+ * spew.c (yylex): Handle PTYPENAME like TYPENAME.
+
+ * typeck.c (get_delta_difference): Do adjust for conversions to
+ and from virtual base.
+
+Wed Feb 25 09:51:29 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (get_delta_difference): Give hard error for conversion
+ from virtual base.
+
+ * cp-tree.h: Tweak formatting.
+
+Wed Feb 25 00:35:33 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (push_namespace): Handle redeclaration error.
+
+ * cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro.
+ (IDENTIFIER_NAMESPACE_BINDINGS): New macro.
+ (NAMESPACE_BINDING): New macro.
+ (IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING.
+ * *.c: Use them.
+
+ * pt.c (push_template_decl): Use innermost_args.
+
+ * decl.c (get_unique_name): Tweak from earlier in the name.
+
+Tue Feb 24 22:15:04 1998 Martin von Loewis <loewis@informatik.hu-berlin.de>
+
+ * cp-tree.def: Add CPLUS_BINDING node.
+ * cp-tree.h (tree_binding): New struct.
+ (BINDING_SCOPE, BINDING_VALUE): New macros.
+ (current_namespace, global_namespace): Declare extern.
+ (struct lang_decl_flags): New field in_namespace.
+ (DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): New macros.
+ (DECL_NAMESPACE, SET_DECL_NAMESPACE): New macros.
+ (TREE_INDIRECT_USING): New macro.
+ * decl2.c (current_namespace, global_namespace): Declare. The
+ value is a NAMESPACE_DECL now, not a TREE_LIST.
+ (is_namespace_ancestor, namespace_ancestor): New static functions.
+ (add_using_namespace, ambiguous_decl): Likewise.
+ (lookup_using_namespace): New support function for lookup_name.
+ (qualified_lookup_using_namespace): New support function for
+ do_scoped_id and lookup_namespace_name.
+ (get_namespace_id): Mark as obsolete.
+ (current_namespace_id): Likewise.
+ (do_namespace_alias): Implement.
+ (do_using_directive): Implement as call to add_using_namespace.
+ * decl.c (binding_for_name): New function.
+ (push_namespace, pop_namespace): Implement.
+ (push_decl): Don't install a FUNCTION_DECL in the global branch.
+ (lookup_namespace_name): Implement using qualified lookup.
+ (lookup_name_real): For global scoping, lookup in
+ global_namespace. For namespace scoping, lookup in given
+ namespace. For unscoped lookup, iterate over namespace,
+ considering using directives.
+ (init_decl_processing): Initialize global_namespace.
+ (grokvardecl): Build assembler name as static name for globals.
+ (grokdeclarator): Remove old namespace mangling.
+ (xref_tag): When installing a global binding for the
+ tag, make sure we have an identifier.
+ * method.c (build_overload_nested_name): Mangle namespaces.
+ (build_qualified_name): Likewise.
+ (build_decl_overload_real): Likewise.
+ * lex.c (build_lang_decl): Set namespace for new declaration to
+ current_namespace.
+ (do_scoped_id): Find global names in global or current
+ namespace, or using qualified namespace lookup, depending on
+ context.
+ * init.c (build_member_call): When scope is namespace, use
+ build_x_function_call instead.
+ (build_offset_ref): When scope is namespace, collapse processing
+ to lookup_namespace_name instead.
+ * error.c (dump_decl): Support NAMESPACE_DECL.
+ * decl.c (pushdecl): Bind globals to current namespace.
+ (push_overloaded_decl): Likewise.
+ (lookup_tag): Likewise.
+ (lookup_name_current_level): Likewise.
+ (xref_tag): Likewise.
+ (start_function): Likewise.
+ * lex.c (do_identifier): Likewise.
+ (identifier_typedecl_value): Likewise.
+ (real_yylex): Likewise.
+ * method.c (do_inline_function_hair): Likewise.
+ * parse.y (unscoped): Likewise.
+ * pt.c (check_explicit_specialization): Likewise.
+ (lookup_template_class): Likewise.
+ * rtti.c (call_void_fn): Likewise.
+ * sig.c (build_sigtable): Likewise.
+ * ptree.c (lang_print_xnode): New function.
+
+Tue Feb 24 01:40:24 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_class_template): Don't instantiate if pedantic
+ and the args use template parms.
+
+ * pt.c (push_tinst_level): If the instantiation uses template parms,
+ fail silently.
+ * decl.c (xref_basetypes): Do call complete_type for basetypes
+ that involve template parameters.
+
+Tue Feb 24 00:36:43 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck2.c (process_init_constructor): Fix labeled init check.
+
+Mon Feb 23 05:08:55 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c, call.c, decl.c, method.c, cp-tree.h: Remove unused NARGS
+ argument to tsubst and friends.
+
+ * pt.c (tsubst, FUNCTION_DECL): Tidy.
+
+ * typeck.c (build_x_function_call): Handle static member function
+ templates like non-templates. Handle friend templates like normal
+ function templates.
+ * pt.c (tsubst, *_PARM): Don't use orig_level.
+ (get_bindings): Don't call add_to_template_args.
+ (instantiate_template): Likewise.
+ (tsubst, FUNCTION_DECL): Call add_to_template_args as appropriate.
+ * ptree.c (print_lang_type): Print index/level for template parms.
+
+Mon Feb 23 02:52:29 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * Make-lang.in (cc1plus): Note that cc1plus depends on
+ cp/cp-tree.h and cp/cp-tree.def.
+
+ * cp-tree.def (TEMPLATE_CONST_PARM): Remove.
+ (TEMPLATE_PARM_INDEX): New tree code, used to indicate a
+ position in a template parameter list.
+ * cp-tree.h (template_parm_index): New structure, used as the tree
+ structure for a TEMPLATE_PARM_INDEX.
+ (TEMPLATE_PARM_IDX): New macro.
+ (TEMPLATE_PARM_LEVEL): Likewise.
+ (TEMPLATE_PARM_DESCENDANTS): Likewise.
+ (TEMPLATE_PARM_ORIG_LEVEL): Likewise.
+ (TEMPLATE_PARM_DECL): Likewise.
+ (TEMPLATE_TYPE_PARM_INDEX): Likewise.
+ (TEMPLATE_TYPE_ORIG_LEVEL): Likewise.
+ (TEMPLATE_TYPE_DECL): Likewise.
+ (TEMPLATE_CONST_IDX): Remove.
+ (TEMPLATE_CONST_LEVEL): Likewise.
+ (TEMPLATE_CONST_SET_INFO): Likewise.
+ (TEMPLATE_TYPE_SET_INFO): Likewise.
+ (TEMPLATE_TYPE_IDX): Redefine in terms of TEMPLATE_PARM_INDEX
+ node.
+ (TEMPLATE_TYPE_LEVEL): Likewise.
+ * decl.c (decls_match): Call comp_template_parms, rather than
+ expanding it inline.
+ (duplicate_decls): If two template declarations are being merged,
+ then their TEMPLATE_INFOs should be merged as well.
+ (grokfndecl): Save template-id information when declaring a friend
+ with explicit template arguments. Pass arguments to
+ check_explicit_specialization via correct convention; at some
+ point check_explicit_specialization changed, but these call-sites
+ did not.
+ (grokdeclarator): Tidy up slightly.
+ * decl2.c (check_classfn): Tidy up slightly. Don't assume that
+ two template functions with the same DECL_ASSEMBLER_NAME the same,
+ since the names are not yet mangled.
+ * error.c (dump_decl): Use TEMPLATE_PARM_INDEX instead of
+ TEMPLATE_CONST_PARM.
+ (dump_expr): Likewise. Use the TEMPLATE_PARM_DECL to get at the
+ decl for a non-type parameter, rather than printing `<tparm ...>'.
+ * friend.c (is_friend): Handle TEMPLATE_DECL friends.
+ (do_friend): Deal with template friends.
+ * lex.c (do_pending_inlines): Call
+ maybe_begin_member_template_processing, rather than
+ conditionally calling begin_member_template_processing.
+ (process_next_inline): Likewise. Call
+ maybe_end_member_template_processing, rather than
+ conditionally calling end_member_template_processing.
+ (do_pending_defargs): Likewise.
+ (do_identifier): Use TEMPLATE_PARM_INDEX instead of
+ TEMPLATE_CONST_PARM.
+ * method.c (build_mangled_template_parm_index): New function.
+ (build_overload_value): Use it.
+ (build_overload_name): Likewise.
+ * pt.c (finish_member_template_decl): Allow friend declarations.
+ (template_class_depth): New function.
+ (is_member_template): Rename, and modify, to become...
+ (is_member_or_friend_template): New function.
+ (end_member_template_processing): Rename, and modify, to become...
+ (maybe_end_member_template_processing).
+ (build_template_parm_index): New function.
+ (reduce_template_parm_level): New function.
+ (process_template_parm): Modify to use build_template_parm_index.
+ (push_template_decl): Deal with friend templates.
+ (uses_template_parms): Use TEMPLATE_PARM_INDEX instead of
+ TEMPLATE_CONST_PARM.
+ (tsubst_friend_function): New function.
+ (instantiate_class_template): Generate the DECL_FRIENDLIST
+ for a new instantiation by using tsubst_friend_function rather
+ than just tsubst.
+ (tsubst): Don't tsubst into a type which is a TEMPLATE_DECL.
+ Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM, and the
+ appropriate new macros. Use reduce_template_parm_level to
+ generate lower-level template parameters. Handle tsubst'ing into
+ TEMPLATE_DECLS that declare TEMPLATE_TEMPLATE_PARMS. Don't forget
+ to tsubst the DECL_CONTEXT and DECL_CLASS_CONTEXT of newly created
+ templates. Similarly for the template parameters for a new
+ template.
+ (tsubst_copy): Tidy up slightly. Use TEMPLATE_PARM_INDEX instead
+ of TEMPLATE_CONST_PARM. Handle TYPE_DECLs by tsubsting into them.
+ (unify): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM.
+ (get_bindings): Call add_to_template_args if necessary.
+ (instantiate_decl): Handle instantiations of friend templates.
+ * search.c (lookup_field_1): Don't treat the TYPE_FIELDS of a
+ TEMPLATE_TYPE_PARM as a list of fields; it's not!
+ * spew.c (yylex): Do a little manual constant propagation to
+ clarify the code.
+
+Sun Feb 22 19:53:29 1998 Jeffrey A Law (law@cygnus.com)
+
+ * error.c: Include sys/types.h.
+
+Thu Feb 19 14:49:09 1998 Jeffrey A Law (law@cygnus.com)
+
+ * method.c (build_mangled_name): Start CPP directives in column zero.
+
+Thu Feb 19 10:36:48 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck2.c (process_init_constructor): Sorry about non-trivial
+ labeled initializers.
+ * parse.y (initlist): Re-enable labeled initializers.
+
+Thu Feb 19 10:15:55 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
+
+ * pt.c (coerce_template_parms): Add a new parameter, is_tmpl_parm,
+ all callers changed. Rely on the new parameter instead of arg
+ being a TREE_LIST when determine whether we are working inside
+ template template parameter. Clean up is_type test.
+
+Thu Feb 19 10:04:12 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (cp_convert_to_pointer): Preserve TREE_CONSTANT.
+ * typeck2.c (initializer_constant_valid_p): Allow conversions
+ between pointers and references.
+
+1998-02-19 Brendan Kehoe <brendan@cygnus.com>
+
+ * typeck.c (build_unary_op): Only warn about incr/decr a pointer
+ if pedantic || warn_pointer_arith.
+
+Thu Feb 19 09:37:21 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
+
+ * pt.c (unify): Handle TEMPLATE_DECL.
+
+1998-02-18 Brendan Kehoe <brendan@cygnus.com>
+
+ * cp-tree.h (strip_attrs): Remove decl.
+
+1998-02-18 Doug Evans <devans@cygnus.com>
+
+ * decl.c (duplicate_decls): Call merge_machine_decl_attributes.
+ Update olddecl's attributes too.
+ (strip_attrs): Remove function.
+ * typeck.c (common_type): Call merge_machine_type_attributes.
+
+Tue Feb 17 14:07:52 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * parse.y (initdcl0_innards): New grammar symbol.
+ (nomods_initdecls, nomods_initdcl0): Change type from itype to
+ none, since the resulting value is never used.
+ (parse_decl): New function.
+ (datadef): Remove redundant actions.
+ (initdcl0, notype_initdcl0, nomods_initdcl0): Use initdcl0_innards.
+ * parse.c: Regenerated.
+
+Tue Feb 17 11:54:16 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (simple_stmt): Use getdecls() to check for decl.
+
+Sat Feb 14 11:50:51 1998 Manfred Hollstein <manfred@s-direktnet.de>
+
+ * Make-lang.in (DEMANGLER_INSTALL_NAME, DEMANGLER_CROSS_NAME): New
+ macros.
+ (c++.install-common): Install c++filt properly as native or as cross
+ variant.
+ (c++.uninstall): Add c++filt.
+
+Fri Feb 13 14:55:37 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (standard_conversion): Fix multi-level ptr conversions.
+
+Fri Feb 13 14:06:22 1998 Mike Stump <mrs@wrs.com>
+
+ * init.c (build_new): Propagate error_mark_node up.
+
+Fri Feb 13 13:24:32 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (simple_stmt): If the condition isn't a declaration,
+ start the controlled block after the test.
+
+Fri Feb 13 02:26:10 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * call.c (build_over_call): Convert builtin abs, labs and fabs to
+ tree-codes.
+ * decl.c (init_decl_processing): Re-enable abs, labs and fabs as
+ builtins.
+
+Fri Feb 13 01:36:42 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (standard_conversion): A BASE_CONV replaces an RVALUE_CONV.
+
+Fri Feb 13 00:21:59 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h: Add access_protected_virtual_node.
+ * class.c (init_class_processing): Initialize it.
+ * decl.c (xref_basetypes): Use it.
+ * parse.y (base_class_access_list): Likewise.
+
+ * Make-lang.in (DEMANGLER_PROG): Add $(exeext).
+ (c++.install-common): Install c++filt.
+
+Thu Feb 12 12:46:51 1998 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * decl.c (shadow_tag): Give error for typedef-ing built-in types.
+
+Wed Feb 11 23:28:05 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * call.c (reference_binding): Use comptypes when comparing
+ TYPE_MAIN_VARIANTS to handle non-canonical array/index types.
+
+Wed Feb 11 16:42:04 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * tree.c (is_overloaded_fn): Use really_overloaded_fn.
+ (really_overloaded_fn): Move check here from is_overloaded_fn.
+ (get_first_fn): Use really_overloaded_fn and is_overloaded_fn.
+
+Wed Feb 11 15:54:18 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * typeck.c (build_ptrmemfunc): Type-check pointer-to-member
+ conversions.
+
+Mon Feb 9 22:23:31 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * cp-tree.h (push_template_decl): Return the decl passed in, or an
+ equivalent duplicate.
+ * decl.c (pushtag): Use the return value from push_template_decl.
+ (duplicate_decls): When duplicating a template declaration, merge
+ the DECL_TEMPLATE_RESULTs as well.
+ (make_implicit_typename): Don't try to dive into typename types to
+ find a context for making a new implicit typename.
+ (start_decl): Use the return value from push_template_decl.
+ (grokdeclarator): Complain about declarations list `const operator
+ int'. Since we don't correctly handle in-class initializations of
+ non-static data members, complain about this (now illegal)
+ practice. Issue an error for initializations of non-const statics
+ since that is illegal as well, and since we don't handle that case
+ correctly either.
+ (start_function): Use the return value from push_template_decl.
+ (start_method): Likewise.
+ * decl2.c (grokfield): Likewise. Since the change to
+ grokdeclarator ensures that all initialized fields are in fact
+ static, remove a redundant test for TREE_PUBLIC.
+ * parse.y (initlist): Disable labeled initializers since they do
+ not work as per the documentation, and since they do not use the
+ same syntax as the C front end.
+ * pt.c (push_template_decl): Return the decl passed in, or an
+ equivalent duplicate.
+ (lookup_template_class): When searching in a nested context,
+ use the right arguments.
+ (uses_template_parms): Handle the DECL_INITIAL for a CONST_DECL.
+ * typeck.c (build_component_ref): Assign the correct type to the
+ result of build_vfn_ref.
+
+Tue Feb 10 23:56:46 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (convert_nontype_argument): Fix typo.
+ (check_explicit_specialization): Allow old-style specialization
+ of class template members.
+
+Tue Feb 10 20:36:52 1998 Jason Merrill <jason@yorick.cygnus.com>
+ Manfred Hollstein <manfred@s-direktnet.de>
+
+ * decl.c (grokdeclarator): Use DECL_USE_TEMPLATE instead
+ when deciding to override DECL_ASSEMBLER_NAME.
+
+Tue Feb 10 15:30:55 1998 Andrew MacLeod <amacleod@torpedo.to.cygnus.com>
+
+ * decl2.c (lang_f_options): Add -fsquangle to option processing list.
+ * cp-tree.h (flag_do_squangling): Add declaration.
+ * lang-options.h: Add -fsquangle and -fno-squangle.
+ * method.c: Add macros and static variables for squangling.
+ (build_overload_name): Rename to build_mangled_name, add logic for B
+ compression, and split into process_modifiers and
+ process_overload_item.
+ (process_modifiers): New function, to handle constant, reference,
+ and pointer types.
+ (process_overload_item): New function, handles issue of type codes.
+ (build_overload_name): New function, start squangling and call
+ build_mangled_name.
+ (ALLOCATE_TYPEVEC, DEALLOCATE_TYPEVEC): Remove macro and expand inline.
+ (start_squangling): New function to initialize squangling structs.
+ (end_squangling): New function to destroy squangling structs.
+ (nrepeats): Rename variable to Nrepeats.
+ (issue_nrepeats): New function for issuing 'n' type repeats.
+ (check_ktype): New function to check for type K name compression.
+ (build_overload_nested_name): Add a check for K name compression.
+ (build_qualified_name): Add a check for K name compression and don't
+ use DECL_ASSEMBLER_NAME when squangling is on.
+ (check_btype): New function, checks for B type compression.
+ (build_static_name, build_decl_overload_real): Initiate squangling.
+ (build_typename_overload, build_overload_with_type): Initiate
+ squangling
+
+Sun Feb 8 23:47:38 1998 scott snyder <sss@d0linux01.fnal.gov>
+
+ * method.c (make_thunk): Avoid name buffer overflow.
+
+Sat Feb 7 16:48:54 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_decl): Call cp_finish_decl for vars even if we
+ don't define them yet.
+
+ * parse.y (nomods_initdcl0): Add constructor_declarator case.
+
+Fri Feb 6 21:32:25 1998 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * config-lang.in (diff_excludes): Use basename only.
+
+Thu Feb 5 19:10:40 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tinfo2.cc: Add tinfo for signed char.
+
+Thu Feb 5 14:38:23 1998 Mike Stump <mrs@wrs.com>
+
+ * search.c (compute_access): Handle protected constructors in derived
+ classes as accessible.
+
+Wed Feb 4 01:26:49 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * expr.c (cplus_expand_expr, PCC_STATIC_STRUCT_RETURN code):
+ Call convert_from_reference sooner.
+
+Tue Feb 3 23:50:52 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * cvt.c (ocp_convert): Obtain the constant values from constant
+ decls even if the destination type is the same as the type of the
+ decl.
+
+ * decl2.c (finish_file): Make sure that static inlines with
+ definitions are not marked DECL_EXTERNAL before returning.
+
+Tue Feb 3 22:43:42 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c: Lose arg_looking_for_template.
+ (lookup_name_real): Likewise.
+ * parse.y: Lose processing_template_arg, template_arg1.
+ (primary): Likewise.
+ * spew.c (yylex): Set lastiddecl for PTYPENAMEs, too.
+
+Tue Feb 3 22:04:01 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
+
+ * error.c (dump_decl): Fix type of default arguments for template
+ template parameters and nontype template parameters.
+ * parse.y (template_parm): Handle invalid default template
+ template arguments here.
+
+ * parse.y (template_parm): Use template_arg instead of PTYPENAME
+ for default template template argument.
+ * pt.c (coerce_template_parms): Merge default template argument
+ codes. Can treat RECORD_TYPE as template name if it is implicitly
+ created. Fix argument index in error message.
+ * typeck.c (comptypes): Merge template argument comparison codes in
+ TEMPLATE_TEMPLATE_PARM and RECORD_TYPE.
+
+Tue Jan 6 01:42:44 1998 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * lex.c (file_name_nondirectory): Also check for '/'.
+
+Mon Feb 2 11:24:22 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * parse.y (primary): Deal with statement-expressions in
+ templates.
+ * pt.c (tsubst_copy): Handle BIND_EXPR.
+ * tree.c (mapcar): Likewise.
+
+ * call.c (add_template_candidate_real): Pass extra parameter to
+ fn_type_unification.
+ * cp-tree.h (fn_type_unification): Add parameter.
+ * pt.c (fn_type_unification): Add additional parameter to deal with
+ static member functions.
+ (get_bindings): Deal with static member functions.
+
+ * cp-tree.h (DECL_NONSTATIC_MEMBER_FUNCTION_P): New macro.
+ (revert_static_member_fn): Declare.
+ * decl.c (revert_static_member_fn): Remove declaration. Change
+ linkage from internal to external.
+ (cp_finish_decl): Deal with virtual functions in classes local to
+ template functions.
+ * decl2.c (finish_file): Don't forget to emit increment/decrement
+ expressions in initializers for file-scope variables.
+ * parse.y (typename_sub2): If the typename doesn't names a
+ template, rather than a type, issue an error message.
+ * pt.c (check_explicit_specialization): Handle specializations of
+ static member functions.
+ (coerce_template_parms): Handle offset references to lists of
+ member functions.
+ * search.c (note_debug_info_needed): Don't crash when handed a
+ type which is being defined.
+ * typeck.c (complete_type): Don't crash when handed NULL_TREE;
+ that can happen with some illegal code.
+
+Mon Feb 2 00:57:38 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * call.c (user_harshness): Initialize `code' to 0.
+ (build_method_call): Initialize `candidates', `cp' and `len' to 0.
+ (null_ptr_cst_p): Add parentheses around && within ||.
+ (standard_conversion): Likewise.
+ (z_candidate): Likewise.
+ (build_user_type_conversion_1): Initialize `args' to NULL_TREE.
+ (build_object_call): Likewise for `mem_args'.
+ (build_new_op): Likewise for `mem_arglist'. Add `return' from
+ default case in enumeration switch.
+
+ * class.c (build_vtable_entry): Add explicit braces to avoid
+ ambiguous `else'.
+ (build_class_init_list): Likewise.
+ (finish_struct_1): Initialize `width' to 0.
+ (instantiate_type): Initialize `name' to NULL_TREE. Add
+ explicit braces to avoid ambiguous `else'.
+
+ * cvt.c (convert_to_aggr): Add explicit braces to avoid ambiguous
+ `else'.
+
+ * decl.c (grok_reference_init): Eliminate unused parameter, all
+ callers changed.
+ (record_builtin_type): Initialize `tdecl' to NULL_TREE.
+ (init_decl_processing): Initialize `vb_off_identifier' to NULL_TREE.
+ (cp_finish_decl): Initialize `ttype' to NULL_TREE.
+ (grokdeclarator): Add parentheses around && within ||. Add
+ explicit braces to avoid ambiguous `else'.
+ (grokparms): Initialize `type' to NULL_TREE.
+ (xref_tag): Remove unused label `just_return'.
+ (finish_enum): Initialize `minnode' and `maxnode' to NULL_TREE.
+ (finish_function): Initialize `cond' and `thenclause' to NULL_TREE.
+ (hack_incomplete_structures): Add parentheses around assignment
+ used as truth value.
+
+ * decl2.c (coerce_delete_type): Hide definition of `e3'.
+
+ * error.c: Include <stdlib.h>.
+ (dump_expr): Change the type of `i' to size_t. Remove unused
+ label `error'.
+
+ * except.c (init_exception_processing): Remove unused variable `d'.
+ (expand_throw): Likewise for `label'.
+
+ * friend.c (add_friends): Add explicit braces to avoid ambiguous
+ `else'.
+
+ * init.c (sort_member_init): Initialize `last_field' to NULL_TREE.
+ (sort_base_init): Likewise for `binfo'.
+ (expand_member_init): Likewise for `rval'.
+ (build_member_call): Add parentheses around assignment used as
+ truth value.
+ (build_offset_ref): Add explicit braces to avoid ambiguous `else'.
+ (build_new): Initialize `nelts' to NULL_TREE. Initialize
+ `old_immediate_size_expand' to 0.
+ (build_new_1): Initialize `nelts' and `alloc_node' to NULL_TREE.
+ (build_vec_delete_1): Remove unused variable `block'.
+ (expand_vec_init): Initialize `itype' to NULL_TREE.
+
+ * lex.c: Include <strings.h> if we don't have <string.h>. Protect
+ declaration of `index' and `rindex' with autoconf macros.
+ (reinit_parse_for_expr): Remove unused variables
+ `look_for_semicolon' and `look_for_lbrac'.
+ (cons_up_default_function): Initialize `args' to NULL_TREE.
+ (readescape): Initialize `firstdig' to 0.
+ (real_yylex): Add parentheses around assignment used as truth value.
+
+ * method.c: Include <strings.h> if we don't have <string.h>.
+ Protect declaration of `index' with autoconf macro.
+
+ * parse.y (primary): Add explicit braces to avoid ambiguous `else'.
+ Initialize `type' to NULL_TREE.
+ (structsp): Remove unused variable `id'.
+
+ * pt.c (coerce_template_parms): Add explicit braces to avoid
+ ambiguous `else'.
+ (lookup_template_class): Initialize `template' to NULL_TREE.
+ (instantiate_class_template): Remove unused variable `name' and `e'.
+ (tsubst): Likewise for `i'. Initialize `last' to NULL_TREE.
+ (do_poplevel): Initialize `saved_warn_unused' to 0.
+ (type_unification): Remove unused varable `parm'.
+ (unify): Likewise for `j'.
+
+ * repo.c (init_repo): Add parentheses around assignment used as
+ truth value.
+ (finish_repo): Remove unused varable `p'.
+
+ * search.c (get_binfo): Initialize `type' to NULL_TREE.
+ (get_base_distance): Likewise.
+ (lookup_field): Initialize `rval_binfo_h', `type', `basetype_path'
+ and `new_v' to NULL_TREE.
+ (lookup_fnfields): Likewise for `rval_binfo_h'.
+ (breadth_first_search): Add parentheses around assignment used as
+ truth value.
+ (get_template_base): Initialize `type' to NULL_TREE.
+
+ * sig.c (append_signature_fields): Initialize `last_mfptr' to
+ NULL_TREE.
+ (build_signature_table_constructor): Likewise for
+ `last_rhs_field', `pfn' and `vt_off'.
+ (build_sigtable): Likewise for `init'.
+
+ * tree.c (break_out_calls): Initialize `t2' to NULL_TREE.
+ (propagate_binfo_offsets): Likewise for `delta'.
+ (hash_tree_cons): Initialize hashcode to 0.
+ (can_free): Likewise for `size'.
+ (cp_tree_equal): Add explicit braces to avoid ambiguous `else'.
+
+ * typeck.c (convert_sequence): Hide prototype.
+ (common_type): Add explicit braces to avoid ambiguous `else'.
+ (comp_target_types): Likewise.
+ (build_x_function_call): Initialize `ctypeptr' to NULL_TREE.
+ (build_function_call_real): Add explicit braces to avoid ambiguous
+ `else'.
+ (convert_arguments): Initialize `called_thing' to 0.
+ (convert_for_initialization): Initialize `savew' and `savee' to 0.
+
+ * typeck2.c (incomplete_type_error): Initialize `errmsg' to 0.
+ (digest_init): Initialize `old_tail_contents' to NULL_TREE.
+ (build_x_arrow): Likewise for `last_rval'.
+
+ * xref.c (GNU_xref_decl): Initialize `cls' to 0.
+
+Sun Feb 1 12:45:34 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * decl.c (init_decl_processing): Use set_sizetype.
+ * decl2.c (sizetype): Don't declare.
+ * typeck.c (c_sizeof): Convert result of *_DIV_EXPR to sizetype.
+ (c_sizeof_nowarn, build_binary_op_nodefault): Likewise.
+ (build_component_addr, unary_complex_lvalue): Likewise.
+ * rtti.c (expand_class_desc): Likewise.
+ * class.c (get_vfield_offset): Likewise.
+
+Thu Jan 29 10:39:30 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (convert_nontype_argument): Move check for is_overloaded_fn
+ early to avoid bogus error. Handle overloaded function
+ names provided as template arguments correctly.
+ (coerce_template_parms): Don't mishandle overloaded functions when
+ dealing with template template parameters.
+ (lookup_template_class): Issue an error message, rather than
+ crashing, when the TYPE_DECL provided is not a template type.
+
+Wed Jan 28 23:14:44 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (instantiate_type): Don't just return a known type if
+ it's wrong.
+
+Wed Jan 28 11:04:07 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * class.c (instantiate_type): Remove handling of FUNCTION_DECL
+ since that code could never be reached.
+
+ * error.c (dump_decl): Avoid aborting in the midst of printing an
+ error message about an illegal template declaration.
+
+ * parse.y (structsp): Print an error message, rather than crashing,
+ when a class-head does not name a class.
+
+ * pt.c (convert_nontype_argument): Allow REAL_TYPE and COMPLEX_TYPE
+ template arguments as a g++ extension.
+
+ * cp-tree.def (ALIGNOF_EXPR): New tree code.
+ * decl2.c (grok_alignof): If processing_template_decl, just store
+ the expression.
+ * typeck.c (c_alignof): Likewise.
+ * decl2.c (build_expr_from_tree): Handle ALIGNOF_EXPR.
+ * error.c (dump_expr): Likewise.
+ * pt.c (tsubst_copy): Likewise.
+ * tree.c (cp_tree_equal): Likewise.
+ * pt.c (uses_template_parms): Correctly determine whether or not a
+ SIZEOF_EXPR/ALIGNOF_EXPR uses template parameters so that constant
+ folding can be done.
+
+ * cp-tree.h (grok_enum_decls): Remove type parameter.
+ * decl.c (grok_enum_decls): Likewise.
+ * decl2.c (grok_x_components): Call grok_enum_decls
+ unconditionally, since it will do nothing if there is no
+ current_local_enum. Use the new calling sequence.
+ * pt.c (tsubst_enum): Use the new calling sequence for
+ grok_enum_decls.
+
+ * decl.c (start_function): Make member functions of local classes
+ in extern inline functions have comdat linkage here...
+ (grokdeclarator): Rather than here.
+
+Wed Jan 28 10:55:47 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (convert_nontype_argument): Use decl_constant_value.
+
+Tue Jan 27 16:42:21 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * call.c (add_template_candidate_real): New function.
+ (add_template_candidate): Use it.
+ (add_template_conv_candidate): Likewise.
+ (joust): Pass extra argument to more_specialized.
+ * class.c (instantiate_type): Handle a single FUNCTION_DECL.
+ (is_local_class): Remove.
+ (finish_struct): Check TI_PENDING_SPECIALIZATION_FLAG.
+ * cp-tree.h (is_local_class): Remove.
+ (perform_array_to_pointer_conversion): Likewise.
+ (finish_member_template_decl): Add.
+ (check_explicit_specialization): Return a tree, not an int.
+ (more_specialized): Take additional argument.
+ (get_bindings): Likewise.
+ (TI_PENDING_SPECIALIZATION_FLAG): New macro.
+ * cvt.c (perform_qualification_conversions): Use comp_ptr_ttypes.
+ (perform_array_to_pointer_conversion): Remove.
+ * decl.c (saved_scope): Add processing_specialization,
+ processing_explicit_instantiation fields.
+ (maybe_push_to_top_level): Save them.
+ (pop_from_top_level): Restore them.
+ (grokfndecl): Use new return value from
+ check_explicit_specialization.
+ (start_decl): Don't check flag_guiding_decls before pushing
+ decls.
+ (cp_finish_decl): Remove previous (bogus) change.
+ (grok_declarator): Use decl_function_context rather than
+ is_local_class.
+ * decl2.c (finish_file): Pass extra argument to get_bindings.
+ (build_expr_from_tree): Let build_x_component_ref check
+ validity of arguments rather than doing it here.
+ * lex.c (cons_up_default_function): Remove code fooling with
+ processing_specialization, processing_explicit_instantiation
+ flags, as that is now done in {maybe_push_top,pop_from}_top_level.
+ * method.c (build_overload_identifier): Mangle local classes in
+ template functions correctly.
+ * parse.y (finish_member_template_decl): Move to pt.c.
+ * pt.c (finish_member_template_decl): Moved here from parse.y.
+ (print_candidates): New function.
+ (determine_specialization): Change interface. Properly look for
+ most specialized versions of template candidates.
+ (check_explicit_specialization): Fully process explicit
+ instantiations.
+ (push_template_decl): Avoid looking at CLASSTYPE fields in
+ FUNCTION_DECLS.
+ (determine_overloaded_function): Remove.
+ (convert_nontype_argument): Change name from
+ convert_nontype_parameter. Use determine_overloaded_function
+ instead of instantiate_type.
+ (mangle_class_name_for_template): Handle type contexts as well as
+ function contexts.
+ (classtype_mangled_name): Likewise.
+ (lookup_template_class): Likewise.
+ (tsubst): Likewise.
+ (more_specialized): Take explict template arguments as a
+ parameter.
+ (most_specialized): Likewise.
+ (get_bindings): Likewise. Check that return types match before
+ proclaiming a function a match.
+ (do_decl_instantiation): Remove code searching for function to
+ instantiate; that is now done in check_explicit_specialization.
+ (add_maybe_template): Pass extra argument to get_bindings.
+ * tree.c (really_overloaded_fn): Use is_overloaded_fn to simplify
+ implementation.
+ * typeck.c (build_component_ref): Check for invalid arguments.
+
+Tue Jan 27 01:44:02 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * expr.c (cplus_expand_expr, AGGR_INIT_EXPR): Don't check that
+ return_target and call_target are equivalent.
+
+ * pt.c (type_unification_real): Just accept function parms that
+ don't use any template parms.
+
+Sun Jan 25 03:30:00 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (cp_finish_decl): When bailing on a comdat variable, also
+ unset DECL_NOT_REALLY_EXTERN.
+
+ * parse.y (typename_sub*): Fix std::.
+
+Sat Jan 24 12:13:54 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * error.c (dump_decl): Fix type default template args.
+ (dump_type): Hand TEMPLATE_DECL off to dump_decl.
+
+Fri Jan 23 18:34:37 1998 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * lex.c (DIR_SEPARATOR): Define to be '/' if not already defined.
+ (file_name_nondirectory): Use.
+
+Wed Jan 21 10:29:57 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
+
+ * pt.c (coerce_template_parms): Don't access elements of ARGLIST
+ that are not really present. Substitute default arguments in
+ template template arguments. Correctly convert TEMPLATE_DECL to
+ TEMPLATE_TEMPLATE_PARM.
+ (comp_template_args): TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM
+ are no longer treated specially here.
+ * parse.y (template_template_parm): Fix copy error.
+ * decl.c (grokdeclarator): Warn about missing `typename' for nested
+ type created from template template parameters.
+ * parse.y (bad_parm): Likewise
+
+ * class.c (finish_struct): Handle TEMPLATE_TEMPLATE_PARM.
+ (push_nested_class): Likewise.
+ * cp-tree.def (TEMPLATE_TEMPLATE_PARM): New tree code.
+ * cp-tree.h (DECL_TEMPLATE_TEMPLATE_PARM_P): New macro.
+ (copy_template_template_parm): Declare.
+ * decl.c (arg_looking_for_template): New variable.
+ (lookup_name_real): Handle TEMPLATE_TEMPLATE_PARM.
+ Try to return TEMPLATE_DECL or TEMPLATE_TEMPLATE_PARM
+ node if arg_looking_for_template is nonzero.
+ (pushdecl): Handle TEMPLATE_TEMPLATE_PARM.
+ (grok_op_properties, xref_tag, xref_basetypes): Likewise.
+ (grokdeclarator): Handle TEMPLATE_DECL.
+ * decl2.c (constructor_name_full): Handle TEMPLATE_TEMPLATE_PARM.
+ * error.c (dump_type): Add TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM.
+ (dump_type_prefix, dump_type_suffix): Handle TEMPLATE_TEMPLATE_PARM.
+ (dump_decl): Handle unnamed template type parameters.
+ Handle template template parameters.
+ (dump_function_name): Handle template template parameters.
+ * init.c (is_aggr_typedef, is_aggr_type, get_aggr_from_typedef):
+ Handle TEMPLATE_TEMPLATE_PARM.
+ * method.c (build_template_template_parm_names): New function.
+ (build_template_parm_names): Handle TEMPLATE_DECL.
+ (build_overload_nested_name, build_overload_name):
+ Handle TEMPLATE_TEMPLATE_PARM.
+ * parse.y (maybe_identifier): New nonterminal.
+ (template_type_parm): Use it.
+ (template_template_parm, template_arg1): New nonterminal.
+ (template_parm): Add template_template_parm rules.
+ (template_arg): Set processing_template_arg.
+ (template_arg1): Rules moved from template_arg.
+ (primary, nonnested_type): Set arg_looking_for_template if we are
+ processing template arguments.
+ * pt.c (begin_member_template_processing): Handle TEMPLATE_DECL.
+ (process_template_parm): Handle template template parameters.
+ (coerce_template_parms, comp_template_args): Likewise.
+ (mangle_class_name_for_template, lookup_template_class): Likewise.
+ (uses_template_parms): Handle TEMPLATE_DECL and
+ TEMPLATE_TEMPLATE_PARM.
+ (current_template_args): Handle TEMPLATE_DECL.
+ (tsubst, tsubst_copy, unify): Handle TEMPLATE_TEMPLATE_PARM.
+ * search.c (dfs_walk, dfs_record_inheritance):
+ Handle TEMPLATE_TEMPLATE_PARM.
+ * tree.c (copy_template_template_parm): New function.
+ (mapcar): Handle TEMPLATE_TEMPLATE_PARM.
+ * typeck.c (comptypes): Handle TEMPLATE_TEMPLATE_PARM.
+
+Mon Jan 19 22:40:03 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * decl.c (start_decl): Don't allow duplicate definitions of static
+ data members.
+
+ * call.c (build_user_type_conversion_1): Handle user-defined
+ template conversion operators correctly.
+
+ * decl2.c (build_expr_from_tree): Issue an error message if the
+ object in a COMPONENT_REF is a TEMPLATE_DECL.
+
+ * typeck.c (incomplete_type_error): Handle TEMPLATE_TYPE_PARMs.
+
+ * class.c (is_local_class): New function.
+ * cp-tree.h (is_local_class): Declare it.
+ (last_tree): Likewise.
+ (begin_tree): Likewise.
+ (end_tree): Likewise.
+ (lookup_template_class): Change prototype.
+ * decl.c (cp_finish_decl): Check for NULL where necessary.
+ Consider FUNCTION_DECLS to declare objects with top-level binding,
+ when calling make_decl_rtl.
+ (grokdeclarator): Give members of local classes internal linkage.
+ (start_function): Remove declaration of last_tree.
+ (finish_function): Set flag_keep_inline_functions around call to
+ rest_of_compilation if we are processing a member function in a
+ local class.
+ (start_method): Call push_template_decl for member functions of
+ local classes in template functions.
+ * decl2.c (import_export_decl): Don't give external linkage to
+ instantiations of templates with internal linkage.
+ * parse.y (last_tree): Remove declaration.
+ (template_type): Pass extra parameter to lookup_template_class.
+ (self_template_type): Likewise.
+ (structsp): Move call to reset_specialization into left_curly.
+ (left_curly): Call reset_specialization, and begin_tree.
+ * pt.c (saved_trees): New variable.
+ (mangle_class_name_for_template): Change prototype. Use
+ additional function context to name local classes in templates
+ correctly.
+ (classtype_mangled_name): Pass the context.
+ (push_template_decl): Handle local classes and templates, and
+ member functions for such classes.
+ (convert_nontype_parameter): Fix handling of pointer-to-member
+ constants.
+ (lookup_template_class): Handle local classes in templates.
+ (tsubst): Likewise. Don't assume that template instantiations
+ have external linkage; pay attention to the template declaration.
+ (mark_decl_instantiated): Likewise.
+ (begin_tree): New function.
+ (end_tree): Likewise.
+
+ * decl.c (xref_basetypes): Don't call complete_type for basetypes
+ that involve template parameters; that can lead to infinite
+ recursion unnecessarily.
+
+ * pt.c (register_specialization): Do not register specializations
+ that aren't ready to be registered yet.
+ (check_explicit_specialization): Handle explicit specialization of
+ constructors and destructors.
+ (build_template_decl): New function.
+ (push_template_delc): Handle out-of-class specializations of
+ member templates.
+
+ * pt.c (check_explicit_specialization): Set up the template
+ information before registering the specialization.
+ (coerce_template_parms): Fix thinko.
+ (tsubst): Handle specializations of member templates correctly.
+
+ * class.c (finish_struct_methods): Remove calls to
+ check_explicit_specialization from here.
+ (finish_struct): And insert them here.
+ * cp-tree.h (perform_qualification_conversions): New function.
+ (perform_array_to_pointer_conversion): Likewise.
+ (begin_explicit_instantiation): Likewise.
+ (end_explicit_instantiation): Likewise.
+ (determine_specialization): Renamed from
+ determine_explicit_specialization.
+ (comp_template_parms): New function.
+ (processing_explicit_instantiation): New variable.
+ * cvt.c (perform_qualification_conversions): New function.
+ (perform_array_to_pointer_conversion): Likewise.
+ * decl.c (duplicate_decls): Don't consider template functions
+ alike unless they have the same parameters. Refine handling of
+ instantiation/specialization mismatches.
+ (start_decl): Don't call pushdecl for template specializations,
+ since they don't affect overloading.
+ (start_function): Likewise.
+ (grokfndecl): Call check_explicit_specialization a little later.
+ Don't call duplicate_decls for memberm template specializations.
+ (grokdeclarator): Don't update template_count for classes that are
+ themselves specializations. Remove use of `2' as parameter to
+ grokfndecl since that value isn't used.
+ * lex.c (cons_up_default_function): Save and restore
+ processing_explicit_instantiation around calls to grokfield.
+ * parse.y (finish_member_template_decl): New function.
+ (component_decl_1): Use it.
+ (fn.def2): Likewise.
+ (template_arg_list_opt): New nonterminal.
+ (template_type): Use it.
+ (self_template_type): Likewise.
+ (template_id): Likewise.
+ (object_template_id): Likewise.
+ (notype_template_declarator): Likwise.
+ (begin_explicit_instantiation): Likewise.
+ (end_explicit_instantiation): Likewise.
+ (explicit_instantiation): Use them.
+ * pt.c (coerce_template_parms): Add parameters.
+ (processing_explicit_instantiation): New variable.
+ (convert_nontype_parameter): New function.
+ (determine_overloaded_function): Likewise.
+ (begin_explicit_instantiation): Likewise.
+ (end_explicit_instantiation): Likewise.
+ (retrieve_specialization): Likewise.
+ (register_specialization): Likewise.
+ (processing_explicit_specialization): Removed.
+ (determine_specialization): Handle specializations of member
+ functions of template class instantiations.
+ (check_explicit_specialization): Refine to conform to standard.
+ (comp_template_parms): New function.
+ (coerce_template_parms): Call convert_nontype_parameter.
+ (tsubst): Refine handling of member templates. Use
+ register_specialization.
+ (instantiate_template): Use retrieve_specialization.
+ (do_decl_instantiation): Likewise.
+ (instantiate_decl): Likewise.
+ (type_unification): Improve handling of explict template
+ arguments.
+ * tree.c (mapcar): Return error_mark_node, rather than aborting,
+ on VAR_DECLS, FUNCTION_DECLS, and CONST_DECLS.
+ * typeck.c (build_unary_op): Call determine_specialization, rather
+ than determine_explicit_specialization.
+
+Mon Jan 19 13:18:51 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (build_up_reference): A TARGET_EXPR has side effects.
+
+Fri Jan 16 11:40:50 1998 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
+
+ * error.c (dump_decl): For enum tags, output the tag, not its value.
+
+1998-01-13 Brendan Kehoe <brendan@cygnus.com>
+
+ * decl.c (init_decl_processing): Only call init_rtti_processing
+ FLAG_RTTI is set.
+
+Mon Jan 12 01:35:18 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (build_new_1): Split out from build_new.
+ (build_new): Just return a NEW_EXPR.
+ * expr.c (cplus_expand_expr): Handle NEW_EXPR.
+
+ * decl2.c (get_temp_regvar): Tweak.
+
+ * cp-tree.h (TREE_CALLS_NEW): Comment out.
+ * class.c (resolves_to_fixed_type_p): Remove use.
+ * method.c (build_opfncall): Likewise.
+ * call.c (build_new_op): Likewise.
+
+Wed Jan 7 23:47:13 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * exception.cc (__eh_alloc, __eh_free): New fns.
+ (__cp_push_exception, __cp_pop_exception): Use them.
+ (__uncatch_exception): Call terminate here if no exception.
+ * except.c (build_terminate_handler): New fn.
+ (expand_start_catch_block): Use it.
+ (expand_exception_blocks): Likewise.
+ (alloc_eh_object): New fn.
+ (expand_throw): Use it. Protect exception init with terminate.
+ * typeck.c (build_modify_expr): Remove code that ignores trivial
+ methods.
+
+Mon Dec 22 11:36:27 1997 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * call.c (add_builtin_candidate): Add default case in enumeration
+ switch.
+ (build_new_op): Likewise.
+ (convert_like): Likewise.
+ * cvt.c (build_expr_type_conversion): Likewise.
+ * tree.c (real_lvalue_p): Likewise.
+ (lvalue_p): Likewise.
+ (cp_tree_equal): Likewise.
+ * typeck.c (comptypes): Likewise.
+ (build_component_ref): Likewise.
+ (build_function_call_real): Likewise.
+ (build_binary_op_nodefault): Likewise.
+ (build_unary_op): Likewise.
+ (build_modify_expr): Likewise.
+ * typeck2.c (initializer_constant_valid_p): Likewise.
+
+Sun Dec 21 15:59:00 1997 Nick Clifton <nickc@cygnus.com>
+
+ * decl2.c (lang_decode_option): Add support for -Wunknown-pragmas.
+
+Thu Dec 18 14:51:50 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (coerce_template_parms): Make sure to digest_init if
+ possible.
+
+ * decl.c (duplicate_decls): Make the newdecl virtual if the
+ olddecl was, just as is done with other attributes of olddecl.
+
+Thu Dec 18 14:43:19 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (unary_complex_lvalue): Ignore op0 when taking the
+ address of an OFFSET_REF.
+
+ * cp-tree.def: Add AGGR_INIT_EXPR.
+ * error.c, tree.c, typeck.c: Replace uses of NEW_EXPR with
+ AGGR_INIT_EXPR where appropriate.
+ * expr.c (cplus_expand_expr): Likewise. Simplify.
+
+ * decl2.c (finish_file): Remove call to register_exception_table.
+
+Wed Dec 17 17:08:52 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * pt.c (instantiate_class_template): Don't do injection when
+ processing_template_decl is true, as pollutes current_binding_level
+ for base classes.
+
+Wed Dec 17 21:17:39 1997 Peter Schmid <schmid@ltoi.iap.physik.tu-darmstadt.de>
+
+ * pt.c (maybe_fold_nontype_arg): Add prototype.
+
+Tue Dec 16 10:31:20 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (mapcar): Handle TRY_CATCH_EXPR et al.
+ * error.c (dump_expr): Likewise.
+
+Mon Dec 15 12:22:04 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_function_call_real): Remove "inline called before
+ definition" pedwarn.
+
+ * pt.c (coerce_template_parms): Use maybe_fold_nontype_arg.
+
+Sun Dec 14 22:34:20 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (cp_convert_to_pointer): Fix base conversion of pm's.
+
+ * pt.c (type_unification_real): Change __null to type void* with
+ a warning.
+
+Sun Dec 14 20:38:35 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * call.c (implicit_conversion): Don't call
+ build_user_type_conversion_1 with a NULL expr, since it will
+ crash.
+
+ * pt.c (unify): Don't try to unify array bounds if either array is
+ unbounded.
+
+Fri Dec 12 16:09:14 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * errfn.c (cp_pedwarn, cp_pedwarn_at, cp_error_at, cp_warning_at):
+ Replace extern decls with casts.
+
+ * decl.c (expand_start_early_try_stmts): Don't mess with a sequence.
+ Update last_parm_cleanup_insn.
+ (store_after_parms): Remove.
+ * cp-tree.h: Adjust.
+
+Thu Dec 11 22:18:37 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (comdat_linkage): Also set DECL_COMDAT.
+ (finish_file): Check DECL_COMDAT instead of weak|one_only.
+ (import_export_vtable): Use make_decl_one_only instead of
+ comdat_linkage for win32 tweak.
+ (import_export_decl): Likewise.
+ * pt.c (mark_decl_instantiated): Likewise.
+
+ * decl2.c (finish_file): Lose handling of templates in pending_statics.
+
+Thu Dec 11 21:12:09 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_file): Lose call to expand_builtin_throw.
+ * except.c (expand_builtin_throw): Remove.
+ * cp-tree.h: Remove ptr_ptr_type_node.
+ * decl.c: Likewise.
+
+Thu Dec 11 20:43:33 1997 Teemu Torma <tot@trema.com>
+
+ * decl.c (ptr_ptr_type_node): Define.
+ (init_decl_processing): Initialize it.
+ * cp-tree.h: Declare it.
+ * exception.cc (__cp_exception_info): Use __get_eh_info.
+ (__cp_push_exception): Likewise.
+ (__cp_pop_exception): Likewise.
+
+ From Scott Snyder <snyder@d0sgif.fnal.gov>:
+ * except.c (expand_builtin_throw): Use get_saved_pc_ref instead of
+ saved_pc.
+ (init_exception_processing): Removed saved_pc initialization.
+
+Wed Dec 10 11:04:45 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_decl): Defer all templates but inline functions.
+
+Mon Dec 8 23:17:13 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (expand_vec_init): Don't fold a list of parameters.
+
+ * decl.c (copy_args_p): Handle copy elision for types with virtual
+ bases.
+ * call.c (build_over_call): Likewise.
+
+Sun Dec 7 22:38:12 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (lookup_template_function): Copy the template arguments,
+ not just the list containing them, to the permanent obstack.
+
+Sun Dec 7 15:53:06 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * except.c (expand_start_catch_block): suspend_momentary for the
+ terminate handler.
+
+ * error.c (dump_decl): Handle LOOKUP_EXPR.
+
+Sun Dec 7 15:45:07 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * rtti.c (build_dynamic_cast): Copy the cast-to type to the
+ permanent obstack if we are processing a template decl.
+ * typeck.c (build_static_cast): Likewise.
+ (build_const_cast): Likewise.
+ (build_reinterpret_cast): Likewise.
+
+ * pt.c (coerce_template_parms): Coerce some expressions, even
+ when processing_template_decl.
+
+Sun Dec 7 01:46:33 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
+
+ * typeck.c (build_binary_op_nodefault, pointer_diff): Symmetric
+ handling of pointer difference expressions.
+
+ * typeck.c (comp_target_types): Comparison of function/method types
+ is independent of nptrs.
+
+Sun Dec 7 01:40:27 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (tsubst): Avoid creating pointer to reference and
+ reference to reference types.
+
+Sat Dec 6 01:29:37 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (do_id): New nonterminal.
+ (template_id): Use it.
+
+Fri Dec 5 01:17:34 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (template_id): do_identifier for PFUNCNAMEs, too.
+ * spew.c (yylex): Don't do_identifier here.
+ * decl2.c (build_expr_from_tree): Revert last change.
+
+ * decl2.c (build_expr_from_tree): Expand the name for a method call.
+ * parse.y (object_template_id): Don't try to take the DECL_NAME.
+
+Wed Dec 3 20:02:39 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (build_new): Use a TARGET_EXPR instead of SAVE_EXPR for
+ alloc_expr.
+ * call.c (build_op_delete_call): Adjust.
+
+ * except.c (expand_end_catch_block): Lose rethrow region.
+ (expand_start_catch_block): Likewise.
+ (expand_end_catch_block): Don't expand_leftover_cleanups.
+
+Wed Dec 3 13:24:04 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * pt.c (tsubst): Remove tree_cons call (places redundant info into
+ DECL_TEMPLATE_INSTANTIATION).
+
+Wed Dec 3 11:44:52 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (is_overloaded_fn): Handle getting a fn template.
+ (really_overloaded_fn): Likewise.
+ * error.c (dump_decl): Handle TEMPLATE_ID_EXPRs better.
+ * pt.c (check_explicit_specialization): Tweak.
+ (determine_explicit_specialization): Tweak.
+
+ * tree.c, cp-tree.h (get_target_expr): New fn.
+
+Wed Dec 3 08:47:27 1997 Paul Eggert <eggert@twinsun.com>
+
+ * pt.c (check_explicit_specialization): Fix misspelling in
+ diagnostic: `preceeded'.
+ * typeck.c (get_delta_difference): Fix misspelling in diagnostic:
+ `conversiona'.
+
+1997-12-02 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (determine_explicit_specialization): Avoid an internal
+ error for bad specializations.
+
+ * method.c (build_overload_value): Handle SCOPE_REF.
+
+Tue Dec 2 19:18:50 1997 Mike Stump <mrs@wrs.com>
+
+ * class.c (prepare_fresh_vtable): Enable even more complex MI
+ vtable names.
+
+Tue Dec 2 01:37:19 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * exception.cc (__check_eh_spec): Optimize a bit.
+
+ * exception.cc (__cp_pop_exception): Lose handler arg.
+ * except.c (do_pop_exception): Likewise.
+ (push_eh_cleanup): Let the cleanup mechanism supply the handler.
+ (expand_end_catch_block): Likewise.
+
+Fri Nov 28 01:58:14 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (check_explicit_specialization): Complain about using a
+ template-id for a non-specialization.
+
+Fri Nov 28 12:35:19 1997 Scott Christley <scottc@net-community.com>
+
+ * repo.c: Prototype rindex only if needed.
+ * xref.c: Likewise.
+
+Fri Nov 28 01:56:35 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
+
+ * error.c (dump_decl): Handle TEMPLATE_ID_EXPR.
+
+Thu Nov 27 00:59:46 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_const_cast): Handle references here instead of
+ handing off to convert_to_reference.
+
+ * except.c: Lose Unexpected, SetTerminate, SetUnexpected,
+ TerminateFunctionCall.
+ (init_exception_processing): Likewise. Terminate et al are now
+ the fns, not ADDR_EXPRs.
+ (various): Lose redundant assemble_external calls.
+ (do_unwind): s/BuiltinReturnAddress/builtin_return_address_fndecl/.
+
+ * cp-tree.h (struct lang_decl_flags): Add comdat.
+ (DECL_COMDAT): New macro.
+ * decl.c (duplicate_decls): Propagate it.
+ (cp_finish_decl): Handle it.
+ * decl2.c (import_export_decl): Just set DECL_COMDAT on VAR_DECLs.
+
+ * class.c: Remove static pending_hard_virtuals.
+ (add_virtual_function): Take pointers to pending_virtuals
+ and pending_hard_virtuals.
+ (finish_struct_1): Pass them. Declare pending_hard_virtuals.
+
+Wed Nov 26 20:28:49 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (import_export_vtable): If we support one_only but not
+ weak symbols, mark instantiated template vtables one_only.
+ (import_export_decl): Likewise for tinfo functions.
+ (finish_vtable_vardecl): Also write out vtables from explicitly
+ instantiated template classes.
+ * pt.c (mark_class_instantiated): Revert last change.
+
+ * except.c (expand_throw): Call mark_used on the destructor.
+
+Wed Nov 26 15:13:48 1997 Jeffrey A Law (law@cygnus.com)
+
+ * lex.c (lang_init): Enable flag_exceptions by default if no
+ command line switch was specified.
+
+1997-11-26 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (unify): Handle `void' template parameters in
+ specializations.
+
+Wed Nov 26 01:11:24 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * rtti.c (build_dynamic_cast): Handle template case here.
+ (build_dynamic_cast_1): Not here.
+
+ * typeck2.c (digest_init): Make copies where appropriate.
+
+ * decl2.c (delete_sanity): resolve_offset_ref.
+
+ * except.c: Call terminate without caching so many bits.
+
+ * except.c (expand_start_catch_block): Fix catching a reference
+ to pointer.
+
+Tue Nov 25 11:28:21 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (build_new): Copy size to the saveable obstack.
+
+ * init.c (build_new): Stick a CLEANUP_POINT_EXPR inside the
+ TRY_CATCH_EXPR for now.
+
+Mon Nov 24 12:15:55 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (mark_addressable): Don't assume a FUNCTION_DECL
+ has DECL_LANG_SPECIFIC.
+
+ * exception.cc (struct cp_eh_info): Add handlers field.
+ (__cp_push_exception): Initialize it.
+ (__cp_pop_exception): Decrement it. Don't pop unless it's 0.
+ (__throw_bad_exception): Remove.
+ * except.c (call_eh_info): Add handlers field.
+ (get_eh_handlers): New fn.
+ (push_eh_cleanup): Increment handlers.
+
+Fri Nov 21 12:22:07 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * except.c (expand_start_eh_spec): Use the try/catch code.
+ (expand_end_eh_spec): Likewise. Call __check_eh_spec instead of
+ doing everything inline.
+ (init_exception_processing): throw_type_match now takes
+ const void pointers.
+ * exception.cc (__check_eh_spec): New fn.
+ * inc/exception: Neither terminate nor unexpected return.
+ * decl.c: Make const_ptr_type_node public.
+ * tinfo2.cc (__throw_type_match_rtti): Take the typeinfos constly.
+
+ * except.c (expand_start_catch_block): We only need the rethrow
+ region for non-sjlj exceptions.
+ (expand_end_catch_block): Likewise. Use outer_context_label_stack.
+
+Thu Nov 20 14:40:17 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * Make-lang.in (CXX_LIB2FUNCS): Add new op new and op delete objs.
+ (various.o): Likewise.
+ * inc/new: Add placement deletes. Add throw specs for default new.
+ * new.cc (set_new_handler): Move here from libgcc2.
+ * new1.cc (new (nothrow)): Catch a bad_alloc thrown from the handler.
+ (new): Move from libgcc2. Throw bad_alloc.
+ * new2.cc: Move the rest of the op news and op deletes from libgcc2.
+ * decl.c (init_decl_processing): Update exception specs on new and
+ 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.
+
+Wed Nov 19 18:24:14 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (start_decl): Don't just complain about a mismatched
+ scope, fix it.
+
+ * decl.c (make_implicit_typename): Handle case where t is not
+ actually from context.
+ * tree.c (get_type_decl): Lose identifier case.
+ * spew.c (yylex): Lose useless call to identifier_typedecl_value.
+ * parse.y (nonnested_type): Just use lookup_name.
+ (complex_type_name): Just use IDENTIFIER_GLOBAL_VALUE.
+
+Wed Nov 19 11:45:07 1997 Michael Tiemann <tiemann@axon.cygnus.com>
+
+ * error.c (dump_function_name): Test DECL_LANG_SPECIFIC in case
+ T was built in C language context (for example, by
+ output_func_start_profiler).
+
+Wed Nov 19 10:39:27 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (make_implicit_typename): New fn.
+ (lookup_name_real): Use it. Use current_class_type as the context.
+
+Mon Nov 17 23:42:03 1997 Bruno Haible <haible@ilog.fr>
+
+ * pt.c (do_poplevel): Don't prohibit jumps into this contour.
+
+Mon Nov 17 02:01:28 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * friend.c (do_friend): Warn about non-template friends in templates.
+
+ * call.c (build_op_delete_call): Fix handling of inherited delete.
+
+ * search.c (dfs_record_inheritance): Ignore template type parms.
+
+Sat Nov 15 00:30:51 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_new_op): Fix copy error.
+ (build_op_new_call): New fn.
+ (build_op_delete_call): New fn.
+ * cp-tree.h: Declare them.
+ * init.c (build_new): Use them. Support placement delete.
+ (build_x_delete): Use build_op_delete_call.
+ (build_delete): Likewise.
+ * decl2.c (delete_sanity): Likewise.
+ (coerce_delete_type): Don't complain about placement delete.
+
+Thu Nov 13 01:52:36 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_new_function_call): Remove unused 'obj' parm.
+ * cp-tree.h, typeck.c: Adjust.
+
+ * init.c (build_new): Make the cleanup last longer.
+ (expand_vec_init): Call do_pending_stack_adjust.
+
+Wed Nov 12 11:04:33 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (do_type_instantiation): Fix typo.
+ (mark_class_instantiated): If we support one_only but not weak
+ symbols, don't mark this as known.
+
+ * init.c (build_new): Handle vec delete in EH cleanup.
+
+Wed Nov 12 08:11:55 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * call.c (build_method_call): Call complete_type before checking
+ for destructor.
+
+Sun Nov 9 01:29:55 1997 Jim Wilson (wilson@cygnus.com)
+
+ * decl.c (add_block_current_level): Delete.
+ * init.c (build_vec_delete_1): Delete build_block and
+ add_block_current_level calls.
+
+Wed Nov 12 00:48:16 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (build_new): Handle freeing allocated memory when the
+ constructor throws.
+
+ * call.c (build_new_method_call): Fix flags arg.
+
+ * pt.c (do_type_instantiation): Don't try to instantiate
+ member templates.
+ (mark_decl_instantiated): If we support one_only but not
+ weak symbols, mark this one_only.
+ * decl2.c (import_export_vtable): Don't defer handling of vtables
+ if MULTIPLE_SYMBOL_SPACES.
+
+Tue Nov 11 12:02:12 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * except.c (expand_end_catch_block): Lose call to __sjpopnthrow.
+
+Tue Nov 11 02:53:44 1997 Jason Merrill <jason@lasher.cygnus.com>
+
+ * except.c (do_pop_exception): Return a value.
+
+Mon Nov 10 20:25:31 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_new_method_call): Handle getting a
+ TEMPLATE_ID_EXPR around a TEMPLATE_DECL. Don't look for a field
+ if we got template parms.
+ * typeck.c (build_x_function_call): Remember the TEMPLATE_ID_EXPR,
+ not just the args.
+ * decl2.c (build_expr_from_tree): Tweak last change.
+ * pt.c (tsubst_copy): Use get_first_fn instead of TREE_VALUE.
+ (maybe_fold_nontype_arg): Split out from tsubst_copy.
+ * tree.c (get_first_fn): Just return a TEMPLATE_ID_EXPR.
+
+Mon Nov 10 20:08:38 1997 Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
+
+ * pt.c (tsubst_copy): Handle explicit template arguments in
+ function calls.
+ * typeck.c (build_x_function_call): Likewise.
+ * decl2.c (build_expr_from_tree): Lookup function name if it
+ hasn't been done.
+
+ * pt.c (tsubst): Instantiate template functions properly when
+ template parameter does not appear in function arguments and return
+ type.
+ (comp_template_args): Handle member templates required by tsubst.
+
+Mon Nov 10 20:08:38 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokdeclarator): Tweak conditions for pedwarn in
+ previous change.
+
+Mon Nov 10 20:08:29 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
+
+ * pt.c (coerce_template_parms): Tweak error message.
+
+ * decl.c (grokdeclarator): If -Wreturn-type, warn everytime a
+ return type defaults to `int', even if there are storage-class
+ specifiers.
+
+Mon Nov 10 03:04:20 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ Complete nested exception support.
+ * except.c (do_pop_exception): Split out...
+ (push_eh_cleanup): From here. Handle the EH region by hand.
+ (expand_start_catch_block): Add a new level for the catch parm.
+ Move the rethrow region outside the two cleanup regions.
+ Protect the initializer for the catch parm with terminate.
+ (expand_end_catch_block): Likewise. End the region for the eh_cleanup.
+ * exception.cc (__cp_pop_exception): Now takes two parms. Handle
+ popping off the middle of the stack.
+ * tree.c (lvalue_p, real_lvalue_p): Handle TRY_CATCH_EXPR,
+ WITH_CLEANUP_EXPR, and UNSAVE_EXPR.
+ (build_cplus_new): Only wrap CALL_EXPRs.
+ * init.c (expand_default_init): Handle a TRY_CATCH_EXPR around
+ the constructor call.
+
+Sun Nov 9 18:00:26 1997 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * Make-lang.in (c++.distdir): Make inc subdirectory.
+
+Fri Nov 7 11:57:28 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_file): Put back some code.
+
+Thu Nov 6 11:28:14 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_file): Remove redundant code.
+ * method.c (emit_thunk): Don't let the backend defer generic thunks.
+
+Wed Nov 5 23:52:50 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * except.c (call_eh_info): Split out...
+ (push_eh_info): From here.
+ (expand_builtin_throw): Use it.
+ (expand_start_catch_block): Move region start back.
+
+Tue Nov 4 13:45:10 1997 Doug Evans <devans@canuck.cygnus.com>
+
+ * lex.c (MULTIBYTE_CHARS): #undef if cross compiling.
+ (real_yylex): Record wide strings using target endianness, not host.
+
+1997-11-03 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * repo.c (rindex): Add decl unconditionally.
+ (get_base_filename, open_repo_file): Don't cast rindex.
+ * xref.c (rindex): Add decl unconditionally.
+ (index): Remove unused decl.
+ (open_xref_file): Don't cast rindex.
+
+Sun Nov 2 15:04:12 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (build_vbase_path): Propagate the result type properly.
+
+1997-11-01 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * except.c (expand_builtin_throw) [!DWARF2_UNWIND_INFO]: Replace
+ remaining use of saved_throw_type with a call to get_eh_type.
+
+1997-10-31 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * lex.c (FILE_NAME_NONDIRECTORY): Delete macro.
+ (file_name_nondirectory): New function, doing the same as the macro.
+ (set_typedecl_interface_info): Use it instead of the macro.
+ (check_newline): Likewise.
+ (handle_cp_pragma): Likewise.
+
+ * repo.c (get_base_filename): Cast result of rindex to char*.
+ (open_repo_file): Likewise.
+ * xref.c (open_xref_file): Likewise.
+ * error.c (dump_char): Make its arg int, not char.
+
+ * except.c (push_eh_info): Pass the number of fields - 1 down, not
+ the exact number of fields.
+
+Fri Oct 31 01:47:57 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ Support for nested exceptions.
+ * tinfo2.cc (__is_pointer): New fn.
+ * exception.cc (struct cp_eh_info): Define.
+ (__cp_exception_info, __uncatch_exception): New fns.
+ (__cp_push_exception, __cp_pop_exception): New fns.
+ * except.c: Lose saved_throw_{type,value,cleanup,in_catch}.
+ Lose empty_fndecl.
+ (init_exception_processing): Likewise. __eh_pc is now external.
+ (push_eh_info): New fn.
+ (get_eh_{info,value,type,caught}): New fns.
+ (push_eh_cleanup): Just call __cp_pop_exception.
+ (expand_start_catch_block): Use push_eh_info. Start the eh region
+ sooner.
+ (expand_end_eh_spec): Use push_eh_info.
+ (expand_throw): Call __cp_push_exception to set up the exception info.
+ Just pass the destructor or 0 as the cleanup. Call __uncatch_exception
+ when we rethrow.
+ (expand_builtin_throw): Don't refer to empty_fndecl.
+
+Thu Oct 23 02:01:30 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_decl): SET_DECL_IMPLICIT_INSTANTIATION on new decl.
+
+1997-10-22 Brendan Kehoe <brendan@cygnus.com>
+
+ * method.c (build_template_parm_names, build_decl_overload_real):
+ Add static to definitions.
+ * pt.c (add_to_template_args, note_template_header,
+ processing_explicit_specialization, type_unification_real): Likewise.
+ ({determine,check}_explicit_specialization): Use a single string for
+ error messages.
+
+Mon Oct 20 12:06:34 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * except.c (expand_exception_blocks): Call do_pending_stack_adjust.
+ (expand_end_catch_block): Likewise.
+ (expand_end_eh_spec): Likewise.
+
+Mon Oct 20 11:44:20 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * decl.c (duplicate_decls): Handle template specializations
+ correctly.
+ * error.c (dump_function_name): Fix printing of specializations of
+ member functions that are not member templates.
+ * cp-tree.h (processing_specialization): Make global.
+ * pt.c (processing_specialization): Likewise.
+ * lex.c (cons_up_default_function): Save and restore
+ processing_specialization to avoid confusion.
+
+Mon Oct 20 10:52:22 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (init_decl_processing): Give null_node unknown* type.
+ * typeck.c (comp_target_types): Handle UNKNOWN_TYPE.
+ (common_type): Likewise.
+ * error.c (args_as_string): Recognize null_node.
+
+Sun Oct 19 09:13:01 1997 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * typeck.c (rationalize_conditional_expr): Handle {MIN,MAX}_EXPR.
+ (unary_complex_lvalue): Call it for {MIN,MAX}_EXPR.
+
+ * decl.c (init_decl_processing): Call using_eh_for_cleanups.
+
+ * Make-lang.in (g++): Include prefix.o.
+
+Thu Oct 16 15:31:09 1997 Judy Goldberg <judygold@sanwafp.com>
+
+ * pt.c (determine_explicit_specialization): Initialize "dummy"
+ to keep Purify quiet.
+
+Thu Oct 16 00:14:48 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (build_overload_value): Handle TEMPLATE_CONST_PARMs here.
+ (build_overload_int): Not here.
+
+Wed Oct 15 00:35:28 1997 Mike Stump <mrs@wrs.com>
+
+ * class.c (build_type_pathname): Remove.
+ (prepare_fresh_vtable): Fix problem with complex MI vtable names.
+
+1997-10-14 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y (unary_expr): Give a pedwarn if someone tries to use the
+ &&label GNU extension.
+
+Tue Oct 14 12:01:00 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * decl.c (pushtag): Unset DECL_ASSEMBLER_NAME before setting it,
+ so as to avoid incorrect manglings.
+ * method.c (build_decl_overload_real): Don't mangle return types
+ for constructors.
+
+Tue Oct 14 11:46:14 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (scratchalloc, build_scratch_list, make_scratch_vec,
+ scratch_tree_cons): Define as macros for now.
+ * call.c, class.c, cvt.c, decl.c, decl2.c, except.c, expr.c, init.c,
+ lex.c, method.c, parse.y, pt.c, rtti.c, search.c, tree.c, typeck.c,
+ typeck2.c: Use them and the expression_obstack variants.
+
+Mon Oct 13 17:41:26 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * decl.c (store_return_init): Allow classes with explicit ctors to
+ be used with the named return values extension.
+
+Fri Oct 10 12:21:11 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_decl): Fix previous change.
+
+Thu Oct 9 12:08:21 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst): Fix thinko.
+ (instantiate_decl): Really use the original template.
+
+ * call.c (build_new_method_call): Use simple constructor_name for
+ error messages.
+
+Wed Oct 8 22:44:42 1997 Jeffrey A Law <law@cygnus.com>
+
+ * method.c (build_underscore_int): Don't use ANSI specific
+ features.
+
+Wed Oct 8 00:18:22 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_prevtable_vardecl): Check DECL_REALLY_EXTERN
+ for our key method; it might have been inlined by -O3.
+
+Tue Oct 7 23:00:12 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * decl.c (make_typename_type): Do not try to call lookup_field for
+ non-aggregate types.
+
+Tue Oct 7 22:52:10 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_reinterpret_cast): Tweak.
+
+Tue Oct 7 22:45:31 1997 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * typeck.c (build_reinterpret_cast): Converting a void pointer
+ to function pointer with a reinterpret_cast produces a warning
+ if -pedantic is issued.
+
+Tue Oct 7 22:43:43 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
+
+ * typeck.c (c_expand_return): Don't warn about returning a
+ reference-type variable as a reference.
+
+Tue Oct 7 21:11:22 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (build_static_name): Fix typo.
+
+1997-10-07 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (duplicate_decls): Make sure DECL_LANG_SPECIFIC is set on
+ OLDDECL before we try to do DECL_USE_TEMPLATE.
+
+Tue Oct 7 00:48:36 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (duplicate_decls): Don't warn about template instances.
+
+ * typeck.c (mark_addressable): Lose ancient code that unsets
+ DECL_EXTERNAL.
+
+ * pt.c (do_decl_instantiation): Lose support for instantiating
+ non-templates.
+
+ * call.c (build_new_function_call): Fix handling of null explicit
+ template args.
+ (build_new_method_call): Likewise.
+
+Mon Oct 6 23:44:34 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * method.c (build_underscore_int): Fix typo.
+
+1997-10-06 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * tree.c (print_lang_statistics): #if 0 call to
+ print_inline_obstack_statistics until its definition is checked in.
+
+Mon Oct 6 09:27:29 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_file): Move dump_tree_statistics to end.
+
+ * pt.c (instantiate_decl): Look for the original template.
+ (tsubst): Set DECL_IMPLICIT_INSTANTIATION on partial instantiations
+ of member templates.
+
+Wed Oct 1 08:41:38 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * Makefile.in (g++FAQ.*): New rules.
+ (CONFLICTS): Update.
+ * g++FAQ.texi: Moved from libg++.
+
+ * parse.y (PFUNCNAME): Only specify the type once.
+
+1997-10-01 Brendan Kehoe <brendan@lasher.cygnus.com>
+
+ * lex.c (real_yylex): Clean up the code to fully behave the way
+ the c-lex.c parser does for complex and real numbers.
+
+Tue Sep 30 08:51:36 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (build_decl_overload_real): Reformat.
+
+Tue Sep 30 00:18:26 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (synthesize_method): If at_eof, determine our linkage.
+
+1997-09-29 Paul Eggert <eggert@twinsun.com>
+
+ * lex.c (real_yylex): Treat `$' just like `_', except issue a
+ diagnostic if !dollars_in_ident or if pedantic.
+
+ * lang-specs.h (@c++): -ansi no longer implies -$.
+
+ * decl2.c (lang_decode_option):
+ -traditional and -ansi now do not mess with
+ dollars_in_ident.
+
+Mon Sep 29 19:57:51 1997 H.J. Lu <hjl@gnu.ai.mit.edu>
+
+ * Makefile.in (parse.o, decl.o): Also depend on
+ $(srcdir)/../except.h $(srcdir)/../output.h.
+ (decl2.o): Also depend on $(srcdir)/../expr.h ../insn-codes.h
+ $(srcdir)/../except.h $(srcdir)/../output.h.
+ (typeck.o, init.o): Also depend on $(srcdir)/../expr.h
+ ../insn-codes.h.
+
+ * call.c, cp-tree.h, decl.c, tree.c: Finish prototyping.
+
+ * expr.c (cplus_expand_expr): Make it static.
+
+ * decl2.c, init.c, typeck.c: Include "expr.h".
+ (expand_expr): Use proper values when calling the function.
+
+Mon Sep 29 11:05:54 1997 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * lang-options.h: New -Wold-style-cast flag.
+ * cp-tree.h (warn_old_style_cast): New variable.
+ * decl2.c (warn_old_style_cast): Likewise.
+ (lang_decode_option): Support -Wold-style-cast.
+ (reparse_absdcl_as_casts): Produce old-style-cast warning.
+
+Mon Sep 29 09:20:53 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * decl.c (cp_finish_decl): Allow expand_aggr_init to set
+ TREE_USED, reset value based on already_used.
+
+ * init.c (expand_member_init): Revert change.
+
+Mon Sep 29 08:57:53 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h, decl.c, decl2.c, pt.c:
+ Lose DECL_C_STATIC and DECL_PUBLIC. Don't pretend statics are public.
+
+ * decl2.c (lang_decode_option): Add missing ;.
+
+Sat Sep 27 16:22:48 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * friend.c (do_friend): Disable injection for all template-derived
+ decls.
+ * decl2.c (lang_decode_option): Handle -fguiding-decls.
+ * parse.y (notype_template_declarator): New nonterminal.
+ (direct_notype_declarator): Use it.
+ (complex_direct_notype_declarator): Likewise.
+ (object_template_id): Accept any kind of identifier after TEMPLATE.
+ (notype_qualified_id): Don't add template declarators here.
+
+Sat Sep 27 16:21:58 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * call.c (add_template_candidate): Add explicit_targs parameter.
+ (build_scoped_method_call): Use it.
+ (build_overload_call_real): Likewise.
+ (build_user_type_conversion_1): Likewise.
+ (build_new_function_call): Likewise.
+ (build_object_call): Likewise.
+ (build_new_op): Likewise.
+ (build_new_method_call): Likewise.
+ (build_new_function_call): Handle TEMPLATE_ID_EXPR.
+ (build_new_method_call): Likewise.
+
+ * class.c (finish_struct_methods): Add specialization pass to
+ determine which methods were specializing which other methods.
+ (instantiate_type): Handle TEMPLATE_ID_EXPR.
+
+ * cp-tree.def (TEMPLATE_ID_EXPR): New tree code.
+
+ * cp-tree.h (name_mangling_version): New variable.
+ (flag_guiding_decls): Likewise.
+ (build_template_decl_overload): New function.
+ (begin_specialization): Likewise.
+ (reset_specialization): Likewise.
+ (end_specialization): Likewise.
+ (determine_explicit_specialization): Likewise.
+ (check_explicit_specialization): Likewise.
+ (lookup_template_function): Likewise.
+ (fn_type_unification): Add explicit_targs parameter.
+ (type_unification): Likewise.
+
+ * decl.c (duplicate_decls): Add smarts for explicit
+ specializations.
+ (grokdeclarator): Handle TEMPLATE_ID_EXPR, and function
+ specializations.
+ (grokfndecl): Call check_explicit_specialization.
+
+ * decl2.c (lang_decode_option): Handle -fname-mangling-version.
+ (build_expr_from_tree): Handle TEMPLATE_ID_EXPR.
+ (check_classfn): Handle specializations.
+
+ * error.c (dump_function_name): Print specialization arguments.
+
+ * friend.c (do_friend): Don't call pushdecl for template
+ instantiations.
+
+ * init.c (build_member_call): Handle TEMPLATE_ID_EXPR.
+
+ * lang-options.h: Add -fname-mangling-version, -fguiding-decls,
+ and -fno-guiding-decls.
+
+ * lex.c (identifier_type): Return PFUNCNAME for template function
+ names.
+
+ * method.c (build_decl_overload_real): New function.
+ (build_template_parm_names): New function.
+ (build_overload_identifier): Use it.
+ (build_underscore_int): New function.
+ (build_overload_int): Use it. Add levels for template
+ parameters.
+ (build_overload_name): Likewise. Also, handle TYPENAME_TYPEs.
+ (build_overload_nested_names): Handle template type parameters.
+ (build_template_decl_overload): New function.
+
+ * parse.y (YYSTYPE): New ntype member.
+ (nested_name_specifier): Use it.
+ (nested_name_specifier_1): Likewise.
+ (PFUNCNAME): New token.
+ (template_id, object_template_id): New non-terminals.
+ (template_parm_list): Note specializations.
+ (template_def): Likewise.
+ (structsp): Likewise.
+ (fn.def2): Handle member template specializations.
+ (component_decl_1): Likewise.
+ (direct_notype_declarator): Handle template-ids.
+ (component_decl_1): Likewise.
+ (direct_notype_declarator): Handle template-ids.
+ (primary): Handle TEMPLATE_ID_EXPR, and template-ids.
+
+ * pt.c (processing_specializations): New variable.
+ (template_header_count): Likewise.
+ (type_unification_real): New function.
+ (processing_explicit_specialization): Likewise.
+ (note_template_header): Likewise.
+ (is_member_template): Handle specializations.
+ (end_template_decl): Call reset_specialization.
+ (push_template_decl): Handle member template specializations.
+ (tsubst): Likewise.
+ (tsubst_copy): Handle TEMPLATE_ID_EXPR.
+ (instantiate_template): Handle specializations.
+ (instantiate_decl): Likewise.
+ (fn_type_unification): Handle explicit_targs.
+ (type_unification): Likewise. Allow incomplete unification
+ without an error message, if allow_incomplete.
+ (get_bindings): Use new calling sequence for fn_type_unification.
+
+ * spew.c (yylex): Handle PFUNCNAME.
+
+ * tree.c (is_overloaded_fn): Handle TEMPLATE_ID_EXPR.
+ (really_overloaded_fn): Likewise.
+ (get_first_fn): Handle function templates.
+
+ * typeck.c (build_x_function_call): Use really_overloaded_fn.
+ Handle TEMPLATE_ID_EXPR.
+ (build_x_unary_op): Likewise.
+ (build_unary_op): Likewise.
+ (mark_addressable): Templates whose address is taken are marked
+ as used.
+
+1997-09-25 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * decl.c (init_decl_processing): Declare __builtin_constant_p as
+ accepting any kind of type, not only int.
+
+Fri Sep 26 00:22:56 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * search.c (get_matching_virtual): Notice virtual bases when sorrying
+ about covariant returns.
+
+ * parse.y (member_init): Also imply typename here. Remove ancient
+ extension for initializing base members.
+
+Thu Sep 25 11:11:13 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ Handle multi-level typenames and implicit typename in base list.
+ * parse.y (typename_sub{,[0-2]}): New rules.
+ (structsp, rule TYPENAME_KEYWORD): Use typename_sub.
+ (nonnested_type): New rule.
+ (complete_type_name): Use it.
+ (base_class.1): Use typename_sub and nonnested_type.
+ (nested_name_specifier): Don't elide std:: here.
+ * decl.c (make_typename_type): Handle getting a type for NAME.
+ (lookup_name_real): Turn std:: into :: here.
+
+ Rvalue conversions were removed in London.
+ * call.c (is_subseq): Don't consider lvalue transformations.
+ (build_conv): LVALUE_CONV and RVALUE_CONV get IDENTITY_RANK.
+ (joust): Re-enable ?: kludge.
+
+1997-09-22 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (start_function): Up warning of no return type to be a
+ pedwarn.
+
+Mon Sep 22 14:15:34 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * init.c (expand_member_init): Don't set TREE_USED.
+ * decl.c (cp_finish_decl): Mark decls used if type has TREE_USED
+ set,don't clear TREE_USED wholesale.
+
+Sat Sep 20 15:31:00 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_over_call): Do require_complete_type before
+ build_cplus_new.
+
+Thu Sep 18 16:47:52 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * search.c (lookup_field): Call complete_type in all cases.
+
+ * decl.c (finish_function): Just warn about flowing off the end.
+
+Wed Sep 17 10:31:25 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokparms): Don't bash a permanent list node if we're
+ in a function.
+
+1997-09-17 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * Makefile.in (CONFLICTS): Fix s/r conflict count to 18.
+
+Tue Sep 16 14:06:56 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_new_op): Give better error for syntactically
+ correct, but semantically invalid, use of undeclared template.
+
+ * call.c (compare_qual): Handle pmfs.
+
+ * decl.c (store_parm_decls): last_parm_cleanup_insn is the insn
+ after the exception spec.
+
+Mon Sep 15 11:52:13 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (null_ptr_cst_p): Integer type, not integral type.
+
+ * call.c (joust): Disable warnings until they can be moved to the
+ right place.
+
+Fri Sep 12 16:11:13 1997 Per Bothner <bothner@cygnus.com>
+
+ * Makefile.in, config-lang.in: Convert to autoconf.
+
+Thu Sep 11 17:14:55 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (lookup_name_real): Add implicit 'typename' to types from
+ base classes.
+
+ * pt.c (most_specialized_class): Fix typo.
+ (tsubst): Move constant folding to TREE_VEC case.
+
+Thu Sep 11 10:08:45 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (do_poplevel): Don't warn about unused local variables
+ while processing_template_decl since we don't always know whether
+ or not they will need constructing/destructing.
+
+ * pt.c (uses_template_parms): Check the values of an enumeration
+ type to make sure they don't depend on template parms.
+
+ * decl.c (make_typename_type): Don't lookup the field if the
+ context uses template parms, even if we're not
+ processing_template_decl at the moment.
+
+ * pt.c (coerce_template_parms): Avoid looking at the
+ TYPE_LANG_DECL portion of a typename type, since there won't be
+ one.
+ (tsubst): Do constant folding as necessary to make sure that
+ arguments passed to lookup_template_class really are constants.
+
+Wed Sep 10 11:21:55 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * except.c (expand_builtin_throw): #ifndef DWARF2_UNWIND_INFO.
+ * decl2.c (finish_file): Only register exception tables if we
+ need to.
+
+ * decl.c (init_decl_processing): Add __builtin_[fs]p.
+
+Tue Sep 9 19:49:38 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (unify): Just return 0 for a TYPENAME_TYPE.
+
+Tue Sep 9 17:57:25 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * error.c (dump_decl): Avoid crashing when presented with a
+ uninitialized constant, as can occur with a template parameter.
+ (dump_expr): Make sure that there are enough levels of
+ current_template_parms before we start diving through them.
+
+1997-09-09 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * typeck.c (build_indirect_ref): Heed FLAG_VOLATILE similar to
+ c-typeck.c.
+
+Tue Sep 9 09:36:39 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * except.c (expand_throw): Call build_delete for all
+ exception types, not just objects with destructors.
+
+Mon Sep 8 02:33:20 1997 Jody Goldberg <jodyg@idt.net>
+
+ * decl.c (current_local_enum): Remove static.
+ * pt.c (tsubst_enum): Save and restore value of current_local_enum
+ in case template is expanded in enum decl.
+ (instantiate_class_template): Use new tsubst_enum signature.
+ (tsubst_expr): Likewise.
+
+Mon Sep 8 01:21:43 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (begin_member_template_processing): Take a function as
+ argument, not a set of template arguments. Use the template
+ parameters, rather than the arguments. Handle non-type parameters
+ correctly. Push a binding level for the parameters so that multiple
+ member templates using the same parameter names can be declared.
+ (end_member_template_processing): Pop the binding level.
+ (push_template_decl): Mark member templates as static when
+ appropriate.
+
+ * lex.c (do_pending_inlines): Pass the function, not its template
+ arguments, to begin_member_template_processing.
+ (process_next_inline): Likewise.
+ (do_pending_defargs): Likewise.
+
+ * error.c (dump_expr): Obtain the correct declaration for a
+ TEMPLATE_CONST_PARM.
+
+ * call.c (add_template_conv_candidate): New function.
+ (build_object_call): Handle member templates, as done in the other
+ build_ functions.
+
+Sat Sep 6 10:20:27 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * decl.c (replace_defag): Undo previous change.
+ * lex.c (do_pending_defargs): Deal with member templates.
+
+ * pt.c (is_member_template): Avoid crashing when passed a
+ non-function argument.
+
+Fri Sep 5 17:27:38 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (grow_method): Remove check for redeclaration.
+
+Fri Sep 5 01:37:17 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * cp-tree.h (INNERMOST_TEMPLATE_PARMS): New macro.
+ (DECL_INNERMOST_TEMPLATE_PARMS): Likewise.
+ (PRIMARY_TEMPLATE_P): Use it.
+ * call.c (build_overload_call_real): Use it.
+ * class.c (instantiate_type): Likewise.
+ * decl.c (decls_match): Likewise.
+ * method.c (build_overload_identifier): Likewise.
+ * pt.c (push_template_decl): Likewise.
+ (classtype_mangled_name): Likewise.
+ (lookup_template_class): Likewise.
+
+ * cp-tree.h (DECL_NTPARMS): Change name from DECL_NT_PARMS to
+ DECL_NTPARMS to conform to usage elsewhere.
+ * call.c (add_template_candidate): Likewise.
+ * class.c (instantiate_type): Likewise.
+ * pt.c (instantiate_template): Likewise.
+ (get_bindings): Likewise.
+
+ * class.c (grow_method): Use DECL_FUNCTION_TEMPLATE_P instead of
+ is_member_template.
+
+ * pt.c (unify): Undo changes to allow multiple levels of template
+ parameters.
+ (type_unification): Likewise.
+ (fn_type_unification): Likewise.
+ (get_class_bindings): Likewise.
+ * cp-tree.h (Likewise).
+
+ * decl.c (replace_defarg): Check that the type of the default
+ parameter does not invlove a template type before complaining
+ about the initialization.
+
+ * error.c (dump_expr): Deal with template constant parameters in
+ member templates correctly.
+
+ * pt.c (is_member_template): Deal with class specializations
+ correctly.
+ (tsubst): Handle "partial instantiation" of member templates
+ correctly.
+
+Wed Sep 3 12:30:24 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * pt.c (type_unification): Change calling sequence to allow for
+ multiple levels of template parameters.
+ (tsubst_expr): Likewise.
+ (tsubst): Likewise.
+ (tsubst_copy): Likewise.
+ (instantiate_template): Likewise.
+ (unify): Likewise.
+ * call.c (build_overload_call_real): Use it.
+ (add_builtin_candidate): Use it.
+ (build_new_method_call): Use it.
+ * class.c (instantiate_type): Use it.
+ * decl.c (grokdeclarator): Use it.
+ * decl2.c (finish_file): Use it.
+ * method.c (build_overload_identifier): Use it.
+
+ * call.c (add_template_candidate): Add additional parameter for
+ the function return type. Call fn_type_unification istead of
+ type_unification.
+ (build_user_type_conversion_1): Handle member templates.
+ (build_new_function_call): Likewise.
+ (build_new_op): Likewise.
+ (build_new_method_call): Likewise.
+
+ * class.c (grow_method): Don't give an error message indicating
+ that two member templates with the same name are ambiguous.
+ (finish_struct): Treat member template functions just like member
+ functions.
+
+ * cp-tree.h (check_member_template): Add declaration.
+ (begin_member_template_processing): Likewise.
+ (end_member_template_processing): Likewise.
+ (fn_type_unification): Likewise.
+ (is_member_template): Likewise.
+ (tsubst): Change prototype.
+ (tsubst_expr): Likewise.
+ (tsubst_copy): Likewise.
+ (instantiate_template): Likewise.
+ (get_bindings): Likewise.
+
+ * decl.c (decls_match): Handle multiple levels of template
+ parameters.
+ (pushdecl): Handle template type params just like other type
+ declarations.
+ (push_class_level_binding): Return immediately if the
+ class_binding_level is NULL.
+ (grokfndecl): If check_classfn() returns a member_template, use
+ the result of the template, not the template itself.
+
+ * decl2.c (check_member_template): New function. Check to see
+ that the entity declared to be a member template can be one.
+ (check_classfn): Allow redeclaration of member template functions
+ with different types; the new functions can be specializations or
+ explicit instantiations.
+
+ * error.c (dump_decl): Handle multiple levels of template
+ parameters.
+ (dump_function_decl): Update to handle function templates.
+
+ * lex.c (do_pending_inlines): Set up template parameter context
+ for member templates.
+ (process_next_inline): Likewise.
+
+ * method.c (build_overload_identifier): Adjust for multiple levels
+ of template parameters.
+
+ * parse.y (fn.def2): Add member templates.
+ (component_decl_1): Likewise.
+
+ * pt.c (begin_member_template_processing): New function.
+ (end_member_template_processing): Likewise.
+ (is_member_template): Likewise.
+ (fn_type_unification): Likewise.
+ (current_template_parms): Return a vector of all the template
+ parms, not just the innermost level of parms.
+ (push_template_decl): Deal with the possibility of member
+ templates.
+ (lookup_template_class): Likewise.
+ (uses_template_parms): Likewise.
+ (tsubst): Modify processing to TEMPLATE_TYPE_PARM and
+ TEMPLATE_CONST_PARM to deal with multiple levels of template
+ arguments. Add processing of TEMPLATE_DECL to produce new
+ TEMPLATE_DECLs from old ones.
+ (do_decl_instantiation): Handle member templates.
+
+ * search.c (lookup_fnfields_1): Handle member template conversion
+ operators.
+
+ * tree.c (cp_tree_equal): Check the levels, as well as the
+ indices, of TEMPLATE_CONST_PARMs.
+
+ * typeck.c (comptypes): Check the levels, as well as the indices,
+ fo TEMPLATE_TYPE_PARMs.
+ (build_x_function_call): Treat member templates like member
+ functions.
+
+Wed Sep 3 11:09:25 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (c_expand_return): Always convert_for_initialization
+ before checking for returning a pointer to local.
+
+ * pt.c (type_unification): If strict and the function parm doesn't
+ use template parms, just compare types.
+
+Wed Sep 3 10:35:49 1997 Klaus Espenlaub <kespenla@student.informatik.uni-ulm.de>
+
+ * method.c (build_overloaded_value): Replace direct call
+ to the floating point emulator with REAL_VALUE_TO_DECIMAL macro.
+
+Wed Sep 3 00:02:53 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (convert_arguments): Don't arbitrarily choose the first
+ of a set of overloaded functions.
+
+Tue Sep 2 12:09:13 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (real_yylex): Don't elide __FUNCTION__.
+
+ * method.c (build_overload_value): Add in_template parm.
+ (build_overload_int): Likewise.
+ (build_overload_identifier): Pass it.
+
+ * decl.c (duplicate_decls): Don't bash a previous template
+ definition with a redeclaration.
+
+ * pt.c (unify): float doesn't match double.
+
+ * pt.c (do_type_instantiation): Handle getting a _TYPE or a
+ TYPE_DECL. Handle getting non-template types.
+ * parse.y (explicit_instantiation): Use typespec instead of
+ aggr template_type.
+
+Tue Sep 2 10:27:08 1997 Richard Henderson <rth@cygnus.com>
+
+ * typeck.c (build_ptrmemfunc1): Clean up ptr->int cast warnings.
+
+Mon Sep 1 13:19:04 1997 Eugene Mamchits <eugin@ips.ras.ru>
+
+ * call.c (add_builtin_candidate): Add missing TREE_TYPE.
+ (compare_ics): Likewise.
+
+Mon Sep 1 13:19:04 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (joust): Warn about choosing one conversion op over
+ another because of 'this' argument when the other return type is
+ better.
+ (source_type): New fn.
+
+ * call.c (build_new_op): Strip leading REF_BIND from first operand
+ to builtin operator.
+
+ * decl2.c (mark_vtable_entries): Mark abort_fndecl as used when we
+ use its RTL.
+
+Thu Aug 28 09:45:23 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (null_ptr_cst_p): Remove support for (void*)0.
+
+Wed Aug 27 02:03:34 1997 Jeffrey A Law <law@cygnus.com>
+
+ * typeck.c (expand_target_expr): Make definition match declaration.
+
+ * class.c (get_basefndecls): Make definition match declaration.
+
+Mon Aug 25 14:30:02 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * input.c (sub_getch): Eventually give up and release the input file.
+
+ * decl.c (cp_finish_decl): If #p i/i, put inline statics in the
+ right place.
+
+ * call.c (joust): Tweak message.
+
+Sat Aug 23 18:02:59 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * error.c (type_as_string): Put const/volatile on template type
+ parameters where appropriate.
+
+Sat Aug 23 17:47:22 1997 Jeffrey A Law <law@cygnus.com>
+
+ * call.c (strictly_better): Make arguments unsigned ints.
+
+Thu Aug 21 18:48:44 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (real_yylex): Refer to __complex instead of complex.
+
+Thu Aug 21 22:25:46 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * lex.c (real_yylex): Don't use getc directly.
+
+Wed Aug 20 17:25:08 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (is_subseq): Don't try to be clever.
+
+Wed Aug 20 03:13:36 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
+
+ * parse.y, pt.c: Include "except.h".
+ * call.c, class.c, class.h, cp-tree.h, cvt.c, decl.c, decl2.c,
+ error.c, except.c, expr.c, friend.c, g++spec.c, init.c, input.c,
+ lex.c, lex.h, method.c, parse.y, pt.c, repo.c, rtti.c, search.c,
+ sig.c, spew.c, tree.c, typeck.c, typeck2.c, xref.c: Finish
+ prototyping.
+
+Wed Aug 20 01:34:40 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (mark_vtable_entries): Instead of replacing pure
+ virtuals with a reference to __pure_virtual, copy the decl and
+ change the RTL.
+
+Tue Aug 19 02:26:07 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (lookup_nested_type_by_name): Handle typedef wierdness.
+
+ * typeck2.c (my_friendly_abort): Report bugs to egcs-bugs@cygnus.com.
+
+ * pt.c (instantiate_class_template): Call repo_template_used
+ before finish_prevtable_vardecl.
+
+ * call.c (is_subseq): New fn.
+ (compare_ics): Use it.
+
+ * repo.c (finish_repo): Don't crash on no args.
+
+ * parse.y (named_complex_class_head_sans_basetype): Handle
+ explicit global scope.
+ * decl2.c (handle_class_head): New fn.
+
+ * pt.c (unify): Add CONST_DECL case.
+
+Thu Aug 14 10:05:13 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * rtti.c (permanent_obstack): Fix decl to not be a pointer.
+
+ * cp-tree.h (report_type_mismatch): Add prototype.
+ * call.c (build_overload_call_real): Remove erroneous fourth
+ argument to report_type_mismatch.
+ (build_user_type_conversion_1): Remove erroneous second arg to
+ tourney.
+ (build_new_function_call): Likewise.
+ (build_object_call): Likewise.
+ (build_new_op): Likewise.
+ (build_new_method_call): Likewise.
+
+Wed Aug 13 19:19:25 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * error.c (dump_decl): Don't bother processing a function with no
+ DECL_LANG_SPECIFIC.
+
+ * method.c (emit_thunk): Call init_function_start in the macro case.
+
+Wed Aug 13 10:46:19 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
+
+ * decl2.c (DEFAULT_VTABLE_THUNKS): Define to be 0 if not
+ defined and used to set flag_vtable_thunks.
+
+Tue Aug 12 20:13:57 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y: Don't clear the inlines from their obstack until they've
+ all been processed.
+
+ * decl.c (duplicate_decls): Don't complain about exception
+ specification mismatch if flag_exceptions is off.
+
+Mon Aug 11 15:01:56 1997 Marc Lehmann <pcg@goof.com>
+
+ * Make-lang.in (c++.distclean): Remove g++.c on make distclean.
+
+Sun Aug 10 12:06:09 1997 Paul Eggert <eggert@twinsun.com>
+
+ * cp-tree.h: Replace STDIO_PROTO with PROTO in include files.
+ * cvt.c, error.c, except.c, expr.c, friend.c, init.c, rtti.c:
+ Include <stdio.h> before include files that formerly used STDIO_PROTO.
+
+ * decl.c, g++spec.c, lex.c, method.c, repo.c:
+ Include "config.h" first, as per autoconf manual.
+
+Fri Aug 8 11:47:48 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (duplicate_decls): Tweak wording.
+ * lex.c (do_pending_defargs): Don't die if we see a default arg
+ that isn't a DEFAULT_ARG.
+ * error.c (dump_expr): Handle DEFAULT_ARG.
+
+ * decl2.c (lang_decode_option): Handle -fhandle-exceptions.
+ * lang-options.h: Add -fhandle-exceptions.
+
+ * class.c (build_vtable): Vtables are artificial.
+ (prepare_fresh_vtable): Likewise.
+
+Wed Aug 6 11:02:36 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (ocp_convert): After converting to the target type, set
+ LOOKUP_NO_CONVERSION.
+
+ * call.c (joust): Warn about potentially confusing promotion rules
+ with -Wsign-promo.
+ * cp-tree.h, lang-options.h, decl2.c: Support -Wsign-promo.
+
+Tue Aug 5 15:15:07 1997 Michael Meissner <meissner@cygnus.com>
+
+ * exception.cc: Declare __terminate_func with noreturn attribute.
+
+Fri Aug 1 03:18:15 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y: Break out eat_saved_input, handle errors.
+ (function_try_block): Use compstmt instead of compstmt_or_error.
+
+Thu Jul 31 17:14:04 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (build_cplus_new): Don't set TREE_ADDRESSABLE.
+
+Fri Jul 4 01:45:16 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * Make-lang.in (cplib2.txt, cplib2.ready): Instead of checking for
+ existence of cc1plus check whether $(LANGUAGES) contains C++.
+
+Wed Jul 30 13:04:21 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * method.c (do_build_copy_constructor): When copying an anonymous
+ union member loop around to handle nested anonymous unions. Use
+ the offset of the member relative to the outer structure, not the
+ union.
+
+Tue Jul 29 21:17:29 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (resolve_args): New fn.
+ (build_new_function_call): Use it.
+ (build_object_call): Likewise.
+ (build_new_method_call): Likewise.
+
+Mon Jul 28 16:02:36 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_over_call): tsubst all default parms from templates.
+
+Wed Jul 23 13:36:25 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (struct cp_function): Add static_labelno.
+ (push_cp_function_context): Save it.
+ (pop_cp_function_context): Restore it.
+
+Tue Jul 22 14:43:29 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_component_ref_1): Convert from reference.
+
+Tue Jul 22 11:06:23 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y (current_declspecs, prefix_attributes): Initialize to
+ NULL_TREE.
+
+ * parse.y (initdcl0): Make sure CURRENT_DECLSPECS is non-nil
+ before we try to force it to be a TREE_LIST.
+ (decl): Make sure $1.t is non-nil.
+
+Sun Jul 20 11:53:07 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (uses_template_parms): Handle template first-parse codes.
+
+ * decl.c (cp_finish_decl): Only warn about user-defined statics.
+
+Fri Jul 18 17:56:08 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (unify): Handle BOOLEAN_TYPE.
+
+ * cp-tree.h: Lose PARM_DEFAULT_FROM_TEMPLATE.
+ * pt.c (tsubst): Don't set it.
+ * call.c (build_over_call): Use uses_template_parms.
+
+Thu Jul 17 18:06:30 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (build_overload_nested_name): Use static_labelno
+ instead of var_labelno.
+ (build_qualified_name): New fn.
+ (build_overload_name): Split out from here.
+ (build_static_name): Use build_qualified_name.
+ * decl.c (cp_finish_decl): Statics in extern inline functions
+ have comdat linkage.
+ (start_function): Initialize static_labelno.
+
+Thu Jul 17 11:20:17 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * class.c (finish_struct_methods): Add check of warn_ctor_dtor_privacy
+ before "all member functions in class [] are private".
+
+Wed Jul 16 23:47:08 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (do_scoped_id): convert_from_reference.
+ * init.c (build_offset_ref): Likewise.
+
+Wed Jul 16 12:34:29 1997 Benjamin Kosnik <bkoz@lisa.cygnus.com>
+
+ * error.c (dump_expr): Check TREE_OPERAND before dump_expr_list.
+
+Mon Jul 14 03:23:46 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (get_member_function_from_ptrfunc): Promote index
+ before saving it.
+
+Sun Jul 13 00:11:52 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (layout_basetypes): Move non-virtual destructor warning.
+ * decl.c (xref_basetypes): Remove non-virtual destructor warning.
+
+Sat Jul 12 12:47:12 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokdeclarator): Call add_defarg_fn for the function
+ type, too.
+ * lex.c (add_defarg_fn): Adjust.
+ (do_pending_defargs): Adjust. Don't skip the first parm.
+
+Fri Jul 11 01:39:50 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (build_enumerator): Global enumerators are also readonly.
+
+ * rtti.c (build_dynamic_cast_1): Renamed from build_dynamic_cast.
+ (build_dynamic_cast): Call it and convert_from_reference.
+
+ * lex.c (add_defarg_fn): New fn.
+ (snarf_defarg): Don't add to defarg_types.
+ (do_pending_defargs): Lose defarg_types. All fns we process now
+ have defargs.
+ * decl.c (grokfndecl): Call add_defarg_fn.
+
+ * Makefile.in (CONFLICTS): Expect 18 s/r conflicts.
+ * cp-tree.def: Add DEFAULT_ARG.
+ * spew.c (yylex): Call snarf_defarg as appropriate.
+ * parse.y: New tokens DEFARG and DEFARG_MARKER.
+ (defarg_again, pending_defargs, defarg, defarg1): New rules.
+ (structsp): Use pending_defargs.
+ (parms, full_parm): Use defarg.
+ * lex.c (init_lex): Initialize inline_text_firstobj.
+ (do_pending_inlines): Never pass the obstack to feed_input.
+ (process_next_inline): Call end_input instead of restore_pending_input.
+ (clear_inline_text_obstack, reinit_parse_for_expr, do_pending_defargs,
+ finish_defarg, feed_defarg, snarf_defarg, maybe_snarf_defarg): New fns.
+ * input.c (end_input): New fn.
+ (sub_getch): At the end of some fed input, just keep returning EOF
+ until someone calls end_input.
+ Remove 'obstack' field from struct input_source.
+ * decl.c (grokparms): Handle DEFAULT_ARG.
+ (replace_defarg): New fn.
+ * cp-tree.h (DEFARG_LENGTH, DEFARG_POINTER): New macros.
+
+Wed Jul 9 13:44:12 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (implicit_conversion): If nothing else works, try binding
+ an rvalue to a reference.
+
+Wed Jul 9 13:04:38 1997 Geoffrey Noer <noer@cygnus.com>
+
+ * decl.c (init_decl_processing): Fix Jun 30 patch -- move
+ ifndef for Cygwin32 to include SIGSEGV.
+
+Thu Jul 3 01:44:05 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * 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 <noer@cygnus.com>
+
+ * decl.c (init_decl_processing): 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 <jason@yorick.cygnus.com>
+
+ * tree.c (mapcar, case CALL_EXPR): Handle all the parse node data.
+
+Fri Jun 27 15:18:49 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * 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 <jason@yorick.cygnus.com>
+
+ * Make-lang.in (cplib2.ready): Add $(LANGUAGES) dependency.
+
+Thu Jun 19 16:49:28 1997 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (c_expand_return): Make sure we clean up temporaries at
+ the end of return x;
+
+Thu Jun 19 12:28:43 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * lex.c (check_for_missing_semicolon): Also check for CV_QUALIFIER.
+
+Tue Jun 17 18:35:57 1997 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_builtin_throw): Add support
+ -fno-sjlj-exceptions -fPIC exception handling on the SPARC.
+
+Mon Jun 16 01:24:37 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * repo.c (extract_string): Null-terminate.
+
+ * cp-tree.h (TI_SPEC_INFO): New macro.
+ (CLASSTYPE_TI_SPEC_INFO): New macro.
+ * pt.c (push_template_decl): Correctly determine # of template parms
+ for partial specs.
+
+ * call.c (compare_ics): Really fix 'this' conversions.
+
+ * pt.c (do_decl_instantiation): Don't crash on explicit inst of
+ non-template fn.
+
+ * pt.c (push_template_decl): Complain about mismatch in # of
+ template parms between a class template and a member template.
+
+Sun Jun 15 02:38:20 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (synthesize_method): You can't call
+ function_cannot_inline_p after finish_function.
+ * decl.c (finish_function): Turn on flag_inline_functions and turn
+ off DECL_INLINE before handing a synthesized method to the
+ backend.
+
+Thu Jun 12 17:35:28 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (synthesize_method): Remove July 30 change to never set
+ DECL_INLINE if at_eof.
+
+Thu Jun 12 15:25:08 1997 Mike Stump <mrs@cygnus.com>
+
+ * xref.c (GNU_xref_member): Ensure that the node has a
+ decl_lang_specific part before checking DECL_FRIEND_P.
+
+Thu Jun 12 12:36:05 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_class_template): Diagnose non-class types used
+ as bases.
+
+Wed Jun 11 17:33:40 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_conditional_expr): Use convert_for_initialization
+ instead of convert_and_check.
+
+Wed Jun 11 12:31:33 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y (typespec): Don't pedwarn for typeof.
+
+Tue Jun 10 00:22:09 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * repo.c (finish_repo): Only check changes if we would write a
+ repo file.
+
+ * call.c (compare_ics): Fix handling of 'this' conversions.
+
+ * pt.c (do_decl_instantiation): Support static data too. Rename
+ from do_function_instantiation.
+ * cp-tree.h: Adjust.
+ * parse.y: Adjust.
+
+ * repo.c (extract_string): New fn.
+ (get_base_filename): Use it.
+ (init_repo): Compare old args with current args.
+
+Mon Jun 9 14:25:30 1997 Mike Stump <mrs@cygnus.com>
+
+ * Makefile.in, Make-lang.in: Protect C-ls with a comment
+ character, idea from Paul Eggert <eggert@twinsun.com>.
+
+Mon Jun 9 01:52:03 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (c_expand_return): Be more persistent in looking for
+ returned temps.
+
+ * cvt.c (build_up_reference): Use NOP_EXPR for switching from
+ pointer to reference.
+
+ * class.c (build_vbase_path): Don't do anything if PATH has no steps.
+
+Sun Jun 8 03:07:05 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (build_member_call, build_offset_ref):
+ Use do_scoped_id instead of do_identifier.
+
+ * cvt.c (convert): Remove bogosity.
+
+Sat Jun 7 20:50:17 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cvt.c (build_up_reference): Do checks of ARGTYPE and
+ TARGET_TYPE before trying to use get_binfo.
+
+Fri Jun 6 17:36:39 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (build_up_reference): Call get_binfo to get access control.
+
+ * decl2.c (import_export_decl): If we don't support weaks, leave
+ statics undefined.
+
+Fri Jun 6 15:55:49 1997 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_builtin_throw): Add support for machines that
+ cannot access globals after throw's epilogue when
+ -fno-sjlj-exceptions is used.
+
+Thu Jun 5 16:28:43 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y: 'std::' becomes '::'.
+ * lex.c (real_yylex): Remove 'namespace' warning.
+ * init.c (build_member_call): Ignore 'std::'.
+ (build_offset_ref): Likewise.
+ * decl2.c (do_using_directive): Ignore 'using namespace std;'.
+ (do_toplevel_using_decl): Ignore 'using std::whatever'.
+ * decl.c (push_namespace): Just sorry.
+ (pop_namespace): Nop.
+ (init_decl_processing): Declare std namespace.
+
+Tue Jun 3 18:08:23 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * search.c (push_class_decls): A name which ambiguously refers to
+ several instantiations of the same template just refers to the
+ template.
+
+Tue Jun 3 12:30:40 1997 Benjamin Kosnik <bkoz@cirdan.cygnus.com>
+
+ * decl.c (build_enumerator): Fix problem with unsigned long
+ enumerated values being smashed to ints, causing overflow
+ when computing next enumerated value (for enum values around
+ MAX_VAL).
+
+Mon Jun 2 17:40:56 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_component_ref): Only call mark_used on a decl.
+
+Thu May 29 15:54:17 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * typeck.c (build_c_cast): Make the check for a ptr to function
+ more specific before possible default_conversion call.
+
+Thu May 29 13:02:06 1997 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_exception_blocks): Simplify and fix and make
+ sure we don't end a region in a sequence, as expand_end_bindings
+ doesn't like it.
+
+Wed May 28 17:08:03 1997 Mike Stump <mrs@cygnus.com>
+
+ * except.c (init_exception_processing): Mark terminate as not
+ returning so that the optimizer can optimize better.
+
+Tue May 27 19:49:19 1997 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (convert): Don't do any extra work, if we can avoid it
+ easily.
+
+Tue May 27 18:21:47 1997 Mike Stump <mrs@cygnus.com>
+
+ * *.[chy]: Change cp_convert to ocp_convert, change convert to
+ cp_convert. convert is now reserved for the backend, and doesn't
+ have the semantics a frontend person should ever want.
+
+Fri May 23 10:58:31 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lang-specs.h: Define __EXCEPTIONS if exceptions are enabled.
+ Lose -traditional support.
+
+Thu May 22 15:41:28 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * rtti.c (get_tinfo_var): Use TYPE_PRECISION (sizetype).
+
+ * parse.y (self_reference): Do it for templates, too.
+ * class.c (pushclass): Don't overload_template_name; the alias
+ generated by build_self_reference serves the same purpose.
+
+ * tree.c (list_hash): Make static, take more args.
+ (list_hash_lookup): Likewise.
+ (list_hash_add): Make static.
+ (list_hash_canon): Lose.
+ (hash_tree_cons): Only build a new node if one isn't already in the
+ hashtable.
+ (hash_tree_chain): Use hash_tree_cons.
+ * cp-tree.h: Adjust.
+ * decl.c (grokfndecl): Just check IDENTIFIER_GLOBAL_VALUE instead
+ of calling lookup_name.
+
+Wed May 21 18:24:19 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_class_template): TYPE_VALUES for an enum
+ doesn't refer to the CONST_DECLs.
+
+Tue May 20 21:09:32 1997 Bob Manson <manson@charmed.cygnus.com>
+
+ * rtti.c (get_tinfo_var): Either INT_TYPE_SIZE or 32, whichever
+ is bigger.
+ (expand_class_desc): Convert the last argument to a sizetype.
+
+Tue May 20 13:55:57 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * gxx.gperf (__complex, __complex__, __imag, __imag__, __real,
+ __real__): Add reswords.
+ * hash.h: Regenerate.
+ * lex.h (rid): Add RID_COMPLEX.
+ (RID_LAST_MODIFIER): Set to RID_COMPLEX.
+ * lex.c (init_lex): Add building of RID_COMPLEX.
+ (real_yylex): General cleanup in line with what c-lex.c also has,
+ sans the cruft for traditional; add handling of SPEC_IMAG, complex
+ types, and imaginary numeric constants.
+ * parse.y (REALPART, IMAGPART): Add tokens.
+ (unary_expr): Add REALPART and IMAGPART rules.
+ * cp-tree.h (complex_{integer,float,double,long}_type_node): Declare.
+ * decl.c (complex_{integer,float,double,long}_type_node): Define
+ types.
+ (init_decl_processing): Set up the types.
+ (grokdeclarator): Add handling of RID_COMPLEX. Set and use
+ DEFAULTED_INT instead of EXPLICIT_INT when we default to int type.
+ * call.c (build_new_op): Add REALPART_EXPR and IMAGPART_EXPR cases.
+ * cvt.c (cp_convert): Handle COMPLEX_TYPE.
+ * error.c (dump_type_prefix, dump_type, dump_type_suffix): Add
+ COMPLEX_TYPE case.
+ * method.c (build_overload_name): Add handling of the different
+ COMPLEX_TYPEs, prefixing them with `J'.
+ * pt.c (process_template_parm): Don't let them use a COMPLEX_TYPE
+ as a template parm.
+ (uses_template_parms, tsubst, unify): Add COMPLEX_TYPE case.
+ * tree.c (lvalue_p): Add REALPART_EXPR and IMAGPART_EXPR cases.
+ (mapcar): Handle COMPLEX_CST.
+ * typeck.c (build_binary_op_nodefault): Handle COMPLEX_TYPE.
+ (common_type): Add code for complex types.
+ (build_unary_op): Add REALPART_EXPR and IMAGPART_EXPR cases.
+ (convert_for_assignment): Likewise.
+ (mark_addressable): Add REALPART_EXPR and IMAGPART_EXPR cases.
+
+Mon May 19 12:26:27 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst): Don't pass the MINUS_EXPR for an array domain to
+ tsubst_expr, as it might try to do overload resolution.
+
+Sat May 17 10:48:31 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_class_template): Oops.
+
+Fri May 16 14:23:57 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.def: Add TAG_DEFN.
+ * pt.c (tsubst_enum): New fn.
+ (instantiate_class_template): Use it.
+ (tsubst_expr): Support TAG_DEFN.
+ (tsubst): Support local enums.
+ (tsubst_copy): Likewise.
+ * decl.c (finish_enum): Likewise.
+ (start_enum): If this is a local enum, switch to permanent_obstack.
+
+Wed May 14 19:08:28 1997 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (store_parm_decls): Set last_parm_cleanup_insn here.
+ (finish_function): Put the base init code for constructors just
+ after the parm cleanup insns.
+ (struct cp_function): Add last_parm_cleanup_insn.
+ (push_cp_function_context): Likewise.
+ (pop_cp_function_context): Likewise.
+
+Tue May 13 15:51:20 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst_copy): Handle BIT_NOT_EXPR.
+
+Wed May 7 11:17:59 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * method.c (emit_thunk) [ASM_OUTPUT_MI_THUNK]: Build up the RTL
+ for THUNK_FNDECL before we switch to temporary allocation.
+
+Mon May 5 14:46:53 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_new_op): Handle null arg2 for ?:.
+
+Thu May 1 18:26:37 1997 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_exception_blocks): Ensure that we flow through
+ the end of the exception region for the exception specification.
+ Move exception region for the exception specification in, so that
+ it doesn't protect the parm cleanup. Remove some obsolete code.
+ * decl.c (store_parm_decls): Likewise.
+ (finish_function): Likewise.
+
+Tue Apr 29 15:38:54 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (build_new): Fix nothrow handling.
+
+Tue Apr 29 14:29:50 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * init.c (emit_base_init): Don't warn about the initialization
+ list for an artificial member.
+
+Fri Apr 25 17:47:59 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * expr.c (do_case): Handle !START case for the error msg.
+
+Fri Apr 25 11:55:23 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c, lang-options.h: New option -Weffc++.
+ * class.c, decl.c, init.c, typeck.c: Move Effective C++ warnings
+ to -Weffc++.
+
+ * decl2.c (finish_prevtable_vardecl): Change NO_LINKAGE_HEURISTICS
+ to MULTIPLE_SYMBOL_SPACES.
+
+Wed Apr 23 18:06:50 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (emit_thunk, generic case): Set current_function_is_thunk.
+
+ * method.c (emit_thunk, macro case): Set up DECL_RESULT.
+
+ * typeck.c (c_expand_return): Don't complain about returning void
+ to void in an artificial function.
+ * method.c (make_thunk): Change settings of READONLY/VOLATILE,
+ don't set DECL_RESULT, set DECL_ARTIFICIAL.
+ (emit_thunk, generic code): Also set up DECL_LANG_SPECIFIC.
+
+Wed Apr 23 14:43:06 1997 Mike Stump <mrs@cygnus.com>
+
+ * init.c (init_decl_processing): Add support for setjmp/longjmp based
+ exception handling.
+ * except.c (init_exception_processing): Likewise.
+ (expand_end_catch_block): Likewise.
+ (expand_exception_blocks): Likewise.
+ (expand_throw): Likewise.
+ * exception.cc (__default_terminate): Likewise.
+
+ * init.c (perform_member_init): Use new method of expr level
+ cleanups, instead of cleanups_this_call and friends.
+ (emit_base_init): Likewise.
+ (expand_aggr_vbase_init_1): Likewise.
+ (expand_vec_init): Likewise.
+ * decl.c (cp_finish_decl): Likewise.
+ (expand_static_init): Likewise.
+ (store_parm_decls): Likewise.
+ (cplus_expand_expr_stmt): Likewise.
+ * decl2.c (finish_file): Likewise.
+
+ * Make-lang.in (exception.o): Ok to compile with -O now.
+
+ * decl.c (maybe_build_cleanup_1): We no longer have to unsave, as
+ we know it will be done later by the backend.
+
+ * decl2.c (lang_f_options): Remove support for short temps.
+ * lang-options.h: Likewise.
+
+Wed Apr 23 04:12:06 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (varargs_function_p): New fn.
+ * method.c (emit_thunk): Replace broken generic code with code to
+ generate a heavyweight thunk function.
+
+Tue Apr 22 02:45:18 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (process_template_parm): pedwarn about floating-point parms.
+
+ * decl.c (grokdeclarator): inline no longer implies static.
+
+ * spew.c (yylex): Always return the TYPE_DECL if we got a scope.
+
+Mon Apr 21 15:42:27 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (check_for_override): The signature of an overriding
+ function is not changed.
+
+ * call.c (build_over_call): Move setting of conv into the loop.
+ Note: this change, along with the related changes of the 18th thru
+ the 20th of April, fix an infinite loop problem in conversions.
+
+Sun Apr 20 16:24:29 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_user_type_conversion_1): Really ignore rvalue
+ conversions when looking for a REFERENCE_TYPE.
+
+ * cvt.c (build_up_reference): Eviscerate, use build_unary_op.
+ * cp-tree.h (TREE_REFERENCE_EXPR): #if 0.
+ * typeck.c (decay_conversion): Don't set TREE_REFERENCE_EXPR.
+ (build_unary_op): Likewise.
+ * call.c (build_over_call): See through a CONVERT_EXPR around the
+ ADDR_EXPR for on a temporary.
+ * typeck.c (c_expand_return): See through a CONVERT_EXPR around
+ the ADDR_EXPR for a local variable.
+
+Fri Apr 18 12:11:33 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_user_type_conversion_1): If we're trying to
+ convert to a REFERENCE_TYPE, only consider lvalue conversions.
+ (build_new_function_call): Print candidates.
+ (implicit_conversion): Try a temp binding if the lvalue conv is BAD.
+ (reference_binding): Binding a temporary of a reference-related type
+ is BAD.
+
+Thu Apr 17 14:37:22 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * inc/typeinfo (type_info::before): Add cv-qualifier-seq.
+ * tinfo2.cc (type_info::before): Likewise.
+
+Mon Apr 14 12:38:17 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (implicit_conversion): Oops.
+
+Fri Apr 11 02:18:30 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (implicit_conversion): Try to find a reference conversion
+ before binding a const reference to a temporary.
+
+Wed Apr 2 12:51:36 1997 Mike Stump <mrs@cygnus.com>
+
+ * exception.cc (__default_unexpected): Call terminate by default,
+ so that if the user overrides terminate, the correct function will
+ be called.
+
+Wed Mar 19 14:14:45 1997 Mike Stump <mrs@cygnus.com>
+
+ * parse.y (left_curly): Avoid trying to use any fields of
+ error_mark_node, as there aren't any.
+
+Thu Mar 13 16:33:22 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (do_identifier): Avoid breaking on overloaded methods
+ as default arguments.
+
+Wed Mar 12 13:55:10 1997 Hans-Peter Nilsson <Hans-Peter.Nilsson@axis.se>
+
+ * call.c (add_template_candidate): Initialize the variable "dummy".
+
+Mon Mar 10 15:13:14 1997 Brendan Kehoe <brendan@canuck.cygnus.com>
+
+ * decl.c (start_decl): Make sure TYPE isn't an error_mark_node
+ before we try to use TYPE_SIZE and TREE_CONSTANT on it.
+
+Fri Mar 7 13:19:36 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-tree.h (comp_ptr_ttypes, more_specialized): Add decl.
+ (debug_binfo): Delete decl, not needed.
+
+ * tree.c (fnaddr_from_vtable_entry, function_arg_chain,
+ promotes_to_aggr_type): Delete fns.
+ * cp-tree.h (FNADDR_FROM_VTABLE_ENTRY,
+ SET_FNADDR_FROM_VTABLE_ENTRY, FUNCTION_ARG_CHAIN,
+ PROMOTES_TO_AGGR_TYPE): Delete alternates to #if 1.
+
+ * decl.c (pending_invalid_xref{,_file,_line}): Delete unused vars.
+
+ * friend.c (is_friend_type): Delete fn.
+ * cp-tree.h (is_friend_type): Delete decl.
+
+ * decl.c (original_result_rtx, double_ftype_double,
+ double_ftype_double_double, int_ftype_int, long_ftype_long,
+ float_ftype_float, ldouble_ftype_ldouble, last_dtor_insn): Make static.
+ * typeck.c (original_result_rtx, warn_synth): Delete extern decls.
+
+ * decl.c (push_overloaded_decl{,_top_level}): Make static, adding
+ fwd decls.
+ * cp-tree.h (push_overloaded_decl{,_top_level}): Delete decls.
+
+ * decl.c (pushdecl_nonclass_level): #if 0, unused.
+ * cp-tree.h (pushdecl_nonclass_level): #if 0 decl.
+
+ * lex.c (reinit_lang_specific): #if 0, unused.
+ * cp-tree.h (reinit_lang_specific): #if 0 decl.
+
+ * decl.c (revert_static_member_fn): Make static, adding fwd decl.
+ * cp-tree.h (revert_static_member_fn): Delete decl.
+
+ * class.c (root_lang_context_p): Delete fn.
+ * cp-tree.h (root_lang_context_p): Delete decl.
+
+ * decl.c (set_current_level_tags_transparency): #if 0, unused.
+ * cp-tree.h (set_current_level_tags_transparency): #if 0 decl.
+
+ * lex.c (set_vardecl_interface_info): Make static.
+ * cp-tree.h (set_vardecl_interface_info): Delete decl.
+
+ * call.c (find_scoped_type): Make static.
+ * cp-tree.h (find_scoped_type): Delete decl.
+
+ * search.c (convert_pointer_to_vbase): Make static.
+ * cp-tree.h (convert_pointer_to_vbase): Delete decl.
+
+ * decl.c (const_ptr_type_node): Likewise.
+ * cp-tree.h (const_ptr_type_node): Delete decl.
+
+ * typeck.c (common_base_type): Make static.
+ * cp-tree.h (common_base_types): Delete erroneous decl.
+
+ * pt.c (classtype_mangled_name): Make static.
+ * cp-tree.h (classtype_mangled_name): Delete decl.
+
+ * lex.c (check_newline): Make static.
+ * cp-tree.h (check_newline): Delete decl.
+
+ * typeck.c (build_x_array_ref): Delete fn, same idea as
+ grok_array_decl.
+ * cp-tree.h (build_x_array_ref): Delete decl.
+
+ * lex.c (copy_decl_lang_specific): Delete fn, same idea as
+ copy_lang_decl.
+ * cp-tree.h (copy_decl_lang_specific): #if 0 decl.
+
+ * class.c (build_vtable_entry): Make static.
+ * cp-tree.h (build_vtable_entry): Delete decl.
+
+ * class.c (build_vbase_pointer): Make static.
+ * cp-tree.h (build_vbase_pointer): Delete decl.
+
+ * sig.c (build_sptr_ref): Add forward decl and make static.
+ * cp-tree.h (build_sptr_ref): Delete decl.
+
+ * call.c (build_new_method_call): Add forward decl and make static.
+ * cp-tree.h (build_new_method_call): Delete decl.
+
+ * call.c (build_object_call): Make static.
+ * class.c (check_for_override, complete_type_p, mark_overriders):
+ Likewise.
+ * decl.c (cp_function_chain): Likewise.
+ * lex.c (set_typedecl_interface_info, reinit_parse_for_block):
+ Likewise.
+ * pt.c (comp_template_args, get_class_bindings, push_tinst_level):
+ Likewise.
+ * tree.c (build_cplus_array_type_1): Likewise.
+ * typeck.c (comp_ptr_ttypes_{const,real,reinterpret}): Likewise.
+ (comp_target_parms): Likewise.
+
+ * init.c (build_builtin_call): Make static.
+ * cp-tree.h (build_builtin_call): Delete decl.
+
+ * typeck.c (binary_op_error): Delete decl.
+ * cp-tree.h (binary_op_error): Likewise.
+
+Thu Mar 6 16:13:52 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * call.c (build_method_call): Compare against error_mark_node
+ directly, rather than the ERROR_MARK tree code.
+ * cvt.c (cp_convert): Likewise.
+ * decl.c (print_binding_level): Likewise.
+ (duplicate_decls): Likewise.
+ (grokdeclarator): Likewise.
+ (grokdeclarator): Likewise.
+ * init.c (expand_aggr_init_1): Likewise.
+ (decl_constant_value): Likewise.
+ * method.c (build_opfncall): Likewise.
+ (hack_identifier): Likewise.
+ * typeck.c (build_modify_expr): Likewise.
+
+ * typeck.c (build_c_cast): Don't decl TYPE as register tree.
+
+Sun Mar 2 02:54:36 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
+
+ * pt.c (unify): Strip NOP_EXPR wrappers before unifying integer values.
+
+ * pt.c (coerce_template_parms): Add new error message.
+
+ * method.c (build_overload_value): Implement name mangling for
+ floating-point template arguments.
+
+ * method.c (build_overload_int, icat, dicat): Fix mangling of template
+ arguments whose absolute value doesn't fit in a signed word.
+
+Mon Mar 3 12:14:54 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * friend.c: New file; put all of the friend stuff in here.
+ * init.c: Instead of here.
+ * Makefile.in (CXX_OBJS): Add friend.o.
+ (friend.o): Add dependencies.
+ * Make-lang.in (CXX_SRCS): Add $(srcdir)/cp/friend.c.
+
+Sun Mar 2 11:04:43 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_scoped_method_call): Complain if the scope isn't a
+ base.
+
+Wed Feb 26 11:31:06 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (left_curly): Don't crash on erroneous type.
+
+ * init.c (build_delete): Fix type of ref.
+
+Tue Feb 25 12:41:48 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * search.c (get_vbase_1): Renamed from get_vbase.
+ (get_vbase): Wrapper, now non-static.
+ (convert_pointer_to_vbase): Now static.
+
+ * call.c (build_scoped_method_call): Accept a binfo for BASETYPE.
+ * init.c (build_delete): Pass one.
+ (build_partial_cleanup_for): Use build_scoped_method_call.
+ * decl.c (finish_function): Pass a binfo.
+
+Mon Feb 24 15:00:12 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_over_call): Only synthesize non-trivial copy ctors.
+
+ * typeck.c (build_c_cast): Lose other reference to flag.
+
+ * call.c (build_field_call): Don't look for [cd]tor_identifier.
+ * decl2.c (delete_sanity): Remove meaningless use of
+ LOOKUP_HAS_IN_CHARGE.
+ * decl.c (finish_function): Use build_scoped_method_call instead
+ of build_delete for running vbase dtors.
+ * init.c (build_delete): Call overload resolution code instead of
+ duplicating it badly.
+
+Thu Feb 20 15:12:15 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_over_call): Call mark_used before trying to elide
+ the call.
+
+ * decl.c (implicitly_declare): Don't set DECL_ARTIFICIAL.
+
+Wed Feb 19 11:18:53 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * typeck.c (build_modify_expr): Always pedwarn for a cast to
+ non-reference used as an lvalue.
+
+Wed Feb 19 10:35:37 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (cp_convert_to_pointer): Convert from 0 to a pmf properly.
+
+Tue Feb 18 15:40:57 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (handler): Fix template typo.
+
+Sun Feb 16 02:12:28 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * error.c (lang_decl_name): New fn.
+ * tree.c (lang_printable_name): Use it.
+
+Fri Feb 14 16:57:05 1997 Mike Stump <mrs@cygnus.com>
+
+ * g++spec.c: Include config.h so that we can catch bzero #defines
+ from the config file.
+
+Tue Feb 11 13:50:48 1997 Mike Stump <mrs@cygnus.com>
+
+ * new1.cc: Include a declaration for malloc, to avoid warning, and
+ avoid lossing on systems that require one (ones that define malloc
+ in xm.h).
+
+Mon Feb 10 22:51:13 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
+
+ * decl2.c (max_tinst_depth): New variable.
+ (lang_decode_option): Parse "-ftemplate-depth-NN" command line
+ option.
+ * pt.c (max_tinst_depth): Variable moved.
+ * lang-options.h: Declare "-ftemplate-depth-NN" command line option
+ as legal.
+
+Fri Feb 7 15:43:34 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (xref_basetypes): Allow a base class that depends on
+ template parms to be incomplete.
+
+ * decl2.c (build_expr_from_tree): Support typeid(type).
+ * rtti.c (get_typeid): Support templates.
+ (expand_si_desc, expand_class_desc): Fix string length.
+ (expand_ptr_desc, expand_attr_desc, expand_generic_desc): Likewise.
+
+Tue Feb 4 11:28:24 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (unify, case TEMPLATE_CONST_PARM): Use cp_tree_equal.
+
+ * pt.c (tsubst): Put it back for -fno-ansi-overloading.
+
+Mon Feb 3 18:41:12 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst, case FUNCTION_DECL): Lose obsolete code that
+ smashes together template and non-template decls of the same
+ signature.
+
+Thu Jan 30 19:18:00 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst): Don't recurse for the type of a TYPENAME_TYPE.
+
+Wed Jan 29 11:40:35 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (duplicate_decls): Next route, pedwarn about different
+ exceptions if -pedantic *or* olddecl !DECL_IN_SYSTEM_HEADER.
+
+Tue Jan 28 20:43:29 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-tree.h (HAS_DEFAULT_IMPLEMENTATION): Delete macro.
+ (struct lang_type): Delete has_default_implementation member.
+ Increase dummy to 21.
+ * decl.c (start_method): Delete usage.
+
+ * cp-tree.h (build_call, null_ptr_cst_p, in_function_p,
+ store_after_parms, start_decl_1, auto_function): Add decls.
+ (get_arglist_len_in_bytes, declare_implicit_exception,
+ have_exceptions_p, make_type_decl, typedecl_for_tag,
+ store_in_parms, pop_implicit_try_blocks, push_exception_cleanup,
+ build_component_type_expr, cplus_exception_name,
+ {make,clear}_anon_parm_name, dont_see_typename): Removed decls.
+ * call.c (build_this): Make static.
+ (is_complete): Likewise.
+ (implicit_conversion): Likewise.
+ (reference_binding): Likewise.
+ (standard_conversion): Likewise.
+ (strip_top_quals): Likewise.
+ (non_reference): Likewise.
+ (build_conv): Likewise.
+ (user_harshness): Likewise.
+ (rank_for_ideal): Likewise.
+ * decl.c (start_decl_1): Delete forward decl.
+ (push_decl_level): Make static.
+ (resume_binding_level): Make static.
+ (namespace_bindings_p): Make static.
+ (declare_namespace_level): Make static.
+ (lookup_name_real): Make static.
+ (duplicate_decls): Make static. Take register off NEWDECL and
+ OLDDECL parm decls.
+ * decl2.c (get_sentry): Make static.
+ (temp_name_p): Delete fn.
+ * except.c (auto_function): Delete decl.
+ * lex.c (handle_{cp,sysv}_pragma): Make static.
+ (handle_sysv_pragma) [HANDLE_SYSV_PRAGMA]: Add forward decl.
+ * method.c (do_build_{copy_constructor,assign_ref}): Make static.
+ * pt.c (tsubst_expr_values): Make static.
+ * rtti.c (combine_strings): Delete decl.
+
+Tue Jan 28 16:40:40 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (push_template_decl): Handle getting a typedef.
+
+ * call.c (build_new_function_call): Complain about void arg.
+
+Tue Jan 28 15:25:09 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (duplicate_decls): Give pedwarn of different exceptions
+ if -pedantic, instead of olddecl !DECL_IN_SYSTEM_HEADER.
+
+Mon Jan 27 19:21:29 1997 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_throw): Don't expand the cleanup tree here,
+ since we are not going to write the rtl out. Fixes problem with
+ -g -O on SPARC.
+
+Mon Jan 27 16:24:35 1997 Sean McNeil <sean@mcneil.com>
+
+ * Make-lang.in: Add $(exeext) as necessary.
+
+Mon Jan 27 13:20:39 1997 Mike Stump <mrs@cygnus.com>
+
+ * parse.y (handler_seq): Must have at least one catch clause.
+
+Sat Jan 25 12:00:05 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (add_builtin_candidate): Restore ?: hack.
+
+ * decl.c (grok_op_properties): More warnings.
+
+Sat Jan 25 08:50:03 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (duplicate_decls): On second thought, do it as a pedwarn
+ still but only if !DECL_IN_SYSTEM_HEADER (olddecl).
+
+ * decl.c (duplicate_decls): Scale back to a warning, and only do
+ 'em if -pedantic.
+
+Fri Jan 24 17:52:54 1997 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (duplicate_decls): pedwarn mismatched exception
+ specifications.
+
+Thu Jan 23 18:18:54 1997 Mike Stump <mrs@cygnus.com>
+
+ * call.c (build_new_method_call): Don't display the invisible
+ argument for controlling virtual bases.
+
+Thu Jan 23 16:48:10 1997 Mike Stump <mrs@cygnus.com>
+
+ * new: Add nothrow new and delete, bad_alloc and throw specifications
+ for delete.
+ * decl.c (init_decl_processing): Add throw specification for delete.
+ * new.cc (nothrow): Define.
+ * lex.c (real_yylex): Removing warning that throw and friends are
+ keywords.
+ * new1.cc (operator new (size_t sz, const nothrow_t&)): Define.
+ * new2.cc (operator new[] (size_t sz, const nothrow_t&): Define.
+ * Make-lang.in: Add new{1,2}.{cc,o}.
+
+Thu Jan 23 16:39:06 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (cons_up_default_function): Fix return type of synth op=.
+
+ * init.c (emit_base_init): Add warnings for uninitialized members
+ and bases.
+
+ * decl.c (xref_basetypes): Add warning for non-polymorphic type
+ with destructor used as base type.
+
+ * decl.c (grok_op_properties): Add warning for op= returning void.
+ * typeck.c (c_expand_return): Add warning for op= returning anything
+ other than *this.
+
+ * class.c (finish_struct_1): Add warning for class with pointers
+ but not copy ctor or copy op=.
+
+ * cp-tree.h (TI_PENDING_TEMPLATE_FLAG): New macro.
+ * pt.c (add_pending_template): Use it instead of LANG_FLAG_0.
+ (instantiate_template): If -fexternal-templates, add this
+ instantiation to pending_templates.
+
+ * decl2.c (copy_assignment_arg_p): Disable old hack to support
+ Booch components.
+
+Tue Jan 21 18:32:04 1997 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (cp_convert): pedwarn enum to pointer conversions.
+
+Mon Jan 20 17:59:51 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (standard_conversion): Handle getting references. Tack
+ on RVALUE_CONV here. Do it for non-class types, too.
+ (reference_binding): Pass references to standard_conversion.
+ (implicit_conversion): Likewise.
+ (add_builtin_candidate): Disable one ?: kludge.
+ (convert_like): Handle RVALUE_CONVs for non-class types.
+ (joust): Disable the other ?: kludge.
+
+Mon Jan 20 14:53:13 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (init_decl_processing): Add code to build up common
+ function types beforehand, to avoid creation then removal of
+ things already in the hash table.
+
+Mon Jan 20 14:43:49 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (finish_function): Also zero out DECL_INCOMING_RTL for
+ the arguments.
+
+ * error.c (dump_expr, TEMPLATE_CONST_PARM): Don't require
+ current_template_parms.
+
+Fri Jan 17 10:25:42 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * search.c (lookup_field): Don't return a function, check want_type.
+
+Thu Jan 16 18:14:35 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * init.c (build_new): Make sure PLACEMENT has a type.
+
+Thu Jan 16 17:40:28 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (build_new): Support new (nothrow).
+
+Wed Jan 15 12:38:14 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_decl): Also do push_to_top_level before setting
+ up DECL_INITIAL.
+
+ * cp-tree.h (PARM_DEFAULT_FROM_TEMPLATE): New macro.
+ * pt.c (tsubst): Defer instantiation of default args.
+ * call.c (build_over_call): Until here.
+
+Wed Jan 15 10:08:10 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * search.c (lookup_field): Make sure we have an
+ IDENTIFIER_CLASS_VALUE before we try to return it.
+
+Thu Jan 9 07:19:01 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * call.c (build_method_call): Delete unused var PARM.
+ (build_overload_call_real): Likewise.
+ (build_object_call): Delete unused var P.
+ (build_new_op): Likewise.
+ * decl.c (builtin_type_tdescs_{arr, len, max}): #if 0 out static
+ var definitions, which are never used.
+ (shadow_tag): Delete unused var FN.
+ * expr.c (cplus_expand_expr): Delete unused var ORIGINAL_TARGET.
+ * init.c (build_new): Delete unused var ALLOC_TEMP.
+ * method.c (hack_identifier): Delete unused var CONTEXT.
+ (do_build_copy_constructor): Delete unused var NAME.
+ (synthesize_method): Delete unused var BASE.
+ * pt.c (lookup_template_class): Delete unused var CODE_TYPE_NODE.
+ * rtti.c (build_headof): Delete unused var VPTR.
+ (get_typeid): Delete unused var T.
+ * typeck.c (build_conditional_expr): Delete unused vars ORIG_OP1
+ and ORIG_OP2.
+ (build_ptrmemfunc): Delete unused vars U and NINDEX.
+ * typeck2.c (build_functional_cast): Delete unused var BINFO.
+
+Wed Jan 8 13:09:54 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * search.c (lookup_field): Use IDENTIFIER_CLASS_VALUE to look up
+ things in a type being defined.
+ * decl.c (finish_enum): Reverse the values so that they are in
+ the correct order.
+
+ * pt.c (instantiate_class_template): Don't initialize
+ BINFO_BASETYPES until the vector is filled out.
+ (unify): Don't abort on conflicting bindings, just fail.
+ (instantiate_decl): Do push_tinst_level before any tsubsting.
+
+ * method.c (build_overload_value): Handle getting a
+ TEMPLATE_CONST_PARM for a pointer.
+
+Tue Jan 7 14:00:58 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (expand_member_init): Don't give 'not a base' error for
+ templates.
+
+ * pt.c (instantiate_decl): Call import_export_decl later.
+
+ * pt.c (instantiate_class_template): Return a value.
+
+ * parse.y (extension): New rule for __extension__.
+ (extdef, unary_expr, decl, component_decl): Use it.
+
+Tue Jan 7 09:20:28 1997 Mike Stump <mrs@cygnus.com>
+
+ * class.c (base_binfo): Remove unused base_has_virtual member.
+ (finish_base_struct): Likewise.
+ (finish_struct_1): Likewise.
+
+Tue Dec 31 20:25:50 1996 Mike Stump <mrs@cygnus.com>
+
+ * search.c (expand_upcast_fixups): Fix bogus code generation
+ problem where the generated code uses the wrong index into the
+ runtime built vtable on the stack. Old code could clobber random
+ stack values.
+
+Tue Dec 31 15:16:56 1996 Mike Stump <mrs@cygnus.com>
+
+ * init.c (perform_member_init): Make sure the partial EH cleanups
+ live on the function_obstack.
+
+Fri Dec 27 10:31:40 1996 Paul Eggert <eggert@twinsun.com>
+
+ * Make-lang.in (g++spec.o): Don't use $< with an explicit target;
+ this isn't portable to some versions of `make' (e.g. Solaris 2.5.1).
+
+Tue Dec 24 10:24:03 1996 Jeffrey A Law <law@cygnus.com>
+
+ * decl.c (grokvardecl): Avoid ANSI style initialization.
+
+Sun Dec 22 04:22:06 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst): Tweak arg types for a FUNCTION_TYPE.
+
+Fri Dec 20 17:09:25 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_class_template): Call grok_{ctor,op}_properties.
+
+Fri Dec 20 12:17:12 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * g++spec.c (lang_specific_driver): Put missing hyphen in front of
+ arguments we compare against. Start the count of I at 1, not 0,
+ since argv[0] is still the command.
+
+Thu Dec 19 11:53:57 1996 Stan Shebs <shebs@andros.cygnus.com>
+
+ * lang-specs.h: Accept .cp as an C++ extension.
+
+Mon Dec 16 22:43:31 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-tree.h (ptr_reasonably_similar): Add decl.
+
+Thu Dec 12 15:00:35 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (grokvardecl): Change SPECBITS parm to be the SPECBITS_IN
+ pointer. New local SPECBITS with the parm's value.
+ (grokdeclarator): Pass &specbits down.
+
+ * parse.y (expr_no_commas): Make sure $$ is not an error_mark_node
+ before we try to do C_SET_EXP_ORIGINAL_CODE on it.
+
+ * search.c (envelope_add_decl): Check that the CLASSTYPE_CID of
+ CONTEXT is not 0 before we try to use TYPE_DERIVES_FROM.
+
+ * decl.c (cplus_expand_expr_stmt): Only expand the expr if EXP is
+ not an error_mark_node.
+
+Sat Dec 7 17:20:22 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (TYPE_MAIN_DECL): Use TYPE_STUB_DECL.
+ * *.c: Use TYPE_MAIN_DECL instead of TYPE_NAME where appropriate.
+
+Fri Dec 6 14:40:09 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokdeclarator): When giving an anonymous struct a name,
+ replace TYPE_NAME instead of TYPE_IDENTIFIER (so TYPE_STUB_DECL is
+ not affected).
+
+ * typeck2.c (build_m_component_ref): If component is a pointer
+ to data member, resolve the OFFSET_REF now.
+
+ * call.c (convert_like): Don't go into infinite recursion.
+
+ * pt.c (coerce_template_parms): Use tsubst_expr for non-type args.
+
+ * class.c (finish_struct_1): Set DECL_ARTIFICIAL on the vptr.
+ * tree.c (layout_basetypes): And on the vbase ptr.
+
+Thu Dec 5 02:11:28 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (BOOL_TYPE_SIZE): Define in terms of POINTER_SIZE or
+ CHAR_TYPE_SIZE so bool is always the same size as another type.
+
+ * decl.c (pushtag): Set DECL_IGNORED_P for DWARF, too.
+
+Tue Dec 3 23:18:37 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (grok_x_components): Remove synthesized methods from
+ TYPE_METHODS of an anonymous union, complain about member
+ functions.
+ * decl.c (shadow_tag): Wipe out memory of synthesized methods in
+ anonymous unions.
+ (finish_function): Just clear the DECL_RTL of our arguments.
+
+Fri Nov 29 21:54:17 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_file): Emit DWARF debugging info for static data
+ members.
+
+ * pt.c (tsubst): If t is a stub decl, return the stub decl for type.
+
+Wed Nov 27 14:47:15 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * typeck.c (build_component_ref): Don't die if COMPONENT isn't a
+ IDENTIFIER_NODE.
+
+Wed Nov 27 16:05:19 1996 Michael Meissner <meissner@tiktok.cygnus.com>
+
+ * Make-lang.in (g++-cross$(exeext)): Fix typo.
+
+Wed Nov 27 08:14:00 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ Make the g++ driver now be a standalone program, rather than one
+ that tries to run the gcc driver after munging up the options.
+ * Make-lang.in (g++.c, g++spec.o): New rules.
+ (g++.o): New rule, based on gcc.o with -DLANG_SPECIFIC_DRIVER
+ added.
+ (g++$(exeext)): New rule, based on xgcc rule.
+ (g++-cross$(exeext)): Now just copies g++$(exeext) over.
+ * g++spec.c: New file.
+ * g++.c: Removed file.
+
+Tue Nov 26 19:01:09 1996 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (build_up_reference): Arrange for any temporary values
+ that have been keep in registers until now to be put into memory.
+
+Mon Nov 25 15:16:41 1996 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Make-lang.in (c++.stage[1234]): Depend upon stage[1-4]-start, so
+ that make -j3 bootstrap works better.
+
+Sun Nov 24 02:09:39 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (pushtag): Do pushdecl for anon tags.
+
+Thu Nov 21 16:30:24 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (c_expand_return): Fix logic.
+ (unary_complex_lvalue): Avoid unused warning on address of INIT_EXPR.
+
+Wed Nov 20 18:47:31 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * g++.c (main): Make sure arglist has a final NULL entry. Add
+ PEXECUTE_LAST to the flags passed to pexecute, as otherwise
+ stdin/stdout of the invoked program are redirected to
+ nowheresville.
+
+Tue Nov 19 16:12:44 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (implicitly_declare): Set DECL_ARTIFICIAL.
+
+Tue Nov 19 15:48:19 1996 Mike Stump <mrs@cygnus.com>
+
+ * init.c (resolve_offset_ref): Handle obj.vfn better.
+ * typeck.c (build_component_ref): Set TREE_TYPE on result from
+ build_vfn_ref.
+
+Tue Nov 19 13:14:33 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (convert_for_assignment): Also handle anachronistic
+ implicit conversions from (::*)() to cv void*.
+ * cvt.c (cp_convert_to_pointer): Likewise.
+
+Mon Nov 18 17:05:26 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (handle_cp_pragma): Fix bogus warning.
+
+Mon Nov 18 16:10:43 1996 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (cp_convert_to_pointer): Avoid thinking a POINTER_TYPE
+ (METHOD_TYPE) is a TYPE_PTRMEMFUNC_P.
+
+Thu Nov 14 23:18:17 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (finish_struct_1): Support DWARF2_DEBUG.
+ * search.c (dfs_debug_mark): Likewise.
+ * decl2.c (finish_vtable_vardecl): Likewise.
+ * decl.c (pushtag, finish_enum): Likewise.
+ * lex.c (check_newline): Use debug_* instead of calling *out
+ functions directly.
+
+Thu Nov 14 15:21:46 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * Make-lang.in (cplib2.ready): Add else clause to avoid problems
+ on some picky hosts.
+
+Wed Nov 13 12:32:07 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (finish_struct_1): A class has a non-trivial copy
+ constructor if it has virtual functions.
+
+ * cvt.c (cp_convert): Always call a constructor.
+
+ * call.c (reference_binding): Still tack on a REF_BIND
+ for bad conversions.
+ (build_user_type_conversion_1): Propagate ICS_BAD_FLAG.
+
+ * typeck.c (convert_arguments): Pass LOOKUP_ONLYCONVERTING.
+ (c_expand_return): Likewise.
+ * typeck2.c (digest_init): Likewise for { }.
+ * init.c (expand_aggr_init_1): Keep the CONSTRUCTOR handling.
+ * cvt.c (cp_convert): Handle failure better.
+
+Wed Nov 13 11:51:20 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * g++.c (main): Also set PEXECUTE_SEARCH, to make the invocation
+ of GCC be path-relative.
+
+Wed Nov 13 11:27:16 1996 Michael Meissner <meissner@tiktok.cygnus.com>
+
+ * Make-lang.in (g++-cross): G++-cross doesn't need version.o, but
+ it does need choose-temp.o and pexecute.o.
+
+Wed Nov 13 07:53:38 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * g++.c (error) [!HAVE_VPRINTF]: Put error back for the only time
+ that we still use it.
+ (P_tmpdir, R_OK, W_OK, X_OK) [__MSDOS__]: Delete unnecessary macros.
+
+Wed Nov 13 02:00:26 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (expand_default_init): Avoid calling constructors to
+ initialize reference temps.
+
+ * cvt.c (convert_to_reference): Fix.
+
+Tue Nov 12 19:10:07 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (cp_convert): Simplify for flag_ansi_overloading.
+ (convert_to_reference): Likewise.
+ * typeck.c (convert_for_initialization): Likewise.
+ * init.c (expand_default_init): Likewise.
+ (expand_aggr_init_1): Likewise.
+ * cp-tree.h (CONV_NONCONVERTING): Lose.
+ * typeck.c (build_c_cast): Lose allow_nonconverting parm.
+ * *.c: Adjust.
+ * call.c (build_user_type_conversion_1): Assume LOOKUP_ONLYCONVERTING.
+
+Tue Nov 12 16:29:04 1996 Brendan Kehoe <brendan@canuck.cygnus.com>
+
+ * pt.c (tsubst_expr): Reverse args to expand_start_catch_block.
+
+Tue Nov 12 15:26:17 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (expand_aggr_init_1): Don't crash on non-constructor
+ TARGET_EXPR.
+
+Tue Nov 12 14:00:50 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * g++.c: Include gansidecl.h.
+ (VPROTO, PVPROTO, VA_START): Delete.
+ (choose_temp_base_try, choose_temp_base, perror_exec,
+ run_dos) [__MSDOS__]: Delete fns.
+ (pfatal_with_name): Delete fn.
+ (temp_filename): Declare like in gcc.c.
+ (pexecute, pwait, choose_temp_base): Declare from gcc.c.
+ (error_count, signal_count): Define.
+ (error): Delete both definitions.
+ (PEXECUTE_{FIRST,LAST,SEARCH,VERBOSE}): Define from gcc.c.
+ (pfatal_pexecute): Add fn from gcc.c.
+ (main): Rename local VERBOSE var to VERBOSE_FLAG. Rewrite the
+ code to use the pexecute stuff also used by gcc.c.
+ (MIN_FATAL_STATUS): Define.
+ * Make-lang.in (g++): Add dependency on and linking with
+ choose-temp.o and pexecute.o.
+
+ * cp-tree.h: Include gansidecl.h.
+ (STDIO_PROTO): Delete #undef/#define.
+ * cvt.c (NULL): Delete #undef/#define.
+ * expr.c (NULL): Likewise.
+ * init.c (NULL): Likewise.
+ * rtti.c (NULL): Likewise.
+ * xref.c (NULL): Likewise.
+
+ * cp-tree.h (build_user_type_conversion): Add prototype.
+ * call.c (build_user_type_conversion): Delete prototype. Correct
+ decl of FLAGS arg to be an int.
+ * cvt.c (build_user_type_conversion): Likewise.
+
+Tue Nov 12 12:16:20 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.def: Add TRY_BLOCK and HANDLER.
+ * except.c (expand_start_catch_block): Support templates.
+ * parse.y (try_block, handler_seq): Likewise.
+ * pt.c (tsubst_expr): Support TRY_BLOCK and HANDLER.
+
+Mon Nov 11 13:57:31 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (current_template_args): New fn.
+ (push_template_decl): Use it.
+ * decl.c (grokdeclarator): Use it.
+
+ * decl2.c (build_expr_from_tree): Dereference ref vars.
+
+ * decl.c (grokdeclarator): Generalize handling of TYPENAME_TYPEs in
+ the decl-specifier-seq.
+
+ * decl.c (grok_op_properties): Don't force the type of a conversion
+ op to be complete. Don't warn about converting to the same type
+ for template instantiations.
+
+ * decl2.c (finish_file): Don't call instantiate_decl on synthesized
+ methods.
+
+Mon Nov 11 13:20:34 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * typeck.c (get_delta_difference): Remove previous bogusness.
+ Don't give errors if force is set.
+
+Fri Nov 8 17:38:44 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_file): Don't emit debug info.
+ * decl.c (pushdecl): Lose obsolete code.
+ (grokdeclarator): Still do the long long thing after complaining.
+ * search.c (note_debug_info_needed): Don't do anything if we're in a
+ template.
+ * method.c (synthesize_method): For non-local classes,
+ push_to_top_level first.
+
+Fri Nov 8 11:52:28 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * typeck.c (get_delta_difference): Add no_error parameter.
+ (build_ptrmemfunc): Call get_delta_difference with no_error set;
+ we don't want error messages when converting unrelated
+ pointer-to-member functions.
+
+Thu Nov 7 11:16:24 1996 Mike Stump <mrs@cygnus.com>
+
+ * error.c (dump_expr): Improve the wording on error messages that
+ involve pointer to member functions.
+
+Tue Nov 5 17:12:05 1996 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (cp_convert_to_pointer): Move code for conversions from
+ (::*)() to void* or (*)() up a bit, so that we can convert from
+ METHOD_TYPEs as well.
+
+Tue Nov 5 14:54:17 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * rtti.c (get_tinfo_fn): Make sure 'type' is permanent.
+ There are no 'member' types.
+ (get_tinfo_fn_dynamic): Diagnose typeid of overloaded fn.
+ (build_x_typeid): Handle errors.
+
+Mon Nov 4 17:43:12 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (convert_for_assignment): Handle anachronistic implicit
+ conversions from (::*)() to void* or (*)().
+ * cvt.c (cp_convert_to_pointer): Likewise.
+ (cp_convert_to_pointer_force): Remove cp_convert_to_pointer
+ conversions from here.
+ * decl2.c (lang_decode_option): Add -W{no-,}pmf-conversions.
+ * lang-options.h: Likewise.
+ * decl2.c (warn_pmf2ptr): Define.
+ * cp-tree.h: Declare it.
+ * typeck2.c (digest_init): Allow pmfs down into
+ convert_for_initialization.
+
+Sun Nov 3 09:43:00 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (c_expand_return): Fix for returning overloaded fn.
+
+Fri Nov 1 08:53:17 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (DIRECT_BIND): Change from INDIRECT_BIND.
+ * decl.c (grok_reference_init): Pass DIRECT_BIND.
+ * cvt.c (build_up_reference): Don't mark 'this' addressable. Use
+ DIRECT_BIND.
+ * call.c (convert_like): Don't pass INDIRECT_BIND.
+ * typeck.c (convert_arguments): Likewise.
+ * typeck.c (mark_addressable): Allow &this if flag_this_is_variable.
+
+Thu Oct 31 17:08:49 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (mark_addressable): Support TARGET_EXPR, unify with
+ similar code in build_up_ref.
+ * cvt.c (build_up_reference): Drastically simplify.
+
+Mon Oct 28 12:45:05 1996 Jeffrey A Law <law@cygnus.com>
+
+ * typeck.c (signed_or_unsigned_type): If the given type already
+ as the correct signedness, then just return it.
+
+ * typeck.c ({un,}signed_type): If can't do anything, call
+ signed_or_unsigned_type.
+
+Thu Oct 24 14:21:59 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * decl2.c (copy_assignment_arg_p): Don't buy the farm if
+ current_class_type is NULL.
+
+Wed Oct 23 00:43:10 1996 Jason Merrill <jason@gerbil.cygnus.com>
+
+ * class.c (finish_struct_1): Avoid empty structs by adding a field
+ so layout_type gets the mode right.
+
+ * typeck.c (c_expand_return): Drastically simplify.
+
+Mon Oct 21 22:34:02 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (decay_conversion): Handle overloaded methods.
+
+Fri Oct 18 16:03:48 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_over_call): A TARGET_EXPR has side-effects.
+
+Thu Oct 17 11:31:59 1996 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (convert_to_pointer_force): Add code to support pointer to
+ member function to pointer to function conversions.
+ * init.c (resolve_offset_ref): Add code to allow faked up objects,
+ ignoring them if they are not used, and giving an error, if they
+ are needed.
+ * typeck.c (get_member_function_from_ptrfunc): Fold e1 to improve
+ code, and so that we can give an error, if we needed an object,
+ and one was not provided.
+ (build_c_cast): Don't call default_conversion when we want to
+ convert to pointer to function from a METHOD_TYPE.
+
+Mon Oct 14 00:28:51 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * Make-lang.in (cplib2.ready): Fix logic.
+
+ * decl.c (shadow_tag): Only complain about non-artificial function
+ members.
+
+ * class.c (finish_struct_1): Add synthesized methods to TYPE_METHODS.
+
+Fri Oct 11 16:12:40 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * expr.c (cplus_expand_expr): Pre-tweak call_target like
+ expand_inline_function would.
+
+ * pt.c (mark_decl_instantiated): If extern_p, call
+ mark_inline_for_output.
+
+Thu Oct 10 15:58:08 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (unary_complex_lvalue): Add code to handle intermediate
+ pmd conversions.
+
+ * typeck.c (get_delta_difference): Fix wording, as we can be used
+ for pointer to data members.
+
+Tue Oct 8 12:43:51 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * pt.c (tsubst): If the function decl isn't a member of this
+ template, return a copy of the decl (including copying the
+ lang-specific part) so we don't hose ourselves later.
+
+Thu Oct 3 16:24:28 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (finish_struct): Remove DWARF-specific tag handling.
+ * decl.c (pushtag): Likewise.
+ (finish_function): Always clear DECL_ARGUMENTS on function decls with
+ no saved RTX.
+ * decl2.c (finish_file): Emit DWARF debugging info for static data
+ members.
+
+Wed Oct 2 21:58:01 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * decl.c (duplicate_decls): Make sure the old DECL_LANG_SPECIFIC
+ isn't the same as the new one before we whack it.
+
+Mon Sep 30 13:38:24 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c, cp-tree.h, cvt.c, decl.c, decl2.c, gxx.gperf, hash.h,
+ lex.c, method.c, parse.y, typeck.c, typeck2.c: Remove
+ warn_traditional and warn_strict_prototypes; remove ancient
+ 'overload' code; remove references to flag_traditional.
+
+Mon Sep 30 12:58:40 1996 Mike Stump <mrs@cygnus.com>
+
+ * input.c (sub_getch): Handle 8-bit characters in string literals.
+
+Sun Sep 29 03:12:01 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (mapcar): Handle CONSTRUCTORs.
+ (copy_to_permanent): Handle expression_obstack properly.
+
+ * Make-lang.in (cplib2.txt): Also depend on the headers.
+
+ * rtti.c (get_tinfo_var): Don't assume that POINTER_SIZE ==
+ INT_TYPE_SIZE.
+ (expand_class_desc): Use USItype for offset field.
+ * tinfo.h (struct __class_type_info): Likewise.
+
+ * method.c (build_overload_int): TYPE_PRECISION should be applied
+ to types.
+
+Sat Sep 28 14:44:50 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_new_op): A COND_EXPR involving void must be a
+ builtin.
+
+Fri Sep 27 16:40:30 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_x_component_ref): New fn.
+ (build_object_ref): Use it.
+ * parse.y (primary): Use it.
+ * decl2.c (build_expr_from_tree): Use it.
+ * cp-tree.h: Declare it.
+
+ * decl.c (start_decl): Variable-sized arrays cannot be initialized.
+ * error.c (dump_type_suffix): Handle variable arrays.
+
+Fri Sep 27 13:14:05 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * Make-lang.in (exception.o): Put back compiling it with -fPIC.
+
+Fri Sep 27 03:00:09 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (lookup_name_real): Don't try to look up anything in a
+ TYPENAME_TYPE.
+
+ * tinfo2.cc (__throw_type_match_rtti): Oops.
+
+Thu Sep 26 22:11:05 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * Make-lang.in (exception.o): Use -fno-PIC for now.
+
+Thu Sep 26 10:59:00 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * rtti.c (build_dynamic_cast): Pass tinfo fns rather than
+ calling them.
+ (get_tinfo_fn_dynamic): Extracted from build_typeid.
+ * tinfo2.cc (__dynamic_cast): Adjust.
+
+ * rtti.c (build_typeid): Use resolves_to_fixed_type_p.
+ (build_x_typeid): Likewise.
+
+ * parse.y: Call build_x_typeid instead of build_typeid.
+ * cp-tree.def: Add TYPEID_EXPR.
+ * pt.c (tsubst_copy): Handle typeid.
+ * decl2.c (build_expr_from_tree): Likewise.
+ * rtti.c (build_x_typeid): Throw bad_typeid from here.
+ (build_typeid): Not here.
+ * cp-tree.h: Declare build_x_typeid.
+
+Wed Sep 25 17:26:16 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (convert_like): Pull out constant values.
+
+ * tree.c (mapcar): Use build_cplus_array_type, not build_array_type.
+
+Wed Sep 25 17:28:53 1996 Michael Meissner <meissner@tiktok.cygnus.com>
+
+ * decl.c (init_decl_processing): Create short int types before
+ creating size_t in case a machine description needs to use
+ unsigned short for size_t.
+
+Tue Sep 24 18:18:44 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * Make-lang.in (exception.o): Turn off pic.
+
+ * tinfo2.cc (__throw_type_match_rtti): Fix cv-variants of the same
+ type, multi-level ptr conversions.
+
+ * rtti.c (call_void_fn): Renamed and genericized from throw_bad_cast.
+ (throw_bad_cast): Use it.
+ (throw_bad_typeid): New fn.
+ (build_typeid): Throw bad_typeid as needed.
+ Use build_call.
+ (synthesize_tinfo_fn): Handle functions and arrays before checking
+ for cv-quals.
+
+ * Remove .h from standard C++ headers, add new.h, move into inc
+ subdirectory.
+
+ * exception*: Remove pointer from object, constructors. Add
+ default exception::what that uses type_info::name. Add
+ __throw_bad_typeid.
+
+ * init.c (build_new): Don't add a cookie to new (void *) T[2].
+
+Mon Sep 23 15:21:53 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * Make-lang.in: Building C++ code depends on cc1plus.
+
+Mon Sep 23 12:38:40 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (struct saved_scope): Declare PROCESSING_TEMPLATE_DECL as
+ a HOST_WIDE_INT, not a tree.
+
+Mon Sep 23 12:36:02 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * exception.cc: Don't include <stdlib.h>.
+
+ * Make-lang.in (c++.clean): Remove cplib2.*.
+
+Mon Sep 23 09:42:19 1996 Doug Evans <dje@canuck.cygnus.com>
+
+ * parse.y (component_decl_1, component_costructor_declarator case):
+ Pass attributes/prefix_attributes in tree list.
+
+Mon Sep 23 01:18:50 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tinfo{,2}.cc: #include <stddef.h> instead of <stdlib.h>.
+
+Sun Sep 22 05:31:22 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (do_identifier): Don't do deferred lookup in a template
+ header.
+
+ * typeck2.c (store_init_value): Oops.
+
+ * new.{h,cc}, exception.{h,cc}, typeinfo.h, tinfo{2.cc,.cc,.h}:
+ New files for C++ lang-support library.
+ * Make-lang.in (CXX_EXTRA_HEADERS): Define.
+ (CXX_LIB2FUNCS): Define.
+ And rules for building the C++ lang-support code.
+ * config-lang.in (headers): Define.
+ (lib2funcs): Define.
+
+Sat Sep 21 19:17:28 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (build_expr_from_tree): If CONSTRUCTOR has a type, call
+ digest_init.
+ * pt.c (tsubst_copy): Compute type for CONSTRUCTOR.
+ * typeck2.c (store_init_value): Check for initializing pmf with { }
+ here.
+ (process_init_constructor): Not here.
+
+Thu Sep 19 16:41:07 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (begin_template_parm_list): Increment
+ processing_template_decl here.
+ (end_template_parm_list): Not here.
+ (process_template_parm): No need to add 1 to it now.
+ * *.c: Use processing_template_decl instead of current_template_parms
+ to check for being in a template.
+
+ * pt.c (uses_template_parms): Handle SCOPE_REF. Fix CONSTRUCTOR.
+ (tsubst_copy): Handle CONSTRUCTOR.
+ (instantiate_decl): Set up context properly for variables.
+ * decl2.c (build_expr_from_tree): Handle CONSTRUCTOR.
+ * class.c (finish_struct): Reverse CLASSTYPE_TAGS.
+
+Wed Sep 18 13:30:20 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * lex.c (enum tree_node_kind) [GATHER_STATISTICS]: Put the enum back.
+
+Wed Sep 18 04:24:07 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (make_thunk): Call comdat_linkage before setting the
+ TREE_CODE.
+
+ * decl2.c (comdat_linkage): Use make_decl_one_only.
+ (import_export_decl): Likewise.
+ * decl.c (init_decl_processing): Check supports_one_only instead of
+ SUPPORTS_WEAK.
+
+Sat Sep 14 08:34:41 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (grokfield): Tighten checking for access decls.
+
+ * decl.c (make_typename_type): Resolve references to
+ current_class_type. Set CLASSTYPE_GOT_SEMICOLON.
+ (lookup_name_real): Types that depend on a template parameter get
+ an implicit 'typename' unless they're in the current scope.
+ (start_decl_1): We don't care about incomplete types that depend
+ on a template parm.
+ (grokdeclarator): Resolve 'typename's in the type specifier that
+ refer to members of the current scope.
+
+ * call.c (build_over_call): Remove 'inline called before
+ definition' diagnostic.
+ (build_method_call): Likewise.
+ * decl.c (duplicate_decls): Downgrade 'used before declared
+ inline' to a warning, only with -Winline.
+
+Fri Sep 13 17:31:40 1996 Stan Shebs <shebs@andros.cygnus.com>
+
+ * mpw-make.sed: Fix include paths, add @DASH_C_FLAG@ to compile.
+
+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>
+
+ * except.c (expand_start_try_stmts): Move to except.c in the backend.
+ (expand_end_try_stmts): Remove.
+
+ * init.c (perform_member_init): Use add_partial_entry () instead
+ of directly manipulating lists.
+ (emit_base_init): Likewise.
+
+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 grammar
+ 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>
+
+ * decl.c (start_function): Only check interface_* for templates
+ with flag_alt_external_templates.
+
+ * call.c (build_new_op): Check for comparison of different enum types.
+ (build_over_call): Fix arg # output.
+
+ * typeck.c (build_component_ref): Handle pre-found TYPE_DECL.
+
+Wed Aug 21 00:13:15 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_new_op): Check for erroneous args.
+
+ * call.c (build_new_method_call): Add missing args to cp_error.
+
+ * tree.c (error_type): Don't print reference-to-array.
+
+ * typeck.c (convert_for_assignment): Don't say contravariance for
+ removing const.
+
+Tue Aug 20 13:23:00 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_over_call): Diagnose bad convs for `this'.
+
+ * lex.c (cons_up_default_function): Set DECL_ARTIFICIAL
+ on _ctor_arg.
+
+ * call.c (convert_like): Handle bad convs.
+ (build_over_call): Handle bad convs better.
+
+ * decl2.c: -fansi-overloading is now the default.
+
+ * call.c (build_new_method_call): Check for erroneous args.
+
+ * pt.c (instantiate_class_template): Propagate
+ TYPE_USES_MULTIPLE_INHERITANCE.
+
+Tue Aug 20 13:09:57 1996 Mike Stump <mrs@cygnus.com>
+
+ * call.c (enforce_access): Add static to routine.
+
+Sun Aug 18 14:35:54 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_user_type_conversion_1): Fix bad handling.
+ (compare_ics): Likewise.
+
+Sat Aug 17 21:54:11 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (standard_conversion): Oops.
+
+Sat Aug 17 16:28:11 1996 Geoffrey Noer <noer@cygnus.com>
+
+ * g++.c: Update test for win32 (&& ! cygwin32).
+
+Sat Aug 17 03:45:31 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (comp_ptr_ttypes_real): Handle OFFSET_TYPEs properly.
+ (ptr_reasonably_similar): New fn.
+ * call.c (BAD_RANK): New rank.
+ (ICS_BAD_FLAG): New macro.
+ (standard_conversion): Handle almost-right pointer conversions.
+ (reference_binding): Handle bad rvalue bindings.
+ (add_*_candidate): Stuff.
+ (build_over_call): Pass bad conversions to convert_for_initialization.
+ (compare_ics): Handle bad convs.
+ (joust): Likewise.
+
+Fri Aug 16 15:02:19 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * init.c (expand_vec_init): Use ptrdiff_type_node instead of
+ integer_type_node when computing pointer offsets.
+
+Fri Aug 16 01:28:32 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (lvalue_type): New fn.
+ (error_type): New fn.
+ * call.c (op_error): Use error_type.
+ (add_conv_candidate): Use lvalue_type.
+ (add_builtin_candidates): Likewise.
+ * error.c (args_as_string): Use error_type.
+
+Thu Aug 15 17:27:13 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_decl): Evaluate DECL_INITIAL of a VAR_DECL here.
+ (tsubst): Not here.
+
+ * decl.c (init_decl_processing): With -ansi, __null's type is the
+ signed integral type with the same number of bits as a pointer.
+ Introduce a new variable null_node for it.
+ * cp-tree.h: Adjust.
+ * call.c (null_ptr_cst_p): Adjust.
+
+Thu Aug 15 17:09:54 1996 Mike Stump <mrs@cygnus.com>
+
+ * except.c (do_unwind): Mark %i7 as used on the SPARC so we can
+ optimize.
+
+Thu Aug 15 01:36:49 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (import_export_decl): Ignore #pragma interface for tinfo
+ fns of classes without virtual functions.
+
+ * call.c (add_function_candidate): Handle `this' specially.
+ (compare_ics): Likewise.
+
+Tue Aug 13 12:16:10 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_conditional_expr): Fix handling of __null.
+
+ * decl2.c (comdat_linkage): New fn.
+ (import_export_vtable): Use it.
+ (import_export_decl): Use it.
+ * method.c (make_thunk): Use it.
+
+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.
+ * parse.y (template_header): Accept 'template <>'.
+
+ * errfn.c: Allow 5 args.
+
+Sun Aug 11 15:20:58 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (make_temp_vec): New fn.
+ * pt.c (push_template_decl): Handle partial specs.
+ (instantiate_class_template): Likewise.
+ (more_specialized): Use get_bindings.
+ (more_specialized_class): New fn.
+ (get_class_bindings): New fn.
+ (most_specialized_class): New fn.
+ (do_function_instantiation): List candidates for ambiguous case.
+ * decl.c (duplicate_decls): Lose reference to DECL_TEMPLATE_MEMBERS.
+ (shadow_tag): Call push_template_decl for partial specializations.
+ * parse.y: Likewise.
+ * cp-tree.h (DECL_TEMPLATE_SPECIALIZATIONS): Replaces
+ DECL_TEMPLATE_MEMBERS.
+ * call.c (print_z_candidates): Reduce duplication.
+
+Fri Aug 9 14:36:08 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (lang_decode_option): Allow -fansi-overloading.
+
+Thu Aug 8 17:04:18 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (get_bindings): New fn.
+ (most_specialized): Likewise.
+ (do_function_instantiation): Use them.
+ (add_maybe_template): New fn.
+ * cp-tree.h (DECL_MAYBE_TEMPLATE): New macro.
+ * call.c (build_new_op): Handle guiding decls.
+ (build_new_function_call): Likewise.
+ * decl2.c (finish_file): Likewise.
+
+ * decl2.c (mark_used): Do synthesis here.
+ * call.c (build_method_call): Not here.
+ (build_over_call): Or here.
+ * typeck.c (build_function_call_real): Or here.
+ * tree.c (bot_manip): Call mark_used on functions used in default
+ args.
+
+Thu Aug 8 17:48:16 1996 Michael Meissner <meissner@tiktok.cygnus.com>
+
+ * decl2.c (import_export_vtable): Delete code that disabled vtable
+ heuristic on systems with ASM_OUTPUT_EXTERNAL.
+
+Wed Aug 7 12:44:11 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_x_function_call): Handle static call context
+ better.
+
+ * decl.c (finish_function): Set the DECL_CONTEXT of the result to
+ the function, not its outer block.
+
+ * call.c (build_field_call): Pass fields on to build_opfncall
+ regardless of TYPE_OVERLOADS_CALL_EXPR.
+ (build_method_call): Pass on to build_new_method_call sooner.
+
+ * typeck.c (build_ptrmemfunc): Just return what instantiate_type
+ gives us.
+ * class.c (instantiate_type): Don't put a POINTER_TYPE to
+ METHOD_TYPE on an expression. Also make a copy of rhs instead of
+ modifying it.
+
+Tue Aug 6 12:58:46 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (compare_ics): Handle qual_conv after lvalue_conv.
+ (add_builtin_candidate): Don't take enums for ++.
+ (build_new_method_call): Handle non-aggregates and field calls.
+ Move new overloading code from...
+ * cvt.c: Here.
+
+ * decl.c (grokparms): Don't check default args in templates.
+
+Mon Aug 5 17:17:06 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (build_new_op): Fix args to build_unary_op.
+ (add_builtin_candidates): Don't call type_promotes_to on float.
+
+ * decl.c (grokparms): Check the type of the default arg.
+
+ * cvt.c (build_new_op): Pass non-overloaded cases on rather than
+ returning NULL_TREE.
+
+ * typeck.c (build_x_binary_op): Avoid doing extra work.
+ (build_x_unary_op): Likewise.
+ (build_x_conditional_expr): Likewise.
+ * cvt.c (build_over_call): Return.
+ (add_builtin_candidate): Fix MEMBER_REF.
+ (build_new_op): Likewise.
+
+Mon Aug 5 17:07:47 1996 Mike Stump <mrs@cygnus.com>
+
+ * method.c (build_overload_name): Put bug fix into code but leave
+ disabled for now so we can be bug compatible with older releases
+ that do repeats incorrectly. In the future, we can enable it.
+
+Mon Aug 5 13:46:28 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (convert_like): Don't call build_cplus_new twice.
+
+ * call.c, cp-tree.h, cvt.c, decl2.c, init.c, method.c, pt.c, typeck.c:
+ Control new overloading code with -fansi-overloading.
+
+Sun Aug 4 15:29:11 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (build_over_call): Call build_cplus_new.
+ * call.c (build_method_call): Likewise.
+ * typeck.c (build_function_call_real): Likewise.
+ (build_conditional_expr): If both operands are TARGET_EXPRs, wrap
+ the COND_EXPR in a TARGET_EXPR so they use the same slot.
+
+ * cvt.c (build_up_reference): Propagate INDIRECT_BIND to
+ recursive calls.
+ * typeck.c (complete_type): Propagate
+ TYPE_NEEDS_{CONSTRUCTING,DESTRUCTOR}.
+
+Sat Aug 3 14:05:07 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (joust): More ?: kludging. Sigh.
+ (build_over_call): Don't try to synthesize global fns.
+
+ * search.c (lookup_conversions): Use binfo marking.
+
+Sat Aug 3 12:33:42 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * search.c (build_mi_matrix): Use the correct value of cid
+ when determining the new mi_size.
+
+Sat Aug 3 01:27:41 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (add_builtin_candidates): Do consider type conversion ops
+ for the first parms of += et al.
+ (strip_top_quals): New fn.
+ (reference_binding): Use it instead of TYPE_MAIN_VARIANT.
+ (implicit_conversion): Likewise.
+ (add_builtin_candidates): Be careful about arrays.
+ (build_new_method_call): Handle vtable optimization.
+
+Fri Aug 2 01:26:59 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h (LOOKUP_NO_TEMP_BIND): New flag.
+ * cvt.c (reference_binding): Use it.
+ (implicit_conversion): Use it.
+ (add_builtin_candidate, COND_EXPR): Use it.
+
+ * cvt.c (build_new_function_call): Check for error args.
+
+ * typeck.c (comptypes): Just check DERIVED_FROM_P, not UNIQUELY.
+
+ * gxx.gperf: Add __null.
+ * hash.h: Regenerate.
+ * lex.h: Add RID_NULL.
+ * lex.c (init_lex): Create null_pointer_node here, stick it in
+ RID_NULL.
+ * decl.c (init_decl_processing): Still set its type here.
+ * cvt.c (cp_convert_to_pointer): Don't produce null_pointer_node.
+ (convert_to_pointer_force): Likewise.
+ (null_ptr_cst_p): Check for null_pointer_node; only accept (void*)0
+ if (! pedantic).
+ * call.c (convert_harshness): Use null_ptr_cst_p.
+ * typeck.c (convert_for_assignment): Likewise. Don't produce
+ null_pointer_node.
+
+ * error.c (args_as_string): Handle lists of actual args, too.
+ * cvt.c (null_ptr_cst): Support (void*)0 for now.
+ (build_user_type_conversion_1): Improve diagnostics.
+ (build_new_function_call): Likewise.
+ (build_object_call): Likewise.
+ (build_new_method_call): Likewise. Move call before def diagnostic...
+ (build_over_call): Here.
+
+ * cvt.c (build_new_method_call): Don't complain about no match if
+ LOOKUP_SPECULATIVELY.
+ (build_over_call): Fix 'this' for virtual fn.
+ (build_new_method_call): Add diagnostic.
+
+Thu Aug 1 16:45:09 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (add_function_candidate): Expect 'this' and 'in_chrg' for
+ constructors to be passed in.
+ (build_over_call): Likewise.
+ (build_user_type_conversion_1): Pass them in.
+ (convert_like): Likewise.
+ (build_object_call): Handle overloaded conversions.
+ (build_over_call): Pass the right args to build_vfn_ref.
+ (standard_conversion): Fix pmf convs.
+ (joust): Handle comparing statics and non-statics.
+ (build_new_method_call): New fn.
+ * call.c (build_method_call): Call it if NEW_OVER.
+
+Thu Aug 1 16:06:14 1996 Mike Stump <mrs@cygnus.com>
+
+ * lex.c (do_identifier): Don't use %O on IDENTIFIER_OPNAME_Ps, use
+ %D instead.
+
+Thu Aug 1 15:24:02 1996 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_throw): Use maybe_build_cleanup_and_delete
+ instead of just maybe_build_cleanup so that we deallocate the
+ thrown object.
+
+Thu Aug 1 15:18:00 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl2.c (finish_prevtable_vardecl): Make non-static for pt.c's use.
+ * cp-tree.h (finish_prevtable_vardecl): Add decl.
+
+Thu Aug 1 11:53:51 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * pt.c (instantiate_class_template): Call complete_type. Also, if
+ we're at the end of the file and we just instantiated a template
+ class with a vtable, call finish_prevtable_vardecl.
+
+ * error.c (dump_decl): Don't explode (or explode more gracefully
+ as appropriate) if the object being dumped has a null type.
+ (dump_expr): Likewise.
+
+ * search.c (build_mi_matrix): Ensure that mi_size is large enough,
+ by counting the number of nodes that we'll need before allocating
+ the array.
+ (lookup_fnfields): Fix comment.
+ (breadth_first_search): Fix comment.
+
+Wed Jul 31 09:57:05 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_class_template): Propagate TYPE_PACKED and
+ TYPE_ALIGN.
+ * class.c (finish_struct): Call cplus_decl_attributes here.
+ (finish_struct_1): Not here.
+ * cp-tree.h: Adjust.
+
+ * pt.c (type_unification): New parameter STRICT.
+ (unify): If STRICT, don't allow cv addition or base deduction.
+ * call.c, class.c, cvt.c, cp-tree.h: Adjust.
+
+Tue Jul 30 13:06:13 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * search.c (get_template_base{_recursive}): New fns.
+ * pt.c (more_specialized): New fn.
+ (do_function_instantiation): Use it.
+ (unify): Handle base deduction.
+ * cvt.c (joust): Use more_specialized.
+ Don't arbitrarily choose between non-builtin candidates.
+ (build_over_call): Call require_complete_type.
+
+ * decl.c (start_function): Statics are static even in a #pragma
+ interface file.
+
+ * decl2.c (import_export_vtable): Disable vtable heuristic on
+ systems with ASM_OUTPUT_EXTERNAL.
+
+ * cvt.c (compare_ics): Fix comparison of PMEM_CONV and BASE_CONV.
+ (standard_conversion): No std conv to enum type.
+
+ * cvt.c (standard_conversion): Fix order of args to DERIVED_FROM_P
+ for ptm's.
+
+ * cvt.c (reference_binding): Bind directly to a base subobject of
+ a class rvalue.
+
+ * cvt.c (build_new_op): Enforce access control.
+
+Tue Jul 30 09:22:53 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * typeck2.c (process_init_constructor): When scanning the
+ union for a named field, skip things that aren't FIELD_DECLs.
+
+ * method.c (synthesize_method): Don't scan fndecl's rtl if
+ we're at the end of the file; just assume the function can't
+ be inlined.
+
+Mon Jul 29 15:48:30 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (build_builtin_candidate): Stick a dummy conversion in if
+ it failed.
+
+ * cvt.c (build_user_type_conversion_1): Handle overloaded
+ conversion ops.
+
+ * cvt.c (add_builtin_candidates): Don't consider type conversion
+ operators for the first parameter of operator=.
+
+Mon Jul 29 15:33:55 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * typeck.c (complete_type): Only call layout_type if we're not
+ expanding a template.
+
+Mon Jul 29 14:40:38 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (compare_ics): Oops.
+
+ * cvt.c (op_error): Oops.
+
+ * cp-tree.def: Add RVALUE_CONV, rename EXACT_CONV to IDENTITY_CONV.
+ * cvt.c: Add IDENTITY_RANK before others. Use real_lvalue_p.
+ (build_conv): Use them.
+ (implicit_conversion): Use them.
+ (convert_like): Handle them.
+ (build_new_op): Handle builtin COND_EXPR again.
+ (add_builtin_candidates): Strip cv-quals. Fix oops. Include enums
+ in lists of types for COND_EXPR.
+ (add_builtin_candidate): Add enum candidates for COND_EXPR.
+
+Mon Jul 29 12:05:40 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * typeck.c (build_modify_expr): Always attempt to build a call to
+ the assignment operator, even if we're using a default one.
+ (convert_for_initialization): Call complete_type.
+
+Mon Jul 29 11:25:08 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (reference_binding): A REF_BIND gets the reference type.
+ (implicit_conversion): Likewise.
+ (convert_like): Likewise.
+ (compare_ics): Likewise.
+ (compare_qual): Likewise.
+ (print_z_candidates): Handle no candidates.
+ (build_new_op): Don't handle builtin COND_EXPR for now.
+
+Sat Jul 27 11:27:47 1996 Stan Shebs <shebs@andros.cygnus.com>
+
+ * cvt.c (build_builtin_candidate): Init local var in an ANSI way.
+
+Fri Jul 26 01:07:22 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (joust): If the candidates are the same, arbitrarily pick one.
+
+ * cvt.c (build_builtin_candidate): Oops.
+ (build_new_op): Oops.
+
+ * method.c (build_opfncall): Pass COND_EXPR on.
+ * cvt.c (build_builtin_candidate): Reorganize, support COND_EXPR.
+ (add_builtin_candidate{,s}): Likewise.
+ (add_builtin_candidates): Likewise.
+ (print_z_candidates, op_error, build_new_op): Likewise.
+ (type_decays_to): New fn.
+ * lex.c (init_lex): Just say ?: for COND_EXPR.
+
+Thu Jul 25 09:33:33 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (complete_type): Call layout_type rather than building
+ a new array type.
+
+ * cvt.c (add_builtin_candidate): Pointer arithmetic candidates
+ only use ptrdiff_t.
+
+Wed Jul 24 12:45:08 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c: Always compile the new overloading code (but don't use it).
+ (implicit_conversion): Add a BASE_CONV when converting to
+ the same class type.
+ (convert_like): Handle BASE_CONV.
+
+Tue Jul 23 12:46:30 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (build_new_op): Support {MAX,MIN}_EXPR.
+ (add_builtin_candidate): Likewise.
+
+ NEW_OVER changes:
+ * typeck.c (build_x_function_call): Try an operator function
+ whenever we call an object of class type.
+ * method.c (build_opfncall): Pass CALL_EXPRs through.
+ * cvt.c (implicit_conversion): Do const-ref case first.
+ (add_conv_candidate, build_object_call, op_error): New fns.
+ (ptr_complete_ob, TYPE_PTROB_P): void is not an object type.
+ ({add,build}_builtin_candidate{,s}, print_z_candidates): Display
+ builtin candidates.
+ (build_new_op): Handle CALL_EXPR. Don't try to decay void.
+ Fall back on preincrement handling. Use op_error.
+ Handle warn_synth.
+ (convert_like): Pass INDIRECT_BIND. Don't try to do anything with
+ an error_mark_node.
+ (build_over_call): Handle PROMOTE_PROTOTYPES and ellipsis promotions
+ properly.
+
+Mon Jul 22 16:21:55 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * pt.c (tsubst_expr): Handle CONTINUE_STMT.
+
+Mon Jul 22 15:38:58 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_component_ref_1): Use build_component_ref
+ instead of open coding it here.
+
+Mon Jul 22 12:18:54 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * g++.c (main): Don't link with -lg++.
+
+ NEW_OVER changes:
+ * cvt.c (convert_to_reference): Don't use convert_from_reference on
+ result of build_type_conversion.
+ (cp_convert): Only call build_method_call for ctors if
+ build_type_conversion failed.
+ (ptr_complete_ob): New function.
+ (TYPE_PTR{,OB,MEM}_P): New macros.
+ ({add,build}_builtin_candidate{,s}): New functions.
+ (print_z_candidates): Handle builtins.
+ (build_user_type_conversion_1): Don't use conversion fns for
+ converting to a base type.
+ (build_user_type_conversion_1): Set ICS_USER_FLAG on AMBIG_CONVs.
+ (build_user_type_conversion): Use convert_from_reference.
+ (build_new_op): New function.
+ (build_over_call): Fix handling of methods.
+ (compare_ics): Handle AMBIG_CONV properly.
+ * typeck2.c: Increment abort count.
+ * method.c (build_opfncall): Forward most requests to build_new_op.
+ * cp-tree.h (IS_OVERLOAD_TYPE): Tweak.
+
+Fri Jul 19 17:59:29 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * error.c (dump_expr, case CONSTRUCTOR, case CAST_EXPR): Take out
+ invalid second argument to dump_expr_list.
+
+Fri Jul 19 14:04:05 1996 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (lookup_name_real): Make sure we do obj->X::i correctly.
+
+Thu Jul 18 14:48:23 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * decl2.c (import_export_vtable): ASM_OUTPUT_EXTERNAL, not
+ ASSEMBLE_EXTERNAL.
+
+Mon Jul 15 17:48:43 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck2.c (process_init_constructor): New pedwarn for using { }
+ to initialize a pointer to member function.
+ * typeck.c (build_ptrmemfunc1): Avoid use of digest_init so that
+ we can avoid the new error.
+
+Mon Jul 15 15:42:03 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_ptrmemfunc1): New function to hide details of
+ pointer to member functions better.
+
+Mon Jul 15 14:23:02 1996 Mike Stump <mrs@cygnus.com>
+
+ * init.c (resolve_offset_ref): Resolve OFFSET_REFs that are
+ methods into the actual method, as we know the implied object is
+ not used.
+
+Mon Jul 15 13:08:29 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y (maybecomma_warn): Only emit the pedwarn if we're not
+ inside a system header.
+
+Fri Jul 12 16:30:05 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * call.c (build_method_call): Call complete_type on the
+ instance type.
+
+Thu Jul 11 17:16:40 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_component_ref): Always build up an OFFSET_REF
+ for obj_ptr->func so that we can know which object to use in a
+ method call.
+
+Wed Jul 10 19:36:37 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_ptrmemfunc): Remove sorry, now we can cast
+ around things. Also improve maintainability.
+
+Wed Jul 10 18:20:11 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * decl.c (grokdeclarator): Check for overflow when evaluating an
+ array dimension.
+
+Wed Jul 10 17:26:19 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (cp_convert): Don't check for ambiguity with constructor
+ if NEW_OVER.
+
+ * typeck.c (build_x_function_call): Pass function overload
+ questions to new overloading code if NEW_OVER.
+ * init.c (expand_aggr_init_1): Only check for type conversion ops
+ if we're doing copy-initialization (i.e. LOOKUP_ONLYCONVERTING).
+ Don't check for ambiguity with constructor if NEW_OVER.
+ * cvt.c (convert_to_reference): Dereference the result of a type
+ conversion operator.
+ (build_conv): Propagate ICS_USER_FLAG.
+ (implicit_conversion): Call instantiate_type.
+ Pass LOOKUP_ONLYCONVERTING instead of LOOKUP_NORMAL.
+ (add_function_candidate): Fix cv-quals on argtype.
+ (print_z_candidates): New function.
+ (build_new_function_call): Call it.
+ (build_user_type_conversion_1): If LOOKUP_ONLYCONVERTING, don't
+ consider non-converting constructors.
+ Call print_z_candidates.
+ Return an AMBIG_CONV for an ambiguous conversion.
+ (build_user_type_conversion): Handle AMBIG_CONV.
+ (convert_like): Fix test for building TARGET_EXPR.
+ Call instantiate_type.
+ Handle AMBIG_CONV and LVALUE_CONV.
+ (build_over_call): Handle 0 args and ellipsis.
+ * cp-tree.def: Add AMBIG_CONV.
+
+Tue Jul 9 17:48:48 1996 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (lookup_name_real): If we find mem in obj when parsing
+ `obj->mem', make sure we return the right value.
+
+Tue Jul 9 16:11:28 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * search.c (get_base_distance): Call complete_type.
+
+Tue Jul 9 12:46:34 1996 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (store_bindings): Make static.
+
+Mon Jul 8 16:42:31 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (expand_aggr_init_1): Don't check type conversions if
+ NEW_OVER.
+
+ * cvt.c (z_candidate): Put back template field.
+ (add_function_candidate): Set it.
+ (add_template_candidate): Likewise.
+ (joust): Use it.
+ (compare_qual): Handle references and pointers to members.
+ (compare_ics): Handle reference bindings.
+
+ * decl.c (duplicate_decls): Propagate DECL_ONE_ONLY.
+
+Mon Jul 8 16:18:56 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * call.c (compute_conversion_costs): Call complete_type.
+
+ * tree.c (vec_binfo_member): Use comptypes instead of comparing
+ pointers, so we can handle template parameters.
+
+Fri Jul 5 16:51:53 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * cvt.c (cp_convert_to_pointer): We have to call complete_type
+ here; let's make it explicit instead of a side effect of an
+ error check.
+
+Wed Jul 3 16:29:51 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (z_candidate): Remove template field.
+ (reference_binding): Handle binding to temporary.
+ (implicit_conversion): Likewise.
+ (add_function_candidate): Handle artificial constructor parms.
+ Handle functions with too few parms.
+ (add_template_candidate): New function.
+ (build_user_type_conversion_1): Handle constructors.
+ (convert_like): Likewise.
+ (build_over_call): Likewise.
+ (build_new_function_call): Support templates.
+ (compare_ics): Fix reference, inheritance handling.
+
+Mon Jul 1 22:58:18 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * decl.c: Add signed_size_zero_node.
+ (init_decl_processing): Build it.
+ * class.c (prepare_fresh_vtable): Use it instead of size_zero_node
+ when we're trying to make a negative delta.
+
+Mon Jul 1 17:56:19 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ Stop doing this damn index==strchr variable name confusion.
+ * class.c (add_virtual_function): Change local var INDEX to be
+ named IDX.
+ (add_method): Likewise.
+ * lex.c (print_parse_statistics): Likewise.
+ * search.c (make_memoized_table_entry): Likewise.
+ (lookup_fnfields_here): Likewise.
+ (lookup_field): Likewise.
+ (lookup_fnfields): Likewise.
+ (get_baselinks): Likewise.
+ * sig.c (build_signature_table_constructor): Likewise.
+ (build_signature_method_call): Likewise.
+ * typeck.c (build_x_array_ref): Change INDEX parm to be named IDX.
+ (get_member_function_from_ptrfunc): Likewise.
+ (build_ptrmemfunc): Change local var INDEX to be IDX.
+ (c_expand_start_case): Likewise.
+
+Sat Jun 29 14:05:46 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (cp_convert_to_pointer): Move user-defined type conversion
+ handling to before extraction of TYPE_PTRMEMFUNC_FN_TYPE.
+ (convert_to_reference): Use build_type_conversion to convert to
+ the reference type directly.
+ (standard_conversion): Fix void* case, non-conversions.
+ (reference_binding): Fix expr == 0 case, non-conversions.
+ (convert_like): Support REF_BIND.
+ (compare_qual): Split out from compare_ics.
+ (compare_ics): Use it, handle icses with only a qual_conv.
+
+ * init.c (expand_vec_init): Don't crash if decl is NULL.
+
+Fri Jun 28 11:52:51 1996 Stan Shebs <shebs@andros.cygnus.com>
+
+ * mpw-config.in: New file, configury for Mac MPW.
+ * mpw-make.sed: New file, makefile editing for MPW.
+
+Thu Jun 27 15:18:30 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_class_template): Call repo_template_used.
+
+ * search.c (lookup_conversions): Only lookup conversions in
+ complete types.
+
+Thu Jun 27 12:59:53 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-tree.def: Renamed from tree.def, to avoid confusion with
+ gcc's tree.def.
+ * cp-tree.h, lex.c: Include cp-tree.def.
+ * Makefile.in (CXX_TREE_H): Reference cp-tree.def.
+
+Wed Jun 26 18:29:47 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * init.c (build_vec_delete_1): Call complete_type.
+
+Mon Jun 24 17:17:32 1996 Mike Stump <mrs@cygnus.com>
+
+ * except.c (start_anon_func): Make sure anonymous functions are
+ never external.
+
+Fri Jun 21 15:10:58 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (finish_function): If function_depth > 1, set nested.
+
+ * decl2.c (grokbitfield): Revert Bob's change.
+ * class.c (finish_struct_1): Fix handling of named bitfield widths.
+
+Thu Jun 20 23:35:38 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (add_pending_template): Handle types.
+ (lookup_template_class): With -fexternal-templates, just add the class
+ to pending_templates instead of instantiating it now.
+ * decl2.c (finish_file): Handle types in pending_templates.
+
+Thu Jun 20 14:08:40 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * decl2.c (grokbitfield): Handle constant decls appropriately.
+ Give an appropriate error message now instead of spewing core
+ later.
+
+Thu Jun 20 13:01:51 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c: Don't turn on thunks by default for now.
+
+Wed Jun 19 11:37:04 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (complete_type): Handle error_mark_node.
+ (common_type, OFFSET_TYPE): Handle template_type_parms.
+
+Tue Jun 18 10:02:15 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_decl): If at_eof, call import_export_decl
+ regardless of DECL_INLINE.
+
+ * typeck.c (mark_addressable): Set TREE_ADDRESSABLE on CONSTRUCTORs.
+
+ * class.c (finish_struct_bits): Copy TYPE_SIZE.
+
+ * rtti.c (build_dynamic_cast): Support templates.
+ * tree.def: Support DYNAMIC_CAST_EXPR.
+ * pt.c (tsubst_copy): Likewise.
+ * decl2.c (build_expr_from_tree): Likewise.
+
+Mon Jun 17 15:23:36 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_static_cast): Support templates.
+ (build_const_cast): Likewise.
+ * tree.def: Support CONST/STATIC_CAST_EXPR.
+ * pt.c (tsubst_copy): Likewise.
+ * decl2.c (build_expr_from_tree): Likewise.
+
+Sun Jun 16 12:33:57 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_vtable_vardecl): Don't trust
+ TREE_SYMBOL_REFERENCED for vtables of local classes.
+
+Fri Jun 14 18:13:36 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst_copy): Handle operator T.
+
+Wed Jun 12 17:52:40 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * init.c (build_delete): Move creation of PARMS inside test of
+ TYPE_HAS_DESTRUCTOR, since it's never used outside of that block.
+
+Tue Jun 11 15:09:18 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * typeck.c (build_conditional_expr): Don't assume that
+ the arguments to ?: are always pointers or records.
+
+Tue Jun 11 13:56:23 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (import_export_decl): Still emit static/weak/comdat
+ copies of inline template functions with -fno-implicit-templates.
+
+Tue Jun 11 11:42:13 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * init.c (build_delete): Determine the complete basetype
+ path to the destructor we're calling.
+
+Fri Jun 7 15:30:10 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * decl.c (build_enumerator): Always copy the INTEGER_CST used to
+ initialize the enum, because we really and truly don't know where
+ it came from.
+ (start_enum): Don't copy integer_zero_node because
+ build_enumerator will do it.
+
+Fri Jun 7 11:11:09 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (finish_function): Do access control on base destructors.
+
+ * pt.c (tsubst, case FUNCTION_DECL): Set up
+ IDENTIFIER_GLOBAL_VALUE for member functions so pushdecl doesn't
+ hose us.
+
+Fri Jun 7 10:37:33 1996 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (build_up_reference): If we have already extended the
+ lifetime of the temporary, don't try it again.
+ * typeck.c (c_expand_return): Don't try and convert the return
+ value twice when we want a reference, once is enough.
+
+Tue Jun 4 15:41:45 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst_expr, case DECL_STMT): Don't pass
+ LOOKUP_ONLYCONVERTING at all for now.
+
+ * search.c (add_conversions): Put the conversion function in
+ TREE_VALUE, the basetype in TREE_PURPOSE.
+ * cvt.c (build_type_conversion): Adjust.
+ * cvt.c (build_expr_type_conversion): Adjust.
+ * call.c (user_harshness): Adjust.
+
+Mon Jun 3 15:30:52 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (emit_thunk): Pretend this is a FUNCTION_DECL for the
+ backend's benefit.
+
+Mon Jun 10 18:58:19 1996 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_start_catch_block): Add a dummy region, if we
+ get an error, so that we can avoid core dumping later.
+
+Fri May 31 14:56:13 1996 Mike Stump <mrs@cygnus.com>
+
+ * cp-tree.h (OFFSET_REF): Remove.
+ * tree.def (CP_OFFSET_REF): Rename to OFFSET_REF.
+ * expr.c (cplus_expand_expr): Cleanup callers of expand_expr.
+ * init.c (expand_aggr_init_1): Likewise.
+ (build_new): Likewise.
+ * typeck.c (expand_target_expr): Likewise.
+
+Fri May 31 14:22:08 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_modify_expr): Don't use TREE_VALUE on a
+ TARGET_EXPR.
+
+Wed May 29 17:04:33 1996 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (build_up_reference): Redo how and when temporaries are
+ created.
+ * decl.c (grok_reference_init): Don't try and be smart about
+ running cleanups.
+
+Wed May 29 16:02:08 1996 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (build_up_reference): Add NULL_TREE to all calls to build
+ (TARGET_EXPR...), now that it has 4 arguments.
+ * tree.c (build_cplus_new): Likewise.
+
+Thu May 23 16:40:30 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * error.c (dump_expr, case CAST_EXPR): Handle T() properly.
+
+ * pt.c (instantiate_decl): Don't call push/pop_cp_function_context.
+ * decl.c (struct saved_scope): Remove named_labels,
+ {base,member}_init_list.
+ (maybe_push_to_top_level): Don't set them. Call
+ push_cp_function_context if appropriate.
+ (pop_from_top_level): Likewise.
+
+ * method.c (do_build_assign_ref): Remove obsolete check of
+ TYPE_HAS_ASSIGN_REF (basetype).
+
+ * decl.c (grokfndecl): Diagnose user definition of
+ implicitly-declared methods.
+
+Thu May 23 12:13:08 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * method.c (do_build_copy_constructor): Add code to give
+ meaningful error messages instead of crashing.
+ (do_build_assign_ref): Don't synthesize assignment operators for
+ classes containing reference or const members.
+
+ * class.c (struct base_info): Remove cant_synth_copy_ctor
+ and cant_synth_asn_ref.
+ (finish_base_struct): Remove the code that tries to conditionalize
+ synthesis of copy constructors & assignment operators based on
+ access permissions. Instead, let it fail when it tries to
+ synthesize the copy constructor. This will give meaningful error
+ messages instead of silently generating code to perform a bitcopy.
+
+Wed May 22 11:45:19 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * lex.c (real_yylex): Remove old-n-crufty #if 0 code for
+ determining types for constant values.
+
+ * decl.c (struct named_label_list): Use instead of stuffing
+ random items into a TREE_LIST node.
+ (named_label_uses): Use the new struct.
+ (poplevel): Likewise.
+ (lookup_label): Likewise.
+ (define_label): Add an error message to tell the user the line
+ where the goto is located in addition to the destination of the
+ goto.
+ (init_decl_processing): Use NULL instead of NULL_TREE to initialize
+ named_label_uses.
+ (finish_function): Likewise.
+
+ (start_decl): Complain about defining a static data member
+ in a different type from which it was declared.
+
+Wed May 22 09:33:23 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (build_expr_type_conversion): Adjust.
+
+Tue May 21 11:21:56 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (build_method_call): Always convert 'this' to the
+ appropriate type.
+
+ * search.c (add_conversions): Put the conversion function in
+ TREE_VALUE, the type in TREE_PURPOSE.
+ * cvt.c (build_type_conversion): Adjust.
+ * call.c (user_harshness): Adjust.
+
+ * method.c (emit_thunk): Call temporary_allocation and
+ permanent_allocation around the ASM_OUTPUT_MI_THUNK case, too.
+
+ * tree.c (build_cplus_array_type): Handle tweaking of
+ TYPE_MAIN_VARIANT here.
+ * typeck.c (common_type): Not here.
+
+ * typeck.c (complete_type): Only try to complete an array type if
+ it has a domain.
+
+Mon May 20 14:55:59 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokvardecl): Call complete_type.
+ (grokdeclarator): Call complete_type for PARM_DECLs.
+
+Fri May 17 16:41:17 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_class_template): Re-set
+ CLASSTYPE_GOT_SEMICOLON after calling finish_struct_1.
+
+Fri May 17 14:56:55 1996 Mike Stump <mrs@cygnus.com>
+
+ * cp-tree.h (cp_expand_decl_cleanup): Remove, the backend is now
+ smart enough to do it right.
+ * tree.c (cp_expand_decl_cleanup): Likewise.
+ * decl.c (cp_finish_decl): Use expand_decl_cleanup instead of
+ cp_expand_decl_cleanup.
+ (store_parm_decls): Likewise.
+ (hack_incomplete_structures): Likewise.
+ * except.c (push_eh_cleanup): Likewise.
+
+Fri May 17 13:13:51 1996 Mike Stump <mrs@cygnus.com>
+
+ * expr.c (expand_expr, cond UNSAVE_EXPR): Move from the C++
+ frontend to the backend where it belongs.
+ * tree.c (unsave_expr): Likewise.
+ (unsave_expr_now): Likewise.
+ * tree.def (UNSAVE_EXPR): Likewise.
+ * cp-tree.h (unsave_expr): Likewise.
+ (unsave_expr_now): Likewise.
+
+Fri May 17 11:02:41 1996 Mike Stump <mrs@cygnus.com>
+
+ * init.c (emit_base_init): Make sure the partial EH cleanups live
+ on the function_obstack.
+
+Thu May 16 15:29:33 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * expr.c (do_case): Don't try to dereference null TREE_TYPEs
+ when checking for pointer types.
+
+Thu May 16 13:38:58 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_class_template): Remove obsolete check for
+ access declarations.
+
+Thu May 16 13:34:15 1996 Mike Stump <mrs@cygnus.com>
+
+ * call.c (build_overload_call): Simplify calls to
+ build_overload_call by removing last parameter.
+ (build_method_call): Likewise.
+ * cp-tree.h: Likewise.
+ * method.c (build_opfncall): Likewise.
+ * typeck.c (build_x_function_call): Likewise.
+
+Thu May 16 13:15:43 1996 Mike Stump <mrs@cygnus.com>
+
+ * call.c (default_parm_conversions): Factor out common code.
+ (build_method_call): Use it.
+ (build_overload_call_real): Use it.
+
+Wed May 15 14:46:14 1996 Mike Stump <mrs@cygnus.com>
+
+ * call.c (build_method_call): Allow implicit & on METHOD_TYPEs,
+ but pedwarn as the code is bogus.
+ * typeck.c (decay_conversion): Likewise.
+ (build_function_call_real): Use build_addr_func instead of
+ default_conversion. Don't allow pointer-to-method functions down
+ here.
+ (build_unary_op): Use real pointer-to-member functions instead of
+ fake ones.
+ (build_ptrmemfunc): Use build_addr_func instead of build_unary_op.
+ (convert_for_assignment): Removed some obsolete code.
+ * decl2.c (reparse_absdcl_as_expr): Pass current_class_ref to
+ build_x_function_call instead of current_class_ptr. Only call
+ digest_init once on an initializer, we do this just checking
+ TREE_TYPE.
+ (build_expr_from_tree): Pass current_class_ref to
+ build_x_function_call instead of current_class_ptr.
+ * init.c (build_member_call): Likewise.
+ * pase.y: Likewise.
+ * error.c (dump_expr): Handle OFFSET_REFs better.
+ * pt.c (unify): Handle pointer-to-member functions better.
+ * decl.c (finish_function): Clear out current_class_ref just like
+ we do for current_class_ptr.
+
+ * typeck.c (get_delta_difference): Handle virtual bases better.
+
+Tue May 14 16:37:37 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * sig.c (build_signature_table_constructor): Use the delta for
+ the original basetype for this virtual function with thunks.
+ (build_signature_method_call): We still need to adjust 'this'
+ with thunks.
+
+Tue May 14 16:27:25 1996 Mike Stump <mrs@cygnus.com>
+
+ * call.c (build_addr_func): New routine. Used to get the `real'
+ address of a function or a method. Needed to avoid getting a
+ pointer-to-member function.
+ (build_call): New routine to build CALL_EXPRs.
+ (build_method_call): Use it.
+ * cvt.c (convert_to_aggr): Likewise.
+ * typeck.c (build_function_call_real): Likewise.
+ * sig.c (build_signature_table_constructor): Use build_addr_func.
+ * cp-tree.h (build_call, build_addr_func): Declare them.
+
+Tue May 14 12:47:47 1996 Mike Stump <mrs@cygnus.com>
+
+ * cp-tree.h (LOOKUP_AGGR): Remove, unused.
+ * parse.y: Remove uses of LOOKUP_AGGR.
+
+Tue May 14 12:07:51 1996 Mike Stump <mrs@cygnus.com>
+
+ * *.[chy]: Rename current_class_decl to current_class_ptr, and
+ C_C_D to current_class_ref.
+
+Mon May 13 16:55:23 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (convert_harshness): Tighten up pointer conversions.
+
+Sat May 11 04:33:50 1996 Doug Evans <dje@canuck.cygnus.com>
+
+ * decl2.c (finish_vtable_vardecl): Surround DECL_ONE_ONLY with ifdef.
+ (finish_file): Likewise.
+
+Fri May 10 11:09:57 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (convert_fn_ptr): We don't use thunks for pmfs.
+
+ * method.c (emit_thunk): Set flag_omit_frame_pointer in default
+ code.
+
+Thu May 9 18:18:30 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c: Turn on thunks by default where supported.
+
+Tue May 7 20:39:57 1996 Mike Stump <mrs@cygnus.com>
+
+ * cp-tree.h (build_overload_call_maybe): Removed.
+ * call.c (build_overload_call_real): Invert meaning of last arg to
+ be require_complete.
+ (build_overload_call): Likewise.
+ * typeck.c (build_x_function_call): Use build_overload_call_real
+ instead of build_overload_call_maybe.
+
+Mon May 6 01:23:32 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_file): Don't try to emit functions that haven't
+ been compiled.
+
+Fri May 3 09:30:13 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_vtable_vardecl): Oops.
+
+ * decl.c (maybe_push_to_top_level): Do save previous_class_*.
+ Also store the bindings from previous_class_values.
+ (pop_from_top_level): Restore them.
+
+Thu May 2 21:56:49 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_vtable_vardecl): Only write out vtable if its
+ symbol has been referenced.
+ (finish_file): Re-join synthesis/vtable loop with inline emission
+ loop, disable inlining when an inline is output.
+
+Thu May 2 17:20:02 1996 Mike Stump <mrs@cygnus.com>
+
+ * except.c (init_exception_processing): Setup saved_in_catch.
+ (push_eh_cleanup): Reset __eh_in_catch.
+ (expand_start_catch_block): Set __eh_in_catch.
+
+Thu May 2 16:21:17 1996 Mike Stump <mrs@cygnus.com>
+
+ * except.c (push_eh_cleanup): Add tracking for whether or not we
+ have an active exception object.
+ (expand_builtin_throw): Use it to make sure a rethrow without an
+ exception object is caught.
+
+Thu May 2 11:26:41 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (maybe_push_to_top_level): Clear out class-level bindings
+ cache.
+
+Wed May 1 11:26:52 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_file): Also use sentries for vars with
+ DECL_ONE_ONLY or DECL_WEAK set (should any such happen to be
+ created).
+
+ * lex.c (handle_cp_pragma): Disable #pragma
+ interface/implementation if SUPPORTS_ONE_ONLY > 1.
+
+Tue Apr 30 11:25:46 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (emit_thunk): Wrap default case in
+ temporary/permanent_allocation.
+
+ * method.c (make_thunk): Use DECL_ONE_ONLY.
+ (emit_thunk): Call assemble_end_function.
+
+Mon Apr 29 15:38:29 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (import_export_vtable): Use DECL_ONE_ONLY.
+ (import_export_decl): Likewise.
+ (finish_prevtable_vardecl): Disable vtable hack if
+ SUPPORTS_ONE_ONLY > 1.
+
+Mon Apr 29 14:32:47 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_modify_expr): PREINCREMENT_EXPR and
+ PREDECREMENT_EXPRs take two arguments, not one.
+
+Mon Apr 29 00:27:53 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (build_vtable_entry): Don't build thunks for abstract
+ virtuals.
+
+ * lex.c (real_yylex): Fix handling of __PRETTY_FUNCTION__ like C
+ frontend.
+
+Sat Apr 27 16:45:35 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (set_rtti_entry): Use size_zero_node.
+ (build_vtable): Likewise.
+
+Sat Apr 27 14:48:57 1996 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * class.c (finish_struct_1): Pass size_zero_node to set_rtti_entry.
+ (prepare_fresh_vtable): Likewise.
+
+Fri Apr 26 13:14:14 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (emit_thunk): Call mark_used on the target function.
+
+ * call.c (build_method_call): Don't warn about pending templates.
+
+Thu Apr 25 14:55:44 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_file): Fix list walking logic.
+
+ * typeck2.c (check_for_new_type): Only warn if -pedantic.
+
+Wed Apr 24 15:41:15 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * class.c (finish_struct_1): Remove old code for
+ dont_allow_type_definitions.
+ * cp-tree.h: Likewise.
+ * spew.c: Make sure cp-tree.h is included before parse.h, so the
+ definition of flagged_type_tree is found before it is used.
+ * lex.c: Likewise.
+ * parse.y: Added the ftype member to the type union, and changed a
+ number of rules to use it instead of ttype. Added calls to
+ check_for_new_type() as appropriate.
+ * typeck2.c (check_for_new_type): New function for checking
+ if a newly defined type appears in the specified tree.
+ * cp-tree.h: Add new type flagged_type_tree. Add a prototype
+ for check_for_new_type().
+
+Wed Apr 24 00:36:21 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_file): Only use a sentry if the decl is public.
+
+ * pt.c (tsubst_expr, DECL_STMT): If we don't have an initializer,
+ don't pass LOOKUP_ONLYCONVERTING.
+
+Tue Apr 23 17:18:47 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * typeck.c (common_type): Fix the ARRAY_TYPE case so it
+ properly keeps track of const and volatile type modifiers.
+
+Tue Apr 23 10:52:56 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (cp_tree_equal): C++ version of simple_cst_equal.
+ * pt.c (comp_template_args): Use it.
+
+ * rtti.c (get_tinfo_fn, build_dynamic_cast, expand_*_desc): Call
+ assemble_external for artificial function decls.
+
+ * decl.c (cp_finish_decl): Oops.
+
+Mon Apr 22 17:28:27 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (import_export_decl): Put static data member templates
+ into common storage, or make them weak, depending on whether they
+ are dynamically or statically initialized.
+ (get_sentry): New function.
+ (finish_file): Do import_export_decl for static data members before
+ building the init/fini functions. Don't init/fini a variable that's
+ EXTERNAL. Use a sentry for variables in common. Fix mismatching
+ push/pop_temp_slots.
+ * decl.c (cp_finish_decl): If DECL_NOT_REALLY_EXTERN, do the
+ expand_static_init thang.
+ * method.c (get_id_2): New function.
+
+Mon Apr 22 15:32:45 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * parse.y (empty_parms): Make sure we use C++-style prototypes
+ when we're declaring member functions.
+
+Sun Apr 21 10:08:22 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * Makefile.in (CONFLICTS): 16 s/r conflicts.
+ * parse.y (self_template_type): New nonterminal.
+
+Thu Apr 18 08:56:54 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (make_typename_type): Handle getting a TYPE_DECL for a
+ name.
+ * parse.y (base_class.1): Allow 'typename foo::bar'.
+
+ * lex.c (check_newline): Remove #pragma code that plays with the
+ input stream, since we now deal with tokens. Clear nextchar when
+ we're done.
+ (handle_cp_pragma): Use real_yylex.
+ (handle_sysv_pragma): Don't do skipline here. Only call real_yylex
+ in one place.
+
+ * lex.c (check_for_missing_semicolon): Handle SELFNAME.
+
+ * lex.c (handle_cp_pragma): Fix "#pragma implementation".
+
+Wed Apr 17 16:51:33 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y: New token SELFNAME for potential constructor.
+ * spew.c (yylex): Handle it.
+ * lex.c (identifier_type): Produce it.
+
+ * parse.y (complete_type_name): In :: case, don't push class binding.
+ (complex_type_name): Likewise.
+
+Wed Apr 17 15:02:40 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_reinterpret_cast): Handle pointer to member
+ functions.
+
+Wed Apr 17 12:28:26 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * lex.c (handle_cp_pragma): New function, with decl, doing the cc1plus
+ pragmas.
+ (check_newline): Put the vtable/unit/implementation/interface pragma
+ code into handle_cp_pragma, replacing it with a call.
+ (handle_sysv_pragma): Give int return type, and take FINPUT and TOKEN
+ args. Get the next token after handling the pragma token.
+
+Wed Apr 17 10:28:34 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (cp_convert_to_pointer): Avoid doing base analysis on pmfs.
+ (convert_to_pointer_force): Likewise.
+
+ * init.c (build_new): Fix array new without -fcheck-new.
+
+Tue Apr 16 13:44:58 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h, call.c, class.c, decl.c, parse.y, pt.c, rtti.c,
+ tree.c: Lose TYPE_NESTED_NAME.
+
+ * parse.y (nested_name_specifier_1): Don't treat non-identifiers
+ as identifiers.
+
+ * tree.def: Add VEC_INIT_EXPR.
+ * expr.c (cplus_expand_expr): Handle it.
+ * init.c (build_new): Use it instead of the RTL_EXPR nastiness and
+ the extra file-scope symbol nastiness.
+
+Mon Apr 15 16:21:29 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (make_thunk): Thunks are static.
+ (emit_thunk): Use ASM_OUTPUT_MI_THUNK if it's defined.
+
+ * decl2.c (mark_vtable_entries): Emit thunks as needed.
+ (finish_file): Don't emit them here.
+
+Sun Apr 14 11:34:39 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * rtti.c (build_dynamic_cast): Handle null pointers.
+ (ifnonnull): New function.
+
+Fri Apr 12 09:08:27 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * call.c (build_method_call): Remember the original basetype we
+ were called with. Give an error message instead of trying
+ (incorrectly) to call a non-static member function through a
+ non-inherited class.
+
+ * search.c (expand_upcast_fixups): Mark the new fixup as
+ DECL_ARTIFICIAL.
+
+Thu Apr 11 03:57:09 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (build_new): Use a TARGET_EXPR for alloc_expr.
+
+ * class.c (set_rtti_entry): Fix for thunks.
+
+ * decl2.c (import_export_decl): Still emit typeinfo fns for
+ cv-variants of builtin types.
+
+ * rtti.c (expand_class_desc): Set up base_info_type_node here.
+ (init_rtti_processing): Instead of here.
+
+Wed Apr 10 14:17:13 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * rtti.c (init_rtti_processing): Do init regardless of -frtti.
+ (build_typeid): Only complain about taking dynamic typeid without
+ -frtti.
+
+ * decl2.c: flag_rtti defaults to 1.
+
+ * rtti.c (get_tinfo_var): The general class case is now smaller.
+ (init_rtti_processing): Pack the latter three fields of base_info
+ into 32 bits.
+
+Wed Apr 10 13:50:14 1996 Mike Stump <mrs@cygnus.com>
+
+ * init.c (expand_member_init): Don't dump if name is NULL_TREE.
+
+Wed Apr 10 12:56:02 1996 Mike Stump <mrs@cygnus.com>
+
+ * search.c (make_memoized_table_entry): Undefer the pop, if necessary.
+ (push_memoized_context): Split out code to undefer pop_type_level to
+ (clear_memoized_cache): here.
+ (pop_memoized_context): We can only handle one layer of deferral of
+ pop_type_level so clear the cache, if there was a previous level.
+
+Tue Apr 9 23:06:09 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * rtti.c (init_rtti_processing): Build up base_info_type_node.
+ (expand_class_desc): Use one pointer to an array of base_info
+ structs, passed using a CONSTRUCTOR.
+
+Tue Apr 9 14:20:57 1996 Mike Stump <mrs@cygnus.com>
+
+ * class.c (build_vbase_path): Remove block extern for
+ flag_assume_nonnull_objects here.
+ (build_vfn_ref): Split out functionality into build_vtbl_ref.
+ (build_vtbl_ref): New routine.
+ (build_vtable): Set up rtti info here.
+ (add_virtual_function): Note in CLASSTYPE_RTTI the best
+ place where we can get the rtti pointers from to avoid having to
+ search around for a place.
+ (finish_base_struct): Likewise.
+ (finish_struct_1): Likewise. Never create totally new vtables
+ with totally new vtable pointers for rtti. Disable code to layout
+ vtable pointers better until we want to break binary
+ compatibility.
+ * rtti.c (build_headof_sub): New routine to convert down to a
+ sub-object that has an rtti pointer in the vtable.
+ (build_headof): Use it. Also, use build_vtbl_ref now to be more
+ maintainable.
+ (build_dynamic_cast): Make sure we have saved it, if we need to.
+ * search.c (dfs_init_vbase_pointers): Disable code that deals with
+ a more efficient vtable layout, enable later.
+ * call.c (flag_assume_nonnull_objects): Moved declaration to
+ * cp-tree.h: here. Declare build_vtbl_ref.
+ * pt.c (instantiate_class_template): Use NULL_TREE instead of 0 in
+ function calls that want a tree.
+
+Tue Apr 9 12:10:26 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * rtti.c (build_dynamic_cast): Handle downcasting to X* given
+ other X subobjects in the most derived type. Ack.
+
+ * rtti.c (build_dynamic_cast): No need to strip cv-quals here,
+ get_typeid will do it for us.
+ (get_typeid_1): Break out call-building for expand_*_desc to use.
+ (get_typeid): Call it.
+ (expand_*_desc): Likewise.
+ * decl.c (init_decl_processing): Don't set TYPE_BUILT_IN on char *
+ and void *.
+ (init_decl_processing): Lose builtin_type_tdescs lossage.
+ * decl2.c (finish_vtable_vardecl): Remove obsolete code.
+
+Mon Apr 8 17:23:23 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * pt.c (tsubst): When calling set_nested_typename, use
+ TYPE_NESTED_NAME (current_class_type) instead of
+ current_class_name.
+
+ * decl.c (pushdecl): Likewise.
+ (pushdecl_class_level): Likewise.
+ (grokdeclarator): Use NULL_TREE instead of 0 in the call to
+ set_nested_typename.
+
+Sun Apr 7 10:44:31 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * rtti.c (synthesize_tinfo_fn): Handle arrays.
+
+ * cp-tree.h (DECL_REALLY_EXTERN): New macro.
+
+Sat Apr 6 13:56:27 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * rtti.c (throw_bad_cast): Use entry point __throw_bad_cast.
+ (init_rtti_processing): Lose bad_cast_type.
+ (build_dynamic_cast): Use throw_bad_cast.
+
+ * rtti.c (synthesize_tinfo_fn): Handle enums and pmfs.
+
+ * decl2.c (finish_file): Don't synthesize artificial functions
+ that are external and not inline.
+
+ * rtti.c (get_tinfo_fn): If at_eof, call import_export_decl.
+
+ * decl2.c (finish_file): Handle having new inlines added to
+ saved_inlines by synthesis.
+
+ * rtti.c (get_bad_cast_node): Don't require <typeinfo>.
+
+Fri Apr 5 17:02:09 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ RTTI rewrite to initialize nodes as needed, not require that
+ users #include <typeinfo>, complete functionality and reduce wasted
+ space.
+ * rtti.c (init_rtti_processing): New fn.
+ (build_typeid): The vtable entry is now a function.
+ (get_tinfo_var): New fn.
+ (get_tinfo_fn): Likewise.
+ (get_typeid): Use it.
+ (build_dynamic_cast): Declare and use entry point __dynamic_cast.
+ (build_*_desc): Rename to expand_*_desc and rewrite to use entry
+ points __rtti_*.
+ (add_uninstantiated_desc, get_def_to_follow, build_t_desc): Lose.
+ (synthesize_tinfo_fn): New fn.
+ * method.c (build_t_desc_overload): Lose.
+ (build_overload_with_type): More generic.
+ * decl.c (init_decl_processing): Call init_rtti_processing.
+ * class.c (set_rtti_entry): Use get_tinfo_fn.
+ * decl2.c (mark_vtable_entries): Mark the rtti function.
+ (finish_prevtable_vardecl): Don't build_t_desc.
+ (import_export_decl): Handle tinfo functions.
+ (finish_file): Likewise.
+ * typeck.c (inline_conversion): New fn.
+ (build_function_call_real): Use it.
+ * cp-tree.h: Add decls.
+
+ * method.c (hack_identifier): Also convert component_refs from
+ references.
+
+ * lex.c (cons_up_default_function): Use the type, not the name, in
+ declspecs.
+
+ * decl2.c (import_export_vtable): Fix weak vtables.
+
+Fri Apr 5 13:30:17 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * search.c (get_base_distance_recursive): Fix access checks for
+ protected bases.
+
+Fri Apr 5 11:02:06 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * call.c (unary_complex_lvalue): Delete unneeded decl, it's in
+ cp-tree.h.
+ (convert_harshness): Add prototypes wrapped by PROTO.
+ * decl2.c (grok_function_init): Likewise.
+ (do_toplevel_using_decl): Change to void return type.
+ * class.c (build_vtable_entry): Remove decl of make_thunk.
+ (merge_overrides): Fix order of arg definitions.
+ (finish_vtbls): Likewise.
+ (fixup_vtable_deltas): Likewise.
+ (modify_all_direct_vtables): Likewise.
+ (modify_all_indirect_vtables): Likewise.
+ * search.c (get_base_distance_recursive): Likewise.
+ (get_abstract_virtuals_1): Likewise.
+ (fixup_virtual_upcast_offsets): Likewise.
+ (lookup_fnfields_1): Add prototypes wrapped by PROTO.
+ * init.c (perform_member_init): Fix order of arg definitions.
+ (expand_aggr_init_1): Add prototypes wrapped by PROTO.
+ * cp-tree.h (make_thunk): Add decl.
+ (overload_template_name, push_template_decl): Add decls.
+ (do_toplevel_using_decl): Change to void return type.
+ (vec_binfo_member): Add decl.
+
+Thu Apr 4 13:33:10 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * typeck.c (mark_addressable, convert_for_assignment,
+ convert_for_initialization, pointer_int_sum, pointer_diff,
+ unary_complex_lvalue): Add prototypes wrapped by PROTO.
+ (convert_sequence): #if 0 fn decl, since definition also is.
+
+Thu Apr 4 11:00:53 1996 Mike Stump <mrs@cygnus.com>
+
+ * rtti.c (build_dynamic_cast): Make sure we strip qualifiers on
+ cast to pointer types for type searching.
+
+Wed Apr 3 17:10:57 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * typeck.c (get_delta_difference): Use cp_error, not error, in the
+ case where BINFO == 0.
+
+Wed Apr 3 12:01:02 1996 Mike Stump <mrs@cygnus.com>
+
+ * call.c (build_method_call): Fix wording of error messages so
+ constructors come out right.
+
+Tue Apr 2 16:06:59 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * decl.c (push_overloaded_decl): Don't warn about hidden
+ constructors when both the type and the function are declared
+ in a system header file.
+
+Mon Apr 1 09:03:13 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * class.c (finish_struct_1): Propagate the TYPE_PACKED
+ flag for the type to the type's fields.
+
+Sat Mar 30 12:14:33 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y (complex_parmlist, ELLIPSES): Take out ARM-based warning.
+
+Fri Mar 29 15:51:36 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * class.c (base_info, finish_base_struct): Replace
+ needs_virtual_dtor with base_has_virtual.
+
+ (finish_struct_1): Remove the old code that tried to make default
+ destructors virtual. Use base_has_virtual when checking if we need
+ to add a vtable entry for the rtti code.
+
+Fri Mar 29 14:02:36 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (push_template_decl): Complain about template decl with
+ inappropriate declaration.
+
+Fri Mar 29 12:15:35 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * typeck.c (build_x_unary_op): Remove bogus check for taking
+ the address of a member function.
+
+Fri Mar 29 11:56:02 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (constructor_declarator): Only push the class if
+ we are not already in the class.
+
+Fri Mar 29 09:41:02 1996 Jeffrey A. Law <law@cygnus.com>
+
+ * method.c (emit_thunk): Remove current_call_is_indirect nonsense.
+ Add additional argument to INIT_CUMULATIVE_ARGS.
+
+Thu Mar 28 16:41:39 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (shadow_tag): Fix error about anon union with methods.
+
+ * parse.y (self_reference): Only generate a self-reference if this
+ is a non-template class.
+ (opt.component_decl_list): Only use it if it was generated.
+
+ * parse.y (component_decl_1): Use constructor_declarator.
+ (fn.def2): Likewise.
+ (notype_component_declarator0): Likewise.
+
+Thu Mar 28 15:11:35 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * typeck.c (build_x_unary_op): Add checks for taking the address
+ of a TARGET_EXPR or of a member function, and give appropriate
+ warnings.
+
+Thu Mar 28 14:49:26 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (process_template_parm): Allow template type parms to be
+ used as types for template const parms.
+
+Wed Mar 27 15:51:19 1996 Mike Stump <mrs@cygnus.com>
+
+ * init.c (expand_vec_init): Ensure the eh cleanups are on the
+ function_obstack.
+
+Wed Mar 27 10:14:30 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (lookup_name_real): Be even more picky about the
+ ambiguous lookup warning.
+ (grokdeclarator): Tweak SCOPE_REF constructor declarators here.
+ * parse.y (constructor_declarator): Rather than here.
+
+ * parse.y (constructor_declarator): New nonterminal.
+ (fn.def1): Use it.
+ (explicit_instantiation): Likewise.
+
+Tue Mar 26 13:41:33 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ Add implicit declaration of class name at class scope.
+ * decl.c (lookup_name_real): Restrict pedwarn about ambiguous lookup.
+ * parse.y (self_reference): New nonterminal.
+ (opt.component_decl_list): Use it.
+ (fn.def1): Add nested_name_specifier type_name cases.
+ * class.c (build_self_reference): New function.
+ (finish_struct): Handle access_default later, move self-reference
+ decl to the end.
+ * pt.c (lookup_template_class): Handle getting a TYPE_DECL.
+ * cp-tree.h: Adjust.
+
+ * pt.c (do_function_instantiation): Separate handling of member
+ functions and non-member functions properly.
+
+Mon Mar 25 14:23:22 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (process_template_parm): Improve error for 'volatile class K'.
+
+ * class.c (finish_struct_1): Check the right slot for destructors.
+
+ * decl.c (start_enum): Complain about enum templates.
+
+Mon Mar 25 13:25:31 1996 Mike Stump <mrs@cygnus.com>
+
+ * init.c (resolve_offset_ref): Offset pointers to member data by one.
+ * typeck.c (unary_complex_lvalue): Likewise.
+
+Mon Mar 25 13:30:42 1996 Bob Manson <manson@charmed.cygnus.com>
+
+ * typeck.c (c_expand_return): Check for a returned local
+ array name, similar to the check for an ADDR_EXPR.
+
+Mon Mar 25 13:07:19 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (cp_finish_decl): Don't build cleanups for static
+ variables here.
+
+Fri Mar 22 17:57:55 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_modify_expr): Fix error messages to be more
+ accurate.
+ * cp-tree.h (assop_as_string): Parallel to op_as_string, but for
+ assignment operators.
+ * error.c (assop_as_string): Likewise. Add support for `%Q' for
+ assignment operators.
+
+Fri Mar 22 13:48:29 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokdeclarator): Call bad_specifiers for typedefs. Also
+ give an error if initialized. pedwarn about nested type with the
+ same name as its enclosing class.
+
+ * pt.c (tsubst, case TYPE_DECL): Set DECL_CONTEXT.
+
+ * typeck.c (require_complete_type): Be sure to instantiate the
+ MAIN_VARIANT of the type.
+
+ * decl2.c (finish_file): Instantiate pending templates before
+ processing static constructors and destructors.
+
+ * pt.c (instantiate_decl): Don't instantiate functions at toplevel
+ unless at_eof.
+
+Fri Mar 22 09:30:17 1996 Bob Manson <manson@beauty.cygnus.com>
+
+ * decl2.c (delete_sanity): If error_mark_node is passed
+ in as an expression, quit while we're ahead.
+
+ * decl.c (grokdeclarator): Give an error message if `friend'
+ is combined with any storage class specifiers.
+
+Wed Mar 20 14:51:55 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (named_complex_class_head_sans_basetype): Don't crash on
+ definition of nonexistent nested type.
+
+ * error.c (dump_decl, case TYPE_DECL): Fix decision for whether or
+ not to say 'typedef'.
+
+Wed Mar 20 00:11:47 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-tree.h (struct lang_type): Make search_slot a tree, not a char*.
+ * search.c (dfs_walk, dfs_init_vbase_pointers,
+ expand_upcast_fixups): Remove cast of CLASSTYPE_SEARCH_SLOT.
+ (dfs_find_vbases): Remove cast for CLASSTYPE_SEARCH_SLOT init.
+
+Tue Mar 19 17:56:03 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * except.c (build_throw): Support minimal parse.
+ * pt.c (tsubst_copy): Support THROW_EXPR.
+ * decl2.c (build_expr_from_tree): Likewise.
+
+ * pt.c (mangle_class_name_for_template): Always allocate
+ scratch_firstobj.
+
+Tue Mar 19 16:34:31 1996 Bob Manson <manson@beauty.cygnus.com>
+
+ * cvt.c (cp_convert_to_pointer): Give an appropriate error
+ when trying to cast from an incomplete type.
+
+Tue Mar 19 16:00:33 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_class_template): Don't bother setting up
+ CLASSTYPE_TAGS explicitly, as the nested types will add
+ themselves.
+
+Tue Mar 19 15:48:43 1996 Bob Manson <manson@beauty.cygnus.com>
+
+ * decl.c (shadow_tag): Remove old error check for usage of
+ an enum without a previous declaration.
+ (xref_tag): Add error message about usage of enums without a
+ previous declaration.
+
+Tue Mar 19 09:21:35 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (do_identifier): Only do name consistency check if we're
+ parsing.
+
+ * pt.c (push_template_decl): Don't crash if we get a member defn
+ that doesn't match.
+
+ * decl.c (xref_tag_from_type): New function to do an xref without
+ always having to figure out code_type_node.
+ * cp-tree.h: Declare it.
+ * pt.c (instantiate_class_template): Use it for friend classes.
+ (lookup_template_class): Use it.
+
+ * typeck2.c (build_functional_cast): Pull out a single parm before
+ passing it to build_c_cast.
+
+Tue Mar 19 09:07:15 1996 Bob Manson <manson@beauty.cygnus.com>
+
+ * expr.c (do_case): Give an error message if a pointer is
+ given as a case value.
+
+Mon Mar 18 21:57:54 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_c_cast): Don't pull single TEMPLATE_DECL out of
+ an overload list.
+
+ * lex.c (cons_up_default_function): Really, now, interface hackery
+ does not apply to synthesized methods.
+
+Mon Mar 18 18:20:57 1996 Mike Stump <mrs@cygnus.com>
+
+ * call.c (build_method_call): Ctors and dtors now have special names
+ with respect to lookups.
+ * class.c (add_method): Likewise.
+ (grow_method): Likewise.
+ (finish_struct_methods): Likewise.
+ (warn_hidden): Likewise.
+ (finish_struct_1): Likewise.
+ * cvt.c (convert_to_reference): Likewise.
+ (convert_to_aggr): Likewise.
+ (cp_convert): Likewise.
+ * decl2.c (check_classfn): Likewise.
+ * init.c (expand_member_init): Likewise.
+ (expand_default_init): Likewise.
+ (expand_aggr_init_1): Likewise.
+ (build_offset_ref): Likewise.
+ (build_new): Likewise.
+ (build_delete): Likewise.
+ * lex.c (do_inline_function_hair): Likewise.
+ * search.c (lookup_field_1): Likewise.
+ (lookup_fnfields_here): Likewise.
+ (lookup_field): Likewise.
+ (lookup_fnfields): Likewise.
+ (get_virtual_destructor): Likewise.
+ (dfs_debug_mark): Likewise.
+ (dfs_pushdecls): Likewise.
+ (dfs_compress_decls): Likewise.
+ * tree.c (layout_basetypes): Likewise.
+ * typeck.c (build_component_ref): Likewise.
+ (build_x_function_call): Likewise.
+ (build_modify_expr): Likewise.
+ (convert_for_initialization): Likewise.
+ (build_functional_cast): Likewise.
+ * cp-tree.h (CLASSTYPE_FIRST_CONVERSION): Likewise.
+ (CTOR_NAME): New.
+ (DTOR_NAME): New.
+ * decl.c (ctor_identifier): New.
+ (dtor_identifier): New.
+ (init_decl_processing): Set them.
+
+Mon Mar 18 18:00:51 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_component_ref): Don't get confused by fields whose
+ context has no type name, like pointer to member functions.
+
+Mon Mar 18 13:19:03 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokdeclarator): Handle typedef without declarator.
+
+ * pt.c (tsubst): Handle SCOPE_REF in declarator.
+
+ * parse.y (bad_parm): Catch another case of missing `typename'.
+
+ * lex.c (yyprint): Handle TYPE_DECLs.
+
+ * decl.c (start_function): Don't try to be clever.
+
+ * lex.c: Lose compiler_error_with_decl.
+ * typeck2.c: Lose error_with_aggr_type.
+ (incomplete_type_error): Use cp_* instead of old functions.
+ (readonly_error): Likewise.
+ * typeck.c (convert_arguments): Likewise.
+ * search.c (lookup_nested_field): Likewise.
+ * method.c (make_thunk): Likewise.
+ * decl.c (grokparms): Likewise.
+ * cp-tree.h: Update.
+
+ * tree.c (min_tree_cons): Call copy_to_permanent for the purpose
+ and value.
+
+Mon Mar 18 11:25:52 1996 Bob Manson <manson@beauty.cygnus.com>
+
+ * method.c (build_opfncall): When deleting a pointer to an
+ array, build a new pointer to the tree past any ARRAY_TYPE
+ nodes.
+
+Mon Mar 18 10:11:46 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (lookup_name_real): Initialize local var TYPE to NULL_TREE.
+
+Fri Mar 15 11:03:57 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_decl): Only call import_export_decl if at_eof
+ and ! DECL_INLINE.
+
+ * decl.c (finish_function): Don't set nested based on
+ hack_decl_function_context.
+ * parse.y (function_try_block): Check for nested function.
+ (pending_inlines): Likewise.
+
+ * decl2.c (build_expr_from_tree): If a unary op already has a
+ type, just return it.
+
+ * decl2.c (finish_prevtable_vardecl): Use ADJUST_VTABLE_LINKAGE.
+
+ * decl2.c (walk_vtables): vardecl_fn returns int; return 1 if it does.
+ (finish_file): Check the return value of walk_vtables.
+ (finish_prevtable_vardecl): Return int.
+ (finish_vtable_vardecl): Likewise.
+ (prune_vtable_vardecl): Likewise.
+ * lex.c (set_vardecl_interface_info): Likewise.
+ * cp-tree.h: Adjust return types.
+
+ * class.c (delete_duplicate_fields_1): Don't complain about
+ duplicate nested types if they're the same type.
+ (finish_struct): Remove check for duplicate.
+ * decl2.c (grokfield): Don't check for typedef of anonymous type.
+
+Thu Mar 14 10:00:19 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h: Lose SIGNATURE_GROKKING_TYPEDEF.
+
+ * decl.c (grokdeclarator): Lose special handling of class-level
+ typedef. Lose SIGNATURE_GROKKING_TYPEDEF. Set
+ SIGNATURE_HAS_OPAQUE_TYPEDECLS later.
+
+ * cvt.c (convert_pointer_to_real): Retain cv-quals in conversion.
+
+ * pt.c (tsubst_copy): Strip cv-quals from destructor name types.
+
+ * search.c (compute_access): Fix handling of anonymous union
+ members.
+ * class.c (finish_struct_anon): Propagate TREE_{PRIVATE,PROTECTED}
+ from anonymous unions to their members.
+
+ * typeck.c (build_x_function_call): For static member functions,
+ hand off to build_member_call.
+
+Wed Mar 13 14:03:34 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_component_ref): Handle OFFSET_REFs.
+
+ * init.c (expand_vec_init): Fix init == 0 case.
+
+Tue Mar 12 14:36:02 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (build_new): pedwarn about init and array new.
+ (expand_vec_init): Handle lists, use convert_for_initialization.
+
+ * typeck.c (convert_for_initialization): Pass LOOKUP_NO_CONVERSION
+ when converting to an aggregate type.
+ * cvt.c (cp_convert): Pass it through.
+
+ * typeck.c (build_conditional_expr): Handle user-defined
+ conversions to slightly different types.
+
+ * decl.c (grokdeclarator): Force an array type in a parm to be
+ permanent.
+
+ * decl2.c (do_using_directive): Sorry.
+ (do_namespace_alias): Likewise.
+ * lex.c (real_yylex): Warn about using the `namespace' keyword.
+
+Sun Mar 10 22:26:09 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (datadef): Move call to note_list_got_semicolon up.
+
+Fri Mar 8 11:47:26 1996 Mike Stump <mrs@cygnus.com>
+
+ * tree.c (unsave_expr): Don't unsave, UNSAVE_EXPRs.
+
+Fri Mar 8 11:29:06 1996 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (cp_finish_decl): The exception regions have to be
+ nested, not overlapping. We start the exception region for a
+ decl, after it has been fully built, and all temporaries for it
+ have been cleaned up.
+
+Thu Mar 7 17:46:06 1996 Mike Stump <mrs@cygnus.com>
+
+ * tree.c (vec_binfo_member): Don't core dump if we have no bases.
+
+Thu Mar 7 14:11:49 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.def: Add RETURN_INIT.
+ * pt.c (instantiate_decl): Handle RETURN_INIT.
+ * decl.c (store_return_init): Handle minimal_parse_mode.
+
+ * tree.c (cp_build_type_variant): Just return an error_mark_node.
+ * decl.c (make_typename_type): Don't try to get the file and line
+ of an identifier.
+ * typeck.c (comptypes): Handle TYPENAME_TYPE.
+
+Wed Mar 6 18:47:50 1996 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * decl.c (poplevel): Make sure we clear out and restore old local
+ non-VAR_DECL values by default when they go out of scope.
+
+Wed Mar 6 09:57:36 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (build_overload_value): Use DECL_ASSEMBLER_NAME in
+ referring to addresses of variables and functions.
+
+ * error.c (dump_expr): Support SIZEOF_EXPR.
+
+ * init.c (do_friend): Use the return value of check_classfn.
+
+ * typeck.c (convert_arguments): Call complete_type.
+
+ * method.c (hack_identifier): After giving an error, set value to
+ error_mark_node.
+
+Tue Mar 5 16:00:15 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (hack_decl_function_context): Kludge around DECL_CONTEXT
+ lossage for local classes.
+ * cp-tree.h: Declare it.
+ * decl.c (lookup_name_real): Evil, painful hack for local classes.
+ (grokfndecl): Set DECL_CLASS_CONTEXT and DECL_NO_STATIC_CHAIN here.
+ Use hack_decl_function_context.
+ (grokdeclarator): Don't set DECL_NO_STATIC_CHAIN here.
+ (start_function): Use hack_decl_function_context.
+ (finish_function): Likewise.
+ * method.c (synthesize_method): Likewise.
+ * lex.c (process_next_inline): Likewise.
+ (do_pending_inlines): Likewise.
+ * decl2.c (finish_file): Unset DECL_STATIC_FUNCTION_P when we're
+ done with it.
+
+Mon Mar 4 22:38:39 1996 Gerald Baumgartner <gb@alexander.cs.purdue.edu>
+
+ * sig.c (build_signature_pointer_or_reference_type): Align
+ signature pointers/references on 8-byte boundaries so they can be
+ grabbed 2 words at a time on a Sparc.
+
+Tue Mar 5 10:21:01 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (hack_identifier): Requiring a static chain is now a
+ hard error.
+ * decl.c (grokdeclarator): Set DECL_NO_STATIC_CHAIN on nested
+ functions.
+
+Mon Mar 4 20:03:33 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (build_offset_ref): Call complete_type.
+
+ * decl.c (pop_from_top_level): Always pop previous_class_type.
+
+ * parse.y: Handle multiple decls in a for-init-statement.
+ * pt.c (tsubst_expr): Likewise.
+
+ * pt.c (tsubst): Use tsubst_expr for the second operand of an
+ ARRAY_REF.
+
+ * decl.c (maybe_push_to_top_level): Don't save previous_class_type.
+ (poplevel_class): Set it here.
+ (pop_from_top_level): Pop it here if we're returning to class scope.
+ * class.c (pushclass): Don't set it here.
+
+ * decl.c (maybe_push_to_top_level): Save current_template_parms,
+ and clear it if !pseudo.
+ (pop_from_top_level): Restore it.
+
+ * decl2.c (finish_file): Push the dummy each time we walk the list
+ of vtables.
+
+ * error.c (dump_expr): Support LOOKUP_EXPR and actually do
+ something for CAST_EXPR.
+
+Mon Feb 19 14:49:18 1996 Rusty Russell <rusty@adelaide.maptek.com.au>
+
+ * cvt.c (cp_convert): Warn about implicit conversion of the
+ address of a function to bool, as it is always true.
+
+Fri Feb 23 23:06:01 1996 Rusty Russell <rusty@adelaide.maptek.com.au>
+
+ * typeck.c (c_expand_return): Fix warning for local externs returned.
+
+Mon Mar 4 15:03:11 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (mapcar): Propagate const and volatile properly.
+
+ * typeck.c (complete_type): Be sure to instantiate the
+ MAIN_VARIANT of the type.
+
+ * method.c (synthesize_method): Class interface hackery does not
+ apply to synthesized methods.
+
+Mon Mar 4 14:05:23 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (comp_template_args): Use comptypes rather than just
+ checking for TEMPLATE_TYPE_PARM equivalence.
+
+ * typeck.c (build_x_function_call): Call complete_type before
+ checking TYPE_OVERLOADS_CALL_EXPR.
+
+Mon Mar 4 18:48:30 1996 Manfred Hollstein <manfred@lts.sel.alcatel.de>
+
+ * g++.c (main): Check also for new define ALT_LIBM.
+
+Fri Mar 1 13:09:33 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_class_template): If we don't have a pattern
+ yet, that's OK.
+ (coerce_template_parms): If we see a local class, bail.
+
+ * decl.c (grok_reference_init): Make sure there's a type before
+ checking its code.
+
+ * pt.c (do_function_instantiation): Avoid crashing on invalid decls.
+ (push_template_decl): Likewise.
+
+ * parse.y (named_class_head): Set
+ CLASSTYPE_TEMPLATE_SPECIALIZATION here if we have basetypes.
+
+ * decl.c (xref_tag): Diagnose redeclaration of template
+ type-parameter name.
+
+ * error.c (dump_type): Handle anonymous template type parms.
+
+ * pt.c (instantiate_template): Use TYPE_MAIN_DECL instead of
+ TYPE_STUB_DECL.
+ (coerce_template_parms): Likewise.
+
+Thu Feb 29 16:26:01 1996 Mike Stump <mrs@cygnus.com>
+
+ * class.c (instantiate_type, case {ARRAY,INDIRECT}_REF,
+ case ADDR_EXPR): Don't modify rhs if a subinstantiation fails.
+
+Thu Feb 29 08:20:25 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_template): Take the MAIN_VARIANT of the type
+ before trying to get its STUB_DECL.
+ (coerce_template_parms): Likewise.
+
+ * parse.y (template_type_parm): If they didn't use 'class',
+ pretend they did after giving an error.
+
+ * pt.c (coerce_template_parms): Diagnose use of local class.
+
+ * decl.c (grok_reference_init): Use instantiate_type.
+
+ * error.c (dump_expr): Handle TEMPLATE_DECLs.
+
+ * parse.y (named_class_head): Diagnose mismatching types and tags.
+
+ * decl.c (pushdecl): Type decls and class templates clash with
+ artificial type decls, not hide them.
+
+ * decl.c (redeclaration_error_message): Diagnose redefinition of
+ templates properly.
+ (duplicate_decls): Diagnose disallowed overloads for template
+ functions, too.
+
+ * decl.c (start_decl): Call complete_type before checking for a
+ destructor.
+
+ * pt.c (tsubst): Use tsubst_expr on the elts of a VEC.
+
+ * decl.c (xref_tag): A TEMPLATE_TYPE_PARM is a match.
+
+Wed Feb 28 09:28:44 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grok_op_properties): Don't check for operator++(int) in
+ a template.
+
+ * tree.c (perm_manip): Return a copy of variable and function
+ decls with external linkage.
+
+ * tree.def: Change some of the min tree codes to type "1".
+ * pt.c (uses_template_parms): Handle 'e's, return 1 for LOOKUP_EXPRs.
+ * method.c (build_overload_int): Emit something arbitrary for
+ anything but an INTEGER_CST if we're in a template.
+
+ * decl.c (cp_finish_decl): Call complete_type before deciding
+ whether or not to lay out the decl.
+
+ * lex.c (do_identifier): Check for DECL_INITIAL before using it.
+
+Tue Feb 27 16:35:32 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck2.c (build_x_arrow): Call complete_type.
+
+ * pt.c (add_pending_template): Broken out.
+ (lookup_template_class): If -fexternal-templates, call it for all
+ the methods of implemented types.
+ (instantiate_class_template): Instead of instantiating them here.
+ (instantiate_decl): Handle -fexternal-templates earlier.
+
+Tue Feb 27 15:51:32 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * search.c, lex.c, decl.c, class.c, cp-tree.h: Don't wrap the
+ memoized lookup stuff inside GATHER_STATISTICS.
+
+Tue Feb 27 10:38:08 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (start_decl): Complain about array of incomplete type
+ here.
+ (grokdeclarator): Not here.
+
+ * parse.y (template_parm): Expand full_parm inline so we can set
+ the rule's precedence.
+
+ * pt.c (tsubst_expr): If we're in a template, just do tsubst_copy.
+ (tsubst): tsubst_expr the DECL_INITIAL of FIELD_DECLs.
+ * decl2.c (grokbitfield): Don't check for integer constant here.
+ * class.c (finish_struct_1): Check here.
+
+ * decl.c (define_label): Make the min decl go on permanent_obstack.
+
+ * pt.c (unify): Don't handle CONST_DECLs.
+ (uses_template_parms): Don't check DECL_INITIAL on a CONST_DECL.
+ (tsubst_copy): Likewise.
+
+ * lex.c (do_identifier): Do pull the DECL_INITIAL out of a
+ CONST_DECL for a template parm.
+
+Mon Feb 26 12:48:18 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokdeclarator): Complain about array of incomplete type
+ here.
+ (start_decl_1): Not here.
+
+ * pt.c (tsubst): Handle pointer-to-function declarators.
+
+ * method.c (hack_identifier): If pedantic, diagnose local class
+ methods that require a static chain.
+
+ * decl.c (grok_op_properties): No longer static.
+ * cp-tree.h: Declare it.
+ * pt.c (tsubst): Call it for operators.
+ Use tsubst_copy for TREE_VECs.
+
+ * parse.y (template_arg): The expr has precedence like '>'.
+
+Fri Feb 23 14:51:52 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (coerce_template_parms): Don't coerce an expression using
+ template parms.
+ (uses_template_parms): Also check DECL_INITIAL in CONST_DECLs.
+ (tsubst): Don't use build_index_2_type if the max_value uses template
+ parms.
+ * method.c (build_overload_int): Emit something arbitrary for an
+ expression using template parms.
+
+ * parse.y (template_close_bracket): New non-terminal to catch use
+ of '>>' instead of '> >' in template class names.
+ (template_type): Use it.
+ * Makefile.in (CONFLICTS): Causes one more r/r conflict.
+
+ * tree.def: Add CAST_EXPR.
+ * typeck2.c (build_functional_cast): Use CAST_EXPR instead of
+ CONVERT_EXPR for minimal_parse_mode.
+ * typeck.c (build_c_cast): Likewise.
+ * pt.c (tsubst_copy): Likewise.
+ * decl2.c (build_expr_from_tree): Likewise.
+ * error.c (dump_expr): Likewise.
+
+Fri Feb 23 10:36:46 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * except.c (SetTerminate, SetUnexpected): Put back global vars.
+ (init_exception_processing): Put back decl/init of
+ set_unexpected_fndecl and set_terminate_fndecl, needed to get the
+ fns from libstdc++.
+
+ * decl.c (struct binding_level): Delete ACCEPT_ANY bitfield.
+ (declare_uninstantiated_type_level, uninstantiated_type_level_p):
+ Delete unused fns.
+ * cp-tree.h (declare_uninstantiated_type_level,
+ uninstantiated_type_level_p): Delete prototypes.
+
+Thu Feb 22 19:36:15 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst_expr): Add default return.
+
+Thu Feb 22 16:47:24 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * error.c (fndecl_as_string): Delete unused arg CNAME.
+ * sig.c (build_signature_table_constructor,
+ build_signature_method_call): Fix calls.
+
+ * class.c (the_null_vtable_entry): Delete var definition.
+ (init_class_processing): Delete tree the_null_vtable_entry init.
+ * decl.c (no_print_{functions, builtins}): Declare as static.
+ (__tp_desc_type_node): #if 0 var definition.
+ (init_type_desc): #if 0 init of __tp_desc_type_node.
+ (vb_off_identifier): Move var decl into init_decl_processing.
+ (current_function_assigns_this): Declare as static.
+ (int_ftype_ptr_ptr_int, void_ftype_ptr_int_int): Delete var decls.
+ (init_decl_processing): Delete init of void_ftype_ptr_ptr_int.
+ Move decls of string_ftype_ptr_ptr and int_ftype_string_string here.
+ * decl2.c (delete_sanity): Delete definition/mod of local var ELT_SIZE.
+ * init.c (BI_header_type, BI_header_size): Declare as static.
+ * pt.c (template_classes): Delete unused var.
+ (add_pending_template): Delete decl for non-existent fn.
+ (lookup_template_class): Delete vars CODE and TAG_CODE.
+ (instantiate_template): Delete unused var TARGS.
+ * cp-tree.h (vb_off_identifier, current_function_assigns_this):
+ Delete decls.
+ (__tp_desc_type_node): #if 0 var decl.
+ (fndecl_as_string): Fix prototype.
+
+Thu Feb 22 15:56:19 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.def: Add GOTO_STMT.
+ * pt.c (tsubst_expr): Support goto and labels.
+ * decl.c (define_label): Support minimal parsing.
+ * parse.y (simple_stmt): Likewise.
+
+Thu Feb 22 15:30:12 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * xref.c (GNU_xref_member): Only define/set var I if
+ XREF_SHORT_MEMBER_NAMES is defined, to match when it's actually
+ used.
+ (GNU_xref_end_scope): Delete unused fifth arg TRNS.
+ (GNU_xref_end): Fix call.
+ * decl.c (poplevel, poplevel_class, finish_method): Fix calls.
+ * cp-tree.h (GNU_xref_end_scope): Fix prototype.
+
+ * tree.c (build_exception_variant): Delete unused vars I, A, T,
+ T2, and CNAME.
+ (layout_vbasetypes): Delete unused var NONVIRTUAL_VAR_SIZE.
+ (mapcar): Delete unused var CODE.
+ (build_cplus_new): Delete unused arg WITH_CLEANUP_P.
+ (break_out_cleanups): Fix call.
+ (bot_manip): Likewise.
+ * call.c (build_method_call): Likewise.
+ * cvt.c (build_up_reference, convert_to_reference, cp_convert):
+ Likewise.
+ * typeck.c (unary_complex_lvalue, build_modify_expr,
+ convert_for_initialization): Likewise.
+ * typeck2.c (build_functional_cast): Likewise.
+ * cp-tree.h (build_cplus_new): Fix prototype.
+
+ * repo.c (open_repo_file): Delete unused var Q.
+ (repo_compile_flags, repo_template_declared,
+ repo_template_defined, repo_class_defined, repo_inline_used,
+ repo_vtable_used, repo_tinfo_used): #if 0 unused fns.
+ (repo_get_id, repo_vtable_used): Declare as static.
+ * cp-tree.h (mark_{decl,class}_instantiated, finish_repo): Add
+ prototypes.
+
+Thu Feb 22 14:53:35 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (pending_inlines): Add function_try_block case.
+
+ * pt.c (unify): Fix for template const parms.
+
+Thu Feb 22 13:24:15 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * lex.c (extract_interface_info): Delete forward decl.
+ (default_copy_constructor_body, default_assign_ref_body): Delete
+ decls for non-existent functions.
+ (synth_firstobj, inline_text_firstobjs): Delete unused vars.
+ (init_lex): Delete setting them.
+ (cons_up_default_function): Delete unused vars FUNC_BUF,
+ FUNC_LEN, and COMPLEX. Delete code setting COMPLEX. Delete old
+ #if 0'd synth code.
+ (toplevel, expression_obstack): Delete unused extern decls.
+ (tree_node_kind): Delete unused enum.
+ (tree_node_counts, tree_node_sizes): Wrap with #ifdef
+ GATHER_STATISTICS.
+ (tree_node_kind_names): Delete unused extern decl.
+ (synth_obstack): Delete unused var.
+ (init_lex): Don't set it.
+ (init_parse): Add decl before use.
+ (reduce_count): Only define #ifdef GATHER_STATISTICS && REDUCE_LENGTH.
+ (current_unit_{name, language}): Delete unused vars.
+ (check_newline): Don't bother setting them, just accept the #pragma.
+ * cp-tree.h (init_repo, peek_yylex): Add prototypes.
+ (current_unit_{name, language}): Delete decls.
+
+ * search.c: Wrap all of the memoized functions, macros, and
+ variables inside #ifdef GATHER_STATISTICS.
+ (lookup_field, lookup_fnfields): Likewise.
+ (init_search_processing): Likewise.
+ (reinit_search_statistics): Wrap whole function.
+ * lex.c (reinit_lang_specific): Wrap call to reinit_search_statistics.
+
+ * decl.c (finish_function): Only call pop_memoized_context if
+ GATHER_STATISTICS is defined.
+ (start_function): Likewise for push_memoized_context.
+ * class.c (pushclass, popclass): Likewise.
+
+ * cp-tree.h (CLASSTYPE_MTABLE_ENTRY): Move definition from here...
+ * search.c (CLASSTYPE_MTABLE_ENTRY): ... to here.
+
+ * cvt.c (cp_convert): Delete unused local var FORM.
+ * cp-tree.h (can_convert, can_convert_arg, real_lvalue_p): Add
+ prototypes.
+
+Thu Feb 22 13:19:44 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (do_poplevel): Oops; really return what we get from
+ poplevel this time.
+
+Thu Feb 22 11:41:44 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * cp-tree.h (is_aggr_type): Add prototype.
+
+ * cp-tree.h ({push,pop}_cp_function_context): Add decls.
+ * method.c ({push,pop}_cp_function_context): Delete decls.
+ * except.c (start_eh_unwinder, end_eh_unwinder): Declare as void.
+ (SetUnexpected, SetTerminate): Delete unused vars.
+ (init_exception_processing): Don't set SetUnexpected or
+ SetTerminate. Don't set SET_UNEXPECTED_FNDECL or SET_TERMINATE_FNDECL.
+ (output_exception_table_entry): Delete unused array LABEL.
+ (expand_internal_throw): Delete unused var PARAMS.
+ (expand_start_catch_block): Delete unused var CLEANUP.
+ (emit_exception_table): Delete unused var EH_NODE_DECL.
+ (expand_builtin_throw): Delete unused vars UNWIND_AND_THROW and
+ GOTO_UNWIND_AND_THROW. Don't set them.
+ (end_eh_unwinder): Add top decl.
+ (pop_rtl_from_perm): Delete unused decl of PERMANENT_OBSTACK.
+ (exception_section, push_rtl_perm, do_function_call,
+ lang_interim_eh, push_eh_cleanup, eh_outer_context,
+ expand_end_eh_spec, end_eh_unwinder): Declare as static.
+ (saved_pc, saved_throw_type, saved_throw_value, saved_cleanup,
+ throw_used): Likewise.
+ * cp-tree.h (expand_end_eh_spec): Delete prototype.
+
+ * search.c (dfs_mark, dfs_mark_vtable_path,
+ dfs_unmark_vtable_path, dfs_mark_new_vtable,
+ dfs_unmark_new_vtable, dfs_clear_search_slot,
+ dfs_search_slot_nonempty_p, bfs_markedp, bfs_unmarkedp,
+ bfs_marked_vtable_pathp, bfs_unmarked_vtable_pathp,
+ bfs_marked_new_vtablep, bfs_unmarked_new_vtablep): #if 0 unused
+ functions.
+ (n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1,
+ n_calls_lookup_fnfields, n_calls_lookup_fnfields_1,
+ n_calls_get_base_type, n_outer_fields_searched, n_contexts_saved):
+ Only define #ifdef GATHER_STATISTICS.
+ (reinit_search_statistics): Only init some vars if GATHER_STATISTICS
+ is defined.
+ (vbase_decl): Delete var definition.
+ (init_search): Delete old decl.
+ (init_vbase_pointers): Delete building of VBASE_DECL, since it's
+ never actually used.
+ (expand_indirect_vtbls_init): Delete init of VBASE_DECL.
+ (get_base_distance_recursive): Delete unused fourth arg
+ BASETYPE_PATH. Fix call .
+ (get_base_distance): Fix call.
+ (push_class_decls): Delete unused var ID.
+ (make_memoized_table_entry): Declare as static.
+ (breadth_first_search): Declare as static.
+ (tree_has_any_destructor_p): Declare as static.
+ (pop_class_decls): Delete unused arg pop_class_decls.
+ * class.c (popclass): Fix call to pop_class_decls.
+ * cp-tree.h (make_memoized_table_entry, breadth_first_search,
+ tree_has_any_destructor_p): Delete prototypes.
+
+ * rtti.c (build_ptmf_desc): Delete unused arg TYPE.
+ (build_t_desc): Fix call. Delete unused vars ELEMS and TT.
+ (build_dynamic_cast): Delete unused local vars TMP1 and RETVAL.
+ (build_user_desc): Delete unused var T.
+ (build_class_desc): Delete unused vars T and OFF.
+ (build_t_desc): Delete unused var NAME_STRING.
+ (build_headof): Make static.
+ (get_bad_cast_node): Likewise.
+ (get_def_to_follow): Likewise.
+ * cp-tree.h (init_type_desc): Add prototype.
+ (build_headof): Remove prototype.
+
+Thu Feb 22 00:54:22 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (tsubst): Only look for matching decls at file scope for
+ non-member functions.
+
+ * call.c (build_scoped_method_call): Handle scoped destructor
+ calls in templates.
+
+ * decl.c (*_top_level): Also save previous_class_values.
+
+ * pt.c (tsubst_expr): Support do {} while loops.
+ * parse.y (simple_stmt): Likewise.
+ * tree.def: Likewise.
+
+ * method.c (build_overload_identifier): For a class nested in a
+ template class, don't mangle in the template parms from our
+ context.
+
+ * lex.c, cp-tree.h: Remove support for template instantiations in
+ the pending_inlines code.
+ * pt.c: Remove dead functions and unused arguments.
+ (uses_template_parms): TYPENAME_TYPEs always use template parms.
+ * parse.y: Stop passing anything to end_template_decl.
+ * tree.c (print_lang_statistics): Only print tinst info #ifdef
+ GATHER_STATISTICS.
+
+Wed Feb 21 16:57:33 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * init.c (expand_recursive_init{,_1}): Delete decls.
+ (sort_member_init): Delete unused var INIT.
+ (emit_base_init): Delete unused var X.
+ (build_offset_ref): Delete unused var CNAME.
+ (sort_member_init): Delete unused var FIELDS_TO_UNMARK.
+ (emit_base_init): Delete unused local var BASE. Delete extern
+ decl of IN_CHARGE_IDENTIFIER.
+ (build_delete): Delete unused local var VIRTUAL_SIZE.
+
+ * init.c (build_vec_delete): Delete unused third arg ELT_SIZE.
+ (build_delete): Fix call.
+ * decl2.c (delete_sanity): Likewise.
+ * cp-tree.h (build_vec_delete): Update prototype.
+
+ * typeck.c (common_base_type): Delete unused var TMP.
+ (build_binary_op): Delete local var ARGS_SAVE.
+ (build_array_ref): Delete unused var ITYPE.
+ (c_expand_return): Delete unused var USE_TEMP.
+
+ * typeck.c (compexcepttypes): Delete unused arg STRICT.
+ (comptypes): Fix calls.
+ * decl.c (duplicate_decls): Likewise.
+ * cp-tree.h (compexcepttypes): Delete extra arg.
+
+ * decl2.c (check_classfn): Delete unused second arg CNAME.
+ * decl.c (start_decl, grokfndecl): Fix calls.
+ * init.c (do_friend): Likewise.
+ * cp-tree.h (check_classfn): Update prototype.
+
+ * cp-tree.h (signature_error, import_export_vtable,
+ append_signature_fields, id_in_current_class, mark_used,
+ copy_assignment_arg_p): Add decls.
+ * decl2.c (mark_used): Delete decl.
+
+ * class.c (n_*): Wrap with #ifdef GATHER_STATISTICS.
+
+ * class.c (get_vtable_entry): Disable unused function.
+ (doing_hard_virtuals): Delete unused static global var.
+ (finish_struct_1): Don't init DOING_HARD_VIRTUALS.
+ (prepare_fresh_vtable): Delete unused vars PATH and RESULT.
+ (overrides): Delete unused vars RETTYPE and BASE_RETTYPE.
+ (modify_one_vtable): Delete unused var OLD_RTTI.
+ (finish_struct_anon): Delete unused vars OFFSET and X.
+ (finish_struct_bits): Delete unused var METHOD_VEC.
+ (get_basefndecls): Delete unused var PURPOSE. Delete unused
+ for-scope local variable METHODS.
+
+ * call.c (user_harshness): Delete unused/unneeded arg PARM.
+ (ideal_candidate): Delete unused args BASETYPE and PARMS.
+ (build_method_call): Delete unused args passed into ideal_candidate.
+ (build_overload_call_real): Likewise. Delete unused var OVERLOAD_NAME.
+ * cp-tree.h (synthesize_method): Add decl.
+
+ * decl.c (note_level_for_for): Give void return type.
+ (pushdecl_nonclass_level): Likewise.
+ (finish_function): Delete unused vars VFIELDS and ALLOCATED_THIS.
+ (poplevel): Delete unused var IMPLICIT_TRY_BLOCK.
+ (suspend_binding_level): Delete unused var LEVEL.
+ (duplicate_decls): Delete unused var CTYPE.
+ (duplicate_decls): Delete unused var PREVIOUS_C_DECL.
+ (init_decl_processing): Delete unused vars FLOAT_ENDLINK and
+ PTR_ENDLINK.
+ (grokdeclarator): Delete unused var C.
+ (grokdeclarator): Delete unused var SIZE_VARIES.
+ (grokparms): Delete unused var SAW_VOID.
+ (start_function): Delete unused var OLDDECL.
+ (cplus_expand_expr_stmt): Delete unused var
+ REMOVE_IMPLICIT_IMMEDIATELY.
+
+ * cp-tree.h (pushdecl_nonclass_level): Fix prototype.
+
+ * Makefile.in (CONFLICTS): Update to 12 shift/reduce.
+
+Wed Feb 21 00:06:17 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (build_min): Set TREE_COMPLEXITY to lineno.
+ (build_min_nt): Likewise.
+ * pt.c (do_pushlevel): Emit line note.
+ (do_poplevel): Return what we get from poplevel.
+ (tsubst_expr): Set lineno from TREE_COMPLEXITY in stmt nodes.
+ * parse.y: Use do_pushlevel and do_poplevel.
+ * cp-tree.h: Declare do_poplevel.
+
+ * cp-tree.h: Declare at_eof.
+ * decl.c (cp_finish_decl): Pass it to rest_of_decl_compilation.
+ * decl2.c (import_export_decl): Renamed from import_export_inline.
+ (finish_file): Call it to do interface handling for statics.
+ * pt.c (tsubst_copy): Call mark_used on variables and functions
+ used here.
+
+ * decl2.c (finish_file): Don't emit statics we can't generate.
+ * pt.c (instantiate_decl): Don't set interface on instantiations
+ we can't generate.
+
+ * cp-tree.h (struct tinst_level): Change 'classname' to 'decl'.
+ * tree.c (print_lang_statistics): Print max template depth.
+ * pt.c (push_tinst_level): Dump entire instantiation context.
+ (instantiate_class_template): Use it and pop_tinst_level.
+ (instantiate_decl): Likewise.
+
+ * call.c class.c cp-tree.h decl.c decl2.c error.c lex.c method.c
+ pt.c ptree.c tree.def: Remove all traces of UNINSTANTIATED_P_TYPE.
+
+Tue Feb 20 18:21:51 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c class.c cp-tree.h cvt.c decl.c decl2.c error.c expr.c
+ init.c lex.c method.c parse.y pt.c repo.c search.c spew.c tree.c
+ tree.def typeck.c typeck2.c xref.c: Massive, systemic changes for
+ the new template implementation.
+
+Tue Feb 20 17:14:29 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl2.c (check_cp_case_value): Use STRIP_TYPE_NOPS.
+
+Thu Feb 15 18:44:42 1996 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (cp_finish_decl): Delay emitting the debug information for
+ a typedef that has been installed as the canonical typedef, if the
+ type has not yet been defined.
+
+Thu Feb 15 09:39:08 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (grokfield): Still call pop_nested_class for access decls.
+
+Wed Feb 14 17:30:04 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (lookup_label): Call label_rtx.
+
+ * decl.c (make_binding_level): New function.
+ (pushlevel, pushlevel_class): Call it instead of explicit
+ duplicate calls to xmalloc.
+
+ * decl.c (init_decl_processing): Delete useless build_pointer_type
+ call.
+
+ * decl.c (float_ftype_float, ldouble_ftype_ldouble): Add definitions.
+ (sizet_ftype_string): Delete variable.
+ (init_decl_processing): Add built-in functions fabsf, fabsl,
+ sqrtf, sqrtl, sinf, sin, sinl, cosf, cos, cosl. New local
+ variable strlen_ftype, used for strlen.
+
+Wed Feb 14 16:21:25 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (push_to_top_level): Start from current_binding_level
+ again for now; the stl hacks depend on g++ being broken in this
+ way, and it'll be fixed in the template rewrite.
+
+ * tree.def: Add USING_DECL.
+ * decl2.c (do_class_using_decl): Implement.
+ (grokfield): Pass access decls off to do_class_using_decl instead of
+ grokdeclarator.
+ * error.c (dump_decl): Handle USING_DECLs.
+ * decl.c (grokdeclarator): Remove code for handling access decls.
+ * class.c (finish_struct_1): Adjust accordingly, treat using-decls
+ as access decls for now.
+ (finish_struct): Don't check USING_DECLs for other uses of the name.
+
+ * search.c (get_matching_virtual): Use cp_error_at.
+
+Wed Feb 14 10:36:58 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * typeck.c (comptypes): Default COMP_TYPE_ATTRIBUTES to 1, to
+ match c-typeck.c.
+ (self_promoting_args_p): Move the check that TYPE is non-nil
+ before trying to look at its main variant.
+ (unsigned_type, signed_type): Add checking of DI/SI/HI/QI nodes.
+
+ * cp-tree.h (DECL_WAITING_FRIENDS, SET_DECL_WAITING_FRIENDS):
+ Delete macros.
+ * init.c (xref_friend, embrace_waiting_friends): Delete functions.
+ (do_friend): Delete call to xref_friend.
+ * class.c (finish_struct_1): Delete call to embrace_waiting_friends.
+
+ * typeck.c (convert_sequence): #if 0 unused function.
+
+ * cp-tree.h (DECL_IN_MEMORY_P): New macro w/ the check that used to
+ be in decl_in_memory_p.
+ (decl_in_memory_p): Delete decl.
+ * expr.c (decl_in_memory_p): Delete fn.
+ * typeck.c (mark_addressable): Use DECL_IN_MEMORY_P.
+
+ * decl.c (cp_finish_decl): Use DECL_IN_MEMORY_P.
+
+Tue Feb 13 12:51:21 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (finish_struct_1): Check for a pure-specifier on a
+ non-virtual function here.
+
+ * decl2.c (grok_function_init): Don't check whether the function
+ is virtual here.
+ (grokfield): Don't call check_for_override here.
+
+ * decl.c (push_to_top_level): Start from inner_binding_level,
+ check class_shadowed in class levels.
+
+Mon Feb 12 17:46:59 1996 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (resume_level): Ignore things that don't have names, instead
+ of core dumping.
+
+Mon Feb 12 15:47:44 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl2.c (grokfield): Set DECL_VINDEX properly for FUNCTION_DECLs.
+
+Sat Feb 10 17:59:45 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (finish_struct_1): Set DECL_VINDEX properly on a
+ synthesized dtor.
+
+ * parse.y (complete_type_name): Bind global_scope earlier.
+ (complex_type_name): Likewise.
+ (qualified_type_name): Remove.
+
+Thu Feb 8 15:15:14 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (grokfndecl): Move code that looks for virtuals in base
+ classes...
+ * class.c (check_for_override): ... to a new function.
+ (finish_struct_1): Call it.
+
+ * cp-tree.h: Declare warn_sign_compare.
+
+ * typeck.c (build_binary_op_nodefault): Check warn_sign_compare
+ rather than extra_warnings to decide whether to warn about
+ comparison of signed and unsigned.
+
+ * decl2.c (lang_decode_option): Handle warn_sign_compare. -Wall
+ implies -Wsign-compare. -Wall doesn't imply -W.
+
+Wed Feb 7 15:27:57 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_component_ref): Fix to handle anon unions in base
+ classes as well.
+
+Wed Feb 7 14:29:12 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * class.c (resolves_to_fixed_type_p): Delete code dealing with
+ a WITH_CLEANUP_EXPR, since we don't generate them any more.
+ * cvt.c (build_up_reference): Likewise.
+ * decl.c (grok_reference_init): Likewise.
+ (cp_finish_decl): Likewise.
+ * error.c (dump_expr): Likewise.
+ * tree.c (real_lvalue_p): Likewise.
+ (lvalue_p): Likewise.
+ (build_cplus_new): Likewise.
+ (unsave_expr_now): Likewise.
+ * typeck.c (unary_complex_lvalue, build_modify_expr,
+ c_expand_return): Likewise.
+
+Tue Feb 6 13:39:22 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ Make the C++ front-end pay attention to attributes for structures.
+ * class.c (finish_struct): New argument ATTRIBUTES, passed down into
+ finish_struct_1.
+ (finish_struct_1): New argument ATTRIBUTES; call cplus_decl_attributes.
+ Take out old round_up_size use and setting the DECL_ALIGN possibly
+ using it. Take out setting of TYPE_ALIGN to round_up_size, which
+ can override what the attribute set.
+ * cp-tree.h (finish_struct): Update prototype.
+ * parse.y (template_instantiate_once): Pass a NULL_TREE for the
+ attributes to finish_struct.
+ (structsp): For a CLASS decl, add maybe_attribute to rule and pass that
+ value down into finish_struct.
+ * Makefile.in (CONFLICTS): Switch to 7 shift/reduce conflicts.
+
+Tue Feb 6 13:12:15 1996 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * decl.c (poplevel): Re-word dead for local handling.
+ (pushdecl): Remove useless DECL_DEAD_FOR_LOCAL test.
+ (cp_finish_decl): If is_for_scope, check for duplicates so
+ we can disable is_for_scope. Otherwise, preserve_temp_slots.
+
+ * lex.c (do_identifier): Use global binding in preference of
+ dead for local variable.
+
+Mon Feb 5 17:46:46 1996 Mike Stump <mrs@cygnus.com>
+
+ * init.c (initializing_context): Handle anon union changes, the
+ context where fields of anon unions can be initialized now has to be
+ found by walking up the TYPE_CONTEXT chain.
+
+Fri Feb 2 14:54:04 1996 Doug Evans <dje@charmed.cygnus.com>
+
+ * decl.c (start_decl): #ifdef out code to set DECL_COMMON
+ if ASM_OUTPUT{,_ALIGNED}_BSS is defined.
+ (obscure_complex_init): If bss is supported, always set
+ DECL_INITIAL to error_mark_node.
+
+Thu Feb 1 16:19:56 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * init.c (is_friend): Make sure there's a context before we see if
+ it's an aggr type.
+
+Thu Feb 1 15:44:53 1996 Mike Stump <mrs@cygnus.com>
+
+ * init.c (is_friend): Classes are not friendly with nested classes.
+
+Thu Feb 1 15:27:37 1996 Doug Evans <dje@charmed.cygnus.com>
+
+ * lex.c (check_newline): Pass last character read to HANDLE_PRAGMA,
+ and record its result.
+
+Thu Feb 1 09:27:01 1996 Mike Stump <mrs@cygnus.com>
+
+ * class.c (finish_struct_anon): Switch around code to not move anon
+ union elements around, nor mess up their contexts, nor offsets,
+ instead we now build up the right number of COMPONENT_REFs for all
+ the anon unions that may be present at build_component_ref time.
+ * typeck.c (lookup_anon_field): New routine to handle field lookup
+ on fields without names. We find them, based upon their unique type
+ instead.
+ * typeck.c (build_component_ref): Allow FIELD_DECL components.
+ Handle finding components in anonymous unions, and ensure that a
+ COMPONENT_REF is built for each level as necessary.
+
+Tue Jan 30 18:18:23 1996 Mike Stump <mrs@cygnus.com>
+
+ * cvt.c (build_up_reference): Make the INDIRECT_BIND case come after
+ code that ensures that copy ctors are used if appropriate.
+
+Tue Jan 30 17:35:14 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * init.c (build_vec_delete): Only give an error if base isn't an
+ error_mark_node.
+
+Mon Jan 29 17:09:06 1996 Mike Stump <mrs@cygnus.com>
+
+ * spew.c (do_aggr): `new struct S;' isn't a forward declaration.
+ (yylex): If we see `new', keep slurping.
+
+Thu Jan 25 18:31:36 1996 Mike Stump <mrs@cygnus.com>
+
+ * class.c (finish_struct_1): Move code for handling anon unions...
+ (finish_struct_anon): to here. Fixup so that we do the offset
+ calculations right, and so that the fields are physically moved to
+ the containers's chain.
+
+Thu Jan 25 18:27:37 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (grokdeclarator): Avoid trying to get an operand off an
+ identifier node.
+
+Wed Jan 24 11:25:30 1996 Jim Wilson <wilson@chestnut.cygnus.com>
+
+ * typeck.c (pointer_int_sum): Use TYPE_PRECISION (sizetype) not
+ POINTER_SIZE to agree with expr.c.
+
+Thu Jan 25 13:01:23 1996 Mike Stump <mrs@cygnus.com>
+
+ * search.c (lookup_field): Don't report ambiguities if protect is 0,
+ instead return NULL_TREE.
+
+Wed Jan 24 13:01:26 1996 Mike Stump <mrs@cygnus.com>
+
+ * class.c (finish_struct_1): Call warn_hidden if we want warnings
+ about overloaded virtual functions.
+ (warn_hidden): New routine to warn of virtual functions that are
+ hidden by other virtual functions, that are not overridden.
+ (get_basefndecls): New routine, used by warn_hidden.
+ (mark_overriders): New routine, used by warn_hidden.
+ * search.c (get_matching_virtual): Remove old warning that just
+ isn't very useful.
+
+Tue Jan 23 12:26:10 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (output_builtin_tdesc_entries): #if 0 the function definition.
+
+ * typeck.c (null_ptr_cst_p): Delete unused fn.
+ (build_function_call_maybe): Delete unused fn.
+
+ * expr.c (extract_init): #if 0 the code after unconditional return 0
+ for now.
+
+ Delete old cadillac code.
+ * edsel.c: Remove file.
+ * Make-lang.in (CXX_SRCS): Take edsel.c off the list.
+ * Makefile.in (CXX_OBJS): Delete edsel.o.
+ (edsel.o): Delete rule.
+ * cp-tree.h (flag_cadillac): Delete var decl.
+ * lang-options.h: Delete "-fcadillac" and "-fno-cadillac".
+ * decl2.c (flag_cadillac): Delete var definition.
+ (lang_decode_option): Delete handling of -fcadillac and -fno-cadillac.
+ (grokfield): Delete code depending on flag_cadillac.
+ (finish_anon_union): Likewise.
+ * class.c (finish_struct_1): Likewise.
+ (pushclass): Likewise.
+ (popclass): Likewise.
+ (push_lang_context): Likewise.
+ (pop_lang_context): Likewise.
+ * decl.c (init_decl_processing): Likewise.
+ (start_decl): Likewise.
+ (cp_finish_decl): Likewise.
+ (xref_tag): Likewise.
+ (finish_enum): Likewise.
+ (start_function): Likewise.
+ (finish_function): Likewise.
+ (finish_stmt): Likewise.
+ * lex.c (lang_init): Likewise.
+ (check_newline): Likewise.
+
+ * lex.c (do_pending_inlines): Delete synthesized method kludge.
+
+ Delete defunct, ancient garbage collection implementation.
+ * rtti.c: New file with the RTTI stuff from gc.c.
+ * gc.c: Removed file (moved the remaining stuff into rtti.c).
+ * Makefile.in (CXX_OBJS): Replace gc.o with rtti.o.
+ (rtti.o): New rule, replacing gc.o.
+ * Make-lang.in (CXX_SRCS): Replace gc.c with rtti.c.
+ * cp-tree.h: Delete gc-related fn decls.
+ (DECL_GC_OFFSET): Delete macro.
+ (flag_gc): Delete extern decl.
+ * decl.c (current_function_obstack_index): Delete var decl.
+ (current_function_obstack_usage): Delete var decl.
+ (start_function): Delete clearing of current_function_obstack_index
+ and current_function_obstack_usage.
+ (init_decl_processing): Delete code relying on -fgc.
+ Delete call to init_gc_processing.
+ (cp_finish_decl): Delete calls to build_static_gc_entry and
+ type_needs_gc_entry. Delete gc code setting DECL_GC_OFFSET.
+ (store_parm_decls): Delete -fgc calls to cp_expand_decl_cleanup
+ and to expand_expr of a __gc_main call.
+ (maybe_gc_cleanup): Delete var decl.
+ (finish_function): Delete call to expand_gc_prologue_and_epilogue.
+ * decl2.c (flag_gc): Delete var decl.
+ (lang_f_options): Delete offering of -fgc.
+ (lang_decode_option): Delete -fgc and -fno-gc handling.
+ (get_temp_regvar): Delete gc code.
+ * init.c (build_new): Delete gc code.
+ * lex.c (init_lex): Delete checking of flag_gc.
+
+ * typeck.c (convert_arguments): Delete gc code.
+ (build_component_addr): Delete -fgc warning.
+ (build_modify_expr): Delete gc code.
+
+ * decl2.c (build_push_scope): Delete fn.
+ * cp-tree.h (build_push_scope): Delete decl.
+
+ * search.c (clear_search_slots): Delete fn.
+ * cp-tree.h (clear_search_slots): Delete decl.
+
+ * search.c (tree_needs_constructor_p): Delete fn.
+ * cp-tree.h (tree_needs_constructor_p): Delete decl.
+
+ * tree.c (id_cmp): Delete fn.
+
+ * tree.c (set_fnaddr_from_vtable_entry): Delete fn.
+ * cp-tree.h (set_fnaddr_from_vtable_entry): Delete decl.
+
+ * tree.c (decl_value_member): Delete fn.
+ * cp-tree.h (decl_value_member): Delete decl.
+
+ * tree.c (list_hash_lookup_or_cons): Delete fn.
+ * cp-tree.h (list_hash_lookup_or_cons): Delete decl.
+
+ * method.c (cplus_exception_name): Delete fn.
+ (EXCEPTION_NAME_{PREFIX, LENGTH}): Delete macros.
+
+ * spew.c (shift_tokens): Delete fn.
+
+Mon Jan 22 17:49:33 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * except.c (init_exception_processing): Pass 1 to needs_pop in calls
+ to cp_finish_decl.
+ * parse.y: Likewise.
+
+Mon Jan 22 17:34:29 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * tree.c (build_cplus_staticfn_type): Delete function definition;
+ never used.
+ * cp-tree.h (build_cplus_staticfn_type): Delete decl.
+
+ * tree.c (virtual_member): Delete function definition; never used.
+ * cp-tree.h (virtual_member): Delete decl.
+
+Fri Jan 19 18:03:14 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_component_ref): Handle getting vbase pointers
+ out of complex multiple inheritance better.
+
+Fri Jan 19 16:27:40 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (build_object_ref): Make sure we use the real type, not
+ any reference type.
+
+Fri Jan 19 16:01:47 1996 Mike Stump <mrs@cygnus.com>
+
+ * tree.c (build_exception_variant): Don't create new types if we
+ don't have to, also build new types on the right obstack.
+
+Fri Jan 19 14:09:44 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (store_bindings): Split out from push_to_top_level.
+ (push_to_top_level): Call it for b->type_shadowed on class binding
+ levels.
+
+Fri Jan 19 13:53:14 1996 Mike Stump <mrs@cygnus.com>
+
+ * search.c (expand_upcast_fixups): Fix so that offsets stored in
+ vbase_offsets are always right. Fixes a problem where virtual base
+ upcasting and downcasting could be wrong during conversions on this
+ during virtual function dispatch at ctor/dtor time when dynamic
+ vtable fixups for deltas are needed. This only sounds easier than
+ it is. :-)
+ (fixup_virtual_upcast_offsets): Change to reflect new calling
+ convention for expand_upcast_fixups.
+
+Fri Jan 19 12:23:08 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl2.c (grokbitfield): Strip the NOPs from WIDTH before we
+ check that it's usable as the bitfield width.
+
+Wed Jan 17 21:22:40 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl2.c (grokfield): Call cplus_decl_attributes with the attrlist.
+ Pass a null tree to grokdeclarator for its ATTRLIST arg, since it's
+ only ever used for functions in it.
+
+Wed Jan 17 12:10:38 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * parse.y (qualified_type_name): Use the TYPE_DECL, not the type.
+ (nested_type): Likewise.
+ (nested_name_specifier): Use lastiddecl.
+
+ * decl.c (grokdeclarator): Adjust accordingly.
+ * init.c (expand_member_init): Likewise.
+ * parse.y (base_class): Likewise.
+ * typeck2.c (build_functional_cast): Likewise.
+
+ * typeck2.c (build_functional_cast): Fill in name after we've
+ checked for non-aggr type.
+
+Wed Jan 17 10:18:01 1996 Mike Stump <mrs@cygnus.com>
+
+ * decl2.c (warn_pointer_arith): Default to on.
+
+Tue Jan 16 12:45:38 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * lex.c (is_rid): New function.
+ * decl.c (grokdeclarator): Diagnose reserved words used as
+ declarator-ids.
+
+Tue Jan 16 11:39:40 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * tree.c (get_decl_list): Don't lose cv-quals.
+
+ * decl.c (grokdeclarator): Fix SCOPE_REF handling and diagnose
+ typespecs used as declarator-ids.
+
+Tue Jan 16 11:09:42 1996 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (poplevel): When poping a level, don't give a warning for
+ any subblocks that already exist.
+
+Tue Jan 16 00:25:33 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_object_ref): Finish what I started.
+
+ * parse.y (qualified_type_name): Don't check TYPE_BUILT_IN.
+
+ * decl2.c (constructor_name_full): Handle TEMPLATE_TYPE_PARMs.
+
+ * decl.c (grokdeclarator): Also accept TEMPLATE_TYPE_PARM as a
+ scope.
+
+Mon Jan 15 16:19:32 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (xref_tag): Handle passing a type in directly.
+
+ * parse.y (qualified_type_name): Pull out the type.
+ (nested_type): Likewise.
+ Take types directly instead of as identifiers.
+ * call.c (build_scoped_method_call): Take types directly instead of
+ as identifiers.
+ * decl.c (xref_basetypes): Likewise.
+ * init.c (expand_member_init): Likewise.
+ (build_member_call): Likewise.
+ (build_offset_ref): Likewise.
+ * typeck2.c (build_scoped_ref): Likewise, remove bogus code.
+ * method.c (do_build_assign_ref): Likewise.
+ * decl.c (grokdeclarator): Handle a type appearing as the
+ declarator-id for constructors.
+ * method.c (do_build_copy_constructor): current_base_init_list now
+ uses the types directly, not their names.
+ * init.c (sort_base_init): Likewise.
+ (expand_member_init): Likewise.
+ * init.c (is_aggr_type): New function, like is_aggr_typedef.
+
+Mon Jan 15 08:45:01 1996 Jeffrey A Law <law@cygnus.com>
+
+ * tree.c (layout_basetypes): Call build_lang_field_decl instead
+ of build_lang_decl if first arg is a FIELD_DECL.
+
+Thu Jan 11 14:55:07 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (cp_finish_decl): Only clear TREE_USED if DECL_NAME is
+ non-empty.
+ * except.c (expand_start_catch_block): Set TREE_USED to avoid
+ warnings about the catch handler.
+
+Mon Jan 8 17:35:12 1996 Jason Merrill <jason@yorick.cygnus.com>
+
+ * typeck.c (build_modify_expr): Use a COMPOUND_EXPR instead of
+ expand_target_expr.
+
+Thu Jan 4 12:30:32 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ Fix access control to use trees rather than integers.
+ * class.c (access_{default, public, protected, private,
+ default_virtual, public_virtual, private_virtual}_node): Add
+ definitions.
+ (init_class_processing): Do creation of those nodes.
+ * cp-tree.h (access_type): Delete enum decl.
+ (access_{default, public, protected, private, default_virtual,
+ public_virtual, private_virtual}_node): Add decls.
+ (compute_access): Change return type.
+ * search.c (compute_access): Have tree return type, instead of enum.
+ (lookup_field): Declare THIS_V and NEW_V to be tree nodes.
+ * lex.c (real_yylex): Use yylval.ttype for giving the value of the
+ access_* node for each of RID_{PUBLIC, PRIVATE, PROTECTED}.
+ * parse.y (VISSPEC): Make ttype rather than itype.
+ (base_class_access_list): Likewise.
+ * *.[cy]: Change all refs of `access_public' to `access_public_node',
+ etc.
+ * call.c (build_method_call): Make ACCESS be a tree.
+ * class.c (alter_access, finish_struct_1, filter_struct): Likewise.
+ * cvt.c (convert_to_aggr): Likewise.
+ * init.c (build_offset_ref, resolve_offset_ref, build_delete):
+ Likewise.
+ * method.c (hack_identifier): Likewise.
+ * typeck.c (build_component_ref_1, build_component_ref): ): Likewise.
+
+Thu Jan 4 11:02:20 1996 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (pointer_int_sum, pointer_diff): Make code agree with C
+ frontend, and make it more consistent with respect to
+ warn_pointer_arith.
+
+Tue Jan 2 00:13:38 1996 Rusty Russell <rusty@adelaide.maptek.com.au>
+
+ * decl.c (pushdecl): Check for duplicate parameter names.
+
+Wed Jan 3 09:25:48 1996 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (expand_static_init): Call assemble_external for atexit.
+
+Wed Jan 3 07:55:19 1996 Mike Stump <mrs@cygnus.com>
+
+ * except.c (do_unwind): Remove some generated dead code.
+ (eh_outer_context): New routine, factor out some common code from
+ expand_builtin_throw and end_eh_unwinder. Add code to do return
+ address masking for the PA.
+ (expand_builtin_throw): Use eh_outer_context instead of open coding
+ it here.
+ (end_eh_unwinder): Likewise.
+
+Tue Jan 2 17:00:56 1996 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_throw): Call assemble_external for __empty, if we
+ use it.
+
+Thu Dec 28 11:13:15 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_builtin_throw): Use RETURN_ADDR_OFFSET instead of
+ NORMAL_RETURN_ADDR_OFFSET.
+ (end_eh_unwinder): Likewise.
+
+Wed Dec 27 22:18:16 1995 Mike Stump <mrs@cygnus.com>
+
+ * gc.c (build_dynamic_cast): Make sure we don't cast away const
+ when dealing with references, and make sure we handle dynamic
+ casting to a cv qualified reference.
+
+Thu Dec 21 23:50:35 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (struct eh_context): New structure top hold eh context
+ information.
+ (push_eh_context): New routine.
+ (pop_eh_context): Likewise.
+ * decl.c (push_cp_function_context): Use them.
+ (pop_cp_function_context): Likewise.
+
+Wed Dec 20 12:42:51 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_file): Also prune uninteresting functions in the
+ inline emission loop.
+
+Wed Dec 20 02:32:07 1995 Jeffrey A Law <law@cygnus.com>
+
+ * sig.c (build_signature_table_constructor): Mark functions
+ in the signature as referenced.
+
+Tue Dec 19 22:36:56 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (finish_file): Do all the vtable/synthesis stuff before
+ the inline emission stuff.
+
+Mon Dec 18 15:51:33 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h, decl2.c (flag_weak): New flag to control the use of
+ weak symbols.
+ * lang-options.h: Add -f{no-,}weak.
+ * decl.c (init_decl_processing): If the target does not support weak
+ symbols, don't use them.
+ * decl2.c, pt.c: s/SUPPORTS_WEAK/flag_weak/.
+
+Sun Dec 17 21:13:23 1995 Rusty Russell <rusty@adelaide.maptek.com.au>
+
+ * init.c (expand_member_init): warning for base init after members.
+
+Fri Dec 15 15:32:18 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (build_expr_type_conversion): Don't convert to a reference
+ type.
+
+Thu Dec 14 16:05:58 1995 Mike Stump <mrs@cygnus.com>
+
+ * method.c (report_type_mismatch): Improve wording for volatile
+ mismatches.
+
+Thu Dec 14 14:16:26 1995 Mike Stump <mrs@cygnus.com>
+
+ * init.c (expand_aggr_init_1): Use expand_aggr_init_1 instead of
+ expand_assignment, as the later doesn't handle things that have
+ copy constructors well. The compiler would do bitwise copying,
+ instead of ctor calling in some cases.
+
+Wed Dec 13 17:05:54 1995 Paul Eggert <eggert@twinsun.com>
+
+ * g++.c (my_strerror): Return "cannot access" if errno is 0.
+ (pfatal_with_name, perror_exec): Don't assume that
+ the returned value from my_strerror contains no '%'s.
+ (concat): Remove.
+ (sys_nerror): Declare only if HAVE_STRERROR is not defined.
+
+Wed Dec 13 16:22:38 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ Lose CLASSTYPE_METHODS/DECL_NEXT_METHOD chain; make
+ TYPE_METHODS/TREE_CHAIN mean what they used to.
+ * decl2.c (constructor_name_full): Refer to CLASSTYPE_METHOD_VEC
+ instead of TYPE_METHODS.
+ * decl.c (duplicate_decls): Lose references to DECL_NEXT_METHOD.
+ * tree.c (tree_copy_lang_decl_for_deferred_output): Likewise.
+ * cp-tree.h (CLASSTYPE_METHODS): Lose.
+ (CLASSTYPE_METHOD_VEC): Point to lang_spec->methods instead of
+ TYPE_METHODS.
+ (struct lang_decl): Lose next_method field.
+ (DECL_NEXT_METHOD): Lose.
+ * class.c (finish_struct_methods): Don't mess with TYPE_METHODS.
+ (finish_struct): Just use TYPE_METHODS; we don't need fn_fields
+ anymore.
+ (finish_struct_methods): Don't mess with the TREE_CHAINs in
+ fn_fields.
+
+ * search.c (add_conversions): Don't use TREE_CHAIN to traverse method
+ vector.
+
+ * call.c (build_method_call): Synthesize here even when not inlining.
+ * typeck.c (build_function_call_real): Likewise.
+
+Wed Dec 13 15:02:39 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * cp/lex.c (check_newline): If DBX_DEBUGGING_INFO and write_symbols
+ == DBX_DEBUG, call dbxout_start_new_source_file and
+ dbxout_resume_previous_source_file when appropriate.
+
+Tue Dec 12 20:38:55 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (start_anon_func): Push to the top level.
+ (end_anon_func): Pop from the top level.
+
+Mon Dec 11 18:56:14 1995 Mike Stump <mrs@cygnus.com>
+
+ * cp-tree.h (build_cleanup): New routine to build cleanups.
+ * decl.c (expand_static_init): Use build_cleanup to build a cleanup
+ call at ctor time and use atexit to run it later.
+ * decl2.c (build_cleanup): New routine, taken from finish_file.
+ (finish_file): Use build_cleanup instead, and don't put function
+ local statics in global dtor list.
+
+Wed Dec 6 14:34:29 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_throw): Ensure that we have cleanups, if we try
+ and expand cleanups.
+
+Wed Dec 6 11:48:21 1995 Mike Stump <mrs@cygnus.com>
+
+ * except.c (expand_throw): Add logic to manage dynamic cleanups for
+ the EH object.
+ (expand_end_catch_block): Use the magic of expand_goto, instead of
+ emit_jump so that we get the cleanup for any catch clause parameter
+ and the cleanup for the exception object. Update to reflect label
+ changes.
+ (push_eh_cleanup): New routine to register a cleanup for an
+ exception object.
+ (empty_fndecl): Used to default cleanup actions to
+ nothing.
+ (init_exception_processing): Setup empty_fndecl. Setup
+ saved_cleanup.
+ (expand_start_catch_block): Update to reflect label changes. Call
+ push_eh_object to register the cleanup for the EH object.
+ (start_anon_func): New routine to start building lambda expressions
+ from trees.
+ (end_anon_func): New routine to end them.
+ (struct labelNode): Change so that we can use tree labels, or rtx
+ labels.
+ (saved_cleanup): Object to check for dynamic cleanups for the
+ exception handling object.
+ (push_label_entry): Change so that we can use tree labels, or rtx
+ labels.
+ (pop_label_entry): Likewise.
+ (top_label_entry): Likewise.
+ (expand_start_all_catch): Use tree label instead of rtx label, so
+ that we can get the magic of expand_goto.
+ (expand_end_all_catch): Update to reflect label changes.
+
+ * class.c (build_vfn_ref): Remove building_cleanup logic, as we now
+ use UNSAVE_EXPRs.
+ * typeck.c (get_member_function_from_ptrfunc): Remove remnants of
+ building_cleanup logic, as we now use UNSAVE_EXPRs.
+ * cp-tree.h (unsave_expr): Declare it.
+ * decl.c (building_cleanup): Remove.
+ (maybe_build_cleanup): Remove building_cleanup logic, and use
+ UNSAVE_EXPR instead.
+
+Sun Dec 3 01:34:58 1995 Mike Stump <mrs@cygnus.com>
+
+ * gc.c (build_t_desc): Update error message to say <typeinfo>.
+
+Thu Nov 30 12:30:05 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (pushdecl): Only warn about shadowing a local variable if
+ warn_shadow is true.
+
+Sun Nov 26 16:06:55 1995 Rusty Russell <rusty@adelaide.maptek.com.au>
+
+ * typeck.c (build_binary_op_nodefault): Added warning about
+ comparisons between different enum types with -Wall, unless
+ -fenum-int-equiv set.
+
+Wed Nov 22 15:44:02 1995 Mike Stump <mrs@cygnus.com>
+
+ * class.c (finish_struct_1): Skip down to the inner type in
+ multidimensional arrays. Ensures ctors will be made for types that
+ need constructing.
+
+Wed Nov 22 14:19:22 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (last_dtor_insn): New to track the last compiler generated
+ insn in a dtor.
+ (store_parm_decls): Set it.
+ (finish_function): Use it to see if the dtor is empty. Avoid doing
+ vtable setup all the time, if we can.
+ (struct cp_function): Add last_dtor_insn.
+ (push_cp_function_context): Save it.
+ (pop_cp_function_context): Restore it.
+
+Wed Nov 22 11:52:19 1995 Paul Russell <Rusty.Russell@adelaide.maptek.com.au>
+
+ * typeck.c (build_unary_op): Set TREE_NO_UNUSED_WARNING to avoid
+ warnings.
+
+Tue Nov 21 17:15:23 1995 Mike Stump <mrs@cygnus.com>
+
+ * typeck.c (expand_target_expr): Make sure targets get put into the
+ current temp_slot_level, so that the free_temp_slots call will reuse
+ them.
+
+Tue Nov 21 13:32:03 1995 Mike Stump <mrs@cygnus.com>
+
+ * class.c (finish_struct_1): Delay delta fixups for virtual bases
+ until after we have done the hard virtuals, to avoid a bogus `every
+ virtual function must have a unique final overrider' for virtual
+ functions that are only overridden by hard virtuals.
+
+Thu Nov 9 13:35:30 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (do_function_instantiation): Don't try to find a file-scope
+ template for a member function.
+
+Tue Nov 14 06:20:35 1995 Mike Stump <mrs@cygnus.com>
+
+ * g++.c (main): Add handling of -nodefaultlibs.
+
+Mon Nov 13 15:45:34 1995 Mike Stump <mrs@cygnus.com>
+
+ * cp-tree.h (INDIRECT_BIND): Add a way for the frontend to
+ distinguish between direct bindings of reference variables, and
+ indirect bindings of reference variables.
+ * cvt.c (build_up_reference): Use it.
+ * typeck.c (convert_arguments): Use it to indicate this is an
+ indirect binding.
+ * decl.c (cp_finish_decl): Ensure that we reuse stack slots as fast
+ as they are unused.
+ (expand_static_init): Likewise.
+ (cplus_expand_expr_stmt): Likewise.
+ * decl2.c (finish_file): Likewise.
+ * init.c (perform_member_init): Likewise.
+ (emit_base_init): Likewise.
+ (expand_aggr_vbase_init_1): Likewise.
+
+Fri Nov 10 09:18:09 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (push_namespace): Rewrite to use build_lang_decl, so we
+ get a DECL_LANG_SPECIFIC node.
+ * cp-tree.h (lang_decl_flags): Add new member `level'.
+ (NAMESPACE_LEVEL): Don't use decl.arguments, instead use the
+ decl_flags level member.
+
+Mon Nov 6 18:36:13 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * call.c (build_method_call): Make sure instance has a
+ TYPE_LANG_SPECIFIC node before we dive into it.
+
+Sat Nov 4 20:01:52 1995 Jason Molenda <crash@phydeaux.cygnus.com>
+
+ * method.c (make_thunk): Use TREE_SET_CODE to set thunk's tree code.
+
+Thu Nov 2 17:56:57 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (duplicate_decls): When smashing decls, smash staticness in
+ the usual way.
+
+Thu Nov 2 16:44:02 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (poplevel): Handle the merging of subblocks of cleanups
+ when finishing blocks that have already been created (usually due to
+ the fixup goto code). Fixes bad debugging information.
+
+Wed Nov 1 12:33:53 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * method.c (hack_identifier): Don't abort when we get a TREE_LIST
+ that's not a list of overloaded functions.
+
+Wed Nov 1 11:38:58 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl2.c (mark_vtable_entries): Check DECL_LANG_SPECIFIC on fn
+ before trying to use DECL_ABSTRACT_VIRTUAL_P.
+
+Tue Oct 31 11:56:55 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl2.c (mark_used): New function for hooking into setting of
+ TREE_USED on decls.
+ * call.c (build_method_call): Use it.
+ * class.c (instantiate_type): Likewise.
+ * init.c (build_offset_ref): Likewise. Don't call assemble_external
+ for all like-named functions.
+ * method.c (hack_identifier): Likewise.
+ (emit_thunk): Don't call assemble_external.
+ (make_thunk): Create thunk as a FUNCTION_DECL so that it
+ gets the right mode and ENCODE_SECTION_INFO works.
+
+ * parse.y: Use mark_used. Pass operator names to do_identifier.
+ * lex.c (do_identifier): Handle operator names.
+
+ * decl2.c (grokclassfn): Tweak __in_chrg attributes.
+
+Thu Oct 26 16:45:58 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * errfn.c: Include stdio.h.
+ (cp_sprintf): Take out decl of sprintf, and cast sprintf to errorfn*.
+
+Wed Oct 25 18:58:41 1995 Mike Stump <mrs@cygnus.com>
+
+ * typeck2.c (digest_init): Always convert initializers to the
+ right type.
+
+Wed Oct 25 13:25:24 1995 Mike Stump <mrs@cygnus.com>
+
+ * init.c (member_init_ok_or_else): Don't allow member initializers
+ for indirect members, as it is invalid.
+
+Wed Oct 25 11:35:28 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * decl.c (grokdeclarator): Don't allow `friend signed ()'.
+
+Fri Oct 20 10:30:59 1995 Mike Stump <mrs@cygnus.com>
+
+ * parse.y (for.init.statement): Catch compound statements inside for
+ initializations, if we're being pedantic.
+
+Fri Oct 20 10:03:42 1995 Mike Stump <mrs@cygnus.com>
+
+ * decl.c (lookup_tag): Return NULL_TREE if we don't find what we are
+ looking for.
+
+Thu Oct 19 14:26:10 1995 Mike Stump <mrs@cygnus.com>
+
+ * error.c (dump_expr): Don't core dump when a boolean expression is
+ used as a default argument.
+
+Thu Oct 19 10:36:30 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (finish_struct_bits): Check aggregate_value_p instead of
+ RETURN_IN_MEMORY.
+
+Wed Oct 18 18:12:32 1995 Jason Merrill <jason@yorick.cygnus.com>
+
+ * class.c (finish_struct_bits): Also set TREE_ADDRESSABLE on a
+ BLKmode type that would otherwise be returned in registers.
+
+Mon Oct 16 12:32:19 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * g++.c (WITHLIBC): New macro.
+ (main): Declare saw_libc. Use WITHLIBC if `-lc' was used; set
+ saw_libc and pass it at the end if it was set.
+
+Wed Oct 11 16:30:34 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * parse.y (fn.def1): Call split_specs_attrs in
+ declmods notype_declarator case.
diff --git a/contrib/gcc/cp/ChangeLog.egcs b/contrib/gcc/cp/ChangeLog.egcs
new file mode 100644
index 0000000..ddefd5c
--- /dev/null
+++ b/contrib/gcc/cp/ChangeLog.egcs
@@ -0,0 +1,4 @@
+Wed Sep 10 16:39:26 1997 Jim Wilson <wilson@cygnus.com>
+
+ * Make-lang.in (LN, LN_S): New macros, use where appropriate.
+
diff --git a/contrib/gcc/cp/Make-lang.in b/contrib/gcc/cp/Make-lang.in
index d5d4e4d..895b410 100644
--- a/contrib/gcc/cp/Make-lang.in
+++ b/contrib/gcc/cp/Make-lang.in
@@ -1,5 +1,6 @@
-# Top level makefile fragment for GNU C++.
-# Copyright (C) 1994, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
+# Top level -*- makefile -*- fragment for GNU C++.
+# Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
#This file is part of GNU CC.
@@ -24,7 +25,7 @@
# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
# foo.info, foo.dvi,
# foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
-# foo.uninstall, foo.distdir,
+# foo.uninstall,
# foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
#
@@ -35,36 +36,22 @@
# - making any compiler driver (eg: g++)
# - the compiler proper (eg: cc1plus)
# - define the names for selecting the language in LANGUAGES.
-#
-# Extra flags to pass to recursive makes.
-CXX_FLAGS_TO_PASS = \
- "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
- "CXXFLAGS=$(CXXFLAGS)" \
- "CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
# Actual names to use when installing a native compiler.
-CXX_INSTALL_NAME = `t='$(program_transform_name)'; echo c++ | sed $$t`
-GXX_INSTALL_NAME = `t='$(program_transform_name)'; echo g++ | sed $$t`
-DEMANGLER_INSTALL_NAME = `t='$(program_transform_name)'; echo c++filt | sed $$t`
+CXX_INSTALL_NAME = `echo c++|sed '$(program_transform_name)'`
+GXX_INSTALL_NAME = `echo g++|sed '$(program_transform_name)'`
+DEMANGLER_INSTALL_NAME = `echo c++filt|sed '$(program_transform_name)'`
+CXX_TARGET_INSTALL_NAME = $(target_alias)-`echo c++|sed '$(program_transform_name)'`
+GXX_TARGET_INSTALL_NAME = $(target_alias)-`echo g++|sed '$(program_transform_name)'`
# Actual names to use when installing a cross-compiler.
-CXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t`
-GXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g++ | sed $$t`
-DEMANGLER_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++filt | sed $$t`
+CXX_CROSS_NAME = `echo c++|sed '$(program_transform_cross_name)'`
+GXX_CROSS_NAME = `echo g++|sed '$(program_transform_cross_name)'`
+DEMANGLER_CROSS_NAME = `echo c++filt|sed '$(program_transform_cross_name)'`
# The name to use for the demangler program.
DEMANGLER_PROG = c++filt$(exeext)
-# Extra headers to install.
-CXX_EXTRA_HEADERS = $(srcdir)/cp/inc/typeinfo $(srcdir)/cp/inc/exception \
- $(srcdir)/cp/inc/new $(srcdir)/cp/inc/new.h
-
-# Extra code to include in libgcc2.
-CXX_LIB2FUNCS = tinfo.o tinfo2.o new.o opnew.o opnewnt.o opvnew.o opvnewnt.o \
- opdel.o opdelnt.o opvdel.o opvdelnt.o exception.o
-CXX_LIB2SRCS = $(srcdir)/cp/new.cc $(srcdir)/cp/new1.cc $(srcdir)/cp/new2.cc \
- $(srcdir)/cp/exception.cc $(srcdir)/cp/tinfo.cc \
- $(srcdir)/cp/tinfo2.cc $(srcdir)/cp/tinfo.h
#
# Define the names for selecting c++ in LANGUAGES.
# Note that it would be nice to move the dependency on g++
@@ -75,16 +62,13 @@ C++ c++: cc1plus$(exeext)
# Tell GNU make to ignore these if they exist.
.PHONY: C++ c++
-g++spec.o: $(srcdir)/cp/g++spec.c
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/cp/g++spec.c
+g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) $(GCC_H) $(CONFIG_H)
+ (SHLIB_LINK='$(SHLIB_LINK)' \
+ SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
+ $(INCLUDES) $(srcdir)/cp/g++spec.c)
-$(INTL_TARGETS): $(srcdir)/cp/parse.c
-$(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y
- @cp_srcdir=`sed -n 's/^srcdir[ ]*=[ ]*//p' cp/Makefile` && \
- echo "cd cp && $(MAKE) $$cp_srcdir/parse.c" && \
- cd cp && \
- $(MAKE) $(SUBDIR_FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) \
- $$cp_srcdir/parse.c
+po-generated: $(srcdir)/cp/parse.c
# Create the compiler driver for g++.
GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o
@@ -97,7 +81,8 @@ g++-cross$(exeext): g++$(exeext)
-rm -f g++-cross$(exeext)
cp g++$(exeext) g++-cross$(exeext)
-cxxmain.o: $(srcdir)/../libiberty/cplus-dem.c $(DEMANGLE_H)
+# The demangler.
+cxxmain.o: $(srcdir)/../libiberty/cplus-dem.c $(DEMANGLE_H) $(CONFIG_H)
rm -f cxxmain.c
$(LN_S) $(srcdir)/../libiberty/cplus-dem.c cxxmain.c
$(CC) -c -DMAIN $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
@@ -108,20 +93,44 @@ $(DEMANGLER_PROG): cxxmain.o underscore.o $(LIBDEPS)
$(CC) -o $@ $(ALL_CFLAGS) $(LDFLAGS) \
cxxmain.o underscore.o $(LIBS)
-CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \
- $(srcdir)/cp/except.c $(srcdir)/cp/input.c $(srcdir)/cp/pt.c \
- $(srcdir)/cp/spew.c $(srcdir)/cp/xref.c $(srcdir)/cp/class.c \
- $(srcdir)/cp/expr.c $(srcdir)/cp/lex.c \
- $(srcdir)/cp/ptree.c $(srcdir)/cp/tree.c $(srcdir)/cp/cvt.c \
- $(srcdir)/cp/errfn.c $(srcdir)/cp/rtti.c $(srcdir)/cp/method.c \
- $(srcdir)/cp/search.c $(srcdir)/cp/typeck.c $(srcdir)/cp/decl.c \
- $(srcdir)/cp/error.c $(srcdir)/cp/friend.c $(srcdir)/cp/init.c \
- $(srcdir)/cp/parse.y $(srcdir)/cp/sig.c $(srcdir)/cp/typeck2.c \
- $(srcdir)/cp/repo.c $(srcdir)/cp/semantics.c
-
-cc1plus$(exeext): $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o c-pragma.o \
- $(srcdir)/cp/cp-tree.h $(srcdir)/cp/cp-tree.def hash.o
- cd cp; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus$(exeext)
+# The compiler itself.
+# Shared with C front end:
+CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
+ $(CXX_TARGET_OBJS)
+
+# Language-specific object files.
+CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
+ cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parse.o cp/ptree.o cp/rtti.o \
+ cp/spew.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \
+ cp/search.o cp/semantics.o cp/tree.o cp/xref.o cp/repo.o cp/dump.o \
+ cp/optimize.o cp/mangle.o cp/cp-lang.o
+
+# Use loose warnings for this front end.
+cp-warn =
+
+cc1plus$(exeext): $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) \
+ libcpp.a $(LIBDEPS)
+ $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
+ $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) libcpp.a $(LIBS)
+
+# Special build rules.
+$(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
+ gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' \
+ $(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h
+
+$(srcdir)/cp/parse.h: $(srcdir)/cp/parse.c
+$(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y
+ @echo "Expect 31 shift/reduce conflicts and 58 reduce/reduce conflicts."
+ cd $(srcdir)/cp && \
+ if $(BISON) $(BISONFLAGS) -d -o p$$$$.c parse.y; then \
+ grep '^#define[ ]*YYEMPTY' p$$$$.c >> p$$$$.h ; \
+ test -f p$$$$.output && mv -f p$$$$.output parse.output ; \
+ mv -f p$$$$.c parse.c ; mv -f p$$$$.h parse.h ; \
+ else \
+ rm -f p$$$$.* ; \
+ false ; \
+ fi
+
#
# Build hooks:
@@ -130,78 +139,10 @@ c++.all.cross: g++-cross$(exeext) $(DEMANGLER_PROG)
c++.start.encap: g++$(exeext)
c++.rest.encap: $(DEMANGLER_PROG)
-c++.info:
+c++.info:
c++.dvi:
+c++.generated-manpages:
-# C++ language-support library pieces for libgcc.
-tinfo.o: cc1plus$(exeext) $(srcdir)/cp/tinfo.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/tinfo.cc
-tinfo2.o: cc1plus$(exeext) $(srcdir)/cp/tinfo2.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/tinfo2.cc
-exception.o: cc1plus$(exeext) $(srcdir)/cp/exception.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \
- -c -fexceptions $(srcdir)/cp/exception.cc
-new.o: cc1plus$(exeext) $(srcdir)/cp/new.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/new.cc
-opnew.o: cc1plus$(exeext) $(srcdir)/cp/new1.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/new1.cc -DL_op_new -o opnew.o
-opnewnt.o: cc1plus$(exeext) $(srcdir)/cp/new1.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/new1.cc -DL_op_newnt -o opnewnt.o
-opvnew.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/new2.cc -DL_op_vnew -o opvnew.o
-opvnewnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/new2.cc -DL_op_vnewnt -o opvnewnt.o
-opdel.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/new2.cc -DL_op_delete -o opdel.o
-opdelnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/new2.cc -DL_op_delnt -o opdelnt.o
-opvdel.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/new2.cc -DL_op_vdel -o opvdel.o
-opvdelnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/new2.cc -DL_op_vdelnt -o opvdelnt.o
-
-# We want to update cplib2.txt if any of the source files change...
-cplib2.txt: $(CXX_LIB2SRCS) $(CXX_EXTRA_HEADERS) cplib2.ready
- case " $(LANGUAGES) " in \
- *" "[cC]"++ "*) \
- echo $(CXX_LIB2FUNCS) > cplib2.new;; \
- *) \
- echo "" > cplib2.new;; \
- esac
- mv -f cplib2.new cplib2.txt
-
-# Or if it would be different.
-# Don't try to do write if `.' is not writable;
-# in that case, we're installing from someone else's directory.
-# But go ahead and fail if that directory hasn't been properly built.
-cplib2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS) stmp-int-hdrs
- @if [ -r cplib2.txt -a -w . ]; then \
- case " $(LANGUAGES) " in \
- *" "[cC]"++ "*) \
- echo $(CXX_LIB2FUNCS) > cplib2.new;; \
- *) \
- echo "" > cplib2.new;; \
- esac; \
- if cmp -s cplib2.new cplib2.txt; then true; else \
- touch cplib2.ready; \
- fi; \
- rm -f cplib2.new; \
- else true ; \
- fi
- @if [ -f cplib2.ready ]; then true; else \
- touch cplib2.ready; \
- fi
#
# Install hooks:
# cc1plus is installed elsewhere as part of $(COMPILERS).
@@ -211,7 +152,7 @@ c++.install-normal:
# Install the driver program as $(target)-g++
# and also as either g++ (if native) or $(tooldir)/bin/g++.
-c++.install-common:
+c++.install-common: installdirs
-if [ -f cc1plus$(exeext) ] ; then \
if [ -f g++-cross$(exeext) ] ; then \
rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
@@ -219,12 +160,22 @@ c++.install-common:
chmod a+x $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
rm -f $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
$(LN) $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
+ if [ -d $(gcc_tooldir)/bin/. ] ; then \
+ rm -f $(gcc_tooldir)/bin/g++$(exeext); \
+ $(INSTALL_PROGRAM) g++-cross$(exeext) $(gcc_tooldir)/bin/g++$(exeext); \
+ rm -f $(gcc_tooldir)/bin/c++$(exeext); \
+ $(LN) $(gcc_tooldir)/bin/g++$(exeext) $(gcc_tooldir)/bin/c++$(exeext); \
+ else true; fi; \
else \
rm -f $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
$(INSTALL_PROGRAM) g++$(exeext) $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
chmod a+x $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
rm -f $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
$(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
+ rm -f $(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
+ $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
+ rm -f $(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \
+ $(LN) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \
fi ; \
if [ x$(DEMANGLER_PROG) != x ] && [ -x "$(DEMANGLER_PROG)" ]; then \
if [ -f g++-cross$(exeext) ] ; then \
@@ -239,18 +190,18 @@ c++.install-common:
fi ; \
fi
-c++.install-info:
+c++.install-info:
-c++.install-man: $(srcdir)/cp/g++.1
+c++.install-man: installdirs $(srcdir)/cp/g++.1
-if [ -f cc1plus$(exeext) ] ; then \
if [ -f g++-cross$(exeext) ] ; then \
- rm -f $(man1dir)/$(GXX_CROSS_NAME)$(manext); \
- $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(man1dir)/$(GXX_CROSS_NAME)$(manext); \
- chmod a-x $(man1dir)/$(GXX_CROSS_NAME)$(manext); \
+ rm -f $(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \
+ $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \
+ chmod a-x $(man1dir)/$(GXX_CROSS_NAME)$(man1ext); \
else \
- rm -f $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
- $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
- chmod a-x $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \
+ rm -f $(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \
+ $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \
+ chmod a-x $(man1dir)/$(GXX_INSTALL_NAME)$(man1ext); \
fi; \
else true; fi
@@ -261,8 +212,8 @@ c++.uninstall:
-rm -rf $(bindir)/$(GXX_CROSS_NAME)$(exeext)
-rm -rf $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext)
-rm -rf $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext)
- -rm -rf $(man1dir)/$(GXX_INSTALL_NAME)$(manext)
- -rm -rf $(man1dir)/$(GXX_CROSS_NAME)$(manext)
+ -rm -rf $(man1dir)/$(GXX_INSTALL_NAME)$(man1ext)
+ -rm -rf $(man1dir)/$(GXX_CROSS_NAME)$(man1ext)
#
# Clean hooks:
# A lot of the ancillary files are deleted by the main makefile.
@@ -271,13 +222,12 @@ c++.uninstall:
c++.mostlyclean:
-rm -f cp/*$(objext) $(DEMANGLER_PROG)
c++.clean:
- -rm -f cplib2.txt cplib2.ready
c++.distclean:
-rm -f cp/config.status cp/Makefile
- -rm -f cp/parse.output
+ -rm -f $(srcdir)/cp/parse.output
c++.extraclean:
c++.maintainer-clean:
- -rm -f cp/parse.c cp/parse.h
+ -rm -f $(srcdir)/cp/parse.c $(srcdir)/cp/parse.h
#
# Stage hooks:
# The main makefile has already created stage?/cp.
@@ -290,21 +240,70 @@ c++.stage3: stage3-start
-mv cp/*$(objext) stage3/cp
c++.stage4: stage4-start
-mv cp/*$(objext) stage4/cp
+
+#
+# .o: .h dependencies.
+CXX_TREE_H = $(TREE_H) cp/cp-tree.h c-common.h cp/cp-tree.def c-common.def \
+ function.h varray.h $(SYSTEM_H) $(CONFIG_H) $(TARGET_H) \
+ $(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h
+
+cp/spew.o: cp/spew.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h toplev.h
+cp/lex.o: cp/lex.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h c-pragma.h \
+ toplev.h output.h mbchar.h $(GGC_H) input.h diagnostic.h cp/operators.def \
+ $(TM_P_H)
+cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) toplev.h langhooks.h langhooks-def.h \
+ c-common.h
+cp/decl.o: cp/decl.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h stack.h \
+ output.h $(EXPR_H) except.h toplev.h hash.h $(GGC_H) $(RTL_H) \
+ cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h
+cp/decl2.o: cp/decl2.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \
+ output.h except.h toplev.h $(GGC_H) $(RTL_H)
+cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H) \
+ diagnostic.h
+cp/typeck.o: cp/typeck.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
+ diagnostic.h
+cp/class.o: cp/class.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H)
+cp/call.o: cp/call.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(EXPR_H) \
+ $(GGC_H) diagnostic.h
+cp/friend.o: cp/friend.c $(CXX_TREE_H) flags.h $(RTL_H) toplev.h $(EXPR_H)
+cp/init.o: cp/init.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
+ $(GGC_H) except.h
+cp/method.o: cp/method.c $(CXX_TREE_H) toplev.h $(GGC_H) $(RTL_H) $(EXPR_H) \
+ $(TM_P_H)
+cp/cvt.o: cp/cvt.c $(CXX_TREE_H) cp/decl.h flags.h toplev.h convert.h
+cp/search.o: cp/search.c $(CXX_TREE_H) stack.h flags.h toplev.h $(RTL_H)
+cp/tree.o: cp/tree.c $(CXX_TREE_H) flags.h toplev.h $(GGC_H) $(RTL_H) \
+ insn-config.h integrate.h tree-inline.h
+cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(SYSTEM_H)
+cp/rtti.o: cp/rtti.c $(CXX_TREE_H) flags.h toplev.h
+cp/except.o: cp/except.c $(CXX_TREE_H) flags.h $(RTL_H) except.h toplev.h \
+ cp/cfns.h $(EXPR_H) libfuncs.h cp/decl.h $(OBSTACK_H)
+cp/expr.o: cp/expr.c $(CXX_TREE_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \
+ except.h $(TM_P_H)
+cp/xref.o: cp/xref.c $(CXX_TREE_H) input.h toplev.h
+cp/pt.o: cp/pt.c $(CXX_TREE_H) cp/decl.h cp/parse.h cp/lex.h toplev.h \
+ $(GGC_H) $(RTL_H) except.h tree-inline.h
+cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h flags.h real.h
+cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h
+cp/semantics.o: cp/semantics.c $(CXX_TREE_H) cp/lex.h except.h toplev.h \
+ flags.h $(GGC_H) debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \
+ tree-inline.h
+cp/dump.o: cp/dump.c $(CXX_TREE_H) tree-dump.h
+cp/optimize.o: cp/optimize.c $(CXX_TREE_H) rtl.h integrate.h insn-config.h \
+ input.h $(PARAMS_H) debug.h tree-inline.h
+cp/mangle.o: cp/mangle.c $(CXX_TREE_H) toplev.h
+
+cp/parse.o: cp/parse.c $(CXX_TREE_H) flags.h cp/lex.h except.h output.h \
+ $(SYSTEM_H) toplev.h $(GGC_H)
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \
+ $(srcdir)/cp/parse.c $(OUTPUT_OPTION)
#
-# Maintenance hooks:
-
-# This target creates the files that can be rebuilt, but go in the
-# distribution anyway. It then copies the files to the distdir directory.
-c++.distdir:
- mkdir tmp/cp
- mkdir tmp/cp/inc
- cd cp ; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) parse.c hash.h
- cd cp; \
- for file in *[0-9a-zA-Z+]; do \
- $(LN) $$file ../tmp/cp; \
- done
- cd cp/inc; \
- for file in *[0-9a-zA-Z+]; do \
- ln $$file ../../tmp/cp/inc >/dev/null 2>&1 \
- || cp $$file ../../tmp/cp/inc; \
- done
+# These exist for maintenance purposes.
+
+# Update the tags table.
+cp/TAGS: force
+ cd $(srcdir)/cp ; \
+ etags --no-globals -l c `echo *.c | sed 's/parse.c//'` \
+ parse.y *.h ../*.c ../*.h;
+
+.PHONY: cp/TAGS
diff --git a/contrib/gcc/cp/NEWS b/contrib/gcc/cp/NEWS
index 1a242ab..a55b484 100644
--- a/contrib/gcc/cp/NEWS
+++ b/contrib/gcc/cp/NEWS
@@ -1,3 +1,93 @@
+*** Changes in GCC 3.1:
+
+* -fhonor-std and -fno-honor-std have been removed. -fno-honor-std was
+ a workaround to allow std compliant code to work with the non-std
+ compliant libstdc++-v2. libstdc++-v3 is std compliant.
+
+* The C++ ABI has been changed to correctly handle this code:
+
+ struct A {
+ void operator delete[] (void *, size_t);
+ };
+
+ struct B : public A {
+ };
+
+ new B[10];
+
+ The amount of storage allocated for the array will be greater than
+ it was in 3.0, in order to store the number of elements in the
+ array, so that the correct size can be passed to `operator delete[]'
+ when the array is deleted. Previously, the value passed to
+ `operator delete[]' was unpredictable.
+
+ This change will only affect code that declares a two-argument
+ `operator delete[]' with a second parameter of type `size_t'
+ in a base class, and does not override that definition in a
+ derived class.
+
+* The C++ ABI has been changed so that:
+
+ struct A {
+ void operator delete[] (void *, size_t);
+ void operator delete[] (void *);
+ };
+
+ does not cause unnecessary storage to be allocated when an array of
+ `A' objects is allocated.
+
+ This change will only affect code that declares both of these
+ forms of `operator delete[]', and declared the two-argument form
+ before the one-argument form.
+
+* The C++ ABI has been changed so that when a parameter is passed by value,
+ any cleanup for that parameter is performed in the caller, as specified
+ by the ia64 C++ ABI, rather than the called function as before.
+
+*** Changes in GCC 3.0:
+
+* Support for guiding declarations has been removed.
+
+* G++ now supports importing member functions from base classes with a
+ using-declaration.
+
+* G++ now enforces access control for nested types.
+
+* In some obscure cases, functions with the same type could have the
+ same mangled name. This bug caused compiler crashes, link-time clashes,
+ and debugger crashes. Fixing this bug required breaking ABI
+ compatibility for the functions involved. The functions in questions
+ are those whose types involve non-type template arguments whose
+ mangled representations require more than one digit.
+
+* Support for assignment to `this' has been removed. This idiom
+ was used in the very early days of C++, before users were allowed
+ to overload `operator new'; it is no longer allowed by the C++
+ standard.
+
+* Support for signatures, a G++ extension, have been removed.
+
+* Certain invalid conversions that were previously accepted will now
+ be rejected. For example, assigning function pointers of one type
+ to function pointers of another type now requires a cast, whereas
+ previously g++ would sometimes accept the code even without the
+ cast.
+
+* G++ previously allowed `sizeof (X::Y)' where Y was a non-static
+ member of X, even if the `sizeof' expression occurred outside
+ of a non-static member function of X (or one of its derived classes,
+ or a member-initializer for X or one of its derived classes.) This
+ extension has been removed.
+
+* G++ no longer allows you to overload the conditional operator (i.e.,
+ the `?:' operator.)
+
+* The "named return value" extension:
+
+ int f () return r { r = 3; }
+
+ has been deprecated, and will be removed in a future version of G++.
+
*** Changes in GCC 2.95:
* Messages about non-conformant code that we can still handle ("pedwarns")
diff --git a/contrib/gcc/cp/call.c b/contrib/gcc/cp/call.c
index a931500..cf6f0b4 100644
--- a/contrib/gcc/cp/call.c
+++ b/contrib/gcc/cp/call.c
@@ -1,5 +1,6 @@
/* Functions related to invoking methods and overloaded functions.
- Copyright (C) 1987, 92-97, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) and
modified by Brendan Kehoe (brendan@cygnus.com).
@@ -31,68 +32,76 @@ Boston, MA 02111-1307, USA. */
#include "flags.h"
#include "rtl.h"
#include "toplev.h"
-
-#include "obstack.h"
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
+#include "expr.h"
+#include "ggc.h"
+#include "diagnostic.h"
extern int inhibit_warnings;
-extern tree ctor_label, dtor_label;
-
-static tree build_new_method_call PROTO((tree, tree, tree, tree, int));
-
-static tree build_field_call PROTO((tree, tree, tree, tree));
-static tree find_scoped_type PROTO((tree, tree, tree));
-static struct z_candidate * tourney PROTO((struct z_candidate *));
-static int joust PROTO((struct z_candidate *, struct z_candidate *, int));
-static int compare_ics PROTO((tree, tree));
-static tree build_over_call PROTO((struct z_candidate *, tree, int));
-static tree convert_like PROTO((tree, tree));
-static void op_error PROTO((enum tree_code, enum tree_code, tree, tree,
+
+static tree build_new_method_call PARAMS ((tree, tree, tree, tree, int));
+
+static tree build_field_call PARAMS ((tree, tree, tree, tree));
+static struct z_candidate * tourney PARAMS ((struct z_candidate *));
+static int equal_functions PARAMS ((tree, tree));
+static int joust PARAMS ((struct z_candidate *, struct z_candidate *, int));
+static int compare_ics PARAMS ((tree, tree));
+static tree build_over_call PARAMS ((struct z_candidate *, tree, int));
+static tree build_java_interface_fn_ref PARAMS ((tree, tree));
+#define convert_like(CONV, EXPR) \
+ convert_like_real ((CONV), (EXPR), NULL_TREE, 0, 0)
+#define convert_like_with_context(CONV, EXPR, FN, ARGNO) \
+ convert_like_real ((CONV), (EXPR), (FN), (ARGNO), 0)
+static tree convert_like_real PARAMS ((tree, tree, tree, int, int));
+static void op_error PARAMS ((enum tree_code, enum tree_code, tree, tree,
tree, const char *));
-static tree build_object_call PROTO((tree, tree));
-static tree resolve_args PROTO((tree));
+static tree build_object_call PARAMS ((tree, tree));
+static tree resolve_args PARAMS ((tree));
static struct z_candidate * build_user_type_conversion_1
- PROTO ((tree, tree, int));
-static void print_z_candidates PROTO((struct z_candidate *));
-static tree build_this PROTO((tree));
-static struct z_candidate * splice_viable PROTO((struct z_candidate *));
-static int any_viable PROTO((struct z_candidate *));
+ PARAMS ((tree, tree, int));
+static void print_z_candidates PARAMS ((struct z_candidate *));
+static tree build_this PARAMS ((tree));
+static struct z_candidate * splice_viable PARAMS ((struct z_candidate *));
+static int any_viable PARAMS ((struct z_candidate *));
static struct z_candidate * add_template_candidate
- PROTO((struct z_candidate *, tree, tree, tree, tree, int,
+ PARAMS ((struct z_candidate *, tree, tree, tree, tree, tree, int,
unification_kind_t));
static struct z_candidate * add_template_candidate_real
- PROTO((struct z_candidate *, tree, tree, tree, tree, int,
+ PARAMS ((struct z_candidate *, tree, tree, tree, tree, tree, int,
tree, unification_kind_t));
static struct z_candidate * add_template_conv_candidate
- PROTO((struct z_candidate *, tree, tree, tree, tree));
+ PARAMS ((struct z_candidate *, tree, tree, tree, tree));
static struct z_candidate * add_builtin_candidates
- PROTO((struct z_candidate *, enum tree_code, enum tree_code,
+ PARAMS ((struct z_candidate *, enum tree_code, enum tree_code,
tree, tree *, int));
static struct z_candidate * add_builtin_candidate
- PROTO((struct z_candidate *, enum tree_code, enum tree_code,
+ PARAMS ((struct z_candidate *, enum tree_code, enum tree_code,
tree, tree, tree, tree *, tree *, int));
-static int is_complete PROTO((tree));
+static int is_complete PARAMS ((tree));
static struct z_candidate * build_builtin_candidate
- PROTO((struct z_candidate *, tree, tree, tree, tree *, tree *,
+ PARAMS ((struct z_candidate *, tree, tree, tree, tree *, tree *,
int));
static struct z_candidate * add_conv_candidate
- PROTO((struct z_candidate *, tree, tree, tree));
+ PARAMS ((struct z_candidate *, tree, tree, tree));
static struct z_candidate * add_function_candidate
- PROTO((struct z_candidate *, tree, tree, int));
-static tree implicit_conversion PROTO((tree, tree, tree, int));
-static tree standard_conversion PROTO((tree, tree, tree));
-static tree reference_binding PROTO((tree, tree, tree, int));
-static tree strip_top_quals PROTO((tree));
-static tree non_reference PROTO((tree));
-static tree build_conv PROTO((enum tree_code, tree, tree));
-static int is_subseq PROTO((tree, tree));
-static int maybe_handle_ref_bind PROTO((tree*, tree*));
-static void maybe_handle_implicit_object PROTO((tree*));
-static struct z_candidate * add_candidate PROTO((struct z_candidate *,
- tree, tree, int));
-static tree source_type PROTO((tree));
-static void add_warning PROTO((struct z_candidate *, struct z_candidate *));
+ PARAMS ((struct z_candidate *, tree, tree, tree, int));
+static tree implicit_conversion PARAMS ((tree, tree, tree, int));
+static tree standard_conversion PARAMS ((tree, tree, tree));
+static tree reference_binding PARAMS ((tree, tree, tree, int));
+static tree non_reference PARAMS ((tree));
+static tree build_conv PARAMS ((enum tree_code, tree, tree));
+static int is_subseq PARAMS ((tree, tree));
+static tree maybe_handle_ref_bind PARAMS ((tree*));
+static void maybe_handle_implicit_object PARAMS ((tree*));
+static struct z_candidate * add_candidate PARAMS ((struct z_candidate *,
+ tree, tree, int));
+static tree source_type PARAMS ((tree));
+static void add_warning PARAMS ((struct z_candidate *, struct z_candidate *));
+static int reference_related_p PARAMS ((tree, tree));
+static int reference_compatible_p PARAMS ((tree, tree));
+static tree convert_class_to_reference PARAMS ((tree, tree, tree));
+static tree direct_reference_binding PARAMS ((tree, tree));
+static int promoted_arithmetic_type_p PARAMS ((tree));
+static tree conditional_conversion PARAMS ((tree, tree));
tree
build_vfield_ref (datum, type)
@@ -106,11 +115,11 @@ build_vfield_ref (datum, type)
if (TREE_CODE (TREE_TYPE (datum)) == REFERENCE_TYPE)
datum = convert_from_reference (datum);
- if (! TYPE_USES_COMPLEX_INHERITANCE (type))
- rval = build (COMPONENT_REF, TREE_TYPE (CLASSTYPE_VFIELD (type)),
- datum, CLASSTYPE_VFIELD (type));
+ if (! TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (type))
+ rval = build (COMPONENT_REF, TREE_TYPE (TYPE_VFIELD (type)),
+ datum, TYPE_VFIELD (type));
else
- rval = build_component_ref (datum, DECL_NAME (CLASSTYPE_VFIELD (type)), NULL_TREE, 0);
+ rval = build_component_ref (datum, DECL_NAME (TYPE_VFIELD (type)), NULL_TREE, 0);
return rval;
}
@@ -124,7 +133,7 @@ build_field_call (basetype_path, instance_ptr, name, parms)
{
tree field, instance;
- if (name == ctor_identifier || name == dtor_identifier)
+ if (IDENTIFIER_CTOR_OR_DTOR_P (name))
return NULL_TREE;
/* Speed up the common case. */
@@ -141,7 +150,7 @@ build_field_call (basetype_path, instance_ptr, name, parms)
{
/* If it's a field, try overloading operator (),
or calling if the field is a pointer-to-function. */
- instance = build_indirect_ref (instance_ptr, NULL_PTR);
+ instance = build_indirect_ref (instance_ptr, NULL);
instance = build_component_ref_1 (instance, field, 0);
if (instance == error_mark_node)
@@ -150,144 +159,16 @@ build_field_call (basetype_path, instance_ptr, name, parms)
if (IS_AGGR_TYPE (TREE_TYPE (instance)))
return build_opfncall (CALL_EXPR, LOOKUP_NORMAL,
instance, parms, NULL_TREE);
- else if (TREE_CODE (TREE_TYPE (instance)) == POINTER_TYPE)
- {
- if (TREE_CODE (TREE_TYPE (TREE_TYPE (instance))) == FUNCTION_TYPE)
- return build_function_call (instance, parms);
- else if (TREE_CODE (TREE_TYPE (TREE_TYPE (instance)))
- == METHOD_TYPE)
- return build_function_call
- (instance, expr_tree_cons (NULL_TREE, instance_ptr, parms));
- }
- }
-
- return NULL_TREE;
-}
-
-static tree
-find_scoped_type (type, inner_name, inner_types)
- tree type, inner_name, inner_types;
-{
- tree tags = CLASSTYPE_TAGS (type);
-
- while (tags)
- {
- /* The TREE_PURPOSE of an enum tag (which becomes a member of the
- enclosing class) is set to the name for the enum type. So, if
- inner_name is `bar', and we strike `baz' for `enum bar { baz }',
- then this test will be true. */
- if (TREE_PURPOSE (tags) == inner_name)
- {
- if (inner_types == NULL_TREE)
- return TYPE_MAIN_DECL (TREE_VALUE (tags));
- return resolve_scope_to_name (TREE_VALUE (tags), inner_types);
- }
- tags = TREE_CHAIN (tags);
+ else if (TREE_CODE (TREE_TYPE (instance)) == FUNCTION_TYPE
+ || (TREE_CODE (TREE_TYPE (instance)) == POINTER_TYPE
+ && (TREE_CODE (TREE_TYPE (TREE_TYPE (instance)))
+ == FUNCTION_TYPE)))
+ return build_function_call (instance, parms);
}
- /* Look for a TYPE_DECL. */
- for (tags = TYPE_FIELDS (type); tags; tags = TREE_CHAIN (tags))
- if (TREE_CODE (tags) == TYPE_DECL && DECL_NAME (tags) == inner_name)
- {
- /* Code by raeburn. */
- if (inner_types == NULL_TREE)
- return tags;
- return resolve_scope_to_name (TREE_TYPE (tags), inner_types);
- }
-
return NULL_TREE;
}
-/* Resolve an expression NAME1::NAME2::...::NAMEn to
- the name that names the above nested type. INNER_TYPES
- is a chain of nested type names (held together by SCOPE_REFs);
- OUTER_TYPE is the type we know to enclose INNER_TYPES.
- Returns NULL_TREE if there is an error. */
-
-tree
-resolve_scope_to_name (outer_type, inner_stuff)
- tree outer_type, inner_stuff;
-{
- register tree tmp;
- tree inner_name, inner_type;
-
- if (outer_type == NULL_TREE && current_class_type != NULL_TREE)
- {
- /* We first try to look for a nesting in our current class context,
- then try any enclosing classes. */
- tree type = current_class_type;
-
- while (type && (TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE))
- {
- tree rval = resolve_scope_to_name (type, inner_stuff);
-
- if (rval != NULL_TREE)
- return rval;
- type = DECL_CONTEXT (TYPE_MAIN_DECL (type));
- }
- }
-
- if (TREE_CODE (inner_stuff) == SCOPE_REF)
- {
- inner_name = TREE_OPERAND (inner_stuff, 0);
- inner_type = TREE_OPERAND (inner_stuff, 1);
- }
- else
- {
- inner_name = inner_stuff;
- inner_type = NULL_TREE;
- }
-
- if (outer_type == NULL_TREE)
- {
- tree x;
- /* If we have something that's already a type by itself,
- use that. */
- if (IDENTIFIER_HAS_TYPE_VALUE (inner_name))
- {
- if (inner_type)
- return resolve_scope_to_name (IDENTIFIER_TYPE_VALUE (inner_name),
- inner_type);
- return inner_name;
- }
-
- x = lookup_name (inner_name, 0);
-
- if (x && TREE_CODE (x) == NAMESPACE_DECL)
- {
- x = lookup_namespace_name (x, inner_type);
- return x;
- }
- return NULL_TREE;
- }
-
- if (! IS_AGGR_TYPE (outer_type))
- return NULL_TREE;
-
- /* Look for member classes or enums. */
- tmp = find_scoped_type (outer_type, inner_name, inner_type);
-
- /* If it's not a type in this class, then go down into the
- base classes and search there. */
- if (! tmp && TYPE_BINFO (outer_type))
- {
- tree binfos = TYPE_BINFO_BASETYPES (outer_type);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tmp = resolve_scope_to_name (BINFO_TYPE (base_binfo), inner_stuff);
- if (tmp)
- return tmp;
- }
- tmp = NULL_TREE;
- }
-
- return tmp;
-}
-
/* Returns nonzero iff the destructor name specified in NAME
(a BIT_NOT_EXPR) matches BASETYPE. The operand of NAME can take many
forms... */
@@ -304,7 +185,7 @@ check_dtor_name (basetype, name)
if (TREE_CODE (name) == TYPE_DECL)
name = TREE_TYPE (name);
- else if (TREE_CODE_CLASS (TREE_CODE (name)) == 't')
+ else if (TYPE_P (name))
/* OK */;
else if (TREE_CODE (name) == IDENTIFIER_NODE)
{
@@ -315,8 +196,17 @@ check_dtor_name (basetype, name)
else
name = get_type_value (name);
}
+ /* In the case of:
+
+ template <class T> struct S { ~S(); };
+ int i;
+ i.~S();
+
+ NAME will be a class template. */
+ else if (DECL_CLASS_TEMPLATE_P (name))
+ return 0;
else
- my_friendly_abort (980605);
+ abort ();
if (name && TYPE_MAIN_VARIANT (basetype) == TYPE_MAIN_VARIANT (name))
return 1;
@@ -377,7 +267,7 @@ build_scoped_method_call (exp, basetype, name, parms)
return build_method_call (exp, name, parms, NULL_TREE, LOOKUP_NORMAL);
if (! check_dtor_name (basetype, name))
- cp_error ("qualified type `%T' does not match destructor name `~%T'",
+ error ("qualified type `%T' does not match destructor name `~%T'",
basetype, TREE_OPERAND (name, 0));
/* Destructors can be "called" for simple types; see 5.2.4 and 12.4 Note
@@ -386,26 +276,31 @@ build_scoped_method_call (exp, basetype, name, parms)
if (! IS_AGGR_TYPE (basetype))
{
if (TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (basetype))
- cp_error ("type of `%E' does not match destructor type `%T' (type was `%T')",
+ error ("type of `%E' does not match destructor type `%T' (type was `%T')",
exp, basetype, type);
return cp_convert (void_type_node, exp);
}
}
+ if (TREE_CODE (basetype) == NAMESPACE_DECL)
+ {
+ error ("`%D' is a namespace", basetype);
+ return error_mark_node;
+ }
if (! is_aggr_type (basetype, 1))
return error_mark_node;
if (! IS_AGGR_TYPE (type))
{
- cp_error ("base object `%E' of scoped method call is of non-aggregate type `%T'",
+ error ("base object `%E' of scoped method call is of non-aggregate type `%T'",
exp, type);
return error_mark_node;
}
if (! binfo)
{
- binfo = get_binfo (basetype, type, 1);
+ binfo = lookup_base (type, basetype, ba_check, NULL);
if (binfo == error_mark_node)
return error_mark_node;
if (! binfo)
@@ -415,9 +310,12 @@ build_scoped_method_call (exp, basetype, name, parms)
if (binfo)
{
if (TREE_CODE (exp) == INDIRECT_REF)
- decl = build_indirect_ref
- (convert_pointer_to_real
- (binfo, build_unary_op (ADDR_EXPR, exp, 0)), NULL_PTR);
+ {
+ decl = build_base_path (PLUS_EXPR,
+ build_unary_op (ADDR_EXPR, exp, 0),
+ binfo, 1);
+ decl = build_indirect_ref (decl, NULL);
+ }
else
decl = build_scoped_ref (exp, basetype);
@@ -427,7 +325,8 @@ build_scoped_method_call (exp, basetype, name, parms)
if (! TYPE_HAS_DESTRUCTOR (TREE_TYPE (decl)))
return cp_convert (void_type_node, exp);
- return build_delete (TREE_TYPE (decl), decl, integer_two_node,
+ return build_delete (TREE_TYPE (decl), decl,
+ sfk_complete_destructor,
LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR,
0);
}
@@ -479,12 +378,14 @@ build_addr_func (function)
(TYPE_PTRMEMFUNC_P) must be handled by our callers. */
tree
-build_call (function, result_type, parms)
- tree function, result_type, parms;
+build_call (function, parms)
+ tree function, parms;
{
int is_constructor = 0;
+ int nothrow;
tree tmp;
tree decl;
+ tree result_type;
function = build_addr_func (function);
@@ -494,17 +395,36 @@ build_call (function, result_type, parms)
return error_mark_node;
}
+ result_type = TREE_TYPE (TREE_TYPE (TREE_TYPE (function)));
+
if (TREE_CODE (function) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL)
decl = TREE_OPERAND (function, 0);
else
decl = NULL_TREE;
+ /* We check both the decl and the type; a function may be known not to
+ throw without being declared throw(). */
+ nothrow = ((decl && TREE_NOTHROW (decl))
+ || TYPE_NOTHROW_P (TREE_TYPE (TREE_TYPE (function))));
+
+ if (decl && TREE_DEPRECATED (decl))
+ warn_deprecated_use (decl);
+
if (decl && DECL_CONSTRUCTOR_P (decl))
is_constructor = 1;
- if (decl)
- my_friendly_assert (TREE_USED (decl), 990125);
+ if (decl && ! TREE_USED (decl))
+ {
+ /* We invoke build_call directly for several library functions.
+ These may have been declared normally if we're building libgcc,
+ so we can't just check DECL_ARTIFICIAL. */
+ if (DECL_ARTIFICIAL (decl)
+ || !strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "__", 2))
+ mark_used (decl);
+ else
+ abort ();
+ }
/* Don't pass empty class objects by value. This is useful
for tags in STL, which are used to control overload resolution.
@@ -514,10 +434,7 @@ build_call (function, result_type, parms)
if (is_empty_class (TREE_TYPE (TREE_VALUE (tmp)))
&& ! TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (tmp))))
{
- tree t = make_node (RTL_EXPR);
- TREE_TYPE (t) = TREE_TYPE (TREE_VALUE (tmp));
- RTL_EXPR_RTL (t) = const0_rtx;
- RTL_EXPR_SEQUENCE (t) = NULL_RTX;
+ tree t = build (EMPTY_CLASS_EXPR, TREE_TYPE (TREE_VALUE (tmp)));
TREE_VALUE (tmp) = build (COMPOUND_EXPR, TREE_TYPE (t),
TREE_VALUE (tmp), t);
}
@@ -526,6 +443,7 @@ build_call (function, result_type, parms)
TREE_HAS_CONSTRUCTOR (function) = is_constructor;
TREE_TYPE (function) = result_type;
TREE_SIDE_EFFECTS (function) = 1;
+ TREE_NOTHROW (function) = nothrow;
return function;
}
@@ -562,6 +480,10 @@ build_call (function, result_type, parms)
`operator()()' is defined for the type of that field, then we return
that result. */
+#ifdef GATHER_STATISTICS
+extern int n_build_method_call;
+#endif
+
tree
build_method_call (instance, name, parms, basetype_path, flags)
tree instance, name, parms, basetype_path;
@@ -608,7 +530,7 @@ build_method_call (instance, name, parms, basetype_path, flags)
basetype = TREE_TYPE (basetype);
if (! check_dtor_name (basetype, name))
- cp_error
+ error
("destructor name `~%T' does not match type `%T' of expression",
TREE_OPERAND (name, 0), basetype);
@@ -617,7 +539,7 @@ build_method_call (instance, name, parms, basetype_path, flags)
instance = default_conversion (instance);
instance_ptr = build_unary_op (ADDR_EXPR, instance, 0);
return build_delete (build_pointer_type (basetype),
- instance_ptr, integer_two_node,
+ instance_ptr, sfk_complete_destructor,
LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 0);
}
@@ -647,7 +569,7 @@ struct z_candidate {
#define BAD_RANK 7
#define ICS_RANK(NODE) \
- (ICS_BAD_FLAG (NODE) ? BAD_RANK \
+ (ICS_BAD_FLAG (NODE) ? BAD_RANK \
: ICS_ELLIPSIS_FLAG (NODE) ? ELLIPSIS_RANK \
: ICS_USER_FLAG (NODE) ? USER_RANK \
: ICS_STD_RANK (NODE))
@@ -659,6 +581,10 @@ struct z_candidate {
#define ICS_THIS_FLAG(NODE) TREE_LANG_FLAG_2 (NODE)
#define ICS_BAD_FLAG(NODE) TREE_LANG_FLAG_3 (NODE)
+/* In a REF_BIND or a BASE_CONV, this indicates that a temporary
+ should be created to hold the result of the conversion. */
+#define NEED_TEMPORARY_P(NODE) TREE_LANG_FLAG_4 (NODE)
+
#define USER_CONV_CAND(NODE) \
((struct z_candidate *)WRAPPER_PTR (TREE_OPERAND (NODE, 1)))
#define USER_CONV_FN(NODE) (USER_CONV_CAND (NODE)->fn)
@@ -667,19 +593,46 @@ int
null_ptr_cst_p (t)
tree t;
{
+ /* [conv.ptr]
+
+ A null pointer constant is an integral constant expression
+ (_expr.const_) rvalue of integer type that evaluates to zero. */
if (t == null_node
- || (integer_zerop (t) && TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE))
+ || (CP_INTEGRAL_TYPE_P (TREE_TYPE (t)) && integer_zerop (t)))
return 1;
return 0;
}
+
+/* Returns non-zero if PARMLIST consists of only default parms and/or
+ ellipsis. */
+
+int
+sufficient_parms_p (parmlist)
+ tree parmlist;
+{
+ for (; parmlist && parmlist != void_list_node;
+ parmlist = TREE_CHAIN (parmlist))
+ if (!TREE_PURPOSE (parmlist))
+ return 0;
+ return 1;
+}
+
static tree
build_conv (code, type, from)
enum tree_code code;
tree type, from;
{
- tree t = build1 (code, type, from);
+ tree t;
int rank = ICS_STD_RANK (from);
+
+ /* We can't use buildl1 here because CODE could be USER_CONV, which
+ takes two arguments. In that case, the caller is responsible for
+ filling in the second argument. */
+ t = make_node (code);
+ TREE_TYPE (t) = type;
+ TREE_OPERAND (t, 0) = from;
+
switch (code)
{
case PTR_CONV:
@@ -703,6 +656,9 @@ build_conv (code, type, from)
return t;
}
+/* If T is a REFERENCE_TYPE return the type to which T refers.
+ Otherwise, return T itself. */
+
static tree
non_reference (t)
tree t;
@@ -712,7 +668,7 @@ non_reference (t)
return t;
}
-static tree
+tree
strip_top_quals (t)
tree t;
{
@@ -746,7 +702,7 @@ standard_conversion (to, from, expr)
if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to))
&& expr && type_unknown_p (expr))
{
- expr = instantiate_type (to, expr, 0);
+ expr = instantiate_type (to, expr, itf_none);
if (expr == error_mark_node)
return NULL_TREE;
from = TREE_TYPE (expr);
@@ -769,10 +725,30 @@ standard_conversion (to, from, expr)
fcode = TREE_CODE (from);
conv = build_conv (LVALUE_CONV, from, conv);
}
- else if (fromref || (expr && real_lvalue_p (expr)))
+ else if (fromref || (expr && lvalue_p (expr)))
conv = build_conv (RVALUE_CONV, from, conv);
- if (from == to)
+ /* Allow conversion between `__complex__' data types */
+ if (tcode == COMPLEX_TYPE && fcode == COMPLEX_TYPE)
+ {
+ /* The standard conversion sequence to convert FROM to TO is
+ the standard conversion sequence to perform componentwise
+ conversion. */
+ tree part_conv = standard_conversion
+ (TREE_TYPE (to), TREE_TYPE (from), NULL_TREE);
+
+ if (part_conv)
+ {
+ conv = build_conv (TREE_CODE (part_conv), to, conv);
+ ICS_STD_RANK (conv) = ICS_STD_RANK (part_conv);
+ }
+ else
+ conv = NULL_TREE;
+
+ return conv;
+ }
+
+ if (same_type_p (from, to))
return conv;
if ((tcode == POINTER_TYPE || TYPE_PTRMEMFUNC_P (to))
@@ -780,31 +756,48 @@ standard_conversion (to, from, expr)
{
conv = build_conv (STD_CONV, to, conv);
}
+ else if ((tcode == INTEGER_TYPE && fcode == POINTER_TYPE)
+ || (tcode == POINTER_TYPE && fcode == INTEGER_TYPE))
+ {
+ /* For backwards brain damage compatibility, allow interconversion of
+ pointers and integers with a pedwarn. */
+ conv = build_conv (STD_CONV, to, conv);
+ ICS_BAD_FLAG (conv) = 1;
+ }
+ else if (tcode == ENUMERAL_TYPE && fcode == INTEGER_TYPE
+ && TYPE_PRECISION (to) == TYPE_PRECISION (from))
+ {
+ /* For backwards brain damage compatibility, allow interconversion of
+ enums and integers with a pedwarn. */
+ conv = build_conv (STD_CONV, to, conv);
+ ICS_BAD_FLAG (conv) = 1;
+ }
else if (tcode == POINTER_TYPE && fcode == POINTER_TYPE)
{
enum tree_code ufcode = TREE_CODE (TREE_TYPE (from));
enum tree_code utcode = TREE_CODE (TREE_TYPE (to));
- if (same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (from)),
- TYPE_MAIN_VARIANT (TREE_TYPE (to))))
+ if (same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (from),
+ TREE_TYPE (to)))
;
else if (utcode == VOID_TYPE && ufcode != OFFSET_TYPE
&& ufcode != FUNCTION_TYPE)
{
from = build_pointer_type
(cp_build_qualified_type (void_type_node,
- CP_TYPE_QUALS (TREE_TYPE (from))));
+ cp_type_quals (TREE_TYPE (from))));
conv = build_conv (PTR_CONV, from, conv);
}
else if (ufcode == OFFSET_TYPE && utcode == OFFSET_TYPE)
{
tree fbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (from));
tree tbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (to));
+ tree binfo = lookup_base (tbase, fbase, ba_check, NULL);
- if (DERIVED_FROM_P (fbase, tbase)
- && (same_type_p
- (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (from))),
- TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (to))))))
+ if (binfo && !binfo_from_vbase (binfo)
+ && (same_type_ignoring_top_level_qualifiers_p
+ (TREE_TYPE (TREE_TYPE (from)),
+ TREE_TYPE (TREE_TYPE (to)))))
{
from = build_offset_type (tbase, TREE_TYPE (TREE_TYPE (from)));
from = build_pointer_type (from);
@@ -818,7 +811,7 @@ standard_conversion (to, from, expr)
{
from =
cp_build_qualified_type (TREE_TYPE (to),
- CP_TYPE_QUALS (TREE_TYPE (from)));
+ cp_type_quals (TREE_TYPE (from)));
from = build_pointer_type (from);
conv = build_conv (PTR_CONV, from, conv);
}
@@ -847,15 +840,16 @@ standard_conversion (to, from, expr)
tree tofn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (to));
tree fbase = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fromfn)));
tree tbase = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (tofn)));
+ tree binfo = lookup_base (tbase, fbase, ba_check, NULL);
- if (! DERIVED_FROM_P (fbase, tbase)
- || ! same_type_p (TREE_TYPE (fromfn), TREE_TYPE (tofn))
- || ! compparms (TREE_CHAIN (TYPE_ARG_TYPES (fromfn)),
- TREE_CHAIN (TYPE_ARG_TYPES (tofn)))
- || CP_TYPE_QUALS (fbase) != CP_TYPE_QUALS (tbase))
+ if (!binfo || binfo_from_vbase (binfo)
+ || !same_type_p (TREE_TYPE (fromfn), TREE_TYPE (tofn))
+ || !compparms (TREE_CHAIN (TYPE_ARG_TYPES (fromfn)),
+ TREE_CHAIN (TYPE_ARG_TYPES (tofn)))
+ || cp_type_quals (fbase) != cp_type_quals (tbase))
return 0;
- from = cp_build_qualified_type (tbase, CP_TYPE_QUALS (fbase));
+ from = cp_build_qualified_type (tbase, cp_type_quals (fbase));
from = build_cplus_method_type (from, TREE_TYPE (fromfn),
TREE_CHAIN (TYPE_ARG_TYPES (fromfn)));
from = build_ptrmemfunc_type (build_pointer_type (from));
@@ -887,11 +881,16 @@ standard_conversion (to, from, expr)
ICS_STD_RANK (conv) = PROMO_RANK;
}
else if (IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from)
- && DERIVED_FROM_P (to, from))
+ && is_properly_derived_from (from, to))
{
if (TREE_CODE (conv) == RVALUE_CONV)
conv = TREE_OPERAND (conv, 0);
conv = build_conv (BASE_CONV, to, conv);
+ /* The derived-to-base conversion indicates the initialization
+ of a parameter with base type from an object of a derived
+ type. A temporary object is created to hold the result of
+ the conversion. */
+ NEED_TEMPORARY_P (conv) = 1;
}
else
return 0;
@@ -899,80 +898,344 @@ standard_conversion (to, from, expr)
return conv;
}
+/* Returns non-zero if T1 is reference-related to T2. */
+
+static int
+reference_related_p (t1, t2)
+ tree t1;
+ tree t2;
+{
+ t1 = TYPE_MAIN_VARIANT (t1);
+ t2 = TYPE_MAIN_VARIANT (t2);
+
+ /* [dcl.init.ref]
+
+ Given types "cv1 T1" and "cv2 T2," "cv1 T1" is reference-related
+ to "cv2 T2" if T1 is the same type as T2, or T1 is a base class
+ of T2. */
+ return (same_type_p (t1, t2)
+ || (CLASS_TYPE_P (t1) && CLASS_TYPE_P (t2)
+ && DERIVED_FROM_P (t1, t2)));
+}
+
+/* Returns non-zero if T1 is reference-compatible with T2. */
+
+static int
+reference_compatible_p (t1, t2)
+ tree t1;
+ tree t2;
+{
+ /* [dcl.init.ref]
+
+ "cv1 T1" is reference compatible with "cv2 T2" if T1 is
+ reference-related to T2 and cv1 is the same cv-qualification as,
+ or greater cv-qualification than, cv2. */
+ return (reference_related_p (t1, t2)
+ && at_least_as_qualified_p (t1, t2));
+}
+
+/* Determine whether or not the EXPR (of class type S) can be
+ converted to T as in [over.match.ref]. */
+
+static tree
+convert_class_to_reference (t, s, expr)
+ tree t;
+ tree s;
+ tree expr;
+{
+ tree conversions;
+ tree arglist;
+ tree conv;
+ struct z_candidate *candidates;
+ struct z_candidate *cand;
+
+ /* [over.match.ref]
+
+ Assuming that "cv1 T" is the underlying type of the reference
+ being initialized, and "cv S" is the type of the initializer
+ expression, with S a class type, the candidate functions are
+ selected as follows:
+
+ --The conversion functions of S and its base classes are
+ considered. Those that are not hidden within S and yield type
+ "reference to cv2 T2", where "cv1 T" is reference-compatible
+ (_dcl.init.ref_) with "cv2 T2", are candidate functions.
+
+ The argument list has one argument, which is the initializer
+ expression. */
+
+ candidates = 0;
+
+ /* Conceptually, we should take the address of EXPR and put it in
+ the argument list. Unfortunately, however, that can result in
+ error messages, which we should not issue now because we are just
+ trying to find a conversion operator. Therefore, we use NULL,
+ cast to the appropriate type. */
+ arglist = build_int_2 (0, 0);
+ TREE_TYPE (arglist) = build_pointer_type (s);
+ arglist = build_tree_list (NULL_TREE, arglist);
+
+ for (conversions = lookup_conversions (s);
+ conversions;
+ conversions = TREE_CHAIN (conversions))
+ {
+ tree fns = TREE_VALUE (conversions);
+
+ for (; fns; fns = OVL_NEXT (fns))
+ {
+ tree f = OVL_CURRENT (fns);
+ tree t2 = TREE_TYPE (TREE_TYPE (f));
+ struct z_candidate *old_candidates = candidates;
+
+ /* If this is a template function, try to get an exact
+ match. */
+ if (TREE_CODE (f) == TEMPLATE_DECL)
+ {
+ candidates
+ = add_template_candidate (candidates,
+ f, s,
+ NULL_TREE,
+ arglist,
+ build_reference_type (t),
+ LOOKUP_NORMAL,
+ DEDUCE_CONV);
+
+ if (candidates != old_candidates)
+ {
+ /* Now, see if the conversion function really returns
+ an lvalue of the appropriate type. From the
+ point of view of unification, simply returning an
+ rvalue of the right type is good enough. */
+ f = candidates->fn;
+ t2 = TREE_TYPE (TREE_TYPE (f));
+ if (TREE_CODE (t2) != REFERENCE_TYPE
+ || !reference_compatible_p (t, TREE_TYPE (t2)))
+ candidates = candidates->next;
+ }
+ }
+ else if (TREE_CODE (t2) == REFERENCE_TYPE
+ && reference_compatible_p (t, TREE_TYPE (t2)))
+ candidates
+ = add_function_candidate (candidates, f, s, arglist,
+ LOOKUP_NORMAL);
+
+ if (candidates != old_candidates)
+ candidates->basetype_path = TYPE_BINFO (s);
+ }
+ }
+
+ /* If none of the conversion functions worked out, let our caller
+ know. */
+ if (!any_viable (candidates))
+ return NULL_TREE;
+
+ candidates = splice_viable (candidates);
+ cand = tourney (candidates);
+ if (!cand)
+ return NULL_TREE;
+
+ conv = build1 (IDENTITY_CONV, s, expr);
+ conv = build_conv (USER_CONV, TREE_TYPE (TREE_TYPE (cand->fn)),
+ conv);
+ TREE_OPERAND (conv, 1) = build_ptr_wrapper (cand);
+ ICS_USER_FLAG (conv) = 1;
+ if (cand->viable == -1)
+ ICS_BAD_FLAG (conv) = 1;
+ cand->second_conv = conv;
+
+ return conv;
+}
+
+/* A reference of the indicated TYPE is being bound directly to the
+ expression represented by the implicit conversion sequence CONV.
+ Return a conversion sequence for this binding. */
+
+static tree
+direct_reference_binding (type, conv)
+ tree type;
+ tree conv;
+{
+ tree t = TREE_TYPE (type);
+
+ /* [over.ics.rank]
+
+ When a parameter of reference type binds directly
+ (_dcl.init.ref_) to an argument expression, the implicit
+ conversion sequence is the identity conversion, unless the
+ argument expression has a type that is a derived class of the
+ parameter type, in which case the implicit conversion sequence is
+ a derived-to-base Conversion.
+
+ If the parameter binds directly to the result of applying a
+ conversion function to the argument expression, the implicit
+ conversion sequence is a user-defined conversion sequence
+ (_over.ics.user_), with the second standard conversion sequence
+ either an identity conversion or, if the conversion function
+ returns an entity of a type that is a derived class of the
+ parameter type, a derived-to-base conversion. */
+ if (!same_type_ignoring_top_level_qualifiers_p (t, TREE_TYPE (conv)))
+ {
+ /* Represent the derived-to-base conversion. */
+ conv = build_conv (BASE_CONV, t, conv);
+ /* We will actually be binding to the base-class subobject in
+ the derived class, so we mark this conversion appropriately.
+ That way, convert_like knows not to generate a temporary. */
+ NEED_TEMPORARY_P (conv) = 0;
+ }
+ return build_conv (REF_BIND, type, conv);
+}
+
/* Returns the conversion path from type FROM to reference type TO for
purposes of reference binding. For lvalue binding, either pass a
- reference type to FROM or an lvalue expression to EXPR.
-
- Currently does not distinguish in the generated trees between binding to
- an lvalue and a temporary. Should it? */
+ reference type to FROM or an lvalue expression to EXPR. If the
+ reference will be bound to a temporary, NEED_TEMPORARY_P is set for
+ the conversion returned. */
static tree
reference_binding (rto, rfrom, expr, flags)
tree rto, rfrom, expr;
int flags;
{
- tree conv;
- int lvalue = 1;
+ tree conv = NULL_TREE;
tree to = TREE_TYPE (rto);
tree from = rfrom;
- int related;
+ int related_p;
+ int compatible_p;
+ cp_lvalue_kind lvalue_p = clk_none;
if (TREE_CODE (to) == FUNCTION_TYPE && expr && type_unknown_p (expr))
{
- expr = instantiate_type (to, expr, 0);
+ expr = instantiate_type (to, expr, itf_none);
if (expr == error_mark_node)
return NULL_TREE;
from = TREE_TYPE (expr);
}
if (TREE_CODE (from) == REFERENCE_TYPE)
- from = TREE_TYPE (from);
- else if (! expr || ! real_lvalue_p (expr))
- lvalue = 0;
+ {
+ /* Anything with reference type is an lvalue. */
+ lvalue_p = clk_ordinary;
+ from = TREE_TYPE (from);
+ }
+ else if (expr)
+ lvalue_p = real_lvalue_p (expr);
- related = (same_type_p (TYPE_MAIN_VARIANT (to),
- TYPE_MAIN_VARIANT (from))
- || (IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from)
- && DERIVED_FROM_P (to, from)));
+ /* Figure out whether or not the types are reference-related and
+ reference compatible. We have do do this after stripping
+ references from FROM. */
+ related_p = reference_related_p (to, from);
+ compatible_p = reference_compatible_p (to, from);
- if (lvalue && related && at_least_as_qualified_p (to, from))
+ if (lvalue_p && compatible_p)
{
- conv = build1 (IDENTITY_CONV, from, expr);
+ /* [dcl.init.ref]
- if (same_type_p (TYPE_MAIN_VARIANT (to),
- TYPE_MAIN_VARIANT (from)))
- conv = build_conv (REF_BIND, rto, conv);
- else
- {
- conv = build_conv (REF_BIND, rto, conv);
- ICS_STD_RANK (conv) = STD_RANK;
- }
+ If the initializer expression
+
+ -- is an lvalue (but not an lvalue for a bit-field), and "cv1 T1"
+ is reference-compatible with "cv2 T2,"
+
+ the reference is bound directly to the initializer exprssion
+ lvalue. */
+ conv = build1 (IDENTITY_CONV, from, expr);
+ conv = direct_reference_binding (rto, conv);
+ if ((lvalue_p & clk_bitfield) != 0
+ && CP_TYPE_CONST_NON_VOLATILE_P (to))
+ /* For the purposes of overload resolution, we ignore the fact
+ this expression is a bitfield. (In particular,
+ [over.ics.ref] says specifically that a function with a
+ non-const reference parameter is viable even if the
+ argument is a bitfield.)
+
+ However, when we actually call the function we must create
+ a temporary to which to bind the reference. If the
+ reference is volatile, or isn't const, then we cannot make
+ a temporary, so we just issue an error when the conversion
+ actually occurs. */
+ NEED_TEMPORARY_P (conv) = 1;
+ return conv;
}
- else
- conv = NULL_TREE;
-
- if (! conv)
+ else if (CLASS_TYPE_P (from) && !(flags & LOOKUP_NO_CONVERSION))
{
- conv = standard_conversion (to, rfrom, expr);
+ /* [dcl.init.ref]
+
+ If the initializer exprsesion
+
+ -- has a class type (i.e., T2 is a class type) can be
+ implicitly converted to an lvalue of type "cv3 T3," where
+ "cv1 T1" is reference-compatible with "cv3 T3". (this
+ conversion is selected by enumerating the applicable
+ conversion functions (_over.match.ref_) and choosing the
+ best one through overload resolution. (_over.match_).
+
+ the reference is bound to the lvalue result of the conversion
+ in the second case. */
+ conv = convert_class_to_reference (to, from, expr);
if (conv)
- {
- conv = build_conv (REF_BIND, rto, conv);
+ return direct_reference_binding (rto, conv);
+ }
- /* Bind directly to a base subobject of a class rvalue. Do it
- after building the conversion for proper handling of ICS_RANK. */
- if (TREE_CODE (TREE_OPERAND (conv, 0)) == BASE_CONV)
- TREE_OPERAND (conv, 0) = TREE_OPERAND (TREE_OPERAND (conv, 0), 0);
- }
- if (conv
- && ((! (CP_TYPE_CONST_NON_VOLATILE_P (to)
- && (flags & LOOKUP_NO_TEMP_BIND) == 0))
- /* If T1 is reference-related to T2, cv1 must be the same
- cv-qualification as, or greater cv-qualification than,
- cv2; otherwise, the program is ill-formed. */
- || (related && !at_least_as_qualified_p (to, from))))
- ICS_BAD_FLAG (conv) = 1;
+ /* From this point on, we conceptually need temporaries, even if we
+ elide them. Only the cases above are "direct bindings". */
+ if (flags & LOOKUP_NO_TEMP_BIND)
+ return NULL_TREE;
+
+ /* [over.ics.rank]
+
+ When a parameter of reference type is not bound directly to an
+ argument expression, the conversion sequence is the one required
+ to convert the argument expression to the underlying type of the
+ reference according to _over.best.ics_. Conceptually, this
+ conversion sequence corresponds to copy-initializing a temporary
+ of the underlying type with the argument expression. Any
+ difference in top-level cv-qualification is subsumed by the
+ initialization itself and does not constitute a conversion. */
+
+ /* [dcl.init.ref]
+
+ Otherwise, the reference shall be to a non-volatile const type. */
+ if (!CP_TYPE_CONST_NON_VOLATILE_P (to))
+ return NULL_TREE;
+
+ /* [dcl.init.ref]
+
+ If the initializer expression is an rvalue, with T2 a class type,
+ and "cv1 T1" is reference-compatible with "cv2 T2", the reference
+ is bound in one of the following ways:
+
+ -- The reference is bound to the object represented by the rvalue
+ or to a sub-object within that object.
+
+ In this case, the implicit conversion sequence is supposed to be
+ same as we would obtain by generating a temporary. Fortunately,
+ if the types are reference compatible, then this is either an
+ identity conversion or the derived-to-base conversion, just as
+ for direct binding. */
+ if (CLASS_TYPE_P (from) && compatible_p)
+ {
+ conv = build1 (IDENTITY_CONV, from, expr);
+ return direct_reference_binding (rto, conv);
}
+ /* [dcl.init.ref]
+
+ Otherwise, a temporary of type "cv1 T1" is created and
+ initialized from the initializer expression using the rules for a
+ non-reference copy initialization. If T1 is reference-related to
+ T2, cv1 must be the same cv-qualification as, or greater
+ cv-qualification than, cv2; otherwise, the program is ill-formed. */
+ if (related_p && !at_least_as_qualified_p (to, from))
+ return NULL_TREE;
+
+ conv = implicit_conversion (to, from, expr, flags);
+ if (!conv)
+ return NULL_TREE;
+
+ conv = build_conv (REF_BIND, rto, conv);
+ /* This reference binding, unlike those above, requires the
+ creation of a temporary. */
+ NEED_TEMPORARY_P (conv) = 1;
+
return conv;
}
@@ -989,6 +1252,23 @@ implicit_conversion (to, from, expr, flags)
tree conv;
struct z_candidate *cand;
+ /* Resolve expressions like `A::p' that we thought might become
+ pointers-to-members. */
+ if (expr && TREE_CODE (expr) == OFFSET_REF)
+ {
+ expr = resolve_offset_ref (expr);
+ from = TREE_TYPE (expr);
+ }
+
+ if (from == error_mark_node || to == error_mark_node
+ || expr == error_mark_node)
+ return NULL_TREE;
+
+ /* Make sure both the FROM and TO types are complete so that
+ user-defined conversions are available. */
+ complete_type (from);
+ complete_type (to);
+
if (TREE_CODE (to) == REFERENCE_TYPE)
conv = reference_binding (to, from, expr, flags);
else
@@ -997,29 +1277,18 @@ implicit_conversion (to, from, expr, flags)
if (conv)
;
else if (expr != NULL_TREE
- && (IS_AGGR_TYPE (non_reference (from))
- || IS_AGGR_TYPE (non_reference (to)))
+ && (IS_AGGR_TYPE (from)
+ || IS_AGGR_TYPE (to))
&& (flags & LOOKUP_NO_CONVERSION) == 0)
{
cand = build_user_type_conversion_1
(to, expr, LOOKUP_ONLYCONVERTING);
if (cand)
conv = cand->second_conv;
- if ((! conv || ICS_BAD_FLAG (conv))
- && TREE_CODE (to) == REFERENCE_TYPE
- && (flags & LOOKUP_NO_TEMP_BIND) == 0)
- {
- cand = build_user_type_conversion_1
- (TYPE_MAIN_VARIANT (TREE_TYPE (to)), expr, LOOKUP_ONLYCONVERTING);
- if (cand)
- {
- if (!CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (to)))
- ICS_BAD_FLAG (cand->second_conv) = 1;
- if (!conv || (ICS_BAD_FLAG (conv)
- > ICS_BAD_FLAG (cand->second_conv)))
- conv = build_conv (REF_BIND, to, cand->second_conv);
- }
- }
+
+ /* We used to try to bind a reference to a temporary here, but that
+ is now handled by the recursive call to this function at the end
+ of reference_binding. */
}
return conv;
@@ -1035,15 +1304,11 @@ add_candidate (candidates, fn, convs, viable)
int viable;
{
struct z_candidate *cand
- = (struct z_candidate *) scratchalloc (sizeof (struct z_candidate));
+ = (struct z_candidate *) ggc_alloc_cleared (sizeof (struct z_candidate));
cand->fn = fn;
cand->convs = convs;
- cand->second_conv = NULL_TREE;
cand->viable = viable;
- cand->basetype_path = NULL_TREE;
- cand->template = NULL_TREE;
- cand->warnings = NULL_TREE;
cand->next = candidates;
return cand;
@@ -1051,12 +1316,15 @@ add_candidate (candidates, fn, convs, viable)
/* Create an overload candidate for the function or method FN called with
the argument list ARGLIST and add it to CANDIDATES. FLAGS is passed on
- to implicit_conversion. */
+ to implicit_conversion.
+
+ CTYPE, if non-NULL, is the type we want to pretend this function
+ comes from for purposes of overload resolution. */
static struct z_candidate *
-add_function_candidate (candidates, fn, arglist, flags)
+add_function_candidate (candidates, fn, ctype, arglist, flags)
struct z_candidate *candidates;
- tree fn, arglist;
+ tree fn, ctype, arglist;
int flags;
{
tree parmlist = TYPE_ARG_TYPES (TREE_TYPE (fn));
@@ -1065,37 +1333,16 @@ add_function_candidate (candidates, fn, arglist, flags)
tree parmnode, argnode;
int viable = 1;
- /* The `this', `in_chrg', and `vlist' arguments to constructors are
- not considered in overload resolution. */
+ /* The `this', `in_chrg' and VTT arguments to constructors are not
+ considered in overload resolution. */
if (DECL_CONSTRUCTOR_P (fn))
{
- parmlist = TREE_CHAIN (parmlist);
- arglist = TREE_CHAIN (arglist);
- if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
- {
- parmlist = TREE_CHAIN (parmlist);
- arglist = TREE_CHAIN (arglist);
- }
- if ((flags & LOOKUP_HAS_VLIST)
- && DECL_CONSTRUCTOR_FOR_PVBASE_P (fn))
- {
- parmlist = TREE_CHAIN (parmlist);
- arglist = TREE_CHAIN (arglist);
- }
- else if (!(flags & LOOKUP_HAS_VLIST)
- && !DECL_CONSTRUCTOR_FOR_PVBASE_P (fn))
- /* Ok */;
- else
- {
- /* The ctor expects a vlist and the arguments don't have
- one, or vice versa, so fn is not even a candidate, since
- the corresponding ctor would be the candidate. */
- return candidates;
- }
+ parmlist = skip_artificial_parms_for (fn, parmlist);
+ arglist = skip_artificial_parms_for (fn, arglist);
}
len = list_length (arglist);
- convs = make_scratch_vec (len);
+ convs = make_tree_vec (len);
/* 13.3.2 - Viable functions [over.match.viable]
First, to be a viable function, a candidate function shall have enough
@@ -1116,13 +1363,8 @@ add_function_candidate (candidates, fn, arglist, flags)
viable = 0;
/* Make sure there are default args for the rest of the parms. */
- else for (; parmnode && parmnode != void_list_node;
- parmnode = TREE_CHAIN (parmnode))
- if (! TREE_PURPOSE (parmnode))
- {
- viable = 0;
- break;
- }
+ else if (!sufficient_parms_p (parmnode))
+ viable = 0;
if (! viable)
goto out;
@@ -1139,25 +1381,31 @@ add_function_candidate (candidates, fn, arglist, flags)
tree arg = TREE_VALUE (argnode);
tree argtype = lvalue_type (arg);
tree t;
+ int is_this;
if (parmnode == void_list_node)
break;
+ is_this = (i == 0 && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
+ && ! DECL_CONSTRUCTOR_P (fn));
+
if (parmnode)
{
tree parmtype = TREE_VALUE (parmnode);
- /* [over.match.funcs] For conversion functions, the function is
- considered to be a member of the class of the implicit object
- argument for the purpose of defining the type of the implicit
- object parameter.
+ /* The type of the implicit object parameter ('this') for
+ overload resolution is not always the same as for the
+ function itself; conversion functions are considered to
+ be members of the class being converted, and functions
+ introduced by a using-declaration are considered to be
+ members of the class that uses them.
- Since build_over_call ignores the ICS for the `this' parameter,
- we can just change the parm type. */
- if (DECL_CONV_FN_P (fn) && i == 0)
+ Since build_over_call ignores the ICS for the `this'
+ parameter, we can just change the parm type. */
+ if (ctype && is_this)
{
parmtype
- = build_qualified_type (TREE_TYPE (argtype),
+ = build_qualified_type (ctype,
TYPE_QUALS (TREE_TYPE (parmtype)));
parmtype = build_pointer_type (parmtype);
}
@@ -1170,8 +1418,7 @@ add_function_candidate (candidates, fn, arglist, flags)
ICS_ELLIPSIS_FLAG (t) = 1;
}
- if (i == 0 && t && TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE
- && ! DECL_CONSTRUCTOR_P (fn))
+ if (t && is_this)
ICS_THIS_FLAG (t) = 1;
TREE_VEC_ELT (convs, i) = t;
@@ -1210,13 +1457,19 @@ add_conv_candidate (candidates, fn, obj, arglist)
tree fn, obj, arglist;
{
tree totype = TREE_TYPE (TREE_TYPE (fn));
- tree parmlist = TYPE_ARG_TYPES (TREE_TYPE (totype));
- int i, len = list_length (arglist) + 1;
- tree convs = make_scratch_vec (len);
- tree parmnode = parmlist;
- tree argnode = arglist;
- int viable = 1;
- int flags = LOOKUP_NORMAL;
+ int i, len, viable, flags;
+ tree parmlist, convs, parmnode, argnode;
+
+ for (parmlist = totype; TREE_CODE (parmlist) != FUNCTION_TYPE; )
+ parmlist = TREE_TYPE (parmlist);
+ parmlist = TYPE_ARG_TYPES (parmlist);
+
+ len = list_length (arglist) + 1;
+ convs = make_tree_vec (len);
+ parmnode = parmlist;
+ argnode = arglist;
+ viable = 1;
+ flags = LOOKUP_NORMAL;
/* Don't bother looking up the same type twice. */
if (candidates && candidates->fn == totype)
@@ -1258,13 +1511,8 @@ add_conv_candidate (candidates, fn, obj, arglist)
if (i < len)
viable = 0;
- for (; parmnode && parmnode != void_list_node;
- parmnode = TREE_CHAIN (parmnode))
- if (! TREE_PURPOSE (parmnode))
- {
- viable = 0;
- break;
- }
+ if (!sufficient_parms_p (parmnode))
+ viable = 0;
return add_candidate (candidates, totype, convs, viable);
}
@@ -1284,7 +1532,7 @@ build_builtin_candidate (candidates, fnname, type1, type2,
types[0] = type1;
types[1] = type2;
- convs = make_scratch_vec (args[2] ? 3 : (args[1] ? 2 : 1));
+ convs = make_tree_vec (args[2] ? 3 : (args[1] ? 2 : 1));
for (i = 0; i < 2; ++i)
{
@@ -1322,13 +1570,36 @@ static int
is_complete (t)
tree t;
{
- return TYPE_SIZE (complete_type (t)) != NULL_TREE;
+ return COMPLETE_TYPE_P (complete_type (t));
+}
+
+/* Returns non-zero if TYPE is a promoted arithmetic type. */
+
+static int
+promoted_arithmetic_type_p (type)
+ tree type;
+{
+ /* [over.built]
+
+ In this section, the term promoted integral type is used to refer
+ to those integral types which are preserved by integral promotion
+ (including e.g. int and long but excluding e.g. char).
+ Similarly, the term promoted arithmetic type refers to promoted
+ integral types plus floating types. */
+ return ((INTEGRAL_TYPE_P (type)
+ && same_type_p (type_promotes_to (type), type))
+ || TREE_CODE (type) == REAL_TYPE);
}
/* Create any builtin operator overload candidates for the operator in
question given the converted operand types TYPE1 and TYPE2. The other
args are passed through from add_builtin_candidates to
- build_builtin_candidate. */
+ build_builtin_candidate.
+
+ TYPE1 and TYPE2 may not be permissible, and we must filter them.
+ If CODE is requires candidates operands of the same type of the kind
+ of which TYPE1 and TYPE2 are, we add both candidates
+ CODE (TYPE1, TYPE1) and CODE (TYPE2, TYPE2). */
static struct z_candidate *
add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
@@ -1376,8 +1647,7 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
return candidates;
case POSTINCREMENT_EXPR:
case PREINCREMENT_EXPR:
- if ((ARITHMETIC_TYPE_P (type1) && TREE_CODE (type1) != ENUMERAL_TYPE)
- || TYPE_PTROB_P (type1))
+ if (ARITHMETIC_TYPE_P (type1) || TYPE_PTROB_P (type1))
{
type1 = build_reference_type (type1);
break;
@@ -1477,8 +1747,8 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
candidate operator functions of the form112)
ptrdiff_t operator-(T, T);
- 16For every pointer type T, there exist candidate operator functions of
- the form
+ 16For every pointer or enumeration type T, there exist candidate operator
+ functions of the form
bool operator<(T, T);
bool operator>(T, T);
bool operator<=(T, T);
@@ -1522,15 +1792,19 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
type1 = type2;
break;
}
+ /* FALLTHROUGH */
case LT_EXPR:
case GT_EXPR:
case LE_EXPR:
case GE_EXPR:
case MAX_EXPR:
case MIN_EXPR:
- if ((ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2))
- || (TYPE_PTR_P (type1) && TYPE_PTR_P (type2)))
+ if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2))
+ break;
+ if (TYPE_PTR_P (type1) && TYPE_PTR_P (type2))
break;
+ if (TREE_CODE (type1) == ENUMERAL_TYPE && TREE_CODE (type2) == ENUMERAL_TYPE)
+ break;
if (TYPE_PTR_P (type1) && null_ptr_cst_p (args[1]))
{
type2 = type1;
@@ -1658,64 +1932,63 @@ add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
return candidates;
default:
- my_friendly_abort (367);
+ abort ();
}
type1 = build_reference_type (type1);
break;
case COND_EXPR:
- /* Kludge around broken overloading rules whereby
- bool ? const char& : enum is ambiguous
- (between int and const char&). */
- flags |= LOOKUP_NO_TEMP_BIND;
-
- /* Extension: Support ?: of enumeral type. Hopefully this will not
- be an extension for long. */
- if (TREE_CODE (type1) == ENUMERAL_TYPE && type1 == type2)
+ /* [over.built]
+
+ For every pair of promoted arithmetic types L and R, there
+ exist candidate operator functions of the form
+
+ LR operator?(bool, L, R);
+
+ where LR is the result of the usual arithmetic conversions
+ between types L and R.
+
+ For every type T, where T is a pointer or pointer-to-member
+ type, there exist candidate operator functions of the form T
+ operator?(bool, T, T); */
+
+ if (promoted_arithmetic_type_p (type1)
+ && promoted_arithmetic_type_p (type2))
+ /* That's OK. */
break;
- else if (TREE_CODE (type1) == ENUMERAL_TYPE
- || TREE_CODE (type2) == ENUMERAL_TYPE)
+
+ /* Otherwise, the types should be pointers. */
+ if (!(TREE_CODE (type1) == POINTER_TYPE
+ || TYPE_PTRMEM_P (type1)
+ || TYPE_PTRMEMFUNC_P (type1))
+ || !(TREE_CODE (type2) == POINTER_TYPE
+ || TYPE_PTRMEM_P (type2)
+ || TYPE_PTRMEMFUNC_P (type2)))
return candidates;
- if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2))
- break;
- if (TREE_CODE (type1) == TREE_CODE (type2)
- && (TREE_CODE (type1) == REFERENCE_TYPE
- || TREE_CODE (type1) == POINTER_TYPE
- || TYPE_PTRMEMFUNC_P (type1)
- || IS_AGGR_TYPE (type1)))
+
+ /* We don't check that the two types are the same; the logic
+ below will actually create two candidates; one in which both
+ parameter types are TYPE1, and one in which both parameter
+ types are TYPE2. */
break;
- if (TREE_CODE (type1) == REFERENCE_TYPE
- || TREE_CODE (type2) == REFERENCE_TYPE)
- return candidates;
- if (((TYPE_PTRMEMFUNC_P (type1) || TREE_CODE (type1) == POINTER_TYPE)
- && null_ptr_cst_p (args[1]))
- || IS_AGGR_TYPE (type1))
- {
- type2 = type1;
- break;
- }
- if (((TYPE_PTRMEMFUNC_P (type2) || TREE_CODE (type2) == POINTER_TYPE)
- && null_ptr_cst_p (args[0]))
- || IS_AGGR_TYPE (type2))
- {
- type1 = type2;
- break;
- }
+
+ /* These arguments do not make for a legal overloaded operator. */
return candidates;
default:
- my_friendly_abort (367);
+ abort ();
}
- /* If we're dealing with two pointer types, we need candidates
- for both of them. */
- if (type2 && type1 != type2
+ /* If we're dealing with two pointer types or two enumeral types,
+ we need candidates for both of them. */
+ if (type2 && !same_type_p (type1, type2)
&& TREE_CODE (type1) == TREE_CODE (type2)
&& (TREE_CODE (type1) == REFERENCE_TYPE
|| (TREE_CODE (type1) == POINTER_TYPE
&& TYPE_PTRMEM_P (type1) == TYPE_PTRMEM_P (type2))
|| TYPE_PTRMEMFUNC_P (type1)
- || IS_AGGR_TYPE (type1)))
+ || IS_AGGR_TYPE (type1)
+ || TREE_CODE (type1) == ENUMERAL_TYPE))
{
candidates = build_builtin_candidate
(candidates, fnname, type1, type1, args, argtypes, flags);
@@ -1743,8 +2016,13 @@ type_decays_to (type)
1) bool-taking candidates. These are the same regardless of the input.
2) pointer-pair taking candidates. These are generated for each type
one of the input types converts to.
- 3) arithmetic candidates. According to the WP, we should generate
- all of these, but I'm trying not to... */
+ 3) arithmetic candidates. According to the standard, we should generate
+ all of these, but I'm trying not to...
+
+ Here we generate a superset of the possible candidates for this particular
+ case. That is a subset of the full set the standard defines, plus some
+ other cases which the standard disallows. add_builtin_candidate will
+ filter out the illegal set. */
static struct z_candidate *
add_builtin_candidates (candidates, code, code2, fnname, args, flags)
@@ -1754,7 +2032,13 @@ add_builtin_candidates (candidates, code, code2, fnname, args, flags)
int flags;
{
int ref1, i;
- tree type, argtypes[3], types[2];
+ int enum_p = 0;
+ tree type, argtypes[3];
+ /* TYPES[i] is the set of possible builtin-operator parameter types
+ we will consider for the Ith argument. These are represented as
+ a TREE_LIST; the TREE_VALUE of each node is the potential
+ parameter type. */
+ tree types[2];
for (i = 0; i < 3; ++i)
{
@@ -1800,6 +2084,16 @@ add_builtin_candidates (candidates, code, code2, fnname, args, flags)
case COMPONENT_REF:
return candidates;
+ case COND_EXPR:
+ case EQ_EXPR:
+ case NE_EXPR:
+ case LT_EXPR:
+ case LE_EXPR:
+ case GT_EXPR:
+ case GE_EXPR:
+ enum_p = 1;
+ /* FALLTHROUGH */
+
default:
ref1 = 0;
}
@@ -1822,10 +2116,10 @@ add_builtin_candidates (candidates, code, code2, fnname, args, flags)
if (code == COND_EXPR)
{
if (real_lvalue_p (args[i]))
- types[i] = scratch_tree_cons
+ types[i] = tree_cons
(NULL_TREE, build_reference_type (argtypes[i]), types[i]);
- types[i] = scratch_tree_cons
+ types[i] = tree_cons
(NULL_TREE, TYPE_MAIN_VARIANT (argtypes[i]), types[i]);
}
@@ -1842,40 +2136,42 @@ add_builtin_candidates (candidates, code, code2, fnname, args, flags)
continue;
if (code == COND_EXPR && TREE_CODE (type) == REFERENCE_TYPE)
- types[i] = scratch_tree_cons (NULL_TREE, type, types[i]);
+ types[i] = tree_cons (NULL_TREE, type, types[i]);
type = non_reference (type);
if (i != 0 || ! ref1)
{
type = TYPE_MAIN_VARIANT (type_decays_to (type));
- if (code == COND_EXPR && TREE_CODE (type) == ENUMERAL_TYPE)
- types[i] = scratch_tree_cons (NULL_TREE, type, types[i]);
+ if (enum_p && TREE_CODE (type) == ENUMERAL_TYPE)
+ types[i] = tree_cons (NULL_TREE, type, types[i]);
if (INTEGRAL_TYPE_P (type))
type = type_promotes_to (type);
}
if (! value_member (type, types[i]))
- types[i] = scratch_tree_cons (NULL_TREE, type, types[i]);
+ types[i] = tree_cons (NULL_TREE, type, types[i]);
}
}
else
{
if (code == COND_EXPR && real_lvalue_p (args[i]))
- types[i] = scratch_tree_cons
+ types[i] = tree_cons
(NULL_TREE, build_reference_type (argtypes[i]), types[i]);
type = non_reference (argtypes[i]);
if (i != 0 || ! ref1)
{
type = TYPE_MAIN_VARIANT (type_decays_to (type));
- if (code == COND_EXPR && TREE_CODE (type) == ENUMERAL_TYPE)
- types[i] = scratch_tree_cons (NULL_TREE, type, types[i]);
+ if (enum_p && TREE_CODE (type) == ENUMERAL_TYPE)
+ types[i] = tree_cons (NULL_TREE, type, types[i]);
if (INTEGRAL_TYPE_P (type))
type = type_promotes_to (type);
}
- types[i] = scratch_tree_cons (NULL_TREE, type, types[i]);
+ types[i] = tree_cons (NULL_TREE, type, types[i]);
}
}
+ /* Run through the possible parameter types of both arguments,
+ creating candidates with those parameter types. */
for (; types[0]; types[0] = TREE_CHAIN (types[0]))
{
if (types[1])
@@ -1899,28 +2195,40 @@ add_builtin_candidates (candidates, code, code2, fnname, args, flags)
TMPL is the template. EXPLICIT_TARGS are any explicit template
arguments. ARGLIST is the arguments provided at the call-site.
The RETURN_TYPE is the desired type for conversion operators. If
- OBJ is NULL_TREE, FLAGS are as for add_function_candidate. If an
- OBJ is supplied, FLAGS are ignored, and OBJ is as for
+ OBJ is NULL_TREE, FLAGS and CTYPE are as for add_function_candidate.
+ If an OBJ is supplied, FLAGS and CTYPE are ignored, and OBJ is as for
add_conv_candidate. */
static struct z_candidate*
-add_template_candidate_real (candidates, tmpl, explicit_targs,
+add_template_candidate_real (candidates, tmpl, ctype, explicit_targs,
arglist, return_type, flags,
obj, strict)
struct z_candidate *candidates;
- tree tmpl, explicit_targs, arglist, return_type;
+ tree tmpl, ctype, explicit_targs, arglist, return_type;
int flags;
tree obj;
unification_kind_t strict;
{
int ntparms = DECL_NTPARMS (tmpl);
- tree targs = make_scratch_vec (ntparms);
+ tree targs = make_tree_vec (ntparms);
+ tree args_without_in_chrg = arglist;
struct z_candidate *cand;
int i;
tree fn;
- i = fn_type_unification (tmpl, explicit_targs, targs, arglist,
- return_type, strict);
+ /* We don't do deduction on the in-charge parameter, the VTT
+ parameter or 'this'. */
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (tmpl))
+ args_without_in_chrg = TREE_CHAIN (args_without_in_chrg);
+
+ if ((DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (tmpl)
+ || DECL_BASE_CONSTRUCTOR_P (tmpl))
+ && TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (tmpl)))
+ args_without_in_chrg = TREE_CHAIN (args_without_in_chrg);
+
+ i = fn_type_unification (tmpl, explicit_targs, targs,
+ args_without_in_chrg,
+ return_type, strict, -1);
if (i != 0)
return candidates;
@@ -1933,7 +2241,8 @@ add_template_candidate_real (candidates, tmpl, explicit_targs,
/* Aha, this is a conversion function. */
cand = add_conv_candidate (candidates, fn, obj, arglist);
else
- cand = add_function_candidate (candidates, fn, arglist, flags);
+ cand = add_function_candidate (candidates, fn, ctype,
+ arglist, flags);
if (DECL_TI_TEMPLATE (fn) != tmpl)
/* This situation can occur if a member template of a template
class is specialized. Then, instantiate_template might return
@@ -1961,16 +2270,16 @@ add_template_candidate_real (candidates, tmpl, explicit_targs,
static struct z_candidate *
-add_template_candidate (candidates, tmpl, explicit_targs,
+add_template_candidate (candidates, tmpl, ctype, explicit_targs,
arglist, return_type, flags, strict)
struct z_candidate *candidates;
- tree tmpl, explicit_targs, arglist, return_type;
+ tree tmpl, ctype, explicit_targs, arglist, return_type;
int flags;
unification_kind_t strict;
{
return
- add_template_candidate_real (candidates, tmpl, explicit_targs,
- arglist, return_type, flags,
+ add_template_candidate_real (candidates, tmpl, ctype,
+ explicit_targs, arglist, return_type, flags,
NULL_TREE, strict);
}
@@ -1981,8 +2290,8 @@ add_template_conv_candidate (candidates, tmpl, obj, arglist, return_type)
tree tmpl, obj, arglist, return_type;
{
return
- add_template_candidate_real (candidates, tmpl, NULL_TREE, arglist,
- return_type, 0, obj, DEDUCE_CONV);
+ add_template_candidate_real (candidates, tmpl, NULL_TREE, NULL_TREE,
+ arglist, return_type, 0, obj, DEDUCE_CONV);
}
@@ -2018,11 +2327,7 @@ build_this (obj)
tree obj;
{
/* Fix this to work on non-lvalues. */
- if (IS_SIGNATURE_POINTER (TREE_TYPE (obj))
- || IS_SIGNATURE_REFERENCE (TREE_TYPE (obj)))
- return obj;
- else
- return build_unary_op (ADDR_EXPR, obj, 0);
+ return build_unary_op (ADDR_EXPR, obj, 0);
}
static void
@@ -2034,21 +2339,21 @@ print_z_candidates (candidates)
{
if (TREE_CODE (candidates->fn) == IDENTIFIER_NODE)
{
- if (candidates->fn == ansi_opname [COND_EXPR])
- cp_error ("%s %D(%T, %T, %T) <builtin>", str, candidates->fn,
+ if (TREE_VEC_LENGTH (candidates->convs) == 3)
+ error ("%s %D(%T, %T, %T) <built-in>", str, candidates->fn,
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)),
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 1)),
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 2)));
else if (TREE_VEC_LENGTH (candidates->convs) == 2)
- cp_error ("%s %D(%T, %T) <builtin>", str, candidates->fn,
+ error ("%s %D(%T, %T) <built-in>", str, candidates->fn,
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)),
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 1)));
else
- cp_error ("%s %D(%T) <builtin>", str, candidates->fn,
+ error ("%s %D(%T) <built-in>", str, candidates->fn,
TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)));
}
else if (TYPE_P (candidates->fn))
- cp_error ("%s %T <conversion>", str, candidates->fn);
+ error ("%s %T <conversion>", str, candidates->fn);
else
cp_error_at ("%s %+#D%s", str, candidates->fn,
candidates->viable == -1 ? " <near match>" : "");
@@ -2073,10 +2378,18 @@ build_user_type_conversion_1 (totype, expr, flags)
tree args = NULL_TREE;
tree templates = NULL_TREE;
+ /* We represent conversion within a hierarchy using RVALUE_CONV and
+ BASE_CONV, as specified by [over.best.ics]; these become plain
+ constructor calls, as specified in [dcl.init]. */
+ my_friendly_assert (!IS_AGGR_TYPE (fromtype) || !IS_AGGR_TYPE (totype)
+ || !DERIVED_FROM_P (totype, fromtype), 20011226);
+
if (IS_AGGR_TYPE (totype))
- ctors = lookup_fnfields (TYPE_BINFO (totype), ctor_identifier, 0);
- if (IS_AGGR_TYPE (fromtype)
- && (! IS_AGGR_TYPE (totype) || ! DERIVED_FROM_P (totype, fromtype)))
+ ctors = lookup_fnfields (TYPE_BINFO (totype),
+ complete_ctor_identifier,
+ 0);
+
+ if (IS_AGGR_TYPE (fromtype))
convs = lookup_conversions (fromtype);
candidates = 0;
@@ -2084,19 +2397,19 @@ build_user_type_conversion_1 (totype, expr, flags)
if (ctors)
{
- tree t = build_int_2 (0, 0);
- TREE_TYPE (t) = build_pointer_type (totype);
- args = build_scratch_list (NULL_TREE, expr);
- if (TYPE_USES_PVBASES (totype) && !flag_vtable_thunks_compat)
- {
- args = scratch_tree_cons (NULL_TREE, vlist_zero_node, args);
- flags |= LOOKUP_HAS_VLIST;
- }
- if (TYPE_USES_VIRTUAL_BASECLASSES (totype))
- args = scratch_tree_cons (NULL_TREE, integer_one_node, args);
- args = scratch_tree_cons (NULL_TREE, t, args);
+ tree t;
ctors = TREE_VALUE (ctors);
+
+ t = build_int_2 (0, 0);
+ TREE_TYPE (t) = build_pointer_type (totype);
+ args = build_tree_list (NULL_TREE, expr);
+ /* We should never try to call the abstract or base constructor
+ from here. */
+ my_friendly_assert (!DECL_HAS_IN_CHARGE_PARM_P (OVL_CURRENT (ctors))
+ && !DECL_HAS_VTT_PARM_P (OVL_CURRENT (ctors)),
+ 20011226);
+ args = tree_cons (NULL_TREE, t, args);
}
for (; ctors; ctors = OVL_NEXT (ctors))
{
@@ -2106,14 +2419,14 @@ build_user_type_conversion_1 (totype, expr, flags)
if (TREE_CODE (ctor) == TEMPLATE_DECL)
{
- templates = scratch_tree_cons (NULL_TREE, ctor, templates);
+ templates = tree_cons (NULL_TREE, ctor, templates);
candidates =
- add_template_candidate (candidates, ctor,
+ add_template_candidate (candidates, ctor, totype,
NULL_TREE, args, NULL_TREE, flags,
DEDUCE_CALL);
}
else
- candidates = add_function_candidate (candidates, ctor,
+ candidates = add_function_candidate (candidates, ctor, totype,
args, flags);
if (candidates)
@@ -2124,7 +2437,7 @@ build_user_type_conversion_1 (totype, expr, flags)
}
if (convs)
- args = build_scratch_list (NULL_TREE, build_this (expr));
+ args = build_tree_list (NULL_TREE, build_this (expr));
for (; convs; convs = TREE_CHAIN (convs))
{
@@ -2154,16 +2467,23 @@ build_user_type_conversion_1 (totype, expr, flags)
tree fn = OVL_CURRENT (fns);
struct z_candidate *old_candidates = candidates;
+ /* [over.match.funcs] For conversion functions, the function is
+ considered to be a member of the class of the implicit object
+ argument for the purpose of defining the type of the implicit
+ object parameter.
+
+ So we pass fromtype as CTYPE to add_*_candidate. */
+
if (TREE_CODE (fn) == TEMPLATE_DECL)
{
- templates = scratch_tree_cons (NULL_TREE, fn, templates);
+ templates = tree_cons (NULL_TREE, fn, templates);
candidates =
- add_template_candidate (candidates, fn, NULL_TREE,
+ add_template_candidate (candidates, fn, fromtype, NULL_TREE,
args, totype, flags,
DEDUCE_CONV);
}
else
- candidates = add_function_candidate (candidates, fn,
+ candidates = add_function_candidate (candidates, fn, fromtype,
args, flags);
if (candidates != old_candidates)
@@ -2174,7 +2494,7 @@ build_user_type_conversion_1 (totype, expr, flags)
0, convflags);
candidates->second_conv = ics;
- candidates->basetype_path = TREE_PURPOSE (convs);
+ candidates->basetype_path = TYPE_BINFO (fromtype);
if (ics == NULL_TREE)
candidates->viable = 0;
@@ -2192,7 +2512,7 @@ build_user_type_conversion_1 (totype, expr, flags)
if (candidates && ! candidates->next)
/* say why this one won't work or try to be loose */;
else
- cp_error ("no viable candidates");
+ error ("no viable candidates");
}
#endif
@@ -2206,7 +2526,7 @@ build_user_type_conversion_1 (totype, expr, flags)
{
if (flags & LOOKUP_COMPLAIN)
{
- cp_error ("conversion from `%T' to `%T' is ambiguous",
+ error ("conversion from `%T' to `%T' is ambiguous",
fromtype, totype);
print_z_candidates (candidates);
}
@@ -2222,22 +2542,15 @@ build_user_type_conversion_1 (totype, expr, flags)
for (p = &(cand->second_conv); TREE_CODE (*p) != IDENTITY_CONV; )
p = &(TREE_OPERAND (*p, 0));
- /* Pedantically, normal function declarations are never considered
- to refer to template instantiations, so we only do this with
- -fguiding-decls. */
- if (flag_guiding_decls && templates && ! cand->template
- && !DECL_INITIAL (cand->fn)
- && TREE_CODE (TREE_TYPE (cand->fn)) != METHOD_TYPE)
- add_maybe_template (cand->fn, templates);
-
*p = build
(USER_CONV,
(DECL_CONSTRUCTOR_P (cand->fn)
? totype : non_reference (TREE_TYPE (TREE_TYPE (cand->fn)))),
- expr, build_expr_ptr_wrapper (cand));
- ICS_USER_FLAG (cand->second_conv) = 1;
+ expr, build_ptr_wrapper (cand));
+
+ ICS_USER_FLAG (cand->second_conv) = ICS_USER_FLAG (*p) = 1;
if (cand->viable == -1)
- ICS_BAD_FLAG (cand->second_conv) = 1;
+ ICS_BAD_FLAG (cand->second_conv) = ICS_BAD_FLAG (*p) = 1;
return cand;
}
@@ -2268,15 +2581,19 @@ resolve_args (args)
tree t;
for (t = args; t; t = TREE_CHAIN (t))
{
- if (TREE_VALUE (t) == error_mark_node)
+ tree arg = TREE_VALUE (t);
+
+ if (arg == error_mark_node)
return error_mark_node;
- else if (TREE_CODE (TREE_TYPE (TREE_VALUE (t))) == VOID_TYPE)
+ else if (VOID_TYPE_P (TREE_TYPE (arg)))
{
error ("invalid use of void expression");
return error_mark_node;
}
- else if (TREE_CODE (TREE_VALUE (t)) == OFFSET_REF)
- TREE_VALUE (t) = resolve_offset_ref (TREE_VALUE (t));
+ else if (TREE_CODE (arg) == OFFSET_REF)
+ arg = resolve_offset_ref (arg);
+ arg = convert_from_reference (arg);
+ TREE_VALUE (t) = arg;
}
return args;
}
@@ -2309,28 +2626,24 @@ build_new_function_call (fn, args)
for (t1 = fn; t1; t1 = OVL_CHAIN (t1))
{
tree t = OVL_FUNCTION (t1);
- struct z_candidate *old_candidates = candidates;
if (TREE_CODE (t) == TEMPLATE_DECL)
{
- templates = scratch_tree_cons (NULL_TREE, t, templates);
+ templates = tree_cons (NULL_TREE, t, templates);
candidates = add_template_candidate
- (candidates, t, explicit_targs, args, NULL_TREE,
+ (candidates, t, NULL_TREE, explicit_targs, args, NULL_TREE,
LOOKUP_NORMAL, DEDUCE_CALL);
}
else if (! template_only)
candidates = add_function_candidate
- (candidates, t, args, LOOKUP_NORMAL);
-
- if (candidates != old_candidates)
- candidates->basetype_path = DECL_REAL_CONTEXT (t);
+ (candidates, t, NULL_TREE, args, LOOKUP_NORMAL);
}
if (! any_viable (candidates))
{
if (candidates && ! candidates->next)
return build_function_call (candidates->fn, args);
- cp_error ("no matching function for call to `%D (%A)'",
+ error ("no matching function for call to `%D(%A)'",
DECL_NAME (OVL_FUNCTION (fn)), args);
if (candidates)
print_z_candidates (candidates);
@@ -2341,19 +2654,12 @@ build_new_function_call (fn, args)
if (cand == 0)
{
- cp_error ("call of overloaded `%D (%A)' is ambiguous",
+ error ("call of overloaded `%D(%A)' is ambiguous",
DECL_NAME (OVL_FUNCTION (fn)), args);
print_z_candidates (candidates);
return error_mark_node;
}
- /* Pedantically, normal function declarations are never considered
- to refer to template instantiations, so we only do this with
- -fguiding-decls. */
- if (flag_guiding_decls && templates && ! cand->template
- && ! DECL_INITIAL (cand->fn))
- add_maybe_template (cand->fn, templates);
-
return build_over_call (cand, args, LOOKUP_NORMAL);
}
@@ -2375,12 +2681,11 @@ build_object_call (obj, args)
{
/* It's no good looking for an overloaded operator() on a
pointer-to-member-function. */
- cp_error ("pointer-to-member function %E cannot be called", obj);
- cp_error ("without an object; consider using .* or ->*");
+ error ("pointer-to-member function %E cannot be called without an object; consider using .* or ->*", obj);
return error_mark_node;
}
- fns = lookup_fnfields (TYPE_BINFO (type), ansi_opname [CALL_EXPR], 1);
+ fns = lookup_fnfields (TYPE_BINFO (type), ansi_opname (CALL_EXPR), 1);
if (fns == error_mark_node)
return error_mark_node;
@@ -2391,8 +2696,8 @@ build_object_call (obj, args)
if (fns)
{
- tree base = TREE_PURPOSE (fns);
- mem_args = scratch_tree_cons (NULL_TREE, build_this (obj), args);
+ tree base = BINFO_TYPE (TREE_PURPOSE (fns));
+ mem_args = tree_cons (NULL_TREE, build_this (obj), args);
for (fns = TREE_VALUE (fns); fns; fns = OVL_NEXT (fns))
{
@@ -2400,16 +2705,16 @@ build_object_call (obj, args)
if (TREE_CODE (fn) == TEMPLATE_DECL)
{
candidates
- = add_template_candidate (candidates, fn, NULL_TREE,
+ = add_template_candidate (candidates, fn, base, NULL_TREE,
mem_args, NULL_TREE,
LOOKUP_NORMAL, DEDUCE_CALL);
}
else
candidates = add_function_candidate
- (candidates, fn, mem_args, LOOKUP_NORMAL);
+ (candidates, fn, base, mem_args, LOOKUP_NORMAL);
if (candidates)
- candidates->basetype_path = base;
+ candidates->basetype_path = TYPE_BINFO (type);
}
}
@@ -2421,8 +2726,12 @@ build_object_call (obj, args)
tree totype = TREE_TYPE (TREE_TYPE (OVL_CURRENT (fns)));
if ((TREE_CODE (totype) == POINTER_TYPE
- || TREE_CODE (totype) == REFERENCE_TYPE)
- && TREE_CODE (TREE_TYPE (totype)) == FUNCTION_TYPE)
+ && TREE_CODE (TREE_TYPE (totype)) == FUNCTION_TYPE)
+ || (TREE_CODE (totype) == REFERENCE_TYPE
+ && TREE_CODE (TREE_TYPE (totype)) == FUNCTION_TYPE)
+ || (TREE_CODE (totype) == REFERENCE_TYPE
+ && TREE_CODE (TREE_TYPE (totype)) == POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (TREE_TYPE (totype))) == FUNCTION_TYPE))
for (; fns; fns = OVL_NEXT (fns))
{
tree fn = OVL_CURRENT (fns);
@@ -2436,15 +2745,12 @@ build_object_call (obj, args)
}
else
candidates = add_conv_candidate (candidates, fn, obj, args);
-
- if (candidates)
- candidates->basetype_path = TREE_PURPOSE (convs);
}
}
if (! any_viable (candidates))
{
- cp_error ("no match for call to `(%T) (%A)'", TREE_TYPE (obj), args);
+ error ("no match for call to `(%T) (%A)'", TREE_TYPE (obj), args);
print_z_candidates (candidates);
return error_mark_node;
}
@@ -2454,7 +2760,7 @@ build_object_call (obj, args)
if (cand == 0)
{
- cp_error ("call of `(%T) (%A)' is ambiguous", TREE_TYPE (obj), args);
+ error ("call of `(%T) (%A)' is ambiguous", TREE_TYPE (obj), args);
print_z_candidates (candidates);
return error_mark_node;
}
@@ -2463,10 +2769,11 @@ build_object_call (obj, args)
function, we must be careful not to unconditionally look at
DECL_NAME here. */
if (TREE_CODE (cand->fn) == FUNCTION_DECL
- && DECL_NAME (cand->fn) == ansi_opname [CALL_EXPR])
+ && DECL_OVERLOADED_OPERATOR_P (cand->fn) == CALL_EXPR)
return build_over_call (cand, mem_args, LOOKUP_NORMAL);
- obj = convert_like (TREE_VEC_ELT (cand->convs, 0), obj);
+ obj = convert_like_with_context
+ (TREE_VEC_ELT (cand->convs, 0), obj, cand->fn, -1);
/* FIXME */
return build_function_call (obj, args);
@@ -2478,30 +2785,434 @@ op_error (code, code2, arg1, arg2, arg3, problem)
tree arg1, arg2, arg3;
const char *problem;
{
- const char * opname
- = (code == MODIFY_EXPR ? assignop_tab [code2] : opname_tab [code]);
+ const char *opname;
+
+ if (code == MODIFY_EXPR)
+ opname = assignment_operator_name_info[code2].name;
+ else
+ opname = operator_name_info[code].name;
switch (code)
{
case COND_EXPR:
- cp_error ("%s for `%T ? %T : %T'", problem,
+ error ("%s for `%T ? %T : %T' operator", problem,
error_type (arg1), error_type (arg2), error_type (arg3));
break;
case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR:
- cp_error ("%s for `%T%s'", problem, error_type (arg1), opname);
+ error ("%s for `%T %s' operator", problem, error_type (arg1), opname);
break;
case ARRAY_REF:
- cp_error ("%s for `%T[%T]'", problem,
+ error ("%s for `%T [%T]' operator", problem,
error_type (arg1), error_type (arg2));
break;
default:
if (arg2)
- cp_error ("%s for `%T %s %T'", problem,
+ error ("%s for `%T %s %T' operator", problem,
error_type (arg1), opname, error_type (arg2));
else
- cp_error ("%s for `%s%T'", problem, opname, error_type (arg1));
+ error ("%s for `%s %T' operator", problem, opname, error_type (arg1));
+ }
+}
+
+/* Return the implicit conversion sequence that could be used to
+ convert E1 to E2 in [expr.cond]. */
+
+static tree
+conditional_conversion (e1, e2)
+ tree e1;
+ tree e2;
+{
+ tree t1 = non_reference (TREE_TYPE (e1));
+ tree t2 = non_reference (TREE_TYPE (e2));
+ tree conv;
+
+ /* [expr.cond]
+
+ If E2 is an lvalue: E1 can be converted to match E2 if E1 can be
+ implicitly converted (clause _conv_) to the type "reference to
+ T2", subject to the constraint that in the conversion the
+ reference must bind directly (_dcl.init.ref_) to E1. */
+ if (real_lvalue_p (e2))
+ {
+ conv = implicit_conversion (build_reference_type (t2),
+ t1,
+ e1,
+ LOOKUP_NO_TEMP_BIND);
+ if (conv)
+ return conv;
+ }
+
+ /* [expr.cond]
+
+ If E1 and E2 have class type, and the underlying class types are
+ the same or one is a base class of the other: E1 can be converted
+ to match E2 if the class of T2 is the same type as, or a base
+ class of, the class of T1, and the cv-qualification of T2 is the
+ same cv-qualification as, or a greater cv-qualification than, the
+ cv-qualification of T1. If the conversion is applied, E1 is
+ changed to an rvalue of type T2 that still refers to the original
+ source class object (or the appropriate subobject thereof). */
+ if (CLASS_TYPE_P (t1) && CLASS_TYPE_P (t2)
+ && same_or_base_type_p (TYPE_MAIN_VARIANT (t2),
+ TYPE_MAIN_VARIANT (t1)))
+ {
+ if (at_least_as_qualified_p (t2, t1))
+ {
+ conv = build1 (IDENTITY_CONV, t1, e1);
+ if (!same_type_p (TYPE_MAIN_VARIANT (t1),
+ TYPE_MAIN_VARIANT (t2)))
+ conv = build_conv (BASE_CONV, t2, conv);
+ return conv;
+ }
+ else
+ return NULL_TREE;
+ }
+
+ /* [expr.cond]
+
+ E1 can be converted to match E2 if E1 can be implicitly converted
+ to the type that expression E2 would have if E2 were converted to
+ an rvalue (or the type it has, if E2 is an rvalue). */
+ return implicit_conversion (t2, t1, e1, LOOKUP_NORMAL);
+}
+
+/* Implement [expr.cond]. ARG1, ARG2, and ARG3 are the three
+ arguments to the conditional expression. By the time this function
+ is called, any suitable candidate functions are included in
+ CANDIDATES. */
+
+tree
+build_conditional_expr (arg1, arg2, arg3)
+ tree arg1;
+ tree arg2;
+ tree arg3;
+{
+ tree arg2_type;
+ tree arg3_type;
+ tree result;
+ tree result_type = NULL_TREE;
+ int lvalue_p = 1;
+ struct z_candidate *candidates = 0;
+ struct z_candidate *cand;
+
+ /* As a G++ extension, the second argument to the conditional can be
+ omitted. (So that `a ? : c' is roughly equivalent to `a ? a :
+ c'.) If the second operand is omitted, make sure it is
+ calculated only once. */
+ if (!arg2)
+ {
+ if (pedantic)
+ pedwarn ("ISO C++ forbids omitting the middle term of a ?: expression");
+ arg1 = arg2 = save_expr (arg1);
+ }
+
+ /* [expr.cond]
+
+ The first expr ession is implicitly converted to bool (clause
+ _conv_). */
+ arg1 = cp_convert (boolean_type_node, arg1);
+
+ /* If something has already gone wrong, just pass that fact up the
+ tree. */
+ if (arg1 == error_mark_node
+ || arg2 == error_mark_node
+ || arg3 == error_mark_node
+ || TREE_TYPE (arg1) == error_mark_node
+ || TREE_TYPE (arg2) == error_mark_node
+ || TREE_TYPE (arg3) == error_mark_node)
+ return error_mark_node;
+
+ /* [expr.cond]
+
+ If either the second or the third operand has type (possibly
+ cv-qualified) void, then the lvalue-to-rvalue (_conv.lval_),
+ array-to-pointer (_conv.array_), and function-to-pointer
+ (_conv.func_) standard conversions are performed on the second
+ and third operands. */
+ arg2_type = TREE_TYPE (arg2);
+ arg3_type = TREE_TYPE (arg3);
+ if (VOID_TYPE_P (arg2_type) || VOID_TYPE_P (arg3_type))
+ {
+ /* Do the conversions. We don't these for `void' type arguments
+ since it can't have any effect and since decay_conversion
+ does not handle that case gracefully. */
+ if (!VOID_TYPE_P (arg2_type))
+ arg2 = decay_conversion (arg2);
+ if (!VOID_TYPE_P (arg3_type))
+ arg3 = decay_conversion (arg3);
+ arg2_type = TREE_TYPE (arg2);
+ arg3_type = TREE_TYPE (arg3);
+
+ /* [expr.cond]
+
+ One of the following shall hold:
+
+ --The second or the third operand (but not both) is a
+ throw-expression (_except.throw_); the result is of the
+ type of the other and is an rvalue.
+
+ --Both the second and the third operands have type void; the
+ result is of type void and is an rvalue. */
+ if ((TREE_CODE (arg2) == THROW_EXPR)
+ ^ (TREE_CODE (arg3) == THROW_EXPR))
+ result_type = ((TREE_CODE (arg2) == THROW_EXPR)
+ ? arg3_type : arg2_type);
+ else if (VOID_TYPE_P (arg2_type) && VOID_TYPE_P (arg3_type))
+ result_type = void_type_node;
+ else
+ {
+ error ("`%E' has type `void' and is not a throw-expression",
+ VOID_TYPE_P (arg2_type) ? arg2 : arg3);
+ return error_mark_node;
+ }
+
+ lvalue_p = 0;
+ goto valid_operands;
+ }
+ /* [expr.cond]
+
+ Otherwise, if the second and third operand have different types,
+ and either has (possibly cv-qualified) class type, an attempt is
+ made to convert each of those operands to the type of the other. */
+ else if (!same_type_p (arg2_type, arg3_type)
+ && (CLASS_TYPE_P (arg2_type) || CLASS_TYPE_P (arg3_type)))
+ {
+ tree conv2 = conditional_conversion (arg2, arg3);
+ tree conv3 = conditional_conversion (arg3, arg2);
+
+ /* [expr.cond]
+
+ If both can be converted, or one can be converted but the
+ conversion is ambiguous, the program is ill-formed. If
+ neither can be converted, the operands are left unchanged and
+ further checking is performed as described below. If exactly
+ one conversion is possible, that conversion is applied to the
+ chosen operand and the converted operand is used in place of
+ the original operand for the remainder of this section. */
+ if ((conv2 && !ICS_BAD_FLAG (conv2)
+ && conv3 && !ICS_BAD_FLAG (conv3))
+ || (conv2 && TREE_CODE (conv2) == AMBIG_CONV)
+ || (conv3 && TREE_CODE (conv3) == AMBIG_CONV))
+ {
+ error ("operands to ?: have different types");
+ return error_mark_node;
+ }
+ else if (conv2 && !ICS_BAD_FLAG (conv2))
+ {
+ arg2 = convert_like (conv2, arg2);
+ arg2 = convert_from_reference (arg2);
+ /* That may not quite have done the trick. If the two types
+ are cv-qualified variants of one another, we will have
+ just used an IDENTITY_CONV. (There's no conversion from
+ an lvalue of one class type to an lvalue of another type,
+ even a cv-qualified variant, and we don't want to lose
+ lvalue-ness here.) So, we manually add a NOP_EXPR here
+ if necessary. */
+ if (!same_type_p (TREE_TYPE (arg2), arg3_type))
+ arg2 = build1 (NOP_EXPR, arg3_type, arg2);
+ arg2_type = TREE_TYPE (arg2);
+ }
+ else if (conv3 && !ICS_BAD_FLAG (conv3))
+ {
+ arg3 = convert_like (conv3, arg3);
+ arg3 = convert_from_reference (arg3);
+ if (!same_type_p (TREE_TYPE (arg3), arg2_type))
+ arg3 = build1 (NOP_EXPR, arg2_type, arg3);
+ arg3_type = TREE_TYPE (arg3);
+ }
+ }
+
+ /* [expr.cond]
+
+ If the second and third operands are lvalues and have the same
+ type, the result is of that type and is an lvalue. */
+ if (real_lvalue_p (arg2) && real_lvalue_p (arg3) &&
+ same_type_p (arg2_type, arg3_type))
+ {
+ result_type = arg2_type;
+ goto valid_operands;
+ }
+
+ /* [expr.cond]
+
+ Otherwise, the result is an rvalue. If the second and third
+ operand do not have the same type, and either has (possibly
+ cv-qualified) class type, overload resolution is used to
+ determine the conversions (if any) to be applied to the operands
+ (_over.match.oper_, _over.built_). */
+ lvalue_p = 0;
+ if (!same_type_p (arg2_type, arg3_type)
+ && (CLASS_TYPE_P (arg2_type) || CLASS_TYPE_P (arg3_type)))
+ {
+ tree args[3];
+ tree conv;
+
+ /* Rearrange the arguments so that add_builtin_candidate only has
+ to know about two args. In build_builtin_candidates, the
+ arguments are unscrambled. */
+ args[0] = arg2;
+ args[1] = arg3;
+ args[2] = arg1;
+ candidates = add_builtin_candidates (candidates,
+ COND_EXPR,
+ NOP_EXPR,
+ ansi_opname (COND_EXPR),
+ args,
+ LOOKUP_NORMAL);
+
+ /* [expr.cond]
+
+ If the overload resolution fails, the program is
+ ill-formed. */
+ if (!any_viable (candidates))
+ {
+ op_error (COND_EXPR, NOP_EXPR, arg1, arg2, arg3, "no match");
+ print_z_candidates (candidates);
+ return error_mark_node;
+ }
+ candidates = splice_viable (candidates);
+ cand = tourney (candidates);
+ if (!cand)
+ {
+ op_error (COND_EXPR, NOP_EXPR, arg1, arg2, arg3, "no match");
+ print_z_candidates (candidates);
+ return error_mark_node;
+ }
+
+ /* [expr.cond]
+
+ Otherwise, the conversions thus determined are applied, and
+ the converted operands are used in place of the original
+ operands for the remainder of this section. */
+ conv = TREE_VEC_ELT (cand->convs, 0);
+ arg1 = convert_like (conv, arg1);
+ conv = TREE_VEC_ELT (cand->convs, 1);
+ arg2 = convert_like (conv, arg2);
+ conv = TREE_VEC_ELT (cand->convs, 2);
+ arg3 = convert_like (conv, arg3);
+ }
+
+ /* [expr.cond]
+
+ Lvalue-to-rvalue (_conv.lval_), array-to-pointer (_conv.array_),
+ and function-to-pointer (_conv.func_) standard conversions are
+ performed on the second and third operands.
+
+ We need to force the lvalue-to-rvalue conversion here for class types,
+ so we get TARGET_EXPRs; trying to deal with a COND_EXPR of class rvalues
+ that isn't wrapped with a TARGET_EXPR plays havoc with exception
+ regions.
+
+ We use ocp_convert rather than build_user_type_conversion because the
+ latter returns NULL_TREE on failure, while the former gives an error. */
+
+ if (IS_AGGR_TYPE (TREE_TYPE (arg2)) && real_lvalue_p (arg2))
+ arg2 = ocp_convert (TREE_TYPE (arg2), arg2,
+ CONV_IMPLICIT|CONV_FORCE_TEMP, LOOKUP_NORMAL);
+ else
+ arg2 = decay_conversion (arg2);
+ arg2_type = TREE_TYPE (arg2);
+
+ if (IS_AGGR_TYPE (TREE_TYPE (arg3)) && real_lvalue_p (arg3))
+ arg3 = ocp_convert (TREE_TYPE (arg3), arg3,
+ CONV_IMPLICIT|CONV_FORCE_TEMP, LOOKUP_NORMAL);
+ else
+ arg3 = decay_conversion (arg3);
+ arg3_type = TREE_TYPE (arg3);
+
+ if (arg2 == error_mark_node || arg3 == error_mark_node)
+ return error_mark_node;
+
+ /* [expr.cond]
+
+ After those conversions, one of the following shall hold:
+
+ --The second and third operands have the same type; the result is of
+ that type. */
+ if (same_type_p (arg2_type, arg3_type))
+ result_type = arg2_type;
+ /* [expr.cond]
+
+ --The second and third operands have arithmetic or enumeration
+ type; the usual arithmetic conversions are performed to bring
+ them to a common type, and the result is of that type. */
+ else if ((ARITHMETIC_TYPE_P (arg2_type)
+ || TREE_CODE (arg2_type) == ENUMERAL_TYPE)
+ && (ARITHMETIC_TYPE_P (arg3_type)
+ || TREE_CODE (arg3_type) == ENUMERAL_TYPE))
+ {
+ /* In this case, there is always a common type. */
+ result_type = type_after_usual_arithmetic_conversions (arg2_type,
+ arg3_type);
+
+ if (TREE_CODE (arg2_type) == ENUMERAL_TYPE
+ && TREE_CODE (arg3_type) == ENUMERAL_TYPE)
+ warning ("enumeral mismatch in conditional expression: `%T' vs `%T'",
+ arg2_type, arg3_type);
+ else if (extra_warnings
+ && ((TREE_CODE (arg2_type) == ENUMERAL_TYPE
+ && !same_type_p (arg3_type, type_promotes_to (arg2_type)))
+ || (TREE_CODE (arg3_type) == ENUMERAL_TYPE
+ && !same_type_p (arg2_type, type_promotes_to (arg3_type)))))
+ warning ("enumeral and non-enumeral type in conditional expression");
+
+ arg2 = perform_implicit_conversion (result_type, arg2);
+ arg3 = perform_implicit_conversion (result_type, arg3);
+ }
+ /* [expr.cond]
+
+ --The second and third operands have pointer type, or one has
+ pointer type and the other is a null pointer constant; pointer
+ conversions (_conv.ptr_) and qualification conversions
+ (_conv.qual_) are performed to bring them to their composite
+ pointer type (_expr.rel_). The result is of the composite
+ pointer type.
+
+ --The second and third operands have pointer to member type, or
+ one has pointer to member type and the other is a null pointer
+ constant; pointer to member conversions (_conv.mem_) and
+ qualification conversions (_conv.qual_) are performed to bring
+ them to a common type, whose cv-qualification shall match the
+ cv-qualification of either the second or the third operand.
+ The result is of the common type. */
+ else if ((null_ptr_cst_p (arg2)
+ && (TYPE_PTR_P (arg3_type) || TYPE_PTRMEM_P (arg3_type)
+ || TYPE_PTRMEMFUNC_P (arg3_type)))
+ || (null_ptr_cst_p (arg3)
+ && (TYPE_PTR_P (arg2_type) || TYPE_PTRMEM_P (arg2_type)
+ || TYPE_PTRMEMFUNC_P (arg2_type)))
+ || (TYPE_PTR_P (arg2_type) && TYPE_PTR_P (arg3_type))
+ || (TYPE_PTRMEM_P (arg2_type) && TYPE_PTRMEM_P (arg3_type))
+ || (TYPE_PTRMEMFUNC_P (arg2_type)
+ && TYPE_PTRMEMFUNC_P (arg3_type)))
+ {
+ result_type = composite_pointer_type (arg2_type, arg3_type, arg2,
+ arg3, "conditional expression");
+ arg2 = perform_implicit_conversion (result_type, arg2);
+ arg3 = perform_implicit_conversion (result_type, arg3);
+ }
+
+ if (!result_type)
+ {
+ error ("operands to ?: have different types");
+ return error_mark_node;
}
+
+ valid_operands:
+ result = fold (build (COND_EXPR, result_type, arg1, arg2, arg3));
+ /* Expand both sides into the same slot, hopefully the target of the
+ ?: expression. We used to check for TARGET_EXPRs here, but now we
+ sometimes wrap them in NOP_EXPRs so the test would fail. */
+ if (!lvalue_p && IS_AGGR_TYPE (result_type))
+ result = build_target_expr_with_type (result, result_type);
+
+ /* If this expression is an rvalue, but might be mistaken for an
+ lvalue, we must add a NON_LVALUE_EXPR. */
+ if (!lvalue_p && real_lvalue_p (result))
+ result = build1 (NON_LVALUE_EXPR, result_type, result);
+
+ return result;
}
tree
@@ -2525,7 +3236,7 @@ build_new_op (code, flags, arg1, arg2, arg3)
undeclared_template<1, 5, 72>a; */
if (code == LT_EXPR && TREE_CODE (arg1) == TEMPLATE_DECL)
{
- cp_error ("`%D' must be declared before use", arg1);
+ error ("`%D' must be declared before use", arg1);
return error_mark_node;
}
@@ -2533,11 +3244,15 @@ build_new_op (code, flags, arg1, arg2, arg3)
{
code2 = TREE_CODE (arg3);
arg3 = NULL_TREE;
- fnname = ansi_assopname[code2];
+ fnname = ansi_assopname (code2);
}
else
- fnname = ansi_opname[code];
+ fnname = ansi_opname (code);
+ if (TREE_CODE (arg1) == OFFSET_REF)
+ arg1 = resolve_offset_ref (arg1);
+ arg1 = convert_from_reference (arg1);
+
switch (code)
{
case NEW_EXPR:
@@ -2545,7 +3260,7 @@ build_new_op (code, flags, arg1, arg2, arg3)
case VEC_DELETE_EXPR:
case DELETE_EXPR:
/* Use build_op_new_call and build_op_delete_call instead. */
- my_friendly_abort (981018);
+ abort ();
case CALL_EXPR:
return build_object_call (arg1, arg2);
@@ -2554,14 +3269,19 @@ build_new_op (code, flags, arg1, arg2, arg3)
break;
}
- /* The comma operator can have void args. */
- if (TREE_CODE (arg1) == OFFSET_REF)
- arg1 = resolve_offset_ref (arg1);
- if (arg2 && TREE_CODE (arg2) == OFFSET_REF)
- arg2 = resolve_offset_ref (arg2);
- if (arg3 && TREE_CODE (arg3) == OFFSET_REF)
- arg3 = resolve_offset_ref (arg3);
-
+ if (arg2)
+ {
+ if (TREE_CODE (arg2) == OFFSET_REF)
+ arg2 = resolve_offset_ref (arg2);
+ arg2 = convert_from_reference (arg2);
+ }
+ if (arg3)
+ {
+ if (TREE_CODE (arg3) == OFFSET_REF)
+ arg3 = resolve_offset_ref (arg3);
+ arg3 = convert_from_reference (arg3);
+ }
+
if (code == COND_EXPR)
{
if (arg2 == NULL_TREE
@@ -2578,13 +3298,12 @@ build_new_op (code, flags, arg1, arg2, arg3)
if (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR)
arg2 = integer_zero_node;
- if (arg2 && arg3)
- arglist = scratch_tree_cons (NULL_TREE, arg1, scratch_tree_cons
- (NULL_TREE, arg2, build_scratch_list (NULL_TREE, arg3)));
- else if (arg2)
- arglist = scratch_tree_cons (NULL_TREE, arg1, build_scratch_list (NULL_TREE, arg2));
- else
- arglist = build_scratch_list (NULL_TREE, arg1);
+ arglist = NULL_TREE;
+ if (arg3)
+ arglist = tree_cons (NULL_TREE, arg3, arglist);
+ if (arg2)
+ arglist = tree_cons (NULL_TREE, arg2, arglist);
+ arglist = tree_cons (NULL_TREE, arg1, arglist);
fns = lookup_function_nonclass (fnname, arglist);
@@ -2595,14 +3314,15 @@ build_new_op (code, flags, arg1, arg2, arg3)
tree fn = OVL_CURRENT (fns);
if (TREE_CODE (fn) == TEMPLATE_DECL)
{
- templates = scratch_tree_cons (NULL_TREE, fn, templates);
+ templates = tree_cons (NULL_TREE, fn, templates);
candidates
- = add_template_candidate (candidates, fn, NULL_TREE,
+ = add_template_candidate (candidates, fn, NULL_TREE, NULL_TREE,
arglist, TREE_TYPE (fnname),
flags, DEDUCE_CALL);
}
else
- candidates = add_function_candidate (candidates, fn, arglist, flags);
+ candidates = add_function_candidate (candidates, fn, NULL_TREE,
+ arglist, flags);
}
if (IS_AGGR_TYPE (TREE_TYPE (arg1)))
@@ -2616,8 +3336,8 @@ build_new_op (code, flags, arg1, arg2, arg3)
if (fns)
{
- tree basetype = TREE_PURPOSE (fns);
- mem_arglist = scratch_tree_cons (NULL_TREE, build_this (arg1), TREE_CHAIN (arglist));
+ tree basetype = BINFO_TYPE (TREE_PURPOSE (fns));
+ mem_arglist = tree_cons (NULL_TREE, build_this (arg1), TREE_CHAIN (arglist));
for (fns = TREE_VALUE (fns); fns; fns = OVL_NEXT (fns))
{
tree fn = OVL_CURRENT (fns);
@@ -2631,18 +3351,18 @@ build_new_op (code, flags, arg1, arg2, arg3)
if (TREE_CODE (fn) == TEMPLATE_DECL)
{
/* A member template. */
- templates = scratch_tree_cons (NULL_TREE, fn, templates);
+ templates = tree_cons (NULL_TREE, fn, templates);
candidates
- = add_template_candidate (candidates, fn, NULL_TREE,
+ = add_template_candidate (candidates, fn, basetype, NULL_TREE,
this_arglist, TREE_TYPE (fnname),
flags, DEDUCE_CALL);
}
else
candidates = add_function_candidate
- (candidates, fn, this_arglist, flags);
+ (candidates, fn, basetype, this_arglist, flags);
- if (candidates)
- candidates->basetype_path = basetype;
+ if (candidates)
+ candidates->basetype_path = TYPE_BINFO (TREE_TYPE (arg1));
}
}
@@ -2679,8 +3399,9 @@ build_new_op (code, flags, arg1, arg2, arg3)
/* Look for an `operator++ (int)'. If they didn't have
one, then we fall back to the old way of doing things. */
if (flags & LOOKUP_COMPLAIN)
- cp_pedwarn ("no `%D (int)' declared for postfix `%s', trying prefix operator instead",
- fnname, opname_tab [code]);
+ pedwarn ("no `%D(int)' declared for postfix `%s', trying prefix operator instead",
+ fnname,
+ operator_name_info[code].name);
if (code == POSTINCREMENT_EXPR)
code = PREINCREMENT_EXPR;
else
@@ -2720,12 +3441,12 @@ build_new_op (code, flags, arg1, arg2, arg3)
{
extern int warn_synth;
if (warn_synth
- && fnname == ansi_opname[MODIFY_EXPR]
+ && fnname == ansi_assopname (NOP_EXPR)
&& DECL_ARTIFICIAL (cand->fn)
&& candidates->next
&& ! candidates->next->next)
{
- cp_warning ("using synthesized `%#D' for copy assignment",
+ warning ("using synthesized `%#D' for copy assignment",
cand->fn);
cp_warning_at (" where cfront would use `%#D'",
cand == candidates
@@ -2733,14 +3454,6 @@ build_new_op (code, flags, arg1, arg2, arg3)
: candidates->fn);
}
- /* Pedantically, normal function declarations are never considered
- to refer to template instantiations, so we only do this with
- -fguiding-decls. */
- if (flag_guiding_decls && templates && ! cand->template
- && ! DECL_INITIAL (cand->fn)
- && TREE_CODE (TREE_TYPE (cand->fn)) != METHOD_TYPE)
- add_maybe_template (cand->fn, templates);
-
return build_over_call
(cand,
TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE
@@ -2762,7 +3475,7 @@ build_new_op (code, flags, arg1, arg2, arg3)
&& (TYPE_MAIN_VARIANT (TREE_TYPE (arg1))
!= TYPE_MAIN_VARIANT (TREE_TYPE (arg2))))
{
- cp_warning ("comparison between `%#T' and `%#T'",
+ warning ("comparison between `%#T' and `%#T'",
TREE_TYPE (arg1), TREE_TYPE (arg2));
}
break;
@@ -2821,7 +3534,7 @@ builtin:
case BIT_XOR_EXPR:
case TRUTH_ANDIF_EXPR:
case TRUTH_ORIF_EXPR:
- return build_binary_op_nodefault (code, arg1, arg2, code);
+ return cp_build_binary_op (code, arg1, arg2);
case CONVERT_EXPR:
case NEGATE_EXPR:
@@ -2843,7 +3556,7 @@ builtin:
case MEMBER_REF:
return build_m_component_ref
- (build_indirect_ref (arg1, NULL_PTR), arg2);
+ (build_indirect_ref (arg1, NULL), arg2);
/* The caller will deal with these. */
case ADDR_EXPR:
@@ -2852,36 +3565,11 @@ builtin:
return NULL_TREE;
default:
- my_friendly_abort (367);
+ abort ();
return NULL_TREE;
}
}
-/* Build up a call to operator new. This has to be handled differently
- from other operators in the way lookup is handled; first members are
- considered, then globals. CODE is either NEW_EXPR or VEC_NEW_EXPR.
- TYPE is the type to be created. ARGS are any new-placement args.
- FLAGS are the usual overloading flags. */
-
-tree
-build_op_new_call (code, type, args, flags)
- enum tree_code code;
- tree type, args;
- int flags;
-{
- tree fnname = ansi_opname[code];
-
- if (IS_AGGR_TYPE (type) && ! (flags & LOOKUP_GLOBAL)
- && (TYPE_GETS_NEW (type) & (1 << (code == VEC_NEW_EXPR))))
- {
- return build_method_call (build_dummy_object (type),
- fnname, args, NULL_TREE, flags);
- }
- else
- return build_new_function_call
- (lookup_function_nonclass (fnname, args), args);
-}
-
/* Build a call to operator delete. This has to be handled very specially,
because the restrictions on what signatures match are different from all
other call instances. For a normal delete, only a delete taking (void *)
@@ -2893,7 +3581,7 @@ build_op_new_call (code, type, args, flags)
used to determine what the corresponding new looked like.
SIZE is the size of the memory block to be deleted.
FLAGS are the usual overloading flags.
- PLACEMENT is the corresponding placement new call, or 0. */
+ PLACEMENT is the corresponding placement new call, or NULL_TREE. */
tree
build_op_delete_call (code, addr, size, flags, placement)
@@ -2901,13 +3589,18 @@ build_op_delete_call (code, addr, size, flags, placement)
tree addr, size, placement;
int flags;
{
- tree fn, fns, fnname, fntype, argtypes, args, type;
+ tree fn = NULL_TREE;
+ tree fns, fnname, fntype, argtypes, args, type;
+ int pass;
if (addr == error_mark_node)
return error_mark_node;
type = TREE_TYPE (TREE_TYPE (addr));
- fnname = ansi_opname[code];
+ while (TREE_CODE (type) == ARRAY_TYPE)
+ type = TREE_TYPE (type);
+
+ fnname = ansi_opname (code);
if (IS_AGGR_TYPE (type) && ! (flags & LOOKUP_GLOBAL))
/* In [class.free]
@@ -2947,52 +3640,75 @@ build_op_delete_call (code, addr, size, flags, placement)
args = NULL_TREE;
}
- argtypes = tree_cons (NULL_TREE, ptr_type_node, argtypes);
- fntype = build_function_type (void_type_node, argtypes);
-
/* Strip const and volatile from addr. */
- if (type != TYPE_MAIN_VARIANT (type))
- addr = cp_convert (build_pointer_type (TYPE_MAIN_VARIANT (type)), addr);
-
- fn = instantiate_type (fntype, fns, 2);
+ addr = cp_convert (ptr_type_node, addr);
- if (fn != error_mark_node)
+ /* We make two tries at finding a matching `operator delete'. On
+ the first pass, we look for an one-operator (or placement)
+ operator delete. If we're not doing placement delete, then on
+ the second pass we look for a two-argument delete. */
+ for (pass = 0; pass < (placement ? 1 : 2); ++pass)
{
- if (TREE_CODE (fns) == TREE_LIST)
- /* Member functions. */
- enforce_access (TREE_PURPOSE (fns), fn);
- return build_function_call (fn, expr_tree_cons (NULL_TREE, addr, args));
+ if (pass == 0)
+ argtypes = tree_cons (NULL_TREE, ptr_type_node, argtypes);
+ else
+ /* Normal delete; now try to find a match including the size
+ argument. */
+ argtypes = tree_cons (NULL_TREE, ptr_type_node,
+ tree_cons (NULL_TREE, sizetype,
+ void_list_node));
+ fntype = build_function_type (void_type_node, argtypes);
+
+ /* Go through the `operator delete' functions looking for one
+ with a matching type. */
+ for (fn = BASELINK_P (fns) ? TREE_VALUE (fns) : fns;
+ fn;
+ fn = OVL_NEXT (fn))
+ {
+ tree t;
+
+ /* Exception specifications on the `delete' operator do not
+ matter. */
+ t = build_exception_variant (TREE_TYPE (OVL_CURRENT (fn)),
+ NULL_TREE);
+ /* We also don't compare attributes. We're really just
+ trying to check the types of the first two parameters. */
+ if (comptypes (t, fntype, COMPARE_NO_ATTRIBUTES))
+ break;
+ }
+
+ /* If we found a match, we're done. */
+ if (fn)
+ break;
}
- /* If we are doing placement delete we do nothing if we don't find a
- matching op delete. */
- if (placement)
- return NULL_TREE;
+ /* If we have a matching function, call it. */
+ if (fn)
+ {
+ /* Make sure we have the actual function, and not an
+ OVERLOAD. */
+ fn = OVL_CURRENT (fn);
- /* Normal delete; now try to find a match including the size argument. */
- argtypes = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, sizetype, void_list_node));
- fntype = build_function_type (void_type_node, argtypes);
+ /* If the FN is a member function, make sure that it is
+ accessible. */
+ if (DECL_CLASS_SCOPE_P (fn))
+ enforce_access (type, fn);
- fn = instantiate_type (fntype, fns, 2);
+ if (pass == 0)
+ args = tree_cons (NULL_TREE, addr, args);
+ else
+ args = tree_cons (NULL_TREE, addr,
+ build_tree_list (NULL_TREE, size));
- if (fn != error_mark_node)
- {
- if (BASELINK_P (fns))
- /* Member functions. */
- enforce_access (TREE_PURPOSE (fns), fn);
- return build_function_call
- (fn, expr_tree_cons (NULL_TREE, addr,
- build_expr_list (NULL_TREE, size)));
+ return build_function_call (fn, args);
}
- /* finish_function passes LOOKUP_SPECULATIVELY if we're in a
- destructor, in which case the error should be deferred
- until someone actually tries to delete one of these. */
- if (flags & LOOKUP_SPECULATIVELY)
+ /* If we are doing placement delete we do nothing if we don't find a
+ matching op delete. */
+ if (placement)
return NULL_TREE;
- cp_error ("no suitable operator delete for `%T'", type);
+ error ("no suitable `operator delete' for `%T'", type);
return error_mark_node;
}
@@ -3016,152 +3732,241 @@ enforce_access (basetype_path, decl)
cp_error_at ("`%+#D' is protected", decl);
else
cp_error_at ("`%+#D' is inaccessible", decl);
- cp_error ("within this context");
+ error ("within this context");
return 0;
}
return 1;
}
-/* Perform the conversions in CONVS on the expression EXPR. */
+/* Perform the conversions in CONVS on the expression EXPR.
+ FN and ARGNUM are used for diagnostics. ARGNUM is zero based, -1
+ indicates the `this' argument of a method. INNER is non-zero when
+ being called to continue a conversion chain. It is negative when a
+ reference binding will be applied, positive otherwise. */
static tree
-convert_like (convs, expr)
+convert_like_real (convs, expr, fn, argnum, inner)
tree convs, expr;
+ tree fn;
+ int argnum;
+ int inner;
{
+ int savew, savee;
+
+ tree totype = TREE_TYPE (convs);
+
if (ICS_BAD_FLAG (convs)
&& TREE_CODE (convs) != USER_CONV
- && TREE_CODE (convs) != AMBIG_CONV)
+ && TREE_CODE (convs) != AMBIG_CONV
+ && TREE_CODE (convs) != REF_BIND)
{
tree t = convs;
for (; t; t = TREE_OPERAND (t, 0))
{
- if (TREE_CODE (t) == USER_CONV)
+ if (TREE_CODE (t) == USER_CONV || !ICS_BAD_FLAG (t))
{
- expr = convert_like (t, expr);
+ expr = convert_like_real (t, expr, fn, argnum, 1);
break;
}
else if (TREE_CODE (t) == AMBIG_CONV)
- return convert_like (t, expr);
+ return convert_like_real (t, expr, fn, argnum, 1);
else if (TREE_CODE (t) == IDENTITY_CONV)
break;
}
- return convert_for_initialization
- (NULL_TREE, TREE_TYPE (convs), expr, LOOKUP_NORMAL,
- "conversion", NULL_TREE, 0);
+ pedwarn ("invalid conversion from `%T' to `%T'", TREE_TYPE (expr), totype);
+ if (fn)
+ pedwarn (" initializing argument %P of `%D'", argnum, fn);
+ return cp_convert (totype, expr);
}
-
+
+ if (!inner)
+ expr = dubious_conversion_warnings
+ (totype, expr, "argument", fn, argnum);
switch (TREE_CODE (convs))
{
case USER_CONV:
{
struct z_candidate *cand
= WRAPPER_PTR (TREE_OPERAND (convs, 1));
- tree fn = cand->fn;
+ tree convfn = cand->fn;
tree args;
- int flags = LOOKUP_NORMAL;
- if (DECL_CONSTRUCTOR_P (fn))
+ if (DECL_CONSTRUCTOR_P (convfn))
{
tree t = build_int_2 (0, 0);
- TREE_TYPE (t) = build_pointer_type (DECL_CONTEXT (fn));
-
- args = build_scratch_list (NULL_TREE, expr);
- if (TYPE_USES_PVBASES (DECL_CONTEXT (fn))
- && !flag_vtable_thunks_compat)
- {
- args = scratch_tree_cons (NULL_TREE, vlist_zero_node, args);
- flags != LOOKUP_HAS_VLIST;
- }
- if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
- args = scratch_tree_cons (NULL_TREE, integer_one_node, args);
- args = scratch_tree_cons (NULL_TREE, t, args);
+ TREE_TYPE (t) = build_pointer_type (DECL_CONTEXT (convfn));
+
+ args = build_tree_list (NULL_TREE, expr);
+ if (DECL_HAS_IN_CHARGE_PARM_P (convfn)
+ || DECL_HAS_VTT_PARM_P (convfn))
+ /* We should never try to call the abstract or base constructor
+ from here. */
+ abort ();
+ args = tree_cons (NULL_TREE, t, args);
}
else
args = build_this (expr);
- expr = build_over_call (cand, args, flags);
+ expr = build_over_call (cand, args, LOOKUP_NORMAL);
/* If this is a constructor or a function returning an aggr type,
we need to build up a TARGET_EXPR. */
- if (DECL_CONSTRUCTOR_P (fn))
- expr = build_cplus_new (TREE_TYPE (convs), expr);
+ if (DECL_CONSTRUCTOR_P (convfn))
+ expr = build_cplus_new (totype, expr);
+ /* The result of the call is then used to direct-initialize the object
+ that is the destination of the copy-initialization. [dcl.init]
+
+ Note that this step is not reflected in the conversion sequence;
+ it affects the semantics when we actually perform the
+ conversion, but is not considered during overload resolution.
+
+ If the target is a class, that means call a ctor. */
+ if (IS_AGGR_TYPE (totype)
+ && (inner >= 0 || !lvalue_p (expr)))
+ {
+ savew = warningcount, savee = errorcount;
+ expr = build_new_method_call
+ (NULL_TREE, complete_ctor_identifier,
+ build_tree_list (NULL_TREE, expr), TYPE_BINFO (totype),
+ /* Core issue 84, now a DR, says that we don't allow UDCs
+ for these args (which deliberately breaks copy-init of an
+ auto_ptr<Base> from an auto_ptr<Derived>). */
+ LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING|LOOKUP_NO_CONVERSION);
+
+ /* Tell the user where this failing constructor call came from. */
+ if (fn)
+ {
+ if (warningcount > savew)
+ warning
+ (" initializing argument %P of `%D' from result of `%D'",
+ argnum, fn, convfn);
+ else if (errorcount > savee)
+ error
+ (" initializing argument %P of `%D' from result of `%D'",
+ argnum, fn, convfn);
+ }
+ else
+ {
+ if (warningcount > savew)
+ warning (" initializing temporary from result of `%D'",
+ convfn);
+ else if (errorcount > savee)
+ error (" initializing temporary from result of `%D'",
+ convfn);
+ }
+ expr = build_cplus_new (totype, expr);
+ }
return expr;
}
case IDENTITY_CONV:
if (type_unknown_p (expr))
- expr = instantiate_type (TREE_TYPE (convs), expr, 1);
- if (TREE_READONLY_DECL_P (expr))
- expr = decl_constant_value (expr);
+ expr = instantiate_type (totype, expr, itf_complain);
return expr;
case AMBIG_CONV:
/* Call build_user_type_conversion again for the error. */
return build_user_type_conversion
- (TREE_TYPE (convs), TREE_OPERAND (convs, 0), LOOKUP_NORMAL);
+ (totype, TREE_OPERAND (convs, 0), LOOKUP_NORMAL);
default:
break;
};
- expr = convert_like (TREE_OPERAND (convs, 0), expr);
+ expr = convert_like_real (TREE_OPERAND (convs, 0), expr, fn, argnum,
+ TREE_CODE (convs) == REF_BIND ? -1 : 1);
if (expr == error_mark_node)
return error_mark_node;
+ /* Convert a non-array constant variable to its underlying value, unless we
+ are about to bind it to a reference, in which case we need to
+ leave it as an lvalue. */
+ if (TREE_CODE (convs) != REF_BIND
+ && TREE_CODE (TREE_TYPE (expr)) != ARRAY_TYPE)
+ expr = decl_constant_value (expr);
+
switch (TREE_CODE (convs))
{
case RVALUE_CONV:
- if (! IS_AGGR_TYPE (TREE_TYPE (convs)))
+ if (! IS_AGGR_TYPE (totype))
return expr;
/* else fall through */
case BASE_CONV:
+ if (TREE_CODE (convs) == BASE_CONV && !NEED_TEMPORARY_P (convs))
+ {
+ /* We are going to bind a reference directly to a base-class
+ subobject of EXPR. */
+ tree base_ptr = build_pointer_type (totype);
+
+ /* Build an expression for `*((base*) &expr)'. */
+ expr = build_unary_op (ADDR_EXPR, expr, 0);
+ expr = perform_implicit_conversion (base_ptr, expr);
+ expr = build_indirect_ref (expr, "implicit conversion");
+ return expr;
+ }
+
+ /* Copy-initialization where the cv-unqualified version of the source
+ type is the same class as, or a derived class of, the class of the
+ destination [is treated as direct-initialization]. [dcl.init] */
+ savew = warningcount, savee = errorcount;
+ expr = build_new_method_call (NULL_TREE, complete_ctor_identifier,
+ build_tree_list (NULL_TREE, expr),
+ TYPE_BINFO (totype),
+ LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING);
+ if (fn)
+ {
+ if (warningcount > savew)
+ warning (" initializing argument %P of `%D'", argnum, fn);
+ else if (errorcount > savee)
+ error (" initializing argument %P of `%D'", argnum, fn);
+ }
+ return build_cplus_new (totype, expr);
+
+ case REF_BIND:
{
- tree cvt_expr = build_user_type_conversion
- (TREE_TYPE (convs), expr, LOOKUP_NORMAL);
- if (!cvt_expr)
+ tree ref_type = totype;
+
+ /* If necessary, create a temporary. */
+ if (NEED_TEMPORARY_P (convs) || !lvalue_p (expr))
{
- /* This can occur if, for example, the EXPR has incomplete
- type. We can't check for that before attempting the
- conversion because the type might be an incomplete
- array type, which is OK if some constructor for the
- destination type takes a pointer argument. */
- if (TYPE_SIZE (TREE_TYPE (expr)) == 0)
- {
- if (same_type_p (TREE_TYPE (expr), TREE_TYPE (convs)))
- incomplete_type_error (expr, TREE_TYPE (expr));
- else
- cp_error ("could not convert `%E' (with incomplete type `%T') to `%T'",
- expr, TREE_TYPE (expr), TREE_TYPE (convs));
- }
- else
- cp_error ("could not convert `%E' to `%T'",
- expr, TREE_TYPE (convs));
- return error_mark_node;
+ tree type = TREE_TYPE (TREE_OPERAND (convs, 0));
+ expr = build_target_expr_with_type (expr, type);
}
- return cvt_expr;
+
+ /* Take the address of the thing to which we will bind the
+ reference. */
+ expr = build_unary_op (ADDR_EXPR, expr, 1);
+ if (expr == error_mark_node)
+ return error_mark_node;
+
+ /* Convert it to a pointer to the type referred to by the
+ reference. This will adjust the pointer if a derived to
+ base conversion is being performed. */
+ expr = cp_convert (build_pointer_type (TREE_TYPE (ref_type)),
+ expr);
+ /* Convert the pointer to the desired reference type. */
+ expr = build1 (NOP_EXPR, ref_type, expr);
+
+ return expr;
}
- case REF_BIND:
- return convert_to_reference
- (TREE_TYPE (convs), expr,
- CONV_IMPLICIT, LOOKUP_NORMAL|LOOKUP_NO_CONVERSION,
- error_mark_node);
case LVALUE_CONV:
return decay_conversion (expr);
case QUAL_CONV:
/* Warn about deprecated conversion if appropriate. */
- string_conv_p (TREE_TYPE (convs), expr, 1);
+ string_conv_p (totype, expr, 1);
break;
default:
break;
}
- return ocp_convert (TREE_TYPE (convs), expr, CONV_IMPLICIT,
+ return ocp_convert (totype, expr, CONV_IMPLICIT,
LOOKUP_NORMAL|LOOKUP_NO_CONVERSION);
}
/* ARG is being passed to a varargs function. Perform any conversions
- required. Return the converted value. */
+ required. Array/function to pointer decay must have already happened.
+ Return the converted value. */
tree
convert_arg_to_ellipsis (arg)
@@ -3172,62 +3977,108 @@ convert_arg_to_ellipsis (arg)
< TYPE_PRECISION (double_type_node)))
/* Convert `float' to `double'. */
arg = cp_convert (double_type_node, arg);
- else if (IS_AGGR_TYPE (TREE_TYPE (arg))
- && ! TYPE_HAS_TRIVIAL_INIT_REF (TREE_TYPE (arg)))
- cp_warning ("cannot pass objects of type `%T' through `...'",
- TREE_TYPE (arg));
else
/* Convert `short' and `char' to full-size `int'. */
arg = default_conversion (arg);
arg = require_complete_type (arg);
+ if (arg != error_mark_node && ! pod_type_p (TREE_TYPE (arg)))
+ {
+ /* Undefined behaviour [expr.call] 5.2.2/7. */
+ warning ("cannot pass objects of non-POD type `%#T' through `...'",
+ TREE_TYPE (arg));
+ }
+
return arg;
}
+/* va_arg (EXPR, TYPE) is a builtin. Make sure it is not abused. */
+
+tree
+build_x_va_arg (expr, type)
+ tree expr;
+ tree type;
+{
+ if (processing_template_decl)
+ return build_min (VA_ARG_EXPR, type, expr);
+
+ type = complete_type_or_else (type, NULL_TREE);
+
+ if (expr == error_mark_node || !type)
+ return error_mark_node;
+
+ if (! pod_type_p (type))
+ {
+ /* Undefined behaviour [expr.call] 5.2.2/7. */
+ warning ("cannot receive objects of non-POD type `%#T' through `...'",
+ type);
+ }
+
+ return build_va_arg (expr, type);
+}
+
+/* TYPE has been given to va_arg. Apply the default conversions which would
+ have happened when passed via ellipsis. Return the promoted type, or
+ NULL_TREE, if there is no change. */
+
+tree
+convert_type_from_ellipsis (type)
+ tree type;
+{
+ tree promote;
+
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ promote = build_pointer_type (TREE_TYPE (type));
+ else if (TREE_CODE (type) == FUNCTION_TYPE)
+ promote = build_pointer_type (type);
+ else
+ promote = type_promotes_to (type);
+
+ return same_type_p (type, promote) ? NULL_TREE : promote;
+}
+
/* ARG is a default argument expression being passed to a parameter of
the indicated TYPE, which is a parameter to FN. Do any required
conversions. Return the converted value. */
tree
-convert_default_arg (type, arg, fn)
+convert_default_arg (type, arg, fn, parmnum)
tree type;
tree arg;
tree fn;
+ int parmnum;
{
- if (fn && DECL_TEMPLATE_INFO (fn))
+ if (TREE_CODE (arg) == DEFAULT_ARG)
{
- /* This default argument came from a template. Instantiate the
- default argument here, not in tsubst. In the case of
- something like:
-
- template <class T>
- struct S {
- static T t();
- void f(T = t());
- };
-
- we must be careful to do name lookup in the scope of S<T>,
- rather than in the current class. */
- if (DECL_CLASS_SCOPE_P (fn))
- pushclass (DECL_REAL_CONTEXT (fn), 2);
-
- arg = tsubst_expr (arg, DECL_TI_ARGS (fn), /*complain=*/1, NULL_TREE);
-
- if (DECL_CLASS_SCOPE_P (fn))
- popclass ();
-
- /* Make sure the default argument is reasonable. */
- arg = check_default_argument (type, arg);
+ /* When processing the default args for a class, we can find that
+ there is an ordering constraint, and we call a function who's
+ default args have not yet been converted. For instance,
+ class A {
+ A (int = 0);
+ void Foo (A const & = A ());
+ };
+ We must process A::A before A::Foo's default arg can be converted.
+ Remember the dependent function, so do_pending_defargs can retry,
+ and check loops. */
+ unprocessed_defarg_fn (fn);
+
+ /* Don't return error_mark node, as we won't be able to distinguish
+ genuine errors from this case, and that would lead to repeated
+ diagnostics. Just make something of the right type. */
+ return build1 (NOP_EXPR, type, integer_zero_node);
}
+ if (fn && DECL_TEMPLATE_INFO (fn))
+ arg = tsubst_default_argument (fn, type, arg);
+
arg = break_out_target_exprs (arg);
if (TREE_CODE (arg) == CONSTRUCTOR)
{
arg = digest_init (type, arg, 0);
arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
- "default argument", 0, 0);
+ "default argument", fn, parmnum);
}
else
{
@@ -3236,18 +4087,21 @@ convert_default_arg (type, arg, fn)
arg = copy_node (arg);
arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
- "default argument", 0, 0);
-#ifdef PROMOTE_PROTOTYPES
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
+ "default argument", fn, parmnum);
+ if (PROMOTE_PROTOTYPES
+ && INTEGRAL_TYPE_P (type)
&& (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)))
arg = default_conversion (arg);
-#endif
}
return arg;
}
+/* Subroutine of the various build_*_call functions. Overload resolution
+ has chosen a winning candidate CAND; build up a CALL_EXPR accordingly.
+ ARGS is a TREE_LIST of the unconverted arguments to the call. FLAGS is a
+ bitmask of various LOOKUP_* flags which apply to the call itself. */
+
static tree
build_over_call (cand, args, flags)
struct z_candidate *cand;
@@ -3271,26 +4125,22 @@ build_over_call (cand, args, flags)
enforce_access (cand->basetype_path, fn);
if (args && TREE_CODE (args) != TREE_LIST)
- args = build_scratch_list (NULL_TREE, args);
+ args = build_tree_list (NULL_TREE, args);
arg = args;
/* The implicit parameters to a constructor are not considered by overload
resolution, and must be of the proper type. */
if (DECL_CONSTRUCTOR_P (fn))
{
- converted_args = expr_tree_cons (NULL_TREE, TREE_VALUE (arg), converted_args);
+ converted_args = tree_cons (NULL_TREE, TREE_VALUE (arg), converted_args);
arg = TREE_CHAIN (arg);
parm = TREE_CHAIN (parm);
- if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
- {
- converted_args = expr_tree_cons
- (NULL_TREE, TREE_VALUE (arg), converted_args);
- arg = TREE_CHAIN (arg);
- parm = TREE_CHAIN (parm);
- }
- if (flags & LOOKUP_HAS_VLIST)
+ if (DECL_HAS_IN_CHARGE_PARM_P (fn))
+ /* We should never try to call the abstract constructor. */
+ abort ();
+ if (DECL_HAS_VTT_PARM_P (fn))
{
- converted_args = expr_tree_cons
+ converted_args = tree_cons
(NULL_TREE, TREE_VALUE (arg), converted_args);
arg = TREE_CHAIN (arg);
parm = TREE_CHAIN (parm);
@@ -3303,7 +4153,7 @@ build_over_call (cand, args, flags)
tree argtype = TREE_TYPE (TREE_VALUE (arg));
tree t;
if (ICS_BAD_FLAG (TREE_VEC_ELT (convs, i)))
- cp_pedwarn ("passing `%T' as `this' argument of `%#D' discards qualifiers",
+ pedwarn ("passing `%T' as `this' argument of `%#D' discards qualifiers",
TREE_TYPE (argtype), fn);
/* [class.mfct.nonstatic]: If a nonstatic member function of a class
@@ -3312,12 +4162,11 @@ build_over_call (cand, args, flags)
So we can assume that anything passed as 'this' is non-null, and
optimize accordingly. */
- if (TREE_CODE (parmtype) == POINTER_TYPE)
- t = convert_pointer_to_real (TREE_TYPE (parmtype), TREE_VALUE (arg));
- else
- /* This happens with signatures. */
- t = convert_force (parmtype, TREE_VALUE (arg), CONV_C_CAST);
- converted_args = expr_tree_cons (NULL_TREE, t, converted_args);
+ my_friendly_assert (TREE_CODE (parmtype) == POINTER_TYPE, 19990811);
+ t = lookup_base (TREE_TYPE (TREE_TYPE (TREE_VALUE (arg))),
+ TREE_TYPE (parmtype), ba_ignore, NULL);
+ t = build_base_path (PLUS_EXPR, TREE_VALUE (arg), t, 1);
+ converted_args = tree_cons (NULL_TREE, t, converted_args);
parm = TREE_CHAIN (parm);
arg = TREE_CHAIN (arg);
++i;
@@ -3330,82 +4179,48 @@ build_over_call (cand, args, flags)
tree type = TREE_VALUE (parm);
conv = TREE_VEC_ELT (convs, i);
- if (ICS_BAD_FLAG (conv))
- {
- tree t = conv;
- val = TREE_VALUE (arg);
-
- for (; t; t = TREE_OPERAND (t, 0))
- {
- if (TREE_CODE (t) == USER_CONV
- || TREE_CODE (t) == AMBIG_CONV)
- {
- val = convert_like (t, val);
- break;
- }
- else if (TREE_CODE (t) == IDENTITY_CONV)
- break;
- }
- val = convert_for_initialization
- (NULL_TREE, type, val, LOOKUP_NORMAL,
- "argument passing", fn, i - is_method);
- }
- else
- {
- /* Issue warnings about peculiar, but legal, uses of NULL. */
- if (ARITHMETIC_TYPE_P (TREE_VALUE (parm))
- && TREE_VALUE (arg) == null_node)
- cp_warning ("converting NULL to non-pointer type");
-
- val = convert_like (conv, TREE_VALUE (arg));
- }
+ val = convert_like_with_context
+ (conv, TREE_VALUE (arg), fn, i - is_method);
-#ifdef PROMOTE_PROTOTYPES
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
+ if (PROMOTE_PROTOTYPES
+ && INTEGRAL_TYPE_P (type)
&& (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)))
val = default_conversion (val);
-#endif
- converted_args = expr_tree_cons (NULL_TREE, val, converted_args);
+ converted_args = tree_cons (NULL_TREE, val, converted_args);
}
/* Default arguments */
- for (; parm && parm != void_list_node; parm = TREE_CHAIN (parm))
+ for (; parm && parm != void_list_node; parm = TREE_CHAIN (parm), i++)
converted_args
- = expr_tree_cons (NULL_TREE,
- convert_default_arg (TREE_VALUE (parm),
- TREE_PURPOSE (parm),
- fn),
- converted_args);
+ = tree_cons (NULL_TREE,
+ convert_default_arg (TREE_VALUE (parm),
+ TREE_PURPOSE (parm),
+ fn, i - is_method),
+ converted_args);
/* Ellipsis */
for (; arg; arg = TREE_CHAIN (arg))
converted_args
- = expr_tree_cons (NULL_TREE,
- convert_arg_to_ellipsis (TREE_VALUE (arg)),
- converted_args);
+ = tree_cons (NULL_TREE,
+ convert_arg_to_ellipsis (TREE_VALUE (arg)),
+ converted_args);
converted_args = nreverse (converted_args);
- if (warn_format && (DECL_NAME (fn) || DECL_ASSEMBLER_NAME (fn)))
- check_function_format (DECL_NAME (fn), DECL_ASSEMBLER_NAME (fn),
- converted_args);
+ if (warn_format)
+ check_function_format (NULL, TYPE_ATTRIBUTES (TREE_TYPE (fn)),
+ converted_args);
/* Avoid actually calling copy constructors and copy assignment operators,
if possible. */
if (! flag_elide_constructors)
/* Do things the hard way. */;
- else if (DECL_CONSTRUCTOR_P (fn)
- && TREE_VEC_LENGTH (convs) == 1
- && copy_args_p (fn))
+ else if (TREE_VEC_LENGTH (convs) == 1
+ && DECL_COPY_CONSTRUCTOR_P (fn))
{
tree targ;
- arg = TREE_CHAIN (converted_args);
- if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
- arg = TREE_CHAIN (arg);
- if (flags & LOOKUP_HAS_VLIST)
- arg = TREE_CHAIN (arg);
+ arg = skip_artificial_parms_for (fn, converted_args);
arg = TREE_VALUE (arg);
/* Pull out the real argument, disregarding const-correctness. */
@@ -3417,8 +4232,8 @@ build_over_call (cand, args, flags)
if (TREE_CODE (targ) == ADDR_EXPR)
{
targ = TREE_OPERAND (targ, 0);
- if (!same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (arg))),
- TYPE_MAIN_VARIANT (TREE_TYPE (targ))))
+ if (!same_type_ignoring_top_level_qualifiers_p
+ (TREE_TYPE (TREE_TYPE (arg)), TREE_TYPE (targ)))
targ = NULL_TREE;
}
else
@@ -3444,39 +4259,22 @@ build_over_call (cand, args, flags)
if (! real_lvalue_p (arg))
return arg;
else if (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
- {
- val = build_decl (VAR_DECL, NULL_TREE, DECL_CONTEXT (fn));
- val = build (TARGET_EXPR, DECL_CONTEXT (fn), val, arg, 0, 0);
- TREE_SIDE_EFFECTS (val) = 1;
- return val;
- }
+ return build_target_expr_with_type (arg, DECL_CONTEXT (fn));
}
- else if (! real_lvalue_p (arg)
- || TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
+ else if ((!real_lvalue_p (arg)
+ || TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
+ /* Empty classes have padding which can be hidden
+ inside an (empty) base of the class. This must not
+ be touched as it might overlay things. When the
+ gcc core learns about empty classes, we can treat it
+ like other classes. */
+ && !is_empty_class (DECL_CONTEXT (fn)))
{
tree address;
tree to = stabilize_reference
(build_indirect_ref (TREE_VALUE (args), 0));
- /* If we're initializing an empty class, then we actually
- have to use a MODIFY_EXPR rather than an INIT_EXPR. The
- reason is that the dummy padding member in the target may
- not actually be allocated if TO is a base class
- subobject. Since we've set TYPE_NONCOPIED_PARTS on the
- padding, a MODIFY_EXPR will preserve its value, which is
- the right thing to do if it's not really padding at all.
-
- It's not safe to just throw away the ARG if we're looking
- at an empty class because the ARG might contain a
- TARGET_EXPR which wants to be bound to TO. If it is not,
- expand_expr will assign a dummy slot for the TARGET_EXPR,
- and we will call a destructor for it, which is wrong,
- because we will also destroy TO, but will never have
- constructed it. */
- val = build (is_empty_class (DECL_CLASS_CONTEXT (fn))
- ? MODIFY_EXPR : INIT_EXPR,
- DECL_CONTEXT (fn), to, arg);
- TREE_SIDE_EFFECTS (val) = 1;
+ val = build (INIT_EXPR, DECL_CONTEXT (fn), to, arg);
address = build_unary_op (ADDR_EXPR, val, 0);
/* Avoid a warning about this expression, if the address is
never used. */
@@ -3484,34 +4282,52 @@ build_over_call (cand, args, flags)
return address;
}
}
- else if (DECL_NAME (fn) == ansi_opname[MODIFY_EXPR]
- && copy_args_p (fn)
- && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CLASS_CONTEXT (fn)))
+ else if (DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR
+ && copy_fn_p (fn)
+ && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CONTEXT (fn)))
{
tree to = stabilize_reference
(build_indirect_ref (TREE_VALUE (converted_args), 0));
arg = build_indirect_ref (TREE_VALUE (TREE_CHAIN (converted_args)), 0);
-
- val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
- TREE_SIDE_EFFECTS (val) = 1;
+ if (is_empty_class (TREE_TYPE (to)))
+ {
+ TREE_USED (arg) = 1;
+
+ val = build (COMPOUND_EXPR, DECL_CONTEXT (fn), arg, to);
+ /* Even though the assignment may not actually result in any
+ code being generated, we do not want to warn about the
+ assignment having no effect. That would be confusing to
+ users who may be performing the assignment as part of a
+ generic algorithm, for example.
+
+ Ideally, the notions of having side-effects and of being
+ useless would be orthogonal. */
+ TREE_SIDE_EFFECTS (val) = 1;
+ }
+ else
+ val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
return val;
}
mark_used (fn);
- if (DECL_CLASS_SCOPE_P (fn) && IS_SIGNATURE (DECL_CONTEXT (fn)))
- return build_signature_method_call (fn, converted_args);
- else if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0)
+ if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0)
{
tree t, *p = &TREE_VALUE (converted_args);
- tree binfo = get_binfo
- (DECL_CONTEXT (fn), TREE_TYPE (TREE_TYPE (*p)), 0);
- *p = convert_pointer_to_real (binfo, *p);
+ tree binfo = lookup_base (TREE_TYPE (TREE_TYPE (*p)),
+ DECL_VIRTUAL_CONTEXT (fn),
+ ba_any, NULL);
+ my_friendly_assert (binfo && binfo != error_mark_node, 20010730);
+
+ *p = build_base_path (PLUS_EXPR, *p, binfo, 1);
if (TREE_SIDE_EFFECTS (*p))
*p = save_expr (*p);
t = build_pointer_type (TREE_TYPE (fn));
- fn = build_vfn_ref (p, build_indirect_ref (*p, 0), DECL_VINDEX (fn));
+ if (DECL_CONTEXT (fn) && TYPE_JAVA_INTERFACE (DECL_CONTEXT (fn)))
+ fn = build_java_interface_fn_ref (fn, *p);
+ else
+ fn = build_vfn_ref (build_indirect_ref (*p, 0), DECL_VINDEX (fn));
TREE_TYPE (fn) = t;
}
else if (DECL_INLINE (fn))
@@ -3526,27 +4342,115 @@ build_over_call (cand, args, flags)
if (TREE_CODE (fn) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL
&& DECL_BUILT_IN (TREE_OPERAND (fn, 0)))
- switch (DECL_FUNCTION_CODE (TREE_OPERAND (fn, 0)))
- {
- case BUILT_IN_ABS:
- case BUILT_IN_LABS:
- case BUILT_IN_FABS:
- if (converted_args == 0)
- return integer_zero_node;
- return build_unary_op (ABS_EXPR, TREE_VALUE (converted_args), 0);
- default:
- break;
- }
+ {
+ tree exp;
+ exp = expand_tree_builtin (TREE_OPERAND (fn, 0), args, converted_args);
+ if (exp)
+ return exp;
+ }
- fn = build_call (fn, TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))), converted_args);
- if (TREE_CODE (TREE_TYPE (fn)) == VOID_TYPE)
+ /* Some built-in function calls will be evaluated at
+ compile-time in fold (). */
+ fn = fold (build_call (fn, converted_args));
+ if (VOID_TYPE_P (TREE_TYPE (fn)))
return fn;
fn = require_complete_type (fn);
+ if (fn == error_mark_node)
+ return error_mark_node;
if (IS_AGGR_TYPE (TREE_TYPE (fn)))
fn = build_cplus_new (TREE_TYPE (fn), fn);
return convert_from_reference (fn);
}
+static tree java_iface_lookup_fn;
+
+/* Make an expression which yields the address of the Java interface
+ method FN. This is achieved by generating a call to libjava's
+ _Jv_LookupInterfaceMethodIdx(). */
+
+static tree
+build_java_interface_fn_ref (fn, instance)
+ tree fn, instance;
+{
+ tree lookup_args, lookup_fn, method, idx;
+ tree klass_ref, iface, iface_ref;
+ int i;
+
+ if (!java_iface_lookup_fn)
+ {
+ tree endlink = build_void_list_node ();
+ tree t = tree_cons (NULL_TREE, ptr_type_node,
+ tree_cons (NULL_TREE, ptr_type_node,
+ tree_cons (NULL_TREE, java_int_type_node,
+ endlink)));
+ java_iface_lookup_fn
+ = builtin_function ("_Jv_LookupInterfaceMethodIdx",
+ build_function_type (ptr_type_node, t),
+ 0, NOT_BUILT_IN, NULL);
+ ggc_add_tree_root (&java_iface_lookup_fn, 1);
+ }
+
+ /* Look up the pointer to the runtime java.lang.Class object for `instance'.
+ This is the first entry in the vtable. */
+ klass_ref = build_vtbl_ref (build_indirect_ref (instance, 0),
+ integer_zero_node);
+
+ /* Get the java.lang.Class pointer for the interface being called. */
+ iface = DECL_CONTEXT (fn);
+ iface_ref = lookup_field (iface, get_identifier ("class$"), 0, 0);
+ if (!iface_ref || TREE_CODE (iface_ref) != VAR_DECL
+ || DECL_CONTEXT (iface_ref) != iface)
+ {
+ error ("could not find class$ field in java interface type `%T'",
+ iface);
+ return error_mark_node;
+ }
+ iface_ref = build1 (ADDR_EXPR, build_pointer_type (iface), iface_ref);
+
+ /* Determine the itable index of FN. */
+ i = 1;
+ for (method = TYPE_METHODS (iface); method; method = TREE_CHAIN (method))
+ {
+ if (!DECL_VIRTUAL_P (method))
+ continue;
+ if (fn == method)
+ break;
+ i++;
+ }
+ idx = build_int_2 (i, 0);
+
+ lookup_args = tree_cons (NULL_TREE, klass_ref,
+ tree_cons (NULL_TREE, iface_ref,
+ build_tree_list (NULL_TREE, idx)));
+ lookup_fn = build1 (ADDR_EXPR,
+ build_pointer_type (TREE_TYPE (java_iface_lookup_fn)),
+ java_iface_lookup_fn);
+ return build (CALL_EXPR, ptr_type_node, lookup_fn, lookup_args, NULL_TREE);
+}
+
+/* Returns the value to use for the in-charge parameter when making a
+ call to a function with the indicated NAME. */
+
+tree
+in_charge_arg_for_name (name)
+ tree name;
+{
+ if (name == base_ctor_identifier
+ || name == base_dtor_identifier)
+ return integer_zero_node;
+ else if (name == complete_ctor_identifier)
+ return integer_one_node;
+ else if (name == complete_dtor_identifier)
+ return integer_two_node;
+ else if (name == deleting_dtor_identifier)
+ return integer_three_node;
+
+ /* This function should only be called with one of the names listed
+ above. */
+ abort ();
+ return NULL_TREE;
+}
+
static tree
build_new_method_call (instance, name, args, basetype_path, flags)
tree instance, name, args, basetype_path;
@@ -3556,17 +4460,18 @@ build_new_method_call (instance, name, args, basetype_path, flags)
tree explicit_targs = NULL_TREE;
tree basetype, mem_args = NULL_TREE, fns, instance_ptr;
tree pretty_name;
- tree user_args = args;
+ tree user_args;
tree templates = NULL_TREE;
+ tree call;
int template_only = 0;
if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
{
explicit_targs = TREE_OPERAND (name, 1);
name = TREE_OPERAND (name, 0);
- if (TREE_CODE_CLASS (TREE_CODE (name)) == 'd')
+ if (DECL_P (name))
name = DECL_NAME (name);
- else
+ else
{
if (TREE_CODE (name) == COMPONENT_REF)
name = TREE_OPERAND (name, 1);
@@ -3577,13 +4482,7 @@ build_new_method_call (instance, name, args, basetype_path, flags)
template_only = 1;
}
- /* If there is an extra argument for controlling virtual bases,
- remove it for error reporting. */
- if (flags & LOOKUP_HAS_IN_CHARGE)
- user_args = TREE_CHAIN (args);
- if (flags & LOOKUP_HAS_VLIST)
- user_args = TREE_CHAIN (user_args);
-
+ user_args = args;
args = resolve_args (args);
if (args == error_mark_node)
@@ -3600,25 +4499,14 @@ build_new_method_call (instance, name, args, basetype_path, flags)
basetype = TYPE_MAIN_VARIANT (TREE_TYPE (instance));
/* XXX this should be handled before we get here. */
- if (! IS_AGGR_TYPE (basetype)
- && ! (TYPE_LANG_SPECIFIC (basetype)
- && (IS_SIGNATURE_POINTER (basetype)
- || IS_SIGNATURE_REFERENCE (basetype))))
+ if (! IS_AGGR_TYPE (basetype))
{
if ((flags & LOOKUP_COMPLAIN) && basetype != error_mark_node)
- cp_error ("request for member `%D' in `%E', which is of non-aggregate type `%T'",
+ error ("request for member `%D' in `%E', which is of non-aggregate type `%T'",
name, instance, basetype);
return error_mark_node;
}
-
- /* If `instance' is a signature pointer/reference and `name' is
- not a constructor, we are calling a signature member function.
- In that case set the `basetype' to the signature type. */
- if ((IS_SIGNATURE_POINTER (basetype)
- || IS_SIGNATURE_REFERENCE (basetype))
- && TYPE_IDENTIFIER (basetype) != name)
- basetype = SIGNATURE_TYPE (basetype);
}
if (basetype_path == NULL_TREE)
@@ -3642,8 +4530,53 @@ build_new_method_call (instance, name, args, basetype_path, flags)
TREE_TYPE (instance_ptr) = build_pointer_type (basetype);
}
- pretty_name
- = (name == ctor_identifier ? constructor_name (basetype) : name);
+ /* Callers should explicitly indicate whether they want to construct
+ the complete object or just the part without virtual bases. */
+ my_friendly_assert (name != ctor_identifier, 20000408);
+ /* Similarly for destructors. */
+ my_friendly_assert (name != dtor_identifier, 20000408);
+
+ if (IDENTIFIER_CTOR_OR_DTOR_P (name))
+ {
+ int constructor_p;
+
+ constructor_p = (name == complete_ctor_identifier
+ || name == base_ctor_identifier);
+ pretty_name = (constructor_p
+ ? constructor_name (basetype) : dtor_identifier);
+
+ /* If we're a call to a constructor or destructor for a
+ subobject that uses virtual base classes, then we need to
+ pass down a pointer to a VTT for the subobject. */
+ if ((name == base_ctor_identifier
+ || name == base_dtor_identifier)
+ && TYPE_USES_VIRTUAL_BASECLASSES (basetype))
+ {
+ tree vtt;
+ tree sub_vtt;
+ tree basebinfo = basetype_path;
+
+ /* If the current function is a complete object constructor
+ or destructor, then we fetch the VTT directly.
+ Otherwise, we look it up using the VTT we were given. */
+ vtt = IDENTIFIER_GLOBAL_VALUE (get_vtt_name (current_class_type));
+ vtt = decay_conversion (vtt);
+ vtt = build (COND_EXPR, TREE_TYPE (vtt),
+ build (EQ_EXPR, boolean_type_node,
+ current_in_charge_parm, integer_zero_node),
+ current_vtt_parm,
+ vtt);
+ if (TREE_VIA_VIRTUAL (basebinfo))
+ basebinfo = binfo_for_vbase (basetype, current_class_type);
+ my_friendly_assert (BINFO_SUBVTT_INDEX (basebinfo), 20010110);
+ sub_vtt = build (PLUS_EXPR, TREE_TYPE (vtt), vtt,
+ BINFO_SUBVTT_INDEX (basebinfo));
+
+ args = tree_cons (NULL_TREE, sub_vtt, args);
+ }
+ }
+ else
+ pretty_name = name;
fns = lookup_fnfields (basetype_path, name, 1);
@@ -3651,31 +4584,20 @@ build_new_method_call (instance, name, args, basetype_path, flags)
return error_mark_node;
if (fns)
{
+ tree base = BINFO_TYPE (TREE_PURPOSE (fns));
tree fn = TREE_VALUE (fns);
- if (name == ctor_identifier && TYPE_USES_VIRTUAL_BASECLASSES (basetype)
- && ! (flags & LOOKUP_HAS_IN_CHARGE))
- {
- if (TYPE_USES_PVBASES(basetype)
- && (!flag_vtable_thunks_compat || (name == dtor_identifier)))
- {
- args = scratch_tree_cons (NULL_TREE, vlist_zero_node, args);
- flags |= LOOKUP_HAS_VLIST;
- }
- flags |= LOOKUP_HAS_IN_CHARGE;
- args = scratch_tree_cons (NULL_TREE, integer_one_node, args);
- }
- mem_args = scratch_tree_cons (NULL_TREE, instance_ptr, args);
+ mem_args = tree_cons (NULL_TREE, instance_ptr, args);
for (; fn; fn = OVL_NEXT (fn))
{
tree t = OVL_CURRENT (fn);
tree this_arglist;
/* We can end up here for copy-init of same or base class. */
- if (name == ctor_identifier
- && (flags & LOOKUP_ONLYCONVERTING)
+ if ((flags & LOOKUP_ONLYCONVERTING)
&& DECL_NONCONVERTING_P (t))
continue;
- if (TREE_CODE (TREE_TYPE (t)) == METHOD_TYPE)
+
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
this_arglist = mem_args;
else
this_arglist = args;
@@ -3683,18 +4605,18 @@ build_new_method_call (instance, name, args, basetype_path, flags)
if (TREE_CODE (t) == TEMPLATE_DECL)
{
/* A member template. */
- templates = scratch_tree_cons (NULL_TREE, t, templates);
+ templates = tree_cons (NULL_TREE, t, templates);
candidates =
- add_template_candidate (candidates, t, explicit_targs,
+ add_template_candidate (candidates, t, base, explicit_targs,
this_arglist,
TREE_TYPE (name), flags, DEDUCE_CALL);
}
else if (! template_only)
- candidates = add_function_candidate (candidates, t,
+ candidates = add_function_candidate (candidates, t, base,
this_arglist, flags);
if (candidates)
- candidates->basetype_path = TREE_PURPOSE (fns);
+ candidates->basetype_path = basetype_path;
}
}
@@ -3703,12 +4625,12 @@ build_new_method_call (instance, name, args, basetype_path, flags)
/* XXX will LOOKUP_SPECULATIVELY be needed when this is done? */
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
- if (TYPE_SIZE (basetype) == 0)
+ if (!COMPLETE_TYPE_P (basetype))
incomplete_type_error (instance_ptr, basetype);
else
- cp_error ("no matching function for call to `%T::%D (%A)%V'",
- basetype, pretty_name, user_args,
- TREE_TYPE (TREE_TYPE (instance_ptr)));
+ error ("no matching function for call to `%T::%D(%A)%#V'",
+ basetype, pretty_name, user_args,
+ TREE_TYPE (TREE_TYPE (instance_ptr)));
print_z_candidates (candidates);
return error_mark_node;
}
@@ -3717,41 +4639,45 @@ build_new_method_call (instance, name, args, basetype_path, flags)
if (cand == 0)
{
- cp_error ("call of overloaded `%D(%A)' is ambiguous", pretty_name,
+ error ("call of overloaded `%D(%A)' is ambiguous", pretty_name,
user_args);
print_z_candidates (candidates);
return error_mark_node;
}
- if (DECL_ABSTRACT_VIRTUAL_P (cand->fn)
+ if (DECL_PURE_VIRTUAL_P (cand->fn)
&& instance == current_class_ref
- && DECL_CONSTRUCTOR_P (current_function_decl)
+ && (DECL_CONSTRUCTOR_P (current_function_decl)
+ || DECL_DESTRUCTOR_P (current_function_decl))
&& ! (flags & LOOKUP_NONVIRTUAL)
- && value_member (cand->fn, CLASSTYPE_ABSTRACT_VIRTUALS (basetype)))
- cp_error ("abstract virtual `%#D' called from constructor", cand->fn);
+ && value_member (cand->fn, CLASSTYPE_PURE_VIRTUALS (basetype)))
+ error ((DECL_CONSTRUCTOR_P (current_function_decl) ?
+ "abstract virtual `%#D' called from constructor"
+ : "abstract virtual `%#D' called from destructor"),
+ cand->fn);
if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE
&& is_dummy_object (instance_ptr))
{
- cp_error ("cannot call member function `%D' without object", cand->fn);
+ error ("cannot call member function `%D' without object", cand->fn);
return error_mark_node;
}
if (DECL_VINDEX (cand->fn) && ! (flags & LOOKUP_NONVIRTUAL)
- && ((instance == current_class_ref && (dtor_label || ctor_label))
- || resolves_to_fixed_type_p (instance, 0)))
+ && resolves_to_fixed_type_p (instance, 0))
flags |= LOOKUP_NONVIRTUAL;
- /* Pedantically, normal function declarations are never considered
- to refer to template instantiations, so we only do this with
- -fguiding-decls. */
- if (flag_guiding_decls && templates && ! cand->template
- && ! DECL_INITIAL (cand->fn))
- add_maybe_template (cand->fn, templates);
-
- return build_over_call
- (cand,
- TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE ? mem_args : args,
- flags);
+ if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE)
+ call = build_over_call (cand, mem_args, flags);
+ else
+ {
+ call = build_over_call (cand, args, flags);
+ /* Do evaluate the object parameter in a call to a static member
+ function. */
+ if (TREE_SIDE_EFFECTS (instance))
+ call = build (COMPOUND_EXPR, TREE_TYPE (call), instance, call);
+ }
+
+ return call;
}
/* Returns non-zero iff standard conversion sequence ICS1 is a proper
@@ -3808,8 +4734,7 @@ is_properly_derived_from (derived, base)
/* We only allow proper derivation here. The DERIVED_FROM_P macro
considers every class derived from itself. */
- return (!same_type_p (TYPE_MAIN_VARIANT (derived),
- TYPE_MAIN_VARIANT (base))
+ return (!same_type_ignoring_top_level_qualifiers_p (derived, base)
&& DERIVED_FROM_P (base, derived));
}
@@ -3833,71 +4758,43 @@ maybe_handle_implicit_object (ics)
member and cv is the cv-qualification on the member
function declaration. */
tree t = *ics;
+ tree reference_type;
+
+ /* The `this' parameter is a pointer to a class type. Make the
+ implict conversion talk about a reference to that same class
+ type. */
+ reference_type = TREE_TYPE (TREE_TYPE (*ics));
+ reference_type = build_reference_type (reference_type);
+
if (TREE_CODE (t) == QUAL_CONV)
t = TREE_OPERAND (t, 0);
if (TREE_CODE (t) == PTR_CONV)
t = TREE_OPERAND (t, 0);
t = build1 (IDENTITY_CONV, TREE_TYPE (TREE_TYPE (t)), NULL_TREE);
- t = build_conv (REF_BIND,
- build_reference_type (TREE_TYPE (TREE_TYPE (*ics))),
- t);
- ICS_STD_RANK (t) = ICS_STD_RANK (*ics);
+ t = direct_reference_binding (reference_type, t);
*ics = t;
}
}
-/* If ICS is a REF_BIND, modify it appropriately, set TARGET_TYPE
- to the type the reference originally referred to, and return 1.
- Otherwise, return 0. */
+/* If *ICS is a REF_BIND set *ICS to the remainder of the conversion,
+ and return the type to which the reference refers. Otherwise,
+ leave *ICS unchanged and return NULL_TREE. */
-static int
-maybe_handle_ref_bind (ics, target_type)
+static tree
+maybe_handle_ref_bind (ics)
tree* ics;
- tree* target_type;
{
if (TREE_CODE (*ics) == REF_BIND)
{
- /* [over.ics.rank]
-
- When a parameter of reference type binds directly
- (_dcl.init.ref_) to an argument expression, the implicit
- conversion sequence is the identity conversion, unless the
- argument expression has a type that is a derived class of the
- parameter type, in which case the implicit conversion
- sequence is a derived-to-base Conversion.
-
- If the parameter binds directly to the result of applying a
- conversion function to the argument expression, the implicit
- conversion sequence is a user-defined conversion sequence
- (_over.ics.user_), with the second standard conversion
- sequence either an identity conversion or, if the conversion
- function returns an entity of a type that is a derived class
- of the parameter type, a derived-to-base Conversion.
-
- When a parameter of reference type is not bound directly to
- an argument expression, the conversion sequence is the one
- required to convert the argument expression to the underlying
- type of the reference according to _over.best.ics_.
- Conceptually, this conversion sequence corresponds to
- copy-initializing a temporary of the underlying type with the
- argument expression. Any difference in top-level
- cv-qualification is subsumed by the initialization itself and
- does not constitute a conversion. */
-
tree old_ics = *ics;
-
- *target_type = TREE_TYPE (TREE_TYPE (*ics));
- *ics = TREE_OPERAND (*ics, 0);
- if (TREE_CODE (*ics) == IDENTITY_CONV
- && is_properly_derived_from (TREE_TYPE (*ics), *target_type))
- *ics = build_conv (BASE_CONV, *target_type, *ics);
+ tree type = TREE_TYPE (TREE_TYPE (old_ics));
+ *ics = TREE_OPERAND (old_ics, 0);
ICS_USER_FLAG (*ics) = ICS_USER_FLAG (old_ics);
ICS_BAD_FLAG (*ics) = ICS_BAD_FLAG (old_ics);
-
- return 1;
+ return type;
}
-
- return 0;
+
+ return NULL_TREE;
}
/* Compare two implicit conversion sequences according to the rules set out in
@@ -3919,12 +4816,11 @@ compare_ics (ics1, ics2)
tree deref_from_type2 = NULL_TREE;
tree deref_to_type1 = NULL_TREE;
tree deref_to_type2 = NULL_TREE;
+ int rank1, rank2;
/* REF_BINDING is non-zero if the result of the conversion sequence
is a reference type. In that case TARGET_TYPE is the
type referred to by the reference. */
- int ref_binding1;
- int ref_binding2;
tree target_type1;
tree target_type2;
@@ -3933,8 +4829,8 @@ compare_ics (ics1, ics2)
maybe_handle_implicit_object (&ics2);
/* Handle reference parameters. */
- ref_binding1 = maybe_handle_ref_bind (&ics1, &target_type1);
- ref_binding2 = maybe_handle_ref_bind (&ics2, &target_type2);
+ target_type1 = maybe_handle_ref_bind (&ics1);
+ target_type2 = maybe_handle_ref_bind (&ics2);
/* [over.ics.rank]
@@ -3948,13 +4844,17 @@ compare_ics (ics1, ics2)
--a user-defined conversion sequence (_over.ics.user_) is a
better conversion sequence than an ellipsis conversion sequence
(_over.ics.ellipsis_). */
- if (ICS_RANK (ics1) > ICS_RANK (ics2))
+ rank1 = ICS_RANK (ics1);
+ rank2 = ICS_RANK (ics2);
+
+ if (rank1 > rank2)
return -1;
- else if (ICS_RANK (ics1) < ICS_RANK (ics2))
+ else if (rank1 < rank2)
return 1;
- if (ICS_RANK (ics1) == BAD_RANK)
+ if (rank1 == BAD_RANK)
{
+ /* XXX Isn't this an extension? */
/* Both ICS are bad. We try to make a decision based on what
would have happenned if they'd been good. */
if (ICS_USER_FLAG (ics1) > ICS_USER_FLAG (ics2)
@@ -4169,9 +5069,11 @@ compare_ics (ics1, ics2)
}
}
}
- else if (IS_AGGR_TYPE_CODE (TREE_CODE (from_type1))
+ else if (CLASS_TYPE_P (non_reference (from_type1))
&& same_type_p (from_type1, from_type2))
{
+ tree from = non_reference (from_type1);
+
/* [over.ics.rank]
--binding of an expression of type C to a reference of type
@@ -4179,8 +5081,8 @@ compare_ics (ics1, ics2)
reference of type A&
--conversion of C to B is better than conversion of C to A, */
- if (is_properly_derived_from (from_type1, to_type1)
- && is_properly_derived_from (from_type1, to_type2))
+ if (is_properly_derived_from (from, to_type1)
+ && is_properly_derived_from (from, to_type2))
{
if (is_properly_derived_from (to_type1, to_type2))
return 1;
@@ -4188,9 +5090,11 @@ compare_ics (ics1, ics2)
return -1;
}
}
- else if (IS_AGGR_TYPE_CODE (TREE_CODE (to_type1))
+ else if (CLASS_TYPE_P (non_reference (to_type1))
&& same_type_p (to_type1, to_type2))
{
+ tree to = non_reference (to_type1);
+
/* [over.ics.rank]
--binding of an expression of type B to a reference of type
@@ -4198,8 +5102,8 @@ compare_ics (ics1, ics2)
reference of type A&,
--onversion of B to A is better than conversion of C to A */
- if (is_properly_derived_from (from_type1, to_type1)
- && is_properly_derived_from (from_type2, to_type1))
+ if (is_properly_derived_from (from_type1, to)
+ && is_properly_derived_from (from_type2, to))
{
if (is_properly_derived_from (from_type2, from_type1))
return 1;
@@ -4227,9 +5131,8 @@ compare_ics (ics1, ics2)
initialized by S2 refers is more cv-qualified than the type to
which the reference initialized by S1 refers */
- if (ref_binding1 && ref_binding2
- && same_type_p (TYPE_MAIN_VARIANT (to_type1),
- TYPE_MAIN_VARIANT (to_type2)))
+ if (target_type1 && target_type2
+ && same_type_ignoring_top_level_qualifiers_p (to_type1, to_type2))
return comp_cv_qualification (target_type2, target_type1);
/* Neither conversion sequence is better than the other. */
@@ -4249,7 +5152,7 @@ source_type (t)
|| TREE_CODE (t) == IDENTITY_CONV)
return TREE_TYPE (t);
}
- my_friendly_abort (1823);
+ abort ();
}
/* Note a warning about preferring WINNER to LOSER. We do this by storing
@@ -4260,9 +5163,24 @@ static void
add_warning (winner, loser)
struct z_candidate *winner, *loser;
{
- winner->warnings = expr_tree_cons (NULL_PTR,
- build_expr_ptr_wrapper (loser),
- winner->warnings);
+ winner->warnings = tree_cons (NULL_TREE,
+ build_ptr_wrapper (loser),
+ winner->warnings);
+}
+
+/* Returns true iff functions are equivalent. Equivalent functions are
+ not '==' only if one is a function-local extern function or if
+ both are extern "C". */
+
+static inline int
+equal_functions (fn1, fn2)
+ tree fn1;
+ tree fn2;
+{
+ if (DECL_LOCAL_FUNCTION_P (fn1) || DECL_LOCAL_FUNCTION_P (fn2)
+ || DECL_EXTERN_C_FUNCTION_P (fn1))
+ return decls_match (fn1, fn2);
+ return fn1 == fn2;
}
/* Compare two candidates for overloading as described in
@@ -4288,8 +5206,9 @@ joust (cand1, cand2, warn)
return -1;
/* If we have two pseudo-candidates for conversions to the same type,
- arbitrarily pick one. */
- if (TYPE_P (cand1->fn) && cand1->fn == cand2->fn)
+ or two candidates for the same function, arbitrarily pick one. */
+ if (cand1->fn == cand2->fn
+ && (TYPE_P (cand1->fn) || DECL_P (cand1->fn)))
return 1;
/* a viable function F1
@@ -4300,10 +5219,10 @@ joust (cand1, cand2, warn)
/* for some argument j, ICSj(F1) is a better conversion sequence than
ICSj(F2) */
- /* For comparing static and non-static member functions, we ignore the
- implicit object parameter of the non-static function. The WP says to
- pretend that the static function has an object parm, but that won't
- work with operator overloading. */
+ /* For comparing static and non-static member functions, we ignore
+ the implicit object parameter of the non-static function. The
+ standard says to pretend that the static function has an object
+ parm, but that won't work with operator overloading. */
len = TREE_VEC_LENGTH (cand1->convs);
if (len != TREE_VEC_LENGTH (cand2->convs))
{
@@ -4317,7 +5236,7 @@ joust (cand1, cand2, warn)
--len;
}
else
- my_friendly_abort (42);
+ abort ();
}
for (i = 0; i < len; ++i)
@@ -4352,9 +5271,9 @@ joust (cand1, cand2, warn)
if (warn)
{
- cp_warning ("passing `%T' chooses `%T' over `%T'",
+ warning ("passing `%T' chooses `%T' over `%T'",
type, type1, type2);
- cp_warning (" in call to `%D'", w->fn);
+ warning (" in call to `%D'", w->fn);
}
else
add_warning (w, l);
@@ -4384,19 +5303,29 @@ joust (cand1, cand2, warn)
if (comp != winner)
{
struct z_candidate *w, *l;
+ tree convn;
if (winner == 1)
w = cand1, l = cand2;
else
w = cand2, l = cand1;
- if (warn)
+ if (DECL_CONTEXT (cand1->fn) == DECL_CONTEXT (cand2->fn)
+ && ! DECL_CONSTRUCTOR_P (cand1->fn)
+ && ! DECL_CONSTRUCTOR_P (cand2->fn)
+ && (convn = standard_conversion
+ (TREE_TYPE (TREE_TYPE (l->fn)),
+ TREE_TYPE (TREE_TYPE (w->fn)), NULL_TREE))
+ && TREE_CODE (convn) == QUAL_CONV)
+ /* Don't complain about `operator char *()' beating
+ `operator const char *() const'. */;
+ else if (warn)
{
tree source = source_type (TREE_VEC_ELT (w->convs, 0));
if (! DECL_CONSTRUCTOR_P (w->fn))
source = TREE_TYPE (source);
- cp_warning ("choosing `%D' over `%D'", w->fn, l->fn);
- cp_warning (" for conversion from `%T' to `%T'",
+ warning ("choosing `%D' over `%D'", w->fn, l->fn);
+ warning (" for conversion from `%T' to `%T'",
source, TREE_TYPE (w->second_conv));
- cp_warning (" because conversion sequence for the argument is better");
+ warning (" because conversion sequence for the argument is better");
}
else
add_warning (w, l);
@@ -4407,16 +5336,39 @@ joust (cand1, cand2, warn)
return winner;
/* or, if not that,
- F1 is a non-template function and F2 is a template function */
-
+ F1 is a non-template function and F2 is a template function
+ specialization. */
+
if (! cand1->template && cand2->template)
return 1;
else if (cand1->template && ! cand2->template)
return -1;
- else if (cand1->template && cand2->template)
- winner = more_specialized
- (TI_TEMPLATE (cand1->template), TI_TEMPLATE (cand2->template),
- NULL_TREE);
+
+ /* or, if not that,
+ F1 and F2 are template functions and the function template for F1 is
+ more specialized than the template for F2 according to the partial
+ ordering rules. */
+
+ if (cand1->template && cand2->template)
+ {
+ winner = more_specialized
+ (TI_TEMPLATE (cand1->template), TI_TEMPLATE (cand2->template),
+ DEDUCE_ORDER,
+ /* Tell the deduction code how many real function arguments
+ we saw, not counting the implicit 'this' argument. But,
+ add_function_candidate() suppresses the "this" argument
+ for constructors.
+
+ [temp.func.order]: The presence of unused ellipsis and default
+ arguments has no effect on the partial ordering of function
+ templates. */
+ TREE_VEC_LENGTH (cand1->convs)
+ - (DECL_NONSTATIC_MEMBER_FUNCTION_P (cand1->fn)
+ - DECL_CONSTRUCTOR_P (cand1->fn)));
+ /* HERE */
+ if (winner)
+ return winner;
+ }
/* or, if not that,
the context is an initialization by user-defined conversion (see
@@ -4426,47 +5378,59 @@ joust (cand1, cand2, warn)
sequence than the standard conversion sequence from the return type
of F2 to the destination type. */
- if (! winner && cand1->second_conv)
- winner = compare_ics (cand1->second_conv, cand2->second_conv);
+ if (cand1->second_conv)
+ {
+ winner = compare_ics (cand1->second_conv, cand2->second_conv);
+ if (winner)
+ return winner;
+ }
+
+ /* Check whether we can discard a builtin candidate, either because we
+ have two identical ones or matching builtin and non-builtin candidates.
- /* If the built-in candidates are the same, arbitrarily pick one. */
- if (! winner && cand1->fn == cand2->fn
- && TREE_CODE (cand1->fn) == IDENTIFIER_NODE)
+ (Pedantically in the latter case the builtin which matched the user
+ function should not be added to the overload set, but we spot it here.
+
+ [over.match.oper]
+ ... the builtin candidates include ...
+ - do not have the same parameter type list as any non-template
+ non-member candidate. */
+
+ if (TREE_CODE (cand1->fn) == IDENTIFIER_NODE
+ || TREE_CODE (cand2->fn) == IDENTIFIER_NODE)
{
for (i = 0; i < len; ++i)
if (!same_type_p (TREE_TYPE (TREE_VEC_ELT (cand1->convs, i)),
TREE_TYPE (TREE_VEC_ELT (cand2->convs, i))))
break;
if (i == TREE_VEC_LENGTH (cand1->convs))
- return 1;
-
- /* Kludge around broken overloading rules whereby
- Integer a, b; test ? a : b; is ambiguous, since there's a builtin
- that takes references and another that takes values. */
- if (cand1->fn == ansi_opname[COND_EXPR])
{
- tree c1 = TREE_VEC_ELT (cand1->convs, 1);
- tree c2 = TREE_VEC_ELT (cand2->convs, 1);
- tree t1 = strip_top_quals (non_reference (TREE_TYPE (c1)));
- tree t2 = strip_top_quals (non_reference (TREE_TYPE (c2)));
-
- if (same_type_p (t1, t2))
- {
- if (TREE_CODE (c1) == REF_BIND && TREE_CODE (c2) != REF_BIND)
- return 1;
- if (TREE_CODE (c1) != REF_BIND && TREE_CODE (c2) == REF_BIND)
- return -1;
- }
+ if (cand1->fn == cand2->fn)
+ /* Two built-in candidates; arbitrarily pick one. */
+ return 1;
+ else if (TREE_CODE (cand1->fn) == IDENTIFIER_NODE)
+ /* cand1 is built-in; prefer cand2. */
+ return -1;
+ else
+ /* cand2 is built-in; prefer cand1. */
+ return 1;
}
}
+ /* If the two functions are the same (this can happen with declarations
+ in multiple scopes and arg-dependent lookup), arbitrarily choose one. */
+ if (DECL_P (cand1->fn) && DECL_P (cand2->fn)
+ && equal_functions (cand1->fn, cand2->fn))
+ return 1;
+
tweak:
/* Extension: If the worst conversion for one candidate is worse than the
worst conversion for the other, take the first. */
- if (! winner && ! pedantic)
+ if (!pedantic)
{
int rank1 = IDENTITY_RANK, rank2 = IDENTITY_RANK;
+ struct z_candidate *w = 0, *l = 0;
for (i = 0; i < len; ++i)
{
@@ -4475,14 +5439,26 @@ tweak:
if (ICS_RANK (TREE_VEC_ELT (cand2->convs, i+off2)) > rank2)
rank2 = ICS_RANK (TREE_VEC_ELT (cand2->convs, i+off2));
}
-
if (rank1 < rank2)
- return 1;
+ winner = 1, w = cand1, l = cand2;
if (rank1 > rank2)
- return -1;
+ winner = -1, w = cand2, l = cand1;
+ if (winner)
+ {
+ if (warn)
+ {
+ pedwarn ("choosing `%D' over `%D'", w->fn, l->fn);
+ pedwarn (
+" because worst conversion for the former is better than worst conversion for the latter");
+ }
+ else
+ add_warning (w, l);
+ return winner;
+ }
}
- return winner;
+ my_friendly_assert (!winner, 20010121);
+ return 0;
}
/* Given a list of candidates for overloading, find the best one, if any.
@@ -4541,14 +5517,17 @@ tourney (candidates)
return champ;
}
+/* Returns non-zero if things of type FROM can be converted to TO. */
+
int
can_convert (to, from)
tree to, from;
{
- tree t = implicit_conversion (to, from, NULL_TREE, LOOKUP_NORMAL);
- return (t && ! ICS_BAD_FLAG (t));
+ return can_convert_arg (to, from, NULL_TREE);
}
+/* Returns non-zero if ARG (of type FROM) can be converted to TO. */
+
int
can_convert_arg (to, from, arg)
tree to, from, arg;
@@ -4556,3 +5535,60 @@ can_convert_arg (to, from, arg)
tree t = implicit_conversion (to, from, arg, LOOKUP_NORMAL);
return (t && ! ICS_BAD_FLAG (t));
}
+
+/* Like can_convert_arg, but allows dubious conversions as well. */
+
+int
+can_convert_arg_bad (to, from, arg)
+ tree to, from, arg;
+{
+ tree t = implicit_conversion (to, from, arg, LOOKUP_NORMAL);
+ return !!t;
+}
+
+/* Convert EXPR to TYPE. Return the converted expression.
+
+ Note that we allow bad conversions here because by the time we get to
+ this point we are committed to doing the conversion. If we end up
+ doing a bad conversion, convert_like will complain. */
+
+tree
+perform_implicit_conversion (type, expr)
+ tree type;
+ tree expr;
+{
+ tree conv;
+
+ if (expr == error_mark_node)
+ return error_mark_node;
+ conv = implicit_conversion (type, TREE_TYPE (expr), expr,
+ LOOKUP_NORMAL);
+ if (!conv)
+ {
+ error ("could not convert `%E' to `%T'", expr, type);
+ return error_mark_node;
+ }
+
+ return convert_like (conv, expr);
+}
+
+/* Convert EXPR to the indicated reference TYPE, in a way suitable for
+ initializing a variable of that TYPE. Return the converted
+ expression. */
+
+tree
+initialize_reference (type, expr)
+ tree type;
+ tree expr;
+{
+ tree conv;
+
+ conv = reference_binding (type, TREE_TYPE (expr), expr, LOOKUP_NORMAL);
+ if (!conv || ICS_BAD_FLAG (conv))
+ {
+ error ("could not convert `%E' to `%T'", expr, type);
+ return error_mark_node;
+ }
+
+ return convert_like (conv, expr);
+}
diff --git a/contrib/gcc/cp/cfns.gperf b/contrib/gcc/cp/cfns.gperf
new file mode 100644
index 0000000..0d1e71b
--- /dev/null
+++ b/contrib/gcc/cp/cfns.gperf
@@ -0,0 +1,229 @@
+%{
+#ifdef __GNUC__
+__inline
+#endif
+static unsigned int hash PARAMS ((const char *, unsigned int));
+#ifdef __GNUC__
+__inline
+#endif
+const char * libc_name_p PARAMS ((const char *, unsigned int));
+%}
+# The standard C library functions, for feeding to gperf; the result is used
+# by nothrow_libfn_p.
+#
+# [lib.res.on.exception.handling]: None of the functions from the
+# Standard C library shall report an error by throwing an
+# exception, unless it calls a program-supplied function that
+# throws an exception.
+#
+# bsearch and qsort are commented out because they can call such functions.
+#
+abort
+abs
+acos
+asctime
+asin
+atan
+atan2
+atexit
+atof
+atoi
+atol
+#bsearch
+btowc
+calloc
+ceil
+clearerr
+clock
+cos
+cosh
+ctime
+difftime
+div
+exit
+exp
+fabs
+fclose
+feof
+ferror
+fflush
+fgetc
+fgetpos
+fgets
+fgetwc
+fgetws
+floor
+fmod
+fopen
+fprintf
+fputc
+fputs
+fputwc
+fputws
+fread
+free
+freopen
+frexp
+fscanf
+fseek
+fsetpos
+ftell
+fwide
+fwprintf
+fwrite
+fwscanf
+getc
+getchar
+getenv
+gets
+getwc
+getwchar
+gmtime
+isalnum
+isalpha
+iscntrl
+isdigit
+isgraph
+islower
+isprint
+ispunct
+isspace
+isupper
+iswalnum
+iswalpha
+iswcntrl
+iswctype
+iswdigit
+iswgraph
+iswlower
+iswprint
+iswpunct
+iswspace
+iswupper
+iswxdigit
+isxdigit
+labs
+ldexp
+ldiv
+localeconv
+localtime
+log
+log10
+longjmp
+malloc
+mblen
+mbrlen
+mbrtowc
+mbsinit
+mbsrtowcs
+mbstowcs
+mbtowc
+memchr
+memcmp
+memcpy
+memmove
+memset
+mktime
+modf
+perror
+pow
+printf
+putc
+putchar
+puts
+putwc
+putwchar
+#qsort
+raise
+rand
+realloc
+remove
+rename
+rewind
+scanf
+setbuf
+setlocale
+setvbuf
+signal
+sin
+sinh
+sprintf
+sqrt
+srand
+sscanf
+strcat
+strchr
+strcmp
+strcoll
+strcpy
+strcspn
+strerror
+strftime
+strlen
+strncat
+strncmp
+strncpy
+strpbrk
+strrchr
+strspn
+strstr
+strtod
+strtok
+strtol
+strtoul
+strxfrm
+swprintf
+swscanf
+system
+tan
+tanh
+time
+tmpfile
+tmpnam
+tolower
+toupper
+towctrans
+towlower
+towupper
+ungetc
+ungetwc
+vfprintf
+vfwprintf
+vprintf
+vsprintf
+vswprintf
+vwprintf
+wcrtomb
+wcscat
+wcschr
+wcscmp
+wcscoll
+wcscpy
+wcscspn
+wcsftime
+wcslen
+wcsncat
+wcsncmp
+wcsncpy
+wcspbrk
+wcsrchr
+wcsrtombs
+wcsspn
+wcsstr
+wcstod
+wcstok
+wcstol
+wcstombs
+wcstoul
+wcsxfrm
+wctob
+wctomb
+wctrans
+wctype
+wmemchr
+wmemcmp
+wmemcpy
+wmemmove
+wmemset
+wprintf
+wscanf
diff --git a/contrib/gcc/cp/class.c b/contrib/gcc/cp/class.c
index 74808c5..aa83b8d 100644
--- a/contrib/gcc/cp/class.c
+++ b/contrib/gcc/cp/class.c
@@ -1,5 +1,6 @@
/* Functions related to building classes and their related objects.
- Copyright (C) 1987, 92-97, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -30,18 +31,13 @@ Boston, MA 02111-1307, USA. */
#include "rtl.h"
#include "output.h"
#include "toplev.h"
-#include "splay-tree.h"
+#include "ggc.h"
+#include "lex.h"
#include "obstack.h"
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-/* This is how we tell when two virtual member functions are really the
- same. */
-#define SAME_FN(FN1DECL, FN2DECL) (DECL_ASSEMBLER_NAME (FN1DECL) == DECL_ASSEMBLER_NAME (FN2DECL))
-
-extern void set_class_shadows PROTO ((tree));
-
/* The number of nested classes being processed. If we are not in the
scope of any class, this is zero. */
@@ -66,107 +62,164 @@ typedef struct class_stack_node {
splay_tree names_used;
}* class_stack_node_t;
+typedef struct vtbl_init_data_s
+{
+ /* The base for which we're building initializers. */
+ tree binfo;
+ /* The type of the most-derived type. */
+ tree derived;
+ /* The binfo for the dynamic type. This will be TYPE_BINFO (derived),
+ unless ctor_vtbl_p is true. */
+ tree rtti_binfo;
+ /* The negative-index vtable initializers built up so far. These
+ are in order from least negative index to most negative index. */
+ tree inits;
+ /* The last (i.e., most negative) entry in INITS. */
+ tree* last_init;
+ /* The binfo for the virtual base for which we're building
+ vcall offset initializers. */
+ tree vbase;
+ /* The functions in vbase for which we have already provided vcall
+ offsets. */
+ varray_type fns;
+ /* The vtable index of the next vcall or vbase offset. */
+ tree index;
+ /* Nonzero if we are building the initializer for the primary
+ vtable. */
+ int primary_vtbl_p;
+ /* Nonzero if we are building the initializer for a construction
+ vtable. */
+ int ctor_vtbl_p;
+} vtbl_init_data;
+
+/* The type of a function passed to walk_subobject_offsets. */
+typedef int (*subobject_offset_fn) PARAMS ((tree, tree, splay_tree));
+
/* The stack itself. This is an dynamically resized array. The
number of elements allocated is CURRENT_CLASS_STACK_SIZE. */
static int current_class_stack_size;
static class_stack_node_t current_class_stack;
-/* When we're processing a member function, current_class_ptr is the
- PARM_DECL for the `this' pointer. The current_class_ref is an
- expression for `*this'. */
-tree current_class_ptr, current_class_ref;
-
-/* The following two can be derived from the previous one */
-tree current_class_name; /* IDENTIFIER_NODE: name of current class */
-tree current_class_type; /* _TYPE: the type of the current class */
-tree current_access_specifier;
-tree previous_class_type; /* _TYPE: the previous type that was a class */
-tree previous_class_values; /* TREE_LIST: copy of the class_shadowed list
- when leaving an outermost class scope. */
-
-/* The obstack on which the cached class declarations are kept. */
-static struct obstack class_cache_obstack;
-/* The first object allocated on that obstack. We can use
- obstack_free with tis value to free the entire obstack. */
-char *class_cache_firstobj;
-
-struct base_info;
-
-static tree get_vfield_name PROTO((tree));
-static void finish_struct_anon PROTO((tree));
-static tree build_vbase_pointer PROTO((tree, tree));
-static tree build_vtable_entry PROTO((tree, tree));
-static tree get_vtable_name PROTO((tree));
-static tree get_derived_offset PROTO((tree, tree));
-static tree get_basefndecls PROTO((tree, tree));
-static void set_rtti_entry PROTO((tree, tree, tree));
-static tree build_vtable PROTO((tree, tree));
-static void prepare_fresh_vtable PROTO((tree, tree));
-static tree prepare_ctor_vtable PROTO((tree, tree, tree));
-static void fixup_vtable_deltas1 PROTO((tree, tree));
-static void fixup_vtable_deltas PROTO((tree, int, tree));
-static tree finish_one_ctor_vtable PROTO((tree, tree, tree, tree));
-static tree prepend_ctor_vfields_for_vbase PROTO((tree, tree, tree, tree, int, tree));
-static tree finish_ctor_vtables_for_vbases PROTO((tree, tree, tree));
-static tree finish_ctor_vtables_1 PROTO((tree, tree));
-static tree prepend_vbase_vfields PROTO((tree, int, tree));
-static void finish_ctor_vtables PROTO((tree));
-static void finish_vtbls PROTO((tree, int, tree));
-static void modify_vtable_entry PROTO((tree, tree, tree));
-static tree get_vtable_entry_n PROTO((tree, unsigned HOST_WIDE_INT));
-static void add_virtual_function PROTO((tree *, tree *, int *, tree, tree));
-static tree delete_duplicate_fields_1 PROTO((tree, tree));
-static void delete_duplicate_fields PROTO((tree));
-static void finish_struct_bits PROTO((tree, int));
-static int alter_access PROTO((tree, tree, tree, tree));
-static void handle_using_decl PROTO((tree, tree, tree, tree));
-static int overrides PROTO((tree, tree));
-static int strictly_overrides PROTO((tree, tree));
-static void merge_overrides PROTO((tree, tree, int, tree));
-static void override_one_vtable PROTO((tree, tree, tree));
-static void mark_overriders PROTO((tree, tree));
-static void check_for_override PROTO((tree, tree));
-static tree get_class_offset_1 PROTO((tree, tree, tree, tree, tree));
-static tree get_class_offset PROTO((tree, tree, tree, tree));
-static void modify_one_vtable PROTO((tree, tree, tree, tree));
-static void modify_all_vtables PROTO((tree, tree, tree));
-static void modify_all_direct_vtables PROTO((tree, int, tree, tree,
- tree));
-static void modify_all_indirect_vtables PROTO((tree, int, int, tree,
- tree, tree));
-static int finish_base_struct PROTO((tree, struct base_info *));
-static void finish_struct_methods PROTO((tree));
-static void maybe_warn_about_overly_private_class PROTO ((tree));
-static tree make_method_vec PROTO((int));
-static void free_method_vec PROTO((tree));
-static tree add_implicitly_declared_members PROTO((tree, int, int, int));
-static tree fixed_type_or_null PROTO((tree, int *));
-static tree resolve_address_of_overloaded_function PROTO((tree, tree, int,
- int, tree));
-static void build_vtable_entry_ref PROTO((tree, tree, tree));
-
-/* Way of stacking language names. */
-tree *current_lang_base, *current_lang_stack;
-int current_lang_stacksize;
-
-/* Names of languages we recognize. */
-tree lang_name_c, lang_name_cplusplus, lang_name_java;
-tree current_lang_name;
-
-/* When layout out an aggregate type, the size of the
- basetypes (virtual and non-virtual) is passed to layout_record
- via this node. */
-static tree base_layout_decl;
-
-/* Constants used for access control. */
-tree access_default_node; /* 0 */
-tree access_public_node; /* 1 */
-tree access_protected_node; /* 2 */
-tree access_private_node; /* 3 */
-tree access_default_virtual_node; /* 4 */
-tree access_public_virtual_node; /* 5 */
-tree access_protected_virtual_node; /* 6 */
-tree access_private_virtual_node; /* 7 */
+/* An array of all local classes present in this translation unit, in
+ declaration order. */
+varray_type local_classes;
+
+static tree get_vfield_name PARAMS ((tree));
+static void finish_struct_anon PARAMS ((tree));
+static tree build_vtable_entry PARAMS ((tree, tree, tree));
+static tree get_vtable_name PARAMS ((tree));
+static tree get_basefndecls PARAMS ((tree, tree));
+static int build_primary_vtable PARAMS ((tree, tree));
+static int build_secondary_vtable PARAMS ((tree, tree));
+static void finish_vtbls PARAMS ((tree));
+static void modify_vtable_entry PARAMS ((tree, tree, tree, tree, tree *));
+static void add_virtual_function PARAMS ((tree *, tree *, int *, tree, tree));
+static tree delete_duplicate_fields_1 PARAMS ((tree, tree));
+static void delete_duplicate_fields PARAMS ((tree));
+static void finish_struct_bits PARAMS ((tree));
+static int alter_access PARAMS ((tree, tree, tree));
+static void handle_using_decl PARAMS ((tree, tree));
+static int strictly_overrides PARAMS ((tree, tree));
+static void check_for_override PARAMS ((tree, tree));
+static tree dfs_modify_vtables PARAMS ((tree, void *));
+static tree modify_all_vtables PARAMS ((tree, int *, tree));
+static void determine_primary_base PARAMS ((tree, int *));
+static void finish_struct_methods PARAMS ((tree));
+static void maybe_warn_about_overly_private_class PARAMS ((tree));
+static int field_decl_cmp PARAMS ((const tree *, const tree *));
+static int method_name_cmp PARAMS ((const tree *, const tree *));
+static tree add_implicitly_declared_members PARAMS ((tree, int, int, int));
+static tree fixed_type_or_null PARAMS ((tree, int *, int *));
+static tree resolve_address_of_overloaded_function PARAMS ((tree, tree, int,
+ int, int, tree));
+static tree build_vtable_entry_ref PARAMS ((tree, tree, tree));
+static tree build_vtbl_ref_1 PARAMS ((tree, tree));
+static tree build_vtbl_initializer PARAMS ((tree, tree, tree, tree, int *));
+static int count_fields PARAMS ((tree));
+static int add_fields_to_vec PARAMS ((tree, tree, int));
+static void check_bitfield_decl PARAMS ((tree));
+static void check_field_decl PARAMS ((tree, tree, int *, int *, int *, int *));
+static void check_field_decls PARAMS ((tree, tree *, int *, int *, int *,
+ int *));
+static bool build_base_field PARAMS ((record_layout_info, tree, int *,
+ splay_tree, tree));
+static bool build_base_fields PARAMS ((record_layout_info, int *,
+ splay_tree, tree));
+static void check_methods PARAMS ((tree));
+static void remove_zero_width_bit_fields PARAMS ((tree));
+static void check_bases PARAMS ((tree, int *, int *, int *));
+static void check_bases_and_members PARAMS ((tree, int *));
+static tree create_vtable_ptr PARAMS ((tree, int *, int *, tree *, tree *));
+static void layout_class_type PARAMS ((tree, int *, int *, tree *, tree *));
+static void fixup_pending_inline PARAMS ((tree));
+static void fixup_inline_methods PARAMS ((tree));
+static void set_primary_base PARAMS ((tree, tree, int *));
+static void propagate_binfo_offsets PARAMS ((tree, tree, tree));
+static void layout_virtual_bases PARAMS ((tree, splay_tree));
+static tree dfs_set_offset_for_unshared_vbases PARAMS ((tree, void *));
+static void build_vbase_offset_vtbl_entries PARAMS ((tree, vtbl_init_data *));
+static void add_vcall_offset_vtbl_entries_r PARAMS ((tree, vtbl_init_data *));
+static void add_vcall_offset_vtbl_entries_1 PARAMS ((tree, vtbl_init_data *));
+static void build_vcall_offset_vtbl_entries PARAMS ((tree, vtbl_init_data *));
+static void layout_vtable_decl PARAMS ((tree, int));
+static tree dfs_find_final_overrider PARAMS ((tree, void *));
+static tree find_final_overrider PARAMS ((tree, tree, tree));
+static int make_new_vtable PARAMS ((tree, tree));
+static int maybe_indent_hierarchy PARAMS ((FILE *, int, int));
+static void dump_class_hierarchy_r PARAMS ((FILE *, int, tree, tree, int));
+static void dump_class_hierarchy PARAMS ((tree));
+static void dump_array PARAMS ((FILE *, tree));
+static void dump_vtable PARAMS ((tree, tree, tree));
+static void dump_vtt PARAMS ((tree, tree));
+static tree build_vtable PARAMS ((tree, tree, tree));
+static void initialize_vtable PARAMS ((tree, tree));
+static void initialize_array PARAMS ((tree, tree));
+static void layout_nonempty_base_or_field PARAMS ((record_layout_info,
+ tree, tree,
+ splay_tree, tree));
+static unsigned HOST_WIDE_INT end_of_class PARAMS ((tree, int));
+static bool layout_empty_base PARAMS ((tree, tree, splay_tree, tree));
+static void accumulate_vtbl_inits PARAMS ((tree, tree, tree, tree, tree));
+static tree dfs_accumulate_vtbl_inits PARAMS ((tree, tree, tree, tree,
+ tree));
+static void set_vindex PARAMS ((tree, int *));
+static void build_rtti_vtbl_entries PARAMS ((tree, vtbl_init_data *));
+static void build_vcall_and_vbase_vtbl_entries PARAMS ((tree,
+ vtbl_init_data *));
+static void force_canonical_binfo_r PARAMS ((tree, tree, tree, tree));
+static void force_canonical_binfo PARAMS ((tree, tree, tree, tree));
+static tree dfs_unshared_virtual_bases PARAMS ((tree, void *));
+static void mark_primary_bases PARAMS ((tree));
+static tree mark_primary_virtual_base PARAMS ((tree, tree));
+static void clone_constructors_and_destructors PARAMS ((tree));
+static tree build_clone PARAMS ((tree, tree));
+static void update_vtable_entry_for_fn PARAMS ((tree, tree, tree, tree *));
+static tree copy_virtuals PARAMS ((tree));
+static void build_ctor_vtbl_group PARAMS ((tree, tree));
+static void build_vtt PARAMS ((tree));
+static tree binfo_ctor_vtable PARAMS ((tree));
+static tree *build_vtt_inits PARAMS ((tree, tree, tree *, tree *));
+static tree dfs_build_secondary_vptr_vtt_inits PARAMS ((tree, void *));
+static tree dfs_ctor_vtable_bases_queue_p PARAMS ((tree, void *data));
+static tree dfs_fixup_binfo_vtbls PARAMS ((tree, void *));
+static tree get_original_base PARAMS ((tree, tree));
+static tree dfs_get_primary_binfo PARAMS ((tree, void*));
+static int record_subobject_offset PARAMS ((tree, tree, splay_tree));
+static int check_subobject_offset PARAMS ((tree, tree, splay_tree));
+static int walk_subobject_offsets PARAMS ((tree, subobject_offset_fn,
+ tree, splay_tree, tree, int));
+static void record_subobject_offsets PARAMS ((tree, tree, splay_tree, int));
+static int layout_conflict_p PARAMS ((tree, tree, splay_tree, int));
+static int splay_tree_compare_integer_csts PARAMS ((splay_tree_key k1,
+ splay_tree_key k2));
+static void warn_about_ambiguous_direct_bases PARAMS ((tree));
+static bool type_requires_array_cookie PARAMS ((tree));
+
+/* Macros for dfs walking during vtt construction. See
+ dfs_ctor_vtable_bases_queue_p, dfs_build_secondary_vptr_vtt_inits
+ and dfs_fixup_binfo_vtbls. */
+#define VTT_TOP_LEVEL_P(NODE) TREE_UNSIGNED (NODE)
+#define VTT_MARKED_BINFO_P(NODE) TREE_USED (NODE)
/* Variables shared between class.c and call.c. */
@@ -181,333 +234,163 @@ int n_build_method_call = 0;
int n_inner_fields_searched = 0;
#endif
-/* Virtual baseclass things. */
-
-static tree
-build_vbase_pointer (exp, type)
- tree exp, type;
-{
- char *name;
- FORMAT_VBASE_NAME (name, type);
-
- return build_component_ref (exp, get_identifier (name), NULL_TREE, 0);
-}
-
-#if 0
-/* Is the type of the EXPR, the complete type of the object?
- If we are going to be wrong, we must be conservative, and return 0. */
-
-static int
-complete_type_p (expr)
- tree expr;
-{
- tree type = TYPE_MAIN_VARIANT (TREE_TYPE (expr));
- while (1)
- {
- switch (TREE_CODE (expr))
- {
- case SAVE_EXPR:
- case INDIRECT_REF:
- case ADDR_EXPR:
- case NOP_EXPR:
- case CONVERT_EXPR:
- expr = TREE_OPERAND (expr, 0);
- continue;
-
- case CALL_EXPR:
- if (! TREE_HAS_CONSTRUCTOR (expr))
- break;
- /* fall through... */
- case VAR_DECL:
- case FIELD_DECL:
- if (TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
- && IS_AGGR_TYPE (TREE_TYPE (TREE_TYPE (expr)))
- && TYPE_MAIN_VARIANT (TREE_TYPE (expr)) == type)
- return 1;
- /* fall through... */
- case TARGET_EXPR:
- case PARM_DECL:
- if (IS_AGGR_TYPE (TREE_TYPE (expr))
- && TYPE_MAIN_VARIANT (TREE_TYPE (expr)) == type)
- return 1;
- /* fall through... */
- case PLUS_EXPR:
- default:
- break;
- }
- break;
- }
- return 0;
-}
-#endif
-
-/* Build multi-level access to EXPR using hierarchy path PATH.
- CODE is PLUS_EXPR if we are going with the grain,
- and MINUS_EXPR if we are not (in which case, we cannot traverse
- virtual baseclass links).
-
- TYPE is the type we want this path to have on exit.
-
- NONNULL is non-zero if we know (for any reason) that EXPR is
- not, in fact, zero. */
+/* Convert to or from a base subobject. EXPR is an expression of type
+ `A' or `A*', an expression of type `B' or `B*' is returned. To
+ convert A to a base B, CODE is PLUS_EXPR and BINFO is the binfo for
+ the B base instance within A. To convert base A to derived B, CODE
+ is MINUS_EXPR and BINFO is the binfo for the A instance within B.
+ In this latter case, A must not be a morally virtual base of B.
+ NONNULL is true if EXPR is known to be non-NULL (this is only
+ needed when EXPR is of pointer type). CV qualifiers are preserved
+ from EXPR. */
tree
-build_vbase_path (code, type, expr, path, nonnull)
+build_base_path (code, expr, binfo, nonnull)
enum tree_code code;
- tree type, expr, path;
+ tree expr;
+ tree binfo;
int nonnull;
{
- register int changed = 0;
- tree last = NULL_TREE, last_virtual = NULL_TREE;
+ tree v_binfo = NULL_TREE;
+ tree d_binfo = NULL_TREE;
+ tree probe;
+ tree offset;
+ tree target_type;
+ tree null_test = NULL;
+ tree ptr_target_type;
int fixed_type_p;
- tree null_expr = 0, nonnull_expr;
- tree basetype;
- tree offset = integer_zero_node;
-
- if (BINFO_INHERITANCE_CHAIN (path) == NULL_TREE)
- return build1 (NOP_EXPR, type, expr);
+ int want_pointer = TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE;
- /* If -fthis-is-variable, we might have set nonnull incorrectly. We
- don't care enough to get this right, so just clear it. */
- if (flag_this_is_variable > 0)
- nonnull = 0;
-
- /* We could do better if we had additional logic to convert back to the
- unconverted type (the static type of the complete object), and then
- convert back to the type we want. Until that is done, we only optimize
- if the complete type is the same type as expr has. */
- fixed_type_p = resolves_to_fixed_type_p (expr, &nonnull);
-
- if (!fixed_type_p && TREE_SIDE_EFFECTS (expr))
- expr = save_expr (expr);
- nonnull_expr = expr;
-
- if (BINFO_INHERITANCE_CHAIN (path))
- path = reverse_path (path);
-
- basetype = BINFO_TYPE (path);
+ if (expr == error_mark_node || binfo == error_mark_node || !binfo)
+ return error_mark_node;
- while (path)
+ for (probe = binfo; probe; probe = BINFO_INHERITANCE_CHAIN (probe))
{
- if (TREE_VIA_VIRTUAL (path))
- {
- last_virtual = BINFO_TYPE (path);
- if (code == PLUS_EXPR)
- {
- changed = ! fixed_type_p;
-
- if (changed)
- {
- tree ind;
-
- /* We already check for ambiguous things in the caller, just
- find a path. */
- if (last)
- {
- tree binfo = get_binfo (last, TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (nonnull_expr))), 0);
- nonnull_expr = convert_pointer_to_real (binfo, nonnull_expr);
- }
- ind = build_indirect_ref (nonnull_expr, NULL_PTR);
- nonnull_expr = build_vbase_pointer (ind, last_virtual);
- if (nonnull == 0
- && TREE_CODE (type) == POINTER_TYPE
- && null_expr == NULL_TREE)
- {
- null_expr = build1 (NOP_EXPR, build_pointer_type (last_virtual), integer_zero_node);
- expr = build (COND_EXPR, build_pointer_type (last_virtual),
- build (EQ_EXPR, boolean_type_node, expr,
- integer_zero_node),
- null_expr, nonnull_expr);
- }
- }
- /* else we'll figure out the offset below. */
-
- /* Happens in the case of parse errors. */
- if (nonnull_expr == error_mark_node)
- return error_mark_node;
- }
- else
- {
- cp_error ("cannot cast up from virtual baseclass `%T'",
- last_virtual);
- return error_mark_node;
- }
- }
- last = path;
- path = BINFO_INHERITANCE_CHAIN (path);
+ d_binfo = probe;
+ if (!v_binfo && TREE_VIA_VIRTUAL (probe))
+ v_binfo = probe;
}
- /* LAST is now the last basetype assoc on the path. */
- /* A pointer to a virtual base member of a non-null object
- is non-null. Therefore, we only need to test for zeroness once.
- Make EXPR the canonical expression to deal with here. */
- if (null_expr)
+ probe = TYPE_MAIN_VARIANT (TREE_TYPE (expr));
+ if (want_pointer)
+ probe = TYPE_MAIN_VARIANT (TREE_TYPE (probe));
+
+ my_friendly_assert (code == MINUS_EXPR
+ ? same_type_p (BINFO_TYPE (binfo), probe)
+ : code == PLUS_EXPR
+ ? same_type_p (BINFO_TYPE (d_binfo), probe)
+ : false, 20010723);
+
+ if (code == MINUS_EXPR && v_binfo)
{
- TREE_OPERAND (expr, 2) = nonnull_expr;
- TREE_TYPE (expr) = TREE_TYPE (TREE_OPERAND (expr, 1))
- = TREE_TYPE (nonnull_expr);
+ error ("cannot convert from base `%T' to derived type `%T' via virtual base `%T'",
+ BINFO_TYPE (binfo), BINFO_TYPE (d_binfo), BINFO_TYPE (v_binfo));
+ return error_mark_node;
}
- else
- expr = nonnull_expr;
- /* If we go through any virtual base pointers, make sure that
- casts to BASETYPE from the last virtual base class use
- the right value for BASETYPE. */
- if (changed)
- {
- tree intype = TREE_TYPE (TREE_TYPE (expr));
- if (TYPE_MAIN_VARIANT (intype) != BINFO_TYPE (last))
- {
- tree binfo = get_binfo (last, TYPE_MAIN_VARIANT (intype), 0);
- offset = BINFO_OFFSET (binfo);
- }
- }
- else
+ fixed_type_p = resolves_to_fixed_type_p (expr, &nonnull);
+ if (fixed_type_p < 0)
+ /* Virtual base layout is not fixed, even in ctors and dtors. */
+ fixed_type_p = 0;
+ if (!fixed_type_p && TREE_SIDE_EFFECTS (expr))
+ expr = save_expr (expr);
+
+ if (!want_pointer)
+ expr = build_unary_op (ADDR_EXPR, expr, 0);
+ else if (!nonnull)
+ null_test = build (EQ_EXPR, boolean_type_node, expr, integer_zero_node);
+
+ offset = BINFO_OFFSET (binfo);
+
+ if (v_binfo && !fixed_type_p)
{
- if (last_virtual)
- {
- offset = BINFO_OFFSET (binfo_member (last_virtual,
- CLASSTYPE_VBASECLASSES (basetype)));
- offset = size_binop (PLUS_EXPR, offset, BINFO_OFFSET (last));
- }
+ /* Going via virtual base V_BINFO. We need the static offset
+ from V_BINFO to BINFO, and the dynamic offset from D_BINFO to
+ V_BINFO. That offset is an entry in D_BINFO's vtable. */
+ tree v_offset = build_vfield_ref (build_indirect_ref (expr, NULL),
+ TREE_TYPE (TREE_TYPE (expr)));
+
+ v_binfo = binfo_for_vbase (BINFO_TYPE (v_binfo), BINFO_TYPE (d_binfo));
+
+ v_offset = build (PLUS_EXPR, TREE_TYPE (v_offset),
+ v_offset, BINFO_VPTR_FIELD (v_binfo));
+ v_offset = build1 (NOP_EXPR,
+ build_pointer_type (ptrdiff_type_node),
+ v_offset);
+ v_offset = build_indirect_ref (v_offset, NULL);
+
+ offset = cp_convert (ptrdiff_type_node,
+ size_diffop (offset, BINFO_OFFSET (v_binfo)));
+
+ if (!integer_zerop (offset))
+ offset = build (code, ptrdiff_type_node, v_offset, offset);
else
- offset = BINFO_OFFSET (last);
+ offset = v_offset;
}
- if (TREE_INT_CST_LOW (offset))
- {
- /* Bash types to make the backend happy. */
- offset = cp_convert (type, offset);
-#if 0
- /* This shouldn't be necessary. (mrs) */
- expr = build1 (NOP_EXPR, type, expr);
-#endif
-
- /* If expr might be 0, we need to preserve that zeroness. */
- if (nonnull == 0)
- {
- if (null_expr)
- TREE_TYPE (null_expr) = type;
- else
- null_expr = build1 (NOP_EXPR, type, integer_zero_node);
- if (TREE_SIDE_EFFECTS (expr))
- expr = save_expr (expr);
-
- return build (COND_EXPR, type,
- build (EQ_EXPR, boolean_type_node, expr, integer_zero_node),
- null_expr,
- build (code, type, expr, offset));
- }
- else return build (code, type, expr, offset);
- }
+ target_type = code == PLUS_EXPR ? BINFO_TYPE (binfo) : BINFO_TYPE (d_binfo);
+
+ target_type = cp_build_qualified_type
+ (target_type, cp_type_quals (TREE_TYPE (TREE_TYPE (expr))));
+ ptr_target_type = build_pointer_type (target_type);
+ if (want_pointer)
+ target_type = ptr_target_type;
+
+ expr = build1 (NOP_EXPR, ptr_target_type, expr);
- /* Cannot change the TREE_TYPE of a NOP_EXPR here, since it may
- be used multiple times in initialization of multiple inheritance. */
- if (null_expr)
- {
- TREE_TYPE (expr) = type;
- return expr;
- }
+ if (!integer_zerop (offset))
+ expr = build (code, ptr_target_type, expr, offset);
else
- return build1 (NOP_EXPR, type, expr);
+ null_test = NULL;
+
+ if (!want_pointer)
+ expr = build_indirect_ref (expr, NULL);
+
+ if (null_test)
+ expr = build (COND_EXPR, target_type, null_test,
+ build1 (NOP_EXPR, target_type, integer_zero_node),
+ expr);
+
+ return expr;
}
+
/* Virtual function things. */
-/* Build an entry in the virtual function table.
- DELTA is the offset for the `this' pointer.
- PFN is an ADDR_EXPR containing a pointer to the virtual function.
- Note that the index (DELTA2) in the virtual function table
- is always 0. */
-
static tree
-build_vtable_entry (delta, pfn)
- tree delta, pfn;
+build_vtable_entry_ref (array_ref, instance, idx)
+ tree array_ref, instance, idx;
{
- if (flag_vtable_thunks)
- {
- HOST_WIDE_INT idelta = TREE_INT_CST_LOW (delta);
- if (idelta && ! DECL_ABSTRACT_VIRTUAL_P (TREE_OPERAND (pfn, 0)))
- {
- pfn = build1 (ADDR_EXPR, vtable_entry_type,
- make_thunk (pfn, idelta));
- TREE_READONLY (pfn) = 1;
- TREE_CONSTANT (pfn) = 1;
- }
-#ifdef GATHER_STATISTICS
- n_vtable_entries += 1;
-#endif
- return pfn;
- }
- else
- {
- extern int flag_huge_objects;
- tree elems = expr_tree_cons (NULL_TREE, delta,
- expr_tree_cons (NULL_TREE, integer_zero_node,
- build_expr_list (NULL_TREE, pfn)));
- tree entry = build (CONSTRUCTOR, vtable_entry_type, NULL_TREE, elems);
-
- /* DELTA used to be constructed by `size_int' and/or size_binop,
- which caused overflow problems when it was negative. That should
- be fixed now. */
-
- if (! int_fits_type_p (delta, delta_type_node))
- {
- if (flag_huge_objects)
- sorry ("object size exceeds built-in limit for virtual function table implementation");
- else
- sorry ("object size exceeds normal limit for virtual function table implementation, recompile all source and use -fhuge-objects");
- }
-
- TREE_CONSTANT (entry) = 1;
- TREE_STATIC (entry) = 1;
- TREE_READONLY (entry) = 1;
-
-#ifdef GATHER_STATISTICS
- n_vtable_entries += 1;
-#endif
+ tree i, i2, vtable, first_fn, basetype;
- return entry;
- }
-}
-
-/* We want to give the assembler the vtable identifier as well as
- the offset to the function pointer. So we generate
-
- __asm__ __volatile__ (".vtable_entry %c0, %c1"
- : : "s"(&class_vtable),
- "i"((long)&vtbl[idx].pfn - (long)&vtbl[0])); */
+ basetype = TREE_TYPE (instance);
+ if (TREE_CODE (basetype) == REFERENCE_TYPE)
+ basetype = TREE_TYPE (basetype);
-static void
-build_vtable_entry_ref (basetype, vtbl, idx)
- tree basetype, vtbl, idx;
-{
- static char asm_stmt[] = ".vtable_entry %c0, %c1";
- tree s, i, i2;
+ vtable = get_vtbl_decl_for_binfo (TYPE_BINFO (basetype));
+ first_fn = TYPE_BINFO_VTABLE (basetype);
- s = build_unary_op (ADDR_EXPR, TYPE_BINFO_VTABLE (basetype), 0);
- s = build_tree_list (build_string (1, "s"), s);
+ i = fold (build_array_ref (first_fn, idx));
+ i = fold (build_c_cast (ptrdiff_type_node,
+ build_unary_op (ADDR_EXPR, i, 0)));
+ i2 = fold (build_array_ref (vtable, build_int_2 (0,0)));
+ i2 = fold (build_c_cast (ptrdiff_type_node,
+ build_unary_op (ADDR_EXPR, i2, 0)));
+ i = fold (cp_build_binary_op (MINUS_EXPR, i, i2));
- i = build_array_ref (vtbl, idx);
- if (!flag_vtable_thunks)
- i = build_component_ref (i, pfn_identifier, vtable_entry_type, 0);
- i = build_c_cast (ptrdiff_type_node, build_unary_op (ADDR_EXPR, i, 0));
- i2 = build_array_ref (vtbl, build_int_2(0,0));
- i2 = build_c_cast (ptrdiff_type_node, build_unary_op (ADDR_EXPR, i2, 0));
- i = build_binary_op (MINUS_EXPR, i, i2);
- i = build_tree_list (build_string (1, "i"), i);
+ if (TREE_CODE (i) != INTEGER_CST)
+ abort ();
- expand_asm_operands (build_string (sizeof(asm_stmt)-1, asm_stmt),
- NULL_TREE, chainon (s, i), NULL_TREE, 1, NULL, 0);
+ return build (VTABLE_REF, TREE_TYPE (array_ref), array_ref, vtable, i);
}
/* Given an object INSTANCE, return an expression which yields the
- virtual function vtable element corresponding to INDEX. There are
- many special cases for INSTANCE which we take care of here, mainly
- to avoid creating extra tree nodes when we don't have to. */
+ vtable element corresponding to INDEX. There are many special
+ cases for INSTANCE which we take care of here, mainly to avoid
+ creating extra tree nodes when we don't have to. */
-tree
-build_vtbl_ref (instance, idx)
+static tree
+build_vtbl_ref_1 (instance, idx)
tree instance, idx;
{
tree vtbl, aref;
@@ -555,53 +438,65 @@ build_vtbl_ref (instance, idx)
&& (TREE_CODE (instance) == RESULT_DECL
|| TREE_CODE (instance) == PARM_DECL
|| TREE_CODE (instance) == VAR_DECL))
- vtbl = TYPE_BINFO_VTABLE (basetype);
+ {
+ vtbl = TYPE_BINFO_VTABLE (basetype);
+ /* Knowing the dynamic type of INSTANCE we can easily obtain
+ the correct vtable entry. We resolve this back to be in
+ terms of the primary vtable. */
+ if (TREE_CODE (vtbl) == PLUS_EXPR)
+ {
+ idx = fold (build (PLUS_EXPR,
+ TREE_TYPE (idx),
+ idx,
+ build (EXACT_DIV_EXPR,
+ TREE_TYPE (idx),
+ TREE_OPERAND (vtbl, 1),
+ TYPE_SIZE_UNIT (vtable_entry_type))));
+ vtbl = get_vtbl_decl_for_binfo (TYPE_BINFO (basetype));
+ }
+ }
else
vtbl = build_vfield_ref (instance, basetype);
}
assemble_external (vtbl);
- if (flag_vtable_gc)
- build_vtable_entry_ref (basetype, vtbl, idx);
-
aref = build_array_ref (vtbl, idx);
return aref;
}
-/* Given an object INSTANCE, return an expression which yields the
- virtual function corresponding to INDEX. There are many special
- cases for INSTANCE which we take care of here, mainly to avoid
- creating extra tree nodes when we don't have to. */
-
tree
-build_vfn_ref (ptr_to_instptr, instance, idx)
- tree *ptr_to_instptr, instance;
- tree idx;
+build_vtbl_ref (instance, idx)
+ tree instance, idx;
{
- tree aref = build_vtbl_ref (instance, idx);
+ tree aref = build_vtbl_ref_1 (instance, idx);
- /* When using thunks, there is no extra delta, and we get the pfn
- directly. */
- if (flag_vtable_thunks)
- return aref;
+ if (flag_vtable_gc)
+ aref = build_vtable_entry_ref (aref, instance, idx);
- if (ptr_to_instptr)
- {
- /* Save the intermediate result in a SAVE_EXPR so we don't have to
- compute each component of the virtual function pointer twice. */
- if (TREE_CODE (aref) == INDIRECT_REF)
- TREE_OPERAND (aref, 0) = save_expr (TREE_OPERAND (aref, 0));
+ return aref;
+}
- *ptr_to_instptr
- = build (PLUS_EXPR, TREE_TYPE (*ptr_to_instptr),
- *ptr_to_instptr,
- cp_convert (ptrdiff_type_node,
- build_component_ref (aref, delta_identifier, NULL_TREE, 0)));
- }
+/* Given an object INSTANCE, return an expression which yields a
+ function pointer corresponding to vtable element INDEX. */
- return build_component_ref (aref, pfn_identifier, NULL_TREE, 0);
+tree
+build_vfn_ref (instance, idx)
+ tree instance, idx;
+{
+ tree aref = build_vtbl_ref_1 (instance, idx);
+
+ /* When using function descriptors, the address of the
+ vtable entry is treated as a function pointer. */
+ if (TARGET_VTABLE_USES_DESCRIPTORS)
+ aref = build1 (NOP_EXPR, TREE_TYPE (aref),
+ build_unary_op (ADDR_EXPR, aref, /*noconvert=*/1));
+
+ if (flag_vtable_gc)
+ aref = build_vtable_entry_ref (aref, instance, idx);
+
+ return aref;
}
/* Return the name of the virtual function table (as an IDENTIFIER_NODE)
@@ -611,123 +506,137 @@ static tree
get_vtable_name (type)
tree type;
{
- tree type_id = build_typename_overload (type);
- char *buf = (char *) alloca (strlen (VTABLE_NAME_FORMAT)
- + IDENTIFIER_LENGTH (type_id) + 2);
- const char *ptr = IDENTIFIER_POINTER (type_id);
- int i;
- for (i = 0; ptr[i] == OPERATOR_TYPENAME_FORMAT[i]; i++) ;
-#if 0
- /* We don't take off the numbers; prepare_fresh_vtable uses the
- DECL_ASSEMBLER_NAME for the type, which includes the number
- in `3foo'. If we were to pull them off here, we'd end up with
- something like `_vt.foo.3bar', instead of a uniform definition. */
- while (ptr[i] >= '0' && ptr[i] <= '9')
- i += 1;
-#endif
- sprintf (buf, VTABLE_NAME_FORMAT, ptr+i);
- return get_identifier (buf);
+ return mangle_vtbl_for_type (type);
}
-/* Return the offset to the main vtable for a given base BINFO. */
+/* Return an IDENTIFIER_NODE for the name of the virtual table table
+ for TYPE. */
tree
-get_vfield_offset (binfo)
- tree binfo;
+get_vtt_name (type)
+ tree type;
{
- tree tmp
- = size_binop (FLOOR_DIV_EXPR,
- DECL_FIELD_BITPOS (CLASSTYPE_VFIELD (BINFO_TYPE (binfo))),
- size_int (BITS_PER_UNIT));
- tmp = convert (sizetype, tmp);
- return size_binop (PLUS_EXPR, tmp, BINFO_OFFSET (binfo));
+ return mangle_vtt_for_type (type);
}
-/* Get the offset to the start of the original binfo that we derived
- this binfo from. If we find TYPE first, return the offset only
- that far. The shortened search is useful because the this pointer
- on method calling is expected to point to a DECL_CONTEXT (fndecl)
- object, and not a baseclass of it. */
+/* Create a VAR_DECL for a primary or secondary vtable for CLASS_TYPE.
+ (For a secondary vtable for B-in-D, CLASS_TYPE should be D, not B.)
+ Use NAME for the name of the vtable, and VTABLE_TYPE for its type. */
static tree
-get_derived_offset (binfo, type)
- tree binfo, type;
+build_vtable (class_type, name, vtable_type)
+ tree class_type;
+ tree name;
+ tree vtable_type;
{
- tree offset1 = get_vfield_offset (TYPE_BINFO (BINFO_TYPE (binfo)));
- tree offset2;
- int i;
- while (BINFO_BASETYPES (binfo)
- && (i=CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo))) != -1)
- {
- tree binfos = BINFO_BASETYPES (binfo);
- if (BINFO_TYPE (binfo) == type)
- break;
- binfo = TREE_VEC_ELT (binfos, i);
- }
- offset2 = get_vfield_offset (TYPE_BINFO (BINFO_TYPE (binfo)));
- return size_binop (MINUS_EXPR, offset1, offset2);
+ tree decl;
+
+ decl = build_lang_decl (VAR_DECL, name, vtable_type);
+ /* vtable names are already mangled; give them their DECL_ASSEMBLER_NAME
+ now to avoid confusion in mangle_decl. */
+ SET_DECL_ASSEMBLER_NAME (decl, name);
+ DECL_CONTEXT (decl) = class_type;
+ DECL_ARTIFICIAL (decl) = 1;
+ TREE_STATIC (decl) = 1;
+ TREE_READONLY (decl) = 1;
+ DECL_VIRTUAL_P (decl) = 1;
+ import_export_vtable (decl, class_type, 0);
+
+ return decl;
}
-/* Update the rtti info for this class. */
+/* Get the VAR_DECL of the vtable for TYPE. TYPE need not be polymorphic,
+ or even complete. If this does not exist, create it. If COMPLETE is
+ non-zero, then complete the definition of it -- that will render it
+ impossible to actually build the vtable, but is useful to get at those
+ which are known to exist in the runtime. */
-static void
-set_rtti_entry (virtuals, offset, type)
- tree virtuals, offset, type;
+tree
+get_vtable_decl (type, complete)
+ tree type;
+ int complete;
{
- tree vfn;
+ tree name = get_vtable_name (type);
+ tree decl = IDENTIFIER_GLOBAL_VALUE (name);
+
+ if (decl)
+ {
+ my_friendly_assert (TREE_CODE (decl) == VAR_DECL
+ && DECL_VIRTUAL_P (decl), 20000118);
+ return decl;
+ }
+
+ decl = build_vtable (type, name, void_type_node);
+ decl = pushdecl_top_level (decl);
+ my_friendly_assert (IDENTIFIER_GLOBAL_VALUE (name) == decl,
+ 20000517);
+
+ /* At one time the vtable info was grabbed 2 words at a time. This
+ fails on sparc unless you have 8-byte alignment. (tiemann) */
+ DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node),
+ DECL_ALIGN (decl));
- if (CLASSTYPE_COM_INTERFACE (type))
- return;
+ if (complete)
+ {
+ DECL_EXTERNAL (decl) = 1;
+ cp_finish_decl (decl, NULL_TREE, NULL_TREE, 0);
+ }
- if (flag_rtti)
- vfn = build1 (ADDR_EXPR, vfunc_ptr_type_node, get_tinfo_fn_unused (type));
- else
- vfn = build1 (NOP_EXPR, vfunc_ptr_type_node, size_zero_node);
- TREE_CONSTANT (vfn) = 1;
+ return decl;
+}
- if (! flag_vtable_thunks)
- TREE_VALUE (virtuals) = build_vtable_entry (offset, vfn);
- else
- {
- tree voff = build1 (NOP_EXPR, vfunc_ptr_type_node, offset);
- TREE_CONSTANT (voff) = 1;
+/* Returns a copy of the BINFO_VIRTUALS list in BINFO. The
+ BV_VCALL_INDEX for each entry is cleared. */
- TREE_VALUE (virtuals) = build_vtable_entry (integer_zero_node, voff);
+static tree
+copy_virtuals (binfo)
+ tree binfo;
+{
+ tree copies;
+ tree t;
- /* The second slot is for the tdesc pointer when thunks are used. */
- TREE_VALUE (TREE_CHAIN (virtuals))
- = build_vtable_entry (integer_zero_node, vfn);
+ copies = copy_list (BINFO_VIRTUALS (binfo));
+ for (t = copies; t; t = TREE_CHAIN (t))
+ {
+ BV_VCALL_INDEX (t) = NULL_TREE;
+ BV_USE_VCALL_INDEX_P (t) = 0;
}
+
+ return copies;
}
-/* Build a virtual function for type TYPE.
- If BINFO is non-NULL, build the vtable starting with the initial
- approximation that it is the same as the one which is the head of
- the association list. */
+/* Build the primary virtual function table for TYPE. If BINFO is
+ non-NULL, build the vtable starting with the initial approximation
+ that it is the same as the one which is the head of the association
+ list. Returns a non-zero value if a new vtable is actually
+ created. */
-static tree
-build_vtable (binfo, type)
+static int
+build_primary_vtable (binfo, type)
tree binfo, type;
{
- tree name = get_vtable_name (type);
- tree virtuals, decl;
+ tree decl;
+ tree virtuals;
+ decl = get_vtable_decl (type, /*complete=*/0);
+
if (binfo)
{
- tree offset;
-
- virtuals = copy_list (BINFO_VIRTUALS (binfo));
- decl = build_lang_decl (VAR_DECL, name, TREE_TYPE (BINFO_VTABLE (binfo)));
-
- /* Now do rtti stuff. */
- offset = get_derived_offset (TYPE_BINFO (type), NULL_TREE);
- offset = ssize_binop (MINUS_EXPR, integer_zero_node, offset);
- set_rtti_entry (virtuals, offset, type);
+ if (BINFO_NEW_VTABLE_MARKED (binfo, type))
+ /* We have already created a vtable for this base, so there's
+ no need to do it again. */
+ return 0;
+
+ virtuals = copy_virtuals (binfo);
+ TREE_TYPE (decl) = TREE_TYPE (get_vtbl_decl_for_binfo (binfo));
+ DECL_SIZE (decl) = TYPE_SIZE (TREE_TYPE (decl));
+ DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (TREE_TYPE (decl));
}
else
{
+ my_friendly_assert (TREE_CODE (TREE_TYPE (decl)) == VOID_TYPE,
+ 20000118);
virtuals = NULL_TREE;
- decl = build_lang_decl (VAR_DECL, name, void_type_node);
}
#ifdef GATHER_STATISTICS
@@ -735,625 +644,402 @@ build_vtable (binfo, type)
n_vtable_elems += list_length (virtuals);
#endif
- /* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */
- import_export_vtable (decl, type, 0);
-
- decl = pushdecl_top_level (decl);
- SET_IDENTIFIER_GLOBAL_VALUE (name, decl);
/* Initialize the association list for this type, based
on our first approximation. */
TYPE_BINFO_VTABLE (type) = decl;
TYPE_BINFO_VIRTUALS (type) = virtuals;
-
- DECL_ARTIFICIAL (decl) = 1;
- TREE_STATIC (decl) = 1;
-#ifndef WRITABLE_VTABLES
- /* Make them READONLY by default. (mrs) */
- TREE_READONLY (decl) = 1;
-#endif
- /* At one time the vtable info was grabbed 2 words at a time. This
- fails on sparc unless you have 8-byte alignment. (tiemann) */
- DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node),
- DECL_ALIGN (decl));
-
- DECL_VIRTUAL_P (decl) = 1;
- DECL_CONTEXT (decl) = type;
-
- binfo = TYPE_BINFO (type);
- SET_BINFO_NEW_VTABLE_MARKED (binfo);
- return decl;
+ SET_BINFO_NEW_VTABLE_MARKED (TYPE_BINFO (type), type);
+ return 1;
}
-extern tree signed_size_zero_node;
-
-/* Give TYPE a new virtual function table which is initialized
+/* Give BINFO a new virtual function table which is initialized
with a skeleton-copy of its original initialization. The only
entry that changes is the `delta' entry, so we can really
share a lot of structure.
- FOR_TYPE is the derived type which caused this table to
+ FOR_TYPE is the most derived type which caused this table to
be needed.
- BINFO is the type association which provided TYPE for FOR_TYPE.
+ Returns non-zero if we haven't met BINFO before.
The order in which vtables are built (by calling this function) for
an object must remain the same, otherwise a binary incompatibility
can result. */
-static void
-prepare_fresh_vtable (binfo, for_type)
+static int
+build_secondary_vtable (binfo, for_type)
tree binfo, for_type;
{
- tree basetype;
- tree orig_decl = BINFO_VTABLE (binfo);
- tree name;
- tree new_decl;
- tree offset;
- tree path = binfo;
- char *buf, *buf2;
- char joiner = '_';
- int i;
-
-#ifdef JOINER
- joiner = JOINER;
-#endif
-
- basetype = TYPE_MAIN_VARIANT (BINFO_TYPE (binfo));
-
- buf2 = TYPE_ASSEMBLER_NAME_STRING (basetype);
- i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1;
-
- /* We know that the vtable that we are going to create doesn't exist
- yet in the global namespace, and when we finish, it will be
- pushed into the global namespace. In complex MI hierarchies, we
- have to loop while the name we are thinking of adding is globally
- defined, adding more name components to the vtable name as we
- loop, until the name is unique. This is because in complex MI
- cases, we might have the same base more than once. This means
- that the order in which this function is called for vtables must
- remain the same, otherwise binary compatibility can be
- compromised. */
-
- while (1)
- {
- char *buf1 = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (for_type)
- + 1 + i);
- char *new_buf2;
+ my_friendly_assert (binfo == CANONICAL_BINFO (binfo, for_type), 20010605);
- sprintf (buf1, "%s%c%s", TYPE_ASSEMBLER_NAME_STRING (for_type), joiner,
- buf2);
- buf = (char *) alloca (strlen (VTABLE_NAME_FORMAT) + strlen (buf1) + 1);
- sprintf (buf, VTABLE_NAME_FORMAT, buf1);
- name = get_identifier (buf);
-
- /* If this name doesn't clash, then we can use it, otherwise
- we add more to the name until it is unique. */
-
- if (! IDENTIFIER_GLOBAL_VALUE (name))
- break;
-
- /* Set values for next loop through, if the name isn't unique. */
-
- path = BINFO_INHERITANCE_CHAIN (path);
-
- /* We better not run out of stuff to make it unique. */
- my_friendly_assert (path != NULL_TREE, 368);
-
- basetype = TYPE_MAIN_VARIANT (BINFO_TYPE (path));
-
- if (for_type == basetype)
- {
- /* If we run out of basetypes in the path, we have already
- found created a vtable with that name before, we now
- resort to tacking on _%d to distinguish them. */
- int j = 2;
- i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1 + i + 1 + 3;
- buf1 = (char *) alloca (i);
- do {
- sprintf (buf1, "%s%c%s%c%d",
- TYPE_ASSEMBLER_NAME_STRING (basetype), joiner,
- buf2, joiner, j);
- buf = (char *) alloca (strlen (VTABLE_NAME_FORMAT)
- + strlen (buf1) + 1);
- sprintf (buf, VTABLE_NAME_FORMAT, buf1);
- name = get_identifier (buf);
-
- /* If this name doesn't clash, then we can use it,
- otherwise we add something different to the name until
- it is unique. */
- } while (++j <= 999 && IDENTIFIER_GLOBAL_VALUE (name));
-
- /* Hey, they really like MI don't they? Increase the 3
- above to 6, and the 999 to 999999. :-) */
- my_friendly_assert (j <= 999, 369);
-
- break;
- }
-
- i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1 + i;
- new_buf2 = (char *) alloca (i);
- sprintf (new_buf2, "%s%c%s",
- TYPE_ASSEMBLER_NAME_STRING (basetype), joiner, buf2);
- buf2 = new_buf2;
- }
-
- new_decl = build_lang_decl (VAR_DECL, name, TREE_TYPE (orig_decl));
- /* Remember which class this vtable is really for. */
- DECL_CONTEXT (new_decl) = for_type;
-
- DECL_ARTIFICIAL (new_decl) = 1;
- TREE_STATIC (new_decl) = 1;
- BINFO_VTABLE (binfo) = pushdecl_top_level (new_decl);
- DECL_VIRTUAL_P (new_decl) = 1;
-#ifndef WRITABLE_VTABLES
- /* Make them READONLY by default. (mrs) */
- TREE_READONLY (new_decl) = 1;
-#endif
- DECL_ALIGN (new_decl) = DECL_ALIGN (orig_decl);
+ if (BINFO_NEW_VTABLE_MARKED (binfo, for_type))
+ /* We already created a vtable for this base. There's no need to
+ do it again. */
+ return 0;
+ /* Remember that we've created a vtable for this BINFO, so that we
+ don't try to do so again. */
+ SET_BINFO_NEW_VTABLE_MARKED (binfo, for_type);
+
/* Make fresh virtual list, so we can smash it later. */
- BINFO_VIRTUALS (binfo) = copy_list (BINFO_VIRTUALS (binfo));
-
- if (TREE_VIA_VIRTUAL (binfo))
- {
- tree binfo1 = binfo_member (BINFO_TYPE (binfo),
- CLASSTYPE_VBASECLASSES (for_type));
-
- /* XXX - This should never happen, if it does, the caller should
- ensure that the binfo is from for_type's binfos, not from any
- base type's. We can remove all this code after a while. */
- if (binfo1 != binfo)
- warning ("internal inconsistency: binfo offset error for rtti");
+ BINFO_VIRTUALS (binfo) = copy_virtuals (binfo);
- offset = BINFO_OFFSET (binfo1);
- }
- else
- offset = BINFO_OFFSET (binfo);
-
- set_rtti_entry (BINFO_VIRTUALS (binfo),
- ssize_binop (MINUS_EXPR, integer_zero_node, offset),
- for_type);
-
-#ifdef GATHER_STATISTICS
- n_vtables += 1;
- n_vtable_elems += list_length (BINFO_VIRTUALS (binfo));
-#endif
-
- /* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */
- import_export_vtable (new_decl, for_type, 0);
-
- if (TREE_VIA_VIRTUAL (binfo))
- my_friendly_assert (binfo == binfo_member (BINFO_TYPE (binfo),
- CLASSTYPE_VBASECLASSES (current_class_type)),
- 170);
- SET_BINFO_NEW_VTABLE_MARKED (binfo);
+ /* Secondary vtables are laid out as part of the same structure as
+ the primary vtable. */
+ BINFO_VTABLE (binfo) = NULL_TREE;
+ return 1;
}
-/* Return a new vtable for use in initialization of the BASE subobject
- of COMPLETE_TYPE. The vtable there goes into the vfield of the
- VBASEBASE virtual subobject. */
+/* Create a new vtable for BINFO which is the hierarchy dominated by
+ T. Return non-zero if we actually created a new vtable. */
-static tree
-prepare_ctor_vtable (complete_type, base, vbasebase)
- tree complete_type, base, vbasebase;
-{
- tree orig_decl = BINFO_VTABLE (vbasebase);
- tree name = get_vlist_vtable_id (base, vbasebase);
- tree new_decl;
-
- new_decl = build_lang_decl (VAR_DECL, name, TREE_TYPE (orig_decl));
- /* Remember which class this vtable is really for. */
- DECL_CONTEXT (new_decl) = complete_type;
-
- DECL_ARTIFICIAL (new_decl) = 1;
- TREE_STATIC (new_decl) = 1;
- new_decl = pushdecl_top_level (new_decl);
- DECL_VIRTUAL_P (new_decl) = 1;
-#ifndef WRITABLE_VTABLES
- /* Make them READONLY by default. (mrs) */
- TREE_READONLY (new_decl) = 1;
-#endif
- DECL_ALIGN (new_decl) = DECL_ALIGN (orig_decl);
-
-#ifdef GATHER_STATISTICS
- n_vtables += 1;
- n_vtable_elems += list_length (BINFO_VIRTUALS (binfo));
-#endif
-
- /* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */
- import_export_vtable (new_decl, complete_type, 0);
-
- return new_decl;
+static int
+make_new_vtable (t, binfo)
+ tree t;
+ tree binfo;
+{
+ if (binfo == TYPE_BINFO (t))
+ /* In this case, it is *type*'s vtable we are modifying. We start
+ with the approximation that its vtable is that of the
+ immediate base class. */
+ /* ??? This actually passes TYPE_BINFO (t), not the primary base binfo,
+ since we've updated DECL_CONTEXT (TYPE_VFIELD (t)) by now. */
+ return build_primary_vtable (TYPE_BINFO (DECL_CONTEXT (TYPE_VFIELD (t))),
+ t);
+ else
+ /* This is our very own copy of `basetype' to play with. Later,
+ we will fill in all the virtual functions that override the
+ virtual functions in these base classes which are not defined
+ by the current type. */
+ return build_secondary_vtable (binfo, t);
}
-#if 0
-/* Access the virtual function table entry that logically
- contains BASE_FNDECL. VIRTUALS is the virtual function table's
- initializer. We can run off the end, when dealing with virtual
- destructors in MI situations, return NULL_TREE in that case. */
+/* Make *VIRTUALS, an entry on the BINFO_VIRTUALS list for BINFO
+ (which is in the hierarchy dominated by T) list FNDECL as its
+ BV_FN. DELTA is the required constant adjustment from the `this'
+ pointer where the vtable entry appears to the `this' required when
+ the function is actually called. */
-static tree
-get_vtable_entry (virtuals, base_fndecl)
- tree virtuals, base_fndecl;
+static void
+modify_vtable_entry (t, binfo, fndecl, delta, virtuals)
+ tree t;
+ tree binfo;
+ tree fndecl;
+ tree delta;
+ tree *virtuals;
{
- unsigned HOST_WIDE_INT n = (HOST_BITS_PER_WIDE_INT >= BITS_PER_WORD
- ? (TREE_INT_CST_LOW (DECL_VINDEX (base_fndecl))
- & (((unsigned HOST_WIDE_INT)1<<(BITS_PER_WORD-1))-1))
- : TREE_INT_CST_LOW (DECL_VINDEX (base_fndecl)));
+ tree v;
-#ifdef GATHER_STATISTICS
- n_vtable_searches += n;
-#endif
+ v = *virtuals;
- while (n > 0 && virtuals)
+ if (fndecl != BV_FN (v)
+ || !tree_int_cst_equal (delta, BV_DELTA (v)))
{
- --n;
- virtuals = TREE_CHAIN (virtuals);
- }
- return virtuals;
-}
-#endif
-
-/* Put new entry ENTRY into virtual function table initializer
- VIRTUALS.
+ tree base_fndecl;
- Also update DECL_VINDEX (FNDECL). */
+ /* We need a new vtable for BINFO. */
+ if (make_new_vtable (t, binfo))
+ {
+ /* If we really did make a new vtable, we also made a copy
+ of the BINFO_VIRTUALS list. Now, we have to find the
+ corresponding entry in that list. */
+ *virtuals = BINFO_VIRTUALS (binfo);
+ while (BV_FN (*virtuals) != BV_FN (v))
+ *virtuals = TREE_CHAIN (*virtuals);
+ v = *virtuals;
+ }
-static void
-modify_vtable_entry (old_entry_in_list, new_entry, fndecl)
- tree old_entry_in_list, new_entry, fndecl;
-{
- tree base_fndecl = TREE_OPERAND (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (old_entry_in_list)), 0);
+ base_fndecl = BV_FN (v);
+ BV_DELTA (v) = delta;
+ BV_VCALL_INDEX (v) = NULL_TREE;
+ BV_FN (v) = fndecl;
-#ifdef NOTQUITE
- cp_warning ("replaced %D with %D", DECL_ASSEMBLER_NAME (base_fndecl),
- DECL_ASSEMBLER_NAME (fndecl));
-#endif
- TREE_VALUE (old_entry_in_list) = new_entry;
+ /* Now assign virtual dispatch information, if unset. We can
+ dispatch this through any overridden base function.
- /* Now assign virtual dispatch information, if unset. */
- /* We can dispatch this, through any overridden base function. */
- if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST)
- {
- DECL_VINDEX (fndecl) = DECL_VINDEX (base_fndecl);
- DECL_CONTEXT (fndecl) = DECL_CONTEXT (base_fndecl);
+ FIXME this can choose a secondary vtable if the primary is not
+ also lexically first, leading to useless conversions.
+ In the V3 ABI, there's no reason for DECL_VIRTUAL_CONTEXT to
+ ever be different from DECL_CONTEXT. */
+ if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST)
+ {
+ DECL_VINDEX (fndecl) = DECL_VINDEX (base_fndecl);
+ DECL_VIRTUAL_CONTEXT (fndecl) = DECL_VIRTUAL_CONTEXT (base_fndecl);
+ }
}
}
-/* Access the virtual function table entry N. VIRTUALS is the virtual
- function table's initializer. */
+/* Set DECL_VINDEX for DECL. VINDEX_P is the number of virtual
+ functions present in the vtable so far. */
-static tree
-get_vtable_entry_n (virtuals, n)
- tree virtuals;
- unsigned HOST_WIDE_INT n;
+static void
+set_vindex (decl, vfuns_p)
+ tree decl;
+ int *vfuns_p;
{
- while (n > 0)
- {
- --n;
- virtuals = TREE_CHAIN (virtuals);
- }
- return virtuals;
+ int vindex;
+
+ vindex = *vfuns_p;
+ *vfuns_p += (TARGET_VTABLE_USES_DESCRIPTORS
+ ? TARGET_VTABLE_USES_DESCRIPTORS : 1);
+ DECL_VINDEX (decl) = build_shared_int_cst (vindex);
}
/* Add a virtual function to all the appropriate vtables for the class
T. DECL_VINDEX(X) should be error_mark_node, if we want to
allocate a new slot in our table. If it is error_mark_node, we
know that no other function from another vtable is overridden by X.
- HAS_VIRTUAL keeps track of how many virtuals there are in our main
- vtable for the type, and we build upon the PENDING_VIRTUALS list
+ VFUNS_P keeps track of how many virtuals there are in our
+ main vtable for the type, and we build upon the NEW_VIRTUALS list
and return it. */
static void
-add_virtual_function (pv, phv, has_virtual, fndecl, t)
- tree *pv, *phv;
- int *has_virtual;
+add_virtual_function (new_virtuals_p, overridden_virtuals_p,
+ vfuns_p, fndecl, t)
+ tree *new_virtuals_p;
+ tree *overridden_virtuals_p;
+ int *vfuns_p;
tree fndecl;
tree t; /* Structure type. */
{
- tree pending_virtuals = *pv;
- tree pending_hard_virtuals = *phv;
-
- /* FUNCTION_TYPEs and OFFSET_TYPEs no longer freely
- convert to void *. Make such a conversion here. */
- tree vfn = build1 (ADDR_EXPR, vfunc_ptr_type_node, fndecl);
- TREE_CONSTANT (vfn) = 1;
-
-#ifndef DUMB_USER
- if (current_class_type == 0)
- cp_warning ("internal problem, current_class_type is zero when adding `%D', please report",
- fndecl);
- if (current_class_type && t != current_class_type)
- cp_warning ("internal problem, current_class_type differs when adding `%D', please report",
- fndecl);
-#endif
+ tree new_virtual;
+
+ /* If this function doesn't override anything from a base class, we
+ can just assign it a new DECL_VINDEX now. Otherwise, if it does
+ override something, we keep it around and assign its DECL_VINDEX
+ later, in modify_all_vtables. */
+ if (TREE_CODE (DECL_VINDEX (fndecl)) == INTEGER_CST)
+ /* We've already dealt with this function. */
+ return;
+
+ new_virtual = make_node (TREE_LIST);
+ BV_FN (new_virtual) = fndecl;
+ BV_DELTA (new_virtual) = integer_zero_node;
- /* If the virtual function is a redefinition of a prior one,
- figure out in which base class the new definition goes,
- and if necessary, make a fresh virtual function table
- to hold that entry. */
if (DECL_VINDEX (fndecl) == error_mark_node)
{
- tree entry;
+ /* FNDECL is a new virtual function; it doesn't override any
+ virtual function in a base class. */
/* We remember that this was the base sub-object for rtti. */
CLASSTYPE_RTTI (t) = t;
- /* If we are using thunks, use two slots at the front, one
- for the offset pointer, one for the tdesc pointer.
- For ARM-style vtables, use the same slot for both. */
- if (*has_virtual == 0 && ! CLASSTYPE_COM_INTERFACE (t))
- {
- if (flag_vtable_thunks)
- *has_virtual = 2;
- else
- *has_virtual = 1;
- }
-
- /* Build a new INT_CST for this DECL_VINDEX. */
- {
- static tree index_table[256];
- tree idx;
- /* We skip a slot for the offset/tdesc entry. */
- int i = (*has_virtual)++;
+ /* Now assign virtual dispatch information. */
+ set_vindex (fndecl, vfuns_p);
+ DECL_VIRTUAL_CONTEXT (fndecl) = t;
- if (i >= 256 || index_table[i] == 0)
- {
- idx = build_int_2 (i, 0);
- if (i < 256)
- index_table[i] = idx;
- }
- else
- idx = index_table[i];
-
- /* Now assign virtual dispatch information. */
- DECL_VINDEX (fndecl) = idx;
- DECL_CONTEXT (fndecl) = t;
- }
- entry = build_vtable_entry (integer_zero_node, vfn);
- pending_virtuals = tree_cons (DECL_VINDEX (fndecl), entry, pending_virtuals);
+ /* Save the state we've computed on the NEW_VIRTUALS list. */
+ TREE_CHAIN (new_virtual) = *new_virtuals_p;
+ *new_virtuals_p = new_virtual;
}
- /* Might already be INTEGER_CST if declared twice in class. We will
- give error later or we've already given it. */
- else if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST)
+ else
{
- /* Need an entry in some other virtual function table.
- Deal with this after we have laid out our virtual base classes. */
- pending_hard_virtuals = temp_tree_cons (fndecl, vfn, pending_hard_virtuals);
+ /* FNDECL overrides a function from a base class. */
+ TREE_CHAIN (new_virtual) = *overridden_virtuals_p;
+ *overridden_virtuals_p = new_virtual;
}
- *pv = pending_virtuals;
- *phv = pending_hard_virtuals;
}
-/* Obstack on which to build the vector of class methods. */
-struct obstack class_obstack;
-extern struct obstack *current_obstack;
-
-/* These are method vectors that were too small for the number of
- methods in some class, and so were abandoned. */
-static tree free_method_vecs;
-
-/* Returns a method vector with enough room for N methods. N should
- be a power of two. */
-
-static tree
-make_method_vec (n)
- int n;
-{
- tree new_vec;
- tree* t;
-
- for (t = &free_method_vecs; *t; t = &(TREE_CHAIN (*t)))
- /* Note that we don't use >= n here because we don't want to
- allocate a very large vector where it isn't needed. */
- if (TREE_VEC_LENGTH (*t) == n)
- {
- new_vec = *t;
- *t = TREE_CHAIN (new_vec);
- TREE_CHAIN (new_vec) = NULL_TREE;
- bzero ((PTR) &TREE_VEC_ELT (new_vec, 0), n * sizeof (tree));
- return new_vec;
- }
-
- new_vec = make_tree_vec (n);
- return new_vec;
-}
-
-/* Free the method vector VEC. */
-
-static void
-free_method_vec (vec)
- tree vec;
-{
- TREE_CHAIN (vec) = free_method_vecs;
- free_method_vecs = vec;
-}
-
-/* Add method METHOD to class TYPE.
-
- If non-NULL, FIELDS is the entry in the METHOD_VEC vector entry of
- the class type where the method should be added. */
+/* Add method METHOD to class TYPE. If ERROR_P is true, we are adding
+ the method after the class has already been defined because a
+ declaration for it was seen. (Even though that is erroneous, we
+ add the method for improved error recovery.) */
void
-add_method (type, fields, method)
- tree type, *fields, method;
+add_method (type, method, error_p)
+ tree type;
+ tree method;
+ int error_p;
{
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- /* Setting the DECL_CONTEXT and DECL_CLASS_CONTEXT here is probably
- redundant. */
- DECL_CONTEXT (method) = type;
- DECL_CLASS_CONTEXT (method) = type;
-
- if (fields && *fields)
- *fields = build_overload (method, *fields);
- else
+ int using = (DECL_CONTEXT (method) != type);
+ int len;
+ int slot;
+ tree method_vec;
+
+ if (!CLASSTYPE_METHOD_VEC (type))
+ /* Make a new method vector. We start with 8 entries. We must
+ allocate at least two (for constructors and destructors), and
+ we're going to end up with an assignment operator at some point
+ as well.
+
+ We could use a TREE_LIST for now, and convert it to a TREE_VEC
+ in finish_struct, but we would probably waste more memory
+ making the links in the list than we would by over-allocating
+ the size of the vector here. Furthermore, we would complicate
+ all the code that expects this to be a vector. */
+ CLASSTYPE_METHOD_VEC (type) = make_tree_vec (8);
+
+ method_vec = CLASSTYPE_METHOD_VEC (type);
+ len = TREE_VEC_LENGTH (method_vec);
+
+ /* Constructors and destructors go in special slots. */
+ if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (method))
+ slot = CLASSTYPE_CONSTRUCTOR_SLOT;
+ else if (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (method))
+ slot = CLASSTYPE_DESTRUCTOR_SLOT;
+ else
{
- int len;
- int slot;
- tree method_vec;
-
- if (!CLASSTYPE_METHOD_VEC (type))
- /* Make a new method vector. We start with 8 entries. We must
- allocate at least two (for constructors and destructors), and
- we're going to end up with an assignment operator at some
- point as well.
-
- We could use a TREE_LIST for now, and convert it to a
- TREE_VEC in finish_struct, but we would probably waste more
- memory making the links in the list than we would by
- over-allocating the size of the vector here. Furthermore,
- we would complicate all the code that expects this to be a
- vector. We keep a free list of vectors that we outgrew so
- that we don't really waste any memory. */
- CLASSTYPE_METHOD_VEC (type) = make_method_vec (8);
-
- method_vec = CLASSTYPE_METHOD_VEC (type);
- len = TREE_VEC_LENGTH (method_vec);
-
- if (DECL_NAME (method) == constructor_name (type))
- /* A new constructor or destructor. Constructors go in
- slot 0; destructors go in slot 1. */
- slot = DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (method)) ? 1 : 0;
- else
- {
- /* See if we already have an entry with this name. */
- for (slot = 2; slot < len; ++slot)
- if (!TREE_VEC_ELT (method_vec, slot)
- || (DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (method_vec,
- slot)))
- == DECL_NAME (method)))
- break;
+ /* See if we already have an entry with this name. */
+ for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT; slot < len; ++slot)
+ if (!TREE_VEC_ELT (method_vec, slot)
+ || (DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (method_vec,
+ slot)))
+ == DECL_NAME (method)))
+ break;
- if (slot == len)
- {
- /* We need a bigger method vector. */
- tree new_vec = make_method_vec (2 * len);
- bcopy ((PTR) &TREE_VEC_ELT (method_vec, 0),
- (PTR) &TREE_VEC_ELT (new_vec, 0),
- len * sizeof (tree));
- free_method_vec (method_vec);
- len = 2 * len;
- method_vec = CLASSTYPE_METHOD_VEC (type) = new_vec;
- }
+ if (slot == len)
+ {
+ /* We need a bigger method vector. */
+ int new_len;
+ tree new_vec;
+
+ /* In the non-error case, we are processing a class
+ definition. Double the size of the vector to give room
+ for new methods. */
+ if (!error_p)
+ new_len = 2 * len;
+ /* In the error case, the vector is already complete. We
+ don't expect many errors, and the rest of the front-end
+ will get confused if there are empty slots in the vector. */
+ else
+ new_len = len + 1;
+
+ new_vec = make_tree_vec (new_len);
+ memcpy (&TREE_VEC_ELT (new_vec, 0), &TREE_VEC_ELT (method_vec, 0),
+ len * sizeof (tree));
+ len = new_len;
+ method_vec = CLASSTYPE_METHOD_VEC (type) = new_vec;
+ }
- if (DECL_CONV_FN_P (method) && !TREE_VEC_ELT (method_vec, slot))
+ if (DECL_CONV_FN_P (method) && !TREE_VEC_ELT (method_vec, slot))
+ {
+ /* Type conversion operators have to come before ordinary
+ methods; add_conversions depends on this to speed up
+ looking for conversion operators. So, if necessary, we
+ slide some of the vector elements up. In theory, this
+ makes this algorithm O(N^2) but we don't expect many
+ conversion operators. */
+ for (slot = 2; slot < len; ++slot)
{
- /* Type conversion operators have to come before
- ordinary methods; add_conversions depends on this to
- speed up looking for conversion operators. So, if
- necessary, we slide some of the vector elements up.
- In theory, this makes this algorithm O(N^2) but we
- don't expect many conversion operators. */
- for (slot = 2; slot < len; ++slot)
- {
- tree fn = TREE_VEC_ELT (method_vec, slot);
+ tree fn = TREE_VEC_ELT (method_vec, slot);
- if (!fn)
- /* There are no more entries in the vector, so we
- can insert the new conversion operator here. */
- break;
+ if (!fn)
+ /* There are no more entries in the vector, so we
+ can insert the new conversion operator here. */
+ break;
- if (!DECL_CONV_FN_P (OVL_CURRENT (fn)))
- /* We can insert the new function right at the
- SLOTth position. */
- break;
- }
+ if (!DECL_CONV_FN_P (OVL_CURRENT (fn)))
+ /* We can insert the new function right at the
+ SLOTth position. */
+ break;
+ }
- if (!TREE_VEC_ELT (method_vec, slot))
- /* There is nothing in the Ith slot, so we can avoid
- moving anything. */
+ if (!TREE_VEC_ELT (method_vec, slot))
+ /* There is nothing in the Ith slot, so we can avoid
+ moving anything. */
;
- else
- {
- /* We know the last slot in the vector is empty
- because we know that at this point there's room
- for a new function. */
- bcopy ((PTR) &TREE_VEC_ELT (method_vec, slot),
- (PTR) &TREE_VEC_ELT (method_vec, slot + 1),
- (len - slot - 1) * sizeof (tree));
- TREE_VEC_ELT (method_vec, slot) = NULL_TREE;
- }
+ else
+ {
+ /* We know the last slot in the vector is empty
+ because we know that at this point there's room
+ for a new function. */
+ memmove (&TREE_VEC_ELT (method_vec, slot + 1),
+ &TREE_VEC_ELT (method_vec, slot),
+ (len - slot - 1) * sizeof (tree));
+ TREE_VEC_ELT (method_vec, slot) = NULL_TREE;
}
}
+ }
- if (template_class_depth (type))
- /* TYPE is a template class. Don't issue any errors now; wait
- until instantiation time to complain. */
- ;
- else
- {
- tree fns;
+ if (template_class_depth (type))
+ /* TYPE is a template class. Don't issue any errors now; wait
+ until instantiation time to complain. */
+ ;
+ else
+ {
+ tree fns;
- /* Check to see if we've already got this method. */
- for (fns = TREE_VEC_ELT (method_vec, slot);
- fns;
- fns = OVL_NEXT (fns))
- {
- tree fn = OVL_CURRENT (fns);
+ /* Check to see if we've already got this method. */
+ for (fns = TREE_VEC_ELT (method_vec, slot);
+ fns;
+ fns = OVL_NEXT (fns))
+ {
+ tree fn = OVL_CURRENT (fns);
- if (TREE_CODE (fn) != TREE_CODE (method))
- continue;
+ if (TREE_CODE (fn) != TREE_CODE (method))
+ continue;
- if (TREE_CODE (method) != TEMPLATE_DECL)
+ if (TREE_CODE (method) != TEMPLATE_DECL)
+ {
+ /* [over.load] Member function declarations with the
+ same name and the same parameter types cannot be
+ overloaded if any of them is a static member
+ function declaration.
+
+ [namespace.udecl] When a using-declaration brings names
+ from a base class into a derived class scope, member
+ functions in the derived class override and/or hide member
+ functions with the same name and parameter types in a base
+ class (rather than conflicting). */
+ if ((DECL_STATIC_FUNCTION_P (fn)
+ != DECL_STATIC_FUNCTION_P (method))
+ || using)
{
- /* [over.load] Member function declarations with the
- same name and the same parameter types cannot be
- overloaded if any of them is a static member
- function declaration. */
- if (DECL_STATIC_FUNCTION_P (fn)
- != DECL_STATIC_FUNCTION_P (method))
+ tree parms1 = TYPE_ARG_TYPES (TREE_TYPE (fn));
+ tree parms2 = TYPE_ARG_TYPES (TREE_TYPE (method));
+ int same = 1;
+
+ /* Compare the quals on the 'this' parm. Don't compare
+ the whole types, as used functions are treated as
+ coming from the using class in overload resolution. */
+ if (using
+ && ! DECL_STATIC_FUNCTION_P (fn)
+ && ! DECL_STATIC_FUNCTION_P (method)
+ && (TYPE_QUALS (TREE_TYPE (TREE_VALUE (parms1)))
+ != TYPE_QUALS (TREE_TYPE (TREE_VALUE (parms2)))))
+ same = 0;
+ if (! DECL_STATIC_FUNCTION_P (fn))
+ parms1 = TREE_CHAIN (parms1);
+ if (! DECL_STATIC_FUNCTION_P (method))
+ parms2 = TREE_CHAIN (parms2);
+
+ if (same && compparms (parms1, parms2))
{
- tree parms1 = TYPE_ARG_TYPES (TREE_TYPE (fn));
- tree parms2 = TYPE_ARG_TYPES (TREE_TYPE (method));
-
- if (! DECL_STATIC_FUNCTION_P (fn))
- parms1 = TREE_CHAIN (parms1);
+ if (using && DECL_CONTEXT (fn) == type)
+ /* Defer to the local function. */
+ return;
else
- parms2 = TREE_CHAIN (parms2);
-
- if (compparms (parms1, parms2))
- cp_error ("`%#D' and `%#D' cannot be overloaded",
+ error ("`%#D' and `%#D' cannot be overloaded",
fn, method);
}
-
- /* Since this is an ordinary function in a
- non-template class, it's mangled name can be used
- as a unique identifier. This technique is only
- an optimization; we would get the same results if
- we just used decls_match here. */
- if (DECL_ASSEMBLER_NAME (fn)
- != DECL_ASSEMBLER_NAME (method))
- continue;
}
- else if (!decls_match (fn, method))
- continue;
+ }
- /* There has already been a declaration of this method
- or member template. */
- cp_error_at ("`%D' has already been declared in `%T'",
- method, type);
+ if (!decls_match (fn, method))
+ continue;
- /* We don't call duplicate_decls here to merge the
- declarations because that will confuse things if the
- methods have inline definitions. In particular, we
- will crash while processing the definitions. */
- return;
- }
+ /* There has already been a declaration of this method
+ or member template. */
+ cp_error_at ("`%D' has already been declared in `%T'",
+ method, type);
+
+ /* We don't call duplicate_decls here to merge the
+ declarations because that will confuse things if the
+ methods have inline definitions. In particular, we
+ will crash while processing the definitions. */
+ return;
}
+ }
- /* Actually insert the new method. */
- TREE_VEC_ELT (method_vec, slot)
- = build_overload (method, TREE_VEC_ELT (method_vec, slot));
+ /* Actually insert the new method. */
+ TREE_VEC_ELT (method_vec, slot)
+ = build_overload (method, TREE_VEC_ELT (method_vec, slot));
/* Add the new binding. */
- if (!DECL_CONSTRUCTOR_P (method)
- && !DECL_DESTRUCTOR_P (method))
- push_class_level_binding (DECL_NAME (method),
- TREE_VEC_ELT (method_vec, slot));
- }
- pop_obstacks ();
+ if (!DECL_CONSTRUCTOR_P (method)
+ && !DECL_DESTRUCTOR_P (method))
+ push_class_level_binding (DECL_NAME (method),
+ TREE_VEC_ELT (method_vec, slot));
}
/* Subroutines of finish_struct. */
@@ -1380,7 +1066,7 @@ delete_duplicate_fields_1 (field, fields)
tree prev = 0;
if (DECL_NAME (field) == 0)
{
- if (TREE_CODE (TREE_TYPE (field)) != UNION_TYPE)
+ if (! ANON_AGGR_TYPE_P (TREE_TYPE (field)))
return fields;
for (x = TYPE_FIELDS (TREE_TYPE (field)); x; x = TREE_CHAIN (x))
@@ -1393,7 +1079,7 @@ delete_duplicate_fields_1 (field, fields)
{
if (DECL_NAME (x) == 0)
{
- if (TREE_CODE (TREE_TYPE (x)) != UNION_TYPE)
+ if (! ANON_AGGR_TYPE_P (TREE_TYPE (x)))
continue;
TYPE_FIELDS (TREE_TYPE (x))
= delete_duplicate_fields_1 (field, TYPE_FIELDS (TREE_TYPE (x)));
@@ -1405,43 +1091,46 @@ delete_duplicate_fields_1 (field, fields)
TREE_CHAIN (prev) = TREE_CHAIN (x);
}
}
- else
+ else if (TREE_CODE (field) == USING_DECL)
+ /* A using declaration is allowed to appear more than
+ once. We'll prune these from the field list later, and
+ handle_using_decl will complain about invalid multiple
+ uses. */
+ ;
+ else if (DECL_NAME (field) == DECL_NAME (x))
{
- if (DECL_NAME (field) == DECL_NAME (x))
+ if (TREE_CODE (field) == CONST_DECL
+ && TREE_CODE (x) == CONST_DECL)
+ cp_error_at ("duplicate enum value `%D'", x);
+ else if (TREE_CODE (field) == CONST_DECL
+ || TREE_CODE (x) == CONST_DECL)
+ cp_error_at ("duplicate field `%D' (as enum and non-enum)",
+ x);
+ else if (DECL_DECLARES_TYPE_P (field)
+ && DECL_DECLARES_TYPE_P (x))
{
- if (TREE_CODE (field) == CONST_DECL
- && TREE_CODE (x) == CONST_DECL)
- cp_error_at ("duplicate enum value `%D'", x);
- else if (TREE_CODE (field) == CONST_DECL
- || TREE_CODE (x) == CONST_DECL)
- cp_error_at ("duplicate field `%D' (as enum and non-enum)",
- x);
- else if (DECL_DECLARES_TYPE_P (field)
- && DECL_DECLARES_TYPE_P (x))
- {
- if (same_type_p (TREE_TYPE (field), TREE_TYPE (x)))
- continue;
- cp_error_at ("duplicate nested type `%D'", x);
- }
- else if (DECL_DECLARES_TYPE_P (field)
- || DECL_DECLARES_TYPE_P (x))
- {
- /* Hide tag decls. */
- if ((TREE_CODE (field) == TYPE_DECL
- && DECL_ARTIFICIAL (field))
- || (TREE_CODE (x) == TYPE_DECL
- && DECL_ARTIFICIAL (x)))
- continue;
- cp_error_at ("duplicate field `%D' (as type and non-type)",
- x);
- }
- else
- cp_error_at ("duplicate member `%D'", x);
- if (prev == 0)
- fields = TREE_CHAIN (fields);
- else
- TREE_CHAIN (prev) = TREE_CHAIN (x);
+ if (same_type_p (TREE_TYPE (field), TREE_TYPE (x)))
+ continue;
+ cp_error_at ("duplicate nested type `%D'", x);
+ }
+ else if (DECL_DECLARES_TYPE_P (field)
+ || DECL_DECLARES_TYPE_P (x))
+ {
+ /* Hide tag decls. */
+ if ((TREE_CODE (field) == TYPE_DECL
+ && DECL_ARTIFICIAL (field))
+ || (TREE_CODE (x) == TYPE_DECL
+ && DECL_ARTIFICIAL (x)))
+ continue;
+ cp_error_at ("duplicate field `%D' (as type and non-type)",
+ x);
}
+ else
+ cp_error_at ("duplicate member `%D'", x);
+ if (prev == 0)
+ fields = TREE_CHAIN (fields);
+ else
+ TREE_CHAIN (prev) = TREE_CHAIN (x);
}
}
}
@@ -1457,18 +1146,24 @@ delete_duplicate_fields (fields)
TREE_CHAIN (x) = delete_duplicate_fields_1 (x, TREE_CHAIN (x));
}
-/* Change the access of FDECL to ACCESS in T. The access to FDECL is
- along the path given by BINFO. Return 1 if change was legit,
- otherwise return 0. */
+/* Change the access of FDECL to ACCESS in T. Return 1 if change was
+ legit, otherwise return 0. */
static int
-alter_access (t, binfo, fdecl, access)
+alter_access (t, fdecl, access)
tree t;
- tree binfo;
tree fdecl;
tree access;
{
- tree elem = purpose_member (t, DECL_ACCESS (fdecl));
+ tree elem;
+
+ if (!DECL_LANG_SPECIFIC (fdecl))
+ retrofit_lang_decl (fdecl);
+
+ if (DECL_DISCRIMINATOR_P (fdecl))
+ abort ();
+
+ elem = purpose_member (t, DECL_ACCESS (fdecl));
if (elem)
{
if (TREE_VALUE (elem) != access)
@@ -1488,22 +1183,19 @@ alter_access (t, binfo, fdecl, access)
}
else
{
- enforce_access (binfo, fdecl);
+ enforce_access (t, fdecl);
DECL_ACCESS (fdecl) = tree_cons (t, access, DECL_ACCESS (fdecl));
return 1;
}
return 0;
}
-/* Process the USING_DECL, which is a member of T. The METHOD_VEC, if
- non-NULL, is the methods of T. The FIELDS are the fields of T. */
+/* Process the USING_DECL, which is a member of T. */
static void
-handle_using_decl (using_decl, t, method_vec, fields)
+handle_using_decl (using_decl, t)
tree using_decl;
tree t;
- tree method_vec;
- tree fields;
{
tree ctype = DECL_INITIAL (using_decl);
tree name = DECL_NAME (using_decl);
@@ -1513,9 +1205,7 @@ handle_using_decl (using_decl, t, method_vec, fields)
: access_public_node;
tree fdecl, binfo;
tree flist = NULL_TREE;
- tree tmp;
- int i;
- int n_methods;
+ tree old_value;
binfo = binfo_or_else (ctype, t);
if (! binfo)
@@ -1524,7 +1214,13 @@ handle_using_decl (using_decl, t, method_vec, fields)
if (name == constructor_name (ctype)
|| name == constructor_name_full (ctype))
{
- cp_error_at ("using-declaration for constructor", using_decl);
+ cp_error_at ("`%D' names constructor", using_decl);
+ return;
+ }
+ if (name == constructor_name (t)
+ || name == constructor_name_full (t))
+ {
+ cp_error_at ("`%D' invalid in `%T'", using_decl, t);
return;
}
@@ -1536,113 +1232,96 @@ handle_using_decl (using_decl, t, method_vec, fields)
return;
}
- /* Functions are represented as TREE_LIST, with the purpose
- being the type and the value the functions. Other members
- come as themselves. */
- if (TREE_CODE (fdecl) == TREE_LIST)
+ if (BASELINK_P (fdecl))
/* Ignore base type this came from. */
fdecl = TREE_VALUE (fdecl);
- if (TREE_CODE (fdecl) == OVERLOAD)
+ old_value = IDENTIFIER_CLASS_VALUE (name);
+ if (old_value)
{
- /* We later iterate over all functions. */
- flist = fdecl;
- fdecl = OVL_FUNCTION (flist);
+ if (is_overloaded_fn (old_value))
+ old_value = OVL_CURRENT (old_value);
+
+ if (DECL_P (old_value) && DECL_CONTEXT (old_value) == t)
+ /* OK */;
+ else
+ old_value = NULL_TREE;
}
-
- name = DECL_NAME (fdecl);
- n_methods = method_vec ? TREE_VEC_LENGTH (method_vec) : 0;
- for (i = 2; i < n_methods && TREE_VEC_ELT (method_vec, i); i++)
- if (DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (method_vec, i)))
- == name)
- {
- cp_error ("cannot adjust access to `%#D' in `%#T'", fdecl, t);
- cp_error_at (" because of local method `%#D' with same name",
- OVL_CURRENT (TREE_VEC_ELT (method_vec, i)));
- return;
- }
- if (! DECL_LANG_SPECIFIC (fdecl))
- /* We don't currently handle DECL_ACCESS for TYPE_DECLs; just return. */
- return;
-
- for (tmp = fields; tmp; tmp = TREE_CHAIN (tmp))
- if (DECL_NAME (tmp) == name)
- {
- cp_error ("cannot adjust access to `%#D' in `%#T'", fdecl, t);
- cp_error_at (" because of local field `%#D' with same name", tmp);
- return;
- }
-
- /* Make type T see field decl FDECL with access ACCESS.*/
- if (flist)
+ if (is_overloaded_fn (fdecl))
+ flist = fdecl;
+
+ if (! old_value)
+ ;
+ else if (is_overloaded_fn (old_value))
{
- while (flist)
+ if (flist)
+ /* It's OK to use functions from a base when there are functions with
+ the same name already present in the current class. */;
+ else
{
- if (alter_access (t, binfo, OVL_FUNCTION (flist),
- access) == 0)
- return;
- flist = OVL_CHAIN (flist);
+ cp_error_at ("`%D' invalid in `%#T'", using_decl, t);
+ cp_error_at (" because of local method `%#D' with same name",
+ OVL_CURRENT (old_value));
+ return;
}
}
+ else if (!DECL_ARTIFICIAL (old_value))
+ {
+ cp_error_at ("`%D' invalid in `%#T'", using_decl, t);
+ cp_error_at (" because of local member `%#D' with same name", old_value);
+ return;
+ }
+
+ /* Make type T see field decl FDECL with access ACCESS.*/
+ if (flist)
+ for (; flist; flist = OVL_NEXT (flist))
+ {
+ add_method (t, OVL_CURRENT (flist), /*error_p=*/0);
+ alter_access (t, OVL_CURRENT (flist), access);
+ }
else
- alter_access (t, binfo, fdecl, access);
+ alter_access (t, fdecl, access);
}
-struct base_info
-{
- int has_virtual;
- int max_has_virtual;
- tree vfield;
- tree vfields;
- tree rtti;
- char cant_have_default_ctor;
- char cant_have_const_ctor;
- char no_const_asn_ref;
-};
-
-/* Record information about type T derived from its base classes.
- Store most of that information in T itself, and place the
- remaining information in the struct BASE_INFO.
-
- Propagate basetype offsets throughout the lattice. Note that the
- lattice topped by T is really a pair: it's a DAG that gives the
- structure of the derivation hierarchy, and it's a list of the
- virtual baseclasses that appear anywhere in the DAG. When a vbase
- type appears in the DAG, it's offset is 0, and it's children start
- their offsets from that point. When a vbase type appears in the list,
- its offset is the offset it has in the hierarchy, and its children's
- offsets include that offset in theirs.
-
- Returns the index of the first base class to have virtual functions,
- or -1 if no such base class. */
+/* Run through the base clases of T, updating
+ CANT_HAVE_DEFAULT_CTOR_P, CANT_HAVE_CONST_CTOR_P, and
+ NO_CONST_ASN_REF_P. Also set flag bits in T based on properties of
+ the bases. */
-static int
-finish_base_struct (t, b)
+static void
+check_bases (t, cant_have_default_ctor_p, cant_have_const_ctor_p,
+ no_const_asn_ref_p)
tree t;
- struct base_info *b;
+ int *cant_have_default_ctor_p;
+ int *cant_have_const_ctor_p;
+ int *no_const_asn_ref_p;
{
- tree binfos = TYPE_BINFO_BASETYPES (t);
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- int first_vfn_base_index = -1;
- bzero ((char *) b, sizeof (struct base_info));
+ int n_baseclasses;
+ int i;
+ int seen_non_virtual_nearly_empty_base_p;
+ tree binfos;
- for (i = 0; i < n_baseclasses; i++)
+ binfos = TYPE_BINFO_BASETYPES (t);
+ n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
+ seen_non_virtual_nearly_empty_base_p = 0;
+
+ /* An aggregate cannot have baseclasses. */
+ CLASSTYPE_NON_AGGREGATE (t) |= (n_baseclasses != 0);
+
+ for (i = 0; i < n_baseclasses; ++i)
{
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree basetype = BINFO_TYPE (base_binfo);
+ tree base_binfo;
+ tree basetype;
- /* Effective C++ rule 14. We only need to check TYPE_VIRTUAL_P
- here because the case of virtual functions but non-virtual
- dtor is handled in finish_struct_1. */
- if (warn_ecpp && ! TYPE_VIRTUAL_P (basetype)
- && TYPE_HAS_DESTRUCTOR (basetype))
- cp_warning ("base class `%#T' has a non-virtual destructor", basetype);
+ /* Figure out what base we're looking at. */
+ base_binfo = TREE_VEC_ELT (binfos, i);
+ basetype = TREE_TYPE (base_binfo);
- /* If the type of basetype is incomplete, then
- we already complained about that fact
- (and we should have fixed it up as well). */
- if (TYPE_SIZE (basetype) == 0)
+ /* If the type of basetype is incomplete, then we already
+ complained about that fact (and we should have fixed it up as
+ well). */
+ if (!COMPLETE_TYPE_P (basetype))
{
int j;
/* The base type is of incomplete type. It is
@@ -1654,177 +1333,461 @@ finish_base_struct (t, b)
n_baseclasses -= 1;
for (j = i; j+1 < n_baseclasses; j++)
TREE_VEC_ELT (binfos, j) = TREE_VEC_ELT (binfos, j+1);
+ continue;
}
- if (! TYPE_HAS_CONST_INIT_REF (basetype))
- b->cant_have_const_ctor = 1;
+ /* Effective C++ rule 14. We only need to check TYPE_POLYMORPHIC_P
+ here because the case of virtual functions but non-virtual
+ dtor is handled in finish_struct_1. */
+ if (warn_ecpp && ! TYPE_POLYMORPHIC_P (basetype)
+ && TYPE_HAS_DESTRUCTOR (basetype))
+ warning ("base class `%#T' has a non-virtual destructor",
+ basetype);
+ /* If the base class doesn't have copy constructors or
+ assignment operators that take const references, then the
+ derived class cannot have such a member automatically
+ generated. */
+ if (! TYPE_HAS_CONST_INIT_REF (basetype))
+ *cant_have_const_ctor_p = 1;
+ if (TYPE_HAS_ASSIGN_REF (basetype)
+ && !TYPE_HAS_CONST_ASSIGN_REF (basetype))
+ *no_const_asn_ref_p = 1;
+ /* Similarly, if the base class doesn't have a default
+ constructor, then the derived class won't have an
+ automatically generated default constructor. */
if (TYPE_HAS_CONSTRUCTOR (basetype)
&& ! TYPE_HAS_DEFAULT_CONSTRUCTOR (basetype))
{
- b->cant_have_default_ctor = 1;
+ *cant_have_default_ctor_p = 1;
if (! TYPE_HAS_CONSTRUCTOR (t))
- {
- cp_pedwarn ("base `%T' with only non-default constructor",
- basetype);
- cp_pedwarn ("in class without a constructor");
- }
+ pedwarn ("base `%T' with only non-default constructor in class without a constructor",
+ basetype);
}
- if (TYPE_HAS_ASSIGN_REF (basetype)
- && !TYPE_HAS_CONST_ASSIGN_REF (basetype))
- b->no_const_asn_ref = 1;
+ if (TREE_VIA_VIRTUAL (base_binfo))
+ /* A virtual base does not effect nearly emptiness. */
+ ;
+ else if (CLASSTYPE_NEARLY_EMPTY_P (basetype))
+ {
+ if (seen_non_virtual_nearly_empty_base_p)
+ /* And if there is more than one nearly empty base, then the
+ derived class is not nearly empty either. */
+ CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
+ else
+ /* Remember we've seen one. */
+ seen_non_virtual_nearly_empty_base_p = 1;
+ }
+ else if (!is_empty_class (basetype))
+ /* If the base class is not empty or nearly empty, then this
+ class cannot be nearly empty. */
+ CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
+ /* A lot of properties from the bases also apply to the derived
+ class. */
TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (basetype);
- TYPE_NEEDS_DESTRUCTOR (t) |= TYPE_NEEDS_DESTRUCTOR (basetype);
- TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_HAS_COMPLEX_ASSIGN_REF (basetype);
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
+ |= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (basetype);
+ TYPE_HAS_COMPLEX_ASSIGN_REF (t)
+ |= TYPE_HAS_COMPLEX_ASSIGN_REF (basetype);
TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (basetype);
-
TYPE_OVERLOADS_CALL_EXPR (t) |= TYPE_OVERLOADS_CALL_EXPR (basetype);
TYPE_OVERLOADS_ARRAY_REF (t) |= TYPE_OVERLOADS_ARRAY_REF (basetype);
TYPE_OVERLOADS_ARROW (t) |= TYPE_OVERLOADS_ARROW (basetype);
+ TYPE_POLYMORPHIC_P (t) |= TYPE_POLYMORPHIC_P (basetype);
+ }
+}
- if (CLASSTYPE_COM_INTERFACE (basetype))
- {
- CLASSTYPE_COM_INTERFACE (t) = 1;
- if (i > 0)
- cp_error
- ("COM interface type `%T' must be the leftmost base class",
- basetype);
- }
- else if (CLASSTYPE_COM_INTERFACE (t))
- {
- cp_error ("COM interface type `%T' with non-COM base class `%T'",
- t, basetype);
- CLASSTYPE_COM_INTERFACE (t) = 0;
- }
+/* Binfo FROM is within a virtual hierarchy which is being reseated to
+ TO. Move primary information from FROM to TO, and recursively traverse
+ into FROM's bases. The hierarchy is dominated by TYPE. MAPPINGS is an
+ assoc list of binfos that have already been reseated. */
- if (TYPE_VIRTUAL_P (basetype))
- {
- /* Ensure that this is set from at least a virtual base
- class. */
- if (b->rtti == NULL_TREE)
- b->rtti = CLASSTYPE_RTTI (basetype);
+static void
+force_canonical_binfo_r (to, from, type, mappings)
+ tree to;
+ tree from;
+ tree type;
+ tree mappings;
+{
+ int i, n_baseclasses = BINFO_N_BASETYPES (from);
+
+ my_friendly_assert (to != from, 20010905);
+ BINFO_INDIRECT_PRIMARY_P (to)
+ = BINFO_INDIRECT_PRIMARY_P (from);
+ BINFO_INDIRECT_PRIMARY_P (from) = 0;
+ BINFO_UNSHARED_MARKED (to) = BINFO_UNSHARED_MARKED (from);
+ BINFO_UNSHARED_MARKED (from) = 0;
+ BINFO_LOST_PRIMARY_P (to) = BINFO_LOST_PRIMARY_P (from);
+ BINFO_LOST_PRIMARY_P (from) = 0;
+ if (BINFO_PRIMARY_P (from))
+ {
+ tree primary = BINFO_PRIMARY_BASE_OF (from);
+ tree assoc;
+
+ /* We might have just moved the primary base too, see if it's on our
+ mappings. */
+ assoc = purpose_member (primary, mappings);
+ if (assoc)
+ primary = TREE_VALUE (assoc);
+ BINFO_PRIMARY_BASE_OF (to) = primary;
+ BINFO_PRIMARY_BASE_OF (from) = NULL_TREE;
+ }
+ my_friendly_assert (same_type_p (BINFO_TYPE (to), BINFO_TYPE (from)),
+ 20010104);
+ mappings = tree_cons (from, to, mappings);
+
+ if (CLASSTYPE_HAS_PRIMARY_BASE_P (BINFO_TYPE (from))
+ && TREE_VIA_VIRTUAL (CLASSTYPE_PRIMARY_BINFO (BINFO_TYPE (from))))
+ {
+ tree from_primary = get_primary_binfo (from);
+
+ if (BINFO_PRIMARY_BASE_OF (from_primary) == from)
+ force_canonical_binfo (get_primary_binfo (to), from_primary,
+ type, mappings);
+ }
+
+ for (i = 0; i != n_baseclasses; i++)
+ {
+ tree from_binfo = BINFO_BASETYPE (from, i);
+ tree to_binfo = BINFO_BASETYPE (to, i);
+
+ if (TREE_VIA_VIRTUAL (from_binfo))
+ {
+ if (BINFO_PRIMARY_P (from_binfo) &&
+ purpose_member (BINFO_PRIMARY_BASE_OF (from_binfo), mappings))
+ /* This base is a primary of some binfo we have already
+ reseated. We must reseat this one too. */
+ force_canonical_binfo (to_binfo, from_binfo, type, mappings);
+ }
+ else
+ force_canonical_binfo_r (to_binfo, from_binfo, type, mappings);
+ }
+}
+
+/* FROM is the canonical binfo for a virtual base. It is being reseated to
+ make TO the canonical binfo, within the hierarchy dominated by TYPE.
+ MAPPINGS is an assoc list of binfos that have already been reseated.
+ Adjust any non-virtual bases within FROM, and also move any virtual bases
+ which are canonical. This complication arises because selecting primary
+ bases walks in inheritance graph order, but we don't share binfos for
+ virtual bases, hence we can fill in the primaries for a virtual base,
+ and then discover that a later base requires the virtual as its
+ primary. */
+
+static void
+force_canonical_binfo (to, from, type, mappings)
+ tree to;
+ tree from;
+ tree type;
+ tree mappings;
+{
+ tree assoc = purpose_member (BINFO_TYPE (to),
+ CLASSTYPE_VBASECLASSES (type));
+ if (TREE_VALUE (assoc) != to)
+ {
+ TREE_VALUE (assoc) = to;
+ force_canonical_binfo_r (to, from, type, mappings);
+ }
+}
+
+/* Make BASE_BINFO the a primary virtual base within the hierarchy
+ dominated by TYPE. Returns BASE_BINFO, if it is not already one, NULL
+ otherwise (because something else has already made it primary). */
+
+static tree
+mark_primary_virtual_base (base_binfo, type)
+ tree base_binfo;
+ tree type;
+{
+ tree shared_binfo = binfo_for_vbase (BINFO_TYPE (base_binfo), type);
+
+ if (BINFO_PRIMARY_P (shared_binfo))
+ {
+ /* It's already allocated in the hierarchy. BINFO won't have a
+ primary base in this hierarchy, even though the complete object
+ BINFO is for, would do. */
+ return NULL_TREE;
+ }
+
+ /* We need to make sure that the assoc list
+ CLASSTYPE_VBASECLASSES of TYPE, indicates this particular
+ primary BINFO for the virtual base, as this is the one
+ that'll really exist. */
+ if (base_binfo != shared_binfo)
+ force_canonical_binfo (base_binfo, shared_binfo, type, NULL);
+
+ return base_binfo;
+}
+
+/* If BINFO is an unmarked virtual binfo for a class with a primary virtual
+ base, then BINFO has no primary base in this graph. Called from
+ mark_primary_bases. DATA is the most derived type. */
- /* Don't borrow virtuals from virtual baseclasses. */
+static tree dfs_unshared_virtual_bases (binfo, data)
+ tree binfo;
+ void *data;
+{
+ tree t = (tree) data;
+
+ if (!BINFO_UNSHARED_MARKED (binfo)
+ && CLASSTYPE_HAS_PRIMARY_BASE_P (BINFO_TYPE (binfo)))
+ {
+ /* This morally virtual base has a primary base when it
+ is a complete object. We need to locate the shared instance
+ of this binfo in the type dominated by T. We duplicate the
+ primary base information from there to here. */
+ tree vbase;
+ tree unshared_base;
+
+ for (vbase = binfo; !TREE_VIA_VIRTUAL (vbase);
+ vbase = BINFO_INHERITANCE_CHAIN (vbase))
+ continue;
+ unshared_base = get_original_base (binfo,
+ binfo_for_vbase (BINFO_TYPE (vbase),
+ t));
+ my_friendly_assert (unshared_base != binfo, 20010612);
+ BINFO_LOST_PRIMARY_P (binfo) = BINFO_LOST_PRIMARY_P (unshared_base);
+ if (!BINFO_LOST_PRIMARY_P (binfo))
+ BINFO_PRIMARY_BASE_OF (get_primary_binfo (binfo)) = binfo;
+ }
+
+ if (binfo != TYPE_BINFO (t))
+ /* The vtable fields will have been copied when duplicating the
+ base binfos. That information is bogus, make sure we don't try
+ and use it. */
+ BINFO_VTABLE (binfo) = NULL_TREE;
+
+ /* If this is a virtual primary base, make sure its offset matches
+ that which it is primary for. */
+ if (BINFO_PRIMARY_P (binfo) && TREE_VIA_VIRTUAL (binfo) &&
+ binfo_for_vbase (BINFO_TYPE (binfo), t) == binfo)
+ {
+ tree delta = size_diffop (BINFO_OFFSET (BINFO_PRIMARY_BASE_OF (binfo)),
+ BINFO_OFFSET (binfo));
+ if (!integer_zerop (delta))
+ propagate_binfo_offsets (binfo, delta, t);
+ }
+
+ BINFO_UNSHARED_MARKED (binfo) = 0;
+ return NULL;
+}
+
+/* Set BINFO_PRIMARY_BASE_OF for all binfos in the hierarchy
+ dominated by TYPE that are primary bases. */
+
+static void
+mark_primary_bases (type)
+ tree type;
+{
+ tree binfo;
+
+ /* Walk the bases in inheritance graph order. */
+ for (binfo = TYPE_BINFO (type); binfo; binfo = TREE_CHAIN (binfo))
+ {
+ tree base_binfo;
+
+ if (!CLASSTYPE_HAS_PRIMARY_BASE_P (BINFO_TYPE (binfo)))
+ /* Not a dynamic base. */
+ continue;
+
+ base_binfo = get_primary_binfo (binfo);
+
+ if (TREE_VIA_VIRTUAL (base_binfo))
+ base_binfo = mark_primary_virtual_base (base_binfo, type);
+
+ if (base_binfo)
+ BINFO_PRIMARY_BASE_OF (base_binfo) = binfo;
+ else
+ BINFO_LOST_PRIMARY_P (binfo) = 1;
+
+ BINFO_UNSHARED_MARKED (binfo) = 1;
+ }
+ /* There could remain unshared morally virtual bases which were not
+ visited in the inheritance graph walk. These bases will have lost
+ their virtual primary base (should they have one). We must now
+ find them. Also we must fix up the BINFO_OFFSETs of primary
+ virtual bases. We could not do that as we went along, as they
+ were originally copied from the bases we inherited from by
+ unshare_base_binfos. That may have decided differently about
+ where a virtual primary base went. */
+ dfs_walk (TYPE_BINFO (type), dfs_unshared_virtual_bases, NULL, type);
+}
+
+/* Make the BINFO the primary base of T. */
+
+static void
+set_primary_base (t, binfo, vfuns_p)
+ tree t;
+ tree binfo;
+ int *vfuns_p;
+{
+ tree basetype;
+
+ CLASSTYPE_PRIMARY_BINFO (t) = binfo;
+ basetype = BINFO_TYPE (binfo);
+ TYPE_BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (basetype);
+ TYPE_BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (basetype);
+ TYPE_VFIELD (t) = TYPE_VFIELD (basetype);
+ CLASSTYPE_RTTI (t) = CLASSTYPE_RTTI (basetype);
+ *vfuns_p = CLASSTYPE_VSIZE (basetype);
+}
+
+/* Determine the primary class for T. */
+
+static void
+determine_primary_base (t, vfuns_p)
+ tree t;
+ int *vfuns_p;
+{
+ int i, n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
+ tree vbases;
+ tree type_binfo;
+
+ /* If there are no baseclasses, there is certainly no primary base. */
+ if (n_baseclasses == 0)
+ return;
+
+ type_binfo = TYPE_BINFO (t);
+
+ for (i = 0; i < n_baseclasses; i++)
+ {
+ tree base_binfo = BINFO_BASETYPE (type_binfo, i);
+ tree basetype = BINFO_TYPE (base_binfo);
+
+ if (TYPE_CONTAINS_VPTR_P (basetype))
+ {
+ /* Even a virtual baseclass can contain our RTTI
+ information. But, we prefer a non-virtual polymorphic
+ baseclass. */
+ if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
+ CLASSTYPE_RTTI (t) = CLASSTYPE_RTTI (basetype);
+
+ /* We prefer a non-virtual base, although a virtual one will
+ do. */
if (TREE_VIA_VIRTUAL (base_binfo))
continue;
- if (first_vfn_base_index < 0)
+ if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
{
- tree vfields;
- first_vfn_base_index = i;
-
- /* Update these two, now that we know what vtable we are
- going to extend. This is so that we can add virtual
- functions, and override them properly. */
- TYPE_BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (basetype);
- TYPE_BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (basetype);
- b->has_virtual = CLASSTYPE_VSIZE (basetype);
- b->vfield = CLASSTYPE_VFIELD (basetype);
- b->vfields = copy_list (CLASSTYPE_VFIELDS (basetype));
- vfields = b->vfields;
- while (vfields)
- {
- if (VF_BINFO_VALUE (vfields) == NULL_TREE
- || ! TREE_VIA_VIRTUAL (VF_BINFO_VALUE (vfields)))
- {
- tree value = VF_BASETYPE_VALUE (vfields);
- if (DECL_NAME (CLASSTYPE_VFIELD (value))
- == DECL_NAME (CLASSTYPE_VFIELD (basetype)))
- VF_NORMAL_VALUE (b->vfields) = basetype;
- else
- VF_NORMAL_VALUE (b->vfields) = VF_NORMAL_VALUE (vfields);
- }
- vfields = TREE_CHAIN (vfields);
- }
- CLASSTYPE_VFIELD (t) = b->vfield;
+ set_primary_base (t, base_binfo, vfuns_p);
+ CLASSTYPE_VFIELDS (t) = copy_list (CLASSTYPE_VFIELDS (basetype));
}
else
{
+ tree vfields;
+
/* Only add unique vfields, and flatten them out as we go. */
- tree vfields = CLASSTYPE_VFIELDS (basetype);
- while (vfields)
- {
- if (VF_BINFO_VALUE (vfields) == NULL_TREE
- || ! TREE_VIA_VIRTUAL (VF_BINFO_VALUE (vfields)))
- {
- tree value = VF_BASETYPE_VALUE (vfields);
- b->vfields = tree_cons (base_binfo, value, b->vfields);
- if (DECL_NAME (CLASSTYPE_VFIELD (value))
- == DECL_NAME (CLASSTYPE_VFIELD (basetype)))
- VF_NORMAL_VALUE (b->vfields) = basetype;
- else
- VF_NORMAL_VALUE (b->vfields) = VF_NORMAL_VALUE (vfields);
- }
- vfields = TREE_CHAIN (vfields);
- }
+ for (vfields = CLASSTYPE_VFIELDS (basetype);
+ vfields;
+ vfields = TREE_CHAIN (vfields))
+ if (VF_BINFO_VALUE (vfields) == NULL_TREE
+ || ! TREE_VIA_VIRTUAL (VF_BINFO_VALUE (vfields)))
+ CLASSTYPE_VFIELDS (t)
+ = tree_cons (base_binfo,
+ VF_BASETYPE_VALUE (vfields),
+ CLASSTYPE_VFIELDS (t));
+ }
+ }
+ }
- if (b->has_virtual == 0)
+ if (!TYPE_VFIELD (t))
+ CLASSTYPE_PRIMARY_BINFO (t) = NULL_TREE;
+
+ /* Find the indirect primary bases - those virtual bases which are primary
+ bases of something else in this hierarchy. */
+ for (vbases = CLASSTYPE_VBASECLASSES (t);
+ vbases;
+ vbases = TREE_CHAIN (vbases))
+ {
+ tree vbase_binfo = TREE_VALUE (vbases);
+
+ /* See if this virtual base is an indirect primary base. To be so,
+ it must be a primary base within the hierarchy of one of our
+ direct bases. */
+ for (i = 0; i < n_baseclasses; ++i)
+ {
+ tree basetype = TYPE_BINFO_BASETYPE (t, i);
+ tree v;
+
+ for (v = CLASSTYPE_VBASECLASSES (basetype);
+ v;
+ v = TREE_CHAIN (v))
+ {
+ tree base_vbase = TREE_VALUE (v);
+
+ if (BINFO_PRIMARY_P (base_vbase)
+ && same_type_p (BINFO_TYPE (base_vbase),
+ BINFO_TYPE (vbase_binfo)))
{
- first_vfn_base_index = i;
-
- /* Update these two, now that we know what vtable we are
- going to extend. This is so that we can add virtual
- functions, and override them properly. */
- TYPE_BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (basetype);
- TYPE_BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (basetype);
- b->has_virtual = CLASSTYPE_VSIZE (basetype);
- b->vfield = CLASSTYPE_VFIELD (basetype);
- CLASSTYPE_VFIELD (t) = b->vfield;
- /* When we install the first one, set the VF_NORMAL_VALUE
- to be the current class, as this it is the most derived
- class. Hopefully, this is not set to something else
- later. (mrs) */
- vfields = b->vfields;
- while (vfields)
- {
- if (DECL_NAME (CLASSTYPE_VFIELD (t))
- == DECL_NAME (CLASSTYPE_VFIELD (basetype)))
- {
- VF_NORMAL_VALUE (vfields) = t;
- /* There should only be one of them! And it should
- always be found, if we get into here. (mrs) */
- break;
- }
- vfields = TREE_CHAIN (vfields);
- }
+ BINFO_INDIRECT_PRIMARY_P (vbase_binfo) = 1;
+ break;
}
}
+
+ /* If we've discovered that this virtual base is an indirect
+ primary base, then we can move on to the next virtual
+ base. */
+ if (BINFO_INDIRECT_PRIMARY_P (vbase_binfo))
+ break;
}
}
- {
- tree vfields;
- /* Find the base class with the largest number of virtual functions. */
- for (vfields = b->vfields; vfields; vfields = TREE_CHAIN (vfields))
- {
- if (CLASSTYPE_VSIZE (VF_BASETYPE_VALUE (vfields)) > b->max_has_virtual)
- b->max_has_virtual = CLASSTYPE_VSIZE (VF_BASETYPE_VALUE (vfields));
- if (VF_DERIVED_VALUE (vfields)
- && CLASSTYPE_VSIZE (VF_DERIVED_VALUE (vfields)) > b->max_has_virtual)
- b->max_has_virtual = CLASSTYPE_VSIZE (VF_DERIVED_VALUE (vfields));
- }
- }
+ /* A "nearly-empty" virtual base class can be the primary base
+ class, if no non-virtual polymorphic base can be found. */
+ if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
+ {
+ /* If not NULL, this is the best primary base candidate we have
+ found so far. */
+ tree candidate = NULL_TREE;
+ tree base_binfo;
- if (b->vfield == 0)
- /* If all virtual functions come only from virtual baseclasses. */
- return -1;
+ /* Loop over the baseclasses. */
+ for (base_binfo = TYPE_BINFO (t);
+ base_binfo;
+ base_binfo = TREE_CHAIN (base_binfo))
+ {
+ tree basetype = BINFO_TYPE (base_binfo);
- /* Update the rtti base if we have a non-virtual base class version
- of it. */
- b->rtti = CLASSTYPE_RTTI (BINFO_TYPE (TREE_VEC_ELT (binfos, first_vfn_base_index)));
+ if (TREE_VIA_VIRTUAL (base_binfo)
+ && CLASSTYPE_NEARLY_EMPTY_P (basetype))
+ {
+ /* If this is not an indirect primary base, then it's
+ definitely our primary base. */
+ if (!BINFO_INDIRECT_PRIMARY_P (base_binfo))
+ {
+ candidate = base_binfo;
+ break;
+ }
+
+ /* If this is an indirect primary base, it still could be
+ our primary base -- unless we later find there's another
+ nearly-empty virtual base that isn't an indirect
+ primary base. */
+ if (!candidate)
+ candidate = base_binfo;
+ }
+ }
+
+ /* If we've got a primary base, use it. */
+ if (candidate)
+ {
+ set_primary_base (t, candidate, vfuns_p);
+ CLASSTYPE_VFIELDS (t)
+ = copy_list (CLASSTYPE_VFIELDS (BINFO_TYPE (candidate)));
+ }
+ }
- return first_vfn_base_index;
+ /* Mark the primary base classes at this point. */
+ mark_primary_bases (t);
}
-/* Set memoizing fields and bits of T (and its variants) for later use.
- MAX_HAS_VIRTUAL is the largest size of any T's virtual function tables. */
+/* Set memoizing fields and bits of T (and its variants) for later
+ use. */
static void
-finish_struct_bits (t, max_has_virtual)
+finish_struct_bits (t)
tree t;
- int max_has_virtual;
{
int i, n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
@@ -1837,12 +1800,13 @@ finish_struct_bits (t, max_has_virtual)
TYPE_HAS_CONSTRUCTOR (variants) = TYPE_HAS_CONSTRUCTOR (t);
TYPE_HAS_DESTRUCTOR (variants) = TYPE_HAS_DESTRUCTOR (t);
TYPE_NEEDS_CONSTRUCTING (variants) = TYPE_NEEDS_CONSTRUCTING (t);
- TYPE_NEEDS_DESTRUCTOR (variants) = TYPE_NEEDS_DESTRUCTOR (t);
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (variants)
+ = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t);
- TYPE_USES_COMPLEX_INHERITANCE (variants) = TYPE_USES_COMPLEX_INHERITANCE (t);
- TYPE_VIRTUAL_P (variants) = TYPE_VIRTUAL_P (t);
+ TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (variants)
+ = TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (t);
+ TYPE_POLYMORPHIC_P (variants) = TYPE_POLYMORPHIC_P (t);
TYPE_USES_VIRTUAL_BASECLASSES (variants) = TYPE_USES_VIRTUAL_BASECLASSES (t);
- TYPE_USES_PVBASES (variants) = TYPE_USES_PVBASES (t);
/* Copy whatever these are holding today. */
TYPE_MIN_VALUE (variants) = TYPE_MIN_VALUE (t);
TYPE_MAX_VALUE (variants) = TYPE_MAX_VALUE (t);
@@ -1852,18 +1816,16 @@ finish_struct_bits (t, max_has_virtual)
variants = TYPE_NEXT_VARIANT (variants);
}
- if (n_baseclasses && max_has_virtual)
- {
- /* For a class w/o baseclasses, `finish_struct' has set
- CLASS_TYPE_ABSTRACT_VIRTUALS correctly (by definition). Similarly
- for a class who's base classes do not have vtables. When neither
- of these is true, we might have removed abstract virtuals (by
- providing a definition), added some (by declaring new ones), or
- redeclared ones from a base class. We need to recalculate what's
- really an abstract virtual at this point (by looking in the
- vtables). */
- CLASSTYPE_ABSTRACT_VIRTUALS (t) = get_abstract_virtuals (t);
- }
+ if (n_baseclasses && TYPE_POLYMORPHIC_P (t))
+ /* For a class w/o baseclasses, `finish_struct' has set
+ CLASS_TYPE_ABSTRACT_VIRTUALS correctly (by
+ definition). Similarly for a class whose base classes do not
+ have vtables. When neither of these is true, we might have
+ removed abstract virtuals (by providing a definition), added
+ some (by declaring new ones), or redeclared ones from a base
+ class. We need to recalculate what's really an abstract virtual
+ at this point (by looking in the vtables). */
+ get_pure_virtuals (t);
if (n_baseclasses)
{
@@ -1985,7 +1947,7 @@ maybe_warn_about_overly_private_class (t)
}
if (!has_nonprivate_method)
{
- cp_warning ("all member functions in class `%T' are private", t);
+ warning ("all member functions in class `%T' are private", t);
return;
}
}
@@ -1999,7 +1961,7 @@ maybe_warn_about_overly_private_class (t)
if (TREE_PRIVATE (dtor))
{
- cp_warning ("`%#T' only defines a private destructor and has no friends",
+ warning ("`%#T' only defines a private destructor and has no friends",
t);
return;
}
@@ -2042,13 +2004,47 @@ maybe_warn_about_overly_private_class (t)
if (nonprivate_ctor == 0)
{
- cp_warning ("`%#T' only defines private constructors and has no friends",
+ warning ("`%#T' only defines private constructors and has no friends",
t);
return;
}
}
}
+/* Function to help qsort sort FIELD_DECLs by name order. */
+
+static int
+field_decl_cmp (x, y)
+ const tree *x, *y;
+{
+ if (DECL_NAME (*x) == DECL_NAME (*y))
+ /* A nontype is "greater" than a type. */
+ return DECL_DECLARES_TYPE_P (*y) - DECL_DECLARES_TYPE_P (*x);
+ if (DECL_NAME (*x) == NULL_TREE)
+ return -1;
+ if (DECL_NAME (*y) == NULL_TREE)
+ return 1;
+ if (DECL_NAME (*x) < DECL_NAME (*y))
+ return -1;
+ return 1;
+}
+
+/* Comparison function to compare two TYPE_METHOD_VEC entries by name. */
+
+static int
+method_name_cmp (m1, m2)
+ const tree *m1, *m2;
+{
+ if (*m1 == NULL_TREE && *m2 == NULL_TREE)
+ return 0;
+ if (*m1 == NULL_TREE)
+ return -1;
+ if (*m2 == NULL_TREE)
+ return 1;
+ if (DECL_NAME (OVL_CURRENT (*m1)) < DECL_NAME (OVL_CURRENT (*m2)))
+ return -1;
+ return 1;
+}
/* Warn about duplicate methods in fn_fields. Also compact method
lists so that lookup can be made faster.
@@ -2062,79 +2058,65 @@ maybe_warn_about_overly_private_class (t)
list. That allows them to be quickly deleted, and requires no
extra storage.
- If there are any constructors/destructors, they are moved to the
- front of the list. This makes pushclass more efficient.
-
- We also link each field which has shares a name with its baseclass
- to the head of the list of fields for that base class. This allows
- us to reduce search time in places like `build_method_call' to
- consider only reasonably likely functions. */
+ Sort methods that are not special (i.e., constructors, destructors,
+ and type conversion operators) so that we can find them faster in
+ search. */
static void
finish_struct_methods (t)
tree t;
{
tree fn_fields;
- tree method_vec = CLASSTYPE_METHOD_VEC (t);
- tree ctor_name = constructor_name (t);
+ tree method_vec;
+ int slot, len;
+
+ if (!TYPE_METHODS (t))
+ {
+ /* Clear these for safety; perhaps some parsing error could set
+ these incorrectly. */
+ TYPE_HAS_CONSTRUCTOR (t) = 0;
+ TYPE_HAS_DESTRUCTOR (t) = 0;
+ CLASSTYPE_METHOD_VEC (t) = NULL_TREE;
+ return;
+ }
+
+ method_vec = CLASSTYPE_METHOD_VEC (t);
+ my_friendly_assert (method_vec != NULL_TREE, 19991215);
+ len = TREE_VEC_LENGTH (method_vec);
/* First fill in entry 0 with the constructors, entry 1 with destructors,
and the next few with type conversion operators (if any). */
for (fn_fields = TYPE_METHODS (t); fn_fields;
fn_fields = TREE_CHAIN (fn_fields))
- {
- tree fn_name = DECL_NAME (fn_fields);
-
- /* Clear out this flag.
+ /* Clear out this flag. */
+ DECL_IN_AGGR_P (fn_fields) = 0;
- @@ Doug may figure out how to break
- @@ this with nested classes and friends. */
- DECL_IN_AGGR_P (fn_fields) = 0;
-
- /* Note here that a copy ctor is private, so we don't dare generate
- a default copy constructor for a class that has a member
- of this type without making sure they have access to it. */
- if (fn_name == ctor_name)
- {
- tree parmtypes = FUNCTION_ARG_CHAIN (fn_fields);
- tree parmtype = parmtypes ? TREE_VALUE (parmtypes) : void_type_node;
-
- if (TREE_CODE (parmtype) == REFERENCE_TYPE
- && TYPE_MAIN_VARIANT (TREE_TYPE (parmtype)) == t)
- {
- if (TREE_CHAIN (parmtypes) == NULL_TREE
- || TREE_CHAIN (parmtypes) == void_list_node
- || TREE_PURPOSE (TREE_CHAIN (parmtypes)))
- {
- if (TREE_PROTECTED (fn_fields))
- TYPE_HAS_NONPUBLIC_CTOR (t) = 1;
- else if (TREE_PRIVATE (fn_fields))
- TYPE_HAS_NONPUBLIC_CTOR (t) = 2;
- }
- }
- }
- else if (fn_name == ansi_opname[(int) MODIFY_EXPR])
- {
- tree parmtype = TREE_VALUE (FUNCTION_ARG_CHAIN (fn_fields));
-
- if (copy_assignment_arg_p (parmtype, DECL_VIRTUAL_P (fn_fields)))
- {
- if (TREE_PROTECTED (fn_fields))
- TYPE_HAS_NONPUBLIC_ASSIGN_REF (t) = 1;
- else if (TREE_PRIVATE (fn_fields))
- TYPE_HAS_NONPUBLIC_ASSIGN_REF (t) = 2;
- }
- }
- }
-
- if (TYPE_HAS_DESTRUCTOR (t) && !TREE_VEC_ELT (method_vec, 1))
+ if (TYPE_HAS_DESTRUCTOR (t) && !CLASSTYPE_DESTRUCTORS (t))
/* We thought there was a destructor, but there wasn't. Some
parse errors cause this anomalous situation. */
TYPE_HAS_DESTRUCTOR (t) = 0;
/* Issue warnings about private constructors and such. If there are
no methods, then some public defaults are generated. */
- maybe_warn_about_overly_private_class (t);
+ maybe_warn_about_overly_private_class (t);
+
+ /* Now sort the methods. */
+ while (len > 2 && TREE_VEC_ELT (method_vec, len-1) == NULL_TREE)
+ len--;
+ TREE_VEC_LENGTH (method_vec) = len;
+
+ /* The type conversion ops have to live at the front of the vec, so we
+ can't sort them. */
+ for (slot = 2; slot < len; ++slot)
+ {
+ tree fn = TREE_VEC_ELT (method_vec, slot);
+
+ if (!DECL_CONV_FN_P (OVL_CURRENT (fn)))
+ break;
+ }
+ if (len - slot > 1)
+ qsort (&TREE_VEC_ELT (method_vec, slot), len-slot, sizeof (tree),
+ (int (*)(const void *, const void *))method_name_cmp);
}
/* Emit error when a duplicate definition of a type is seen. Patch up. */
@@ -2143,8 +2125,8 @@ void
duplicate_tag_error (t)
tree t;
{
- cp_error ("redefinition of `%#T'", t);
- cp_error_at ("previous definition here", t);
+ error ("redefinition of `%#T'", t);
+ cp_error_at ("previous definition of `%#T'", t);
/* Pretend we haven't defined this type. */
@@ -2176,14 +2158,18 @@ duplicate_tag_error (t)
tree binfo = TYPE_BINFO (t);
int interface_only = CLASSTYPE_INTERFACE_ONLY (t);
int interface_unknown = CLASSTYPE_INTERFACE_UNKNOWN (t);
+ tree template_info = CLASSTYPE_TEMPLATE_INFO (t);
+ int use_template = CLASSTYPE_USE_TEMPLATE (t);
- bzero ((char *) TYPE_LANG_SPECIFIC (t), sizeof (struct lang_type));
+ memset ((char *) TYPE_LANG_SPECIFIC (t), 0, sizeof (struct lang_type));
BINFO_BASETYPES(binfo) = NULL_TREE;
TYPE_BINFO (t) = binfo;
CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, interface_unknown);
TYPE_REDEFINED (t) = 1;
+ CLASSTYPE_TEMPLATE_INFO (t) = template_info;
+ CLASSTYPE_USE_TEMPLATE (t) = use_template;
}
TYPE_SIZE (t) = NULL_TREE;
TYPE_MODE (t) = VOIDmode;
@@ -2191,72 +2177,72 @@ duplicate_tag_error (t)
TYPE_METHODS (t) = NULL_TREE;
TYPE_VFIELD (t) = NULL_TREE;
TYPE_CONTEXT (t) = NULL_TREE;
+
+ /* Clear TYPE_LANG_FLAGS -- those in TYPE_LANG_SPECIFIC are cleared above. */
+ TYPE_LANG_FLAG_0 (t) = 0;
+ TYPE_LANG_FLAG_1 (t) = 0;
+ TYPE_LANG_FLAG_2 (t) = 0;
+ TYPE_LANG_FLAG_3 (t) = 0;
+ TYPE_LANG_FLAG_4 (t) = 0;
+ TYPE_LANG_FLAG_5 (t) = 0;
+ TYPE_LANG_FLAG_6 (t) = 0;
+ /* But not this one. */
+ SET_IS_AGGR_TYPE (t, 1);
}
-/* finish up all new vtables. */
+/* Make BINFO's vtable have N entries, including RTTI entries,
+ vbase and vcall offsets, etc. Set its type and call the backend
+ to lay it out. */
static void
-finish_vtbls (binfo, do_self, t)
+layout_vtable_decl (binfo, n)
tree binfo;
- int do_self;
- tree t;
+ int n;
{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
+ tree atype;
+ tree vtable;
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
- {
- if (BINFO_NEW_VTABLE_MARKED (binfo))
- {
- tree decl, context;
-
- decl = BINFO_VTABLE (binfo);
- context = DECL_CONTEXT (decl);
- DECL_CONTEXT (decl) = 0;
- if (DECL_INITIAL (decl) != BINFO_VIRTUALS (binfo))
- DECL_INITIAL (decl) = build_nt (CONSTRUCTOR, NULL_TREE,
- BINFO_VIRTUALS (binfo));
- cp_finish_decl (decl, DECL_INITIAL (decl), NULL_TREE, 0, 0);
- DECL_CONTEXT (decl) = context;
- }
- CLEAR_BINFO_NEW_VTABLE_MARKED (binfo);
- }
+ atype = build_cplus_array_type (vtable_entry_type,
+ build_index_type (size_int (n - 1)));
+ layout_type (atype);
- for (i = 0; i < n_baselinks; i++)
+ /* We may have to grow the vtable. */
+ vtable = get_vtbl_decl_for_binfo (binfo);
+ if (!same_type_p (TREE_TYPE (vtable), atype))
{
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable
- = i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));
- if (TREE_VIA_VIRTUAL (base_binfo))
- {
- base_binfo = binfo_member (BINFO_TYPE (base_binfo), CLASSTYPE_VBASECLASSES (t));
- }
- finish_vtbls (base_binfo, is_not_base_vtable, t);
+ TREE_TYPE (vtable) = atype;
+ DECL_SIZE (vtable) = DECL_SIZE_UNIT (vtable) = NULL_TREE;
+ layout_decl (vtable, 0);
+
+ /* At one time the vtable info was grabbed 2 words at a time. This
+ fails on Sparc unless you have 8-byte alignment. */
+ DECL_ALIGN (vtable) = MAX (TYPE_ALIGN (double_type_node),
+ DECL_ALIGN (vtable));
}
}
-/* True if we should override the given BASE_FNDECL with the given
- FNDECL. */
+/* True iff FNDECL and BASE_FNDECL (both non-static member functions)
+ have the same signature. */
-static int
-overrides (fndecl, base_fndecl)
+int
+same_signature_p (fndecl, base_fndecl)
tree fndecl, base_fndecl;
{
- /* Destructors have special names. */
- if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (base_fndecl))
- && DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (fndecl)))
+ /* One destructor overrides another if they are the same kind of
+ destructor. */
+ if (DECL_DESTRUCTOR_P (base_fndecl) && DECL_DESTRUCTOR_P (fndecl)
+ && special_function_p (base_fndecl) == special_function_p (fndecl))
return 1;
- if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (base_fndecl))
- || DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (fndecl)))
+ /* But a non-destructor never overrides a destructor, nor vice
+ versa, nor do different kinds of destructors override
+ one-another. For example, a complete object destructor does not
+ override a deleting destructor. */
+ if (DECL_DESTRUCTOR_P (base_fndecl) || DECL_DESTRUCTOR_P (fndecl))
return 0;
+
if (DECL_NAME (fndecl) == DECL_NAME (base_fndecl))
{
tree types, base_types;
-#if 0
- retypes = TREE_TYPE (TREE_TYPE (fndecl));
- base_retypes = TREE_TYPE (TREE_TYPE (base_fndecl));
-#endif
types = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
base_types = TYPE_ARG_TYPES (TREE_TYPE (base_fndecl));
if ((TYPE_QUALS (TREE_TYPE (TREE_VALUE (base_types)))
@@ -2267,584 +2253,496 @@ overrides (fndecl, base_fndecl)
return 0;
}
+typedef struct find_final_overrider_data_s {
+ /* The function for which we are trying to find a final overrider. */
+ tree fn;
+ /* The base class in which the function was declared. */
+ tree declaring_base;
+ /* The most derived class in the hierarchy. */
+ tree most_derived_type;
+ /* The final overriding function. */
+ tree overriding_fn;
+ /* The functions that we thought might be final overriders, but
+ aren't. */
+ tree candidates;
+ /* The BINFO for the class in which the final overriding function
+ appears. */
+ tree overriding_base;
+} find_final_overrider_data;
+
+/* Called from find_final_overrider via dfs_walk. */
+
static tree
-get_class_offset_1 (parent, binfo, context, t, fndecl)
- tree parent, binfo, context, t, fndecl;
+dfs_find_final_overrider (binfo, data)
+ tree binfo;
+ void *data;
{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- tree rval = NULL_TREE;
-
- if (binfo == parent)
- return error_mark_node;
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree nrval;
+ find_final_overrider_data *ffod = (find_final_overrider_data *) data;
+
+ if (same_type_p (BINFO_TYPE (binfo),
+ BINFO_TYPE (ffod->declaring_base))
+ && tree_int_cst_equal (BINFO_OFFSET (binfo),
+ BINFO_OFFSET (ffod->declaring_base)))
+ {
+ tree path;
+ tree method;
+
+ /* We haven't found an overrider yet. */
+ method = NULL_TREE;
+ /* We've found a path to the declaring base. Walk down the path
+ looking for an overrider for FN. */
+ for (path = reverse_path (binfo);
+ path;
+ path = TREE_CHAIN (path))
+ {
+ method = look_for_overrides_here (BINFO_TYPE (TREE_VALUE (path)),
+ ffod->fn);
+ if (method)
+ break;
+ }
- if (TREE_VIA_VIRTUAL (base_binfo))
- base_binfo = binfo_member (BINFO_TYPE (base_binfo),
- CLASSTYPE_VBASECLASSES (t));
- nrval = get_class_offset_1 (parent, base_binfo, context, t, fndecl);
- /* See if we have a new value */
- if (nrval && (nrval != error_mark_node || rval==0))
+ /* If we found an overrider, record the overriding function, and
+ the base from which it came. */
+ if (path)
{
- /* Only compare if we have two offsets */
- if (rval && rval != error_mark_node
- && ! tree_int_cst_equal (nrval, rval))
+ tree base;
+
+ /* Assume the path is non-virtual. See if there are any
+ virtual bases from (but not including) the overrider up
+ to and including the base where the function is
+ defined. */
+ for (base = TREE_CHAIN (path); base; base = TREE_CHAIN (base))
+ if (TREE_VIA_VIRTUAL (TREE_VALUE (base)))
+ {
+ base = ffod->declaring_base;
+ break;
+ }
+
+ /* If we didn't already have an overrider, or any
+ candidates, then this function is the best candidate so
+ far. */
+ if (!ffod->overriding_fn && !ffod->candidates)
{
- /* Only give error if the two offsets are different */
- error ("every virtual function must have a unique final overrider");
- cp_error (" found two (or more) `%T' class subobjects in `%T'", context, t);
- cp_error (" with virtual `%D' from virtual base class", fndecl);
- return rval;
+ ffod->overriding_fn = method;
+ ffod->overriding_base = TREE_VALUE (path);
+ }
+ else if (ffod->overriding_fn)
+ {
+ /* We had a best overrider; let's see how this compares. */
+
+ if (ffod->overriding_fn == method
+ && (tree_int_cst_equal
+ (BINFO_OFFSET (TREE_VALUE (path)),
+ BINFO_OFFSET (ffod->overriding_base))))
+ /* We found the same overrider we already have, and in the
+ same place; it's still the best. */;
+ else if (strictly_overrides (ffod->overriding_fn, method))
+ /* The old function overrides this function; it's still the
+ best. */;
+ else if (strictly_overrides (method, ffod->overriding_fn))
+ {
+ /* The new function overrides the old; it's now the
+ best. */
+ ffod->overriding_fn = method;
+ ffod->overriding_base = TREE_VALUE (path);
+ }
+ else
+ {
+ /* Ambiguous. */
+ ffod->candidates
+ = build_tree_list (NULL_TREE,
+ ffod->overriding_fn);
+ if (method != ffod->overriding_fn)
+ ffod->candidates
+ = tree_cons (NULL_TREE, method, ffod->candidates);
+ ffod->overriding_fn = NULL_TREE;
+ ffod->overriding_base = NULL_TREE;
+ }
+ }
+ else
+ {
+ /* We had a list of ambiguous overrides; let's see how this
+ new one compares. */
+
+ tree candidates;
+ bool incomparable = false;
+
+ /* If there were previous candidates, and this function
+ overrides all of them, then it is the new best
+ candidate. */
+ for (candidates = ffod->candidates;
+ candidates;
+ candidates = TREE_CHAIN (candidates))
+ {
+ /* If the candidate overrides the METHOD, then we
+ needn't worry about it any further. */
+ if (strictly_overrides (TREE_VALUE (candidates),
+ method))
+ {
+ method = NULL_TREE;
+ break;
+ }
+
+ /* If the METHOD doesn't override the candidate,
+ then it is incomporable. */
+ if (!strictly_overrides (method,
+ TREE_VALUE (candidates)))
+ incomparable = true;
+ }
+
+ /* If METHOD overrode all the candidates, then it is the
+ new best candidate. */
+ if (!candidates && !incomparable)
+ {
+ ffod->overriding_fn = method;
+ ffod->overriding_base = TREE_VALUE (path);
+ ffod->candidates = NULL_TREE;
+ }
+ /* If METHOD didn't override all the candidates, then it
+ is another candidate. */
+ else if (method && incomparable)
+ ffod->candidates
+ = tree_cons (NULL_TREE, method, ffod->candidates);
}
- rval = nrval;
- }
-
- if (rval && BINFO_TYPE (binfo) == context)
- {
- my_friendly_assert (rval == error_mark_node
- || tree_int_cst_equal (rval, BINFO_OFFSET (binfo)), 999);
- rval = BINFO_OFFSET (binfo);
}
}
- return rval;
+
+ return NULL_TREE;
}
-/* Get the offset to the CONTEXT subobject that is related to the
- given BINFO. */
+/* Returns a TREE_LIST whose TREE_PURPOSE is the final overrider for
+ FN and whose TREE_VALUE is the binfo for the base where the
+ overriding occurs. BINFO (in the hierarchy dominated by T) is the
+ base object in which FN is declared. */
static tree
-get_class_offset (context, t, binfo, fndecl)
- tree context, t, binfo, fndecl;
+find_final_overrider (t, binfo, fn)
+ tree t;
+ tree binfo;
+ tree fn;
{
- tree first_binfo = binfo;
- tree offset;
- int i;
+ find_final_overrider_data ffod;
- if (context == t)
- return integer_zero_node;
+ /* Getting this right is a little tricky. This is legal:
- if (BINFO_TYPE (binfo) == context)
- return BINFO_OFFSET (binfo);
+ struct S { virtual void f (); };
+ struct T { virtual void f (); };
+ struct U : public S, public T { };
- /* Check less derived binfos first. */
- while (BINFO_BASETYPES (binfo)
- && (i=CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo))) != -1)
- {
- tree binfos = BINFO_BASETYPES (binfo);
- binfo = TREE_VEC_ELT (binfos, i);
- if (BINFO_TYPE (binfo) == context)
- return BINFO_OFFSET (binfo);
- }
+ even though calling `f' in `U' is ambiguous. But,
- /* Ok, not found in the less derived binfos, now check the more
- derived binfos. */
- offset = get_class_offset_1 (first_binfo, TYPE_BINFO (t), context, t, fndecl);
- if (offset==0 || TREE_CODE (offset) != INTEGER_CST)
- my_friendly_abort (999); /* we have to find it. */
- return offset;
-}
+ struct R { virtual void f(); };
+ struct S : virtual public R { virtual void f (); };
+ struct T : virtual public R { virtual void f (); };
+ struct U : public S, public T { };
-/* Skip RTTI information at the front of the virtual list. */
-
-unsigned HOST_WIDE_INT
-skip_rtti_stuff (virtuals, t)
- tree *virtuals, t;
-{
- int n;
-
- if (CLASSTYPE_COM_INTERFACE (t))
- return 0;
-
- n = 0;
- if (*virtuals)
- {
- /* We always reserve a slot for the offset/tdesc entry. */
- ++n;
- *virtuals = TREE_CHAIN (*virtuals);
- }
- if (flag_vtable_thunks && *virtuals)
- {
- /* The second slot is reserved for the tdesc pointer when thunks
- are used. */
- ++n;
- *virtuals = TREE_CHAIN (*virtuals);
+ is not -- there's no way to decide whether to put `S::f' or
+ `T::f' in the vtable for `R'.
+
+ The solution is to look at all paths to BINFO. If we find
+ different overriders along any two, then there is a problem. */
+ ffod.fn = fn;
+ ffod.declaring_base = binfo;
+ ffod.most_derived_type = t;
+ ffod.overriding_fn = NULL_TREE;
+ ffod.overriding_base = NULL_TREE;
+ ffod.candidates = NULL_TREE;
+
+ dfs_walk (TYPE_BINFO (t),
+ dfs_find_final_overrider,
+ NULL,
+ &ffod);
+
+ /* If there was no winner, issue an error message. */
+ if (!ffod.overriding_fn)
+ {
+ error ("no unique final overrider for `%D' in `%T'", fn, t);
+ return error_mark_node;
}
- return n;
-}
-static void
-modify_one_vtable (binfo, t, fndecl, pfn)
- tree binfo, t, fndecl, pfn;
-{
- tree virtuals = BINFO_VIRTUALS (binfo);
- unsigned HOST_WIDE_INT n;
-
- /* update rtti entry */
- if (flag_rtti)
- {
- if (binfo == TYPE_BINFO (t))
- {
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- build_vtable (TYPE_BINFO (DECL_CONTEXT (CLASSTYPE_VFIELD (t))), t);
- }
- else
- {
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- prepare_fresh_vtable (binfo, t);
- }
- }
- if (fndecl == NULL_TREE)
- return;
+ return build_tree_list (ffod.overriding_fn, ffod.overriding_base);
+}
- n = skip_rtti_stuff (&virtuals, t);
+/* Returns the function from the BINFO_VIRTUALS entry in T which matches
+ the signature of FUNCTION_DECL FN, or NULL_TREE if none. In other words,
+ the function that the slot in T's primary vtable points to. */
- while (virtuals)
- {
- tree current_fndecl = TREE_VALUE (virtuals);
- current_fndecl = FNADDR_FROM_VTABLE_ENTRY (current_fndecl);
- current_fndecl = TREE_OPERAND (current_fndecl, 0);
- if (current_fndecl && overrides (fndecl, current_fndecl))
- {
- tree base_offset, offset;
- tree context = DECL_CLASS_CONTEXT (fndecl);
- tree vfield = CLASSTYPE_VFIELD (t);
- tree this_offset;
-
- offset = get_class_offset (context, t, binfo, fndecl);
-
- /* Find the right offset for the this pointer based on the
- base class we just found. We have to take into
- consideration the virtual base class pointers that we
- stick in before the virtual function table pointer.
-
- Also, we want just the delta between the most base class
- that we derived this vfield from and us. */
- base_offset = size_binop (PLUS_EXPR,
- get_derived_offset (binfo, DECL_CONTEXT (current_fndecl)),
- BINFO_OFFSET (binfo));
- this_offset = ssize_binop (MINUS_EXPR, offset, base_offset);
-
- if (binfo == TYPE_BINFO (t))
- {
- /* In this case, it is *type*'s vtable we are modifying.
- We start with the approximation that it's vtable is that
- of the immediate base class. */
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- build_vtable (TYPE_BINFO (DECL_CONTEXT (vfield)), t);
- }
- else
- {
- /* This is our very own copy of `basetype' to play with.
- Later, we will fill in all the virtual functions
- that override the virtual functions in these base classes
- which are not defined by the current type. */
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- prepare_fresh_vtable (binfo, t);
- }
+static tree get_matching_virtual PARAMS ((tree, tree));
+static tree
+get_matching_virtual (t, fn)
+ tree t, fn;
+{
+ tree f;
-#ifdef NOTQUITE
- cp_warning ("in %D", DECL_NAME (BINFO_VTABLE (binfo)));
-#endif
- modify_vtable_entry (get_vtable_entry_n (BINFO_VIRTUALS (binfo), n),
- build_vtable_entry (this_offset, pfn),
- fndecl);
- }
- ++n;
- virtuals = TREE_CHAIN (virtuals);
- }
+ for (f = BINFO_VIRTUALS (TYPE_BINFO (t)); f; f = TREE_CHAIN (f))
+ if (same_signature_p (BV_FN (f), fn))
+ return BV_FN (f);
+ return NULL_TREE;
}
-/* These are the ones that are not through virtual base classes. */
+/* Update an entry in the vtable for BINFO, which is in the hierarchy
+ dominated by T. FN has been overriden in BINFO; VIRTUALS points to the
+ corresponding position in the BINFO_VIRTUALS list. */
static void
-modify_all_direct_vtables (binfo, do_self, t, fndecl, pfn)
+update_vtable_entry_for_fn (t, binfo, fn, virtuals)
+ tree t;
tree binfo;
- int do_self;
- tree t, fndecl, pfn;
+ tree fn;
+ tree *virtuals;
{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
+ tree b;
+ tree overrider;
+ tree delta;
+ tree virtual_base;
+ tree first_defn;
+ bool lost = false;
+
+ /* Find the nearest primary base (possibly binfo itself) which defines
+ this function; this is the class the caller will convert to when
+ calling FN through BINFO. */
+ for (b = binfo; ; b = get_primary_binfo (b))
+ {
+ if (look_for_overrides_here (BINFO_TYPE (b), fn))
+ break;
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
- {
- modify_one_vtable (binfo, t, fndecl, pfn);
+ /* The nearest definition is from a lost primary. */
+ if (BINFO_LOST_PRIMARY_P (b))
+ lost = true;
}
+ first_defn = b;
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable
- = i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));
- if (! TREE_VIA_VIRTUAL (base_binfo))
- modify_all_direct_vtables (base_binfo, is_not_base_vtable, t, fndecl, pfn);
- }
-}
+ /* Find the final overrider. */
+ overrider = find_final_overrider (t, b, fn);
+ if (overrider == error_mark_node)
+ return;
-/* Fixup all the delta entries in this one vtable that need updating. */
+ /* Assume that we will produce a thunk that convert all the way to
+ the final overrider, and not to an intermediate virtual base. */
+ virtual_base = NULL_TREE;
-static void
-fixup_vtable_deltas1 (binfo, t)
- tree binfo, t;
-{
- tree virtuals = BINFO_VIRTUALS (binfo);
- unsigned HOST_WIDE_INT n;
-
- n = skip_rtti_stuff (&virtuals, t);
+ /* See if we can convert to an intermediate virtual base first, and then
+ use the vcall offset located there to finish the conversion. */
+ for (; b; b = BINFO_INHERITANCE_CHAIN (b))
+ {
+ /* If we find the final overrider, then we can stop
+ walking. */
+ if (same_type_p (BINFO_TYPE (b),
+ BINFO_TYPE (TREE_VALUE (overrider))))
+ break;
- while (virtuals)
+ /* If we find a virtual base, and we haven't yet found the
+ overrider, then there is a virtual base between the
+ declaring base (first_defn) and the final overrider. */
+ if (!virtual_base && TREE_VIA_VIRTUAL (b))
+ virtual_base = b;
+ }
+
+ /* Compute the constant adjustment to the `this' pointer. The
+ `this' pointer, when this function is called, will point at BINFO
+ (or one of its primary bases, which are at the same offset). */
+
+ if (virtual_base)
+ /* The `this' pointer needs to be adjusted from the declaration to
+ the nearest virtual base. */
+ delta = size_diffop (BINFO_OFFSET (virtual_base),
+ BINFO_OFFSET (first_defn));
+ else if (lost)
+ /* If the nearest definition is in a lost primary, we don't need an
+ entry in our vtable. Except possibly in a constructor vtable,
+ if we happen to get our primary back. In that case, the offset
+ will be zero, as it will be a primary base. */
+ delta = size_zero_node;
+ else
{
- tree fndecl = TREE_VALUE (virtuals);
- tree pfn = FNADDR_FROM_VTABLE_ENTRY (fndecl);
- tree delta = DELTA_FROM_VTABLE_ENTRY (fndecl);
- fndecl = TREE_OPERAND (pfn, 0);
- if (fndecl)
+ /* The `this' pointer needs to be adjusted from pointing to
+ BINFO to pointing at the base where the final overrider
+ appears. */
+ delta = size_diffop (BINFO_OFFSET (TREE_VALUE (overrider)),
+ BINFO_OFFSET (binfo));
+
+ if (! integer_zerop (delta))
{
- tree base_offset, offset;
- tree context = DECL_CLASS_CONTEXT (fndecl);
- tree vfield = CLASSTYPE_VFIELD (t);
- tree this_offset;
-
- offset = get_class_offset (context, t, binfo, fndecl);
-
- /* Find the right offset for the this pointer based on the
- base class we just found. We have to take into
- consideration the virtual base class pointers that we
- stick in before the virtual function table pointer.
-
- Also, we want just the delta between the most base class
- that we derived this vfield from and us. */
- base_offset = size_binop (PLUS_EXPR,
- get_derived_offset (binfo,
- DECL_CONTEXT (fndecl)),
- BINFO_OFFSET (binfo));
- this_offset = ssize_binop (MINUS_EXPR, offset, base_offset);
-
- if (! tree_int_cst_equal (this_offset, delta))
+ /* We'll need a thunk. But if we have a (perhaps formerly)
+ primary virtual base, we have a vcall slot for this function,
+ so we can use it rather than create a non-virtual thunk. */
+
+ b = get_primary_binfo (first_defn);
+ for (; b; b = get_primary_binfo (b))
{
- /* Make sure we can modify the derived association with immunity. */
- if (binfo == TYPE_BINFO (t))
- {
- /* In this case, it is *type*'s vtable we are modifying.
- We start with the approximation that it's vtable is that
- of the immediate base class. */
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- build_vtable (TYPE_BINFO (DECL_CONTEXT (vfield)), t);
- }
- else
+ tree f = get_matching_virtual (BINFO_TYPE (b), fn);
+ if (!f)
+ /* b doesn't have this function; no suitable vbase. */
+ break;
+ if (TREE_VIA_VIRTUAL (b))
{
- /* This is our very own copy of `basetype' to play with.
- Later, we will fill in all the virtual functions
- that override the virtual functions in these base classes
- which are not defined by the current type. */
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- prepare_fresh_vtable (binfo, t);
+ /* Found one; we can treat ourselves as a virtual base. */
+ virtual_base = binfo;
+ delta = size_zero_node;
+ break;
}
-
- modify_vtable_entry (get_vtable_entry_n (BINFO_VIRTUALS (binfo), n),
- build_vtable_entry (this_offset, pfn),
- fndecl);
}
}
- ++n;
- virtuals = TREE_CHAIN (virtuals);
}
-}
-/* Fixup all the delta entries in all the direct vtables that need updating.
- This happens when we have non-overridden virtual functions from a
- virtual base class, that are at a different offset, in the new
- hierarchy, because the layout of the virtual bases has changed. */
+ modify_vtable_entry (t,
+ binfo,
+ TREE_PURPOSE (overrider),
+ delta,
+ virtuals);
-static void
-fixup_vtable_deltas (binfo, init_self, t)
- tree binfo;
- int init_self;
- tree t;
-{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable
- = i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));
- if (! TREE_VIA_VIRTUAL (base_binfo))
- fixup_vtable_deltas (base_binfo, is_not_base_vtable, t);
- }
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (init_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
- {
- fixup_vtable_deltas1 (binfo, t);
- }
+ if (virtual_base)
+ BV_USE_VCALL_INDEX_P (*virtuals) = 1;
}
-/* These are the ones that are through virtual base classes. */
+/* Called from modify_all_vtables via dfs_walk. */
-static void
-modify_all_indirect_vtables (binfo, do_self, via_virtual, t, fndecl, pfn)
+static tree
+dfs_modify_vtables (binfo, data)
tree binfo;
- int do_self, via_virtual;
- tree t, fndecl, pfn;
+ void *data;
{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (do_self && via_virtual && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
+ if (/* There's no need to modify the vtable for a non-virtual
+ primary base; we're not going to use that vtable anyhow.
+ We do still need to do this for virtual primary bases, as they
+ could become non-primary in a construction vtable. */
+ (!BINFO_PRIMARY_P (binfo) || TREE_VIA_VIRTUAL (binfo))
+ /* Similarly, a base without a vtable needs no modification. */
+ && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
{
- modify_one_vtable (binfo, t, fndecl, pfn);
- }
+ tree t;
+ tree virtuals;
+ tree old_virtuals;
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable
- = i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));
- if (TREE_VIA_VIRTUAL (base_binfo))
- {
- via_virtual = 1;
- base_binfo = binfo_member (BINFO_TYPE (base_binfo), CLASSTYPE_VBASECLASSES (t));
- }
- modify_all_indirect_vtables (base_binfo, is_not_base_vtable, via_virtual, t, fndecl, pfn);
- }
-}
+ t = (tree) data;
-static void
-modify_all_vtables (t, fndecl, vfn)
- tree t, fndecl, vfn;
-{
- /* Do these first, so that we will make use of any non-virtual class's
- vtable, over a virtual classes vtable. */
- modify_all_direct_vtables (TYPE_BINFO (t), 1, t, fndecl, vfn);
- if (TYPE_USES_VIRTUAL_BASECLASSES (t))
- modify_all_indirect_vtables (TYPE_BINFO (t), 1, 0, t, fndecl, vfn);
+ make_new_vtable (t, binfo);
+
+ /* Now, go through each of the virtual functions in the virtual
+ function table for BINFO. Find the final overrider, and
+ update the BINFO_VIRTUALS list appropriately. */
+ for (virtuals = BINFO_VIRTUALS (binfo),
+ old_virtuals = BINFO_VIRTUALS (TYPE_BINFO (BINFO_TYPE (binfo)));
+ virtuals;
+ virtuals = TREE_CHAIN (virtuals),
+ old_virtuals = TREE_CHAIN (old_virtuals))
+ update_vtable_entry_for_fn (t,
+ binfo,
+ BV_FN (old_virtuals),
+ &virtuals);
+ }
+
+ SET_BINFO_MARKED (binfo);
+
+ return NULL_TREE;
}
-/* Here, we already know that they match in every respect.
- All we have to check is where they had their declarations. */
+/* Update all of the primary and secondary vtables for T. Create new
+ vtables as required, and initialize their RTTI information. Each
+ of the functions in OVERRIDDEN_VIRTUALS overrides a virtual
+ function from a base class; find and modify the appropriate entries
+ to point to the overriding functions. Returns a list, in
+ declaration order, of the functions that are overridden in this
+ class, but do not appear in the primary base class vtable, and
+ which should therefore be appended to the end of the vtable for T. */
-static int
-strictly_overrides (fndecl1, fndecl2)
- tree fndecl1, fndecl2;
+static tree
+modify_all_vtables (t, vfuns_p, overridden_virtuals)
+ tree t;
+ int *vfuns_p;
+ tree overridden_virtuals;
{
- int distance = get_base_distance (DECL_CLASS_CONTEXT (fndecl2),
- DECL_CLASS_CONTEXT (fndecl1),
- 0, (tree *)0);
- if (distance == -2 || distance > 0)
- return 1;
- return 0;
-}
+ tree binfo = TYPE_BINFO (t);
+ tree *fnsp;
-/* Merge overrides for one vtable.
- If we want to merge in same function, we are fine.
- else
- if one has a DECL_CLASS_CONTEXT that is a parent of the
- other, than choose the more derived one
- else
- potentially ill-formed (see 10.3 [class.virtual])
- we have to check later to see if there was an
- override in this class. If there was ok, if not
- then it is ill-formed. (mrs)
+ /* Update all of the vtables. */
+ dfs_walk (binfo,
+ dfs_modify_vtables,
+ dfs_unmarked_real_bases_queue_p,
+ t);
+ dfs_walk (binfo, dfs_unmark, dfs_marked_real_bases_queue_p, t);
- We take special care to reuse a vtable, if we can. */
+ /* Include overriding functions for secondary vtables in our primary
+ vtable. */
+ for (fnsp = &overridden_virtuals; *fnsp; )
+ {
+ tree fn = TREE_VALUE (*fnsp);
-static void
-override_one_vtable (binfo, old, t)
- tree binfo, old, t;
-{
- tree virtuals = BINFO_VIRTUALS (binfo);
- tree old_virtuals = BINFO_VIRTUALS (old);
- enum { REUSE_NEW, REUSE_OLD, UNDECIDED, NEITHER } choose = UNDECIDED;
-
- /* If we have already committed to modifying it, then don't try and
- reuse another vtable. */
- if (BINFO_NEW_VTABLE_MARKED (binfo))
- choose = NEITHER;
-
- skip_rtti_stuff (&virtuals, t);
- skip_rtti_stuff (&old_virtuals, t);
-
- while (virtuals)
- {
- tree fndecl = TREE_VALUE (virtuals);
- tree old_fndecl = TREE_VALUE (old_virtuals);
- fndecl = FNADDR_FROM_VTABLE_ENTRY (fndecl);
- old_fndecl = FNADDR_FROM_VTABLE_ENTRY (old_fndecl);
- fndecl = TREE_OPERAND (fndecl, 0);
- old_fndecl = TREE_OPERAND (old_fndecl, 0);
- /* First check to see if they are the same. */
- if (DECL_ASSEMBLER_NAME (fndecl) == DECL_ASSEMBLER_NAME (old_fndecl))
- {
- /* No need to do anything. */
- }
- else if (strictly_overrides (fndecl, old_fndecl))
+ if (!BINFO_VIRTUALS (binfo)
+ || !value_member (fn, BINFO_VIRTUALS (binfo)))
{
- if (choose == UNDECIDED)
- choose = REUSE_NEW;
- else if (choose == REUSE_OLD)
- {
- choose = NEITHER;
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- {
- prepare_fresh_vtable (binfo, t);
- override_one_vtable (binfo, old, t);
- return;
- }
- }
- }
- else if (strictly_overrides (old_fndecl, fndecl))
- {
- if (choose == UNDECIDED)
- choose = REUSE_OLD;
- else if (choose == REUSE_NEW)
- {
- choose = NEITHER;
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- {
- prepare_fresh_vtable (binfo, t);
- override_one_vtable (binfo, old, t);
- return;
- }
- TREE_VALUE (virtuals) = TREE_VALUE (old_virtuals);
- }
- else if (choose == NEITHER)
- {
- TREE_VALUE (virtuals) = TREE_VALUE (old_virtuals);
- }
+ /* Set the vtable index. */
+ set_vindex (fn, vfuns_p);
+ /* We don't need to convert to a base class when calling
+ this function. */
+ DECL_VIRTUAL_CONTEXT (fn) = t;
+
+ /* We don't need to adjust the `this' pointer when
+ calling this function. */
+ BV_DELTA (*fnsp) = integer_zero_node;
+ BV_VCALL_INDEX (*fnsp) = NULL_TREE;
+
+ /* This is an overridden function not already in our
+ vtable. Keep it. */
+ fnsp = &TREE_CHAIN (*fnsp);
}
else
- {
- choose = NEITHER;
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- {
- prepare_fresh_vtable (binfo, t);
- override_one_vtable (binfo, old, t);
- return;
- }
- {
- /* This MUST be overridden, or the class is ill-formed. */
- tree fndecl = TREE_OPERAND (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals)), 0);
- tree vfn;
-
- fndecl = copy_node (fndecl);
- copy_lang_decl (fndecl);
- DECL_NEEDS_FINAL_OVERRIDER_P (fndecl) = 1;
- /* Make sure we search for it later. */
- if (! CLASSTYPE_ABSTRACT_VIRTUALS (t))
- CLASSTYPE_ABSTRACT_VIRTUALS (t) = error_mark_node;
-
- vfn = build1 (ADDR_EXPR, vfunc_ptr_type_node, fndecl);
- TREE_CONSTANT (vfn) = 1;
-
- /* We can use integer_zero_node, as we will core dump
- if this is used anyway. */
- TREE_VALUE (virtuals) = build_vtable_entry (integer_zero_node, vfn);
- }
- }
- virtuals = TREE_CHAIN (virtuals);
- old_virtuals = TREE_CHAIN (old_virtuals);
- }
-
- /* Let's reuse the old vtable. */
- if (choose == REUSE_OLD)
- {
- BINFO_VTABLE (binfo) = BINFO_VTABLE (old);
- BINFO_VIRTUALS (binfo) = BINFO_VIRTUALS (old);
+ /* We've already got an entry for this function. Skip it. */
+ *fnsp = TREE_CHAIN (*fnsp);
}
+
+ return overridden_virtuals;
}
-/* Merge in overrides for virtual bases.
- BINFO is the hierarchy we want to modify, and OLD has the potential
- overrides. */
-
-static void
-merge_overrides (binfo, old, do_self, t)
- tree binfo, old;
- int do_self;
- tree t;
-{
- tree binfos = BINFO_BASETYPES (binfo);
- tree old_binfos = BINFO_BASETYPES (old);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
+/* Here, we already know that they match in every respect.
+ All we have to check is where they had their declarations.
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
- {
- override_one_vtable (binfo, old, t);
- }
+ Return non-zero iff FNDECL1 is declared in a class which has a
+ proper base class containing FNDECL2. We don't care about
+ ambiguity or accessibility. */
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree old_base_binfo = TREE_VEC_ELT (old_binfos, i);
- int is_not_base_vtable
- = i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));
- if (! TREE_VIA_VIRTUAL (base_binfo))
- merge_overrides (base_binfo, old_base_binfo, is_not_base_vtable, t);
- }
+static int
+strictly_overrides (fndecl1, fndecl2)
+ tree fndecl1, fndecl2;
+{
+ base_kind kind;
+
+ return (lookup_base (DECL_CONTEXT (fndecl1), DECL_CONTEXT (fndecl2),
+ ba_ignore | ba_quiet, &kind)
+ && kind != bk_same_type);
}
-/* Get the base virtual function declarations in T that are either
- overridden or hidden by FNDECL as a list. We set TREE_PURPOSE with
- the overrider/hider. */
+/* Get the base virtual function declarations in T that have the
+ indicated NAME. */
static tree
-get_basefndecls (fndecl, t)
- tree fndecl, t;
+get_basefndecls (name, t)
+ tree name, t;
{
- tree methods = TYPE_METHODS (t);
+ tree methods;
tree base_fndecls = NULL_TREE;
- tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- while (methods)
- {
- if (TREE_CODE (methods) == FUNCTION_DECL
- && DECL_VINDEX (methods) != NULL_TREE
- && DECL_NAME (fndecl) == DECL_NAME (methods))
- base_fndecls = temp_tree_cons (fndecl, methods, base_fndecls);
+ int n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
+ int i;
- methods = TREE_CHAIN (methods);
- }
+ for (methods = TYPE_METHODS (t); methods; methods = TREE_CHAIN (methods))
+ if (TREE_CODE (methods) == FUNCTION_DECL
+ && DECL_VINDEX (methods) != NULL_TREE
+ && DECL_NAME (methods) == name)
+ base_fndecls = tree_cons (NULL_TREE, methods, base_fndecls);
if (base_fndecls)
return base_fndecls;
for (i = 0; i < n_baseclasses; i++)
{
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree basetype = BINFO_TYPE (base_binfo);
-
- base_fndecls = chainon (get_basefndecls (fndecl, basetype),
+ tree basetype = TYPE_BINFO_BASETYPE (t, i);
+ base_fndecls = chainon (get_basefndecls (name, basetype),
base_fndecls);
}
return base_fndecls;
}
-/* Mark the functions that have been hidden with their overriders.
- Since we start out with all functions already marked with a hider,
- no need to mark functions that are just hidden.
-
- Subroutine of warn_hidden. */
-
-static void
-mark_overriders (fndecl, base_fndecls)
- tree fndecl, base_fndecls;
-{
- for (; base_fndecls; base_fndecls = TREE_CHAIN (base_fndecls))
- {
- if (overrides (fndecl, TREE_VALUE (base_fndecls)))
- TREE_PURPOSE (base_fndecls) = fndecl;
- }
-}
-
/* If this declaration supersedes the declaration of
a method declared virtual in the base class, then
mark this field as being virtual as well. */
@@ -2853,54 +2751,24 @@ static void
check_for_override (decl, ctype)
tree decl, ctype;
{
- tree binfos = BINFO_BASETYPES (TYPE_BINFO (ctype));
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- int virtualp = DECL_VIRTUAL_P (decl);
- int found_overriden_fn = 0;
+ if (TREE_CODE (decl) == TEMPLATE_DECL)
+ /* In [temp.mem] we have:
- for (i = 0; i < n_baselinks; i++)
+ A specialization of a member function template does not
+ override a virtual function from a base class. */
+ return;
+ if ((DECL_DESTRUCTOR_P (decl)
+ || IDENTIFIER_VIRTUAL_P (DECL_NAME (decl)))
+ && look_for_overrides (ctype, decl)
+ && !DECL_STATIC_FUNCTION_P (decl))
{
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- if (TYPE_VIRTUAL_P (BINFO_TYPE (base_binfo)))
- {
- tree tmp = get_matching_virtual
- (base_binfo, decl,
- DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl)));
-
- if (tmp && !found_overriden_fn)
- {
- /* If this function overrides some virtual in some base
- class, then the function itself is also necessarily
- virtual, even if the user didn't explicitly say so. */
- DECL_VIRTUAL_P (decl) = 1;
-
- /* The TMP we really want is the one from the deepest
- baseclass on this path, taking care not to
- duplicate if we have already found it (via another
- path to its virtual baseclass. */
- if (TREE_CODE (TREE_TYPE (decl)) == FUNCTION_TYPE)
- {
- cp_error_at ("method `%D' may not be declared static",
- decl);
- cp_error_at ("(since `%D' declared virtual in base class.)",
- tmp);
- break;
- }
- virtualp = 1;
-
- DECL_VINDEX (decl)
- = tree_cons (NULL_TREE, tmp, DECL_VINDEX (decl));
-
- /* We now know that DECL overrides something,
- which is all that is important. But, we must
- continue to iterate through all the base-classes
- in order to allow get_matching_virtual to check for
- various illegal overrides. */
- found_overriden_fn = 1;
- }
- }
+ /* Set DECL_VINDEX to a value that is neither an
+ INTEGER_CST nor the error_mark_node so that
+ add_virtual_function will realize this is an
+ overriding function. */
+ DECL_VINDEX (decl) = decl;
}
- if (virtualp)
+ if (DECL_VIRTUAL_P (decl))
{
if (DECL_VINDEX (decl) == NULL_TREE)
DECL_VINDEX (decl) = error_mark_node;
@@ -2922,365 +2790,62 @@ warn_hidden (t)
/* We go through each separately named virtual function. */
for (i = 2; i < n_methods && TREE_VEC_ELT (method_vec, i); ++i)
{
- tree fns = TREE_VEC_ELT (method_vec, i);
+ tree fns;
+ tree name;
tree fndecl;
-
- tree base_fndecls = NULL_TREE;
- tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- /* First see if we have any virtual functions in this batch. */
- for (; fns; fns = OVL_NEXT (fns))
+ tree base_fndecls;
+ int j;
+
+ /* All functions in this slot in the CLASSTYPE_METHOD_VEC will
+ have the same name. Figure out what name that is. */
+ name = DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (method_vec, i)));
+ /* There are no possibly hidden functions yet. */
+ base_fndecls = NULL_TREE;
+ /* Iterate through all of the base classes looking for possibly
+ hidden functions. */
+ for (j = 0; j < CLASSTYPE_N_BASECLASSES (t); j++)
{
- fndecl = OVL_CURRENT (fns);
- if (DECL_VINDEX (fndecl))
- break;
- }
-
- if (fns == NULL_TREE)
- continue;
-
- /* First we get a list of all possible functions that might be
- hidden from each base class. */
- for (i = 0; i < n_baseclasses; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree basetype = BINFO_TYPE (base_binfo);
-
- base_fndecls = chainon (get_basefndecls (fndecl, basetype),
+ tree basetype = TYPE_BINFO_BASETYPE (t, j);
+ base_fndecls = chainon (get_basefndecls (name, basetype),
base_fndecls);
}
- fns = OVL_NEXT (fns);
-
- /* ...then mark up all the base functions with overriders, preferring
- overriders to hiders. */
- if (base_fndecls)
- for (; fns; fns = OVL_NEXT (fns))
- {
- fndecl = OVL_CURRENT (fns);
- if (DECL_VINDEX (fndecl))
- mark_overriders (fndecl, base_fndecls);
- }
+ /* If there are no functions to hide, continue. */
+ if (!base_fndecls)
+ continue;
- /* Now give a warning for all base functions without overriders,
- as they are hidden. */
- for (; base_fndecls; base_fndecls = TREE_CHAIN (base_fndecls))
+ /* Remove any overridden functions. */
+ for (fns = TREE_VEC_ELT (method_vec, i); fns; fns = OVL_NEXT (fns))
{
- if (! overrides (TREE_PURPOSE (base_fndecls),
- TREE_VALUE (base_fndecls)))
+ fndecl = OVL_CURRENT (fns);
+ if (DECL_VINDEX (fndecl))
{
- /* Here we know it is a hider, and no overrider exists. */
- cp_warning_at ("`%D' was hidden", TREE_VALUE (base_fndecls));
- cp_warning_at (" by `%D'", TREE_PURPOSE (base_fndecls));
+ tree *prev = &base_fndecls;
+
+ while (*prev)
+ /* If the method from the base class has the same
+ signature as the method from the derived class, it
+ has been overridden. */
+ if (same_signature_p (fndecl, TREE_VALUE (*prev)))
+ *prev = TREE_CHAIN (*prev);
+ else
+ prev = &TREE_CHAIN (*prev);
}
}
- }
-}
-
-/* Generate one vtable for use in constructors or destructors of BASE
- subobjects of COMPLETE_TYPE objects. The vtable belongs to the
- vfield of the VBASEVASE subobject of the VBASE virtual base of
- COMPLETE_TYPE (and BASE). */
-static tree
-finish_one_ctor_vtable (complete_type, base, vbase, vbasebase)
- tree complete_type, base, vbase, vbasebase;
-{
- tree virtuals;
- tree newtable;
- tree newvirtuals;
- tree offset;
- tree newvbase = binfo_member (BINFO_TYPE (vbase),
- CLASSTYPE_VBASECLASSES (complete_type));
-
- newtable = prepare_ctor_vtable (complete_type, base, vbasebase);
- newvirtuals = copy_list (BINFO_VIRTUALS (vbasebase));
-
- virtuals = newvirtuals;
- /* Change the offset entry. First, delta between base an vbase. */
- offset = ssize_binop (MINUS_EXPR, BINFO_OFFSET (newvbase),
- BINFO_OFFSET (base));
- /* Add delta between vbase and vbasebase. */
- offset = ssize_binop (PLUS_EXPR, offset, BINFO_OFFSET (vbasebase));
- offset = ssize_binop (MINUS_EXPR, offset, BINFO_OFFSET (vbase));
- /* Finally, negate. */
- offset = ssize_binop (MINUS_EXPR, integer_zero_node, offset);
- offset = build1 (NOP_EXPR, vfunc_ptr_type_node, offset);
- TREE_CONSTANT (offset) = 1;
- TREE_VALUE (virtuals) = build_vtable_entry (integer_zero_node, offset);
- virtuals = TREE_CHAIN (virtuals);
-
- /* Skip the typeinfo function. */
- virtuals = TREE_CHAIN (virtuals);
-
- /* Iterate over all methods of this virtual base. */
- for (; virtuals; virtuals = TREE_CHAIN (virtuals))
- {
- tree fndecl = TREE_VALUE (virtuals);
- tree pfn = FNADDR_FROM_VTABLE_ENTRY (fndecl);
- fndecl = TREE_OPERAND (pfn, 0);
- if (fndecl)
+ /* Now give a warning for all base functions without overriders,
+ as they are hidden. */
+ while (base_fndecls)
{
- tree delta, newdelta, binfo_context;
- tree context = DECL_CLASS_CONTEXT (fndecl);
-
- /* If this method is implemented in a base of the vbase, the
- thunk we have is correct. */
- if (DERIVED_FROM_P (context, vbase))
- continue;
-
- binfo_context = binfo_value (context, base);
- if (TREE_VIA_VIRTUAL (binfo_context))
- binfo_context = binfo_member
- (context, CLASSTYPE_VBASECLASSES (complete_type));
- /* This is the delta from a complete C to a B subobject, or
- more generally to the base subobject that implements the
- virtual function for B. BASE already has the offset to
- the complete type. */
- delta = BINFO_OFFSET (binfo_context);
- /* This is the delta from the A to the complete C. */
- newdelta = BINFO_OFFSET (newvbase);
- /* This is the delta from the A to the B subobject. */
- newdelta = size_binop (MINUS_EXPR, newdelta, delta);
- newdelta = ssize_binop (MINUS_EXPR, integer_zero_node,
- newdelta);
-
- modify_vtable_entry (virtuals,
- build_vtable_entry (newdelta, pfn),
- fndecl);
+ /* Here we know it is a hider, and no overrider exists. */
+ cp_warning_at ("`%D' was hidden", TREE_VALUE (base_fndecls));
+ cp_warning_at (" by `%D'",
+ OVL_CURRENT (TREE_VEC_ELT (method_vec, i)));
+ base_fndecls = TREE_CHAIN (base_fndecls);
}
}
- DECL_INITIAL (newtable) = build_nt (CONSTRUCTOR, NULL_TREE,
- newvirtuals);
- DECL_CONTEXT (newtable) = NULL_TREE;
- cp_finish_decl (newtable, DECL_INITIAL (newtable), NULL_TREE, 0, 0);
- DECL_CONTEXT (newtable) = complete_type;
- return newtable;
-}
-
-/* Add all vtables into LIST for the VBASEBASE subobject and its bases
- of VBASE virtual BASE of COMPLETE_TYPE for use in BASE
- constructors. DO_SELF indicates whether this is the VBASEBASE that
- has 'primary' vfield. Return the new LIST. */
-
-static tree
-prepend_ctor_vfields_for_vbase (complete_type, base, vbase, vbasebase,
- do_self, list)
- tree complete_type, base, vbase, vbasebase;
- int do_self;
- tree list;
-{
- int i;
- tree vtbl;
- tree bases = BINFO_BASETYPES (vbasebase);
- int vfp = CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (vbasebase));
-
- if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (vbasebase)))
- {
- vtbl = finish_one_ctor_vtable (complete_type, base, vbase, vbasebase);
- vtbl = build1 (ADDR_EXPR, vtbl_ptr_type_node, vtbl);
- TREE_READONLY (vtbl) = 1;
- TREE_CONSTANT (vtbl) = 1;
- list = tree_cons (NULL_TREE, vtbl, list);
- }
-
- if (!bases)
- return list;
-
- for (i = 0; i < TREE_VEC_LENGTH (bases); i++)
- {
- tree vbasebase = TREE_VEC_ELT (bases, i);
- if (TREE_VIA_VIRTUAL (vbasebase))
- continue;
- list = prepend_ctor_vfields_for_vbase
- (complete_type, base, vbase, vbasebase, (i != vfp), list);
- }
-
- return list;
-}
-
-/* Iterate over all virtual bases of the BASE subobject of
- COMPLETE_TYPE. This list is given in VBASES. Return the list of
- vtables generated in the process. */
-
-static tree
-finish_ctor_vtables_for_vbases (vbases, base, complete_type)
- tree vbases, base, complete_type;
-{
- tree result = NULL_TREE;
-
- for (; vbases; vbases = TREE_CHAIN (vbases))
- result = prepend_ctor_vfields_for_vbase
- (complete_type, base, vbases, vbases, 1, result);
- return result;
-}
-
-/* Generate special vtables for virtual bases for use inside base
- class ctors and dtors. Inside this function, we assume the
- following scenario:
- class A{virtual void foo();};
- class B:virtual A{int member1;}
- class C:B{int member2;}
-
- BINFO is a base subject (e.g. B) of COMPLETE_TYPE. Returns the list
- of virtual tables. */
-
-static tree
-finish_ctor_vtables_1 (binfo, complete_type)
- tree binfo;
- tree complete_type;
-{
- int i;
- tree binfos;
- tree result = NULL_TREE;
-
- binfos = BINFO_BASETYPES (binfo);
- if (!binfos)
- return result;
-
- /* Iterate over all bases (i.e. B). */
- for (i = 0; i < TREE_VEC_LENGTH (binfos); i++)
- {
- tree base = TREE_VEC_ELT (binfos, i);
- tree vbases = CLASSTYPE_VBASECLASSES (BINFO_TYPE (base));
- if (!vbases)
- /* This base class does not have virtual bases. */
- continue;
- if (TREE_VIA_VIRTUAL (base))
- /* A virtual base class is initialized on in the most-derived
- constructor. */
- continue;
- if (!TYPE_USES_PVBASES (BINFO_TYPE (base)))
- /* Class has no polymorphic vbases. */
- continue;
- /* Prepend vtable list for base class. */
- result = chainon (finish_ctor_vtables_1 (base, complete_type),
- result);
- /* Prepend our own vtable list. */
- result = chainon
- (finish_ctor_vtables_for_vbases (vbases, base, complete_type),
- result);
- }
- return result;
-}
-
-/* Add the vtables of a virtual base BINFO in front of LIST, returning
- the new list. DO_SELF indicates whether we have to return the
- vtable of a vfield borrowed in a derived class. */
-
-static tree
-prepend_vbase_vfields (binfo, do_self, list)
- tree binfo;
- int do_self;
- tree list;
-{
- int i;
- tree vtbl;
- tree bases = BINFO_BASETYPES (binfo);
- int vfp = CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));
-
- if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
- {
- vtbl = BINFO_VTABLE (binfo);
- vtbl = build1 (ADDR_EXPR, vtbl_ptr_type_node, vtbl);
- TREE_READONLY (vtbl) = 1;
- TREE_CONSTANT (vtbl) = 1;
- list = tree_cons (NULL_TREE, vtbl, list);
- }
-
- if (!bases)
- return list;
-
- for (i = 0; i < TREE_VEC_LENGTH (bases); i++)
- {
- tree base = TREE_VEC_ELT (bases, i);
- if (TREE_VIA_VIRTUAL (base))
- continue;
- list = prepend_vbase_vfields (base, (i != vfp), list);
- }
-
- return list;
}
-/* Wrapper around finish_ctor_vtables_1. Compute the vtable list for
- type T. */
-
-static void
-finish_ctor_vtables (t)
- tree t;
-{
- tree veclist = NULL_TREE;
- tree decl, type;
- char *name;
- tree vbase;
- int len;
-
- /* This is only good for vtable thunks. */
- my_friendly_assert (flag_vtable_thunks, 990307);
-
- /* Start with the list of most-derived vtables. */
-
- for (vbase = CLASSTYPE_VBASECLASSES (t); vbase;
- vbase = TREE_CHAIN (vbase))
- veclist = prepend_vbase_vfields (vbase, 1, veclist);
-
- /* Compute the list of vtables for the bases. */
- veclist = chainon (veclist, finish_ctor_vtables_1 (TYPE_BINFO (t), t));
-
- /* Finally, we initialize the virtual bases first. */
- for (vbase = CLASSTYPE_VBASECLASSES (t); vbase;
- vbase = TREE_CHAIN (vbase))
- {
- tree vbases = CLASSTYPE_VBASECLASSES (BINFO_TYPE (vbase));
- if (!vbases)
- continue;
- veclist = chainon (veclist,
- finish_ctor_vtables_for_vbases (vbases, vbase, t));
- veclist = chainon (veclist,
- finish_ctor_vtables_1 (vbase, t));
- }
-
- veclist = nreverse (veclist);
-
- /* Generate the name for the vtable list. */
- name = alloca (strlen (VLIST_NAME_FORMAT)
- + TYPE_ASSEMBLER_NAME_LENGTH (t) + 2);
- sprintf (name, VLIST_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (t));
-
- /* Build the type of the list. */
- len = list_length (veclist) - 1;
- if (len < 0)
- /* If this class has virtual bases without virtual methods, make a
- single zero-entry in the array. This avoids zero-sized objects. */
- len++;
- type = build_cplus_array_type (vtbl_ptr_type_node,
- build_index_type (size_int (len)));
-
-
- /* Produce a new decl holding the list. */
- decl = build_lang_decl (VAR_DECL, get_identifier (name), type);
- TREE_STATIC (decl) = 1;
- TREE_READONLY (decl) = 1;
- decl = pushdecl_top_level (decl);
- import_export_vtable (decl, t, 0);
- DECL_INITIAL (decl) = build_nt (CONSTRUCTOR, NULL_TREE, veclist);
-
- DECL_ARTIFICIAL (decl) = 1;
- /* This tells finish_file et.al. that this is related to virtual
- tables. There is currently no way to distinguish between vtables
- and vlists, other than the name of the decl. */
- DECL_VIRTUAL_P (decl) = 1;
-
- /* Output the array. */
- cp_finish_decl (decl, DECL_INITIAL (decl), NULL_TREE, 0, 0);
-
- /* Set the class context after finishing, so that finish thinks this
- is an unrelated global, and then finish_vtable_vardecl knows what
- class this is related to. */
- DECL_CONTEXT (decl) = t;
-}
-
/* Check for things that are invalid. There are probably plenty of other
things we should check for also. */
@@ -3289,6 +2854,7 @@ finish_struct_anon (t)
tree t;
{
tree field;
+
for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
{
if (TREE_STATIC (field))
@@ -3297,75 +2863,82 @@ finish_struct_anon (t)
continue;
if (DECL_NAME (field) == NULL_TREE
- && TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
+ && ANON_AGGR_TYPE_P (TREE_TYPE (field)))
{
- tree* uelt = &TYPE_FIELDS (TREE_TYPE (field));
- for (; *uelt; uelt = &TREE_CHAIN (*uelt))
+ tree elt = TYPE_FIELDS (TREE_TYPE (field));
+ for (; elt; elt = TREE_CHAIN (elt))
{
- if (DECL_ARTIFICIAL (*uelt))
+ /* We're generally only interested in entities the user
+ declared, but we also find nested classes by noticing
+ the TYPE_DECL that we create implicitly. You're
+ allowed to put one anonymous union inside another,
+ though, so we explicitly tolerate that. We use
+ TYPE_ANONYMOUS_P rather than ANON_AGGR_TYPE_P so that
+ we also allow unnamed types used for defining fields. */
+ if (DECL_ARTIFICIAL (elt)
+ && (!DECL_IMPLICIT_TYPEDEF_P (elt)
+ || TYPE_ANONYMOUS_P (TREE_TYPE (elt))))
continue;
- if (DECL_NAME (*uelt) == constructor_name (t))
- cp_pedwarn_at ("ANSI C++ forbids member `%D' with same name as enclosing class",
- *uelt);
+ if (DECL_NAME (elt) == constructor_name (t))
+ cp_pedwarn_at ("ISO C++ forbids member `%D' with same name as enclosing class",
+ elt);
- if (TREE_CODE (*uelt) != FIELD_DECL)
+ if (TREE_CODE (elt) != FIELD_DECL)
{
cp_pedwarn_at ("`%#D' invalid; an anonymous union can only have non-static data members",
- *uelt);
+ elt);
continue;
}
- if (TREE_PRIVATE (*uelt))
+ if (TREE_PRIVATE (elt))
cp_pedwarn_at ("private member `%#D' in anonymous union",
- *uelt);
- else if (TREE_PROTECTED (*uelt))
+ elt);
+ else if (TREE_PROTECTED (elt))
cp_pedwarn_at ("protected member `%#D' in anonymous union",
- *uelt);
+ elt);
- TREE_PRIVATE (*uelt) = TREE_PRIVATE (field);
- TREE_PROTECTED (*uelt) = TREE_PROTECTED (field);
+ TREE_PRIVATE (elt) = TREE_PRIVATE (field);
+ TREE_PROTECTED (elt) = TREE_PROTECTED (field);
}
}
}
}
-extern int interface_only, interface_unknown;
-
/* Create default constructors, assignment operators, and so forth for
the type indicated by T, if they are needed.
CANT_HAVE_DEFAULT_CTOR, CANT_HAVE_CONST_CTOR, and
- CANT_HAVE_ASSIGNMENT are nonzero if, for whatever reason, the class
- cannot have a default constructor, copy constructor taking a const
- reference argument, or an assignment operator, respectively. If a
- virtual destructor is created, its DECL is returned; otherwise the
- return value is NULL_TREE. */
+ CANT_HAVE_CONST_ASSIGNMENT are nonzero if, for whatever reason, the
+ class cannot have a default constructor, copy constructor taking a
+ const reference argument, or an assignment operator taking a const
+ reference, respectively. If a virtual destructor is created, its
+ DECL is returned; otherwise the return value is NULL_TREE. */
static tree
add_implicitly_declared_members (t, cant_have_default_ctor,
cant_have_const_cctor,
- cant_have_assignment)
+ cant_have_const_assignment)
tree t;
int cant_have_default_ctor;
int cant_have_const_cctor;
- int cant_have_assignment;
+ int cant_have_const_assignment;
{
tree default_fn;
tree implicit_fns = NULL_TREE;
- tree name = TYPE_IDENTIFIER (t);
tree virtual_dtor = NULL_TREE;
tree *f;
+ ++adding_implicit_members;
+
/* Destructor. */
- if (TYPE_NEEDS_DESTRUCTOR (t) && !TYPE_HAS_DESTRUCTOR (t)
- && !IS_SIGNATURE (t))
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) && !TYPE_HAS_DESTRUCTOR (t))
{
- default_fn = cons_up_default_function (t, name, 0);
+ default_fn = implicitly_declare_fn (sfk_destructor, t, /*const_p=*/0);
check_for_override (default_fn, t);
/* If we couldn't make it work, then pretend we didn't need it. */
if (default_fn == void_type_node)
- TYPE_NEEDS_DESTRUCTOR (t) = 0;
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = 0;
else
{
TREE_CHAIN (default_fn) = implicit_fns;
@@ -3375,33 +2948,36 @@ add_implicitly_declared_members (t, cant_have_default_ctor,
virtual_dtor = default_fn;
}
}
- TYPE_NEEDS_DESTRUCTOR (t) |= TYPE_HAS_DESTRUCTOR (t);
+ else
+ /* Any non-implicit destructor is non-trivial. */
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) |= TYPE_HAS_DESTRUCTOR (t);
/* Default constructor. */
- if (! TYPE_HAS_CONSTRUCTOR (t) && ! cant_have_default_ctor
- && ! IS_SIGNATURE (t))
+ if (! TYPE_HAS_CONSTRUCTOR (t) && ! cant_have_default_ctor)
{
- default_fn = cons_up_default_function (t, name, 2);
+ default_fn = implicitly_declare_fn (sfk_constructor, t, /*const_p=*/0);
TREE_CHAIN (default_fn) = implicit_fns;
implicit_fns = default_fn;
}
/* Copy constructor. */
- if (! TYPE_HAS_INIT_REF (t) && ! IS_SIGNATURE (t) && ! TYPE_FOR_JAVA (t))
+ if (! TYPE_HAS_INIT_REF (t) && ! TYPE_FOR_JAVA (t))
{
/* ARM 12.18: You get either X(X&) or X(const X&), but
not both. --Chip */
- default_fn = cons_up_default_function (t, name,
- 3 + cant_have_const_cctor);
+ default_fn
+ = implicitly_declare_fn (sfk_copy_constructor, t,
+ /*const_p=*/!cant_have_const_cctor);
TREE_CHAIN (default_fn) = implicit_fns;
implicit_fns = default_fn;
}
/* Assignment operator. */
- if (! TYPE_HAS_ASSIGN_REF (t) && ! IS_SIGNATURE (t) && ! TYPE_FOR_JAVA (t))
+ if (! TYPE_HAS_ASSIGN_REF (t) && ! TYPE_FOR_JAVA (t))
{
- default_fn = cons_up_default_function (t, name,
- 5 + cant_have_assignment);
+ default_fn
+ = implicitly_declare_fn (sfk_assignment_operator, t,
+ /*const_p=*/!cant_have_const_assignment);
TREE_CHAIN (default_fn) = implicit_fns;
implicit_fns = default_fn;
}
@@ -3409,234 +2985,340 @@ add_implicitly_declared_members (t, cant_have_default_ctor,
/* Now, hook all of the new functions on to TYPE_METHODS,
and add them to the CLASSTYPE_METHOD_VEC. */
for (f = &implicit_fns; *f; f = &TREE_CHAIN (*f))
- add_method (t, 0, *f);
+ add_method (t, *f, /*error_p=*/0);
*f = TYPE_METHODS (t);
TYPE_METHODS (t) = implicit_fns;
+ --adding_implicit_members;
+
return virtual_dtor;
}
-/* Create a RECORD_TYPE or UNION_TYPE node for a C struct or union declaration
- (or C++ class declaration).
-
- For C++, we must handle the building of derived classes.
- Also, C++ allows static class members. The way that this is
- handled is to keep the field name where it is (as the DECL_NAME
- of the field), and place the overloaded decl in the DECL_FIELD_BITPOS
- of the field. layout_record and layout_union will know about this.
-
- More C++ hair: inline functions have text in their
- DECL_PENDING_INLINE_INFO nodes which must somehow be parsed into
- meaningful tree structure. After the struct has been laid out, set
- things up so that this can happen.
-
- And still more: virtual functions. In the case of single inheritance,
- when a new virtual function is seen which redefines a virtual function
- from the base class, the new virtual function is placed into
- the virtual function table at exactly the same address that
- it had in the base class. When this is extended to multiple
- inheritance, the same thing happens, except that multiple virtual
- function tables must be maintained. The first virtual function
- table is treated in exactly the same way as in the case of single
- inheritance. Additional virtual function tables have different
- DELTAs, which tell how to adjust `this' to point to the right thing.
-
- ATTRIBUTES is the set of decl attributes to be applied, if any. */
-
-void
-finish_struct_1 (t, warn_anon)
- tree t;
- int warn_anon;
-{
- int old;
- enum tree_code code = TREE_CODE (t);
- tree fields = TYPE_FIELDS (t);
- tree x, last_x, method_vec;
- int has_virtual;
- int max_has_virtual;
- tree pending_virtuals = NULL_TREE;
- tree pending_hard_virtuals = NULL_TREE;
- tree abstract_virtuals = NULL_TREE;
- tree vfield;
- tree vfields;
- tree virtual_dtor;
- int cant_have_default_ctor;
- int cant_have_const_ctor;
- int no_const_asn_ref;
- int has_mutable = 0;
-
- /* The index of the first base class which has virtual
- functions. Only applied to non-virtual baseclasses. */
- int first_vfn_base_index;
+/* Subroutine of finish_struct_1. Recursively count the number of fields
+ in TYPE, including anonymous union members. */
- int n_baseclasses;
- int any_default_members = 0;
- int const_sans_init = 0;
- int ref_sans_init = 0;
- tree access_decls = NULL_TREE;
- int aggregate = 1;
- int empty = 1;
- int has_pointers = 0;
- tree inline_friends;
+static int
+count_fields (fields)
+ tree fields;
+{
+ tree x;
+ int n_fields = 0;
+ for (x = fields; x; x = TREE_CHAIN (x))
+ {
+ if (TREE_CODE (x) == FIELD_DECL && ANON_AGGR_TYPE_P (TREE_TYPE (x)))
+ n_fields += count_fields (TYPE_FIELDS (TREE_TYPE (x)));
+ else
+ n_fields += 1;
+ }
+ return n_fields;
+}
- if (warn_anon && code != UNION_TYPE && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
- pedwarn ("anonymous class type not used to declare any objects");
+/* Subroutine of finish_struct_1. Recursively add all the fields in the
+ TREE_LIST FIELDS to the TREE_VEC FIELD_VEC, starting at offset IDX. */
- if (TYPE_SIZE (t))
+static int
+add_fields_to_vec (fields, field_vec, idx)
+ tree fields, field_vec;
+ int idx;
+{
+ tree x;
+ for (x = fields; x; x = TREE_CHAIN (x))
{
- if (IS_AGGR_TYPE (t))
- cp_error ("redefinition of `%#T'", t);
+ if (TREE_CODE (x) == FIELD_DECL && ANON_AGGR_TYPE_P (TREE_TYPE (x)))
+ idx = add_fields_to_vec (TYPE_FIELDS (TREE_TYPE (x)), field_vec, idx);
else
- my_friendly_abort (172);
- popclass ();
- return;
+ TREE_VEC_ELT (field_vec, idx++) = x;
}
+ return idx;
+}
- GNU_xref_decl (current_function_decl, t);
-
- /* If this type was previously laid out as a forward reference,
- make sure we lay it out again. */
+/* FIELD is a bit-field. We are finishing the processing for its
+ enclosing type. Issue any appropriate messages and set appropriate
+ flags. */
- TYPE_SIZE (t) = NULL_TREE;
- CLASSTYPE_GOT_SEMICOLON (t) = 0;
+static void
+check_bitfield_decl (field)
+ tree field;
+{
+ tree type = TREE_TYPE (field);
+ tree w = NULL_TREE;
-#if 0
- /* This is in general too late to do this. I moved the main case up to
- left_curly, what else needs to move? */
- if (! IS_SIGNATURE (t))
+ /* Detect invalid bit-field type. */
+ if (DECL_INITIAL (field)
+ && ! INTEGRAL_TYPE_P (TREE_TYPE (field)))
{
- my_friendly_assert (CLASSTYPE_INTERFACE_ONLY (t) == interface_only, 999);
- my_friendly_assert (CLASSTYPE_INTERFACE_KNOWN (t) == ! interface_unknown, 999);
+ cp_error_at ("bit-field `%#D' with non-integral type", field);
+ w = error_mark_node;
}
-#endif
- old = suspend_momentary ();
+ /* Detect and ignore out of range field width. */
+ if (DECL_INITIAL (field))
+ {
+ w = DECL_INITIAL (field);
- /* Install struct as DECL_FIELD_CONTEXT of each field decl.
- Also process specified field sizes.
- Set DECL_FIELD_SIZE to the specified size, or 0 if none specified.
- The specified size is found in the DECL_INITIAL.
- Store 0 there, except for ": 0" fields (so we can find them
- and delete them, below). */
+ /* Avoid the non_lvalue wrapper added by fold for PLUS_EXPRs. */
+ STRIP_NOPS (w);
- if (TYPE_BINFO_BASETYPES (t))
- n_baseclasses = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (t));
- else
- n_baseclasses = 0;
+ /* detect invalid field size. */
+ if (TREE_CODE (w) == CONST_DECL)
+ w = DECL_INITIAL (w);
+ else
+ w = decl_constant_value (w);
+
+ if (TREE_CODE (w) != INTEGER_CST)
+ {
+ cp_error_at ("bit-field `%D' width not an integer constant",
+ field);
+ w = error_mark_node;
+ }
+ else if (tree_int_cst_sgn (w) < 0)
+ {
+ cp_error_at ("negative width in bit-field `%D'", field);
+ w = error_mark_node;
+ }
+ else if (integer_zerop (w) && DECL_NAME (field) != 0)
+ {
+ cp_error_at ("zero width for bit-field `%D'", field);
+ w = error_mark_node;
+ }
+ else if (compare_tree_int (w, TYPE_PRECISION (type)) > 0
+ && TREE_CODE (type) != ENUMERAL_TYPE
+ && TREE_CODE (type) != BOOLEAN_TYPE)
+ cp_warning_at ("width of `%D' exceeds its type", field);
+ else if (TREE_CODE (type) == ENUMERAL_TYPE
+ && (0 > compare_tree_int (w,
+ min_precision (TYPE_MIN_VALUE (type),
+ TREE_UNSIGNED (type)))
+ || 0 > compare_tree_int (w,
+ min_precision
+ (TYPE_MAX_VALUE (type),
+ TREE_UNSIGNED (type)))))
+ cp_warning_at ("`%D' is too small to hold all values of `%#T'",
+ field, type);
+ }
+
+ /* Remove the bit-field width indicator so that the rest of the
+ compiler does not treat that value as an initializer. */
+ DECL_INITIAL (field) = NULL_TREE;
- if (n_baseclasses > 0)
+ if (w != error_mark_node)
{
- struct base_info base_info;
+ DECL_SIZE (field) = convert (bitsizetype, w);
+ DECL_BIT_FIELD (field) = 1;
- first_vfn_base_index = finish_base_struct (t, &base_info);
- /* Remember where we got our vfield from. */
- CLASSTYPE_VFIELD_PARENT (t) = first_vfn_base_index;
- has_virtual = base_info.has_virtual;
- max_has_virtual = base_info.max_has_virtual;
- vfield = base_info.vfield;
- vfields = base_info.vfields;
- CLASSTYPE_RTTI (t) = base_info.rtti;
- cant_have_default_ctor = base_info.cant_have_default_ctor;
- cant_have_const_ctor = base_info.cant_have_const_ctor;
- no_const_asn_ref = base_info.no_const_asn_ref;
- aggregate = 0;
+ if (integer_zerop (w))
+ {
+#ifdef EMPTY_FIELD_BOUNDARY
+ DECL_ALIGN (field) = MAX (DECL_ALIGN (field),
+ EMPTY_FIELD_BOUNDARY);
+#endif
+#ifdef PCC_BITFIELD_TYPE_MATTERS
+ if (PCC_BITFIELD_TYPE_MATTERS)
+ {
+ DECL_ALIGN (field) = MAX (DECL_ALIGN (field),
+ TYPE_ALIGN (type));
+ DECL_USER_ALIGN (field) |= TYPE_USER_ALIGN (type);
+ }
+#endif
+ }
}
else
{
- first_vfn_base_index = -1;
- has_virtual = 0;
- max_has_virtual = has_virtual;
- vfield = NULL_TREE;
- vfields = NULL_TREE;
- CLASSTYPE_RTTI (t) = NULL_TREE;
- cant_have_default_ctor = 0;
- cant_have_const_ctor = 0;
- no_const_asn_ref = 0;
+ /* Non-bit-fields are aligned for their type. */
+ DECL_BIT_FIELD (field) = 0;
+ CLEAR_DECL_C_BIT_FIELD (field);
+ DECL_ALIGN (field) = MAX (DECL_ALIGN (field), TYPE_ALIGN (type));
+ DECL_USER_ALIGN (field) |= TYPE_USER_ALIGN (type);
}
+}
-#if 0
- /* Both of these should be done before now. */
- if (write_virtuals == 3 && CLASSTYPE_INTERFACE_KNOWN (t)
- && ! IS_SIGNATURE (t))
+/* FIELD is a non bit-field. We are finishing the processing for its
+ enclosing type T. Issue any appropriate messages and set appropriate
+ flags. */
+
+static void
+check_field_decl (field, t, cant_have_const_ctor,
+ cant_have_default_ctor, no_const_asn_ref,
+ any_default_members)
+ tree field;
+ tree t;
+ int *cant_have_const_ctor;
+ int *cant_have_default_ctor;
+ int *no_const_asn_ref;
+ int *any_default_members;
+{
+ tree type = strip_array_types (TREE_TYPE (field));
+
+ /* An anonymous union cannot contain any fields which would change
+ the settings of CANT_HAVE_CONST_CTOR and friends. */
+ if (ANON_UNION_TYPE_P (type))
+ ;
+ /* And, we don't set TYPE_HAS_CONST_INIT_REF, etc., for anonymous
+ structs. So, we recurse through their fields here. */
+ else if (ANON_AGGR_TYPE_P (type))
{
- my_friendly_assert (CLASSTYPE_INTERFACE_ONLY (t) == interface_only, 999);
- my_friendly_assert (CLASSTYPE_VTABLE_NEEDS_WRITING (t) == ! interface_only, 999);
+ tree fields;
+
+ for (fields = TYPE_FIELDS (type); fields; fields = TREE_CHAIN (fields))
+ if (TREE_CODE (fields) == FIELD_DECL && !DECL_C_BIT_FIELD (field))
+ check_field_decl (fields, t, cant_have_const_ctor,
+ cant_have_default_ctor, no_const_asn_ref,
+ any_default_members);
}
-#endif
+ /* Check members with class type for constructors, destructors,
+ etc. */
+ else if (CLASS_TYPE_P (type))
+ {
+ /* Never let anything with uninheritable virtuals
+ make it through without complaint. */
+ abstract_virtuals_error (field, type);
+
+ if (TREE_CODE (t) == UNION_TYPE)
+ {
+ if (TYPE_NEEDS_CONSTRUCTING (type))
+ cp_error_at ("member `%#D' with constructor not allowed in union",
+ field);
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
+ cp_error_at ("member `%#D' with destructor not allowed in union",
+ field);
+ if (TYPE_HAS_COMPLEX_ASSIGN_REF (type))
+ cp_error_at ("member `%#D' with copy assignment operator not allowed in union",
+ field);
+ }
+ else
+ {
+ TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (type);
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
+ |= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type);
+ TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_HAS_COMPLEX_ASSIGN_REF (type);
+ TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (type);
+ }
- /* The three of these are approximations which may later be
- modified. Needed at this point to make add_virtual_function
- and modify_vtable_entries work. */
- CLASSTYPE_VFIELDS (t) = vfields;
- CLASSTYPE_VFIELD (t) = vfield;
+ if (!TYPE_HAS_CONST_INIT_REF (type))
+ *cant_have_const_ctor = 1;
- for (x = TYPE_METHODS (t); x; x = TREE_CHAIN (x))
+ if (!TYPE_HAS_CONST_ASSIGN_REF (type))
+ *no_const_asn_ref = 1;
+
+ if (TYPE_HAS_CONSTRUCTOR (type)
+ && ! TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
+ *cant_have_default_ctor = 1;
+ }
+ if (DECL_INITIAL (field) != NULL_TREE)
{
- GNU_xref_member (current_class_name, x);
+ /* `build_class_init_list' does not recognize
+ non-FIELD_DECLs. */
+ if (TREE_CODE (t) == UNION_TYPE && any_default_members != 0)
+ cp_error_at ("multiple fields in union `%T' initialized");
+ *any_default_members = 1;
+ }
- /* If this was an evil function, don't keep it in class. */
- if (IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (x)))
- continue;
+ /* Non-bit-fields are aligned for their type, except packed fields
+ which require only BITS_PER_UNIT alignment. */
+ DECL_ALIGN (field) = MAX (DECL_ALIGN (field),
+ (DECL_PACKED (field)
+ ? BITS_PER_UNIT
+ : TYPE_ALIGN (TREE_TYPE (field))));
+ if (! DECL_PACKED (field))
+ DECL_USER_ALIGN (field) |= TYPE_USER_ALIGN (TREE_TYPE (field));
+}
- /* Do both of these, even though they're in the same union;
- if the insn `r' member and the size `i' member are
- different sizes, as on the alpha, the larger of the two
- will end up with garbage in it. */
- DECL_SAVED_INSNS (x) = NULL_RTX;
- DECL_FIELD_SIZE (x) = 0;
+/* Check the data members (both static and non-static), class-scoped
+ typedefs, etc., appearing in the declaration of T. Issue
+ appropriate diagnostics. Sets ACCESS_DECLS to a list (in
+ declaration order) of access declarations; each TREE_VALUE in this
+ list is a USING_DECL.
- check_for_override (x, t);
- if (DECL_ABSTRACT_VIRTUAL_P (x) && ! DECL_VINDEX (x))
- cp_error_at ("initializer specified for non-virtual method `%D'", x);
+ In addition, set the following flags:
- /* The name of the field is the original field name
- Save this in auxiliary field for later overloading. */
- if (DECL_VINDEX (x))
- {
- add_virtual_function (&pending_virtuals, &pending_hard_virtuals,
- &has_virtual, x, t);
- if (DECL_ABSTRACT_VIRTUAL_P (x))
- abstract_virtuals = tree_cons (NULL_TREE, x, abstract_virtuals);
-#if 0
- /* XXX Why did I comment this out? (jason) */
- else
- TREE_USED (x) = 1;
-#endif
- }
- }
+ EMPTY_P
+ The class is empty, i.e., contains no non-static data members.
- if (n_baseclasses)
- fields = chainon (build_vbase_pointer_fields (t), fields);
+ CANT_HAVE_DEFAULT_CTOR_P
+ This class cannot have an implicitly generated default
+ constructor.
- last_x = NULL_TREE;
- for (x = fields; x; x = TREE_CHAIN (x))
+ CANT_HAVE_CONST_CTOR_P
+ This class cannot have an implicitly generated copy constructor
+ taking a const reference.
+
+ CANT_HAVE_CONST_ASN_REF
+ This class cannot have an implicitly generated assignment
+ operator taking a const reference.
+
+ All of these flags should be initialized before calling this
+ function.
+
+ Returns a pointer to the end of the TYPE_FIELDs chain; additional
+ fields can be added by adding to this chain. */
+
+static void
+check_field_decls (t, access_decls, empty_p,
+ cant_have_default_ctor_p, cant_have_const_ctor_p,
+ no_const_asn_ref_p)
+ tree t;
+ tree *access_decls;
+ int *empty_p;
+ int *cant_have_default_ctor_p;
+ int *cant_have_const_ctor_p;
+ int *no_const_asn_ref_p;
+{
+ tree *field;
+ tree *next;
+ int has_pointers;
+ int any_default_members;
+
+ /* First, delete any duplicate fields. */
+ delete_duplicate_fields (TYPE_FIELDS (t));
+
+ /* Assume there are no access declarations. */
+ *access_decls = NULL_TREE;
+ /* Assume this class has no pointer members. */
+ has_pointers = 0;
+ /* Assume none of the members of this class have default
+ initializations. */
+ any_default_members = 0;
+
+ for (field = &TYPE_FIELDS (t); *field; field = next)
{
+ tree x = *field;
+ tree type = TREE_TYPE (x);
+
GNU_xref_member (current_class_name, x);
+ next = &TREE_CHAIN (x);
+
if (TREE_CODE (x) == FIELD_DECL)
{
DECL_PACKED (x) |= TYPE_PACKED (t);
if (DECL_C_BIT_FIELD (x) && integer_zerop (DECL_INITIAL (x)))
- /* A zero-width bitfield doesn't do the trick. */;
+ /* We don't treat zero-width bitfields as making a class
+ non-empty. */
+ ;
else
- empty = 0;
+ {
+ /* The class is non-empty. */
+ *empty_p = 0;
+ /* The class is not even nearly empty. */
+ CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
+ }
}
if (TREE_CODE (x) == USING_DECL)
{
- /* Save access declarations for later. */
- if (last_x)
- TREE_CHAIN (last_x) = TREE_CHAIN (x);
- else
- fields = TREE_CHAIN (x);
-
- access_decls = scratch_tree_cons (NULL_TREE, x, access_decls);
+ /* Prune the access declaration from the list of fields. */
+ *field = TREE_CHAIN (x);
+
+ /* Save the access declarations for our caller. */
+ *access_decls = tree_cons (NULL_TREE, x, *access_decls);
+
+ /* Since we've reset *FIELD there's no reason to skip to the
+ next field. */
+ next = field;
continue;
}
- last_x = x;
-
if (TREE_CODE (x) == TYPE_DECL
|| TREE_CODE (x) == TEMPLATE_DECL)
continue;
@@ -3644,7 +3326,7 @@ finish_struct_1 (t, warn_anon)
/* If we've gotten this far, it's a data member, possibly static,
or an enumerator. */
- DECL_FIELD_CONTEXT (x) = t;
+ DECL_CONTEXT (x) = t;
/* ``A local class cannot have static data members.'' ARM 9.4 */
if (current_function_decl && TREE_STATIC (x))
@@ -3652,34 +3334,29 @@ finish_struct_1 (t, warn_anon)
/* Perform error checking that did not get done in
grokdeclarator. */
- if (TREE_CODE (TREE_TYPE (x)) == FUNCTION_TYPE)
+ if (TREE_CODE (type) == FUNCTION_TYPE)
{
cp_error_at ("field `%D' invalidly declared function type",
x);
- TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x));
+ type = build_pointer_type (type);
+ TREE_TYPE (x) = type;
}
- else if (TREE_CODE (TREE_TYPE (x)) == METHOD_TYPE)
+ else if (TREE_CODE (type) == METHOD_TYPE)
{
cp_error_at ("field `%D' invalidly declared method type", x);
- TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x));
+ type = build_pointer_type (type);
+ TREE_TYPE (x) = type;
}
- else if (TREE_CODE (TREE_TYPE (x)) == OFFSET_TYPE)
+ else if (TREE_CODE (type) == OFFSET_TYPE)
{
cp_error_at ("field `%D' invalidly declared offset type", x);
- TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x));
+ type = build_pointer_type (type);
+ TREE_TYPE (x) = type;
}
-#if 0
- if (DECL_NAME (x) == constructor_name (t))
- cant_have_default_ctor = 1;
-#endif
-
- if (TREE_TYPE (x) == error_mark_node)
+ if (type == error_mark_node)
continue;
- DECL_SAVED_INSNS (x) = NULL_RTX;
- DECL_FIELD_SIZE (x) = 0;
-
/* When this goes into scope, it will be a non-local reference. */
DECL_NONLOCAL (x) = 1;
@@ -3698,316 +3375,1046 @@ finish_struct_1 (t, warn_anon)
/* Now it can only be a FIELD_DECL. */
if (TREE_PRIVATE (x) || TREE_PROTECTED (x))
- aggregate = 0;
+ CLASSTYPE_NON_AGGREGATE (t) = 1;
/* If this is of reference type, check if it needs an init.
Also do a little ANSI jig if necessary. */
- if (TREE_CODE (TREE_TYPE (x)) == REFERENCE_TYPE)
+ if (TREE_CODE (type) == REFERENCE_TYPE)
{
+ CLASSTYPE_NON_POD_P (t) = 1;
if (DECL_INITIAL (x) == NULL_TREE)
- ref_sans_init = 1;
+ CLASSTYPE_REF_FIELDS_NEED_INIT (t) = 1;
/* ARM $12.6.2: [A member initializer list] (or, for an
aggregate, initialization by a brace-enclosed list) is the
only way to initialize nonstatic const and reference
members. */
- cant_have_default_ctor = 1;
+ *cant_have_default_ctor_p = 1;
TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1;
if (! TYPE_HAS_CONSTRUCTOR (t) && extra_warnings)
- {
- if (DECL_NAME (x))
- cp_warning_at ("non-static reference `%#D' in class without a constructor", x);
- else
- cp_warning_at ("non-static reference in class without a constructor", x);
- }
+ cp_warning_at ("non-static reference `%#D' in class without a constructor", x);
}
- if (TREE_CODE (TREE_TYPE (x)) == POINTER_TYPE)
+ type = strip_array_types (type);
+
+ if (TREE_CODE (type) == POINTER_TYPE)
has_pointers = 1;
- if (DECL_MUTABLE_P (x) || TYPE_HAS_MUTABLE_P (TREE_TYPE (x)))
- has_mutable = 1;
+ if (DECL_MUTABLE_P (x) || TYPE_HAS_MUTABLE_P (type))
+ CLASSTYPE_HAS_MUTABLE (t) = 1;
+
+ if (! pod_type_p (type))
+ /* DR 148 now allows pointers to members (which are POD themselves),
+ to be allowed in POD structs. */
+ CLASSTYPE_NON_POD_P (t) = 1;
/* If any field is const, the structure type is pseudo-const. */
- if (CP_TYPE_CONST_P (TREE_TYPE (x)))
+ if (CP_TYPE_CONST_P (type))
{
C_TYPE_FIELDS_READONLY (t) = 1;
if (DECL_INITIAL (x) == NULL_TREE)
- const_sans_init = 1;
+ CLASSTYPE_READONLY_FIELDS_NEED_INIT (t) = 1;
/* ARM $12.6.2: [A member initializer list] (or, for an
aggregate, initialization by a brace-enclosed list) is the
only way to initialize nonstatic const and reference
members. */
- cant_have_default_ctor = 1;
+ *cant_have_default_ctor_p = 1;
TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1;
- if (! TYPE_HAS_CONSTRUCTOR (t) && !IS_SIGNATURE (t)
- && extra_warnings)
- {
- if (DECL_NAME (x))
- cp_warning_at ("non-static const member `%#D' in class without a constructor", x);
- else
- cp_warning_at ("non-static const member in class without a constructor", x);
- }
+ if (! TYPE_HAS_CONSTRUCTOR (t) && extra_warnings)
+ cp_warning_at ("non-static const member `%#D' in class without a constructor", x);
}
- else
+ /* A field that is pseudo-const makes the structure likewise. */
+ else if (IS_AGGR_TYPE (type))
{
- /* A field that is pseudo-const makes the structure
- likewise. */
- tree t1 = TREE_TYPE (x);
- while (TREE_CODE (t1) == ARRAY_TYPE)
- t1 = TREE_TYPE (t1);
- if (IS_AGGR_TYPE (t1))
- {
- if (C_TYPE_FIELDS_READONLY (t1))
- C_TYPE_FIELDS_READONLY (t) = 1;
- if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (t1))
- const_sans_init = 1;
- }
+ C_TYPE_FIELDS_READONLY (t) |= C_TYPE_FIELDS_READONLY (type);
+ CLASSTYPE_READONLY_FIELDS_NEED_INIT (t)
+ |= CLASSTYPE_READONLY_FIELDS_NEED_INIT (type);
}
+ /* Core issue 80: A nonstatic data member is required to have a
+ different name from the class iff the class has a
+ user-defined constructor. */
+ if (DECL_NAME (x) == constructor_name (t)
+ && TYPE_HAS_CONSTRUCTOR (t))
+ cp_pedwarn_at ("field `%#D' with same name as class", x);
+
/* We set DECL_C_BIT_FIELD in grokbitfield.
If the type and width are valid, we'll also set DECL_BIT_FIELD. */
if (DECL_C_BIT_FIELD (x))
+ check_bitfield_decl (x);
+ else
+ check_field_decl (x, t,
+ cant_have_const_ctor_p,
+ cant_have_default_ctor_p,
+ no_const_asn_ref_p,
+ &any_default_members);
+ }
+
+ /* Effective C++ rule 11. */
+ if (has_pointers && warn_ecpp && TYPE_HAS_CONSTRUCTOR (t)
+ && ! (TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t)))
+ {
+ warning ("`%#T' has pointer data members", t);
+
+ if (! TYPE_HAS_INIT_REF (t))
{
- /* Invalid bit-field size done by grokfield. */
- /* Detect invalid bit-field type. */
- if (DECL_INITIAL (x)
- && ! INTEGRAL_TYPE_P (TREE_TYPE (x)))
- {
- cp_error_at ("bit-field `%#D' with non-integral type", x);
- DECL_INITIAL (x) = NULL;
- }
+ warning (" but does not override `%T(const %T&)'", t, t);
+ if (! TYPE_HAS_ASSIGN_REF (t))
+ warning (" or `operator=(const %T&)'", t);
+ }
+ else if (! TYPE_HAS_ASSIGN_REF (t))
+ warning (" but does not override `operator=(const %T&)'", t);
+ }
- /* Detect and ignore out of range field width. */
- if (DECL_INITIAL (x))
- {
- tree w = DECL_INITIAL (x);
- register int width = 0;
- /* Avoid the non_lvalue wrapper added by fold for PLUS_EXPRs. */
- STRIP_NOPS (w);
+ /* Check anonymous struct/anonymous union fields. */
+ finish_struct_anon (t);
- /* detect invalid field size. */
- if (TREE_CODE (w) == CONST_DECL)
- w = DECL_INITIAL (w);
- else if (TREE_READONLY_DECL_P (w))
- w = decl_constant_value (w);
+ /* We've built up the list of access declarations in reverse order.
+ Fix that now. */
+ *access_decls = nreverse (*access_decls);
+}
- if (TREE_CODE (w) != INTEGER_CST)
- {
- cp_error_at ("bit-field `%D' width not an integer constant",
- x);
- DECL_INITIAL (x) = NULL_TREE;
- }
- else if (width = TREE_INT_CST_LOW (w),
- width < 0)
- {
- DECL_INITIAL (x) = NULL;
- cp_error_at ("negative width in bit-field `%D'", x);
- }
- else if (width == 0 && DECL_NAME (x) != 0)
- {
- DECL_INITIAL (x) = NULL;
- cp_error_at ("zero width for bit-field `%D'", x);
- }
- else if (width
- > TYPE_PRECISION (long_long_unsigned_type_node))
- {
- /* The backend will dump if you try to use something
- too big; avoid that. */
- DECL_INITIAL (x) = NULL;
- sorry ("bit-fields larger than %d bits",
- TYPE_PRECISION (long_long_unsigned_type_node));
- cp_error_at (" in declaration of `%D'", x);
- }
- else if (width > TYPE_PRECISION (TREE_TYPE (x))
- && TREE_CODE (TREE_TYPE (x)) != ENUMERAL_TYPE
- && TREE_CODE (TREE_TYPE (x)) != BOOLEAN_TYPE)
- {
- cp_warning_at ("width of `%D' exceeds its type", x);
- }
- else if (TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE
- && ((min_precision (TYPE_MIN_VALUE (TREE_TYPE (x)),
- TREE_UNSIGNED (TREE_TYPE (x))) > width)
- || (min_precision (TYPE_MAX_VALUE (TREE_TYPE (x)),
- TREE_UNSIGNED (TREE_TYPE (x))) > width)))
- {
- cp_warning_at ("`%D' is too small to hold all values of `%#T'",
- x, TREE_TYPE (x));
- }
+/* If TYPE is an empty class type, records its OFFSET in the table of
+ OFFSETS. */
- if (DECL_INITIAL (x))
- {
- DECL_INITIAL (x) = NULL_TREE;
- DECL_FIELD_SIZE (x) = width;
- DECL_BIT_FIELD (x) = 1;
+static int
+record_subobject_offset (type, offset, offsets)
+ tree type;
+ tree offset;
+ splay_tree offsets;
+{
+ splay_tree_node n;
- if (width == 0)
- {
-#ifdef EMPTY_FIELD_BOUNDARY
- DECL_ALIGN (x) = MAX (DECL_ALIGN (x),
- EMPTY_FIELD_BOUNDARY);
-#endif
-#ifdef PCC_BITFIELD_TYPE_MATTERS
- if (PCC_BITFIELD_TYPE_MATTERS)
- DECL_ALIGN (x) = MAX (DECL_ALIGN (x),
- TYPE_ALIGN (TREE_TYPE (x)));
-#endif
- }
- }
- }
- else
- /* Non-bit-fields are aligned for their type. */
- DECL_ALIGN (x) = MAX (DECL_ALIGN (x), TYPE_ALIGN (TREE_TYPE (x)));
+ if (!is_empty_class (type))
+ return 0;
+
+ /* Record the location of this empty object in OFFSETS. */
+ n = splay_tree_lookup (offsets, (splay_tree_key) offset);
+ if (!n)
+ n = splay_tree_insert (offsets,
+ (splay_tree_key) offset,
+ (splay_tree_value) NULL_TREE);
+ n->value = ((splay_tree_value)
+ tree_cons (NULL_TREE,
+ type,
+ (tree) n->value));
+
+ return 0;
+}
+
+/* Returns non-zero if TYPE is an empty class type and there is
+ already an entry in OFFSETS for the same TYPE as the same OFFSET. */
+
+static int
+check_subobject_offset (type, offset, offsets)
+ tree type;
+ tree offset;
+ splay_tree offsets;
+{
+ splay_tree_node n;
+ tree t;
+
+ if (!is_empty_class (type))
+ return 0;
+
+ /* Record the location of this empty object in OFFSETS. */
+ n = splay_tree_lookup (offsets, (splay_tree_key) offset);
+ if (!n)
+ return 0;
+
+ for (t = (tree) n->value; t; t = TREE_CHAIN (t))
+ if (same_type_p (TREE_VALUE (t), type))
+ return 1;
+
+ return 0;
+}
+
+/* Walk through all the subobjects of TYPE (located at OFFSET). Call
+ F for every subobject, passing it the type, offset, and table of
+ OFFSETS. If VBASES_P is non-zero, then even virtual non-primary
+ bases should be traversed; otherwise, they are ignored.
+
+ If MAX_OFFSET is non-NULL, then subobjects with an offset greater
+ than MAX_OFFSET will not be walked.
+
+ If F returns a non-zero value, the traversal ceases, and that value
+ is returned. Otherwise, returns zero. */
+
+static int
+walk_subobject_offsets (type, f, offset, offsets, max_offset, vbases_p)
+ tree type;
+ subobject_offset_fn f;
+ tree offset;
+ splay_tree offsets;
+ tree max_offset;
+ int vbases_p;
+{
+ int r = 0;
+
+ /* If this OFFSET is bigger than the MAX_OFFSET, then we should
+ stop. */
+ if (max_offset && INT_CST_LT (max_offset, offset))
+ return 0;
+
+ if (CLASS_TYPE_P (type))
+ {
+ tree field;
+ int i;
+
+ /* Record the location of TYPE. */
+ r = (*f) (type, offset, offsets);
+ if (r)
+ return r;
+
+ /* Iterate through the direct base classes of TYPE. */
+ for (i = 0; i < CLASSTYPE_N_BASECLASSES (type); ++i)
+ {
+ tree binfo = BINFO_BASETYPE (TYPE_BINFO (type), i);
+
+ if (!vbases_p
+ && TREE_VIA_VIRTUAL (binfo)
+ && !BINFO_PRIMARY_P (binfo))
+ continue;
+
+ r = walk_subobject_offsets (BINFO_TYPE (binfo),
+ f,
+ size_binop (PLUS_EXPR,
+ offset,
+ BINFO_OFFSET (binfo)),
+ offsets,
+ max_offset,
+ vbases_p);
+ if (r)
+ return r;
+ }
+
+ /* Iterate through the fields of TYPE. */
+ for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
+ if (TREE_CODE (field) == FIELD_DECL)
+ {
+ r = walk_subobject_offsets (TREE_TYPE (field),
+ f,
+ size_binop (PLUS_EXPR,
+ offset,
+ DECL_FIELD_OFFSET (field)),
+ offsets,
+ max_offset,
+ /*vbases_p=*/1);
+ if (r)
+ return r;
+ }
+ }
+ else if (TREE_CODE (type) == ARRAY_TYPE)
+ {
+ tree domain = TYPE_DOMAIN (type);
+ tree index;
+
+ /* Step through each of the elements in the array. */
+ for (index = size_zero_node;
+ INT_CST_LT (index, TYPE_MAX_VALUE (domain));
+ index = size_binop (PLUS_EXPR, index, size_one_node))
+ {
+ r = walk_subobject_offsets (TREE_TYPE (type),
+ f,
+ offset,
+ offsets,
+ max_offset,
+ /*vbases_p=*/1);
+ if (r)
+ return r;
+ offset = size_binop (PLUS_EXPR, offset,
+ TYPE_SIZE_UNIT (TREE_TYPE (type)));
+ /* If this new OFFSET is bigger than the MAX_OFFSET, then
+ there's no point in iterating through the remaining
+ elements of the array. */
+ if (max_offset && INT_CST_LT (max_offset, offset))
+ break;
+ }
+ }
+
+ return 0;
+}
+
+/* Record all of the empty subobjects of TYPE (located at OFFSET) in
+ OFFSETS. If VBASES_P is non-zero, virtual bases of TYPE are
+ examined. */
+
+static void
+record_subobject_offsets (type, offset, offsets, vbases_p)
+ tree type;
+ tree offset;
+ splay_tree offsets;
+ int vbases_p;
+{
+ walk_subobject_offsets (type, record_subobject_offset, offset,
+ offsets, /*max_offset=*/NULL_TREE, vbases_p);
+}
+
+/* Returns non-zero if any of the empty subobjects of TYPE (located at
+ OFFSET) conflict with entries in OFFSETS. If VBASES_P is non-zero,
+ virtual bases of TYPE are examined. */
+
+static int
+layout_conflict_p (type, offset, offsets, vbases_p)
+ tree type;
+ tree offset;
+ splay_tree offsets;
+ int vbases_p;
+{
+ splay_tree_node max_node;
+
+ /* Get the node in OFFSETS that indicates the maximum offset where
+ an empty subobject is located. */
+ max_node = splay_tree_max (offsets);
+ /* If there aren't any empty subobjects, then there's no point in
+ performing this check. */
+ if (!max_node)
+ return 0;
+
+ return walk_subobject_offsets (type, check_subobject_offset, offset,
+ offsets, (tree) (max_node->key),
+ vbases_p);
+}
+
+/* DECL is a FIELD_DECL corresponding either to a base subobject of a
+ non-static data member of the type indicated by RLI. BINFO is the
+ binfo corresponding to the base subobject, OFFSETS maps offsets to
+ types already located at those offsets. T is the most derived
+ type. This function determines the position of the DECL. */
+
+static void
+layout_nonempty_base_or_field (rli, decl, binfo, offsets, t)
+ record_layout_info rli;
+ tree decl;
+ tree binfo;
+ splay_tree offsets;
+ tree t;
+{
+ tree offset = NULL_TREE;
+ tree type = TREE_TYPE (decl);
+ /* If we are laying out a base class, rather than a field, then
+ DECL_ARTIFICIAL will be set on the FIELD_DECL. */
+ int field_p = !DECL_ARTIFICIAL (decl);
+
+ /* Try to place the field. It may take more than one try if we have
+ a hard time placing the field without putting two objects of the
+ same type at the same address. */
+ while (1)
+ {
+ struct record_layout_info_s old_rli = *rli;
+
+ /* Place this field. */
+ place_field (rli, decl);
+ offset = byte_position (decl);
+
+ /* We have to check to see whether or not there is already
+ something of the same type at the offset we're about to use.
+ For example:
+
+ struct S {};
+ struct T : public S { int i; };
+ struct U : public S, public T {};
+
+ Here, we put S at offset zero in U. Then, we can't put T at
+ offset zero -- its S component would be at the same address
+ as the S we already allocated. So, we have to skip ahead.
+ Since all data members, including those whose type is an
+ empty class, have non-zero size, any overlap can happen only
+ with a direct or indirect base-class -- it can't happen with
+ a data member. */
+ if (layout_conflict_p (TREE_TYPE (decl),
+ offset,
+ offsets,
+ field_p))
+ {
+ /* Strip off the size allocated to this field. That puts us
+ at the first place we could have put the field with
+ proper alignment. */
+ *rli = old_rli;
+
+ /* Bump up by the alignment required for the type. */
+ rli->bitpos
+ = size_binop (PLUS_EXPR, rli->bitpos,
+ bitsize_int (binfo
+ ? CLASSTYPE_ALIGN (type)
+ : TYPE_ALIGN (type)));
+ normalize_rli (rli);
}
else
+ /* There was no conflict. We're done laying out this field. */
+ break;
+ }
+
+ /* Now that we know where it will be placed, update its
+ BINFO_OFFSET. */
+ if (binfo && CLASS_TYPE_P (BINFO_TYPE (binfo)))
+ propagate_binfo_offsets (binfo,
+ convert (ssizetype, offset), t);
+}
+
+/* Layout the empty base BINFO. EOC indicates the byte currently just
+ past the end of the class, and should be correctly aligned for a
+ class of the type indicated by BINFO; OFFSETS gives the offsets of
+ the empty bases allocated so far. T is the most derived
+ type. Return non-zero iff we added it at the end. */
+
+static bool
+layout_empty_base (binfo, eoc, offsets, t)
+ tree binfo;
+ tree eoc;
+ splay_tree offsets;
+ tree t;
+{
+ tree alignment;
+ tree basetype = BINFO_TYPE (binfo);
+ bool atend = false;
+
+ /* This routine should only be used for empty classes. */
+ my_friendly_assert (is_empty_class (basetype), 20000321);
+ alignment = ssize_int (CLASSTYPE_ALIGN_UNIT (basetype));
+
+ /* This is an empty base class. We first try to put it at offset
+ zero. */
+ if (layout_conflict_p (BINFO_TYPE (binfo),
+ BINFO_OFFSET (binfo),
+ offsets,
+ /*vbases_p=*/0))
+ {
+ /* That didn't work. Now, we move forward from the next
+ available spot in the class. */
+ atend = true;
+ propagate_binfo_offsets (binfo, convert (ssizetype, eoc), t);
+ while (1)
{
- tree type = TREE_TYPE (x);
+ if (!layout_conflict_p (BINFO_TYPE (binfo),
+ BINFO_OFFSET (binfo),
+ offsets,
+ /*vbases_p=*/0))
+ /* We finally found a spot where there's no overlap. */
+ break;
- while (TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
+ /* There's overlap here, too. Bump along to the next spot. */
+ propagate_binfo_offsets (binfo, alignment, t);
+ }
+ }
+ return atend;
+}
- if (TYPE_LANG_SPECIFIC (type) && ! ANON_UNION_P (x)
- && ! TYPE_PTRMEMFUNC_P (type))
- {
- /* Never let anything with uninheritable virtuals
- make it through without complaint. */
- if (CLASSTYPE_ABSTRACT_VIRTUALS (type))
- abstract_virtuals_error (x, type);
-
- /* Don't let signatures make it through either. */
- if (IS_SIGNATURE (type))
- signature_error (x, type);
-
- if (code == UNION_TYPE)
- {
- const char *fie = NULL;
- if (TYPE_NEEDS_CONSTRUCTING (type))
- fie = "constructor";
- else if (TYPE_NEEDS_DESTRUCTOR (type))
- fie = "destructor";
- else if (TYPE_HAS_COMPLEX_ASSIGN_REF (type))
- fie = "copy assignment operator";
- if (fie)
- cp_error_at ("member `%#D' with %s not allowed in union", x,
- fie);
- }
- else
- {
- TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (type);
- TYPE_NEEDS_DESTRUCTOR (t) |= TYPE_NEEDS_DESTRUCTOR (type);
- TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_HAS_COMPLEX_ASSIGN_REF (type);
- TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (type);
- }
+/* Build a FIELD_DECL for the base given by BINFO in the class
+ indicated by RLI. If the new object is non-empty, clear *EMPTY_P.
+ *BASE_ALIGN is a running maximum of the alignments of any base
+ class. OFFSETS gives the location of empty base subobjects. T is
+ the most derived type. Return non-zero if the new object cannot be
+ nearly-empty. */
- if (!TYPE_HAS_CONST_INIT_REF (type))
- cant_have_const_ctor = 1;
+static bool
+build_base_field (rli, binfo, empty_p, offsets, t)
+ record_layout_info rli;
+ tree binfo;
+ int *empty_p;
+ splay_tree offsets;
+ tree t;
+{
+ tree basetype = BINFO_TYPE (binfo);
+ tree decl;
+ bool atend = false;
+
+ if (!COMPLETE_TYPE_P (basetype))
+ /* This error is now reported in xref_tag, thus giving better
+ location information. */
+ return atend;
+
+ decl = build_decl (FIELD_DECL, NULL_TREE, basetype);
+ DECL_ARTIFICIAL (decl) = 1;
+ DECL_FIELD_CONTEXT (decl) = rli->t;
+ DECL_SIZE (decl) = CLASSTYPE_SIZE (basetype);
+ DECL_SIZE_UNIT (decl) = CLASSTYPE_SIZE_UNIT (basetype);
+ DECL_ALIGN (decl) = CLASSTYPE_ALIGN (basetype);
+ DECL_USER_ALIGN (decl) = CLASSTYPE_USER_ALIGN (basetype);
+
+ if (!integer_zerop (DECL_SIZE (decl)))
+ {
+ /* The containing class is non-empty because it has a non-empty
+ base class. */
+ *empty_p = 0;
- if (!TYPE_HAS_CONST_ASSIGN_REF (type))
- no_const_asn_ref = 1;
+ /* Try to place the field. It may take more than one try if we
+ have a hard time placing the field without putting two
+ objects of the same type at the same address. */
+ layout_nonempty_base_or_field (rli, decl, binfo, offsets, t);
+ }
+ else
+ {
+ unsigned HOST_WIDE_INT eoc;
- if (TYPE_HAS_CONSTRUCTOR (type)
- && ! TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
- {
- cant_have_default_ctor = 1;
-#if 0
- /* This is wrong for aggregates. */
- if (! TYPE_HAS_CONSTRUCTOR (t))
- {
- if (DECL_NAME (x))
- cp_pedwarn_at ("member `%#D' with only non-default constructor", x);
- else
- cp_pedwarn_at ("member with only non-default constructor", x);
- cp_pedwarn_at ("in class without a constructor",
- x);
- }
-#endif
- }
- }
- if (DECL_INITIAL (x) != NULL_TREE)
+ /* On some platforms (ARM), even empty classes will not be
+ byte-aligned. */
+ eoc = tree_low_cst (rli_size_unit_so_far (rli), 0);
+ eoc = CEIL (eoc, DECL_ALIGN_UNIT (decl)) * DECL_ALIGN_UNIT (decl);
+ atend |= layout_empty_base (binfo, size_int (eoc), offsets, t);
+ }
+
+ /* Record the offsets of BINFO and its base subobjects. */
+ record_subobject_offsets (BINFO_TYPE (binfo),
+ BINFO_OFFSET (binfo),
+ offsets,
+ /*vbases_p=*/0);
+ return atend;
+}
+
+/* Layout all of the non-virtual base classes. Record empty
+ subobjects in OFFSETS. T is the most derived type. Return
+ non-zero if the type cannot be nearly empty. */
+
+static bool
+build_base_fields (rli, empty_p, offsets, t)
+ record_layout_info rli;
+ int *empty_p;
+ splay_tree offsets;
+ tree t;
+{
+ /* Chain to hold all the new FIELD_DECLs which stand in for base class
+ subobjects. */
+ tree rec = rli->t;
+ int n_baseclasses = CLASSTYPE_N_BASECLASSES (rec);
+ int i;
+ bool atend = 0;
+
+ /* The primary base class is always allocated first. */
+ if (CLASSTYPE_HAS_PRIMARY_BASE_P (rec))
+ build_base_field (rli, CLASSTYPE_PRIMARY_BINFO (rec),
+ empty_p, offsets, t);
+
+ /* Now allocate the rest of the bases. */
+ for (i = 0; i < n_baseclasses; ++i)
+ {
+ tree base_binfo;
+
+ base_binfo = BINFO_BASETYPE (TYPE_BINFO (rec), i);
+
+ /* The primary base was already allocated above, so we don't
+ need to allocate it again here. */
+ if (base_binfo == CLASSTYPE_PRIMARY_BINFO (rec))
+ continue;
+
+ /* A primary virtual base class is allocated just like any other
+ base class, but a non-primary virtual base is allocated
+ later, in layout_virtual_bases. */
+ if (TREE_VIA_VIRTUAL (base_binfo)
+ && !BINFO_PRIMARY_P (base_binfo))
+ continue;
+
+ atend |= build_base_field (rli, base_binfo, empty_p, offsets, t);
+ }
+ return atend;
+}
+
+/* Go through the TYPE_METHODS of T issuing any appropriate
+ diagnostics, figuring out which methods override which other
+ methods, and so forth. */
+
+static void
+check_methods (t)
+ tree t;
+{
+ tree x;
+
+ for (x = TYPE_METHODS (t); x; x = TREE_CHAIN (x))
+ {
+ GNU_xref_member (current_class_name, x);
+
+ /* If this was an evil function, don't keep it in class. */
+ if (DECL_ASSEMBLER_NAME_SET_P (x)
+ && IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (x)))
+ continue;
+
+ check_for_override (x, t);
+ if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
+ cp_error_at ("initializer specified for non-virtual method `%D'", x);
+
+ /* The name of the field is the original field name
+ Save this in auxiliary field for later overloading. */
+ if (DECL_VINDEX (x))
+ {
+ TYPE_POLYMORPHIC_P (t) = 1;
+ if (DECL_PURE_VIRTUAL_P (x))
+ CLASSTYPE_PURE_VIRTUALS (t)
+ = tree_cons (NULL_TREE, x, CLASSTYPE_PURE_VIRTUALS (t));
+ }
+ }
+}
+
+/* FN is a constructor or destructor. Clone the declaration to create
+ a specialized in-charge or not-in-charge version, as indicated by
+ NAME. */
+
+static tree
+build_clone (fn, name)
+ tree fn;
+ tree name;
+{
+ tree parms;
+ tree clone;
+
+ /* Copy the function. */
+ clone = copy_decl (fn);
+ /* Remember where this function came from. */
+ DECL_CLONED_FUNCTION (clone) = fn;
+ DECL_ABSTRACT_ORIGIN (clone) = fn;
+ /* Reset the function name. */
+ DECL_NAME (clone) = name;
+ SET_DECL_ASSEMBLER_NAME (clone, NULL_TREE);
+ /* There's no pending inline data for this function. */
+ DECL_PENDING_INLINE_INFO (clone) = NULL;
+ DECL_PENDING_INLINE_P (clone) = 0;
+ /* And it hasn't yet been deferred. */
+ DECL_DEFERRED_FN (clone) = 0;
+
+ /* The base-class destructor is not virtual. */
+ if (name == base_dtor_identifier)
+ {
+ DECL_VIRTUAL_P (clone) = 0;
+ if (TREE_CODE (clone) != TEMPLATE_DECL)
+ DECL_VINDEX (clone) = NULL_TREE;
+ }
+
+ /* If there was an in-charge parameter, drop it from the function
+ type. */
+ if (DECL_HAS_IN_CHARGE_PARM_P (clone))
+ {
+ tree basetype;
+ tree parmtypes;
+ tree exceptions;
+
+ exceptions = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (clone));
+ basetype = TYPE_METHOD_BASETYPE (TREE_TYPE (clone));
+ parmtypes = TYPE_ARG_TYPES (TREE_TYPE (clone));
+ /* Skip the `this' parameter. */
+ parmtypes = TREE_CHAIN (parmtypes);
+ /* Skip the in-charge parameter. */
+ parmtypes = TREE_CHAIN (parmtypes);
+ /* And the VTT parm, in a complete [cd]tor. */
+ if (DECL_HAS_VTT_PARM_P (fn)
+ && ! DECL_NEEDS_VTT_PARM_P (clone))
+ parmtypes = TREE_CHAIN (parmtypes);
+ /* If this is subobject constructor or destructor, add the vtt
+ parameter. */
+ TREE_TYPE (clone)
+ = build_cplus_method_type (basetype,
+ TREE_TYPE (TREE_TYPE (clone)),
+ parmtypes);
+ if (exceptions)
+ TREE_TYPE (clone) = build_exception_variant (TREE_TYPE (clone),
+ exceptions);
+ }
+
+ /* Copy the function parameters. But, DECL_ARGUMENTS on a TEMPLATE_DECL
+ aren't function parameters; those are the template parameters. */
+ if (TREE_CODE (clone) != TEMPLATE_DECL)
+ {
+ DECL_ARGUMENTS (clone) = copy_list (DECL_ARGUMENTS (clone));
+ /* Remove the in-charge parameter. */
+ if (DECL_HAS_IN_CHARGE_PARM_P (clone))
+ {
+ TREE_CHAIN (DECL_ARGUMENTS (clone))
+ = TREE_CHAIN (TREE_CHAIN (DECL_ARGUMENTS (clone)));
+ DECL_HAS_IN_CHARGE_PARM_P (clone) = 0;
+ }
+ /* And the VTT parm, in a complete [cd]tor. */
+ if (DECL_HAS_VTT_PARM_P (fn))
+ {
+ if (DECL_NEEDS_VTT_PARM_P (clone))
+ DECL_HAS_VTT_PARM_P (clone) = 1;
+ else
{
- /* `build_class_init_list' does not recognize
- non-FIELD_DECLs. */
- if (code == UNION_TYPE && any_default_members != 0)
- cp_error_at ("multiple fields in union `%T' initialized");
- any_default_members = 1;
+ TREE_CHAIN (DECL_ARGUMENTS (clone))
+ = TREE_CHAIN (TREE_CHAIN (DECL_ARGUMENTS (clone)));
+ DECL_HAS_VTT_PARM_P (clone) = 0;
}
}
+
+ for (parms = DECL_ARGUMENTS (clone); parms; parms = TREE_CHAIN (parms))
+ {
+ DECL_CONTEXT (parms) = clone;
+ copy_lang_decl (parms);
+ }
}
- /* If this type has any constant members which did not come
- with their own initialization, mark that fact here. It is
- not an error here, since such types can be saved either by their
- constructors, or by fortuitous initialization. */
- CLASSTYPE_READONLY_FIELDS_NEED_INIT (t) = const_sans_init;
- CLASSTYPE_REF_FIELDS_NEED_INIT (t) = ref_sans_init;
- CLASSTYPE_ABSTRACT_VIRTUALS (t) = abstract_virtuals;
- CLASSTYPE_HAS_MUTABLE (t) = has_mutable;
+ /* Create the RTL for this function. */
+ SET_DECL_RTL (clone, NULL_RTX);
+ rest_of_decl_compilation (clone, NULL, /*top_level=*/1, at_eof);
+
+ /* Make it easy to find the CLONE given the FN. */
+ TREE_CHAIN (clone) = TREE_CHAIN (fn);
+ TREE_CHAIN (fn) = clone;
- /* Effective C++ rule 11. */
- if (has_pointers && warn_ecpp && TYPE_HAS_CONSTRUCTOR (t)
- && ! (TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t)))
+ /* If this is a template, handle the DECL_TEMPLATE_RESULT as well. */
+ if (TREE_CODE (clone) == TEMPLATE_DECL)
{
- cp_warning ("`%#T' has pointer data members", t);
-
- if (! TYPE_HAS_INIT_REF (t))
+ tree result;
+
+ DECL_TEMPLATE_RESULT (clone)
+ = build_clone (DECL_TEMPLATE_RESULT (clone), name);
+ result = DECL_TEMPLATE_RESULT (clone);
+ DECL_TEMPLATE_INFO (result) = copy_node (DECL_TEMPLATE_INFO (result));
+ DECL_TI_TEMPLATE (result) = clone;
+ }
+ else if (DECL_DEFERRED_FN (fn))
+ defer_fn (clone);
+
+ return clone;
+}
+
+/* Produce declarations for all appropriate clones of FN. If
+ UPDATE_METHOD_VEC_P is non-zero, the clones are added to the
+ CLASTYPE_METHOD_VEC as well. */
+
+void
+clone_function_decl (fn, update_method_vec_p)
+ tree fn;
+ int update_method_vec_p;
+{
+ tree clone;
+
+ /* Avoid inappropriate cloning. */
+ if (TREE_CHAIN (fn)
+ && DECL_CLONED_FUNCTION (TREE_CHAIN (fn)))
+ return;
+
+ if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn))
+ {
+ /* For each constructor, we need two variants: an in-charge version
+ and a not-in-charge version. */
+ clone = build_clone (fn, complete_ctor_identifier);
+ if (update_method_vec_p)
+ add_method (DECL_CONTEXT (clone), clone, /*error_p=*/0);
+ clone = build_clone (fn, base_ctor_identifier);
+ if (update_method_vec_p)
+ add_method (DECL_CONTEXT (clone), clone, /*error_p=*/0);
+ }
+ else
+ {
+ my_friendly_assert (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn), 20000411);
+
+ /* For each destructor, we need three variants: an in-charge
+ version, a not-in-charge version, and an in-charge deleting
+ version. We clone the deleting version first because that
+ means it will go second on the TYPE_METHODS list -- and that
+ corresponds to the correct layout order in the virtual
+ function table.
+
+ For a non-virtual destructor, we do not build a deleting
+ destructor. */
+ if (DECL_VIRTUAL_P (fn))
{
- cp_warning (" but does not override `%T(const %T&)'", t, t);
- if (! TYPE_HAS_ASSIGN_REF (t))
- cp_warning (" or `operator=(const %T&)'", t);
+ clone = build_clone (fn, deleting_dtor_identifier);
+ if (update_method_vec_p)
+ add_method (DECL_CONTEXT (clone), clone, /*error_p=*/0);
}
- else if (! TYPE_HAS_ASSIGN_REF (t))
- cp_warning (" but does not override `operator=(const %T&)'", t);
+ clone = build_clone (fn, complete_dtor_identifier);
+ if (update_method_vec_p)
+ add_method (DECL_CONTEXT (clone), clone, /*error_p=*/0);
+ clone = build_clone (fn, base_dtor_identifier);
+ if (update_method_vec_p)
+ add_method (DECL_CONTEXT (clone), clone, /*error_p=*/0);
}
+
+ /* Note that this is an abstract function that is never emitted. */
+ DECL_ABSTRACT (fn) = 1;
+}
+
+/* DECL is an in charge constructor, which is being defined. This will
+ have had an in class declaration, from whence clones were
+ declared. An out-of-class definition can specify additional default
+ arguments. As it is the clones that are involved in overload
+ resolution, we must propagate the information from the DECL to its
+ clones. */
+
+void
+adjust_clone_args (decl)
+ tree decl;
+{
+ tree clone;
+ for (clone = TREE_CHAIN (decl); clone && DECL_CLONED_FUNCTION (clone);
+ clone = TREE_CHAIN (clone))
+ {
+ tree orig_clone_parms = TYPE_ARG_TYPES (TREE_TYPE (clone));
+ tree orig_decl_parms = TYPE_ARG_TYPES (TREE_TYPE (decl));
+ tree decl_parms, clone_parms;
+
+ clone_parms = orig_clone_parms;
+
+ /* Skip the 'this' parameter. */
+ orig_clone_parms = TREE_CHAIN (orig_clone_parms);
+ orig_decl_parms = TREE_CHAIN (orig_decl_parms);
+
+ if (DECL_HAS_IN_CHARGE_PARM_P (decl))
+ orig_decl_parms = TREE_CHAIN (orig_decl_parms);
+ if (DECL_HAS_VTT_PARM_P (decl))
+ orig_decl_parms = TREE_CHAIN (orig_decl_parms);
+
+ clone_parms = orig_clone_parms;
+ if (DECL_HAS_VTT_PARM_P (clone))
+ clone_parms = TREE_CHAIN (clone_parms);
+
+ for (decl_parms = orig_decl_parms; decl_parms;
+ decl_parms = TREE_CHAIN (decl_parms),
+ clone_parms = TREE_CHAIN (clone_parms))
+ {
+ my_friendly_assert (same_type_p (TREE_TYPE (decl_parms),
+ TREE_TYPE (clone_parms)), 20010424);
+
+ if (TREE_PURPOSE (decl_parms) && !TREE_PURPOSE (clone_parms))
+ {
+ /* A default parameter has been added. Adjust the
+ clone's parameters. */
+ tree exceptions = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (clone));
+ tree basetype = TYPE_METHOD_BASETYPE (TREE_TYPE (clone));
+ tree type;
+
+ clone_parms = orig_decl_parms;
+
+ if (DECL_HAS_VTT_PARM_P (clone))
+ {
+ clone_parms = tree_cons (TREE_PURPOSE (orig_clone_parms),
+ TREE_VALUE (orig_clone_parms),
+ clone_parms);
+ TREE_TYPE (clone_parms) = TREE_TYPE (orig_clone_parms);
+ }
+ type = build_cplus_method_type (basetype,
+ TREE_TYPE (TREE_TYPE (clone)),
+ clone_parms);
+ if (exceptions)
+ type = build_exception_variant (type, exceptions);
+ TREE_TYPE (clone) = type;
+
+ clone_parms = NULL_TREE;
+ break;
+ }
+ }
+ my_friendly_assert (!clone_parms, 20010424);
+ }
+}
+
+/* For each of the constructors and destructors in T, create an
+ in-charge and not-in-charge variant. */
+
+static void
+clone_constructors_and_destructors (t)
+ tree t;
+{
+ tree fns;
+
+ /* If for some reason we don't have a CLASSTYPE_METHOD_VEC, we bail
+ out now. */
+ if (!CLASSTYPE_METHOD_VEC (t))
+ return;
+
+ for (fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
+ clone_function_decl (OVL_CURRENT (fns), /*update_method_vec_p=*/1);
+ for (fns = CLASSTYPE_DESTRUCTORS (t); fns; fns = OVL_NEXT (fns))
+ clone_function_decl (OVL_CURRENT (fns), /*update_method_vec_p=*/1);
+}
+
+/* Remove all zero-width bit-fields from T. */
+
+static void
+remove_zero_width_bit_fields (t)
+ tree t;
+{
+ tree *fieldsp;
+
+ fieldsp = &TYPE_FIELDS (t);
+ while (*fieldsp)
+ {
+ if (TREE_CODE (*fieldsp) == FIELD_DECL
+ && DECL_C_BIT_FIELD (*fieldsp)
+ && DECL_INITIAL (*fieldsp))
+ *fieldsp = TREE_CHAIN (*fieldsp);
+ else
+ fieldsp = &TREE_CHAIN (*fieldsp);
+ }
+}
+
+/* Returns TRUE iff we need a cookie when dynamically allocating an
+ array whose elements have the indicated class TYPE. */
+
+static bool
+type_requires_array_cookie (type)
+ tree type;
+{
+ tree fns;
+ bool has_two_argument_delete_p = false;
+
+ my_friendly_assert (CLASS_TYPE_P (type), 20010712);
+
+ /* If there's a non-trivial destructor, we need a cookie. In order
+ to iterate through the array calling the destructor for each
+ element, we'll have to know how many elements there are. */
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
+ return true;
+
+ /* If the usual deallocation function is a two-argument whose second
+ argument is of type `size_t', then we have to pass the size of
+ the array to the deallocation function, so we will need to store
+ a cookie. */
+ fns = lookup_fnfields (TYPE_BINFO (type),
+ ansi_opname (VEC_DELETE_EXPR),
+ /*protect=*/0);
+ /* If there are no `operator []' members, or the lookup is
+ ambiguous, then we don't need a cookie. */
+ if (!fns || fns == error_mark_node)
+ return false;
+ /* Loop through all of the functions. */
+ for (fns = TREE_VALUE (fns); fns; fns = OVL_NEXT (fns))
+ {
+ tree fn;
+ tree second_parm;
+
+ /* Select the current function. */
+ fn = OVL_CURRENT (fns);
+ /* See if this function is a one-argument delete function. If
+ it is, then it will be the usual deallocation function. */
+ second_parm = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fn)));
+ if (second_parm == void_list_node)
+ return false;
+ /* Otherwise, if we have a two-argument function and the second
+ argument is `size_t', it will be the usual deallocation
+ function -- unless there is one-argument function, too. */
+ if (TREE_CHAIN (second_parm) == void_list_node
+ && same_type_p (TREE_VALUE (second_parm), sizetype))
+ has_two_argument_delete_p = true;
+ }
+
+ return has_two_argument_delete_p;
+}
+
+/* Check the validity of the bases and members declared in T. Add any
+ implicitly-generated functions (like copy-constructors and
+ assignment operators). Compute various flag bits (like
+ CLASSTYPE_NON_POD_T) for T. This routine works purely at the C++
+ level: i.e., independently of the ABI in use. */
+
+static void
+check_bases_and_members (t, empty_p)
+ tree t;
+ int *empty_p;
+{
+ /* Nonzero if we are not allowed to generate a default constructor
+ for this case. */
+ int cant_have_default_ctor;
+ /* Nonzero if the implicitly generated copy constructor should take
+ a non-const reference argument. */
+ int cant_have_const_ctor;
+ /* Nonzero if the the implicitly generated assignment operator
+ should take a non-const reference argument. */
+ int no_const_asn_ref;
+ tree access_decls;
+
+ /* By default, we use const reference arguments and generate default
+ constructors. */
+ cant_have_default_ctor = 0;
+ cant_have_const_ctor = 0;
+ no_const_asn_ref = 0;
+
+ /* Assume that the class is nearly empty; we'll clear this flag if
+ it turns out not to be nearly empty. */
+ CLASSTYPE_NEARLY_EMPTY_P (t) = 1;
+
+ /* Check all the base-classes. */
+ check_bases (t, &cant_have_default_ctor, &cant_have_const_ctor,
+ &no_const_asn_ref);
+
+ /* Check all the data member declarations. */
+ check_field_decls (t, &access_decls, empty_p,
+ &cant_have_default_ctor,
+ &cant_have_const_ctor,
+ &no_const_asn_ref);
+
+ /* Check all the method declarations. */
+ check_methods (t);
+
+ /* A nearly-empty class has to be vptr-containing; a nearly empty
+ class contains just a vptr. */
+ if (!TYPE_CONTAINS_VPTR_P (t))
+ CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
+
/* Do some bookkeeping that will guide the generation of implicitly
declared member functions. */
TYPE_HAS_COMPLEX_INIT_REF (t)
- |= (TYPE_HAS_INIT_REF (t) || TYPE_USES_VIRTUAL_BASECLASSES (t)
- || has_virtual || any_default_members);
+ |= (TYPE_HAS_INIT_REF (t)
+ || TYPE_USES_VIRTUAL_BASECLASSES (t)
+ || TYPE_POLYMORPHIC_P (t));
TYPE_NEEDS_CONSTRUCTING (t)
- |= (TYPE_HAS_CONSTRUCTOR (t) || TYPE_USES_VIRTUAL_BASECLASSES (t)
- || has_virtual || any_default_members);
- if (! IS_SIGNATURE (t))
- CLASSTYPE_NON_AGGREGATE (t)
- = ! aggregate || has_virtual || TYPE_HAS_CONSTRUCTOR (t);
+ |= (TYPE_HAS_CONSTRUCTOR (t)
+ || TYPE_USES_VIRTUAL_BASECLASSES (t)
+ || TYPE_POLYMORPHIC_P (t));
+ CLASSTYPE_NON_AGGREGATE (t) |= (TYPE_HAS_CONSTRUCTOR (t)
+ || TYPE_POLYMORPHIC_P (t));
+ CLASSTYPE_NON_POD_P (t)
+ |= (CLASSTYPE_NON_AGGREGATE (t) || TYPE_HAS_DESTRUCTOR (t)
+ || TYPE_HAS_ASSIGN_REF (t));
TYPE_HAS_REAL_ASSIGN_REF (t) |= TYPE_HAS_ASSIGN_REF (t);
TYPE_HAS_COMPLEX_ASSIGN_REF (t)
- |= TYPE_HAS_ASSIGN_REF (t) || TYPE_USES_VIRTUAL_BASECLASSES (t);
+ |= TYPE_HAS_ASSIGN_REF (t) || TYPE_CONTAINS_VPTR_P (t);
/* Synthesize any needed methods. Note that methods will be synthesized
for anonymous unions; grok_x_components undoes that. */
- virtual_dtor
- = add_implicitly_declared_members (t, cant_have_default_ctor,
- cant_have_const_ctor,
- no_const_asn_ref);
- if (virtual_dtor)
- add_virtual_function (&pending_virtuals, &pending_hard_virtuals,
- &has_virtual, virtual_dtor, t);
+ add_implicitly_declared_members (t, cant_have_default_ctor,
+ cant_have_const_ctor,
+ no_const_asn_ref);
- if (TYPE_METHODS (t))
- {
- finish_struct_methods (t);
- method_vec = CLASSTYPE_METHOD_VEC (t);
- }
- else
- {
- method_vec = 0;
+ /* Create the in-charge and not-in-charge variants of constructors
+ and destructors. */
+ clone_constructors_and_destructors (t);
- /* Just in case these got accidentally
- filled in by syntax errors. */
- TYPE_HAS_CONSTRUCTOR (t) = 0;
- TYPE_HAS_DESTRUCTOR (t) = 0;
- }
+ /* Process the using-declarations. */
+ for (; access_decls; access_decls = TREE_CHAIN (access_decls))
+ handle_using_decl (TREE_VALUE (access_decls), t);
+
+ /* Build and sort the CLASSTYPE_METHOD_VEC. */
+ finish_struct_methods (t);
+
+ /* Figure out whether or not we will need a cookie when dynamically
+ allocating an array of this type. */
+ TYPE_LANG_SPECIFIC (t)->vec_new_uses_cookie
+ = type_requires_array_cookie (t);
+}
+
+/* If T needs a pointer to its virtual function table, set TYPE_VFIELD
+ accordingly. If a new vfield was created (because T doesn't have a
+ primary base class), then the newly created field is returned. It
+ is not added to the TYPE_FIELDS list; it is the caller's
+ responsibility to do that. */
- for (access_decls = nreverse (access_decls); access_decls;
- access_decls = TREE_CHAIN (access_decls))
- handle_using_decl (TREE_VALUE (access_decls), t, method_vec, fields);
+static tree
+create_vtable_ptr (t, empty_p, vfuns_p,
+ new_virtuals_p, overridden_virtuals_p)
+ tree t;
+ int *empty_p;
+ int *vfuns_p;
+ tree *new_virtuals_p;
+ tree *overridden_virtuals_p;
+{
+ tree fn;
- if (vfield == NULL_TREE && has_virtual)
+ /* Loop over the virtual functions, adding them to our various
+ vtables. */
+ for (fn = TYPE_METHODS (t); fn; fn = TREE_CHAIN (fn))
+ if (DECL_VINDEX (fn) && !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn))
+ add_virtual_function (new_virtuals_p, overridden_virtuals_p,
+ vfuns_p, fn, t);
+
+ /* If we couldn't find an appropriate base class, create a new field
+ here. Even if there weren't any new virtual functions, we might need a
+ new virtual function table if we're supposed to include vptrs in
+ all classes that need them. */
+ if (!TYPE_VFIELD (t) && (*vfuns_p || TYPE_CONTAINS_VPTR_P (t)))
{
/* We build this decl with vtbl_ptr_type_node, which is a
`vtable_entry_type*'. It might seem more precise to use
@@ -4028,255 +4435,682 @@ finish_struct_1 (t, warn_anon)
bounds. That's better than using `void*' or some such; it's
cleaner, and it let's the alias analysis code know that these
stores cannot alias stores to void*! */
- vfield = build_lang_field_decl (FIELD_DECL, get_vfield_name (t),
- vtbl_ptr_type_node);
- /* If you change any of the below, take a look at all the
- other VFIELD_BASEs and VTABLE_BASEs in the code, and change
- them too. */
- DECL_ASSEMBLER_NAME (vfield) = get_identifier (VFIELD_BASE);
- CLASSTYPE_VFIELD (t) = vfield;
- DECL_VIRTUAL_P (vfield) = 1;
- DECL_ARTIFICIAL (vfield) = 1;
- DECL_FIELD_CONTEXT (vfield) = t;
- DECL_CLASS_CONTEXT (vfield) = t;
- DECL_FCONTEXT (vfield) = t;
- DECL_SAVED_INSNS (vfield) = NULL_RTX;
- DECL_FIELD_SIZE (vfield) = 0;
- DECL_ALIGN (vfield) = TYPE_ALIGN (ptr_type_node);
-#if 0
- /* This is more efficient, but breaks binary compatibility, turn
- it on sometime when we don't care. If we turn it on, we also
- have to enable the code in dfs_init_vbase_pointers. */
- /* vfield is always first entry in structure. */
- TREE_CHAIN (vfield) = fields;
- fields = vfield;
-#else
- if (last_x)
+ tree field;
+
+ field = build_decl (FIELD_DECL, get_vfield_name (t), vtbl_ptr_type_node);
+ SET_DECL_ASSEMBLER_NAME (field, get_identifier (VFIELD_BASE));
+ DECL_VIRTUAL_P (field) = 1;
+ DECL_ARTIFICIAL (field) = 1;
+ DECL_FIELD_CONTEXT (field) = t;
+ DECL_FCONTEXT (field) = t;
+ DECL_ALIGN (field) = TYPE_ALIGN (vtbl_ptr_type_node);
+ DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (vtbl_ptr_type_node);
+
+ TYPE_VFIELD (t) = field;
+
+ /* This class is non-empty. */
+ *empty_p = 0;
+
+ if (CLASSTYPE_N_BASECLASSES (t))
+ /* If there were any baseclasses, they can't possibly be at
+ offset zero any more, because that's where the vtable
+ pointer is. So, converting to a base class is going to
+ take work. */
+ TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (t) = 1;
+
+ return field;
+ }
+
+ return NULL_TREE;
+}
+
+/* Fixup the inline function given by INFO now that the class is
+ complete. */
+
+static void
+fixup_pending_inline (fn)
+ tree fn;
+{
+ if (DECL_PENDING_INLINE_INFO (fn))
+ {
+ tree args = DECL_ARGUMENTS (fn);
+ while (args)
{
- my_friendly_assert (TREE_CHAIN (last_x) == NULL_TREE, 175);
- TREE_CHAIN (last_x) = vfield;
- last_x = vfield;
+ DECL_CONTEXT (args) = fn;
+ args = TREE_CHAIN (args);
}
+ }
+}
+
+/* Fixup the inline methods and friends in TYPE now that TYPE is
+ complete. */
+
+static void
+fixup_inline_methods (type)
+ tree type;
+{
+ tree method = TYPE_METHODS (type);
+
+ if (method && TREE_CODE (method) == TREE_VEC)
+ {
+ if (TREE_VEC_ELT (method, 1))
+ method = TREE_VEC_ELT (method, 1);
+ else if (TREE_VEC_ELT (method, 0))
+ method = TREE_VEC_ELT (method, 0);
else
- fields = vfield;
-#endif
- empty = 0;
- vfields = chainon (vfields, build_tree_list (NULL_TREE, t));
+ method = TREE_VEC_ELT (method, 2);
}
- /* Now DECL_INITIAL is null on all members except for zero-width bit-fields.
+ /* Do inline member functions. */
+ for (; method; method = TREE_CHAIN (method))
+ fixup_pending_inline (method);
+
+ /* Do friends. */
+ for (method = CLASSTYPE_INLINE_FRIENDS (type);
+ method;
+ method = TREE_CHAIN (method))
+ fixup_pending_inline (TREE_VALUE (method));
+ CLASSTYPE_INLINE_FRIENDS (type) = NULL_TREE;
+}
+
+/* Add OFFSET to all base types of BINFO which is a base in the
+ hierarchy dominated by T.
- C++: maybe we will support default field initialization some day... */
+ OFFSET, which is a type offset, is number of bytes. */
- /* Delete all duplicate fields from the fields */
- delete_duplicate_fields (fields);
+static void
+propagate_binfo_offsets (binfo, offset, t)
+ tree binfo;
+ tree offset;
+ tree t;
+{
+ int i;
+ tree primary_binfo;
- /* Now we have the nearly final fieldlist for the data fields. Record it,
- then lay out the structure or union (including the fields). */
+ /* Update BINFO's offset. */
+ BINFO_OFFSET (binfo)
+ = convert (sizetype,
+ size_binop (PLUS_EXPR,
+ convert (ssizetype, BINFO_OFFSET (binfo)),
+ offset));
- TYPE_FIELDS (t) = fields;
+ /* Find the primary base class. */
+ primary_binfo = get_primary_binfo (binfo);
- if (n_baseclasses)
+ /* Scan all of the bases, pushing the BINFO_OFFSET adjust
+ downwards. */
+ for (i = -1; i < BINFO_N_BASETYPES (binfo); ++i)
{
- last_x = build_base_fields (t);
+ tree base_binfo;
+
+ /* On the first time through the loop, do the primary base.
+ Because the primary base need not be an immediate base, we
+ must handle the primary base specially. */
+ if (i == -1)
+ {
+ if (!primary_binfo)
+ continue;
- /* If all our bases are empty, we can be empty too. */
- for (x = last_x; empty && x; x = TREE_CHAIN (x))
- if (DECL_SIZE (x) != integer_zero_node)
- empty = 0;
+ base_binfo = primary_binfo;
+ }
+ else
+ {
+ base_binfo = BINFO_BASETYPE (binfo, i);
+ /* Don't do the primary base twice. */
+ if (base_binfo == primary_binfo)
+ continue;
+ }
+
+ /* Skip virtual bases that aren't our canonical primary base. */
+ if (TREE_VIA_VIRTUAL (base_binfo)
+ && (BINFO_PRIMARY_BASE_OF (base_binfo) != binfo
+ || base_binfo != binfo_for_vbase (BINFO_TYPE (base_binfo), t)))
+ continue;
+
+ propagate_binfo_offsets (base_binfo, offset, t);
}
+}
- /* CLASSTYPE_INLINE_FRIENDS is really TYPE_NONCOPIED_PARTS. Thus,
- we have to save this before we start modifying
- TYPE_NONCOPIED_PARTS. */
- inline_friends = CLASSTYPE_INLINE_FRIENDS (t);
- CLASSTYPE_INLINE_FRIENDS (t) = NULL_TREE;
+/* Called via dfs_walk from layout_virtual bases. */
- if (empty)
+static tree
+dfs_set_offset_for_unshared_vbases (binfo, data)
+ tree binfo;
+ void *data;
+{
+ /* If this is a virtual base, make sure it has the same offset as
+ the shared copy. If it's a primary base, then we know it's
+ correct. */
+ if (TREE_VIA_VIRTUAL (binfo))
{
- /* C++: do not let empty structures exist. */
- tree decl = build_lang_field_decl
- (FIELD_DECL, NULL_TREE, char_type_node);
- TREE_CHAIN (decl) = fields;
- TYPE_FIELDS (t) = decl;
- TYPE_NONCOPIED_PARTS (t)
- = tree_cons (NULL_TREE, decl, TYPE_NONCOPIED_PARTS (t));
- TREE_STATIC (TYPE_NONCOPIED_PARTS (t)) = 1;
+ tree t = (tree) data;
+ tree vbase;
+ tree offset;
+
+ vbase = binfo_for_vbase (BINFO_TYPE (binfo), t);
+ if (vbase != binfo)
+ {
+ offset = size_diffop (BINFO_OFFSET (vbase), BINFO_OFFSET (binfo));
+ propagate_binfo_offsets (binfo, offset, t);
+ }
}
- if (n_baseclasses)
- TYPE_FIELDS (t) = chainon (last_x, TYPE_FIELDS (t));
-
- layout_type (t);
+ return NULL_TREE;
+}
- /* Remember the size and alignment of the class before adding
- the virtual bases. */
- if (empty && flag_new_abi)
- CLASSTYPE_SIZE (t) = integer_zero_node;
- else if (flag_new_abi && TYPE_HAS_COMPLEX_INIT_REF (t)
- && TYPE_HAS_COMPLEX_ASSIGN_REF (t))
- CLASSTYPE_SIZE (t) = TYPE_BINFO_SIZE (t);
- else
- CLASSTYPE_SIZE (t) = TYPE_SIZE (t);
- CLASSTYPE_ALIGN (t) = TYPE_ALIGN (t);
+/* Set BINFO_OFFSET for all of the virtual bases for T. Update
+ TYPE_ALIGN and TYPE_SIZE for T. OFFSETS gives the location of
+ empty subobjects of T. */
- finish_struct_anon (t);
+static void
+layout_virtual_bases (t, offsets)
+ tree t;
+ splay_tree offsets;
+{
+ tree vbases;
+ unsigned HOST_WIDE_INT dsize;
+ unsigned HOST_WIDE_INT eoc;
- /* Set the TYPE_DECL for this type to contain the right
- value for DECL_OFFSET, so that we can use it as part
- of a COMPONENT_REF for multiple inheritance. */
+ if (CLASSTYPE_N_BASECLASSES (t) == 0)
+ return;
- layout_decl (TYPE_MAIN_DECL (t), 0);
+#ifdef STRUCTURE_SIZE_BOUNDARY
+ /* Packed structures don't need to have minimum size. */
+ if (! TYPE_PACKED (t))
+ TYPE_ALIGN (t) = MAX (TYPE_ALIGN (t), STRUCTURE_SIZE_BOUNDARY);
+#endif
- /* Now fix up any virtual base class types that we left lying
- around. We must get these done before we try to lay out the
- virtual function table. */
- pending_hard_virtuals = nreverse (pending_hard_virtuals);
+ /* DSIZE is the size of the class without the virtual bases. */
+ dsize = tree_low_cst (TYPE_SIZE (t), 1);
- if (n_baseclasses)
- /* layout_basetypes will remove the base subobject fields. */
- max_has_virtual = layout_basetypes (t, max_has_virtual);
- if (empty)
- TYPE_FIELDS (t) = fields;
-
- my_friendly_assert (TYPE_FIELDS (t) == fields, 981117);
-
- /* Delete all zero-width bit-fields from the front of the fieldlist */
- while (fields && DECL_C_BIT_FIELD (fields)
- && DECL_INITIAL (fields))
- fields = TREE_CHAIN (fields);
- /* Delete all such fields from the rest of the fields. */
- for (x = fields; x;)
- {
- if (TREE_CHAIN (x) && DECL_C_BIT_FIELD (TREE_CHAIN (x))
- && DECL_INITIAL (TREE_CHAIN (x)))
- TREE_CHAIN (x) = TREE_CHAIN (TREE_CHAIN (x));
- else
- x = TREE_CHAIN (x);
- }
- TYPE_FIELDS (t) = fields;
+ /* Make every class have alignment of at least one. */
+ TYPE_ALIGN (t) = MAX (TYPE_ALIGN (t), BITS_PER_UNIT);
- if (TYPE_USES_VIRTUAL_BASECLASSES (t))
+ /* Go through the virtual bases, allocating space for each virtual
+ base that is not already a primary base class. These are
+ allocated in inheritance graph order. */
+ for (vbases = TYPE_BINFO (t);
+ vbases;
+ vbases = TREE_CHAIN (vbases))
{
- tree vbases;
+ tree vbase;
- vbases = CLASSTYPE_VBASECLASSES (t);
-
- {
- /* Now fixup overrides of all functions in vtables from all
- direct or indirect virtual base classes. */
- tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
+ if (!TREE_VIA_VIRTUAL (vbases))
+ continue;
+ vbase = binfo_for_vbase (BINFO_TYPE (vbases), t);
- for (i = 0; i < n_baseclasses; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree basetype = BINFO_TYPE (base_binfo);
- tree vbases;
+ if (!BINFO_PRIMARY_P (vbase))
+ {
+ /* This virtual base is not a primary base of any class in the
+ hierarchy, so we have to add space for it. */
+ tree basetype;
+ unsigned int desired_align;
+
+ basetype = BINFO_TYPE (vbase);
+
+ desired_align = CLASSTYPE_ALIGN (basetype);
+ TYPE_ALIGN (t) = MAX (TYPE_ALIGN (t), desired_align);
+
+ /* Add padding so that we can put the virtual base class at an
+ appropriately aligned offset. */
+ dsize = CEIL (dsize, desired_align) * desired_align;
+
+ /* We try to squish empty virtual bases in just like
+ ordinary empty bases. */
+ if (is_empty_class (basetype))
+ layout_empty_base (vbase,
+ size_int (CEIL (dsize, BITS_PER_UNIT)),
+ offsets, t);
+ else
+ {
+ tree offset;
+
+ offset = ssize_int (CEIL (dsize, BITS_PER_UNIT));
+ offset = size_diffop (offset,
+ convert (ssizetype,
+ BINFO_OFFSET (vbase)));
+
+ /* And compute the offset of the virtual base. */
+ propagate_binfo_offsets (vbase, offset, t);
+ /* Every virtual baseclass takes a least a UNIT, so that
+ we can take it's address and get something different
+ for each base. */
+ dsize += MAX (BITS_PER_UNIT,
+ tree_low_cst (CLASSTYPE_SIZE (basetype), 0));
+ }
- vbases = CLASSTYPE_VBASECLASSES (basetype);
- while (vbases)
- {
- merge_overrides (binfo_member (BINFO_TYPE (vbases),
- CLASSTYPE_VBASECLASSES (t)),
- vbases, 1, t);
- vbases = TREE_CHAIN (vbases);
- }
- }
+ /* Keep track of the offsets assigned to this virtual base. */
+ record_subobject_offsets (BINFO_TYPE (vbase),
+ BINFO_OFFSET (vbase),
+ offsets,
+ /*vbases_p=*/0);
}
}
- /* Set up the DECL_FIELD_BITPOS of the vfield if we need to, as we
- might need to know it for setting up the offsets in the vtable
- (or in thunks) below. */
- if (vfield != NULL_TREE
- && DECL_FIELD_CONTEXT (vfield) != t)
+ /* Now, go through the TYPE_BINFO hierarchy, setting the
+ BINFO_OFFSETs correctly for all non-primary copies of the virtual
+ bases and their direct and indirect bases. The ambiguity checks
+ in lookup_base depend on the BINFO_OFFSETs being set
+ correctly. */
+ dfs_walk (TYPE_BINFO (t), dfs_set_offset_for_unshared_vbases, NULL, t);
+
+ /* If we had empty base classes that protruded beyond the end of the
+ class, we didn't update DSIZE above; we were hoping to overlay
+ multiple such bases at the same location. */
+ eoc = end_of_class (t, /*include_virtuals_p=*/1);
+ if (eoc * BITS_PER_UNIT > dsize)
+ dsize = eoc * BITS_PER_UNIT;
+
+ /* Now, make sure that the total size of the type is a multiple of
+ its alignment. */
+ dsize = CEIL (dsize, TYPE_ALIGN (t)) * TYPE_ALIGN (t);
+ TYPE_SIZE (t) = bitsize_int (dsize);
+ TYPE_SIZE_UNIT (t) = convert (sizetype,
+ size_binop (CEIL_DIV_EXPR, TYPE_SIZE (t),
+ bitsize_unit_node));
+
+ /* Check for ambiguous virtual bases. */
+ if (extra_warnings)
+ for (vbases = CLASSTYPE_VBASECLASSES (t);
+ vbases;
+ vbases = TREE_CHAIN (vbases))
+ {
+ tree basetype = BINFO_TYPE (TREE_VALUE (vbases));
+
+ if (!lookup_base (t, basetype, ba_ignore | ba_quiet, NULL))
+ warning ("virtual base `%T' inaccessible in `%T' due to ambiguity",
+ basetype, t);
+ }
+}
+
+/* Returns the offset of the byte just past the end of the base class
+ with the highest offset in T. If INCLUDE_VIRTUALS_P is zero, then
+ only non-virtual bases are included. */
+
+static unsigned HOST_WIDE_INT
+end_of_class (t, include_virtuals_p)
+ tree t;
+ int include_virtuals_p;
+{
+ unsigned HOST_WIDE_INT result = 0;
+ int i;
+
+ for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); ++i)
{
- tree binfo = get_binfo (DECL_FIELD_CONTEXT (vfield), t, 0);
- tree offset = BINFO_OFFSET (binfo);
+ tree base_binfo;
+ tree offset;
+ tree size;
+ unsigned HOST_WIDE_INT end_of_base;
- vfield = copy_node (vfield);
- copy_lang_decl (vfield);
+ base_binfo = BINFO_BASETYPE (TYPE_BINFO (t), i);
- if (! integer_zerop (offset))
- offset = size_binop (MULT_EXPR, offset, size_int (BITS_PER_UNIT));
- DECL_FIELD_CONTEXT (vfield) = t;
- DECL_CLASS_CONTEXT (vfield) = t;
- DECL_FIELD_BITPOS (vfield)
- = size_binop (PLUS_EXPR, offset, DECL_FIELD_BITPOS (vfield));
- CLASSTYPE_VFIELD (t) = vfield;
+ if (!include_virtuals_p
+ && TREE_VIA_VIRTUAL (base_binfo)
+ && !BINFO_PRIMARY_P (base_binfo))
+ continue;
+
+ if (is_empty_class (BINFO_TYPE (base_binfo)))
+ /* An empty class has zero CLASSTYPE_SIZE_UNIT, but we need to
+ allocate some space for it. It cannot have virtual bases,
+ so TYPE_SIZE_UNIT is fine. */
+ size = TYPE_SIZE_UNIT (BINFO_TYPE (base_binfo));
+ else
+ size = CLASSTYPE_SIZE_UNIT (BINFO_TYPE (base_binfo));
+ offset = size_binop (PLUS_EXPR,
+ BINFO_OFFSET (base_binfo),
+ size);
+ end_of_base = tree_low_cst (offset, /*pos=*/1);
+ if (end_of_base > result)
+ result = end_of_base;
}
-
-#ifdef NOTQUITE
- cp_warning ("Doing hard virtuals for %T...", t);
-#endif
- if (has_virtual > max_has_virtual)
- max_has_virtual = has_virtual;
- if (max_has_virtual > 0)
- TYPE_VIRTUAL_P (t) = 1;
+ return result;
+}
+
+/* Warn about direct bases of T that are inaccessible because they are
+ ambiguous. For example:
+
+ struct S {};
+ struct T : public S {};
+ struct U : public S, public T {};
- if (flag_rtti && TYPE_VIRTUAL_P (t) && !pending_hard_virtuals)
- modify_all_vtables (t, NULL_TREE, NULL_TREE);
+ Here, `(S*) new U' is not allowed because there are two `S'
+ subobjects of U. */
- while (pending_hard_virtuals)
+static void
+warn_about_ambiguous_direct_bases (t)
+ tree t;
+{
+ int i;
+
+ for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); ++i)
{
- modify_all_vtables (t,
- TREE_PURPOSE (pending_hard_virtuals),
- TREE_VALUE (pending_hard_virtuals));
- pending_hard_virtuals = TREE_CHAIN (pending_hard_virtuals);
+ tree basetype = TYPE_BINFO_BASETYPE (t, i);
+
+ if (!lookup_base (t, basetype, ba_ignore | ba_quiet, NULL))
+ warning ("direct base `%T' inaccessible in `%T' due to ambiguity",
+ basetype, t);
}
-
- if (TYPE_USES_VIRTUAL_BASECLASSES (t))
- {
- tree vbases;
- /* Now fixup any virtual function entries from virtual bases
- that have different deltas. This has to come after we do the
- pending hard virtuals, as we might have a function that comes
- from multiple virtual base instances that is only overridden
- by a hard virtual above. */
- vbases = CLASSTYPE_VBASECLASSES (t);
- while (vbases)
- {
- /* We might be able to shorten the amount of work we do by
- only doing this for vtables that come from virtual bases
- that have differing offsets, but don't want to miss any
- entries. */
- fixup_vtable_deltas (vbases, 1, t);
- vbases = TREE_CHAIN (vbases);
- }
+}
+
+/* Compare two INTEGER_CSTs K1 and K2. */
+
+static int
+splay_tree_compare_integer_csts (k1, k2)
+ splay_tree_key k1;
+ splay_tree_key k2;
+{
+ return tree_int_cst_compare ((tree) k1, (tree) k2);
+}
+
+/* Calculate the TYPE_SIZE, TYPE_ALIGN, etc for T. Calculate
+ BINFO_OFFSETs for all of the base-classes. Position the vtable
+ pointer. */
+
+static void
+layout_class_type (t, empty_p, vfuns_p,
+ new_virtuals_p, overridden_virtuals_p)
+ tree t;
+ int *empty_p;
+ int *vfuns_p;
+ tree *new_virtuals_p;
+ tree *overridden_virtuals_p;
+{
+ tree non_static_data_members;
+ tree field;
+ tree vptr;
+ record_layout_info rli;
+ unsigned HOST_WIDE_INT eoc;
+ /* Maps offsets (represented as INTEGER_CSTs) to a TREE_LIST of
+ types that appear at that offset. */
+ splay_tree empty_base_offsets;
+
+ /* Keep track of the first non-static data member. */
+ non_static_data_members = TYPE_FIELDS (t);
+
+ /* Start laying out the record. */
+ rli = start_record_layout (t);
+
+ /* If possible, we reuse the virtual function table pointer from one
+ of our base classes. */
+ determine_primary_base (t, vfuns_p);
+
+ /* Create a pointer to our virtual function table. */
+ vptr = create_vtable_ptr (t, empty_p, vfuns_p,
+ new_virtuals_p, overridden_virtuals_p);
+
+ /* The vptr is always the first thing in the class. */
+ if (vptr)
+ {
+ TYPE_FIELDS (t) = chainon (vptr, TYPE_FIELDS (t));
+ place_field (rli, vptr);
}
- /* Under our model of GC, every C++ class gets its own virtual
- function table, at least virtually. */
- if (pending_virtuals)
+ /* Build FIELD_DECLs for all of the non-virtual base-types. */
+ empty_base_offsets = splay_tree_new (splay_tree_compare_integer_csts,
+ NULL, NULL);
+ if (build_base_fields (rli, empty_p, empty_base_offsets, t))
+ CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
+
+ /* Layout the non-static data members. */
+ for (field = non_static_data_members; field; field = TREE_CHAIN (field))
{
- pending_virtuals = nreverse (pending_virtuals);
- /* We must enter these virtuals into the table. */
- if (first_vfn_base_index < 0)
+ tree type;
+ tree padding;
+
+ /* We still pass things that aren't non-static data members to
+ the back-end, in case it wants to do something with them. */
+ if (TREE_CODE (field) != FIELD_DECL)
{
- if (! CLASSTYPE_COM_INTERFACE (t))
- {
- /* The second slot is for the tdesc pointer when thunks are used. */
- if (flag_vtable_thunks)
- pending_virtuals = tree_cons (NULL_TREE, NULL_TREE, pending_virtuals);
+ place_field (rli, field);
+ continue;
+ }
- /* The first slot is for the rtti offset. */
- pending_virtuals = tree_cons (NULL_TREE, NULL_TREE, pending_virtuals);
+ type = TREE_TYPE (field);
- set_rtti_entry (pending_virtuals,
- convert (ssizetype, integer_zero_node), t);
- }
- build_vtable (NULL_TREE, t);
+ /* If this field is a bit-field whose width is greater than its
+ type, then there are some special rules for allocating
+ it. */
+ if (DECL_C_BIT_FIELD (field)
+ && INT_CST_LT (TYPE_SIZE (type), DECL_SIZE (field)))
+ {
+ integer_type_kind itk;
+ tree integer_type;
+
+ /* We must allocate the bits as if suitably aligned for the
+ longest integer type that fits in this many bits. type
+ of the field. Then, we are supposed to use the left over
+ bits as additional padding. */
+ for (itk = itk_char; itk != itk_none; ++itk)
+ if (INT_CST_LT (DECL_SIZE (field),
+ TYPE_SIZE (integer_types[itk])))
+ break;
+
+ /* ITK now indicates a type that is too large for the
+ field. We have to back up by one to find the largest
+ type that fits. */
+ integer_type = integer_types[itk - 1];
+ padding = size_binop (MINUS_EXPR, DECL_SIZE (field),
+ TYPE_SIZE (integer_type));
+ DECL_SIZE (field) = TYPE_SIZE (integer_type);
+ DECL_ALIGN (field) = TYPE_ALIGN (integer_type);
+ DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (integer_type);
}
else
- {
- /* Here we know enough to change the type of our virtual
- function table, but we will wait until later this function. */
+ padding = NULL_TREE;
- if (! BINFO_NEW_VTABLE_MARKED (TYPE_BINFO (t)))
- build_vtable (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (t), first_vfn_base_index), t);
+ layout_nonempty_base_or_field (rli, field, NULL_TREE,
+ empty_base_offsets, t);
+
+ /* If we needed additional padding after this field, add it
+ now. */
+ if (padding)
+ {
+ tree padding_field;
+
+ padding_field = build_decl (FIELD_DECL,
+ NULL_TREE,
+ char_type_node);
+ DECL_BIT_FIELD (padding_field) = 1;
+ DECL_SIZE (padding_field) = padding;
+ DECL_ALIGN (padding_field) = 1;
+ DECL_USER_ALIGN (padding_field) = 0;
+ layout_nonempty_base_or_field (rli, padding_field,
+ NULL_TREE,
+ empty_base_offsets, t);
}
+ }
+
+ /* It might be the case that we grew the class to allocate a
+ zero-sized base class. That won't be reflected in RLI, yet,
+ because we are willing to overlay multiple bases at the same
+ offset. However, now we need to make sure that RLI is big enough
+ to reflect the entire class. */
+ eoc = end_of_class (t, /*include_virtuals_p=*/0);
+ if (TREE_CODE (rli_size_unit_so_far (rli)) == INTEGER_CST
+ && compare_tree_int (rli_size_unit_so_far (rli), eoc) < 0)
+ {
+ rli->offset = size_binop (MAX_EXPR, rli->offset, size_int (eoc));
+ rli->bitpos = bitsize_zero_node;
+ }
+
+ /* We make all structures have at least one element, so that they
+ have non-zero size. The class may be empty even if it has
+ basetypes. Therefore, we add the fake field after all the other
+ fields; if there are already FIELD_DECLs on the list, their
+ offsets will not be disturbed. */
+ if (!eoc && *empty_p)
+ {
+ tree padding;
+
+ padding = build_decl (FIELD_DECL, NULL_TREE, char_type_node);
+ place_field (rli, padding);
+ }
+
+ /* Let the back-end lay out the type. Note that at this point we
+ have only included non-virtual base-classes; we will lay out the
+ virtual base classes later. So, the TYPE_SIZE/TYPE_ALIGN after
+ this call are not necessarily correct; they are just the size and
+ alignment when no virtual base clases are used. */
+ finish_record_layout (rli);
+
+ /* Delete all zero-width bit-fields from the list of fields. Now
+ that the type is laid out they are no longer important. */
+ remove_zero_width_bit_fields (t);
+
+ /* Remember the size and alignment of the class before adding
+ the virtual bases. */
+ if (*empty_p)
+ {
+ CLASSTYPE_SIZE (t) = bitsize_zero_node;
+ CLASSTYPE_SIZE_UNIT (t) = size_zero_node;
+ }
+ else
+ {
+ CLASSTYPE_SIZE (t) = TYPE_BINFO_SIZE (t);
+ CLASSTYPE_SIZE_UNIT (t) = TYPE_BINFO_SIZE_UNIT (t);
+ }
+
+ CLASSTYPE_ALIGN (t) = TYPE_ALIGN (t);
+ CLASSTYPE_USER_ALIGN (t) = TYPE_USER_ALIGN (t);
+
+ /* Set the TYPE_DECL for this type to contain the right
+ value for DECL_OFFSET, so that we can use it as part
+ of a COMPONENT_REF for multiple inheritance. */
+ layout_decl (TYPE_MAIN_DECL (t), 0);
+
+ /* Now fix up any virtual base class types that we left lying
+ around. We must get these done before we try to lay out the
+ virtual function table. As a side-effect, this will remove the
+ base subobject fields. */
+ layout_virtual_bases (t, empty_base_offsets);
+
+ /* Warn about direct bases that can't be talked about due to
+ ambiguity. */
+ warn_about_ambiguous_direct_bases (t);
+
+ /* Clean up. */
+ splay_tree_delete (empty_base_offsets);
+}
+
+/* Create a RECORD_TYPE or UNION_TYPE node for a C struct or union declaration
+ (or C++ class declaration).
+
+ For C++, we must handle the building of derived classes.
+ Also, C++ allows static class members. The way that this is
+ handled is to keep the field name where it is (as the DECL_NAME
+ of the field), and place the overloaded decl in the bit position
+ of the field. layout_record and layout_union will know about this.
+
+ More C++ hair: inline functions have text in their
+ DECL_PENDING_INLINE_INFO nodes which must somehow be parsed into
+ meaningful tree structure. After the struct has been laid out, set
+ things up so that this can happen.
+
+ And still more: virtual functions. In the case of single inheritance,
+ when a new virtual function is seen which redefines a virtual function
+ from the base class, the new virtual function is placed into
+ the virtual function table at exactly the same address that
+ it had in the base class. When this is extended to multiple
+ inheritance, the same thing happens, except that multiple virtual
+ function tables must be maintained. The first virtual function
+ table is treated in exactly the same way as in the case of single
+ inheritance. Additional virtual function tables have different
+ DELTAs, which tell how to adjust `this' to point to the right thing.
+
+ ATTRIBUTES is the set of decl attributes to be applied, if any. */
+
+void
+finish_struct_1 (t)
+ tree t;
+{
+ tree x;
+ int vfuns;
+ /* The NEW_VIRTUALS is a TREE_LIST. The TREE_VALUE of each node is
+ a FUNCTION_DECL. Each of these functions is a virtual function
+ declared in T that does not override any virtual function from a
+ base class. */
+ tree new_virtuals = NULL_TREE;
+ /* The OVERRIDDEN_VIRTUALS list is like the NEW_VIRTUALS list,
+ except that each declaration here overrides the declaration from
+ a base class. */
+ tree overridden_virtuals = NULL_TREE;
+ int n_fields = 0;
+ tree vfield;
+ int empty = 1;
+
+ if (COMPLETE_TYPE_P (t))
+ {
+ if (IS_AGGR_TYPE (t))
+ error ("redefinition of `%#T'", t);
+ else
+ abort ();
+ popclass ();
+ return;
+ }
+
+ GNU_xref_decl (current_function_decl, t);
+
+ /* If this type was previously laid out as a forward reference,
+ make sure we lay it out again. */
+ TYPE_SIZE (t) = NULL_TREE;
+ CLASSTYPE_GOT_SEMICOLON (t) = 0;
+ CLASSTYPE_PRIMARY_BINFO (t) = NULL_TREE;
+ vfuns = 0;
+ CLASSTYPE_RTTI (t) = NULL_TREE;
+
+ fixup_inline_methods (t);
+
+ /* Do end-of-class semantic processing: checking the validity of the
+ bases and members and add implicitly generated methods. */
+ check_bases_and_members (t, &empty);
+
+ /* Layout the class itself. */
+ layout_class_type (t, &empty, &vfuns,
+ &new_virtuals, &overridden_virtuals);
+
+ /* Make sure that we get our own copy of the vfield FIELD_DECL. */
+ vfield = TYPE_VFIELD (t);
+ if (vfield && CLASSTYPE_HAS_PRIMARY_BASE_P (t))
+ {
+ tree primary = CLASSTYPE_PRIMARY_BINFO (t);
+
+ my_friendly_assert (same_type_p (DECL_FIELD_CONTEXT (vfield),
+ BINFO_TYPE (primary)),
+ 20010726);
+ /* The vtable better be at the start. */
+ my_friendly_assert (integer_zerop (DECL_FIELD_OFFSET (vfield)),
+ 20010726);
+ my_friendly_assert (integer_zerop (BINFO_OFFSET (primary)),
+ 20010726);
+
+ vfield = copy_decl (vfield);
+ DECL_FIELD_CONTEXT (vfield) = t;
+ TYPE_VFIELD (t) = vfield;
+ }
+ else
+ my_friendly_assert (!vfield || DECL_FIELD_CONTEXT (vfield) == t, 20010726);
+
+ overridden_virtuals
+ = modify_all_vtables (t, &vfuns, nreverse (overridden_virtuals));
+
+ /* If we created a new vtbl pointer for this class, add it to the
+ list. */
+ if (TYPE_VFIELD (t) && !CLASSTYPE_HAS_PRIMARY_BASE_P (t))
+ CLASSTYPE_VFIELDS (t)
+ = chainon (CLASSTYPE_VFIELDS (t), build_tree_list (NULL_TREE, t));
+
+ /* If necessary, create the primary vtable for this class. */
+ if (new_virtuals || overridden_virtuals || TYPE_CONTAINS_VPTR_P (t))
+ {
+ new_virtuals = nreverse (new_virtuals);
+ /* We must enter these virtuals into the table. */
+ if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
+ build_primary_vtable (NULL_TREE, t);
+ else if (! BINFO_NEW_VTABLE_MARKED (TYPE_BINFO (t), t))
+ /* Here we know enough to change the type of our virtual
+ function table, but we will wait until later this function. */
+ build_primary_vtable (CLASSTYPE_PRIMARY_BINFO (t), t);
/* If this type has basetypes with constructors, then those
constructors might clobber the virtual function table. But
@@ -4285,80 +5119,66 @@ finish_struct_1 (t, warn_anon)
CLASSTYPE_NEEDS_VIRTUAL_REINIT (t) = 1;
}
- else if (first_vfn_base_index >= 0)
+ /* If we didn't need a new vtable, see if we should copy one from
+ the base. */
+ else if (CLASSTYPE_HAS_PRIMARY_BASE_P (t))
{
- tree binfo = TREE_VEC_ELT (TYPE_BINFO_BASETYPES (t), first_vfn_base_index);
- /* This class contributes nothing new to the virtual function
- table. However, it may have declared functions which
- went into the virtual function table "inherited" from the
- base class. If so, we grab a copy of those updated functions,
- and pretend they are ours. */
+ tree binfo = CLASSTYPE_PRIMARY_BINFO (t);
- /* See if we should steal the virtual info from base class. */
- if (TYPE_BINFO_VTABLE (t) == NULL_TREE)
- TYPE_BINFO_VTABLE (t) = BINFO_VTABLE (binfo);
- if (TYPE_BINFO_VIRTUALS (t) == NULL_TREE)
- TYPE_BINFO_VIRTUALS (t) = BINFO_VIRTUALS (binfo);
+ /* If this class uses a different vtable than its primary base
+ then when we will need to initialize our vptr after the base
+ class constructor runs. */
if (TYPE_BINFO_VTABLE (t) != BINFO_VTABLE (binfo))
CLASSTYPE_NEEDS_VIRTUAL_REINIT (t) = 1;
}
- if (max_has_virtual || first_vfn_base_index >= 0)
- {
- CLASSTYPE_VSIZE (t) = has_virtual;
- if (first_vfn_base_index >= 0)
- {
- if (pending_virtuals)
- TYPE_BINFO_VIRTUALS (t) = chainon (TYPE_BINFO_VIRTUALS (t),
- pending_virtuals);
- }
- else if (has_virtual)
- {
- TYPE_BINFO_VIRTUALS (t) = pending_virtuals;
- DECL_VIRTUAL_P (TYPE_BINFO_VTABLE (t)) = 1;
- }
- }
-
- /* Now lay out the virtual function table. */
- if (has_virtual)
+ if (TYPE_CONTAINS_VPTR_P (t))
{
- /* Use size_int so values are memoized in common cases. */
- tree itype = build_index_type (size_int (has_virtual));
- tree atype = build_cplus_array_type (vtable_entry_type, itype);
-
- layout_type (atype);
+ if (TYPE_BINFO_VTABLE (t))
+ my_friendly_assert (DECL_VIRTUAL_P (TYPE_BINFO_VTABLE (t)),
+ 20000116);
+ if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
+ my_friendly_assert (TYPE_BINFO_VIRTUALS (t) == NULL_TREE,
+ 20000116);
- CLASSTYPE_VFIELD (t) = vfield;
-
- /* We may have to grow the vtable. */
- if (TREE_TYPE (TYPE_BINFO_VTABLE (t)) != atype)
- {
- TREE_TYPE (TYPE_BINFO_VTABLE (t)) = atype;
- DECL_SIZE (TYPE_BINFO_VTABLE (t)) = 0;
- layout_decl (TYPE_BINFO_VTABLE (t), 0);
- /* At one time the vtable info was grabbed 2 words at a time. This
- fails on sparc unless you have 8-byte alignment. (tiemann) */
- DECL_ALIGN (TYPE_BINFO_VTABLE (t))
- = MAX (TYPE_ALIGN (double_type_node),
- DECL_ALIGN (TYPE_BINFO_VTABLE (t)));
- }
+ CLASSTYPE_VSIZE (t) = vfuns;
+ /* Entries for virtual functions defined in the primary base are
+ followed by entries for new functions unique to this class. */
+ TYPE_BINFO_VIRTUALS (t)
+ = chainon (TYPE_BINFO_VIRTUALS (t), new_virtuals);
+ /* Finally, add entries for functions that override virtuals
+ from non-primary bases. */
+ TYPE_BINFO_VIRTUALS (t)
+ = chainon (TYPE_BINFO_VIRTUALS (t), overridden_virtuals);
}
- else if (first_vfn_base_index >= 0)
- CLASSTYPE_VFIELD (t) = vfield;
- CLASSTYPE_VFIELDS (t) = vfields;
- finish_struct_bits (t, max_has_virtual);
+ finish_struct_bits (t);
/* Complete the rtl for any static member objects of the type we're
working on. */
- for (x = fields; x; x = TREE_CHAIN (x))
+ for (x = TYPE_FIELDS (t); x; x = TREE_CHAIN (x))
+ if (TREE_CODE (x) == VAR_DECL && TREE_STATIC (x)
+ && TREE_TYPE (x) == t)
+ DECL_MODE (x) = TYPE_MODE (t);
+
+ /* Done with FIELDS...now decide whether to sort these for
+ faster lookups later.
+
+ The C front-end only does this when n_fields > 15. We use
+ a smaller number because most searches fail (succeeding
+ ultimately as the search bores through the inheritance
+ hierarchy), and we want this failure to occur quickly. */
+
+ n_fields = count_fields (TYPE_FIELDS (t));
+ if (n_fields > 7)
{
- if (TREE_CODE (x) == VAR_DECL && TREE_STATIC (x)
- && TREE_TYPE (x) == t)
- {
- DECL_MODE (x) = TYPE_MODE (t);
- make_decl_rtl (x, NULL, 0);
- }
+ tree field_vec = make_tree_vec (n_fields);
+ add_fields_to_vec (TYPE_FIELDS (t), field_vec, 0);
+ qsort (&TREE_VEC_ELT (field_vec, 0), n_fields, sizeof (tree),
+ (int (*)(const void *, const void *))field_decl_cmp);
+ if (! DECL_LANG_SPECIFIC (TYPE_MAIN_DECL (t)))
+ retrofit_lang_decl (TYPE_MAIN_DECL (t));
+ DECL_SORTED_FIELDS (TYPE_MAIN_DECL (t)) = field_vec;
}
if (TYPE_HAS_CONSTRUCTOR (t))
@@ -4376,108 +5196,28 @@ finish_struct_1 (t, warn_anon)
}
}
- /* Write out inline function definitions. */
- do_inline_function_hair (t, inline_friends);
-
- if (CLASSTYPE_VSIZE (t) != 0)
- {
-#if 0
- /* This is now done above. */
- if (DECL_FIELD_CONTEXT (vfield) != t)
- {
- tree binfo = get_binfo (DECL_FIELD_CONTEXT (vfield), t, 0);
- tree offset = BINFO_OFFSET (binfo);
-
- vfield = copy_node (vfield);
- copy_lang_decl (vfield);
-
- if (! integer_zerop (offset))
- offset = size_binop (MULT_EXPR, offset, size_int (BITS_PER_UNIT));
- DECL_FIELD_CONTEXT (vfield) = t;
- DECL_CLASS_CONTEXT (vfield) = t;
- DECL_FIELD_BITPOS (vfield)
- = size_binop (PLUS_EXPR, offset, DECL_FIELD_BITPOS (vfield));
- CLASSTYPE_VFIELD (t) = vfield;
- }
-#endif
-
- /* In addition to this one, all the other vfields should be listed. */
- /* Before that can be done, we have to have FIELD_DECLs for them, and
- a place to find them. */
- TYPE_NONCOPIED_PARTS (t)
- = tree_cons (default_conversion (TYPE_BINFO_VTABLE (t)),
- vfield, TYPE_NONCOPIED_PARTS (t));
-
- if (warn_nonvdtor && TYPE_HAS_DESTRUCTOR (t)
- && DECL_VINDEX (TREE_VEC_ELT (method_vec, 1)) == NULL_TREE)
- cp_warning ("`%#T' has virtual functions but non-virtual destructor",
- t);
- }
-
/* Make the rtl for any new vtables we have created, and unmark
the base types we marked. */
- finish_vtbls (TYPE_BINFO (t), 1, t);
- /* If we use thunks, and have virtual bases, we might need to emit
- additional vtables. */
- if (flag_vtable_thunks && TYPE_USES_PVBASES (t))
- finish_ctor_vtables (t);
- hack_incomplete_structures (t);
+ finish_vtbls (t);
+
+ /* Build the VTT for T. */
+ build_vtt (t);
-#if 0
- if (TYPE_NAME (t) && TYPE_IDENTIFIER (t))
- undo_template_name_overload (TYPE_IDENTIFIER (t), 1);
-#endif
+ if (warn_nonvdtor && TYPE_POLYMORPHIC_P (t) && TYPE_HAS_DESTRUCTOR (t)
+ && DECL_VINDEX (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), 1)) == NULL_TREE)
+ warning ("`%#T' has virtual functions but non-virtual destructor", t);
- resume_momentary (old);
+ hack_incomplete_structures (t);
if (warn_overloaded_virtual)
warn_hidden (t);
-#if 0
- /* This has to be done after we have sorted out what to do with
- the enclosing type. */
- if (write_symbols != DWARF_DEBUG)
- {
- /* Be smarter about nested classes here. If a type is nested,
- only output it if we would output the enclosing type. */
- if (DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (t)))
- DECL_IGNORED_P (TYPE_MAIN_DECL (t)) = TREE_ASM_WRITTEN (TYPE_MAIN_DECL (t));
- }
-#endif
-
- if (write_symbols != DWARF_DEBUG && write_symbols != DWARF2_DEBUG)
- {
- /* If the type has methods, we want to think about cutting down
- the amount of symbol table stuff we output. The value stored in
- the TYPE_DECL's DECL_IGNORED_P slot is a first approximation.
- For example, if a member function is seen and we decide to
- write out that member function, then we can change the value
- of the DECL_IGNORED_P slot, and the type will be output when
- that member function's debug info is written out.
-
- We can't do this with DWARF, which does not support name
- references between translation units. */
- if (CLASSTYPE_METHOD_VEC (t))
- {
- /* Don't output full info about any type
- which does not have its implementation defined here. */
- if (CLASSTYPE_INTERFACE_ONLY (t))
- TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
-#if 0
- /* XXX do something about this. */
- else if (CLASSTYPE_INTERFACE_UNKNOWN (t))
- /* Only a first approximation! */
- TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
-#endif
- }
- else if (CLASSTYPE_INTERFACE_ONLY (t))
- TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
- }
+ maybe_suppress_debug_info (t);
+ dump_class_hierarchy (t);
+
/* Finish debugging output for this type. */
- rest_of_type_compilation (t, toplevel_bindings_p ());
-
- return;
+ rest_of_type_compilation (t, ! LOCAL_CLASS_P (t));
}
/* When T was built up, the member declarations were added in reverse
@@ -4516,69 +5256,47 @@ unreverse_member_declarations (t)
}
tree
-finish_struct (t, attributes, warn_anon)
+finish_struct (t, attributes)
tree t, attributes;
- int warn_anon;
{
- tree name = TYPE_NAME (t);
-
- if (TREE_CODE (name) == TYPE_DECL)
- {
- extern int lineno;
-
- DECL_SOURCE_FILE (name) = input_filename;
- /* For TYPE_DECL that are not typedefs (those marked with a line
- number of zero, we don't want to mark them as real typedefs.
- If this fails one needs to make sure real typedefs have a
- previous line number, even if it is wrong, that way the below
- will fill in the right line number. (mrs) */
- if (DECL_SOURCE_LINE (name))
- DECL_SOURCE_LINE (name) = lineno;
- name = DECL_NAME (name);
- }
-
- /* Append the fields we need for constructing signature tables. */
- if (IS_SIGNATURE (t))
- append_signature_fields (t);
+ const char *saved_filename = input_filename;
+ int saved_lineno = lineno;
/* Now that we've got all the field declarations, reverse everything
as necessary. */
unreverse_member_declarations (t);
- cplus_decl_attributes (t, attributes, NULL_TREE);
+ cplus_decl_attributes (&t, attributes, (int) ATTR_FLAG_TYPE_IN_PLACE);
+
+ /* Nadger the current location so that diagnostics point to the start of
+ the struct, not the end. */
+ input_filename = DECL_SOURCE_FILE (TYPE_NAME (t));
+ lineno = DECL_SOURCE_LINE (TYPE_NAME (t));
if (processing_template_decl)
{
- tree d = getdecls ();
- for (; d; d = TREE_CHAIN (d))
- {
- /* If this is the decl for the class or one of the template
- parms, we've seen all the injected decls. */
- if ((TREE_CODE (d) == TYPE_DECL
- && (TREE_TYPE (d) == t
- || TREE_CODE (TREE_TYPE (d)) == TEMPLATE_TYPE_PARM
- || TREE_CODE (TREE_TYPE (d)) == TEMPLATE_TEMPLATE_PARM))
- || TREE_CODE (d) == CONST_DECL)
- break;
- /* Don't inject cache decls. */
- else if (IDENTIFIER_TEMPLATE (DECL_NAME (d)))
- continue;
- DECL_TEMPLATE_INJECT (CLASSTYPE_TI_TEMPLATE (t))
- = tree_cons (NULL_TREE, d,
- DECL_TEMPLATE_INJECT (CLASSTYPE_TI_TEMPLATE (t)));
- }
finish_struct_methods (t);
- TYPE_SIZE (t) = integer_zero_node;
- }
+ TYPE_SIZE (t) = bitsize_zero_node;
+ }
else
- finish_struct_1 (t, warn_anon);
+ finish_struct_1 (t);
+
+ input_filename = saved_filename;
+ lineno = saved_lineno;
TYPE_BEING_DEFINED (t) = 0;
if (current_class_type)
popclass ();
else
- error ("trying to finish struct, but kicked out due to previous parse errors.");
+ error ("trying to finish struct, but kicked out due to previous parse errors");
+
+ if (processing_template_decl)
+ {
+ tree scope = current_scope ();
+ if (scope && TREE_CODE (scope) == FUNCTION_DECL)
+ add_stmt (build_min (TAG_DEFN, t));
+ }
return t;
}
@@ -4588,21 +5306,24 @@ finish_struct (t, attributes, warn_anon)
or not.
*NONNULL is set iff INSTANCE can be known to be nonnull, regardless
- of our knowledge of its type. */
+ of our knowledge of its type. *NONNULL should be initialized
+ before this function is called. */
static tree
-fixed_type_or_null (instance, nonnull)
+fixed_type_or_null (instance, nonnull, cdtorp)
tree instance;
int *nonnull;
+ int *cdtorp;
{
switch (TREE_CODE (instance))
{
case INDIRECT_REF:
- /* Check that we are not going through a cast of some sort. */
- if (TREE_TYPE (instance)
- == TREE_TYPE (TREE_TYPE (TREE_OPERAND (instance, 0))))
- instance = TREE_OPERAND (instance, 0);
- /* fall through... */
+ if (POINTER_TYPE_P (TREE_TYPE (instance)))
+ return NULL_TREE;
+ else
+ return fixed_type_or_null (TREE_OPERAND (instance, 0),
+ nonnull, cdtorp);
+
case CALL_EXPR:
/* This is a call to a constructor, hence it's never zero. */
if (TREE_HAS_CONSTRUCTOR (instance))
@@ -4621,31 +5342,31 @@ fixed_type_or_null (instance, nonnull)
*nonnull = 1;
return TREE_TYPE (instance);
}
- return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull);
+ return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp);
case RTL_EXPR:
return NULL_TREE;
case PLUS_EXPR:
case MINUS_EXPR:
+ if (TREE_CODE (TREE_OPERAND (instance, 0)) == ADDR_EXPR)
+ return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp);
if (TREE_CODE (TREE_OPERAND (instance, 1)) == INTEGER_CST)
/* Propagate nonnull. */
- fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull);
- if (TREE_CODE (TREE_OPERAND (instance, 0)) == ADDR_EXPR)
- return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull);
+ fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp);
return NULL_TREE;
case NOP_EXPR:
case CONVERT_EXPR:
- return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull);
+ return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp);
case ADDR_EXPR:
if (nonnull)
*nonnull = 1;
- return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull);
+ return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp);
case COMPONENT_REF:
- return fixed_type_or_null (TREE_OPERAND (instance, 1), nonnull);
+ return fixed_type_or_null (TREE_OPERAND (instance, 1), nonnull, cdtorp);
case VAR_DECL:
case FIELD_DECL:
@@ -4665,21 +5386,25 @@ fixed_type_or_null (instance, nonnull)
*nonnull = 1;
return TREE_TYPE (instance);
}
- else if (nonnull)
- {
- if (instance == current_class_ptr
- && flag_this_is_variable <= 0)
- {
- /* Normally, 'this' must be non-null. */
- if (flag_this_is_variable == 0)
- *nonnull = 1;
-
- /* <0 means we're in a constructor and we know our type. */
- if (flag_this_is_variable < 0)
- return TREE_TYPE (TREE_TYPE (instance));
- }
- else if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE)
- /* Reference variables should be references to objects. */
+ else if (instance == current_class_ptr)
+ {
+ if (nonnull)
+ *nonnull = 1;
+
+ /* if we're in a ctor or dtor, we know our type. */
+ if (DECL_LANG_SPECIFIC (current_function_decl)
+ && (DECL_CONSTRUCTOR_P (current_function_decl)
+ || DECL_DESTRUCTOR_P (current_function_decl)))
+ {
+ if (cdtorp)
+ *cdtorp = 1;
+ return TREE_TYPE (TREE_TYPE (instance));
+ }
+ }
+ else if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE)
+ {
+ /* Reference variables should be references to objects. */
+ if (nonnull)
*nonnull = 1;
}
return NULL_TREE;
@@ -4689,15 +5414,19 @@ fixed_type_or_null (instance, nonnull)
}
}
-/* Return non-zero if the dynamic type of INSTANCE is known, and equivalent
- to the static type. We also handle the case where INSTANCE is really
- a pointer.
+/* Return non-zero if the dynamic type of INSTANCE is known, and
+ equivalent to the static type. We also handle the case where
+ INSTANCE is really a pointer. Return negative if this is a
+ ctor/dtor. There the dynamic type is known, but this might not be
+ the most derived base of the original object, and hence virtual
+ bases may not be layed out according to this type.
Used to determine whether the virtual function table is needed
or not.
*NONNULL is set iff INSTANCE can be known to be nonnull, regardless
- of our knowledge of its type. */
+ of our knowledge of its type. *NONNULL should be initialized
+ before this function is called. */
int
resolves_to_fixed_type_p (instance, nonnull)
@@ -4705,12 +5434,16 @@ resolves_to_fixed_type_p (instance, nonnull)
int *nonnull;
{
tree t = TREE_TYPE (instance);
- tree fixed = fixed_type_or_null (instance, nonnull);
+ int cdtorp = 0;
+
+ tree fixed = fixed_type_or_null (instance, nonnull, &cdtorp);
if (fixed == NULL_TREE)
return 0;
if (POINTER_TYPE_P (t))
t = TREE_TYPE (t);
- return same_type_p (TYPE_MAIN_VARIANT (t), TYPE_MAIN_VARIANT (fixed));
+ if (!same_type_ignoring_top_level_qualifiers_p (t, fixed))
+ return 0;
+ return cdtorp ? -1 : 1;
}
@@ -4722,25 +5455,21 @@ init_class_processing ()
current_class_stack
= (class_stack_node_t) xmalloc (current_class_stack_size
* sizeof (struct class_stack_node));
-
- current_lang_stacksize = 10;
- current_lang_base = (tree *)xmalloc(current_lang_stacksize * sizeof (tree));
- current_lang_stack = current_lang_base;
+ VARRAY_TREE_INIT (local_classes, 8, "local_classes");
+ ggc_add_tree_varray_root (&local_classes, 1);
access_default_node = build_int_2 (0, 0);
- access_public_node = build_int_2 (1, 0);
- access_protected_node = build_int_2 (2, 0);
- access_private_node = build_int_2 (3, 0);
+ access_public_node = build_int_2 (ak_public, 0);
+ access_protected_node = build_int_2 (ak_protected, 0);
+ access_private_node = build_int_2 (ak_private, 0);
access_default_virtual_node = build_int_2 (4, 0);
- access_public_virtual_node = build_int_2 (5, 0);
- access_protected_virtual_node = build_int_2 (6, 0);
- access_private_virtual_node = build_int_2 (7, 0);
+ access_public_virtual_node = build_int_2 (4 | ak_public, 0);
+ access_protected_virtual_node = build_int_2 (4 | ak_protected, 0);
+ access_private_virtual_node = build_int_2 (4 | ak_private, 0);
- /* Keep these values lying around. */
- base_layout_decl = build_lang_field_decl (FIELD_DECL, NULL_TREE, error_mark_node);
- TREE_TYPE (base_layout_decl) = make_node (RECORD_TYPE);
-
- gcc_obstack_init (&class_obstack);
+ ridpointers[(int) RID_PUBLIC] = access_public_node;
+ ridpointers[(int) RID_PRIVATE] = access_private_node;
+ ridpointers[(int) RID_PROTECTED] = access_protected_node;
}
/* Set current scope to NAME. CODE tells us if this is a
@@ -4815,17 +5544,11 @@ pushclass (type, modify)
if (previous_class_type != NULL_TREE
&& (type != previous_class_type
- || TYPE_SIZE (previous_class_type) == NULL_TREE)
+ || !COMPLETE_TYPE_P (previous_class_type))
&& current_class_depth == 1)
{
/* Forcibly remove any old class remnants. */
invalidate_class_lookup_cache ();
-
- /* Now, free the obstack on which we cached all the values. */
- if (class_cache_firstobj)
- obstack_free (&class_cache_obstack, class_cache_firstobj);
- class_cache_firstobj
- = (char*) obstack_finish (&class_cache_obstack);
}
/* If we're about to enter a nested class, clear
@@ -4835,11 +5558,6 @@ pushclass (type, modify)
pushlevel_class ();
-#if 0
- if (CLASSTYPE_TEMPLATE_INFO (type))
- overload_template_name (type);
-#endif
-
if (modify)
{
if (type != previous_class_type || current_class_depth > 1)
@@ -4880,12 +5598,11 @@ invalidate_class_lookup_cache ()
{
tree t;
- /* This code can be seen as a cache miss. When we've cached a
- class' scope's bindings and we can't use them, we need to reset
- them. This is it! */
+ /* The IDENTIFIER_CLASS_VALUEs are no longer valid. */
for (t = previous_class_values; t; t = TREE_CHAIN (t))
IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (t)) = NULL_TREE;
-
+
+ previous_class_values = NULL_TREE;
previous_class_type = NULL_TREE;
}
@@ -4895,7 +5612,7 @@ invalidate_class_lookup_cache ()
void
popclass ()
{
- poplevel (1, 0, 0);
+ poplevel_class ();
/* Since poplevel_class does the popping of class decls nowadays,
this really only frees the obstack used for these decls. */
pop_class_decls ();
@@ -4908,7 +5625,9 @@ popclass ()
splay_tree_delete (current_class_stack[current_class_depth].names_used);
}
-/* Returns 1 if current_class_type is either T or a nested type of T. */
+/* Returns 1 if current_class_type is either T or a nested type of T.
+ We start looking from 1 because entry 0 is from global scope, and has
+ no type. */
int
currently_open_class (t)
@@ -4917,12 +5636,32 @@ currently_open_class (t)
int i;
if (t == current_class_type)
return 1;
- for (i = 0; i < current_class_depth; ++i)
+ for (i = 1; i < current_class_depth; ++i)
if (current_class_stack [i].type == t)
return 1;
return 0;
}
+/* If either current_class_type or one of its enclosing classes are derived
+ from T, return the appropriate type. Used to determine how we found
+ something via unqualified lookup. */
+
+tree
+currently_open_derived_class (t)
+ tree t;
+{
+ int i;
+
+ if (DERIVED_FROM_P (t, current_class_type))
+ return current_class_type;
+
+ for (i = current_class_depth - 1; i > 0; --i)
+ if (DERIVED_FROM_P (t, current_class_stack[i].type))
+ return current_class_stack[i].type;
+
+ return NULL_TREE;
+}
+
/* When entering a class scope, all enclosing class scopes' names with
static meaning (static variables, static functions, types and enumerators)
have to be visible. This recursive function calls pushclass for all
@@ -4938,10 +5677,12 @@ push_nested_class (type, modify)
tree context;
/* A namespace might be passed in error cases, like A::B:C. */
- if (type == NULL_TREE || type == error_mark_node || ! IS_AGGR_TYPE (type)
+ if (type == NULL_TREE
+ || type == error_mark_node
|| TREE_CODE (type) == NAMESPACE_DECL
+ || ! IS_AGGR_TYPE (type)
|| TREE_CODE (type) == TEMPLATE_TYPE_PARM
- || TREE_CODE (type) == TEMPLATE_TEMPLATE_PARM)
+ || TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM)
return;
context = DECL_CONTEXT (TYPE_MAIN_DECL (type));
@@ -4963,6 +5704,14 @@ pop_nested_class ()
pop_nested_class ();
}
+/* Returns the number of extern "LANG" blocks we are nested within. */
+
+int
+current_lang_depth ()
+{
+ return VARRAY_ACTIVE_SIZE (current_lang_base);
+}
+
/* Set global variables CURRENT_LANG_NAME to appropriate value
so that behavior of name-mangling machinery is correct. */
@@ -4970,41 +5719,30 @@ void
push_lang_context (name)
tree name;
{
- *current_lang_stack++ = current_lang_name;
- if (current_lang_stack >= current_lang_base + current_lang_stacksize)
- {
- current_lang_base
- = (tree *)xrealloc (current_lang_base,
- sizeof (tree) * (current_lang_stacksize + 10));
- current_lang_stack = current_lang_base + current_lang_stacksize;
- current_lang_stacksize += 10;
- }
+ VARRAY_PUSH_TREE (current_lang_base, current_lang_name);
if (name == lang_name_cplusplus)
{
- strict_prototype = strict_prototypes_lang_cplusplus;
current_lang_name = name;
}
else if (name == lang_name_java)
{
- strict_prototype = strict_prototypes_lang_cplusplus;
current_lang_name = name;
/* DECL_IGNORED_P is initially set for these types, to avoid clutter.
(See record_builtin_java_type in decl.c.) However, that causes
incorrect debug entries if these types are actually used.
So we re-enable debug output after extern "Java". */
- DECL_IGNORED_P (java_byte_type_node) = 0;
- DECL_IGNORED_P (java_short_type_node) = 0;
- DECL_IGNORED_P (java_int_type_node) = 0;
- DECL_IGNORED_P (java_long_type_node) = 0;
- DECL_IGNORED_P (java_float_type_node) = 0;
- DECL_IGNORED_P (java_double_type_node) = 0;
- DECL_IGNORED_P (java_char_type_node) = 0;
- DECL_IGNORED_P (java_boolean_type_node) = 0;
+ DECL_IGNORED_P (TYPE_NAME (java_byte_type_node)) = 0;
+ DECL_IGNORED_P (TYPE_NAME (java_short_type_node)) = 0;
+ DECL_IGNORED_P (TYPE_NAME (java_int_type_node)) = 0;
+ DECL_IGNORED_P (TYPE_NAME (java_long_type_node)) = 0;
+ DECL_IGNORED_P (TYPE_NAME (java_float_type_node)) = 0;
+ DECL_IGNORED_P (TYPE_NAME (java_double_type_node)) = 0;
+ DECL_IGNORED_P (TYPE_NAME (java_char_type_node)) = 0;
+ DECL_IGNORED_P (TYPE_NAME (java_boolean_type_node)) = 0;
}
else if (name == lang_name_c)
{
- strict_prototype = strict_prototypes_lang_c;
current_lang_name = name;
}
else
@@ -5016,12 +5754,8 @@ push_lang_context (name)
void
pop_lang_context ()
{
- current_lang_name = *--current_lang_stack;
- if (current_lang_name == lang_name_cplusplus
- || current_lang_name == lang_name_java)
- strict_prototype = strict_prototypes_lang_cplusplus;
- else if (current_lang_name == lang_name_c)
- strict_prototype = strict_prototypes_lang_c;
+ current_lang_name = VARRAY_TOP_TREE (current_lang_base);
+ VARRAY_POP (current_lang_base);
}
/* Type instantiation routines. */
@@ -5029,19 +5763,22 @@ pop_lang_context ()
/* Given an OVERLOAD and a TARGET_TYPE, return the function that
matches the TARGET_TYPE. If there is no satisfactory match, return
error_mark_node, and issue an error message if COMPLAIN is
- non-zero. If TEMPLATE_ONLY, the name of the overloaded function
+ non-zero. Permit pointers to member function if PTRMEM is non-zero.
+ If TEMPLATE_ONLY, the name of the overloaded function
was a template-id, and EXPLICIT_TARGS are the explicitly provided
template arguments. */
static tree
resolve_address_of_overloaded_function (target_type,
overload,
- complain,
+ complain,
+ ptrmem,
template_only,
explicit_targs)
tree target_type;
tree overload;
int complain;
+ int ptrmem;
int template_only;
tree explicit_targs;
{
@@ -5086,10 +5823,12 @@ resolve_address_of_overloaded_function (target_type,
&& (TREE_CODE (TREE_TYPE (target_type))
== METHOD_TYPE)), 0);
+ if (TREE_CODE (overload) == COMPONENT_REF)
+ overload = TREE_OPERAND (overload, 1);
+
/* Check that the TARGET_TYPE is reasonable. */
if (TYPE_PTRFN_P (target_type))
- /* This is OK. */
- ;
+ /* This is OK. */;
else if (TYPE_PTRMEMFUNC_P (target_type))
/* This is OK, too. */
is_ptrmem = 1;
@@ -5103,8 +5842,9 @@ resolve_address_of_overloaded_function (target_type,
else
{
if (complain)
- cp_error("cannot resolve overloaded function `%D' based on conversion to type `%T'",
- DECL_NAME (OVL_FUNCTION (overload)), target_type);
+ error ("\
+cannot resolve overloaded function `%D' based on conversion to type `%T'",
+ DECL_NAME (OVL_FUNCTION (overload)), target_type);
return error_mark_node;
}
@@ -5139,7 +5879,7 @@ resolve_address_of_overloaded_function (target_type,
fntype = build_pointer_type (fntype);
if (can_convert_arg (target_type, fntype, fn))
- matches = scratch_tree_cons (fn, NULL_TREE, matches);
+ matches = tree_cons (fn, NULL_TREE, matches);
}
}
@@ -5150,6 +5890,7 @@ resolve_address_of_overloaded_function (target_type,
{
tree target_fn_type;
tree target_arg_types;
+ tree target_ret_type;
tree fns;
if (is_ptrmem)
@@ -5158,6 +5899,11 @@ resolve_address_of_overloaded_function (target_type,
else
target_fn_type = TREE_TYPE (target_type);
target_arg_types = TYPE_ARG_TYPES (target_fn_type);
+ target_ret_type = TREE_TYPE (target_fn_type);
+
+ /* Never do unification on the 'this' parameter. */
+ if (TREE_CODE (target_fn_type) == METHOD_TYPE)
+ target_arg_types = TREE_CHAIN (target_arg_types);
for (fns = overload; fns; fns = OVL_CHAIN (fns))
{
@@ -5177,10 +5923,10 @@ resolve_address_of_overloaded_function (target_type,
continue;
/* Try to do argument deduction. */
- targs = make_scratch_vec (DECL_NTPARMS (fn));
+ targs = make_tree_vec (DECL_NTPARMS (fn));
if (fn_type_unification (fn, explicit_targs, targs,
- target_arg_types, NULL_TREE,
- DEDUCE_EXACT) != 0)
+ target_arg_types, target_ret_type,
+ DEDUCE_EXACT, -1) != 0)
/* Argument deduction failed. */
continue;
@@ -5198,17 +5944,16 @@ resolve_address_of_overloaded_function (target_type,
else if (!is_reference)
instantiation_type = build_pointer_type (instantiation_type);
if (can_convert_arg (target_type, instantiation_type, instantiation))
- matches = scratch_tree_cons (instantiation, fn, matches);
+ matches = tree_cons (instantiation, fn, matches);
}
/* Now, remove all but the most specialized of the matches. */
if (matches)
{
- tree match = most_specialized_instantiation (matches,
- explicit_targs);
+ tree match = most_specialized_instantiation (matches);
if (match != error_mark_node)
- matches = scratch_tree_cons (match, NULL_TREE, NULL_TREE);
+ matches = tree_cons (match, NULL_TREE, NULL_TREE);
}
}
@@ -5218,7 +5963,7 @@ resolve_address_of_overloaded_function (target_type,
/* There were *no* matches. */
if (complain)
{
- cp_error ("no matches converting function `%D' to type `%#T'",
+ error ("no matches converting function `%D' to type `%#T'",
DECL_NAME (OVL_FUNCTION (overload)),
target_type);
@@ -5226,8 +5971,8 @@ resolve_address_of_overloaded_function (target_type,
TREE_VALUE slots, so we cons one up here (we're losing anyway,
so why be clever?). */
for (; overload; overload = OVL_NEXT (overload))
- matches = scratch_tree_cons (NULL_TREE, OVL_CURRENT (overload),
- matches);
+ matches = tree_cons (NULL_TREE, OVL_CURRENT (overload),
+ matches);
print_candidates (matches);
}
@@ -5241,7 +5986,7 @@ resolve_address_of_overloaded_function (target_type,
{
tree match;
- cp_error ("converting overloaded function `%D' to type `%#T' is ambiguous",
+ error ("converting overloaded function `%D' to type `%#T' is ambiguous",
DECL_NAME (OVL_FUNCTION (overload)),
target_type);
@@ -5259,6 +6004,21 @@ resolve_address_of_overloaded_function (target_type,
/* Good, exactly one match. Now, convert it to the correct type. */
fn = TREE_PURPOSE (matches);
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
+ && !ptrmem && !flag_ms_extensions)
+ {
+ static int explained;
+
+ if (!complain)
+ return error_mark_node;
+
+ pedwarn ("assuming pointer to member `%D'", fn);
+ if (!explained)
+ {
+ pedwarn ("(a pointer to member can only be formed with `&%E')", fn);
+ explained = 1;
+ }
+ }
mark_used (fn);
if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type))
@@ -5276,24 +6036,26 @@ resolve_address_of_overloaded_function (target_type,
/* This function will instantiate the type of the expression given in
RHS to match the type of LHSTYPE. If errors exist, then return
- error_mark_node. We only complain is COMPLAIN is set. If we are
- not complaining, never modify rhs, as overload resolution wants to
- try many possible instantiations, in hopes that at least one will
- work.
-
- FLAGS is a bitmask, as we see at the top of the function.
-
+ error_mark_node. FLAGS is a bit mask. If ITF_COMPLAIN is set, then
+ we complain on errors. If we are not complaining, never modify rhs,
+ as overload resolution wants to try many possible instantiations, in
+ the hope that at least one will work.
+
For non-recursive calls, LHSTYPE should be a function, pointer to
function, or a pointer to member function. */
tree
instantiate_type (lhstype, rhs, flags)
tree lhstype, rhs;
- int flags;
+ enum instantiate_type_flags flags;
{
- int complain = (flags & 1);
- int strict = (flags & 2) ? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT;
-
+ int complain = (flags & itf_complain);
+ int strict = (flags & itf_no_attributes)
+ ? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT;
+ int allow_ptrmem = flags & itf_ptrmem_ok;
+
+ flags &= ~itf_ptrmem_ok;
+
if (TREE_CODE (lhstype) == UNKNOWN_TYPE)
{
if (complain)
@@ -5306,7 +6068,7 @@ instantiate_type (lhstype, rhs, flags)
if (comptypes (lhstype, TREE_TYPE (rhs), strict))
return rhs;
if (complain)
- cp_error ("argument of type `%T' does not match `%T'",
+ error ("argument of type `%T' does not match `%T'",
TREE_TYPE (rhs), lhstype);
return error_mark_node;
}
@@ -5328,7 +6090,7 @@ instantiate_type (lhstype, rhs, flags)
case SAVE_EXPR:
case CONSTRUCTOR:
case BUFFER_REF:
- my_friendly_abort (177);
+ abort ();
return error_mark_node;
case INDIRECT_REF:
@@ -5352,40 +6114,13 @@ instantiate_type (lhstype, rhs, flags)
return instantiate_type (lhstype, rhs, flags);
case COMPONENT_REF:
- {
- tree field = TREE_OPERAND (rhs, 1);
- tree r;
-
- r = instantiate_type (lhstype, field, flags);
-
- if (r != error_mark_node && TYPE_PTRMEMFUNC_P (lhstype))
- {
- if (complain)
- {
- tree t = TYPE_PTRMEMFUNC_OBJECT_TYPE (lhstype);
-
- if (TREE_CODE (field) == OVERLOAD)
- field = OVL_FUNCTION (field);
- if (TREE_CODE (field) == FUNCTION_DECL)
- {
- cp_pedwarn ("object-dependent reference `%E' can only be used in a call",
- DECL_NAME (field));
- cp_pedwarn (" to form a pointer to member function, say `&%T::%E'",
- t, DECL_NAME (field));
- }
- else
- cp_pedwarn ("object-dependent reference can only be used in a call");
- }
- return r;
- }
-
- return r;
- }
+ return instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags);
case OFFSET_REF:
rhs = TREE_OPERAND (rhs, 1);
if (BASELINK_P (rhs))
- return instantiate_type (lhstype, TREE_VALUE (rhs), flags);
+ return instantiate_type (lhstype, TREE_VALUE (rhs),
+ flags | allow_ptrmem);
/* This can happen if we are forming a pointer-to-member for a
member template. */
@@ -5394,18 +6129,25 @@ instantiate_type (lhstype, rhs, flags)
/* Fall through. */
case TEMPLATE_ID_EXPR:
- return
- resolve_address_of_overloaded_function (lhstype,
- TREE_OPERAND (rhs, 0),
- complain,
- /*template_only=*/1,
- TREE_OPERAND (rhs, 1));
+ {
+ tree fns = TREE_OPERAND (rhs, 0);
+ tree args = TREE_OPERAND (rhs, 1);
+
+ return
+ resolve_address_of_overloaded_function (lhstype,
+ fns,
+ complain,
+ allow_ptrmem,
+ /*template_only=*/1,
+ args);
+ }
case OVERLOAD:
return
resolve_address_of_overloaded_function (lhstype,
rhs,
complain,
+ allow_ptrmem,
/*template_only=*/0,
/*explicit_targs=*/NULL_TREE);
@@ -5417,7 +6159,7 @@ instantiate_type (lhstype, rhs, flags)
case CALL_EXPR:
/* This is too hard for now. */
- my_friendly_abort (183);
+ abort ();
return error_mark_node;
case PLUS_EXPR:
@@ -5517,17 +6259,21 @@ instantiate_type (lhstype, rhs, flags)
return rhs;
case ADDR_EXPR:
+ {
+ if (PTRMEM_OK_P (rhs))
+ flags |= itf_ptrmem_ok;
+
return instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags);
-
+ }
case ENTRY_VALUE_EXPR:
- my_friendly_abort (184);
+ abort ();
return error_mark_node;
case ERROR_MARK:
return error_mark_node;
default:
- my_friendly_abort (185);
+ abort ();
return error_mark_node;
}
}
@@ -5546,7 +6292,7 @@ get_vfield_name (type)
char *buf;
while (BINFO_BASETYPES (binfo)
- && TYPE_VIRTUAL_P (BINFO_TYPE (BINFO_BASETYPE (binfo, 0)))
+ && TYPE_CONTAINS_VPTR_P (BINFO_TYPE (BINFO_BASETYPE (binfo, 0)))
&& ! TREE_VIA_VIRTUAL (BINFO_BASETYPE (binfo, 0)))
binfo = BINFO_BASETYPE (binfo, 0);
@@ -5575,27 +6321,6 @@ print_class_statistics ()
#endif
}
-/* Push an obstack which is sufficiently long-lived to hold such class
- decls that may be cached in the previous_class_values list. The
- effect is undone by pop_obstacks. */
-
-void
-push_cache_obstack ()
-{
- static int cache_obstack_initialized;
-
- if (!cache_obstack_initialized)
- {
- gcc_obstack_init (&class_cache_obstack);
- class_cache_firstobj
- = (char*) obstack_finish (&class_cache_obstack);
- cache_obstack_initialized = 1;
- }
-
- push_obstacks_nochange ();
- current_obstack = &class_cache_obstack;
-}
-
/* Build a dummy reference to ourselves so Derived::Base (and A::A) works,
according to [class]:
The class-name is also inserted
@@ -5611,9 +6336,11 @@ build_self_reference ()
DECL_NONLOCAL (value) = 1;
DECL_CONTEXT (value) = current_class_type;
- DECL_CLASS_CONTEXT (value) = current_class_type;
DECL_ARTIFICIAL (value) = 1;
+ if (processing_template_decl)
+ value = push_template_decl (value);
+
saved_cas = current_access_specifier;
current_access_specifier = access_public_node;
finish_member_declaration (value);
@@ -5626,23 +6353,13 @@ int
is_empty_class (type)
tree type;
{
- tree t;
-
if (type == error_mark_node)
return 0;
if (! IS_AGGR_TYPE (type))
return 0;
- if (flag_new_abi)
- return CLASSTYPE_SIZE (type) == integer_zero_node;
-
- if (TYPE_BINFO_BASETYPES (type))
- return 0;
- t = TYPE_FIELDS (type);
- while (t && TREE_CODE (t) != FIELD_DECL)
- t = TREE_CHAIN (t);
- return (t == NULL_TREE);
+ return integer_zerop (CLASSTYPE_SIZE (type));
}
/* Find the enclosing class of the given NODE. NODE can be a *_DECL or
@@ -5669,7 +6386,7 @@ get_enclosing_class (type)
break;
default:
- my_friendly_abort (0);
+ abort ();
}
}
return NULL_TREE;
@@ -5683,7 +6400,7 @@ is_base_of_enclosing_class (base, type)
{
while (type)
{
- if (get_binfo (base, type, 0))
+ if (lookup_base (type, base, ba_any, NULL))
return 1;
type = get_enclosing_class (type);
@@ -5745,9 +6462,1576 @@ note_name_declared_in_class (name, decl)
A name N used in a class S shall refer to the same declaration
in its context and when re-evaluated in the completed scope of
S. */
- cp_error ("declaration of `%#D'", decl);
- cp_error_at ("changes meaning of `%s' from `%+#D'",
- IDENTIFIER_POINTER (DECL_NAME (decl)),
+ error ("declaration of `%#D'", decl);
+ cp_error_at ("changes meaning of `%D' from `%+#D'",
+ DECL_NAME (OVL_CURRENT (decl)),
(tree) n->value);
}
}
+
+/* Returns the VAR_DECL for the complete vtable associated with BINFO.
+ Secondary vtables are merged with primary vtables; this function
+ will return the VAR_DECL for the primary vtable. */
+
+tree
+get_vtbl_decl_for_binfo (binfo)
+ tree binfo;
+{
+ tree decl;
+
+ decl = BINFO_VTABLE (binfo);
+ if (decl && TREE_CODE (decl) == PLUS_EXPR)
+ {
+ my_friendly_assert (TREE_CODE (TREE_OPERAND (decl, 0)) == ADDR_EXPR,
+ 2000403);
+ decl = TREE_OPERAND (TREE_OPERAND (decl, 0), 0);
+ }
+ if (decl)
+ my_friendly_assert (TREE_CODE (decl) == VAR_DECL, 20000403);
+ return decl;
+}
+
+/* Called from get_primary_binfo via dfs_walk. DATA is a TREE_LIST
+ who's TREE_PURPOSE is the TYPE of the required primary base and
+ who's TREE_VALUE is a list of candidate binfos that we fill in. */
+
+static tree
+dfs_get_primary_binfo (binfo, data)
+ tree binfo;
+ void *data;
+{
+ tree cons = (tree) data;
+ tree primary_base = TREE_PURPOSE (cons);
+
+ if (TREE_VIA_VIRTUAL (binfo)
+ && same_type_p (BINFO_TYPE (binfo), primary_base))
+ /* This is the right type of binfo, but it might be an unshared
+ instance, and the shared instance is later in the dfs walk. We
+ must keep looking. */
+ TREE_VALUE (cons) = tree_cons (NULL, binfo, TREE_VALUE (cons));
+
+ return NULL_TREE;
+}
+
+/* Returns the unshared binfo for the primary base of BINFO. Note
+ that in a complex hierarchy the resulting BINFO may not actually
+ *be* primary. In particular if the resulting BINFO is a virtual
+ base, and it occurs elsewhere in the hierarchy, then this
+ occurrence may not actually be a primary base in the complete
+ object. Check BINFO_PRIMARY_P to be sure. */
+
+tree
+get_primary_binfo (binfo)
+ tree binfo;
+{
+ tree primary_base;
+ tree result = NULL_TREE;
+ tree virtuals;
+
+ primary_base = CLASSTYPE_PRIMARY_BINFO (BINFO_TYPE (binfo));
+ if (!primary_base)
+ return NULL_TREE;
+
+ /* A non-virtual primary base is always a direct base, and easy to
+ find. */
+ if (!TREE_VIA_VIRTUAL (primary_base))
+ {
+ int i;
+
+ /* Scan the direct basetypes until we find a base with the same
+ type as the primary base. */
+ for (i = 0; i < BINFO_N_BASETYPES (binfo); ++i)
+ {
+ tree base_binfo = BINFO_BASETYPE (binfo, i);
+
+ if (same_type_p (BINFO_TYPE (base_binfo),
+ BINFO_TYPE (primary_base)))
+ return base_binfo;
+ }
+
+ /* We should always find the primary base. */
+ abort ();
+ }
+
+ /* For a primary virtual base, we have to scan the entire hierarchy
+ rooted at BINFO; the virtual base could be an indirect virtual
+ base. There could be more than one instance of the primary base
+ in the hierarchy, and if one is the canonical binfo we want that
+ one. If it exists, it should be the first one we find, but as a
+ consistency check we find them all and make sure. */
+ virtuals = build_tree_list (BINFO_TYPE (primary_base), NULL_TREE);
+ dfs_walk (binfo, dfs_get_primary_binfo, NULL, virtuals);
+ virtuals = TREE_VALUE (virtuals);
+
+ /* We must have found at least one instance. */
+ my_friendly_assert (virtuals, 20010612);
+
+ if (TREE_CHAIN (virtuals))
+ {
+ /* We found more than one instance of the base. We must make
+ sure that, if one is the canonical one, it is the first one
+ we found. As the chain is in reverse dfs order, that means
+ the last on the list. */
+ tree complete_binfo;
+ tree canonical;
+
+ for (complete_binfo = binfo;
+ BINFO_INHERITANCE_CHAIN (complete_binfo);
+ complete_binfo = BINFO_INHERITANCE_CHAIN (complete_binfo))
+ continue;
+ canonical = binfo_for_vbase (BINFO_TYPE (primary_base),
+ BINFO_TYPE (complete_binfo));
+
+ for (; virtuals; virtuals = TREE_CHAIN (virtuals))
+ {
+ result = TREE_VALUE (virtuals);
+
+ if (canonical == result)
+ {
+ /* This is the unshared instance. Make sure it was the
+ first one found. */
+ my_friendly_assert (!TREE_CHAIN (virtuals), 20010612);
+ break;
+ }
+ }
+ }
+ else
+ result = TREE_VALUE (virtuals);
+ return result;
+}
+
+/* If INDENTED_P is zero, indent to INDENT. Return non-zero. */
+
+static int
+maybe_indent_hierarchy (stream, indent, indented_p)
+ FILE *stream;
+ int indent;
+ int indented_p;
+{
+ if (!indented_p)
+ fprintf (stream, "%*s", indent, "");
+ return 1;
+}
+
+/* Dump the offsets of all the bases rooted at BINFO (in the hierarchy
+ dominated by T) to stderr. INDENT should be zero when called from
+ the top level; it is incremented recursively. */
+
+static void
+dump_class_hierarchy_r (stream, flags, t, binfo, indent)
+ FILE *stream;
+ int flags;
+ tree t;
+ tree binfo;
+ int indent;
+{
+ int i;
+ int indented = 0;
+
+ indented = maybe_indent_hierarchy (stream, indent, 0);
+ fprintf (stream, "%s (0x%lx) ",
+ type_as_string (binfo, TFF_PLAIN_IDENTIFIER),
+ (unsigned long) binfo);
+ fprintf (stream, HOST_WIDE_INT_PRINT_DEC,
+ tree_low_cst (BINFO_OFFSET (binfo), 0));
+ if (is_empty_class (BINFO_TYPE (binfo)))
+ fprintf (stream, " empty");
+ else if (CLASSTYPE_NEARLY_EMPTY_P (BINFO_TYPE (binfo)))
+ fprintf (stream, " nearly-empty");
+ if (TREE_VIA_VIRTUAL (binfo))
+ {
+ tree canonical = binfo_for_vbase (BINFO_TYPE (binfo), t);
+
+ fprintf (stream, " virtual");
+ if (canonical == binfo)
+ fprintf (stream, " canonical");
+ else
+ fprintf (stream, " non-canonical");
+ }
+ fprintf (stream, "\n");
+
+ indented = 0;
+ if (BINFO_PRIMARY_BASE_OF (binfo))
+ {
+ indented = maybe_indent_hierarchy (stream, indent + 3, indented);
+ fprintf (stream, " primary-for %s (0x%lx)",
+ type_as_string (BINFO_PRIMARY_BASE_OF (binfo),
+ TFF_PLAIN_IDENTIFIER),
+ (unsigned long)BINFO_PRIMARY_BASE_OF (binfo));
+ }
+ if (BINFO_LOST_PRIMARY_P (binfo))
+ {
+ indented = maybe_indent_hierarchy (stream, indent + 3, indented);
+ fprintf (stream, " lost-primary");
+ }
+ if (indented)
+ fprintf (stream, "\n");
+
+ if (!(flags & TDF_SLIM))
+ {
+ int indented = 0;
+
+ if (BINFO_SUBVTT_INDEX (binfo))
+ {
+ indented = maybe_indent_hierarchy (stream, indent + 3, indented);
+ fprintf (stream, " subvttidx=%s",
+ expr_as_string (BINFO_SUBVTT_INDEX (binfo),
+ TFF_PLAIN_IDENTIFIER));
+ }
+ if (BINFO_VPTR_INDEX (binfo))
+ {
+ indented = maybe_indent_hierarchy (stream, indent + 3, indented);
+ fprintf (stream, " vptridx=%s",
+ expr_as_string (BINFO_VPTR_INDEX (binfo),
+ TFF_PLAIN_IDENTIFIER));
+ }
+ if (BINFO_VPTR_FIELD (binfo))
+ {
+ indented = maybe_indent_hierarchy (stream, indent + 3, indented);
+ fprintf (stream, " vbaseoffset=%s",
+ expr_as_string (BINFO_VPTR_FIELD (binfo),
+ TFF_PLAIN_IDENTIFIER));
+ }
+ if (BINFO_VTABLE (binfo))
+ {
+ indented = maybe_indent_hierarchy (stream, indent + 3, indented);
+ fprintf (stream, " vptr=%s",
+ expr_as_string (BINFO_VTABLE (binfo),
+ TFF_PLAIN_IDENTIFIER));
+ }
+
+ if (indented)
+ fprintf (stream, "\n");
+ }
+
+
+ for (i = 0; i < BINFO_N_BASETYPES (binfo); ++i)
+ dump_class_hierarchy_r (stream, flags,
+ t, BINFO_BASETYPE (binfo, i),
+ indent + 2);
+}
+
+/* Dump the BINFO hierarchy for T. */
+
+static void
+dump_class_hierarchy (t)
+ tree t;
+{
+ int flags;
+ FILE *stream = dump_begin (TDI_class, &flags);
+
+ if (!stream)
+ return;
+
+ fprintf (stream, "Class %s\n", type_as_string (t, TFF_PLAIN_IDENTIFIER));
+ fprintf (stream, " size=%lu align=%lu\n",
+ (unsigned long)(tree_low_cst (TYPE_SIZE (t), 0) / BITS_PER_UNIT),
+ (unsigned long)(TYPE_ALIGN (t) / BITS_PER_UNIT));
+ dump_class_hierarchy_r (stream, flags, t, TYPE_BINFO (t), 0);
+ fprintf (stream, "\n");
+ dump_end (TDI_class, stream);
+}
+
+static void
+dump_array (stream, decl)
+ FILE *stream;
+ tree decl;
+{
+ tree inits;
+ int ix;
+ HOST_WIDE_INT elt;
+ tree size = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (decl)));
+
+ elt = (tree_low_cst (TYPE_SIZE (TREE_TYPE (TREE_TYPE (decl))), 0)
+ / BITS_PER_UNIT);
+ fprintf (stream, "%s:", decl_as_string (decl, TFF_PLAIN_IDENTIFIER));
+ fprintf (stream, " %s entries",
+ expr_as_string (size_binop (PLUS_EXPR, size, size_one_node),
+ TFF_PLAIN_IDENTIFIER));
+ fprintf (stream, "\n");
+
+ for (ix = 0, inits = TREE_OPERAND (DECL_INITIAL (decl), 1);
+ inits; ix++, inits = TREE_CHAIN (inits))
+ fprintf (stream, "%-4ld %s\n", (long)(ix * elt),
+ expr_as_string (TREE_VALUE (inits), TFF_PLAIN_IDENTIFIER));
+}
+
+static void
+dump_vtable (t, binfo, vtable)
+ tree t;
+ tree binfo;
+ tree vtable;
+{
+ int flags;
+ FILE *stream = dump_begin (TDI_class, &flags);
+
+ if (!stream)
+ return;
+
+ if (!(flags & TDF_SLIM))
+ {
+ int ctor_vtbl_p = TYPE_BINFO (t) != binfo;
+
+ fprintf (stream, "%s for %s",
+ ctor_vtbl_p ? "Construction vtable" : "Vtable",
+ type_as_string (binfo, TFF_PLAIN_IDENTIFIER));
+ if (ctor_vtbl_p)
+ {
+ if (!TREE_VIA_VIRTUAL (binfo))
+ fprintf (stream, " (0x%lx instance)", (unsigned long)binfo);
+ fprintf (stream, " in %s", type_as_string (t, TFF_PLAIN_IDENTIFIER));
+ }
+ fprintf (stream, "\n");
+ dump_array (stream, vtable);
+ fprintf (stream, "\n");
+ }
+
+ dump_end (TDI_class, stream);
+}
+
+static void
+dump_vtt (t, vtt)
+ tree t;
+ tree vtt;
+{
+ int flags;
+ FILE *stream = dump_begin (TDI_class, &flags);
+
+ if (!stream)
+ return;
+
+ if (!(flags & TDF_SLIM))
+ {
+ fprintf (stream, "VTT for %s\n",
+ type_as_string (t, TFF_PLAIN_IDENTIFIER));
+ dump_array (stream, vtt);
+ fprintf (stream, "\n");
+ }
+
+ dump_end (TDI_class, stream);
+}
+
+/* Virtual function table initialization. */
+
+/* Create all the necessary vtables for T and its base classes. */
+
+static void
+finish_vtbls (t)
+ tree t;
+{
+ tree list;
+ tree vbase;
+ int i;
+
+ /* We lay out the primary and secondary vtables in one contiguous
+ vtable. The primary vtable is first, followed by the non-virtual
+ secondary vtables in inheritance graph order. */
+ list = build_tree_list (TYPE_BINFO_VTABLE (t), NULL_TREE);
+ accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t),
+ TYPE_BINFO (t), t, list);
+
+ /* Then come the virtual bases, also in inheritance graph order. */
+ for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
+ {
+ tree real_base;
+
+ if (!TREE_VIA_VIRTUAL (vbase))
+ continue;
+
+ /* Although we walk in inheritance order, that might not get the
+ canonical base. */
+ real_base = binfo_for_vbase (BINFO_TYPE (vbase), t);
+
+ accumulate_vtbl_inits (real_base, real_base,
+ TYPE_BINFO (t), t, list);
+ }
+
+ /* Fill in BINFO_VPTR_FIELD in the immediate binfos for our virtual
+ base classes, for the benefit of the debugging backends. */
+ for (i = 0; i < BINFO_N_BASETYPES (TYPE_BINFO (t)); ++i)
+ {
+ tree base = BINFO_BASETYPE (TYPE_BINFO (t), i);
+ if (TREE_VIA_VIRTUAL (base))
+ {
+ vbase = binfo_for_vbase (BINFO_TYPE (base), t);
+ BINFO_VPTR_FIELD (base) = BINFO_VPTR_FIELD (vbase);
+ }
+ }
+
+ if (TYPE_BINFO_VTABLE (t))
+ initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list));
+}
+
+/* Initialize the vtable for BINFO with the INITS. */
+
+static void
+initialize_vtable (binfo, inits)
+ tree binfo;
+ tree inits;
+{
+ tree decl;
+
+ layout_vtable_decl (binfo, list_length (inits));
+ decl = get_vtbl_decl_for_binfo (binfo);
+ initialize_array (decl, inits);
+ dump_vtable (BINFO_TYPE (binfo), binfo, decl);
+}
+
+/* Initialize DECL (a declaration for a namespace-scope array) with
+ the INITS. */
+
+static void
+initialize_array (decl, inits)
+ tree decl;
+ tree inits;
+{
+ tree context;
+
+ context = DECL_CONTEXT (decl);
+ DECL_CONTEXT (decl) = NULL_TREE;
+ DECL_INITIAL (decl) = build_nt (CONSTRUCTOR, NULL_TREE, inits);
+ cp_finish_decl (decl, DECL_INITIAL (decl), NULL_TREE, 0);
+ DECL_CONTEXT (decl) = context;
+}
+
+/* Build the VTT (virtual table table) for T.
+ A class requires a VTT if it has virtual bases.
+
+ This holds
+ 1 - primary virtual pointer for complete object T
+ 2 - secondary VTTs for each direct non-virtual base of T which requires a
+ VTT
+ 3 - secondary virtual pointers for each direct or indirect base of T which
+ has virtual bases or is reachable via a virtual path from T.
+ 4 - secondary VTTs for each direct or indirect virtual base of T.
+
+ Secondary VTTs look like complete object VTTs without part 4. */
+
+static void
+build_vtt (t)
+ tree t;
+{
+ tree inits;
+ tree type;
+ tree vtt;
+ tree index;
+
+ /* Build up the initializers for the VTT. */
+ inits = NULL_TREE;
+ index = size_zero_node;
+ build_vtt_inits (TYPE_BINFO (t), t, &inits, &index);
+
+ /* If we didn't need a VTT, we're done. */
+ if (!inits)
+ return;
+
+ /* Figure out the type of the VTT. */
+ type = build_index_type (size_int (list_length (inits) - 1));
+ type = build_cplus_array_type (const_ptr_type_node, type);
+
+ /* Now, build the VTT object itself. */
+ vtt = build_vtable (t, get_vtt_name (t), type);
+ pushdecl_top_level (vtt);
+ initialize_array (vtt, inits);
+
+ dump_vtt (t, vtt);
+}
+
+/* The type corresponding to BASE_BINFO is a base of the type of BINFO, but
+ from within some hierarchy which is inherited from the type of BINFO.
+ Return BASE_BINFO's equivalent binfo from the hierarchy dominated by
+ BINFO. */
+
+static tree
+get_original_base (base_binfo, binfo)
+ tree base_binfo;
+ tree binfo;
+{
+ tree derived;
+ int ix;
+
+ if (same_type_p (BINFO_TYPE (base_binfo), BINFO_TYPE (binfo)))
+ return binfo;
+ if (TREE_VIA_VIRTUAL (base_binfo))
+ return binfo_for_vbase (BINFO_TYPE (base_binfo), BINFO_TYPE (binfo));
+ derived = get_original_base (BINFO_INHERITANCE_CHAIN (base_binfo), binfo);
+
+ for (ix = 0; ix != BINFO_N_BASETYPES (derived); ix++)
+ if (same_type_p (BINFO_TYPE (base_binfo),
+ BINFO_TYPE (BINFO_BASETYPE (derived, ix))))
+ return BINFO_BASETYPE (derived, ix);
+ abort ();
+ return NULL;
+}
+
+/* When building a secondary VTT, BINFO_VTABLE is set to a TREE_LIST with
+ PURPOSE the RTTI_BINFO, VALUE the real vtable pointer for this binfo,
+ and CHAIN the vtable pointer for this binfo after construction is
+ complete. VALUE can also be another BINFO, in which case we recurse. */
+
+static tree
+binfo_ctor_vtable (binfo)
+ tree binfo;
+{
+ tree vt;
+
+ while (1)
+ {
+ vt = BINFO_VTABLE (binfo);
+ if (TREE_CODE (vt) == TREE_LIST)
+ vt = TREE_VALUE (vt);
+ if (TREE_CODE (vt) == TREE_VEC)
+ binfo = vt;
+ else
+ break;
+ }
+
+ return vt;
+}
+
+/* Recursively build the VTT-initializer for BINFO (which is in the
+ hierarchy dominated by T). INITS points to the end of the initializer
+ list to date. INDEX is the VTT index where the next element will be
+ replaced. Iff BINFO is the binfo for T, this is the top level VTT (i.e.
+ not a subvtt for some base of T). When that is so, we emit the sub-VTTs
+ for virtual bases of T. When it is not so, we build the constructor
+ vtables for the BINFO-in-T variant. */
+
+static tree *
+build_vtt_inits (binfo, t, inits, index)
+ tree binfo;
+ tree t;
+ tree *inits;
+ tree *index;
+{
+ int i;
+ tree b;
+ tree init;
+ tree secondary_vptrs;
+ int top_level_p = same_type_p (TREE_TYPE (binfo), t);
+
+ /* We only need VTTs for subobjects with virtual bases. */
+ if (!TYPE_USES_VIRTUAL_BASECLASSES (BINFO_TYPE (binfo)))
+ return inits;
+
+ /* We need to use a construction vtable if this is not the primary
+ VTT. */
+ if (!top_level_p)
+ {
+ build_ctor_vtbl_group (binfo, t);
+
+ /* Record the offset in the VTT where this sub-VTT can be found. */
+ BINFO_SUBVTT_INDEX (binfo) = *index;
+ }
+
+ /* Add the address of the primary vtable for the complete object. */
+ init = binfo_ctor_vtable (binfo);
+ *inits = build_tree_list (NULL_TREE, init);
+ inits = &TREE_CHAIN (*inits);
+ if (top_level_p)
+ {
+ my_friendly_assert (!BINFO_VPTR_INDEX (binfo), 20010129);
+ BINFO_VPTR_INDEX (binfo) = *index;
+ }
+ *index = size_binop (PLUS_EXPR, *index, TYPE_SIZE_UNIT (ptr_type_node));
+
+ /* Recursively add the secondary VTTs for non-virtual bases. */
+ for (i = 0; i < BINFO_N_BASETYPES (binfo); ++i)
+ {
+ b = BINFO_BASETYPE (binfo, i);
+ if (!TREE_VIA_VIRTUAL (b))
+ inits = build_vtt_inits (BINFO_BASETYPE (binfo, i), t,
+ inits, index);
+ }
+
+ /* Add secondary virtual pointers for all subobjects of BINFO with
+ either virtual bases or reachable along a virtual path, except
+ subobjects that are non-virtual primary bases. */
+ secondary_vptrs = tree_cons (t, NULL_TREE, BINFO_TYPE (binfo));
+ TREE_TYPE (secondary_vptrs) = *index;
+ VTT_TOP_LEVEL_P (secondary_vptrs) = top_level_p;
+ VTT_MARKED_BINFO_P (secondary_vptrs) = 0;
+
+ dfs_walk_real (binfo,
+ dfs_build_secondary_vptr_vtt_inits,
+ NULL,
+ dfs_ctor_vtable_bases_queue_p,
+ secondary_vptrs);
+ VTT_MARKED_BINFO_P (secondary_vptrs) = 1;
+ dfs_walk (binfo, dfs_unmark, dfs_ctor_vtable_bases_queue_p,
+ secondary_vptrs);
+
+ *index = TREE_TYPE (secondary_vptrs);
+
+ /* The secondary vptrs come back in reverse order. After we reverse
+ them, and add the INITS, the last init will be the first element
+ of the chain. */
+ secondary_vptrs = TREE_VALUE (secondary_vptrs);
+ if (secondary_vptrs)
+ {
+ *inits = nreverse (secondary_vptrs);
+ inits = &TREE_CHAIN (secondary_vptrs);
+ my_friendly_assert (*inits == NULL_TREE, 20000517);
+ }
+
+ /* Add the secondary VTTs for virtual bases. */
+ if (top_level_p)
+ for (b = TYPE_BINFO (BINFO_TYPE (binfo)); b; b = TREE_CHAIN (b))
+ {
+ tree vbase;
+
+ if (!TREE_VIA_VIRTUAL (b))
+ continue;
+
+ vbase = binfo_for_vbase (BINFO_TYPE (b), t);
+ inits = build_vtt_inits (vbase, t, inits, index);
+ }
+
+ if (!top_level_p)
+ {
+ tree data = tree_cons (t, binfo, NULL_TREE);
+ VTT_TOP_LEVEL_P (data) = 0;
+ VTT_MARKED_BINFO_P (data) = 0;
+
+ dfs_walk (binfo, dfs_fixup_binfo_vtbls,
+ dfs_ctor_vtable_bases_queue_p,
+ data);
+ }
+
+ return inits;
+}
+
+/* Called from build_vtt_inits via dfs_walk. BINFO is the binfo
+ for the base in most derived. DATA is a TREE_LIST who's
+ TREE_CHAIN is the type of the base being
+ constructed whilst this secondary vptr is live. The TREE_UNSIGNED
+ flag of DATA indicates that this is a constructor vtable. The
+ TREE_TOP_LEVEL flag indicates that this is the primary VTT. */
+
+static tree
+dfs_build_secondary_vptr_vtt_inits (binfo, data)
+ tree binfo;
+ void *data;
+{
+ tree l;
+ tree t;
+ tree init;
+ tree index;
+ int top_level_p;
+
+ l = (tree) data;
+ t = TREE_CHAIN (l);
+ top_level_p = VTT_TOP_LEVEL_P (l);
+
+ SET_BINFO_MARKED (binfo);
+
+ /* We don't care about bases that don't have vtables. */
+ if (!TYPE_VFIELD (BINFO_TYPE (binfo)))
+ return NULL_TREE;
+
+ /* We're only interested in proper subobjects of T. */
+ if (same_type_p (BINFO_TYPE (binfo), t))
+ return NULL_TREE;
+
+ /* We're not interested in non-virtual primary bases. */
+ if (!TREE_VIA_VIRTUAL (binfo) && BINFO_PRIMARY_P (binfo))
+ return NULL_TREE;
+
+ /* If BINFO has virtual bases or is reachable via a virtual path
+ from T, it'll have a secondary vptr. */
+ if (!TYPE_USES_VIRTUAL_BASECLASSES (BINFO_TYPE (binfo))
+ && !binfo_via_virtual (binfo, t))
+ return NULL_TREE;
+
+ /* Record the index where this secondary vptr can be found. */
+ index = TREE_TYPE (l);
+ if (top_level_p)
+ {
+ my_friendly_assert (!BINFO_VPTR_INDEX (binfo), 20010129);
+ BINFO_VPTR_INDEX (binfo) = index;
+ }
+ TREE_TYPE (l) = size_binop (PLUS_EXPR, index,
+ TYPE_SIZE_UNIT (ptr_type_node));
+
+ /* Add the initializer for the secondary vptr itself. */
+ if (top_level_p && TREE_VIA_VIRTUAL (binfo))
+ {
+ /* It's a primary virtual base, and this is not the construction
+ vtable. Find the base this is primary of in the inheritance graph,
+ and use that base's vtable now. */
+ while (BINFO_PRIMARY_BASE_OF (binfo))
+ binfo = BINFO_PRIMARY_BASE_OF (binfo);
+ }
+ init = binfo_ctor_vtable (binfo);
+ TREE_VALUE (l) = tree_cons (NULL_TREE, init, TREE_VALUE (l));
+
+ return NULL_TREE;
+}
+
+/* dfs_walk_real predicate for building vtables. DATA is a TREE_LIST,
+ VTT_MARKED_BINFO_P indicates whether marked or unmarked bases
+ should be walked. TREE_PURPOSE is the TREE_TYPE that dominates the
+ hierarchy. */
+
+static tree
+dfs_ctor_vtable_bases_queue_p (binfo, data)
+ tree binfo;
+ void *data;
+{
+ if (TREE_VIA_VIRTUAL (binfo))
+ /* Get the shared version. */
+ binfo = binfo_for_vbase (BINFO_TYPE (binfo), TREE_PURPOSE ((tree) data));
+
+ if (!BINFO_MARKED (binfo) == VTT_MARKED_BINFO_P ((tree) data))
+ return NULL_TREE;
+ return binfo;
+}
+
+/* Called from build_vtt_inits via dfs_walk. After building constructor
+ vtables and generating the sub-vtt from them, we need to restore the
+ BINFO_VTABLES that were scribbled on. DATA is a TREE_LIST whose
+ TREE_VALUE is the TREE_TYPE of the base whose sub vtt was generated. */
+
+static tree
+dfs_fixup_binfo_vtbls (binfo, data)
+ tree binfo;
+ void *data;
+{
+ CLEAR_BINFO_MARKED (binfo);
+
+ /* We don't care about bases that don't have vtables. */
+ if (!TYPE_VFIELD (BINFO_TYPE (binfo)))
+ return NULL_TREE;
+
+ /* If we scribbled the construction vtable vptr into BINFO, clear it
+ out now. */
+ if (BINFO_VTABLE (binfo)
+ && TREE_CODE (BINFO_VTABLE (binfo)) == TREE_LIST
+ && (TREE_PURPOSE (BINFO_VTABLE (binfo))
+ == TREE_VALUE ((tree) data)))
+ BINFO_VTABLE (binfo) = TREE_CHAIN (BINFO_VTABLE (binfo));
+
+ return NULL_TREE;
+}
+
+/* Build the construction vtable group for BINFO which is in the
+ hierarchy dominated by T. */
+
+static void
+build_ctor_vtbl_group (binfo, t)
+ tree binfo;
+ tree t;
+{
+ tree list;
+ tree type;
+ tree vtbl;
+ tree inits;
+ tree id;
+ tree vbase;
+
+ /* See if we've already created this construction vtable group. */
+ id = mangle_ctor_vtbl_for_type (t, binfo);
+ if (IDENTIFIER_GLOBAL_VALUE (id))
+ return;
+
+ my_friendly_assert (!same_type_p (BINFO_TYPE (binfo), t), 20010124);
+ /* Build a version of VTBL (with the wrong type) for use in
+ constructing the addresses of secondary vtables in the
+ construction vtable group. */
+ vtbl = build_vtable (t, id, ptr_type_node);
+ list = build_tree_list (vtbl, NULL_TREE);
+ accumulate_vtbl_inits (binfo, TYPE_BINFO (TREE_TYPE (binfo)),
+ binfo, t, list);
+
+ /* Add the vtables for each of our virtual bases using the vbase in T
+ binfo. */
+ for (vbase = TYPE_BINFO (BINFO_TYPE (binfo));
+ vbase;
+ vbase = TREE_CHAIN (vbase))
+ {
+ tree b;
+ tree orig_base;
+
+ if (!TREE_VIA_VIRTUAL (vbase))
+ continue;
+ b = binfo_for_vbase (BINFO_TYPE (vbase), t);
+ orig_base = binfo_for_vbase (BINFO_TYPE (vbase), BINFO_TYPE (binfo));
+
+ accumulate_vtbl_inits (b, orig_base, binfo, t, list);
+ }
+ inits = TREE_VALUE (list);
+
+ /* Figure out the type of the construction vtable. */
+ type = build_index_type (size_int (list_length (inits) - 1));
+ type = build_cplus_array_type (vtable_entry_type, type);
+ TREE_TYPE (vtbl) = type;
+
+ /* Initialize the construction vtable. */
+ pushdecl_top_level (vtbl);
+ initialize_array (vtbl, inits);
+ dump_vtable (t, binfo, vtbl);
+}
+
+/* Add the vtbl initializers for BINFO (and its bases other than
+ non-virtual primaries) to the list of INITS. BINFO is in the
+ hierarchy dominated by T. RTTI_BINFO is the binfo within T of
+ the constructor the vtbl inits should be accumulated for. (If this
+ is the complete object vtbl then RTTI_BINFO will be TYPE_BINFO (T).)
+ ORIG_BINFO is the binfo for this object within BINFO_TYPE (RTTI_BINFO).
+ BINFO is the active base equivalent of ORIG_BINFO in the inheritance
+ graph of T. Both BINFO and ORIG_BINFO will have the same BINFO_TYPE,
+ but are not necessarily the same in terms of layout. */
+
+static void
+accumulate_vtbl_inits (binfo, orig_binfo, rtti_binfo, t, inits)
+ tree binfo;
+ tree orig_binfo;
+ tree rtti_binfo;
+ tree t;
+ tree inits;
+{
+ int i;
+ int ctor_vtbl_p = !same_type_p (BINFO_TYPE (rtti_binfo), t);
+
+ my_friendly_assert (same_type_p (BINFO_TYPE (binfo),
+ BINFO_TYPE (orig_binfo)),
+ 20000517);
+
+ /* If it doesn't have a vptr, we don't do anything. */
+ if (!TYPE_CONTAINS_VPTR_P (BINFO_TYPE (binfo)))
+ return;
+
+ /* If we're building a construction vtable, we're not interested in
+ subobjects that don't require construction vtables. */
+ if (ctor_vtbl_p
+ && !TYPE_USES_VIRTUAL_BASECLASSES (BINFO_TYPE (binfo))
+ && !binfo_via_virtual (orig_binfo, BINFO_TYPE (rtti_binfo)))
+ return;
+
+ /* Build the initializers for the BINFO-in-T vtable. */
+ TREE_VALUE (inits)
+ = chainon (TREE_VALUE (inits),
+ dfs_accumulate_vtbl_inits (binfo, orig_binfo,
+ rtti_binfo, t, inits));
+
+ /* Walk the BINFO and its bases. We walk in preorder so that as we
+ initialize each vtable we can figure out at what offset the
+ secondary vtable lies from the primary vtable. We can't use
+ dfs_walk here because we need to iterate through bases of BINFO
+ and RTTI_BINFO simultaneously. */
+ for (i = 0; i < BINFO_N_BASETYPES (binfo); ++i)
+ {
+ tree base_binfo = BINFO_BASETYPE (binfo, i);
+
+ /* Skip virtual bases. */
+ if (TREE_VIA_VIRTUAL (base_binfo))
+ continue;
+ accumulate_vtbl_inits (base_binfo,
+ BINFO_BASETYPE (orig_binfo, i),
+ rtti_binfo, t,
+ inits);
+ }
+}
+
+/* Called from accumulate_vtbl_inits. Returns the initializers for
+ the BINFO vtable. */
+
+static tree
+dfs_accumulate_vtbl_inits (binfo, orig_binfo, rtti_binfo, t, l)
+ tree binfo;
+ tree orig_binfo;
+ tree rtti_binfo;
+ tree t;
+ tree l;
+{
+ tree inits = NULL_TREE;
+ tree vtbl = NULL_TREE;
+ int ctor_vtbl_p = !same_type_p (BINFO_TYPE (rtti_binfo), t);
+
+ if (ctor_vtbl_p
+ && TREE_VIA_VIRTUAL (orig_binfo) && BINFO_PRIMARY_P (orig_binfo))
+ {
+ /* In the hierarchy of BINFO_TYPE (RTTI_BINFO), this is a
+ primary virtual base. If it is not the same primary in
+ the hierarchy of T, we'll need to generate a ctor vtable
+ for it, to place at its location in T. If it is the same
+ primary, we still need a VTT entry for the vtable, but it
+ should point to the ctor vtable for the base it is a
+ primary for within the sub-hierarchy of RTTI_BINFO.
+
+ There are three possible cases:
+
+ 1) We are in the same place.
+ 2) We are a primary base within a lost primary virtual base of
+ RTTI_BINFO.
+ 3) We are primary to something not a base of RTTI_BINFO. */
+
+ tree b = BINFO_PRIMARY_BASE_OF (binfo);
+ tree last = NULL_TREE;
+
+ /* First, look through the bases we are primary to for RTTI_BINFO
+ or a virtual base. */
+ for (; b; b = BINFO_PRIMARY_BASE_OF (b))
+ {
+ last = b;
+ if (TREE_VIA_VIRTUAL (b) || b == rtti_binfo)
+ break;
+ }
+ /* If we run out of primary links, keep looking down our
+ inheritance chain; we might be an indirect primary. */
+ if (b == NULL_TREE)
+ for (b = last; b; b = BINFO_INHERITANCE_CHAIN (b))
+ if (TREE_VIA_VIRTUAL (b) || b == rtti_binfo)
+ break;
+
+ /* If we found RTTI_BINFO, this is case 1. If we found a virtual
+ base B and it is a base of RTTI_BINFO, this is case 2. In
+ either case, we share our vtable with LAST, i.e. the
+ derived-most base within B of which we are a primary. */
+ if (b == rtti_binfo
+ || (b && binfo_for_vbase (BINFO_TYPE (b),
+ BINFO_TYPE (rtti_binfo))))
+ /* Just set our BINFO_VTABLE to point to LAST, as we may not have
+ set LAST's BINFO_VTABLE yet. We'll extract the actual vptr in
+ binfo_ctor_vtable after everything's been set up. */
+ vtbl = last;
+
+ /* Otherwise, this is case 3 and we get our own. */
+ }
+ else if (!BINFO_NEW_VTABLE_MARKED (orig_binfo, BINFO_TYPE (rtti_binfo)))
+ return inits;
+
+ if (!vtbl)
+ {
+ tree index;
+ int non_fn_entries;
+
+ /* Compute the initializer for this vtable. */
+ inits = build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo,
+ &non_fn_entries);
+
+ /* Figure out the position to which the VPTR should point. */
+ vtbl = TREE_PURPOSE (l);
+ vtbl = build1 (ADDR_EXPR,
+ vtbl_ptr_type_node,
+ vtbl);
+ TREE_CONSTANT (vtbl) = 1;
+ index = size_binop (PLUS_EXPR,
+ size_int (non_fn_entries),
+ size_int (list_length (TREE_VALUE (l))));
+ index = size_binop (MULT_EXPR,
+ TYPE_SIZE_UNIT (vtable_entry_type),
+ index);
+ vtbl = build (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, index);
+ TREE_CONSTANT (vtbl) = 1;
+ }
+
+ if (ctor_vtbl_p)
+ /* For a construction vtable, we can't overwrite BINFO_VTABLE.
+ So, we make a TREE_LIST. Later, dfs_fixup_binfo_vtbls will
+ straighten this out. */
+ BINFO_VTABLE (binfo) = tree_cons (rtti_binfo, vtbl, BINFO_VTABLE (binfo));
+ else if (BINFO_PRIMARY_P (binfo) && TREE_VIA_VIRTUAL (binfo))
+ inits = NULL_TREE;
+ else
+ /* For an ordinary vtable, set BINFO_VTABLE. */
+ BINFO_VTABLE (binfo) = vtbl;
+
+ return inits;
+}
+
+/* Construct the initializer for BINFO's virtual function table. BINFO
+ is part of the hierarchy dominated by T. If we're building a
+ construction vtable, the ORIG_BINFO is the binfo we should use to
+ find the actual function pointers to put in the vtable - but they
+ can be overridden on the path to most-derived in the graph that
+ ORIG_BINFO belongs. Otherwise,
+ ORIG_BINFO should be the same as BINFO. The RTTI_BINFO is the
+ BINFO that should be indicated by the RTTI information in the
+ vtable; it will be a base class of T, rather than T itself, if we
+ are building a construction vtable.
+
+ The value returned is a TREE_LIST suitable for wrapping in a
+ CONSTRUCTOR to use as the DECL_INITIAL for a vtable. If
+ NON_FN_ENTRIES_P is not NULL, *NON_FN_ENTRIES_P is set to the
+ number of non-function entries in the vtable.
+
+ It might seem that this function should never be called with a
+ BINFO for which BINFO_PRIMARY_P holds, the vtable for such a
+ base is always subsumed by a derived class vtable. However, when
+ we are building construction vtables, we do build vtables for
+ primary bases; we need these while the primary base is being
+ constructed. */
+
+static tree
+build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo, non_fn_entries_p)
+ tree binfo;
+ tree orig_binfo;
+ tree t;
+ tree rtti_binfo;
+ int *non_fn_entries_p;
+{
+ tree v, b;
+ tree vfun_inits;
+ tree vbase;
+ vtbl_init_data vid;
+
+ /* Initialize VID. */
+ memset (&vid, 0, sizeof (vid));
+ vid.binfo = binfo;
+ vid.derived = t;
+ vid.rtti_binfo = rtti_binfo;
+ vid.last_init = &vid.inits;
+ vid.primary_vtbl_p = (binfo == TYPE_BINFO (t));
+ vid.ctor_vtbl_p = !same_type_p (BINFO_TYPE (rtti_binfo), t);
+ /* The first vbase or vcall offset is at index -3 in the vtable. */
+ vid.index = ssize_int (-3);
+
+ /* Add entries to the vtable for RTTI. */
+ build_rtti_vtbl_entries (binfo, &vid);
+
+ /* Create an array for keeping track of the functions we've
+ processed. When we see multiple functions with the same
+ signature, we share the vcall offsets. */
+ VARRAY_TREE_INIT (vid.fns, 32, "fns");
+ /* Add the vcall and vbase offset entries. */
+ build_vcall_and_vbase_vtbl_entries (binfo, &vid);
+ /* Clean up. */
+ VARRAY_FREE (vid.fns);
+ /* Clear BINFO_VTABLE_PATH_MARKED; it's set by
+ build_vbase_offset_vtbl_entries. */
+ for (vbase = CLASSTYPE_VBASECLASSES (t);
+ vbase;
+ vbase = TREE_CHAIN (vbase))
+ CLEAR_BINFO_VTABLE_PATH_MARKED (TREE_VALUE (vbase));
+
+ if (non_fn_entries_p)
+ *non_fn_entries_p = list_length (vid.inits);
+
+ /* Go through all the ordinary virtual functions, building up
+ initializers. */
+ vfun_inits = NULL_TREE;
+ for (v = BINFO_VIRTUALS (orig_binfo); v; v = TREE_CHAIN (v))
+ {
+ tree delta;
+ tree vcall_index;
+ tree fn;
+ tree pfn;
+ tree init = NULL_TREE;
+
+ fn = BV_FN (v);
+
+ /* If the only definition of this function signature along our
+ primary base chain is from a lost primary, this vtable slot will
+ never be used, so just zero it out. This is important to avoid
+ requiring extra thunks which cannot be generated with the function.
+
+ We first check this in update_vtable_entry_for_fn, so we handle
+ restored primary bases properly; we also need to do it here so we
+ zero out unused slots in ctor vtables, rather than filling themff
+ with erroneous values (though harmless, apart from relocation
+ costs). */
+ for (b = binfo; ; b = get_primary_binfo (b))
+ {
+ /* We found a defn before a lost primary; go ahead as normal. */
+ if (look_for_overrides_here (BINFO_TYPE (b), fn))
+ break;
+
+ /* The nearest definition is from a lost primary; clear the
+ slot. */
+ if (BINFO_LOST_PRIMARY_P (b))
+ {
+ init = size_zero_node;
+ break;
+ }
+ }
+
+ if (! init)
+ {
+ /* Pull the offset for `this', and the function to call, out of
+ the list. */
+ delta = BV_DELTA (v);
+
+ if (BV_USE_VCALL_INDEX_P (v))
+ {
+ vcall_index = BV_VCALL_INDEX (v);
+ my_friendly_assert (vcall_index != NULL_TREE, 20000621);
+ }
+ else
+ vcall_index = NULL_TREE;
+
+ my_friendly_assert (TREE_CODE (delta) == INTEGER_CST, 19990727);
+ my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL, 19990727);
+
+ /* You can't call an abstract virtual function; it's abstract.
+ So, we replace these functions with __pure_virtual. */
+ if (DECL_PURE_VIRTUAL_P (fn))
+ fn = abort_fndecl;
+
+ /* Take the address of the function, considering it to be of an
+ appropriate generic type. */
+ pfn = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
+ /* The address of a function can't change. */
+ TREE_CONSTANT (pfn) = 1;
+
+ /* Enter it in the vtable. */
+ init = build_vtable_entry (delta, vcall_index, pfn);
+ }
+
+ /* And add it to the chain of initializers. */
+ if (TARGET_VTABLE_USES_DESCRIPTORS)
+ {
+ int i;
+ if (init == size_zero_node)
+ for (i = 0; i < TARGET_VTABLE_USES_DESCRIPTORS; ++i)
+ vfun_inits = tree_cons (NULL_TREE, init, vfun_inits);
+ else
+ for (i = 0; i < TARGET_VTABLE_USES_DESCRIPTORS; ++i)
+ {
+ tree fdesc = build (FDESC_EXPR, vfunc_ptr_type_node,
+ TREE_OPERAND (init, 0),
+ build_int_2 (i, 0));
+ TREE_CONSTANT (fdesc) = 1;
+
+ vfun_inits = tree_cons (NULL_TREE, fdesc, vfun_inits);
+ }
+ }
+ else
+ vfun_inits = tree_cons (NULL_TREE, init, vfun_inits);
+ }
+
+ /* The initializers for virtual functions were built up in reverse
+ order; straighten them out now. */
+ vfun_inits = nreverse (vfun_inits);
+
+ /* The negative offset initializers are also in reverse order. */
+ vid.inits = nreverse (vid.inits);
+
+ /* Chain the two together. */
+ return chainon (vid.inits, vfun_inits);
+}
+
+/* Adds to vid->inits the initializers for the vbase and vcall
+ offsets in BINFO, which is in the hierarchy dominated by T. */
+
+static void
+build_vcall_and_vbase_vtbl_entries (binfo, vid)
+ tree binfo;
+ vtbl_init_data *vid;
+{
+ tree b;
+
+ /* If this is a derived class, we must first create entries
+ corresponding to the primary base class. */
+ b = get_primary_binfo (binfo);
+ if (b)
+ build_vcall_and_vbase_vtbl_entries (b, vid);
+
+ /* Add the vbase entries for this base. */
+ build_vbase_offset_vtbl_entries (binfo, vid);
+ /* Add the vcall entries for this base. */
+ build_vcall_offset_vtbl_entries (binfo, vid);
+}
+
+/* Returns the initializers for the vbase offset entries in the vtable
+ for BINFO (which is part of the class hierarchy dominated by T), in
+ reverse order. VBASE_OFFSET_INDEX gives the vtable index
+ where the next vbase offset will go. */
+
+static void
+build_vbase_offset_vtbl_entries (binfo, vid)
+ tree binfo;
+ vtbl_init_data *vid;
+{
+ tree vbase;
+ tree t;
+ tree non_primary_binfo;
+
+ /* If there are no virtual baseclasses, then there is nothing to
+ do. */
+ if (!TYPE_USES_VIRTUAL_BASECLASSES (BINFO_TYPE (binfo)))
+ return;
+
+ t = vid->derived;
+
+ /* We might be a primary base class. Go up the inheritance hierarchy
+ until we find the most derived class of which we are a primary base:
+ it is the offset of that which we need to use. */
+ non_primary_binfo = binfo;
+ while (BINFO_INHERITANCE_CHAIN (non_primary_binfo))
+ {
+ tree b;
+
+ /* If we have reached a virtual base, then it must be a primary
+ base (possibly multi-level) of vid->binfo, or we wouldn't
+ have called build_vcall_and_vbase_vtbl_entries for it. But it
+ might be a lost primary, so just skip down to vid->binfo. */
+ if (TREE_VIA_VIRTUAL (non_primary_binfo))
+ {
+ non_primary_binfo = vid->binfo;
+ break;
+ }
+
+ b = BINFO_INHERITANCE_CHAIN (non_primary_binfo);
+ if (get_primary_binfo (b) != non_primary_binfo)
+ break;
+ non_primary_binfo = b;
+ }
+
+ /* Go through the virtual bases, adding the offsets. */
+ for (vbase = TYPE_BINFO (BINFO_TYPE (binfo));
+ vbase;
+ vbase = TREE_CHAIN (vbase))
+ {
+ tree b;
+ tree delta;
+
+ if (!TREE_VIA_VIRTUAL (vbase))
+ continue;
+
+ /* Find the instance of this virtual base in the complete
+ object. */
+ b = binfo_for_vbase (BINFO_TYPE (vbase), t);
+
+ /* If we've already got an offset for this virtual base, we
+ don't need another one. */
+ if (BINFO_VTABLE_PATH_MARKED (b))
+ continue;
+ SET_BINFO_VTABLE_PATH_MARKED (b);
+
+ /* Figure out where we can find this vbase offset. */
+ delta = size_binop (MULT_EXPR,
+ vid->index,
+ convert (ssizetype,
+ TYPE_SIZE_UNIT (vtable_entry_type)));
+ if (vid->primary_vtbl_p)
+ BINFO_VPTR_FIELD (b) = delta;
+
+ if (binfo != TYPE_BINFO (t))
+ {
+ tree orig_vbase;
+
+ /* Find the instance of this virtual base in the type of BINFO. */
+ orig_vbase = binfo_for_vbase (BINFO_TYPE (vbase),
+ BINFO_TYPE (binfo));
+
+ /* The vbase offset had better be the same. */
+ if (!tree_int_cst_equal (delta,
+ BINFO_VPTR_FIELD (orig_vbase)))
+ abort ();
+ }
+
+ /* The next vbase will come at a more negative offset. */
+ vid->index = size_binop (MINUS_EXPR, vid->index, ssize_int (1));
+
+ /* The initializer is the delta from BINFO to this virtual base.
+ The vbase offsets go in reverse inheritance-graph order, and
+ we are walking in inheritance graph order so these end up in
+ the right order. */
+ delta = size_diffop (BINFO_OFFSET (b), BINFO_OFFSET (non_primary_binfo));
+
+ *vid->last_init
+ = build_tree_list (NULL_TREE,
+ fold (build1 (NOP_EXPR,
+ vtable_entry_type,
+ delta)));
+ vid->last_init = &TREE_CHAIN (*vid->last_init);
+ }
+}
+
+/* Adds the initializers for the vcall offset entries in the vtable
+ for BINFO (which is part of the class hierarchy dominated by VID->DERIVED)
+ to VID->INITS. */
+
+static void
+build_vcall_offset_vtbl_entries (binfo, vid)
+ tree binfo;
+ vtbl_init_data *vid;
+{
+ /* We only need these entries if this base is a virtual base. */
+ if (!TREE_VIA_VIRTUAL (binfo))
+ return;
+
+ /* We need a vcall offset for each of the virtual functions in this
+ vtable. For example:
+
+ class A { virtual void f (); };
+ class B1 : virtual public A { virtual void f (); };
+ class B2 : virtual public A { virtual void f (); };
+ class C: public B1, public B2 { virtual void f (); };
+
+ A C object has a primary base of B1, which has a primary base of A. A
+ C also has a secondary base of B2, which no longer has a primary base
+ of A. So the B2-in-C construction vtable needs a secondary vtable for
+ A, which will adjust the A* to a B2* to call f. We have no way of
+ knowing what (or even whether) this offset will be when we define B2,
+ so we store this "vcall offset" in the A sub-vtable and look it up in
+ a "virtual thunk" for B2::f.
+
+ We need entries for all the functions in our primary vtable and
+ in our non-virtual bases' secondary vtables. */
+ vid->vbase = binfo;
+ /* Now, walk through the non-virtual bases, adding vcall offsets. */
+ add_vcall_offset_vtbl_entries_r (binfo, vid);
+}
+
+/* Build vcall offsets, starting with those for BINFO. */
+
+static void
+add_vcall_offset_vtbl_entries_r (binfo, vid)
+ tree binfo;
+ vtbl_init_data *vid;
+{
+ int i;
+ tree primary_binfo;
+
+ /* Don't walk into virtual bases -- except, of course, for the
+ virtual base for which we are building vcall offsets. Any
+ primary virtual base will have already had its offsets generated
+ through the recursion in build_vcall_and_vbase_vtbl_entries. */
+ if (TREE_VIA_VIRTUAL (binfo) && vid->vbase != binfo)
+ return;
+
+ /* If BINFO has a primary base, process it first. */
+ primary_binfo = get_primary_binfo (binfo);
+ if (primary_binfo)
+ add_vcall_offset_vtbl_entries_r (primary_binfo, vid);
+
+ /* Add BINFO itself to the list. */
+ add_vcall_offset_vtbl_entries_1 (binfo, vid);
+
+ /* Scan the non-primary bases of BINFO. */
+ for (i = 0; i < BINFO_N_BASETYPES (binfo); ++i)
+ {
+ tree base_binfo;
+
+ base_binfo = BINFO_BASETYPE (binfo, i);
+ if (base_binfo != primary_binfo)
+ add_vcall_offset_vtbl_entries_r (base_binfo, vid);
+ }
+}
+
+/* Called from build_vcall_offset_vtbl_entries_r. */
+
+static void
+add_vcall_offset_vtbl_entries_1 (binfo, vid)
+ tree binfo;
+ vtbl_init_data* vid;
+{
+ tree derived_virtuals;
+ tree base_virtuals;
+ tree orig_virtuals;
+ tree binfo_inits;
+ /* If BINFO is a primary base, the most derived class which has BINFO as
+ a primary base; otherwise, just BINFO. */
+ tree non_primary_binfo;
+
+ binfo_inits = NULL_TREE;
+
+ /* We might be a primary base class. Go up the inheritance hierarchy
+ until we find the most derived class of which we are a primary base:
+ it is the BINFO_VIRTUALS there that we need to consider. */
+ non_primary_binfo = binfo;
+ while (BINFO_INHERITANCE_CHAIN (non_primary_binfo))
+ {
+ tree b;
+
+ /* If we have reached a virtual base, then it must be vid->vbase,
+ because we ignore other virtual bases in
+ add_vcall_offset_vtbl_entries_r. In turn, it must be a primary
+ base (possibly multi-level) of vid->binfo, or we wouldn't
+ have called build_vcall_and_vbase_vtbl_entries for it. But it
+ might be a lost primary, so just skip down to vid->binfo. */
+ if (TREE_VIA_VIRTUAL (non_primary_binfo))
+ {
+ if (non_primary_binfo != vid->vbase)
+ abort ();
+ non_primary_binfo = vid->binfo;
+ break;
+ }
+
+ b = BINFO_INHERITANCE_CHAIN (non_primary_binfo);
+ if (get_primary_binfo (b) != non_primary_binfo)
+ break;
+ non_primary_binfo = b;
+ }
+
+ if (vid->ctor_vtbl_p)
+ /* For a ctor vtable we need the equivalent binfo within the hierarchy
+ where rtti_binfo is the most derived type. */
+ non_primary_binfo = get_original_base
+ (non_primary_binfo, TYPE_BINFO (BINFO_TYPE (vid->rtti_binfo)));
+
+ /* Make entries for the rest of the virtuals. */
+ for (base_virtuals = BINFO_VIRTUALS (binfo),
+ derived_virtuals = BINFO_VIRTUALS (non_primary_binfo),
+ orig_virtuals = BINFO_VIRTUALS (TYPE_BINFO (BINFO_TYPE (binfo)));
+ base_virtuals;
+ base_virtuals = TREE_CHAIN (base_virtuals),
+ derived_virtuals = TREE_CHAIN (derived_virtuals),
+ orig_virtuals = TREE_CHAIN (orig_virtuals))
+ {
+ tree orig_fn;
+ tree fn;
+ tree base;
+ tree base_binfo;
+ size_t i;
+ tree vcall_offset;
+
+ /* Find the declaration that originally caused this function to
+ be present in BINFO_TYPE (binfo). */
+ orig_fn = BV_FN (orig_virtuals);
+
+ /* When processing BINFO, we only want to generate vcall slots for
+ function slots introduced in BINFO. So don't try to generate
+ one if the function isn't even defined in BINFO. */
+ if (!same_type_p (DECL_CONTEXT (orig_fn), BINFO_TYPE (binfo)))
+ continue;
+
+ /* Find the overriding function. */
+ fn = BV_FN (derived_virtuals);
+
+ /* If there is already an entry for a function with the same
+ signature as FN, then we do not need a second vcall offset.
+ Check the list of functions already present in the derived
+ class vtable. */
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (vid->fns); ++i)
+ {
+ tree derived_entry;
+
+ derived_entry = VARRAY_TREE (vid->fns, i);
+ if (same_signature_p (BV_FN (derived_entry), fn)
+ /* We only use one vcall offset for virtual destructors,
+ even though there are two virtual table entries. */
+ || (DECL_DESTRUCTOR_P (BV_FN (derived_entry))
+ && DECL_DESTRUCTOR_P (fn)))
+ {
+ if (!vid->ctor_vtbl_p)
+ BV_VCALL_INDEX (derived_virtuals)
+ = BV_VCALL_INDEX (derived_entry);
+ break;
+ }
+ }
+ if (i != VARRAY_ACTIVE_SIZE (vid->fns))
+ continue;
+
+ /* The FN comes from BASE. So, we must calculate the adjustment from
+ vid->vbase to BASE. We can just look for BASE in the complete
+ object because we are converting from a virtual base, so if there
+ were multiple copies, there would not be a unique final overrider
+ and vid->derived would be ill-formed. */
+ base = DECL_CONTEXT (fn);
+ base_binfo = lookup_base (vid->derived, base, ba_any, NULL);
+
+ /* Compute the vcall offset. */
+ /* As mentioned above, the vbase we're working on is a primary base of
+ vid->binfo. But it might be a lost primary, so its BINFO_OFFSET
+ might be wrong, so we just use the BINFO_OFFSET from vid->binfo. */
+ vcall_offset = BINFO_OFFSET (vid->binfo);
+ vcall_offset = size_diffop (BINFO_OFFSET (base_binfo),
+ vcall_offset);
+ vcall_offset = fold (build1 (NOP_EXPR, vtable_entry_type,
+ vcall_offset));
+
+ *vid->last_init = build_tree_list (NULL_TREE, vcall_offset);
+ vid->last_init = &TREE_CHAIN (*vid->last_init);
+
+ /* Keep track of the vtable index where this vcall offset can be
+ found. For a construction vtable, we already made this
+ annotation when we built the original vtable. */
+ if (!vid->ctor_vtbl_p)
+ BV_VCALL_INDEX (derived_virtuals) = vid->index;
+
+ /* The next vcall offset will be found at a more negative
+ offset. */
+ vid->index = size_binop (MINUS_EXPR, vid->index, ssize_int (1));
+
+ /* Keep track of this function. */
+ VARRAY_PUSH_TREE (vid->fns, derived_virtuals);
+ }
+}
+
+/* Return vtbl initializers for the RTTI entries coresponding to the
+ BINFO's vtable. The RTTI entries should indicate the object given
+ by VID->rtti_binfo. */
+
+static void
+build_rtti_vtbl_entries (binfo, vid)
+ tree binfo;
+ vtbl_init_data *vid;
+{
+ tree b;
+ tree t;
+ tree basetype;
+ tree offset;
+ tree decl;
+ tree init;
+
+ basetype = BINFO_TYPE (binfo);
+ t = BINFO_TYPE (vid->rtti_binfo);
+
+ /* To find the complete object, we will first convert to our most
+ primary base, and then add the offset in the vtbl to that value. */
+ b = binfo;
+ while (CLASSTYPE_HAS_PRIMARY_BASE_P (BINFO_TYPE (b))
+ && !BINFO_LOST_PRIMARY_P (b))
+ {
+ tree primary_base;
+
+ primary_base = get_primary_binfo (b);
+ my_friendly_assert (BINFO_PRIMARY_BASE_OF (primary_base) == b, 20010127);
+ b = primary_base;
+ }
+ offset = size_diffop (BINFO_OFFSET (vid->rtti_binfo), BINFO_OFFSET (b));
+
+ /* The second entry is the address of the typeinfo object. */
+ if (flag_rtti)
+ decl = build_unary_op (ADDR_EXPR, get_tinfo_decl (t), 0);
+ else
+ decl = integer_zero_node;
+
+ /* Convert the declaration to a type that can be stored in the
+ vtable. */
+ init = build1 (NOP_EXPR, vfunc_ptr_type_node, decl);
+ TREE_CONSTANT (init) = 1;
+ *vid->last_init = build_tree_list (NULL_TREE, init);
+ vid->last_init = &TREE_CHAIN (*vid->last_init);
+
+ /* Add the offset-to-top entry. It comes earlier in the vtable that
+ the the typeinfo entry. Convert the offset to look like a
+ function pointer, so that we can put it in the vtable. */
+ init = build1 (NOP_EXPR, vfunc_ptr_type_node, offset);
+ TREE_CONSTANT (init) = 1;
+ *vid->last_init = build_tree_list (NULL_TREE, init);
+ vid->last_init = &TREE_CHAIN (*vid->last_init);
+}
+
+/* Build an entry in the virtual function table. DELTA is the offset
+ for the `this' pointer. VCALL_INDEX is the vtable index containing
+ the vcall offset; NULL_TREE if none. ENTRY is the virtual function
+ table entry itself. It's TREE_TYPE must be VFUNC_PTR_TYPE_NODE,
+ but it may not actually be a virtual function table pointer. (For
+ example, it might be the address of the RTTI object, under the new
+ ABI.) */
+
+static tree
+build_vtable_entry (delta, vcall_index, entry)
+ tree delta;
+ tree vcall_index;
+ tree entry;
+{
+ tree fn = TREE_OPERAND (entry, 0);
+
+ if ((!integer_zerop (delta) || vcall_index != NULL_TREE)
+ && fn != abort_fndecl)
+ {
+ entry = make_thunk (entry, delta, vcall_index);
+ entry = build1 (ADDR_EXPR, vtable_entry_type, entry);
+ TREE_READONLY (entry) = 1;
+ TREE_CONSTANT (entry) = 1;
+ }
+#ifdef GATHER_STATISTICS
+ n_vtable_entries += 1;
+#endif
+ return entry;
+}
diff --git a/contrib/gcc/cp/config-lang.in b/contrib/gcc/cp/config-lang.in
index dd31af4..c07408d 100644
--- a/contrib/gcc/cp/config-lang.in
+++ b/contrib/gcc/cp/config-lang.in
@@ -1,5 +1,6 @@
# Top level configure fragment for GNU C++.
-# Copyright (C) 1994, 1995, 1997, 1998 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1997, 1998, 2000, 2001
+# Free Software Foundation, Inc.
#This file is part of GNU CC.
@@ -24,7 +25,6 @@
# language - name of language as it would appear in $(LANGUAGES)
# compilers - value to add to $(COMPILERS)
# stagestuff - files to add to $(STAGESTUFF)
-# diff_excludes - files to ignore when building diffs between two versions.
language="c++"
@@ -32,10 +32,4 @@ compilers="cc1plus\$(exeext)"
stagestuff="g++\$(exeext) g++-cross\$(exeext) cc1plus\$(exeext)"
-diff_excludes="-x parse.c -x parse.h"
-
-headers='$(CXX_EXTRA_HEADERS)'
-
-lib2funcs=cplib2.txt
-
-outputs=cp/Makefile
+target_libs="${libstdcxx_version} target-gperf"
diff --git a/contrib/gcc/cp/cp-lang.c b/contrib/gcc/cp/cp-lang.c
new file mode 100644
index 0000000..c40330b
--- /dev/null
+++ b/contrib/gcc/cp/cp-lang.c
@@ -0,0 +1,110 @@
+/* Language-dependent hooks for C++.
+ Copyright 2001 Free Software Foundation, Inc.
+ Contributed by Alexandre Oliva <aoliva@redhat.com>
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "tree.h"
+#include "cp-tree.h"
+#include "c-common.h"
+#include "toplev.h"
+#include "langhooks.h"
+#include "langhooks-def.h"
+
+static HOST_WIDE_INT cxx_get_alias_set PARAMS ((tree));
+
+#undef LANG_HOOKS_NAME
+#define LANG_HOOKS_NAME "GNU C++"
+#undef LANG_HOOKS_INIT
+#define LANG_HOOKS_INIT cxx_init
+#undef LANG_HOOKS_FINISH
+#define LANG_HOOKS_FINISH cxx_finish
+#undef LANG_HOOKS_CLEAR_BINDING_STACK
+#define LANG_HOOKS_CLEAR_BINDING_STACK pop_everything
+#undef LANG_HOOKS_INIT_OPTIONS
+#define LANG_HOOKS_INIT_OPTIONS cxx_init_options
+#undef LANG_HOOKS_DECODE_OPTION
+#define LANG_HOOKS_DECODE_OPTION cxx_decode_option
+#undef LANG_HOOKS_POST_OPTIONS
+#define LANG_HOOKS_POST_OPTIONS cxx_post_options
+#undef LANG_HOOKS_GET_ALIAS_SET
+#define LANG_HOOKS_GET_ALIAS_SET cxx_get_alias_set
+#undef LANG_HOOKS_EXPAND_CONSTANT
+#define LANG_HOOKS_EXPAND_CONSTANT cplus_expand_constant
+#undef LANG_HOOKS_SAFE_FROM_P
+#define LANG_HOOKS_SAFE_FROM_P c_safe_from_p
+#undef LANG_HOOKS_PRINT_STATISTICS
+#define LANG_HOOKS_PRINT_STATISTICS cxx_print_statistics
+#undef LANG_HOOKS_PRINT_XNODE
+#define LANG_HOOKS_PRINT_XNODE cxx_print_xnode
+#undef LANG_HOOKS_PRINT_DECL
+#define LANG_HOOKS_PRINT_DECL cxx_print_decl
+#undef LANG_HOOKS_PRINT_TYPE
+#define LANG_HOOKS_PRINT_TYPE cxx_print_type
+#undef LANG_HOOKS_PRINT_IDENTIFIER
+#define LANG_HOOKS_PRINT_IDENTIFIER cxx_print_identifier
+#undef LANG_HOOKS_SET_YYDEBUG
+#define LANG_HOOKS_SET_YYDEBUG cxx_set_yydebug
+
+#undef LANG_HOOKS_TREE_INLINING_WALK_SUBTREES
+#define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES \
+ cp_walk_subtrees
+#undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
+#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
+ cp_cannot_inline_tree_fn
+#undef LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS
+#define LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS \
+ cp_add_pending_fn_decls
+#undef LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P
+#define LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P \
+ cp_is_overload_p
+#undef LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P
+#define LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P \
+ cp_auto_var_in_fn_p
+#undef LANG_HOOKS_TREE_INLINING_COPY_RES_DECL_FOR_INLINING
+#define LANG_HOOKS_TREE_INLINING_COPY_RES_DECL_FOR_INLINING \
+ cp_copy_res_decl_for_inlining
+#undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P
+#define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P anon_aggr_type_p
+#undef LANG_HOOKS_TREE_INLINING_START_INLINING
+#define LANG_HOOKS_TREE_INLINING_START_INLINING cp_start_inlining
+#undef LANG_HOOKS_TREE_INLINING_END_INLINING
+#define LANG_HOOKS_TREE_INLINING_END_INLINING cp_end_inlining
+#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
+#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN cp_dump_tree
+#undef LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN
+#define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN cp_type_quals
+
+/* Each front end provides its own hooks, for toplev.c. */
+const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
+
+/* Special routine to get the alias set for C++. */
+
+static HOST_WIDE_INT
+cxx_get_alias_set (t)
+ tree t;
+{
+ /* It's not yet safe to use alias sets for classes in C++ because
+ the TYPE_FIELDs list for a class doesn't mention base classes. */
+ if (AGGREGATE_TYPE_P (t))
+ return 0;
+
+ return c_common_get_alias_set (t);
+}
diff --git a/contrib/gcc/cp/cp-tree.def b/contrib/gcc/cp/cp-tree.def
index 70801fc..dbe990a 100644
--- a/contrib/gcc/cp/cp-tree.def
+++ b/contrib/gcc/cp/cp-tree.def
@@ -1,7 +1,8 @@
/* This file contains the definitions and documentation for the
additional tree codes used in the GNU C++ compiler (see tree.def
for the standard codes).
- Copyright (C) 1987, 1988, 1990, 1993, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1988, 1990, 1993, 1997, 1998,
+ 1999, 2000, 2001 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -32,7 +33,7 @@ DEFTREECODE (OFFSET_REF, "offset_ref", 'r', 2)
/* A pointer-to-member constant. For a pointer-to-member constant
`X::Y' The PTRMEM_CST_CLASS is the RECORD_TYPE for `X' and the
PTRMEM_CST_MEMBER is the _DECL for `Y'. */
-DEFTREECODE (PTRMEM_CST, "ptrmem_cst", 'c', 1)
+DEFTREECODE (PTRMEM_CST, "ptrmem_cst", 'c', 2)
/* For NEW_EXPR, operand 0 is the placement list.
Operand 1 is the new-declarator.
@@ -70,10 +71,9 @@ DEFTREECODE (AGGR_INIT_EXPR, "aggr_init_expr", 'e', 3)
else it is NULL_TREE. */
DEFTREECODE (THROW_EXPR, "throw_expr", 'e', 1)
-/* Initialization of a vector, used in build_new. Operand 0 is the target
- of the initialization, operand 1 is the initializer, and operand 2 is
- the number of elements. */
-DEFTREECODE (VEC_INIT_EXPR, "vec_init_expr", 'e', 3)
+/* An empty class object. The TREE_TYPE gives the class type. We use
+ these to avoid actually creating instances of the empty classes. */
+DEFTREECODE (EMPTY_CLASS_EXPR, "empty_class_expr", 'e', 0)
/* Template definition. The following fields have the specified uses,
although there are other macros in cp-tree.h that should be used for
@@ -84,10 +84,10 @@ DEFTREECODE (VEC_INIT_EXPR, "vec_init_expr", 'e', 3)
only done for functions so far
For class template:
DECL_INITIAL associated templates (methods &c)
- DECL_RESULT null
+ DECL_TEMPLATE_RESULT null
For non-class templates:
TREE_TYPE type of object to be constructed
- DECL_RESULT decl for object to be created
+ DECL_TEMPLATE_RESULT decl for object to be created
(e.g., FUNCTION_DECL with tmpl parms used)
*/
DEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0)
@@ -126,23 +126,35 @@ DEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0)
the types of things; the ORIG_LEVEL is the level when we are
worrying about instantiating things. */
DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'x',
- /* The addition of (sizeof(char*) - 1) in the next
- expression is to ensure against the case where
- sizeof(char*) does not evenly divide
- sizeof(HOST_WIDE_INT). */
- 2 + ((3 * sizeof (HOST_WIDE_INT) + sizeof(char*) - 1)
- / sizeof (char*)))
+ /* The addition of (sizeof(tree) - 1) in the next expression
+ is to handle the case when padding pushes us past an even
+ multiple of sizeof(tree). */
+ /* We used to try to calculate this using
+ 1+3*sizeof(HOST_WIDE_INT), but that fails if alignment
+ makes it bigger. */
+ ((sizeof (template_parm_index) - sizeof (struct tree_common))
+ + sizeof (tree) - 1)
+ / sizeof (tree))
/* Index into a template parameter list. This parameter must be a type.
The TYPE_FIELDS value will be a TEMPLATE_PARM_INDEX. */
DEFTREECODE (TEMPLATE_TYPE_PARM, "template_type_parm", 't', 0)
-/* Index into a template parameter list. This parameter must be a type.
- If it is used in signature of a template, TEMPLATE_INFO is NULL_TREE.
- Otherwise it is used to declare a type like TT<int>.
- The TYPE_FIELDS value will be a TEMPLATE_PARM_INDEX. */
+/* Index into a template parameter list for template template parameters.
+ This parameter must be a type. The TYPE_FIELDS value will be a
+ TEMPLATE_PARM_INDEX.
+
+ It is used without template arguments like TT in C<TT>,
+ TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO is NULL_TREE
+ and TYPE_NAME is a TEMPLATE_DECL. */
DEFTREECODE (TEMPLATE_TEMPLATE_PARM, "template_template_parm", 't', 0)
+/* Like TEMPLATE_TEMPLATE_PARM it is used with bound template arguments
+ like TT<int>.
+ In this case, TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO contains the
+ template name and its bound arguments. TYPE_NAME is a TYPE_DECL. */
+DEFTREECODE (BOUND_TEMPLATE_TEMPLATE_PARM, "bound_template_template_parm", 't', 0)
+
/* A type designated by `typename T::t'. TYPE_CONTEXT is `T',
TYPE_NAME is an IDENTIFIER_NODE for `t'. If the type was named via
template-id, TYPENAME_TYPE_FULLNAME will hold the TEMPLATE_ID_EXPR.
@@ -151,26 +163,24 @@ DEFTREECODE (TEMPLATE_TEMPLATE_PARM, "template_template_parm", 't', 0)
of `T'. */
DEFTREECODE (TYPENAME_TYPE, "typename_type", 't', 0)
+/* For template template argument of the form `T::template C'.
+ TYPE_CONTEXT is `T', the template parameter dependent object.
+ TYPE_NAME is an IDENTIFIER_NODE for `C', the member class template. */
+DEFTREECODE (UNBOUND_CLASS_TEMPLATE, "unbound_class_template", 't', 0)
+
/* A type designated by `__typeof (expr)'. TYPE_FIELDS is the
expression in question. */
DEFTREECODE (TYPEOF_TYPE, "typeof_type", 't', 0)
-/* A thunk is a stub function.
-
- Thunks are used to implement multiple inheritance:
- At run-time, such a thunk subtracts THUNK_DELTA (an int, not a tree)
- from the this pointer, and then jumps to DECL_INITIAL
- (which is an ADDR_EXPR whose operand is a FUNCTION_DECL).
-
- Other kinds of thunks may be defined later. */
-DEFTREECODE (THUNK_DECL, "thunk_decl", 'd', 0)
-
/* A using declaration. DECL_INITIAL contains the specified scope.
This is not an alias, but is later expanded into multiple aliases. */
DEFTREECODE (USING_DECL, "using_decl", 'd', 0)
+/* A using directive. The operand is USING_STMT_NAMESPACE. */
+DEFTREECODE (USING_STMT, "using_directive", 'e', 1)
+
/* An un-parsed default argument. Looks like an IDENTIFIER_NODE. */
-DEFTREECODE (DEFAULT_ARG, "default_arg", 'c', 2)
+DEFTREECODE (DEFAULT_ARG, "default_arg", 'x', 2)
/* A template-id, like foo<int>. The first operand is the template.
The second is the TREE_LIST or TREE_VEC of explicitly specified
@@ -192,9 +202,6 @@ DEFTREECODE (OVERLOAD, "overload", 'x', 1)
tree structure. */
DEFTREECODE (WRAPPER, "wrapper", 'x', 1)
-/* A node to remember a source position. */
-DEFTREECODE (SRCLOC, "srcloc", 'x', 2)
-
/* Used to represent deferred name lookup for dependent names while
parsing a template declaration. The first argument is an
IDENTIFIER_NODE for the name in question. The TREE_TYPE is
@@ -209,31 +216,39 @@ DEFTREECODE (REINTERPRET_CAST_EXPR, "reinterpret_cast_expr", '1', 1)
DEFTREECODE (CONST_CAST_EXPR, "const_cast_expr", '1', 1)
DEFTREECODE (STATIC_CAST_EXPR, "static_cast_expr", '1', 1)
DEFTREECODE (DYNAMIC_CAST_EXPR, "dynamic_cast_expr", '1', 1)
-DEFTREECODE (SIZEOF_EXPR, "sizeof_expr", '1', 1)
-DEFTREECODE (ALIGNOF_EXPR, "alignof_expr", '1', 1)
-DEFTREECODE (ARROW_EXPR, "arrow_expr", 'e', 1)
DEFTREECODE (DOTSTAR_EXPR, "dotstar_expr", 'e', 2)
DEFTREECODE (TYPEID_EXPR, "typeid_expr", 'e', 1)
-
-DEFTREECODE (EXPR_STMT, "expr_stmt", 'e', 1)
-DEFTREECODE (COMPOUND_STMT, "compound_stmt", 'e', 1)
-DEFTREECODE (DECL_STMT, "decl_stmt", 'e', 3)
-DEFTREECODE (IF_STMT, "if_stmt", 'e', 3)
-DEFTREECODE (FOR_STMT, "for_stmt", 'e', 4)
-DEFTREECODE (WHILE_STMT, "while_stmt", 'e', 2)
-DEFTREECODE (DO_STMT, "do_stmt", 'e', 2)
-DEFTREECODE (RETURN_STMT, "return_stmt", 'e', 1)
-DEFTREECODE (BREAK_STMT, "break_stmt", 'e', 0)
-DEFTREECODE (CONTINUE_STMT, "continue_stmt", 'e', 0)
-DEFTREECODE (SWITCH_STMT, "switch_stmt", 'e', 2)
-DEFTREECODE (GOTO_STMT, "goto_stmt", 'e', 1)
-DEFTREECODE (ASM_STMT, "asm_stmt", 'e', 5)
-
+DEFTREECODE (PSEUDO_DTOR_EXPR, "pseudo_dtor_expr", 'e', 3)
+
+/* A SUBOBJECT statement marks the point at which a sub-object is
+ fully constructed. After this point, the SUBOBJECT_CLEANUP must be
+ run if an exception is thrown before the end of the enclosing
+ function. */
+DEFTREECODE (SUBOBJECT, "subobject", 'e', 1)
+/* An CTOR_STMT marks the beginning (if CTOR_BEGIN_P holds) or end of
+ a constructor (if CTOR_END_P) holds. At the end of a constructor,
+ the cleanups associated with any SUBOBJECT_CLEANUPS need no longer
+ be run. */
+DEFTREECODE (CTOR_STMT, "ctor_stmt", 'e', 0)
+/* A CLEANUP_STMT marks the point at which a declaration is fully
+ constructed. If, after this point, the CLEANUP_DECL goes out of
+ scope, the CLEANUP_EXPR must be run. */
+DEFTREECODE (CLEANUP_STMT, "cleanup_stmt", 'e', 2)
+/* CTOR_INITIALIZER is a placeholder in template code for a call to
+ setup_vtbl_pointer (and appears in all functions, not just ctors). */
DEFTREECODE (CTOR_INITIALIZER, "ctor_initializer", 'e', 2)
-DEFTREECODE (CASE_LABEL, "case_label", 'e', 2)
DEFTREECODE (RETURN_INIT, "return_init", 'e', 2)
-DEFTREECODE (TRY_BLOCK, "try_stmt", 'e', 2)
-DEFTREECODE (HANDLER, "catch_stmt", 'e', 2)
+DEFTREECODE (TRY_BLOCK, "try_block", 'e', 2)
+DEFTREECODE (EH_SPEC_BLOCK, "eh_spec_block", 'e', 2)
+/* A HANDLER wraps a catch handler for the HANDLER_TYPE. If this is
+ CATCH_ALL_TYPE, then the handler catches all types. The declaration of
+ the catch variable is in HANDLER_PARMS, and the body block in
+ HANDLER_BODY. */
+DEFTREECODE (HANDLER, "handler", 'e', 2)
+
+/* A MUST_NOT_THROW_EXPR wraps an expression that may not
+ throw, and must call terminate if it does. */
+DEFTREECODE (MUST_NOT_THROW_EXPR, "must_not_throw_expr", 'e', 1)
DEFTREECODE (TAG_DEFN, "tag_defn", 'e', 0)
diff --git a/contrib/gcc/cp/cp-tree.h b/contrib/gcc/cp/cp-tree.h
index 8c1e7df..f7cddac 100644
--- a/contrib/gcc/cp/cp-tree.h
+++ b/contrib/gcc/cp/cp-tree.h
@@ -1,6 +1,7 @@
/* Definitions for C++ parsing and type checking.
- Copyright (C) 1987, 92-97, 1998, 1999 Free Software Foundation, Inc.
- Hacked by Michael Tiemann (tiemann@cygnus.com)
+ Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 2000, 2001, 2002 Free Software Foundation, Inc.
+ Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -19,65 +20,93 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef _CP_TREE_H
-#define _CP_TREE_H
+#include "function.h"
+#include "hashtab.h"
+#include "splay-tree.h"
+#include "varray.h"
+
+#ifndef GCC_CP_TREE_H
+#define GCC_CP_TREE_H
+
+#include "c-common.h"
/* Usage of TREE_LANG_FLAG_?:
0: BINFO_MARKED (BINFO nodes).
- COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
+ IDENTIFIER_MARKED (IDENTIFIER_NODEs)
NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR).
- TREE_NEGATED_INT (in INTEGER_CST).
TREE_INDIRECT_USING (in NAMESPACE_DECL).
- IDENTIFIER_MARKED (used by search routines).
LOCAL_BINDING_P (in CPLUS_BINDING)
+ ICS_USER_FLAG (in _CONV)
+ CLEANUP_P (in TRY_BLOCK)
+ AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR)
+ CTOR_BEGIN_P (in CTOR_STMT)
+ BV_USE_VCALL_INDEX_P (in the BINFO_VIRTUALS TREE_LIST)
+ PTRMEM_OK_P (in ADDR_EXPR, OFFSET_REF)
+ PARMLIST_ELLIPSIS_P (in PARMLIST)
1: IDENTIFIER_VIRTUAL_P.
TI_PENDING_TEMPLATE_FLAG.
TEMPLATE_PARMS_FOR_INLINE.
DELETE_EXPR_USE_VEC (in DELETE_EXPR).
(TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
- TYPE_USES_COMPLEX_INHERITANCE (in _TYPE).
- C_DECLARED_LABEL_FLAG.
+ TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (in _TYPE).
INHERITED_VALUE_BINDING_P (in CPLUS_BINDING)
BASELINK_P (in TREE_LIST)
+ ICS_ELLIPSIS_FLAG (in _CONV)
+ BINFO_ACCESS (in BINFO)
2: IDENTIFIER_OPNAME_P.
- BINFO_VBASE_MARKED.
- BINFO_FIELDS_MARKED.
- TYPE_VIRTUAL_P.
+ TYPE_POLYMORHPIC_P (in _TYPE)
+ ICS_THIS_FLAG (in _CONV)
+ BINDING_HAS_LEVEL_P (in CPLUS_BINDING)
+ BINFO_LOST_PRIMARY_P (in BINFO)
+ TREE_PARMLIST (in TREE_LIST)
3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE).
BINFO_VTABLE_PATH_MARKED.
BINFO_PUSHDECLS_MARKED.
(TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
+ ICS_BAD_FLAG (in _CONV)
+ FN_TRY_BLOCK_P (in TRY_BLOCK)
+ IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE)
4: BINFO_NEW_VTABLE_MARKED.
TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
or FIELD_DECL).
- 5: TYPE_USES_PVBASES (in a class TYPE).
- 6: Not used.
+ NEED_TEMPORARY_P (in REF_BIND, BASE_CONV)
+ IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE)
+ 5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE)
+ 6: BINFO_ACCESS (in BINFO)
Usage of TYPE_LANG_FLAG_?:
0: C_TYPE_FIELDS_READONLY (in RECORD_TYPE or UNION_TYPE).
1: TYPE_HAS_CONSTRUCTOR.
2: TYPE_HAS_DESTRUCTOR.
3: TYPE_FOR_JAVA.
- 4: TYPE_NEEDS_DESTRUCTOR.
+ 4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
5: IS_AGGR_TYPE.
6: TYPE_BUILT_IN.
Usage of DECL_LANG_FLAG_?:
0: DECL_ERROR_REPORTED (in VAR_DECL).
- DECL_TEMPLATE_PARM_P (in CONST_DECL, TYPE_DECL, or TEMPLATE_DECL)
+ DECL_TEMPLATE_PARM_P (in PARM_DECL, CONST_DECL, TYPE_DECL, or TEMPLATE_DECL)
+ DECL_LOCAL_FUNCTION_P (in FUNCTION_DECL)
+ DECL_MUTABLE_P (in FIELD_DECL)
1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL)
+ DECL_C_BITFIELD (in FIELD_DECL)
2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
+ DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL)
3: DECL_IN_AGGR_P.
- 4: DECL_MAYBE_TEMPLATE.
+ 4: DECL_C_BIT_FIELD
5: DECL_INTERFACE_KNOWN.
6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
+ DECL_THUNK_P (in a member FUNCTION_DECL)
Usage of language-independent fields in a language-dependent manner:
-
+
+ TREE_USED
+ This field is BINFO_INDIRECT_PRIMARY_P in a BINFO.
+
TYPE_ALIAS_SET
This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so
forth as a substitute for the mark bits provided in `lang_type'.
@@ -85,19 +114,123 @@ Boston, MA 02111-1307, USA. */
TYPE_BINFO
For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO.
- For a TYPENAME_TYPE, this is TYPENAME_TYPE_FULLNAME.
- For a TEMPLATE_TEMPLATE_PARM, this is
- TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
+ For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS
+
+ BINFO_VIRTUALS
+ For a binfo, this is a TREE_LIST. The BV_DELTA of each node
+ gives the amount by which to adjust the `this' pointer when
+ calling the function. If the method is an overriden version of a
+ base class method, then it is assumed that, prior to adjustment,
+ the this pointer points to an object of the base class.
+
+ The BV_VCALL_INDEX of each node, if non-NULL, gives the vtable
+ index of the vcall offset for this entry. If
+ BV_USE_VCALL_INDEX_P then the corresponding vtable entry should
+ use a virtual thunk, as opposed to an ordinary thunk.
+
+ The BV_FN is the declaration for the virtual function itself.
+
+ BINFO_VTABLE
+ This is an expression with POINTER_TYPE that gives the value
+ to which the vptr should be initialized. Use get_vtbl_decl_for_binfo
+ to extract the VAR_DECL for the complete vtable.
+
+ DECL_ARGUMENTS
+ For a VAR_DECL this is DECL_ANON_UNION_ELEMS.
+
+ DECL_VINDEX
+ This field is NULL for a non-virtual function. For a virtual
+ function, it is eventually set to an INTEGER_CST indicating the
+ index in the vtable at which this function can be found. When
+ a virtual function is declared, but before it is known what
+ function is overriden, this field is the error_mark_node.
+
+ Temporarily, it may be set to a TREE_LIST whose TREE_VALUE is
+ the virtual function this one overrides, and whose TREE_CHAIN is
+ the old DECL_VINDEX. */
+
+/* Language-specific tree checkers. */
+
+#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
+
+#define VAR_OR_FUNCTION_DECL_CHECK(NODE) \
+({ const tree __t = (NODE); \
+ enum tree_code const __c = TREE_CODE(__t); \
+ if (__c != VAR_DECL && __c != FUNCTION_DECL) \
+ tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \
+ __FUNCTION__); \
+ __t; })
+
+#define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \
+({ const tree __t = (NODE); \
+ enum tree_code const __c = TREE_CODE(__t); \
+ if (__c != VAR_DECL \
+ && __c != FUNCTION_DECL \
+ && __c != PARM_DECL) \
+ tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \
+ __FUNCTION__); \
+ __t; })
+
+#define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \
+({ const tree __t = (NODE); \
+ enum tree_code const __c = TREE_CODE(__t); \
+ if (__c != VAR_DECL \
+ && __c != FUNCTION_DECL \
+ && __c != TYPE_DECL \
+ && __c != TEMPLATE_DECL) \
+ tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \
+ __FUNCTION__); \
+ __t; })
+
+#define RECORD_OR_UNION_TYPE_CHECK(NODE) \
+({ const tree __t = (NODE); \
+ enum tree_code const __c = TREE_CODE(__t); \
+ if (__c != RECORD_TYPE && __c != UNION_TYPE) \
+ tree_check_failed (__t, RECORD_TYPE, __FILE__, __LINE__, \
+ __FUNCTION__); \
+ __t; })
+
+#define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \
+({ const tree __t = (NODE); \
+ enum tree_code const __c = TREE_CODE(__t); \
+ if (__c != BOUND_TEMPLATE_TEMPLATE_PARM) \
+ tree_check_failed (__t, BOUND_TEMPLATE_TEMPLATE_PARM, \
+ __FILE__, __LINE__, __FUNCTION__); \
+ __t; })
+
+#else /* not ENABLE_TREE_CHECKING, or not gcc */
+
+#define VAR_OR_FUNCTION_DECL_CHECK(NODE) (NODE)
+#define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) (NODE)
+#define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) (NODE)
+#define RECORD_OR_UNION_TYPE_CHECK(NODE) (NODE)
+#define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) (NODE)
- DECL_SAVED_INSNS/DECL_FIELD_SIZE
- For a static VAR_DECL, this is DECL_INIT_PRIORITY.
-*/
+#endif
+
+/* ABI control. */
+
+/* Nonzero to use __cxa_atexit, rather than atexit, to register
+ destructors for local statics and global objects. */
+
+extern int flag_use_cxa_atexit;
+
+/* Nonzero means generate 'rtti' that give run-time type information. */
+
+extern int flag_rtti;
+
+/* Nonzero if we want to support huge (> 2^(sizeof(short)*8-1) bytes)
+ objects. */
+
+extern int flag_huge_objects;
+
+
/* Language-dependent contents of an identifier. */
struct lang_identifier
{
- struct tree_identifier ignore;
+ struct c_common_identifier ignore;
tree namespace_bindings;
tree bindings;
tree class_value;
@@ -105,23 +238,34 @@ struct lang_identifier
struct lang_id2 *x;
};
+/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
+ keyword. C_RID_CODE (node) is then the RID_* value of the keyword,
+ and C_RID_YYCODE is the token number wanted by Yacc. */
+
+#define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_5 (ID)
+
+extern const short rid_to_yy[RID_MAX];
+#define C_RID_YYCODE(ID) rid_to_yy[C_RID_CODE (ID)]
+
+#define LANG_IDENTIFIER_CAST(NODE) \
+ ((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE))
+
struct lang_id2
{
tree label_value, implicit_decl;
tree error_locus;
};
-typedef struct
+typedef struct
{
tree t;
int new_type_flag;
+ tree lookups;
} flagged_type_tree;
-typedef struct
+typedef struct
{
- char common[sizeof (struct tree_common)];
- struct rtx_def *rtl; /* Unused, but required to match up with what
- the middle-end expects. */
+ struct tree_common common;
HOST_WIDE_INT index;
HOST_WIDE_INT level;
HOST_WIDE_INT orig_level;
@@ -130,44 +274,78 @@ typedef struct
typedef struct ptrmem_cst
{
- char common[sizeof (struct tree_common)];
+ struct tree_common common;
+ /* This isn't used, but the middle-end expects all constants to have
+ this field. */
+ rtx rtl;
tree member;
}* ptrmem_cst_t;
/* Nonzero if this binding is for a local scope, as opposed to a class
or namespace scope. */
-#define LOCAL_BINDING_P(NODE) TREE_LANG_FLAG_0(NODE)
+#define LOCAL_BINDING_P(NODE) TREE_LANG_FLAG_0 (NODE)
/* Nonzero if BINDING_VALUE is from a base class of the class which is
currently being defined. */
-#define INHERITED_VALUE_BINDING_P(NODE) TREE_LANG_FLAG_1(NODE)
+#define INHERITED_VALUE_BINDING_P(NODE) TREE_LANG_FLAG_1 (NODE)
/* For a binding between a name and an entity at a non-local scope,
defines the scope where the binding is declared. (Either a class
_TYPE node, or a NAMESPACE_DECL.) This macro should be used only
for namespace-level bindings; on the IDENTIFIER_BINDING list
BINDING_LEVEL is used instead. */
-#define BINDING_SCOPE(NODE) (((struct tree_binding*)NODE)->scope.scope)
+#define BINDING_SCOPE(NODE) \
+ (((struct tree_binding*)CPLUS_BINDING_CHECK (NODE))->scope.scope)
+
+/* Nonzero if NODE has BINDING_LEVEL, rather than BINDING_SCOPE. */
+#define BINDING_HAS_LEVEL_P(NODE) TREE_LANG_FLAG_2 (NODE)
/* This is the declaration bound to the name. Possible values:
variable, overloaded function, namespace, template, enumerator. */
-#define BINDING_VALUE(NODE) (((struct tree_binding*)NODE)->value)
+#define BINDING_VALUE(NODE) \
+ (((struct tree_binding*)CPLUS_BINDING_CHECK (NODE))->value)
/* If name is bound to a type, this is the type (struct, union, enum). */
-#define BINDING_TYPE(NODE) TREE_TYPE(NODE)
+#define BINDING_TYPE(NODE) TREE_TYPE (NODE)
#define IDENTIFIER_GLOBAL_VALUE(NODE) \
- namespace_binding (NODE, global_namespace)
+ namespace_binding ((NODE), global_namespace)
#define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
- set_namespace_binding (NODE, global_namespace, VAL)
+ set_namespace_binding ((NODE), global_namespace, (VAL))
#define IDENTIFIER_NAMESPACE_VALUE(NODE) \
- namespace_binding (NODE, current_namespace)
+ namespace_binding ((NODE), current_namespace)
#define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \
- set_namespace_binding (NODE, current_namespace, VAL)
+ set_namespace_binding ((NODE), current_namespace, (VAL))
+
+#define CLEANUP_P(NODE) TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE))
+#define CLEANUP_DECL(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 0)
+#define CLEANUP_EXPR(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 1)
+
+/* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual
+ sense of `same'. */
+#define same_type_p(TYPE1, TYPE2) \
+ comptypes ((TYPE1), (TYPE2), COMPARE_STRICT)
+
+/* Returns nonzero iff TYPE1 and TYPE2 are the same type, ignoring
+ top-level qualifiers. */
+#define same_type_ignoring_top_level_qualifiers_p(TYPE1, TYPE2) \
+ same_type_p (TYPE_MAIN_VARIANT (TYPE1), TYPE_MAIN_VARIANT (TYPE2))
+
+/* Non-zero if we are presently building a statement tree, rather
+ than expanding each statement as we encounter it. */
+#define building_stmt_tree() (last_tree != NULL_TREE)
+
+/* Returns non-zero iff NODE is a declaration for the global function
+ `main'. */
+#define DECL_MAIN_P(NODE) \
+ (DECL_EXTERN_C_FUNCTION_P (NODE) \
+ && DECL_NAME (NODE) != NULL_TREE \
+ && MAIN_NAME_P (DECL_NAME (NODE)))
+
struct tree_binding
{
- char common[sizeof (struct tree_common)];
+ struct tree_common common;
union {
tree scope;
struct binding_level *level;
@@ -176,21 +354,22 @@ struct tree_binding
};
/* The overloaded FUNCTION_DECL. */
-#define OVL_FUNCTION(NODE) (((struct tree_overload*)NODE)->function)
-#define OVL_CHAIN(NODE) TREE_CHAIN(NODE)
+#define OVL_FUNCTION(NODE) \
+ (((struct tree_overload*)OVERLOAD_CHECK (NODE))->function)
+#define OVL_CHAIN(NODE) TREE_CHAIN (NODE)
/* Polymorphic access to FUNCTION and CHAIN. */
#define OVL_CURRENT(NODE) \
- ((TREE_CODE(NODE)==OVERLOAD) ? OVL_FUNCTION(NODE) : NODE)
+ ((TREE_CODE (NODE) == OVERLOAD) ? OVL_FUNCTION (NODE) : (NODE))
#define OVL_NEXT(NODE) \
- ((TREE_CODE(NODE)==OVERLOAD) ? TREE_CHAIN(NODE) : NULL_TREE)
+ ((TREE_CODE (NODE) == OVERLOAD) ? TREE_CHAIN (NODE) : NULL_TREE)
/* If set, this was imported in a using declaration.
This is not to confuse with being used somewhere, which
is not important for this node. */
-#define OVL_USED(NODE) TREE_USED(NODE)
+#define OVL_USED(NODE) TREE_USED (NODE)
struct tree_overload
{
- char common[sizeof (struct tree_common)];
+ struct tree_common common;
tree function;
};
@@ -198,41 +377,37 @@ struct tree_overload
indicating a particular base class, and whose TREE_VALUE is a
(possibly overloaded) function from that base class. */
#define BASELINK_P(NODE) \
- (TREE_CODE ((NODE)) == TREE_LIST && TREE_LANG_FLAG_1 ((NODE)))
+ (TREE_CODE (NODE) == TREE_LIST && TREE_LANG_FLAG_1 (NODE))
#define SET_BASELINK_P(NODE) \
- (TREE_LANG_FLAG_1 ((NODE)) = 1)
+ (TREE_LANG_FLAG_1 (NODE) = 1)
-#define WRAPPER_PTR(NODE) (((struct tree_wrapper*)NODE)->u.ptr)
-#define WRAPPER_INT(NODE) (((struct tree_wrapper*)NODE)->u.i)
+#define WRAPPER_PTR(NODE) (((struct tree_wrapper*)WRAPPER_CHECK (NODE))->u.ptr)
+#define WRAPPER_INT(NODE) (((struct tree_wrapper*)WRAPPER_CHECK (NODE))->u.i)
struct tree_wrapper
{
- char common[sizeof (struct tree_common)];
+ struct tree_common common;
union {
void *ptr;
int i;
} u;
};
-#define SRCLOC_FILE(NODE) (((struct tree_srcloc*)NODE)->filename)
-#define SRCLOC_LINE(NODE) (((struct tree_srcloc*)NODE)->linenum)
+#define SRCLOC_FILE(NODE) (((struct tree_srcloc*)SRCLOC_CHECK (NODE))->filename)
+#define SRCLOC_LINE(NODE) (((struct tree_srcloc*)SRCLOC_CHECK (NODE))->linenum)
struct tree_srcloc
{
- char common[sizeof (struct tree_common)];
- char *filename;
+ struct tree_common common;
+ const char *filename;
int linenum;
};
-/* To identify to the debug emitters if it should pay attention to the
- flag `-Wtemplate-debugging'. */
-#define HAVE_TEMPLATES 1
-
/* Macros for access to language-specific slots in an identifier. */
#define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \
- (((struct lang_identifier *)(NODE))->namespace_bindings)
+ (LANG_IDENTIFIER_CAST (NODE)->namespace_bindings)
#define IDENTIFIER_TEMPLATE(NODE) \
- (((struct lang_identifier *)(NODE))->class_template_info)
+ (LANG_IDENTIFIER_CAST (NODE)->class_template_info)
/* The IDENTIFIER_BINDING is the innermost CPLUS_BINDING for the
identifier. It's TREE_CHAIN is the next outermost binding. Each
@@ -242,12 +417,12 @@ struct tree_srcloc
and such.) You can use BINDING_SCOPE or BINDING_LEVEL to
determine the scope that bound the name. */
#define IDENTIFIER_BINDING(NODE) \
- (((struct lang_identifier*) (NODE))->bindings)
+ (LANG_IDENTIFIER_CAST (NODE)->bindings)
/* The IDENTIFIER_VALUE is the value of the IDENTIFIER_BINDING, or
NULL_TREE if there is no binding. */
#define IDENTIFIER_VALUE(NODE) \
- (IDENTIFIER_BINDING (NODE) \
+ (IDENTIFIER_BINDING (NODE) \
? BINDING_VALUE (IDENTIFIER_BINDING (NODE)) \
: NULL_TREE)
@@ -257,136 +432,499 @@ struct tree_srcloc
IDENTIFIER_BINDINGs list, so any time that this is non-NULL so is
IDENTIFIER_BINDING. */
#define IDENTIFIER_CLASS_VALUE(NODE) \
- (((struct lang_identifier *) (NODE))->class_value)
-
-/* The amount of time used by the file whose special "time identifier"
- is NODE, represented as an INTEGER_CST. See get_time_identifier. */
-#define TIME_IDENTIFIER_TIME(NODE) IDENTIFIER_BINDING(NODE)
-
-/* For a "time identifier" this is a INTEGER_CST. The
- TREE_INT_CST_LOW is 1 if the corresponding file is "interface only".
- The TRE_INT_CST_HIGH is 1 if it is "interface unknown". */
-#define TIME_IDENTIFIER_FILEINFO(NODE) IDENTIFIER_CLASS_VALUE (NODE)
+ (LANG_IDENTIFIER_CAST (NODE)->class_value)
/* TREE_TYPE only indicates on local and class scope the current
type. For namespace scope, the presence of a type in any namespace
is indicated with global_type_node, and the real type behind must
be found through lookup. */
-#define IDENTIFIER_TYPE_VALUE(NODE) (identifier_type_value(NODE))
-#define REAL_IDENTIFIER_TYPE_VALUE(NODE) (TREE_TYPE (NODE))
-#define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = TYPE)
+#define IDENTIFIER_TYPE_VALUE(NODE) identifier_type_value (NODE)
+#define REAL_IDENTIFIER_TYPE_VALUE(NODE) TREE_TYPE (NODE)
+#define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = (TYPE))
#define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0)
-#define LANG_ID_FIELD(NAME,NODE) \
- (((struct lang_identifier *)(NODE))->x \
- ? ((struct lang_identifier *)(NODE))->x->NAME : 0)
-#define SET_LANG_ID(NODE,VALUE,NAME) \
- (((struct lang_identifier *)(NODE))->x == 0 \
- ? ((struct lang_identifier *)(NODE))->x \
- = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \
- ((struct lang_identifier *)(NODE))->x->NAME = (VALUE))
+#define LANG_ID_FIELD(NAME, NODE) \
+ (LANG_IDENTIFIER_CAST (NODE)->x \
+ ? LANG_IDENTIFIER_CAST (NODE)->x->NAME : 0)
-#define IDENTIFIER_LABEL_VALUE(NODE) LANG_ID_FIELD(label_value, NODE)
-#define SET_IDENTIFIER_LABEL_VALUE(NODE,VALUE) \
- SET_LANG_ID(NODE, VALUE, label_value)
+#define SET_LANG_ID(NODE, VALUE, NAME) \
+ (LANG_IDENTIFIER_CAST (NODE)->x == 0 \
+ ? LANG_IDENTIFIER_CAST (NODE)->x \
+ = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \
+ LANG_IDENTIFIER_CAST (NODE)->x->NAME = (VALUE))
-#define IDENTIFIER_IMPLICIT_DECL(NODE) LANG_ID_FIELD(implicit_decl, NODE)
-#define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE) \
- SET_LANG_ID(NODE, VALUE, implicit_decl)
+#define IDENTIFIER_LABEL_VALUE(NODE) \
+ LANG_ID_FIELD (label_value, NODE)
+#define SET_IDENTIFIER_LABEL_VALUE(NODE, VALUE) \
+ SET_LANG_ID (NODE, VALUE, label_value)
-#define IDENTIFIER_ERROR_LOCUS(NODE) LANG_ID_FIELD(error_locus, NODE)
-#define SET_IDENTIFIER_ERROR_LOCUS(NODE,VALUE) \
- SET_LANG_ID(NODE, VALUE, error_locus)
+#define IDENTIFIER_IMPLICIT_DECL(NODE) \
+ LANG_ID_FIELD (implicit_decl, NODE)
+#define SET_IDENTIFIER_IMPLICIT_DECL(NODE, VALUE) \
+ SET_LANG_ID (NODE, VALUE, implicit_decl)
+#define IDENTIFIER_ERROR_LOCUS(NODE) \
+ LANG_ID_FIELD (error_locus, NODE)
+#define SET_IDENTIFIER_ERROR_LOCUS(NODE, VALUE) \
+ SET_LANG_ID (NODE, VALUE, error_locus)
-#define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1(NODE)
+/* Nonzero if this identifier is used as a virtual function name somewhere
+ (optimizes searches). */
+#define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1 (NODE)
-/* Nonzero if this identifier is the prefix for a mangled C++ operator name. */
-#define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2(NODE)
+/* Nonzero if this identifier is the prefix for a mangled C++ operator
+ name. */
+#define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2 (NODE)
/* Nonzero if this identifier is the name of a type-conversion
operator. */
-#define IDENTIFIER_TYPENAME_P(NODE) \
- (! strncmp (IDENTIFIER_POINTER (NODE), \
- OPERATOR_TYPENAME_FORMAT, \
- strlen (OPERATOR_TYPENAME_FORMAT)))
+#define IDENTIFIER_TYPENAME_P(NODE) \
+ TREE_LANG_FLAG_4 (NODE)
-/* Nonzero means reject anything that ANSI standard C forbids. */
-extern int pedantic;
+/* Nonzero if this identifier is the name of a constructor or
+ destructor. */
+#define IDENTIFIER_CTOR_OR_DTOR_P(NODE) \
+ TREE_LANG_FLAG_3 (NODE)
/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
-#define C_TYPE_FIELDS_READONLY(type) TYPE_LANG_FLAG_0 (type)
-
-/* Record in each node resulting from a binary operator
- what operator was specified for it. */
-#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
+#define C_TYPE_FIELDS_READONLY(TYPE) TYPE_LANG_FLAG_0 (TYPE)
/* Store a value in that field. */
-#define C_SET_EXP_ORIGINAL_CODE(exp, code) \
- (TREE_COMPLEXITY (exp) = (int)(code))
+#define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \
+ (TREE_COMPLEXITY (EXP) = (int)(CODE))
/* If non-zero, a VAR_DECL whose cleanup will cause a throw to the
next exception handler. */
extern tree exception_throw_decl;
-extern tree double_type_node, long_double_type_node, float_type_node;
-extern tree char_type_node, unsigned_char_type_node, signed_char_type_node;
-extern tree ptrdiff_type_node;
-
-extern tree short_integer_type_node, short_unsigned_type_node;
-extern tree long_integer_type_node, long_unsigned_type_node;
-extern tree long_long_integer_type_node, long_long_unsigned_type_node;
-extern tree unsigned_type_node;
-extern tree string_type_node, char_array_type_node, int_array_type_node;
-extern tree wchar_array_type_node;
-extern tree wchar_type_node, signed_wchar_type_node, unsigned_wchar_type_node;
-
-extern tree complex_integer_type_node;
-extern tree complex_float_type_node;
-extern tree complex_double_type_node;
-extern tree complex_long_double_type_node;
-
-extern tree intQI_type_node, unsigned_intQI_type_node;
-extern tree intHI_type_node, unsigned_intHI_type_node;
-extern tree intSI_type_node, unsigned_intSI_type_node;
-extern tree intDI_type_node, unsigned_intDI_type_node;
-#if HOST_BITS_PER_WIDE_INT >= 64
-extern tree intTI_type_node, unsigned_intTI_type_node;
-#endif
+enum cp_tree_index
+{
+ CPTI_JAVA_BYTE_TYPE,
+ CPTI_JAVA_SHORT_TYPE,
+ CPTI_JAVA_INT_TYPE,
+ CPTI_JAVA_LONG_TYPE,
+ CPTI_JAVA_FLOAT_TYPE,
+ CPTI_JAVA_DOUBLE_TYPE,
+ CPTI_JAVA_CHAR_TYPE,
+ CPTI_JAVA_BOOLEAN_TYPE,
+
+ CPTI_WCHAR_DECL,
+ CPTI_VTABLE_ENTRY_TYPE,
+ CPTI_DELTA_TYPE,
+ CPTI_VTABLE_INDEX_TYPE,
+ CPTI_CLEANUP_TYPE,
+ CPTI_VTT_PARM_TYPE,
+
+ CPTI_TI_DESC_TYPE,
+ CPTI_BLTN_DESC_TYPE,
+ CPTI_PTR_DESC_TYPE,
+ CPTI_ARY_DESC_TYPE,
+ CPTI_FUNC_DESC_TYPE,
+ CPTI_ENUM_DESC_TYPE,
+ CPTI_CLASS_DESC_TYPE,
+ CPTI_SI_CLASS_DESC_TYPE,
+ CPTI_VMI_CLASS_DESC_TYPE,
+ CPTI_PTM_DESC_TYPE,
+ CPTI_BASE_DESC_TYPE,
+
+ CPTI_CLASS_TYPE,
+ CPTI_RECORD_TYPE,
+ CPTI_UNION_TYPE,
+ CPTI_ENUM_TYPE,
+ CPTI_UNKNOWN_TYPE,
+ CPTI_VTBL_TYPE,
+ CPTI_VTBL_PTR_TYPE,
+ CPTI_STD,
+ CPTI_ABI,
+ CPTI_TYPE_INFO_TYPE,
+ CPTI_TINFO_DECL_TYPE,
+ CPTI_ABORT_FNDECL,
+ CPTI_GLOBAL_DELETE_FNDECL,
+ CPTI_AGGR_TAG,
+
+ CPTI_ACCESS_DEFAULT,
+ CPTI_ACCESS_PUBLIC,
+ CPTI_ACCESS_PROTECTED,
+ CPTI_ACCESS_PRIVATE,
+ CPTI_ACCESS_DEFAULT_VIRTUAL,
+ CPTI_ACCESS_PUBLIC_VIRTUAL,
+ CPTI_ACCESS_PROTECTED_VIRTUAL,
+ CPTI_ACCESS_PRIVATE_VIRTUAL,
+
+ CPTI_CTOR_IDENTIFIER,
+ CPTI_COMPLETE_CTOR_IDENTIFIER,
+ CPTI_BASE_CTOR_IDENTIFIER,
+ CPTI_DTOR_IDENTIFIER,
+ CPTI_COMPLETE_DTOR_IDENTIFIER,
+ CPTI_BASE_DTOR_IDENTIFIER,
+ CPTI_DELETING_DTOR_IDENTIFIER,
+ CPTI_DELTA_IDENTIFIER,
+ CPTI_IN_CHARGE_IDENTIFIER,
+ CPTI_VTT_PARM_IDENTIFIER,
+ CPTI_NELTS_IDENTIFIER,
+ CPTI_THIS_IDENTIFIER,
+ CPTI_PFN_IDENTIFIER,
+ CPTI_VPTR_IDENTIFIER,
+ CPTI_STD_IDENTIFIER,
+
+ CPTI_LANG_NAME_C,
+ CPTI_LANG_NAME_CPLUSPLUS,
+ CPTI_LANG_NAME_JAVA,
+
+ CPTI_EMPTY_EXCEPT_SPEC,
+ CPTI_NULL,
+ CPTI_JCLASS,
+ CPTI_TERMINATE,
+ CPTI_CALL_UNEXPECTED,
+ CPTI_ATEXIT,
+ CPTI_DSO_HANDLE,
+ CPTI_DCAST,
+
+ CPTI_MAX
+};
+
+extern tree cp_global_trees[CPTI_MAX];
+
+#define java_byte_type_node cp_global_trees[CPTI_JAVA_BYTE_TYPE]
+#define java_short_type_node cp_global_trees[CPTI_JAVA_SHORT_TYPE]
+#define java_int_type_node cp_global_trees[CPTI_JAVA_INT_TYPE]
+#define java_long_type_node cp_global_trees[CPTI_JAVA_LONG_TYPE]
+#define java_float_type_node cp_global_trees[CPTI_JAVA_FLOAT_TYPE]
+#define java_double_type_node cp_global_trees[CPTI_JAVA_DOUBLE_TYPE]
+#define java_char_type_node cp_global_trees[CPTI_JAVA_CHAR_TYPE]
+#define java_boolean_type_node cp_global_trees[CPTI_JAVA_BOOLEAN_TYPE]
+
+#define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL]
+#define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
+/* The type used to represent an offset by which to adjust the `this'
+ pointer in pointer-to-member types. */
+#define delta_type_node cp_global_trees[CPTI_DELTA_TYPE]
+/* The type used to represent an index into the vtable. */
+#define vtable_index_type cp_global_trees[CPTI_VTABLE_INDEX_TYPE]
+
+#define ti_desc_type_node cp_global_trees[CPTI_TI_DESC_TYPE]
+#define bltn_desc_type_node cp_global_trees[CPTI_BLTN_DESC_TYPE]
+#define ptr_desc_type_node cp_global_trees[CPTI_PTR_DESC_TYPE]
+#define ary_desc_type_node cp_global_trees[CPTI_ARY_DESC_TYPE]
+#define func_desc_type_node cp_global_trees[CPTI_FUNC_DESC_TYPE]
+#define enum_desc_type_node cp_global_trees[CPTI_ENUM_DESC_TYPE]
+#define class_desc_type_node cp_global_trees[CPTI_CLASS_DESC_TYPE]
+#define si_class_desc_type_node cp_global_trees[CPTI_SI_CLASS_DESC_TYPE]
+#define vmi_class_desc_type_node cp_global_trees[CPTI_VMI_CLASS_DESC_TYPE]
+#define ptm_desc_type_node cp_global_trees[CPTI_PTM_DESC_TYPE]
+#define base_desc_type_node cp_global_trees[CPTI_BASE_DESC_TYPE]
+
+#define class_type_node cp_global_trees[CPTI_CLASS_TYPE]
+#define record_type_node cp_global_trees[CPTI_RECORD_TYPE]
+#define union_type_node cp_global_trees[CPTI_UNION_TYPE]
+#define enum_type_node cp_global_trees[CPTI_ENUM_TYPE]
+#define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
+#define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
+#define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
+#define std_node cp_global_trees[CPTI_STD]
+#define abi_node cp_global_trees[CPTI_ABI]
+#define type_info_type_node cp_global_trees[CPTI_TYPE_INFO_TYPE]
+#define tinfo_decl_type cp_global_trees[CPTI_TINFO_DECL_TYPE]
+#define abort_fndecl cp_global_trees[CPTI_ABORT_FNDECL]
+#define global_delete_fndecl cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
+#define current_aggr cp_global_trees[CPTI_AGGR_TAG]
+
+/* Define the sets of attributes that member functions and baseclasses
+ can have. These are sensible combinations of {public,private,protected}
+ cross {virtual,non-virtual}. */
+
+#define access_default_node cp_global_trees[CPTI_ACCESS_DEFAULT]
+#define access_public_node cp_global_trees[CPTI_ACCESS_PUBLIC]
+#define access_protected_node cp_global_trees[CPTI_ACCESS_PROTECTED]
+#define access_private_node cp_global_trees[CPTI_ACCESS_PRIVATE]
+#define access_default_virtual_node cp_global_trees[CPTI_ACCESS_DEFAULT_VIRTUAL]
+#define access_public_virtual_node cp_global_trees[CPTI_ACCESS_PUBLIC_VIRTUAL]
+#define access_protected_virtual_node cp_global_trees[CPTI_ACCESS_PROTECTED_VIRTUAL]
+#define access_private_virtual_node cp_global_trees[CPTI_ACCESS_PRIVATE_VIRTUAL]
+
+/* We cache these tree nodes so as to call get_identifier less
+ frequently. */
+
+/* The name of a constructor that takes an in-charge parameter to
+ decide whether or not to construct virtual base classes. */
+#define ctor_identifier cp_global_trees[CPTI_CTOR_IDENTIFIER]
+/* The name of a constructor that constructs virtual base classes. */
+#define complete_ctor_identifier cp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER]
+/* The name of a constructor that does not construct virtual base classes. */
+#define base_ctor_identifier cp_global_trees[CPTI_BASE_CTOR_IDENTIFIER]
+/* The name of a destructor that takes an in-charge parameter to
+ decide whether or not to destroy virtual base classes and whether
+ or not to delete the object. */
+#define dtor_identifier cp_global_trees[CPTI_DTOR_IDENTIFIER]
+/* The name of a destructor that destroys virtual base classes. */
+#define complete_dtor_identifier cp_global_trees[CPTI_COMPLETE_DTOR_IDENTIFIER]
+/* The name of a destructor that does not destroy virtual base
+ classes. */
+#define base_dtor_identifier cp_global_trees[CPTI_BASE_DTOR_IDENTIFIER]
+/* The name of a destructor that destroys virtual base classes, and
+ then deletes the entire object. */
+#define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER]
+#define delta_identifier cp_global_trees[CPTI_DELTA_IDENTIFIER]
+#define in_charge_identifier cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER]
+/* The name of the parameter that contains a pointer to the VTT to use
+ for this subobject constructor or destructor. */
+#define vtt_parm_identifier cp_global_trees[CPTI_VTT_PARM_IDENTIFIER]
+#define nelts_identifier cp_global_trees[CPTI_NELTS_IDENTIFIER]
+#define this_identifier cp_global_trees[CPTI_THIS_IDENTIFIER]
+#define pfn_identifier cp_global_trees[CPTI_PFN_IDENTIFIER]
+#define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER]
+/* The name of the std namespace. */
+#define std_identifier cp_global_trees[CPTI_STD_IDENTIFIER]
+#define lang_name_c cp_global_trees[CPTI_LANG_NAME_C]
+#define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS]
+#define lang_name_java cp_global_trees[CPTI_LANG_NAME_JAVA]
+
+/* Exception specifier used for throw(). */
+#define empty_except_spec cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC]
+
+/* The node for `__null'. */
+#define null_node cp_global_trees[CPTI_NULL]
+
+/* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*). */
+#define jclass_node cp_global_trees[CPTI_JCLASS]
+
+/* The declaration for `std::terminate'. */
+#define terminate_node cp_global_trees[CPTI_TERMINATE]
+
+/* The declaration for "__cxa_call_unexpected". */
+#define call_unexpected_node cp_global_trees[CPTI_CALL_UNEXPECTED]
+
+/* A pointer to `std::atexit'. */
+#define atexit_node cp_global_trees[CPTI_ATEXIT]
+
+/* A pointer to `__dso_handle'. */
+#define dso_handle_node cp_global_trees[CPTI_DSO_HANDLE]
+
+/* The declaration of the dynamic_cast runtime. */
+#define dynamic_cast_node cp_global_trees[CPTI_DCAST]
+
+/* The type of a destructor. */
+#define cleanup_type cp_global_trees[CPTI_CLEANUP_TYPE]
+
+/* The type of the vtt parameter passed to subobject constructors and
+ destructors. */
+#define vtt_parm_type cp_global_trees[CPTI_VTT_PARM_TYPE]
+
+/* Global state. */
+
+struct saved_scope
+{
+ tree old_bindings;
+ tree old_namespace;
+ tree decl_ns_list;
+ tree class_name;
+ tree class_type;
+ tree access_specifier;
+ tree function_decl;
+ varray_type lang_base;
+ tree lang_name;
+ tree template_parms;
+ tree x_previous_class_type;
+ tree x_previous_class_values;
+ tree x_saved_tree;
+ tree incomplete;
+ tree lookups;
+
+ HOST_WIDE_INT x_processing_template_decl;
+ int x_processing_specialization;
+ int x_processing_explicit_instantiation;
+ int need_pop_function_context;
+
+ struct stmt_tree_s x_stmt_tree;
+
+ struct binding_level *class_bindings;
+ struct binding_level *bindings;
+
+ struct saved_scope *prev;
+};
+
+/* The current open namespace. */
+
+#define current_namespace scope_chain->old_namespace
+
+/* The stack for namespaces of current declarations. */
+
+#define decl_namespace_list scope_chain->decl_ns_list
+
+/* IDENTIFIER_NODE: name of current class */
+
+#define current_class_name scope_chain->class_name
+
+/* _TYPE: the type of the current class */
+
+#define current_class_type scope_chain->class_type
+
+/* When parsing a class definition, the access specifier most recently
+ given by the user, or, if no access specifier was given, the
+ default value appropriate for the kind of class (i.e., struct,
+ class, or union). */
+
+#define current_access_specifier scope_chain->access_specifier
+
+/* Pointer to the top of the language name stack. */
+
+#define current_lang_base scope_chain->lang_base
+#define current_lang_name scope_chain->lang_name
+
+/* Parsing a function declarator leaves a list of parameter names
+ or a chain or parameter decls here. */
+
+#define current_template_parms scope_chain->template_parms
+
+#define processing_template_decl scope_chain->x_processing_template_decl
+#define processing_specialization scope_chain->x_processing_specialization
+#define processing_explicit_instantiation scope_chain->x_processing_explicit_instantiation
+
+/* _TYPE: the previous type that was a class */
+
+#define previous_class_type scope_chain->x_previous_class_type
+
+/* This is a copy of the class_shadowed list of the previous class
+ binding contour when at global scope. It's used to reset
+ IDENTIFIER_CLASS_VALUEs when entering another class scope (i.e. a
+ cache miss). */
+
+#define previous_class_values scope_chain->x_previous_class_values
+
+/* A list of the declarations with incomplete type at namespace scope. */
+
+#define namespace_scope_incomplete scope_chain->incomplete
+
+/* A list of private types mentioned, for deferred access checking. */
+
+#define type_lookups scope_chain->lookups
+
+extern struct saved_scope *scope_chain;
+
+struct unparsed_text;
+
+/* Global state pertinent to the current function. */
+
+struct cp_language_function
+{
+ struct language_function base;
+
+ tree x_dtor_label;
+ tree x_current_class_ptr;
+ tree x_current_class_ref;
+ tree x_eh_spec_block;
+ tree x_in_charge_parm;
+ tree x_vtt_parm;
+ tree x_return_value;
+
+ tree *x_vcalls_possible_p;
+
+ int returns_value;
+ int returns_null;
+ int in_function_try_handler;
+ int x_expanding_p;
+
+ struct named_label_use_list *x_named_label_uses;
+ struct named_label_list *x_named_labels;
+ struct binding_level *bindings;
+ varray_type x_local_names;
+
+ const char *cannot_inline;
+ struct unparsed_text *unparsed_inlines;
+};
+
+/* The current C++-specific per-function global variables. */
+
+#define cp_function_chain \
+ ((struct cp_language_function *) (cfun->language))
+
+/* In a destructor, the point at which all derived class destroying
+ has been done, just before any base class destroying will be done. */
+
+#define dtor_label cp_function_chain->x_dtor_label
+
+/* When we're processing a member function, current_class_ptr is the
+ PARM_DECL for the `this' pointer. The current_class_ref is an
+ expression for `*this'. */
+
+#define current_class_ptr \
+ (cfun ? cp_function_chain->x_current_class_ptr : NULL_TREE)
+#define current_class_ref \
+ (cfun ? cp_function_chain->x_current_class_ref : NULL_TREE)
+
+/* The EH_SPEC_BLOCK for the exception-specifiers for the current
+ function, if any. */
+
+#define current_eh_spec_block cp_function_chain->x_eh_spec_block
+
+/* The `__in_chrg' parameter for the current function. Only used for
+ constructors and destructors. */
+
+#define current_in_charge_parm cp_function_chain->x_in_charge_parm
+
+/* The `__vtt_parm' parameter for the current function. Only used for
+ constructors and destructors. */
+
+#define current_vtt_parm cp_function_chain->x_vtt_parm
+
+/* In destructors, this is a pointer to a condition in an
+ if-statement. If the pointed-to value is boolean_true_node, then
+ there may be virtual function calls in this destructor. */
+
+#define current_vcalls_possible_p cp_function_chain->x_vcalls_possible_p
+
+/* Set to 0 at beginning of a function definition, set to 1 if
+ a return statement that specifies a return value is seen. */
-extern tree java_byte_type_node;
-extern tree java_short_type_node;
-extern tree java_int_type_node;
-extern tree java_long_type_node;
-extern tree java_float_type_node;
-extern tree java_double_type_node;
-extern tree java_char_type_node;
-extern tree java_boolean_type_node;
+#define current_function_returns_value cp_function_chain->returns_value
-extern int current_function_returns_value;
-extern int current_function_returns_null;
-extern tree current_function_return_value;
+/* Set to 0 at beginning of a function definition, set to 1 if
+ a return statement with no argument is seen. */
+
+#define current_function_returns_null cp_function_chain->returns_null
+
+/* Non-zero if we should generate RTL for functions that we process.
+ When this is zero, we just accumulate tree structure, without
+ interacting with the back end. */
+
+#define expanding_p cp_function_chain->x_expanding_p
+
+/* Non-zero if we are in the semantic analysis phase for the current
+ function. */
+
+#define doing_semantic_analysis_p() (!expanding_p)
+
+#define in_function_try_handler cp_function_chain->in_function_try_handler
+
+/* Expression always returned from function, or error_mark_node
+ otherwise, for use by the automatic named return value optimization. */
+
+#define current_function_return_value \
+ (cp_function_chain->x_return_value)
-extern tree current_namespace;
extern tree global_namespace;
-extern tree ridpointers[];
-extern tree ansi_opname[];
-extern tree ansi_assopname[];
+#define ansi_opname(CODE) \
+ (operator_name_info[(int) (CODE)].identifier)
+#define ansi_assopname(CODE) \
+ (assignment_operator_name_info[(int) (CODE)].identifier)
/* Nonzero means `$' can be in an identifier. */
extern int dollars_in_ident;
-/* Nonzero means allow type mismatches in conditional expressions;
- just make their values `void'. */
-
-extern int flag_cond_mismatch;
-
/* Nonzero means don't recognize the keyword `asm'. */
extern int flag_no_asm;
+/* Nonzero means don't recognize any extended keywords. */
+
+extern int flag_no_gnu_keywords;
+
+/* Nonzero means recognize the named operators from C++98. */
+
+extern int flag_operator_names;
+
/* For cross referencing. */
extern int flag_gnu_xref;
@@ -399,39 +937,16 @@ extern int flag_gnu_binutils;
extern int warn_implicit;
-/* Nonzero means warn about usage of long long when `-pedantic'. */
-
-extern int warn_long_long;
-
/* Nonzero means warn when all ctors or dtors are private, and the class
has no friends. */
extern int warn_ctor_dtor_privacy;
-/* Nonzero means warn about function definitions that default the return type
- or that use a null return and have a return-type other than void. */
-
-extern int warn_return_type;
-
-/* Nonzero means give string constants the type `const char *', as mandated
- by the standard. */
-
-extern int flag_const_strings;
-
/* Nonzero means warn about deprecated conversion from string constant to
`char *'. */
extern int warn_write_strings;
-/* Nonzero means warn about sizeof(function) or addition/subtraction
- of function pointers. */
-
-extern int warn_pointer_arith;
-
-/* Nonzero means warn about suggesting putting in ()'s. */
-
-extern int warn_parentheses;
-
/* Nonzero means warn about multiple (redundant) decls for the same single
variable or function. */
@@ -445,6 +960,10 @@ extern int warn_missing_braces;
extern int warn_sign_compare;
+/* Warn about testing equality of floating point numbers. */
+
+extern int warn_float_equal;
+
/* Warn about a subscript that has type char. */
extern int warn_char_subscripts;
@@ -454,10 +973,6 @@ extern int warn_char_subscripts;
extern int warn_cast_qual;
-/* Warn about *printf or *scanf format/argument anomalies. */
-
-extern int warn_format;
-
/* Nonzero means warn about non virtual destructors in classes that have
virtual functions. */
@@ -477,35 +992,21 @@ extern int warn_ecpp;
extern int warn_sign_promo;
-/* Non-zero means warn when a function is declared extern and later inline. */
-
-extern int warn_extern_inline;
-
/* Non-zero means warn when an old-style cast is used. */
extern int warn_old_style_cast;
-/* Nonzero means to treat bitfields as unsigned unless they say `signed'. */
+/* Non-zero means warn when the compiler will reorder code. */
-extern int flag_signed_bitfields;
+extern int warn_reorder;
+
+/* Non-zero means warn about deprecated features. */
-/* 3 means write out only virtuals function tables `defined'
- in this implementation file.
- 2 means write out only specific virtual function tables
- and give them (C) public access.
- 1 means write out virtual function tables and give them
- (C) public access.
- 0 means write out virtual function tables and give them
- (C) static access (default).
- -1 means declare virtual function tables extern. */
+extern int warn_deprecated;
-extern int write_virtuals;
+/* Nonzero means to treat bitfields as unsigned unless they say `signed'. */
-/* True for more efficient but incompatible (not fully tested)
- vtable implementation (using thunks).
- 0 is old behavior; 1 is new behavior; 3 adds vlist arguments;
- 2 is 3 plus backwards-compatibility to 1. */
-extern int flag_vtable_thunks, flag_vtable_thunks_compat;
+extern int flag_signed_bitfields;
/* INTERFACE_ONLY nonzero means that we are in an "interface"
section of the compiler. INTERFACE_UNKNOWN nonzero means
@@ -518,32 +1019,17 @@ extern int interface_only, interface_unknown;
extern int flag_elide_constructors;
-/* Nonzero means enable obscure ANSI features and disable GNU extensions
- that might cause ANSI-compliant code to be miscompiled. */
+/* Nonzero means enable obscure standard features and disable GNU
+ extensions that might cause standard-compliant code to be
+ miscompiled. */
extern int flag_ansi;
-/* Nonzero means recognize and handle signature language constructs. */
-
-extern int flag_handle_signatures;
-
/* Nonzero means that member functions defined in class scope are
inline by default. */
extern int flag_default_inline;
-/* The name-mangling scheme to use. Versions of gcc before 2.8 use
- version 0. */
-extern int name_mangling_version;
-
-/* Nonzero means that guiding declarations are allowed. */
-extern int flag_guiding_decls;
-
-/* Nonzero if squashed mangling is to be performed.
- This uses the B and K codes to reference previously seen class types
- and class qualifiers. */
-extern int flag_do_squangling;
-
/* Nonzero means generate separate instantiation control files and juggle
them at link time. */
extern int flag_use_repository;
@@ -552,10 +1038,6 @@ extern int flag_use_repository;
required. */
extern int flag_optional_diags;
-/* Nonzero means do not consider empty argument prototype to mean function
- takes no arguments. */
-extern int flag_strict_prototype;
-
/* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */
extern int flag_vtable_gc;
@@ -563,15 +1045,26 @@ extern int flag_vtable_gc;
The value of this flag is ignored if -pedantic is specified. */
extern int flag_permissive;
+/* Nonzero means to implement standard semantics for exception
+ specifications, calling unexpected if an exception is thrown that
+ doesn't match the specification. Zero means to treat them as
+ assertions and optimize accordingly, but not check them. */
+extern int flag_enforce_eh_specs;
+
/* Nonzero if we want to obey access control semantics. */
extern int flag_access_control;
+/* Nonzero if we want to check the return value of new and avoid calling
+ constructors if it is a null pointer. */
+
+extern int flag_check_new;
+
/* C++ language-specific tree codes. */
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
enum cplus_tree_code {
- __DUMMY = LAST_AND_UNUSED_TREE_CODE,
+ CP_DUMMY_TREE_CODE = LAST_C_TREE_CODE,
#include "cp-tree.def"
LAST_CPLUS_TREE_CODE
};
@@ -581,101 +1074,111 @@ enum languages { lang_c, lang_cplusplus, lang_java };
/* Macros to make error reporting functions' lives easier. */
#define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
+#define TYPE_LINKAGE_IDENTIFIER(NODE) \
+ (TYPE_IDENTIFIER (TYPE_MAIN_VARIANT (NODE)))
#define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
#define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
-#define TYPE_ASSEMBLER_NAME_STRING(NODE) (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
-#define TYPE_ASSEMBLER_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
+#define TYPE_ASSEMBLER_NAME_STRING(NODE) \
+ (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
+#define TYPE_ASSEMBLER_NAME_LENGTH(NODE) \
+ (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
+
+/* Nonzero if NODE has no name for linkage purposes. */
+#define TYPE_ANONYMOUS_P(NODE) \
+ (TAGGED_TYPE_P (NODE) && ANON_AGGRNAME_P (TYPE_LINKAGE_IDENTIFIER (NODE)))
/* The _DECL for this _TYPE. */
#define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
/* Nonzero if T is a class (or struct or union) type. Also nonzero
- for template type parameters and typename types. Despite its name,
+ for template type parameters, typename types, and instantiated
+ template template parameters. Despite its name,
this macro has nothing to do with the definition of aggregate given
in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. */
-#define IS_AGGR_TYPE(t) \
- (TREE_CODE (t) == TEMPLATE_TYPE_PARM \
- || TREE_CODE (t) == TYPENAME_TYPE \
- || TREE_CODE (t) == TYPEOF_TYPE \
- || TYPE_LANG_FLAG_5 (t))
-
-/* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or
- union type. */
+#define IS_AGGR_TYPE(T) \
+ (TREE_CODE (T) == TEMPLATE_TYPE_PARM \
+ || TREE_CODE (T) == TYPENAME_TYPE \
+ || TREE_CODE (T) == TYPEOF_TYPE \
+ || TREE_CODE (T) == BOUND_TEMPLATE_TEMPLATE_PARM \
+ || TYPE_LANG_FLAG_5 (T))
+
+/* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or
+ union type. */
#define SET_IS_AGGR_TYPE(T, VAL) \
(TYPE_LANG_FLAG_5 (T) = (VAL))
/* Nonzero if T is a class type. Zero for template type parameters,
typename types, and so forth. */
-#define CLASS_TYPE_P(t) \
- (IS_AGGR_TYPE_CODE (TREE_CODE (t)) && IS_AGGR_TYPE (t))
+#define CLASS_TYPE_P(T) \
+ (IS_AGGR_TYPE_CODE (TREE_CODE (T)) && IS_AGGR_TYPE (T))
-#define IS_AGGR_TYPE_CODE(t) (t == RECORD_TYPE || t == UNION_TYPE)
-#define IS_AGGR_TYPE_2(TYPE1,TYPE2) \
+#define IS_AGGR_TYPE_CODE(T) ((T) == RECORD_TYPE || (T) == UNION_TYPE)
+#define IS_AGGR_TYPE_2(TYPE1, TYPE2) \
(TREE_CODE (TYPE1) == TREE_CODE (TYPE2) \
- && IS_AGGR_TYPE (TYPE1)&IS_AGGR_TYPE (TYPE2))
-#define IS_OVERLOAD_TYPE(t) \
- (IS_AGGR_TYPE (t) || TREE_CODE (t) == ENUMERAL_TYPE)
+ && IS_AGGR_TYPE (TYPE1) && IS_AGGR_TYPE (TYPE2))
+#define TAGGED_TYPE_P(T) \
+ (CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE)
+#define IS_OVERLOAD_TYPE(T) TAGGED_TYPE_P (T)
/* In a *_TYPE, nonzero means a built-in type. */
-#define TYPE_BUILT_IN(NODE) TYPE_LANG_FLAG_6(NODE)
+#define TYPE_BUILT_IN(NODE) TYPE_LANG_FLAG_6 (NODE)
/* True if this a "Java" type, defined in 'extern "Java"'. */
-#define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3(NODE)
-
-/* The type qualifiers for this type, including the qualifiers on the
- elements for an array type. */
-#define CP_TYPE_QUALS(NODE) \
- ((TREE_CODE (NODE) != ARRAY_TYPE) \
- ? TYPE_QUALS (NODE) : cp_type_quals (NODE))
+#define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3 (NODE)
/* Nonzero if this type is const-qualified. */
#define CP_TYPE_CONST_P(NODE) \
- ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_CONST) != 0)
+ ((cp_type_quals (NODE) & TYPE_QUAL_CONST) != 0)
/* Nonzero if this type is volatile-qualified. */
#define CP_TYPE_VOLATILE_P(NODE) \
- ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_VOLATILE) != 0)
+ ((cp_type_quals (NODE) & TYPE_QUAL_VOLATILE) != 0)
/* Nonzero if this type is restrict-qualified. */
#define CP_TYPE_RESTRICT_P(NODE) \
- ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_RESTRICT) != 0)
+ ((cp_type_quals (NODE) & TYPE_QUAL_RESTRICT) != 0)
/* Nonzero if this type is const-qualified, but not
volatile-qualified. Other qualifiers are ignored. This macro is
used to test whether or not it is OK to bind an rvalue to a
reference. */
#define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \
- ((CP_TYPE_QUALS (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \
+ ((cp_type_quals (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \
== TYPE_QUAL_CONST)
-#define DELTA_FROM_VTABLE_ENTRY(ENTRY) \
- (!flag_vtable_thunks ? \
- TREE_VALUE (CONSTRUCTOR_ELTS (ENTRY)) \
- : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? integer_zero_node \
- : build_int_2 (THUNK_DELTA (TREE_OPERAND ((ENTRY), 0)), 0))
-
-/* Virtual function addresses can be gotten from a virtual function
- table entry using this macro. */
-#define FNADDR_FROM_VTABLE_ENTRY(ENTRY) \
- (!flag_vtable_thunks ? \
- TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) \
- : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? (ENTRY) \
- : DECL_INITIAL (TREE_OPERAND ((ENTRY), 0)))
-#define SET_FNADDR_FROM_VTABLE_ENTRY(ENTRY,VALUE) \
- (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) = (VALUE))
-#define FUNCTION_ARG_CHAIN(NODE) (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE))))
-#define PROMOTES_TO_AGGR_TYPE(NODE,CODE) \
+#define FUNCTION_ARG_CHAIN(NODE) \
+ TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE)))
+
+/* Given a FUNCTION_DECL, returns the first TREE_LIST out of TYPE_ARG_TYPES
+ which refers to a user-written parameter. */
+#define FUNCTION_FIRST_USER_PARMTYPE(NODE) \
+ skip_artificial_parms_for ((NODE), TYPE_ARG_TYPES (TREE_TYPE (NODE)))
+
+/* Similarly, but for DECL_ARGUMENTS. */
+#define FUNCTION_FIRST_USER_PARM(NODE) \
+ skip_artificial_parms_for ((NODE), DECL_ARGUMENTS (NODE))
+
+#define PROMOTES_TO_AGGR_TYPE(NODE, CODE) \
(((CODE) == TREE_CODE (NODE) \
- && IS_AGGR_TYPE (TREE_TYPE (NODE))) \
+ && IS_AGGR_TYPE (TREE_TYPE (NODE))) \
|| IS_AGGR_TYPE (NODE))
-/* Nonzero iff TYPE is uniquely derived from PARENT. Under MI, PARENT can
- be an ambiguous base class of TYPE, and this macro will be false. */
-#define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) >= 0)
-#define ACCESSIBLY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, -1, (tree *)0) >= 0)
-#define ACCESSIBLY_UNIQUELY_DERIVED_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 1, (tree *)0) >= 0)
-#define DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) != -1)
+/* Nonzero iff TYPE is derived from PARENT. Ignores accessibility and
+ ambiguity issues. */
+#define DERIVED_FROM_P(PARENT, TYPE) \
+ lookup_base ((TYPE), PARENT, ba_any, NULL)
+/* Nonzero iff TYPE is uniquely derived from PARENT. Ignores
+ accessibility. */
+#define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) \
+ lookup_base ((TYPE), (PARENT), ba_ignore | ba_quiet, NULL)
+/* Nonzero iff TYPE is accessible in the current scope and uniquely
+ derived from PARENT. */
+#define ACCESSIBLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \
+ lookup_base ((TYPE), (PARENT), ba_check | ba_quiet, NULL)
+/* Nonzero iff TYPE is publicly & uniquely derived from PARENT. */
+#define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \
+ lookup_base ((TYPE), (PARENT), ba_not_special | ba_quiet, NULL)
/* This structure provides additional information above and beyond
what is provide in the ordinary tree_type. In the past, we used it
@@ -692,94 +1195,77 @@ enum languages { lang_c, lang_cplusplus, lang_java };
a minimum. */
struct lang_type
{
- struct
- {
- unsigned has_type_conversion : 1;
- unsigned has_init_ref : 1;
- unsigned has_default_ctor : 1;
- unsigned uses_multiple_inheritance : 1;
- unsigned const_needs_init : 1;
- unsigned ref_needs_init : 1;
- unsigned has_const_assign_ref : 1;
- unsigned anon_union : 1;
-
- unsigned has_nonpublic_ctor : 2;
- unsigned has_nonpublic_assign_ref : 2;
- unsigned vtable_needs_writing : 1;
- unsigned has_assign_ref : 1;
- unsigned gets_new : 2;
-
- unsigned gets_delete : 2;
- unsigned has_call_overloaded : 1;
- unsigned has_array_ref_overloaded : 1;
- unsigned has_arrow_overloaded : 1;
- unsigned interface_only : 1;
- unsigned interface_unknown : 1;
- unsigned needs_virtual_reinit : 1;
-
- unsigned marks: 6;
- unsigned vec_delete_takes_size : 1;
- unsigned declared_class : 1;
-
- unsigned being_defined : 1;
- unsigned redefined : 1;
- unsigned debug_requested : 1;
- unsigned use_template : 2;
- unsigned got_semicolon : 1;
- unsigned ptrmemfunc_flag : 1;
- unsigned is_signature : 1;
-
- unsigned is_signature_pointer : 1;
- unsigned is_signature_reference : 1;
- unsigned has_opaque_typedecls : 1;
- unsigned sigtable_has_been_generated : 1;
- unsigned was_anonymous : 1;
- unsigned has_real_assign_ref : 1;
- unsigned has_const_init_ref : 1;
- unsigned has_complex_init_ref : 1;
-
- unsigned has_complex_assign_ref : 1;
- unsigned has_abstract_assign_ref : 1;
- unsigned non_aggregate : 1;
- unsigned is_partial_instantiation : 1;
- unsigned has_mutable : 1;
- unsigned com_interface : 1;
- /* When adding a flag here, consider whether or not it ought to
- apply to a template instance if it applies to the template.
- If so, make sure to copy it in instantiate_class_template! */
-
- /* The MIPS compiler gets it wrong if this struct also
- does not fill out to a multiple of 4 bytes. Add a
- member `dummy' with new bits if you go over the edge. */
- unsigned dummy : 10;
- } type_flags;
-
- int vsize;
- int vfield_parent;
-
- union tree_node *vfields;
- union tree_node *vbases;
-
- union tree_node *tags;
-
- union tree_node *search_slot;
-
unsigned char align;
- /* Room for another three unsigned chars. */
-
- union tree_node *size;
- union tree_node *abstract_virtuals;
- union tree_node *friend_classes;
-
- union tree_node *rtti;
+ unsigned has_type_conversion : 1;
+ unsigned has_init_ref : 1;
+ unsigned has_default_ctor : 1;
+ unsigned uses_multiple_inheritance : 1;
+ unsigned const_needs_init : 1;
+ unsigned ref_needs_init : 1;
+ unsigned has_const_assign_ref : 1;
+ unsigned anon_aggr : 1;
+
+ unsigned has_mutable : 1;
+ unsigned com_interface : 1;
+ unsigned non_pod_class : 1;
+ unsigned nearly_empty_p : 1;
+ unsigned user_align : 1;
+ unsigned has_assign_ref : 1;
+ unsigned has_new : 1;
+ unsigned has_array_new : 1;
+
+ unsigned gets_delete : 2;
+ unsigned has_call_overloaded : 1;
+ unsigned has_array_ref_overloaded : 1;
+ unsigned has_arrow_overloaded : 1;
+ unsigned interface_only : 1;
+ unsigned interface_unknown : 1;
+ unsigned needs_virtual_reinit : 1;
+
+ unsigned marks: 6;
+ unsigned vec_new_uses_cookie : 1;
+ unsigned declared_class : 1;
+
+ unsigned being_defined : 1;
+ unsigned redefined : 1;
+ unsigned debug_requested : 1;
+ unsigned use_template : 2;
+ unsigned got_semicolon : 1;
+ unsigned ptrmemfunc_flag : 1;
+ unsigned was_anonymous : 1;
+
+ unsigned has_real_assign_ref : 1;
+ unsigned has_const_init_ref : 1;
+ unsigned has_complex_init_ref : 1;
+ unsigned has_complex_assign_ref : 1;
+ unsigned has_abstract_assign_ref : 1;
+ unsigned non_aggregate : 1;
+ unsigned is_partial_instantiation : 1;
+ unsigned java_interface : 1;
+
+ /* When adding a flag here, consider whether or not it ought to
+ apply to a template instance if it applies to the template. If
+ so, make sure to copy it in instantiate_class_template! */
+
+ /* There are some bits left to fill out a 32-bit word. Keep track
+ of this by updating the size of this bitfield whenever you add or
+ remove a flag. */
+ unsigned dummy : 8;
- union tree_node *methods;
+ int vsize;
- union tree_node *signature;
- union tree_node *signature_pointer_to;
- union tree_node *signature_reference_to;
- union tree_node *template_info;
+ tree primary_base;
+ tree vfields;
+ tree vbases;
+ tree tags;
+ tree size;
+ tree size_unit;
+ tree pure_virtuals;
+ tree friend_classes;
+ tree rtti;
+ tree methods;
+ tree template_info;
tree befriending_classes;
};
@@ -788,275 +1274,287 @@ struct lang_type
1=implicit template instantiation
2=explicit template specialization
3=explicit template instantiation */
-#define CLASSTYPE_USE_TEMPLATE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.use_template)
+#define CLASSTYPE_USE_TEMPLATE(NODE) (TYPE_LANG_SPECIFIC (NODE)->use_template)
/* Fields used for storing information before the class is defined.
After the class is defined, these fields hold other information. */
/* List of friends which were defined inline in this class definition. */
-#define CLASSTYPE_INLINE_FRIENDS(NODE) (TYPE_NONCOPIED_PARTS (NODE))
+#define CLASSTYPE_INLINE_FRIENDS(NODE) CLASSTYPE_PURE_VIRTUALS (NODE)
-/* Nonzero for _CLASSTYPE means that operator new and delete are defined,
- respectively. */
-#define TYPE_GETS_NEW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_new)
-#define TYPE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_delete)
+/* Nonzero for _CLASSTYPE means that operator delete is defined. */
+#define TYPE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC (NODE)->gets_delete)
#define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
-/* Nonzero for _CLASSTYPE means that operator vec delete is defined and
- takes the optional size_t argument. */
-#define TYPE_VEC_DELETE_TAKES_SIZE(NODE) \
- (TYPE_LANG_SPECIFIC(NODE)->type_flags.vec_delete_takes_size)
-#define TYPE_VEC_NEW_USES_COOKIE(NODE) \
- (TYPE_NEEDS_DESTRUCTOR (NODE) \
- || (TYPE_LANG_SPECIFIC (NODE) && TYPE_VEC_DELETE_TAKES_SIZE (NODE)))
+/* Nonzero if `new NODE[x]' should cause the allocation of extra
+ storage to indicate how many array elements are in use. */
+#define TYPE_VEC_NEW_USES_COOKIE(NODE) \
+ (CLASS_TYPE_P (NODE) \
+ && TYPE_LANG_SPECIFIC (NODE)->vec_new_uses_cookie)
/* Nonzero means that this _CLASSTYPE node defines ways of converting
itself to other types. */
-#define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_type_conversion)
+#define TYPE_HAS_CONVERSION(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->has_type_conversion)
/* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
-#define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assign_ref)
-#define TYPE_HAS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_assign_ref)
+#define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_assign_ref)
+#define TYPE_HAS_CONST_ASSIGN_REF(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->has_const_assign_ref)
/* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
-#define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_init_ref)
-#define TYPE_HAS_CONST_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_init_ref)
+#define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_init_ref)
+#define TYPE_HAS_CONST_INIT_REF(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->has_const_init_ref)
+
+/* Nonzero if this class defines an overloaded operator new. (An
+ operator new [] doesn't count.) */
+#define TYPE_HAS_NEW_OPERATOR(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->has_new)
+
+/* Nonzero if this class defines an overloaded operator new[]. */
+#define TYPE_HAS_ARRAY_NEW_OPERATOR(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->has_array_new)
/* Nonzero means that this type is being defined. I.e., the left brace
starting the definition of this type has been seen. */
-#define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.being_defined)
+#define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC (NODE)->being_defined)
/* Nonzero means that this type has been redefined. In this case, if
convenient, don't reprocess any methods that appear in its redefinition. */
-#define TYPE_REDEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.redefined)
-
-/* Nonzero means that this type is a signature. */
-# define IS_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)?TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature:0)
-# define SET_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature=1)
-# define CLEAR_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature=0)
-
-/* Nonzero means that this type is a signature pointer type. */
-# define IS_SIGNATURE_POINTER(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature_pointer)
-
-/* Nonzero means that this type is a signature reference type. */
-# define IS_SIGNATURE_REFERENCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature_reference)
-
-/* Nonzero means that this signature contains opaque type declarations. */
-#define SIGNATURE_HAS_OPAQUE_TYPEDECLS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_opaque_typedecls)
-
-/* Nonzero means that a signature table has been generated
- for this signature. */
-#define SIGTABLE_HAS_BEEN_GENERATED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.sigtable_has_been_generated)
-
-/* If NODE is a class, this is the signature type that contains NODE's
- signature after it has been computed using sigof(). */
-#define CLASSTYPE_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
-
-/* If NODE is a signature pointer or signature reference, this is the
- signature type the pointer/reference points to. */
-#define SIGNATURE_TYPE(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
-
-/* If NODE is a signature, this is a vector of all methods defined
- in the signature or in its base types together with their default
- implementations. */
-#define SIGNATURE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
-
-/* If NODE is a signature, this is the _TYPE node that contains NODE's
- signature pointer type. */
-#define SIGNATURE_POINTER_TO(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature_pointer_to)
-
-/* If NODE is a signature, this is the _TYPE node that contains NODE's
- signature reference type. */
-#define SIGNATURE_REFERENCE_TO(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature_reference_to)
+#define TYPE_REDEFINED(NODE) (TYPE_LANG_SPECIFIC (NODE)->redefined)
/* The is the basetype that contains NODE's rtti. */
-#define CLASSTYPE_RTTI(NODE) (TYPE_LANG_SPECIFIC(NODE)->rtti)
+#define CLASSTYPE_RTTI(NODE) (TYPE_LANG_SPECIFIC (NODE)->rtti)
/* Nonzero means that this _CLASSTYPE node overloads operator(). */
-#define TYPE_OVERLOADS_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_call_overloaded)
+#define TYPE_OVERLOADS_CALL_EXPR(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->has_call_overloaded)
/* Nonzero means that this _CLASSTYPE node overloads operator[]. */
-#define TYPE_OVERLOADS_ARRAY_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_array_ref_overloaded)
+#define TYPE_OVERLOADS_ARRAY_REF(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->has_array_ref_overloaded)
/* Nonzero means that this _CLASSTYPE node overloads operator->. */
-#define TYPE_OVERLOADS_ARROW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_arrow_overloaded)
+#define TYPE_OVERLOADS_ARROW(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->has_arrow_overloaded)
/* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
multiple inheritance. If this is 0 for the root of a type
hierarchy, then we can use more efficient search techniques. */
-#define TYPE_USES_MULTIPLE_INHERITANCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.uses_multiple_inheritance)
+#define TYPE_USES_MULTIPLE_INHERITANCE(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->uses_multiple_inheritance)
/* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
virtual base classes. If this is 0 for the root of a type
hierarchy, then we can use more efficient search techniques. */
-#define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TREE_LANG_FLAG_3(NODE))
-
-/* Nonzero means that this _CLASSTYPE uses polymorphic virtual bases.
- This flag is set only when we use vtable thunks. */
-#define TYPE_USES_PVBASES(NODE) (TREE_LANG_FLAG_5(NODE))
+#define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TREE_LANG_FLAG_3 (NODE))
/* Vector member functions defined in this class. Each element is
either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD. All
functions with the same name end up in the same slot. The first
two elements are for constructors, and destructors, respectively.
- These are followed by ordinary member functions. There may be
- empty entries at the end of the vector. */
-#define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->methods)
-
-/* The first type conversion operator in the class (the others can be
- searched with TREE_CHAIN), or the first non-constructor function if
- there are no type conversion operators. */
-#define CLASSTYPE_FIRST_CONVERSION(NODE) \
- TREE_VEC_LENGTH (CLASSTYPE_METHOD_VEC (NODE)) > 2 \
- ? TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), 2) \
- : NULL_TREE;
+ Any conversion operators are next, followed by ordinary member
+ functions. There may be empty entries at the end of the vector. */
+#define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC (NODE)->methods)
+
+/* The slot in the CLASSTYPE_METHOD_VEC where constructors go. */
+#define CLASSTYPE_CONSTRUCTOR_SLOT 0
+
+/* The slot in the CLASSTYPE_METHOD_VEC where destructors go. */
+#define CLASSTYPE_DESTRUCTOR_SLOT 1
+
+/* The first slot in the CLASSTYPE_METHOD_VEC where conversion
+ operators can appear. */
+#define CLASSTYPE_FIRST_CONVERSION_SLOT 2
+
+/* A FUNCTION_DECL or OVERLOAD for the constructors for NODE. These
+ are the constructors that take an in-charge parameter. */
+#define CLASSTYPE_CONSTRUCTORS(NODE) \
+ (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), CLASSTYPE_CONSTRUCTOR_SLOT))
+
+/* A FUNCTION_DECL for the destructor for NODE. These are the
+ destructors that take an in-charge parameter. */
+#define CLASSTYPE_DESTRUCTORS(NODE) \
+ (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), CLASSTYPE_DESTRUCTOR_SLOT))
/* Mark bits for depth-first and breath-first searches. */
/* Get the value of the Nth mark bit. */
-#define CLASSTYPE_MARKED_N(NODE, N) \
- (((CLASS_TYPE_P (NODE) ? TYPE_LANG_SPECIFIC (NODE)->type_flags.marks \
- : TYPE_ALIAS_SET (NODE)) & (1 << N)) != 0)
+#define CLASSTYPE_MARKED_N(NODE, N) \
+ (((CLASS_TYPE_P (NODE) ? TYPE_LANG_SPECIFIC (NODE)->marks \
+ : ((unsigned) TYPE_ALIAS_SET (NODE))) & (1 << (N))) != 0)
/* Set the Nth mark bit. */
-#define SET_CLASSTYPE_MARKED_N(NODE, N) \
- (CLASS_TYPE_P (NODE) \
- ? (TYPE_LANG_SPECIFIC (NODE)->type_flags.marks |= (1 << (N))) \
- : (TYPE_ALIAS_SET (NODE) |= (1 << (N))))
+#define SET_CLASSTYPE_MARKED_N(NODE, N) \
+ (CLASS_TYPE_P (NODE) \
+ ? (void) (TYPE_LANG_SPECIFIC (NODE)->marks |= (1 << (N))) \
+ : (void) (TYPE_ALIAS_SET (NODE) |= (1 << (N))))
/* Clear the Nth mark bit. */
-#define CLEAR_CLASSTYPE_MARKED_N(NODE, N) \
- (CLASS_TYPE_P (NODE) \
- ? (TYPE_LANG_SPECIFIC (NODE)->type_flags.marks &= ~(1 << (N))) \
- : (TYPE_ALIAS_SET (NODE) &= ~(1 << (N))))
+#define CLEAR_CLASSTYPE_MARKED_N(NODE, N) \
+ (CLASS_TYPE_P (NODE) \
+ ? (void) (TYPE_LANG_SPECIFIC (NODE)->marks &= ~(1 << (N))) \
+ : (void) (TYPE_ALIAS_SET (NODE) &= ~(1 << (N))))
/* Get the value of the mark bits. */
-#define CLASSTYPE_MARKED(NODE) CLASSTYPE_MARKED_N(NODE, 0)
-#define CLASSTYPE_MARKED2(NODE) CLASSTYPE_MARKED_N(NODE, 1)
-#define CLASSTYPE_MARKED3(NODE) CLASSTYPE_MARKED_N(NODE, 2)
-#define CLASSTYPE_MARKED4(NODE) CLASSTYPE_MARKED_N(NODE, 3)
-#define CLASSTYPE_MARKED5(NODE) CLASSTYPE_MARKED_N(NODE, 4)
-#define CLASSTYPE_MARKED6(NODE) CLASSTYPE_MARKED_N(NODE, 5)
+#define CLASSTYPE_MARKED(NODE) CLASSTYPE_MARKED_N (NODE, 0)
+#define CLASSTYPE_MARKED2(NODE) CLASSTYPE_MARKED_N (NODE, 1)
+#define CLASSTYPE_MARKED3(NODE) CLASSTYPE_MARKED_N (NODE, 2)
+#define CLASSTYPE_MARKED4(NODE) CLASSTYPE_MARKED_N (NODE, 3)
+#define CLASSTYPE_MARKED5(NODE) CLASSTYPE_MARKED_N (NODE, 4)
+#define CLASSTYPE_MARKED6(NODE) CLASSTYPE_MARKED_N (NODE, 5)
/* Macros to modify the above flags */
-#define SET_CLASSTYPE_MARKED(NODE) SET_CLASSTYPE_MARKED_N(NODE, 0)
-#define CLEAR_CLASSTYPE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 0)
-#define SET_CLASSTYPE_MARKED2(NODE) SET_CLASSTYPE_MARKED_N(NODE, 1)
-#define CLEAR_CLASSTYPE_MARKED2(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 1)
-#define SET_CLASSTYPE_MARKED3(NODE) SET_CLASSTYPE_MARKED_N(NODE, 2)
-#define CLEAR_CLASSTYPE_MARKED3(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 2)
-#define SET_CLASSTYPE_MARKED4(NODE) SET_CLASSTYPE_MARKED_N(NODE, 3)
-#define CLEAR_CLASSTYPE_MARKED4(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 3)
-#define SET_CLASSTYPE_MARKED5(NODE) SET_CLASSTYPE_MARKED_N(NODE, 4)
-#define CLEAR_CLASSTYPE_MARKED5(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 4)
-#define SET_CLASSTYPE_MARKED6(NODE) SET_CLASSTYPE_MARKED_N(NODE, 5)
-#define CLEAR_CLASSTYPE_MARKED6(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 5)
+#define SET_CLASSTYPE_MARKED(NODE) SET_CLASSTYPE_MARKED_N (NODE, 0)
+#define CLEAR_CLASSTYPE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 0)
+#define SET_CLASSTYPE_MARKED2(NODE) SET_CLASSTYPE_MARKED_N (NODE, 1)
+#define CLEAR_CLASSTYPE_MARKED2(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 1)
+#define SET_CLASSTYPE_MARKED3(NODE) SET_CLASSTYPE_MARKED_N (NODE, 2)
+#define CLEAR_CLASSTYPE_MARKED3(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 2)
+#define SET_CLASSTYPE_MARKED4(NODE) SET_CLASSTYPE_MARKED_N (NODE, 3)
+#define CLEAR_CLASSTYPE_MARKED4(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 3)
+#define SET_CLASSTYPE_MARKED5(NODE) SET_CLASSTYPE_MARKED_N (NODE, 4)
+#define CLEAR_CLASSTYPE_MARKED5(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 4)
+#define SET_CLASSTYPE_MARKED6(NODE) SET_CLASSTYPE_MARKED_N (NODE, 5)
+#define CLEAR_CLASSTYPE_MARKED6(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 5)
/* A list of the nested tag-types (class, struct, union, or enum)
found within this class. The TREE_PURPOSE of each node is the name
of the type; the TREE_VALUE is the type itself. This list includes
nested member class templates. */
-#define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC(NODE)->tags)
-
-/* If this class has any bases, this is the number of the base class from
- which our VFIELD is based, -1 otherwise. If this class has no base
- classes, this is not used.
- In D : B1, B2, PARENT would be 0, if D's vtable came from B1,
- 1, if D's vtable came from B2. */
-#define CLASSTYPE_VFIELD_PARENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfield_parent)
-
-/* Remove when done merging. */
-#define CLASSTYPE_VFIELD(NODE) TYPE_VFIELD(NODE)
-
-/* The number of virtual functions defined for this
- _CLASSTYPE node. */
-#define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize)
-/* The list of binfos of virtual base classes that this type uses. */
-#define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases)
-/* The virtual function pointer fields that this type contains. */
-#define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfields)
-
-/* Number of baseclasses defined for this type.
- 0 means no base classes. */
+#define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC (NODE)->tags)
+
+/* Nonzero if NODE has a primary base class, i.e., a base class with
+ which it shares the virtual function table pointer. */
+#define CLASSTYPE_HAS_PRIMARY_BASE_P(NODE) \
+ (CLASSTYPE_PRIMARY_BINFO (NODE) != NULL_TREE)
+
+/* If non-NULL, this is the binfo for the primary base class, i.e.,
+ the base class which contains the virtual function table pointer
+ for this class. */
+#define CLASSTYPE_PRIMARY_BINFO(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->primary_base)
+
+/* The number of virtual functions present in this class' virtual
+ function table. */
+#define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC (NODE)->vsize)
+
+/* A chain of BINFOs for the direct and indirect virtual base classes
+ that this type uses in a post-order depth-first left-to-right
+ order. (In other words, these bases appear in the order that they
+ should be initialized.) If a virtual base is primary, then the
+ primary copy will appear on this list. Thus, the BINFOs on this
+ list are all "real"; they are the same BINFOs that will be
+ encountered when using dfs_unmarked_real_bases_queue_p and related
+ functions. */
+#define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC (NODE)->vbases)
+
+/* For a non-virtual BINFO, the BINFO itself; for a virtual BINFO, the
+ binfo_for_vbase. C is the most derived class for the hierarchy
+ containing BINFO. */
+#define CANONICAL_BINFO(BINFO, C) \
+ (TREE_VIA_VIRTUAL (BINFO) \
+ ? binfo_for_vbase (BINFO_TYPE (BINFO), C) \
+ : (BINFO))
+
+/* Number of direct baseclasses of NODE. */
#define CLASSTYPE_N_BASECLASSES(NODE) \
- (TYPE_BINFO_BASETYPES (NODE) ? TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES(NODE)) : 0)
+ (BINFO_N_BASETYPES (TYPE_BINFO (NODE)))
+
+/* These are the size and alignment of the type without its virtual
+ base classes, for when we use this type as a base itself. */
+#define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC (NODE)->size)
+#define CLASSTYPE_SIZE_UNIT(NODE) (TYPE_LANG_SPECIFIC (NODE)->size_unit)
+#define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC (NODE)->align)
+#define CLASSTYPE_USER_ALIGN(NODE) (TYPE_LANG_SPECIFIC (NODE)->user_align)
-/* Used for keeping search-specific information. Any search routine
- which uses this must define what exactly this slot is used for. */
-#define CLASSTYPE_SEARCH_SLOT(NODE) (TYPE_LANG_SPECIFIC(NODE)->search_slot)
+/* The alignment of NODE, without its virtual bases, in bytes. */
+#define CLASSTYPE_ALIGN_UNIT(NODE) \
+ (CLASSTYPE_ALIGN (NODE) / BITS_PER_UNIT)
-/* These are the size, mode and alignment of the type without its
- virtual base classes, for when we use this type as a base itself. */
-#define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
-#define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)
+/* True if this a Java interface type, declared with
+ '__attribute__ ((java_interface))'. */
+#define TYPE_JAVA_INTERFACE(NODE) (TYPE_LANG_SPECIFIC (NODE)->java_interface)
/* A cons list of virtual functions which cannot be inherited by
derived classes. When deriving from this type, the derived
class must provide its own definition for each of these functions. */
-#define CLASSTYPE_ABSTRACT_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->abstract_virtuals)
+#define CLASSTYPE_PURE_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC (NODE)->pure_virtuals)
/* Nonzero means that this aggr type has been `closed' by a semicolon. */
-#define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.got_semicolon)
+#define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->got_semicolon)
/* Nonzero means that the main virtual function table pointer needs to be
set because base constructors have placed the wrong value there.
If this is zero, it means that they placed the right value there,
and there is no need to change it. */
-#define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_virtual_reinit)
-
-/* Nonzero means that if this type has virtual functions, that
- the virtual function table will be written out. */
-#define CLASSTYPE_VTABLE_NEEDS_WRITING(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.vtable_needs_writing)
+#define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->needs_virtual_reinit)
/* Nonzero means that this type has an X() constructor. */
-#define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_default_ctor)
-
-/* Nonzero means the type declared a ctor as private or protected. We
- use this to make sure we don't try to generate a copy ctor for a
- class that has a member of type NODE. */
-#define TYPE_HAS_NONPUBLIC_CTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_nonpublic_ctor)
-
-/* Ditto, for operator=. */
-#define TYPE_HAS_NONPUBLIC_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_nonpublic_assign_ref)
+#define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->has_default_ctor)
/* Nonzero means that this type contains a mutable member */
-#define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_mutable)
+#define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_mutable)
#define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
-/* Nonzero means that this type is meant for communication via COM. */
-#define CLASSTYPE_COM_INTERFACE(NODE) \
- (TYPE_LANG_SPECIFIC(NODE)->type_flags.com_interface)
+/* Nonzero means that this class type is a non-POD class. */
+#define CLASSTYPE_NON_POD_P(NODE) (TYPE_LANG_SPECIFIC (NODE)->non_pod_class)
+
+/* Nonzero if this class is "nearly empty", i.e., contains only a
+ virtual function table pointer. */
+#define CLASSTYPE_NEARLY_EMPTY_P(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->nearly_empty_p)
/* A list of class types of which this type is a friend. The
TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
case of a template friend. */
-#define CLASSTYPE_FRIEND_CLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->friend_classes)
+#define CLASSTYPE_FRIEND_CLASSES(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->friend_classes)
/* A list of the classes which grant friendship to this class. */
#define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \
(TYPE_LANG_SPECIFIC (NODE)->befriending_classes)
/* Say whether this node was declared as a "class" or a "struct". */
-#define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_class)
+#define CLASSTYPE_DECLARED_CLASS(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->declared_class)
/* Nonzero if this class has const members which have no specified initialization. */
-#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.const_needs_init)
+#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->const_needs_init)
/* Nonzero if this class has ref members which have no specified initialization. */
-#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ref_needs_init)
+#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->ref_needs_init)
/* Nonzero if this class is included from a header file which employs
`#pragma interface', and it is not included in its implementation file. */
-#define CLASSTYPE_INTERFACE_ONLY(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_only)
-
-/* Same as above, but for classes whose purpose we do not know. */
-#define CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown)
-#define CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown == 0)
-#define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = !!(X))
-#define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = 1)
-#define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = 0)
+#define CLASSTYPE_INTERFACE_ONLY(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->interface_only)
+
+/* True if we have already determined whether or not vtables, VTTs,
+ typeinfo, and other similar per-class data should be emitted in
+ this translation unit. This flag does not indicate whether or not
+ these items should be emitted; it only indicates that we know one
+ way or the other. */
+#define CLASSTYPE_INTERFACE_KNOWN(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->interface_unknown == 0)
+/* The opposite of CLASSTYPE_INTERFANCE_KNOWN. */
+#define CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->interface_unknown)
+
+#define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) \
+ (TYPE_LANG_SPECIFIC (NODE)->interface_unknown = !!(X))
+#define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->interface_unknown = 1)
+#define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->interface_unknown = 0)
/* Nonzero if a _DECL node requires us to output debug info for this class. */
-#define CLASSTYPE_DEBUG_REQUESTED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.debug_requested)
+#define CLASSTYPE_DEBUG_REQUESTED(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->debug_requested)
/* Additional macros for inheritance information. */
@@ -1065,58 +1563,114 @@ struct lang_type
for B (in D) will have a BINFO_INHERITANCE_CHAIN pointing to
D. In tree.h, this pointer is described as pointing in other
direction. There is a different BINFO for each path to a virtual
- base; BINFOs for virtual bases are not shared. In addition, shared
- versions of each of the virtual class BINFOs are stored in
- CLASSTYPE_VBASECLASSES.
+ base; BINFOs for virtual bases are not shared.
We use TREE_VIA_PROTECTED and TREE_VIA_PUBLIC, but private
inheritance is indicated by the absence of the other two flags, not
- by TREE_VIAR_PRIVATE, which is unused.
+ by TREE_VIA_PRIVATE, which is unused. */
- The TREE_CHAIN is for scratch space in search.c. */
+/* Mark the binfo, whether shared or not. Each instance of a virtual
+ base can be separately marked. */
+#define BINFO_UNSHARED_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
-/* Nonzero means marked by DFS or BFS search, including searches
- by `get_binfo' and `get_base_distance'. */
-#define BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED(BINFO_TYPE(NODE)):TREE_LANG_FLAG_0(NODE))
+/* Nonzero means marked by DFS or BFS search. */
+#define BINFO_MARKED(NODE) \
+ (TREE_VIA_VIRTUAL (NODE) \
+ ? CLASSTYPE_MARKED (BINFO_TYPE (NODE)) \
+ : TREE_LANG_FLAG_0 (NODE))
/* Macros needed because of C compilers that don't allow conditional
expressions to be lvalues. Grr! */
-#define SET_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=1))
-#define CLEAR_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=0))
-
-/* Nonzero means marked in search through virtual inheritance hierarchy. */
-#define BINFO_VBASE_MARKED(NODE) CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
-/* Modifier macros */
-#define SET_BINFO_VBASE_MARKED(NODE) SET_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
-#define CLEAR_BINFO_VBASE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
-
-/* Nonzero means marked in search for members or member functions. */
-#define BINFO_FIELDS_MARKED(NODE) \
- (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED2 (BINFO_TYPE (NODE)):TREE_LANG_FLAG_2(NODE))
-#define SET_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=1))
-#define CLEAR_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=0))
+#define SET_BINFO_MARKED(NODE) \
+ (TREE_VIA_VIRTUAL(NODE) \
+ ? SET_CLASSTYPE_MARKED (BINFO_TYPE (NODE)) \
+ : (TREE_LANG_FLAG_0 (NODE) = 1))
+#define CLEAR_BINFO_MARKED(NODE) \
+ (TREE_VIA_VIRTUAL (NODE) \
+ ? CLEAR_CLASSTYPE_MARKED (BINFO_TYPE (NODE)) \
+ : (TREE_LANG_FLAG_0 (NODE) = 0))
/* Nonzero means that this class is on a path leading to a new vtable. */
-#define BINFO_VTABLE_PATH_MARKED(NODE) \
- (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):TREE_LANG_FLAG_3(NODE))
-#define SET_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=1))
-#define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=0))
-
-/* Nonzero means that this class has a new vtable. */
-#define BINFO_NEW_VTABLE_MARKED(NODE) \
- (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):TREE_LANG_FLAG_4(NODE))
-#define SET_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=1))
-#define CLEAR_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=0))
+#define BINFO_VTABLE_PATH_MARKED(NODE) \
+ (TREE_VIA_VIRTUAL (NODE) \
+ ? CLASSTYPE_MARKED3 (BINFO_TYPE (NODE)) \
+ : TREE_LANG_FLAG_3 (NODE))
+#define SET_BINFO_VTABLE_PATH_MARKED(NODE) \
+ (TREE_VIA_VIRTUAL(NODE) \
+ ? SET_CLASSTYPE_MARKED3 (BINFO_TYPE (NODE)) \
+ : (TREE_LANG_FLAG_3 (NODE) = 1))
+#define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) \
+ (TREE_VIA_VIRTUAL (NODE) \
+ ? CLEAR_CLASSTYPE_MARKED3 (BINFO_TYPE (NODE))\
+ : (TREE_LANG_FLAG_3 (NODE) = 0))
+
+/* Nonzero means B (a BINFO) has its own vtable. Under the old ABI,
+ secondary vtables are sometimes shared. Any copies will not have
+ this flag set.
+
+ B is part of the hierarchy dominated by C. */
+#define BINFO_NEW_VTABLE_MARKED(B, C) \
+ (TREE_LANG_FLAG_4 (CANONICAL_BINFO (B, C)))
+
+/* Any subobject that needs a new vtable must have a vptr and must not
+ be a non-virtual primary base (since it would then use the vtable from a
+ derived class and never become non-primary.) */
+#define SET_BINFO_NEW_VTABLE_MARKED(B, C) \
+ (BINFO_NEW_VTABLE_MARKED (B, C) = 1, \
+ my_friendly_assert (!BINFO_PRIMARY_P (B) \
+ || TREE_VIA_VIRTUAL (B), 20000517), \
+ my_friendly_assert (CLASSTYPE_VFIELDS (BINFO_TYPE (B)) != NULL_TREE, \
+ 20000517))
/* Nonzero means this class has done dfs_pushdecls. */
#define BINFO_PUSHDECLS_MARKED(NODE) BINFO_VTABLE_PATH_MARKED (NODE)
#define SET_BINFO_PUSHDECLS_MARKED(NODE) SET_BINFO_VTABLE_PATH_MARKED (NODE)
#define CLEAR_BINFO_PUSHDECLS_MARKED(NODE) CLEAR_BINFO_VTABLE_PATH_MARKED (NODE)
+/* Nonzero if this BINFO is a primary base class.
+
+ In the TYPE_BINFO hierarchy, this flag is never set for a base
+ class of a non-primary virtual base. This flag is only valid for
+ paths (given by BINFO_INHERITANCE_CHAIN) that really exist in the
+ final object. */
+#define BINFO_PRIMARY_P(NODE) \
+ (BINFO_PRIMARY_BASE_OF (NODE) != NULL_TREE)
+
+/* The index in the VTT where this subobject's sub-VTT can be found.
+ NULL_TREE if there is no sub-VTT. */
+#define BINFO_SUBVTT_INDEX(NODE) TREE_VEC_ELT (NODE, 8)
+
+/* The index in the VTT where the vptr for this subobject can be
+ found. NULL_TREE if there is no secondary vptr in the VTT. */
+#define BINFO_VPTR_INDEX(NODE) TREE_VEC_ELT (NODE, 9)
+
+/* The binfo of which NODE is a primary base. (This is different from
+ BINFO_INHERITANCE_CHAIN for virtual base because a virtual base is
+ sometimes a primary base for a class for which it is not an
+ immediate base.) */
+#define BINFO_PRIMARY_BASE_OF(NODE) TREE_VEC_ELT (NODE, 10)
+
+/* Nonzero if this binfo has lost its primary base binfo (because that
+ is a nearly-empty virtual base that has been taken by some other
+ base in the complete hierarchy. */
+#define BINFO_LOST_PRIMARY_P(NODE) TREE_LANG_FLAG_2 (NODE)
+
+/* Nonzero if this binfo is an indirect primary base, i.e. a virtual
+ base that is a primary base of some of other class in the
+ hierarchy. */
+#define BINFO_INDIRECT_PRIMARY_P(NODE) TREE_USED (NODE)
+
/* Used by various search routines. */
#define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
/* Accessor macros for the vfield slots in structures. */
+/* The virtual function pointer fields that this type contains. For a
+ vfield defined just for this class, or from a primary base, the
+ TREE_PURPOSE is NULL. Otherwise, the TREE_PURPOSE is the BINFO for
+ the class containing the vfield. The TREE_VALUE is the class where
+ the vfield was first defined. */
+#define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC (NODE)->vfields)
+
/* Get the assoc info that caused this vfield to exist. */
#define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE)
@@ -1124,20 +1678,36 @@ struct lang_type
#define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE)
/* Get the value of the top-most type dominating the non-`normal' vfields. */
-#define VF_DERIVED_VALUE(NODE) (VF_BINFO_VALUE (NODE) ? BINFO_TYPE (VF_BINFO_VALUE (NODE)) : NULL_TREE)
+#define VF_DERIVED_VALUE(NODE) \
+ (VF_BINFO_VALUE (NODE) ? BINFO_TYPE (VF_BINFO_VALUE (NODE)) : NULL_TREE)
+
+/* The number of bytes by which to adjust the `this' pointer when
+ calling this virtual function. */
+#define BV_DELTA(NODE) (TREE_PURPOSE (NODE))
+
+/* If non-NULL, the vtable index at which to find the vcall offset
+ when calling this virtual function. */
+#define BV_VCALL_INDEX(NODE) (TREE_TYPE (NODE))
+
+/* The function to call. */
+#define BV_FN(NODE) (TREE_VALUE (NODE))
-/* Get the value of the top-most type that's `normal' for the vfield. */
-#define VF_NORMAL_VALUE(NODE) TREE_TYPE (NODE)
+/* Nonzero if we should use a virtual thunk for this entry. */
+#define BV_USE_VCALL_INDEX_P(NODE) \
+ (TREE_LANG_FLAG_0 (NODE))
/* Nonzero for TREE_LIST node means that this list of things
is a list of parameters, as opposed to a list of expressions. */
-#define TREE_PARMLIST(NODE) ((NODE)->common.unsigned_flag) /* overloaded! */
+#define TREE_PARMLIST(NODE) (TREE_LANG_FLAG_2 (NODE))
+
+/* Nonzero for a parmlist means that this parmlist ended in ... */
+#define PARMLIST_ELLIPSIS_P(NODE) TREE_LANG_FLAG_0 (NODE)
/* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE
- will be NULL_TREE to indicate a throw specification of `(...)', or,
- equivalently, no throw specification. */
-#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
+ will be NULL_TREE to indicate a throw specification of `()', or
+ no exceptions allowed. */
+#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_BINFO (NODE)
/* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */
#define TYPE_NOTHROW_P(NODE) \
@@ -1145,66 +1715,116 @@ struct lang_type
&& TREE_VALUE (TYPE_RAISES_EXCEPTIONS (NODE)) == NULL_TREE)
/* The binding level associated with the namespace. */
-#define NAMESPACE_LEVEL(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.level)
+#define NAMESPACE_LEVEL(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.u.level)
/* If a DECL has DECL_LANG_SPECIFIC, it is either a lang_decl_flags or
- a lang_decl (which has lang_decl_flags as its initial prefix). A
- FUNCTION_DECL, NAMESPACE_DECL, TYPE_DECL, or USING_DECL may have a
- full lang_decl. A FIELD_DECL, or a static data member VAR_DECL,
- will have only lang_decl_flags. Thus, one should only access the
- members of lang_decl that are not in lang_decl_flags for DECLs that
- are not FIELD_DECLs or VAR_DECLs. */
+ a lang_decl (which has lang_decl_flags as its initial prefix).
+ This macro is nonzero for tree nodes whose DECL_LANG_SPECIFIC is
+ the full lang_decl, and not just lang_decl_flags. */
+#define CAN_HAVE_FULL_LANG_DECL_P(NODE) \
+ (!(TREE_CODE (NODE) == VAR_DECL \
+ || TREE_CODE (NODE) == CONST_DECL \
+ || TREE_CODE (NODE) == FIELD_DECL \
+ || TREE_CODE (NODE) == USING_DECL))
struct lang_decl_flags
{
-#ifdef ONLY_INT_FIELDS
- int language : 8;
-#else
- enum languages language : 8;
-#endif
+ struct c_lang_decl base;
+
+ ENUM_BITFIELD(languages) language : 8;
unsigned operator_attr : 1;
unsigned constructor_attr : 1;
+ unsigned destructor_attr : 1;
unsigned friend_attr : 1;
unsigned static_function : 1;
- unsigned const_memfunc : 1;
- unsigned volatile_memfunc : 1;
- unsigned abstract_virtual : 1;
- unsigned permanent_attr : 1 ;
-
- unsigned mutable_flag : 1;
- unsigned is_default_implementation : 1;
- unsigned saved_inline : 1;
+ unsigned pure_virtual : 1;
+ unsigned has_in_charge_parm_p : 1;
+ unsigned has_vtt_parm_p : 1;
+
+ unsigned deferred : 1;
unsigned use_template : 2;
unsigned nonconverting : 1;
- unsigned declared_inline : 1;
unsigned not_really_extern : 1;
unsigned needs_final_overrider : 1;
- unsigned bitfield : 1;
- unsigned defined_in_class : 1;
- unsigned constructor_for_vbase_attr : 2;
- unsigned dummy : 3;
+ unsigned initialized_in_class : 1;
+ unsigned pending_inline_p : 1;
- tree access;
- tree context;
- tree memfunc_pointer_to;
- tree template_info;
- struct binding_level *level;
+ unsigned global_ctor_p : 1;
+ unsigned global_dtor_p : 1;
+ unsigned assignment_operator_p : 1;
+ unsigned anticipated_p : 1;
+ /* Four unused bits. */
+
+ union {
+ /* In a FUNCTION_DECL, VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this
+ is DECL_TEMPLATE_INFO. */
+ tree template_info;
+
+ /* In a NAMESPACE_DECL, this is NAMESPACE_LEVEL. */
+ struct binding_level *level;
+ } u;
+
+ union {
+ /* This is DECL_ACCESS. */
+ tree access;
+
+ /* For VAR_DECL in function, this is DECL_DISCRIMINATOR. */
+ int discriminator;
+
+ /* In a namespace-scope FUNCTION_DECL, this is
+ GLOBAL_INIT_PRIORITY. */
+ int init_priority;
+
+ /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
+ THUNK_VCALL_OFFSET. */
+ tree vcall_offset;
+ } u2;
};
struct lang_decl
{
struct lang_decl_flags decl_flags;
- tree main_decl_variant;
tree befriending_classes;
- struct pending_inline *pending_inline_info;
+
+ /* For a virtual FUNCTION_DECL, this is DECL_VIRTUAL_CONTEXT. For a
+ non-virtual FUNCTION_DECL, this is DECL_FRIEND_CONTEXT. */
+ tree context;
+
+ /* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION. */
+ tree cloned_function;
+
+ union
+ {
+ tree sorted_fields;
+ struct unparsed_text *pending_inline_info;
+ struct cp_language_function *saved_language_function;
+ } u;
+
+ union {
+ /* In an overloaded operator, this is the value of
+ DECL_OVERLOADED_OPERATOR_P. */
+ enum tree_code operator_code;
+ } u2;
};
-/* Non-zero if NODE is a _DECL with TREE_READONLY set. */
-#define TREE_READONLY_DECL_P(NODE) \
- (TREE_READONLY (NODE) && TREE_CODE_CLASS (TREE_CODE (NODE)) == 'd')
+#define DEFARG_POINTER(NODE) (DEFAULT_ARG_CHECK (NODE)->identifier.id.str)
+
+/* DECL_NEEDED_P holds of a declaration when we need to emit its
+ definition. This is true when the back-end tells us that
+ the symbol has been referenced in the generated code. If, however,
+ we are not generating code, then it is also true when a symbol has
+ just been used somewhere, even if it's not really needed. We need
+ anything that isn't comdat, but we don't know for sure whether or
+ not something is comdat until end-of-file. */
+#define DECL_NEEDED_P(DECL) \
+ ((at_eof && TREE_PUBLIC (DECL) && !DECL_COMDAT (DECL)) \
+ || (DECL_ASSEMBLER_NAME_SET_P (DECL) \
+ && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL))) \
+ || (flag_syntax_only && TREE_USED (DECL)))
/* Non-zero iff DECL is memory-based. The DECL_RTL of
certain const variables might be a CONST_INT, or a REG
@@ -1212,99 +1832,173 @@ struct lang_decl
here because on most RISC machines, a variable's address
is not, by itself, a legitimate address. */
#define DECL_IN_MEMORY_P(NODE) \
- (DECL_RTL (NODE) != NULL_RTX && GET_CODE (DECL_RTL (NODE)) == MEM)
+ (DECL_RTL_SET_P (NODE) && GET_CODE (DECL_RTL (NODE)) == MEM)
-/* For FUNCTION_DECLs: return the language in which this decl
- was declared. */
-#define DECL_LANGUAGE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.language)
+/* For a FUNCTION_DECL or a VAR_DECL, the language linkage for the
+ declaration. Some entities (like a member function in a local
+ class, or a local variable) do not have linkage at all, and this
+ macro should not be used in those cases.
+
+ Implementation note: A FUNCTION_DECL without DECL_LANG_SPECIFIC was
+ created by language-independent code, and has C linkage. Most
+ VAR_DECLs have C++ linkage, and do not have DECL_LANG_SPECIFIC, but
+ we do create DECL_LANG_SPECIFIC for variables with non-C++ linkage. */
+#define DECL_LANGUAGE(NODE) \
+ (DECL_LANG_SPECIFIC (NODE) \
+ ? DECL_LANG_SPECIFIC (NODE)->decl_flags.language \
+ : (TREE_CODE (NODE) == FUNCTION_DECL \
+ ? lang_c : lang_cplusplus))
+
+/* Set the language linkage for NODE to LANGUAGE. */
+#define SET_DECL_LANGUAGE(NODE, LANGUAGE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.language = (LANGUAGE))
/* For FUNCTION_DECLs: nonzero means that this function is a constructor. */
-#define DECL_CONSTRUCTOR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_attr)
-
-/* There ought to be a better way to find out whether or not something is
- a destructor. */
-#define DECL_DESTRUCTOR_P(NODE) \
- (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (NODE)) \
- && DECL_LANGUAGE (NODE) == lang_cplusplus)
-
-#define DECL_CONV_FN_P(NODE) \
- (IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)) && TREE_TYPE (DECL_NAME (NODE)))
-
-#define CONSTRUCTOR_FOR_VBASE 1
-#define CONSTRUCTOR_FOR_PVBASE 2
-#define DESTRUCTOR_FOR_PVBASE 3
-
-/* For FUNCTION_DECLs: nonzero means that this function is a con/destructor
- for an object with virtual baseclasses. */
-#define DECL_CONSTRUCTOR_FOR_VBASE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr)
-
-/* Nonzero means that this function is a constructor for an object
- with virtual baseclasses. */
-#define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) \
- (DECL_CONSTRUCTOR_FOR_VBASE (NODE) == CONSTRUCTOR_FOR_VBASE)
+#define DECL_CONSTRUCTOR_P(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.constructor_attr)
+
+/* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete
+ object. */
+#define DECL_COMPLETE_CONSTRUCTOR_P(NODE) \
+ (DECL_CONSTRUCTOR_P (NODE) \
+ && DECL_NAME (NODE) == complete_ctor_identifier)
+
+/* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a base
+ object. */
+#define DECL_BASE_CONSTRUCTOR_P(NODE) \
+ (DECL_CONSTRUCTOR_P (NODE) \
+ && DECL_NAME (NODE) == base_ctor_identifier)
+
+/* Nonzero if NODE (a FUNCTION_DECL) is a constructor, but not either the
+ specialized in-charge constructor or the specialized not-in-charge
+ constructor. */
+#define DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P(NODE) \
+ (DECL_CONSTRUCTOR_P (NODE) && !DECL_CLONED_FUNCTION_P (NODE))
-/* Nonzero means that this function is a constructor for an object
- with virtual baseclasses which have virtual functions. */
-#define DECL_CONSTRUCTOR_FOR_PVBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr == CONSTRUCTOR_FOR_PVBASE)
+/* Nonzero if NODE (a FUNCTION_DECL) is a copy constructor. */
+#define DECL_COPY_CONSTRUCTOR_P(NODE) \
+ (DECL_CONSTRUCTOR_P (NODE) && copy_fn_p (NODE) > 0)
-/* Nonzero means that this function is a destructor for an object
- with virtual baseclasses which have virtual functions. */
-#define DECL_DESTRUCTOR_FOR_PVBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr == DESTRUCTOR_FOR_PVBASE)
+/* Nonzero if NODE is a destructor. */
+#define DECL_DESTRUCTOR_P(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.destructor_attr)
+
+/* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the
+ specialized in-charge constructor, in-charge deleting constructor,
+ or the the base destructor. */
+#define DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P(NODE) \
+ (DECL_DESTRUCTOR_P (NODE) && !DECL_CLONED_FUNCTION_P (NODE))
+
+/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
+ object. */
+#define DECL_COMPLETE_DESTRUCTOR_P(NODE) \
+ (DECL_DESTRUCTOR_P (NODE) \
+ && DECL_NAME (NODE) == complete_dtor_identifier)
+
+/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a base
+ object. */
+#define DECL_BASE_DESTRUCTOR_P(NODE) \
+ (DECL_DESTRUCTOR_P (NODE) \
+ && DECL_NAME (NODE) == base_dtor_identifier)
+
+/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
+ object that deletes the object after it has been destroyed. */
+#define DECL_DELETING_DESTRUCTOR_P(NODE) \
+ (DECL_DESTRUCTOR_P (NODE) \
+ && DECL_NAME (NODE) == deleting_dtor_identifier)
+
+/* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or
+ destructor. */
+#define DECL_CLONED_FUNCTION_P(NODE) \
+ ((TREE_CODE (NODE) == FUNCTION_DECL \
+ || TREE_CODE (NODE) == TEMPLATE_DECL) \
+ && DECL_LANG_SPECIFIC (NODE) \
+ && DECL_CLONED_FUNCTION (NODE) != NULL_TREE)
-/* Nonzero means that this function is a wrapper around a PVBASE ctor. */
-#define DECL_VLIST_CTOR_WRAPPER_P(NODE) \
- (DECL_CONSTRUCTOR_FOR_VBASE_P (NODE) && DECL_VLIST_CTOR_WRAPPED (NODE)\
- && TREE_CODE (DECL_VLIST_CTOR_WRAPPED (NODE)) == FUNCTION_DECL \
- && DECL_CONSTRUCTOR_FOR_PVBASE_P (DECL_VLIST_CTOR_WRAPPED (NODE)))
+/* If DECL_CLONED_FUNCTION_P holds, this is the function that was
+ cloned. */
+#define DECL_CLONED_FUNCTION(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->cloned_function)
-/* Refers to original function that NODE wraps. */
-#define DECL_VLIST_CTOR_WRAPPED(NODE) DECL_MEMFUNC_POINTER_TO (NODE)
+/* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS. */
+#define DECL_DISCRIMINATOR_P(NODE) \
+ (TREE_CODE (NODE) == VAR_DECL \
+ && DECL_FUNCTION_SCOPE_P (NODE))
-/* Non-zero for a FUNCTION_DECL that declares a type-info function. */
-#define DECL_TINFO_FN_P(NODE) \
- (TREE_CODE (NODE) == FUNCTION_DECL \
- && DECL_ARTIFICIAL (NODE) \
- && DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag)
+/* Discriminator for name mangling. */
+#define DECL_DISCRIMINATOR(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.u2.discriminator)
-/* Mark NODE as a type-info function. */
-#define SET_DECL_TINFO_FN_P(NODE) \
- (DECL_LANG_SPECIFIC((NODE))->decl_flags.mutable_flag = 1)
+/* Non-zero if the VTT parm has been added to NODE. */
+#define DECL_HAS_VTT_PARM_P(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.has_vtt_parm_p)
-/* For FUNCTION_DECLs: nonzero means that this function is a default
- implementation of a signature method. */
-#define IS_DEFAULT_IMPLEMENTATION(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.is_default_implementation)
+/* Non-zero if NODE is a FUNCTION_DECL for which a VTT parameter is
+ required. */
+#define DECL_NEEDS_VTT_PARM_P(NODE) \
+ (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (NODE)) \
+ && (DECL_BASE_CONSTRUCTOR_P (NODE) \
+ || DECL_BASE_DESTRUCTOR_P (NODE)))
+
+/* Non-zero if NODE is a user-defined conversion operator. */
+#define DECL_CONV_FN_P(NODE) \
+ (IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)))
+
+/* Set the overloaded operator code for NODE to CODE. */
+#define SET_OVERLOADED_OPERATOR_CODE(NODE, CODE) \
+ (DECL_LANG_SPECIFIC (NODE)->u2.operator_code = (CODE))
+
+/* If NODE is an overloaded operator, then this returns the TREE_CODE
+ associcated with the overloaded operator.
+ DECL_ASSIGNMENT_OPERATOR_P must also be checked to determine
+ whether or not NODE is an assignment operator. If NODE is not an
+ overloaded operator, ERROR_MARK is returned. Since the numerical
+ value of ERROR_MARK is zero, this macro can be used as a predicate
+ to test whether or not NODE is an overloaded operator. */
+#define DECL_OVERLOADED_OPERATOR_P(NODE) \
+ (IDENTIFIER_OPNAME_P (DECL_NAME (NODE)) \
+ ? DECL_LANG_SPECIFIC (NODE)->u2.operator_code : ERROR_MARK)
+
+/* Non-zero if NODE is an assignment operator. */
+#define DECL_ASSIGNMENT_OPERATOR_P(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.assignment_operator_p)
+
+/* For FUNCTION_DECLs: nonzero means that this function is a
+ constructor or a destructor with an extra in-charge parameter to
+ control whether or not virtual bases are constructed. */
+#define DECL_HAS_IN_CHARGE_PARM_P(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.has_in_charge_parm_p)
+
+/* Nonzero if NODE is an overloaded `operator delete[]' function. */
+#define DECL_ARRAY_DELETE_OPERATOR_P(NODE) \
+ (DECL_OVERLOADED_OPERATOR_P (NODE) == VEC_DELETE_EXPR)
/* Nonzero for _DECL means that this decl appears in (or will appear
in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
detecting circularity in case members are multiply defined. In the
case of a VAR_DECL, it is also used to determine how program storage
should be allocated. */
-#define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3(NODE))
+#define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3 (NODE))
-/* Nonzero if the DECL was defined in the class definition itself,
+/* Nonzero if the DECL was initialized in the class definition itself,
rather than outside the class. */
-#define DECL_DEFINED_IN_CLASS_P(DECL) \
- (DECL_LANG_SPECIFIC (DECL)->decl_flags.defined_in_class)
+#define DECL_INITIALIZED_IN_CLASS_P(DECL) \
+ (DECL_LANG_SPECIFIC (DECL)->decl_flags.initialized_in_class)
/* Nonzero for FUNCTION_DECL means that this decl is just a
friend declaration, and should not be added to the list of
member functions for this class. */
-#define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.friend_attr)
+#define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.friend_attr)
/* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */
#define DECL_BEFRIENDING_CLASSES(NODE) \
- (DECL_LANG_SPECIFIC(NODE)->befriending_classes)
+ (DECL_LANG_SPECIFIC (NODE)->befriending_classes)
/* Nonzero for FUNCTION_DECL means that this decl is a static
member function. */
-#define DECL_STATIC_FUNCTION_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.static_function)
-
-/* Nonzero for a class member means that it is shared between all objects
- of that class. */
-#define SHARED_MEMBER_P(NODE) \
- (TREE_CODE (NODE) == VAR_DECL || TREE_CODE (NODE) == TYPE_DECL \
- || TREE_CODE (NODE) == CONST_DECL)
-
+#define DECL_STATIC_FUNCTION_P(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.static_function)
+
/* Nonzero for FUNCTION_DECL means that this decl is a non-static
member function. */
#define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
@@ -1317,44 +2011,88 @@ struct lang_decl
/* Nonzero for FUNCTION_DECL means that this member function
has `this' as const X *const. */
-#define DECL_CONST_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.const_memfunc)
+#define DECL_CONST_MEMFUNC_P(NODE) \
+ (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
+ && CP_TYPE_CONST_P (TREE_TYPE (TREE_VALUE \
+ (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
/* Nonzero for FUNCTION_DECL means that this member function
has `this' as volatile X *const. */
-#define DECL_VOLATILE_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.volatile_memfunc)
+#define DECL_VOLATILE_MEMFUNC_P(NODE) \
+ (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
+ && CP_TYPE_VOLATILE_P (TREE_TYPE (TREE_VALUE \
+ (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
/* Nonzero for a DECL means that this member is a non-static member. */
-#define DECL_NONSTATIC_MEMBER_P(NODE) \
- ((TREE_CODE (NODE) == FUNCTION_DECL \
+#define DECL_NONSTATIC_MEMBER_P(NODE) \
+ ((TREE_CODE (NODE) == FUNCTION_DECL \
&& DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)) \
|| TREE_CODE (NODE) == FIELD_DECL)
/* Nonzero for _DECL means that this member object type
is mutable. */
-#define DECL_MUTABLE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag)
+#define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (NODE))
/* Nonzero for _DECL means that this constructor is a non-converting
constructor. */
-#define DECL_NONCONVERTING_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.nonconverting)
+#define DECL_NONCONVERTING_P(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.nonconverting)
-/* Nonzero for FUNCTION_DECL means that this member function
- exists as part of an abstract class's interface. */
-#define DECL_ABSTRACT_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.abstract_virtual)
+/* Nonzero for FUNCTION_DECL means that this member function is a pure
+ virtual function. */
+#define DECL_PURE_VIRTUAL_P(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.pure_virtual)
/* Nonzero for FUNCTION_DECL means that this member function
must be overridden by derived classes. */
-#define DECL_NEEDS_FINAL_OVERRIDER_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.needs_final_overrider)
+#define DECL_NEEDS_FINAL_OVERRIDER_P(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.needs_final_overrider)
-/* Nonzero if allocated on permanent_obstack. */
-#define LANG_DECL_PERMANENT(LANGDECL) ((LANGDECL)->decl_flags.permanent_attr)
+/* Nonzero if NODE is a thunk, rather than an ordinary function. */
+#define DECL_THUNK_P(NODE) \
+ (TREE_CODE (NODE) == FUNCTION_DECL \
+ && DECL_LANG_FLAG_7 (NODE))
+
+/* Nonzero if NODE is a FUNCTION_DECL, but not a thunk. */
+#define DECL_NON_THUNK_FUNCTION_P(NODE) \
+ (TREE_CODE (NODE) == FUNCTION_DECL && !DECL_THUNK_P (NODE))
+
+/* Nonzero if NODE is `extern "C"'. */
+#define DECL_EXTERN_C_P(NODE) \
+ (DECL_LANGUAGE (NODE) == lang_c)
+
+/* Nonzero if NODE is an `extern "C"' function. */
+#define DECL_EXTERN_C_FUNCTION_P(NODE) \
+ (DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE))
+
+/* Set DECL_THUNK_P for node. */
+#define SET_DECL_THUNK_P(NODE) \
+ (DECL_LANG_FLAG_7 (NODE) = 1)
+
+/* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a
+ template function. */
+#define DECL_PRETTY_FUNCTION_P(NODE) \
+ (TREE_LANG_FLAG_0 (NODE))
/* The _TYPE context in which this _DECL appears. This field holds the
- class where a virtual function instance is actually defined, and the
- lexical scope of a friend function defined in a class body. */
-#define DECL_CLASS_CONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.context)
-#define DECL_REAL_CONTEXT(NODE) \
- ((TREE_CODE (NODE) == FUNCTION_DECL && DECL_FUNCTION_MEMBER_P (NODE)) \
- ? DECL_CLASS_CONTEXT (NODE) : CP_DECL_CONTEXT (NODE))
+ class where a virtual function instance is actually defined. */
+#define DECL_CLASS_CONTEXT(NODE) \
+ (DECL_CLASS_SCOPE_P (NODE) ? DECL_CONTEXT (NODE) : NULL_TREE)
+
+/* For a non-member friend function, the class (if any) in which this
+ friend was defined. For example, given:
+
+ struct S { friend void f (); };
+
+ the DECL_FRIEND_CONTEXT for `f' will be `S'. */
+#define DECL_FRIEND_CONTEXT(NODE) \
+ ((DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE)) \
+ ? DECL_LANG_SPECIFIC (NODE)->context \
+ : NULL_TREE)
+
+/* Set the DECL_FRIEND_CONTEXT for NODE to CONTEXT. */
+#define SET_DECL_FRIEND_CONTEXT(NODE, CONTEXT) \
+ (DECL_LANG_SPECIFIC (NODE)->context = (CONTEXT))
/* NULL_TREE in DECL_CONTEXT represents the global namespace. */
#define CP_DECL_CONTEXT(NODE) \
@@ -1363,107 +2101,188 @@ struct lang_decl
/* For a virtual function, the base where we find its vtable entry.
For a non-virtual function, the base where it is defined. */
-#define DECL_VIRTUAL_CONTEXT(NODE) DECL_CONTEXT (NODE)
+#define DECL_VIRTUAL_CONTEXT(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->context)
/* 1 iff NODE has namespace scope, including the global namespace. */
-#define DECL_NAMESPACE_SCOPE_P(NODE) \
- (DECL_CONTEXT (NODE) == NULL_TREE \
- || TREE_CODE (DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
+#define DECL_NAMESPACE_SCOPE_P(NODE) \
+ (!DECL_TEMPLATE_PARM_P (NODE) \
+ && TREE_CODE (CP_DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
/* 1 iff NODE is a class member. */
#define DECL_CLASS_SCOPE_P(NODE) \
- (DECL_CONTEXT (NODE) \
- && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (NODE))) == 't')
+ (DECL_CONTEXT (NODE) && TYPE_P (DECL_CONTEXT (NODE)))
/* 1 iff NODE is function-local. */
#define DECL_FUNCTION_SCOPE_P(NODE) \
(DECL_CONTEXT (NODE) \
&& TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
-
+
+/* 1 iff NODE is function-local, but for types. */
+#define LOCAL_CLASS_P(NODE) \
+ (decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE)
+
/* For a NAMESPACE_DECL: the list of using namespace directives
The PURPOSE is the used namespace, the value is the namespace
that is the common ancestor. */
-#define DECL_NAMESPACE_USING(NODE) DECL_VINDEX(NODE)
+#define DECL_NAMESPACE_USING(NODE) DECL_VINDEX (NAMESPACE_DECL_CHECK (NODE))
/* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users
of a namespace, to record the transitive closure of using namespace. */
-#define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NODE)
+#define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NAMESPACE_DECL_CHECK (NODE))
/* In a NAMESPACE_DECL, points to the original namespace if this is
a namespace alias. */
-#define DECL_NAMESPACE_ALIAS(NODE) DECL_ABSTRACT_ORIGIN (NODE)
+#define DECL_NAMESPACE_ALIAS(NODE) \
+ DECL_ABSTRACT_ORIGIN (NAMESPACE_DECL_CHECK (NODE))
#define ORIGINAL_NAMESPACE(NODE) \
(DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE))
+/* Non-zero if NODE is the std namespace. */
+#define DECL_NAMESPACE_STD_P(NODE) \
+ (TREE_CODE (NODE) == NAMESPACE_DECL \
+ && CP_DECL_CONTEXT (NODE) == global_namespace \
+ && DECL_NAME (NODE) == std_identifier)
+
/* In a non-local VAR_DECL with static storage duration, this is the
initialization priority. If this value is zero, the NODE will be
initialized at the DEFAULT_INIT_PRIORITY. */
-#define DECL_INIT_PRIORITY(NODE) (DECL_FIELD_SIZE ((NODE)))
+#define DECL_INIT_PRIORITY(NODE) (VAR_DECL_CHECK (NODE)->decl.u2.i)
-/* In a TREE_LIST concatenating using directives, indicate indirekt
+/* In a TREE_LIST concatenating using directives, indicate indirect
directives */
-#define TREE_INDIRECT_USING(NODE) ((NODE)->common.lang_flag_0)
+#define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->common.lang_flag_0)
/* In a VAR_DECL for a variable declared in a for statement,
this is the shadowed (local) variable. */
-#define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT(NODE)
-
-/* Points back to the decl which caused this lang_decl to be allocated. */
-#define DECL_MAIN_VARIANT(NODE) (DECL_LANG_SPECIFIC(NODE)->main_decl_variant)
-
-/* For a FUNCTION_DECL: if this function was declared inline inside of
- a class declaration, this is where the text for the function is
- squirreled away. */
-#define DECL_PENDING_INLINE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->pending_inline_info)
-
-/* True if on the saved_inlines (see decl2.c) list. */
-#define DECL_SAVED_INLINE(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->decl_flags.saved_inline)
-
-/* For a FUNCTION_DECL: if this function was declared inside a signature
- declaration, this is the corresponding member function pointer that was
- created for it. */
-#define DECL_MEMFUNC_POINTER_TO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.memfunc_pointer_to)
-
-/* For a FIELD_DECL: this points to the signature member function from
- which this signature member function pointer was created. */
-#define DECL_MEMFUNC_POINTING_TO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.memfunc_pointer_to)
-
-/* For a VAR_DECL or FUNCTION_DECL: template-specific information. */
-#define DECL_TEMPLATE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.template_info)
+#define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT_FLD(VAR_DECL_CHECK (NODE))
+
+/* In a FUNCTION_DECL, this is nonzero if this function was defined in
+ the class definition. We have saved away the text of the function,
+ but have not yet processed it. */
+#define DECL_PENDING_INLINE_P(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.pending_inline_p)
+
+/* If DECL_PENDING_INLINE_P holds, this is the saved text of the
+ function. */
+#define DECL_PENDING_INLINE_INFO(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->u.pending_inline_info)
+
+/* For a TYPE_DECL: if this function has many fields, we'll sort them
+ and put them into a TREE_VEC. */
+#define DECL_SORTED_FIELDS(NODE) \
+ (DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))->u.sorted_fields)
+
+/* True if on the deferred_fns (see decl2.c) list. */
+#define DECL_DEFERRED_FN(DECL) \
+ (DECL_LANG_SPECIFIC (DECL)->decl_flags.deferred)
+
+/* For a VAR_DECL, FUNCTION_DECL, TYPE_DECL or TEMPLATE_DECL:
+ template-specific information. */
+#define DECL_TEMPLATE_INFO(NODE) \
+ (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE)) \
+ ->decl_flags.u.template_info)
/* Template information for a RECORD_TYPE or UNION_TYPE. */
-#define CLASSTYPE_TEMPLATE_INFO(NODE) (TYPE_LANG_SPECIFIC(NODE)->template_info)
+#define CLASSTYPE_TEMPLATE_INFO(NODE) \
+ (TYPE_LANG_SPECIFIC (RECORD_OR_UNION_TYPE_CHECK (NODE))->template_info)
/* Template information for an ENUMERAL_TYPE. Although an enumeration may
not be a primary template, it may be declared within the scope of a
primary template and the enumeration constants may depend on
non-type template parameters. */
-#define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (NODE))
+#define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (ENUMERAL_TYPE_CHECK (NODE)))
/* Template information for a template template parameter. */
-#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) (TYPE_BINFO (NODE))
+#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) \
+ (TYPE_LANG_SPECIFIC (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK (NODE)) \
+ ->template_info)
/* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */
#define TYPE_TEMPLATE_INFO(NODE) \
(TREE_CODE (NODE) == ENUMERAL_TYPE \
- ? ENUM_TEMPLATE_INFO (NODE) : \
- (TREE_CODE (NODE) == TEMPLATE_TEMPLATE_PARM \
- ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) \
- : CLASSTYPE_TEMPLATE_INFO (NODE)))
+ ? ENUM_TEMPLATE_INFO (NODE) : \
+ (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \
+ ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) : \
+ (TYPE_LANG_SPECIFIC (NODE) \
+ ? CLASSTYPE_TEMPLATE_INFO (NODE) \
+ : NULL_TREE)))
/* Set the template information for an ENUMERAL_, RECORD_, or
UNION_TYPE to VAL. */
-#define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \
- (TREE_CODE (NODE) == ENUMERAL_TYPE \
- ? (ENUM_TEMPLATE_INFO (NODE) = VAL) \
- : (CLASSTYPE_TEMPLATE_INFO (NODE) = VAL))
+#define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \
+ (TREE_CODE (NODE) == ENUMERAL_TYPE \
+ ? (ENUM_TEMPLATE_INFO (NODE) = (VAL)) \
+ : (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL)))
#define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE))
#define TI_ARGS(NODE) (TREE_VALUE (NODE))
-#define TI_SPEC_INFO(NODE) (TREE_CHAIN (NODE))
#define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
+/* We use TREE_VECs to hold template arguments. If there is only one
+ level of template arguments, then the TREE_VEC contains the
+ arguments directly. If there is more than one level of template
+ arguments, then each entry in the TREE_VEC is itself a TREE_VEC,
+ containing the template arguments for a single level. The first
+ entry in the outer TREE_VEC is the outermost level of template
+ parameters; the last is the innermost.
+
+ It is incorrect to ever form a template argument vector containing
+ only one level of arguments, but which is a TREE_VEC containing as
+ its only entry the TREE_VEC for that level. */
+
+/* Non-zero if the template arguments is actually a vector of vectors,
+ rather than just a vector. */
+#define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \
+ ((NODE) != NULL_TREE \
+ && TREE_CODE (NODE) == TREE_VEC \
+ && TREE_VEC_LENGTH (NODE) > 0 \
+ && TREE_VEC_ELT (NODE, 0) != NULL_TREE \
+ && TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC)
+
+/* The depth of a template argument vector. When called directly by
+ the parser, we use a TREE_LIST rather than a TREE_VEC to represent
+ template arguments. In fact, we may even see NULL_TREE if there
+ are no template arguments. In both of those cases, there is only
+ one level of template arguments. */
+#define TMPL_ARGS_DEPTH(NODE) \
+ (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (NODE) ? TREE_VEC_LENGTH (NODE) : 1)
+
+/* The LEVELth level of the template ARGS. The outermost level of of
+ args is level 1, not level 0. */
+#define TMPL_ARGS_LEVEL(ARGS, LEVEL) \
+ (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS) \
+ ? TREE_VEC_ELT (ARGS, (LEVEL) - 1) : (ARGS))
+
+/* Set the LEVELth level of the template ARGS to VAL. This macro does
+ not work with single-level argument vectors. */
+#define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL) \
+ (TREE_VEC_ELT (ARGS, (LEVEL) - 1) = (VAL))
+
+/* Accesses the IDXth parameter in the LEVELth level of the ARGS. */
+#define TMPL_ARG(ARGS, LEVEL, IDX) \
+ (TREE_VEC_ELT (TMPL_ARGS_LEVEL (ARGS, LEVEL), IDX))
+
+/* Set the IDXth element in the LEVELth level of ARGS to VAL. This
+ macro does not work with single-level argument vectors. */
+#define SET_TMPL_ARG(ARGS, LEVEL, IDX, VAL) \
+ (TREE_VEC_ELT (TREE_VEC_ELT ((ARGS), (LEVEL) - 1), (IDX)) = (VAL))
+
+/* Given a single level of template arguments in NODE, return the
+ number of arguments. */
+#define NUM_TMPL_ARGS(NODE) \
+ ((NODE) == NULL_TREE ? 0 \
+ : (TREE_CODE (NODE) == TREE_VEC \
+ ? TREE_VEC_LENGTH (NODE) : list_length (NODE)))
+
+/* Returns the innermost level of template arguments in ARGS. */
+#define INNERMOST_TEMPLATE_ARGS(NODE) \
+ (get_innermost_template_args ((NODE), 1))
+
+/* The number of levels of template parameters given by NODE. */
+#define TMPL_PARMS_DEPTH(NODE) \
+ ((HOST_WIDE_INT) TREE_INT_CST_LOW (TREE_PURPOSE (NODE)))
+
/* The TEMPLATE_DECL instantiated or specialized by NODE. This
TEMPLATE_DECL will be the immediate parent, not the most general
template. For example, in:
@@ -1471,17 +2290,18 @@ struct lang_decl
template <class T> struct S { template <class U> void f(U); }
the FUNCTION_DECL for S<int>::f<double> will have, as its
- DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'.
+ DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'.
As a special case, for a member friend template of a template
class, this value will not be a TEMPLATE_DECL, but rather a
- LOOKUP_EXPR or IDENTIFIER_NODE indicating the name of the template
- and any explicit template arguments provided. For example, in:
+ LOOKUP_EXPR, IDENTIFIER_NODE or OVERLOAD indicating the name of
+ the template and any explicit template arguments provided. For
+ example, in:
template <class T> struct S { friend void f<int>(int, double); }
the DECL_TI_TEMPLATE will be a LOOKUP_EXPR for `f' and the
- DECL_TI_ARGS will be {int}. */
+ DECL_TI_ARGS will be {int}. */
#define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
/* The template arguments used to obtain this decl from the most
@@ -1492,8 +2312,7 @@ struct lang_decl
#define DECL_TI_ARGS(NODE) TI_ARGS (DECL_TEMPLATE_INFO (NODE))
#define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
#define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
-#define CLASSTYPE_TI_SPEC_INFO(NODE) TI_SPEC_INFO (CLASSTYPE_TEMPLATE_INFO (NODE))
-#define ENUM_TI_TEMPLATE(NODE) \
+#define ENUM_TI_TEMPLATE(NODE) \
TI_TEMPLATE (ENUM_TEMPLATE_INFO (NODE))
#define ENUM_TI_ARGS(NODE) \
TI_ARGS (ENUM_TEMPLATE_INFO (NODE))
@@ -1502,24 +2321,31 @@ struct lang_decl
#define TYPE_TI_TEMPLATE(NODE) \
(TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
-/* Like DECL_TI_ARGS, , but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
+/* Like DECL_TI_ARGS, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
#define TYPE_TI_ARGS(NODE) \
(TI_ARGS (TYPE_TEMPLATE_INFO (NODE)))
-#define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE(NODE)
+#define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE (NODE)
/* Nonzero if the NODE corresponds to the template parameters for a
member template, whose inline definition is being processed after
the class definition is complete. */
#define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
-#define DECL_SAVED_TREE(NODE) DECL_MEMFUNC_POINTER_TO (NODE)
-#define COMPOUND_STMT_NO_SCOPE(NODE) TREE_LANG_FLAG_0 (NODE)
+/* In a FUNCTION_DECL, the saved language-specific per-function data. */
+#define DECL_SAVED_FUNCTION_DATA(NODE) \
+ (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))->u.saved_language_function)
+
#define NEW_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
#define DELETE_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
#define DELETE_EXPR_USE_VEC(NODE) TREE_LANG_FLAG_1 (NODE)
#define LOOKUP_EXPR_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
+/* Nonzero if this AGGR_INIT_EXPR provides for initialization via a
+ constructor call, rather than an ordinary function call. */
+#define AGGR_INIT_VIA_CTOR_P(NODE) \
+ TREE_LANG_FLAG_0 (AGGR_INIT_EXPR_CHECK (NODE))
+
/* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
TEMPLATE_DECL. This macro determines whether or not a given class
type is really a template type, as opposed to an instantiation or
@@ -1533,95 +2359,93 @@ struct lang_decl
this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the
corresponding TYPE_DECL. However, this may also be a
TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'. */
-#define TYPENAME_TYPE_FULLNAME(NODE) TYPE_BINFO (NODE)
+#define TYPENAME_TYPE_FULLNAME(NODE) (TYPE_FIELDS (NODE))
/* Nonzero if NODE is an implicit typename. */
#define IMPLICIT_TYPENAME_P(NODE) \
(TREE_CODE (NODE) == TYPENAME_TYPE && TREE_TYPE (NODE))
+/* Nonzero if NODE is a TYPE_DECL that should not be visible because
+ it is from a dependent base class. */
+#define IMPLICIT_TYPENAME_TYPE_DECL_P(NODE) \
+ (TREE_CODE (NODE) == TYPE_DECL \
+ && DECL_ARTIFICIAL (NODE) \
+ && IMPLICIT_TYPENAME_P (TREE_TYPE (NODE)))
+
/* Nonzero in INTEGER_CST means that this int is negative by dint of
using a twos-complement negated operand. */
-#define TREE_NEGATED_INT(NODE) (TREE_LANG_FLAG_0 (NODE))
+#define TREE_NEGATED_INT(NODE) TREE_LANG_FLAG_0 (INTEGER_CST_CHECK (NODE))
-#if 0 /* UNUSED */
-/* Nonzero in any kind of _EXPR or _REF node means that it is a call
- to a storage allocation routine. If, later, alternate storage
- is found to hold the object, this call can be ignored. */
-#define TREE_CALLS_NEW(NODE) (TREE_LANG_FLAG_1 (NODE))
-#endif
+/* Nonzero in any kind of _TYPE where conversions to base-classes may
+ involve pointer arithmetic. If this is zero, then converting to
+ a base-class never requires changing the value of the pointer. */
+#define TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P(NODE) (TREE_LANG_FLAG_1 (NODE))
-/* Nonzero in any kind of _TYPE that uses multiple inheritance
- or virtual baseclasses. */
-#define TYPE_USES_COMPLEX_INHERITANCE(NODE) (TREE_LANG_FLAG_1 (NODE))
+/* [class.virtual]
-#if 0 /* UNUSED */
-/* Nonzero in IDENTIFIER_NODE means that this name is not the name the user
- gave; it's a DECL_NESTED_TYPENAME. Someone may want to set this on
- mangled function names, too, but it isn't currently. */
-#define TREE_MANGLED(NODE) (FOO)
-#endif
-
-#if 0 /* UNUSED */
-/* Nonzero in IDENTIFIER_NODE means that this name is overloaded, and
- should be looked up in a non-standard way. */
-#define DECL_OVERLOADED(NODE) (FOO)
-#endif
+ A class that declares or inherits a virtual function is called a
+ polymorphic class. */
+#define TYPE_POLYMORPHIC_P(NODE) (TREE_LANG_FLAG_2 (NODE))
-/* Nonzero if this (non-TYPE)_DECL has its virtual attribute set.
- For a FUNCTION_DECL, this is when the function is a virtual function.
- For a VAR_DECL, this is when the variable is a virtual function table.
- For a FIELD_DECL, when the field is the field for the virtual function table.
- For an IDENTIFIER_NODE, nonzero if any function with this name
- has been declared virtual.
-
- For a _TYPE if it uses virtual functions (or is derived from
- one that does). */
-#define TYPE_VIRTUAL_P(NODE) (TREE_LANG_FLAG_2 (NODE))
+/* Nonzero if this class has a virtual function table pointer. */
+#define TYPE_CONTAINS_VPTR_P(NODE) \
+ (TYPE_POLYMORPHIC_P (NODE) \
+ || TYPE_USES_VIRTUAL_BASECLASSES (NODE))
extern int flag_new_for_scope;
/* This flag is true of a local VAR_DECL if it was declared in a for
statement, but we are no longer in the scope of the for. */
-#define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (NODE)
+#define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (VAR_DECL_CHECK (NODE))
/* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
if we already emitted a warning about using it. */
-#define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (NODE)
+#define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE))
+
+/* Nonzero if NODE is a FUNCTION_DECL (for a function with global
+ scope) declared in a local scope. */
+#define DECL_LOCAL_FUNCTION_P(NODE) \
+ DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE))
-/* This _DECL represents a compiler-generated entity. */
-#define SET_DECL_ARTIFICIAL(NODE) (DECL_ARTIFICIAL (NODE) = 1)
+/* Nonzero if NODE is a FUNCTION_DECL for a built-in function, and we have
+ not yet seen a prototype for that function. */
+#define DECL_ANTICIPATED(NODE) \
+ (DECL_LANG_SPECIFIC (DECL_CHECK (NODE))->decl_flags.anticipated_p)
/* Record whether a typedef for type `int' was actually `signed int'. */
-#define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
-
-/* In a FIELD_DECL, nonzero if the decl was originally a bitfield. */
-#define DECL_C_BIT_FIELD(NODE) \
- (DECL_LANG_SPECIFIC (NODE) && DECL_LANG_SPECIFIC (NODE)->decl_flags.bitfield)
-#define SET_DECL_C_BIT_FIELD(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->decl_flags.bitfield = 1)
-
-/* Nonzero if the type T promotes to itself.
- ANSI C states explicitly the list of types that promote;
- in particular, short promotes to int even if they have the same width. */
-#define C_PROMOTING_INTEGER_TYPE_P(t) \
- (TREE_CODE ((t)) == INTEGER_TYPE \
- && (TYPE_MAIN_VARIANT (t) == char_type_node \
- || TYPE_MAIN_VARIANT (t) == signed_char_type_node \
- || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node \
- || TYPE_MAIN_VARIANT (t) == short_integer_type_node \
- || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node))
+#define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
+
+/* Returns non-zero if DECL has external linkage, as specified by the
+ language standard. (This predicate may hold even when the
+ corresponding entity is not actually given external linkage in the
+ object file; see decl_linkage for details.) */
+#define DECL_EXTERNAL_LINKAGE_P(DECL) \
+ (decl_linkage (DECL) == lk_external)
#define INTEGRAL_CODE_P(CODE) \
- (CODE == INTEGER_TYPE || CODE == ENUMERAL_TYPE || CODE == BOOLEAN_TYPE)
-#define ARITHMETIC_TYPE_P(TYPE) (INTEGRAL_TYPE_P (TYPE) || FLOAT_TYPE_P (TYPE))
+ ((CODE) == INTEGER_TYPE || (CODE) == ENUMERAL_TYPE || (CODE) == BOOLEAN_TYPE)
-/* Mark which labels are explicitly declared.
- These may be shadowed, and may be referenced from nested functions. */
-#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
+/* [basic.fundamental]
+
+ Types bool, char, wchar_t, and the signed and unsigned integer types
+ are collectively called integral types.
+
+ Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
+ types as well, which is incorrect in C++. */
+#define CP_INTEGRAL_TYPE_P(TYPE) \
+ (TREE_CODE (TYPE) == BOOLEAN_TYPE \
+ || TREE_CODE (TYPE) == INTEGER_TYPE)
+
+/* [basic.fundamental]
+
+ Integral and floating types are collectively called arithmetic
+ types. */
+#define ARITHMETIC_TYPE_P(TYPE) \
+ (CP_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == REAL_TYPE)
/* Nonzero for _TYPE means that the _TYPE defines
at least one constructor. */
-#define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1(NODE))
+#define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1 (NODE))
/* When appearing in an INDIRECT_REF, it means that the tree structure
underneath is actually a call to a constructor. This is needed
@@ -1637,48 +2461,50 @@ extern int flag_new_for_scope;
When appearing in a FIELD_DECL, it means that this field
has been duly initialized in its constructor. */
-#define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE))
+#define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4 (NODE))
#define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
&& CONSTRUCTOR_ELTS (NODE) == NULL_TREE \
&& ! TREE_HAS_CONSTRUCTOR (NODE))
-#if 0
-/* Indicates that a NON_LVALUE_EXPR came from a C++ reference.
- Used to generate more helpful error message in case somebody
- tries to take its address. */
-#define TREE_REFERENCE_EXPR(NODE) (TREE_LANG_FLAG_3(NODE))
-#endif
-
/* Nonzero for _TYPE means that the _TYPE defines a destructor. */
-#define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2(NODE))
-
-#if 0
-/* Nonzero for _TYPE node means that creating an object of this type
- will involve a call to a constructor. This can apply to objects
- of ARRAY_TYPE if the type of the elements needs a constructor. */
-#define TYPE_NEEDS_CONSTRUCTING(NODE) ... defined in ../tree.h ...
-#endif
+#define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2 (NODE))
/* Nonzero means that an object of this type can not be initialized using
an initializer list. */
#define CLASSTYPE_NON_AGGREGATE(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->type_flags.non_aggregate)
+ (TYPE_LANG_SPECIFIC (NODE)->non_aggregate)
#define TYPE_NON_AGGREGATE_CLASS(NODE) \
(IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
/* Nonzero if there is a user-defined X::op=(x&) for this class. */
-#define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_real_assign_ref)
-#define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_assign_ref)
-#define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_abstract_assign_ref)
-#define TYPE_HAS_COMPLEX_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_init_ref)
+#define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_real_assign_ref)
+#define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_complex_assign_ref)
+#define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_abstract_assign_ref)
+#define TYPE_HAS_COMPLEX_INIT_REF(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_complex_init_ref)
+
+/* Nonzero if TYPE has a trivial destructor. From [class.dtor]:
+
+ A destructor is trivial if it is an implicitly declared
+ destructor and if:
+
+ - all of the direct base classes of its class have trivial
+ destructors,
+
+ - for all of the non-static data members of its class that are
+ of class type (or array thereof), each such class has a
+ trivial destructor. */
+#define TYPE_HAS_TRIVIAL_DESTRUCTOR(NODE) \
+ (!TYPE_HAS_NONTRIVIAL_DESTRUCTOR (NODE))
-/* Nonzero for _TYPE node means that destroying an object of this type
- will involve a call to a destructor. This can apply to objects
- of ARRAY_TYPE is the type of the elements needs a destructor. */
-#define TYPE_NEEDS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_4(NODE))
+/* Nonzero for _TYPE node means that this type does not have a trivial
+ destructor. Therefore, destroying an object of this type will
+ involve a call to a destructor. This can apply to objects of
+ ARRAY_TYPE is the type of the elements needs a destructor. */
+#define TYPE_HAS_NONTRIVIAL_DESTRUCTOR(NODE) \
+ (TYPE_LANG_FLAG_4 (NODE))
-/* Nonzero for class type means that initialization of this type can use
+/* Nonzero for class type means that copy initialization of this type can use
a bitwise copy. */
#define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \
(TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE))
@@ -1702,70 +2528,55 @@ extern int flag_new_for_scope;
#define TYPE_PTRFN_P(NODE) \
(TREE_CODE (NODE) == POINTER_TYPE \
&& TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
+#define TYPE_REFFN_P(NODE) \
+ (TREE_CODE (NODE) == REFERENCE_TYPE \
+ && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
/* Nonzero for _TYPE node means that this type is a pointer to member
function type. */
-#define TYPE_PTRMEMFUNC_P(NODE) \
- (TREE_CODE(NODE) == RECORD_TYPE && TYPE_PTRMEMFUNC_FLAG (NODE))
-#define TYPE_PTRMEMFUNC_FLAG(NODE) \
- (TYPE_LANG_SPECIFIC(NODE)->type_flags.ptrmemfunc_flag)
-
-/* A pointer-to-function member type looks like:
-
- struct {
- short __delta;
- short __index;
- union {
- P __pfn;
- short __delta2;
- } __pfn_or_delta2;
- };
-
- where P is a POINTER_TYPE to a METHOD_TYPE appropriate for the
- pointer to member. The fields are used as follows:
+#define TYPE_PTRMEMFUNC_P(NODE) \
+ (TREE_CODE (NODE) == RECORD_TYPE \
+ && TYPE_LANG_SPECIFIC (NODE) \
+ && TYPE_PTRMEMFUNC_FLAG (NODE))
- If __INDEX is -1, then the function to call is non-virtual, and
- is located at the address given by __PFN.
-
- If __INDEX is zero, then this a NULL pointer-to-member.
-
- Otherwise, the function to call is virtual. Then, __DELTA2 gives
- the offset from an instance of the object to the virtual function
- table, and __INDEX - 1 is the index into the vtable to use to
- find the function.
-
- The value to use for the THIS parameter is the address of the
- object plus __DELTA.
+#define TYPE_PTRMEMFUNC_FLAG(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->ptrmemfunc_flag)
- For example, given:
+/* Indicates when overload resolution may resolve to a pointer to
+ member function. [expr.unary.op]/3 */
+#define PTRMEM_OK_P(NODE) TREE_LANG_FLAG_0 (NODE)
- struct B1 {
- int i;
- };
+/* A pointer-to-function member type looks like:
- struct B2 {
- double d;
- void f();
+ struct {
+ __P __pfn;
+ ptrdiff_t __delta;
};
- struct S : public B1, B2 {};
-
- the pointer-to-member for `&S::f' looks like:
-
- { 4, -1, { &f__2B2 } };
-
- The `4' means that given an `S*' you have to add 4 bytes to get to
- the address of the `B2*'. Then, the -1 indicates that this is a
- non-virtual function. Of course, `&f__2B2' is the name of that
- function.
+ If __pfn is NULL, it is a NULL pointer-to-member-function.
+
+ (Because the vtable is always the first thing in the object, we
+ don't need its offset.) If the function is virtual, then PFN is
+ one plus twice the index into the vtable; otherwise, it is just a
+ pointer to the function.
+
+ Unfortunately, using the lowest bit of PFN doesn't work in
+ architectures that don't impose alignment requirements on function
+ addresses, or that use the lowest bit to tell one ISA from another,
+ for example. For such architectures, we use the lowest bit of
+ DELTA instead of the lowest bit of the PFN, and DELTA will be
+ multiplied by 2. */
+enum ptrmemfunc_vbit_where_t
+{
+ ptrmemfunc_vbit_in_pfn,
+ ptrmemfunc_vbit_in_delta
+};
- (Of course, the exactl values may differ depending on the mangling
- scheme, sizes of types, and such.). */
-
/* Get the POINTER_TYPE to the METHOD_TYPE associated with this
pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
before using this macro. */
-#define TYPE_PTRMEMFUNC_FN_TYPE(NODE) (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (NODE)))))))
+#define TYPE_PTRMEMFUNC_FN_TYPE(NODE) \
+ (TREE_TYPE (TYPE_FIELDS (NODE)))
/* Returns `A' for a type like `int (A::*)(double)' */
#define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
@@ -1773,63 +2584,67 @@ extern int flag_new_for_scope;
/* These are use to manipulate the canonical RECORD_TYPE from the
hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */
-#define TYPE_GET_PTRMEMFUNC_TYPE(NODE) ((tree)TYPE_LANG_SPECIFIC(NODE))
-#define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) (TYPE_LANG_SPECIFIC(NODE) = ((struct lang_type *)(void*)(VALUE)))
-/* These are to get the delta2 and pfn fields from a TYPE_PTRMEMFUNC_P. */
-#define DELTA2_FROM_PTRMEMFUNC(NODE) delta2_from_ptrmemfunc ((NODE))
+#define TYPE_GET_PTRMEMFUNC_TYPE(NODE) \
+ ((tree)TYPE_LANG_SPECIFIC (NODE))
+#define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) \
+ (TYPE_LANG_SPECIFIC (NODE) = ((struct lang_type *)(void*)(VALUE)))
+/* Returns the pfn field from a TYPE_PTRMEMFUNC_P. */
#define PFN_FROM_PTRMEMFUNC(NODE) pfn_from_ptrmemfunc ((NODE))
+/* For a pointer-to-member type of the form `T X::*', this is `X'.
+ For a type like `void (X::*)() const', this type is `X', not `const
+ X'. To get at the `const X' you have to look at the
+ TYPE_PTRMEM_POINTED_TO_TYPE; there, the first parameter will have
+ type `const X*'. */
+#define TYPE_PTRMEM_CLASS_TYPE(NODE) \
+ (TYPE_PTRMEM_P (NODE) \
+ ? TYPE_OFFSET_BASETYPE (TREE_TYPE (NODE)) \
+ : TYPE_PTRMEMFUNC_OBJECT_TYPE (NODE))
+
+/* For a pointer-to-member type of the form `T X::*', this is `T'. */
+#define TYPE_PTRMEM_POINTED_TO_TYPE(NODE) \
+ (TYPE_PTRMEM_P (NODE) \
+ ? TREE_TYPE (TREE_TYPE (NODE)) \
+ : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
+
/* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for
`X'. */
-#define PTRMEM_CST_CLASS(NODE) \
- (TYPE_PTRMEM_P (TREE_TYPE (NODE)) \
- ? TYPE_OFFSET_BASETYPE (TREE_TYPE (TREE_TYPE (NODE))) \
- : TYPE_PTRMEMFUNC_OBJECT_TYPE (TREE_TYPE (NODE)))
+#define PTRMEM_CST_CLASS(NODE) \
+ TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (PTRMEM_CST_CHECK (NODE)))
-/* For a pointer-to-member constant `X::Y' this is the _DECL for
+/* For a pointer-to-member constant `X::Y' this is the _DECL for
`Y'. */
-#define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t) NODE)->member)
+#define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member)
/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
- specified in its declaration. */
-#define DECL_THIS_EXTERN(NODE) (DECL_LANG_FLAG_2(NODE))
+ specified in its declaration. This can also be set for an
+ erroneously declared PARM_DECL. */
+#define DECL_THIS_EXTERN(NODE) \
+ DECL_LANG_FLAG_2 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was
- specified in its declaration. */
-#define DECL_THIS_STATIC(NODE) (DECL_LANG_FLAG_6(NODE))
-
-/* Nonzero in FUNCTION_DECL means it is really an operator.
- Just used to communicate formatting information to dbxout.c. */
-#define DECL_OPERATOR(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.operator_attr)
-
-#define ANON_UNION_P(NODE) (DECL_NAME (NODE) == 0)
-
-/* Nonzero if TYPE is an anonymous union type. We have to use a flag for
- this because "A union for which objects or pointers are declared is not
- an anonymous union" [class.union]. */
-#define ANON_UNION_TYPE_P(NODE) \
- (TYPE_LANG_SPECIFIC (NODE) \
- && TYPE_LANG_SPECIFIC (NODE)->type_flags.anon_union)
-#define SET_ANON_UNION_TYPE_P(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->type_flags.anon_union = 1)
+ specified in its declaration. This can also be set for an
+ erroneously declared PARM_DECL. */
+#define DECL_THIS_STATIC(NODE) \
+ DECL_LANG_FLAG_6 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
+
+/* Nonzero if TYPE is an anonymous union or struct type. We have to use a
+ flag for this because "A union for which objects or pointers are
+ declared is not an anonymous union" [class.union]. */
+#define ANON_AGGR_TYPE_P(NODE) \
+ (CLASS_TYPE_P (NODE) && TYPE_LANG_SPECIFIC (NODE)->anon_aggr)
+#define SET_ANON_AGGR_TYPE_P(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->anon_aggr = 1)
+
+/* Nonzero if TYPE is an anonymous union type. */
+#define ANON_UNION_TYPE_P(NODE) \
+ (TREE_CODE (NODE) == UNION_TYPE && ANON_AGGR_TYPE_P (NODE))
#define UNKNOWN_TYPE LANG_TYPE
/* Define fields and accessors for nodes representing declared names. */
-#if 0
-/* C++: A derived class may be able to directly use the virtual
- function table of a base class. When it does so, it may
- still have a decl node used to access the virtual function
- table (so that variables of this type can initialize their
- virtual function table pointers by name). When such thievery
- is committed, know exactly which base class's virtual function
- table is the one being stolen. This effectively computes the
- transitive closure. */
-#define DECL_VPARENT(NODE) ((NODE)->decl.arguments)
-#endif
-
-#define TYPE_WAS_ANONYMOUS(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.was_anonymous)
+#define TYPE_WAS_ANONYMOUS(NODE) (TYPE_LANG_SPECIFIC (NODE)->was_anonymous)
/* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
@@ -1854,17 +2669,27 @@ extern int flag_new_for_scope;
For example, if a member that would normally be public in a
derived class is made protected, then the derived class and the
protected_access_node will appear in the DECL_ACCESS for the node. */
-#define DECL_ACCESS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.access)
+#define DECL_ACCESS(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.u2.access)
+
+/* Nonzero if the FUNCTION_DECL is a global constructor. */
+#define DECL_GLOBAL_CTOR_P(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_ctor_p)
+
+/* Nonzero if the FUNCTION_DECL is a global destructor. */
+#define DECL_GLOBAL_DTOR_P(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_dtor_p)
-/* C++: all of these are overloaded!
- These apply to PARM_DECLs and VAR_DECLs. */
-#define DECL_REFERENCE_SLOT(NODE) ((tree)(NODE)->decl.arguments)
-#define SET_DECL_REFERENCE_SLOT(NODE,VAL) ((NODE)->decl.arguments=VAL)
+/* If DECL_GLOBAL_CTOR_P or DECL_GLOBAL_DTOR_P holds, this macro
+ returns the initialization priority for the function. Constructors
+ with lower numbers should be run first. Destructors should be run
+ in the reverse order of constructors. */
+#define GLOBAL_INIT_PRIORITY(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.u2.init_priority)
/* Accessor macros for C++ template decl nodes. */
/* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node
- is a INT_CST whose TREE_INT_CST_HIGH indicates the level of the
+ is a INT_CST whose TREE_INT_CST_LOW indicates the level of the
template parameters, with 1 being the outermost set of template
parameters. The TREE_VALUE is a vector, whose elements are the
template parameters at each level. Each element in the vector is a
@@ -1874,13 +2699,13 @@ extern int flag_new_for_scope;
TEMPLATE_PARM_INDEX for the parameter is avilable as the
DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
TYPE_DECL). */
-#define DECL_TEMPLATE_PARMS(NODE) DECL_ARGUMENTS(NODE)
+#define DECL_TEMPLATE_PARMS(NODE) DECL_ARGUMENTS (NODE)
#define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
#define DECL_NTPARMS(NODE) \
TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
/* For function, method, class-data templates. */
-#define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT(NODE)
+#define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT_FLD (NODE)
/* For a static member variable template, the
DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and
implicitly generated instantiations of the variable. There are no
@@ -1906,7 +2731,7 @@ extern int flag_new_for_scope;
<class U> struct S1<T>::S2'.
This list is not used for function templates. */
-#define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX(NODE)
+#define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX (NODE)
/* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists
contains all instantiations and specializations of the function,
including partial instantiations. For a partial instantiation
@@ -1916,7 +2741,7 @@ extern int flag_new_for_scope;
template <class T> struct S {
template <class U> void f(U);
- template <> void f(T);
+ template <> void f(T);
};
the `S<int>::f<int>(int)' function will appear on the
@@ -1937,13 +2762,21 @@ extern int flag_new_for_scope;
for the partial specialization.
This list is not used for static variable templates. */
-#define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE(NODE)
-#define DECL_TEMPLATE_INJECT(NODE) DECL_INITIAL(NODE)
+#define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE (NODE)
/* Nonzero for a DECL which is actually a template parameter. */
-#define DECL_TEMPLATE_PARM_P(NODE) \
- DECL_LANG_FLAG_0 (NODE)
-
+#define DECL_TEMPLATE_PARM_P(NODE) \
+ (DECL_LANG_FLAG_0 (NODE) \
+ && (TREE_CODE (NODE) == CONST_DECL \
+ || TREE_CODE (NODE) == PARM_DECL \
+ || TREE_CODE (NODE) == TYPE_DECL \
+ || TREE_CODE (NODE) == TEMPLATE_DECL))
+
+/* Mark NODE as a template parameter. */
+#define SET_DECL_TEMPLATE_PARM_P(NODE) \
+ (DECL_LANG_FLAG_0 (NODE) = 1)
+
+/* Nonzero if NODE is a template template parameter. */
#define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \
(TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE))
@@ -1961,6 +2794,18 @@ extern int flag_new_for_scope;
#define DECL_DECLARES_TYPE_P(NODE) \
(TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE))
+/* Nonzero if NODE is the typedef implicitly generated for a type when
+ the type is declared. (In C++, `struct S {};' is roughly equivalent
+ to `struct S {}; typedef struct S S;' in C. This macro will hold
+ for the typedef indicated in this example. Note that in C++, there
+ is a second implicit typedef for each class, in the scope of `S'
+ itself, so that you can say `S::S'. This macro does *not* hold for
+ those typedefs. */
+#define DECL_IMPLICIT_TYPEDEF_P(NODE) \
+ (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_2 (NODE))
+#define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \
+ (DECL_LANG_FLAG_2 (NODE) = 1)
+
/* A `primary' template is one that has its own template header. A
member function of a class template is a template, but not primary.
A member template is primary. Friend templates are primary, too. */
@@ -1970,10 +2815,10 @@ extern int flag_new_for_scope;
(TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE)))
/* Returns non-zero if NODE is a primary template. */
-#define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == NODE)
+#define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == (NODE))
#define CLASSTYPE_TEMPLATE_LEVEL(NODE) \
- (TREE_INT_CST_HIGH (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE))))
+ (TREE_INT_CST_LOW (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE))))
/* Indicates whether or not (and how) a template was expanded for this
FUNCTION_DECL or VAR_DECL.
@@ -1981,7 +2826,7 @@ extern int flag_new_for_scope;
1=implicit template instantiation
2=explicit template specialization, e.g. int min<int> (int, int);
3=explicit template instantiation, e.g. template int min<int> (int, int); */
-#define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.use_template)
+#define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.use_template)
#define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
#define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
@@ -1997,16 +2842,16 @@ extern int flag_new_for_scope;
#define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1)
#define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1)
#define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
- (CLASSTYPE_USE_TEMPLATE(NODE) == 1)
+ (CLASSTYPE_USE_TEMPLATE (NODE) == 1)
#define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
- (CLASSTYPE_USE_TEMPLATE(NODE) = 1)
+ (CLASSTYPE_USE_TEMPLATE (NODE) = 1)
#define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3)
#define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3)
#define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
- (CLASSTYPE_USE_TEMPLATE(NODE) == 3)
+ (CLASSTYPE_USE_TEMPLATE (NODE) == 3)
#define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
- (CLASSTYPE_USE_TEMPLATE(NODE) = 3)
+ (CLASSTYPE_USE_TEMPLATE (NODE) = 3)
/* Non-zero if DECL is a friend function which is an instantiation
from the point of view of the compiler, but not from the point of
@@ -2022,7 +2867,7 @@ extern int flag_new_for_scope;
i.e., an instantiation whose instantiation arguments involve
template types. */
#define PARTIAL_INSTANTIATION_P(TYPE) \
- (TYPE_LANG_SPECIFIC (TYPE)->type_flags.is_partial_instantiation)
+ (TYPE_LANG_SPECIFIC (TYPE)->is_partial_instantiation)
/* Non-zero iff we are currently processing a declaration for an
entity with its own template parameter list, and which is not a
@@ -2036,7 +2881,8 @@ extern int flag_new_for_scope;
/* Nonzero if this VAR_DECL or FUNCTION_DECL has already been
instantiated, i.e. its definition has been generated from the
pattern given in the the template. */
-#define DECL_TEMPLATE_INSTANTIATED(NODE) DECL_LANG_FLAG_1(NODE)
+#define DECL_TEMPLATE_INSTANTIATED(NODE) \
+ DECL_LANG_FLAG_1 (VAR_OR_FUNCTION_DECL_CHECK (NODE))
/* We know what we're doing with this decl now. */
#define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
@@ -2044,8 +2890,8 @@ extern int flag_new_for_scope;
/* This function was declared inline. This flag controls the linkage
semantics of 'inline'; whether or not the function is inlined is
controlled by DECL_INLINE. */
-#define DECL_THIS_INLINE(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->decl_flags.declared_inline)
+#define DECL_DECLARED_INLINE_P(NODE) \
+ (DECL_LANG_SPECIFIC (NODE)->decl_flags.base.declared_inline)
/* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
so that assemble_external will work properly. So we have this flag to
@@ -2056,67 +2902,198 @@ extern int flag_new_for_scope;
#define DECL_REALLY_EXTERN(NODE) \
(DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE))
-#define THUNK_DELTA(DECL) ((DECL)->decl.frame_size.i)
+/* A thunk is a stub function.
+
+ A thunk is an alternate entry point for an ordinary FUNCTION_DECL.
+ The address of the ordinary FUNCTION_DECL is given by the
+ DECL_INITIAL, which is always an ADDR_EXPR whose operand is a
+ FUNCTION_DECL. The job of the thunk is to adjust the `this'
+ pointer before transferring control to the FUNCTION_DECL.
+
+ A thunk may perform either, or both, of the following operations:
+
+ o Adjust the `this' pointer by a constant offset.
+ o Adjust the `this' pointer by looking up a vcall-offset
+ in the vtable.
+
+ If both operations are performed, then the constant adjument to
+ `this' is performed first.
-/* ...and for unexpanded-parameterized-type nodes. */
-#define UPT_TEMPLATE(NODE) TREE_PURPOSE(TYPE_VALUES(NODE))
-#define UPT_PARMS(NODE) TREE_VALUE(TYPE_VALUES(NODE))
+ The constant adjustment is given by THUNK_DELTA. If the
+ vcall-offset is required, the index into the vtable is given by
+ THUNK_VCALL_OFFSET. */
-/* An un-parsed default argument looks like an identifier. */
-#define DEFARG_NODE_CHECK(t) TREE_CHECK(t, DEFAULT_ARG)
-#define DEFARG_LENGTH(NODE) (DEFARG_NODE_CHECK(NODE)->identifier.length)
-#define DEFARG_POINTER(NODE) (DEFARG_NODE_CHECK(NODE)->identifier.pointer)
+/* An integer indicating how many bytes should be subtracted from the
+ `this' pointer when this function is called. */
+#define THUNK_DELTA(DECL) (DECL_CHECK (DECL)->decl.u1.i)
-#define builtin_function(NAME, TYPE, CODE, LIBNAME) \
- define_function (NAME, TYPE, CODE, (void (*) PROTO((tree)))pushdecl, LIBNAME)
+/* A tree indicating how many bytes should be subtracted from the
+ vtable for the `this' pointer to find the vcall offset. (The vptr
+ is always located at offset zero from the f `this' pointer.) If
+ NULL, then there is no vcall offset. */
+#define THUNK_VCALL_OFFSET(DECL) \
+ (DECL_LANG_SPECIFIC (DECL)->decl_flags.u2.vcall_offset)
/* These macros provide convenient access to the various _STMT nodes
created when parsing template declarations. */
-#define IF_COND(NODE) TREE_OPERAND (NODE, 0)
-#define THEN_CLAUSE(NODE) TREE_OPERAND (NODE, 1)
-#define ELSE_CLAUSE(NODE) TREE_OPERAND (NODE, 2)
-#define WHILE_COND(NODE) TREE_OPERAND (NODE, 0)
-#define WHILE_BODY(NODE) TREE_OPERAND (NODE, 1)
-#define DO_COND(NODE) TREE_OPERAND (NODE, 0)
-#define DO_BODY(NODE) TREE_OPERAND (NODE, 1)
-#define RETURN_EXPR(NODE) TREE_OPERAND (NODE, 0)
-#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (NODE, 0)
-#define FOR_INIT_STMT(NODE) TREE_OPERAND (NODE, 0)
-#define FOR_COND(NODE) TREE_OPERAND (NODE, 1)
-#define FOR_EXPR(NODE) TREE_OPERAND (NODE, 2)
-#define FOR_BODY(NODE) TREE_OPERAND (NODE, 3)
-#define SWITCH_COND(NODE) TREE_OPERAND (NODE, 0)
-#define SWITCH_BODY(NODE) TREE_OPERAND (NODE, 1)
-#define CASE_LOW(NODE) TREE_OPERAND (NODE, 0)
-#define CASE_HIGH(NODE) TREE_OPERAND (NODE, 1)
-#define GOTO_DESTINATION(NODE) TREE_OPERAND (NODE, 0)
-#define TRY_STMTS(NODE) TREE_OPERAND (NODE, 0)
-#define TRY_HANDLERS(NODE) TREE_OPERAND (NODE, 1)
-#define HANDLER_PARMS(NODE) TREE_OPERAND (NODE, 0)
-#define HANDLER_BODY(NODE) TREE_OPERAND (NODE, 1)
-#define COMPOUND_BODY(NODE) TREE_OPERAND (NODE, 0)
-#define ASM_CV_QUAL(NODE) TREE_OPERAND (NODE, 0)
-#define ASM_STRING(NODE) TREE_OPERAND (NODE, 1)
-#define ASM_OUTPUTS(NODE) TREE_OPERAND (NODE, 2)
-#define ASM_INPUTS(NODE) TREE_OPERAND (NODE, 3)
-#define ASM_CLOBBERS(NODE) TREE_OPERAND (NODE, 4)
+#define TRY_STMTS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0)
+#define TRY_HANDLERS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 1)
-/* An enumeration of the kind of tags that C++ accepts. */
-enum tag_types { record_type, class_type, union_type, enum_type,
- signature_type };
+#define EH_SPEC_STMTS(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 0)
+#define EH_SPEC_RAISES(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 1)
+
+#define USING_STMT_NAMESPACE(NODE) TREE_OPERAND (USING_STMT_CHECK (NODE), 0)
+
+/* Nonzero if this try block is a function try block. */
+#define FN_TRY_BLOCK_P(NODE) TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE))
+#define HANDLER_PARMS(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 0)
+#define HANDLER_BODY(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 1)
+#define HANDLER_TYPE(NODE) TREE_TYPE (HANDLER_CHECK (NODE))
+#define SUBOBJECT_CLEANUP(NODE) TREE_OPERAND (SUBOBJECT_CHECK (NODE), 0)
+
+/* Nonzero if this CTOR_STMT is for the beginning of a constructor. */
+#define CTOR_BEGIN_P(NODE) \
+ (TREE_LANG_FLAG_0 (CTOR_STMT_CHECK (NODE)))
+
+/* Nonzero if this CTOR_STMT is for the end of a constructor. */
+#define CTOR_END_P(NODE) \
+ (!CTOR_BEGIN_P (NODE))
+
+/* The parameters for a call-declarator. */
+#define CALL_DECLARATOR_PARMS(NODE) \
+ (TREE_PURPOSE (TREE_OPERAND (NODE, 1)))
-/* Zero means prototype weakly, as in ANSI C (no args means nothing).
- Each language context defines how this variable should be set. */
-extern int strict_prototype;
-extern int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus;
+/* The cv-qualifiers for a call-declarator. */
+#define CALL_DECLARATOR_QUALS(NODE) \
+ (TREE_VALUE (TREE_OPERAND (NODE, 1)))
-/* Non-zero means that if a label exists, and no other identifier
- applies, use the value of the label. */
-extern int flag_labels_ok;
+/* The exception-specification for a call-declarator. */
+#define CALL_DECLARATOR_EXCEPTION_SPEC(NODE) \
+ (TREE_TYPE (NODE))
-/* Non-zero means to collect statistics which might be expensive
- and to print them when we are done. */
-extern int flag_detailed_statistics;
+/* An enumeration of the kind of tags that C++ accepts. */
+enum tag_types { record_type, class_type, union_type, enum_type };
+
+/* The various kinds of lvalues we distinguish. */
+typedef enum cp_lvalue_kind {
+ clk_none = 0, /* Things that are not an lvalue. */
+ clk_ordinary = 1, /* An ordinary lvalue. */
+ clk_class = 2, /* An rvalue of class-type. */
+ clk_bitfield = 4, /* An lvalue for a bit-field. */
+} cp_lvalue_kind;
+
+/* The kinds of scopes we recognize. */
+typedef enum scope_kind {
+ sk_template_parms, /* A scope for template parameters. */
+ sk_template_spec /* A scope corresponding to a template
+ specialization. There is never anything in
+ this scope. */
+} scope_kind;
+
+/* Various kinds of template specialization, instantiation, etc. */
+typedef enum tmpl_spec_kind {
+ tsk_none, /* Not a template at all. */
+ tsk_invalid_member_spec, /* An explicit member template
+ specialization, but the enclosing
+ classes have not all been explicitly
+ specialized. */
+ tsk_invalid_expl_inst, /* An explicit instantiation containing
+ template parameter lists. */
+ tsk_excessive_parms, /* A template declaration with too many
+ template parameter lists. */
+ tsk_insufficient_parms, /* A template declaration with too few
+ parameter lists. */
+ tsk_template, /* A template declaration. */
+ tsk_expl_spec, /* An explicit specialization. */
+ tsk_expl_inst /* An explicit instantiation. */
+} tmpl_spec_kind;
+
+/* The various kinds of access. BINFO_ACCESS depends on these being
+ two bit quantities. The numerical values are important; they are
+ used to initialize RTTI data structures, so changing them changes
+ the ABI. */
+typedef enum access_kind {
+ ak_none = 0, /* Inaccessible. */
+ ak_public = 1, /* Accessible, as a `public' thing. */
+ ak_protected = 2, /* Accessible, as a `protected' thing. */
+ ak_private = 3 /* Accessible, as a `private' thing. */
+} access_kind;
+
+/* The various kinds of special functions. If you add to this list,
+ you should update special_function_p as well. */
+typedef enum special_function_kind {
+ sfk_none = 0, /* Not a special function. This enumeral
+ must have value zero; see
+ special_function_p. */
+ sfk_constructor, /* A constructor. */
+ sfk_copy_constructor, /* A copy constructor. */
+ sfk_assignment_operator, /* An assignment operator. */
+ sfk_destructor, /* A destructor. */
+ sfk_complete_destructor, /* A destructor for complete objects. */
+ sfk_base_destructor, /* A destructor for base subobjects. */
+ sfk_deleting_destructor, /* A destructor for complete objects that
+ deletes the object after it has been
+ destroyed. */
+ sfk_conversion /* A conversion operator. */
+} special_function_kind;
+
+/* The various kinds of linkage. From [basic.link],
+
+ A name is said to have linkage when it might denote the same
+ object, reference, function, type, template, namespace or value
+ as a name introduced in another scope:
+
+ -- When a name has external linkage, the entity it denotes can
+ be referred to from scopes of other translation units or from
+ other scopes of the same translation unit.
+
+ -- When a name has internal linkage, the entity it denotes can
+ be referred to by names from other scopes in the same
+ translation unit.
+
+ -- When a name has no linkage, the entity it denotes cannot be
+ referred to by names from other scopes. */
+
+typedef enum linkage_kind {
+ lk_none, /* No linkage. */
+ lk_internal, /* Internal linkage. */
+ lk_external /* External linkage. */
+} linkage_kind;
+
+/* Bitmask flags to pass to instantiate_type. */
+typedef enum instantiate_type_flags {
+ itf_none = 0, /* nothing special */
+ itf_complain = 1 << 0, /* complain about errors */
+ itf_no_attributes = 1 << 1, /* ignore attributes on comparisons */
+ itf_ptrmem_ok = 1 << 2, /* pointers to member ok (internal use) */
+} instantiate_type_flags;
+
+/* The kind of checking we can do looking in a class hierarchy. */
+typedef enum base_access {
+ ba_any = 0, /* Do not check access, allow an ambiguous base,
+ prefer a non-virtual base */
+ ba_ignore = 1, /* Do not check access */
+ ba_check = 2, /* Check access */
+ ba_not_special = 3, /* Do not consider special privilege
+ current_class_type might give. */
+ ba_quiet = 4, /* Do not issue error messages (bit mask). */
+} base_access;
+
+/* The kind of base we can find, looking in a class hierarchy.
+ Values <0 indicate we failed. */
+typedef enum base_kind {
+ bk_inaccessible = -3, /* The base is inaccessible */
+ bk_ambig = -2, /* The base is ambiguous */
+ bk_not_base = -1, /* It is not a base */
+ bk_same_type = 0, /* It is the same type */
+ bk_proper_base = 1, /* It is a proper base */
+ bk_via_virtual = 2 /* It is a proper base, but via a virtual
+ path. This might not be the canonical
+ binfo. */
+} base_kind;
+
+/* Nonzero means allow Microsoft extensions without a pedwarn. */
+extern int flag_ms_extensions;
/* Non-zero means warn in function declared in derived class has the
same name as a virtual in the base class, but fails to match the
@@ -2126,183 +3103,69 @@ extern int warn_overloaded_virtual;
/* Nonzero means warn about use of multicharacter literals. */
extern int warn_multichar;
+/* Set by add_implicitly_declared_members() to keep those members from
+ being flagged as deprecated or reported as using deprecated
+ types. */
+extern int adding_implicit_members;
+
/* Non-zero means warn if a non-templatized friend function is
declared in a templatized class. This behavior is warned about with
flag_guiding_decls in do_friend. */
extern int warn_nontemplate_friend;
-/* in c-common.c */
-extern void declare_function_name PROTO((void));
-extern void decl_attributes PROTO((tree, tree, tree));
-extern void init_function_format_info PROTO((void));
-extern void record_function_format PROTO((tree, tree, int, int, int));
-extern void check_function_format PROTO((tree, tree, tree));
-/* Print an error message for invalid operands to arith operation CODE.
- NOP_EXPR is used as a special case (see truthvalue_conversion). */
-extern void binary_op_error PROTO((enum tree_code));
-extern tree cp_build_qualified_type PROTO((tree, int));
-extern tree canonical_type_variant PROTO((tree));
-extern void c_expand_expr_stmt PROTO((tree));
-/* Validate the expression after `case' and apply default promotions. */
-extern tree check_case_value PROTO((tree));
-/* Concatenate a list of STRING_CST nodes into one STRING_CST. */
-extern tree combine_strings PROTO((tree));
-extern void constant_expression_warning PROTO((tree));
-extern tree convert_and_check PROTO((tree, tree));
-extern void overflow_warning PROTO((tree));
-extern void unsigned_conversion_warning PROTO((tree, tree));
-extern void c_apply_type_quals_to_decl PROTO((int, tree));
-
-/* Read the rest of the current #-directive line. */
-#if USE_CPPLIB
-extern char *get_directive_line PROTO((void));
-#define GET_DIRECTIVE_LINE() get_directive_line ()
-#else
-extern char *get_directive_line PROTO((FILE *));
-#define GET_DIRECTIVE_LINE() get_directive_line (finput)
-#endif
-/* Subroutine of build_binary_op, used for comparison operations.
- See if the operands have both been converted from subword integer types
- and, if so, perhaps change them both back to their original type. */
-extern tree shorten_compare PROTO((tree *, tree *, tree *, enum tree_code *));
-/* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
- or validate its data type for an `if' or `while' statement or ?..: exp. */
-extern tree truthvalue_conversion PROTO((tree));
-extern tree type_for_mode PROTO((enum machine_mode, int));
-extern tree type_for_size PROTO((unsigned, int));
-extern int c_get_alias_set PROTO((tree));
-
/* in decl{2}.c */
-extern tree void_list_node;
-extern tree void_zero_node;
-extern tree default_function_type;
-extern tree vtable_entry_type;
-extern tree sigtable_entry_type;
-extern tree __t_desc_type_node;
-#if 0
-extern tree __tp_desc_type_node;
-#endif
-extern tree __access_mode_type_node;
-extern tree __bltn_desc_type_node, __user_desc_type_node;
-extern tree __class_desc_type_node, __attr_desc_type_node;
-extern tree __ptr_desc_type_node, __func_desc_type_node;
-extern tree __ptmf_desc_type_node, __ptmd_desc_type_node;
-extern tree type_info_type_node;
-extern tree class_star_type_node;
-extern tree this_identifier;
-extern tree ctor_identifier, dtor_identifier;
-extern tree pfn_identifier;
-extern tree index_identifier;
-extern tree delta_identifier;
-extern tree delta2_identifier;
-extern tree pfn_or_delta2_identifier;
-extern tree tag_identifier;
-extern tree vt_off_identifier;
-extern tree in_charge_identifier;
-
/* A node that is a list (length 1) of error_mark_nodes. */
extern tree error_mark_list;
-extern tree ptr_type_node;
-extern tree class_type_node, record_type_node, union_type_node, enum_type_node;
-extern tree unknown_type_node;
-extern tree opaque_type_node, signature_type_node;
-
-extern tree vlist_identifier, vlist_type_node, vlist_zero_node;
-
/* Node for "pointer to (virtual) function".
This may be distinct from ptr_type_node so gdb can distinguish them. */
-#define vfunc_ptr_type_node \
- (flag_vtable_thunks ? vtable_entry_type : ptr_type_node)
+#define vfunc_ptr_type_node vtable_entry_type
-/* The type of a vtbl, i.e., an array of vtable entries. */
-extern tree vtbl_type_node;
-/* The type of a class vtbl pointer, i.e., a pointer to a vtable entry. */
-extern tree vtbl_ptr_type_node;
-extern tree delta_type_node;
-extern tree std_node;
-extern tree long_long_integer_type_node, long_long_unsigned_type_node;
/* For building calls to `delete'. */
extern tree integer_two_node, integer_three_node;
-extern tree boolean_type_node, boolean_true_node, boolean_false_node;
-
-extern tree null_node;
extern tree anonymous_namespace_name;
-/* The FUNCTION_DECL for the default `::operator delete'. */
-
-extern tree global_delete_fndecl;
+/* The number of function bodies which we are currently processing.
+ (Zero if we are at namespace scope, one inside the body of a
+ function, two inside the body of a function in a local class, etc.) */
+extern int function_depth;
/* in pt.c */
-/* These values are used for the `STRICT' parameter to type_unfication and
+/* These values are used for the `STRICT' parameter to type_unification and
fn_type_unification. Their meanings are described with the
documentation for fn_type_unification. */
typedef enum unification_kind_t {
DEDUCE_CALL,
DEDUCE_CONV,
- DEDUCE_EXACT
+ DEDUCE_EXACT,
+ DEDUCE_ORDER
} unification_kind_t;
-extern tree current_template_parms;
-extern HOST_WIDE_INT processing_template_decl;
-extern tree last_tree;
-
-/* The template currently being instantiated, and where the instantiation
- was triggered. */
-struct tinst_level
-{
- tree decl;
- int line;
- char *file;
- struct tinst_level *next;
-};
+/* Macros for operating on a template instantiation level node, represented
+ by an EXPR_WITH_FILE_LOCATION. */
-extern int minimal_parse_mode;
-
-extern void maybe_print_template_context PROTO ((void));
+#define TINST_DECL(NODE) EXPR_WFL_NODE (NODE)
+#define TINST_LINE(NODE) EXPR_WFL_LINENO (NODE)
+#define TINST_FILE(NODE) EXPR_WFL_FILENAME (NODE)
/* in class.c */
-/* When parsing a class definition, the access specifier most recently
- given by the user, or, if no access specifier was given, the
- default value appropriate for the kind of class (i.e., struct,
- class, or union). */
-extern tree current_access_specifier;
-
-extern tree current_class_name;
-extern tree current_class_type;
-extern tree current_class_ptr;
-extern tree previous_class_type;
-extern tree current_class_ref;
extern int current_class_depth;
-extern tree current_lang_name;
-extern tree lang_name_cplusplus, lang_name_c, lang_name_java;
-
-/* The low-water mark on the class-cache obstack. */
-extern char *class_cache_firstobj;
-
/* Points to the name of that function. May not be the DECL_NAME
of CURRENT_FUNCTION_DECL due to overloading */
extern tree original_function_name;
-/* in init.c */
-extern tree global_base_init_list;
-extern tree current_base_init_list, current_member_init_list;
-
-extern int current_function_just_assigned_this;
-extern int current_function_parms_stored;
+/* An array of all local classes present in this translation unit, in
+ declaration order. */
+extern varray_type local_classes;
/* Here's where we control how name mangling takes place. */
-#define OPERATOR_ASSIGN_FORMAT "__a%s"
-#define OPERATOR_FORMAT "__%s"
-#define OPERATOR_TYPENAME_FORMAT "__op"
-
/* Cannot use '$' up front, because this confuses gdb
(names beginning with '$' are gdb-local identifiers).
@@ -2319,19 +3182,14 @@ extern int current_function_parms_stored;
#define VPTR_NAME "$v"
#define THROW_NAME "$eh_throw"
-#define DESTRUCTOR_DECL_PREFIX "_$_"
#define AUTO_VTABLE_NAME "__vtbl$me__"
#define AUTO_TEMP_NAME "_$tmp_"
#define AUTO_TEMP_FORMAT "_$tmp_%d"
#define VTABLE_BASE "$vb"
-#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt$%s")
-#define VCTABLE_NAME "__vc$"
-#define VLIST_NAME_FORMAT "__vl$%s"
+#define VTABLE_NAME_PREFIX "__vt_"
#define VFIELD_BASE "$vf"
#define VFIELD_NAME "_vptr$"
#define VFIELD_NAME_FORMAT "_vptr$%s"
-#define VBASE_NAME "_vb$"
-#define VBASE_NAME_FORMAT "_vb$%s"
#define STATIC_NAME_FORMAT "_%s$%s"
#define ANON_AGGRNAME_FORMAT "$_%d"
@@ -2343,19 +3201,14 @@ extern int current_function_parms_stored;
#define VPTR_NAME ".v"
#define THROW_NAME ".eh_throw"
-#define DESTRUCTOR_DECL_PREFIX "_._"
#define AUTO_VTABLE_NAME "__vtbl.me__"
#define AUTO_TEMP_NAME "_.tmp_"
#define AUTO_TEMP_FORMAT "_.tmp_%d"
#define VTABLE_BASE ".vb"
-#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt.%s")
-#define VCTABLE_NAME "__vc."
-#define VLIST_NAME_FORMAT "__vl.%s"
+#define VTABLE_NAME_PREFIX "__vt_"
#define VFIELD_BASE ".vf"
#define VFIELD_NAME "_vptr."
#define VFIELD_NAME_FORMAT "_vptr.%s"
-#define VBASE_NAME "_vb."
-#define VBASE_NAME_FORMAT "_vb.%s"
#define STATIC_NAME_FORMAT "_%s.%s"
#define ANON_AGGRNAME_FORMAT "._%d"
@@ -2366,10 +3219,6 @@ extern int current_function_parms_stored;
#define VPTR_NAME_P(ID_NODE) \
(!strncmp (IDENTIFIER_POINTER (ID_NODE), VPTR_NAME, sizeof (VPTR_NAME) - 1))
#define THROW_NAME "__eh_throw"
-#define DESTRUCTOR_DECL_PREFIX "__destr_"
-#define DESTRUCTOR_NAME_P(ID_NODE) \
- (!strncmp (IDENTIFIER_POINTER (ID_NODE), DESTRUCTOR_DECL_PREFIX, \
- sizeof (DESTRUCTOR_DECL_PREFIX) - 1))
#define IN_CHARGE_NAME "__in_chrg"
#define AUTO_VTABLE_NAME "__vtbl_me__"
#define AUTO_TEMP_NAME "__tmp_"
@@ -2379,23 +3228,16 @@ extern int current_function_parms_stored;
#define AUTO_TEMP_FORMAT "__tmp_%d"
#define VTABLE_BASE "__vtb"
#define VTABLE_NAME "__vt_"
-#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt_%s")
+#define VTABLE_NAME_PREFIX "__vt_"
#define VTABLE_NAME_P(ID_NODE) \
(!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
sizeof (VTABLE_NAME) - 1))
-#define VCTABLE_NAME "__vc_"
-#define VLIST_NAME_FORMAT "__vl_%s"
#define VFIELD_BASE "__vfb"
#define VFIELD_NAME "__vptr_"
#define VFIELD_NAME_P(ID_NODE) \
(!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \
sizeof (VFIELD_NAME) - 1))
-#define VFIELD_NAME_FORMAT "_vptr_%s"
-#define VBASE_NAME "__vb_"
-#define VBASE_NAME_P(ID_NODE) \
- (!strncmp (IDENTIFIER_POINTER (ID_NODE), VBASE_NAME, \
- sizeof (VBASE_NAME) - 1))
-#define VBASE_NAME_FORMAT "__vb_%s"
+#define VFIELD_NAME_FORMAT "__vptr_%s"
#define STATIC_NAME_FORMAT "__static_%s_%s"
#define ANON_AGGRNAME_PREFIX "__anon_"
@@ -2403,144 +3245,54 @@ extern int current_function_parms_stored;
(!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \
sizeof (ANON_AGGRNAME_PREFIX) - 1))
#define ANON_AGGRNAME_FORMAT "__anon_%d"
-#define ANON_PARMNAME_FORMAT "__%d"
-#define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
- && IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
- && IDENTIFIER_POINTER (ID_NODE)[2] <= '9')
#endif /* NO_DOT_IN_LABEL */
#endif /* NO_DOLLAR_IN_LABEL */
#define THIS_NAME "this"
-#define DESTRUCTOR_NAME_FORMAT "~%s"
#define FILE_FUNCTION_PREFIX_LEN 9
#define CTOR_NAME "__ct"
#define DTOR_NAME "__dt"
#define IN_CHARGE_NAME "__in_chrg"
-#define VLIST_NAME "__vlist"
-#define VLIST1_NAME "__vlist1"
-#define VLIST_TYPE_NAME "6_Vlist"
#define VTBL_PTR_TYPE "__vtbl_ptr_type"
#define VTABLE_DELTA_NAME "__delta"
-#define VTABLE_INDEX_NAME "__index"
#define VTABLE_PFN_NAME "__pfn"
-#define VTABLE_DELTA2_NAME "__delta2"
-
-#define SIGNATURE_FIELD_NAME "__s_"
-#define SIGNATURE_FIELD_NAME_FORMAT "__s_%s"
-#define SIGNATURE_OPTR_NAME "__optr"
-#define SIGNATURE_SPTR_NAME "__sptr"
-#define SIGNATURE_POINTER_NAME "__sp_"
-#define SIGNATURE_POINTER_NAME_FORMAT "__%s%s%ssp_%s"
-#define SIGNATURE_REFERENCE_NAME "__sr_"
-#define SIGNATURE_REFERENCE_NAME_FORMAT "__%s%s%ssr_%s"
-
-#define SIGTABLE_PTR_TYPE "__sigtbl_ptr_type"
-#define SIGTABLE_NAME_FORMAT "__st_%s_%s"
-#define SIGTABLE_NAME_FORMAT_LONG "__st_%s_%s_%d"
-#define SIGTABLE_TAG_NAME "__tag"
-#define SIGTABLE_VB_OFF_NAME "__vb_off"
-#define SIGTABLE_VT_OFF_NAME "__vt_off"
-#define EXCEPTION_CLEANUP_NAME "exception cleanup"
-
-#define THIS_NAME_P(ID_NODE) (strcmp(IDENTIFIER_POINTER (ID_NODE), "this") == 0)
+
+#define EXCEPTION_CLEANUP_NAME "exception cleanup"
#if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
#define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
&& IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
-#define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == JOINER \
- && IDENTIFIER_POINTER (ID_NODE)[2] == '_')
#define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
&& IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
&& IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
-#define VBASE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
- && IDENTIFIER_POINTER (ID_NODE)[2] == 'b' \
- && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
-
-#define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
-#define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
+#define TEMP_NAME_P(ID_NODE) \
+ (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
+#define VFIELD_NAME_P(ID_NODE) \
+ (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
/* For anonymous aggregate types, we need some sort of name to
hold on to. In practice, this should not appear, but it should
not be harmful if it does. */
#define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
&& IDENTIFIER_POINTER (ID_NODE)[1] == '_')
-#define ANON_PARMNAME_FORMAT "_%d"
-#define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
- && IDENTIFIER_POINTER (ID_NODE)[1] <= '9')
#endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
-/* Store the vbase pointer field name for type TYPE into pointer BUF. */
-#define FORMAT_VBASE_NAME(BUF,TYPE) do { \
- char *wbuf = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (TYPE) \
- + sizeof (VBASE_NAME) + 1); \
- sprintf (wbuf, VBASE_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (TYPE)); \
- (BUF) = wbuf; \
-} while (0)
-
-/* Returns non-zero iff ID_NODE is an IDENTIFIER_NODE whose name is
- `main'. */
-#define MAIN_NAME_P(ID_NODE) \
- (strcmp (IDENTIFIER_POINTER (ID_NODE), "main") == 0)
-
/* Returns non-zero iff NODE is a declaration for the global function
`main'. */
#define DECL_MAIN_P(NODE) \
- (TREE_CODE (NODE) == FUNCTION_DECL \
- && DECL_LANGUAGE (NODE) == lang_c \
+ (DECL_EXTERN_C_FUNCTION_P (NODE) \
&& DECL_NAME (NODE) != NULL_TREE \
&& MAIN_NAME_P (DECL_NAME (NODE)))
-/* Define the sets of attributes that member functions and baseclasses
- can have. These are sensible combinations of {public,private,protected}
- cross {virtual,non-virtual}. */
-
-/* in class.c. */
-extern tree access_default_node; /* 0 */
-extern tree access_public_node; /* 1 */
-extern tree access_protected_node; /* 2 */
-extern tree access_private_node; /* 3 */
-extern tree access_default_virtual_node; /* 4 */
-extern tree access_public_virtual_node; /* 5 */
-extern tree access_protected_virtual_node; /* 6 */
-extern tree access_private_virtual_node; /* 7 */
-
/* Things for handling inline functions. */
-struct pending_inline
-{
- struct pending_inline *next; /* pointer to next in chain */
- int lineno; /* line number we got the text from */
- char *filename; /* name of file we were processing */
- tree fndecl; /* FUNCTION_DECL that brought us here */
- int token; /* token we were scanning */
- int token_value; /* value of token we were scanning (YYSTYPE) */
-
- char *buf; /* pointer to character stream */
- int len; /* length of stream */
- unsigned int can_free : 1; /* free this after we're done with it? */
- unsigned int deja_vu : 1; /* set iff we don't want to see it again. */
- unsigned int interface : 2; /* 0=interface 1=unknown 2=implementation */
-};
-
-/* in method.c */
-extern struct pending_inline *pending_inlines;
-
-/* Positive values means that we cannot make optimizing assumptions about
- `this'. Negative values means we know `this' to be of static type. */
-
-extern int flag_this_is_variable;
-
-/* Nonzero means generate 'rtti' that give run-time type information. */
-
-extern int flag_rtti;
-
/* Nonzero means do emit exported implementations of functions even if
they can be inlined. */
@@ -2564,27 +3316,21 @@ extern int flag_implicit_templates;
extern int flag_weak;
-/* Nonzero to enable experimental ABI changes. */
-
-extern int flag_new_abi;
-
-/* Nonzero to not ignore namespace std. */
-
-extern int flag_honor_std;
-
/* Nonzero if we're done parsing and into end-of-file activities. */
extern int at_eof;
-enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
+/* Functions called along with real static constructors and destructors. */
-/* The following two can be derived from the previous one */
-extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */
+extern tree static_ctors;
+extern tree static_dtors;
+
+enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
/* Some macros for char-based bitfields. */
-#define B_SET(a,x) (a[x>>3] |= (1 << (x&7)))
-#define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7)))
-#define B_TST(a,x) (a[x>>3] & (1 << (x&7)))
+#define B_SET(A,X) ((A)[(X)>>3] |= (1 << ((X)&7)))
+#define B_CLR(A,X) ((A)[(X)>>3] &= ~(1 << ((X)&7)))
+#define B_TST(A,X) ((A)[(X)>>3] & (1 << ((X)&7)))
/* These are uses as bits in flags passed to build_method_call
to control its error reporting behavior.
@@ -2596,14 +3342,13 @@ extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */
LOOKUP_NONVIRTUAL means make a direct call to the member function found
LOOKUP_GLOBAL means search through the space of overloaded functions,
as well as the space of member functions.
- LOOKUP_HAS_IN_CHARGE means that the "in charge" variable is already
- in the parameter list.
- LOOKUP_HAS_VLIST means that the "vlist" variable is already in
- the parameter list.
LOOKUP_ONLYCONVERTING means that non-conversion constructors are not tried.
DIRECT_BIND means that if a temporary is created, it should be created so
that it lives as long as the current variable bindings; otherwise it
- only lives until the end of the complete-expression.
+ only lives until the end of the complete-expression. It also forces
+ direct-initialization in cases where other parts of the compiler have
+ already generated a temporary, such as reference initialization and the
+ catch parameter.
LOOKUP_SPECULATIVELY means return NULL_TREE if we cannot find what we are
after. Note, LOOKUP_COMPLAIN is checked and error messages printed
before LOOKUP_SPECULATIVELY is checked.
@@ -2614,7 +3359,7 @@ extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */
These are used in global lookup to support elaborated types and
qualifiers.
-
+
LOOKUP_PREFER_TYPES means not to accept objects, and possibly namespaces.
LOOKUP_PREFER_NAMESPACES means not to accept objects, and possibly types.
LOOKUP_PREFER_BOTH means class-or-namespace-name.
@@ -2624,10 +3369,8 @@ extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */
#define LOOKUP_PROTECT (1)
#define LOOKUP_COMPLAIN (2)
#define LOOKUP_NORMAL (3)
-/* #define LOOKUP_UNUSED (4) */
#define LOOKUP_NONVIRTUAL (8)
#define LOOKUP_GLOBAL (16)
-#define LOOKUP_HAS_IN_CHARGE (32)
#define LOOKUP_SPECULATIVELY (64)
#define LOOKUP_ONLYCONVERTING (128)
#define DIRECT_BIND (256)
@@ -2638,14 +3381,13 @@ extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */
#define LOOKUP_PREFER_NAMESPACES (4096)
#define LOOKUP_PREFER_BOTH (6144)
#define LOOKUP_TEMPLATES_EXPECTED (8192)
-#define LOOKUP_HAS_VLIST (16384)
-#define LOOKUP_NAMESPACES_ONLY(f) \
- (((f) & LOOKUP_PREFER_NAMESPACES) && !((f) & LOOKUP_PREFER_TYPES))
-#define LOOKUP_TYPES_ONLY(f) \
- (!((f) & LOOKUP_PREFER_NAMESPACES) && ((f) & LOOKUP_PREFER_TYPES))
-#define LOOKUP_QUALIFIERS_ONLY(f) ((f) & LOOKUP_PREFER_BOTH)
-
+#define LOOKUP_NAMESPACES_ONLY(F) \
+ (((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES))
+#define LOOKUP_TYPES_ONLY(F) \
+ (!((F) & LOOKUP_PREFER_NAMESPACES) && ((F) & LOOKUP_PREFER_TYPES))
+#define LOOKUP_QUALIFIERS_ONLY(F) ((F) & LOOKUP_PREFER_BOTH)
+
/* These flags are used by the conversion code.
CONV_IMPLICIT : Perform implicit conversions (standard and user-defined).
@@ -2654,7 +3396,7 @@ extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */
CONV_REINTERPRET: Perform the explicit conversions for reinterpret_cast.
CONV_PRIVATE : Perform upcasts to private bases.
CONV_FORCE_TEMP : Require a new temporary when converting to the same
- aggregate type. */
+ aggregate type. */
#define CONV_IMPLICIT 1
#define CONV_STATIC 2
@@ -2708,26 +3450,30 @@ extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */
#define PUSH_USING 2 /* We are pushing this DECL as the
result of a using declaration. */
-/* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual
- sense of `same'. */
-#define same_type_p(type1, type2) \
- comptypes ((type1), (type2), COMPARE_STRICT)
+/* Used with start function. */
+#define SF_DEFAULT 0 /* No flags. */
+#define SF_PRE_PARSED 1 /* The function declaration has
+ already been parsed. */
+#define SF_INCLASS_INLINE 2 /* The function is an inline, defined
+ in the class body. */
/* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2
is derived from TYPE1, or if TYPE2 is a pointer (reference) to a
class derived from the type pointed to (referred to) by TYPE1. */
-#define same_or_base_type_p(type1, type2) \
- comptypes ((type1), (type2), COMPARE_BASE)
+#define same_or_base_type_p(TYPE1, TYPE2) \
+ comptypes ((TYPE1), (TYPE2), COMPARE_BASE)
/* These macros are used to access a TEMPLATE_PARM_INDEX. */
-#define TEMPLATE_PARM_IDX(NODE) (((template_parm_index*) NODE)->index)
-#define TEMPLATE_PARM_LEVEL(NODE) (((template_parm_index*) NODE)->level)
+#define TEMPLATE_PARM_INDEX_CAST(NODE) \
+ ((template_parm_index*)TEMPLATE_PARM_INDEX_CHECK (NODE))
+#define TEMPLATE_PARM_IDX(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->index)
+#define TEMPLATE_PARM_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->level)
#define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE))
-#define TEMPLATE_PARM_ORIG_LEVEL(NODE) (((template_parm_index*) NODE)->orig_level)
-#define TEMPLATE_PARM_DECL(NODE) (((template_parm_index*) NODE)->decl)
+#define TEMPLATE_PARM_ORIG_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->orig_level)
+#define TEMPLATE_PARM_DECL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->decl)
-/* These macros are for accessing the fields of TEMPLATE_TYPE_PARM
- and TEMPLATE_TEMPLATE_PARM nodes. */
+/* These macros are for accessing the fields of TEMPLATE_TYPE_PARM,
+ TEMPLATE_TEMPLATE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM nodes. */
#define TEMPLATE_TYPE_PARM_INDEX(NODE) (TYPE_FIELDS (NODE))
#define TEMPLATE_TYPE_IDX(NODE) \
(TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE)))
@@ -2738,837 +3484,917 @@ extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */
#define TEMPLATE_TYPE_DECL(NODE) \
(TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
+/* These constants can used as bit flags in the process of tree formatting.
+
+ TFF_PLAIN_IDENTIFIER: unqualified part of a name.
+ TFF_SCOPE: include the class and namespace scope of the name.
+ TFF_CHASE_TYPEDEF: print the original type-id instead of the typedef-name.
+ TFF_DECL_SPECIFIERS: print decl-specifiers.
+ TFF_CLASS_KEY_OR_ENUM: precede a class-type name (resp. enum name) with
+ a class-key (resp. `enum').
+ TFF_RETURN_TYPE: include function return type.
+ TFF_FUNCTION_DEFAULT_ARGUMENTS: include function default parameter values.
+ TFF_EXCEPTION_SPECIFICATION: show function exception specification.
+ TFF_TEMPLATE_HEADER: show the template<...> header in a
+ template-declaration.
+ TFF_TEMPLATE_NAME: show only template-name.
+ TFF_EXPR_IN_PARENS: Parenthesize expressions. */
+
+#define TFF_PLAIN_IDENTIFIER (0)
+#define TFF_SCOPE (1)
+#define TFF_CHASE_TYPEDEF (1 << 1)
+#define TFF_DECL_SPECIFIERS (1 << 2)
+#define TFF_CLASS_KEY_OR_ENUM (1 << 3)
+#define TFF_RETURN_TYPE (1 << 4)
+#define TFF_FUNCTION_DEFAULT_ARGUMENTS (1 << 5)
+#define TFF_EXCEPTION_SPECIFICATION (1 << 6)
+#define TFF_TEMPLATE_HEADER (1 << 7)
+#define TFF_TEMPLATE_NAME (1 << 8)
+#define TFF_EXPR_IN_PARENS (1 << 9)
+
+/* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM
+ node. */
+#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL(NODE) \
+ ((TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM) \
+ ? TYPE_TI_TEMPLATE (NODE) \
+ : TYPE_NAME (NODE))
+
/* in lex.c */
+
+extern void init_reswords PARAMS ((void));
+
/* Indexed by TREE_CODE, these tables give C-looking names to
operators represented by TREE_CODES. For example,
opname_tab[(int) MINUS_EXPR] == "-". */
-extern char **opname_tab, **assignop_tab;
-
+extern const char **opname_tab, **assignop_tab;
+
+typedef struct operator_name_info_t
+{
+ /* The IDENTIFIER_NODE for the operator. */
+ tree identifier;
+ /* The name of the operator. */
+ const char *name;
+ /* The mangled name of the operator. */
+ const char *mangled_name;
+} operator_name_info_t;
+
+/* A mapping from tree codes to operator name information. */
+extern operator_name_info_t operator_name_info[];
+/* Similar, but for assignment operators. */
+extern operator_name_info_t assignment_operator_name_info[];
+
/* in call.c */
-extern int check_dtor_name PROTO((tree, tree));
-extern int get_arglist_len_in_bytes PROTO((tree));
-
-extern tree build_vfield_ref PROTO((tree, tree));
-extern tree resolve_scope_to_name PROTO((tree, tree));
-extern tree build_scoped_method_call PROTO((tree, tree, tree, tree));
-extern tree build_addr_func PROTO((tree));
-extern tree build_call PROTO((tree, tree, tree));
-extern tree build_method_call PROTO((tree, tree, tree, tree, int));
-extern int null_ptr_cst_p PROTO((tree));
-extern tree type_decays_to PROTO((tree));
-extern tree build_user_type_conversion PROTO((tree, tree, int));
-extern tree build_new_function_call PROTO((tree, tree));
-extern tree build_new_op PROTO((enum tree_code, int, tree, tree, tree));
-extern tree build_op_new_call PROTO((enum tree_code, tree, tree, int));
-extern tree build_op_delete_call PROTO((enum tree_code, tree, tree, int, tree));
-extern int can_convert PROTO((tree, tree));
-extern int can_convert_arg PROTO((tree, tree, tree));
-extern int enforce_access PROTO((tree, tree));
-extern tree convert_default_arg PROTO((tree, tree, tree));
-extern tree convert_arg_to_ellipsis PROTO((tree));
-extern int is_properly_derived_from PROTO((tree, tree));
+extern int check_dtor_name PARAMS ((tree, tree));
+extern int get_arglist_len_in_bytes PARAMS ((tree));
+
+extern tree build_vfield_ref PARAMS ((tree, tree));
+extern tree build_scoped_method_call PARAMS ((tree, tree, tree, tree));
+extern tree build_conditional_expr PARAMS ((tree, tree, tree));
+extern tree build_addr_func PARAMS ((tree));
+extern tree build_call PARAMS ((tree, tree));
+extern tree build_method_call PARAMS ((tree, tree, tree, tree, int));
+extern int null_ptr_cst_p PARAMS ((tree));
+extern int sufficient_parms_p PARAMS ((tree));
+extern tree type_decays_to PARAMS ((tree));
+extern tree build_user_type_conversion PARAMS ((tree, tree, int));
+extern tree build_new_function_call PARAMS ((tree, tree));
+extern tree build_new_op PARAMS ((enum tree_code, int, tree, tree, tree));
+extern tree build_op_delete_call PARAMS ((enum tree_code, tree, tree, int, tree));
+extern int can_convert PARAMS ((tree, tree));
+extern int can_convert_arg PARAMS ((tree, tree, tree));
+extern int can_convert_arg_bad PARAMS ((tree, tree, tree));
+extern int enforce_access PARAMS ((tree, tree));
+extern tree convert_default_arg PARAMS ((tree, tree, tree, int));
+extern tree convert_arg_to_ellipsis PARAMS ((tree));
+extern tree build_x_va_arg PARAMS ((tree, tree));
+extern tree convert_type_from_ellipsis PARAMS ((tree));
+extern int is_properly_derived_from PARAMS ((tree, tree));
+extern tree initialize_reference PARAMS ((tree, tree));
+extern tree strip_top_quals PARAMS ((tree));
+extern tree perform_implicit_conversion PARAMS ((tree, tree));
/* in class.c */
-extern tree build_vbase_path PROTO((enum tree_code, tree, tree, tree, int));
-extern tree build_vtbl_ref PROTO((tree, tree));
-extern tree build_vfn_ref PROTO((tree *, tree, tree));
-extern void add_method PROTO((tree, tree *, tree));
-extern int currently_open_class PROTO((tree));
-extern tree get_vfield_offset PROTO((tree));
-extern void duplicate_tag_error PROTO((tree));
-extern tree finish_struct PROTO((tree, tree, int));
-extern void finish_struct_1 PROTO((tree, int));
-extern int resolves_to_fixed_type_p PROTO((tree, int *));
-extern void init_class_processing PROTO((void));
-extern int is_empty_class PROTO((tree));
-extern void pushclass PROTO((tree, int));
-extern void popclass PROTO((void));
-extern void push_nested_class PROTO((tree, int));
-extern void pop_nested_class PROTO((void));
-extern void push_lang_context PROTO((tree));
-extern void pop_lang_context PROTO((void));
-extern tree instantiate_type PROTO((tree, tree, int));
-extern void print_class_statistics PROTO((void));
-extern void push_cache_obstack PROTO((void));
-extern unsigned HOST_WIDE_INT skip_rtti_stuff PROTO((tree *, tree));
-extern void build_self_reference PROTO((void));
-extern void warn_hidden PROTO((tree));
-extern tree get_enclosing_class PROTO((tree));
-int is_base_of_enclosing_class PROTO((tree, tree));
-extern void unreverse_member_declarations PROTO((tree));
-extern void invalidate_class_lookup_cache PROTO((void));
-extern void maybe_note_name_used_in_class PROTO((tree, tree));
-extern void note_name_declared_in_class PROTO((tree, tree));
+extern tree build_base_path PARAMS ((enum tree_code, tree, tree, int));
+extern tree build_vbase_path PARAMS ((enum tree_code, tree, tree, tree, int));
+extern tree build_vtbl_ref PARAMS ((tree, tree));
+extern tree build_vfn_ref PARAMS ((tree, tree));
+extern tree get_vtable_decl PARAMS ((tree, int));
+extern void add_method PARAMS ((tree, tree, int));
+extern int currently_open_class PARAMS ((tree));
+extern tree currently_open_derived_class PARAMS ((tree));
+extern void duplicate_tag_error PARAMS ((tree));
+extern tree finish_struct PARAMS ((tree, tree));
+extern void finish_struct_1 PARAMS ((tree));
+extern int resolves_to_fixed_type_p PARAMS ((tree, int *));
+extern void init_class_processing PARAMS ((void));
+extern int is_empty_class PARAMS ((tree));
+extern void pushclass PARAMS ((tree, int));
+extern void popclass PARAMS ((void));
+extern void push_nested_class PARAMS ((tree, int));
+extern void pop_nested_class PARAMS ((void));
+extern int current_lang_depth PARAMS ((void));
+extern void push_lang_context PARAMS ((tree));
+extern void pop_lang_context PARAMS ((void));
+extern tree instantiate_type PARAMS ((tree, tree, enum instantiate_type_flags));
+extern void print_class_statistics PARAMS ((void));
+extern void cxx_print_statistics PARAMS ((void));
+extern void cxx_print_xnode PARAMS ((FILE *, tree, int));
+extern void cxx_print_decl PARAMS ((FILE *, tree, int));
+extern void cxx_print_type PARAMS ((FILE *, tree, int));
+extern void cxx_print_identifier PARAMS ((FILE *, tree, int));
+extern void cxx_set_yydebug PARAMS ((int));
+extern void build_self_reference PARAMS ((void));
+extern int same_signature_p PARAMS ((tree, tree));
+extern void warn_hidden PARAMS ((tree));
+extern tree get_enclosing_class PARAMS ((tree));
+int is_base_of_enclosing_class PARAMS ((tree, tree));
+extern void unreverse_member_declarations PARAMS ((tree));
+extern void invalidate_class_lookup_cache PARAMS ((void));
+extern void maybe_note_name_used_in_class PARAMS ((tree, tree));
+extern void note_name_declared_in_class PARAMS ((tree, tree));
+extern tree get_vtbl_decl_for_binfo PARAMS ((tree));
+extern tree in_charge_arg_for_name PARAMS ((tree));
+extern tree get_vtt_name PARAMS ((tree));
+extern tree get_primary_binfo PARAMS ((tree));
/* in cvt.c */
-extern tree convert_to_reference PROTO((tree, tree, int, int, tree));
-extern tree convert_from_reference PROTO((tree));
-extern tree convert_pointer_to_real PROTO((tree, tree));
-extern tree convert_pointer_to PROTO((tree, tree));
-extern tree ocp_convert PROTO((tree, tree, int, int));
-extern tree cp_convert PROTO((tree, tree));
-extern tree convert PROTO((tree, tree));
-extern tree convert_force PROTO((tree, tree, int));
-extern tree build_type_conversion PROTO((tree, tree, int));
-extern tree build_expr_type_conversion PROTO((int, tree, int));
-extern tree type_promotes_to PROTO((tree));
-extern tree perform_qualification_conversions PROTO((tree, tree));
+extern tree convert_to_reference PARAMS ((tree, tree, int, int, tree));
+extern tree convert_from_reference PARAMS ((tree));
+extern tree convert_lvalue PARAMS ((tree, tree));
+extern tree ocp_convert PARAMS ((tree, tree, int, int));
+extern tree cp_convert PARAMS ((tree, tree));
+extern tree convert_to_void PARAMS ((tree, const char */*implicit context*/));
+extern tree convert_force PARAMS ((tree, tree, int));
+extern tree build_type_conversion PARAMS ((tree, tree, int));
+extern tree build_expr_type_conversion PARAMS ((int, tree, int));
+extern tree type_promotes_to PARAMS ((tree));
+extern tree perform_qualification_conversions PARAMS ((tree, tree));
+extern void clone_function_decl PARAMS ((tree, int));
+extern void adjust_clone_args PARAMS ((tree));
/* decl.c */
/* resume_binding_level */
-extern void set_identifier_local_value PROTO((tree, tree));
-extern int global_bindings_p PROTO((void));
-extern int toplevel_bindings_p PROTO((void));
-extern int namespace_bindings_p PROTO((void));
-extern void keep_next_level PROTO((void));
-extern int kept_level_p PROTO((void));
-extern void declare_parm_level PROTO((void));
-extern void declare_pseudo_global_level PROTO((void));
-extern int pseudo_global_level_p PROTO((void));
-extern void set_class_shadows PROTO((tree));
-extern void pushlevel PROTO((int));
-extern void note_level_for_for PROTO((void));
-extern void pushlevel_temporary PROTO((int));
-extern tree poplevel PROTO((int, int, int));
-extern void resume_level PROTO((struct binding_level *));
-extern void delete_block PROTO((tree));
-extern void insert_block PROTO((tree));
-extern void add_block_current_level PROTO((tree));
-extern void set_block PROTO((tree));
-extern void pushlevel_class PROTO((void));
-extern void print_binding_stack PROTO((void));
-extern void print_binding_level PROTO((struct binding_level *));
-extern void push_namespace PROTO((tree));
-extern void pop_namespace PROTO((void));
-extern void maybe_push_to_top_level PROTO((int));
-extern void push_to_top_level PROTO((void));
-extern void pop_from_top_level PROTO((void));
-extern tree identifier_type_value PROTO((tree));
-extern void set_identifier_type_value PROTO((tree, tree));
-extern void pop_everything PROTO((void));
-extern void pushtag PROTO((tree, tree, int));
-extern tree make_anon_name PROTO((void));
-extern void clear_anon_tags PROTO((void));
-extern int decls_match PROTO((tree, tree));
-extern int duplicate_decls PROTO((tree, tree));
-extern tree pushdecl PROTO((tree));
-extern tree pushdecl_top_level PROTO((tree));
-extern void pushdecl_class_level PROTO((tree));
-#if 0
-extern void pushdecl_nonclass_level PROTO((tree));
-#endif
-extern tree pushdecl_namespace_level PROTO((tree));
-extern tree push_using_decl PROTO((tree, tree));
-extern tree push_using_directive PROTO((tree));
-extern void push_class_level_binding PROTO((tree, tree));
-extern tree implicitly_declare PROTO((tree));
-extern tree lookup_label PROTO((tree));
-extern tree shadow_label PROTO((tree));
-extern tree define_label PROTO((char *, int, tree));
-extern void push_switch PROTO((void));
-extern void pop_switch PROTO((void));
-extern void define_case_label PROTO((void));
-extern tree getdecls PROTO((void));
-extern tree gettags PROTO((void));
-#if 0
-extern void set_current_level_tags_transparency PROTO((int));
-#endif
-extern tree binding_for_name PROTO((tree, tree));
-extern tree namespace_binding PROTO((tree, tree));
-extern void set_namespace_binding PROTO((tree, tree, tree));
-extern tree lookup_namespace_name PROTO((tree, tree));
-extern tree build_typename_type PROTO((tree, tree, tree, tree));
-extern tree make_typename_type PROTO((tree, tree));
-extern tree lookup_name_nonclass PROTO((tree));
-extern tree lookup_function_nonclass PROTO((tree, tree));
-extern tree lookup_name PROTO((tree, int));
-extern tree lookup_name_current_level PROTO((tree));
-extern tree lookup_type_current_level PROTO((tree));
-extern tree lookup_name_namespace_only PROTO((tree));
-extern void begin_only_namespace_names PROTO((void));
-extern void end_only_namespace_names PROTO((void));
-extern tree namespace_ancestor PROTO((tree, tree));
-extern int lookup_using_namespace PROTO((tree,tree,tree,tree,int));
-extern int qualified_lookup_using_namespace PROTO((tree,tree,tree,int));
-extern tree auto_function PROTO((tree, tree, enum built_in_function));
-extern void init_decl_processing PROTO((void));
-extern int init_type_desc PROTO((void));
-extern tree define_function
- PROTO((const char *, tree, enum built_in_function,
- void (*) (tree), const char *));
-extern tree check_tag_decl PROTO((tree));
-extern void shadow_tag PROTO((tree));
-extern tree groktypename PROTO((tree));
-extern tree start_decl PROTO((tree, tree, int, tree, tree));
-extern void start_decl_1 PROTO((tree));
-extern void cp_finish_decl PROTO((tree, tree, tree, int, int));
-extern void finish_decl PROTO((tree, tree, tree));
-extern void expand_static_init PROTO((tree, tree));
-extern int complete_array_type PROTO((tree, tree, int));
-extern tree build_ptrmemfunc_type PROTO((tree));
+extern void cxx_init_decl_processing PARAMS ((void));
+extern int toplevel_bindings_p PARAMS ((void));
+extern int namespace_bindings_p PARAMS ((void));
+extern void keep_next_level PARAMS ((int));
+extern int kept_level_p PARAMS ((void));
+extern int template_parm_scope_p PARAMS ((void));
+extern void set_class_shadows PARAMS ((tree));
+extern void maybe_push_cleanup_level PARAMS ((tree));
+extern void begin_scope PARAMS ((scope_kind));
+extern void finish_scope PARAMS ((void));
+extern void note_level_for_for PARAMS ((void));
+extern void note_level_for_try PARAMS ((void));
+extern void note_level_for_catch PARAMS ((void));
+extern void resume_level PARAMS ((struct binding_level *));
+extern void delete_block PARAMS ((tree));
+extern void add_block_current_level PARAMS ((tree));
+extern void pushlevel_class PARAMS ((void));
+extern void poplevel_class PARAMS ((void));
+extern void print_binding_stack PARAMS ((void));
+extern void print_binding_level PARAMS ((struct binding_level *));
+extern void push_namespace PARAMS ((tree));
+extern void pop_namespace PARAMS ((void));
+extern void push_nested_namespace PARAMS ((tree));
+extern void pop_nested_namespace PARAMS ((tree));
+extern void maybe_push_to_top_level PARAMS ((int));
+extern void push_to_top_level PARAMS ((void));
+extern void pop_from_top_level PARAMS ((void));
+extern void push_switch PARAMS ((tree));
+extern void pop_switch PARAMS ((void));
+extern tree identifier_type_value PARAMS ((tree));
+extern void set_identifier_type_value PARAMS ((tree, tree));
+extern void pop_everything PARAMS ((void));
+extern void pushtag PARAMS ((tree, tree, int));
+extern tree make_anon_name PARAMS ((void));
+extern void clear_anon_tags PARAMS ((void));
+extern int decls_match PARAMS ((tree, tree));
+extern int duplicate_decls PARAMS ((tree, tree));
+extern tree pushdecl_top_level PARAMS ((tree));
+extern void pushdecl_class_level PARAMS ((tree));
+extern tree pushdecl_namespace_level PARAMS ((tree));
+extern tree push_using_decl PARAMS ((tree, tree));
+extern tree push_using_directive PARAMS ((tree));
+extern void push_class_level_binding PARAMS ((tree, tree));
+extern tree implicitly_declare PARAMS ((tree));
+extern tree declare_local_label PARAMS ((tree));
+extern tree define_label PARAMS ((const char *, int, tree));
+extern void check_goto PARAMS ((tree));
+extern void define_case_label PARAMS ((void));
+extern tree binding_for_name PARAMS ((tree, tree));
+extern tree namespace_binding PARAMS ((tree, tree));
+extern void set_namespace_binding PARAMS ((tree, tree, tree));
+extern tree lookup_namespace_name PARAMS ((tree, tree));
+extern tree build_typename_type PARAMS ((tree, tree, tree, tree));
+extern tree make_typename_type PARAMS ((tree, tree, int));
+extern tree make_unbound_class_template PARAMS ((tree, tree, int));
+extern tree lookup_name_nonclass PARAMS ((tree));
+extern tree lookup_function_nonclass PARAMS ((tree, tree));
+extern tree lookup_name PARAMS ((tree, int));
+extern tree lookup_name_current_level PARAMS ((tree));
+extern tree lookup_type_current_level PARAMS ((tree));
+extern tree lookup_name_namespace_only PARAMS ((tree));
+extern void begin_only_namespace_names PARAMS ((void));
+extern void end_only_namespace_names PARAMS ((void));
+extern tree namespace_ancestor PARAMS ((tree, tree));
+extern tree unqualified_namespace_lookup PARAMS ((tree, int, tree *));
+extern int lookup_using_namespace PARAMS ((tree, tree, tree, tree, int, tree *));
+extern int qualified_lookup_using_namespace PARAMS ((tree, tree, tree, int));
+extern tree build_library_fn PARAMS ((tree, tree));
+extern tree build_library_fn_ptr PARAMS ((const char *, tree));
+extern tree build_cp_library_fn_ptr PARAMS ((const char *, tree));
+extern tree push_library_fn PARAMS ((tree, tree));
+extern tree push_void_library_fn PARAMS ((tree, tree));
+extern tree push_throw_library_fn PARAMS ((tree, tree));
+extern int init_type_desc PARAMS ((void));
+extern tree check_tag_decl PARAMS ((tree));
+extern void shadow_tag PARAMS ((tree));
+extern tree groktypename PARAMS ((tree));
+extern tree start_decl PARAMS ((tree, tree, int, tree, tree));
+extern void start_decl_1 PARAMS ((tree));
+extern void cp_finish_decl PARAMS ((tree, tree, tree, int));
+extern void finish_decl PARAMS ((tree, tree, tree));
+extern void maybe_inject_for_scope_var PARAMS ((tree));
+extern void initialize_local_var PARAMS ((tree, tree, int));
+extern void expand_static_init PARAMS ((tree, tree));
+extern tree start_handler_parms PARAMS ((tree, tree));
+extern int complete_array_type PARAMS ((tree, tree, int));
+extern tree build_ptrmemfunc_type PARAMS ((tree));
/* the grokdeclarator prototype is in decl.h */
-extern int parmlist_is_exprlist PROTO((tree));
-extern int copy_args_p PROTO((tree));
-extern int grok_ctor_properties PROTO((tree, tree));
-extern void grok_op_properties PROTO((tree, int, int));
-extern tree xref_tag PROTO((tree, tree, int));
-extern tree xref_tag_from_type PROTO((tree, tree, int));
-extern void xref_basetypes PROTO((tree, tree, tree, tree));
-extern tree start_enum PROTO((tree));
-extern tree finish_enum PROTO((tree));
-extern tree build_enumerator PROTO((tree, tree, tree));
-extern int start_function PROTO((tree, tree, tree, int));
-extern void expand_start_early_try_stmts PROTO((void));
-extern void store_parm_decls PROTO((void));
-extern void store_return_init PROTO((tree, tree));
-extern void finish_function PROTO((int, int, int));
-extern tree start_method PROTO((tree, tree, tree));
-extern tree finish_method PROTO((tree));
-extern void hack_incomplete_structures PROTO((tree));
-extern tree maybe_build_cleanup_and_delete PROTO((tree));
-extern tree maybe_build_cleanup PROTO((tree));
-extern void cplus_expand_expr_stmt PROTO((tree));
-extern void finish_stmt PROTO((void));
-extern void push_cp_function_context PROTO((tree));
-extern void pop_cp_function_context PROTO((tree));
-extern int in_function_p PROTO((void));
-extern void replace_defarg PROTO((tree, tree));
-extern void print_other_binding_stack PROTO((struct binding_level *));
-extern void revert_static_member_fn PROTO((tree*, tree*, tree*));
-extern void fixup_anonymous_union PROTO((tree));
-extern int check_static_variable_definition PROTO((tree, tree));
-extern void push_local_binding PROTO((tree, tree, int));
-extern int push_class_binding PROTO((tree, tree));
-extern tree check_default_argument PROTO((tree, tree));
-extern tree push_overloaded_decl PROTO((tree, int));
-extern void clear_identifier_class_values PROTO((void));
-extern void storetags PROTO((tree));
-extern int vtable_decl_p PROTO((tree, void *));
-extern int vtype_decl_p PROTO((tree, void *));
-extern int sigtable_decl_p PROTO((tree, void *));
-typedef int (*walk_globals_pred) PROTO((tree, void *));
-typedef int (*walk_globals_fn) PROTO((tree *, void *));
-extern int walk_globals PROTO((walk_globals_pred,
+extern int parmlist_is_exprlist PARAMS ((tree));
+extern int copy_fn_p PARAMS ((tree));
+extern void grok_special_member_properties PARAMS ((tree));
+extern int grok_ctor_properties PARAMS ((tree, tree));
+extern void grok_op_properties PARAMS ((tree, int));
+extern tree xref_tag PARAMS ((tree, tree, int));
+extern tree xref_tag_from_type PARAMS ((tree, tree, int));
+extern void xref_basetypes PARAMS ((tree, tree, tree, tree));
+extern tree start_enum PARAMS ((tree));
+extern void finish_enum PARAMS ((tree));
+extern void build_enumerator PARAMS ((tree, tree, tree));
+extern int start_function PARAMS ((tree, tree, tree, int));
+extern tree begin_function_body PARAMS ((void));
+extern void finish_function_body PARAMS ((tree));
+extern tree finish_function PARAMS ((int));
+extern tree start_method PARAMS ((tree, tree, tree));
+extern tree finish_method PARAMS ((tree));
+extern void hack_incomplete_structures PARAMS ((tree));
+extern void finish_stmt PARAMS ((void));
+extern void print_other_binding_stack PARAMS ((struct binding_level *));
+extern void revert_static_member_fn PARAMS ((tree));
+extern void fixup_anonymous_aggr PARAMS ((tree));
+extern int check_static_variable_definition PARAMS ((tree, tree));
+extern tree compute_array_index_type PARAMS ((tree, tree));
+extern void push_local_binding PARAMS ((tree, tree, int));
+extern int push_class_binding PARAMS ((tree, tree));
+extern tree check_default_argument PARAMS ((tree, tree));
+extern tree push_overloaded_decl PARAMS ((tree, int));
+extern void clear_identifier_class_values PARAMS ((void));
+extern void storetags PARAMS ((tree));
+extern int vtable_decl_p PARAMS ((tree, void *));
+extern int vtype_decl_p PARAMS ((tree, void *));
+extern int sigtable_decl_p PARAMS ((tree, void *));
+typedef int (*walk_globals_pred) PARAMS ((tree, void *));
+typedef int (*walk_globals_fn) PARAMS ((tree *, void *));
+extern int walk_globals PARAMS ((walk_globals_pred,
walk_globals_fn,
void *));
-typedef int (*walk_namespaces_fn) PROTO((tree, void *));
-extern int walk_namespaces PROTO((walk_namespaces_fn,
+typedef int (*walk_namespaces_fn) PARAMS ((tree, void *));
+extern int walk_namespaces PARAMS ((walk_namespaces_fn,
void *));
-extern int wrapup_globals_for_namespace PROTO((tree, void *));
+extern int wrapup_globals_for_namespace PARAMS ((tree, void *));
+extern tree cp_namespace_decls PARAMS ((tree));
+extern tree create_implicit_typedef PARAMS ((tree, tree));
+extern tree maybe_push_decl PARAMS ((tree));
+extern tree build_target_expr_with_type PARAMS ((tree, tree));
+extern int local_variable_p PARAMS ((tree));
+extern int nonstatic_local_decl_p PARAMS ((tree));
+extern tree declare_global_var PARAMS ((tree, tree));
+extern void register_dtor_fn PARAMS ((tree));
+extern tmpl_spec_kind current_tmpl_spec_kind PARAMS ((int));
+extern tree cp_fname_init PARAMS ((const char *));
/* in decl2.c */
-extern int check_java_method PROTO((tree));
-extern int lang_decode_option PROTO((int, char **));
-extern tree grok_method_quals PROTO((tree, tree, tree));
-extern void warn_if_unknown_interface PROTO((tree));
-extern void grok_x_components PROTO((tree));
-extern void maybe_retrofit_in_chrg PROTO((tree));
-extern void maybe_make_one_only PROTO((tree));
-extern void grokclassfn PROTO((tree, tree, enum overload_flags, tree));
-extern tree grok_alignof PROTO((tree));
-extern tree grok_array_decl PROTO((tree, tree));
-extern tree delete_sanity PROTO((tree, tree, int, int));
-extern tree check_classfn PROTO((tree, tree));
-extern void check_member_template PROTO((tree));
-extern tree grokfield PROTO((tree, tree, tree, tree, tree));
-extern tree grokbitfield PROTO((tree, tree, tree));
-extern tree groktypefield PROTO((tree, tree));
-extern tree grokoptypename PROTO((tree, tree));
-extern int copy_assignment_arg_p PROTO((tree, int));
-extern void cplus_decl_attributes PROTO((tree, tree, tree));
-extern tree constructor_name_full PROTO((tree));
-extern tree constructor_name PROTO((tree));
-extern void setup_vtbl_ptr PROTO((void));
-extern void mark_inline_for_output PROTO((tree));
-extern void clear_temp_name PROTO((void));
-extern tree get_temp_name PROTO((tree, int));
-extern tree get_temp_regvar PROTO((tree, tree));
-extern void finish_anon_union PROTO((tree));
-extern tree finish_table PROTO((tree, tree, tree, int));
-extern void finish_builtin_type PROTO((tree, const char *,
+extern void init_decl2 PARAMS ((void));
+extern int check_java_method PARAMS ((tree));
+extern int cxx_decode_option PARAMS ((int, char **));
+extern int grok_method_quals PARAMS ((tree, tree, tree));
+extern void warn_if_unknown_interface PARAMS ((tree));
+extern void grok_x_components PARAMS ((tree));
+extern void maybe_retrofit_in_chrg PARAMS ((tree));
+extern void maybe_make_one_only PARAMS ((tree));
+extern void grokclassfn PARAMS ((tree, tree, enum overload_flags, tree));
+extern tree grok_array_decl PARAMS ((tree, tree));
+extern tree delete_sanity PARAMS ((tree, tree, int, int));
+extern tree check_classfn PARAMS ((tree, tree));
+extern void check_member_template PARAMS ((tree));
+extern tree grokfield PARAMS ((tree, tree, tree, tree, tree));
+extern tree grokbitfield PARAMS ((tree, tree, tree));
+extern tree groktypefield PARAMS ((tree, tree));
+extern tree grokoptypename PARAMS ((tree, tree));
+extern void cplus_decl_attributes PARAMS ((tree *, tree, int));
+extern tree constructor_name_full PARAMS ((tree));
+extern tree constructor_name PARAMS ((tree));
+extern void defer_fn PARAMS ((tree));
+extern void finish_anon_union PARAMS ((tree));
+extern tree finish_table PARAMS ((tree, tree, tree, int));
+extern void finish_builtin_type PARAMS ((tree, const char *,
tree *, int, tree));
-extern tree coerce_new_type PROTO((tree));
-extern tree coerce_delete_type PROTO((tree));
-extern void comdat_linkage PROTO((tree));
-extern void import_export_class PROTO((tree));
-extern void import_export_vtable PROTO((tree, tree, int));
-extern void import_export_decl PROTO((tree));
-extern tree build_cleanup PROTO((tree));
-extern void finish_file PROTO((void));
-extern tree reparse_absdcl_as_expr PROTO((tree, tree));
-extern tree reparse_absdcl_as_casts PROTO((tree, tree));
-extern tree build_expr_from_tree PROTO((tree));
-extern tree reparse_decl_as_expr PROTO((tree, tree));
-extern tree finish_decl_parsing PROTO((tree));
-extern tree check_cp_case_value PROTO((tree));
-extern void set_decl_namespace PROTO((tree, tree, int));
-extern tree current_decl_namespace PROTO((void));
-extern void push_decl_namespace PROTO((tree));
-extern void pop_decl_namespace PROTO((void));
-extern void push_scope PROTO((tree));
-extern void pop_scope PROTO((tree));
-extern void do_namespace_alias PROTO((tree, tree));
-extern void do_toplevel_using_decl PROTO((tree));
-extern void do_local_using_decl PROTO((tree));
-extern tree do_class_using_decl PROTO((tree));
-extern void do_using_directive PROTO((tree));
-extern void check_default_args PROTO((tree));
-extern void mark_used PROTO((tree));
-extern tree handle_class_head PROTO((tree, tree, tree));
-extern tree lookup_arg_dependent PROTO((tree, tree, tree));
-extern void finish_static_data_member_decl PROTO((tree, tree, tree, int, int));
-
-/* in errfn.c */
-/* The cp_* functions aren't suitable for ATTRIBUTE_PRINTF. */
-extern void cp_error PVPROTO((const char *, ...));
-extern void cp_error_at PVPROTO((const char *, ...));
-extern void cp_warning PVPROTO((const char *, ...));
-extern void cp_warning_at PVPROTO((const char *, ...));
-extern void cp_pedwarn PVPROTO((const char *, ...));
-extern void cp_pedwarn_at PVPROTO((const char *, ...));
-extern void cp_compiler_error PVPROTO((const char *, ...));
-extern void cp_sprintf PVPROTO((const char *, ...));
-extern void cp_deprecated PROTO((const char*));
+extern tree coerce_new_type PARAMS ((tree));
+extern tree coerce_delete_type PARAMS ((tree));
+extern void comdat_linkage PARAMS ((tree));
+extern void import_export_vtable PARAMS ((tree, tree, int));
+extern void import_export_decl PARAMS ((tree));
+extern tree build_cleanup PARAMS ((tree));
+extern void finish_file PARAMS ((void));
+extern tree reparse_absdcl_as_expr PARAMS ((tree, tree));
+extern tree reparse_absdcl_as_casts PARAMS ((tree, tree));
+extern tree build_expr_from_tree PARAMS ((tree));
+extern tree reparse_decl_as_expr PARAMS ((tree, tree));
+extern tree finish_decl_parsing PARAMS ((tree));
+extern void set_decl_namespace PARAMS ((tree, tree, int));
+extern tree current_decl_namespace PARAMS ((void));
+extern void push_decl_namespace PARAMS ((tree));
+extern void pop_decl_namespace PARAMS ((void));
+extern void push_scope PARAMS ((tree));
+extern void pop_scope PARAMS ((tree));
+extern void do_namespace_alias PARAMS ((tree, tree));
+extern void do_toplevel_using_decl PARAMS ((tree));
+extern void do_local_using_decl PARAMS ((tree));
+extern tree do_class_using_decl PARAMS ((tree));
+extern void do_using_directive PARAMS ((tree));
+extern void check_default_args PARAMS ((tree));
+extern void mark_used PARAMS ((tree));
+extern tree handle_class_head PARAMS ((tree, tree, tree, int, int *));
+extern tree lookup_arg_dependent PARAMS ((tree, tree, tree));
+extern void finish_static_data_member_decl PARAMS ((tree, tree, tree, int));
+extern tree build_artificial_parm PARAMS ((tree, tree));
+extern tree get_guard PARAMS ((tree));
+extern tree get_guard_cond PARAMS ((tree));
+extern tree set_guard PARAMS ((tree));
+
+/* in parse.y */
+extern void cp_parse_init PARAMS ((void));
+
+extern void cp_error_at PARAMS ((const char *msgid, ...));
+extern void cp_warning_at PARAMS ((const char *msgid, ...));
+extern void cp_pedwarn_at PARAMS ((const char *msgid, ...));
+
+/* XXX Not i18n clean. */
+#define cp_deprecated(STR) \
+ do { \
+ if (warn_deprecated) \
+ warning ("%s is deprecated, please see the documentation for details", \
+ (STR)); \
+ } while (0)
/* in error.c */
-extern void init_error PROTO((void));
-extern char *fndecl_as_string PROTO((tree, int));
-extern char *type_as_string PROTO((tree, int));
-extern char *type_as_string_real PROTO((tree, int, int));
-extern char *args_as_string PROTO((tree, int));
-extern char *decl_as_string PROTO((tree, int));
-extern char *expr_as_string PROTO((tree, int));
-extern char *code_as_string PROTO((enum tree_code, int));
-extern char *language_as_string PROTO((enum languages, int));
-extern char *parm_as_string PROTO((int, int));
-extern char *op_as_string PROTO((enum tree_code, int));
-extern char *assop_as_string PROTO((enum tree_code, int));
-extern char *cv_as_string PROTO((tree, int));
-extern char *lang_decl_name PROTO((tree, int));
-extern char *cp_file_of PROTO((tree));
-extern int cp_line_of PROTO((tree));
+extern void init_error PARAMS ((void));
+extern const char *type_as_string PARAMS ((tree, int));
+extern const char *decl_as_string PARAMS ((tree, int));
+extern const char *expr_as_string PARAMS ((tree, int));
+extern const char *context_as_string PARAMS ((tree, int));
+extern const char *lang_decl_name PARAMS ((tree, int));
+extern const char *cp_file_of PARAMS ((tree));
+extern int cp_line_of PARAMS ((tree));
+extern const char *language_to_string PARAMS ((enum languages, int));
+extern void print_instantiation_context PARAMS ((void));
/* in except.c */
-extern void init_exception_processing PROTO((void));
-extern void expand_start_catch_block PROTO((tree, tree));
-extern void expand_end_catch_block PROTO((void));
-extern void expand_builtin_throw PROTO((void));
-extern void expand_start_eh_spec PROTO((void));
-extern void expand_exception_blocks PROTO((void));
-extern tree start_anon_func PROTO((void));
-extern void end_anon_func PROTO((void));
-extern void expand_throw PROTO((tree));
-extern tree build_throw PROTO((tree));
-extern void mark_all_runtime_matches PROTO((void));
+extern void init_exception_processing PARAMS ((void));
+extern tree expand_start_catch_block PARAMS ((tree));
+extern void expand_end_catch_block PARAMS ((void));
+extern void expand_builtin_throw PARAMS ((void));
+extern void expand_eh_spec_block PARAMS ((tree));
+extern void expand_exception_blocks PARAMS ((void));
+extern tree build_exc_ptr PARAMS ((void));
+extern tree build_throw PARAMS ((tree));
+extern void mark_all_runtime_matches PARAMS ((void));
+extern int nothrow_libfn_p PARAMS ((tree));
+extern void check_handlers PARAMS ((tree));
+extern void choose_personality_routine PARAMS ((enum languages));
/* in expr.c */
-extern void init_cplus_expand PROTO((void));
-extern void fixup_result_decl PROTO((tree, struct rtx_def *));
-extern int extract_init PROTO((tree, tree));
-extern void do_case PROTO((tree, tree));
+extern void init_cplus_expand PARAMS ((void));
+extern int extract_init PARAMS ((tree, tree));
+extern tree cplus_expand_constant PARAMS ((tree));
/* friend.c */
-extern int is_friend PROTO((tree, tree));
-extern void make_friend_class PROTO((tree, tree));
-extern void add_friend PROTO((tree, tree));
-extern void add_friends PROTO((tree, tree, tree));
-extern tree do_friend PROTO((tree, tree, tree, tree, tree, enum overload_flags, tree, int));
+extern int is_friend PARAMS ((tree, tree));
+extern void make_friend_class PARAMS ((tree, tree));
+extern void add_friend PARAMS ((tree, tree));
+extern tree do_friend PARAMS ((tree, tree, tree, tree, tree, enum overload_flags, tree, int));
/* in init.c */
-extern void init_init_processing PROTO((void));
-extern void expand_direct_vtbls_init PROTO((tree, tree, int, int, tree));
-extern void emit_base_init PROTO((tree, int));
-extern void check_base_init PROTO((tree));
-extern void expand_member_init PROTO((tree, tree, tree));
-extern void expand_aggr_init PROTO((tree, tree, int));
-extern int is_aggr_typedef PROTO((tree, int));
-extern int is_aggr_type PROTO((tree, int));
-extern tree get_aggr_from_typedef PROTO((tree, int));
-extern tree get_type_value PROTO((tree));
-extern tree build_member_call PROTO((tree, tree, tree));
-extern tree build_offset_ref PROTO((tree, tree));
-extern tree resolve_offset_ref PROTO((tree));
-extern tree decl_constant_value PROTO((tree));
-extern tree build_new PROTO((tree, tree, tree, int));
-extern tree build_new_1 PROTO((tree));
-extern tree expand_vec_init PROTO((tree, tree, tree, tree, int));
-extern tree build_x_delete PROTO((tree, int, tree));
-extern tree build_delete PROTO((tree, tree, tree, int, int));
-extern tree build_vbase_delete PROTO((tree, tree));
-extern tree build_vec_delete PROTO((tree, tree, tree, tree, int));
-extern tree build_base_dtor_call PROTO((tree, tree, tree));
-extern void init_vlist PROTO((tree));
+extern void init_init_processing PARAMS ((void));
+extern void emit_base_init PARAMS ((tree, tree));
+extern tree expand_member_init PARAMS ((tree, tree, tree));
+extern tree build_aggr_init PARAMS ((tree, tree, int));
+extern int is_aggr_type PARAMS ((tree, int));
+extern tree get_aggr_from_typedef PARAMS ((tree, int));
+extern tree get_type_value PARAMS ((tree));
+extern tree build_member_call PARAMS ((tree, tree, tree));
+extern tree build_offset_ref PARAMS ((tree, tree));
+extern tree resolve_offset_ref PARAMS ((tree));
+extern tree build_new PARAMS ((tree, tree, tree, int));
+extern tree build_vec_init PARAMS ((tree, tree, int));
+extern tree build_x_delete PARAMS ((tree, int, tree));
+extern tree build_delete PARAMS ((tree, tree, special_function_kind, int, int));
+extern void push_base_cleanups PARAMS ((void));
+extern tree build_vbase_delete PARAMS ((tree, tree));
+extern tree build_vec_delete PARAMS ((tree, tree, special_function_kind, int));
+extern tree create_temporary_var PARAMS ((tree));
+extern void begin_init_stmts PARAMS ((tree *, tree *));
+extern tree finish_init_stmts PARAMS ((tree, tree));
+extern void initialize_vtbl_ptrs PARAMS ((tree));
+extern tree build_java_class_ref PARAMS ((tree));
/* in input.c */
/* in lex.c */
-extern char *file_name_nondirectory PROTO((const char *));
-extern tree make_pointer_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 void lang_init PROTO((void));
-extern void lang_finish PROTO((void));
-#if 0
-extern void reinit_lang_specific PROTO((void));
-#endif
-extern void reinit_parse_for_function PROTO((void));
-extern void print_parse_statistics PROTO((void));
-extern void extract_interface_info PROTO((void));
-extern void do_pending_inlines PROTO((void));
-extern void process_next_inline PROTO((tree));
-extern struct pending_input *save_pending_input PROTO((void));
-extern void restore_pending_input PROTO((struct pending_input *));
-extern void yyungetc PROTO((int, int));
-extern void reinit_parse_for_method PROTO((int, tree));
-extern void reinit_parse_for_block PROTO((int, struct obstack *));
-extern tree cons_up_default_function PROTO((tree, tree, int));
-extern void check_for_missing_semicolon PROTO((tree));
-extern void note_got_semicolon PROTO((tree));
-extern void note_list_got_semicolon PROTO((tree));
-extern void do_pending_lang_change PROTO((void));
-extern int identifier_type PROTO((tree));
-extern void see_typename PROTO((void));
-extern tree do_identifier PROTO((tree, int, tree));
-extern tree do_scoped_id PROTO((tree, int));
-extern tree identifier_typedecl_value PROTO((tree));
-extern int real_yylex PROTO((void));
-extern int is_rid PROTO((tree));
-extern tree build_lang_decl PROTO((enum tree_code, tree, tree));
-extern void retrofit_lang_decl PROTO((tree));
-extern tree build_lang_field_decl PROTO((enum tree_code, tree, tree));
-extern void copy_lang_decl PROTO((tree));
-extern tree make_lang_type PROTO((enum tree_code));
-extern void dump_time_statistics PROTO((void));
-extern void compiler_error PVPROTO((const char *, ...))
+extern tree make_pointer_declarator PARAMS ((tree, tree));
+extern tree make_reference_declarator PARAMS ((tree, tree));
+extern tree make_call_declarator PARAMS ((tree, tree, tree, tree));
+extern void set_quals_and_spec PARAMS ((tree, tree, tree));
+extern void print_parse_statistics PARAMS ((void));
+extern void do_pending_inlines PARAMS ((void));
+extern void process_next_inline PARAMS ((struct unparsed_text *));
+
+extern void yyungetc PARAMS ((int, int));
+extern void snarf_method PARAMS ((tree));
+
+extern void check_for_missing_semicolon PARAMS ((tree));
+extern void note_got_semicolon PARAMS ((tree));
+extern void note_list_got_semicolon PARAMS ((tree));
+extern void do_pending_lang_change PARAMS ((void));
+extern void see_typename PARAMS ((void));
+extern tree do_identifier PARAMS ((tree, int, tree));
+extern tree do_scoped_id PARAMS ((tree, int));
+extern tree identifier_typedecl_value PARAMS ((tree));
+extern tree build_lang_decl PARAMS ((enum tree_code, tree, tree));
+extern void retrofit_lang_decl PARAMS ((tree));
+extern tree copy_decl PARAMS ((tree));
+extern tree copy_type PARAMS ((tree));
+extern tree cp_make_lang_type PARAMS ((enum tree_code));
+extern tree make_aggr_type PARAMS ((enum tree_code));
+extern void compiler_error PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1;
-extern void yyerror PROTO((const char *));
-extern void clear_inline_text_obstack PROTO((void));
-extern void maybe_snarf_defarg PROTO((void));
-extern tree snarf_defarg PROTO((void));
-extern void add_defarg_fn PROTO((tree));
-extern void do_pending_defargs PROTO((void));
-extern int identifier_type PROTO((tree));
-extern void yyhook PROTO((int));
-extern int cp_type_qual_from_rid PROTO((tree));
+extern void yyerror PARAMS ((const char *));
+extern void clear_inline_text_obstack PARAMS ((void));
+extern void yyhook PARAMS ((int));
+extern int cp_type_qual_from_rid PARAMS ((tree));
+extern const char *cxx_init PARAMS ((const char *));
+extern void cxx_finish PARAMS ((void));
+extern void cxx_init_options PARAMS ((void));
+extern void cxx_post_options PARAMS ((void));
/* in method.c */
-extern void init_method PROTO((void));
-extern void do_inline_function_hair PROTO((tree, tree));
-extern char *build_overload_name PROTO((tree, int, int));
-extern tree build_static_name PROTO((tree, tree));
-extern tree build_decl_overload PROTO((tree, tree, int));
-extern tree build_decl_overload_real PROTO((tree, tree, tree, tree,
- tree, int));
-extern void set_mangled_name_for_decl PROTO((tree));
-extern tree build_typename_overload PROTO((tree));
-extern tree build_overload_with_type PROTO((tree, tree));
-extern tree build_destructor_name PROTO((tree, int));
-extern tree build_opfncall PROTO((enum tree_code, int, tree, tree, tree));
-extern tree hack_identifier PROTO((tree, tree));
-extern tree make_thunk PROTO((tree, int));
-extern void emit_thunk PROTO((tree));
-extern void synthesize_method PROTO((tree));
-extern tree get_id_2 PROTO((char *, tree));
-extern tree get_vlist_vtable_id PROTO((tree, tree));
-
+extern void init_method PARAMS ((void));
+extern void set_mangled_name_for_decl PARAMS ((tree));
+extern tree build_opfncall PARAMS ((enum tree_code, int, tree, tree, tree));
+extern tree hack_identifier PARAMS ((tree, tree));
+extern tree make_thunk PARAMS ((tree, tree, tree));
+extern void use_thunk PARAMS ((tree, int));
+extern void synthesize_method PARAMS ((tree));
+extern tree implicitly_declare_fn PARAMS ((special_function_kind, tree, int));
+extern tree skip_artificial_parms_for PARAMS ((tree, tree));
+
+/* In optimize.c */
+extern void optimize_function PARAMS ((tree));
+extern int calls_setjmp_p PARAMS ((tree));
+extern int maybe_clone_body PARAMS ((tree));
/* in pt.c */
-extern void check_template_shadow PROTO ((tree));
-extern tree innermost_args PROTO ((tree));
-extern tree tsubst PROTO ((tree, tree, int, tree));
-extern tree tsubst_expr PROTO ((tree, tree, int, tree));
-extern tree tsubst_copy PROTO ((tree, tree, int, tree));
-extern void maybe_begin_member_template_processing PROTO((tree));
-extern void maybe_end_member_template_processing PROTO((void));
-extern tree finish_member_template_decl PROTO((tree));
-extern void begin_template_parm_list PROTO((void));
-extern void begin_specialization PROTO((void));
-extern void reset_specialization PROTO((void));
-extern void end_specialization PROTO((void));
-extern void begin_explicit_instantiation PROTO((void));
-extern void end_explicit_instantiation PROTO((void));
-extern tree check_explicit_specialization PROTO((tree, tree, int, int));
-extern tree process_template_parm PROTO((tree, tree));
-extern tree end_template_parm_list PROTO((tree));
-extern void end_template_decl PROTO((void));
-extern tree current_template_args PROTO((void));
-extern tree push_template_decl PROTO((tree));
-extern tree push_template_decl_real PROTO((tree, int));
-extern void redeclare_class_template PROTO((tree, tree));
-extern tree lookup_template_class PROTO((tree, tree, tree, tree, int));
-extern tree lookup_template_function PROTO((tree, tree));
-extern int uses_template_parms PROTO((tree));
-extern tree instantiate_class_template PROTO((tree));
-extern tree instantiate_template PROTO((tree, tree));
-extern void overload_template_name PROTO((tree));
-extern int fn_type_unification PROTO((tree, tree, tree, tree, tree, unification_kind_t));
-struct tinst_level *tinst_for_decl PROTO((void));
-extern void mark_decl_instantiated PROTO((tree, int));
-extern int more_specialized PROTO((tree, tree, tree));
-extern void mark_class_instantiated PROTO((tree, int));
-extern void do_decl_instantiation PROTO((tree, tree, tree));
-extern void do_type_instantiation PROTO((tree, tree));
-extern tree instantiate_decl PROTO((tree));
-extern tree do_poplevel PROTO((void));
-extern tree get_bindings PROTO((tree, tree, tree));
-/* CONT ... */
-extern void add_tree PROTO((tree));
-extern void begin_tree PROTO((void));
-extern void end_tree PROTO((void));
-extern void add_maybe_template PROTO((tree, tree));
-extern void pop_tinst_level PROTO((void));
-extern int more_specialized_class PROTO((tree, tree));
-extern void do_pushlevel PROTO((void));
-extern int is_member_template PROTO((tree));
-extern int template_parms_equal PROTO((tree, tree));
-extern int comp_template_parms PROTO((tree, tree));
-extern int template_class_depth PROTO((tree));
-extern int is_specialization_of PROTO((tree, tree));
-extern int comp_template_args PROTO((tree, tree));
-extern void maybe_process_partial_specialization PROTO((tree));
-extern void maybe_check_template_type PROTO((tree));
-extern tree most_specialized_instantiation PROTO((tree, tree));
-extern void print_candidates PROTO((tree));
-extern int instantiate_pending_templates PROTO((void));
-
-extern int processing_specialization;
-extern int processing_explicit_instantiation;
+extern void init_pt PARAMS ((void));
+extern void check_template_shadow PARAMS ((tree));
+extern tree get_innermost_template_args PARAMS ((tree, int));
+extern tree tsubst PARAMS ((tree, tree, int, tree));
+extern tree tsubst_expr PARAMS ((tree, tree, int, tree));
+extern tree tsubst_copy PARAMS ((tree, tree, int, tree));
+extern void maybe_begin_member_template_processing PARAMS ((tree));
+extern void maybe_end_member_template_processing PARAMS ((void));
+extern tree finish_member_template_decl PARAMS ((tree));
+extern void begin_template_parm_list PARAMS ((void));
+extern void begin_specialization PARAMS ((void));
+extern void reset_specialization PARAMS ((void));
+extern void end_specialization PARAMS ((void));
+extern void begin_explicit_instantiation PARAMS ((void));
+extern void end_explicit_instantiation PARAMS ((void));
+extern tree check_explicit_specialization PARAMS ((tree, tree, int, int));
+extern tree process_template_parm PARAMS ((tree, tree));
+extern tree end_template_parm_list PARAMS ((tree));
+extern void end_template_decl PARAMS ((void));
+extern tree current_template_args PARAMS ((void));
+extern tree push_template_decl PARAMS ((tree));
+extern tree push_template_decl_real PARAMS ((tree, int));
+extern void redeclare_class_template PARAMS ((tree, tree));
+extern tree lookup_template_class PARAMS ((tree, tree, tree, tree, int, int));
+extern tree lookup_template_function PARAMS ((tree, tree));
+extern int uses_template_parms PARAMS ((tree));
+extern tree instantiate_class_template PARAMS ((tree));
+extern tree instantiate_template PARAMS ((tree, tree));
+extern int fn_type_unification PARAMS ((tree, tree, tree, tree, tree, unification_kind_t, int));
+extern tree tinst_for_decl PARAMS ((void));
+extern void mark_decl_instantiated PARAMS ((tree, int));
+extern int more_specialized PARAMS ((tree, tree, int, int));
+extern void mark_class_instantiated PARAMS ((tree, int));
+extern void do_decl_instantiation PARAMS ((tree, tree, tree));
+extern void do_type_instantiation PARAMS ((tree, tree, int));
+extern tree instantiate_decl PARAMS ((tree, int));
+extern tree get_bindings PARAMS ((tree, tree, tree));
+extern int push_tinst_level PARAMS ((tree));
+extern void pop_tinst_level PARAMS ((void));
+extern int more_specialized_class PARAMS ((tree, tree));
+extern int is_member_template PARAMS ((tree));
+extern int template_parms_equal PARAMS ((tree, tree));
+extern int comp_template_parms PARAMS ((tree, tree));
+extern int template_class_depth PARAMS ((tree));
+extern int is_specialization_of PARAMS ((tree, tree));
+extern int comp_template_args PARAMS ((tree, tree));
+extern void maybe_process_partial_specialization PARAMS ((tree));
+extern void maybe_check_template_type PARAMS ((tree));
+extern tree most_specialized_instantiation PARAMS ((tree));
+extern void print_candidates PARAMS ((tree));
+extern int instantiate_pending_templates PARAMS ((void));
+extern tree tsubst_default_argument PARAMS ((tree, tree, tree));
+extern tree most_general_template PARAMS ((tree));
+extern tree get_mostly_instantiated_function_type PARAMS ((tree, tree *, tree *));
+extern int problematic_instantiation_changed PARAMS ((void));
+extern void record_last_problematic_instantiation PARAMS ((void));
+extern tree current_instantiation PARAMS ((void));
extern int processing_template_parmlist;
/* in repo.c */
-extern void repo_template_used PROTO((tree));
-extern void repo_template_instantiated PROTO((tree, int));
-extern void init_repo PROTO((const char *));
-extern void finish_repo PROTO((void));
+extern void repo_template_used PARAMS ((tree));
+extern void repo_template_instantiated PARAMS ((tree, int));
+extern void init_repo PARAMS ((const char *));
+extern void finish_repo PARAMS ((void));
/* in rtti.c */
-extern void init_rtti_processing PROTO((void));
-extern tree get_tinfo_fn_dynamic PROTO((tree));
-extern tree build_typeid PROTO((tree));
-extern tree build_x_typeid PROTO((tree));
-extern tree get_tinfo_fn PROTO((tree));
-extern tree get_tinfo_fn_unused PROTO((tree));
-extern tree get_typeid PROTO((tree));
-extern tree get_typeid_1 PROTO((tree));
-extern tree build_dynamic_cast PROTO((tree, tree));
-extern void synthesize_tinfo_fn PROTO((tree));
+extern void init_rtti_processing PARAMS((void));
+extern tree build_typeid PARAMS((tree));
+extern tree get_tinfo_decl PARAMS((tree));
+extern tree get_typeid PARAMS((tree));
+extern tree build_dynamic_cast PARAMS((tree, tree));
+extern void emit_support_tinfos PARAMS((void));
+extern int tinfo_decl_p PARAMS((tree, void *));
+extern int emit_tinfo_decl PARAMS((tree *, void *));
/* in search.c */
-extern int types_overlap_p PROTO((tree, tree));
-extern tree get_vbase PROTO((tree, tree));
-extern tree get_binfo PROTO((tree, tree, int));
-extern int get_base_distance PROTO((tree, tree, int, tree *));
-extern int accessible_p PROTO((tree, tree));
-extern tree lookup_field PROTO((tree, tree, int, int));
-extern int lookup_fnfields_1 PROTO((tree, tree));
-extern tree lookup_fnfields PROTO((tree, tree, int));
-extern tree lookup_member PROTO((tree, tree, int, int));
-extern tree lookup_nested_tag PROTO((tree, tree));
-extern tree get_matching_virtual PROTO((tree, tree, int));
-extern tree get_abstract_virtuals PROTO((tree));
-extern tree init_vbase_pointers PROTO((tree, tree));
-extern void expand_indirect_vtbls_init PROTO((tree, tree, tree));
-extern void clear_search_slots PROTO((tree));
-extern tree get_vbase_types PROTO((tree));
-extern void note_debug_info_needed PROTO((tree));
-extern void push_class_decls PROTO((tree));
-extern void pop_class_decls PROTO((void));
-extern void unuse_fields PROTO((tree));
-extern void print_search_statistics PROTO((void));
-extern void init_search_processing PROTO((void));
-extern void reinit_search_statistics PROTO((void));
-extern tree current_scope PROTO((void));
-extern tree lookup_conversions PROTO((tree));
-extern tree binfo_for_vtable PROTO((tree));
-extern tree dfs_walk PROTO((tree,
- tree (*)(tree, void *),
+extern tree lookup_base PARAMS ((tree, tree, base_access, base_kind *));
+extern int types_overlap_p PARAMS ((tree, tree));
+extern tree get_vbase PARAMS ((tree, tree));
+extern tree get_dynamic_cast_base_type PARAMS ((tree, tree));
+extern void type_access_control PARAMS ((tree, tree));
+extern void skip_type_access_control PARAMS ((void));
+extern void reset_type_access_control PARAMS ((void));
+extern int accessible_p PARAMS ((tree, tree));
+extern tree lookup_field PARAMS ((tree, tree, int, int));
+extern int lookup_fnfields_1 PARAMS ((tree, tree));
+extern tree lookup_fnfields PARAMS ((tree, tree, int));
+extern tree lookup_member PARAMS ((tree, tree, int, int));
+extern int look_for_overrides PARAMS ((tree, tree));
+extern void get_pure_virtuals PARAMS ((tree));
+extern void get_vbase_types PARAMS ((tree));
+extern void maybe_suppress_debug_info PARAMS ((tree));
+extern void note_debug_info_needed PARAMS ((tree));
+extern void push_class_decls PARAMS ((tree));
+extern void pop_class_decls PARAMS ((void));
+extern void unuse_fields PARAMS ((tree));
+extern void print_search_statistics PARAMS ((void));
+extern void init_search_processing PARAMS ((void));
+extern void reinit_search_statistics PARAMS ((void));
+extern tree current_scope PARAMS ((void));
+extern int at_function_scope_p PARAMS ((void));
+extern tree context_for_name_lookup PARAMS ((tree));
+extern tree lookup_conversions PARAMS ((tree));
+extern tree binfo_for_vtable PARAMS ((tree));
+extern tree binfo_from_vbase PARAMS ((tree));
+extern tree look_for_overrides_here PARAMS ((tree, tree));
+extern tree dfs_walk PARAMS ((tree,
+ tree (*) (tree, void *),
+ tree (*) (tree, void *),
+ void *));
+extern tree dfs_walk_real PARAMS ((tree,
+ tree (*) (tree, void *),
+ tree (*) (tree, void *),
tree (*) (tree, void *),
void *));
-extern tree dfs_unmark PROTO((tree, void *));
-extern tree markedp PROTO((tree, void *));
+extern tree dfs_unmark PARAMS ((tree, void *));
+extern tree markedp PARAMS ((tree, void *));
+extern tree unmarkedp PARAMS ((tree, void *));
+extern tree dfs_skip_nonprimary_vbases_unmarkedp PARAMS ((tree, void *));
+extern tree dfs_skip_nonprimary_vbases_markedp PARAMS ((tree, void *));
+extern tree dfs_unmarked_real_bases_queue_p PARAMS ((tree, void *));
+extern tree dfs_marked_real_bases_queue_p PARAMS ((tree, void *));
+extern tree dfs_skip_vbases PARAMS ((tree, void *));
+extern tree marked_vtable_pathp PARAMS ((tree, void *));
+extern tree unmarked_vtable_pathp PARAMS ((tree, void *));
+extern tree find_vbase_instance PARAMS ((tree, tree));
+extern tree binfo_for_vbase PARAMS ((tree, tree));
+extern tree binfo_via_virtual PARAMS ((tree, tree));
/* in semantics.c */
-extern void finish_expr_stmt PROTO((tree));
-extern tree begin_if_stmt PROTO((void));
-extern void finish_if_stmt_cond PROTO((tree, tree));
-extern tree finish_then_clause PROTO((tree));
-extern void begin_else_clause PROTO((void));
-extern void finish_else_clause PROTO((tree));
-extern void finish_if_stmt PROTO((void));
-extern tree begin_while_stmt PROTO((void));
-extern void finish_while_stmt_cond PROTO((tree, tree));
-extern void finish_while_stmt PROTO((tree));
-extern tree begin_do_stmt PROTO((void));
-extern void finish_do_body PROTO((tree));
-extern void finish_do_stmt PROTO((tree, tree));
-extern void finish_return_stmt PROTO((tree));
-extern tree begin_for_stmt PROTO((void));
-extern void finish_for_init_stmt PROTO((tree));
-extern void finish_for_cond PROTO((tree, tree));
-extern void finish_for_expr PROTO((tree, tree));
-extern void finish_for_stmt PROTO((tree, tree));
-extern void finish_break_stmt PROTO((void));
-extern void finish_continue_stmt PROTO((void));
-extern void begin_switch_stmt PROTO((void));
-extern tree finish_switch_cond PROTO((tree));
-extern void finish_switch_stmt PROTO((tree, tree));
-extern void finish_case_label PROTO((tree, tree));
-extern void finish_goto_stmt PROTO((tree));
-extern tree begin_try_block PROTO((void));
-extern void finish_try_block PROTO((tree));
-extern void finish_handler_sequence PROTO((tree));
-extern tree begin_handler PROTO((void));
-extern void finish_handler_parms PROTO((tree));
-extern void finish_handler PROTO((tree));
-extern tree begin_compound_stmt PROTO((int));
-extern tree finish_compound_stmt PROTO((int, tree));
-extern void finish_asm_stmt PROTO((tree, tree, tree, tree, tree));
-extern tree finish_parenthesized_expr PROTO((tree));
-extern tree begin_stmt_expr PROTO((void));
-extern tree finish_stmt_expr PROTO((tree, tree));
-extern tree finish_call_expr PROTO((tree, tree, int));
-extern tree finish_increment_expr PROTO((tree, enum tree_code));
-extern tree finish_this_expr PROTO((void));
-extern tree finish_object_call_expr PROTO((tree, tree, tree));
-extern tree finish_qualified_object_call_expr PROTO((tree, tree, tree));
-extern tree finish_pseudo_destructor_call_expr PROTO((tree, tree, tree));
-extern tree finish_qualified_call_expr PROTO ((tree, tree));
-extern tree finish_label_address_expr PROTO((tree));
-extern tree finish_unary_op_expr PROTO((enum tree_code, tree));
-extern tree finish_id_expr PROTO((tree));
-extern int begin_new_placement PROTO((void));
-extern tree finish_new_placement PROTO((tree, int));
-extern int begin_function_definition PROTO((tree, tree));
-extern tree begin_constructor_declarator PROTO((tree, tree));
-extern tree finish_declarator PROTO((tree, tree, tree, tree, int));
-extern void finish_translation_unit PROTO((void));
-extern tree finish_template_type_parm PROTO((tree, tree));
-extern tree finish_template_template_parm PROTO((tree, tree));
-extern tree finish_parmlist PROTO((tree, int));
-extern tree begin_class_definition PROTO((tree));
-extern tree finish_class_definition PROTO((tree, tree, int, int));
-extern void finish_default_args PROTO((void));
-extern void begin_inline_definitions PROTO((void));
-extern void finish_inline_definitions PROTO((void));
-extern tree finish_member_class_template PROTO((tree));
-extern void finish_template_decl PROTO((tree));
-extern tree finish_template_type PROTO((tree, tree, int));
-extern void enter_scope_of PROTO((tree));
-extern tree finish_base_specifier PROTO((tree, tree, int));
-extern void finish_member_declaration PROTO((tree));
-extern void check_multiple_declarators PROTO((void));
-extern tree finish_typeof PROTO((tree));
-
-/* in sig.c */
-extern tree build_signature_pointer_type PROTO((tree));
-extern tree build_signature_reference_type PROTO((tree));
-extern tree build_signature_pointer_constructor PROTO((tree, tree));
-extern tree build_signature_method_call PROTO((tree, tree));
-extern tree build_optr_ref PROTO((tree));
-extern void append_signature_fields PROTO((tree));
+extern void init_cp_semantics PARAMS ((void));
+extern tree finish_expr_stmt PARAMS ((tree));
+extern tree begin_if_stmt PARAMS ((void));
+extern void finish_if_stmt_cond PARAMS ((tree, tree));
+extern tree finish_then_clause PARAMS ((tree));
+extern void begin_else_clause PARAMS ((void));
+extern void finish_else_clause PARAMS ((tree));
+extern void finish_if_stmt PARAMS ((void));
+extern tree begin_while_stmt PARAMS ((void));
+extern void finish_while_stmt_cond PARAMS ((tree, tree));
+extern void finish_while_stmt PARAMS ((tree));
+extern tree begin_do_stmt PARAMS ((void));
+extern void finish_do_body PARAMS ((tree));
+extern void finish_do_stmt PARAMS ((tree, tree));
+extern tree finish_return_stmt PARAMS ((tree));
+extern tree begin_for_stmt PARAMS ((void));
+extern void finish_for_init_stmt PARAMS ((tree));
+extern void finish_for_cond PARAMS ((tree, tree));
+extern void finish_for_expr PARAMS ((tree, tree));
+extern void finish_for_stmt PARAMS ((tree));
+extern tree finish_break_stmt PARAMS ((void));
+extern tree finish_continue_stmt PARAMS ((void));
+extern tree begin_switch_stmt PARAMS ((void));
+extern void finish_switch_cond PARAMS ((tree, tree));
+extern void finish_switch_stmt PARAMS ((tree));
+extern tree finish_case_label PARAMS ((tree, tree));
+extern tree finish_goto_stmt PARAMS ((tree));
+extern tree begin_try_block PARAMS ((void));
+extern void finish_try_block PARAMS ((tree));
+extern tree begin_eh_spec_block PARAMS ((void));
+extern void finish_eh_spec_block PARAMS ((tree, tree));
+extern void finish_handler_sequence PARAMS ((tree));
+extern tree begin_function_try_block PARAMS ((void));
+extern void finish_function_try_block PARAMS ((tree));
+extern void finish_function_handler_sequence PARAMS ((tree));
+extern void finish_cleanup_try_block PARAMS ((tree));
+extern tree begin_handler PARAMS ((void));
+extern void finish_handler_parms PARAMS ((tree, tree));
+extern void begin_catch_block PARAMS ((tree));
+extern void finish_handler PARAMS ((tree));
+extern void finish_cleanup PARAMS ((tree, tree));
+extern tree begin_compound_stmt PARAMS ((int));
+extern tree finish_compound_stmt PARAMS ((int, tree));
+extern tree finish_asm_stmt PARAMS ((tree, tree, tree, tree, tree));
+extern void finish_label_stmt PARAMS ((tree));
+extern void finish_label_decl PARAMS ((tree));
+extern void finish_subobject PARAMS ((tree));
+extern tree finish_parenthesized_expr PARAMS ((tree));
+extern tree begin_stmt_expr PARAMS ((void));
+extern tree finish_stmt_expr PARAMS ((tree));
+extern tree finish_call_expr PARAMS ((tree, tree, int));
+extern tree finish_increment_expr PARAMS ((tree, enum tree_code));
+extern tree finish_this_expr PARAMS ((void));
+extern tree finish_object_call_expr PARAMS ((tree, tree, tree));
+extern tree finish_qualified_object_call_expr PARAMS ((tree, tree, tree));
+extern tree finish_pseudo_destructor_call_expr PARAMS ((tree, tree, tree));
+extern tree finish_qualified_call_expr PARAMS ((tree, tree));
+extern tree finish_unary_op_expr PARAMS ((enum tree_code, tree));
+extern tree finish_id_expr PARAMS ((tree));
+extern void save_type_access_control PARAMS ((tree));
+extern void decl_type_access_control PARAMS ((tree));
+extern int begin_function_definition PARAMS ((tree, tree));
+extern tree begin_constructor_declarator PARAMS ((tree, tree));
+extern tree finish_declarator PARAMS ((tree, tree, tree, tree, int));
+extern void finish_translation_unit PARAMS ((void));
+extern tree finish_template_type_parm PARAMS ((tree, tree));
+extern tree finish_template_template_parm PARAMS ((tree, tree));
+extern tree finish_parmlist PARAMS ((tree, int));
+extern tree begin_class_definition PARAMS ((tree));
+extern tree finish_class_definition PARAMS ((tree, tree, int, int));
+extern void finish_default_args PARAMS ((void));
+extern void begin_inline_definitions PARAMS ((void));
+extern void finish_inline_definitions PARAMS ((void));
+extern tree finish_member_class_template PARAMS ((tree));
+extern void finish_template_decl PARAMS ((tree));
+extern tree finish_template_type PARAMS ((tree, tree, int));
+extern void enter_scope_of PARAMS ((tree));
+extern tree finish_base_specifier PARAMS ((tree, tree));
+extern void finish_member_declaration PARAMS ((tree));
+extern void check_multiple_declarators PARAMS ((void));
+extern tree finish_typeof PARAMS ((tree));
+extern tree finish_sizeof PARAMS ((tree));
+extern tree finish_alignof PARAMS ((tree));
+extern void finish_decl_cleanup PARAMS ((tree, tree));
+extern void finish_named_return_value PARAMS ((tree, tree));
+extern void expand_body PARAMS ((tree));
+extern tree nullify_returns_r PARAMS ((tree *, int *, void *));
+extern void do_pushlevel PARAMS ((void));
+extern tree do_poplevel PARAMS ((void));
+extern void finish_mem_initializers PARAMS ((tree));
+extern void setup_vtbl_ptr PARAMS ((tree, tree));
+extern void clear_out_block PARAMS ((void));
+extern tree begin_global_stmt_expr PARAMS ((void));
+extern tree finish_global_stmt_expr PARAMS ((tree));
+
/* in spew.c */
-extern void init_spew PROTO((void));
-extern int peekyylex PROTO((void));
-extern int yylex PROTO((void));
-extern tree arbitrate_lookup PROTO((tree, tree, tree));
+extern void init_spew PARAMS ((void));
+extern void mark_pending_inlines PARAMS ((PTR));
+extern int peekyylex PARAMS ((void));
+extern tree arbitrate_lookup PARAMS ((tree, tree, tree));
+extern tree frob_opname PARAMS ((tree));
+extern void maybe_snarf_defarg PARAMS ((void));
+extern void add_defarg_fn PARAMS ((tree));
+extern void do_pending_defargs PARAMS ((void));
+extern void done_pending_defargs PARAMS ((void));
+extern void unprocessed_defarg_fn PARAMS ((tree));
+extern void replace_defarg PARAMS ((tree, tree));
+extern void end_input PARAMS ((void));
/* in tree.c */
-extern int pod_type_p PROTO((tree));
-extern void unshare_base_binfos PROTO((tree));
-extern int member_p PROTO((tree));
-extern int real_lvalue_p PROTO((tree));
-extern tree build_min PVPROTO((enum tree_code, tree, ...));
-extern tree build_min_nt PVPROTO((enum tree_code, ...));
-extern tree min_tree_cons PROTO((tree, tree, tree));
-extern int lvalue_p PROTO((tree));
-extern int lvalue_or_else PROTO((tree, const char *));
-extern tree build_cplus_new PROTO((tree, tree));
-extern tree get_target_expr PROTO((tree));
-extern tree break_out_cleanups PROTO((tree));
-extern tree break_out_calls PROTO((tree));
-extern tree build_cplus_method_type PROTO((tree, tree, tree));
-extern tree build_cplus_staticfn_type PROTO((tree, tree, tree));
-extern tree build_cplus_array_type PROTO((tree, tree));
-extern int layout_basetypes PROTO((tree, int));
-extern tree build_vbase_pointer_fields PROTO((tree));
-extern tree build_base_fields PROTO((tree));
-extern tree hash_tree_cons PROTO((tree, tree, tree));
-extern tree hash_tree_chain PROTO((tree, tree));
-extern tree hash_chainon PROTO((tree, tree));
-extern tree make_binfo PROTO((tree, tree, tree, tree));
-extern tree binfo_value PROTO((tree, tree));
-extern tree reverse_path PROTO((tree));
-extern int count_functions PROTO((tree));
-extern int is_overloaded_fn PROTO((tree));
-extern tree get_first_fn PROTO((tree));
-extern tree binding_init PROTO((struct tree_binding*));
-extern int bound_pmf_p PROTO((tree));
-extern tree ovl_cons PROTO((tree, tree));
-extern tree scratch_ovl_cons PROTO((tree, tree));
-extern int ovl_member PROTO((tree, tree));
-extern tree build_overload PROTO((tree, tree));
-extern tree fnaddr_from_vtable_entry PROTO((tree));
-extern tree function_arg_chain PROTO((tree));
-extern int promotes_to_aggr_type PROTO((tree, enum tree_code));
-extern int is_aggr_type_2 PROTO((tree, tree));
-extern char *lang_printable_name PROTO((tree, int));
-extern tree build_exception_variant PROTO((tree, tree));
-extern tree copy_template_template_parm PROTO((tree));
-extern tree copy_to_permanent PROTO((tree));
-extern tree permanent_p PROTO((tree));
-extern void print_lang_statistics PROTO((void));
-extern void __eprintf
- PROTO((const char *, const char *, unsigned, const char *));
-extern tree array_type_nelts_total PROTO((tree));
-extern tree array_type_nelts_top PROTO((tree));
-extern tree break_out_target_exprs PROTO((tree));
-extern tree get_type_decl PROTO((tree));
-extern tree vec_binfo_member PROTO((tree, tree));
-extern tree hack_decl_function_context PROTO((tree));
-extern tree decl_namespace_context PROTO((tree));
-extern tree lvalue_type PROTO((tree));
-extern tree error_type PROTO((tree));
-extern tree make_temp_vec PROTO((int));
-extern tree build_ptr_wrapper PROTO((void *));
-extern tree build_expr_ptr_wrapper PROTO((void *));
-extern tree build_int_wrapper PROTO((int));
-extern tree build_srcloc_here PROTO((void));
-extern int varargs_function_p PROTO((tree));
-extern int really_overloaded_fn PROTO((tree));
-extern int cp_tree_equal PROTO((tree, tree));
-extern int can_free PROTO((struct obstack *, tree));
-extern tree mapcar PROTO((tree, tree (*) (tree)));
-extern tree no_linkage_check PROTO((tree));
-extern void debug_binfo PROTO((tree));
-extern void push_expression_obstack PROTO((void));
-extern tree build_dummy_object PROTO((tree));
-extern tree maybe_dummy_object PROTO((tree, tree *));
-extern int is_dummy_object PROTO((tree));
-extern tree search_tree PROTO((tree, tree (*)(tree)));
-extern int cp_valid_lang_attribute PROTO((tree, tree, tree, tree));
-extern tree make_ptrmem_cst PROTO((tree, tree));
-
-#define scratchalloc expralloc
-#define scratch_tree_cons expr_tree_cons
-#define build_scratch_list build_expr_list
-#define make_scratch_vec make_temp_vec
-#define push_scratch_obstack push_expression_obstack
+extern void init_tree PARAMS ((void));
+extern int pod_type_p PARAMS ((tree));
+extern tree canonical_type_variant PARAMS ((tree));
+extern void unshare_base_binfos PARAMS ((tree));
+extern int member_p PARAMS ((tree));
+extern cp_lvalue_kind real_lvalue_p PARAMS ((tree));
+extern tree build_min PARAMS ((enum tree_code, tree, ...));
+extern tree build_min_nt PARAMS ((enum tree_code, ...));
+extern tree build_cplus_new PARAMS ((tree, tree));
+extern tree get_target_expr PARAMS ((tree));
+extern tree break_out_calls PARAMS ((tree));
+extern tree build_cplus_method_type PARAMS ((tree, tree, tree));
+extern tree build_cplus_staticfn_type PARAMS ((tree, tree, tree));
+extern tree build_cplus_array_type PARAMS ((tree, tree));
+extern tree hash_tree_cons PARAMS ((tree, tree, tree));
+extern tree hash_tree_chain PARAMS ((tree, tree));
+extern tree hash_chainon PARAMS ((tree, tree));
+extern tree make_binfo PARAMS ((tree, tree, tree, tree));
+extern tree reverse_path PARAMS ((tree));
+extern int count_functions PARAMS ((tree));
+extern int is_overloaded_fn PARAMS ((tree));
+extern tree get_first_fn PARAMS ((tree));
+extern int bound_pmf_p PARAMS ((tree));
+extern tree ovl_cons PARAMS ((tree, tree));
+extern tree build_overload PARAMS ((tree, tree));
+extern tree function_arg_chain PARAMS ((tree));
+extern int promotes_to_aggr_type PARAMS ((tree, enum tree_code));
+extern int is_aggr_type_2 PARAMS ((tree, tree));
+extern const char *lang_printable_name PARAMS ((tree, int));
+extern tree build_exception_variant PARAMS ((tree, tree));
+extern tree bind_template_template_parm PARAMS ((tree, tree));
+extern tree array_type_nelts_total PARAMS ((tree));
+extern tree array_type_nelts_top PARAMS ((tree));
+extern tree break_out_target_exprs PARAMS ((tree));
+extern tree get_type_decl PARAMS ((tree));
+extern tree vec_binfo_member PARAMS ((tree, tree));
+extern tree decl_namespace_context PARAMS ((tree));
+extern tree lvalue_type PARAMS ((tree));
+extern tree error_type PARAMS ((tree));
+extern tree build_ptr_wrapper PARAMS ((void *));
+extern tree build_int_wrapper PARAMS ((int));
+extern tree build_srcloc_here PARAMS ((void));
+extern int varargs_function_p PARAMS ((tree));
+extern int really_overloaded_fn PARAMS ((tree));
+extern int cp_tree_equal PARAMS ((tree, tree));
+extern tree no_linkage_check PARAMS ((tree));
+extern void debug_binfo PARAMS ((tree));
+extern tree build_dummy_object PARAMS ((tree));
+extern tree maybe_dummy_object PARAMS ((tree, tree *));
+extern int is_dummy_object PARAMS ((tree));
+extern const struct attribute_spec cp_attribute_table[];
+extern tree make_ptrmem_cst PARAMS ((tree, tree));
+extern tree cp_build_qualified_type_real PARAMS ((tree, int, int));
+#define cp_build_qualified_type(TYPE, QUALS) \
+ cp_build_qualified_type_real ((TYPE), (QUALS), /*complain=*/1)
+extern tree build_shared_int_cst PARAMS ((int));
+extern special_function_kind special_function_p PARAMS ((tree));
+extern int count_trees PARAMS ((tree));
+extern int char_type_p PARAMS ((tree));
+extern void verify_stmt_tree PARAMS ((tree));
+extern tree find_tree PARAMS ((tree, tree));
+extern linkage_kind decl_linkage PARAMS ((tree));
+extern tree cp_walk_subtrees PARAMS ((tree*, int*, walk_tree_fn,
+ void*, void*));
+extern int cp_cannot_inline_tree_fn PARAMS ((tree*));
+extern tree cp_add_pending_fn_decls PARAMS ((void*,tree));
+extern int cp_is_overload_p PARAMS ((tree));
+extern int cp_auto_var_in_fn_p PARAMS ((tree,tree));
+extern tree cp_copy_res_decl_for_inlining PARAMS ((tree, tree, tree, void*,
+ int*, void*));
+extern int cp_start_inlining PARAMS ((tree));
+extern void cp_end_inlining PARAMS ((tree));
/* in typeck.c */
-extern int string_conv_p PROTO((tree, tree, int));
-extern tree condition_conversion PROTO((tree));
-extern tree target_type PROTO((tree));
-extern tree require_complete_type PROTO((tree));
-extern tree require_complete_type_in_void PROTO((tree));
-extern tree complete_type PROTO((tree));
-extern tree complete_type_or_else PROTO((tree, tree));
-extern int type_unknown_p PROTO((tree));
-extern int fntype_p PROTO((tree));
-extern tree commonparms PROTO((tree, tree));
-extern tree original_type PROTO((tree));
-extern tree common_type PROTO((tree, tree));
-extern int compexcepttypes PROTO((tree, tree));
-extern int comptypes PROTO((tree, tree, int));
-extern int comp_target_types PROTO((tree, tree, int));
-extern int compparms PROTO((tree, tree));
-extern int comp_target_types PROTO((tree, tree, int));
-extern int comp_cv_qualification PROTO((tree, tree));
-extern int comp_cv_qual_signature PROTO((tree, tree));
-extern int self_promoting_args_p PROTO((tree));
-extern tree unsigned_type PROTO((tree));
-extern tree signed_type PROTO((tree));
-extern tree signed_or_unsigned_type PROTO((int, tree));
-extern tree expr_sizeof PROTO((tree));
-extern tree c_sizeof PROTO((tree));
-extern tree c_sizeof_nowarn PROTO((tree));
-extern tree c_alignof PROTO((tree));
-extern tree inline_conversion PROTO((tree));
-extern tree decay_conversion PROTO((tree));
-extern tree default_conversion PROTO((tree));
-extern tree build_object_ref PROTO((tree, tree, tree));
-extern tree build_component_ref_1 PROTO((tree, tree, int));
-extern tree build_component_ref PROTO((tree, tree, tree, int));
-extern tree build_x_component_ref PROTO((tree, tree, tree, int));
-extern tree build_x_indirect_ref PROTO((tree, const char *));
-extern tree build_indirect_ref PROTO((tree, const char *));
-extern tree build_array_ref PROTO((tree, tree));
-extern tree build_x_function_call PROTO((tree, tree, tree));
-extern tree get_member_function_from_ptrfunc PROTO((tree *, tree));
-extern tree build_function_call_real PROTO((tree, tree, int, int));
-extern tree build_function_call PROTO((tree, tree));
-extern tree build_function_call_maybe PROTO((tree, tree));
-extern tree convert_arguments PROTO((tree, tree, tree, int));
-extern tree build_x_binary_op PROTO((enum tree_code, tree, tree));
-extern tree build_binary_op PROTO((enum tree_code, tree, tree));
-extern tree build_binary_op_nodefault PROTO((enum tree_code, tree, tree, enum tree_code));
-extern tree build_x_unary_op PROTO((enum tree_code, tree));
-extern tree build_unary_op PROTO((enum tree_code, tree, int));
-extern tree unary_complex_lvalue PROTO((enum tree_code, tree));
-extern int mark_addressable PROTO((tree));
-extern tree build_x_conditional_expr PROTO((tree, tree, tree));
-extern tree build_conditional_expr PROTO((tree, tree, tree));
-extern tree build_x_compound_expr PROTO((tree));
-extern tree build_compound_expr PROTO((tree));
-extern tree build_static_cast PROTO((tree, tree));
-extern tree build_reinterpret_cast PROTO((tree, tree));
-extern tree build_const_cast PROTO((tree, tree));
-extern tree build_c_cast PROTO((tree, tree));
-extern tree build_x_modify_expr PROTO((tree, enum tree_code, tree));
-extern tree build_modify_expr PROTO((tree, enum tree_code, tree));
-extern tree convert_for_initialization PROTO((tree, tree, tree, int, const char *, tree, int));
-extern void c_expand_asm_operands PROTO((tree, tree, tree, tree, int, char *, int));
-extern void c_expand_return PROTO((tree));
-extern tree c_expand_start_case PROTO((tree));
-extern int comp_ptr_ttypes PROTO((tree, tree));
-extern int ptr_reasonably_similar PROTO((tree, tree));
-extern tree build_ptrmemfunc PROTO((tree, tree, int));
-extern int cp_type_quals PROTO((tree));
-extern int cp_has_mutable_p PROTO((tree));
-extern int at_least_as_qualified_p PROTO((tree, tree));
-extern int more_qualified_p PROTO((tree, tree));
-extern tree build_ptrmemfunc1 PROTO((tree, tree, tree, tree, tree));
-extern void expand_ptrmemfunc_cst PROTO((tree, tree *, tree *, tree *, tree *));
-extern tree delta2_from_ptrmemfunc PROTO((tree));
-extern tree pfn_from_ptrmemfunc PROTO((tree));
+extern int string_conv_p PARAMS ((tree, tree, int));
+extern tree cp_truthvalue_conversion PARAMS ((tree));
+extern tree condition_conversion PARAMS ((tree));
+extern tree target_type PARAMS ((tree));
+extern tree require_complete_type PARAMS ((tree));
+extern tree complete_type PARAMS ((tree));
+extern tree complete_type_or_else PARAMS ((tree, tree));
+extern int type_unknown_p PARAMS ((tree));
+extern tree commonparms PARAMS ((tree, tree));
+extern tree original_type PARAMS ((tree));
+extern int comp_except_specs PARAMS ((tree, tree, int));
+extern int comptypes PARAMS ((tree, tree, int));
+extern int comp_target_types PARAMS ((tree, tree, int));
+extern int compparms PARAMS ((tree, tree));
+extern int comp_cv_qualification PARAMS ((tree, tree));
+extern int comp_cv_qual_signature PARAMS ((tree, tree));
+extern tree expr_sizeof PARAMS ((tree));
+extern tree c_sizeof_nowarn PARAMS ((tree));
+extern tree inline_conversion PARAMS ((tree));
+extern tree decay_conversion PARAMS ((tree));
+extern tree build_object_ref PARAMS ((tree, tree, tree));
+extern tree build_component_ref_1 PARAMS ((tree, tree, int));
+extern tree build_component_ref PARAMS ((tree, tree, tree, int));
+extern tree build_x_component_ref PARAMS ((tree, tree, tree, int));
+extern tree build_x_indirect_ref PARAMS ((tree, const char *));
+extern tree build_indirect_ref PARAMS ((tree, const char *));
+extern tree build_array_ref PARAMS ((tree, tree));
+extern tree build_x_function_call PARAMS ((tree, tree, tree));
+extern tree get_member_function_from_ptrfunc PARAMS ((tree *, tree));
+extern tree build_function_call_real PARAMS ((tree, tree, int, int));
+extern tree build_function_call_maybe PARAMS ((tree, tree));
+extern tree convert_arguments PARAMS ((tree, tree, tree, int));
+extern tree build_x_binary_op PARAMS ((enum tree_code, tree, tree));
+extern tree build_x_unary_op PARAMS ((enum tree_code, tree));
+extern tree unary_complex_lvalue PARAMS ((enum tree_code, tree));
+extern tree build_x_conditional_expr PARAMS ((tree, tree, tree));
+extern tree build_x_compound_expr PARAMS ((tree));
+extern tree build_compound_expr PARAMS ((tree));
+extern tree build_static_cast PARAMS ((tree, tree));
+extern tree build_reinterpret_cast PARAMS ((tree, tree));
+extern tree build_const_cast PARAMS ((tree, tree));
+extern tree build_c_cast PARAMS ((tree, tree));
+extern tree build_x_modify_expr PARAMS ((tree, enum tree_code, tree));
+extern tree build_modify_expr PARAMS ((tree, enum tree_code, tree));
+extern tree dubious_conversion_warnings PARAMS ((tree, tree, const char *, tree, int));
+extern tree convert_for_initialization PARAMS ((tree, tree, tree, int, const char *, tree, int));
+extern int comp_ptr_ttypes PARAMS ((tree, tree));
+extern int ptr_reasonably_similar PARAMS ((tree, tree));
+extern tree build_ptrmemfunc PARAMS ((tree, tree, int));
+extern int cp_type_quals PARAMS ((tree));
+extern int cp_has_mutable_p PARAMS ((tree));
+extern int at_least_as_qualified_p PARAMS ((tree, tree));
+extern int more_qualified_p PARAMS ((tree, tree));
+extern tree build_ptrmemfunc1 PARAMS ((tree, tree, tree));
+extern void expand_ptrmemfunc_cst PARAMS ((tree, tree *, tree *));
+extern tree pfn_from_ptrmemfunc PARAMS ((tree));
+extern tree type_after_usual_arithmetic_conversions PARAMS ((tree, tree));
+extern tree composite_pointer_type PARAMS ((tree, tree, tree, tree,
+ const char*));
+extern tree check_return_expr PARAMS ((tree));
+#define cp_build_binary_op(code, arg1, arg2) \
+ build_binary_op(code, arg1, arg2, 1)
/* in typeck2.c */
-extern tree error_not_base_type PROTO((tree, tree));
-extern tree binfo_or_else PROTO((tree, tree));
-extern void readonly_error PROTO((tree, const char *, int));
-extern void abstract_virtuals_error PROTO((tree, tree));
-extern void signature_error PROTO((tree, tree));
-extern void incomplete_type_error PROTO((tree, tree));
-extern void my_friendly_abort PROTO((int))
- ATTRIBUTE_NORETURN;
-extern void my_friendly_assert PROTO((int, int));
-extern tree store_init_value PROTO((tree, tree));
-extern tree digest_init PROTO((tree, tree, tree *));
-extern tree build_scoped_ref PROTO((tree, tree));
-extern tree build_x_arrow PROTO((tree));
-extern tree build_m_component_ref PROTO((tree, tree));
-extern tree build_functional_cast PROTO((tree, tree));
-extern char *enum_name_string PROTO((tree, tree));
-extern void report_case_error PROTO((int, tree, tree, tree));
-extern void check_for_new_type PROTO((const char *, flagged_type_tree));
-extern tree initializer_constant_valid_p PROTO((tree, tree));
+extern tree error_not_base_type PARAMS ((tree, tree));
+extern tree binfo_or_else PARAMS ((tree, tree));
+extern void readonly_error PARAMS ((tree, const char *, int));
+extern int abstract_virtuals_error PARAMS ((tree, tree));
+
+#define my_friendly_assert(EXP, N) (void) \
+ (((EXP) == 0) ? (fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0) : 0)
+
+extern tree store_init_value PARAMS ((tree, tree));
+extern tree digest_init PARAMS ((tree, tree, tree *));
+extern tree build_scoped_ref PARAMS ((tree, tree));
+extern tree build_x_arrow PARAMS ((tree));
+extern tree build_m_component_ref PARAMS ((tree, tree));
+extern tree build_functional_cast PARAMS ((tree, tree));
+extern void check_for_new_type PARAMS ((const char *, flagged_type_tree));
+extern tree add_exception_specifier PARAMS ((tree, tree, int));
+extern tree merge_exception_specifiers PARAMS ((tree, tree));
/* in xref.c */
-extern void GNU_xref_begin PROTO((const char *));
-extern void GNU_xref_end PROTO((int));
-extern void GNU_xref_file PROTO((const char *));
-extern void GNU_xref_start_scope PROTO((HOST_WIDE_INT));
-extern void GNU_xref_end_scope PROTO((HOST_WIDE_INT, HOST_WIDE_INT, int, int));
-extern void GNU_xref_ref PROTO((tree, const char *));
-extern void GNU_xref_decl PROTO((tree, tree));
-extern void GNU_xref_call PROTO((tree, const char *));
-extern void GNU_xref_function PROTO((tree, tree));
-extern void GNU_xref_assign PROTO((tree));
-extern void GNU_xref_hier PROTO((tree, tree, int, int, int));
-extern void GNU_xref_member PROTO((tree, tree));
+extern void GNU_xref_begin PARAMS ((const char *));
+extern void GNU_xref_end PARAMS ((int));
+extern void GNU_xref_file PARAMS ((const char *));
+extern void GNU_xref_start_scope PARAMS ((HOST_WIDE_INT));
+extern void GNU_xref_end_scope PARAMS ((HOST_WIDE_INT, HOST_WIDE_INT, int, int));
+extern void GNU_xref_ref PARAMS ((tree, const char *));
+extern void GNU_xref_decl PARAMS ((tree, tree));
+extern void GNU_xref_call PARAMS ((tree, const char *));
+extern void GNU_xref_function PARAMS ((tree, tree));
+extern void GNU_xref_assign PARAMS ((tree));
+extern void GNU_xref_hier PARAMS ((tree, tree, int, int, int));
+extern void GNU_xref_member PARAMS ((tree, tree));
+
+/* in mangle.c */
+extern void init_mangle PARAMS ((void));
+extern void mangle_decl PARAMS ((tree));
+extern const char *mangle_type_string PARAMS ((tree));
+extern tree mangle_type PARAMS ((tree));
+extern tree mangle_typeinfo_for_type PARAMS ((tree));
+extern tree mangle_typeinfo_string_for_type PARAMS ((tree));
+extern tree mangle_vtbl_for_type PARAMS ((tree));
+extern tree mangle_vtt_for_type PARAMS ((tree));
+extern tree mangle_ctor_vtbl_for_type PARAMS ((tree, tree));
+extern tree mangle_thunk PARAMS ((tree, tree, tree));
+extern tree mangle_conv_op_name_for_type PARAMS ((tree));
+extern tree mangle_guard_variable PARAMS ((tree));
+extern tree mangle_ref_init_variable PARAMS ((tree));
+
+/* in dump.c */
+extern int cp_dump_tree PARAMS ((void *, tree));
/* -- end of C++ */
-#endif /* not _CP_TREE_H */
+#endif /* ! GCC_CP_TREE_H */
diff --git a/contrib/gcc/cp/cvt.c b/contrib/gcc/cp/cvt.c
index 7082726..6029e84 100644
--- a/contrib/gcc/cp/cvt.c
+++ b/contrib/gcc/cp/cvt.c
@@ -1,5 +1,6 @@
/* Language-level data type conversion for GNU C++.
- Copyright (C) 1987, 88, 92-97, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -34,9 +35,10 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h"
#include "decl.h"
-static tree cp_convert_to_pointer PROTO((tree, tree));
-static tree convert_to_pointer_force PROTO((tree, tree));
-static tree build_up_reference PROTO((tree, tree, int));
+static tree cp_convert_to_pointer PARAMS ((tree, tree, int));
+static tree convert_to_pointer_force PARAMS ((tree, tree));
+static tree build_up_reference PARAMS ((tree, tree, int, tree));
+static void warn_ref_binding PARAMS ((tree, tree, tree));
/* Change of width--truncation and extension of integers or reals--
is represented with NOP_EXPR. Proper functioning of many things
@@ -65,11 +67,14 @@ static tree build_up_reference PROTO((tree, tree, int));
else if dealing with method pointers, delegate
else convert blindly
else if converting class, pass off to build_type_conversion
- else try C-style pointer conversion */
+ else try C-style pointer conversion. If FORCE is true then allow
+ conversions via virtual bases (these are permitted by reinterpret_cast,
+ but not static_cast). */
static tree
-cp_convert_to_pointer (type, expr)
+cp_convert_to_pointer (type, expr, force)
tree type, expr;
+ int force;
{
register tree intype = TREE_TYPE (expr);
register enum tree_code form;
@@ -78,9 +83,9 @@ cp_convert_to_pointer (type, expr)
if (IS_AGGR_TYPE (intype))
{
intype = complete_type (intype);
- if (TYPE_SIZE (intype) == NULL_TREE)
+ if (!COMPLETE_TYPE_P (intype))
{
- cp_error ("can't convert from incomplete type `%T' to `%T'",
+ error ("can't convert from incomplete type `%T' to `%T'",
intype, type);
return error_mark_node;
}
@@ -89,7 +94,7 @@ cp_convert_to_pointer (type, expr)
if (rval)
{
if (rval == error_mark_node)
- cp_error ("conversion of `%E' from `%T' to `%T' is ambiguous",
+ error ("conversion of `%E' from `%T' to `%T' is ambiguous",
expr, intype, type);
return rval;
}
@@ -98,7 +103,7 @@ cp_convert_to_pointer (type, expr)
/* Handle anachronistic conversions from (::*)() to cv void* or (*)(). */
if (TREE_CODE (type) == POINTER_TYPE
&& (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
- || TYPE_MAIN_VARIANT (TREE_TYPE (type)) == void_type_node))
+ || VOID_TYPE_P (TREE_TYPE (type))))
{
/* Allow an implicit this pointer for pointer to member
functions. */
@@ -118,7 +123,7 @@ cp_convert_to_pointer (type, expr)
{
if (TREE_CODE (TREE_TYPE (TREE_TYPE (expr))) == METHOD_TYPE)
if (pedantic || warn_pmf2ptr)
- cp_pedwarn ("converting from `%T' to `%T'", TREE_TYPE (expr),
+ pedwarn ("converting from `%T' to `%T'", TREE_TYPE (expr),
type);
return build1 (NOP_EXPR, type, expr);
}
@@ -136,68 +141,83 @@ cp_convert_to_pointer (type, expr)
&& TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE
&& IS_AGGR_TYPE (TREE_TYPE (type))
&& IS_AGGR_TYPE (TREE_TYPE (intype))
- && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE
- /* If EXPR is NULL, then we don't need to do any arithmetic
- to convert it:
-
- [conv.ptr]
-
- The null pointer value is converted to the null pointer
- value of the destination type. */
- && !integer_zerop (expr))
+ && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE)
{
enum tree_code code = PLUS_EXPR;
- tree binfo = get_binfo (TREE_TYPE (type), TREE_TYPE (intype), 1);
- if (binfo == error_mark_node)
- return error_mark_node;
- if (binfo == NULL_TREE)
+ tree binfo;
+
+ /* Try derived to base conversion. */
+ binfo = lookup_base (TREE_TYPE (intype), TREE_TYPE (type),
+ ba_check, NULL);
+ if (!binfo)
{
- binfo = get_binfo (TREE_TYPE (intype), TREE_TYPE (type), 1);
- if (binfo == error_mark_node)
- return error_mark_node;
+ /* Try base to derived conversion. */
+ binfo = lookup_base (TREE_TYPE (type), TREE_TYPE (intype),
+ ba_check, NULL);
code = MINUS_EXPR;
}
+ if (binfo == error_mark_node)
+ return error_mark_node;
if (binfo)
{
- if (TYPE_USES_VIRTUAL_BASECLASSES (TREE_TYPE (type))
- || TYPE_USES_VIRTUAL_BASECLASSES (TREE_TYPE (intype))
- || ! BINFO_OFFSET_ZEROP (binfo))
+ expr = build_base_path (code, expr, binfo, 0);
+ /* Add any qualifier conversions. */
+ if (!same_type_p (TREE_TYPE (TREE_TYPE (expr)),
+ TREE_TYPE (type)))
{
- /* Need to get the path we took. */
- tree path;
-
- if (code == PLUS_EXPR)
- get_base_distance (TREE_TYPE (type), TREE_TYPE (intype),
- 0, &path);
- else
- get_base_distance (TREE_TYPE (intype), TREE_TYPE (type),
- 0, &path);
- return build_vbase_path (code, type, expr, path, 0);
+ expr = build1 (NOP_EXPR, type, expr);
+ TREE_CONSTANT (expr) =
+ TREE_CONSTANT (TREE_OPERAND (expr, 0));
}
+ return expr;
}
}
if (TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
{
- tree b1 = TYPE_OFFSET_BASETYPE (TREE_TYPE (type));
- tree b2 = TYPE_OFFSET_BASETYPE (TREE_TYPE (intype));
- tree binfo = get_binfo (b2, b1, 1);
+ tree b1;
+ tree b2;
+ tree binfo;
enum tree_code code = PLUS_EXPR;
+ base_kind bk;
- if (binfo == NULL_TREE)
+ b1 = TYPE_OFFSET_BASETYPE (TREE_TYPE (type));
+ b2 = TYPE_OFFSET_BASETYPE (TREE_TYPE (intype));
+ binfo = lookup_base (b1, b2, ba_check, &bk);
+ if (!binfo)
{
- binfo = get_binfo (b1, b2, 1);
+ binfo = lookup_base (b2, b1, ba_check, &bk);
code = MINUS_EXPR;
}
-
if (binfo == error_mark_node)
return error_mark_node;
- if (binfo && ! TREE_VIA_VIRTUAL (binfo))
- expr = size_binop (code, expr, BINFO_OFFSET (binfo));
+
+ if (bk == bk_via_virtual)
+ {
+ if (force)
+ warning ("pointer to member cast from `%T' to `%T' is via virtual base",
+ TREE_TYPE (intype), TREE_TYPE (type));
+ else
+ {
+ error ("pointer to member cast from `%T' to `%T' is via virtual base",
+ TREE_TYPE (intype), TREE_TYPE (type));
+ return error_mark_node;
+ }
+ /* This is a reinterpret cast, whose result is unspecified.
+ We choose to do nothing. */
+ return build1 (NOP_EXPR, type, expr);
+ }
+
+ if (TREE_CODE (expr) == PTRMEM_CST)
+ expr = cplus_expand_constant (expr);
+
+ if (binfo)
+ expr = size_binop (code, convert (sizetype, expr),
+ BINFO_OFFSET (binfo));
}
else if (TYPE_PTRMEMFUNC_P (type))
{
- cp_error ("cannot convert `%E' from type `%T' to type `%T'",
+ error ("cannot convert `%E' from type `%T' to type `%T'",
expr, intype, type);
return error_mark_node;
}
@@ -207,25 +227,27 @@ cp_convert_to_pointer (type, expr)
return rval;
}
else if (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype))
- return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 1);
+ return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0);
else if (TYPE_PTRMEMFUNC_P (intype))
{
- cp_error ("cannot convert `%E' from type `%T' to type `%T'",
+ error ("cannot convert `%E' from type `%T' to type `%T'",
expr, intype, type);
return error_mark_node;
}
my_friendly_assert (form != OFFSET_TYPE, 186);
- if (TYPE_LANG_SPECIFIC (intype)
- && (IS_SIGNATURE_POINTER (intype) || IS_SIGNATURE_REFERENCE (intype)))
- return convert_to_pointer (type, build_optr_ref (expr));
-
if (integer_zerop (expr))
{
if (TYPE_PTRMEMFUNC_P (type))
return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0);
- expr = build_int_2 (0, 0);
+
+ if (TYPE_PTRMEM_P (type))
+ /* A NULL pointer-to-member is represented by -1, not by
+ zero. */
+ expr = build_int_2 (-1, -1);
+ else
+ expr = build_int_2 (0, 0);
TREE_TYPE (expr) = type;
return expr;
}
@@ -245,9 +267,9 @@ cp_convert_to_pointer (type, expr)
}
if (type_unknown_p (expr))
- return instantiate_type (type, expr, 1);
+ return instantiate_type (type, expr, itf_complain);
- cp_error ("cannot convert `%E' from type `%T' to type `%T'",
+ error ("cannot convert `%E' from type `%T' to type `%T'",
expr, intype, type);
return error_mark_node;
}
@@ -270,15 +292,6 @@ convert_to_pointer_force (type, expr)
return expr;
}
- /* Convert signature pointer/reference to `void *' first. */
- if (form == RECORD_TYPE
- && (IS_SIGNATURE_POINTER (intype) || IS_SIGNATURE_REFERENCE (intype)))
- {
- expr = build_optr_ref (expr);
- intype = TREE_TYPE (expr);
- form = TREE_CODE (intype);
- }
-
if (form == POINTER_TYPE)
{
intype = TYPE_MAIN_VARIANT (intype);
@@ -290,34 +303,36 @@ convert_to_pointer_force (type, expr)
&& TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE)
{
enum tree_code code = PLUS_EXPR;
- tree path;
- int distance = get_base_distance (TREE_TYPE (type),
- TREE_TYPE (intype), 0, &path);
- if (distance == -2)
+ tree binfo;
+
+ binfo = lookup_base (TREE_TYPE (intype), TREE_TYPE (type),
+ ba_ignore, NULL);
+ if (!binfo)
{
- ambig:
- cp_error ("type `%T' is ambiguous baseclass of `%s'",
- TREE_TYPE (type),
- TYPE_NAME_STRING (TREE_TYPE (intype)));
- return error_mark_node;
+ binfo = lookup_base (TREE_TYPE (type), TREE_TYPE (intype),
+ ba_ignore, NULL);
+ code = MINUS_EXPR;
}
- if (distance == -1)
+ if (binfo == error_mark_node)
+ return error_mark_node;
+ if (binfo)
{
- distance = get_base_distance (TREE_TYPE (intype),
- TREE_TYPE (type), 0, &path);
- if (distance == -2)
- goto ambig;
- if (distance < 0)
- /* Doesn't need any special help from us. */
- return build1 (NOP_EXPR, type, expr);
-
- code = MINUS_EXPR;
+ expr = build_base_path (code, expr, binfo, 0);
+ /* Add any qualifier conversions. */
+ if (!same_type_p (TREE_TYPE (TREE_TYPE (expr)),
+ TREE_TYPE (type)))
+ {
+ expr = build1 (NOP_EXPR, type, expr);
+ TREE_CONSTANT (expr) =
+ TREE_CONSTANT (TREE_OPERAND (expr, 0));
+ }
+ return expr;
}
- return build_vbase_path (code, type, expr, path, 0);
+
}
}
- return cp_convert_to_pointer (type, expr);
+ return cp_convert_to_pointer (type, expr, 1);
}
/* We are passing something to a function which requires a reference.
@@ -325,42 +340,56 @@ convert_to_pointer_force (type, expr)
value we have to begin with is in ARG.
FLAGS controls how we manage access checking.
- DIRECT_BIND in FLAGS controls how any temporaries are generated. */
+ DIRECT_BIND in FLAGS controls how any temporaries are generated.
+ If DIRECT_BIND is set, DECL is the reference we're binding to. */
static tree
-build_up_reference (type, arg, flags)
- tree type, arg;
+build_up_reference (type, arg, flags, decl)
+ tree type, arg, decl;
int flags;
{
tree rval;
tree argtype = TREE_TYPE (arg);
tree target_type = TREE_TYPE (type);
+ tree stmt_expr = NULL_TREE;
my_friendly_assert (TREE_CODE (type) == REFERENCE_TYPE, 187);
if ((flags & DIRECT_BIND) && ! real_lvalue_p (arg))
{
+ /* Create a new temporary variable. We can't just use a TARGET_EXPR
+ here because it needs to live as long as DECL. */
tree targ = arg;
- if (toplevel_bindings_p ())
- arg = get_temp_name (argtype, 1);
+
+ arg = build_decl (VAR_DECL, NULL_TREE, argtype);
+ DECL_ARTIFICIAL (arg) = 1;
+ TREE_USED (arg) = 1;
+ TREE_STATIC (arg) = TREE_STATIC (decl);
+
+ if (TREE_STATIC (decl))
+ {
+ /* Namespace-scope or local static; give it a mangled name. */
+ tree name = mangle_ref_init_variable (decl);
+ DECL_NAME (arg) = name;
+ SET_DECL_ASSEMBLER_NAME (arg, name);
+ arg = pushdecl_top_level (arg);
+ }
else
{
- arg = pushdecl (build_decl (VAR_DECL, NULL_TREE, argtype));
- DECL_ARTIFICIAL (arg) = 1;
+ /* Automatic; make sure we handle the cleanup properly. */
+ maybe_push_cleanup_level (argtype);
+ arg = pushdecl (arg);
}
+
+ /* Process the initializer for the declaration. */
DECL_INITIAL (arg) = targ;
- cp_finish_decl (arg, targ, NULL_TREE, 0,
+ cp_finish_decl (arg, targ, NULL_TREE,
LOOKUP_ONLYCONVERTING|DIRECT_BIND);
}
else if (!(flags & DIRECT_BIND) && ! lvalue_p (arg))
- {
- tree slot = build_decl (VAR_DECL, NULL_TREE, argtype);
- DECL_ARTIFICIAL (slot) = 1;
- arg = build (TARGET_EXPR, argtype, slot, arg, NULL_TREE, NULL_TREE);
- TREE_SIDE_EFFECTS (arg) = 1;
- }
+ return get_target_expr (arg);
- /* If we had a way to wrap this up, and say, if we ever needed it's
+ /* If we had a way to wrap this up, and say, if we ever needed its
address, transform all occurrences of the register, into a memory
reference we could win better. */
rval = build_unary_op (ADDR_EXPR, arg, 1);
@@ -372,22 +401,60 @@ build_up_reference (type, arg, flags)
&& IS_AGGR_TYPE (argtype)
&& IS_AGGR_TYPE (target_type))
{
- /* We go through get_binfo for the access control. */
- tree binfo = get_binfo (target_type, argtype, 1);
+ /* We go through lookup_base for the access control. */
+ tree binfo = lookup_base (argtype, target_type, ba_check, NULL);
if (binfo == error_mark_node)
return error_mark_node;
if (binfo == NULL_TREE)
return error_not_base_type (target_type, argtype);
- rval = convert_pointer_to_real (binfo, rval);
+ rval = build_base_path (PLUS_EXPR, rval, binfo, 1);
}
else
rval
= convert_to_pointer_force (build_pointer_type (target_type), rval);
rval = build1 (NOP_EXPR, type, rval);
TREE_CONSTANT (rval) = TREE_CONSTANT (TREE_OPERAND (rval, 0));
+
+ /* If we created and initialized a new temporary variable, add the
+ representation of that initialization to the RVAL. */
+ if (stmt_expr)
+ rval = build (COMPOUND_EXPR, TREE_TYPE (rval), stmt_expr, rval);
+
+ /* And return the result. */
return rval;
}
+/* Subroutine of convert_to_reference. REFTYPE is the target reference type.
+ INTYPE is the original rvalue type and DECL is an optional _DECL node
+ for diagnostics.
+
+ [dcl.init.ref] says that if an rvalue is used to
+ initialize a reference, then the reference must be to a
+ non-volatile const type. */
+
+static void
+warn_ref_binding (reftype, intype, decl)
+ tree reftype, intype, decl;
+{
+ tree ttl = TREE_TYPE (reftype);
+
+ if (!CP_TYPE_CONST_NON_VOLATILE_P (ttl))
+ {
+ const char *msg;
+
+ if (CP_TYPE_VOLATILE_P (ttl) && decl)
+ msg = "initialization of volatile reference type `%#T' from rvalue of type `%T'";
+ else if (CP_TYPE_VOLATILE_P (ttl))
+ msg = "conversion to volatile reference type `%#T' from rvalue of type `%T'";
+ else if (decl)
+ msg = "initialization of non-const reference type `%#T' from rvalue of type `%T'";
+ else
+ msg = "conversion to non-const reference type `%#T' from rvalue of type `%T'";
+
+ pedwarn (msg, reftype, intype);
+ }
+}
+
/* For C++: Only need to do one-level references, but cannot
get tripped up on signed/unsigned differences.
@@ -410,15 +477,15 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
if (TREE_CODE (type) == FUNCTION_TYPE && intype == unknown_type_node)
{
expr = instantiate_type (type, expr,
- (flags & LOOKUP_COMPLAIN) != 0);
+ (flags & LOOKUP_COMPLAIN)
+ ? itf_complain : itf_none);
if (expr == error_mark_node)
return error_mark_node;
intype = TREE_TYPE (expr);
}
- if (TREE_CODE (intype) == REFERENCE_TYPE)
- my_friendly_abort (364);
+ my_friendly_assert (TREE_CODE (intype) != REFERENCE_TYPE, 364);
intype = TYPE_MAIN_VARIANT (intype);
@@ -450,33 +517,16 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
tree ttl = TREE_TYPE (reftype);
tree ttr = lvalue_type (expr);
- /* [dcl.init.ref] says that if an rvalue is used to
- initialize a reference, then the reference must be to a
- non-volatile const type. */
- if (! real_lvalue_p (expr)
- && !CP_TYPE_CONST_NON_VOLATILE_P (ttl))
- {
- const char *msg;
-
- if (CP_TYPE_VOLATILE_P (ttl) && decl)
- msg = "initialization of volatile reference type `%#T'";
- else if (CP_TYPE_VOLATILE_P (ttl))
- msg = "conversion to volatile reference type `%#T'";
- else if (decl)
- msg = "initialization of non-const reference type `%#T'";
- else
- msg = "conversion to non-const reference type `%#T'";
-
- cp_pedwarn (msg, reftype);
- cp_pedwarn ("from rvalue of type `%T'", intype);
- }
- else if (! (convtype & CONV_CONST)
+ if (! real_lvalue_p (expr))
+ warn_ref_binding (reftype, intype, decl);
+
+ if (! (convtype & CONV_CONST)
&& !at_least_as_qualified_p (ttl, ttr))
- cp_pedwarn ("conversion from `%T' to `%T' discards qualifiers",
+ pedwarn ("conversion from `%T' to `%T' discards qualifiers",
ttr, reftype);
}
- return build_up_reference (reftype, expr, flags);
+ return build_up_reference (reftype, expr, flags, decl);
}
else if ((convtype & CONV_REINTERPRET) && lvalue_p (expr))
{
@@ -490,7 +540,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
if (TREE_CODE (intype) == POINTER_TYPE
&& (comptypes (TREE_TYPE (intype), type,
COMPARE_BASE | COMPARE_RELAXED )))
- cp_warning ("casting `%T' to `%T' does not dereference pointer",
+ warning ("casting `%T' to `%T' does not dereference pointer",
intype, reftype);
rval = build_unary_op (ADDR_EXPR, expr, 0);
@@ -506,11 +556,8 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
"converting", 0, 0);
if (rval == NULL_TREE || rval == error_mark_node)
return rval;
- rval = build_up_reference (reftype, rval, flags);
-
- if (rval && ! CP_TYPE_CONST_P (TREE_TYPE (reftype)))
- cp_pedwarn ("initializing non-const `%T' with `%T' will use a temporary",
- reftype, intype);
+ warn_ref_binding (reftype, intype, decl);
+ rval = build_up_reference (reftype, rval, flags, decl);
}
if (rval)
@@ -522,7 +569,7 @@ convert_to_reference (reftype, expr, convtype, flags, decl)
my_friendly_assert (TREE_CODE (intype) != OFFSET_TYPE, 189);
if (flags & LOOKUP_COMPLAIN)
- cp_error ("cannot convert type `%T' to type `%T'", intype, reftype);
+ error ("cannot convert type `%T' to type `%T'", intype, reftype);
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
@@ -542,97 +589,22 @@ convert_from_reference (val)
if (TREE_CODE (type) == OFFSET_TYPE)
type = TREE_TYPE (type);
if (TREE_CODE (type) == REFERENCE_TYPE)
- return build_indirect_ref (val, NULL_PTR);
+ return build_indirect_ref (val, NULL);
return val;
}
-
-/* Call this when we know (for any reason) that expr is not, in fact,
- zero. This routine is like convert_pointer_to, but it pays
- attention to which specific instance of what type we want to
- convert to. This routine should eventually become
- convert_to_pointer after all references to convert_to_pointer
- are removed. */
-
-tree
-convert_pointer_to_real (binfo, expr)
- tree binfo, expr;
-{
- register tree intype = TREE_TYPE (expr);
- tree ptr_type;
- tree type, rval;
-
- if (intype == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (binfo) == TREE_VEC)
- type = BINFO_TYPE (binfo);
- else if (IS_AGGR_TYPE (binfo))
- {
- type = binfo;
- }
- else
- {
- type = binfo;
- binfo = NULL_TREE;
- }
-
- ptr_type = cp_build_qualified_type (type,
- CP_TYPE_QUALS (TREE_TYPE (intype)));
- ptr_type = build_pointer_type (ptr_type);
- if (same_type_p (ptr_type, TYPE_MAIN_VARIANT (intype)))
- return expr;
-
- my_friendly_assert (!integer_zerop (expr), 191);
-
- intype = TYPE_MAIN_VARIANT (TREE_TYPE (intype));
- if (TREE_CODE (type) == RECORD_TYPE
- && TREE_CODE (intype) == RECORD_TYPE
- && type != intype)
- {
- tree path;
- int distance
- = get_base_distance (binfo, intype, 0, &path);
-
- /* This function shouldn't be called with unqualified arguments
- but if it is, give them an error message that they can read. */
- if (distance < 0)
- {
- cp_error ("cannot convert a pointer of type `%T' to a pointer of type `%T'",
- intype, type);
-
- if (distance == -2)
- cp_error ("because `%T' is an ambiguous base class", type);
- return error_mark_node;
- }
-
- return build_vbase_path (PLUS_EXPR, ptr_type, expr, path, 1);
- }
- rval = build1 (NOP_EXPR, ptr_type,
- TREE_CODE (expr) == NOP_EXPR ? TREE_OPERAND (expr, 0) : expr);
- TREE_CONSTANT (rval) = TREE_CONSTANT (expr);
- return rval;
-}
-/* Call this when we know (for any reason) that expr is
- not, in fact, zero. This routine gets a type out of the first
- argument and uses it to search for the type to convert to. If there
- is more than one instance of that type in the expr, the conversion is
- ambiguous. This routine should eventually go away, and all
- callers should use convert_to_pointer_real. */
+/* Implicitly convert the lvalue EXPR to another lvalue of type TOTYPE,
+ preserving cv-qualification. */
tree
-convert_pointer_to (binfo, expr)
- tree binfo, expr;
+convert_lvalue (totype, expr)
+ tree totype, expr;
{
- tree type;
-
- if (TREE_CODE (binfo) == TREE_VEC)
- type = BINFO_TYPE (binfo);
- else if (IS_AGGR_TYPE (binfo))
- type = binfo;
- else
- type = binfo;
- return convert_pointer_to_real (type, expr);
+ totype = cp_build_qualified_type (totype, TYPE_QUALS (TREE_TYPE (expr)));
+ totype = build_reference_type (totype);
+ expr = convert_to_reference (totype, expr, CONV_IMPLICIT, LOOKUP_NORMAL,
+ NULL_TREE);
+ return convert_from_reference (expr);
}
/* C++ conversions, preference to static cast conversions. */
@@ -660,8 +632,10 @@ ocp_convert (type, expr, convtype, flags)
|| TREE_TYPE (e) == error_mark_node)
return error_mark_node;
- if (TREE_READONLY_DECL_P (e))
- e = decl_constant_value (e);
+ complete_type (type);
+ complete_type (TREE_TYPE (expr));
+
+ e = decl_constant_value (e);
if (IS_AGGR_TYPE (type) && (convtype & CONV_FORCE_TEMP)
/* Some internal structures (vtable_entry_type, sigtbl_ptr_type)
@@ -679,26 +653,20 @@ ocp_convert (type, expr, convtype, flags)
that can result in infinite recursion; fold will call
convert, which will call ocp_convert, etc. */
return e;
+ /* For complex data types, we need to perform componentwise
+ conversion. */
+ else if (TREE_CODE (type) == COMPLEX_TYPE)
+ return fold (convert_to_complex (type, e));
else
return fold (build1 (NOP_EXPR, type, e));
}
if (code == VOID_TYPE && (convtype & CONV_STATIC))
{
- e = require_complete_type_in_void (e);
- if (e != error_mark_node)
- e = build1 (CONVERT_EXPR, void_type_node, e);
-
+ e = convert_to_void (e, /*implicit=*/NULL);
return e;
}
-#if 0
- /* This is incorrect. A truncation can't be stripped this way.
- Extensions will be stripped by the use of get_unwidened. */
- if (TREE_CODE (e) == NOP_EXPR)
- return cp_convert (type, TREE_OPERAND (e, 0));
-#endif
-
/* Just convert to the type of the member. */
if (code == OFFSET_TYPE)
{
@@ -706,13 +674,6 @@ ocp_convert (type, expr, convtype, flags)
code = TREE_CODE (type);
}
-#if 0
- if (code == REFERENCE_TYPE)
- return fold (convert_to_reference (type, e, convtype, flags, NULL_TREE));
- else if (TREE_CODE (TREE_TYPE (e)) == REFERENCE_TYPE)
- e = convert_from_reference (e);
-#endif
-
if (TREE_CODE (e) == OFFSET_REF)
e = resolve_offset_ref (e);
@@ -725,7 +686,7 @@ ocp_convert (type, expr, convtype, flags)
&& ((ARITHMETIC_TYPE_P (intype) && ! (convtype & CONV_STATIC))
|| (TREE_CODE (intype) == POINTER_TYPE)))
{
- cp_pedwarn ("conversion from `%#T' to `%#T'", intype, type);
+ pedwarn ("conversion from `%#T' to `%#T'", intype, type);
if (flag_pedantic_errors)
return error_mark_node;
@@ -737,24 +698,33 @@ ocp_convert (type, expr, convtype, flags)
if (rval)
return rval;
if (flags & LOOKUP_COMPLAIN)
- cp_error ("`%#T' used where a `%T' was expected", intype, type);
+ error ("`%#T' used where a `%T' was expected", intype, type);
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
return error_mark_node;
}
if (code == BOOLEAN_TYPE)
{
+ tree fn = NULL_TREE;
+
/* Common Ada/Pascal programmer's mistake. We always warn
about this since it is so bad. */
if (TREE_CODE (expr) == FUNCTION_DECL)
- cp_warning ("the address of `%D', will always be `true'", expr);
- return truthvalue_conversion (e);
+ fn = expr;
+ else if (TREE_CODE (expr) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (expr, 0)) == FUNCTION_DECL)
+ fn = TREE_OPERAND (expr, 0);
+ if (fn && !DECL_WEAK (fn))
+ warning ("the address of `%D', will always be `true'", fn);
+ return cp_truthvalue_conversion (e);
}
return fold (convert_to_integer (type, e));
}
if (code == POINTER_TYPE || code == REFERENCE_TYPE
|| TYPE_PTRMEMFUNC_P (type))
- return fold (cp_convert_to_pointer (type, e));
+ return fold (cp_convert_to_pointer (type, e, 0));
+ if (code == VECTOR_TYPE)
+ return fold (convert_to_vector (type, e));
if (code == REAL_TYPE || code == COMPLEX_TYPE)
{
if (IS_AGGR_TYPE (TREE_TYPE (e)))
@@ -765,7 +735,7 @@ ocp_convert (type, expr, convtype, flags)
return rval;
else
if (flags & LOOKUP_COMPLAIN)
- cp_error ("`%#T' used where a floating point value was expected",
+ error ("`%#T' used where a floating point value was expected",
TREE_TYPE (e));
}
if (code == REAL_TYPE)
@@ -784,29 +754,6 @@ ocp_convert (type, expr, convtype, flags)
dtype = TYPE_MAIN_VARIANT (dtype);
- /* Conversion of object pointers or signature pointers/references
- to signature pointers/references. */
-
- if (TYPE_LANG_SPECIFIC (type)
- && (IS_SIGNATURE_POINTER (type) || IS_SIGNATURE_REFERENCE (type)))
- {
- tree constructor = build_signature_pointer_constructor (type, expr);
- tree sig_ty = SIGNATURE_TYPE (type);
- tree sig_ptr;
-
- if (constructor == error_mark_node)
- return error_mark_node;
-
- sig_ptr = get_temp_name (type, 1);
- DECL_INITIAL (sig_ptr) = constructor;
- CLEAR_SIGNATURE (sig_ty);
- cp_finish_decl (sig_ptr, constructor, NULL_TREE, 0, 0);
- SET_SIGNATURE (sig_ty);
- TREE_READONLY (sig_ptr) = 1;
-
- return sig_ptr;
- }
-
/* Conversion between aggregate types. New C++ semantics allow
objects of derived type to be cast to objects of base type.
Old semantics only allowed this between pointers.
@@ -816,11 +763,8 @@ ocp_convert (type, expr, convtype, flags)
ctor = e;
- if (IS_AGGR_TYPE (type) && CLASSTYPE_ABSTRACT_VIRTUALS (type))
- {
- abstract_virtuals_error (NULL_TREE, type);
- return error_mark_node;
- }
+ if (abstract_virtuals_error (NULL_TREE, type))
+ return error_mark_node;
if ((flags & LOOKUP_ONLYCONVERTING)
&& ! (IS_AGGR_TYPE (dtype) && DERIVED_FROM_P (type, dtype)))
@@ -828,9 +772,10 @@ ocp_convert (type, expr, convtype, flags)
with a user-defined conversion sequence, then we direct-initialize
the target with the temp (see [dcl.init]). */
ctor = build_user_type_conversion (type, ctor, flags);
- if (ctor)
- ctor = build_method_call (NULL_TREE, ctor_identifier,
- build_expr_list (NULL_TREE, ctor),
+ else
+ ctor = build_method_call (NULL_TREE,
+ complete_ctor_identifier,
+ build_tree_list (NULL_TREE, ctor),
TYPE_BINFO (type), flags);
if (ctor)
return build_cplus_new (type, ctor);
@@ -845,13 +790,152 @@ ocp_convert (type, expr, convtype, flags)
return e;
if (flags & LOOKUP_COMPLAIN)
- cp_error ("conversion from `%T' to non-scalar type `%T' requested",
+ error ("conversion from `%T' to non-scalar type `%T' requested",
TREE_TYPE (expr), type);
if (flags & LOOKUP_SPECULATIVELY)
return NULL_TREE;
return error_mark_node;
}
+/* When an expression is used in a void context, its value is discarded and
+ no lvalue-rvalue and similar conversions happen [expr.static.cast/4,
+ stmt.expr/1, expr.comma/1]. This permits dereferencing an incomplete type
+ in a void context. The C++ standard does not define what an `access' to an
+ object is, but there is reason to beleive that it is the lvalue to rvalue
+ conversion -- if it were not, `*&*p = 1' would violate [expr]/4 in that it
+ accesses `*p' not to calculate the value to be stored. But, dcl.type.cv/8
+ indicates that volatile semantics should be the same between C and C++
+ where ever possible. C leaves it implementation defined as to what
+ constitutes an access to a volatile. So, we interpret `*vp' as a read of
+ the volatile object `vp' points to, unless that is an incomplete type. For
+ volatile references we do not do this interpretation, because that would
+ make it impossible to ignore the reference return value from functions. We
+ issue warnings in the confusing cases.
+
+ IMPLICIT is tells us the context of an implicit void conversion. */
+
+tree
+convert_to_void (expr, implicit)
+ tree expr;
+ const char *implicit;
+{
+ if (expr == error_mark_node
+ || TREE_TYPE (expr) == error_mark_node)
+ return error_mark_node;
+ if (!TREE_TYPE (expr))
+ return expr;
+ if (VOID_TYPE_P (TREE_TYPE (expr)))
+ return expr;
+ switch (TREE_CODE (expr))
+ {
+ case COND_EXPR:
+ {
+ /* The two parts of a cond expr might be separate lvalues. */
+ tree op1 = TREE_OPERAND (expr,1);
+ tree op2 = TREE_OPERAND (expr,2);
+ tree new_op1 = convert_to_void (op1, implicit);
+ tree new_op2 = convert_to_void (op2, implicit);
+
+ expr = build (COND_EXPR, void_type_node,
+ TREE_OPERAND (expr, 0), new_op1, new_op2);
+ break;
+ }
+
+ case COMPOUND_EXPR:
+ {
+ /* The second part of a compound expr contains the value. */
+ tree op1 = TREE_OPERAND (expr,1);
+ tree new_op1 = convert_to_void (op1, implicit);
+
+ if (new_op1 != op1)
+ {
+ tree t = build (COMPOUND_EXPR, TREE_TYPE (new_op1),
+ TREE_OPERAND (expr, 0), new_op1);
+ TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (expr);
+ expr = t;
+ }
+
+ break;
+ }
+
+ case NON_LVALUE_EXPR:
+ case NOP_EXPR:
+ /* These have already decayed to rvalue. */
+ break;
+
+ case CALL_EXPR: /* we have a special meaning for volatile void fn() */
+ break;
+
+ case INDIRECT_REF:
+ {
+ tree type = TREE_TYPE (expr);
+ int is_reference = TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0)))
+ == REFERENCE_TYPE;
+ int is_volatile = TYPE_VOLATILE (type);
+ int is_complete = COMPLETE_TYPE_P (complete_type (type));
+
+ if (is_volatile && !is_complete)
+ warning ("object of incomplete type `%T' will not be accessed in %s",
+ type, implicit ? implicit : "void context");
+ else if (is_reference && is_volatile)
+ warning ("object of type `%T' will not be accessed in %s",
+ TREE_TYPE (TREE_OPERAND (expr, 0)),
+ implicit ? implicit : "void context");
+ if (is_reference || !is_volatile || !is_complete)
+ expr = TREE_OPERAND (expr, 0);
+
+ break;
+ }
+
+ case VAR_DECL:
+ {
+ /* External variables might be incomplete. */
+ tree type = TREE_TYPE (expr);
+ int is_complete = COMPLETE_TYPE_P (complete_type (type));
+
+ if (TYPE_VOLATILE (type) && !is_complete)
+ warning ("object `%E' of incomplete type `%T' will not be accessed in %s",
+ expr, type, implicit ? implicit : "void context");
+ break;
+ }
+
+ case OFFSET_REF:
+ expr = resolve_offset_ref (expr);
+ break;
+
+ default:;
+ }
+ {
+ tree probe = expr;
+
+ if (TREE_CODE (probe) == ADDR_EXPR)
+ probe = TREE_OPERAND (expr, 0);
+ if (type_unknown_p (probe))
+ {
+ /* [over.over] enumerates the places where we can take the address
+ of an overloaded function, and this is not one of them. */
+ pedwarn ("%s cannot resolve address of overloaded function",
+ implicit ? implicit : "void cast");
+ }
+ else if (implicit && probe == expr && is_overloaded_fn (probe))
+ /* Only warn when there is no &. */
+ warning ("%s is a reference, not call, to function `%E'",
+ implicit, expr);
+ }
+
+ if (expr != error_mark_node && !VOID_TYPE_P (TREE_TYPE (expr)))
+ {
+ /* FIXME: This is where we should check for expressions with no
+ effects. At the moment we do that in both build_x_component_expr
+ and expand_expr_stmt -- inconsistently too. For the moment
+ leave implicit void conversions unadorned so that expand_expr_stmt
+ has a chance of detecting some of the cases. */
+ if (!implicit)
+ expr = build1 (CONVERT_EXPR, void_type_node, expr);
+ }
+ return expr;
+}
+
/* Create an expression whose value is that of EXPR,
converted to type TYPE. The TREE_TYPE of the value
is always TYPE. This function implements all reasonable
@@ -864,7 +948,7 @@ ocp_convert (type, expr, convtype, flags)
conversions to/from basetypes may involve memory references
(vbases) and adding or subtracting small values (multiple
inheritance), but it calls convert from the constant folding code
- on subtrees of already build trees after it has ripped them apart.
+ on subtrees of already built trees after it has ripped them apart.
Also, if we ever support range variables, we'll probably also have to
do a little bit more work. */
@@ -882,8 +966,7 @@ convert (type, expr)
if (POINTER_TYPE_P (type) && POINTER_TYPE_P (intype))
{
- if (TREE_READONLY_DECL_P (expr))
- expr = decl_constant_value (expr);
+ expr = decl_constant_value (expr);
return fold (build1 (NOP_EXPR, type, expr));
}
@@ -974,13 +1057,16 @@ build_expr_type_conversion (desires, expr, complain)
if (expr == null_node
&& (desires & WANT_INT)
&& !(desires & WANT_NULL))
- cp_warning ("converting NULL to non-pointer type");
+ warning ("converting NULL to non-pointer type");
if (TREE_CODE (expr) == OFFSET_REF)
expr = resolve_offset_ref (expr);
expr = convert_from_reference (expr);
basetype = TREE_TYPE (expr);
+ if (basetype == error_mark_node)
+ return error_mark_node;
+
if (! IS_AGGR_TYPE (basetype))
switch (TREE_CODE (basetype))
{
@@ -1047,9 +1133,9 @@ build_expr_type_conversion (desires, expr, complain)
{
if (complain)
{
- cp_error ("ambiguous default type conversion from `%T'",
+ error ("ambiguous default type conversion from `%T'",
basetype);
- cp_error (" candidate conversions include `%D' and `%D'",
+ error (" candidate conversions include `%D' and `%D'",
winner, cand);
}
return error_mark_node;
@@ -1081,7 +1167,7 @@ type_promotes_to (type)
if (type == error_mark_node)
return error_mark_node;
- type_quals = CP_TYPE_QUALS (type);
+ type_quals = cp_type_quals (type);
type = TYPE_MAIN_VARIANT (type);
/* bool always promotes to int (not unsigned), even if it's the same
@@ -1103,7 +1189,7 @@ type_promotes_to (type)
else
type = totype;
}
- else if (C_PROMOTING_INTEGER_TYPE_P (type))
+ else if (c_promoting_integer_type_p (type))
{
/* Retain unsignedness if really not getting bigger. */
if (TREE_UNSIGNED (type)
diff --git a/contrib/gcc/cp/decl.c b/contrib/gcc/cp/decl.c
index 6a6aedd..a5d9c64 100644
--- a/contrib/gcc/cp/decl.c
+++ b/contrib/gcc/cp/decl.c
@@ -1,5 +1,6 @@
/* Process declarations and variables for C compiler.
- Copyright (C) 1988, 92-98, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+ 2001, 2002 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -31,424 +32,204 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "tree.h"
#include "rtl.h"
+#include "expr.h"
#include "flags.h"
#include "cp-tree.h"
+#include "tree-inline.h"
#include "decl.h"
#include "lex.h"
-#include <signal.h>
-#include "obstack.h"
-#include "defaults.h"
#include "output.h"
#include "except.h"
#include "toplev.h"
#include "../hash.h"
+#include "ggc.h"
+#include "tm_p.h"
+#include "target.h"
+#include "c-common.h"
+#include "diagnostic.h"
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern tree builtin_return_address_fndecl;
-
-extern struct obstack permanent_obstack;
-extern struct obstack* saveable_obstack;
-
-extern int current_class_depth;
-
-extern tree static_ctors, static_dtors;
-
-extern int static_labelno;
-
-extern tree current_namespace;
-extern tree global_namespace;
-
-extern void (*print_error_function) PROTO((char *));
-extern int (*valid_lang_attribute) PROTO ((tree, tree, tree, tree));
-
-/* Obstack used for remembering local class declarations (like
- enums and static (const) members. */
-#include "stack.h"
-struct obstack decl_obstack;
-static struct stack_level *decl_stack;
-
-#ifndef CHAR_TYPE_SIZE
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-#endif
-
-#ifndef SHORT_TYPE_SIZE
-#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
-#endif
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_LONG_TYPE_SIZE
-#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-#endif
-
-#ifndef FLOAT_TYPE_SIZE
-#define FLOAT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef DOUBLE_TYPE_SIZE
-#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
+extern const struct attribute_spec *lang_attribute_table;
#ifndef BOOL_TYPE_SIZE
-#ifdef SLOW_BYTE_ACCESS
-#define BOOL_TYPE_SIZE ((SLOW_BYTE_ACCESS) ? (POINTER_SIZE) : (CHAR_TYPE_SIZE))
-#else
+/* `bool' has size and alignment `1', on all platforms. */
#define BOOL_TYPE_SIZE CHAR_TYPE_SIZE
#endif
-#endif
-
-/* We let tm.h override the types used here, to handle trivial differences
- such as the choice of unsigned int or long unsigned int for size_t.
- When machines start needing nontrivial differences in the size type,
- it would be best to do something here to figure out automatically
- from other information what type to use. */
-
-#ifndef SIZE_TYPE
-#define SIZE_TYPE "long unsigned int"
-#endif
-#ifndef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "long int"
-#endif
-
-#ifndef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-#endif
+static tree grokparms PARAMS ((tree));
+static const char *redeclaration_error_message PARAMS ((tree, tree));
-static tree grokparms PROTO((tree, int));
-static tree lookup_nested_type PROTO((tree, tree));
-static const char *redeclaration_error_message PROTO((tree, tree));
-
-static struct stack_level *push_decl_level PROTO((struct stack_level *,
- struct obstack *));
-static void push_binding_level PROTO((struct binding_level *, int,
+static void push_binding_level PARAMS ((struct binding_level *, int,
int));
-static void pop_binding_level PROTO((void));
-static void suspend_binding_level PROTO((void));
-static void resume_binding_level PROTO((struct binding_level *));
-static struct binding_level *make_binding_level PROTO((void));
-static void declare_namespace_level PROTO((void));
-static void signal_catch PROTO((int)) ATTRIBUTE_NORETURN;
-static void storedecls PROTO((tree));
-static void require_complete_types_for_parms PROTO((tree));
-static void push_overloaded_decl_1 PROTO((tree));
-static int ambi_op_p PROTO((tree));
-static int unary_op_p PROTO((tree));
-static tree store_bindings PROTO((tree, tree));
-static tree lookup_tag_reverse PROTO((tree, tree));
-static tree obscure_complex_init PROTO((tree, tree));
-static tree maybe_build_cleanup_1 PROTO((tree, tree));
-static tree lookup_name_real PROTO((tree, int, int, int));
-static void warn_extern_redeclared_static PROTO((tree, tree));
-static void grok_reference_init PROTO((tree, tree, tree));
-static tree grokfndecl PROTO((tree, tree, tree, tree, int,
+static void pop_binding_level PARAMS ((void));
+static void suspend_binding_level PARAMS ((void));
+static void resume_binding_level PARAMS ((struct binding_level *));
+static struct binding_level *make_binding_level PARAMS ((void));
+static void declare_namespace_level PARAMS ((void));
+static int decl_jump_unsafe PARAMS ((tree));
+static void storedecls PARAMS ((tree));
+static void require_complete_types_for_parms PARAMS ((tree));
+static int ambi_op_p PARAMS ((enum tree_code));
+static int unary_op_p PARAMS ((enum tree_code));
+static tree store_bindings PARAMS ((tree, tree));
+static tree lookup_tag_reverse PARAMS ((tree, tree));
+static tree obscure_complex_init PARAMS ((tree, tree));
+static tree lookup_name_real PARAMS ((tree, int, int, int));
+static void push_local_name PARAMS ((tree));
+static void warn_extern_redeclared_static PARAMS ((tree, tree));
+static tree grok_reference_init PARAMS ((tree, tree, tree));
+static tree grokfndecl PARAMS ((tree, tree, tree, tree, int,
enum overload_flags, tree,
tree, int, int, int, int, int, int, tree));
-static tree grokvardecl PROTO((tree, tree, RID_BIT_TYPE *, int, int, tree));
-static tree lookup_tag PROTO((enum tree_code, tree,
+static tree grokvardecl PARAMS ((tree, tree, RID_BIT_TYPE *, int, int, tree));
+static tree lookup_tag PARAMS ((enum tree_code, tree,
struct binding_level *, int));
static void set_identifier_type_value_with_scope
- PROTO((tree, tree, struct binding_level *));
-static void record_builtin_type PROTO((enum rid, const char *, tree));
-static void record_unknown_type PROTO((tree, const char *));
-static int member_function_or_else PROTO((tree, tree, const char *));
-static void bad_specifiers PROTO((tree, const char *, int, int, int, int,
+ PARAMS ((tree, tree, struct binding_level *));
+static void record_unknown_type PARAMS ((tree, const char *));
+static tree build_library_fn_1 PARAMS ((tree, enum tree_code, tree));
+static int member_function_or_else PARAMS ((tree, tree, enum overload_flags));
+static void bad_specifiers PARAMS ((tree, const char *, int, int, int, int,
int));
-static void lang_print_error_function PROTO((char *));
-static tree maybe_process_template_type_declaration PROTO((tree, int, struct binding_level*));
-static void check_for_uninitialized_const_var PROTO((tree));
-static unsigned long typename_hash PROTO((hash_table_key));
-static boolean typename_compare PROTO((hash_table_key, hash_table_key));
-static void push_binding PROTO((tree, tree, struct binding_level*));
-static int add_binding PROTO((tree, tree));
-static void pop_binding PROTO((tree, tree));
-static tree local_variable_p PROTO((tree));
-static tree find_binding PROTO((tree, tree));
-static tree select_decl PROTO((tree, int));
-static tree unqualified_namespace_lookup PROTO((tree, int));
-static int lookup_flags PROTO((int, int));
-static tree qualify_lookup PROTO((tree, int));
-static tree record_builtin_java_type PROTO((const char *, int));
-static const char *tag_name PROTO((enum tag_types code));
-static void find_class_binding_level PROTO((void));
-static struct binding_level *innermost_nonclass_level PROTO((void));
-static void finish_dtor PROTO((void));
-static void finish_ctor PROTO((int));
-static tree poplevel_class PROTO((void));
-static void warn_about_implicit_typename_lookup PROTO((tree, tree));
-static int walk_namespaces_r PROTO((tree, walk_namespaces_fn, void *));
-static int walk_globals_r PROTO((tree, void *));
+static tree maybe_process_template_type_declaration PARAMS ((tree, int, struct binding_level*));
+static void check_for_uninitialized_const_var PARAMS ((tree));
+static unsigned long typename_hash PARAMS ((hash_table_key));
+static bool typename_compare PARAMS ((hash_table_key, hash_table_key));
+static void push_binding PARAMS ((tree, tree, struct binding_level*));
+static int add_binding PARAMS ((tree, tree));
+static void pop_binding PARAMS ((tree, tree));
+static tree local_variable_p_walkfn PARAMS ((tree *, int *, void *));
+static tree find_binding PARAMS ((tree, tree));
+static tree select_decl PARAMS ((tree, int));
+static int lookup_flags PARAMS ((int, int));
+static tree qualify_lookup PARAMS ((tree, int));
+static tree record_builtin_java_type PARAMS ((const char *, int));
+static const char *tag_name PARAMS ((enum tag_types code));
+static void find_class_binding_level PARAMS ((void));
+static struct binding_level *innermost_nonclass_level PARAMS ((void));
+static void warn_about_implicit_typename_lookup PARAMS ((tree, tree));
+static int walk_namespaces_r PARAMS ((tree, walk_namespaces_fn, void *));
+static int walk_globals_r PARAMS ((tree, void *));
+static void add_decl_to_level PARAMS ((tree, struct binding_level *));
+static tree make_label_decl PARAMS ((tree, int));
+static void use_label PARAMS ((tree));
+static void check_previous_goto_1 PARAMS ((tree, struct binding_level *, tree,
+ const char *, int));
+static void check_previous_goto PARAMS ((struct named_label_use_list *));
+static void check_switch_goto PARAMS ((struct binding_level *));
+static void check_previous_gotos PARAMS ((tree));
+static void pop_label PARAMS ((tree, tree));
+static void pop_labels PARAMS ((tree));
+static void maybe_deduce_size_from_array_init PARAMS ((tree, tree));
+static void layout_var_decl PARAMS ((tree));
+static void maybe_commonize_var PARAMS ((tree));
+static tree check_initializer PARAMS ((tree, tree));
+static void make_rtl_for_nonlocal_decl PARAMS ((tree, tree, const char *));
+static void push_cp_function_context PARAMS ((struct function *));
+static void pop_cp_function_context PARAMS ((struct function *));
+static void mark_binding_level PARAMS ((void *));
+static void mark_named_label_lists PARAMS ((void *, void *));
+static void mark_cp_function_context PARAMS ((struct function *));
+static void mark_saved_scope PARAMS ((void *));
+static void mark_lang_function PARAMS ((struct cp_language_function *));
+static void save_function_data PARAMS ((tree));
+static void check_function_type PARAMS ((tree, tree));
+static void destroy_local_var PARAMS ((tree));
+static void begin_constructor_body PARAMS ((void));
+static void finish_constructor_body PARAMS ((void));
+static void begin_destructor_body PARAMS ((void));
+static void finish_destructor_body PARAMS ((void));
+static tree create_array_type_for_decl PARAMS ((tree, tree, tree));
+static tree get_atexit_node PARAMS ((void));
+static tree get_dso_handle_node PARAMS ((void));
+static tree start_cleanup_fn PARAMS ((void));
+static void end_cleanup_fn PARAMS ((void));
+static tree cp_make_fname_decl PARAMS ((tree, int));
+static void initialize_predefined_identifiers PARAMS ((void));
+static tree check_special_function_return_type
+ PARAMS ((special_function_kind, tree, tree));
+static tree push_cp_library_fn PARAMS ((enum tree_code, tree));
+static tree build_cp_library_fn PARAMS ((tree, enum tree_code, tree));
+static void store_parm_decls PARAMS ((tree));
+static int cp_missing_noreturn_ok_p PARAMS ((tree));
#if defined (DEBUG_CP_BINDING_LEVELS)
-static void indent PROTO((void));
+static void indent PARAMS ((void));
#endif
-/* A node which has tree code ERROR_MARK, and whose type is itself.
- All erroneous expressions are replaced with this node. All functions
- that accept nodes as arguments should avoid generating error messages
- if this node is one of the arguments, since it is undesirable to get
- multiple error messages from one error in the input. */
-
-tree error_mark_node;
-
/* Erroneous argument lists can use this *IFF* they do not modify it. */
tree error_mark_list;
-/* INTEGER_TYPE and REAL_TYPE nodes for the standard data types */
-
-tree short_integer_type_node;
-tree integer_type_node;
-tree long_integer_type_node;
-tree long_long_integer_type_node;
-
-tree short_unsigned_type_node;
-tree unsigned_type_node;
-tree long_unsigned_type_node;
-tree long_long_unsigned_type_node;
-
-tree ptrdiff_type_node;
-
-tree unsigned_char_type_node;
-tree signed_char_type_node;
-tree char_type_node;
-tree wchar_type_node;
-tree signed_wchar_type_node;
-tree unsigned_wchar_type_node;
-
-tree wchar_decl_node;
-
-tree float_type_node;
-tree double_type_node;
-tree long_double_type_node;
-
-tree complex_integer_type_node;
-tree complex_float_type_node;
-tree complex_double_type_node;
-tree complex_long_double_type_node;
-
-tree intQI_type_node;
-tree intHI_type_node;
-tree intSI_type_node;
-tree intDI_type_node;
-#if HOST_BITS_PER_WIDE_INT >= 64
-tree intTI_type_node;
-#endif
-
-tree unsigned_intQI_type_node;
-tree unsigned_intHI_type_node;
-tree unsigned_intSI_type_node;
-tree unsigned_intDI_type_node;
-#if HOST_BITS_PER_WIDE_INT >= 64
-tree unsigned_intTI_type_node;
-#endif
-
-tree java_byte_type_node;
-tree java_short_type_node;
-tree java_int_type_node;
-tree java_long_type_node;
-tree java_float_type_node;
-tree java_double_type_node;
-tree java_char_type_node;
-tree java_boolean_type_node;
+/* The following symbols are subsumed in the cp_global_trees array, and
+ listed here individually for documentation purposes.
-/* A VOID_TYPE node, and the same, packaged in a TREE_LIST. */
+ C++ extensions
+ tree wchar_decl_node;
-tree void_type_node, void_list_node;
-tree void_zero_node;
+ tree vtable_entry_type;
+ tree delta_type_node;
+ tree __t_desc_type_node;
+ tree ti_desc_type_node;
+ tree bltn_desc_type_node, ptr_desc_type_node;
+ tree ary_desc_type_node, func_desc_type_node, enum_desc_type_node;
+ tree class_desc_type_node, si_class_desc_type_node, vmi_class_desc_type_node;
+ tree ptm_desc_type_node;
+ tree base_desc_type_node;
-/* Nodes for types `void *' and `const void *'. */
+ tree class_type_node, record_type_node, union_type_node, enum_type_node;
+ tree unknown_type_node;
-tree ptr_type_node;
-tree const_ptr_type_node;
+ Array type `vtable_entry_type[]'
-/* Nodes for types `char *' and `const char *'. */
+ tree vtbl_type_node;
+ tree vtbl_ptr_type_node;
-tree string_type_node, const_string_type_node;
+ Namespaces,
-/* Type `char[256]' or something like it.
- Used when an array of char is needed and the size is irrelevant. */
+ tree std_node;
+ tree abi_node;
-tree char_array_type_node;
-
-/* Type `int[256]' or something like it.
- Used when an array of int needed and the size is irrelevant. */
-
-tree int_array_type_node;
-
-/* Type `wchar_t[256]' or something like it.
- Used when a wide string literal is created. */
-
-tree wchar_array_type_node;
-
-/* The bool data type, and constants */
-tree boolean_type_node, boolean_true_node, boolean_false_node;
-
-/* Type `int ()' -- used for implicit declaration of functions. */
-
-tree default_function_type;
-
-/* Function types `double (double)' and `double (double, double)', etc. */
+ A FUNCTION_DECL which can call `abort'. Not necessarily the
+ one that the user will declare, but sufficient to be called
+ by routines that want to abort the program.
-static tree double_ftype_double, double_ftype_double_double;
-static tree int_ftype_int, long_ftype_long;
-static tree float_ftype_float;
-static tree ldouble_ftype_ldouble;
+ tree abort_fndecl;
-/* Function type `int (const void *, const void *, size_t)' */
-static tree int_ftype_cptr_cptr_sizet;
+ The FUNCTION_DECL for the default `::operator delete'.
-/* C++ extensions */
-tree vtable_entry_type;
-tree delta_type_node;
-#if 0
-/* Old rtti stuff. */
-tree __baselist_desc_type_node;
-tree __i_desc_type_node, __m_desc_type_node;
-tree __t_desc_array_type, __i_desc_array_type, __m_desc_array_type;
-#endif
-tree __t_desc_type_node;
-#if 0
-tree __tp_desc_type_node;
-#endif
-tree __access_mode_type_node;
-tree __bltn_desc_type_node, __user_desc_type_node, __class_desc_type_node;
-tree __ptr_desc_type_node, __attr_desc_type_node, __func_desc_type_node;
-tree __ptmf_desc_type_node, __ptmd_desc_type_node;
-#if 0
-/* Not needed yet? May be needed one day? */
-tree __bltn_desc_array_type, __user_desc_array_type, __class_desc_array_type;
-tree __ptr_desc_array_type, __attr_dec_array_type, __func_desc_array_type;
-tree __ptmf_desc_array_type, __ptmd_desc_array_type;
-#endif
+ tree global_delete_fndecl;
-/* This is the identifier __vlist. */
-tree vlist_identifier;
+ Used by RTTI
+ tree type_info_type_node, tinfo_decl_id, tinfo_decl_type;
+ tree tinfo_var_id;
-/* This is the type _Vlist = vtable_entry_type**. */
-tree vlist_type_node;
+*/
-/* A null pointer of type _Vlist. */
-tree vlist_zero_node;
+tree cp_global_trees[CPTI_MAX];
/* Indicates that there is a type value in some namespace, although
- that is not necessarily in scope at the moment. */
+ that is not necessarily in scope at the moment. */
static tree global_type_node;
-tree class_star_type_node;
-tree class_type_node, record_type_node, union_type_node, enum_type_node;
-tree unknown_type_node;
-tree opaque_type_node, signature_type_node;
-tree sigtable_entry_type;
-
-/* Array type `vtable_entry_type[]' */
-tree vtbl_type_node;
-tree vtbl_ptr_type_node;
-
-/* namespace std */
-tree std_node;
-int in_std = 0;
-
/* Expect only namespace names now. */
static int only_namespace_names;
-/* In a destructor, the point at which all derived class destroying
- has been done, just before any base class destroying will be done. */
-
-tree dtor_label;
-
-/* In a destructor, the last insn emitted after the start of the
- function and the parms. */
-
-static rtx last_dtor_insn;
-
-/* In a constructor, the last insn emitted after the start of the
- function and the parms, the exception specification and any
- function-try-block. The constructor initializers are emitted after
- this insn. */
-
-static rtx last_parm_cleanup_insn;
-
-/* In a constructor, the point at which we are ready to return
- the pointer to the initialized object. */
+/* Used only for jumps to as-yet undefined labels, since jumps to
+ defined labels can have their validity checked immediately. */
-tree ctor_label;
-
-/* A FUNCTION_DECL which can call `abort'. Not necessarily the
- one that the user will declare, but sufficient to be called
- by routines that want to abort the program. */
-
-tree abort_fndecl;
-
-/* A FUNCTION_DECL for the default `::operator delete'. */
-
-tree global_delete_fndecl;
-
-extern rtx cleanup_label, return_label;
-
-/* If original DECL_RESULT of current function was a register,
- but due to being an addressable named return value, would up
- on the stack, this variable holds the named return value's
- original location. */
-static rtx original_result_rtx;
-
-/* Sequence of insns which represents base initialization. */
-tree base_init_expr;
-
-/* C++: Keep these around to reduce calls to `get_identifier'.
- Identifiers for `this' in member functions and the auto-delete
- parameter for destructors. */
-tree this_identifier, in_charge_identifier;
-tree ctor_identifier, dtor_identifier;
-/* Used in pointer to member functions, in vtables, and in sigtables. */
-tree pfn_identifier, index_identifier, delta_identifier, delta2_identifier;
-tree pfn_or_delta2_identifier, tag_identifier;
-tree vt_off_identifier;
-
-struct named_label_list
+struct named_label_use_list
{
struct binding_level *binding_level;
tree names_in_scope;
tree label_decl;
- char *filename_o_goto;
+ const char *filename_o_goto;
int lineno_o_goto;
- struct named_label_list *next;
+ struct named_label_use_list *next;
};
-/* A list (chain of TREE_LIST nodes) of named label uses.
- The TREE_PURPOSE field is the list of variables defined
- in the label's scope defined at the point of use.
- The TREE_VALUE field is the LABEL_DECL used.
- The TREE_TYPE field holds `current_binding_level' at the
- point of the label's use.
+#define named_label_uses cp_function_chain->x_named_label_uses
- BWAHAHAAHAHahhahahahaah. No, no, no, said the little chicken.
-
- Look at the pretty struct named_label_list. See the pretty struct
- with the pretty named fields that describe what they do. See the
- pretty lack of gratuitous casts. Notice the code got a lot cleaner.
-
- Used only for jumps to as-yet undefined labels, since
- jumps to defined labels can have their validity checked
- by stmt.c. */
-
-static struct named_label_list *named_label_uses = NULL;
+#define local_names cp_function_chain->x_local_names
/* A list of objects which have constructors or destructors
which reside in the global scope. The decl is stored in
@@ -458,133 +239,56 @@ tree static_aggregates;
/* -- end of C++ */
-/* Two expressions that are constants with value zero.
- The first is of type `int', the second of type `void *'. */
-
-tree integer_zero_node;
-tree null_pointer_node;
-
-/* The value for __null (NULL), namely, a zero of an integer type with
- the same number of bits as a pointer. */
-tree null_node;
-
-/* A node for the integer constants 1, 2, and 3. */
-
-tree integer_one_node, integer_two_node, integer_three_node;
-
-/* While defining an enum type, this is 1 plus the last enumerator
- constant value. */
-
-static tree enum_next_value;
-
-/* Nonzero means that there was overflow computing enum_next_value. */
-
-static int enum_overflow;
-
-/* Parsing a function declarator leaves a list of parameter names
- or a chain or parameter decls here. */
+/* A node for the integer constants 2, and 3. */
-tree last_function_parms;
-
-/* Parsing a function declarator leaves here a chain of structure
- and enum types declared in the parmlist. */
-
-static tree last_function_parm_tags;
-
-/* After parsing the declarator that starts a function definition,
- `start_function' puts here the list of parameter names or chain of decls.
- `store_parm_decls' finds it here. */
-
-static tree current_function_parms;
+tree integer_two_node, integer_three_node;
/* Similar, for last_function_parm_tags. */
-static tree current_function_parm_tags;
-
-/* A list (chain of TREE_LIST nodes) of all LABEL_DECLs in the function
- that have names. Here so we can clear out their names' definitions
- at the end of the function. */
-
-static tree named_labels;
-
-/* A list of LABEL_DECLs from outer contexts that are currently shadowed. */
-
-static tree shadowed_labels;
-
-/* The FUNCTION_DECL for the function currently being compiled,
- or 0 if between functions. */
-tree current_function_decl;
-
-/* Set to 0 at beginning of a function definition, set to 1 if
- a return statement that specifies a return value is seen. */
-
-int current_function_returns_value;
-
-/* Set to 0 at beginning of a function definition, set to 1 if
- a return statement with no argument is seen. */
-
-int current_function_returns_null;
+tree last_function_parms;
-/* Set to 0 at beginning of a function definition, and whenever
- a label (case or named) is defined. Set to value of expression
- returned from function when that value can be transformed into
- a named return value. */
+/* A list of all LABEL_DECLs in the function that have names. Here so
+ we can clear out their names' definitions at the end of the
+ function, and so we can check the validity of jumps to these labels. */
-tree current_function_return_value;
+struct named_label_list
+{
+ struct binding_level *binding_level;
+ tree names_in_scope;
+ tree old_value;
+ tree label_decl;
+ tree bad_decls;
+ struct named_label_list *next;
+ unsigned int in_try_scope : 1;
+ unsigned int in_catch_scope : 1;
+};
-/* Nonzero means give `double' the same size as `float'. */
+#define named_labels cp_function_chain->x_named_labels
-extern int flag_short_double;
+/* Nonzero means use the ISO C94 dialect of C. */
-/* Nonzero means don't recognize any builtin functions. */
+int flag_isoc94;
-extern int flag_no_builtin;
+/* Nonzero means use the ISO C99 dialect of C. */
-/* Nonzero means don't recognize the non-ANSI builtin functions.
- -ansi sets this. */
+int flag_isoc99;
-extern int flag_no_nonansi_builtin;
+/* Nonzero means we are a hosted implementation for code shared with C. */
-/* Nonzero means enable obscure ANSI features and disable GNU extensions
- that might cause ANSI-compliant code to be miscompiled. */
+int flag_hosted = 1;
-extern int flag_ansi;
+/* Nonzero means add default format_arg attributes for functions not
+ in ISO C. */
-/* Nonzero if we want to support huge (> 2^(sizeof(short)*8-1) bytes)
- objects. */
-extern int flag_huge_objects;
+int flag_noniso_default_format_attributes = 1;
/* Nonzero if we want to conserve space in the .o files. We do this
by putting uninitialized data and runtime initialized data into
.common instead of .data at the expense of not flagging multiple
definitions. */
extern int flag_conserve_space;
-
-/* Pointers to the base and current top of the language name stack. */
-
-extern tree *current_lang_base, *current_lang_stack;
/* C and C++ flags are in decl2.c. */
-/* Set to 0 at beginning of a constructor, set to 1
- if that function does an allocation before referencing its
- instance variable. */
-static int current_function_assigns_this;
-int current_function_just_assigned_this;
-
-/* Set to 0 at beginning of a function. Set non-zero when
- store_parm_decls is called. Don't call store_parm_decls
- if this flag is non-zero! */
-int current_function_parms_stored;
-
-/* Flag used when debugging spew.c */
-
-extern int spew_debug;
-
-/* This is a copy of the class_shadowed list of the previous class binding
- contour when at global scope. It's used to reset IDENTIFIER_CLASS_VALUEs
- when entering another class scope (i.e. a cache miss). */
-extern tree previous_class_values;
-
/* A expression of value 0 with the same precision as a sizetype
node, but signed. */
tree signed_size_zero_node;
@@ -593,20 +297,27 @@ tree signed_size_zero_node;
unit. */
tree anonymous_namespace_name;
-
-/* Allocate a level of searching. */
+/* The number of function bodies which we are currently processing.
+ (Zero if we are at namespace scope, one inside the body of a
+ function, two inside the body of a function in a local class, etc.) */
+int function_depth;
-static
-struct stack_level *
-push_decl_level (stack, obstack)
- struct stack_level *stack;
- struct obstack *obstack;
-{
- struct stack_level tem;
- tem.prev = stack;
+/* States indicating how grokdeclarator() should handle declspecs marked
+ with __attribute__((deprecated)). An object declared as
+ __attribute__((deprecated)) suppresses warnings of uses of other
+ deprecated items. */
+
+enum deprecated_states {
+ DEPRECATED_NORMAL,
+ DEPRECATED_SUPPRESS
+};
- return push_stack_level (obstack, (char *)&tem, sizeof (tem));
-}
+static enum deprecated_states deprecated_state = DEPRECATED_NORMAL;
+
+/* Set by add_implicitly_declared_members() to keep those members from
+ being flagged as deprecated or reported as using deprecated
+ types. */
+int adding_implicit_members = 0;
/* For each binding contour we allocate a binding_level structure
which records the names defined in that contour.
@@ -659,25 +370,27 @@ struct binding_level
/* If this binding level is the binding level for a class, then
class_shadowed is a TREE_LIST. The TREE_PURPOSE of each node
- is the name of an entity bound in the class; the TREE_VALUE is
- the IDENTIFIER_CLASS_VALUE before we entered the class. Thus,
- when leaving class scope, we can restore the
- IDENTIFIER_CLASS_VALUE by walking this list. The TREE_TYPE is
+ is the name of an entity bound in the class. The TREE_TYPE is
the DECL bound by this name in the class. */
tree class_shadowed;
/* Similar to class_shadowed, but for IDENTIFIER_TYPE_VALUE, and
- is used for all binding levels. */
+ is used for all binding levels. In addition the TREE_VALUE is the
+ IDENTIFIER_TYPE_VALUE before we entered the class. */
tree type_shadowed;
+ /* A TREE_LIST. Each TREE_VALUE is the LABEL_DECL for a local
+ label in this scope. The TREE_PURPOSE is the previous value of
+ the IDENTIFIER_LABEL VALUE. */
+ tree shadowed_labels;
+
/* For each level (except not the global one),
a chain of BLOCK nodes for all the levels
that were entered and exited one level down. */
tree blocks;
- /* The BLOCK node for this level, if one has been preallocated.
- If 0, the BLOCK is allocated (if needed) when the level is popped. */
- tree this_block;
+ /* The _TYPE node for this level, if parm_flag == 2. */
+ tree this_class;
/* The binding level which this one is contained in (inherits from). */
struct binding_level *level_chain;
@@ -687,19 +400,18 @@ struct binding_level
tree incomplete;
/* List of VAR_DECLS saved from a previous for statement.
- These would be dead in ANSI-conforming code, but might
+ These would be dead in ISO-conforming code, but might
be referenced in ARM-era code. These are stored in a
TREE_LIST; the TREE_VALUE is the actual declaration. */
tree dead_vars_from_for;
/* 1 for the level that holds the parameters of a function.
- 2 for the level that holds a class declaration.
- 3 for levels that hold parameter declarations. */
- unsigned parm_flag : 4;
+ 2 for the level that holds a class declaration. */
+ unsigned parm_flag : 2;
/* 1 means make a BLOCK for this level regardless of all else.
2 for temporary binding contours created by the compiler. */
- unsigned keep : 3;
+ unsigned keep : 2;
/* Nonzero if this level "doesn't exist" for tags. */
unsigned tag_transparent : 1;
@@ -709,19 +421,32 @@ struct binding_level
unsigned more_cleanups_ok : 1;
unsigned have_cleanups : 1;
- /* Nonzero if this level is for storing the decls for template
+ /* Nonzero if this scope is for storing the decls for template
parameters and generic decls; these decls will be discarded and
replaced with a TEMPLATE_DECL. */
- unsigned pseudo_global : 1;
+ unsigned template_parms_p : 1;
+
+ /* Nonzero if this scope corresponds to the `<>' in a
+ `template <>' clause. Whenever this flag is set,
+ TEMPLATE_PARMS_P will be set as well. */
+ unsigned template_spec_p : 1;
/* This is set for a namespace binding level. */
unsigned namespace_p : 1;
/* True if this level is that of a for-statement where we need to
- worry about ambiguous (ARM or ANSI) scope rules. */
+ worry about ambiguous (ARM or ISO) scope rules. */
unsigned is_for_scope : 1;
- /* Two bits left for this word. */
+ /* True if this level corresponds to a TRY block. Currently this
+ information is only available while building the tree structure. */
+ unsigned is_try_scope : 1;
+
+ /* True if this level corresponds to a CATCH block. Currently this
+ information is only available while building the tree structure. */
+ unsigned is_catch_scope : 1;
+
+ /* Three bits left for this word. */
#if defined(DEBUG_CP_BINDING_LEVELS)
/* Binding depth at which this level began. */
@@ -730,14 +455,17 @@ struct binding_level
};
#define NULL_BINDING_LEVEL ((struct binding_level *) NULL)
-
+
/* The binding level currently in effect. */
-static struct binding_level *current_binding_level;
+#define current_binding_level \
+ (cfun && cp_function_chain->bindings \
+ ? cp_function_chain->bindings \
+ : scope_chain->bindings)
/* The binding level of the current class, if any. */
-static struct binding_level *class_binding_level;
+#define class_binding_level scope_chain->class_bindings
/* A chain of binding_level structures awaiting reuse. */
@@ -749,10 +477,6 @@ static struct binding_level *free_binding_level;
static struct binding_level *global_binding_level;
-/* Binding level structures are initialized by copying this one. */
-
-static struct binding_level clear_binding_level;
-
/* Nonzero means unconditionally make a BLOCK for the next level pushed. */
static int keep_next_level_flag;
@@ -771,7 +495,7 @@ indent ()
}
#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
-static tree pushdecl_with_scope PROTO((tree, struct binding_level *));
+static tree pushdecl_with_scope PARAMS ((tree, struct binding_level *));
static void
push_binding_level (newlevel, tag_transparent, keep)
@@ -780,11 +504,12 @@ push_binding_level (newlevel, tag_transparent, keep)
{
/* Add this level to the front of the chain (stack) of levels that
are active. */
- *newlevel = clear_binding_level;
+ memset ((char*) newlevel, 0, sizeof (struct binding_level));
newlevel->level_chain = current_binding_level;
current_binding_level = newlevel;
newlevel->tag_transparent = tag_transparent;
newlevel->more_cleanups_ok = 1;
+
newlevel->keep = keep;
#if defined(DEBUG_CP_BINDING_LEVELS)
newlevel->binding_depth = binding_depth;
@@ -819,7 +544,7 @@ pop_binding_level ()
{
/* Cannot pop a level, if there are none left to pop. */
if (current_binding_level == global_binding_level)
- my_friendly_abort (123);
+ abort ();
}
/* Pop the current level, and free the structure for reuse. */
#if defined(DEBUG_CP_BINDING_LEVELS)
@@ -858,7 +583,7 @@ suspend_binding_level ()
{
/* Cannot suspend a level, if there are none left to suspend. */
if (current_binding_level == global_binding_level)
- my_friendly_abort (123);
+ abort ();
}
/* Suspend the current level. */
#if defined(DEBUG_CP_BINDING_LEVELS)
@@ -933,15 +658,15 @@ innermost_nonclass_level ()
/* Nonzero if we are currently in a toplevel binding level. This
means either the global binding level or a namespace in a toplevel
binding level. Since there are no non-toplevel namespace levels,
- this really means any namespace or pseudo-global level. We also
- include a class whose context is toplevel. */
+ this really means any namespace or template parameter level. We
+ also include a class whose context is toplevel. */
int
toplevel_bindings_p ()
{
struct binding_level *b = innermost_nonclass_level ();
- return b->namespace_p || b->pseudo_global;
+ return b->namespace_p || b->template_parms_p;
}
/* Nonzero if this is a namespace scope, or if we are defining a class
@@ -956,10 +681,15 @@ namespace_bindings_p ()
return b->namespace_p;
}
+/* If KEEP is non-zero, make a BLOCK node for the next binding level,
+ unconditionally. Otherwise, use the normal logic to decide whether
+ or not to create a BLOCK. */
+
void
-keep_next_level ()
+keep_next_level (keep)
+ int keep;
{
- keep_next_level_flag = 1;
+ keep_next_level_flag = keep;
}
/* Nonzero if the current level needs to have a BLOCK made. */
@@ -974,32 +704,108 @@ kept_level_p ()
&& !current_binding_level->tag_transparent));
}
-/* Identify this binding level as a level of parameters. */
-
-void
-declare_parm_level ()
-{
- current_binding_level->parm_flag = 1;
-}
-
-void
-declare_pseudo_global_level ()
-{
- current_binding_level->pseudo_global = 1;
-}
-
static void
declare_namespace_level ()
{
current_binding_level->namespace_p = 1;
}
+/* Returns non-zero if this scope was created to store template
+ parameters. */
+
int
-pseudo_global_level_p ()
+template_parm_scope_p ()
{
- struct binding_level *b = innermost_nonclass_level ();
+ return current_binding_level->template_parms_p;
+}
+
+/* Returns the kind of template specialization we are currently
+ processing, given that it's declaration contained N_CLASS_SCOPES
+ explicit scope qualifications. */
+
+tmpl_spec_kind
+current_tmpl_spec_kind (n_class_scopes)
+ int n_class_scopes;
+{
+ int n_template_parm_scopes = 0;
+ int seen_specialization_p = 0;
+ int innermost_specialization_p = 0;
+ struct binding_level *b;
+
+ /* Scan through the template parameter scopes. */
+ for (b = current_binding_level; b->template_parms_p; b = b->level_chain)
+ {
+ /* If we see a specialization scope inside a parameter scope,
+ then something is wrong. That corresponds to a declaration
+ like:
+
+ template <class T> template <> ...
+
+ which is always illegal since [temp.expl.spec] forbids the
+ specialization of a class member template if the enclosing
+ class templates are not explicitly specialized as well. */
+ if (b->template_spec_p)
+ {
+ if (n_template_parm_scopes == 0)
+ innermost_specialization_p = 1;
+ else
+ seen_specialization_p = 1;
+ }
+ else if (seen_specialization_p == 1)
+ return tsk_invalid_member_spec;
+
+ ++n_template_parm_scopes;
+ }
- return b->pseudo_global;
+ /* Handle explicit instantiations. */
+ if (processing_explicit_instantiation)
+ {
+ if (n_template_parm_scopes != 0)
+ /* We've seen a template parameter list during an explicit
+ instantiation. For example:
+
+ template <class T> template void f(int);
+
+ This is erroneous. */
+ return tsk_invalid_expl_inst;
+ else
+ return tsk_expl_inst;
+ }
+
+ if (n_template_parm_scopes < n_class_scopes)
+ /* We've not seen enough template headers to match all the
+ specialized classes present. For example:
+
+ template <class T> void R<T>::S<T>::f(int);
+
+ This is illegal; there needs to be one set of template
+ parameters for each class. */
+ return tsk_insufficient_parms;
+ else if (n_template_parm_scopes == n_class_scopes)
+ /* We're processing a non-template declaration (even though it may
+ be a member of a template class.) For example:
+
+ template <class T> void S<T>::f(int);
+
+ The `class T' maches the `S<T>', leaving no template headers
+ corresponding to the `f'. */
+ return tsk_none;
+ else if (n_template_parm_scopes > n_class_scopes + 1)
+ /* We've got too many template headers. For example:
+
+ template <> template <class T> void f (T);
+
+ There need to be more enclosing classes. */
+ return tsk_excessive_parms;
+ else
+ /* This must be a template. It's of the form:
+
+ template <class T> template <class U> void S<T>::f(U);
+
+ This is a specialization if the innermost level was a
+ specialization; otherwise it's just a definition of the
+ template. */
+ return innermost_specialization_p ? tsk_expl_spec : tsk_template;
}
void
@@ -1017,17 +823,12 @@ void
pushlevel (tag_transparent)
int tag_transparent;
{
- register struct binding_level *newlevel = NULL_BINDING_LEVEL;
+ struct binding_level *newlevel;
- /* If this is the top level of a function,
- just make sure that NAMED_LABELS is 0.
- They should have been set to 0 at the end of the previous function. */
-
- if (current_binding_level == global_binding_level)
- my_friendly_assert (named_labels == NULL_TREE, 134);
+ if (cfun && !doing_semantic_analysis_p ())
+ return;
/* Reuse or create a struct for this binding level. */
-
#if defined(DEBUG_CP_BINDING_LEVELS)
if (0)
#else /* !defined(DEBUG_CP_BINDING_LEVELS) */
@@ -1038,45 +839,94 @@ pushlevel (tag_transparent)
free_binding_level = free_binding_level->level_chain;
}
else
- {
- newlevel = make_binding_level ();
- }
+ newlevel = make_binding_level ();
push_binding_level (newlevel, tag_transparent, keep_next_level_flag);
- GNU_xref_start_scope ((HOST_WIDE_INT) newlevel);
+ GNU_xref_start_scope ((size_t) newlevel);
keep_next_level_flag = 0;
}
+/* We're defining an object of type TYPE. If it needs a cleanup, but
+ we're not allowed to add any more objects with cleanups to the current
+ scope, create a new binding level. */
+
+void
+maybe_push_cleanup_level (type)
+ tree type;
+{
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
+ && current_binding_level->more_cleanups_ok == 0)
+ {
+ keep_next_level (2);
+ pushlevel (1);
+ clear_last_expr ();
+ add_scope_stmt (/*begin_p=*/1, /*partial_p=*/1);
+ }
+}
+
+/* Enter a new scope. The KIND indicates what kind of scope is being
+ created. */
+
+void
+begin_scope (sk)
+ scope_kind sk;
+{
+ pushlevel (0);
+
+ switch (sk)
+ {
+ case sk_template_spec:
+ current_binding_level->template_spec_p = 1;
+ /* Fall through. */
+
+ case sk_template_parms:
+ current_binding_level->template_parms_p = 1;
+ break;
+
+ default:
+ abort ();
+ }
+}
+
+/* Exit the current scope. */
+
+void
+finish_scope ()
+{
+ poplevel (0, 0, 0);
+}
+
void
note_level_for_for ()
{
current_binding_level->is_for_scope = 1;
}
+/* Record that the current binding level represents a try block. */
+
void
-pushlevel_temporary (tag_transparent)
- int tag_transparent;
+note_level_for_try ()
{
- pushlevel (tag_transparent);
- current_binding_level->keep = 2;
- clear_last_expr ();
+ current_binding_level->is_try_scope = 1;
+}
- /* Note we don't call push_momentary() here. Otherwise, it would cause
- cleanups to be allocated on the momentary obstack, and they will be
- overwritten by the next statement. */
+/* Record that the current binding level represents a catch block. */
- expand_start_bindings (0);
+void
+note_level_for_catch ()
+{
+ current_binding_level->is_catch_scope = 1;
}
/* For a binding between a name and an entity at a block scope,
this is the `struct binding_level' for the block. */
#define BINDING_LEVEL(NODE) \
- (((struct tree_binding*)NODE)->scope.level)
+ (((struct tree_binding*)(NODE))->scope.level)
-/* These are currently unused, but permanent, CPLUS_BINDING nodes.
- They are kept here because they are allocated from the permanent
- obstack and cannot be easily freed. */
-static tree free_binding_nodes;
+/* A free list of CPLUS_BINDING nodes, connected by their
+ TREE_CHAINs. */
+
+static tree free_bindings;
/* Make DECL the innermost binding for ID. The LEVEL is the binding
level at which this declaration is being bound. */
@@ -1089,22 +939,13 @@ push_binding (id, decl, level)
{
tree binding;
- if (!free_binding_nodes)
+ if (free_bindings)
{
- /* There are no free nodes, so we must build one here. */
- push_obstacks_nochange ();
- end_temporary_allocation ();
- binding = make_node (CPLUS_BINDING);
- pop_obstacks ();
+ binding = free_bindings;
+ free_bindings = TREE_CHAIN (binding);
}
else
- {
- /* There are nodes on the free list. Grab the first one. */
- binding = free_binding_nodes;
-
- /* And update the free list. */
- free_binding_nodes = TREE_CHAIN (free_binding_nodes);
- }
+ binding = make_node (CPLUS_BINDING);
/* Now, fill in the binding information. */
BINDING_VALUE (binding) = decl;
@@ -1112,6 +953,7 @@ push_binding (id, decl, level)
BINDING_LEVEL (binding) = level;
INHERITED_VALUE_BINDING_P (binding) = 0;
LOCAL_BINDING_P (binding) = (level != class_binding_level);
+ BINDING_HAS_LEVEL_P (binding) = 1;
/* And put it on the front of the list of bindings for ID. */
TREE_CHAIN (binding) = IDENTIFIER_BINDING (id);
@@ -1152,9 +994,37 @@ add_binding (id, decl)
BINDING_VALUE (binding) = decl;
INHERITED_VALUE_BINDING_P (binding) = 0;
}
+ else if (TREE_CODE (BINDING_VALUE (binding)) == TYPE_DECL
+ && TREE_CODE (decl) == TYPE_DECL
+ && DECL_NAME (decl) == DECL_NAME (BINDING_VALUE (binding))
+ && (same_type_p (TREE_TYPE (decl),
+ TREE_TYPE (BINDING_VALUE (binding)))
+ /* If either type involves template parameters, we must
+ wait until instantiation. */
+ || uses_template_parms (TREE_TYPE (decl))
+ || uses_template_parms (TREE_TYPE (BINDING_VALUE (binding)))))
+ /* We have two typedef-names, both naming the same type to have
+ the same name. This is OK because of:
+
+ [dcl.typedef]
+
+ In a given scope, a typedef specifier can be used to redefine
+ the name of any type declared in that scope to refer to the
+ type to which it already refers. */
+ ok = 0;
+ /* There can be two block-scope declarations of the same variable,
+ so long as they are `extern' declarations. */
+ else if (TREE_CODE (decl) == VAR_DECL
+ && TREE_CODE (BINDING_VALUE (binding)) == VAR_DECL
+ && DECL_EXTERNAL (decl)
+ && DECL_EXTERNAL (BINDING_VALUE (binding)))
+ {
+ duplicate_decls (decl, BINDING_VALUE (binding));
+ ok = 0;
+ }
else
{
- cp_error ("declaration of `%#D'", decl);
+ error ("declaration of `%#D'", decl);
cp_error_at ("conflicts with previous declaration `%#D'",
BINDING_VALUE (binding));
ok = 0;
@@ -1163,9 +1033,23 @@ add_binding (id, decl)
return ok;
}
-/* Bind DECL to ID in the current_binding_level.
- If PUSH_USING is set in FLAGS, we know that DECL doesn't really belong
- to this binding level, that it got here through a using-declaration. */
+/* Add DECL to the list of things declared in B. */
+
+static void
+add_decl_to_level (decl, b)
+ tree decl;
+ struct binding_level *b;
+{
+ /* We build up the list in reverse order, and reverse it later if
+ necessary. */
+ TREE_CHAIN (decl) = b->names;
+ b->names = decl;
+}
+
+/* Bind DECL to ID in the current_binding_level, assumed to be a local
+ binding level. If PUSH_USING is set in FLAGS, we know that DECL
+ doesn't really belong to this binding level, that it got here
+ through a using-declaration. */
void
push_local_binding (id, decl, flags)
@@ -1202,8 +1086,7 @@ push_local_binding (id, decl, flags)
/* And put DECL on the list of things declared by the current
binding level. */
- TREE_CHAIN (decl) = b->names;
- b->names = decl;
+ add_decl_to_level (decl, b);
}
/* Bind DECL to ID in the class_binding_level. Returns nonzero if the
@@ -1245,18 +1128,16 @@ push_class_binding (id, decl)
context for an implicit typename declaration is always
the derived class in which the lookup was done, so the checks
based on the context of DECL below will not trigger. */
- if (TREE_CODE (decl) == TYPE_DECL
- && IMPLICIT_TYPENAME_P (TREE_TYPE (decl)))
+ if (IMPLICIT_TYPENAME_TYPE_DECL_P (decl))
INHERITED_VALUE_BINDING_P (binding) = 1;
else
{
if (TREE_CODE (decl) == OVERLOAD)
- context = DECL_REAL_CONTEXT (OVL_CURRENT (decl));
+ context = CP_DECL_CONTEXT (OVL_CURRENT (decl));
else
{
- my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd',
- 0);
- context = DECL_REAL_CONTEXT (decl);
+ my_friendly_assert (DECL_P (decl), 0);
+ context = context_for_name_lookup (decl);
}
if (is_properly_derived_from (current_class_type, context))
@@ -1277,13 +1158,13 @@ push_class_binding (id, decl)
/* Remove the binding for DECL which should be the innermost binding
for ID. */
-static void
-pop_binding (id, decl)
+static void
+pop_binding (id, decl)
tree id;
tree decl;
{
tree binding;
-
+
if (id == NULL_TREE)
/* It's easiest to write the loops that call this function without
checking whether or not the entities involved have names. We
@@ -1303,7 +1184,7 @@ pop_binding (id, decl)
else if (BINDING_TYPE (binding) == decl)
BINDING_TYPE (binding) = NULL_TREE;
else
- my_friendly_abort (0);
+ abort ();
if (!BINDING_VALUE (binding) && !BINDING_TYPE (binding))
{
@@ -1311,10 +1192,61 @@ pop_binding (id, decl)
identifier. Unhook it from the list of bindings. */
IDENTIFIER_BINDING (id) = TREE_CHAIN (binding);
- /* And place it on the free list. */
- TREE_CHAIN (binding) = free_binding_nodes;
- free_binding_nodes = binding;
+ /* Add it to the free list. */
+ TREE_CHAIN (binding) = free_bindings;
+ free_bindings = binding;
+
+ /* Clear the BINDING_LEVEL so the garbage collector doesn't walk
+ it. */
+ BINDING_LEVEL (binding) = NULL;
+ }
+}
+
+/* When a label goes out of scope, check to see if that label was used
+ in a valid manner, and issue any appropriate warnings or errors. */
+
+static void
+pop_label (label, old_value)
+ tree label;
+ tree old_value;
+{
+ if (!processing_template_decl && doing_semantic_analysis_p ())
+ {
+ if (DECL_INITIAL (label) == NULL_TREE)
+ {
+ cp_error_at ("label `%D' used but not defined", label);
+ /* Avoid crashing later. */
+ define_label (input_filename, 1, DECL_NAME (label));
+ }
+ else if (warn_unused_label && !TREE_USED (label))
+ cp_warning_at ("label `%D' defined but not used", label);
+ }
+
+ SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (label), old_value);
+}
+
+/* At the end of a function, all labels declared within the function
+ go out of scope. BLOCK is the top-level block for the
+ function. */
+
+static void
+pop_labels (block)
+ tree block;
+{
+ struct named_label_list *link;
+
+ /* Clear out the definitions of all label names, since their scopes
+ end here. */
+ for (link = named_labels; link; link = link->next)
+ {
+ pop_label (link->label_decl, link->old_value);
+ /* Put the labels into the "variables" of the top-level block,
+ so debugger can see them. */
+ TREE_CHAIN (link->label_decl) = BLOCK_VARS (block);
+ BLOCK_VARS (block) = link->label_decl;
}
+
+ named_labels = NULL;
}
/* Exit a binding level.
@@ -1343,17 +1275,23 @@ poplevel (keep, reverse, functionbody)
Put it into forward order, just for cleanliness. */
tree decls;
int tmp = functionbody;
- int real_functionbody = current_binding_level->keep == 2
- ? ((functionbody = 0), tmp) : functionbody;
- tree tags = functionbody >= 0 ? current_binding_level->tags : 0;
- tree subblocks = functionbody >= 0 ? current_binding_level->blocks : 0;
+ int real_functionbody;
+ tree tags;
+ tree subblocks;
tree block = NULL_TREE;
tree decl;
- int block_previously_created;
int leaving_for_scope;
- if (current_binding_level->parm_flag == 2)
- return poplevel_class ();
+ if (cfun && !doing_semantic_analysis_p ())
+ return NULL_TREE;
+
+ my_friendly_assert (current_binding_level->parm_flag != 2,
+ 19990916);
+
+ real_functionbody = (current_binding_level->keep == 2
+ ? ((functionbody = 0), tmp) : functionbody);
+ tags = functionbody >= 0 ? current_binding_level->tags : 0;
+ subblocks = functionbody >= 0 ? current_binding_level->blocks : 0;
my_friendly_assert (!current_binding_level->class_shadowed,
19990414);
@@ -1363,14 +1301,50 @@ poplevel (keep, reverse, functionbody)
rather than the end. This hack is no longer used. */
my_friendly_assert (keep == 0 || keep == 1, 0);
- GNU_xref_end_scope ((HOST_WIDE_INT) current_binding_level,
- (HOST_WIDE_INT) current_binding_level->level_chain,
+ GNU_xref_end_scope ((size_t) current_binding_level,
+ (size_t) current_binding_level->level_chain,
current_binding_level->parm_flag,
current_binding_level->keep);
if (current_binding_level->keep == 1)
keep = 1;
+ /* Any uses of undefined labels, and any defined labels, now operate
+ under constraints of next binding contour. */
+ if (cfun && !functionbody)
+ {
+ struct binding_level *level_chain;
+ level_chain = current_binding_level->level_chain;
+ if (level_chain)
+ {
+ struct named_label_use_list *uses;
+ struct named_label_list *labels;
+ for (labels = named_labels; labels; labels = labels->next)
+ if (labels->binding_level == current_binding_level)
+ {
+ tree decl;
+ if (current_binding_level->is_try_scope)
+ labels->in_try_scope = 1;
+ if (current_binding_level->is_catch_scope)
+ labels->in_catch_scope = 1;
+ for (decl = labels->names_in_scope; decl;
+ decl = TREE_CHAIN (decl))
+ if (decl_jump_unsafe (decl))
+ labels->bad_decls = tree_cons (NULL_TREE, decl,
+ labels->bad_decls);
+ labels->binding_level = level_chain;
+ labels->names_in_scope = level_chain->names;
+ }
+
+ for (uses = named_label_uses; uses; uses = uses->next)
+ if (uses->binding_level == current_binding_level)
+ {
+ uses->binding_level = level_chain;
+ uses->names_in_scope = level_chain->names;
+ }
+ }
+ }
+
/* Get the decls in the order they were written.
Usually current_binding_level->names is in reverse order.
But parameter decls were previously put in forward order. */
@@ -1383,7 +1357,6 @@ poplevel (keep, reverse, functionbody)
/* Output any nested inline functions within this block
if they weren't already output. */
-
for (decl = decls; decl; decl = TREE_CHAIN (decl))
if (TREE_CODE (decl) == FUNCTION_DECL
&& ! TREE_ASM_WRITTEN (decl)
@@ -1404,51 +1377,27 @@ poplevel (keep, reverse, functionbody)
}
}
+ /* When not in function-at-a-time mode, expand_end_bindings will
+ warn about unused variables. But, in function-at-a-time mode
+ expand_end_bindings is not passed the list of variables in the
+ current scope, and therefore no warning is emitted. So, we
+ explicitly warn here. */
+ if (!processing_template_decl)
+ warn_about_unused_variables (getdecls ());
+
/* If there were any declarations or structure tags in that level,
or if this level is a function body,
create a BLOCK to record them for the life of this function. */
-
block = NULL_TREE;
- block_previously_created = (current_binding_level->this_block != NULL_TREE);
- if (block_previously_created)
- block = current_binding_level->this_block;
- else if (keep == 1 || functionbody)
+ if (keep == 1 || functionbody)
block = make_node (BLOCK);
if (block != NULL_TREE)
{
- if (block_previously_created)
- {
- if (decls || tags || subblocks)
- {
- if (BLOCK_VARS (block) || BLOCK_TYPE_TAGS (block))
- warning ("internal compiler error: debugging info corrupted");
-
- BLOCK_VARS (block) = decls;
- BLOCK_TYPE_TAGS (block) = tags;
-
- /* We can have previous subblocks and new subblocks when
- doing fixup_gotos with complex cleanups. We chain the new
- subblocks onto the end of any pre-existing subblocks. */
- BLOCK_SUBBLOCKS (block) = chainon (BLOCK_SUBBLOCKS (block),
- subblocks);
- }
- /* If we created the block earlier on, and we are just
- diddling it now, then it already should have a proper
- BLOCK_END_NOTE value associated with it. */
- }
- else
- {
- BLOCK_VARS (block) = decls;
- BLOCK_TYPE_TAGS (block) = tags;
- BLOCK_SUBBLOCKS (block) = subblocks;
- /* Otherwise, for a new block, install a new BLOCK_END_NOTE
- value. */
- remember_end_note (block);
- }
+ BLOCK_VARS (block) = decls;
+ BLOCK_SUBBLOCKS (block) = subblocks;
}
/* In each subblock, record that this is its superior. */
-
if (keep >= 0)
for (link = subblocks; link; link = TREE_CHAIN (link))
BLOCK_SUPERCONTEXT (link) = block;
@@ -1457,15 +1406,16 @@ poplevel (keep, reverse, functionbody)
in a for-init statement were in scope after the for-statement
ended. We only use the new rules in flag_new_for_scope is
nonzero. */
- leaving_for_scope
+ leaving_for_scope
= current_binding_level->is_for_scope && flag_new_for_scope == 1;
/* Remove declarations for all the DECLs in this level. */
for (link = decls; link; link = TREE_CHAIN (link))
{
- if (leaving_for_scope && TREE_CODE (link) == VAR_DECL)
+ if (leaving_for_scope && TREE_CODE (link) == VAR_DECL
+ && DECL_NAME (link))
{
- tree outer_binding
+ tree outer_binding
= TREE_CHAIN (IDENTIFIER_BINDING (DECL_NAME (link)));
tree ns_binding;
@@ -1474,21 +1424,21 @@ poplevel (keep, reverse, functionbody)
else
ns_binding = NULL_TREE;
- if (outer_binding
- && (BINDING_LEVEL (outer_binding)
+ if (outer_binding
+ && (BINDING_LEVEL (outer_binding)
== current_binding_level->level_chain))
/* We have something like:
-
+
int i;
for (int i; ;);
-
+
and we are leaving the `for' scope. There's no reason to
keep the binding of the inner `i' in this case. */
pop_binding (DECL_NAME (link), link);
- else if ((outer_binding
- && (TREE_CODE (BINDING_VALUE (outer_binding))
+ else if ((outer_binding
+ && (TREE_CODE (BINDING_VALUE (outer_binding))
== TYPE_DECL))
- || (ns_binding
+ || (ns_binding
&& TREE_CODE (ns_binding) == TYPE_DECL))
/* Here, we have something like:
@@ -1506,11 +1456,11 @@ poplevel (keep, reverse, functionbody)
/* Mark this VAR_DECL as dead so that we can tell we left it
there only for backward compatibility. */
DECL_DEAD_FOR_LOCAL (link) = 1;
-
+
/* Keep track of what should of have happenned when we
popped the binding. */
if (outer_binding && BINDING_VALUE (outer_binding))
- DECL_SHADOWED_FOR_VAR (link)
+ DECL_SHADOWED_FOR_VAR (link)
= BINDING_VALUE (outer_binding);
/* Add it to the list of dead variables in the next
@@ -1527,18 +1477,18 @@ poplevel (keep, reverse, functionbody)
= 0;
}
}
- else
+ else
{
/* Remove the binding. */
decl = link;
if (TREE_CODE (decl) == TREE_LIST)
decl = TREE_VALUE (decl);
- if (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd')
+ if (DECL_P (decl))
pop_binding (DECL_NAME (decl), decl);
else if (TREE_CODE (decl) == OVERLOAD)
pop_binding (DECL_NAME (OVL_FUNCTION (decl)), decl);
- else
- my_friendly_abort (0);
+ else
+ abort ();
}
}
@@ -1552,7 +1502,13 @@ poplevel (keep, reverse, functionbody)
for (link = current_binding_level->type_shadowed;
link; link = TREE_CHAIN (link))
SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (link), TREE_VALUE (link));
-
+
+ /* Restore the IDENTIFIER_LABEL_VALUEs for local labels. */
+ for (link = current_binding_level->shadowed_labels;
+ link;
+ link = TREE_CHAIN (link))
+ pop_label (TREE_VALUE (link), TREE_PURPOSE (link));
+
/* There may be OVERLOADs (wrapped in TREE_LISTs) on the BLOCK_VARs
list if a `using' declaration put them there. The debugging
back-ends won't understand OVERLOAD, so we remove them here.
@@ -1574,70 +1530,24 @@ poplevel (keep, reverse, functionbody)
/* If the level being exited is the top level of a function,
check over all the labels. */
-
if (functionbody)
{
- /* If this is the top level block of a function,
- the vars are the function's parameters.
- Don't leave them in the BLOCK because they are
- found in the FUNCTION_DECL instead. */
-
+ /* Since this is the top level block of a function, the vars are
+ the function's parameters. Don't leave them in the BLOCK
+ because they are found in the FUNCTION_DECL instead. */
BLOCK_VARS (block) = 0;
-
- /* Clear out the definitions of all label names,
- since their scopes end here. */
-
- for (link = named_labels; link; link = TREE_CHAIN (link))
- {
- register tree label = TREE_VALUE (link);
-
- if (DECL_INITIAL (label) == NULL_TREE)
- {
- cp_error_at ("label `%D' used but not defined", label);
- /* Avoid crashing later. */
- define_label (input_filename, 1, DECL_NAME (label));
- }
- else if (warn_unused && !TREE_USED (label))
- cp_warning_at ("label `%D' defined but not used", label);
- SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (label), NULL_TREE);
-
- /* Put the labels into the "variables" of the
- top-level block, so debugger can see them. */
- TREE_CHAIN (label) = BLOCK_VARS (block);
- BLOCK_VARS (block) = label;
- }
-
- named_labels = NULL_TREE;
+ pop_labels (block);
}
- /* Any uses of undefined labels now operate under constraints
- of next binding contour. */
- {
- struct binding_level *level_chain;
- level_chain = current_binding_level->level_chain;
- if (level_chain)
- {
- struct named_label_list *labels;
- for (labels = named_label_uses; labels; labels = labels->next)
- if (labels->binding_level == current_binding_level)
- {
- labels->binding_level = level_chain;
- labels->names_in_scope = level_chain->names;
- }
- }
- }
-
tmp = current_binding_level->keep;
pop_binding_level ();
if (functionbody)
DECL_INITIAL (current_function_decl) = block;
else if (block)
- {
- if (!block_previously_created)
- current_binding_level->blocks
- = chainon (current_binding_level->blocks, block);
- }
+ current_binding_level->blocks
+ = chainon (current_binding_level->blocks, block);
+
/* If we did not make a block for the level just exited,
any blocks made for inner levels
(since they cannot be recorded as subblocks in that level)
@@ -1647,23 +1557,28 @@ poplevel (keep, reverse, functionbody)
current_binding_level->blocks
= chainon (current_binding_level->blocks, subblocks);
+ /* Each and every BLOCK node created here in `poplevel' is important
+ (e.g. for proper debugging information) so if we created one
+ earlier, mark it as "used". */
+ if (block)
+ TREE_USED (block) = 1;
+
/* Take care of compiler's internal binding structures. */
if (tmp == 2)
{
- expand_end_bindings (getdecls (), keep, 1);
- /* Each and every BLOCK node created here in `poplevel' is important
- (e.g. for proper debugging information) so if we created one
- earlier, mark it as "used". */
+ tree scope_stmts;
+
+ scope_stmts
+ = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/1);
if (block)
- TREE_USED (block) = 1;
- block = poplevel (keep, reverse, real_functionbody);
+ {
+ SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmts)) = block;
+ SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmts)) = block;
+ }
+
+ block = poplevel (keep, reverse, functionbody);
}
- /* Each and every BLOCK node created here in `poplevel' is important
- (e.g. for proper debugging information) so if we created one
- earlier, mark it as "used". */
- if (block)
- TREE_USED (block) = 1;
return block;
}
@@ -1709,9 +1624,11 @@ insert_block (block)
void
set_block (block)
- register tree block;
+ tree block ATTRIBUTE_UNUSED;
{
- current_binding_level->this_block = block;
+ /* The RTL expansion machinery requires us to provide this callback,
+ but it is not applicable in function-at-a-time mode. */
+ my_friendly_assert (cfun && !doing_semantic_analysis_p (), 20000911);
}
/* Do a pushlevel for class declarations. */
@@ -1740,22 +1657,21 @@ pushlevel_class ()
push_binding_level (newlevel, 0, 0);
- decl_stack = push_decl_level (decl_stack, &decl_obstack);
class_binding_level = current_binding_level;
class_binding_level->parm_flag = 2;
+ class_binding_level->this_class = current_class_type;
}
/* ...and a poplevel for class declarations. */
-static tree
+void
poplevel_class ()
{
register struct binding_level *level = class_binding_level;
tree shadowed;
my_friendly_assert (level != 0, 354);
-
- decl_stack = pop_stack_level (decl_stack);
+
/* If we're leaving a toplevel class, don't bother to do the setting
of IDENTIFIER_CLASS_VALUE to NULL_TREE, since first of all this slot
shouldn't even be used when current_class_type isn't set, and second,
@@ -1770,7 +1686,7 @@ poplevel_class ()
shadowed;
shadowed = TREE_CHAIN (shadowed))
IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (shadowed)) = NULL_TREE;
-
+
/* Find the next enclosing class, and recreate
IDENTIFIER_CLASS_VALUEs appropriate for that class. */
b = level->level_chain;
@@ -1778,8 +1694,8 @@ poplevel_class ()
b = b->level_chain;
if (b)
- for (shadowed = b->class_shadowed;
- shadowed;
+ for (shadowed = b->class_shadowed;
+ shadowed;
shadowed = TREE_CHAIN (shadowed))
{
tree t;
@@ -1787,9 +1703,9 @@ poplevel_class ()
t = IDENTIFIER_BINDING (TREE_PURPOSE (shadowed));
while (t && BINDING_LEVEL (t) != b)
t = TREE_CHAIN (t);
-
+
if (t)
- IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (shadowed))
+ IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (shadowed))
= BINDING_VALUE (t);
}
}
@@ -1806,13 +1722,13 @@ poplevel_class ()
SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (shadowed), TREE_VALUE (shadowed));
/* Remove the bindings for all of the class-level declarations. */
- for (shadowed = level->class_shadowed;
- shadowed;
+ for (shadowed = level->class_shadowed;
+ shadowed;
shadowed = TREE_CHAIN (shadowed))
pop_binding (TREE_PURPOSE (shadowed), TREE_TYPE (shadowed));
- GNU_xref_end_scope ((HOST_WIDE_INT) class_binding_level,
- (HOST_WIDE_INT) class_binding_level->level_chain,
+ GNU_xref_end_scope ((size_t) class_binding_level,
+ (size_t) class_binding_level->level_chain,
class_binding_level->parm_flag,
class_binding_level->keep);
@@ -1823,8 +1739,6 @@ poplevel_class ()
#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
pop_binding_level ();
-
- return NULL_TREE;
}
/* We are entering the scope of a class. Clear IDENTIFIER_CLASS_VALUE
@@ -1863,21 +1777,17 @@ vtype_decl_p (t, data)
void *data ATTRIBUTE_UNUSED;
{
return (TREE_CODE (t) == TYPE_DECL
- && TREE_TYPE (t) != error_mark_node
- && TYPE_LANG_SPECIFIC (TREE_TYPE (t))
- && CLASSTYPE_VSIZE (TREE_TYPE (t)));
+ && TREE_CODE (TREE_TYPE (t)) == RECORD_TYPE
+ && TYPE_POLYMORPHIC_P (TREE_TYPE (t)));
}
-/* Returns non-zero if T is a signature table. */
+/* Return the declarations that are members of the namespace NS. */
-int
-sigtable_decl_p (t, data)
- tree t;
- void *data ATTRIBUTE_UNUSED;
+tree
+cp_namespace_decls (ns)
+ tree ns;
{
- return (TREE_CODE (t) == VAR_DECL
- && TREE_TYPE (t) != error_mark_node
- && IS_SIGNATURE (TREE_TYPE (t)));
+ return NAMESPACE_LEVEL (ns)->names;
}
/* Walk all the namespaces contained NAMESPACE, including NAMESPACE
@@ -1894,19 +1804,13 @@ walk_namespaces_r (namespace, f, data)
result |= (*f) (namespace, data);
- for (current = NAMESPACE_LEVEL (namespace)->names;
+ for (current = cp_namespace_decls (namespace);
current;
current = TREE_CHAIN (current))
{
if (TREE_CODE (current) != NAMESPACE_DECL
|| DECL_NAMESPACE_ALIAS (current))
continue;
- if (!DECL_LANG_SPECIFIC (current))
- {
- /* Hmm. std. */
- my_friendly_assert (current == std_node, 393);
- continue;
- }
/* We found a namespace. */
result |= walk_namespaces_r (current, f, data);
@@ -1936,7 +1840,7 @@ struct walk_globals_data {
for which P returns non-zero, call F with its address. If any call
to F returns a non-zero value, return a non-zero value. */
-static int
+static int
walk_globals_r (namespace, data)
tree namespace;
void *data;
@@ -1993,7 +1897,7 @@ wrapup_globals_for_namespace (namespace, data)
tree namespace;
void *data;
{
- tree globals = NAMESPACE_LEVEL (namespace)->names;
+ tree globals = cp_namespace_decls (namespace);
int len = list_length (globals);
tree *vec = (tree *) alloca (sizeof (tree) * len);
int i;
@@ -2007,10 +1911,9 @@ wrapup_globals_for_namespace (namespace, data)
/* Process the decls in reverse order--earliest first.
Put them into VEC from back to front, then take out from front. */
-
for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
vec[len - i - 1] = decl;
-
+
if (last_time)
{
check_global_declarations (vec, len);
@@ -2043,6 +1946,51 @@ wrapup_globals_for_namespace (namespace, data)
}
+/* Mark ARG (which is really a struct binding_level **) for GC. */
+
+static void
+mark_binding_level (arg)
+ void *arg;
+{
+ struct binding_level *lvl = *(struct binding_level **)arg;
+
+ for (; lvl; lvl = lvl->level_chain)
+ {
+ ggc_mark_tree (lvl->names);
+ ggc_mark_tree (lvl->tags);
+ ggc_mark_tree (lvl->usings);
+ ggc_mark_tree (lvl->using_directives);
+ ggc_mark_tree (lvl->class_shadowed);
+ ggc_mark_tree (lvl->type_shadowed);
+ ggc_mark_tree (lvl->shadowed_labels);
+ ggc_mark_tree (lvl->blocks);
+ ggc_mark_tree (lvl->this_class);
+ ggc_mark_tree (lvl->incomplete);
+ ggc_mark_tree (lvl->dead_vars_from_for);
+ }
+}
+
+static void
+mark_named_label_lists (labs, uses)
+ void *labs;
+ void *uses;
+{
+ struct named_label_list *l = *(struct named_label_list **)labs;
+ struct named_label_use_list *u = *(struct named_label_use_list **)uses;
+
+ for (; l; l = l->next)
+ {
+ ggc_mark (l);
+ mark_binding_level (l->binding_level);
+ ggc_mark_tree (l->old_value);
+ ggc_mark_tree (l->label_decl);
+ ggc_mark_tree (l->bad_decls);
+ }
+
+ for (; u; u = u->next)
+ ggc_mark (u);
+}
+
/* For debugging. */
static int no_print_functions = 0;
static int no_print_builtins = 0;
@@ -2070,7 +2018,7 @@ print_binding_level (lvl)
/* We can probably fit 3 names to a line? */
for (t = lvl->names; t; t = TREE_CHAIN (t))
{
- if (no_print_functions && (TREE_CODE (t) == FUNCTION_DECL))
+ if (no_print_functions && (TREE_CODE (t) == FUNCTION_DECL))
continue;
if (no_print_builtins
&& (TREE_CODE (t) == TYPE_DECL)
@@ -2209,14 +2157,14 @@ find_binding (name, scope)
tree iter, prev = NULL_TREE;
scope = ORIGINAL_NAMESPACE (scope);
-
+
for (iter = IDENTIFIER_NAMESPACE_BINDINGS (name); iter;
iter = TREE_CHAIN (iter))
{
my_friendly_assert (TREE_CODE (iter) == CPLUS_BINDING, 374);
if (BINDING_SCOPE (iter) == scope)
{
- /* Move binding found to the fron of the list, so
+ /* Move binding found to the front of the list, so
subsequent lookups will find it faster. */
if (prev)
{
@@ -2244,7 +2192,7 @@ binding_for_name (name, scope)
tree result;
scope = ORIGINAL_NAMESPACE (scope);
-
+
if (b && TREE_CODE (b) != CPLUS_BINDING)
{
/* Get rid of optimization for global scope. */
@@ -2254,15 +2202,13 @@ binding_for_name (name, scope)
}
if (b && (result = find_binding (name, scope)))
return result;
- /* Not found, make a new permanent one. */
- push_obstacks (&permanent_obstack, &permanent_obstack);
+ /* Not found, make a new one. */
result = make_node (CPLUS_BINDING);
TREE_CHAIN (result) = b;
IDENTIFIER_NAMESPACE_BINDINGS (name) = result;
BINDING_SCOPE (result) = scope;
BINDING_TYPE (result) = NULL_TREE;
BINDING_VALUE (result) = NULL_TREE;
- pop_obstacks ();
return result;
}
@@ -2300,7 +2246,7 @@ set_namespace_binding (name, scope, val)
if (scope == NULL_TREE)
scope = global_namespace;
-
+
if (scope == global_namespace)
{
b = IDENTIFIER_NAMESPACE_BINDINGS (name);
@@ -2344,12 +2290,6 @@ push_namespace (name)
need_new = 0;
implicit_use = 1;
}
- else if (current_namespace == global_namespace
- && name == DECL_NAME (std_node))
- {
- in_std++;
- return;
- }
else
{
/* Check whether this is an extended namespace definition. */
@@ -2359,13 +2299,13 @@ push_namespace (name)
need_new = 0;
if (DECL_NAMESPACE_ALIAS (d))
{
- cp_error ("namespace alias `%D' not allowed here, assuming `%D'",
+ error ("namespace alias `%D' not allowed here, assuming `%D'",
d, DECL_NAMESPACE_ALIAS (d));
d = DECL_NAMESPACE_ALIAS (d);
}
}
}
-
+
if (need_new)
{
/* Make a new namespace, binding the name to it. */
@@ -2374,6 +2314,7 @@ push_namespace (name)
level is set elsewhere. */
if (!global)
{
+ DECL_CONTEXT (d) = FROB_CONTEXT (current_namespace);
d = pushdecl (d);
pushlevel (0);
declare_namespace_level ();
@@ -2394,55 +2335,92 @@ push_namespace (name)
void
pop_namespace ()
{
- if (current_namespace == global_namespace)
- {
- my_friendly_assert (in_std>0, 980421);
- in_std--;
- return;
- }
+ my_friendly_assert (current_namespace != global_namespace, 20010801);
current_namespace = CP_DECL_CONTEXT (current_namespace);
/* The binding level is not popped, as it might be re-opened later. */
suspend_binding_level ();
}
+/* Push into the scope of the namespace NS, even if it is deeply
+ nested within another namespace. */
+
+void
+push_nested_namespace (ns)
+ tree ns;
+{
+ if (ns == global_namespace)
+ push_to_top_level ();
+ else
+ {
+ push_nested_namespace (CP_DECL_CONTEXT (ns));
+ push_namespace (DECL_NAME (ns));
+ }
+}
+
+/* Pop back from the scope of the namespace NS, which was previously
+ entered with push_nested_namespace. */
+
+void
+pop_nested_namespace (ns)
+ tree ns;
+{
+ while (ns != global_namespace)
+ {
+ pop_namespace ();
+ ns = CP_DECL_CONTEXT (ns);
+ }
+
+ pop_from_top_level ();
+}
+
/* Subroutines for reverting temporarily to top-level for instantiation
of templates and such. We actually need to clear out the class- and
local-value slots of all identifiers, so that only the global values
are at all visible. Simply setting current_binding_level to the global
scope isn't enough, because more binding levels may be pushed. */
-struct saved_scope {
- struct binding_level *old_binding_level;
- tree old_bindings;
- tree old_namespace;
- struct saved_scope *prev;
- tree class_name, class_type;
- tree access_specifier;
- tree function_decl;
- struct binding_level *class_bindings;
- tree *lang_base, *lang_stack, lang_name;
- int lang_stacksize;
- int minimal_parse_mode;
- tree last_function_parms;
- tree template_parms;
- HOST_WIDE_INT processing_template_decl;
- tree previous_class_type, previous_class_values;
- int processing_specialization;
- int processing_explicit_instantiation;
- char *class_cache_firstobj;
-};
-static struct saved_scope *current_saved_scope;
+struct saved_scope *scope_chain;
-/* A chain of the binding vecs created by store_bindings. We create a
- whole bunch of these during compilation, on permanent_obstack, so we
- can't just throw them away. */
-static tree free_binding_vecs;
+/* Mark ARG (which is really a struct saved_scope **) for GC. */
+
+static void
+mark_saved_scope (arg)
+ void *arg;
+{
+ struct saved_scope *t = *(struct saved_scope **)arg;
+ while (t)
+ {
+ mark_binding_level (&t->class_bindings);
+ ggc_mark_tree (t->old_bindings);
+ ggc_mark_tree (t->old_namespace);
+ ggc_mark_tree (t->decl_ns_list);
+ ggc_mark_tree (t->class_name);
+ ggc_mark_tree (t->class_type);
+ ggc_mark_tree (t->access_specifier);
+ ggc_mark_tree (t->function_decl);
+ if (t->lang_base)
+ ggc_mark_tree_varray (t->lang_base);
+ ggc_mark_tree (t->lang_name);
+ ggc_mark_tree (t->template_parms);
+ ggc_mark_tree (t->x_previous_class_type);
+ ggc_mark_tree (t->x_previous_class_values);
+ ggc_mark_tree (t->x_saved_tree);
+ ggc_mark_tree (t->incomplete);
+ ggc_mark_tree (t->lookups);
+
+ mark_stmt_tree (&t->x_stmt_tree);
+ mark_binding_level (&t->bindings);
+ t = t->prev;
+ }
+}
static tree
store_bindings (names, old_bindings)
tree names, old_bindings;
{
tree t;
+ tree search_bindings = old_bindings;
+
for (t = names; t; t = TREE_CHAIN (t))
{
tree binding, t1, id;
@@ -2452,35 +2430,25 @@ store_bindings (names, old_bindings)
else
id = DECL_NAME (t);
- if (!id
+ if (!id
/* Note that we may have an IDENTIFIER_CLASS_VALUE even when
we have no IDENTIFIER_BINDING if we have left the class
scope, but cached the class-level declarations. */
|| !(IDENTIFIER_BINDING (id) || IDENTIFIER_CLASS_VALUE (id)))
continue;
- for (t1 = old_bindings; t1; t1 = TREE_CHAIN (t1))
+ for (t1 = search_bindings; t1; t1 = TREE_CHAIN (t1))
if (TREE_VEC_ELT (t1, 0) == id)
goto skip_it;
- if (free_binding_vecs)
- {
- binding = free_binding_vecs;
- free_binding_vecs = TREE_CHAIN (free_binding_vecs);
- }
- else
- binding = make_tree_vec (4);
-
- if (id)
- {
- my_friendly_assert (TREE_CODE (id) == IDENTIFIER_NODE, 135);
- TREE_VEC_ELT (binding, 0) = id;
- TREE_VEC_ELT (binding, 1) = REAL_IDENTIFIER_TYPE_VALUE (id);
- TREE_VEC_ELT (binding, 2) = IDENTIFIER_BINDING (id);
- TREE_VEC_ELT (binding, 3) = IDENTIFIER_CLASS_VALUE (id);
- IDENTIFIER_BINDING (id) = NULL_TREE;
- IDENTIFIER_CLASS_VALUE (id) = NULL_TREE;
- }
+ my_friendly_assert (TREE_CODE (id) == IDENTIFIER_NODE, 135);
+ binding = make_tree_vec (4);
+ TREE_VEC_ELT (binding, 0) = id;
+ TREE_VEC_ELT (binding, 1) = REAL_IDENTIFIER_TYPE_VALUE (id);
+ TREE_VEC_ELT (binding, 2) = IDENTIFIER_BINDING (id);
+ TREE_VEC_ELT (binding, 3) = IDENTIFIER_CLASS_VALUE (id);
+ IDENTIFIER_BINDING (id) = NULL_TREE;
+ IDENTIFIER_CLASS_VALUE (id) = NULL_TREE;
TREE_CHAIN (binding) = old_bindings;
old_bindings = binding;
skip_it:
@@ -2493,15 +2461,26 @@ void
maybe_push_to_top_level (pseudo)
int pseudo;
{
- extern int current_lang_stacksize;
- struct saved_scope *s
- = (struct saved_scope *) xmalloc (sizeof (struct saved_scope));
- struct binding_level *b = current_binding_level;
- tree old_bindings = NULL_TREE;
+ struct saved_scope *s;
+ struct binding_level *b;
+ tree old_bindings;
+ int need_pop;
- push_cp_function_context (NULL_TREE);
+ s = (struct saved_scope *) xcalloc (1, sizeof (struct saved_scope));
- if (previous_class_type)
+ b = scope_chain ? current_binding_level : 0;
+
+ /* If we're in the middle of some function, save our state. */
+ if (cfun)
+ {
+ need_pop = 1;
+ push_function_context_to (NULL_TREE);
+ }
+ else
+ need_pop = 0;
+
+ old_bindings = NULL_TREE;
+ if (scope_chain && previous_class_type)
old_bindings = store_bindings (previous_class_values, old_bindings);
/* Have to include global_binding_level, because class-level decls
@@ -2514,7 +2493,7 @@ maybe_push_to_top_level (pseudo)
inserted into namespace level, finish_file wouldn't find them
when doing pending instantiations. Therefore, don't stop at
namespace level, but continue until :: . */
- if (b == global_binding_level || (pseudo && b->pseudo_global))
+ if (b == global_binding_level || (pseudo && b->template_parms_p))
break;
old_bindings = store_bindings (b->names, old_bindings);
@@ -2527,54 +2506,17 @@ maybe_push_to_top_level (pseudo)
for (t = b->type_shadowed; t; t = TREE_CHAIN (t))
SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (t), TREE_VALUE (t));
}
-
- s->old_binding_level = current_binding_level;
- current_binding_level = b;
-
- s->old_namespace = current_namespace;
- s->class_name = current_class_name;
- s->class_type = current_class_type;
- s->access_specifier = current_access_specifier;
+ s->prev = scope_chain;
+ s->old_bindings = old_bindings;
+ s->bindings = b;
+ s->need_pop_function_context = need_pop;
s->function_decl = current_function_decl;
- s->class_bindings = class_binding_level;
- s->lang_stack = current_lang_stack;
- s->lang_base = current_lang_base;
- s->lang_stacksize = current_lang_stacksize;
- s->lang_name = current_lang_name;
- s->minimal_parse_mode = minimal_parse_mode;
- s->last_function_parms = last_function_parms;
- s->template_parms = current_template_parms;
- s->processing_template_decl = processing_template_decl;
- s->previous_class_type = previous_class_type;
- s->previous_class_values = previous_class_values;
- s->class_cache_firstobj = class_cache_firstobj;
- s->processing_specialization = processing_specialization;
- s->processing_explicit_instantiation = processing_explicit_instantiation;
-
- current_class_name = current_class_type = NULL_TREE;
+
+ scope_chain = s;
current_function_decl = NULL_TREE;
- class_binding_level = (struct binding_level *)0;
- current_lang_stacksize = 10;
- current_lang_stack = current_lang_base
- = (tree *) xmalloc (current_lang_stacksize * sizeof (tree));
+ VARRAY_TREE_INIT (current_lang_base, 10, "current_lang_base");
current_lang_name = lang_name_cplusplus;
- strict_prototype = strict_prototypes_lang_cplusplus;
- named_labels = NULL_TREE;
- shadowed_labels = NULL_TREE;
- minimal_parse_mode = 0;
- previous_class_type = previous_class_values = NULL_TREE;
- class_cache_firstobj = 0;
- processing_specialization = 0;
- processing_explicit_instantiation = 0;
- current_template_parms = NULL_TREE;
- processing_template_decl = 0;
current_namespace = global_namespace;
-
- s->prev = current_saved_scope;
- s->old_bindings = old_bindings;
- current_saved_scope = s;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
}
void
@@ -2586,64 +2528,36 @@ push_to_top_level ()
void
pop_from_top_level ()
{
- extern int current_lang_stacksize;
- struct saved_scope *s = current_saved_scope;
+ struct saved_scope *s = scope_chain;
tree t;
/* Clear out class-level bindings cache. */
if (previous_class_type)
invalidate_class_lookup_cache ();
- pop_obstacks ();
+ VARRAY_FREE (current_lang_base);
- current_binding_level = s->old_binding_level;
- current_saved_scope = s->prev;
- for (t = s->old_bindings; t; )
+ scope_chain = s->prev;
+ for (t = s->old_bindings; t; t = TREE_CHAIN (t))
{
- tree save = t;
tree id = TREE_VEC_ELT (t, 0);
- if (id)
- {
- SET_IDENTIFIER_TYPE_VALUE (id, TREE_VEC_ELT (t, 1));
- IDENTIFIER_BINDING (id) = TREE_VEC_ELT (t, 2);
- IDENTIFIER_CLASS_VALUE (id) = TREE_VEC_ELT (t, 3);
- }
- t = TREE_CHAIN (t);
- TREE_CHAIN (save) = free_binding_vecs;
- free_binding_vecs = save;
+
+ SET_IDENTIFIER_TYPE_VALUE (id, TREE_VEC_ELT (t, 1));
+ IDENTIFIER_BINDING (id) = TREE_VEC_ELT (t, 2);
+ IDENTIFIER_CLASS_VALUE (id) = TREE_VEC_ELT (t, 3);
}
- current_namespace = s->old_namespace;
- current_class_name = s->class_name;
- current_class_type = s->class_type;
- current_access_specifier = s->access_specifier;
+
+ /* If we were in the middle of compiling a function, restore our
+ state. */
+ if (s->need_pop_function_context)
+ pop_function_context_from (NULL_TREE);
current_function_decl = s->function_decl;
- class_binding_level = s->class_bindings;
- free (current_lang_base);
- current_lang_base = s->lang_base;
- current_lang_stack = s->lang_stack;
- current_lang_name = s->lang_name;
- current_lang_stacksize = s->lang_stacksize;
- if (current_lang_name == lang_name_cplusplus)
- strict_prototype = strict_prototypes_lang_cplusplus;
- else if (current_lang_name == lang_name_c)
- strict_prototype = strict_prototypes_lang_c;
- minimal_parse_mode = s->minimal_parse_mode;
- last_function_parms = s->last_function_parms;
- current_template_parms = s->template_parms;
- processing_template_decl = s->processing_template_decl;
- previous_class_type = s->previous_class_type;
- previous_class_values = s->previous_class_values;
- processing_specialization = s->processing_specialization;
- processing_explicit_instantiation = s->processing_explicit_instantiation;
- class_cache_firstobj = s->class_cache_firstobj;
free (s);
-
- pop_cp_function_context (NULL_TREE);
}
/* Push a definition of struct, union or enum tag "name".
- into binding_level "b". "type" should be the type node,
+ into binding_level "b". "type" should be the type node,
We assume that the tag "name" is not already defined.
Note that the definition may really be just a forward reference.
@@ -2740,49 +2654,31 @@ pop_everything ()
Returns the TYPE_DECL for TYPE, which may have been altered by this
processing. */
-static tree
+static tree
maybe_process_template_type_declaration (type, globalize, b)
tree type;
int globalize;
struct binding_level* b;
{
tree decl = TYPE_NAME (type);
-
+
if (processing_template_parmlist)
/* You can't declare a new template type in a template parameter
list. But, you can declare a non-template type:
-
+
template <class A*> struct S;
-
+
is a forward-declaration of `A'. */
;
- else
+ else
{
maybe_check_template_type (type);
- my_friendly_assert (IS_AGGR_TYPE (type)
+ my_friendly_assert (IS_AGGR_TYPE (type)
|| TREE_CODE (type) == ENUMERAL_TYPE, 0);
-
-
- if (/* If !GLOBALIZE then we are looking at a definition.
- It may not be a primary template. (For example, in:
-
- template <class T>
- struct S1 { class S2 {}; }
-
- we have to push_template_decl for S2.) */
- (processing_template_decl && !globalize)
- /* If we are declaring a friend template class, we will
- have GLOBALIZE set, since something like:
-
- template <class T>
- struct S1 {
- template <class U>
- friend class S2;
- };
-
- declares S2 to be at global scope. */
- || PROCESSING_REAL_TEMPLATE_DECL_P ())
+
+
+ if (processing_template_decl)
{
/* This may change after the call to
push_template_decl_real, but we want the original value. */
@@ -2797,16 +2693,16 @@ maybe_process_template_type_declaration (type, globalize, b)
friend case, push_template_decl will already have put the
friend into global scope, if appropriate. */
if (TREE_CODE (type) != ENUMERAL_TYPE
- && !globalize && b->pseudo_global
+ && !globalize && b->template_parms_p
&& b->level_chain->parm_flag == 2)
{
finish_member_declaration (CLASSTYPE_TI_TEMPLATE (type));
/* Put this tag on the list of tags for the class, since
that won't happen below because B is not the class
binding level, but is instead the pseudo-global level. */
- b->level_chain->tags =
- saveable_tree_cons (name, type, b->level_chain->tags);
- if (TYPE_SIZE (current_class_type) == NULL_TREE)
+ b->level_chain->tags =
+ tree_cons (name, type, b->level_chain->tags);
+ if (!COMPLETE_TYPE_P (current_class_type))
CLASSTYPE_TAGS (current_class_type) = b->level_chain->tags;
}
}
@@ -2815,6 +2711,64 @@ maybe_process_template_type_declaration (type, globalize, b)
return decl;
}
+/* In C++, you don't have to write `struct S' to refer to `S'; you
+ can just use `S'. We accomplish this by creating a TYPE_DECL as
+ if the user had written `typedef struct S S'. Create and return
+ the TYPE_DECL for TYPE. */
+
+tree
+create_implicit_typedef (name, type)
+ tree name;
+ tree type;
+{
+ tree decl;
+
+ decl = build_decl (TYPE_DECL, name, type);
+ DECL_ARTIFICIAL (decl) = 1;
+ /* There are other implicit type declarations, like the one *within*
+ a class that allows you to write `S::S'. We must distinguish
+ amongst these. */
+ SET_DECL_IMPLICIT_TYPEDEF_P (decl);
+ TYPE_NAME (type) = decl;
+
+ return decl;
+}
+
+/* Remember a local name for name-mangling purposes. */
+
+static void
+push_local_name (decl)
+ tree decl;
+{
+ size_t i, nelts;
+ tree t, name;
+
+ if (!local_names)
+ VARRAY_TREE_INIT (local_names, 8, "local_names");
+
+ name = DECL_NAME (decl);
+
+ nelts = VARRAY_ACTIVE_SIZE (local_names);
+ for (i = 0; i < nelts; i++)
+ {
+ t = VARRAY_TREE (local_names, i);
+ if (DECL_NAME (t) == name)
+ {
+ if (!DECL_LANG_SPECIFIC (decl))
+ retrofit_lang_decl (decl);
+ if (DECL_LANG_SPECIFIC (t))
+ DECL_DISCRIMINATOR (decl) = DECL_DISCRIMINATOR (t) + 1;
+ else
+ DECL_DISCRIMINATOR (decl) = 1;
+
+ VARRAY_TREE (local_names, i) = decl;
+ return;
+ }
+ }
+
+ VARRAY_PUSH_TREE (local_names, decl);
+}
+
/* Push a tag name NAME for struct/class/union/enum type TYPE.
Normally put it into the inner-most non-tag-transparent scope,
but if GLOBALIZE is true, put it in the inner-most non-class scope.
@@ -2829,13 +2783,16 @@ pushtag (name, type, globalize)
b = current_binding_level;
while (b->tag_transparent
- || (globalize && b->parm_flag == 2))
+ || (b->parm_flag == 2
+ && (globalize
+ /* We may be defining a new type in the initializer
+ of a static member variable. We allow this when
+ not pedantic, and it is particularly useful for
+ type punning via an anonymous union. */
+ || COMPLETE_TYPE_P (b->this_class))))
b = b->level_chain;
- if (toplevel_bindings_p ())
- b->tags = perm_tree_cons (name, type, b->tags);
- else
- b->tags = saveable_tree_cons (name, type, b->tags);
+ b->tags = tree_cons (name, type, b->tags);
if (name)
{
@@ -2843,59 +2800,42 @@ pushtag (name, type, globalize)
if (IDENTIFIER_TYPE_VALUE (name) != type)
{
register tree d = NULL_TREE;
- int newdecl = 0, in_class = 0;
- tree context;
- tree c_decl = NULL_TREE;
+ int in_class = 0;
+ tree context = TYPE_CONTEXT (type);
- context = type ? TYPE_CONTEXT (type) : NULL_TREE;
if (! context)
{
tree cs = current_scope ();
if (! globalize)
context = cs;
- else if (cs != NULL_TREE
- && TREE_CODE_CLASS (TREE_CODE (cs)) == 't')
+ else if (cs != NULL_TREE && TYPE_P (cs))
/* When declaring a friend class of a local class, we want
to inject the newly named class into the scope
containing the local class, not the namespace scope. */
- context = hack_decl_function_context (get_type_decl (cs));
+ context = decl_function_context (get_type_decl (cs));
}
- if (context)
- c_decl = TREE_CODE (context) == FUNCTION_DECL
- ? context : TYPE_MAIN_DECL (context);
-
if (!context)
context = current_namespace;
- if ((b->pseudo_global && b->level_chain->parm_flag == 2)
+ if ((b->template_parms_p && b->level_chain->parm_flag == 2)
|| b->parm_flag == 2)
in_class = 1;
- else
- d = lookup_nested_type (type, c_decl);
- if (d == NULL_TREE)
- {
- newdecl = 1;
- d = build_decl (TYPE_DECL, name, type);
- if (current_lang_name == lang_name_java)
- TYPE_FOR_JAVA (type) = 1;
- SET_DECL_ARTIFICIAL (d);
- if (! in_class)
- set_identifier_type_value_with_scope (name, type, b);
- }
- else
- d = TYPE_MAIN_DECL (d);
+ if (current_lang_name == lang_name_java)
+ TYPE_FOR_JAVA (type) = 1;
- TYPE_NAME (type) = d;
+ d = create_implicit_typedef (name, type);
DECL_CONTEXT (d) = FROB_CONTEXT (context);
+ if (! in_class)
+ set_identifier_type_value_with_scope (name, type, b);
d = maybe_process_template_type_declaration (type,
globalize, b);
if (b->parm_flag == 2)
{
- if (newdecl && !PROCESSING_REAL_TEMPLATE_DECL_P ())
+ if (!PROCESSING_REAL_TEMPLATE_DECL_P ())
/* Put this TYPE_DECL on the TYPE_FIELDS list for the
class. But if it's a member template class, we
want the TEMPLATE_DECL, not the TYPE_DECL, so this
@@ -2907,21 +2847,25 @@ pushtag (name, type, globalize)
else
d = pushdecl_with_scope (d, b);
- if (newdecl)
- {
- if (ANON_AGGRNAME_P (name))
- DECL_IGNORED_P (d) = 1;
-
- TYPE_CONTEXT (type) = DECL_CONTEXT (d);
- DECL_ASSEMBLER_NAME (d) = DECL_NAME (d);
- if (!uses_template_parms (type))
- DECL_ASSEMBLER_NAME (d)
- = get_identifier (build_overload_name (type, 1, 1));
- }
+ /* FIXME what if it gets a name from typedef? */
+ if (ANON_AGGRNAME_P (name))
+ DECL_IGNORED_P (d) = 1;
+
+ TYPE_CONTEXT (type) = DECL_CONTEXT (d);
+
+ /* If this is a local class, keep track of it. We need this
+ information for name-mangling, and so that it is possible to find
+ all function definitions in a translation unit in a convenient
+ way. (It's otherwise tricky to find a member function definition
+ it's only pointed to from within a local class.) */
+ if (TYPE_CONTEXT (type)
+ && TREE_CODE (TYPE_CONTEXT (type)) == FUNCTION_DECL
+ && !processing_template_decl)
+ VARRAY_PUSH_TREE (local_classes, type);
}
if (b->parm_flag == 2)
{
- if (TYPE_SIZE (current_class_type) == NULL_TREE)
+ if (!COMPLETE_TYPE_P (current_class_type))
CLASSTYPE_TAGS (current_class_type) = b->tags;
}
}
@@ -3019,49 +2963,41 @@ decls_match (newdecl, olddecl)
tree p1 = TYPE_ARG_TYPES (f1);
tree p2 = TYPE_ARG_TYPES (f2);
- if (DECL_REAL_CONTEXT (newdecl) != DECL_REAL_CONTEXT (olddecl)
- && ! (DECL_LANGUAGE (newdecl) == lang_c
- && DECL_LANGUAGE (olddecl) == lang_c))
+ if (CP_DECL_CONTEXT (newdecl) != CP_DECL_CONTEXT (olddecl)
+ && ! (DECL_EXTERN_C_P (newdecl)
+ && DECL_EXTERN_C_P (olddecl)))
return 0;
- /* When we parse a static member function definition,
- we put together a FUNCTION_DECL which thinks its type
- is METHOD_TYPE. Change that to FUNCTION_TYPE, and
- proceed. */
- if (TREE_CODE (f1) == METHOD_TYPE && DECL_STATIC_FUNCTION_P (olddecl))
- revert_static_member_fn (&newdecl, &f1, &p1);
- else if (TREE_CODE (f2) == METHOD_TYPE
- && DECL_STATIC_FUNCTION_P (newdecl))
- revert_static_member_fn (&olddecl, &f2, &p2);
-
- /* Here we must take care of the case where new default
- parameters are specified. Also, warn if an old
- declaration becomes ambiguous because default
- parameters may cause the two to be ambiguous. */
if (TREE_CODE (f1) != TREE_CODE (f2))
- {
- if (TREE_CODE (f1) == OFFSET_TYPE)
- cp_compiler_error ("`%D' redeclared as member function", newdecl);
- else
- cp_compiler_error ("`%D' redeclared as non-member function", newdecl);
- return 0;
- }
+ return 0;
if (same_type_p (TREE_TYPE (f1), TREE_TYPE (f2)))
{
- if (! strict_prototypes_lang_c && DECL_LANGUAGE (olddecl) == lang_c
- && p2 == NULL_TREE)
+ if (p2 == NULL_TREE && DECL_EXTERN_C_P (olddecl)
+ && (DECL_BUILT_IN (olddecl)
+#ifndef NO_IMPLICIT_EXTERN_C
+ || (DECL_IN_SYSTEM_HEADER (newdecl) && !DECL_CLASS_SCOPE_P (newdecl))
+ || (DECL_IN_SYSTEM_HEADER (olddecl) && !DECL_CLASS_SCOPE_P (olddecl))
+#endif
+ ))
{
types_match = self_promoting_args_p (p1);
if (p1 == void_list_node)
TREE_TYPE (newdecl) = TREE_TYPE (olddecl);
}
- else if (!strict_prototypes_lang_c && DECL_LANGUAGE (olddecl)==lang_c
- && DECL_LANGUAGE (newdecl) == lang_c && p1 == NULL_TREE)
+#ifndef NO_IMPLICIT_EXTERN_C
+ else if (p1 == NULL_TREE
+ && (DECL_EXTERN_C_P (olddecl)
+ && DECL_IN_SYSTEM_HEADER (olddecl)
+ && !DECL_CLASS_SCOPE_P (olddecl))
+ && (DECL_EXTERN_C_P (newdecl)
+ && DECL_IN_SYSTEM_HEADER (newdecl)
+ && !DECL_CLASS_SCOPE_P (newdecl)))
{
types_match = self_promoting_args_p (p2);
TREE_TYPE (newdecl) = TREE_TYPE (olddecl);
}
+#endif
else
types_match = compparms (p1, p2);
}
@@ -3073,7 +3009,11 @@ decls_match (newdecl, olddecl)
if (!comp_template_parms (DECL_TEMPLATE_PARMS (newdecl),
DECL_TEMPLATE_PARMS (olddecl)))
return 0;
-
+
+ if (TREE_CODE (DECL_TEMPLATE_RESULT (newdecl))
+ != TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)))
+ return 0;
+
if (TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL)
types_match = 1;
else
@@ -3098,8 +3038,7 @@ decls_match (newdecl, olddecl)
}
/* If NEWDECL is `static' and an `extern' was seen previously,
- warn about it. (OLDDECL may be NULL_TREE; NAME contains
- information about previous usage as an `extern'.)
+ warn about it. OLDDECL is the previous declaration.
Note that this does not apply to the C++ case of declaring
a variable `extern const' and then later `const'.
@@ -3111,34 +3050,39 @@ static void
warn_extern_redeclared_static (newdecl, olddecl)
tree newdecl, olddecl;
{
- tree name;
-
- static const char *explicit_extern_static_warning
+ static const char *const explicit_extern_static_warning
= "`%D' was declared `extern' and later `static'";
- static const char *implicit_extern_static_warning
+ static const char *const implicit_extern_static_warning
= "`%D' was declared implicitly `extern' and later `static'";
- if (TREE_CODE (newdecl) == TYPE_DECL)
+ tree name;
+
+ if (TREE_CODE (newdecl) == TYPE_DECL
+ || TREE_CODE (newdecl) == TEMPLATE_DECL
+ || TREE_CODE (newdecl) == CONST_DECL)
+ return;
+
+ /* Don't get confused by static member functions; that's a different
+ use of `static'. */
+ if (TREE_CODE (newdecl) == FUNCTION_DECL
+ && DECL_STATIC_FUNCTION_P (newdecl))
+ return;
+
+ /* If the old declaration was `static', or the new one isn't, then
+ then everything is OK. */
+ if (DECL_THIS_STATIC (olddecl) || !DECL_THIS_STATIC (newdecl))
+ return;
+
+ /* It's OK to declare a builtin function as `static'. */
+ if (TREE_CODE (olddecl) == FUNCTION_DECL
+ && DECL_ARTIFICIAL (olddecl))
return;
name = DECL_ASSEMBLER_NAME (newdecl);
- if (TREE_PUBLIC (name) && DECL_THIS_STATIC (newdecl))
- {
- /* It's okay to redeclare an ANSI built-in function as static,
- or to declare a non-ANSI built-in function as anything. */
- if (! (TREE_CODE (newdecl) == FUNCTION_DECL
- && olddecl != NULL_TREE
- && TREE_CODE (olddecl) == FUNCTION_DECL
- && (DECL_BUILT_IN (olddecl)
- || DECL_BUILT_IN_NONANSI (olddecl))))
- {
- cp_pedwarn (IDENTIFIER_IMPLICIT_DECL (name)
- ? implicit_extern_static_warning
- : explicit_extern_static_warning, newdecl);
- if (olddecl != NULL_TREE)
- cp_pedwarn_at ("previous declaration of `%D'", olddecl);
- }
- }
+ pedwarn (IDENTIFIER_IMPLICIT_DECL (name)
+ ? implicit_extern_static_warning
+ : explicit_extern_static_warning, newdecl);
+ cp_pedwarn_at ("previous declaration of `%D'", olddecl);
}
/* Handle when a new declaration NEWDECL has the same name as an old
@@ -3152,7 +3096,6 @@ int
duplicate_decls (newdecl, olddecl)
tree newdecl, olddecl;
{
- extern struct obstack permanent_obstack;
unsigned olddecl_uid = DECL_UID (olddecl);
int olddecl_friend = 0, types_match = 0;
int new_defines_function = 0;
@@ -3170,47 +3113,111 @@ duplicate_decls (newdecl, olddecl)
if (TREE_TYPE (newdecl) == error_mark_node
|| TREE_TYPE (olddecl) == error_mark_node)
types_match = 1;
-
+
+ if (DECL_P (olddecl)
+ && TREE_CODE (newdecl) == FUNCTION_DECL
+ && TREE_CODE (olddecl) == FUNCTION_DECL
+ && (DECL_UNINLINABLE (newdecl) || DECL_UNINLINABLE (olddecl)))
+ {
+ if (DECL_DECLARED_INLINE_P (newdecl)
+ && DECL_UNINLINABLE (newdecl)
+ && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
+ /* Already warned elsewhere. */;
+ else if (DECL_DECLARED_INLINE_P (olddecl)
+ && DECL_UNINLINABLE (olddecl)
+ && lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
+ /* Already warned. */;
+ else if (DECL_DECLARED_INLINE_P (newdecl)
+ && DECL_UNINLINABLE (olddecl)
+ && lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
+ {
+ warning_with_decl (newdecl,
+ "function `%s' redeclared as inline");
+ warning_with_decl (olddecl,
+ "previous declaration of function `%s' with attribute noinline");
+ }
+ else if (DECL_DECLARED_INLINE_P (olddecl)
+ && DECL_UNINLINABLE (newdecl)
+ && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
+ {
+ warning_with_decl (newdecl,
+ "function `%s' redeclared with attribute noinline");
+ warning_with_decl (olddecl,
+ "previous declaration of function `%s' was inline");
+ }
+ }
+
/* Check for redeclaration and other discrepancies. */
if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_ARTIFICIAL (olddecl)
- && (DECL_BUILT_IN (olddecl) || DECL_BUILT_IN_NONANSI (olddecl)))
- {
- /* If you declare a built-in or predefined function name as static,
- the old definition is overridden, but optionally warn this was a
- bad choice of name. Ditto for overloads. */
- if (! TREE_PUBLIC (newdecl)
- || (TREE_CODE (newdecl) == FUNCTION_DECL
- && DECL_LANGUAGE (newdecl) != DECL_LANGUAGE (olddecl)))
- {
- if (warn_shadow)
- cp_warning ("shadowing %s function `%#D'",
- DECL_BUILT_IN (olddecl) ? "built-in" : "library",
+ && DECL_ARTIFICIAL (olddecl))
+ {
+ if (TREE_CODE (newdecl) != FUNCTION_DECL)
+ {
+ /* If you declare a built-in or predefined function name as static,
+ the old definition is overridden, but optionally warn this was a
+ bad choice of name. */
+ if (! TREE_PUBLIC (newdecl))
+ {
+ if (warn_shadow)
+ warning ("shadowing %s function `%#D'",
+ DECL_BUILT_IN (olddecl) ? "built-in" : "library",
+ olddecl);
+ /* Discard the old built-in function. */
+ return 0;
+ }
+ /* If the built-in is not ansi, then programs can override
+ it even globally without an error. */
+ else if (! DECL_BUILT_IN (olddecl))
+ warning ("library function `%#D' redeclared as non-function `%#D'",
+ olddecl, newdecl);
+ else
+ {
+ error ("declaration of `%#D'", newdecl);
+ error ("conflicts with built-in declaration `%#D'",
olddecl);
- /* Discard the old built-in function. */
+ }
return 0;
}
- else if (! types_match)
+ else if (!types_match)
{
- if (TREE_CODE (newdecl) != FUNCTION_DECL)
+ if ((DECL_EXTERN_C_P (newdecl)
+ && DECL_EXTERN_C_P (olddecl))
+ || compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)),
+ TYPE_ARG_TYPES (TREE_TYPE (olddecl))))
{
- /* If the built-in is not ansi, then programs can override
- it even globally without an error. */
- if (! DECL_BUILT_IN (olddecl))
- cp_warning ("library function `%#D' redeclared as non-function `%#D'",
- olddecl, newdecl);
- else
+ /* A near match; override the builtin. */
+
+ if (TREE_PUBLIC (newdecl))
{
- cp_error ("declaration of `%#D'", newdecl);
- cp_error ("conflicts with built-in declaration `%#D'",
- olddecl);
+ warning ("new declaration `%#D'", newdecl);
+ warning ("ambiguates built-in declaration `%#D'",
+ olddecl);
}
- return 0;
+ else if (warn_shadow)
+ warning ("shadowing %s function `%#D'",
+ DECL_BUILT_IN (olddecl) ? "built-in" : "library",
+ olddecl);
}
+ else
+ /* Discard the old built-in function. */
+ return 0;
+ }
- cp_warning ("declaration of `%#D'", newdecl);
- cp_warning ("conflicts with built-in declaration `%#D'",
- olddecl);
+ if (DECL_THIS_STATIC (newdecl) && !DECL_THIS_STATIC (olddecl))
+ {
+ /* If a builtin function is redeclared as `static', merge
+ the declarations, but make the original one static. */
+ DECL_THIS_STATIC (olddecl) = 1;
+ TREE_PUBLIC (olddecl) = 0;
+
+ /* Make the old declaration consistent with the new one so
+ that all remnants of the builtin-ness of this function
+ will be banished. */
+ SET_DECL_LANGUAGE (olddecl, DECL_LANGUAGE (newdecl));
+ SET_DECL_RTL (olddecl, DECL_RTL (newdecl));
+ COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
+ SET_IDENTIFIER_GLOBAL_VALUE (DECL_ASSEMBLER_NAME (newdecl),
+ newdecl);
}
}
else if (TREE_CODE (olddecl) != TREE_CODE (newdecl))
@@ -3239,7 +3246,7 @@ duplicate_decls (newdecl, olddecl)
&& DECL_FUNCTION_TEMPLATE_P (newdecl)))
return 0;
- cp_error ("`%#D' redeclared as different kind of symbol", newdecl);
+ error ("`%#D' redeclared as different kind of symbol", newdecl);
if (TREE_CODE (olddecl) == TREE_LIST)
olddecl = TREE_VALUE (olddecl);
cp_error_at ("previous declaration of `%#D'", olddecl);
@@ -3251,7 +3258,7 @@ duplicate_decls (newdecl, olddecl)
}
else if (!types_match)
{
- if (DECL_REAL_CONTEXT (newdecl) != DECL_REAL_CONTEXT (olddecl))
+ if (CP_DECL_CONTEXT (newdecl) != CP_DECL_CONTEXT (olddecl))
/* These are certainly not duplicate declarations; they're
from different scopes. */
return 0;
@@ -3264,7 +3271,7 @@ duplicate_decls (newdecl, olddecl)
if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == TYPE_DECL
|| TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL)
{
- cp_error ("declaration of template `%#D'", newdecl);
+ error ("declaration of template `%#D'", newdecl);
cp_error_at ("conflicts with previous declaration `%#D'",
olddecl);
}
@@ -3275,24 +3282,23 @@ duplicate_decls (newdecl, olddecl)
&& comp_template_parms (DECL_TEMPLATE_PARMS (newdecl),
DECL_TEMPLATE_PARMS (olddecl)))
{
- cp_error ("new declaration `%#D'", newdecl);
+ error ("new declaration `%#D'", newdecl);
cp_error_at ("ambiguates old declaration `%#D'", olddecl);
}
return 0;
}
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
- if (DECL_LANGUAGE (newdecl) == lang_c
- && DECL_LANGUAGE (olddecl) == lang_c)
+ if (DECL_EXTERN_C_P (newdecl) && DECL_EXTERN_C_P (olddecl))
{
- cp_error ("declaration of C function `%#D' conflicts with",
+ error ("declaration of C function `%#D' conflicts with",
newdecl);
cp_error_at ("previous declaration `%#D' here", olddecl);
}
else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)),
TYPE_ARG_TYPES (TREE_TYPE (olddecl))))
{
- cp_error ("new declaration `%#D'", newdecl);
+ error ("new declaration `%#D'", newdecl);
cp_error_at ("ambiguates old declaration `%#D'", olddecl);
}
else
@@ -3303,18 +3309,18 @@ duplicate_decls (newdecl, olddecl)
else if (current_class_type == NULL_TREE
|| IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (newdecl)) != current_class_type)
{
- cp_error ("conflicting types for `%#D'", newdecl);
+ error ("conflicting types for `%#D'", newdecl);
cp_error_at ("previous declaration as `%#D'", olddecl);
}
}
- else if (TREE_CODE (newdecl) == FUNCTION_DECL
+ else if (TREE_CODE (newdecl) == FUNCTION_DECL
&& ((DECL_TEMPLATE_SPECIALIZATION (olddecl)
&& (!DECL_TEMPLATE_INFO (newdecl)
- || (DECL_TI_TEMPLATE (newdecl)
+ || (DECL_TI_TEMPLATE (newdecl)
!= DECL_TI_TEMPLATE (olddecl))))
|| (DECL_TEMPLATE_SPECIALIZATION (newdecl)
&& (!DECL_TEMPLATE_INFO (olddecl)
- || (DECL_TI_TEMPLATE (olddecl)
+ || (DECL_TI_TEMPLATE (olddecl)
!= DECL_TI_TEMPLATE (newdecl))))))
/* It's OK to have a template specialization and a non-template
with the same type, or to have specializations of two
@@ -3325,8 +3331,8 @@ duplicate_decls (newdecl, olddecl)
specialize one of its methods. This situation is legal, but
the declarations must be merged in the usual way. */
return 0;
- else if (TREE_CODE (newdecl) == FUNCTION_DECL
- && ((DECL_TEMPLATE_INSTANTIATION (olddecl)
+ else if (TREE_CODE (newdecl) == FUNCTION_DECL
+ && ((DECL_TEMPLATE_INSTANTIATION (olddecl)
&& !DECL_USE_TEMPLATE (newdecl))
|| (DECL_TEMPLATE_INSTANTIATION (newdecl)
&& !DECL_USE_TEMPLATE (olddecl))))
@@ -3343,7 +3349,7 @@ duplicate_decls (newdecl, olddecl)
const char *errmsg = redeclaration_error_message (newdecl, olddecl);
if (errmsg)
{
- cp_error (errmsg, newdecl);
+ error (errmsg, newdecl);
if (DECL_NAME (olddecl) != NULL_TREE)
cp_error_at ((DECL_INITIAL (olddecl)
&& namespace_bindings_p ())
@@ -3365,13 +3371,13 @@ duplicate_decls (newdecl, olddecl)
/* extern "C" int foo ();
int foo () { bar (); }
is OK. */
- if (current_lang_stack == current_lang_base)
- DECL_LANGUAGE (newdecl) = DECL_LANGUAGE (olddecl);
+ if (current_lang_depth () == 0)
+ SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl));
else
{
cp_error_at ("previous declaration of `%#D' with %L linkage",
olddecl, DECL_LANGUAGE (olddecl));
- cp_error ("conflicts with new declaration with %L linkage",
+ error ("conflicts with new declaration with %L linkage",
DECL_LANGUAGE (newdecl));
}
}
@@ -3386,7 +3392,7 @@ duplicate_decls (newdecl, olddecl)
if (TREE_CODE (TREE_TYPE (newdecl)) == METHOD_TYPE)
t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2);
-
+
for (; t1 && t1 != void_list_node;
t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2), i++)
if (TREE_PURPOSE (t1) && TREE_PURPOSE (t2))
@@ -3396,7 +3402,7 @@ duplicate_decls (newdecl, olddecl)
{
if (pedantic)
{
- cp_pedwarn ("default argument given for parameter %d of `%#D'",
+ pedwarn ("default argument given for parameter %d of `%#D'",
i, newdecl);
cp_pedwarn_at ("after previous specification in `%#D'",
olddecl);
@@ -3404,17 +3410,18 @@ duplicate_decls (newdecl, olddecl)
}
else
{
- cp_error ("default argument given for parameter %d of `%#D'",
+ error ("default argument given for parameter %d of `%#D'",
i, newdecl);
cp_error_at ("after previous specification in `%#D'",
olddecl);
}
}
- if (DECL_THIS_INLINE (newdecl) && ! DECL_THIS_INLINE (olddecl)
+ if (DECL_DECLARED_INLINE_P (newdecl)
+ && ! DECL_DECLARED_INLINE_P (olddecl)
&& TREE_ADDRESSABLE (olddecl) && warn_inline)
{
- cp_warning ("`%#D' was used before it was declared inline",
+ warning ("`%#D' was used before it was declared inline",
newdecl);
cp_warning_at ("previous non-inline declaration here",
olddecl);
@@ -3435,19 +3442,23 @@ duplicate_decls (newdecl, olddecl)
definition. */
if (DECL_VINDEX (olddecl))
DECL_VINDEX (newdecl) = DECL_VINDEX (olddecl);
+ if (DECL_VIRTUAL_CONTEXT (olddecl))
+ DECL_VIRTUAL_CONTEXT (newdecl) = DECL_VIRTUAL_CONTEXT (olddecl);
if (DECL_CONTEXT (olddecl))
DECL_CONTEXT (newdecl) = DECL_CONTEXT (olddecl);
- if (DECL_CLASS_CONTEXT (olddecl))
- DECL_CLASS_CONTEXT (newdecl) = DECL_CLASS_CONTEXT (olddecl);
- if (DECL_PENDING_INLINE_INFO (newdecl) == (struct pending_inline *)0)
+ if (DECL_PENDING_INLINE_INFO (newdecl) == 0)
DECL_PENDING_INLINE_INFO (newdecl) = DECL_PENDING_INLINE_INFO (olddecl);
DECL_STATIC_CONSTRUCTOR (newdecl) |= DECL_STATIC_CONSTRUCTOR (olddecl);
DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl);
- DECL_ABSTRACT_VIRTUAL_P (newdecl) |= DECL_ABSTRACT_VIRTUAL_P (olddecl);
+ DECL_PURE_VIRTUAL_P (newdecl) |= DECL_PURE_VIRTUAL_P (olddecl);
DECL_VIRTUAL_P (newdecl) |= DECL_VIRTUAL_P (olddecl);
DECL_NEEDS_FINAL_OVERRIDER_P (newdecl) |= DECL_NEEDS_FINAL_OVERRIDER_P (olddecl);
+ DECL_THIS_STATIC (newdecl) |= DECL_THIS_STATIC (olddecl);
+ if (DECL_OVERLOADED_OPERATOR_P (olddecl) != ERROR_MARK)
+ SET_OVERLOADED_OPERATOR_CODE
+ (newdecl, DECL_OVERLOADED_OPERATOR_P (olddecl));
new_defines_function = DECL_INITIAL (newdecl) != NULL_TREE;
-
+
/* Optionally warn about more than one declaration for the same
name, but don't warn about a function declaration followed by a
definition. */
@@ -3456,9 +3467,9 @@ duplicate_decls (newdecl, olddecl)
/* Don't warn about extern decl followed by definition. */
&& !(DECL_EXTERNAL (olddecl) && ! DECL_EXTERNAL (newdecl))
/* Don't warn about friends, let add_friend take care of it. */
- && ! DECL_FRIEND_P (newdecl))
+ && ! (DECL_FRIEND_P (newdecl) || DECL_FRIEND_P (olddecl)))
{
- cp_warning ("redundant redeclaration of `%D' in same scope", newdecl);
+ warning ("redundant redeclaration of `%D' in same scope", newdecl);
cp_warning_at ("previous declaration of `%D'", olddecl);
}
}
@@ -3476,44 +3487,52 @@ duplicate_decls (newdecl, olddecl)
CLASSTYPE_FRIEND_CLASSES (newtype)
= CLASSTYPE_FRIEND_CLASSES (oldtype);
}
+
+ DECL_ORIGINAL_TYPE (newdecl) = DECL_ORIGINAL_TYPE (olddecl);
}
/* Copy all the DECL_... slots specified in the new decl
except for any that we copy here from the old type. */
- DECL_MACHINE_ATTRIBUTES (newdecl)
- = merge_machine_decl_attributes (olddecl, newdecl);
+ DECL_ATTRIBUTES (newdecl)
+ = (*targetm.merge_decl_attributes) (olddecl, newdecl);
if (TREE_CODE (newdecl) == TEMPLATE_DECL)
{
- if (! duplicate_decls (DECL_TEMPLATE_RESULT (newdecl),
- DECL_TEMPLATE_RESULT (olddecl)))
- cp_error ("invalid redeclaration of %D", newdecl);
TREE_TYPE (olddecl) = TREE_TYPE (DECL_TEMPLATE_RESULT (olddecl));
- DECL_TEMPLATE_SPECIALIZATIONS (olddecl)
+ DECL_TEMPLATE_SPECIALIZATIONS (olddecl)
= chainon (DECL_TEMPLATE_SPECIALIZATIONS (olddecl),
DECL_TEMPLATE_SPECIALIZATIONS (newdecl));
-
+
+ /* If the new declaration is a definition, update the file and
+ line information on the declaration. */
+ if (DECL_INITIAL (DECL_TEMPLATE_RESULT (olddecl)) == NULL_TREE
+ && DECL_INITIAL (DECL_TEMPLATE_RESULT (newdecl)) != NULL_TREE)
+ {
+ DECL_SOURCE_LINE (olddecl)
+ = DECL_SOURCE_LINE (DECL_TEMPLATE_RESULT (olddecl))
+ = DECL_SOURCE_LINE (newdecl);
+ DECL_SOURCE_FILE (olddecl)
+ = DECL_SOURCE_FILE (DECL_TEMPLATE_RESULT (olddecl))
+ = DECL_SOURCE_FILE (newdecl);
+ }
+
return 1;
}
-
+
if (types_match)
{
/* Automatically handles default parameters. */
tree oldtype = TREE_TYPE (olddecl);
tree newtype;
- /* Make sure we put the new type in the same obstack as the old one. */
- if (oldtype)
- push_obstacks (TYPE_OBSTACK (oldtype), TYPE_OBSTACK (oldtype));
- else
- {
- push_obstacks_nochange ();
- end_temporary_allocation ();
- }
-
/* Merge the data types specified in the two decls. */
newtype = common_type (TREE_TYPE (newdecl), TREE_TYPE (olddecl));
+ /* If common_type produces a non-typedef type, just use the old type. */
+ if (TREE_CODE (newdecl) == TYPE_DECL
+ && newtype == DECL_ORIGINAL_TYPE (newdecl))
+ newtype = oldtype;
+
if (TREE_CODE (newdecl) == VAR_DECL)
DECL_THIS_EXTERN (newdecl) |= DECL_THIS_EXTERN (olddecl);
/* Do this after calling `common_type' so that default
@@ -3527,15 +3546,15 @@ duplicate_decls (newdecl, olddecl)
TREE_TYPE (olddecl) = build_exception_variant (newtype,
TYPE_RAISES_EXCEPTIONS (oldtype));
- if ((pedantic || (! DECL_IN_SYSTEM_HEADER (olddecl)
- && ! DECL_IN_SYSTEM_HEADER (newdecl)))
+ if ((pedantic || ! DECL_IN_SYSTEM_HEADER (olddecl))
&& DECL_SOURCE_LINE (olddecl) != 0
&& flag_exceptions
- && ! compexcepttypes (TREE_TYPE (newdecl), TREE_TYPE (olddecl)))
+ && !comp_except_specs (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)),
+ TYPE_RAISES_EXCEPTIONS (TREE_TYPE (olddecl)), 1))
{
- cp_pedwarn ("declaration of `%D' throws different exceptions",
+ error ("declaration of `%F' throws different exceptions",
newdecl);
- cp_pedwarn_at ("previous declaration here", olddecl);
+ cp_error_at ("than previous declaration `%F'", olddecl);
}
}
TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = newtype;
@@ -3567,7 +3586,8 @@ duplicate_decls (newdecl, olddecl)
DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl);
DECL_SOURCE_LINE (newdecl) = DECL_SOURCE_LINE (olddecl);
- if (DECL_LANG_SPECIFIC (newdecl)
+ if (CAN_HAVE_FULL_LANG_DECL_P (newdecl)
+ && DECL_LANG_SPECIFIC (newdecl)
&& DECL_LANG_SPECIFIC (olddecl))
DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl);
}
@@ -3579,14 +3599,16 @@ duplicate_decls (newdecl, olddecl)
if (DECL_SECTION_NAME (newdecl) == NULL_TREE)
DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl);
- /* Keep the old rtl since we can safely use it, unless it's the
- call to abort() used for abstract virtuals. */
- if ((DECL_LANG_SPECIFIC (olddecl)
- && !DECL_ABSTRACT_VIRTUAL_P (olddecl))
- || DECL_RTL (olddecl) != DECL_RTL (abort_fndecl))
- DECL_RTL (newdecl) = DECL_RTL (olddecl);
+ /* Keep the old rtl since we can safely use it. */
+ COPY_DECL_RTL (olddecl, newdecl);
- pop_obstacks ();
+ if (TREE_CODE (newdecl) == FUNCTION_DECL)
+ {
+ DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl)
+ |= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl);
+ DECL_NO_LIMIT_STACK (newdecl)
+ |= DECL_NO_LIMIT_STACK (olddecl);
+ }
}
/* If cannot merge, then use the new type and qualifiers,
and don't preserve the old rtl. */
@@ -3606,17 +3628,18 @@ duplicate_decls (newdecl, olddecl)
/* Merge the storage class information. */
DECL_WEAK (newdecl) |= DECL_WEAK (olddecl);
DECL_ONE_ONLY (newdecl) |= DECL_ONE_ONLY (olddecl);
+ DECL_DEFER_OUTPUT (newdecl) |= DECL_DEFER_OUTPUT (olddecl);
TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl);
TREE_STATIC (olddecl) = TREE_STATIC (newdecl) |= TREE_STATIC (olddecl);
if (! DECL_EXTERNAL (olddecl))
DECL_EXTERNAL (newdecl) = 0;
-
+
if (DECL_LANG_SPECIFIC (newdecl) && DECL_LANG_SPECIFIC (olddecl))
{
DECL_INTERFACE_KNOWN (newdecl) |= DECL_INTERFACE_KNOWN (olddecl);
DECL_NOT_REALLY_EXTERN (newdecl) |= DECL_NOT_REALLY_EXTERN (olddecl);
DECL_COMDAT (newdecl) |= DECL_COMDAT (olddecl);
- DECL_TEMPLATE_INSTANTIATED (newdecl)
+ DECL_TEMPLATE_INSTANTIATED (newdecl)
|= DECL_TEMPLATE_INSTANTIATED (olddecl);
/* Don't really know how much of the language-specific
values we should copy from old to new. */
@@ -3624,6 +3647,8 @@ duplicate_decls (newdecl, olddecl)
DECL_ACCESS (newdecl) = DECL_ACCESS (olddecl);
DECL_NONCONVERTING_P (newdecl) = DECL_NONCONVERTING_P (olddecl);
DECL_TEMPLATE_INFO (newdecl) = DECL_TEMPLATE_INFO (olddecl);
+ DECL_INITIALIZED_IN_CLASS_P (newdecl)
+ |= DECL_INITIALIZED_IN_CLASS_P (olddecl);
olddecl_friend = DECL_FRIEND_P (olddecl);
/* Only functions have DECL_BEFRIENDING_CLASSES. */
@@ -3636,8 +3661,8 @@ duplicate_decls (newdecl, olddecl)
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
- if (DECL_TEMPLATE_INSTANTIATION (olddecl)
- && !DECL_TEMPLATE_INSTANTIATION (newdecl))
+ if (DECL_TEMPLATE_INSTANTIATION (olddecl)
+ && !DECL_TEMPLATE_INSTANTIATION (newdecl))
{
/* If newdecl is not a specialization, then it is not a
template-related function at all. And that means that we
@@ -3645,21 +3670,21 @@ duplicate_decls (newdecl, olddecl)
my_friendly_assert (DECL_TEMPLATE_SPECIALIZATION (newdecl),
0);
- if (TREE_USED (olddecl))
+ if (TREE_USED (olddecl))
/* From [temp.expl.spec]:
-
+
If a template, a member template or the member of a class
template is explicitly specialized then that
specialization shall be declared before the first use of
that specialization that would cause an implicit
instantiation to take place, in every translation unit in
which such a use occurs. */
- cp_error ("explicit specialization of %D after first use",
+ error ("explicit specialization of %D after first use",
olddecl);
SET_DECL_TEMPLATE_SPECIALIZATION (olddecl);
}
- DECL_THIS_INLINE (newdecl) |= DECL_THIS_INLINE (olddecl);
+ DECL_DECLARED_INLINE_P (newdecl) |= DECL_DECLARED_INLINE_P (olddecl);
/* If either decl says `inline', this fn is inline, unless its
definition was passed already. */
@@ -3667,77 +3692,69 @@ duplicate_decls (newdecl, olddecl)
DECL_INLINE (olddecl) = 1;
DECL_INLINE (newdecl) = DECL_INLINE (olddecl);
+ DECL_UNINLINABLE (newdecl) = DECL_UNINLINABLE (olddecl)
+ = (DECL_UNINLINABLE (newdecl) || DECL_UNINLINABLE (olddecl));
+
+ /* Preserve abstractness on cloned [cd]tors. */
+ DECL_ABSTRACT (newdecl) = DECL_ABSTRACT (olddecl);
+
if (! types_match)
{
- DECL_LANGUAGE (olddecl) = DECL_LANGUAGE (newdecl);
- DECL_ASSEMBLER_NAME (olddecl) = DECL_ASSEMBLER_NAME (newdecl);
- DECL_RTL (olddecl) = DECL_RTL (newdecl);
+ SET_DECL_LANGUAGE (olddecl, DECL_LANGUAGE (newdecl));
+ COPY_DECL_ASSEMBLER_NAME (newdecl, olddecl);
+ SET_DECL_RTL (olddecl, DECL_RTL (newdecl));
}
if (! types_match || new_defines_function)
{
- /* These need to be copied so that the names are available. */
+ /* These need to be copied so that the names are available.
+ Note that if the types do match, we'll preserve inline
+ info and other bits, but if not, we won't. */
DECL_ARGUMENTS (olddecl) = DECL_ARGUMENTS (newdecl);
DECL_RESULT (olddecl) = DECL_RESULT (newdecl);
}
if (new_defines_function)
/* If defining a function declared with other language
linkage, use the previously declared language linkage. */
- DECL_LANGUAGE (newdecl) = DECL_LANGUAGE (olddecl);
- else
+ SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl));
+ else if (types_match)
{
/* If redeclaring a builtin function, and not a definition,
it stays built in. */
if (DECL_BUILT_IN (olddecl))
{
- DECL_BUILT_IN (newdecl) = 1;
+ DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
/* If we're keeping the built-in definition, keep the rtl,
regardless of declaration matches. */
- DECL_RTL (newdecl) = DECL_RTL (olddecl);
+ SET_DECL_RTL (newdecl, DECL_RTL (olddecl));
}
else
- DECL_FRAME_SIZE (newdecl) = DECL_FRAME_SIZE (olddecl);
+ DECL_NUM_STMTS (newdecl) = DECL_NUM_STMTS (olddecl);
DECL_RESULT (newdecl) = DECL_RESULT (olddecl);
- if ((DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl)))
- /* Previously saved insns go together with
- the function's previous definition. */
- DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
/* Don't clear out the arguments if we're redefining a function. */
if (DECL_ARGUMENTS (olddecl))
DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl);
}
- if (DECL_LANG_SPECIFIC (olddecl))
- DECL_MAIN_VARIANT (newdecl) = DECL_MAIN_VARIANT (olddecl);
- }
-
- if (TREE_CODE (newdecl) == NAMESPACE_DECL)
- {
- NAMESPACE_LEVEL (newdecl) = NAMESPACE_LEVEL (olddecl);
}
+ else if (TREE_CODE (newdecl) == NAMESPACE_DECL)
+ NAMESPACE_LEVEL (newdecl) = NAMESPACE_LEVEL (olddecl);
/* Now preserve various other info from the definition. */
TREE_ADDRESSABLE (newdecl) = TREE_ADDRESSABLE (olddecl);
TREE_ASM_WRITTEN (newdecl) = TREE_ASM_WRITTEN (olddecl);
DECL_COMMON (newdecl) = DECL_COMMON (olddecl);
- DECL_ASSEMBLER_NAME (newdecl) = DECL_ASSEMBLER_NAME (olddecl);
+ COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
int function_size;
- struct lang_decl *ol = DECL_LANG_SPECIFIC (olddecl);
- struct lang_decl *nl = DECL_LANG_SPECIFIC (newdecl);
function_size = sizeof (struct tree_decl);
- bcopy ((char *) newdecl + sizeof (struct tree_common),
- (char *) olddecl + sizeof (struct tree_common),
- function_size - sizeof (struct tree_common));
-
- /* Can we safely free the storage used by newdecl? */
-
-#define ROUND(x) ((x + obstack_alignment_mask (&permanent_obstack)) \
- & ~ obstack_alignment_mask (&permanent_obstack))
+ memcpy ((char *) olddecl + sizeof (struct tree_common),
+ (char *) newdecl + sizeof (struct tree_common),
+ function_size - sizeof (struct tree_common));
if (DECL_TEMPLATE_INSTANTIATION (newdecl))
{
@@ -3745,16 +3762,16 @@ duplicate_decls (newdecl, olddecl)
the following sequence of events has occurred:
o A friend function was declared in a class template. The
- class template was instantiated.
+ class template was instantiated.
- o The instantiation of the friend declaration was
- recorded on the instantiation list, and is newdecl.
+ o The instantiation of the friend declaration was
+ recorded on the instantiation list, and is newdecl.
o Later, however, instantiate_class_template called pushdecl
on the newdecl to perform name injection. But, pushdecl in
turn called duplicate_decls when it discovered that another
declaration of a global function with the same name already
- existed.
+ existed.
o Here, in duplicate_decls, we decided to clobber newdecl.
@@ -3763,53 +3780,20 @@ duplicate_decls (newdecl, olddecl)
instantiations so that if we try to do the instantiation
again we won't get the clobbered declaration. */
- tree tmpl = DECL_TI_TEMPLATE (newdecl);
- tree decls = DECL_TEMPLATE_SPECIALIZATIONS (tmpl);
+ tree tmpl = DECL_TI_TEMPLATE (newdecl);
+ tree decls = DECL_TEMPLATE_SPECIALIZATIONS (tmpl);
for (; decls; decls = TREE_CHAIN (decls))
if (TREE_VALUE (decls) == newdecl)
TREE_VALUE (decls) = olddecl;
}
-
- if (((char *)newdecl + ROUND (function_size) == (char *)nl
- && ((char *)newdecl + ROUND (function_size)
- + ROUND (sizeof (struct lang_decl))
- == obstack_next_free (&permanent_obstack)))
- || ((char *)newdecl + ROUND (function_size)
- == obstack_next_free (&permanent_obstack)))
- {
- DECL_MAIN_VARIANT (newdecl) = olddecl;
- DECL_LANG_SPECIFIC (olddecl) = ol;
- bcopy ((char *)nl, (char *)ol, sizeof (struct lang_decl));
-
- obstack_free (&permanent_obstack, newdecl);
- }
- else if (LANG_DECL_PERMANENT (ol) && ol != nl)
- {
- if (DECL_MAIN_VARIANT (olddecl) == olddecl)
- {
- /* Save these lang_decls that would otherwise be lost. */
- extern tree free_lang_decl_chain;
- tree free_lang_decl = (tree) ol;
-
- if (DECL_LANG_SPECIFIC (olddecl) == ol)
- abort ();
-
- TREE_CHAIN (free_lang_decl) = free_lang_decl_chain;
- free_lang_decl_chain = free_lang_decl;
- }
- else
- {
- /* Storage leak. */;
- }
- }
}
else
{
- bcopy ((char *) newdecl + sizeof (struct tree_common),
- (char *) olddecl + sizeof (struct tree_common),
- sizeof (struct tree_decl) - sizeof (struct tree_common)
- + tree_code_length [(int)TREE_CODE (newdecl)] * sizeof (char *));
+ memcpy ((char *) olddecl + sizeof (struct tree_common),
+ (char *) newdecl + sizeof (struct tree_common),
+ sizeof (struct tree_decl) - sizeof (struct tree_common)
+ + tree_code_length [(int)TREE_CODE (newdecl)] * sizeof (char *));
}
DECL_UID (olddecl) = olddecl_uid;
@@ -3818,7 +3802,7 @@ duplicate_decls (newdecl, olddecl)
/* NEWDECL contains the merged attribute lists.
Update OLDDECL to be the same. */
- DECL_MACHINE_ATTRIBUTES (olddecl) = DECL_MACHINE_ATTRIBUTES (newdecl);
+ DECL_ATTRIBUTES (olddecl) = DECL_ATTRIBUTES (newdecl);
return 1;
}
@@ -3836,8 +3820,15 @@ pushdecl (x)
tree x;
{
register tree t;
- register tree name = DECL_ASSEMBLER_NAME (x);
- int need_new_binding = 1;
+ register tree name;
+ int need_new_binding;
+
+ /* We shouldn't be calling pushdecl when we're generating RTL for a
+ function that we already did semantic analysis on previously. */
+ my_friendly_assert (!cfun || doing_semantic_analysis_p (),
+ 19990913);
+
+ need_new_binding = 1;
if (DECL_TEMPLATE_PARM_P (x))
/* Template parameters have no context; they are not X::T even
@@ -3848,68 +3839,124 @@ pushdecl (x)
if (current_function_decl && x != current_function_decl
/* A local declaration for a function doesn't constitute
nesting. */
- && (TREE_CODE (x) != FUNCTION_DECL || DECL_INITIAL (x))
- /* Don't change DECL_CONTEXT of virtual methods. */
- && (TREE_CODE (x) != FUNCTION_DECL || !DECL_VIRTUAL_P (x))
+ && !(TREE_CODE (x) == FUNCTION_DECL && !DECL_INITIAL (x))
+ /* A local declaration for an `extern' variable is in the
+ scope of the current namespace, not the current
+ function. */
+ && !(TREE_CODE (x) == VAR_DECL && DECL_EXTERNAL (x))
&& !DECL_CONTEXT (x))
DECL_CONTEXT (x) = current_function_decl;
- if (!DECL_CONTEXT (x))
- DECL_CONTEXT (x) = FROB_CONTEXT (current_namespace);
- }
- /* Type are looked up using the DECL_NAME, as that is what the rest of the
- compiler wants to use. */
- if (TREE_CODE (x) == TYPE_DECL || TREE_CODE (x) == VAR_DECL
- || TREE_CODE (x) == NAMESPACE_DECL)
- name = DECL_NAME (x);
+ /* If this is the declaration for a namespace-scope function,
+ but the declaration itself is in a local scope, mark the
+ declaration. */
+ if (TREE_CODE (x) == FUNCTION_DECL
+ && DECL_NAMESPACE_SCOPE_P (x)
+ && current_function_decl
+ && x != current_function_decl)
+ DECL_LOCAL_FUNCTION_P (x) = 1;
+ }
+ name = DECL_NAME (x);
if (name)
{
-#if 0
- /* Not needed...see below. */
- char *file;
- int line;
-#endif
+ int different_binding_level = 0;
+
if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
name = TREE_OPERAND (name, 0);
-
- /* Namespace-scoped variables are not found in the current level. */
- if (TREE_CODE (x) == VAR_DECL && DECL_NAMESPACE_SCOPE_P (x))
+
+ /* In case this decl was explicitly namespace-qualified, look it
+ up in its namespace context. */
+ if (TREE_CODE (x) == VAR_DECL && DECL_NAMESPACE_SCOPE_P (x)
+ && namespace_bindings_p ())
t = namespace_binding (name, DECL_CONTEXT (x));
else
t = lookup_name_current_level (name);
+
+ /* [basic.link] If there is a visible declaration of an entity
+ with linkage having the same name and type, ignoring entities
+ declared outside the innermost enclosing namespace scope, the
+ block scope declaration declares that same entity and
+ receives the linkage of the previous declaration. */
+ if (! t && current_function_decl && x != current_function_decl
+ && (TREE_CODE (x) == FUNCTION_DECL || TREE_CODE (x) == VAR_DECL)
+ && DECL_EXTERNAL (x))
+ {
+ /* Look in block scope. */
+ t = IDENTIFIER_VALUE (name);
+ /* Or in the innermost namespace. */
+ if (! t)
+ t = namespace_binding (name, DECL_CONTEXT (x));
+ /* Does it have linkage? Note that if this isn't a DECL, it's an
+ OVERLOAD, which is OK. */
+ if (t && DECL_P (t) && ! (TREE_STATIC (t) || DECL_EXTERNAL (t)))
+ t = NULL_TREE;
+ if (t)
+ different_binding_level = 1;
+ }
+
+ /* If we are declaring a function, and the result of name-lookup
+ was an OVERLOAD, look for an overloaded instance that is
+ actually the same as the function we are declaring. (If
+ there is one, we have to merge our declaration with the
+ previous declaration.) */
+ if (t && TREE_CODE (t) == OVERLOAD)
+ {
+ tree match;
+
+ if (TREE_CODE (x) == FUNCTION_DECL)
+ for (match = t; match; match = OVL_NEXT (match))
+ {
+ if (decls_match (OVL_CURRENT (match), x))
+ break;
+ }
+ else
+ /* Just choose one. */
+ match = t;
+
+ if (match)
+ t = OVL_CURRENT (match);
+ else
+ t = NULL_TREE;
+ }
+
if (t == error_mark_node)
{
/* error_mark_node is 0 for a while during initialization! */
t = NULL_TREE;
cp_error_at ("`%#D' used prior to declaration", x);
}
-
else if (t != NULL_TREE)
{
-#if 0
- /* This is turned off until I have time to do it right (bpk). */
- /* With the code below that uses it... */
- file = DECL_SOURCE_FILE (t);
- line = DECL_SOURCE_LINE (t);
-#endif
- if (TREE_CODE (t) == PARM_DECL)
+ if (different_binding_level)
+ {
+ if (decls_match (x, t))
+ /* The standard only says that the local extern
+ inherits linkage from the previous decl; in
+ particular, default args are not shared. It would
+ be nice to propagate inlining info, though. FIXME. */
+ TREE_PUBLIC (x) = TREE_PUBLIC (t);
+ }
+ else if (TREE_CODE (t) == PARM_DECL)
{
if (DECL_CONTEXT (t) == NULL_TREE)
- fatal ("parse errors have confused me too much");
+ /* This is probaby caused by too many errors, but calling
+ abort will say that if errors have occurred. */
+ abort ();
/* Check for duplicate params. */
if (duplicate_decls (x, t))
return t;
}
- else if (((TREE_CODE (x) == FUNCTION_DECL && DECL_LANGUAGE (x) == lang_c)
+ else if ((DECL_EXTERN_C_FUNCTION_P (x)
|| DECL_FUNCTION_TEMPLATE_P (x))
&& is_overloaded_fn (t))
/* Don't do anything just yet. */;
else if (t == wchar_decl_node)
{
if (pedantic && ! DECL_IN_SYSTEM_HEADER (x))
- cp_pedwarn ("redeclaration of wchar_t as `%T'", TREE_TYPE (x));
+ pedwarn ("redeclaration of `wchar_t' as `%T'",
+ TREE_TYPE (x));
/* Throw away the redeclaration. */
return t;
@@ -3921,36 +3968,6 @@ pushdecl (x)
}
else if (duplicate_decls (x, t))
{
-#if 0
- /* This is turned off until I have time to do it right (bpk). */
-
- /* Also warn if they did a prototype with `static' on it, but
- then later left the `static' off. */
- if (! TREE_PUBLIC (name) && TREE_PUBLIC (x))
- {
- if (DECL_LANG_SPECIFIC (t) && DECL_FRIEND_P (t))
- return t;
-
- if (extra_warnings)
- {
- cp_warning ("`static' missing from declaration of `%D'",
- t);
- warning_with_file_and_line (file, line,
- "previous declaration of `%s'",
- decl_as_string (t, 0));
- }
-
- /* Now fix things so it'll do what they expect. */
- if (current_function_decl)
- TREE_PUBLIC (current_function_decl) = 0;
- }
- /* Due to interference in memory reclamation (X may be
- obstack-deallocated at this point), we must guard against
- one really special case. [jason: This should be handled
- by start_function] */
- if (current_function_decl == x)
- current_function_decl = t;
-#endif
if (TREE_CODE (t) == TYPE_DECL)
SET_IDENTIFIER_TYPE_VALUE (name, TREE_TYPE (t));
else if (TREE_CODE (t) == FUNCTION_DECL)
@@ -3961,13 +3978,13 @@ pushdecl (x)
else if (DECL_MAIN_P (x))
{
/* A redeclaration of main, but not a duplicate of the
- previous one.
+ previous one.
[basic.start.main]
This function shall not be overloaded. */
cp_error_at ("invalid redeclaration of `%D'", t);
- cp_error ("as `%D'", x);
+ error ("as `%D'", x);
/* We don't try to push this declaration since that
causes a crash. */
return x;
@@ -3978,17 +3995,16 @@ pushdecl (x)
/* If this is a function conjured up by the backend, massage it
so it looks friendly. */
- if (TREE_CODE (x) == FUNCTION_DECL
- && ! DECL_LANG_SPECIFIC (x))
+ if (DECL_NON_THUNK_FUNCTION_P (x) && ! DECL_LANG_SPECIFIC (x))
{
retrofit_lang_decl (x);
- DECL_LANGUAGE (x) = lang_c;
+ SET_DECL_LANGUAGE (x, lang_c);
}
- if (TREE_CODE (x) == FUNCTION_DECL && ! DECL_FUNCTION_MEMBER_P (x))
+ if (DECL_NON_THUNK_FUNCTION_P (x) && ! DECL_FUNCTION_MEMBER_P (x))
{
t = push_overloaded_decl (x, PUSH_LOCAL);
- if (t != x || DECL_LANGUAGE (x) == lang_c)
+ if (t != x)
return t;
if (!namespace_bindings_p ())
/* We do not need to create a binding for this name;
@@ -3997,7 +4013,12 @@ pushdecl (x)
need_new_binding = 0;
}
else if (DECL_FUNCTION_TEMPLATE_P (x) && DECL_NAMESPACE_SCOPE_P (x))
- return push_overloaded_decl (x, PUSH_GLOBAL);
+ {
+ t = push_overloaded_decl (x, PUSH_GLOBAL);
+ if (t == x)
+ add_decl_to_level (x, NAMESPACE_LEVEL (CP_DECL_CONTEXT (t)));
+ return t;
+ }
/* If declaring a type as a typedef, copy the type (unless we're
at line 0), and install this TYPE_DECL as the new type's typedef
@@ -4005,7 +4026,7 @@ pushdecl (x)
if (TREE_CODE (x) == TYPE_DECL)
{
tree type = TREE_TYPE (x);
- if (DECL_SOURCE_LINE (x) == 0)
+ if (DECL_SOURCE_LINE (x) == 0)
{
if (TYPE_NAME (type) == 0)
TYPE_NAME (type) = x;
@@ -4014,24 +4035,20 @@ pushdecl (x)
/* We don't want to copy the type when all we're
doing is making a TYPE_DECL for the purposes of
inlining. */
- && (!TYPE_NAME (type)
+ && (!TYPE_NAME (type)
|| TYPE_NAME (type) != DECL_ABSTRACT_ORIGIN (x)))
{
- push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type));
-
DECL_ORIGINAL_TYPE (x) = type;
type = build_type_copy (type);
TYPE_STUB_DECL (type) = TYPE_STUB_DECL (DECL_ORIGINAL_TYPE (x));
TYPE_NAME (type) = x;
TREE_TYPE (x) = type;
-
- pop_obstacks ();
}
if (type != error_mark_node
&& TYPE_NAME (type)
&& TYPE_IDENTIFIER (type))
- set_identifier_type_value_with_scope (DECL_NAME (x), type,
+ set_identifier_type_value_with_scope (DECL_NAME (x), type,
current_binding_level);
}
@@ -4040,25 +4057,23 @@ pushdecl (x)
We get warnings about inline functions where they are defined.
We get warnings about other functions from push_overloaded_decl.
-
+
Avoid duplicate warnings where they are used. */
if (TREE_PUBLIC (x) && TREE_CODE (x) != FUNCTION_DECL)
{
tree decl;
- if (IDENTIFIER_NAMESPACE_VALUE (name) != NULL_TREE
- && (DECL_EXTERNAL (IDENTIFIER_NAMESPACE_VALUE (name))
- || TREE_PUBLIC (IDENTIFIER_NAMESPACE_VALUE (name))))
- decl = IDENTIFIER_NAMESPACE_VALUE (name);
- else
- decl = NULL_TREE;
+ decl = IDENTIFIER_NAMESPACE_VALUE (name);
+ if (decl && TREE_CODE (decl) == OVERLOAD)
+ decl = OVL_FUNCTION (decl);
- if (decl
+ if (decl && decl != error_mark_node
+ && (DECL_EXTERNAL (decl) || TREE_PUBLIC (decl))
/* If different sort of thing, we already gave an error. */
&& TREE_CODE (decl) == TREE_CODE (x)
&& !same_type_p (TREE_TYPE (x), TREE_TYPE (decl)))
{
- cp_pedwarn ("type mismatch with previous external decl", x);
+ pedwarn ("type mismatch with previous external decl", x);
cp_pedwarn_at ("previous external decl of `%#D'", decl);
}
}
@@ -4074,15 +4089,15 @@ pushdecl (x)
if (IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE && TREE_PUBLIC (x))
TREE_PUBLIC (name) = 1;
- if (!(TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x)
- && t != NULL_TREE))
- {
- if (TREE_CODE (x) == FUNCTION_DECL)
- my_friendly_assert
- ((IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE)
- || (IDENTIFIER_GLOBAL_VALUE (name) == x), 378);
- SET_IDENTIFIER_NAMESPACE_VALUE (name, x);
- }
+ /* Bind the name for the entity. */
+ if (!(TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x)
+ && t != NULL_TREE)
+ && (TREE_CODE (x) == TYPE_DECL
+ || TREE_CODE (x) == VAR_DECL
+ || TREE_CODE (x) == NAMESPACE_DECL
+ || TREE_CODE (x) == CONST_DECL
+ || TREE_CODE (x) == TEMPLATE_DECL))
+ SET_IDENTIFIER_NAMESPACE_VALUE (name, x);
/* Don't forget if the function was used via an implicit decl. */
if (IDENTIFIER_IMPLICIT_DECL (name)
@@ -4099,7 +4114,7 @@ pushdecl (x)
/* If this real decl matches the implicit, don't complain. */
&& ! (TREE_CODE (x) == FUNCTION_DECL
&& TREE_TYPE (TREE_TYPE (x)) == integer_type_node))
- cp_warning
+ warning
("`%D' was previously implicitly declared to return `int'", x);
/* If new decl is `static' and an `extern' was seen previously,
@@ -4124,16 +4139,29 @@ pushdecl (x)
/* If this is a TYPE_DECL, push it into the type value slot. */
if (TREE_CODE (x) == TYPE_DECL)
- set_identifier_type_value_with_scope (name, TREE_TYPE (x),
+ set_identifier_type_value_with_scope (name, TREE_TYPE (x),
current_binding_level);
/* Clear out any TYPE_DECL shadowed by a namespace so that
we won't think this is a type. The C struct hack doesn't
go through namespaces. */
if (TREE_CODE (x) == NAMESPACE_DECL)
- set_identifier_type_value_with_scope (name, NULL_TREE,
+ set_identifier_type_value_with_scope (name, NULL_TREE,
current_binding_level);
+ if (oldlocal)
+ {
+ tree d = oldlocal;
+
+ while (oldlocal
+ && TREE_CODE (oldlocal) == VAR_DECL
+ && DECL_DEAD_FOR_LOCAL (oldlocal))
+ oldlocal = DECL_SHADOWED_FOR_VAR (oldlocal);
+
+ if (oldlocal == NULL_TREE)
+ oldlocal = IDENTIFIER_NAMESPACE_VALUE (DECL_NAME (d));
+ }
+
/* If this is an extern function declaration, see if we
have a global definition or declaration for the function. */
if (oldlocal == NULL_TREE
@@ -4147,7 +4175,7 @@ pushdecl (x)
/* OK */;
else
{
- cp_warning ("extern declaration of `%#D' doesn't match", x);
+ warning ("extern declaration of `%#D' doesn't match", x);
cp_warning_at ("global declaration `%#D'", oldglobal);
}
}
@@ -4160,58 +4188,54 @@ pushdecl (x)
&& TREE_PUBLIC (x))
TREE_PUBLIC (name) = 1;
- if (DECL_FROM_INLINE (x))
- /* Inline decls shadow nothing. */;
-
/* Warn if shadowing an argument at the top level of the body. */
- else if (oldlocal != NULL_TREE && !DECL_EXTERNAL (x)
- && TREE_CODE (oldlocal) == PARM_DECL
- /* Don't complain if it's from an enclosing function. */
- && DECL_CONTEXT (oldlocal) == current_function_decl
- && TREE_CODE (x) != PARM_DECL)
+ if (oldlocal != NULL_TREE && !DECL_EXTERNAL (x)
+ /* Inline decls shadow nothing. */
+ && !DECL_FROM_INLINE (x)
+ && TREE_CODE (oldlocal) == PARM_DECL)
{
- /* Go to where the parms should be and see if we
- find them there. */
- struct binding_level *b = current_binding_level->level_chain;
+ bool err = false;
- if (cleanup_label)
- b = b->level_chain;
+ /* Don't complain if it's from an enclosing function. */
+ if (DECL_CONTEXT (oldlocal) == current_function_decl
+ && TREE_CODE (x) != PARM_DECL)
+ {
+ /* Go to where the parms should be and see if we find
+ them there. */
+ struct binding_level *b = current_binding_level->level_chain;
+
+ /* ARM $8.3 */
+ if (b->parm_flag == 1)
+ {
+ error ("declaration of `%#D' shadows a parameter",
+ name);
+ err = true;
+ }
+ }
- /* ARM $8.3 */
- if (b->parm_flag == 1)
- cp_error ("declaration of `%#D' shadows a parameter", name);
+ if (warn_shadow && !err)
+ shadow_warning ("a parameter", name, oldlocal);
}
- else if (warn_shadow && oldlocal != NULL_TREE
- && current_binding_level->is_for_scope
- && !DECL_DEAD_FOR_LOCAL (oldlocal))
- {
- warning ("variable `%s' shadows local",
- IDENTIFIER_POINTER (name));
- cp_warning_at (" this is the shadowed declaration", oldlocal);
- }
+
/* Maybe warn if shadowing something else. */
else if (warn_shadow && !DECL_EXTERNAL (x)
- /* No shadow warnings for internally generated vars. */
- && ! DECL_ARTIFICIAL (x)
- /* No shadow warnings for vars made for inlining. */
- && ! DECL_FROM_INLINE (x))
+ /* No shadow warnings for internally generated vars. */
+ && ! DECL_ARTIFICIAL (x)
+ /* No shadow warnings for vars made for inlining. */
+ && ! DECL_FROM_INLINE (x))
{
- const char *warnstring = NULL;
-
- if (oldlocal != NULL_TREE && TREE_CODE (oldlocal) == PARM_DECL)
- warnstring = "declaration of `%s' shadows a parameter";
- else if (IDENTIFIER_CLASS_VALUE (name) != NULL_TREE
+ if (IDENTIFIER_CLASS_VALUE (name) != NULL_TREE
&& current_class_ptr
&& !TREE_STATIC (name))
- warnstring = "declaration of `%s' shadows a member of `this'";
- else if (oldlocal != NULL_TREE)
- warnstring = "declaration of `%s' shadows previous local";
- else if (oldglobal != NULL_TREE)
+ warning ("declaration of `%s' shadows a member of `this'",
+ IDENTIFIER_POINTER (name));
+ else if (oldlocal != NULL_TREE
+ && TREE_CODE (oldlocal) == VAR_DECL)
+ shadow_warning ("a previous local", name, oldlocal);
+ else if (oldglobal != NULL_TREE
+ && TREE_CODE (oldglobal) == VAR_DECL)
/* XXX shadow warnings in outer-more namespaces */
- warnstring = "declaration of `%s' shadows global declaration";
-
- if (warnstring)
- warning (warnstring, IDENTIFIER_POINTER (name));
+ shadow_warning ("a global declaration", name, oldglobal);
}
}
@@ -4221,25 +4245,26 @@ pushdecl (x)
/* Keep count of variables in this level with incomplete type. */
if (TREE_CODE (x) == VAR_DECL
&& TREE_TYPE (x) != error_mark_node
- && ((TYPE_SIZE (TREE_TYPE (x)) == NULL_TREE
+ && ((!COMPLETE_TYPE_P (TREE_TYPE (x))
&& PROMOTES_TO_AGGR_TYPE (TREE_TYPE (x), ARRAY_TYPE))
/* RTTI TD entries are created while defining the type_info. */
|| (TYPE_LANG_SPECIFIC (TREE_TYPE (x))
&& TYPE_BEING_DEFINED (TREE_TYPE (x)))))
- current_binding_level->incomplete
- = tree_cons (NULL_TREE, x, current_binding_level->incomplete);
+ {
+ if (namespace_bindings_p ())
+ namespace_scope_incomplete
+ = tree_cons (NULL_TREE, x, namespace_scope_incomplete);
+ else
+ current_binding_level->incomplete
+ = tree_cons (NULL_TREE, x, current_binding_level->incomplete);
+ }
}
if (need_new_binding)
- {
- /* Put decls on list in reverse order.
- We will reverse them later if necessary. */
- TREE_CHAIN (x) = current_binding_level->names;
- current_binding_level->names = x;
- if (current_binding_level == global_binding_level
- && !TREE_PERMANENT (x))
- my_friendly_abort (124);
- }
+ add_decl_to_level (x,
+ DECL_NAMESPACE_SCOPE_P (x)
+ ? NAMESPACE_LEVEL (CP_DECL_CONTEXT (x))
+ : current_binding_level);
return x;
}
@@ -4327,10 +4352,9 @@ tree
pushdecl_top_level (x)
tree x;
{
- tree cur_namespace = current_namespace;
- current_namespace = global_namespace;
+ push_to_top_level ();
x = pushdecl_namespace_level (x);
- current_namespace = cur_namespace;
+ pop_from_top_level ();
return x;
}
@@ -4354,7 +4378,7 @@ pushdecl_class_level (x)
if (TREE_CODE (x) == TYPE_DECL)
set_identifier_type_value (name, TREE_TYPE (x));
}
- else if (ANON_UNION_TYPE_P (TREE_TYPE (x)))
+ else if (ANON_AGGR_TYPE_P (TREE_TYPE (x)))
{
tree f;
@@ -4365,28 +4389,35 @@ pushdecl_class_level (x)
}
}
-#if 0
-/* This function is used to push the mangled decls for nested types into
- the appropriate scope. Previously pushdecl_top_level was used, but that
- is incorrect for members of local classes. */
+/* Enter DECL into the symbol table, if that's appropriate. Returns
+ DECL, or a modified version thereof. */
-void
-pushdecl_nonclass_level (x)
- tree x;
+tree
+maybe_push_decl (decl)
+ tree decl;
{
- struct binding_level *b = current_binding_level;
-
- my_friendly_assert (b->parm_flag != 2, 180);
-
-#if 0
- /* Get out of template binding levels */
- while (b->pseudo_global)
- b = b->level_chain;
-#endif
+ tree type = TREE_TYPE (decl);
- pushdecl_with_scope (x, b);
+ /* Add this decl to the current binding level, but not if it comes
+ from another scope, e.g. a static member variable. TEM may equal
+ DECL or it may be a previous decl of the same name. */
+ if (decl == error_mark_node
+ || (TREE_CODE (decl) != PARM_DECL
+ && DECL_CONTEXT (decl) != NULL_TREE
+ /* Definitions of namespace members outside their namespace are
+ possible. */
+ && TREE_CODE (DECL_CONTEXT (decl)) != NAMESPACE_DECL)
+ || (TREE_CODE (decl) == TEMPLATE_DECL && !namespace_bindings_p ())
+ || TREE_CODE (type) == UNKNOWN_TYPE
+ /* The declaration of a template specialization does not affect
+ the functions available for overload resolution, so we do not
+ call pushdecl. */
+ || (TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_TEMPLATE_SPECIALIZATION (decl)))
+ return decl;
+ else
+ return pushdecl (decl);
}
-#endif
/* Make the declaration(s) of X appear in CLASS scope
under the name NAME. */
@@ -4397,7 +4428,7 @@ push_class_level_binding (name, x)
tree x;
{
tree binding;
- /* The class_binding_level will be NULL if x is a template
+ /* The class_binding_level will be NULL if x is a template
parameter name in a member template. */
if (!class_binding_level)
return;
@@ -4411,7 +4442,7 @@ push_class_level_binding (name, x)
class, then we will need to restore IDENTIFIER_CLASS_VALUE when
we leave this class. Record the shadowed declaration here. */
binding = IDENTIFIER_BINDING (name);
- if (binding
+ if (binding
&& ((TREE_CODE (x) == OVERLOAD
&& BINDING_VALUE (binding)
&& is_overloaded_fn (BINDING_VALUE (binding)))
@@ -4438,9 +4469,8 @@ push_class_level_binding (name, x)
else
old_decl = BINDING_VALUE (binding);
- /* There was already a binding for X containing fewer
- functions than are named in X. Find the previous
- declaration of X on the class-shadowed list, and update it. */
+ /* Find the previous binding of name on the class-shadowed
+ list, and update it. */
for (shadow = class_binding_level->class_shadowed;
shadow;
shadow = TREE_CHAIN (shadow))
@@ -4450,29 +4480,28 @@ push_class_level_binding (name, x)
BINDING_VALUE (binding) = x;
INHERITED_VALUE_BINDING_P (binding) = 0;
TREE_TYPE (shadow) = x;
+ IDENTIFIER_CLASS_VALUE (name) = x;
return;
}
}
/* If we didn't replace an existing binding, put the binding on the
- stack of bindings for the identifier, and update
- IDENTIFIER_CLASS_VALUE. */
+ stack of bindings for the identifier, and update the shadowed list. */
if (push_class_binding (name, x))
{
- push_cache_obstack ();
class_binding_level->class_shadowed
- = tree_cons (name, IDENTIFIER_CLASS_VALUE (name),
+ = tree_cons (name, NULL,
class_binding_level->class_shadowed);
- pop_obstacks ();
/* Record the value we are binding NAME to so that we can know
what to pop later. */
TREE_TYPE (class_binding_level->class_shadowed) = x;
}
}
-/* Insert another USING_DECL into the current binding level,
- returning this declaration. If this is a redeclaration,
- do nothing and return NULL_TREE. */
+/* Insert another USING_DECL into the current binding level, returning
+ this declaration. If this is a redeclaration, do nothing, and
+ return NULL_TREE if this not in namespace scope (in namespace
+ scope, a using decl might extend any previous bindings). */
tree
push_using_decl (scope, name)
@@ -4480,14 +4509,14 @@ push_using_decl (scope, name)
tree name;
{
tree decl;
-
+
my_friendly_assert (TREE_CODE (scope) == NAMESPACE_DECL, 383);
my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 384);
for (decl = current_binding_level->usings; decl; decl = TREE_CHAIN (decl))
if (DECL_INITIAL (decl) == scope && DECL_NAME (decl) == name)
break;
if (decl)
- return NULL_TREE;
+ return namespace_bindings_p () ? decl : NULL_TREE;
decl = build_lang_decl (USING_DECL, name, void_type_node);
DECL_INITIAL (decl) = scope;
TREE_CHAIN (decl) = current_binding_level->usings;
@@ -4505,7 +4534,7 @@ push_using_directive (used)
{
tree ud = current_binding_level->using_directives;
tree iter, ancestor;
-
+
/* Check if we already have this. */
if (purpose_member (used, ud) != NULL_TREE)
return NULL_TREE;
@@ -4516,7 +4545,7 @@ push_using_directive (used)
ancestor = namespace_ancestor (current_decl_namespace (), used);
ud = current_binding_level->using_directives;
- ud = perm_tree_cons (used, ancestor, ud);
+ ud = tree_cons (used, ancestor, ud);
current_binding_level->using_directives = ud;
return ud;
}
@@ -4527,14 +4556,14 @@ push_using_directive (used)
want to be referenced by that name. It is then up to the users of
that name to decide what to do with that list.
- DECL may also be a TEMPLATE_DECL, with a FUNCTION_DECL in its DECL_RESULT
- slot. It is dealt with the same way.
+ DECL may also be a TEMPLATE_DECL, with a FUNCTION_DECL in its
+ DECL_TEMPLATE_RESULT. It is dealt with the same way.
FLAGS is a bitwise-or of the following values:
PUSH_LOCAL: Bind DECL in the current scope, rather than at
namespace scope.
PUSH_USING: DECL is being pushed as the result of a using
- declaration.
+ declaration.
The value returned may be a previous declaration if we guessed wrong
about what language DECL should belong to (C or C++). Otherwise,
@@ -4551,17 +4580,7 @@ push_overloaded_decl (decl, flags)
int doing_global = (namespace_bindings_p () || !(flags & PUSH_LOCAL));
if (doing_global)
- {
- old = namespace_binding (name, DECL_CONTEXT (decl));
- if (old && TREE_CODE (old) == FUNCTION_DECL
- && DECL_ARTIFICIAL (old)
- && (DECL_BUILT_IN (old) || DECL_BUILT_IN_NONANSI (old)))
- {
- if (duplicate_decls (decl, old))
- return old;
- old = NULL_TREE;
- }
- }
+ old = namespace_binding (name, DECL_CONTEXT (decl));
else
old = lookup_name_current_level (name);
@@ -4573,13 +4592,13 @@ push_overloaded_decl (decl, flags)
if (IS_AGGR_TYPE (t) && warn_shadow
&& (! DECL_IN_SYSTEM_HEADER (decl)
|| ! DECL_IN_SYSTEM_HEADER (old)))
- cp_warning ("`%#D' hides constructor for `%#T'", decl, t);
+ warning ("`%#D' hides constructor for `%#T'", decl, t);
old = NULL_TREE;
}
else if (is_overloaded_fn (old))
{
tree tmp;
-
+
for (tmp = old; tmp; tmp = OVL_NEXT (tmp))
{
tree fn = OVL_CURRENT (tmp);
@@ -4588,17 +4607,20 @@ push_overloaded_decl (decl, flags)
&& !(flags & PUSH_USING)
&& compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)),
TYPE_ARG_TYPES (TREE_TYPE (decl))))
- cp_error ("`%#D' conflicts with previous using declaration `%#D'",
+ error ("`%#D' conflicts with previous using declaration `%#D'",
decl, fn);
-
+
if (duplicate_decls (decl, fn))
return fn;
}
}
+ else if (old == error_mark_node)
+ /* Ignore the undefined symbol marker. */
+ old = NULL_TREE;
else
{
cp_error_at ("previous non-function declaration `%#D'", old);
- cp_error ("conflicts with function declaration `%#D'", decl);
+ error ("conflicts with function declaration `%#D'", decl);
return decl;
}
}
@@ -4629,7 +4651,7 @@ push_overloaded_decl (decl, flags)
if (TREE_CODE (new_binding) == OVERLOAD && old)
{
tree *d;
-
+
for (d = &BINDING_LEVEL (IDENTIFIER_BINDING (name))->names;
*d;
d = &TREE_CHAIN (*d))
@@ -4642,7 +4664,8 @@ push_overloaded_decl (decl, flags)
TREE_VALUE (*d) = new_binding;
else
/* Build a TREE_LIST to wrap the OVERLOAD. */
- *d = build_tree_list (NULL_TREE, new_binding);
+ *d = tree_cons (NULL_TREE, new_binding,
+ TREE_CHAIN (*d));
/* And update the CPLUS_BINDING node. */
BINDING_VALUE (IDENTIFIER_BINDING (name))
@@ -4651,7 +4674,7 @@ push_overloaded_decl (decl, flags)
}
/* We should always find a previous binding in this case. */
- my_friendly_abort (0);
+ abort ();
}
/* Install the new binding. */
@@ -4669,15 +4692,6 @@ implicitly_declare (functionid)
tree functionid;
{
register tree decl;
- int temp = allocation_temporary_p ();
-
- push_obstacks_nochange ();
-
- /* Save the decl permanently so we can warn if definition follows.
- In ANSI C, warn_implicit is usually false, so the saves little space.
- But in C++, it's usually true, hence the extra code. */
- if (temp && (! warn_implicit || toplevel_bindings_p ()))
- end_temporary_allocation ();
/* We used to reuse an old implicit decl here,
but this loses with inline functions because it can clobber
@@ -4687,22 +4701,20 @@ implicitly_declare (functionid)
DECL_EXTERNAL (decl) = 1;
TREE_PUBLIC (decl) = 1;
- /* ANSI standard says implicit declarations are in the innermost block.
+ /* ISO standard says implicit declarations are in the innermost block.
So we record the decl in the standard fashion. */
pushdecl (decl);
- rest_of_decl_compilation (decl, NULL_PTR, 0, 0);
+ rest_of_decl_compilation (decl, NULL, 0, 0);
if (warn_implicit
/* Only one warning per identifier. */
&& IDENTIFIER_IMPLICIT_DECL (functionid) == NULL_TREE)
{
- cp_pedwarn ("implicit declaration of function `%#D'", decl);
+ pedwarn ("implicit declaration of function `%#D'", decl);
}
SET_IDENTIFIER_IMPLICIT_DECL (functionid, decl);
- pop_obstacks ();
-
return decl;
}
@@ -4731,7 +4743,7 @@ redeclaration_error_message (newdecl, olddecl)
/* If this is a pure function, its olddecl will actually be
the original initialization to `0' (which we force to call
abort()). Don't complain about redefinition in this case. */
- if (DECL_LANG_SPECIFIC (olddecl) && DECL_ABSTRACT_VIRTUAL_P (olddecl))
+ if (DECL_LANG_SPECIFIC (olddecl) && DECL_PURE_VIRTUAL_P (olddecl))
return 0;
/* If both functions come from different namespaces, this is not
@@ -4757,15 +4769,17 @@ redeclaration_error_message (newdecl, olddecl)
else if (TREE_CODE (newdecl) == TEMPLATE_DECL)
{
if ((TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == FUNCTION_DECL
+ && (DECL_TEMPLATE_RESULT (newdecl)
+ != DECL_TEMPLATE_RESULT (olddecl))
&& DECL_INITIAL (DECL_TEMPLATE_RESULT (newdecl))
&& DECL_INITIAL (DECL_TEMPLATE_RESULT (olddecl)))
|| (TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL
- && TYPE_SIZE (TREE_TYPE (newdecl))
- && TYPE_SIZE (TREE_TYPE (olddecl))))
+ && COMPLETE_TYPE_P (TREE_TYPE (newdecl))
+ && COMPLETE_TYPE_P (TREE_TYPE (olddecl))))
return "redefinition of `%#D'";
return 0;
}
- else if (toplevel_bindings_p ())
+ else if (toplevel_bindings_p () || DECL_NAMESPACE_SCOPE_P (newdecl))
{
/* Objects declared at top level: */
/* If at least one is a reference, it's ok. */
@@ -4785,32 +4799,51 @@ redeclaration_error_message (newdecl, olddecl)
}
}
-/* Get the LABEL_DECL corresponding to identifier ID as a label.
- Create one if none exists so far for the current function.
- This function is called for both label definitions and label references. */
+/* Create a new label, named ID. */
-tree
-lookup_label (id)
+static tree
+make_label_decl (id, local_p)
tree id;
+ int local_p;
{
- register tree decl = IDENTIFIER_LABEL_VALUE (id);
+ tree decl;
- if (current_function_decl == NULL_TREE)
- {
- error ("label `%s' referenced outside of any function",
- IDENTIFIER_POINTER (id));
- return NULL_TREE;
- }
+ decl = build_decl (LABEL_DECL, id, void_type_node);
+ if (expanding_p)
+ /* Make sure every label has an rtx. */
+ label_rtx (decl);
+
+ DECL_CONTEXT (decl) = current_function_decl;
+ DECL_MODE (decl) = VOIDmode;
+ C_DECLARED_LABEL_FLAG (decl) = local_p;
- if ((decl == NULL_TREE
- || DECL_SOURCE_LINE (decl) == 0)
- && (named_label_uses == NULL
- || named_label_uses->names_in_scope != current_binding_level->names
- || named_label_uses->label_decl != decl))
+ /* Say where one reference is to the label, for the sake of the
+ error if it is not defined. */
+ DECL_SOURCE_LINE (decl) = lineno;
+ DECL_SOURCE_FILE (decl) = input_filename;
+
+ /* Record the fact that this identifier is bound to this label. */
+ SET_IDENTIFIER_LABEL_VALUE (id, decl);
+
+ return decl;
+}
+
+/* Record this label on the list of used labels so that we can check
+ at the end of the function to see whether or not the label was
+ actually defined, and so we can check when the label is defined whether
+ this use is valid. */
+
+static void
+use_label (decl)
+ tree decl;
+{
+ if (named_label_uses == NULL
+ || named_label_uses->names_in_scope != current_binding_level->names
+ || named_label_uses->label_decl != decl)
{
- struct named_label_list *new_ent;
- new_ent
- = (struct named_label_list*)oballoc (sizeof (struct named_label_list));
+ struct named_label_use_list *new_ent;
+ new_ent = ((struct named_label_use_list *)
+ ggc_alloc (sizeof (struct named_label_use_list)));
new_ent->label_decl = decl;
new_ent->names_in_scope = current_binding_level->names;
new_ent->binding_level = current_binding_level;
@@ -4819,61 +4852,265 @@ lookup_label (id)
new_ent->next = named_label_uses;
named_label_uses = new_ent;
}
+}
+
+/* Look for a label named ID in the current function. If one cannot
+ be found, create one. (We keep track of used, but undefined,
+ labels, and complain about them at the end of a function.) */
+
+tree
+lookup_label (id)
+ tree id;
+{
+ tree decl;
+ struct named_label_list *ent;
- /* Use a label already defined or ref'd with this name. */
- if (decl != NULL_TREE)
+ /* You can't use labels at global scope. */
+ if (current_function_decl == NULL_TREE)
{
- /* But not if it is inherited and wasn't declared to be inheritable. */
- if (DECL_CONTEXT (decl) != current_function_decl
- && ! C_DECLARED_LABEL_FLAG (decl))
- return shadow_label (id);
- return decl;
+ error ("label `%s' referenced outside of any function",
+ IDENTIFIER_POINTER (id));
+ return NULL_TREE;
}
- decl = build_decl (LABEL_DECL, id, void_type_node);
+ /* See if we've already got this label. */
+ decl = IDENTIFIER_LABEL_VALUE (id);
+ if (decl != NULL_TREE && DECL_CONTEXT (decl) == current_function_decl)
+ return decl;
- /* Make sure every label has an rtx. */
- label_rtx (decl);
+ /* Record this label on the list of labels used in this function.
+ We do this before calling make_label_decl so that we get the
+ IDENTIFIER_LABEL_VALUE before the new label is declared. */
+ ent = ((struct named_label_list *)
+ ggc_alloc_cleared (sizeof (struct named_label_list)));
+ ent->old_value = IDENTIFIER_LABEL_VALUE (id);
+ ent->next = named_labels;
+ named_labels = ent;
- /* A label not explicitly declared must be local to where it's ref'd. */
- DECL_CONTEXT (decl) = current_function_decl;
+ /* We need a new label. */
+ decl = make_label_decl (id, /*local_p=*/0);
- DECL_MODE (decl) = VOIDmode;
+ /* Now fill in the information we didn't have before. */
+ ent->label_decl = decl;
- /* Say where one reference is to the label,
- for the sake of the error if it is not defined. */
- DECL_SOURCE_LINE (decl) = lineno;
- DECL_SOURCE_FILE (decl) = input_filename;
+ return decl;
+}
- SET_IDENTIFIER_LABEL_VALUE (id, decl);
+/* Declare a local label named ID. */
+
+tree
+declare_local_label (id)
+ tree id;
+{
+ tree decl;
- named_labels = tree_cons (NULL_TREE, decl, named_labels);
- named_label_uses->label_decl = decl;
+ /* Add a new entry to the SHADOWED_LABELS list so that when we leave
+ this scope we can restore the old value of
+ IDENTIFIER_TYPE_VALUE. */
+ current_binding_level->shadowed_labels
+ = tree_cons (IDENTIFIER_LABEL_VALUE (id), NULL_TREE,
+ current_binding_level->shadowed_labels);
+ /* Look for the label. */
+ decl = make_label_decl (id, /*local_p=*/1);
+ /* Now fill in the information we didn't have before. */
+ TREE_VALUE (current_binding_level->shadowed_labels) = decl;
return decl;
}
-/* Make a label named NAME in the current function,
- shadowing silently any that may be inherited from containing functions
- or containing scopes.
+/* Returns nonzero if it is ill-formed to jump past the declaration of
+ DECL. Returns 2 if it's also a real problem. */
+
+static int
+decl_jump_unsafe (decl)
+ tree decl;
+{
+ if (TREE_CODE (decl) != VAR_DECL || TREE_STATIC (decl))
+ return 0;
- Note that valid use, if the label being shadowed
- comes from another scope in the same function,
- requires calling declare_nonlocal_label right away. */
+ if (DECL_INITIAL (decl) == NULL_TREE
+ && pod_type_p (TREE_TYPE (decl)))
+ return 0;
-tree
-shadow_label (name)
- tree name;
+ /* This is really only important if we're crossing an initialization.
+ The POD stuff is just pedantry; why should it matter if the class
+ contains a field of pointer to member type? */
+ if (DECL_INITIAL (decl)
+ || (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl))))
+ return 2;
+ return 1;
+}
+
+/* Check that a single previously seen jump to a newly defined label
+ is OK. DECL is the LABEL_DECL or 0; LEVEL is the binding_level for
+ the jump context; NAMES are the names in scope in LEVEL at the jump
+ context; FILE and LINE are the source position of the jump or 0. */
+
+static void
+check_previous_goto_1 (decl, level, names, file, line)
+ tree decl;
+ struct binding_level *level;
+ tree names;
+ const char *file;
+ int line;
{
- register tree decl = IDENTIFIER_LABEL_VALUE (name);
+ int identified = 0;
+ int saw_eh = 0;
+ struct binding_level *b = current_binding_level;
+ for (; b; b = b->level_chain)
+ {
+ tree new_decls = b->names;
+ tree old_decls = (b == level ? names : NULL_TREE);
+ for (; new_decls != old_decls;
+ new_decls = TREE_CHAIN (new_decls))
+ {
+ int problem = decl_jump_unsafe (new_decls);
+ if (! problem)
+ continue;
- if (decl != NULL_TREE)
+ if (! identified)
+ {
+ if (decl)
+ pedwarn ("jump to label `%D'", decl);
+ else
+ pedwarn ("jump to case label");
+
+ if (file)
+ pedwarn_with_file_and_line (file, line, " from here");
+ identified = 1;
+ }
+
+ if (problem > 1)
+ cp_error_at (" crosses initialization of `%#D'",
+ new_decls);
+ else
+ cp_pedwarn_at (" enters scope of non-POD `%#D'",
+ new_decls);
+ }
+
+ if (b == level)
+ break;
+ if ((b->is_try_scope || b->is_catch_scope) && ! saw_eh)
+ {
+ if (! identified)
+ {
+ if (decl)
+ pedwarn ("jump to label `%D'", decl);
+ else
+ pedwarn ("jump to case label");
+
+ if (file)
+ pedwarn_with_file_and_line (file, line, " from here");
+ identified = 1;
+ }
+ if (b->is_try_scope)
+ error (" enters try block");
+ else
+ error (" enters catch block");
+ saw_eh = 1;
+ }
+ }
+}
+
+static void
+check_previous_goto (use)
+ struct named_label_use_list *use;
+{
+ check_previous_goto_1 (use->label_decl, use->binding_level,
+ use->names_in_scope, use->filename_o_goto,
+ use->lineno_o_goto);
+}
+
+static void
+check_switch_goto (level)
+ struct binding_level *level;
+{
+ check_previous_goto_1 (NULL_TREE, level, level->names, NULL, 0);
+}
+
+/* Check that any previously seen jumps to a newly defined label DECL
+ are OK. Called by define_label. */
+
+static void
+check_previous_gotos (decl)
+ tree decl;
+{
+ struct named_label_use_list **usep;
+
+ if (! TREE_USED (decl))
+ return;
+
+ for (usep = &named_label_uses; *usep; )
{
- shadowed_labels = tree_cons (NULL_TREE, decl, shadowed_labels);
- SET_IDENTIFIER_LABEL_VALUE (name, NULL_TREE);
+ struct named_label_use_list *use = *usep;
+ if (use->label_decl == decl)
+ {
+ check_previous_goto (use);
+ *usep = use->next;
+ }
+ else
+ usep = &(use->next);
}
+}
+
+/* Check that a new jump to a label DECL is OK. Called by
+ finish_goto_stmt. */
- return lookup_label (name);
+void
+check_goto (decl)
+ tree decl;
+{
+ int identified = 0;
+ tree bad;
+ struct named_label_list *lab;
+
+ /* We can't know where a computed goto is jumping. So we assume
+ that it's OK. */
+ if (! DECL_P (decl))
+ return;
+
+ /* If the label hasn't been defined yet, defer checking. */
+ if (! DECL_INITIAL (decl))
+ {
+ use_label (decl);
+ return;
+ }
+
+ for (lab = named_labels; lab; lab = lab->next)
+ if (decl == lab->label_decl)
+ break;
+
+ /* If the label is not on named_labels it's a gcc local label, so
+ it must be in an outer scope, so jumping to it is always OK. */
+ if (lab == 0)
+ return;
+
+ if ((lab->in_try_scope || lab->in_catch_scope || lab->bad_decls)
+ && !identified)
+ {
+ cp_pedwarn_at ("jump to label `%D'", decl);
+ pedwarn (" from here");
+ identified = 1;
+ }
+
+ for (bad = lab->bad_decls; bad; bad = TREE_CHAIN (bad))
+ {
+ tree b = TREE_VALUE (bad);
+ int u = decl_jump_unsafe (b);
+
+ if (u > 1 && DECL_ARTIFICIAL (b))
+ /* Can't skip init of __exception_info. */
+ cp_error_at (" enters catch block", b);
+ else if (u > 1)
+ cp_error_at (" skips initialization of `%#D'", b);
+ else
+ cp_pedwarn_at (" enters scope of non-POD `%#D'", b);
+ }
+
+ if (lab->in_try_scope)
+ error (" enters try block");
+ else if (lab->in_catch_scope)
+ error (" enters catch block");
}
/* Define a label, specifying the location in the source file.
@@ -4882,132 +5119,44 @@ shadow_label (name)
tree
define_label (filename, line, name)
- char *filename;
+ const char *filename;
int line;
tree name;
{
- tree decl;
-
- if (minimal_parse_mode)
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- decl = build_decl (LABEL_DECL, name, void_type_node);
- pop_obstacks ();
- DECL_SOURCE_LINE (decl) = line;
- DECL_SOURCE_FILE (decl) = filename;
- add_tree (decl);
- return decl;
- }
+ tree decl = lookup_label (name);
+ struct named_label_list *ent;
+ register struct binding_level *p;
- decl = lookup_label (name);
+ for (ent = named_labels; ent; ent = ent->next)
+ if (ent->label_decl == decl)
+ break;
- /* After labels, make any new cleanups go into their
+ /* After labels, make any new cleanups in the function go into their
own new (temporary) binding contour. */
- current_binding_level->more_cleanups_ok = 0;
-
- /* If label with this name is known from an outer context, shadow it. */
- if (decl != NULL_TREE && DECL_CONTEXT (decl) != current_function_decl)
- {
- shadowed_labels = tree_cons (NULL_TREE, decl, shadowed_labels);
- SET_IDENTIFIER_LABEL_VALUE (name, NULL_TREE);
- decl = lookup_label (name);
- }
+ for (p = current_binding_level; !(p->parm_flag); p = p->level_chain)
+ p->more_cleanups_ok = 0;
if (name == get_identifier ("wchar_t"))
- cp_pedwarn ("label named wchar_t");
+ pedwarn ("label named wchar_t");
if (DECL_INITIAL (decl) != NULL_TREE)
{
- cp_error ("duplicate label `%D'", decl);
+ error ("duplicate label `%D'", decl);
return 0;
}
else
{
- struct named_label_list *uses, *prev;
- int identified = 0;
-
/* Mark label as having been defined. */
DECL_INITIAL (decl) = error_mark_node;
/* Say where in the source. */
DECL_SOURCE_FILE (decl) = filename;
DECL_SOURCE_LINE (decl) = line;
-
- prev = NULL;
- uses = named_label_uses;
- while (uses != NULL)
- if (uses->label_decl == decl)
- {
- struct binding_level *b = current_binding_level;
- while (b)
- {
- tree new_decls = b->names;
- tree old_decls = (b == uses->binding_level)
- ? uses->names_in_scope : NULL_TREE;
- while (new_decls != old_decls)
- {
- if (TREE_CODE (new_decls) == VAR_DECL
- /* Don't complain about crossing initialization
- of internal entities. They can't be accessed,
- and they should be cleaned up
- by the time we get to the label. */
- && ! DECL_ARTIFICIAL (new_decls)
- && !(DECL_INITIAL (new_decls) == NULL_TREE
- && pod_type_p (TREE_TYPE (new_decls))))
- {
- /* This is really only important if we're crossing
- an initialization. The POD stuff is just
- pedantry; why should it matter if the class
- contains a field of pointer to member type? */
- int problem = (DECL_INITIAL (new_decls)
- || (TYPE_NEEDS_CONSTRUCTING
- (TREE_TYPE (new_decls))));
-
- if (! identified)
- {
- if (problem)
- {
- cp_error ("jump to label `%D'", decl);
- error_with_file_and_line
- (uses->filename_o_goto,
- uses->lineno_o_goto, " from here");
- }
- else
- {
- cp_pedwarn ("jump to label `%D'", decl);
- pedwarn_with_file_and_line
- (uses->filename_o_goto,
- uses->lineno_o_goto, " from here");
- }
- identified = 1;
- }
-
- if (problem)
- cp_error_at (" crosses initialization of `%#D'",
- new_decls);
- else
- cp_pedwarn_at (" enters scope of non-POD `%#D'",
- new_decls);
- }
- new_decls = TREE_CHAIN (new_decls);
- }
- if (b == uses->binding_level)
- break;
- b = b->level_chain;
- }
-
- if (prev != NULL)
- prev->next = uses->next;
- else
- named_label_uses = uses->next;
-
- uses = uses->next;
- }
- else
- {
- prev = uses;
- uses = uses->next;
- }
- current_function_return_value = NULL_TREE;
+ if (ent)
+ {
+ ent->names_in_scope = current_binding_level->names;
+ ent->binding_level = current_binding_level;
+ }
+ check_previous_gotos (decl);
return decl;
}
}
@@ -5016,78 +5165,101 @@ struct cp_switch
{
struct binding_level *level;
struct cp_switch *next;
+ /* The SWITCH_STMT being built. */
+ tree switch_stmt;
+ /* A splay-tree mapping the low element of a case range to the high
+ element, or NULL_TREE if there is no high element. Used to
+ determine whether or not a new case label duplicates an old case
+ label. We need a tree, rather than simply a hash table, because
+ of the GNU case range extension. */
+ splay_tree cases;
};
+/* A stack of the currently active switch statements. The innermost
+ switch statement is on the top of the stack. There is no need to
+ mark the stack for garbage collection because it is only active
+ during the processing of the body of a function, and we never
+ collect at that point. */
+
static struct cp_switch *switch_stack;
+/* Called right after a switch-statement condition is parsed.
+ SWITCH_STMT is the switch statement being parsed. */
+
void
-push_switch ()
+push_switch (switch_stmt)
+ tree switch_stmt;
{
struct cp_switch *p
- = (struct cp_switch *) oballoc (sizeof (struct cp_switch));
+ = (struct cp_switch *) xmalloc (sizeof (struct cp_switch));
p->level = current_binding_level;
p->next = switch_stack;
+ p->switch_stmt = switch_stmt;
+ p->cases = splay_tree_new (case_compare, NULL, NULL);
switch_stack = p;
}
void
pop_switch ()
{
+ struct cp_switch *cs;
+
+ cs = switch_stack;
+ splay_tree_delete (cs->cases);
switch_stack = switch_stack->next;
+ free (cs);
}
-/* Same, but for CASE labels. If DECL is NULL_TREE, it's the default. */
-/* XXX Note decl is never actually used. (bpk) */
+/* Note that we've seen a definition of a case label, and complain if this
+ is a bad place for one. */
-void
-define_case_label ()
+tree
+finish_case_label (low_value, high_value)
+ tree low_value;
+ tree high_value;
{
- tree cleanup = last_cleanup_this_contour ();
- struct binding_level *b = current_binding_level;
- int identified = 0;
+ tree cond, r;
+ register struct binding_level *p;
- if (cleanup)
+ if (! switch_stack)
{
- static int explained = 0;
- cp_warning_at ("destructor needed for `%#D'", TREE_PURPOSE (cleanup));
- warning ("where case label appears here");
- if (!explained)
- {
- warning ("(enclose actions of previous case statements requiring");
- warning ("destructors in their own binding contours.)");
- explained = 1;
- }
+ if (high_value)
+ error ("case label not within a switch statement");
+ else if (low_value)
+ error ("case label `%E' not within a switch statement",
+ low_value);
+ else
+ error ("`default' label not within a switch statement");
+ return NULL_TREE;
}
- for (; b && b != switch_stack->level; b = b->level_chain)
+ if (processing_template_decl)
{
- tree new_decls = b->names;
- for (; new_decls; new_decls = TREE_CHAIN (new_decls))
- {
- if (TREE_CODE (new_decls) == VAR_DECL
- /* Don't complain about crossing initialization
- of internal entities. They can't be accessed,
- and they should be cleaned up
- by the time we get to the label. */
- && ! DECL_ARTIFICIAL (new_decls)
- && ((DECL_INITIAL (new_decls) != NULL_TREE
- && DECL_INITIAL (new_decls) != error_mark_node)
- || TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (new_decls))))
- {
- if (! identified)
- error ("jump to case label");
- identified = 1;
- cp_error_at (" crosses initialization of `%#D'",
- new_decls);
- }
- }
+ tree label;
+
+ /* For templates, just add the case label; we'll do semantic
+ analysis at instantiation-time. */
+ label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
+ return add_stmt (build_case_label (low_value, high_value, label));
}
- /* After labels, make any new cleanups go into their
+ /* Find the condition on which this switch statement depends. */
+ cond = SWITCH_COND (switch_stack->switch_stmt);
+ if (cond && TREE_CODE (cond) == TREE_LIST)
+ cond = TREE_VALUE (cond);
+
+ r = c_add_case_label (switch_stack->cases, cond, low_value, high_value);
+ if (r == error_mark_node)
+ r = NULL_TREE;
+
+ check_switch_goto (switch_stack->level);
+
+ /* After labels, make any new cleanups in the function go into their
own new (temporary) binding contour. */
+ for (p = current_binding_level; !(p->parm_flag); p = p->level_chain)
+ p->more_cleanups_ok = 0;
- current_binding_level->more_cleanups_ok = 0;
- current_function_return_value = NULL_TREE;
+ return r;
}
/* Return the list of declarations of the current level.
@@ -5148,9 +5320,9 @@ lookup_tag (form, name, binding_level, thislevel_only)
int thislevel_only;
{
register struct binding_level *level;
- /* Non-zero if, we should look past a pseudo-global level, even if
- THISLEVEL_ONLY. */
- int allow_pseudo_global = 1;
+ /* Non-zero if, we should look past a template parameter level, even
+ if THISLEVEL_ONLY. */
+ int allow_template_parms_p = 1;
for (level = binding_level; level; level = level->level_chain)
{
@@ -5169,15 +5341,15 @@ lookup_tag (form, name, binding_level, thislevel_only)
{
tree old = binding_for_name (name, tail);
- /* If we just skipped past a pseudo global level, even
- though THISLEVEL_ONLY, and we find a template class
- declaration, then we use the _TYPE node for the
+ /* If we just skipped past a template parameter level,
+ even though THISLEVEL_ONLY, and we find a template
+ class declaration, then we use the _TYPE node for the
template. See the example below. */
- if (thislevel_only && !allow_pseudo_global
- && old && BINDING_VALUE (old)
+ if (thislevel_only && !allow_template_parms_p
+ && old && BINDING_VALUE (old)
&& DECL_CLASS_TEMPLATE_P (BINDING_VALUE (old)))
old = TREE_TYPE (BINDING_VALUE (old));
- else
+ else
old = BINDING_TYPE (old);
/* If it has an original type, it is a typedef, and we
@@ -5187,7 +5359,7 @@ lookup_tag (form, name, binding_level, thislevel_only)
if (old && TREE_CODE (old) != form
&& !(form != ENUMERAL_TYPE && TREE_CODE (old) == TEMPLATE_DECL))
{
- cp_error ("`%#D' redeclared as %C", old, form);
+ error ("`%#D' redeclared as %C", old, form);
return NULL_TREE;
}
if (old)
@@ -5207,7 +5379,7 @@ lookup_tag (form, name, binding_level, thislevel_only)
&& !(form != ENUMERAL_TYPE && code == TEMPLATE_DECL))
{
/* Definition isn't the kind we were looking for. */
- cp_error ("`%#D' redeclared as %C", TREE_VALUE (tail),
+ error ("`%#D' redeclared as %C", TREE_VALUE (tail),
form);
return NULL_TREE;
}
@@ -5216,78 +5388,25 @@ lookup_tag (form, name, binding_level, thislevel_only)
}
if (thislevel_only && ! level->tag_transparent)
{
- if (level->pseudo_global && allow_pseudo_global)
+ if (level->template_parms_p && allow_template_parms_p)
{
/* We must deal with cases like this:
-
+
template <class T> struct S;
template <class T> struct S {};
-
+
When looking up `S', for the second declaration, we
would like to find the first declaration. But, we
are in the pseudo-global level created for the
template parameters, rather than the (surrounding)
namespace level. Thus, we keep going one more level,
even though THISLEVEL_ONLY is non-zero. */
- allow_pseudo_global = 0;
+ allow_template_parms_p = 0;
continue;
}
else
return NULL_TREE;
}
- if (current_class_type && level->level_chain->namespace_p)
- {
- /* Try looking in this class's tags before heading into
- global binding level. */
- tree context = current_class_type;
- while (context)
- {
- switch (TREE_CODE_CLASS (TREE_CODE (context)))
- {
- tree these_tags;
- case 't':
- these_tags = CLASSTYPE_TAGS (context);
- if (ANON_AGGRNAME_P (name))
- while (these_tags)
- {
- if (TYPE_IDENTIFIER (TREE_VALUE (these_tags))
- == name)
- return TREE_VALUE (tail);
- these_tags = TREE_CHAIN (these_tags);
- }
- else
- while (these_tags)
- {
- if (TREE_PURPOSE (these_tags) == name)
- {
- if (TREE_CODE (TREE_VALUE (these_tags)) != form)
- {
- cp_error ("`%#D' redeclared as %C in class scope",
- TREE_VALUE (tail), form);
- return NULL_TREE;
- }
- return TREE_VALUE (tail);
- }
- these_tags = TREE_CHAIN (these_tags);
- }
- /* If this type is not yet complete, then don't
- look at its context. */
- if (TYPE_SIZE (context) == NULL_TREE)
- goto no_context;
- /* Go to next enclosing type, if any. */
- context = DECL_CONTEXT (TYPE_MAIN_DECL (context));
- break;
- case 'd':
- context = DECL_CONTEXT (context);
- break;
- default:
- my_friendly_abort (10);
- }
- continue;
- no_context:
- break;
- }
- }
}
return NULL_TREE;
}
@@ -5331,56 +5450,14 @@ lookup_tag_reverse (type, name)
return NULL_TREE;
}
-/* Lookup TYPE in CONTEXT (a chain of nested types or a FUNCTION_DECL).
- Return the type value, or NULL_TREE if not found. */
-
-static tree
-lookup_nested_type (type, context)
- tree type;
- tree context;
-{
- if (context == NULL_TREE)
- return NULL_TREE;
- while (context)
- {
- switch (TREE_CODE (context))
- {
- case TYPE_DECL:
- {
- tree ctype = TREE_TYPE (context);
- tree match = value_member (type, CLASSTYPE_TAGS (ctype));
- if (match)
- return TREE_VALUE (match);
- context = DECL_CONTEXT (context);
-
- /* When we have a nested class whose member functions have
- local types (e.g., a set of enums), we'll arrive here
- with the DECL_CONTEXT as the actual RECORD_TYPE node for
- the enclosing class. Instead, we want to make sure we
- come back in here with the TYPE_DECL, not the RECORD_TYPE. */
- if (context && TREE_CODE (context) == RECORD_TYPE)
- context = TREE_CHAIN (context);
- }
- break;
- case FUNCTION_DECL:
- if (TYPE_NAME (type) && TYPE_IDENTIFIER (type))
- return lookup_name (TYPE_IDENTIFIER (type), 1);
- return NULL_TREE;
- default:
- my_friendly_abort (12);
- }
- }
- return NULL_TREE;
-}
-
/* Look up NAME in the NAMESPACE. */
tree
lookup_namespace_name (namespace, name)
tree namespace, name;
{
- struct tree_binding _b;
tree val;
+ tree template_id = NULL_TREE;
my_friendly_assert (TREE_CODE (namespace) == NAMESPACE_DECL, 370);
@@ -5391,15 +5468,25 @@ lookup_namespace_name (namespace, name)
{
/* This happens for A::B where B is a template, and there are no
template arguments. */
- cp_error ("invalid use of `%D'", name);
+ error ("invalid use of `%D'", name);
return error_mark_node;
}
namespace = ORIGINAL_NAMESPACE (namespace);
+ if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
+ {
+ template_id = name;
+ name = TREE_OPERAND (name, 0);
+ if (TREE_CODE (name) == OVERLOAD)
+ name = DECL_NAME (OVL_CURRENT (name));
+ else if (DECL_P (name))
+ name = DECL_NAME (name);
+ }
+
my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 373);
-
- val = binding_init (&_b);
+
+ val = make_node (CPLUS_BINDING);
if (!qualified_lookup_using_namespace (name, namespace, val, 0))
return error_mark_node;
@@ -5407,13 +5494,34 @@ lookup_namespace_name (namespace, name)
{
val = BINDING_VALUE (val);
+ if (template_id)
+ {
+ if (DECL_CLASS_TEMPLATE_P (val))
+ val = lookup_template_class (val,
+ TREE_OPERAND (template_id, 1),
+ /*in_decl=*/NULL_TREE,
+ /*context=*/NULL_TREE,
+ /*entering_scope=*/0,
+ /*complain=*/1);
+ else if (DECL_FUNCTION_TEMPLATE_P (val)
+ || TREE_CODE (val) == OVERLOAD)
+ val = lookup_template_function (val,
+ TREE_OPERAND (template_id, 1));
+ else
+ {
+ error ("`%D::%D' is not a template",
+ namespace, name);
+ return error_mark_node;
+ }
+ }
+
/* If we have a single function from a using decl, pull it out. */
if (TREE_CODE (val) == OVERLOAD && ! really_overloaded_fn (val))
val = OVL_FUNCTION (val);
return val;
}
- cp_error ("`%D' undeclared in namespace `%D'", name, namespace);
+ error ("`%D' undeclared in namespace `%D'", name, namespace);
return error_mark_node;
}
@@ -5435,7 +5543,7 @@ typename_hash (k)
/* Compare two TYPENAME_TYPEs. K1 and K2 are really of type `tree'. */
-static boolean
+static bool
typename_compare (k1, k2)
hash_table_key k1;
hash_table_key k2;
@@ -5449,10 +5557,10 @@ typename_compare (k1, k2)
t2 = (tree) k2;
d1 = TYPE_NAME (t1);
d2 = TYPE_NAME (t2);
-
+
return (DECL_NAME (d1) == DECL_NAME (d2)
&& same_type_p (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2))
- && ((TREE_TYPE (t1) != NULL_TREE)
+ && ((TREE_TYPE (t1) != NULL_TREE)
== (TREE_TYPE (t2) != NULL_TREE))
&& same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))
&& TYPENAME_TYPE_FULLNAME (t1) == TYPENAME_TYPE_FULLNAME (t2));
@@ -5462,7 +5570,7 @@ typename_compare (k1, k2)
the type of `T', NAME is the IDENTIFIER_NODE for `t'. If BASE_TYPE
is non-NULL, this type is being created by the implicit typename
extension, and BASE_TYPE is a type named `t' in some base class of
- `T' which depends on template parameters.
+ `T' which depends on template parameters.
Returns the new TYPENAME_TYPE. */
@@ -5475,24 +5583,20 @@ build_typename_type (context, name, fullname, base_type)
{
tree t;
tree d;
- struct hash_entry* e;
+ struct hash_entry *e;
static struct hash_table ht;
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
- if (!ht.table
- && !hash_table_init (&ht, &hash_newfunc, &typename_hash,
- &typename_compare))
- fatal ("virtual memory exhausted");
+ if (!ht.table)
+ {
+ static struct hash_table *h = &ht;
- /* The FULLNAME needs to exist for the life of the hash table, i.e.,
- for the entire compilation. */
- if (!TREE_PERMANENT (fullname))
- fullname = copy_to_permanent (fullname);
+ hash_table_init (&ht, &hash_newfunc, &typename_hash, &typename_compare);
+ ggc_add_tree_hash_table_root (&h, 1);
+ }
/* Build the TYPENAME_TYPE. */
- t = make_lang_type (TYPENAME_TYPE);
+ t = make_aggr_type (TYPENAME_TYPE);
TYPE_CONTEXT (t) = FROB_CONTEXT (context);
TYPENAME_TYPE_FULLNAME (t) = fullname;
TREE_TYPE (t) = base_type;
@@ -5507,32 +5611,29 @@ build_typename_type (context, name, fullname, base_type)
/* See if we already have this type. */
e = hash_lookup (&ht, t, /*create=*/false, /*copy=*/0);
if (e)
- {
- /* This will free not only TREE_TYPE, but the lang-specific data
- and the TYPE_DECL as well. */
- obstack_free (&permanent_obstack, t);
- t = (tree) e->key;
- }
+ t = (tree) e->key;
else
/* Insert the type into the table. */
hash_lookup (&ht, t, /*create=*/true, /*copy=*/0);
- pop_obstacks ();
-
return t;
}
+/* Resolve `typename CONTEXT::NAME'. Returns an appropriate type,
+ unless an error occurs, in which case error_mark_node is returned.
+ If COMPLAIN zero, don't complain about any errors that occur. */
+
tree
-make_typename_type (context, name)
+make_typename_type (context, name, complain)
tree context, name;
+ int complain;
{
- tree t;
tree fullname;
- if (TREE_CODE_CLASS (TREE_CODE (name)) == 't')
+ if (TYPE_P (name))
{
- if (!(TYPE_LANG_SPECIFIC (name)
- && (CLASSTYPE_IS_TEMPLATE (name)
+ if (!(TYPE_LANG_SPECIFIC (name)
+ && (CLASSTYPE_IS_TEMPLATE (name)
|| CLASSTYPE_USE_TEMPLATE (name))))
name = TYPE_IDENTIFIER (name);
else
@@ -5552,15 +5653,21 @@ make_typename_type (context, name)
if (TREE_CODE (name) == TEMPLATE_DECL)
name = TREE_OPERAND (fullname, 0) = DECL_NAME (name);
}
+ if (TREE_CODE (name) == TEMPLATE_DECL)
+ {
+ error ("`%D' used without template parameters", name);
+ return error_mark_node;
+ }
if (TREE_CODE (name) != IDENTIFIER_NODE)
- my_friendly_abort (2000);
+ abort ();
if (TREE_CODE (context) == NAMESPACE_DECL)
{
/* We can get here from typename_sub0 in the explicit_template_type
expansion. Just fail. */
- cp_error ("no class template named `%#T' in `%#T'",
- name, context);
+ if (complain)
+ error ("no class template named `%#T' in `%#T'",
+ name, context);
return error_mark_node;
}
@@ -5574,26 +5681,30 @@ make_typename_type (context, name)
tmpl = lookup_field (context, name, 0, 0);
if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl))
{
- cp_error ("no class template named `%#T' in `%#T'",
- name, context);
+ if (complain)
+ error ("no class template named `%#T' in `%#T'",
+ name, context);
return error_mark_node;
}
- return lookup_template_class (tmpl,
+ return lookup_template_class (tmpl,
TREE_OPERAND (fullname, 1),
- NULL_TREE, context,
- /*entering_scope=*/0);
+ NULL_TREE, context,
+ /*entering_scope=*/0,
+ /*complain=*/1);
}
else
{
- if (IS_AGGR_TYPE (context))
- t = lookup_field (context, name, 0, 1);
- else
+ tree t;
+
+ if (!IS_AGGR_TYPE (context))
{
- cp_error ("no type named `%#T' in `%#T'", name, context);
+ if (complain)
+ error ("no type named `%#T' in `%#T'", name, context);
return error_mark_node;
}
+ t = lookup_field (context, name, 0, 1);
if (t)
return TREE_TYPE (t);
}
@@ -5601,16 +5712,72 @@ make_typename_type (context, name)
/* If the CONTEXT is not a template type, then either the field is
there now or its never going to be. */
- if (!uses_template_parms (context) && !t)
+ if (!uses_template_parms (context))
{
- cp_error ("no type named `%#T' in `%#T'", name, context);
+ if (complain)
+ error ("no type named `%#T' in `%#T'", name, context);
return error_mark_node;
}
-
-
+
+
return build_typename_type (context, name, fullname, NULL_TREE);
}
+/* Resolve `CONTEXT::template NAME'. Returns an appropriate type,
+ unless an error occurs, in which case error_mark_node is returned.
+ If COMPLAIN zero, don't complain about any errors that occur. */
+
+tree
+make_unbound_class_template (context, name, complain)
+ tree context, name;
+ int complain;
+{
+ tree t;
+ tree d;
+
+ if (TYPE_P (name))
+ name = TYPE_IDENTIFIER (name);
+ else if (DECL_P (name))
+ name = DECL_NAME (name);
+ if (TREE_CODE (name) != IDENTIFIER_NODE)
+ abort ();
+
+ if (!uses_template_parms (context)
+ || currently_open_class (context))
+ {
+ tree tmpl = NULL_TREE;
+
+ if (IS_AGGR_TYPE (context))
+ tmpl = lookup_field (context, name, 0, 0);
+
+ if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl))
+ {
+ if (complain)
+ error ("no class template named `%#T' in `%#T'", name, context);
+ return error_mark_node;
+ }
+
+ if (!enforce_access (context, tmpl))
+ return error_mark_node;
+
+ return tmpl;
+ }
+
+ /* Build the UNBOUND_CLASS_TEMPLATE. */
+ t = make_aggr_type (UNBOUND_CLASS_TEMPLATE);
+ TYPE_CONTEXT (t) = FROB_CONTEXT (context);
+ TREE_TYPE (t) = NULL_TREE;
+
+ /* Build the corresponding TEMPLATE_DECL. */
+ d = build_decl (TEMPLATE_DECL, name, t);
+ TYPE_NAME (TREE_TYPE (d)) = d;
+ TYPE_STUB_DECL (TREE_TYPE (d)) = d;
+ DECL_CONTEXT (d) = FROB_CONTEXT (context);
+ DECL_ARTIFICIAL (d) = 1;
+
+ return t;
+}
+
/* Select the right _DECL from multiple choices. */
static tree
@@ -5620,6 +5787,15 @@ select_decl (binding, flags)
{
tree val;
val = BINDING_VALUE (binding);
+
+ /* When we implicitly declare some builtin entity, we mark it
+ DECL_ANTICIPATED, so that we know to ignore it until it is
+ really declared. */
+ if (val && DECL_P (val)
+ && DECL_LANG_SPECIFIC (val)
+ && DECL_ANTICIPATED (val))
+ return NULL_TREE;
+
if (LOOKUP_NAMESPACES_ONLY (flags))
{
/* We are not interested in types. */
@@ -5627,7 +5803,7 @@ select_decl (binding, flags)
return val;
return NULL_TREE;
}
-
+
/* If we could have a type and
we have nothing or we need a type and have none. */
if (BINDING_TYPE (binding)
@@ -5643,24 +5819,30 @@ select_decl (binding, flags)
return val;
}
-/* Unscoped lookup of a global, iterate over namespaces, considering
- using namespace statements. */
+/* Unscoped lookup of a global: iterate over current namespaces,
+ considering using-directives. If SPACESP is non-NULL, store a list
+ of the namespaces we've considered in it. */
-static tree
-unqualified_namespace_lookup (name, flags)
+tree
+unqualified_namespace_lookup (name, flags, spacesp)
tree name;
int flags;
+ tree *spacesp;
{
- struct tree_binding _binding;
- tree b = binding_init (&_binding);
- tree initial = current_decl_namespace();
+ tree b = make_node (CPLUS_BINDING);
+ tree initial = current_decl_namespace ();
tree scope = initial;
tree siter;
struct binding_level *level;
tree val = NULL_TREE;
- while (!val)
+ if (spacesp)
+ *spacesp = NULL_TREE;
+
+ for (; !val; scope = CP_DECL_CONTEXT (scope))
{
+ if (spacesp)
+ *spacesp = tree_cons (scope, NULL_TREE, *spacesp);
val = binding_for_name (name, scope);
/* Initialize binding for this context. */
@@ -5668,11 +5850,11 @@ unqualified_namespace_lookup (name, flags)
BINDING_TYPE (b) = BINDING_TYPE (val);
/* Add all _DECLs seen through local using-directives. */
- for (level = current_binding_level;
+ for (level = current_binding_level;
!level->namespace_p;
level = level->level_chain)
if (!lookup_using_namespace (name, b, level->using_directives,
- scope, flags))
+ scope, flags, spacesp))
/* Give up because of error. */
return error_mark_node;
@@ -5681,8 +5863,8 @@ unqualified_namespace_lookup (name, flags)
siter = initial;
while (1)
{
- if (!lookup_using_namespace (name, b, DECL_NAMESPACE_USING (siter),
- scope, flags))
+ if (!lookup_using_namespace (name, b, DECL_NAMESPACE_USING (siter),
+ scope, flags, spacesp))
/* Give up because of error. */
return error_mark_node;
if (siter == scope) break;
@@ -5692,7 +5874,6 @@ unqualified_namespace_lookup (name, flags)
val = select_decl (b, flags);
if (scope == global_namespace)
break;
- scope = CP_DECL_CONTEXT (scope);
}
return val;
}
@@ -5751,11 +5932,11 @@ warn_about_implicit_typename_lookup (typename, binding)
&& ! (TREE_CODE (binding) == TYPE_DECL
&& same_type_p (TREE_TYPE (binding), subtype)))
{
- cp_warning ("lookup of `%D' finds `%#D'",
+ warning ("lookup of `%D' finds `%#D'",
name, binding);
- cp_warning (" instead of `%D' from dependent base class",
+ warning (" instead of `%D' from dependent base class",
typename);
- cp_warning (" (use `typename %T::%D' if that's what you meant)",
+ warning (" (use `typename %T::%D' if that's what you meant)",
constructor_name (current_class_type), name);
}
}
@@ -5769,7 +5950,7 @@ warn_about_implicit_typename_lookup (typename, binding)
If PREFER_TYPE is > 0, we prefer TYPE_DECLs or namespaces.
If PREFER_TYPE is > 1, we reject non-type decls (e.g. namespaces).
If PREFER_TYPE is -2, we're being called from yylex(). (UGLY)
- Otherwise we prefer non-TYPE_DECLs.
+ Otherwise we prefer non-TYPE_DECLs.
If NONCLASS is non-zero, we don't look for the NAME in class scope,
using IDENTIFIER_CLASS_VALUE. */
@@ -5803,15 +5984,11 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
if (looking_for_template)
flags |= LOOKUP_TEMPLATES_EXPECTED;
- /* std:: becomes :: for now. */
- if (got_scope == std_node)
- got_scope = void_type_node;
-
if (got_scope)
type = got_scope;
else if (got_object != error_mark_node)
type = got_object;
-
+
if (type)
{
if (type == error_mark_node)
@@ -5826,8 +6003,7 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
type = global_namespace;
if (TREE_CODE (type) == NAMESPACE_DECL)
{
- struct tree_binding b;
- val = binding_init (&b);
+ val = make_node (CPLUS_BINDING);
flags |= LOOKUP_COMPLAIN;
if (!qualified_lookup_using_namespace (name, type, val, flags))
return NULL_TREE;
@@ -5835,14 +6011,24 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
}
else if (! IS_AGGR_TYPE (type)
|| TREE_CODE (type) == TEMPLATE_TYPE_PARM
- || TREE_CODE (type) == TEMPLATE_TEMPLATE_PARM
+ || TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM
|| TREE_CODE (type) == TYPENAME_TYPE)
/* Someone else will give an error about this if needed. */
val = NULL_TREE;
else if (type == current_class_type)
val = IDENTIFIER_CLASS_VALUE (name);
else
- val = lookup_member (type, name, 0, prefer_type);
+ {
+ val = lookup_member (type, name, 0, prefer_type);
+ type_access_control (type, val);
+
+ /* Restore the containing TYPENAME_TYPE if we looked
+ through it before. */
+ if (got_scope && got_scope != type
+ && val && TREE_CODE (val) == TYPE_DECL
+ && TREE_CODE (TREE_TYPE (val)) == TYPENAME_TYPE)
+ TYPE_CONTEXT (TREE_TYPE (val)) = got_scope;
+ }
}
else
val = NULL_TREE;
@@ -5850,7 +6036,10 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
if (got_scope)
goto done;
else if (got_object && val)
- from_obj = val;
+ {
+ from_obj = val;
+ val = NULL_TREE;
+ }
}
else
{
@@ -5860,6 +6049,10 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
}
/* First, look in non-namespace scopes. */
+
+ if (current_class_type == NULL_TREE)
+ nonclass = 1;
+
for (t = IDENTIFIER_BINDING (name); t; t = TREE_CHAIN (t))
{
tree binding;
@@ -5867,26 +6060,29 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
if (!LOCAL_BINDING_P (t) && nonclass)
/* We're not looking for class-scoped bindings, so keep going. */
continue;
-
+
/* If this is the kind of thing we're looking for, we're done. */
if (qualify_lookup (BINDING_VALUE (t), flags))
binding = BINDING_VALUE (t);
- else if ((flags & LOOKUP_PREFER_TYPES)
+ else if ((flags & LOOKUP_PREFER_TYPES)
&& qualify_lookup (BINDING_TYPE (t), flags))
binding = BINDING_TYPE (t);
else
binding = NULL_TREE;
+ /* Handle access control on types from enclosing or base classes. */
+ if (binding && ! yylex
+ && BINDING_LEVEL (t) && BINDING_LEVEL (t)->parm_flag == 2)
+ type_access_control (BINDING_LEVEL (t)->this_class, binding);
+
if (binding
- && (!val || !(TREE_CODE (binding) == TYPE_DECL
- && IMPLICIT_TYPENAME_P (TREE_TYPE (binding)))))
+ && (!val || !IMPLICIT_TYPENAME_TYPE_DECL_P (binding)))
{
if (val_is_implicit_typename && !yylex)
warn_about_implicit_typename_lookup (val, binding);
val = binding;
- val_is_implicit_typename
- = (TREE_CODE (val) == TYPE_DECL
- && IMPLICIT_TYPENAME_P (TREE_TYPE (val)));
+ val_is_implicit_typename
+ = IMPLICIT_TYPENAME_TYPE_DECL_P (val);
if (!val_is_implicit_typename)
break;
}
@@ -5895,7 +6091,7 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
/* Now lookup in namespace scopes. */
if (!val || val_is_implicit_typename)
{
- t = unqualified_namespace_lookup (name, flags);
+ t = unqualified_namespace_lookup (name, flags, 0);
if (t)
{
if (val_is_implicit_typename && !yylex)
@@ -5912,13 +6108,11 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
{
if (looking_for_typename && TREE_CODE (from_obj) == TYPE_DECL
&& TREE_CODE (val) == TYPE_DECL
- && TREE_TYPE (from_obj) != TREE_TYPE (val))
- {
- cp_pedwarn ("lookup of `%D' in the scope of `%#T' (`%#T')",
- name, got_object, TREE_TYPE (from_obj));
- cp_pedwarn (" does not match lookup in the current scope (`%#T')",
- TREE_TYPE (val));
- }
+ && ! same_type_p (TREE_TYPE (from_obj), TREE_TYPE (val)))
+ pedwarn ("\
+lookup of `%D' in the scope of `%#T' (`%#D') \
+does not match lookup in the current scope (`%#D')",
+ name, got_object, from_obj, val);
/* We don't change val to from_obj if got_object depends on
template parms because that breaks implicit typename for
@@ -5984,20 +6178,20 @@ lookup_name_current_level (name)
if (b->namespace_p)
{
- t = IDENTIFIER_NAMESPACE_VALUE (name);
+ t = IDENTIFIER_NAMESPACE_VALUE (name);
/* extern "C" function() */
if (t != NULL_TREE && TREE_CODE (t) == TREE_LIST)
t = TREE_VALUE (t);
}
- else if (IDENTIFIER_BINDING (name)
+ else if (IDENTIFIER_BINDING (name)
&& LOCAL_BINDING_P (IDENTIFIER_BINDING (name)))
{
while (1)
{
if (BINDING_LEVEL (IDENTIFIER_BINDING (name)) == b)
return IDENTIFIER_VALUE (name);
-
+
if (b->keep == 2)
b = b->level_chain;
else
@@ -6048,47 +6242,12 @@ end_only_namespace_names ()
only_namespace_names = 0;
}
-/* Arrange for the user to get a source line number, even when the
- compiler is going down in flames, so that she at least has a
- chance of working around problems in the compiler. We used to
- call error(), but that let the segmentation fault continue
- through; now, it's much more passive by asking them to send the
- maintainers mail about the problem. */
-
-static void
-signal_catch (sig)
- int sig ATTRIBUTE_UNUSED;
-{
- signal (SIGSEGV, SIG_DFL);
-#ifdef SIGIOT
- signal (SIGIOT, SIG_DFL);
-#endif
-#ifdef SIGILL
- signal (SIGILL, SIG_DFL);
-#endif
-#ifdef SIGABRT
- signal (SIGABRT, SIG_DFL);
-#endif
-#ifdef SIGBUS
- signal (SIGBUS, SIG_DFL);
-#endif
- my_friendly_abort (0);
-}
-
-#if 0
-/* Unused -- brendan 970107 */
-/* Array for holding types considered "built-in". These types
- are output in the module in which `main' is defined. */
-static tree *builtin_type_tdescs_arr;
-static int builtin_type_tdescs_len, builtin_type_tdescs_max;
-#endif
-
/* Push the declarations of builtin types into the namespace.
- RID_INDEX, if < RID_MAX is the index of the builtin type
+ RID_INDEX is the index of the builtin type
in the array RID_POINTERS. NAME is the name used when looking
up the builtin type. TYPE is the _TYPE node for the builtin type. */
-static void
+void
record_builtin_type (rid_index, name, type)
enum rid rid_index;
const char *name;
@@ -6103,7 +6262,7 @@ record_builtin_type (rid_index, name, type)
tname = get_identifier (name);
TYPE_BUILT_IN (type) = 1;
-
+
if (tname)
{
tdecl = pushdecl (build_decl (TYPE_DECL, tname, type));
@@ -6176,31 +6335,59 @@ record_unknown_type (type, name)
TYPE_DECL_SUPPRESS_DEBUG (decl) = 1;
TYPE_SIZE (type) = TYPE_SIZE (void_type_node);
TYPE_ALIGN (type) = 1;
+ TYPE_USER_ALIGN (type) = 0;
TYPE_MODE (type) = TYPE_MODE (void_type_node);
-}
+}
-/* Push overloaded decl, in global scope, with one argument so it
- can be used as a callback from define_function. */
+/* An string for which we should create an IDENTIFIER_NODE at
+ startup. */
-static void
-push_overloaded_decl_1 (x)
- tree x;
+typedef struct predefined_identifier
{
- push_overloaded_decl (x, PUSH_GLOBAL);
-}
+ /* The name of the identifier. */
+ const char *const name;
+ /* The place where the IDENTIFIER_NODE should be stored. */
+ tree *const node;
+ /* Non-zero if this is the name of a constructor or destructor. */
+ const int ctor_or_dtor_p;
+} predefined_identifier;
-#ifdef __GNUC__
-__inline
-#endif
-tree
-auto_function (name, type, code)
- tree name, type;
- enum built_in_function code;
-{
- return define_function
- (IDENTIFIER_POINTER (name), type, code, push_overloaded_decl_1,
- IDENTIFIER_POINTER (build_decl_overload (name, TYPE_ARG_TYPES (type),
- 0)));
+/* Create all the predefined identifiers. */
+
+static void
+initialize_predefined_identifiers ()
+{
+ const predefined_identifier *pid;
+
+ /* A table of identifiers to create at startup. */
+ static const predefined_identifier predefined_identifiers[] = {
+ { "C++", &lang_name_cplusplus, 0 },
+ { "C", &lang_name_c, 0 },
+ { "Java", &lang_name_java, 0 },
+ { CTOR_NAME, &ctor_identifier, 1 },
+ { "__base_ctor", &base_ctor_identifier, 1 },
+ { "__comp_ctor", &complete_ctor_identifier, 1 },
+ { DTOR_NAME, &dtor_identifier, 1 },
+ { "__comp_dtor", &complete_dtor_identifier, 1 },
+ { "__base_dtor", &base_dtor_identifier, 1 },
+ { "__deleting_dtor", &deleting_dtor_identifier, 1 },
+ { IN_CHARGE_NAME, &in_charge_identifier, 0 },
+ { "nelts", &nelts_identifier, 0 },
+ { THIS_NAME, &this_identifier, 0 },
+ { VTABLE_DELTA_NAME, &delta_identifier, 0 },
+ { VTABLE_PFN_NAME, &pfn_identifier, 0 },
+ { "_vptr", &vptr_identifier, 0 },
+ { "__vtt_parm", &vtt_parm_identifier, 0 },
+ { "std", &std_identifier, 0 },
+ { NULL, NULL, 0 }
+ };
+
+ for (pid = predefined_identifiers; pid->name; ++pid)
+ {
+ *pid->node = get_identifier (pid->name);
+ if (pid->ctor_or_dtor_p)
+ IDENTIFIER_CTOR_OR_DTOR_P (*pid->node) = 1;
+ }
}
/* Create the predefined scalar types of C,
@@ -6209,79 +6396,62 @@ auto_function (name, type, code)
Make definitions for built-in primitive functions. */
void
-init_decl_processing ()
-{
- register tree endlink, int_endlink, double_endlink, unsigned_endlink;
- tree fields[20];
- /* Data type of memcpy. */
- tree memcpy_ftype, strlen_ftype;
- int wchar_type_size;
- tree temp;
- tree array_domain_type;
- tree vb_off_identifier = NULL_TREE;
- /* Function type `char *(char *, char *)' and similar ones */
- tree string_ftype_ptr_ptr, int_ftype_string_string;
- tree sizetype_endlink;
- tree ptr_ftype, ptr_ftype_unsigned, ptr_ftype_sizetype;
- tree void_ftype, void_ftype_int, void_ftype_ptr;
-
- /* Have to make these distinct before we try using them. */
- lang_name_cplusplus = get_identifier ("C++");
- lang_name_c = get_identifier ("C");
- lang_name_java = get_identifier ("Java");
+cxx_init_decl_processing ()
+{
+ tree void_ftype;
+ tree void_ftype_ptr;
+
+ /* Create all the identifiers we need. */
+ initialize_predefined_identifiers ();
+
+ /* Fill in back-end hooks. */
+ init_lang_status = &push_cp_function_context;
+ free_lang_status = &pop_cp_function_context;
+ mark_lang_status = &mark_cp_function_context;
+ lang_missing_noreturn_ok_p = &cp_missing_noreturn_ok_p;
+
+ cp_parse_init ();
+ init_decl2 ();
+ init_pt ();
+
+ /* Create the global variables. */
+ push_to_top_level ();
/* Enter the global namespace. */
my_friendly_assert (global_namespace == NULL_TREE, 375);
- my_friendly_assert (current_lang_name == NULL_TREE, 375);
- current_lang_name = lang_name_cplusplus;
push_namespace (get_identifier ("::"));
global_namespace = current_namespace;
current_lang_name = NULL_TREE;
- if (flag_strict_prototype == 2)
- flag_strict_prototype = pedantic;
+ /* Adjust various flags based on command-line settings. */
if (! flag_permissive && ! pedantic)
flag_pedantic_errors = 1;
+ if (!flag_no_inline)
+ {
+ flag_inline_trees = 1;
+ flag_no_inline = 1;
+ }
+ if (flag_inline_functions)
+ {
+ flag_inline_trees = 2;
+ flag_inline_functions = 0;
+ }
- strict_prototypes_lang_c = flag_strict_prototype;
+ /* In C++, we never create builtin functions whose name does not
+ begin with `__'. Users should be using headers to get prototypes
+ in C++. It would be nice if we could warn when `-fbuiltin' is
+ used explicitly, but we do not have that information. */
+ flag_no_builtin = 1;
/* Initially, C. */
current_lang_name = lang_name_c;
current_function_decl = NULL_TREE;
- named_labels = NULL_TREE;
- named_label_uses = NULL;
current_binding_level = NULL_BINDING_LEVEL;
free_binding_level = NULL_BINDING_LEVEL;
- /* Because most segmentation signals can be traced back into user
- code, catch them and at least give the user a chance of working
- around compiler bugs. */
- signal (SIGSEGV, signal_catch);
-
- /* 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
- code. */
-#ifdef SIGIOT
- signal (SIGIOT, signal_catch);
-#endif
-#ifdef SIGILL
- signal (SIGILL, signal_catch);
-#endif
-#ifdef SIGABRT
- signal (SIGABRT, signal_catch);
-#endif
-#ifdef SIGBUS
- signal (SIGBUS, signal_catch);
-#endif
-
- gcc_obstack_init (&decl_obstack);
+ build_common_tree_nodes (flag_signed_char);
- /* Must lay these out before anything else gets laid out. */
- error_mark_node = make_node (ERROR_MARK);
- TREE_PERMANENT (error_mark_node) = 1;
- TREE_TYPE (error_mark_node) = error_mark_node;
error_mark_list = build_tree_list (error_mark_node, error_mark_node);
TREE_TYPE (error_mark_list) = error_mark_node;
@@ -6292,147 +6462,14 @@ init_decl_processing ()
NAMESPACE_LEVEL (global_namespace) = global_binding_level;
declare_namespace_level ();
- this_identifier = get_identifier (THIS_NAME);
- in_charge_identifier = get_identifier (IN_CHARGE_NAME);
- vlist_identifier = get_identifier (VLIST_NAME);
- ctor_identifier = get_identifier (CTOR_NAME);
- dtor_identifier = get_identifier (DTOR_NAME);
- pfn_identifier = get_identifier (VTABLE_PFN_NAME);
- index_identifier = get_identifier (VTABLE_INDEX_NAME);
- delta_identifier = get_identifier (VTABLE_DELTA_NAME);
- delta2_identifier = get_identifier (VTABLE_DELTA2_NAME);
- pfn_or_delta2_identifier = get_identifier ("__pfn_or_delta2");
- if (flag_handle_signatures)
- {
- tag_identifier = get_identifier (SIGTABLE_TAG_NAME);
- vb_off_identifier = get_identifier (SIGTABLE_VB_OFF_NAME);
- vt_off_identifier = get_identifier (SIGTABLE_VT_OFF_NAME);
- }
-
- /* Define `int' and `char' first so that dbx will output them first. */
-
- integer_type_node = make_signed_type (INT_TYPE_SIZE);
- record_builtin_type (RID_INT, NULL_PTR, integer_type_node);
+ /* Create the `std' namespace. */
+ push_namespace (std_identifier);
+ std_node = current_namespace;
+ pop_namespace ();
- /* Define `char', which is like either `signed char' or `unsigned char'
- but not the same as either. */
+ lang_attribute_table = cp_attribute_table;
- char_type_node
- = (flag_signed_char
- ? make_signed_type (CHAR_TYPE_SIZE)
- : make_unsigned_type (CHAR_TYPE_SIZE));
- record_builtin_type (RID_CHAR, "char", char_type_node);
-
- /* `signed' is the same as `int' */
- record_builtin_type (RID_SIGNED, NULL_PTR, integer_type_node);
-
- long_integer_type_node = make_signed_type (LONG_TYPE_SIZE);
- record_builtin_type (RID_LONG, "long int", long_integer_type_node);
-
- unsigned_type_node = make_unsigned_type (INT_TYPE_SIZE);
- record_builtin_type (RID_UNSIGNED, "unsigned int", unsigned_type_node);
-
- long_unsigned_type_node = make_unsigned_type (LONG_TYPE_SIZE);
- record_builtin_type (RID_MAX, "long unsigned int", long_unsigned_type_node);
- record_builtin_type (RID_MAX, "unsigned long", long_unsigned_type_node);
-
- long_long_integer_type_node = make_signed_type (LONG_LONG_TYPE_SIZE);
- record_builtin_type (RID_MAX, "long long int", long_long_integer_type_node);
-
- long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE);
- record_builtin_type (RID_MAX, "long long unsigned int",
- long_long_unsigned_type_node);
- record_builtin_type (RID_MAX, "long long unsigned",
- long_long_unsigned_type_node);
-
- short_integer_type_node = make_signed_type (SHORT_TYPE_SIZE);
- record_builtin_type (RID_SHORT, "short int", short_integer_type_node);
- short_unsigned_type_node = make_unsigned_type (SHORT_TYPE_SIZE);
- record_builtin_type (RID_MAX, "short unsigned int", short_unsigned_type_node);
- record_builtin_type (RID_MAX, "unsigned short", short_unsigned_type_node);
-
- /* `unsigned long' is the standard type for sizeof.
- Note that stddef.h uses `unsigned long',
- and this must agree, even if long and int are the same size. */
- set_sizetype
- (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE))));
-
- ptrdiff_type_node
- = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE)));
-
- /* Define both `signed char' and `unsigned char'. */
- signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE);
- record_builtin_type (RID_MAX, "signed char", signed_char_type_node);
- unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE);
- record_builtin_type (RID_MAX, "unsigned char", unsigned_char_type_node);
-
- /* These are types that type_for_size and type_for_mode use. */
- intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node));
- intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node));
- intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node));
- intDI_type_node = make_signed_type (GET_MODE_BITSIZE (DImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node));
-#if HOST_BITS_PER_WIDE_INT >= 64
- intTI_type_node = make_signed_type (GET_MODE_BITSIZE (TImode));
- pushdecl (build_decl (TYPE_DECL, get_identifier ("__int128_t"), intTI_type_node));
-#endif
- unsigned_intQI_type_node = make_unsigned_type (GET_MODE_BITSIZE (QImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node));
- unsigned_intHI_type_node = make_unsigned_type (GET_MODE_BITSIZE (HImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node));
- unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node));
- unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node));
-#if HOST_BITS_PER_WIDE_INT >= 64
- unsigned_intTI_type_node = make_unsigned_type (GET_MODE_BITSIZE (TImode));
- pushdecl (build_decl (TYPE_DECL, get_identifier ("__uint128_t"), unsigned_intTI_type_node));
-#endif
-
- float_type_node = make_node (REAL_TYPE);
- TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE;
- record_builtin_type (RID_FLOAT, NULL_PTR, float_type_node);
- layout_type (float_type_node);
-
- double_type_node = make_node (REAL_TYPE);
- if (flag_short_double)
- TYPE_PRECISION (double_type_node) = FLOAT_TYPE_SIZE;
- else
- TYPE_PRECISION (double_type_node) = DOUBLE_TYPE_SIZE;
- record_builtin_type (RID_DOUBLE, NULL_PTR, double_type_node);
- layout_type (double_type_node);
-
- long_double_type_node = make_node (REAL_TYPE);
- TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE;
- record_builtin_type (RID_MAX, "long double", long_double_type_node);
- layout_type (long_double_type_node);
-
- complex_integer_type_node = make_node (COMPLEX_TYPE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"),
- complex_integer_type_node));
- TREE_TYPE (complex_integer_type_node) = integer_type_node;
- layout_type (complex_integer_type_node);
-
- complex_float_type_node = make_node (COMPLEX_TYPE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"),
- complex_float_type_node));
- TREE_TYPE (complex_float_type_node) = float_type_node;
- layout_type (complex_float_type_node);
-
- complex_double_type_node = make_node (COMPLEX_TYPE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"),
- complex_double_type_node));
- TREE_TYPE (complex_double_type_node) = double_type_node;
- layout_type (complex_double_type_node);
-
- complex_long_double_type_node = make_node (COMPLEX_TYPE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"),
- complex_long_double_type_node));
- TREE_TYPE (complex_long_double_type_node) = long_double_type_node;
- layout_type (complex_long_double_type_node);
+ c_common_nodes_and_builtins ();
java_byte_type_node = record_builtin_java_type ("__java_byte", 8);
java_short_type_node = record_builtin_java_type ("__java_short", 16);
@@ -6443,10 +6480,6 @@ init_decl_processing ()
java_char_type_node = record_builtin_java_type ("__java_char", -16);
java_boolean_type_node = record_builtin_java_type ("__java_boolean", -1);
- integer_zero_node = build_int_2 (0, 0);
- TREE_TYPE (integer_zero_node) = integer_type_node;
- integer_one_node = build_int_2 (1, 0);
- TREE_TYPE (integer_one_node) = integer_type_node;
integer_two_node = build_int_2 (2, 0);
TREE_TYPE (integer_two_node) = integer_type_node;
integer_three_node = build_int_2 (3, 0);
@@ -6463,318 +6496,28 @@ init_decl_processing ()
boolean_true_node = build_int_2 (1, 0);
TREE_TYPE (boolean_true_node) = boolean_type_node;
- /* These are needed by stor-layout.c. */
- size_zero_node = size_int (0);
- size_one_node = size_int (1);
-
signed_size_zero_node = build_int_2 (0, 0);
TREE_TYPE (signed_size_zero_node) = make_signed_type (TYPE_PRECISION (sizetype));
- void_type_node = make_node (VOID_TYPE);
- record_builtin_type (RID_VOID, NULL_PTR, void_type_node);
- layout_type (void_type_node); /* Uses integer_zero_node. */
- void_list_node = build_tree_list (NULL_TREE, void_type_node);
- TREE_PARMLIST (void_list_node) = 1;
-
- null_pointer_node = build_int_2 (0, 0);
- TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node);
- layout_type (TREE_TYPE (null_pointer_node));
-
- /* Used for expressions that do nothing, but are not errors. */
- void_zero_node = build_int_2 (0, 0);
- TREE_TYPE (void_zero_node) = void_type_node;
-
- string_type_node = build_pointer_type (char_type_node);
- const_string_type_node
- = build_pointer_type (build_qualified_type (char_type_node,
- TYPE_QUAL_CONST));
-#if 0
- record_builtin_type (RID_MAX, NULL_PTR, string_type_node);
-#endif
+ empty_except_spec = build_tree_list (NULL_TREE, NULL_TREE);
- /* Make a type to be the domain of a few array types
- whose domains don't really matter.
- 200 is small enough that it always fits in size_t
- and large enough that it can hold most function names for the
- initializations of __FUNCTION__ and __PRETTY_FUNCTION__. */
- array_domain_type = build_index_type (build_int_2 (200, 0));
-
- /* Make a type for arrays of characters.
- With luck nothing will ever really depend on the length of this
- array type. */
- char_array_type_node
- = build_array_type (char_type_node, array_domain_type);
- /* Likewise for arrays of ints. */
- int_array_type_node
- = build_array_type (integer_type_node, array_domain_type);
-
- /* This is just some anonymous class type. Nobody should ever
- need to look inside this envelope. */
- class_star_type_node = build_pointer_type (make_lang_type (RECORD_TYPE));
-
- default_function_type
- = build_function_type (integer_type_node, NULL_TREE);
-
- ptr_type_node = build_pointer_type (void_type_node);
- const_ptr_type_node
- = build_pointer_type (build_qualified_type (void_type_node,
- TYPE_QUAL_CONST));
#if 0
- record_builtin_type (RID_MAX, NULL_PTR, ptr_type_node);
+ record_builtin_type (RID_MAX, NULL, string_type_node);
#endif
- endlink = void_list_node;
- int_endlink = tree_cons (NULL_TREE, integer_type_node, endlink);
- double_endlink = tree_cons (NULL_TREE, double_type_node, endlink);
- unsigned_endlink = tree_cons (NULL_TREE, unsigned_type_node, endlink);
+ delta_type_node = ptrdiff_type_node;
+ vtable_index_type = ptrdiff_type_node;
- ptr_ftype = build_function_type (ptr_type_node, NULL_TREE);
- ptr_ftype_unsigned = build_function_type (ptr_type_node, unsigned_endlink);
- sizetype_endlink = tree_cons (NULL_TREE, sizetype, endlink);
- /* We realloc here because sizetype could be int or unsigned. S'ok. */
- ptr_ftype_sizetype = build_function_type (ptr_type_node, sizetype_endlink);
+ vtt_parm_type = build_pointer_type (const_ptr_type_node);
+ lang_type_promotes_to = convert_type_from_ellipsis;
- void_ftype = build_function_type (void_type_node, endlink);
- void_ftype_int = build_function_type (void_type_node, int_endlink);
+ void_ftype = build_function_type (void_type_node, void_list_node);
+ void_ftype_ptr = build_function_type (void_type_node,
+ tree_cons (NULL_TREE,
+ ptr_type_node,
+ void_list_node));
void_ftype_ptr
- = build_function_type (void_type_node,
- tree_cons (NULL_TREE, ptr_type_node, endlink));
- void_ftype_ptr
- = build_exception_variant (void_ftype_ptr,
- tree_cons (NULL_TREE, NULL_TREE, NULL_TREE));
-
- float_ftype_float
- = build_function_type (float_type_node,
- tree_cons (NULL_TREE, float_type_node, endlink));
-
- double_ftype_double
- = build_function_type (double_type_node, double_endlink);
-
- ldouble_ftype_ldouble
- = build_function_type (long_double_type_node,
- tree_cons (NULL_TREE, long_double_type_node,
- endlink));
-
- double_ftype_double_double
- = build_function_type (double_type_node,
- tree_cons (NULL_TREE, double_type_node,
- double_endlink));
-
- int_ftype_int
- = build_function_type (integer_type_node, int_endlink);
-
- long_ftype_long
- = build_function_type (long_integer_type_node,
- tree_cons (NULL_TREE, long_integer_type_node,
- endlink));
-
- int_ftype_cptr_cptr_sizet
- = build_function_type (integer_type_node,
- tree_cons (NULL_TREE, const_ptr_type_node,
- tree_cons (NULL_TREE, const_ptr_type_node,
- tree_cons (NULL_TREE,
- sizetype,
- endlink))));
-
- string_ftype_ptr_ptr /* strcpy prototype */
- = build_function_type (string_type_node,
- tree_cons (NULL_TREE, string_type_node,
- tree_cons (NULL_TREE,
- const_string_type_node,
- endlink)));
-
- int_ftype_string_string /* strcmp prototype */
- = build_function_type (integer_type_node,
- tree_cons (NULL_TREE, const_string_type_node,
- tree_cons (NULL_TREE,
- const_string_type_node,
- endlink)));
-
- strlen_ftype /* strlen prototype */
- = build_function_type (sizetype,
- tree_cons (NULL_TREE, const_string_type_node,
- endlink));
-
- memcpy_ftype /* memcpy prototype */
- = build_function_type (ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, const_ptr_type_node,
- sizetype_endlink)));
-
- if (flag_huge_objects)
- delta_type_node = long_integer_type_node;
- else
- delta_type_node = short_integer_type_node;
-
- builtin_function ("__builtin_constant_p", default_function_type,
- BUILT_IN_CONSTANT_P, NULL_PTR);
-
- builtin_return_address_fndecl
- = builtin_function ("__builtin_return_address", ptr_ftype_unsigned,
- BUILT_IN_RETURN_ADDRESS, NULL_PTR);
-
- builtin_function ("__builtin_frame_address", ptr_ftype_unsigned,
- BUILT_IN_FRAME_ADDRESS, NULL_PTR);
-
- builtin_function ("__builtin_alloca", ptr_ftype_sizetype,
- BUILT_IN_ALLOCA, "alloca");
- builtin_function ("__builtin_ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR);
- /* Define alloca, ffs as builtins.
- Declare _exit just to mark it as volatile. */
- if (! flag_no_builtin && !flag_no_nonansi_builtin)
- {
- temp = builtin_function ("alloca", ptr_ftype_sizetype,
- BUILT_IN_ALLOCA, NULL_PTR);
- /* Suppress error if redefined as a non-function. */
- DECL_BUILT_IN_NONANSI (temp) = 1;
- temp = builtin_function ("ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR);
- /* Suppress error if redefined as a non-function. */
- DECL_BUILT_IN_NONANSI (temp) = 1;
- temp = builtin_function ("_exit", void_ftype_int,
- NOT_BUILT_IN, NULL_PTR);
- TREE_THIS_VOLATILE (temp) = 1;
- TREE_SIDE_EFFECTS (temp) = 1;
- /* Suppress error if redefined as a non-function. */
- DECL_BUILT_IN_NONANSI (temp) = 1;
- }
-
- builtin_function ("__builtin_abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR);
- builtin_function ("__builtin_fabsf", float_ftype_float, BUILT_IN_FABS,
- NULL_PTR);
- builtin_function ("__builtin_fabs", double_ftype_double, BUILT_IN_FABS,
- NULL_PTR);
- builtin_function ("__builtin_fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS,
- NULL_PTR);
- builtin_function ("__builtin_labs", long_ftype_long,
- BUILT_IN_LABS, NULL_PTR);
- builtin_function ("__builtin_saveregs", ptr_ftype,
- BUILT_IN_SAVEREGS, NULL_PTR);
- builtin_function ("__builtin_classify_type", default_function_type,
- BUILT_IN_CLASSIFY_TYPE, NULL_PTR);
- builtin_function ("__builtin_next_arg", ptr_ftype,
- BUILT_IN_NEXT_ARG, NULL_PTR);
- builtin_function ("__builtin_args_info", int_ftype_int,
- BUILT_IN_ARGS_INFO, NULL_PTR);
- builtin_function ("__builtin_setjmp",
- build_function_type (integer_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- endlink)),
- BUILT_IN_SETJMP, NULL_PTR);
- builtin_function ("__builtin_longjmp",
- build_function_type (integer_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE,
- integer_type_node,
- endlink))),
- BUILT_IN_LONGJMP, NULL_PTR);
-
- /* Untyped call and return. */
- builtin_function ("__builtin_apply_args", ptr_ftype,
- BUILT_IN_APPLY_ARGS, NULL_PTR);
-
- temp = tree_cons (NULL_TREE,
- build_pointer_type (build_function_type (void_type_node,
- NULL_TREE)),
- tree_cons (NULL_TREE, ptr_ftype_sizetype, NULL_TREE));
- builtin_function ("__builtin_apply",
- build_function_type (ptr_type_node, temp),
- BUILT_IN_APPLY, NULL_PTR);
- builtin_function ("__builtin_return", void_ftype_ptr,
- BUILT_IN_RETURN, NULL_PTR);
-
- /* Currently under experimentation. */
- builtin_function ("__builtin_memcpy", memcpy_ftype,
- BUILT_IN_MEMCPY, "memcpy");
- builtin_function ("__builtin_memcmp", int_ftype_cptr_cptr_sizet,
- BUILT_IN_MEMCMP, "memcmp");
- builtin_function ("__builtin_strcmp", int_ftype_string_string,
- BUILT_IN_STRCMP, "strcmp");
- builtin_function ("__builtin_strcpy", string_ftype_ptr_ptr,
- BUILT_IN_STRCPY, "strcpy");
- builtin_function ("__builtin_strlen", strlen_ftype,
- BUILT_IN_STRLEN, "strlen");
- builtin_function ("__builtin_sqrtf", float_ftype_float,
- BUILT_IN_FSQRT, "sqrtf");
- builtin_function ("__builtin_fsqrt", double_ftype_double,
- BUILT_IN_FSQRT, NULL_PTR);
- builtin_function ("__builtin_sqrtl", ldouble_ftype_ldouble,
- BUILT_IN_FSQRT, "sqrtl");
- builtin_function ("__builtin_sinf", float_ftype_float,
- BUILT_IN_SIN, "sinf");
- builtin_function ("__builtin_sin", double_ftype_double,
- BUILT_IN_SIN, "sin");
- builtin_function ("__builtin_sinl", ldouble_ftype_ldouble,
- BUILT_IN_SIN, "sinl");
- builtin_function ("__builtin_cosf", float_ftype_float,
- BUILT_IN_COS, "cosf");
- builtin_function ("__builtin_cos", double_ftype_double,
- BUILT_IN_COS, "cos");
- builtin_function ("__builtin_cosl", ldouble_ftype_ldouble,
- BUILT_IN_COS, "cosl");
-
- if (!flag_no_builtin)
- {
- builtin_function ("abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR);
- builtin_function ("fabs", double_ftype_double, BUILT_IN_FABS, NULL_PTR);
- builtin_function ("labs", long_ftype_long, BUILT_IN_LABS, NULL_PTR);
- builtin_function ("fabsf", float_ftype_float, BUILT_IN_FABS, NULL_PTR);
- builtin_function ("fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS,
- NULL_PTR);
- builtin_function ("memcpy", memcpy_ftype, BUILT_IN_MEMCPY, NULL_PTR);
- builtin_function ("memcmp", int_ftype_cptr_cptr_sizet, BUILT_IN_MEMCMP,
- NULL_PTR);
- builtin_function ("strcmp", int_ftype_string_string, BUILT_IN_STRCMP,
- NULL_PTR);
- builtin_function ("strcpy", string_ftype_ptr_ptr, BUILT_IN_STRCPY,
- NULL_PTR);
- builtin_function ("strlen", strlen_ftype, BUILT_IN_STRLEN, NULL_PTR);
- builtin_function ("sqrtf", float_ftype_float, BUILT_IN_FSQRT, NULL_PTR);
- builtin_function ("sqrt", double_ftype_double, BUILT_IN_FSQRT, NULL_PTR);
- builtin_function ("sqrtl", ldouble_ftype_ldouble, BUILT_IN_FSQRT,
- NULL_PTR);
- builtin_function ("sinf", float_ftype_float, BUILT_IN_SIN, NULL_PTR);
- builtin_function ("sin", double_ftype_double, BUILT_IN_SIN, NULL_PTR);
- builtin_function ("sinl", ldouble_ftype_ldouble, BUILT_IN_SIN, NULL_PTR);
- builtin_function ("cosf", float_ftype_float, BUILT_IN_COS, NULL_PTR);
- builtin_function ("cos", double_ftype_double, BUILT_IN_COS, NULL_PTR);
- builtin_function ("cosl", ldouble_ftype_ldouble, BUILT_IN_COS, NULL_PTR);
-
- /* Declare these functions volatile
- to avoid spurious "control drops through" warnings. */
- temp = builtin_function ("abort", void_ftype,
- NOT_BUILT_IN, NULL_PTR);
- TREE_THIS_VOLATILE (temp) = 1;
- TREE_SIDE_EFFECTS (temp) = 1;
- /* Well, these are actually ANSI, but we can't set DECL_BUILT_IN on
- them... */
- DECL_BUILT_IN_NONANSI (temp) = 1;
- temp = builtin_function ("exit", void_ftype_int,
- NOT_BUILT_IN, NULL_PTR);
- TREE_THIS_VOLATILE (temp) = 1;
- TREE_SIDE_EFFECTS (temp) = 1;
- DECL_BUILT_IN_NONANSI (temp) = 1;
- }
-
-#if 0
- /* Support for these has not been written in either expand_builtin
- or build_function_call. */
- builtin_function ("__builtin_div", default_ftype, BUILT_IN_DIV, NULL_PTR);
- builtin_function ("__builtin_ldiv", default_ftype, BUILT_IN_LDIV, NULL_PTR);
- builtin_function ("__builtin_ffloor", double_ftype_double, BUILT_IN_FFLOOR,
- NULL_PTR);
- builtin_function ("__builtin_fceil", double_ftype_double, BUILT_IN_FCEIL,
- NULL_PTR);
- builtin_function ("__builtin_fmod", double_ftype_double_double,
- BUILT_IN_FMOD, NULL_PTR);
- builtin_function ("__builtin_frem", double_ftype_double_double,
- BUILT_IN_FREM, NULL_PTR);
- builtin_function ("__builtin_memset", ptr_ftype_ptr_int_int,
- BUILT_IN_MEMSET, NULL_PTR);
- builtin_function ("__builtin_getexp", double_ftype_double, BUILT_IN_GETEXP,
- NULL_PTR);
- builtin_function ("__builtin_getman", double_ftype_double, BUILT_IN_GETMAN,
- NULL_PTR);
-#endif
+ = build_exception_variant (void_ftype_ptr, empty_except_spec);
/* C++ extensions */
@@ -6784,136 +6527,35 @@ init_decl_processing ()
/* Indirecting an UNKNOWN_TYPE node yields an UNKNOWN_TYPE node. */
TREE_TYPE (unknown_type_node) = unknown_type_node;
- TREE_TYPE (null_node) = type_for_size (POINTER_SIZE, 0);
-
/* Looking up TYPE_POINTER_TO and TYPE_REFERENCE_TO yield the same
result. */
TYPE_POINTER_TO (unknown_type_node) = unknown_type_node;
TYPE_REFERENCE_TO (unknown_type_node) = unknown_type_node;
- /* This is for handling opaque types in signatures. */
- opaque_type_node = copy_node (ptr_type_node);
- TYPE_MAIN_VARIANT (opaque_type_node) = opaque_type_node;
- record_builtin_type (RID_MAX, 0, opaque_type_node);
-
- /* This is special for C++ so functions can be overloaded. */
- wchar_type_node
- = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (WCHAR_TYPE)));
- wchar_type_size = TYPE_PRECISION (wchar_type_node);
- signed_wchar_type_node = make_signed_type (wchar_type_size);
- unsigned_wchar_type_node = make_unsigned_type (wchar_type_size);
- wchar_type_node
- = TREE_UNSIGNED (wchar_type_node)
- ? unsigned_wchar_type_node
- : signed_wchar_type_node;
- record_builtin_type (RID_WCHAR, "__wchar_t", wchar_type_node);
-
- /* Artificial declaration of wchar_t -- can be bashed */
- wchar_decl_node = build_decl (TYPE_DECL, get_identifier ("wchar_t"),
- wchar_type_node);
- pushdecl (wchar_decl_node);
-
- /* This is for wide string constants. */
- wchar_array_type_node
- = build_array_type (wchar_type_node, array_domain_type);
-
- if (flag_vtable_thunks)
- {
- /* Make sure we get a unique function type, so we can give
- its pointer type a name. (This wins for gdb.) */
- tree vfunc_type = make_node (FUNCTION_TYPE);
- TREE_TYPE (vfunc_type) = integer_type_node;
- TYPE_ARG_TYPES (vfunc_type) = NULL_TREE;
- layout_type (vfunc_type);
-
- vtable_entry_type = build_pointer_type (vfunc_type);
- }
- else
- {
- vtable_entry_type = make_lang_type (RECORD_TYPE);
- fields[0] = build_lang_field_decl (FIELD_DECL, delta_identifier,
- delta_type_node);
- fields[1] = build_lang_field_decl (FIELD_DECL, index_identifier,
- delta_type_node);
- fields[2] = build_lang_field_decl (FIELD_DECL, pfn_identifier,
- ptr_type_node);
- finish_builtin_type (vtable_entry_type, VTBL_PTR_TYPE, fields, 2,
- double_type_node);
-
- /* Make this part of an invisible union. */
- fields[3] = copy_node (fields[2]);
- TREE_TYPE (fields[3]) = delta_type_node;
- DECL_NAME (fields[3]) = delta2_identifier;
- DECL_MODE (fields[3]) = TYPE_MODE (delta_type_node);
- DECL_SIZE (fields[3]) = TYPE_SIZE (delta_type_node);
- TREE_UNSIGNED (fields[3]) = 0;
- TREE_CHAIN (fields[2]) = fields[3];
- vtable_entry_type = build_qualified_type (vtable_entry_type,
- TYPE_QUAL_CONST);
- }
+ {
+ /* Make sure we get a unique function type, so we can give
+ its pointer type a name. (This wins for gdb.) */
+ tree vfunc_type = make_node (FUNCTION_TYPE);
+ TREE_TYPE (vfunc_type) = integer_type_node;
+ TYPE_ARG_TYPES (vfunc_type) = NULL_TREE;
+ layout_type (vfunc_type);
+
+ vtable_entry_type = build_pointer_type (vfunc_type);
+ }
record_builtin_type (RID_MAX, VTBL_PTR_TYPE, vtable_entry_type);
vtbl_type_node
= build_cplus_array_type (vtable_entry_type, NULL_TREE);
layout_type (vtbl_type_node);
vtbl_type_node = build_qualified_type (vtbl_type_node, TYPE_QUAL_CONST);
- record_builtin_type (RID_MAX, NULL_PTR, vtbl_type_node);
+ record_builtin_type (RID_MAX, NULL, vtbl_type_node);
vtbl_ptr_type_node = build_pointer_type (vtable_entry_type);
layout_type (vtbl_ptr_type_node);
- record_builtin_type (RID_MAX, NULL_PTR, vtbl_ptr_type_node);
-
- if (flag_vtable_thunks)
- {
- /* We need vlists only when using thunks; otherwise leave them
- as NULL_TREE. That way, it doesn't get into the way of the
- mangling. */
- vlist_type_node = build_pointer_type (vtbl_ptr_type_node);
- vlist_zero_node = build_int_2 (0, 0);
- TREE_TYPE (vlist_zero_node) = vlist_type_node;
- }
-
- /* Simplify life by making a "sigtable_entry_type". Give its
- fields names so that the debugger can use them. */
-
- if (flag_handle_signatures)
- {
- sigtable_entry_type = make_lang_type (RECORD_TYPE);
- fields[0] = build_lang_field_decl (FIELD_DECL, tag_identifier,
- delta_type_node);
- fields[1] = build_lang_field_decl (FIELD_DECL, vb_off_identifier,
- delta_type_node);
- fields[2] = build_lang_field_decl (FIELD_DECL, delta_identifier,
- delta_type_node);
- fields[3] = build_lang_field_decl (FIELD_DECL, index_identifier,
- delta_type_node);
- fields[4] = build_lang_field_decl (FIELD_DECL, pfn_identifier,
- ptr_type_node);
-
- /* Set the alignment to the max of the alignment of ptr_type_node and
- delta_type_node. Double alignment wastes a word on the Sparc. */
- finish_builtin_type (sigtable_entry_type, SIGTABLE_PTR_TYPE, fields, 4,
- (TYPE_ALIGN (ptr_type_node) > TYPE_ALIGN (delta_type_node))
- ? ptr_type_node
- : delta_type_node);
-
- /* Make this part of an invisible union. */
- fields[5] = copy_node (fields[4]);
- TREE_TYPE (fields[5]) = delta_type_node;
- DECL_NAME (fields[5]) = vt_off_identifier;
- DECL_MODE (fields[5]) = TYPE_MODE (delta_type_node);
- DECL_SIZE (fields[5]) = TYPE_SIZE (delta_type_node);
- TREE_UNSIGNED (fields[5]) = 0;
- TREE_CHAIN (fields[4]) = fields[5];
-
- sigtable_entry_type = build_qualified_type (sigtable_entry_type,
- TYPE_QUAL_CONST);
- record_builtin_type (RID_MAX, SIGTABLE_PTR_TYPE, sigtable_entry_type);
- }
-
- std_node = build_decl (NAMESPACE_DECL,
- get_identifier (flag_honor_std ? "fake std":"std"),
- void_type_node);
- pushdecl (std_node);
+ record_builtin_type (RID_MAX, NULL, vtbl_ptr_type_node);
+
+ push_namespace (get_identifier ("__cxxabiv1"));
+ abi_node = current_namespace;
+ pop_namespace ();
global_type_node = make_node (LANG_TYPE);
record_unknown_type (global_type_node, "global type");
@@ -6923,111 +6565,335 @@ init_decl_processing ()
{
tree bad_alloc_type_node, newtype, deltype;
- if (flag_honor_std)
- push_namespace (get_identifier ("std"));
+ tree ptr_ftype_sizetype;
+
+ push_namespace (std_identifier);
bad_alloc_type_node = xref_tag
(class_type_node, get_identifier ("bad_alloc"), 1);
- if (flag_honor_std)
- pop_namespace ();
+ pop_namespace ();
+ ptr_ftype_sizetype
+ = build_function_type (ptr_type_node,
+ tree_cons (NULL_TREE,
+ c_size_type_node,
+ void_list_node));
newtype = build_exception_variant
- (ptr_ftype_sizetype, build_tree_list (NULL_TREE, bad_alloc_type_node));
- deltype = build_exception_variant
- (void_ftype_ptr, build_tree_list (NULL_TREE, NULL_TREE));
- auto_function (ansi_opname[(int) NEW_EXPR], newtype, NOT_BUILT_IN);
- auto_function (ansi_opname[(int) VEC_NEW_EXPR], newtype, NOT_BUILT_IN);
- global_delete_fndecl
- = auto_function (ansi_opname[(int) DELETE_EXPR], deltype, NOT_BUILT_IN);
- auto_function (ansi_opname[(int) VEC_DELETE_EXPR], deltype, NOT_BUILT_IN);
+ (ptr_ftype_sizetype, add_exception_specifier
+ (NULL_TREE, bad_alloc_type_node, -1));
+ deltype = build_exception_variant (void_ftype_ptr, empty_except_spec);
+ push_cp_library_fn (NEW_EXPR, newtype);
+ push_cp_library_fn (VEC_NEW_EXPR, newtype);
+ global_delete_fndecl = push_cp_library_fn (DELETE_EXPR, deltype);
+ push_cp_library_fn (VEC_DELETE_EXPR, deltype);
}
abort_fndecl
- = define_function ("__pure_virtual", void_ftype,
- NOT_BUILT_IN, 0, 0);
+ = build_library_fn_ptr ("__cxa_pure_virtual", void_ftype);
/* Perform other language dependent initializations. */
init_class_processing ();
init_init_processing ();
init_search_processing ();
- if (flag_rtti)
- init_rtti_processing ();
+ init_rtti_processing ();
if (flag_exceptions)
init_exception_processing ();
- if (flag_no_inline)
- {
- flag_inline_functions = 0;
- }
if (! supports_one_only ())
flag_weak = 0;
- /* Create the global bindings for __FUNCTION__ and __PRETTY_FUNCTION__. */
- declare_function_name ();
-
- /* Prepare to check format strings against argument lists. */
- init_function_format_info ();
+ make_fname_decl = cp_make_fname_decl;
+ start_fname_decls ();
/* Show we use EH for cleanups. */
using_eh_for_cleanups ();
- print_error_function = lang_print_error_function;
- lang_get_alias_set = &c_get_alias_set;
- valid_lang_attribute = cp_valid_lang_attribute;
-
/* Maintain consistency. Perhaps we should just complain if they
say -fwritable-strings? */
if (flag_writable_strings)
flag_const_strings = 0;
+
+ /* Add GC roots for all of our global variables. */
+ ggc_add_tree_root (c_global_trees, sizeof c_global_trees / sizeof(tree));
+ ggc_add_tree_root (cp_global_trees, sizeof cp_global_trees / sizeof(tree));
+ ggc_add_tree_root (&integer_three_node, 1);
+ ggc_add_tree_root (&integer_two_node, 1);
+ ggc_add_tree_root (&signed_size_zero_node, 1);
+ ggc_add_tree_root (&size_one_node, 1);
+ ggc_add_tree_root (&size_zero_node, 1);
+ ggc_add_root (&global_binding_level, 1, sizeof global_binding_level,
+ mark_binding_level);
+ ggc_add_root (&scope_chain, 1, sizeof scope_chain, &mark_saved_scope);
+ ggc_add_tree_root (&static_ctors, 1);
+ ggc_add_tree_root (&static_dtors, 1);
+ ggc_add_tree_root (&lastiddecl, 1);
+
+ ggc_add_tree_root (&last_function_parms, 1);
+ ggc_add_tree_root (&error_mark_list, 1);
+
+ ggc_add_tree_root (&global_namespace, 1);
+ ggc_add_tree_root (&global_type_node, 1);
+ ggc_add_tree_root (&anonymous_namespace_name, 1);
+
+ ggc_add_tree_root (&got_object, 1);
+ ggc_add_tree_root (&got_scope, 1);
+
+ ggc_add_tree_root (&current_lang_name, 1);
+ ggc_add_tree_root (&static_aggregates, 1);
+ ggc_add_tree_root (&free_bindings, 1);
}
-/* Function to print any language-specific context for an error message. */
+/* Generate an initializer for a function naming variable from
+ NAME. NAME may be NULL, in which case we generate a special
+ ERROR_MARK node which should be replaced later. */
-static void
-lang_print_error_function (file)
- char *file;
+tree
+cp_fname_init (name)
+ const char *name;
+{
+ tree domain = NULL_TREE;
+ tree type;
+ tree init = NULL_TREE;
+ size_t length = 0;
+
+ if (name)
+ {
+ length = strlen (name);
+ domain = build_index_type (size_int (length));
+ init = build_string (length + 1, name);
+ }
+
+ type = build_qualified_type (char_type_node, TYPE_QUAL_CONST);
+ type = build_cplus_array_type (type, domain);
+
+ if (init)
+ TREE_TYPE (init) = type;
+ else
+ /* We don't know the value until instantiation time. Make
+ something which will be digested now, but replaced later. */
+ init = build (ERROR_MARK, type);
+
+ return init;
+}
+
+/* Create the VAR_DECL for __FUNCTION__ etc. ID is the name to give the
+ decl, NAME is the initialization string and TYPE_DEP indicates whether
+ NAME depended on the type of the function. We make use of that to detect
+ __PRETTY_FUNCTION__ inside a template fn. This is being done
+ lazily at the point of first use, so we musn't push the decl now. */
+
+static tree
+cp_make_fname_decl (id, type_dep)
+ tree id;
+ int type_dep;
{
- default_print_error_function (file);
- maybe_print_template_context ();
+ const char *const name = (type_dep && processing_template_decl
+ ? NULL : fname_as_string (type_dep));
+ tree init = cp_fname_init (name);
+ tree decl = build_decl (VAR_DECL, id, TREE_TYPE (init));
+
+ /* As we don't push the decl here, we must set the context. */
+ DECL_CONTEXT (decl) = current_function_decl;
+ DECL_PRETTY_FUNCTION_P (decl) = type_dep;
+
+ TREE_STATIC (decl) = 1;
+ TREE_READONLY (decl) = 1;
+ DECL_ARTIFICIAL (decl) = 1;
+ DECL_INITIAL (decl) = init;
+
+ TREE_USED (decl) = 1;
+
+ cp_finish_decl (decl, init, NULL_TREE, LOOKUP_ONLYCONVERTING);
+
+ return decl;
}
-/* Make a definition for a builtin function named NAME and whose data type
+/* Entry point for the benefit of c_common_nodes_and_builtins.
+
+ Make a definition for a builtin function named NAME and whose data type
is TYPE. TYPE should be a function type with argument types.
- FUNCTION_CODE tells later passes how to compile calls to this function.
- See tree.h for its possible values.
- If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
+ CLASS and CODE tell later passes how to compile calls to this function.
+ See tree.h for possible values.
+
+ If LIBNAME is nonzero, use that for DECL_ASSEMBLER_NAME,
the name to be called if we can't opencode the function. */
tree
-define_function (name, type, function_code, pfn, library_name)
+builtin_function (name, type, code, class, libname)
const char *name;
tree type;
- enum built_in_function function_code;
- void (*pfn) PROTO((tree));
- const char *library_name;
+ int code;
+ enum built_in_class class;
+ const char *libname;
{
- tree decl = build_lang_decl (FUNCTION_DECL, get_identifier (name), type);
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
+ tree decl = build_library_fn_1 (get_identifier (name), ERROR_MARK, type);
+ DECL_BUILT_IN_CLASS (decl) = class;
+ DECL_FUNCTION_CODE (decl) = code;
my_friendly_assert (DECL_CONTEXT (decl) == NULL_TREE, 392);
- DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
+
+ /* All builtins that don't begin with an `_' should go in the `std'
+ namespace. */
+ if (name[0] != '_')
+ {
+ push_namespace (std_identifier);
+ DECL_CONTEXT (decl) = std_node;
+ }
+ pushdecl (decl);
+ if (name[0] != '_')
+ pop_namespace ();
/* Since `pushdecl' relies on DECL_ASSEMBLER_NAME instead of DECL_NAME,
we cannot change DECL_ASSEMBLER_NAME until we have installed this
function in the namespace. */
- if (pfn) (*pfn) (decl);
- if (library_name)
- DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name);
- make_function_rtl (decl);
- if (function_code != NOT_BUILT_IN)
- {
- DECL_BUILT_IN (decl) = 1;
- DECL_FUNCTION_CODE (decl) = function_code;
- }
+ if (libname)
+ SET_DECL_ASSEMBLER_NAME (decl, get_identifier (libname));
+ make_decl_rtl (decl, NULL);
+
+ /* Warn if a function in the namespace for users
+ is used without an occasion to consider it declared. */
+ if (name[0] != '_' || name[1] != '_')
+ DECL_ANTICIPATED (decl) = 1;
+
+ /* Possibly apply some default attributes to this built-in function. */
+ decl_attributes (&decl, NULL_TREE, 0);
+
return decl;
}
+
+/* Generate a FUNCTION_DECL with the typical flags for a runtime library
+ function. Not called directly. */
+
+static tree
+build_library_fn_1 (name, operator_code, type)
+ tree name;
+ enum tree_code operator_code;
+ tree type;
+{
+ tree fn = build_lang_decl (FUNCTION_DECL, name, type);
+ DECL_EXTERNAL (fn) = 1;
+ TREE_PUBLIC (fn) = 1;
+ DECL_ARTIFICIAL (fn) = 1;
+ TREE_NOTHROW (fn) = 1;
+ SET_OVERLOADED_OPERATOR_CODE (fn, operator_code);
+ SET_DECL_LANGUAGE (fn, lang_c);
+ return fn;
+}
+
+/* Returns the _DECL for a library function with C linkage.
+ We assume that such functions never throw; if this is incorrect,
+ callers should unset TREE_NOTHROW. */
+
+tree
+build_library_fn (name, type)
+ tree name;
+ tree type;
+{
+ return build_library_fn_1 (name, ERROR_MARK, type);
+}
+
+/* Returns the _DECL for a library function with C++ linkage. */
+
+static tree
+build_cp_library_fn (name, operator_code, type)
+ tree name;
+ enum tree_code operator_code;
+ tree type;
+{
+ tree fn = build_library_fn_1 (name, operator_code, type);
+ TREE_NOTHROW (fn) = TYPE_NOTHROW_P (type);
+ DECL_CONTEXT (fn) = FROB_CONTEXT (current_namespace);
+ SET_DECL_LANGUAGE (fn, lang_cplusplus);
+ set_mangled_name_for_decl (fn);
+ return fn;
+}
+
+/* Like build_library_fn, but takes a C string instead of an
+ IDENTIFIER_NODE. */
+
+tree
+build_library_fn_ptr (name, type)
+ const char *name;
+ tree type;
+{
+ return build_library_fn (get_identifier (name), type);
+}
+
+/* Like build_cp_library_fn, but takes a C string instead of an
+ IDENTIFIER_NODE. */
+
+tree
+build_cp_library_fn_ptr (name, type)
+ const char *name;
+ tree type;
+{
+ return build_cp_library_fn (get_identifier (name), ERROR_MARK, type);
+}
+
+/* Like build_library_fn, but also pushes the function so that we will
+ be able to find it via IDENTIFIER_GLOBAL_VALUE. */
+
+tree
+push_library_fn (name, type)
+ tree name, type;
+{
+ tree fn = build_library_fn (name, type);
+ pushdecl_top_level (fn);
+ return fn;
+}
+
+/* Like build_cp_library_fn, but also pushes the function so that it
+ will be found by normal lookup. */
+
+static tree
+push_cp_library_fn (operator_code, type)
+ enum tree_code operator_code;
+ tree type;
+{
+ tree fn = build_cp_library_fn (ansi_opname (operator_code),
+ operator_code,
+ type);
+ pushdecl (fn);
+ return fn;
+}
+
+/* Like push_library_fn, but takes a TREE_LIST of parm types rather than
+ a FUNCTION_TYPE. */
+
+tree
+push_void_library_fn (name, parmtypes)
+ tree name, parmtypes;
+{
+ tree type = build_function_type (void_type_node, parmtypes);
+ return push_library_fn (name, type);
+}
+
+/* Like push_library_fn, but also note that this function throws
+ and does not return. Used for __throw_foo and the like. */
+
+tree
+push_throw_library_fn (name, type)
+ tree name, type;
+{
+ tree fn = push_library_fn (name, type);
+ TREE_THIS_VOLATILE (fn) = 1;
+ TREE_NOTHROW (fn) = 0;
+ return fn;
+}
+
+/* Apply default attributes to a function, if a system function with default
+ attributes. */
+
+void
+insert_default_attributes (decl)
+ tree decl;
+{
+ if (!DECL_EXTERN_C_FUNCTION_P (decl))
+ return;
+ if (!TREE_PUBLIC (decl))
+ return;
+ c_common_insert_default_attributes (decl);
+}
/* When we call finish_struct for an anonymous union, we create
default copy constructors and such. But, an anonymous union
@@ -7040,7 +6906,7 @@ define_function (name, type, function_code, pfn, library_name)
union type.) */
void
-fixup_anonymous_union (t)
+fixup_anonymous_aggr (t)
tree t;
{
tree *q;
@@ -7064,10 +6930,36 @@ fixup_anonymous_union (t)
q = &TREE_CHAIN (*q);
}
- /* ANSI C++ June 5 1992 WP 9.5.3. Anonymous unions may not have
- function members. */
+ /* ISO C++ 9.5.3. Anonymous unions may not have function members. */
if (TYPE_METHODS (t))
- error ("an anonymous union cannot have function members");
+ cp_error_at ("an anonymous union cannot have function members", t);
+
+ /* Anonymous aggregates cannot have fields with ctors, dtors or complex
+ assignment operators (because they cannot have these methods themselves).
+ For anonymous unions this is already checked because they are not allowed
+ in any union, otherwise we have to check it. */
+ if (TREE_CODE (t) != UNION_TYPE)
+ {
+ tree field, type;
+
+ for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
+ if (TREE_CODE (field) == FIELD_DECL)
+ {
+ type = TREE_TYPE (field);
+ if (CLASS_TYPE_P (type))
+ {
+ if (TYPE_NEEDS_CONSTRUCTING (type))
+ cp_error_at ("member %#D' with constructor not allowed in anonymous aggregate",
+ field);
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
+ cp_error_at ("member %#D' with destructor not allowed in anonymous aggregate",
+ field);
+ if (TYPE_HAS_COMPLEX_ASSIGN_REF (type))
+ cp_error_at ("member %#D' with copy assignment operator not allowed in anonymous aggregate",
+ field);
+ }
+ }
+ }
}
/* Make sure that a declaration with no declarator is well-formed, i.e.
@@ -7080,6 +6972,8 @@ check_tag_decl (declspecs)
tree declspecs;
{
int found_type = 0;
+ int saw_friend = 0;
+ int saw_typedef = 0;
tree ob_modifier = NULL_TREE;
register tree link;
register tree t = NULL_TREE;
@@ -7088,21 +6982,38 @@ check_tag_decl (declspecs)
{
register tree value = TREE_VALUE (link);
- if (TYPE_P (value))
+ if (TYPE_P (value)
+ || TREE_CODE (value) == TYPE_DECL
+ || (TREE_CODE (value) == IDENTIFIER_NODE
+ && IDENTIFIER_GLOBAL_VALUE (value)
+ && TREE_CODE (IDENTIFIER_GLOBAL_VALUE (value)) == TYPE_DECL))
{
++found_type;
- if (IS_AGGR_TYPE (value) || TREE_CODE (value) == ENUMERAL_TYPE)
+ if (found_type == 2 && TREE_CODE (value) == IDENTIFIER_NODE)
+ {
+ if (! in_system_header)
+ pedwarn ("redeclaration of C++ built-in type `%T'", value);
+ return NULL_TREE;
+ }
+
+ if (TYPE_P (value)
+ && ((TREE_CODE (value) != TYPENAME_TYPE && IS_AGGR_TYPE (value))
+ || TREE_CODE (value) == ENUMERAL_TYPE))
{
my_friendly_assert (TYPE_MAIN_DECL (value) != NULL_TREE, 261);
t = value;
}
}
+ else if (value == ridpointers[(int) RID_TYPEDEF])
+ saw_typedef = 1;
else if (value == ridpointers[(int) RID_FRIEND])
{
if (current_class_type == NULL_TREE
|| current_scope () != current_class_type)
ob_modifier = value;
+ else
+ saw_friend = 1;
}
else if (value == ridpointers[(int) RID_STATIC]
|| value == ridpointers[(int) RID_EXTERN]
@@ -7119,34 +7030,53 @@ check_tag_decl (declspecs)
if (found_type > 1)
error ("multiple types in one declaration");
- /* Inside a class, we might be in a friend or access declaration.
- Until we have a good way of detecting the latter, don't warn. */
- if (t == NULL_TREE && ! current_class_type)
+ if (t == NULL_TREE && ! saw_friend)
pedwarn ("declaration does not declare anything");
- /* Check for an anonymous union. We're careful
- accessing TYPE_IDENTIFIER because some built-in types, like
- pointer-to-member types, do not have TYPE_NAME. */
- else if (t && TREE_CODE (t) == UNION_TYPE
- && TYPE_NAME (t)
- && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
- {
+ /* Check for an anonymous union. */
+ else if (t && IS_AGGR_TYPE_CODE (TREE_CODE (t))
+ && TYPE_ANONYMOUS_P (t))
+ {
+ /* 7/3 In a simple-declaration, the optional init-declarator-list
+ can be omitted only when declaring a class (clause 9) or
+ enumeration (7.2), that is, when the decl-specifier-seq contains
+ either a class-specifier, an elaborated-type-specifier with
+ a class-key (9.1), or an enum-specifier. In these cases and
+ whenever a class-specifier or enum-specifier is present in the
+ decl-specifier-seq, the identifiers in these specifiers are among
+ the names being declared by the declaration (as class-name,
+ enum-names, or enumerators, depending on the syntax). In such
+ cases, and except for the declaration of an unnamed bit-field (9.6),
+ the decl-specifier-seq shall introduce one or more names into the
+ program, or shall redeclare a name introduced by a previous
+ declaration. [Example:
+ enum { }; // ill-formed
+ typedef class { }; // ill-formed
+ --end example] */
+ if (saw_typedef)
+ {
+ error ("missing type-name in typedef-declaration");
+ return NULL_TREE;
+ }
/* Anonymous unions are objects, so they can have specifiers. */;
- SET_ANON_UNION_TYPE_P (t);
+ SET_ANON_AGGR_TYPE_P (t);
+
+ if (TREE_CODE (t) != UNION_TYPE && pedantic && ! in_system_header)
+ pedwarn ("ISO C++ prohibits anonymous structs");
}
else if (ob_modifier)
{
if (ob_modifier == ridpointers[(int) RID_INLINE]
|| ob_modifier == ridpointers[(int) RID_VIRTUAL])
- cp_error ("`%D' can only be specified for functions", ob_modifier);
+ error ("`%D' can only be specified for functions", ob_modifier);
else if (ob_modifier == ridpointers[(int) RID_FRIEND])
- cp_error ("`%D' can only be specified inside a class", ob_modifier);
+ error ("`%D' can only be specified inside a class", ob_modifier);
else if (ob_modifier == ridpointers[(int) RID_EXPLICIT])
- cp_error ("`%D' can only be specified for constructors",
+ error ("`%D' can only be specified for constructors",
ob_modifier);
else
- cp_error ("`%D' can only be specified for objects and functions",
+ error ("`%D' can only be specified for objects and functions",
ob_modifier);
}
@@ -7178,14 +7108,14 @@ shadow_tag (declspecs)
union { ... } ;
because there is no declarator after the union, the parser
sends that declaration here. */
- if (t && ANON_UNION_TYPE_P (t))
+ if (t && ANON_AGGR_TYPE_P (t))
{
- fixup_anonymous_union (t);
+ fixup_anonymous_aggr (t);
if (TYPE_FIELDS (t))
{
tree decl = grokdeclarator (NULL_TREE, declspecs, NORMAL, 0,
- NULL_TREE);
+ NULL);
finish_anon_union (decl);
}
}
@@ -7197,11 +7127,16 @@ tree
groktypename (typename)
tree typename;
{
+ tree specs, attrs;
+ tree type;
if (TREE_CODE (typename) != TREE_LIST)
return typename;
- return grokdeclarator (TREE_VALUE (typename),
- TREE_PURPOSE (typename),
- TYPENAME, 0, NULL_TREE);
+ split_specs_attrs (TREE_PURPOSE (typename), &specs, &attrs);
+ type = grokdeclarator (TREE_VALUE (typename), specs,
+ TYPENAME, 0, &attrs);
+ if (attrs)
+ cplus_decl_attributes (&type, attrs, 0);
+ return type;
}
/* Decode a declarator in an ordinary declaration or data definition.
@@ -7219,22 +7154,17 @@ groktypename (typename)
do go through here. Structure field declarations are done by
grokfield and not through here. */
-/* Set this to zero to debug not using the temporary obstack
- to parse initializers. */
-int debug_temp_inits = 1;
-
tree
start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
tree declarator, declspecs;
int initialized;
tree attributes, prefix_attributes;
{
- register tree decl;
+ tree decl;
register tree type, tem;
tree context;
extern int have_extern_spec;
extern int used_extern_spec;
- tree attrlist;
#if 0
/* See code below that used this. */
@@ -7244,19 +7174,23 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
/* This should only be done once on the top most decl. */
if (have_extern_spec && !used_extern_spec)
{
- declspecs = decl_tree_cons (NULL_TREE, get_identifier ("extern"),
- declspecs);
+ declspecs = tree_cons (NULL_TREE, get_identifier ("extern"),
+ declspecs);
used_extern_spec = 1;
}
- if (attributes || prefix_attributes)
- attrlist = build_scratch_list (attributes, prefix_attributes);
- else
- attrlist = NULL_TREE;
+ /* An object declared as __attribute__((deprecated)) suppresses
+ warnings of uses of other deprecated items. */
+ if (lookup_attribute ("deprecated", attributes))
+ deprecated_state = DEPRECATED_SUPPRESS;
+
+ attributes = chainon (attributes, prefix_attributes);
decl = grokdeclarator (declarator, declspecs, NORMAL, initialized,
- attrlist);
-
+ &attributes);
+
+ deprecated_state = DEPRECATED_NORMAL;
+
if (decl == NULL_TREE || TREE_CODE (decl) == VOID_TYPE)
return NULL_TREE;
@@ -7265,30 +7199,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
if (type == error_mark_node)
return NULL_TREE;
- /* Don't lose if destructors must be executed at file-level. */
- if (! processing_template_decl && TREE_STATIC (decl)
- && TYPE_NEEDS_DESTRUCTOR (complete_type (type))
- && !TREE_PERMANENT (decl))
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- decl = copy_node (decl);
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- tree itype = TYPE_DOMAIN (type);
- if (itype && ! TREE_PERMANENT (itype))
- {
- itype = build_index_type (copy_to_permanent (TYPE_MAX_VALUE (itype)));
- type = build_cplus_array_type (TREE_TYPE (type), itype);
- TREE_TYPE (decl) = type;
- }
- }
- pop_obstacks ();
- }
-
- context
- = (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl))
- ? DECL_CLASS_CONTEXT (decl)
- : DECL_CONTEXT (decl);
+ context = DECL_CONTEXT (decl);
if (initialized && context && TREE_CODE (context) == NAMESPACE_DECL
&& context != current_namespace && TREE_CODE (decl) == VAR_DECL)
@@ -7314,46 +7225,25 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
Any other case of an initialization in a TYPE_DECL is an error. */
if (pedantic || list_length (declspecs) > 1)
{
- cp_error ("typedef `%D' is initialized", decl);
+ error ("typedef `%D' is initialized", decl);
initialized = 0;
}
break;
case FUNCTION_DECL:
- cp_error ("function `%#D' is initialized like a variable", decl);
+ error ("function `%#D' is initialized like a variable", decl);
initialized = 0;
break;
default:
- if (! processing_template_decl)
- {
- if (type != error_mark_node)
- {
- if (TYPE_SIZE (type) != NULL_TREE
- && ! TREE_CONSTANT (TYPE_SIZE (type)))
- {
- cp_error
- ("variable-sized object `%D' may not be initialized",
- decl);
- initialized = 0;
- }
-
- if (TREE_CODE (type) == ARRAY_TYPE
- && TYPE_SIZE (complete_type (TREE_TYPE (type))) == NULL_TREE)
- {
- cp_error
- ("elements of array `%#D' have incomplete type", decl);
- initialized = 0;
- }
- }
- }
+ break;
}
if (initialized)
{
if (! toplevel_bindings_p ()
&& DECL_EXTERNAL (decl))
- cp_warning ("declaration of `%#D' has `extern' and is initialized",
+ warning ("declaration of `%#D' has `extern' and is initialized",
decl);
DECL_EXTERNAL (decl) = 0;
if (toplevel_bindings_p ())
@@ -7365,14 +7255,17 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
DECL_INITIAL (decl) = error_mark_node;
}
-#ifdef SET_DEFAULT_DECL_ATTRIBUTES
- SET_DEFAULT_DECL_ATTRIBUTES (decl, attributes);
-#endif
-
/* Set attributes here so if duplicate decl, will have proper attributes. */
- cplus_decl_attributes (decl, attributes, prefix_attributes);
+ cplus_decl_attributes (&decl, attributes, 0);
- if (context && TYPE_SIZE (complete_type (context)) != NULL_TREE)
+ if (TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_DECLARED_INLINE_P (decl)
+ && DECL_UNINLINABLE (decl)
+ && lookup_attribute ("noinline", DECL_ATTRIBUTES (decl)))
+ warning_with_decl (decl,
+ "inline function `%s' given attribute noinline");
+
+ if (context && COMPLETE_TYPE_P (complete_type (context)))
{
push_nested_class (context, 2);
@@ -7380,12 +7273,12 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
{
tree field = lookup_field (context, DECL_NAME (decl), 0, 0);
if (field == NULL_TREE || TREE_CODE (field) != VAR_DECL)
- cp_error ("`%#D' is not a static member of `%#T'", decl, context);
+ error ("`%#D' is not a static member of `%#T'", decl, context);
else
{
if (DECL_CONTEXT (field) != context)
{
- cp_pedwarn ("ANSI C++ does not permit `%T::%D' to be defined as `%T::%D'",
+ pedwarn ("ISO C++ does not permit `%T::%D' to be defined as `%T::%D'",
DECL_CONTEXT (field), DECL_NAME (decl),
context, DECL_NAME (decl));
DECL_CONTEXT (decl) = DECL_CONTEXT (field);
@@ -7396,7 +7289,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
initialization. Thus, duplicate_decls won't warn
about this situation, and so we check here. */
if (DECL_INITIAL (decl) && DECL_INITIAL (field))
- cp_error ("duplicate initialization of %D", decl);
+ error ("duplicate initialization of %D", decl);
if (duplicate_decls (decl, field))
decl = field;
}
@@ -7410,8 +7303,8 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
/* cp_finish_decl sets DECL_EXTERNAL if DECL_IN_AGGR_P is set. */
DECL_IN_AGGR_P (decl) = 0;
- if ((DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
- || CLASSTYPE_USE_TEMPLATE (context))
+ if ((DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
+ || CLASSTYPE_TEMPLATE_INSTANTIATION (context))
{
SET_DECL_TEMPLATE_SPECIALIZATION (decl);
/* [temp.expl.spec] An explicit specialization of a static data
@@ -7425,40 +7318,15 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
}
if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl))
- cp_pedwarn ("declaration of `%#D' outside of class is not definition",
+ pedwarn ("declaration of `%#D' outside of class is not definition",
decl);
}
- /* Add this decl to the current binding level, but not if it
- comes from another scope, e.g. a static member variable.
- TEM may equal DECL or it may be a previous decl of the same name. */
-
- if ((TREE_CODE (decl) != PARM_DECL && DECL_CONTEXT (decl) != NULL_TREE
- /* Definitions of namespace members outside their namespace are
- possible. */
- && TREE_CODE (DECL_CONTEXT (decl)) != NAMESPACE_DECL)
- || (TREE_CODE (decl) == TEMPLATE_DECL && !namespace_bindings_p ())
- || TREE_CODE (type) == LANG_TYPE
- /* The declaration of template specializations does not affect
- the functions available for overload resolution, so we do not
- call pushdecl. */
- || (TREE_CODE (decl) == FUNCTION_DECL
- && DECL_TEMPLATE_SPECIALIZATION (decl)))
- tem = decl;
- else
- tem = pushdecl (decl);
+ /* Enter this declaration into the symbol table. */
+ tem = maybe_push_decl (decl);
if (processing_template_decl)
- {
- if (! current_function_decl)
- tem = push_template_decl (tem);
- else if (minimal_parse_mode)
- DECL_VINDEX (tem)
- = build_min_nt (DECL_STMT, copy_to_permanent (declarator),
- copy_to_permanent (declspecs),
- NULL_TREE);
- }
-
+ tem = push_template_decl (tem);
#if ! defined (ASM_OUTPUT_BSS) && ! defined (ASM_OUTPUT_ALIGNED_BSS)
/* Tell the back-end to use or not use .common as appropriate. If we say
@@ -7468,39 +7336,10 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
data segment. */
DECL_COMMON (tem) = flag_conserve_space || ! TREE_PUBLIC (tem);
#endif
-
+
if (! processing_template_decl)
start_decl_1 (tem);
- /* Corresponding pop_obstacks is done in `cp_finish_decl'. */
- push_obstacks_nochange ();
-
-#if 0
- /* We have no way of knowing whether the initializer will need to be
- evaluated at run-time or not until we've parsed it, so let's just put
- it in the permanent obstack. (jason) */
- if (init_written
- && ! (TREE_CODE (tem) == PARM_DECL
- || (TREE_READONLY (tem)
- && (TREE_CODE (tem) == VAR_DECL
- || TREE_CODE (tem) == FIELD_DECL))))
- {
- /* When parsing and digesting the initializer,
- use temporary storage. Do this even if we will ignore the value. */
- if (toplevel_bindings_p () && debug_temp_inits)
- {
- if (processing_template_decl
- || TYPE_NEEDS_CONSTRUCTING (type)
- || TREE_CODE (type) == REFERENCE_TYPE)
- /* In this case, the initializer must lay down in permanent
- storage, since it will be saved until `finish_file' is run. */
- ;
- else
- temporary_allocation ();
- }
- }
-#endif
-
return tem;
}
@@ -7514,12 +7353,7 @@ start_decl_1 (decl)
if (type == error_mark_node)
return;
- /* If this type of object needs a cleanup, and control may
- jump past it, make a new binding level so that it is cleaned
- up only when it is initialized first. */
- if (TYPE_NEEDS_DESTRUCTOR (type)
- && current_binding_level->more_cleanups_ok == 0)
- pushlevel_temporary (1);
+ maybe_push_cleanup_level (type);
if (initialized)
/* Is it valid for this decl to have an initializer at all?
@@ -7528,19 +7362,19 @@ start_decl_1 (decl)
{
/* Don't allow initializations for incomplete types except for
arrays which might be completed by the initialization. */
- if (TYPE_SIZE (complete_type (type)) != NULL_TREE)
+ if (COMPLETE_TYPE_P (complete_type (type)))
; /* A complete type is ok. */
else if (TREE_CODE (type) != ARRAY_TYPE)
{
- cp_error ("variable `%#D' has initializer but incomplete type",
+ error ("variable `%#D' has initializer but incomplete type",
decl);
initialized = 0;
type = TREE_TYPE (decl) = error_mark_node;
}
- else if (TYPE_SIZE (complete_type (TREE_TYPE (type))) == NULL_TREE)
+ else if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (type))))
{
if (DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl))
- cp_error ("elements of array `%#D' have incomplete type", decl);
+ error ("elements of array `%#D' have incomplete type", decl);
/* else we already gave an error in start_decl. */
initialized = 0;
}
@@ -7549,12 +7383,14 @@ start_decl_1 (decl)
if (!initialized
&& TREE_CODE (decl) != TYPE_DECL
&& TREE_CODE (decl) != TEMPLATE_DECL
- && IS_AGGR_TYPE (type) && ! DECL_EXTERNAL (decl))
+ && type != error_mark_node
+ && IS_AGGR_TYPE (type)
+ && ! DECL_EXTERNAL (decl))
{
if ((! processing_template_decl || ! uses_template_parms (type))
- && TYPE_SIZE (complete_type (type)) == NULL_TREE)
+ && !COMPLETE_TYPE_P (complete_type (type)))
{
- cp_error ("aggregate `%#D' has incomplete type and cannot be initialized",
+ error ("aggregate `%#D' has incomplete type and cannot be initialized",
decl);
/* Change the type so that assemble_variable will give
DECL an rtl we can live with: (mem (const_int 0)). */
@@ -7572,23 +7408,6 @@ start_decl_1 (decl)
}
}
-#if 0
- /* We don't do this yet for GNU C++. */
- /* For a local variable, define the RTL now. */
- if (! toplevel_bindings_p ()
- /* But not if this is a duplicate decl
- and we preserved the rtl from the previous one
- (which may or may not happen). */
- && DECL_RTL (tem) == NULL_RTX)
- {
- if (TYPE_SIZE (TREE_TYPE (tem)) != NULL_TREE)
- expand_decl (tem);
- else if (TREE_CODE (TREE_TYPE (tem)) == ARRAY_TYPE
- && DECL_INITIAL (tem) != NULL_TREE)
- expand_decl (tem);
- }
-#endif
-
if (! initialized)
DECL_INITIAL (decl) = NULL_TREE;
}
@@ -7599,7 +7418,7 @@ start_decl_1 (decl)
Quotes on semantics can be found in ARM 8.4.3. */
-static void
+static tree
grok_reference_init (decl, type, init)
tree decl, type, init;
{
@@ -7610,22 +7429,17 @@ grok_reference_init (decl, type, init)
if ((DECL_LANG_SPECIFIC (decl) == 0
|| DECL_IN_AGGR_P (decl) == 0)
&& ! DECL_THIS_EXTERN (decl))
- {
- cp_error ("`%D' declared as reference but not initialized", decl);
- if (TREE_CODE (decl) == VAR_DECL)
- SET_DECL_REFERENCE_SLOT (decl, error_mark_node);
- }
- return;
+ error ("`%D' declared as reference but not initialized", decl);
+ return NULL_TREE;
}
if (init == error_mark_node)
- return;
+ return NULL_TREE;
- if (TREE_CODE (type) == REFERENCE_TYPE
- && TREE_CODE (init) == CONSTRUCTOR)
+ if (TREE_CODE (init) == CONSTRUCTOR)
{
- cp_error ("ANSI C++ forbids use of initializer list to initialize reference `%D'", decl);
- return;
+ error ("ISO C++ forbids use of initializer list to initialize reference `%D'", decl);
+ return NULL_TREE;
}
if (TREE_CODE (init) == TREE_LIST)
@@ -7641,44 +7455,32 @@ grok_reference_init (decl, type, init)
init = default_conversion (init);
}
+ /* Convert INIT to the reference type TYPE. This may involve the
+ creation of a temporary, whose lifetime must be the same as that
+ of the reference. If so, a DECL_STMT for the temporary will be
+ added just after the DECL_STMT for DECL. That's why we don't set
+ DECL_INITIAL for local references (instead assigning to them
+ explicitly); we need to allow the temporary to be initialized
+ first. */
tmp = convert_to_reference
(type, init, CONV_IMPLICIT,
- LOOKUP_SPECULATIVELY|LOOKUP_NORMAL|DIRECT_BIND, decl);
+ LOOKUP_ONLYCONVERTING|LOOKUP_SPECULATIVELY|LOOKUP_NORMAL|DIRECT_BIND,
+ decl);
if (tmp == error_mark_node)
- goto fail;
- else if (tmp != NULL_TREE)
- {
- init = tmp;
- DECL_INITIAL (decl) = save_expr (init);
- }
- else
+ return NULL_TREE;
+ else if (tmp == NULL_TREE)
{
- cp_error ("cannot initialize `%T' from `%T'", type, TREE_TYPE (init));
- goto fail;
+ error ("cannot initialize `%T' from `%T'", type, TREE_TYPE (init));
+ return NULL_TREE;
}
- /* ?? Can this be optimized in some cases to
- hand back the DECL_INITIAL slot?? */
- if (TYPE_SIZE (TREE_TYPE (type)))
- {
- init = convert_from_reference (decl);
- if (TREE_PERMANENT (decl))
- init = copy_to_permanent (init);
- SET_DECL_REFERENCE_SLOT (decl, init);
- }
+ if (TREE_STATIC (decl) && !TREE_CONSTANT (tmp))
+ return tmp;
- if (TREE_STATIC (decl) && ! TREE_CONSTANT (DECL_INITIAL (decl)))
- {
- expand_static_init (decl, DECL_INITIAL (decl));
- DECL_INITIAL (decl) = NULL_TREE;
- }
- return;
+ DECL_INITIAL (decl) = tmp;
- fail:
- if (TREE_CODE (decl) == VAR_DECL)
- SET_DECL_REFERENCE_SLOT (decl, error_mark_node);
- return;
+ return NULL_TREE;
}
/* Fill in DECL_INITIAL with some magical value to prevent expand_decl from
@@ -7708,6 +7510,164 @@ obscure_complex_init (decl, init)
return init;
}
+/* When parsing `int a[] = {1, 2};' we don't know the size of the
+ array until we finish parsing the initializer. If that's the
+ situation we're in, update DECL accordingly. */
+
+static void
+maybe_deduce_size_from_array_init (decl, init)
+ tree decl;
+ tree init;
+{
+ tree type = TREE_TYPE (decl);
+
+ if (TREE_CODE (type) == ARRAY_TYPE
+ && TYPE_DOMAIN (type) == NULL_TREE
+ && TREE_CODE (decl) != TYPE_DECL)
+ {
+ /* do_default is really a C-ism to deal with tentative definitions.
+ But let's leave it here to ease the eventual merge. */
+ int do_default = !DECL_EXTERNAL (decl);
+ tree initializer = init ? init : DECL_INITIAL (decl);
+ int failure = complete_array_type (type, initializer, do_default);
+
+ if (failure == 1)
+ error ("initializer fails to determine size of `%D'", decl);
+
+ if (failure == 2)
+ {
+ if (do_default)
+ error ("array size missing in `%D'", decl);
+ /* If a `static' var's size isn't known, make it extern as
+ well as static, so it does not get allocated. If it's not
+ `static', then don't mark it extern; finish_incomplete_decl
+ will give it a default size and it will get allocated. */
+ else if (!pedantic && TREE_STATIC (decl) && !TREE_PUBLIC (decl))
+ DECL_EXTERNAL (decl) = 1;
+ }
+
+ if (pedantic && TYPE_DOMAIN (type) != NULL_TREE
+ && tree_int_cst_lt (TYPE_MAX_VALUE (TYPE_DOMAIN (type)),
+ integer_zero_node))
+ error ("zero-size array `%D'", decl);
+
+ layout_decl (decl, 0);
+ }
+}
+
+/* Set DECL_SIZE, DECL_ALIGN, etc. for DECL (a VAR_DECL), and issue
+ any appropriate error messages regarding the layout. */
+
+static void
+layout_var_decl (decl)
+ tree decl;
+{
+ tree type = TREE_TYPE (decl);
+#if 0
+ tree ttype = target_type (type);
+#endif
+
+ /* If we haven't already layed out this declaration, do so now.
+ Note that we must not call complete type for an external object
+ because it's type might involve templates that we are not
+ supposed to isntantiate yet. (And it's perfectly legal to say
+ `extern X x' for some incomplete type `X'.) */
+ if (!DECL_EXTERNAL (decl))
+ complete_type (type);
+ if (!DECL_SIZE (decl) && COMPLETE_TYPE_P (type))
+ layout_decl (decl, 0);
+
+ if (!DECL_EXTERNAL (decl) && DECL_SIZE (decl) == NULL_TREE)
+ {
+ /* An automatic variable with an incomplete type: that is an error.
+ Don't talk about array types here, since we took care of that
+ message in grokdeclarator. */
+ error ("storage size of `%D' isn't known", decl);
+ TREE_TYPE (decl) = error_mark_node;
+ }
+#if 0
+ /* Keep this code around in case we later want to control debug info
+ based on whether a type is "used". (jason 1999-11-11) */
+
+ else if (!DECL_EXTERNAL (decl) && IS_AGGR_TYPE (ttype))
+ /* Let debugger know it should output info for this type. */
+ note_debug_info_needed (ttype);
+
+ if (TREE_STATIC (decl) && DECL_CLASS_SCOPE_P (decl))
+ note_debug_info_needed (DECL_CONTEXT (decl));
+#endif
+
+ if ((DECL_EXTERNAL (decl) || TREE_STATIC (decl))
+ && DECL_SIZE (decl) != NULL_TREE
+ && ! TREE_CONSTANT (DECL_SIZE (decl)))
+ {
+ if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST)
+ constant_expression_warning (DECL_SIZE (decl));
+ else
+ error ("storage size of `%D' isn't constant", decl);
+ }
+
+ if (TREE_STATIC (decl)
+ && !DECL_ARTIFICIAL (decl)
+ && current_function_decl
+ && DECL_CONTEXT (decl) == current_function_decl)
+ push_local_name (decl);
+}
+
+/* If a local static variable is declared in an inline function, or if
+ we have a weak definition, we must endeavor to create only one
+ instance of the variable at link-time. */
+
+static void
+maybe_commonize_var (decl)
+ tree decl;
+{
+ /* Static data in a function with comdat linkage also has comdat
+ linkage. */
+ if (TREE_STATIC (decl)
+ /* Don't mess with __FUNCTION__. */
+ && ! DECL_ARTIFICIAL (decl)
+ && current_function_decl
+ && DECL_CONTEXT (decl) == current_function_decl
+ && (DECL_DECLARED_INLINE_P (current_function_decl)
+ || DECL_TEMPLATE_INSTANTIATION (current_function_decl))
+ && TREE_PUBLIC (current_function_decl))
+ {
+ /* If flag_weak, we don't need to mess with this, as we can just
+ make the function weak, and let it refer to its unique local
+ copy. This works because we don't allow the function to be
+ inlined. */
+ if (! flag_weak)
+ {
+ if (DECL_INTERFACE_KNOWN (current_function_decl))
+ {
+ TREE_PUBLIC (decl) = 1;
+ DECL_EXTERNAL (decl) = DECL_EXTERNAL (current_function_decl);
+ }
+ else if (DECL_INITIAL (decl) == NULL_TREE
+ || DECL_INITIAL (decl) == error_mark_node)
+ {
+ TREE_PUBLIC (decl) = 1;
+ DECL_COMMON (decl) = 1;
+ }
+ /* else we lose. We can only do this if we can use common,
+ which we can't if it has been initialized. */
+
+ if (!TREE_PUBLIC (decl))
+ {
+ cp_warning_at ("sorry: semantics of inline function static data `%#D' are wrong (you'll wind up with multiple copies)", decl);
+ cp_warning_at (" you can work around this by removing the initializer", decl);
+ }
+ }
+ else
+ comdat_linkage (decl);
+ }
+ else if (DECL_LANG_SPECIFIC (decl) && DECL_COMDAT (decl))
+ /* Set it up again; we might have set DECL_INITIAL since the last
+ time. */
+ comdat_linkage (decl);
+}
+
/* Issue an error message if DECL is an uninitialized const variable. */
static void
@@ -7724,7 +7684,354 @@ check_for_uninitialized_const_var (decl)
&& CP_TYPE_CONST_P (type)
&& !TYPE_NEEDS_CONSTRUCTING (type)
&& !DECL_INITIAL (decl))
- cp_error ("uninitialized const `%D'", decl);
+ error ("uninitialized const `%D'", decl);
+}
+
+/* Verify INIT (the initializer for DECL), and record the
+ initialization in DECL_INITIAL, if appropriate. Returns a new
+ value for INIT. */
+
+static tree
+check_initializer (decl, init)
+ tree decl;
+ tree init;
+{
+ tree type;
+
+ if (TREE_CODE (decl) == FIELD_DECL)
+ return init;
+
+ type = TREE_TYPE (decl);
+
+ /* If `start_decl' didn't like having an initialization, ignore it now. */
+ if (init != NULL_TREE && DECL_INITIAL (decl) == NULL_TREE)
+ init = NULL_TREE;
+
+ /* Check the initializer. */
+ if (init)
+ {
+ /* Things that are going to be initialized need to have complete
+ type. */
+ TREE_TYPE (decl) = type = complete_type (TREE_TYPE (decl));
+
+ if (type == error_mark_node)
+ /* We will have already complained. */
+ init = NULL_TREE;
+ else if (COMPLETE_TYPE_P (type) && !TREE_CONSTANT (TYPE_SIZE (type)))
+ {
+ error ("variable-sized object `%D' may not be initialized", decl);
+ init = NULL_TREE;
+ }
+ else if (TREE_CODE (type) == ARRAY_TYPE
+ && !COMPLETE_TYPE_P (complete_type (TREE_TYPE (type))))
+ {
+ error ("elements of array `%#D' have incomplete type", decl);
+ init = NULL_TREE;
+ }
+ else if (TREE_CODE (type) != ARRAY_TYPE && !COMPLETE_TYPE_P (type))
+ {
+ error ("`%D' has incomplete type", decl);
+ TREE_TYPE (decl) = error_mark_node;
+ init = NULL_TREE;
+ }
+ }
+
+ if (TREE_CODE (decl) == CONST_DECL)
+ {
+ my_friendly_assert (TREE_CODE (decl) != REFERENCE_TYPE, 148);
+
+ DECL_INITIAL (decl) = init;
+
+ my_friendly_assert (init != NULL_TREE, 149);
+ init = NULL_TREE;
+ }
+ else if (!DECL_EXTERNAL (decl) && TREE_CODE (type) == REFERENCE_TYPE)
+ {
+ init = grok_reference_init (decl, type, init);
+ if (init)
+ init = obscure_complex_init (decl, init);
+ }
+ else if (init)
+ {
+ if (TYPE_HAS_CONSTRUCTOR (type) || TYPE_NEEDS_CONSTRUCTING (type))
+ {
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ init = digest_init (type, init, (tree *) 0);
+ else if (TREE_CODE (init) == CONSTRUCTOR
+ && TREE_HAS_CONSTRUCTOR (init))
+ {
+ if (TYPE_NON_AGGREGATE_CLASS (type))
+ {
+ error ("`%D' must be initialized by constructor, not by `{...}'",
+ decl);
+ init = error_mark_node;
+ }
+ else
+ goto dont_use_constructor;
+ }
+ }
+ else
+ {
+ dont_use_constructor:
+ if (TREE_CODE (init) != TREE_VEC)
+ init = store_init_value (decl, init);
+ }
+
+ if (init)
+ /* We must hide the initializer so that expand_decl
+ won't try to do something it does not understand. */
+ init = obscure_complex_init (decl, init);
+ }
+ else if (DECL_EXTERNAL (decl))
+ ;
+ else if (TYPE_P (type)
+ && (IS_AGGR_TYPE (type) || TYPE_NEEDS_CONSTRUCTING (type)))
+ {
+ tree core_type = strip_array_types (type);
+
+ if (! TYPE_NEEDS_CONSTRUCTING (core_type))
+ {
+ if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (core_type))
+ error ("structure `%D' with uninitialized const members", decl);
+ if (CLASSTYPE_REF_FIELDS_NEED_INIT (core_type))
+ error ("structure `%D' with uninitialized reference members",
+ decl);
+ }
+
+ check_for_uninitialized_const_var (decl);
+
+ if (COMPLETE_TYPE_P (type) && TYPE_NEEDS_CONSTRUCTING (type))
+ init = obscure_complex_init (decl, NULL_TREE);
+
+ }
+ else
+ check_for_uninitialized_const_var (decl);
+
+ return init;
+}
+
+/* If DECL is not a local variable, give it RTL. */
+
+static void
+make_rtl_for_nonlocal_decl (decl, init, asmspec)
+ tree decl;
+ tree init;
+ const char *asmspec;
+{
+ int toplev = toplevel_bindings_p ();
+ int defer_p;
+
+ /* Handle non-variables up front. */
+ if (TREE_CODE (decl) != VAR_DECL)
+ {
+ rest_of_decl_compilation (decl, asmspec, toplev, at_eof);
+ return;
+ }
+
+ /* If we see a class member here, it should be a static data
+ member. */
+ if (DECL_LANG_SPECIFIC (decl) && DECL_IN_AGGR_P (decl))
+ {
+ my_friendly_assert (TREE_STATIC (decl), 19990828);
+ /* An in-class declaration of a static data member should be
+ external; it is only a declaration, and not a definition. */
+ if (init == NULL_TREE)
+ my_friendly_assert (DECL_EXTERNAL (decl), 20000723);
+ }
+
+ /* Set the DECL_ASSEMBLER_NAME for the variable. */
+ if (asmspec)
+ {
+ SET_DECL_ASSEMBLER_NAME (decl, get_identifier (asmspec));
+ /* The `register' keyword, when used together with an
+ asm-specification, indicates that the variable should be
+ placed in a particular register. */
+ if (DECL_REGISTER (decl))
+ DECL_C_HARD_REGISTER (decl) = 1;
+ }
+
+ /* We don't create any RTL for local variables. */
+ if (DECL_FUNCTION_SCOPE_P (decl) && !TREE_STATIC (decl))
+ return;
+
+ /* We defer emission of local statics until the corresponding
+ DECL_STMT is expanded. */
+ defer_p = DECL_FUNCTION_SCOPE_P (decl) || DECL_VIRTUAL_P (decl);
+
+ /* We try to defer namespace-scope static constants so that they are
+ not emitted into the object file unnecessarily. */
+ if (!DECL_VIRTUAL_P (decl)
+ && TREE_READONLY (decl)
+ && DECL_INITIAL (decl) != NULL_TREE
+ && DECL_INITIAL (decl) != error_mark_node
+ && ! EMPTY_CONSTRUCTOR_P (DECL_INITIAL (decl))
+ && toplev
+ && !TREE_PUBLIC (decl))
+ {
+ /* Fool with the linkage according to #pragma interface. */
+ if (!interface_unknown)
+ {
+ TREE_PUBLIC (decl) = 1;
+ DECL_EXTERNAL (decl) = interface_only;
+ }
+
+ defer_p = 1;
+ }
+
+ /* If we're deferring the variable, we only need to make RTL if
+ there's an ASMSPEC. Otherwise, we'll lazily create it later when
+ we need it. (There's no way to lazily create RTL for things that
+ have assembly specs because the information about the specifier
+ isn't stored in the tree, yet) */
+ if (defer_p && asmspec)
+ make_decl_rtl (decl, asmspec);
+ /* If we're not deferring, go ahead and assemble the variable. */
+ else if (!defer_p)
+ rest_of_decl_compilation (decl, asmspec, toplev, at_eof);
+}
+
+/* The old ARM scoping rules injected variables declared in the
+ initialization statement of a for-statement into the surrounding
+ scope. We support this usage, in order to be backward-compatible.
+ DECL is a just-declared VAR_DECL; if necessary inject its
+ declaration into the surrounding scope. */
+
+void
+maybe_inject_for_scope_var (decl)
+ tree decl;
+{
+ if (!DECL_NAME (decl))
+ return;
+
+ if (current_binding_level->is_for_scope)
+ {
+ struct binding_level *outer
+ = current_binding_level->level_chain;
+
+ /* Check to see if the same name is already bound at the outer
+ level, either because it was directly declared, or because a
+ dead for-decl got preserved. In either case, the code would
+ not have been valid under the ARM scope rules, so clear
+ is_for_scope for the current_binding_level.
+
+ Otherwise, we need to preserve the temp slot for decl to last
+ into the outer binding level. */
+
+ tree outer_binding
+ = TREE_CHAIN (IDENTIFIER_BINDING (DECL_NAME (decl)));
+
+ if (outer_binding && BINDING_LEVEL (outer_binding) == outer
+ && (TREE_CODE (BINDING_VALUE (outer_binding))
+ == VAR_DECL)
+ && DECL_DEAD_FOR_LOCAL (BINDING_VALUE (outer_binding)))
+ {
+ BINDING_VALUE (outer_binding)
+ = DECL_SHADOWED_FOR_VAR (BINDING_VALUE (outer_binding));
+ current_binding_level->is_for_scope = 0;
+ }
+ else if (DECL_IN_MEMORY_P (decl))
+ preserve_temp_slots (DECL_RTL (decl));
+ }
+}
+
+/* Generate code to initialize DECL (a local variable). */
+
+void
+initialize_local_var (decl, init, flags)
+ tree decl;
+ tree init;
+ int flags;
+{
+ tree type = TREE_TYPE (decl);
+
+ /* If the type is bogus, don't bother initializing the variable. */
+ if (type == error_mark_node)
+ return;
+
+ if (DECL_SIZE (decl) == NULL_TREE && !TREE_STATIC (decl))
+ {
+ /* If we used it already as memory, it must stay in memory. */
+ DECL_INITIAL (decl) = NULL_TREE;
+ TREE_ADDRESSABLE (decl) = TREE_USED (decl);
+ }
+
+ /* Local statics are handled differently from ordinary automatic
+ variables. */
+ if (TREE_STATIC (decl))
+ {
+ if (TYPE_NEEDS_CONSTRUCTING (type) || init != NULL_TREE
+ || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
+ expand_static_init (decl, init);
+ return;
+ }
+
+ if (DECL_SIZE (decl) && type != error_mark_node)
+ {
+ int already_used;
+
+ /* Compute and store the initial value. */
+ already_used = TREE_USED (decl) || TREE_USED (type);
+
+ if (init || TYPE_NEEDS_CONSTRUCTING (type))
+ {
+ int saved_stmts_are_full_exprs_p;
+
+ my_friendly_assert (building_stmt_tree (), 20000906);
+ saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p ();
+ current_stmt_tree ()->stmts_are_full_exprs_p = 1;
+ finish_expr_stmt (build_aggr_init (decl, init, flags));
+ current_stmt_tree ()->stmts_are_full_exprs_p =
+ saved_stmts_are_full_exprs_p;
+ }
+
+ /* Set this to 0 so we can tell whether an aggregate which was
+ initialized was ever used. Don't do this if it has a
+ destructor, so we don't complain about the 'resource
+ allocation is initialization' idiom. Now set
+ attribute((unused)) on types so decls of that type will be
+ marked used. (see TREE_USED, above.) */
+ if (TYPE_NEEDS_CONSTRUCTING (type)
+ && ! already_used
+ && TYPE_HAS_TRIVIAL_DESTRUCTOR (type)
+ && DECL_NAME (decl))
+ TREE_USED (decl) = 0;
+ else if (already_used)
+ TREE_USED (decl) = 1;
+ }
+}
+
+/* Generate code to destroy DECL (a local variable). */
+
+static void
+destroy_local_var (decl)
+ tree decl;
+{
+ tree type = TREE_TYPE (decl);
+ tree cleanup;
+
+ /* Only variables get cleaned up. */
+ if (TREE_CODE (decl) != VAR_DECL)
+ return;
+
+ /* And only things with destructors need cleaning up. */
+ if (type == error_mark_node
+ || TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
+ return;
+
+ if (TREE_CODE (decl) == VAR_DECL &&
+ (DECL_EXTERNAL (decl) || TREE_STATIC (decl)))
+ /* We don't clean up things that aren't defined in this
+ translation unit, or that need a static cleanup. The latter
+ are handled by finish_file. */
+ return;
+
+ /* Compute the cleanup. */
+ cleanup = maybe_build_cleanup (decl);
+
+ /* Record the cleanup required for this declaration. */
+ if (DECL_SIZE (decl) && TREE_TYPE (decl) != error_mark_node
+ && cleanup)
+ finish_decl_cleanup (decl, cleanup);
}
/* Finish processing of a declaration;
@@ -7732,40 +8039,23 @@ check_for_uninitialized_const_var (decl)
If the length of an array type is not known before,
it must be determined now, from the initial value, or it is an error.
- Call `pop_obstacks' iff NEED_POP is nonzero.
-
- For C++, `cp_finish_decl' must be fairly evasive: it must keep initializers
- for aggregates that have constructors alive on the permanent obstack,
- so that the global initializing functions can be written at the end.
-
- INIT0 holds the value of an initializer that should be allowed to escape
+ INIT holds the value of an initializer that should be allowed to escape
the normal rules.
- FLAGS is LOOKUP_ONLYCONVERTING is the = init syntax was used, else 0
- if the (init) syntax was used.
-
- For functions that take default parameters, DECL points to its
- "maximal" instantiation. `cp_finish_decl' must then also declared its
- subsequently lower and lower forms of instantiation, checking for
- ambiguity as it goes. This can be sped up later. */
+ FLAGS is LOOKUP_ONLYCONVERTING if the = init syntax was used, else 0
+ if the (init) syntax was used. */
void
-cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
+cp_finish_decl (decl, init, asmspec_tree, flags)
tree decl, init;
tree asmspec_tree;
- int need_pop;
int flags;
{
register tree type;
- tree cleanup = NULL_TREE, ttype = NULL_TREE;
- int was_incomplete;
- int temporary = allocation_temporary_p ();
- char *asmspec = NULL;
+ tree ttype = NULL_TREE;
+ const char *asmspec = NULL;
int was_readonly = 0;
- int already_used = 0;
- tree core_type;
- /* If this is 0, then we did not change obstacks. */
if (! decl)
{
if (init)
@@ -7779,18 +8069,18 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
if (init && TREE_CODE (init) == NAMESPACE_DECL)
{
- cp_error ("Cannot initialize `%D' to namespace `%D'",
+ error ("cannot initialize `%D' to namespace `%D'",
decl, init);
init = NULL_TREE;
}
if (current_class_type
- && DECL_REAL_CONTEXT (decl) == current_class_type
+ && CP_DECL_CONTEXT (decl) == current_class_type
&& TYPE_BEING_DEFINED (current_class_type)
&& (DECL_INITIAL (decl) || init))
- DECL_DEFINED_IN_CLASS_P (decl) = 1;
+ DECL_INITIALIZED_IN_CLASS_P (decl) = 1;
- if (TREE_CODE (decl) == VAR_DECL
+ if (TREE_CODE (decl) == VAR_DECL
&& DECL_CONTEXT (decl)
&& TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL
&& DECL_CONTEXT (decl) != current_namespace
@@ -7800,46 +8090,29 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
pop_decl_namespace ();
}
- /* If the type of the thing we are declaring either has
- a constructor, or has a virtual function table pointer,
- AND its initialization was accepted by `start_decl',
- then we stayed on the permanent obstack through the
- declaration, otherwise, changed obstacks as GCC would. */
-
type = TREE_TYPE (decl);
if (type == error_mark_node)
- {
- if (toplevel_bindings_p () && temporary)
- end_temporary_allocation ();
-
- return;
- }
+ return;
if (TYPE_HAS_MUTABLE_P (type))
TREE_READONLY (decl) = 0;
-
+
if (processing_template_decl)
{
+ /* Add this declaration to the statement-tree. */
+ if (at_function_scope_p ()
+ && TREE_CODE (decl) != RESULT_DECL)
+ add_decl_stmt (decl);
+
if (init && DECL_INITIAL (decl))
DECL_INITIAL (decl) = init;
- if (minimal_parse_mode && ! DECL_ARTIFICIAL (decl))
- {
- tree stmt = DECL_VINDEX (decl);
- /* If the decl is declaring a member of a local class (in a
- template function), the DECL_VINDEX will either be NULL,
- or it will be an actual virtual function index, not a
- DECL_STMT. */
- if (stmt != NULL_TREE && TREE_CODE (stmt) == DECL_STMT)
- {
- DECL_VINDEX (decl) = NULL_TREE;
- TREE_OPERAND (stmt, 2) = copy_to_permanent (init);
- add_tree (stmt);
- }
- }
-
goto finish_end0;
}
+
+ /* Parameters are handled by store_parm_decls, not cp_finish_decl. */
+ my_friendly_assert (TREE_CODE (decl) != PARM_DECL, 19990828);
+
/* Take care of TYPE_DECLs up front. */
if (TREE_CODE (decl) == TYPE_DECL)
{
@@ -7853,7 +8126,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
&& IS_AGGR_TYPE (type) && DECL_NAME (decl))
{
if (TREE_TYPE (DECL_NAME (decl)) && TREE_TYPE (decl) != type)
- cp_warning ("shadowing previous type declaration of `%#D'", decl);
+ warning ("shadowing previous type declaration of `%#D'", decl);
set_identifier_type_value (DECL_NAME (decl), type);
CLASSTYPE_GOT_SEMICOLON (type) = 1;
}
@@ -7863,22 +8136,20 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
type, and that type has not been defined yet, delay emitting
the debug information for it, as we will emit it later. */
if (TYPE_MAIN_DECL (TREE_TYPE (decl)) == decl
- && TYPE_SIZE (TREE_TYPE (decl)) == NULL_TREE)
+ && !COMPLETE_TYPE_P (TREE_TYPE (decl)))
TYPE_DECL_SUPPRESS_DEBUG (decl) = 1;
- rest_of_decl_compilation (decl, NULL_PTR,
+ rest_of_decl_compilation (decl, NULL,
DECL_CONTEXT (decl) == NULL_TREE, at_eof);
goto finish_end;
}
+
if (TREE_CODE (decl) != FUNCTION_DECL)
- {
- ttype = target_type (type);
- }
+ ttype = target_type (type);
if (! DECL_EXTERNAL (decl) && TREE_READONLY (decl)
&& TYPE_NEEDS_CONSTRUCTING (type))
{
-
/* Currently, GNU C++ puts constants in text space, making them
impossible to initialize. In the future, one would hope for
an operating system which understood the difference between
@@ -7887,379 +8158,49 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
TREE_READONLY (decl) = 0;
}
- if (TREE_CODE (decl) == FIELD_DECL)
+ if (TREE_CODE (decl) == FIELD_DECL && asmspec)
{
- if (init && init != error_mark_node)
- my_friendly_assert (TREE_PERMANENT (init), 147);
-
- if (asmspec)
- {
- /* This must override the asm specifier which was placed
- by grokclassfn. Lay this out fresh. */
- DECL_RTL (TREE_TYPE (decl)) = NULL_RTX;
- DECL_ASSEMBLER_NAME (decl) = get_identifier (asmspec);
- make_decl_rtl (decl, asmspec, 0);
- }
- }
- /* If `start_decl' didn't like having an initialization, ignore it now. */
- else if (init != NULL_TREE && DECL_INITIAL (decl) == NULL_TREE)
- init = NULL_TREE;
- else if (DECL_EXTERNAL (decl))
- ;
- else if (TREE_CODE (type) == REFERENCE_TYPE
- || (TYPE_LANG_SPECIFIC (type) && IS_SIGNATURE_REFERENCE (type)))
- {
- if (TREE_STATIC (decl))
- make_decl_rtl (decl, NULL_PTR,
- toplevel_bindings_p ()
- || pseudo_global_level_p ());
- grok_reference_init (decl, type, init);
- init = NULL_TREE;
- }
-
- GNU_xref_decl (current_function_decl, decl);
-
- core_type = type;
- while (TREE_CODE (core_type) == ARRAY_TYPE)
- core_type = TREE_TYPE (core_type);
-
- if (TREE_CODE (decl) == FIELD_DECL)
- ;
- else if (TREE_CODE (decl) == CONST_DECL)
- {
- my_friendly_assert (TREE_CODE (decl) != REFERENCE_TYPE, 148);
-
- DECL_INITIAL (decl) = init;
-
- /* This will keep us from needing to worry about our obstacks. */
- my_friendly_assert (init != NULL_TREE, 149);
- init = NULL_TREE;
- }
- else if (init)
- {
- if (TYPE_HAS_CONSTRUCTOR (type) || TYPE_NEEDS_CONSTRUCTING (type))
- {
- if (TREE_CODE (type) == ARRAY_TYPE)
- init = digest_init (type, init, (tree *) 0);
- else if (TREE_CODE (init) == CONSTRUCTOR
- && TREE_HAS_CONSTRUCTOR (init))
- {
- if (TYPE_NON_AGGREGATE_CLASS (type))
- {
- cp_error ("`%D' must be initialized by constructor, not by `{...}'",
- decl);
- init = error_mark_node;
- }
- else
- goto dont_use_constructor;
- }
- }
- else
- {
- dont_use_constructor:
- if (TREE_CODE (init) != TREE_VEC)
- init = store_init_value (decl, init);
- }
-
- if (init)
- /* We must hide the initializer so that expand_decl
- won't try to do something it does not understand. */
- init = obscure_complex_init (decl, init);
- }
- else if (DECL_EXTERNAL (decl))
- ;
- else if (TREE_CODE_CLASS (TREE_CODE (type)) == 't'
- && (IS_AGGR_TYPE (type) || TYPE_NEEDS_CONSTRUCTING (type)))
- {
- if (! TYPE_NEEDS_CONSTRUCTING (core_type))
- {
- if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (core_type))
- cp_error ("structure `%D' with uninitialized const members", decl);
- if (CLASSTYPE_REF_FIELDS_NEED_INIT (core_type))
- cp_error ("structure `%D' with uninitialized reference members",
- decl);
- }
-
- check_for_uninitialized_const_var (decl);
-
- if (TYPE_SIZE (type) != NULL_TREE
- && TYPE_NEEDS_CONSTRUCTING (type))
- init = obscure_complex_init (decl, NULL_TREE);
-
+ /* This must override the asm specifier which was placed by
+ grokclassfn. Lay this out fresh. */
+ SET_DECL_RTL (TREE_TYPE (decl), NULL_RTX);
+ SET_DECL_ASSEMBLER_NAME (decl, get_identifier (asmspec));
+ make_decl_rtl (decl, asmspec);
}
- else
- check_for_uninitialized_const_var (decl);
-
- /* For top-level declaration, the initial value was read in
- the temporary obstack. MAXINDEX, rtl, etc. to be made below
- must go in the permanent obstack; but don't discard the
- temporary data yet. */
-
- if (toplevel_bindings_p () && temporary)
- end_temporary_allocation ();
/* Deduce size of array from initialization, if not already known. */
+ init = check_initializer (decl, init);
+ maybe_deduce_size_from_array_init (decl, init);
- if (TREE_CODE (type) == ARRAY_TYPE
- && TYPE_DOMAIN (type) == NULL_TREE
- && TREE_CODE (decl) != TYPE_DECL)
- {
- int do_default
- = (TREE_STATIC (decl)
- /* Even if pedantic, an external linkage array
- may have incomplete type at first. */
- ? pedantic && ! DECL_EXTERNAL (decl)
- : !DECL_EXTERNAL (decl));
- tree initializer = init ? init : DECL_INITIAL (decl);
- int failure = complete_array_type (type, initializer, do_default);
-
- if (failure == 1)
- cp_error ("initializer fails to determine size of `%D'", decl);
-
- if (failure == 2)
- {
- if (do_default)
- cp_error ("array size missing in `%D'", decl);
- /* If a `static' var's size isn't known, make it extern as
- well as static, so it does not get allocated. If it's not
- `static', then don't mark it extern; finish_incomplete_decl
- will give it a default size and it will get allocated. */
- else if (!pedantic && TREE_STATIC (decl) && !TREE_PUBLIC (decl))
- DECL_EXTERNAL (decl) = 1;
- }
-
- if (pedantic && TYPE_DOMAIN (type) != NULL_TREE
- && tree_int_cst_lt (TYPE_MAX_VALUE (TYPE_DOMAIN (type)),
- integer_zero_node))
- cp_error ("zero-size array `%D'", decl);
+ GNU_xref_decl (current_function_decl, decl);
- layout_decl (decl, 0);
- }
+ /* Add this declaration to the statement-tree. This needs to happen
+ after the call to check_initializer so that the DECL_STMT for a
+ reference temp is added before the DECL_STMT for the reference itself. */
+ if (building_stmt_tree ()
+ && at_function_scope_p ()
+ && TREE_CODE (decl) != RESULT_DECL)
+ add_decl_stmt (decl);
if (TREE_CODE (decl) == VAR_DECL)
- {
- if (DECL_SIZE (decl) == NULL_TREE
- && TYPE_SIZE (complete_type (TREE_TYPE (decl))) != NULL_TREE)
- layout_decl (decl, 0);
-
- if (TREE_STATIC (decl) && DECL_SIZE (decl) == NULL_TREE)
- {
- /* A static variable with an incomplete type:
- that is an error if it is initialized.
- Otherwise, let it through, but if it is not `extern'
- then it may cause an error message later. */
- if (DECL_INITIAL (decl) != NULL_TREE)
- cp_error ("storage size of `%D' isn't known", decl);
- init = NULL_TREE;
- }
- else if (!DECL_EXTERNAL (decl) && DECL_SIZE (decl) == NULL_TREE)
- {
- /* An automatic variable with an incomplete type: that is an error.
- Don't talk about array types here, since we took care of that
- message in grokdeclarator. */
- cp_error ("storage size of `%D' isn't known", decl);
- TREE_TYPE (decl) = error_mark_node;
- }
- else if (!DECL_EXTERNAL (decl) && IS_AGGR_TYPE (ttype))
- /* Let debugger know it should output info for this type. */
- note_debug_info_needed (ttype);
-
- if (TREE_STATIC (decl) && DECL_CLASS_SCOPE_P (decl))
- note_debug_info_needed (DECL_CONTEXT (decl));
-
- if ((DECL_EXTERNAL (decl) || TREE_STATIC (decl))
- && DECL_SIZE (decl) != NULL_TREE
- && ! TREE_CONSTANT (DECL_SIZE (decl)))
- {
- if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST)
- constant_expression_warning (DECL_SIZE (decl));
- else
- cp_error ("storage size of `%D' isn't constant", decl);
- }
-
- if (! DECL_EXTERNAL (decl) && TYPE_NEEDS_DESTRUCTOR (type)
- /* Cleanups for static variables are handled by `finish_file'. */
- && ! TREE_STATIC (decl))
- {
- int yes = suspend_momentary ();
- cleanup = maybe_build_cleanup (decl);
- resume_momentary (yes);
- }
- }
- /* PARM_DECLs get cleanups, too. */
- else if (TREE_CODE (decl) == PARM_DECL && TYPE_NEEDS_DESTRUCTOR (type))
- {
- if (temporary)
- end_temporary_allocation ();
- cleanup = maybe_build_cleanup (decl);
- if (temporary)
- resume_temporary_allocation ();
- }
+ layout_var_decl (decl);
/* Output the assembler code and/or RTL code for variables and functions,
unless the type is an undefined structure or union.
If not, it will get done when the type is completed. */
-
- was_incomplete = (DECL_SIZE (decl) == NULL_TREE);
-
if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL
|| TREE_CODE (decl) == RESULT_DECL)
{
- /* ??? FIXME: What about nested classes? */
- int toplev = toplevel_bindings_p () || pseudo_global_level_p ();
- int was_temp
- = (TREE_STATIC (decl) && TYPE_NEEDS_DESTRUCTOR (type)
- && allocation_temporary_p ());
-
- if (was_temp)
- end_temporary_allocation ();
-
- /* Static data in a function with comdat linkage also has comdat
- linkage. */
- if (TREE_CODE (decl) == VAR_DECL
- && TREE_STATIC (decl)
- /* Don't mess with __FUNCTION__. */
- && ! TREE_ASM_WRITTEN (decl)
- && current_function_decl
- && DECL_CONTEXT (decl) == current_function_decl
- && (DECL_THIS_INLINE (current_function_decl)
- || DECL_TEMPLATE_INSTANTIATION (current_function_decl))
- && TREE_PUBLIC (current_function_decl))
- {
- /* Rather than try to get this right with inlining, we suppress
- inlining of such functions. */
- current_function_cannot_inline
- = "function with static variable cannot be inline";
-
- /* If flag_weak, we don't need to mess with this, as we can just
- make the function weak, and let it refer to its unique local
- copy. This works because we don't allow the function to be
- inlined. */
- if (! flag_weak)
- {
- if (DECL_INTERFACE_KNOWN (current_function_decl))
- {
- TREE_PUBLIC (decl) = 1;
- DECL_EXTERNAL (decl) = DECL_EXTERNAL (current_function_decl);
- }
- else if (DECL_INITIAL (decl) == NULL_TREE
- || DECL_INITIAL (decl) == error_mark_node)
- {
- TREE_PUBLIC (decl) = 1;
- DECL_COMMON (decl) = 1;
- }
- /* else we lose. We can only do this if we can use common,
- which we can't if it has been initialized. */
-
- if (TREE_PUBLIC (decl))
- DECL_ASSEMBLER_NAME (decl)
- = build_static_name (current_function_decl, DECL_NAME (decl));
- else if (! DECL_ARTIFICIAL (decl))
- {
- cp_warning_at ("sorry: semantics of inline function static data `%#D' are wrong (you'll wind up with multiple copies)", decl);
- cp_warning_at (" you can work around this by removing the initializer", decl);
- }
- }
- }
+ if (TREE_CODE (decl) == VAR_DECL)
+ maybe_commonize_var (decl);
- else if (TREE_CODE (decl) == VAR_DECL
- && DECL_LANG_SPECIFIC (decl)
- && DECL_COMDAT (decl))
- /* Set it up again; we might have set DECL_INITIAL since the
- last time. */
- comdat_linkage (decl);
+ make_rtl_for_nonlocal_decl (decl, init, asmspec);
- if (TREE_CODE (decl) == VAR_DECL && DECL_VIRTUAL_P (decl))
- make_decl_rtl (decl, NULL_PTR, toplev);
- else if (TREE_CODE (decl) == VAR_DECL
- && TREE_READONLY (decl)
- && DECL_INITIAL (decl) != NULL_TREE
- && DECL_INITIAL (decl) != error_mark_node
- && ! EMPTY_CONSTRUCTOR_P (DECL_INITIAL (decl)))
- {
- DECL_INITIAL (decl) = save_expr (DECL_INITIAL (decl));
-
- if (asmspec)
- DECL_ASSEMBLER_NAME (decl) = get_identifier (asmspec);
-
- if (! toplev
- && TREE_STATIC (decl)
- && ! TREE_SIDE_EFFECTS (decl)
- && ! TREE_PUBLIC (decl)
- && ! DECL_EXTERNAL (decl)
- && ! TYPE_NEEDS_DESTRUCTOR (type)
- && DECL_MODE (decl) != BLKmode)
- {
- /* If this variable is really a constant, then fill its DECL_RTL
- slot with something which won't take up storage.
- If something later should take its address, we can always give
- it legitimate RTL at that time. */
- DECL_RTL (decl) = gen_reg_rtx (DECL_MODE (decl));
- store_expr (DECL_INITIAL (decl), DECL_RTL (decl), 0);
- TREE_ASM_WRITTEN (decl) = 1;
- }
- else if (toplev && ! TREE_PUBLIC (decl))
- {
- /* If this is a static const, change its apparent linkage
- if it belongs to a #pragma interface. */
- if (!interface_unknown)
- {
- TREE_PUBLIC (decl) = 1;
- DECL_EXTERNAL (decl) = interface_only;
- }
- make_decl_rtl (decl, asmspec, toplev);
- }
- else
- rest_of_decl_compilation (decl, asmspec, toplev, at_eof);
- }
- else if (TREE_CODE (decl) == VAR_DECL
- && DECL_LANG_SPECIFIC (decl)
- && DECL_IN_AGGR_P (decl))
- {
- if (TREE_STATIC (decl))
- {
- if (init == NULL_TREE
-#ifdef DEFAULT_STATIC_DEFS
- /* If this code is dead, then users must
- explicitly declare static member variables
- outside the class def'n as well. */
- && TYPE_NEEDS_CONSTRUCTING (type)
-#endif
- )
- {
- DECL_EXTERNAL (decl) = 1;
- make_decl_rtl (decl, asmspec, 1);
- }
- else
- rest_of_decl_compilation (decl, asmspec, toplev, at_eof);
- }
- else
- /* Just a constant field. Should not need any rtl. */
- goto finish_end0;
- }
+ if (TREE_CODE (type) == FUNCTION_TYPE
+ || TREE_CODE (type) == METHOD_TYPE)
+ abstract_virtuals_error (decl,
+ strip_array_types (TREE_TYPE (type)));
else
- rest_of_decl_compilation (decl, asmspec, toplev, at_eof);
-
- if (was_temp)
- resume_temporary_allocation ();
-
- if (type != error_mark_node
- && TYPE_LANG_SPECIFIC (core_type)
- && CLASSTYPE_ABSTRACT_VIRTUALS (core_type))
- abstract_virtuals_error (decl, core_type);
- else if ((TREE_CODE (type) == FUNCTION_TYPE
- || TREE_CODE (type) == METHOD_TYPE)
- && TYPE_LANG_SPECIFIC (TREE_TYPE (type))
- && CLASSTYPE_ABSTRACT_VIRTUALS (TREE_TYPE (type)))
- abstract_virtuals_error (decl, TREE_TYPE (type));
-
- if (TYPE_LANG_SPECIFIC (core_type) && IS_SIGNATURE (core_type))
- signature_error (decl, core_type);
- else if ((TREE_CODE (type) == FUNCTION_TYPE
- || TREE_CODE (type) == METHOD_TYPE)
- && TYPE_LANG_SPECIFIC (TREE_TYPE (type))
- && IS_SIGNATURE (TREE_TYPE (type)))
- signature_error (decl, TREE_TYPE (type));
+ abstract_virtuals_error (decl, strip_array_types (type));
if (TREE_CODE (decl) == FUNCTION_DECL)
;
@@ -8270,137 +8211,46 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
if (init)
DECL_INITIAL (decl) = init;
}
- else if (TREE_STATIC (decl) && type != error_mark_node)
+ else if (TREE_CODE (CP_DECL_CONTEXT (decl)) == FUNCTION_DECL)
{
- /* Cleanups for static variables are handled by `finish_file'. */
- if (TYPE_NEEDS_CONSTRUCTING (type) || init != NULL_TREE
- || TYPE_NEEDS_DESTRUCTOR (type))
- expand_static_init (decl, init);
- }
- else if (! toplev)
- {
- /* This is a declared decl which must live until the
- end of the binding contour. It may need a cleanup. */
-
- /* Recompute the RTL of a local array now
- if it used to be an incomplete type. */
- if (was_incomplete && ! TREE_STATIC (decl))
- {
- /* If we used it already as memory, it must stay in memory. */
- TREE_ADDRESSABLE (decl) = TREE_USED (decl);
- /* If it's still incomplete now, no init will save it. */
- if (DECL_SIZE (decl) == NULL_TREE)
- DECL_INITIAL (decl) = NULL_TREE;
- expand_decl (decl);
- }
- else if (! TREE_ASM_WRITTEN (decl)
- && (TYPE_SIZE (type) != NULL_TREE
- || TREE_CODE (type) == ARRAY_TYPE))
+ /* This is a local declaration. */
+ if (doing_semantic_analysis_p ())
+ maybe_inject_for_scope_var (decl);
+ /* Initialize the local variable. But, if we're building a
+ statement-tree, we'll do the initialization when we
+ expand the tree. */
+ if (processing_template_decl)
{
- /* Do this here, because we did not expand this decl's
- rtl in start_decl. */
- if (DECL_RTL (decl) == NULL_RTX)
- expand_decl (decl);
- else if (cleanup)
- {
- /* XXX: Why don't we use decl here? */
- /* Ans: Because it was already expanded? */
- if (! expand_decl_cleanup (NULL_TREE, cleanup))
- cp_error ("parser lost in parsing declaration of `%D'",
- decl);
- /* Cleanup used up here. */
- cleanup = NULL_TREE;
- }
+ if (init || DECL_INITIAL (decl) == error_mark_node)
+ DECL_INITIAL (decl) = init;
}
-
- if (current_binding_level->is_for_scope)
- {
- struct binding_level *outer
- = current_binding_level->level_chain;
-
- /* Check to see if the same name is already bound at
- the outer level, either because it was directly declared,
- or because a dead for-decl got preserved. In either case,
- the code would not have been valid under the ARM
- scope rules, so clear is_for_scope for the
- current_binding_level.
-
- Otherwise, we need to preserve the temp slot for decl
- to last into the outer binding level. */
-
- tree outer_binding
- = TREE_CHAIN (IDENTIFIER_BINDING (DECL_NAME (decl)));
-
- if (outer_binding && BINDING_LEVEL (outer_binding) == outer
- && (TREE_CODE (BINDING_VALUE (outer_binding))
- == VAR_DECL)
- && DECL_DEAD_FOR_LOCAL (BINDING_VALUE (outer_binding)))
- {
- BINDING_VALUE (outer_binding)
- = DECL_SHADOWED_FOR_VAR (BINDING_VALUE (outer_binding));
- current_binding_level->is_for_scope = 0;
- }
- else if (DECL_IN_MEMORY_P (decl))
- preserve_temp_slots (DECL_RTL (decl));
- }
-
- expand_start_target_temps ();
-
- if (DECL_SIZE (decl) && type != error_mark_node)
- {
- /* Compute and store the initial value. */
- expand_decl_init (decl);
- already_used = TREE_USED (decl) || TREE_USED (type);
-
- if (init || TYPE_NEEDS_CONSTRUCTING (type))
- {
- emit_line_note (DECL_SOURCE_FILE (decl),
- DECL_SOURCE_LINE (decl));
- expand_aggr_init (decl, init, flags);
- }
-
- /* Set this to 0 so we can tell whether an aggregate which
- was initialized was ever used. Don't do this if it has a
- destructor, so we don't complain about the 'resource
- allocation is initialization' idiom. */
- /* Now set attribute((unused)) on types so decls of
- that type will be marked used. (see TREE_USED, above.)
- This avoids the warning problems this particular code
- tried to work around. */
-
- if (TYPE_NEEDS_CONSTRUCTING (type)
- && ! already_used
- && cleanup == NULL_TREE
- && DECL_NAME (decl))
- TREE_USED (decl) = 0;
-
- if (already_used)
- TREE_USED (decl) = 1;
- }
-
- /* Cleanup any temporaries needed for the initial value. */
- expand_end_target_temps ();
-
- if (DECL_SIZE (decl) && type != error_mark_node)
+ else
{
- /* Store the cleanup, if there was one. */
- if (cleanup)
- {
- if (! expand_decl_cleanup (decl, cleanup))
- cp_error ("parser lost in parsing declaration of `%D'",
- decl);
- }
+ /* If we're not building RTL, then we need to do so
+ now. */
+ my_friendly_assert (building_stmt_tree (), 20000906);
+ /* Initialize the variable. */
+ initialize_local_var (decl, init, flags);
+ /* Clean up the variable. */
+ destroy_local_var (decl);
}
}
+ else if (TREE_STATIC (decl) && type != error_mark_node)
+ {
+ /* Cleanups for static variables are handled by `finish_file'. */
+ if (TYPE_NEEDS_CONSTRUCTING (type) || init != NULL_TREE
+ || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
+ expand_static_init (decl, init);
+ }
finish_end0:
/* Undo call to `pushclass' that was done in `start_decl'
due to initialization of qualified member variable.
I.e., Foo::x = 10; */
{
- tree context = DECL_REAL_CONTEXT (decl);
+ tree context = CP_DECL_CONTEXT (decl);
if (context
- && TREE_CODE_CLASS (TREE_CODE (context)) == 't'
+ && TYPE_P (context)
&& (TREE_CODE (decl) == VAR_DECL
/* We also have a pushclass done that we need to undo here
if we're at top level and declare a method. */
@@ -8408,7 +8258,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
/* If size hasn't been set, we're still defining it,
and therefore inside the class body; don't pop
the binding level.. */
- && TYPE_SIZE (context) != NULL_TREE
+ && COMPLETE_TYPE_P (context)
&& context == current_class_type)
pop_nested_class ();
}
@@ -8416,44 +8266,253 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
finish_end:
- /* If requested, warn about definitions of large data objects. */
+ if (was_readonly)
+ TREE_READONLY (decl) = 1;
+}
+
+/* This is here for a midend callback from c-common.c */
+
+void
+finish_decl (decl, init, asmspec_tree)
+ tree decl, init;
+ tree asmspec_tree;
+{
+ cp_finish_decl (decl, init, asmspec_tree, 0);
+}
- if (warn_larger_than
- && ! processing_template_decl
- && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL)
- && !DECL_EXTERNAL (decl))
+/* Returns a declaration for a VAR_DECL as if:
+
+ extern "C" TYPE NAME;
+
+ had been seen. Used to create compiler-generated global
+ variables. */
+
+tree
+declare_global_var (name, type)
+ tree name;
+ tree type;
+{
+ tree decl;
+
+ push_to_top_level ();
+ decl = build_decl (VAR_DECL, name, type);
+ TREE_PUBLIC (decl) = 1;
+ DECL_EXTERNAL (decl) = 1;
+ DECL_ARTIFICIAL (decl) = 1;
+ pushdecl (decl);
+ cp_finish_decl (decl, NULL_TREE, NULL_TREE, 0);
+ pop_from_top_level ();
+
+ return decl;
+}
+
+/* Returns a pointer to the `atexit' function. Note that if
+ FLAG_USE_CXA_ATEXIT is non-zero, then this will actually be the new
+ `__cxa_atexit' function specified in the IA64 C++ ABI. */
+
+static tree
+get_atexit_node ()
+{
+ tree atexit_fndecl;
+ tree arg_types;
+ tree fn_type;
+ tree fn_ptr_type;
+ const char *name;
+
+ if (atexit_node)
+ return atexit_node;
+
+ if (flag_use_cxa_atexit)
{
- register tree decl_size = DECL_SIZE (decl);
+ /* The declaration for `__cxa_atexit' is:
- if (decl_size && TREE_CODE (decl_size) == INTEGER_CST)
- {
- unsigned units = TREE_INT_CST_LOW (decl_size) / BITS_PER_UNIT;
+ int __cxa_atexit (void (*)(void *), void *, void *)
- if (units > larger_than_size)
- warning_with_decl (decl, "size of `%s' is %u bytes", units);
- }
+ We build up the argument types and then then function type
+ itself. */
+
+ /* First, build the pointer-to-function type for the first
+ argument. */
+ arg_types = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
+ fn_type = build_function_type (void_type_node, arg_types);
+ fn_ptr_type = build_pointer_type (fn_type);
+ /* Then, build the rest of the argument types. */
+ arg_types = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
+ arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types);
+ arg_types = tree_cons (NULL_TREE, fn_ptr_type, arg_types);
+ /* And the final __cxa_atexit type. */
+ fn_type = build_function_type (integer_type_node, arg_types);
+ fn_ptr_type = build_pointer_type (fn_type);
+ name = "__cxa_atexit";
+ }
+ else
+ {
+ /* The declaration for `atexit' is:
+
+ int atexit (void (*)());
+
+ We build up the argument types and then then function type
+ itself. */
+ fn_type = build_function_type (void_type_node, void_list_node);
+ fn_ptr_type = build_pointer_type (fn_type);
+ arg_types = tree_cons (NULL_TREE, fn_ptr_type, void_list_node);
+ /* Build the final atexit type. */
+ fn_type = build_function_type (integer_type_node, arg_types);
+ name = "atexit";
}
- if (need_pop)
+ /* Now, build the function declaration. */
+ push_lang_context (lang_name_c);
+ atexit_fndecl = build_library_fn_ptr (name, fn_type);
+ mark_used (atexit_fndecl);
+ pop_lang_context ();
+ atexit_node = default_conversion (atexit_fndecl);
+
+ return atexit_node;
+}
+
+/* Returns the __dso_handle VAR_DECL. */
+
+static tree
+get_dso_handle_node ()
+{
+ if (dso_handle_node)
+ return dso_handle_node;
+
+ /* Declare the variable. */
+ dso_handle_node = declare_global_var (get_identifier ("__dso_handle"),
+ ptr_type_node);
+
+ return dso_handle_node;
+}
+
+/* Begin a new function with internal linkage whose job will be simply
+ to destroy some particular variable. */
+
+static tree
+start_cleanup_fn ()
+{
+ static int counter = 0;
+ int old_interface_unknown = interface_unknown;
+ char name[32];
+ tree parmtypes;
+ tree fntype;
+ tree fndecl;
+
+ push_to_top_level ();
+
+ /* No need to mangle this. */
+ push_lang_context (lang_name_c);
+
+ interface_unknown = 1;
+
+ /* Build the parameter-types. */
+ parmtypes = void_list_node;
+ /* Functions passed to __cxa_atexit take an additional parameter.
+ We'll just ignore it. After we implement the new calling
+ convention for destructors, we can eliminate the use of
+ additional cleanup functions entirely in the -fnew-abi case. */
+ if (flag_use_cxa_atexit)
+ parmtypes = tree_cons (NULL_TREE, ptr_type_node, parmtypes);
+ /* Build the function type itself. */
+ fntype = build_function_type (void_type_node, parmtypes);
+ /* Build the name of the function. */
+ sprintf (name, "__tcf_%d", counter++);
+ /* Build the function declaration. */
+ fndecl = build_lang_decl (FUNCTION_DECL, get_identifier (name), fntype);
+ /* It's a function with internal linkage, generated by the
+ compiler. */
+ TREE_PUBLIC (fndecl) = 0;
+ DECL_ARTIFICIAL (fndecl) = 1;
+ /* Make the function `inline' so that it is only emitted if it is
+ actually needed. It is unlikely that it will be inlined, since
+ it is only called via a function pointer, but we avoid unnecessary
+ emissions this way. */
+ DECL_INLINE (fndecl) = 1;
+ /* Build the parameter. */
+ if (flag_use_cxa_atexit)
{
- /* Resume permanent allocation, if not within a function. */
- /* The corresponding push_obstacks_nochange is in start_decl,
- start_method, groktypename, and in grokfield. */
- pop_obstacks ();
+ tree parmdecl;
+
+ parmdecl = build_decl (PARM_DECL, NULL_TREE, ptr_type_node);
+ DECL_CONTEXT (parmdecl) = fndecl;
+ DECL_ARG_TYPE (parmdecl) = ptr_type_node;
+ TREE_USED (parmdecl) = 1;
+ DECL_ARGUMENTS (fndecl) = parmdecl;
}
- if (was_readonly)
- TREE_READONLY (decl) = 1;
+ pushdecl (fndecl);
+ start_function (/*specs=*/NULL_TREE, fndecl, NULL_TREE, SF_PRE_PARSED);
+
+ interface_unknown = old_interface_unknown;
+
+ pop_lang_context ();
+
+ return current_function_decl;
}
-/* This is here for a midend callback from c-common.c */
+/* Finish the cleanup function begun by start_cleanup_fn. */
+
+static void
+end_cleanup_fn ()
+{
+ expand_body (finish_function (0));
+
+ pop_from_top_level ();
+}
+
+/* Generate code to handle the destruction of DECL, an object with
+ static storage duration. */
void
-finish_decl (decl, init, asmspec_tree)
- tree decl, init;
- tree asmspec_tree;
+register_dtor_fn (decl)
+ tree decl;
{
- cp_finish_decl (decl, init, asmspec_tree, 1, 0);
+ tree cleanup;
+ tree compound_stmt;
+ tree args;
+ tree fcall;
+
+ int saved_flag_access_control;
+
+ if (TYPE_HAS_TRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
+ return;
+
+ /* Call build_cleanup before we enter the anonymous function so that
+ any access checks will be done relative to the current scope,
+ rather than the scope of the anonymous function. */
+ build_cleanup (decl);
+
+ /* Now start the function. */
+ cleanup = start_cleanup_fn ();
+
+ /* Now, recompute the cleanup. It may contain SAVE_EXPRs that refer
+ to the original function, rather than the anonymous one. That
+ will make the back-end think that nested functions are in use,
+ which causes confusion. */
+ saved_flag_access_control = flag_access_control;
+ flag_access_control = 0;
+ fcall = build_cleanup (decl);
+ flag_access_control = saved_flag_access_control;
+
+ /* Create the body of the anonymous function. */
+ compound_stmt = begin_compound_stmt (/*has_no_scope=*/0);
+ finish_expr_stmt (fcall);
+ finish_compound_stmt (/*has_no_scope=*/0, compound_stmt);
+ end_cleanup_fn ();
+
+ /* Call atexit with the cleanup function. */
+ mark_addressable (cleanup);
+ cleanup = build_unary_op (ADDR_EXPR, cleanup, 0);
+ if (flag_use_cxa_atexit)
+ {
+ args = tree_cons (NULL_TREE, get_dso_handle_node (), NULL_TREE);
+ args = tree_cons (NULL_TREE, null_pointer_node, args);
+ args = tree_cons (NULL_TREE, cleanup, args);
+ }
+ else
+ args = tree_cons (NULL_TREE, cleanup, NULL_TREE);
+ finish_expr_stmt (build_function_call (get_atexit_node (), args));
}
void
@@ -8466,23 +8525,24 @@ expand_static_init (decl, init)
if (oldstatic)
{
if (TREE_PURPOSE (oldstatic) && init != NULL_TREE)
- cp_error ("multiple initializations given for `%D'", decl);
+ error ("multiple initializations given for `%D'", decl);
}
else if (! toplevel_bindings_p ())
{
/* Emit code to perform this initialization but once. */
- tree temp;
-
- /* Remember this information until end of file. */
- push_obstacks (&permanent_obstack, &permanent_obstack);
+ tree if_stmt;
+ tree then_clause;
+ tree assignment;
+ tree guard;
+ tree guard_init;
/* Emit code to perform this initialization but once. This code
looks like:
- static int temp = 0;
- if (!temp) {
+ static int guard = 0;
+ if (!guard) {
// Do initialization.
- temp = 1;
+ guard = 1;
// Register variable for destruction at end of program.
}
@@ -8490,7 +8550,7 @@ expand_static_init (decl, init)
initialization is complete. This ensures that an exception,
thrown during the construction, will cause the variable to
reinitialized when we pass through this code again, as per:
-
+
[stmt.dcl]
If the initialization exits by throwing an exception, the
@@ -8500,110 +8560,79 @@ expand_static_init (decl, init)
In theory, this process should be thread-safe, too; multiple
threads should not be able to initialize the variable more
than once. We don't yet attempt to ensure thread-safety. */
- temp = get_temp_name (integer_type_node, 1);
- rest_of_decl_compilation (temp, NULL_PTR, 0, 0);
+
+ /* Create the guard variable. */
+ guard = get_guard (decl);
/* Begin the conditional initialization. */
- expand_start_cond (build_binary_op (EQ_EXPR, temp,
- integer_zero_node), 0);
- expand_start_target_temps ();
+ if_stmt = begin_if_stmt ();
+ finish_if_stmt_cond (get_guard_cond (guard), if_stmt);
+ then_clause = begin_compound_stmt (/*has_no_scope=*/0);
/* Do the initialization itself. */
if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl))
|| (init && TREE_CODE (init) == TREE_LIST))
- {
- expand_aggr_init (decl, init, 0);
- do_pending_stack_adjust ();
- }
+ assignment = build_aggr_init (decl, init, 0);
else if (init)
- expand_assignment (decl, init, 0, 0);
-
- /* Set TEMP to 1. */
- expand_assignment (temp, integer_one_node, 0, 0);
-
- /* Cleanup any temporaries needed for the initial value. If
- destroying one of the temporaries causes an exception to be
- thrown, then the object itself has still been fully
- constructed. */
- expand_end_target_temps ();
+ /* The initialization we're doing here is just a bitwise
+ copy. */
+ assignment = build (INIT_EXPR, TREE_TYPE (decl), decl, init);
+ else
+ assignment = NULL_TREE;
+
+ /* Once the assignment is complete, set TEMP to 1. Since the
+ construction of the static object is complete at this point,
+ we want to make sure TEMP is set to 1 even if a temporary
+ constructed during the initialization throws an exception
+ when it is destroyed. So, we combine the initialization and
+ the assignment to TEMP into a single expression, ensuring
+ that when we call finish_expr_stmt the cleanups will not be
+ run until after TEMP is set to 1. */
+ guard_init = set_guard (guard);
+ if (assignment)
+ {
+ assignment = tree_cons (NULL_TREE, assignment,
+ build_tree_list (NULL_TREE,
+ guard_init));
+ assignment = build_compound_expr (assignment);
+ }
+ else
+ assignment = guard_init;
+ finish_expr_stmt (assignment);
/* Use atexit to register a function for destroying this static
variable. */
- if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (decl)))
- {
- tree cleanup, fcall;
- static tree Atexit = 0;
- int saved_flag_access_control;
+ register_dtor_fn (decl);
- if (Atexit == 0)
- {
- tree atexit_fndecl, PFV, pfvlist;
- /* Remember this information until end of file. */
- push_obstacks (&permanent_obstack, &permanent_obstack);
- PFV = build_pointer_type (build_function_type
- (void_type_node, void_list_node));
-
- pfvlist = tree_cons (NULL_TREE, PFV, void_list_node);
-
- push_lang_context (lang_name_c);
- atexit_fndecl
- = builtin_function ("atexit",
- build_function_type (void_type_node,
- pfvlist),
- NOT_BUILT_IN, NULL_PTR);
- mark_used (atexit_fndecl);
- Atexit = default_conversion (atexit_fndecl);
- pop_lang_context ();
- pop_obstacks ();
- }
-
- /* Call build_cleanup before we enter the anonymous function
- so that any access checks will be done relative to the
- current scope, rather than the scope of the anonymous
- function. */
- build_cleanup (decl);
-
- /* Now start the function. */
- cleanup = start_anon_func ();
-
- /* Now, recompute the cleanup. It may contain SAVE_EXPRs
- that refer to the original function, rather than the
- anonymous one. That will make the back-end think that
- nested functions are in use, which causes confusion. */
- saved_flag_access_control = flag_access_control;
- flag_access_control = 0;
- fcall = build_cleanup (decl);
- flag_access_control = saved_flag_access_control;
-
- /* Finish off the function. */
- expand_expr_stmt (fcall);
- end_anon_func ();
-
- /* Call atexit with the cleanup function. */
- mark_addressable (cleanup);
- cleanup = build_unary_op (ADDR_EXPR, cleanup, 0);
- fcall = build_function_call (Atexit,
- expr_tree_cons (NULL_TREE,
- cleanup,
- NULL_TREE));
- expand_expr_stmt (fcall);
- }
-
- expand_end_cond ();
- /* Resume old (possibly temporary) allocation. */
- pop_obstacks ();
+ finish_compound_stmt (/*has_no_scope=*/0, then_clause);
+ finish_then_clause (if_stmt);
+ finish_if_stmt ();
}
else
+ static_aggregates = tree_cons (init, decl, static_aggregates);
+}
+
+/* Finish the declaration of a catch-parameter. */
+
+tree
+start_handler_parms (declspecs, declarator)
+ tree declspecs;
+ tree declarator;
+{
+ tree decl;
+ if (declspecs)
{
- /* This code takes into account memory allocation policy of
- `start_decl'. Namely, if TYPE_NEEDS_CONSTRUCTING does not
- hold for this object, then we must make permanent the storage
- currently in the temporary obstack. */
- if (!TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))
- preserve_initializer ();
- static_aggregates = perm_tree_cons (init, decl, static_aggregates);
+ decl = grokdeclarator (declarator, declspecs, CATCHPARM,
+ 1, NULL);
+ if (decl == NULL_TREE)
+ error ("invalid catch parameter");
}
+ else
+ decl = NULL_TREE;
+
+ return decl;
}
+
/* Make TYPE a complete type based on INITIAL_VALUE.
Return 0 if successful, 1 if INITIAL_VALUE can't be deciphered,
@@ -8616,14 +8645,21 @@ complete_array_type (type, initial_value, do_default)
{
register tree maxindex = NULL_TREE;
int value = 0;
-
- /* Allocate on the same obstack as TYPE. */
- push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type));
-
+
if (initial_value)
{
- /* Note MAXINDEX is really the maximum index,
- one less than the size. */
+ /* An array of character type can be initialized from a
+ brace-enclosed string constant. */
+ if (char_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (type)))
+ && TREE_CODE (initial_value) == CONSTRUCTOR
+ && CONSTRUCTOR_ELTS (initial_value)
+ && (TREE_CODE (TREE_VALUE (CONSTRUCTOR_ELTS (initial_value)))
+ == STRING_CST)
+ && TREE_CHAIN (CONSTRUCTOR_ELTS (initial_value)) == NULL_TREE)
+ initial_value = TREE_VALUE (CONSTRUCTOR_ELTS (initial_value));
+
+ /* Note MAXINDEX is really the maximum index, one less than the
+ size. */
if (TREE_CODE (initial_value) == STRING_CST)
{
int eltsize
@@ -8634,13 +8670,14 @@ complete_array_type (type, initial_value, do_default)
else if (TREE_CODE (initial_value) == CONSTRUCTOR)
{
tree elts = CONSTRUCTOR_ELTS (initial_value);
- maxindex = size_binop (MINUS_EXPR, integer_zero_node, size_one_node);
+
+ maxindex = ssize_int (-1);
for (; elts; elts = TREE_CHAIN (elts))
{
if (TREE_PURPOSE (elts))
maxindex = TREE_PURPOSE (elts);
else
- maxindex = size_binop (PLUS_EXPR, maxindex, size_one_node);
+ maxindex = size_binop (PLUS_EXPR, maxindex, ssize_int (1));
}
maxindex = copy_node (maxindex);
}
@@ -8687,8 +8724,6 @@ complete_array_type (type, initial_value, do_default)
TYPE_DOMAIN (TYPE_MAIN_VARIANT (type)) = domain;
}
- pop_obstacks();
-
/* Lay out the type now that we can get the real answer. */
layout_type (type);
@@ -8701,13 +8736,18 @@ complete_array_type (type, initial_value, do_default)
message to print in that case. Otherwise, quietly return 1. */
static int
-member_function_or_else (ctype, cur_type, string)
+member_function_or_else (ctype, cur_type, flags)
tree ctype, cur_type;
- const char *string;
+ enum overload_flags flags;
{
if (ctype && ctype != cur_type)
{
- error (string, TYPE_NAME_STRING (ctype));
+ if (flags == DTOR_FLAG)
+ error ("destructor for alien class `%T' cannot be a member",
+ ctype);
+ else
+ error ("constructor for alien class `%T' cannot be a member",
+ ctype);
return 0;
}
return 1;
@@ -8725,16 +8765,20 @@ bad_specifiers (object, type, virtualp, quals, inlinep, friendp, raises)
int virtualp, quals, friendp, raises, inlinep;
{
if (virtualp)
- cp_error ("`%D' declared as a `virtual' %s", object, type);
+ error ("`%D' declared as a `virtual' %s", object, type);
if (inlinep)
- cp_error ("`%D' declared as an `inline' %s", object, type);
+ error ("`%D' declared as an `inline' %s", object, type);
if (quals)
- cp_error ("`const' and `volatile' function specifiers on `%D' invalid in %s declaration",
+ error ("`const' and `volatile' function specifiers on `%D' invalid in %s declaration",
object, type);
if (friendp)
- cp_error_at ("invalid friend declaration", object);
- if (raises)
- cp_error_at ("invalid exception specifications", object);
+ cp_error_at ("`%D' declared as a friend", object);
+ if (raises
+ && (TREE_CODE (object) == TYPE_DECL
+ || (!TYPE_PTRFN_P (TREE_TYPE (object))
+ && !TYPE_REFFN_P (TREE_TYPE (object))
+ && !TYPE_PTRMEMFUNC_P (TREE_TYPE (object)))))
+ cp_error_at ("`%D' declared with an exception specification", object);
}
/* CTYPE is class type, or null if non-class.
@@ -8747,7 +8791,7 @@ bad_specifiers (object, type, virtualp, quals, inlinep, friendp, raises)
or `volatile'.
RAISES is a list of exceptions that this function can raise.
CHECK is 1 if we must find this method in CTYPE, 0 if we should
- not look, and -1 if we should not call `grokclassfn' at all.
+ not look, and -1 if we should not call `grokclassfn' at all.
Returns `NULL_TREE' if something goes wrong, after issuing
applicable error messages. */
@@ -8765,21 +8809,13 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
int check, friendp, publicp, inlinep, funcdef_flag, template_count;
tree in_namespace;
{
- tree cname, decl;
+ tree decl;
int staticp = ctype && TREE_CODE (type) == FUNCTION_TYPE;
int has_default_arg = 0;
tree t;
- if (ctype)
- cname = TREE_CODE (TYPE_NAME (ctype)) == TYPE_DECL
- ? TYPE_IDENTIFIER (ctype) : TYPE_NAME (ctype);
- else
- cname = NULL_TREE;
-
if (raises)
- {
- type = build_exception_variant (type, raises);
- }
+ type = build_exception_variant (type, raises);
decl = build_lang_decl (FUNCTION_DECL, declarator, type);
/* Propagate volatile out from type to decl. */
@@ -8789,7 +8825,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
/* If this decl has namespace scope, set that up. */
if (in_namespace)
set_decl_namespace (decl, in_namespace, friendp);
- else if (publicp && ! ctype)
+ else if (!ctype)
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
/* `main' and builtins have implicit 'C' linkage. */
@@ -8802,7 +8838,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
&& ctype == NULL_TREE
/* NULL_TREE means global namespace. */
&& DECL_CONTEXT (decl) == NULL_TREE)
- DECL_LANGUAGE (decl) = lang_c;
+ SET_DECL_LANGUAGE (decl, lang_c);
/* Should probably propagate const out from type to decl I bet (mrs). */
if (staticp)
@@ -8812,24 +8848,28 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
}
if (ctype)
- DECL_CLASS_CONTEXT (decl) = ctype;
+ DECL_CONTEXT (decl) = ctype;
if (ctype == NULL_TREE && DECL_MAIN_P (decl))
{
if (processing_template_decl)
- error ("cannot declare `main' to be a template");
+ error ("cannot declare `::main' to be a template");
if (inlinep)
- error ("cannot declare `main' to be inline");
- else if (! publicp)
- error ("cannot declare `main' to be static");
+ error ("cannot declare `::main' to be inline");
+ if (!publicp)
+ error ("cannot declare `::main' to be static");
+ if (!same_type_p (TREE_TYPE (TREE_TYPE (decl)),
+ integer_type_node))
+ error ("`main' must return `int'");
inlinep = 0;
publicp = 1;
}
/* Members of anonymous types and local classes have no linkage; make
them internal. */
- if (ctype && (ANON_AGGRNAME_P (TYPE_IDENTIFIER (ctype))
- || hack_decl_function_context (TYPE_MAIN_DECL (ctype))))
+ /* FIXME what if it gets a name from typedef? */
+ if (ctype && (TYPE_ANONYMOUS_P (ctype)
+ || decl_function_context (TYPE_MAIN_DECL (ctype))))
publicp = 0;
if (publicp)
@@ -8842,16 +8882,22 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
t = no_linkage_check (TREE_TYPE (decl));
if (t)
{
- if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
+ if (TYPE_ANONYMOUS_P (t))
{
- if (DECL_LANGUAGE (decl) == lang_c)
+ if (DECL_EXTERN_C_P (decl))
/* Allow this; it's pretty common in C. */;
else
- cp_pedwarn ("non-local function `%#D' uses anonymous type",
- decl);
+ {
+ pedwarn ("non-local function `%#D' uses anonymous type",
+ decl);
+ if (DECL_ORIGINAL_TYPE (TYPE_NAME (t)))
+ cp_pedwarn_at ("\
+`%#D' does not refer to the unqualified type, so it is not used for linkage",
+ TYPE_NAME (t));
+ }
}
else
- cp_pedwarn ("non-local function `%#D' uses local type `%T'",
+ pedwarn ("non-local function `%#D' uses local type `%T'",
decl, t);
}
}
@@ -8863,21 +8909,26 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
DECL_NOT_REALLY_EXTERN (decl) = 1;
}
+ /* If the declaration was declared inline, mark it as such. */
if (inlinep)
- DECL_THIS_INLINE (decl) = DECL_INLINE (decl) = 1;
+ DECL_DECLARED_INLINE_P (decl) = 1;
+ /* We inline functions that are explicitly declared inline, or, when
+ the user explicitly asks us to, all functions. */
+ if (DECL_DECLARED_INLINE_P (decl) || flag_inline_trees == 2)
+ DECL_INLINE (decl) = 1;
DECL_EXTERNAL (decl) = 1;
if (quals != NULL_TREE && TREE_CODE (type) == FUNCTION_TYPE)
{
- cp_error ("%smember function `%D' cannot have `%T' method qualifier",
+ error ("%smember function `%D' cannot have `%T' method qualifier",
(ctype ? "static " : "non-"), decl, TREE_VALUE (quals));
quals = NULL_TREE;
}
if (IDENTIFIER_OPNAME_P (DECL_NAME (decl)))
- grok_op_properties (decl, virtualp, check < 0);
+ grok_op_properties (decl, friendp);
- if (ctype && hack_decl_function_context (decl))
+ if (ctype && decl_function_context (decl))
DECL_NO_STATIC_CHAIN (decl) = 1;
for (t = TYPE_ARG_TYPES (TREE_TYPE (decl)); t; t = TREE_CHAIN (t))
@@ -8892,15 +8943,18 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
&& TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR)
{
if (funcdef_flag)
- cp_error
+ error
("defining explicit specialization `%D' in friend declaration",
orig_declarator);
else
{
+ tree fns = TREE_OPERAND (orig_declarator, 0);
+ tree args = TREE_OPERAND (orig_declarator, 1);
+
if (PROCESSING_REAL_TEMPLATE_DECL_P ())
{
/* Something like `template <class T> friend void f<T>()'. */
- cp_error ("template-id `%D' in declaration of primary template",
+ error ("invalid use of template-id `%D' in declaration of primary template",
orig_declarator);
return NULL_TREE;
}
@@ -8909,21 +8963,33 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
/* A friend declaration of the form friend void f<>(). Record
the information in the TEMPLATE_ID_EXPR. */
SET_DECL_IMPLICIT_INSTANTIATION (decl);
- DECL_TEMPLATE_INFO (decl)
- = perm_tree_cons (TREE_OPERAND (orig_declarator, 0),
- TREE_OPERAND (orig_declarator, 1),
- NULL_TREE);
+
+ if (TREE_CODE (fns) == COMPONENT_REF)
+ {
+ /* Due to bison parser ickiness, we will have already looked
+ up an operator_name or PFUNCNAME within the current class
+ (see template_id in parse.y). If the current class contains
+ such a name, we'll get a COMPONENT_REF here. Undo that. */
+
+ my_friendly_assert (TREE_TYPE (TREE_OPERAND (fns, 0))
+ == current_class_type, 20001120);
+ fns = TREE_OPERAND (fns, 1);
+ }
+ my_friendly_assert (TREE_CODE (fns) == IDENTIFIER_NODE
+ || TREE_CODE (fns) == LOOKUP_EXPR
+ || TREE_CODE (fns) == OVERLOAD, 20001120);
+ DECL_TEMPLATE_INFO (decl) = tree_cons (fns, args, NULL_TREE);
if (has_default_arg)
{
- cp_error ("default arguments are not allowed in declaration of friend template specialization `%D'",
+ error ("default arguments are not allowed in declaration of friend template specialization `%D'",
decl);
return NULL_TREE;
}
if (inlinep)
{
- cp_error ("`inline' is not allowed in declaration of friend template specialization `%D'",
+ error ("`inline' is not allowed in declaration of friend template specialization `%D'",
decl);
return NULL_TREE;
}
@@ -8933,120 +8999,85 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
if (has_default_arg)
add_defarg_fn (decl);
- /* Plain overloading: will not be grok'd by grokclassfn. */
- if (! ctype && ! processing_template_decl
- && DECL_LANGUAGE (decl) != lang_c
- && (! DECL_USE_TEMPLATE (decl) || name_mangling_version < 1))
- set_mangled_name_for_decl (decl);
-
if (funcdef_flag)
/* Make the init_value nonzero so pushdecl knows this is not
tentative. error_mark_node is replaced later with the BLOCK. */
DECL_INITIAL (decl) = error_mark_node;
+ if (TYPE_NOTHROW_P (type) || nothrow_libfn_p (decl))
+ TREE_NOTHROW (decl) = 1;
+
/* Caller will do the rest of this. */
if (check < 0)
return decl;
- if (check && funcdef_flag)
- DECL_INITIAL (decl) = error_mark_node;
+ if (flags == NO_SPECIAL && ctype && constructor_name (ctype) == declarator)
+ DECL_CONSTRUCTOR_P (decl) = 1;
- if (flags == NO_SPECIAL && ctype && constructor_name (cname) == declarator)
- {
- tree tmp;
- /* Just handle constructors here. We could do this
- inside the following if stmt, but I think
- that the code is more legible by breaking this
- case out. See comments below for what each of
- the following calls is supposed to do. */
- DECL_CONSTRUCTOR_P (decl) = 1;
+ /* Function gets the ugly name, field gets the nice one. This call
+ may change the type of the function (because of default
+ parameters)! */
+ if (ctype != NULL_TREE)
+ grokclassfn (ctype, decl, flags, quals);
- grokclassfn (ctype, decl, flags, quals);
+ decl = check_explicit_specialization (orig_declarator, decl,
+ template_count,
+ 2 * (funcdef_flag != 0) +
+ 4 * (friendp != 0));
+ if (decl == error_mark_node)
+ return NULL_TREE;
- decl = check_explicit_specialization (orig_declarator, decl,
- template_count,
- 2 * (funcdef_flag != 0) +
- 4 * (friendp != 0));
+ if (ctype != NULL_TREE
+ && (! TYPE_FOR_JAVA (ctype) || check_java_method (decl))
+ && check)
+ {
+ tree old_decl;
- if (decl == error_mark_node)
- return NULL_TREE;
+ old_decl = check_classfn (ctype, decl);
- maybe_vlist_ctor_wrapper (decl, funcdef_flag);
+ if (old_decl && TREE_CODE (old_decl) == TEMPLATE_DECL)
+ /* Because grokfndecl is always supposed to return a
+ FUNCTION_DECL, we pull out the DECL_TEMPLATE_RESULT
+ here. We depend on our callers to figure out that its
+ really a template that's being returned. */
+ old_decl = DECL_TEMPLATE_RESULT (old_decl);
- if ((! TYPE_FOR_JAVA (ctype) || check_java_method (decl))
- && check)
+ if (old_decl && DECL_STATIC_FUNCTION_P (old_decl)
+ && TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
{
- tmp = check_classfn (ctype, decl);
+ /* Remove the `this' parm added by grokclassfn.
+ XXX Isn't this done in start_function, too? */
+ revert_static_member_fn (decl);
+ last_function_parms = TREE_CHAIN (last_function_parms);
+ }
+ if (old_decl && DECL_ARTIFICIAL (old_decl))
+ error ("definition of implicitly-declared `%D'", old_decl);
- if (tmp && TREE_CODE (tmp) == TEMPLATE_DECL)
- tmp = DECL_TEMPLATE_RESULT(tmp);
+ if (old_decl)
+ {
+ /* Since we've smashed OLD_DECL to its
+ DECL_TEMPLATE_RESULT, we must do the same to DECL. */
+ if (TREE_CODE (decl) == TEMPLATE_DECL)
+ decl = DECL_TEMPLATE_RESULT (decl);
- if (tmp && DECL_ARTIFICIAL (tmp))
- cp_error ("definition of implicitly-declared `%D'", tmp);
- if (tmp && duplicate_decls (decl, tmp))
- return tmp;
+ /* Attempt to merge the declarations. This can fail, in
+ the case of some illegal specialization declarations. */
+ if (!duplicate_decls (decl, old_decl))
+ error ("no `%#D' member function declared in class `%T'",
+ decl, ctype);
+ return old_decl;
}
- if (! grok_ctor_properties (ctype, decl))
- return NULL_TREE;
}
- else
- {
- tree tmp;
-
- /* Function gets the ugly name, field gets the nice one.
- This call may change the type of the function (because
- of default parameters)! */
- if (ctype != NULL_TREE)
- grokclassfn (ctype, decl, flags, quals);
-
- decl = check_explicit_specialization (orig_declarator, decl,
- template_count,
- 2 * (funcdef_flag != 0) +
- 4 * (friendp != 0));
- if (decl == error_mark_node)
- return NULL_TREE;
- if (ctype != NULL_TREE
- && (! TYPE_FOR_JAVA (ctype) || check_java_method (decl))
- && check)
- {
- tmp = check_classfn (ctype, decl);
+ if (DECL_CONSTRUCTOR_P (decl) && !grok_ctor_properties (ctype, decl))
+ return NULL_TREE;
- if (tmp && TREE_CODE (tmp) == TEMPLATE_DECL)
- tmp = DECL_TEMPLATE_RESULT (tmp);
-
- if (tmp && DECL_STATIC_FUNCTION_P (tmp)
- && TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
- {
- /* Remove the `this' parm added by grokclassfn.
- XXX Isn't this done in start_function, too? */
- revert_static_member_fn (&decl, NULL, NULL);
- last_function_parms = TREE_CHAIN (last_function_parms);
- }
- if (tmp && DECL_ARTIFICIAL (tmp))
- cp_error ("definition of implicitly-declared `%D'", tmp);
- if (tmp)
- {
- /* Attempt to merge the declarations. This can fail, in
- the case of some illegal specialization declarations. */
- if (!duplicate_decls (decl, tmp))
- cp_error ("no `%#D' member function declared in class `%T'",
- decl, ctype);
- return tmp;
- }
- }
+ if (ctype == NULL_TREE || check)
+ return decl;
- if (ctype == NULL_TREE || check)
- return decl;
+ if (virtualp)
+ DECL_VIRTUAL_P (decl) = 1;
- if (virtualp)
- {
- DECL_VIRTUAL_P (decl) = 1;
- if (DECL_VINDEX (decl) == NULL_TREE)
- DECL_VINDEX (decl) = error_mark_node;
- IDENTIFIER_VIRTUAL_P (DECL_NAME (decl)) = 1;
- }
- }
return decl;
}
@@ -9070,10 +9101,8 @@ grokvardecl (type, declarator, specbits_in, initialized, constp, in_namespace)
can be initialized, the code will reach here. */
tree basetype = TYPE_OFFSET_BASETYPE (type);
type = TREE_TYPE (type);
- decl = build_lang_field_decl (VAR_DECL, declarator, type);
+ decl = build_lang_decl (VAR_DECL, declarator, type);
DECL_CONTEXT (decl) = basetype;
- DECL_CLASS_CONTEXT (decl) = basetype;
- DECL_ASSEMBLER_NAME (decl) = build_static_name (basetype, declarator);
}
else
{
@@ -9086,14 +9115,26 @@ grokvardecl (type, declarator, specbits_in, initialized, constp, in_namespace)
else
context = NULL_TREE;
- decl = build_decl (VAR_DECL, declarator, complete_type (type));
+ /* For namespace-scope variables, declared in a template, we
+ need the full lang_decl. The same is true for
+ namespace-scope variables that do not have C++ language
+ linkage. */
+ if (context
+ && (processing_template_decl
+ || current_lang_name != lang_name_cplusplus))
+ decl = build_lang_decl (VAR_DECL, declarator, type);
+ else
+ decl = build_decl (VAR_DECL, declarator, type);
if (context)
set_decl_namespace (decl, context, 0);
context = DECL_CONTEXT (decl);
if (declarator && context && current_lang_name != lang_name_c)
- DECL_ASSEMBLER_NAME (decl) = build_static_name (context, declarator);
+ /* We can't mangle lazily here because we don't have any
+ way to recover whether or not a variable was `extern
+ "C"' later. */
+ mangle_decl (decl);
}
if (in_namespace)
@@ -9138,10 +9179,10 @@ grokvardecl (type, declarator, specbits_in, initialized, constp, in_namespace)
tree t = no_linkage_check (TREE_TYPE (decl));
if (t)
{
- if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
+ if (TYPE_ANONYMOUS_P (t))
/* Ignore for now; `enum { foo } e' is pretty common. */;
else
- cp_pedwarn ("non-local variable `%#D' uses local type `%T'",
+ pedwarn ("non-local variable `%#D' uses local type `%T'",
decl, t);
}
}
@@ -9158,7 +9199,10 @@ build_ptrmemfunc_type (type)
{
tree fields[4];
tree t;
- tree u;
+ tree unqualified_variant = NULL_TREE;
+
+ if (type == error_mark_node)
+ return type;
/* If a canonical type already exists for this type, use it. We use
this method instead of type_hash_canon, because it only does a
@@ -9167,40 +9211,46 @@ build_ptrmemfunc_type (type)
if ((t = TYPE_GET_PTRMEMFUNC_TYPE (type)))
return t;
- push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type));
-
- u = make_lang_type (UNION_TYPE);
- SET_IS_AGGR_TYPE (u, 0);
- fields[0] = build_lang_field_decl (FIELD_DECL, pfn_identifier, type);
- fields[1] = build_lang_field_decl (FIELD_DECL, delta2_identifier,
- delta_type_node);
- finish_builtin_type (u, "__ptrmemfunc_type", fields, 1, ptr_type_node);
- TYPE_NAME (u) = NULL_TREE;
-
- t = make_lang_type (RECORD_TYPE);
+ /* Make sure that we always have the unqualified pointer-to-member
+ type first. */
+ if (cp_type_quals (type) != TYPE_UNQUALIFIED)
+ unqualified_variant
+ = build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type));
+ t = make_aggr_type (RECORD_TYPE);
/* Let the front-end know this is a pointer to member function... */
TYPE_PTRMEMFUNC_FLAG (t) = 1;
/* ... and not really an aggregate. */
SET_IS_AGGR_TYPE (t, 0);
- fields[0] = build_lang_field_decl (FIELD_DECL, delta_identifier,
- delta_type_node);
- fields[1] = build_lang_field_decl (FIELD_DECL, index_identifier,
- delta_type_node);
- fields[2] = build_lang_field_decl (FIELD_DECL, pfn_or_delta2_identifier, u);
- finish_builtin_type (t, "__ptrmemfunc_type", fields, 2, ptr_type_node);
-
- pop_obstacks ();
+ fields[0] = build_decl (FIELD_DECL, pfn_identifier, type);
+ fields[1] = build_decl (FIELD_DECL, delta_identifier,
+ delta_type_node);
+ finish_builtin_type (t, "__ptrmemfunc_type", fields, 1, ptr_type_node);
/* Zap out the name so that the back-end will give us the debugging
information for this anonymous RECORD_TYPE. */
TYPE_NAME (t) = NULL_TREE;
+ /* If this is not the unqualified form of this pointer-to-member
+ type, set the TYPE_MAIN_VARIANT for this type to be the
+ unqualified type. Since they are actually RECORD_TYPEs that are
+ not variants of each other, we must do this manually. */
+ if (cp_type_quals (type) != TYPE_UNQUALIFIED)
+ {
+ t = build_qualified_type (t, cp_type_quals (type));
+ TYPE_MAIN_VARIANT (t) = unqualified_variant;
+ TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (unqualified_variant);
+ TYPE_NEXT_VARIANT (unqualified_variant) = t;
+ }
+
+ /* Cache this pointer-to-member type so that we can find it again
+ later. */
TYPE_SET_PTRMEMFUNC_TYPE (type, t);
/* Seems to be wanted. */
CLASSTYPE_GOT_SEMICOLON (t) = 1;
+
return t;
}
@@ -9222,7 +9272,7 @@ check_static_variable_definition (decl, type)
required. */
if (CLASS_TYPE_P (type) || TREE_CODE (type) == REFERENCE_TYPE)
{
- cp_error ("in-class initialization of static data member of non-integral type `%T'",
+ error ("invalid in-class initialization of static data member of non-integral type `%T'",
type);
/* If we just return the declaration, crashes will sometimes
occur. We therefore return void_type_node, as if this was a
@@ -9231,14 +9281,268 @@ check_static_variable_definition (decl, type)
return 1;
}
else if (!CP_TYPE_CONST_P (type))
- cp_error ("ANSI C++ forbids in-class initialization of non-const static member `%D'",
+ error ("ISO C++ forbids in-class initialization of non-const static member `%D'",
decl);
else if (pedantic && !INTEGRAL_TYPE_P (type))
- cp_pedwarn ("ANSI C++ forbids initialization of member constant `%D' of non-integral type `%T'", decl, type);
+ pedwarn ("ISO C++ forbids initialization of member constant `%D' of non-integral type `%T'", decl, type);
return 0;
}
+/* Given the SIZE (i.e., number of elements) in an array, compute an
+ appropriate index type for the array. If non-NULL, NAME is the
+ name of the thing being declared. */
+
+tree
+compute_array_index_type (name, size)
+ tree name;
+ tree size;
+{
+ tree itype;
+
+ /* If this involves a template parameter, it will be a constant at
+ instantiation time, but we don't know what the value is yet.
+ Even if no template parameters are involved, we may an expression
+ that is not a constant; we don't even simplify `1 + 2' when
+ processing a template. */
+ if (processing_template_decl)
+ {
+ /* Resolve a qualified reference to an enumerator or static
+ const data member of ours. */
+ if (TREE_CODE (size) == SCOPE_REF
+ && TREE_OPERAND (size, 0) == current_class_type)
+ {
+ tree t = lookup_field (current_class_type,
+ TREE_OPERAND (size, 1), 0, 0);
+ if (t)
+ size = t;
+ }
+
+ return build_index_type (build_min (MINUS_EXPR, sizetype,
+ size, integer_one_node));
+ }
+
+ /* The size might be the result of a cast. */
+ STRIP_TYPE_NOPS (size);
+
+ /* It might be a const variable or enumeration constant. */
+ size = decl_constant_value (size);
+
+ /* The array bound must be an integer type. */
+ if (TREE_CODE (TREE_TYPE (size)) != INTEGER_TYPE
+ && TREE_CODE (TREE_TYPE (size)) != ENUMERAL_TYPE
+ && TREE_CODE (TREE_TYPE (size)) != BOOLEAN_TYPE)
+ {
+ if (name)
+ error ("size of array `%D' has non-integer type", name);
+ else
+ error ("size of array has non-integer type");
+ size = integer_one_node;
+ }
+
+ /* Normally, the array-bound will be a constant. */
+ if (TREE_CODE (size) == INTEGER_CST)
+ {
+ /* Check to see if the array bound overflowed. Make that an
+ error, no matter how generous we're being. */
+ int old_flag_pedantic_errors = flag_pedantic_errors;
+ int old_pedantic = pedantic;
+ pedantic = flag_pedantic_errors = 1;
+ constant_expression_warning (size);
+ pedantic = old_pedantic;
+ flag_pedantic_errors = old_flag_pedantic_errors;
+
+ /* An array must have a positive number of elements. */
+ if (INT_CST_LT (size, integer_zero_node))
+ {
+ if (name)
+ error ("size of array `%D' is negative", name);
+ else
+ error ("size of array is negative");
+ size = integer_one_node;
+ }
+ /* Except that an extension we allow zero-sized arrays. We
+ always allow them in system headers because glibc uses
+ them. */
+ else if (integer_zerop (size) && pedantic && !in_system_header)
+ {
+ if (name)
+ pedwarn ("ISO C++ forbids zero-size array `%D'", name);
+ else
+ pedwarn ("ISO C++ forbids zero-size array");
+ }
+ }
+ else if (TREE_CONSTANT (size))
+ {
+ /* `(int) &fn' is not a valid array bound. */
+ if (name)
+ error ("size of array `%D' is not an integral constant-expression",
+ name);
+ else
+ error ("size of array is not an integral constant-expression");
+ }
+
+ /* Compute the index of the largest element in the array. It is
+ one less than the number of elements in the array. */
+ itype
+ = fold (cp_build_binary_op (MINUS_EXPR,
+ cp_convert (ssizetype, size),
+ cp_convert (ssizetype,
+ integer_one_node)));
+
+ /* Check for variable-sized arrays. We allow such things as an
+ extension, even though they are not allowed in ANSI/ISO C++. */
+ if (!TREE_CONSTANT (itype))
+ {
+ if (pedantic)
+ {
+ if (name)
+ pedwarn ("ISO C++ forbids variable-size array `%D'",
+ name);
+ else
+ pedwarn ("ISO C++ forbids variable-size array");
+ }
+
+ /* Create a variable-sized array index type. */
+ itype = variable_size (itype);
+ }
+ /* Make sure that there was no overflow when creating to a signed
+ index type. (For example, on a 32-bit machine, an array with
+ size 2^32 - 1 is too big.) */
+ else if (TREE_OVERFLOW (itype))
+ {
+ error ("overflow in array dimension");
+ TREE_OVERFLOW (itype) = 0;
+ }
+
+ /* Create and return the appropriate index type. */
+ return build_index_type (itype);
+}
+
+/* Returns an ARRAY_TYPE for an array with SIZE elements of the
+ indicated TYPE. If non-NULL, NAME is the NAME of the declaration
+ with this type. */
+
+static tree
+create_array_type_for_decl (name, type, size)
+ tree name;
+ tree type;
+ tree size;
+{
+ tree itype = NULL_TREE;
+ const char* error_msg;
+
+ /* If things have already gone awry, bail now. */
+ if (type == error_mark_node || size == error_mark_node)
+ return error_mark_node;
+
+ /* Assume that everything will go OK. */
+ error_msg = NULL;
+
+ /* There are some types which cannot be array elements. */
+ switch (TREE_CODE (type))
+ {
+ case VOID_TYPE:
+ error_msg = "array of void";
+ break;
+
+ case FUNCTION_TYPE:
+ error_msg = "array of functions";
+ break;
+
+ case REFERENCE_TYPE:
+ error_msg = "array of references";
+ break;
+
+ case OFFSET_TYPE:
+ error_msg = "array of data members";
+ break;
+
+ case METHOD_TYPE:
+ error_msg = "array of function members";
+ break;
+
+ default:
+ break;
+ }
+
+ /* If something went wrong, issue an error-message and return. */
+ if (error_msg)
+ {
+ if (name)
+ error ("declaration of `%D' as %s", name, error_msg);
+ else
+ error ("creating %s", error_msg);
+
+ return error_mark_node;
+ }
+
+ /* [dcl.array]
+
+ The constant expressions that specify the bounds of the arrays
+ can be omitted only for the first member of the sequence. */
+ if (TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type))
+ {
+ if (name)
+ error ("declaration of `%D' as multidimensional array must have bounds for all dimensions except the first",
+ name);
+ else
+ error ("multidimensional array must have bounds for all dimensions except the first");
+
+ return error_mark_node;
+ }
+
+ /* Figure out the index type for the array. */
+ if (size)
+ itype = compute_array_index_type (name, size);
+
+ return build_cplus_array_type (type, itype);
+}
+
+/* Check that it's OK to declare a function with the indicated TYPE.
+ SFK indicates the kind of special function (if any) that this
+ function is. OPTYPE is the type given in a conversion operator
+ declaration. Returns the actual return type of the function; that
+ may be different than TYPE if an error occurs, or for certain
+ special functions. */
+
+static tree
+check_special_function_return_type (sfk, type, optype)
+ special_function_kind sfk;
+ tree type;
+ tree optype;
+{
+ switch (sfk)
+ {
+ case sfk_constructor:
+ if (type)
+ error ("return type specification for constructor invalid");
+
+ type = void_type_node;
+ break;
+
+ case sfk_destructor:
+ if (type)
+ error ("return type specification for destructor invalid");
+ type = void_type_node;
+ break;
+
+ case sfk_conversion:
+ if (type && !same_type_p (type, optype))
+ error ("operator `%T' declared to return `%T'", optype, type);
+ else if (type)
+ pedwarn ("return type specified for `operator %T'", optype);
+ type = optype;
+ break;
+
+ default:
+ abort ();
+ break;
+ }
+
+ return type;
+}
+
/* Given declspecs and a declarator,
determine the name and type of the object declared
and construct a ..._DECL node for it.
@@ -9266,10 +9570,11 @@ check_static_variable_definition (decl, type)
BITFIELD for a field with specified width.
INITIALIZED is 1 if the decl has an initializer.
- ATTRLIST is a TREE_LIST node with prefix attributes in TREE_VALUE and
- normal attributes in TREE_PURPOSE, or NULL_TREE.
+ ATTRLIST is a pointer to the list of attributes, which may be NULL
+ if there are none; *ATTRLIST may be modified if attributes from inside
+ the declarator should be applied to the declaration.
- In the TYPENAME case, DECLARATOR is really an absolute declarator.
+ In the TYPENAME case, DECLARATOR is really an abstract declarator.
It may also be so in the PARM case, for a prototype where the
argument type is specified but not the name.
@@ -9293,20 +9598,19 @@ check_static_variable_definition (decl, type)
is erroneous, NULL_TREE is returned.
QUALS is used only for FUNCDEF and MEMFUNCDEF cases. For a member
- function, these are the qualifiers to give to the `this' pointer.
+ function, these are the qualifiers to give to the `this' pointer. We
+ apply TYPE_QUAL_RESTRICT to the this ptr, not the object.
May return void_type_node if the declarator turned out to be a friend.
See grokfield for details. */
-enum return_types { return_normal, return_ctor, return_dtor, return_conversion };
-
tree
grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
tree declspecs;
tree declarator;
enum decl_context decl_context;
int initialized;
- tree attrlist;
+ tree *attrlist;
{
RID_BIT_TYPE specbits;
int nclasses = 0;
@@ -9321,16 +9625,17 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
int explicit_int = 0;
int explicit_char = 0;
int defaulted_int = 0;
- int opaque_typedef = 0;
+ int extern_langp = 0;
+
tree typedef_decl = NULL_TREE;
- char *name;
+ const char *name;
tree typedef_type = NULL_TREE;
int funcdef_flag = 0;
enum tree_code innermost_code = ERROR_MARK;
int bitfield = 0;
#if 0
/* See the code below that used this. */
- tree decl_machine_attr = NULL_TREE;
+ tree decl_attr = NULL_TREE;
#endif
/* Set this to error_mark_node for FIELD_DECLs we could not handle properly.
All FIELD_DECLs we build here have `init' put into their DECL_INITIAL. */
@@ -9339,7 +9644,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
/* Keep track of what sort of function is being processed
so that we can warn about default return values, or explicit
return values which do not match prescribed defaults. */
- enum return_types return_type = return_normal;
+ special_function_kind sfk = sfk_none;
tree dname = NULL_TREE;
tree ctype = current_class_type;
@@ -9349,8 +9654,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
tree raises = NULL_TREE;
int template_count = 0;
tree in_namespace = NULL_TREE;
- tree inner_attrs;
- int ignore_attrs;
+ tree returned_attrs = NULL_TREE;
RIDBIT_RESET_ALL (specbits);
if (decl_context == FUNCDEF)
@@ -9389,7 +9693,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
my_friendly_assert (flags == NO_SPECIAL, 152);
flags = DTOR_FLAG;
- return_type = return_dtor;
+ sfk = sfk_destructor;
if (TREE_CODE (name) == TYPE_DECL)
TREE_OPERAND (decl, 0) = name = constructor_name (name);
my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 153);
@@ -9416,7 +9720,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (rename)
{
- cp_error ("destructor `%T' must match class name `%T'",
+ error ("destructor `%T' must match class name `%T'",
name, rename);
TREE_OPERAND (decl, 0) = rename;
}
@@ -9434,31 +9738,30 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
break;
case CALL_EXPR:
- if (parmlist_is_exprlist (TREE_OPERAND (decl, 1)))
+ if (parmlist_is_exprlist (CALL_DECLARATOR_PARMS (decl)))
{
/* This is actually a variable declaration using
constructor syntax. We need to call start_decl and
cp_finish_decl so we can get the variable
initialized... */
- tree attributes, prefix_attributes;
+ tree attributes;
*next = TREE_OPERAND (decl, 0);
- init = TREE_OPERAND (decl, 1);
+ init = CALL_DECLARATOR_PARMS (decl);
if (attrlist)
{
- attributes = TREE_PURPOSE (attrlist);
- prefix_attributes = TREE_VALUE (attrlist);
+ attributes = *attrlist;
}
else
{
attributes = NULL_TREE;
- prefix_attributes = NULL_TREE;
}
decl = start_decl (declarator, declspecs, 1,
- attributes, prefix_attributes);
+ attributes, NULL_TREE);
+ decl_type_access_control (decl);
if (decl)
{
/* Look for __unused__ attribute */
@@ -9467,7 +9770,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
finish_decl (decl, init, NULL_TREE);
}
else
- cp_error ("invalid declarator");
+ error ("invalid declarator");
return 0;
}
innermost_code = TREE_CODE (decl);
@@ -9487,12 +9790,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
&& decl != NULL_TREE && flags != DTOR_FLAG
&& decl == constructor_name (ctype))
{
- return_type = return_ctor;
+ sfk = sfk_constructor;
ctor_return_type = ctype;
}
ctype = NULL_TREE;
break;
-
+
case TEMPLATE_ID_EXPR:
{
tree fns = TREE_OPERAND (decl, 0);
@@ -9518,26 +9821,26 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
next = 0;
- if (is_rid (dname))
+ if (C_IS_RESERVED_WORD (dname))
{
- cp_error ("declarator-id missing; using reserved word `%D'",
+ error ("declarator-id missing; using reserved word `%D'",
dname);
name = IDENTIFIER_POINTER (dname);
}
- if (! IDENTIFIER_OPNAME_P (dname)
- /* GNU/Linux headers use '__op'. Arrgh. */
- || (IDENTIFIER_TYPENAME_P (dname) && ! TREE_TYPE (dname)))
+ else if (!IDENTIFIER_TYPENAME_P (dname))
name = IDENTIFIER_POINTER (dname);
else
{
- if (IDENTIFIER_TYPENAME_P (dname))
- {
- my_friendly_assert (flags == NO_SPECIAL, 154);
- flags = TYPENAME_FLAG;
- ctor_return_type = TREE_TYPE (dname);
- return_type = return_conversion;
- }
- name = operator_name_string (dname);
+ my_friendly_assert (flags == NO_SPECIAL, 154);
+ flags = TYPENAME_FLAG;
+ ctor_return_type = TREE_TYPE (dname);
+ sfk = sfk_conversion;
+ if (IDENTIFIER_GLOBAL_VALUE (dname)
+ && (TREE_CODE (IDENTIFIER_GLOBAL_VALUE (dname))
+ == TYPE_DECL))
+ name = IDENTIFIER_POINTER (dname);
+ else
+ name = "<invalid operator>";
}
break;
@@ -9562,11 +9865,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
&& TREE_CODE (TREE_OPERAND (decl, 1)) == INDIRECT_REF)
ctype = cname;
else if (TREE_CODE (cname) == TEMPLATE_TYPE_PARM
- || TREE_CODE (cname) == TEMPLATE_TEMPLATE_PARM)
+ || TREE_CODE (cname) == BOUND_TEMPLATE_TEMPLATE_PARM)
{
- cp_error ("`%T::%D' is not a valid declarator", cname,
+ error ("`%T::%D' is not a valid declarator", cname,
TREE_OPERAND (decl, 1));
- cp_error (" perhaps you want `typename %T::%D' to make it a type",
+ error (" perhaps you want `typename %T::%D' to make it a type",
cname, TREE_OPERAND (decl, 1));
return void_type_node;
}
@@ -9578,7 +9881,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
{
if (! UNIQUELY_DERIVED_FROM_P (cname, ctype))
{
- cp_error ("type `%T' is not derived from type `%T'",
+ error ("type `%T' is not derived from type `%T'",
cname, ctype);
TREE_OPERAND (decl, 0) = NULL_TREE;
}
@@ -9599,7 +9902,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (TREE_CODE (decl) == IDENTIFIER_NODE
&& constructor_name (ctype) == decl)
{
- return_type = return_ctor;
+ sfk = sfk_constructor;
ctor_return_type = ctype;
}
else if (TREE_CODE (decl) == BIT_NOT_EXPR
@@ -9607,7 +9910,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
&& (constructor_name (ctype) == TREE_OPERAND (decl, 0)
|| constructor_name_full (ctype) == TREE_OPERAND (decl, 0)))
{
- return_type = return_dtor;
+ sfk = sfk_destructor;
ctor_return_type = ctype;
flags = DTOR_FLAG;
TREE_OPERAND (decl, 0) = constructor_name (ctype);
@@ -9624,9 +9927,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
case TYPE_DECL:
/* Parse error puts this typespec where
a declarator should go. */
- cp_error ("`%T' specified as declarator-id", DECL_NAME (decl));
+ error ("`%T' specified as declarator-id", DECL_NAME (decl));
if (TREE_TYPE (decl) == current_class_type)
- cp_error (" perhaps you want `%T' for a constructor",
+ error (" perhaps you want `%T' for a constructor",
current_class_name);
dname = DECL_NAME (decl);
name = IDENTIFIER_POINTER (dname);
@@ -9634,19 +9937,15 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
/* Avoid giving two errors for this. */
IDENTIFIER_CLASS_VALUE (dname) = NULL_TREE;
- declspecs = temp_tree_cons (NULL_TREE, integer_type_node,
- declspecs);
+ declspecs = tree_cons (NULL_TREE, integer_type_node, declspecs);
*next = dname;
next = 0;
break;
default:
- cp_compiler_error ("`%D' as declarator", decl);
- return 0; /* We used to do a 155 abort here. */
+ internal_error ("`%D' as declarator", decl);
}
}
- if (name == NULL)
- name = "type name";
}
/* A function definition's declarator must have the form of
@@ -9659,7 +9958,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
&& innermost_code != CALL_EXPR
&& ! (ctype && declspecs == NULL_TREE))
{
- cp_error ("declaration of `%D' as non-function", dname);
+ error ("declaration of `%D' as non-function", dname);
return void_type_node;
}
@@ -9677,8 +9976,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
We also want to avoid calling this a PARM if it is in a namespace. */
- if (decl_context == NORMAL && ! namespace_bindings_p ()
- && ! pseudo_global_level_p ())
+ if (decl_context == NORMAL && !toplevel_bindings_p ())
{
struct binding_level *b = current_binding_level;
current_binding_level = b->level_chain;
@@ -9687,6 +9985,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
current_binding_level = b;
}
+ if (name == NULL)
+ name = decl_context == PARM ? "parameter" : "type name";
+
/* Look through the decl specs and record which ones appear.
Some typespecs are defined as built-in typenames.
Others, the ones that are modifiers of other types,
@@ -9716,6 +10017,14 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
id = TREE_VALUE (spec);
+ /* If the entire declaration is itself tagged as deprecated then
+ suppress reports of deprecated items. */
+ if (!adding_implicit_members && id && TREE_DEPRECATED (id))
+ {
+ if (deprecated_state != DEPRECATED_SUPPRESS)
+ warn_deprecated_use (id);
+ }
+
if (TREE_CODE (id) == IDENTIFIER_NODE)
{
if (id == ridpointers[(int) RID_INT]
@@ -9728,7 +10037,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (id == ridpointers[(int) RID_BOOL])
error ("`bool' is now a keyword");
else
- cp_error ("extraneous `%T' ignored", id);
+ error ("extraneous `%T' ignored", id);
}
else
{
@@ -9744,7 +10053,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (IDENTIFIER_HAS_TYPE_VALUE (id))
{
if (type)
- cp_error ("multiple declarations `%T' and `%T'", type, id);
+ error ("multiple declarations `%T' and `%T'", type, id);
else
type = IDENTIFIER_TYPE_VALUE (id);
goto found;
@@ -9757,7 +10066,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (i == (int) RID_LONG && RIDBIT_SETP (i, specbits))
{
if (pedantic && ! in_system_header && warn_long_long)
- pedwarn ("ANSI C++ does not support `long long'");
+ pedwarn ("ISO C++ does not support `long long'");
if (longlong)
error ("`long long long' is too long for GCC");
else
@@ -9765,16 +10074,20 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
}
else if (RIDBIT_SETP (i, specbits))
pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id));
+ if (i == (int)RID_EXTERN
+ && TREE_PURPOSE (spec) == error_mark_node)
+ /* This extern was part of a language linkage. */
+ extern_langp = 1;
RIDBIT_SET (i, specbits);
goto found;
}
}
}
/* C++ aggregate types. */
- else if (TREE_CODE (id) == TYPE_DECL || TREE_CODE (id) == TEMPLATE_DECL)
+ else if (TREE_CODE (id) == TYPE_DECL)
{
if (type)
- cp_error ("multiple declarations `%T' and `%T'", type,
+ error ("multiple declarations `%T' and `%T'", type,
TREE_TYPE (id));
else
{
@@ -9796,7 +10109,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
type = TREE_TYPE (t);
#if 0
/* See the code below that used this. */
- decl_machine_attr = DECL_MACHINE_ATTRIBUTES (id);
+ decl_attr = DECL_ATTRIBUTES (id);
#endif
typedef_decl = t;
}
@@ -9811,10 +10124,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
typedef_type = type;
/* No type at all: default to `int', and set DEFAULTED_INT
- because it was not a user-defined typedef.
- Except when we have a `typedef' inside a signature, in
- which case the type defaults to `unknown type' and is
- instantiated when assigning to a signature pointer or ref. */
+ because it was not a user-defined typedef. */
if (type == NULL_TREE
&& (RIDBIT_SETP (RID_SIGNED, specbits)
@@ -9827,67 +10137,49 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
defaulted_int = 1;
}
- if (type == NULL_TREE)
+ if (sfk != sfk_none)
+ type = check_special_function_return_type (sfk, type,
+ ctor_return_type);
+ else if (type == NULL_TREE)
{
+ int is_main;
+
explicit_int = -1;
- if (return_type == return_dtor)
- type = void_type_node;
- else if (return_type == return_ctor)
- type = build_pointer_type (ctor_return_type);
- else if (return_type == return_conversion)
- type = ctor_return_type;
- else if (current_class_type
- && IS_SIGNATURE (current_class_type)
- && RIDBIT_SETP (RID_TYPEDEF, specbits)
- && (decl_context == FIELD || decl_context == NORMAL))
- {
- explicit_int = 0;
- opaque_typedef = 1;
- type = copy_node (opaque_type_node);
- }
- else
- {
- /* We handle `main' specially here, because 'main () { }' is so
- common. With no options, it is allowed. With -Wreturn-type,
- it is a warning. It is only an error with -pedantic-errors. */
- int is_main = (funcdef_flag
- && MAIN_NAME_P (dname)
- && ctype == NULL_TREE
- && in_namespace == NULL_TREE
- && current_namespace == global_namespace);
- if (in_system_header)
- /* Allow it, sigh. */;
- else if (pedantic || ! is_main)
- cp_pedwarn ("ANSI C++ forbids declaration `%D' with no type",
- dname);
- else if (warn_return_type)
- cp_warning ("ANSI C++ forbids declaration `%D' with no type",
- dname);
+ /* We handle `main' specially here, because 'main () { }' is so
+ common. With no options, it is allowed. With -Wreturn-type,
+ it is a warning. It is only an error with -pedantic-errors. */
+ is_main = (funcdef_flag
+ && dname && MAIN_NAME_P (dname)
+ && ctype == NULL_TREE
+ && in_namespace == NULL_TREE
+ && current_namespace == global_namespace);
+
+ if (in_system_header || flag_ms_extensions)
+ /* Allow it, sigh. */;
+ else if (pedantic || ! is_main)
+ pedwarn ("ISO C++ forbids declaration of `%s' with no type",
+ name);
+ else if (warn_return_type)
+ warning ("ISO C++ forbids declaration of `%s' with no type",
+ name);
- type = integer_type_node;
- }
- }
- else if (return_type == return_dtor)
- {
- error ("return type specification for destructor invalid");
- type = void_type_node;
- }
- else if (return_type == return_ctor)
- {
- error ("return type specification for constructor invalid");
- type = build_pointer_type (ctor_return_type);
+ type = integer_type_node;
}
- else if (return_type == return_conversion)
+
+ if (type && TREE_CODE (type) == TYPENAME_TYPE && TREE_TYPE (type))
{
- if (!same_type_p (type, ctor_return_type))
- cp_error ("operator `%T' declared to return `%T'",
- ctor_return_type, type);
- else
- cp_pedwarn ("return type specified for `operator %T'",
- ctor_return_type);
+ /* The implicit typename extension is deprecated and will be
+ removed. Warn about its use now. */
+ warning ("`%T' is implicitly a typename", type);
+ cp_deprecated ("implicit typename");
- type = ctor_return_type;
+ /* Now remove its implicitness, so that we don't warn again.
+ For instance this might be a typedef, and we do not want to
+ warn on uses of the typedef itself. Simply clearing the
+ TREE_TYPE is insufficient. */
+ type = copy_node (type);
+ TREE_TYPE (type) = NULL_TREE;
}
ctype = NULL_TREE;
@@ -9901,8 +10193,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
&& TYPE_MAIN_VARIANT (type) == double_type_node)
{
RIDBIT_RESET (RID_LONG, specbits);
- type = build_qualified_type (long_double_type_node,
- CP_TYPE_QUALS (type));
+ type = build_qualified_type (long_double_type_node,
+ cp_type_quals (type));
}
/* Check all other uses of type modifiers. */
@@ -9965,14 +10257,24 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
/* Decide whether an integer type is signed or not.
Optionally treat bitfields as signed by default. */
if (RIDBIT_SETP (RID_UNSIGNED, specbits)
- || (bitfield && ! flag_signed_bitfields
- && (explicit_int || defaulted_int || explicit_char
- /* A typedef for plain `int' without `signed'
- can be controlled just like plain `int'. */
- || ! (typedef_decl != NULL_TREE
- && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)))
- && TREE_CODE (type) != ENUMERAL_TYPE
- && RIDBIT_NOTSETP (RID_SIGNED, specbits)))
+ /* [class.bit]
+
+ It is implementation-defined whether a plain (neither
+ explicitly signed or unsigned) char, short, int, or long
+ bit-field is signed or unsigned.
+
+ Naturally, we extend this to long long as well. Note that
+ this does not include wchar_t. */
+ || (bitfield && !flag_signed_bitfields
+ && RIDBIT_NOTSETP (RID_SIGNED, specbits)
+ /* A typedef for plain `int' without `signed' can be
+ controlled just like plain `int', but a typedef for
+ `signed int' cannot be so controlled. */
+ && !(typedef_decl
+ && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl))
+ && (TREE_CODE (type) == INTEGER_TYPE
+ || TREE_CODE (type) == CHAR_TYPE)
+ && !same_type_p (TYPE_MAIN_VARIANT (type), wchar_type_node)))
{
if (longlong)
type = long_long_unsigned_type_node;
@@ -10022,11 +10324,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
type = build_complex_type (type);
}
- if (return_type == return_conversion
+ if (sfk == sfk_conversion
&& (RIDBIT_SETP (RID_CONST, specbits)
|| RIDBIT_SETP (RID_VOLATILE, specbits)
|| RIDBIT_SETP (RID_RESTRICT, specbits)))
- cp_error ("qualifiers are not allowed on declaration of `operator %T'",
+ error ("qualifiers are not allowed on declaration of `operator %T'",
ctor_return_type);
/* Set CONSTP if this declaration is `const', whether by
@@ -10034,9 +10336,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
Likewise for VOLATILEP. */
constp = !! RIDBIT_SETP (RID_CONST, specbits) + CP_TYPE_CONST_P (type);
- restrictp =
+ restrictp =
!! RIDBIT_SETP (RID_RESTRICT, specbits) + CP_TYPE_RESTRICT_P (type);
- volatilep =
+ volatilep =
!! RIDBIT_SETP (RID_VOLATILE, specbits) + CP_TYPE_VOLATILE_P (type);
type_quals = ((constp ? TYPE_QUAL_CONST : 0)
| (restrictp ? TYPE_QUAL_RESTRICT : 0)
@@ -10054,37 +10356,19 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (virtualp && staticp == 2)
{
- cp_error ("member `%D' cannot be declared both virtual and static",
+ error ("member `%D' cannot be declared both virtual and static",
dname);
staticp = 0;
}
friendp = RIDBIT_SETP (RID_FRIEND, specbits);
RIDBIT_RESET (RID_FRIEND, specbits);
- /* $7.1.2, Function specifiers */
- if (friendp && explicitp)
- error ("only declarations of constructors can be `explicit'");
-
- if (RIDBIT_SETP (RID_MUTABLE, specbits))
- {
- if (decl_context == PARM)
- {
- error ("non-member `%s' cannot be declared `mutable'", name);
- RIDBIT_RESET (RID_MUTABLE, specbits);
- }
- else if (friendp || decl_context == TYPENAME)
- {
- error ("non-object member `%s' cannot be declared `mutable'", name);
- RIDBIT_RESET (RID_MUTABLE, specbits);
- }
- }
-
/* Warn if two storage classes are given. Default to `auto'. */
if (RIDBIT_ANY_SET (specbits))
{
if (RIDBIT_SETP (RID_STATIC, specbits)) nclasses++;
- if (RIDBIT_SETP (RID_EXTERN, specbits)) nclasses++;
+ if (RIDBIT_SETP (RID_EXTERN, specbits) && !extern_langp) nclasses++;
if (decl_context == PARM && nclasses > 0)
error ("storage class specifiers invalid in parameter declarations");
if (RIDBIT_SETP (RID_TYPEDEF, specbits))
@@ -10095,6 +10379,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
}
if (RIDBIT_SETP (RID_AUTO, specbits)) nclasses++;
if (RIDBIT_SETP (RID_REGISTER, specbits)) nclasses++;
+ if (!nclasses && !friendp && extern_langp)
+ nclasses++;
}
/* Give error if `virtual' is used outside of class declaration. */
@@ -10104,49 +10390,13 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
error ("virtual outside class declaration");
virtualp = 0;
}
- if (current_class_name == NULL_TREE && RIDBIT_SETP (RID_MUTABLE, specbits))
- {
- error ("only members can be declared mutable");
- RIDBIT_RESET (RID_MUTABLE, specbits);
- }
/* Static anonymous unions are dealt with here. */
if (staticp && decl_context == TYPENAME
&& TREE_CODE (declspecs) == TREE_LIST
- && ANON_UNION_TYPE_P (TREE_VALUE (declspecs)))
+ && ANON_AGGR_TYPE_P (TREE_VALUE (declspecs)))
decl_context = FIELD;
- /* Give error if `const,' `volatile,' `inline,' `friend,' or `virtual'
- is used in a signature member function declaration. */
- if (decl_context == FIELD
- && IS_SIGNATURE (current_class_type)
- && RIDBIT_NOTSETP (RID_TYPEDEF, specbits))
- {
- if (type_quals != TYPE_UNQUALIFIED)
- {
- error ("type qualifiers specified for signature member function `%s'", name);
- type_quals = TYPE_UNQUALIFIED;
- }
- if (inlinep)
- {
- error ("`inline' specified for signature member function `%s'", name);
- /* Later, we'll make signature member functions inline. */
- inlinep = 0;
- }
- if (friendp)
- {
- error ("`friend' declaration in signature definition");
- friendp = 0;
- }
- if (virtualp)
- {
- error ("`virtual' specified for signature member function `%s'",
- name);
- /* Later, we'll make signature member functions virtual. */
- virtualp = 0;
- }
- }
-
/* Warn about storage classes that are invalid for certain
kinds of declarations (parameters, typenames, etc.). */
@@ -10161,11 +10411,10 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
else if (RIDBIT_SETP (RID_TYPEDEF, specbits))
;
else if (decl_context == FIELD
- && ! IS_SIGNATURE (current_class_type)
- /* C++ allows static class elements */
- && RIDBIT_SETP (RID_STATIC, specbits))
- /* C++ also allows inlines and signed and unsigned elements,
- but in those cases we don't come in here. */
+ /* C++ allows static class elements */
+ && RIDBIT_SETP (RID_STATIC, specbits))
+ /* C++ also allows inlines and signed and unsigned elements,
+ but in those cases we don't come in here. */
;
else
{
@@ -10176,34 +10425,36 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (declarator)
{
- /* Avoid trying to get an operand off an identifier node. */
+ /* Avoid trying to get an operand off an identifier node. */
if (TREE_CODE (declarator) == IDENTIFIER_NODE)
tmp = declarator;
else
tmp = TREE_OPERAND (declarator, 0);
op = IDENTIFIER_OPNAME_P (tmp);
+ if (IDENTIFIER_TYPENAME_P (tmp))
+ {
+ if (IDENTIFIER_GLOBAL_VALUE (tmp)
+ && (TREE_CODE (IDENTIFIER_GLOBAL_VALUE (tmp))
+ == TYPE_DECL))
+ name = IDENTIFIER_POINTER (tmp);
+ else
+ name = "<invalid operator>";
+ }
}
error ("storage class specified for %s `%s'",
- IS_SIGNATURE (current_class_type)
- ? (op
- ? "signature member operator"
- : "signature member function")
- : (op ? "member operator" : "field"),
- op ? operator_name_string (tmp) : name);
+ op ? "member operator" : "field",
+ name);
}
else
- error (((decl_context == PARM || decl_context == CATCHPARM)
- ? "storage class specified for parameter `%s'"
- : "storage class specified for typename"), name);
+ {
+ if (decl_context == PARM || decl_context == CATCHPARM)
+ error ("storage class specified for parameter `%s'", name);
+ else
+ error ("storage class specified for typename");
+ }
RIDBIT_RESET (RID_REGISTER, specbits);
RIDBIT_RESET (RID_AUTO, specbits);
RIDBIT_RESET (RID_EXTERN, specbits);
-
- if (decl_context == FIELD && IS_SIGNATURE (current_class_type))
- {
- RIDBIT_RESET (RID_STATIC, specbits);
- staticp = 0;
- }
}
}
else if (RIDBIT_SETP (RID_EXTERN, specbits) && initialized && !funcdef_flag)
@@ -10234,9 +10485,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
Descend through it, creating more complex types, until we reach
the declared identifier (or NULL_TREE, in an absolute declarator). */
- inner_attrs = NULL_TREE;
- ignore_attrs = 0;
-
while (declarator && TREE_CODE (declarator) != IDENTIFIER_NODE
&& TREE_CODE (declarator) != TEMPLATE_ID_EXPR)
{
@@ -10278,220 +10526,70 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (ctype != NULL_TREE)
{
tree dummy = build_decl (TYPE_DECL, NULL_TREE, type);
- ctype = grok_method_quals (ctype, dummy, quals);
+ grok_method_quals (ctype, dummy, quals);
type = TREE_TYPE (dummy);
+ ctype = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (type)));
quals = NULL_TREE;
}
}
- /* See the comment for the TREE_LIST case, below. */
- if (ignore_attrs)
- ignore_attrs = 0;
- else if (inner_attrs)
- {
- decl_attributes (type, inner_attrs, NULL_TREE);
- inner_attrs = NULL_TREE;
- }
-
switch (TREE_CODE (declarator))
{
case TREE_LIST:
{
/* We encode a declarator with embedded attributes using
- a TREE_LIST. The attributes apply to the declarator
- directly inside them, so we have to skip an iteration
- before applying them to the type. If the declarator just
- inside is the declarator-id, we apply the attrs to the
- decl itself. */
- inner_attrs = TREE_PURPOSE (declarator);
- ignore_attrs = 1;
+ a TREE_LIST. */
+ tree attrs = TREE_PURPOSE (declarator);
+ tree inner_decl;
+ int attr_flags;
+
declarator = TREE_VALUE (declarator);
+ inner_decl = declarator;
+ while (inner_decl != NULL_TREE
+ && TREE_CODE (inner_decl) == TREE_LIST)
+ inner_decl = TREE_VALUE (inner_decl);
+ attr_flags = 0;
+ if (inner_decl == NULL_TREE
+ || TREE_CODE (inner_decl) == IDENTIFIER_NODE)
+ attr_flags |= (int) ATTR_FLAG_DECL_NEXT;
+ if (TREE_CODE (inner_decl) == CALL_EXPR)
+ attr_flags |= (int) ATTR_FLAG_FUNCTION_NEXT;
+ if (TREE_CODE (inner_decl) == ARRAY_REF)
+ attr_flags |= (int) ATTR_FLAG_ARRAY_NEXT;
+ returned_attrs = decl_attributes (&type,
+ chainon (returned_attrs, attrs),
+ attr_flags);
}
break;
case ARRAY_REF:
{
- register tree itype = NULL_TREE;
- register tree size = TREE_OPERAND (declarator, 1);
- /* The index is a signed object `sizetype' bits wide. */
- tree index_type = signed_type (sizetype);
-
- declarator = TREE_OPERAND (declarator, 0);
+ register tree size;
- /* Check for some types that there cannot be arrays of. */
-
- if (TREE_CODE (type) == VOID_TYPE)
- {
- cp_error ("declaration of `%D' as array of voids", dname);
- type = error_mark_node;
- }
-
- if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- cp_error ("declaration of `%D' as array of functions", dname);
- type = error_mark_node;
- }
-
- /* ARM $8.4.3: Since you can't have a pointer to a reference,
- you can't have arrays of references. If we allowed them,
- then we'd be saying x[i] is valid for an array x, but
- then you'd have to ask: what does `*(x + i)' mean? */
- if (TREE_CODE (type) == REFERENCE_TYPE)
- {
- if (decl_context == TYPENAME)
- cp_error ("cannot make arrays of references");
- else
- cp_error ("declaration of `%D' as array of references",
- dname);
- type = error_mark_node;
- }
-
- if (TREE_CODE (type) == OFFSET_TYPE)
- {
- cp_error ("declaration of `%D' as array of data members",
- dname);
- type = error_mark_node;
- }
-
- if (TREE_CODE (type) == METHOD_TYPE)
- {
- cp_error ("declaration of `%D' as array of function members",
- dname);
- type = error_mark_node;
- }
-
- if (size == error_mark_node)
- type = error_mark_node;
- else if (TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type))
- {
- /* [dcl.array]
-
- the constant expressions that specify the bounds of
- the arrays can be omitted only for the first member
- of the sequence. */
- cp_error ("declaration of `%D' as multidimensional array",
- dname);
- cp_error ("must have bounds for all dimensions except the first");
- type = error_mark_node;
- }
-
- if (type == error_mark_node)
- continue;
+ size = TREE_OPERAND (declarator, 1);
/* VC++ spells a zero-sized array with []. */
if (size == NULL_TREE && decl_context == FIELD && ! staticp
&& ! RIDBIT_SETP (RID_TYPEDEF, specbits))
size = integer_zero_node;
- if (size)
- {
- /* Must suspend_momentary here because the index
- type may need to live until the end of the function.
- For example, it is used in the declaration of a
- variable which requires destructing at the end of
- the function; then build_vec_delete will need this
- value. */
- int yes = suspend_momentary ();
- /* Might be a cast. */
- if (TREE_CODE (size) == NOP_EXPR
- && TREE_TYPE (size) == TREE_TYPE (TREE_OPERAND (size, 0)))
- size = TREE_OPERAND (size, 0);
-
- /* If this involves a template parameter, it will be a
- constant at instantiation time, but we don't know
- what the value is yet. Even if no template
- parameters are involved, we may an expression that
- is not a constant; we don't even simplify `1 + 2'
- when processing a template. */
- if (processing_template_decl)
- {
- /* Resolve a qualified reference to an enumerator or
- static const data member of ours. */
- if (TREE_CODE (size) == SCOPE_REF
- && TREE_OPERAND (size, 0) == current_class_type)
- {
- tree t = lookup_field (current_class_type,
- TREE_OPERAND (size, 1), 0, 0);
- if (t)
- size = t;
- }
-
- itype = build_index_type (build_min
- (MINUS_EXPR, sizetype, size, integer_one_node));
- goto dont_grok_size;
- }
-
- if (TREE_CODE (TREE_TYPE (size)) != INTEGER_TYPE
- && TREE_CODE (TREE_TYPE (size)) != ENUMERAL_TYPE
- && TREE_CODE (TREE_TYPE (size)) != BOOLEAN_TYPE)
- {
- cp_error ("size of array `%D' has non-integer type",
- dname);
- size = integer_one_node;
- }
- if (TREE_READONLY_DECL_P (size))
- size = decl_constant_value (size);
- if (pedantic && integer_zerop (size))
- cp_pedwarn ("ANSI C++ forbids zero-size array `%D'", dname);
- if (TREE_CONSTANT (size))
- {
- int old_flag_pedantic_errors = flag_pedantic_errors;
- int old_pedantic = pedantic;
- pedantic = flag_pedantic_errors = 1;
- /* Always give overflow errors on array subscripts. */
- constant_expression_warning (size);
- pedantic = old_pedantic;
- flag_pedantic_errors = old_flag_pedantic_errors;
- if (INT_CST_LT (size, integer_zero_node))
- {
- cp_error ("size of array `%D' is negative", dname);
- size = integer_one_node;
- }
- }
- else
- {
- if (pedantic)
- {
- if (dname)
- cp_pedwarn ("ANSI C++ forbids variable-size array `%D'",
- dname);
- else
- cp_pedwarn ("ANSI C++ forbids variable-size array");
- }
- }
+ declarator = TREE_OPERAND (declarator, 0);
- itype
- = fold (build_binary_op (MINUS_EXPR,
- cp_convert (index_type, size),
- cp_convert (index_type,
- integer_one_node)));
- if (! TREE_CONSTANT (itype))
- itype = variable_size (itype);
- else if (TREE_OVERFLOW (itype))
- {
- error ("overflow in array dimension");
- TREE_OVERFLOW (itype) = 0;
- }
+ type = create_array_type_for_decl (dname, type, size);
- /* If we're a parm, we need to have a permanent type so
- mangling checks for re-use will work right. If both the
- element and index types are permanent, the array type
- will be, too. */
- if (decl_context == PARM
- && allocation_temporary_p () && TREE_PERMANENT (type))
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- itype = build_index_type (itype);
- pop_obstacks ();
- }
- else
- itype = build_index_type (itype);
-
- dont_grok_size:
- resume_momentary (yes);
+ /* VLAs never work as fields. */
+ if (decl_context == FIELD && !processing_template_decl
+ && TREE_CODE (type) == ARRAY_TYPE
+ && TYPE_DOMAIN (type) != NULL_TREE
+ && !TREE_CONSTANT (TYPE_MAX_VALUE (TYPE_DOMAIN (type))))
+ {
+ error ("size of member `%D' is not constant", dname);
+ /* Proceed with arbitrary constant size, so that offset
+ computations don't get confused. */
+ type = create_array_type_for_decl (dname, TREE_TYPE (type),
+ integer_one_node);
}
- type = build_cplus_array_type (type, itype);
ctype = NULL_TREE;
}
break;
@@ -10500,7 +10598,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
{
tree arg_types;
int funcdecl_p;
- tree inner_parms = TREE_OPERAND (declarator, 1);
+ tree inner_parms = CALL_DECLARATOR_PARMS (declarator);
tree inner_decl = TREE_OPERAND (declarator, 0);
/* Declaring a function type.
@@ -10526,30 +10624,30 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (inner_decl && TREE_CODE (inner_decl) == SCOPE_REF)
inner_decl = TREE_OPERAND (inner_decl, 1);
- if (inner_decl && TREE_CODE (inner_decl) == TEMPLATE_ID_EXPR)
+ if (inner_decl && TREE_CODE (inner_decl) == TEMPLATE_ID_EXPR)
inner_decl = dname;
/* Pick up type qualifiers which should be applied to `this'. */
- quals = TREE_OPERAND (declarator, 2);
+ quals = CALL_DECLARATOR_QUALS (declarator);
/* Pick up the exception specifications. */
- raises = TREE_TYPE (declarator);
+ raises = CALL_DECLARATOR_EXCEPTION_SPEC (declarator);
/* Say it's a definition only for the CALL_EXPR
closest to the identifier. */
funcdecl_p
- = inner_decl
+ = inner_decl
&& (TREE_CODE (inner_decl) == IDENTIFIER_NODE
- || TREE_CODE (inner_decl) == TEMPLATE_ID_EXPR
+ || TREE_CODE (inner_decl) == TEMPLATE_ID_EXPR
|| TREE_CODE (inner_decl) == BIT_NOT_EXPR);
-
+
if (ctype == NULL_TREE
&& decl_context == FIELD
&& funcdecl_p
&& (friendp == 0 || dname == current_class_name))
ctype = current_class_type;
- if (ctype && return_type == return_conversion)
+ if (ctype && sfk == sfk_conversion)
TYPE_HAS_CONVERSION (ctype) = 1;
if (ctype && constructor_name (ctype) == dname)
{
@@ -10560,21 +10658,22 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (flags == DTOR_FLAG)
{
- /* ANSI C++ June 5 1992 WP 12.4.1. A destructor may
- not be declared const or volatile. A destructor
- may not be static. */
+ /* ISO C++ 12.4/2. A destructor may not be
+ declared const or volatile. A destructor may
+ not be static. */
if (staticp == 2)
error ("destructor cannot be static member function");
if (quals)
{
- cp_error ("destructors may not be `%s'",
+ error ("destructors may not be `%s'",
IDENTIFIER_POINTER (TREE_VALUE (quals)));
quals = NULL_TREE;
}
if (decl_context == FIELD)
{
- if (! member_function_or_else (ctype, current_class_type,
- "destructor for alien class `%s' cannot be a member"))
+ if (! member_function_or_else (ctype,
+ current_class_type,
+ flags))
return void_type_node;
}
}
@@ -10582,9 +10681,10 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
{
if (explicitp == 1)
explicitp = 2;
- /* ANSI C++ June 5 1992 WP 12.1.2. A constructor may
- not be declared const or volatile. A constructor may
- not be virtual. A constructor may not be static. */
+ /* ISO C++ 12.1. A constructor may not be
+ declared const or volatile. A constructor may
+ not be virtual. A constructor may not be
+ static. */
if (staticp == 2)
error ("constructor cannot be static member function");
if (virtualp)
@@ -10594,32 +10694,26 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
}
if (quals)
{
- cp_error ("constructors may not be `%s'",
+ error ("constructors may not be `%s'",
IDENTIFIER_POINTER (TREE_VALUE (quals)));
quals = NULL_TREE;
- }
+ }
{
RID_BIT_TYPE tmp_bits;
- bcopy ((void*)&specbits, (void*)&tmp_bits, sizeof (RID_BIT_TYPE));
+ memcpy (&tmp_bits, &specbits, sizeof (RID_BIT_TYPE));
RIDBIT_RESET (RID_INLINE, tmp_bits);
RIDBIT_RESET (RID_STATIC, tmp_bits);
if (RIDBIT_ANY_SET (tmp_bits))
error ("return value type specifier for constructor ignored");
}
- type = build_pointer_type (ctype);
- if (decl_context == FIELD
- && IS_SIGNATURE (current_class_type))
- {
- error ("constructor not allowed in signature");
- return void_type_node;
- }
- else if (decl_context == FIELD)
+ if (decl_context == FIELD)
{
- if (! member_function_or_else (ctype, current_class_type,
- "constructor for alien class `%s' cannot be member"))
+ if (! member_function_or_else (ctype,
+ current_class_type,
+ flags))
return void_type_node;
TYPE_HAS_CONSTRUCTOR (ctype) = 1;
- if (return_type != return_ctor)
+ if (sfk != sfk_constructor)
return NULL_TREE;
}
}
@@ -10640,7 +10734,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (decl_context == NORMAL)
error ("friend declaration not in class definition");
if (current_function_decl && funcdef_flag)
- cp_error ("can't define friend function `%s' in a local class definition",
+ error ("can't define friend function `%s' in a local class definition",
name);
}
@@ -10652,7 +10746,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
/* FIXME: This is where default args should be fully
processed. */
- arg_types = grokparms (inner_parms, funcdecl_p ? funcdef_flag : 0);
+ arg_types = grokparms (inner_parms);
if (declarator && flags == DTOR_FLAG)
{
@@ -10661,13 +10755,10 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
want the underlying IDENTIFIER. */
if (TREE_CODE (declarator) == BIT_NOT_EXPR)
declarator = TREE_OPERAND (declarator, 0);
-
- if (strict_prototype == 0 && arg_types == NULL_TREE)
- arg_types = void_list_node;
- else if (arg_types == NULL_TREE
- || arg_types != void_list_node)
+
+ if (arg_types != void_list_node)
{
- cp_error ("destructors may not have parameters");
+ error ("destructors may not have parameters");
arg_types = void_list_node;
last_function_parms = NULL_TREE;
}
@@ -10708,7 +10799,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
&& (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE
|| TREE_CODE (TREE_TYPE (type)) == REFERENCE_TYPE))
{
- cp_error ("cannot declare pointer to `%#T' member",
+ error ("cannot declare pointer to `%#T' member",
TREE_TYPE (type));
type = TREE_TYPE (type);
}
@@ -10720,31 +10811,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
but to the target of the pointer. */
type_quals = TYPE_UNQUALIFIED;
- if (IS_SIGNATURE (type))
- {
- if (TREE_CODE (declarator) == ADDR_EXPR)
- {
- if (CLASSTYPE_METHOD_VEC (type) == NULL_TREE
- && TYPE_SIZE (type))
- cp_warning ("empty signature `%T' used in signature reference declaration",
- type);
-#if 0
- type = build_signature_reference_type (type);
-#else
- sorry ("signature reference");
- return NULL_TREE;
-#endif
- }
- else
- {
- if (CLASSTYPE_METHOD_VEC (type) == NULL_TREE
- && TYPE_SIZE (type))
- cp_warning ("empty signature `%T' used in signature pointer declaration",
- type);
- type = build_signature_pointer_type (type);
- }
- }
- else if (TREE_CODE (declarator) == ADDR_EXPR)
+ if (TREE_CODE (declarator) == ADDR_EXPR)
{
if (TREE_CODE (type) == VOID_TYPE)
error ("invalid type: `void &'");
@@ -10858,7 +10925,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
TREE_COMPLEXITY (declarator) = current_class_depth;
}
else
- my_friendly_abort (16);
+ abort ();
if (TREE_OPERAND (declarator, 0) == NULL_TREE)
{
@@ -10872,16 +10939,26 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
ctype = TREE_OPERAND (declarator, 0);
t = ctype;
- while (t != NULL_TREE && CLASS_TYPE_P (t))
+ while (t != NULL_TREE && CLASS_TYPE_P (t))
{
- if (CLASSTYPE_TEMPLATE_INFO (t) &&
- !CLASSTYPE_TEMPLATE_SPECIALIZATION (t))
+ /* You're supposed to have one `template <...>'
+ for every template class, but you don't need one
+ for a full specialization. For example:
+
+ template <class T> struct S{};
+ template <> struct S<int> { void f(); };
+ void S<int>::f () {}
+
+ is correct; there shouldn't be a `template <>' for
+ the definition of `S<int>::f'. */
+ if (CLASSTYPE_TEMPLATE_INFO (t)
+ && (CLASSTYPE_TEMPLATE_INSTANTIATION (t)
+ || uses_template_parms (CLASSTYPE_TI_ARGS (t)))
+ && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)))
template_count += 1;
+
t = TYPE_MAIN_DECL (t);
- if (DECL_LANG_SPECIFIC (t))
- t = DECL_CLASS_CONTEXT (t);
- else
- t = NULL_TREE;
+ t = DECL_CONTEXT (t);
}
if (sname == NULL_TREE)
@@ -10901,24 +10978,23 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
Is this ill-formed? */
if (pedantic)
- cp_pedwarn ("extra qualification `%T::' on member `%s' ignored",
+ pedwarn ("extra qualification `%T::' on member `%s' ignored",
ctype, name);
}
else if (TREE_CODE (type) == FUNCTION_TYPE)
{
- if (current_class_type == NULL_TREE
- || friendp)
+ if (current_class_type == NULL_TREE || friendp)
type = build_cplus_method_type (ctype, TREE_TYPE (type),
TYPE_ARG_TYPES (type));
else
{
- cp_error ("cannot declare member function `%T::%s' within `%T'",
+ error ("cannot declare member function `%T::%s' within `%T'",
ctype, name, current_class_type);
return void_type_node;
}
}
else if (RIDBIT_SETP (RID_TYPEDEF, specbits)
- || TYPE_SIZE (complete_type (ctype)) != NULL_TREE)
+ || COMPLETE_TYPE_P (complete_type (ctype)))
{
/* Have to move this code elsewhere in this function.
this code is used for i.e., typedef int A::M; M *pm;
@@ -10927,29 +11003,22 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (current_class_type)
{
- cp_error ("cannot declare member `%T::%s' within `%T'",
+ error ("cannot declare member `%T::%s' within `%T'",
ctype, name, current_class_type);
return void_type_node;
}
type = build_offset_type (ctype, type);
}
- else if (uses_template_parms (ctype))
- {
- if (TREE_CODE (type) == FUNCTION_TYPE)
- type
- = build_cplus_method_type (ctype, TREE_TYPE (type),
- TYPE_ARG_TYPES (type));
- }
else
- {
- cp_error ("structure `%T' not yet defined", ctype);
- return error_mark_node;
+ {
+ incomplete_type_error (NULL_TREE, ctype);
+ return error_mark_node;
}
declarator = sname;
}
else if (TREE_CODE (sname) == SCOPE_REF)
- my_friendly_abort (17);
+ abort ();
else
{
done_scoping:
@@ -10984,41 +11053,68 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
break;
default:
- my_friendly_abort (158);
+ abort ();
}
}
- /* See the comment for the TREE_LIST case, above. */
- if (inner_attrs)
+ if (returned_attrs)
{
- if (! ignore_attrs)
- decl_attributes (type, inner_attrs, NULL_TREE);
- else if (attrlist)
- TREE_VALUE (attrlist) = chainon (inner_attrs, TREE_VALUE (attrlist));
+ if (attrlist)
+ *attrlist = chainon (returned_attrs, *attrlist);
else
- attrlist = build_decl_list (NULL_TREE, inner_attrs);
+ attrlist = &returned_attrs;
}
/* Now TYPE has the actual type. */
- if (explicitp == 1)
+ /* Did array size calculations overflow? */
+
+ if (TREE_CODE (type) == ARRAY_TYPE
+ && COMPLETE_TYPE_P (type)
+ && TREE_OVERFLOW (TYPE_SIZE (type)))
+ {
+ error ("size of array `%s' is too large", name);
+ /* If we proceed with the array type as it is, we'll eventually
+ crash in tree_low_cst(). */
+ type = error_mark_node;
+ }
+
+ if (explicitp == 1 || (explicitp && friendp))
{
- error ("only constructors can be declared `explicit'");
+ /* [dcl.fct.spec] The explicit specifier shall only be used in
+ declarations of constructors within a class definition. */
+ error ("only declarations of constructors can be `explicit'");
explicitp = 0;
}
if (RIDBIT_SETP (RID_MUTABLE, specbits))
{
- if (type_quals & TYPE_QUAL_CONST)
+ if (current_class_name == NULL_TREE || decl_context == PARM || friendp)
+ {
+ error ("non-member `%s' cannot be declared `mutable'", name);
+ RIDBIT_RESET (RID_MUTABLE, specbits);
+ }
+ else if (decl_context == TYPENAME || RIDBIT_SETP (RID_TYPEDEF, specbits))
{
- error ("const `%s' cannot be declared `mutable'", name);
+ error ("non-object member `%s' cannot be declared `mutable'", name);
RIDBIT_RESET (RID_MUTABLE, specbits);
}
+ else if (TREE_CODE (type) == FUNCTION_TYPE
+ || TREE_CODE (type) == METHOD_TYPE)
+ {
+ error ("function `%s' cannot be declared `mutable'", name);
+ RIDBIT_RESET (RID_MUTABLE, specbits);
+ }
else if (staticp)
{
error ("static `%s' cannot be declared `mutable'", name);
RIDBIT_RESET (RID_MUTABLE, specbits);
}
+ else if (type_quals & TYPE_QUAL_CONST)
+ {
+ error ("const `%s' cannot be declared `mutable'", name);
+ RIDBIT_RESET (RID_MUTABLE, specbits);
+ }
}
if (declarator == NULL_TREE
@@ -11029,12 +11125,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
/* OK */;
else if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR)
{
- cp_error ("template-id `%D' used as a declarator", declarator);
+ error ("template-id `%D' used as a declarator", declarator);
declarator = dname;
}
else
/* Unexpected declarator format. */
- my_friendly_abort (990210);
+ abort ();
/* If this is declaring a typedef name, return a TYPE_DECL. */
@@ -11050,38 +11146,31 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (decl_context == FIELD)
{
if (declarator == constructor_name (current_class_type))
- cp_pedwarn ("ANSI C++ forbids nested type `%D' with same name as enclosing class",
+ pedwarn ("ISO C++ forbids nested type `%D' with same name as enclosing class",
declarator);
decl = build_lang_decl (TYPE_DECL, declarator, type);
- if (IS_SIGNATURE (current_class_type) && opaque_typedef)
- SIGNATURE_HAS_OPAQUE_TYPEDECLS (current_class_type) = 1;
}
else
{
- /* Make sure this typedef lives as long as its type,
- since it might be used as a template parameter. */
- if (type != error_mark_node)
- push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type));
decl = build_decl (TYPE_DECL, declarator, type);
- if (type != error_mark_node)
- pop_obstacks ();
+ if (!current_function_decl)
+ DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
}
-
- /* If the user declares "struct {...} foo" then `foo' will have
- an anonymous name. Fill that name in now. Nothing can
- refer to it, so nothing needs know about the name change.
- The TYPE_NAME field was filled in by build_struct_xref. */
+
+ /* If the user declares "typedef struct {...} foo" then the
+ struct will have an anonymous name. Fill that name in now.
+ Nothing can refer to it, so nothing needs know about the name
+ change. */
if (type != error_mark_node
+ && declarator
&& TYPE_NAME (type)
&& TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && ANON_AGGRNAME_P (TYPE_IDENTIFIER (type)))
+ && TYPE_ANONYMOUS_P (type)
+ && cp_type_quals (type) == TYPE_UNQUALIFIED)
{
tree oldname = TYPE_NAME (type);
tree t;
- /* FIXME: This is bogus; we should not be doing this for
- cv-qualified types. */
-
/* Replace the anonymous name with the real name everywhere. */
lookup_tag_reverse (type, declarator);
for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
@@ -11095,23 +11184,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
type is a (non-primary) template. The name for the
template needs updating as well. */
if (TYPE_LANG_SPECIFIC (type) && CLASSTYPE_TEMPLATE_INFO (type))
- DECL_NAME (CLASSTYPE_TI_TEMPLATE (type))
+ DECL_NAME (CLASSTYPE_TI_TEMPLATE (type))
= TYPE_IDENTIFIER (type);
- /* XXX Temporarily set the scope.
- When returning, start_decl expects it as NULL_TREE,
- and will then then set it using pushdecl. */
- my_friendly_assert (DECL_CONTEXT (decl) == NULL_TREE, 980404);
- if (current_class_type)
- DECL_CONTEXT (decl) = current_class_type;
- else
- DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
-
- DECL_ASSEMBLER_NAME (decl) = DECL_NAME (decl);
- DECL_ASSEMBLER_NAME (decl)
- = get_identifier (build_overload_name (type, 1, 1));
- DECL_CONTEXT (decl) = NULL_TREE;
-
/* FIXME remangle member functions; member functions of a
type with external linkage have external linkage. */
}
@@ -11126,7 +11201,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (ctype == NULL_TREE)
{
if (TREE_CODE (type) != METHOD_TYPE)
- cp_error_at ("invalid type qualifier for non-method type", decl);
+ cp_error_at ("invalid type qualifier for non-member function type", decl);
else
ctype = TYPE_METHOD_BASETYPE (type);
}
@@ -11138,9 +11213,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
|| (typedef_decl && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)))
C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1;
- if (RIDBIT_SETP (RID_MUTABLE, specbits))
- error ("non-object member `%s' cannot be declared mutable", name);
-
bad_specifiers (decl, "type", virtualp, quals != NULL_TREE,
inlinep, friendp, raises != NULL_TREE);
@@ -11156,12 +11228,33 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
a distinct type, so that each identifier's size can be
controlled separately by its own initializer. */
- if (type == typedef_type && TREE_CODE (type) == ARRAY_TYPE
- && TYPE_DOMAIN (type) == NULL_TREE)
+ if (type != 0 && typedef_type != 0
+ && TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == 0
+ && TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (typedef_type))
{
type = build_cplus_array_type (TREE_TYPE (type), TYPE_DOMAIN (type));
}
+ /* Detect where we're using a typedef of function type to declare a
+ function. last_function_parms will not be set, so we must create
+ it now. */
+
+ if (type == typedef_type && TREE_CODE (type) == FUNCTION_TYPE)
+ {
+ tree decls = NULL_TREE;
+ tree args;
+
+ for (args = TYPE_ARG_TYPES (type); args; args = TREE_CHAIN (args))
+ {
+ tree decl = build_decl (PARM_DECL, NULL_TREE, TREE_VALUE (args));
+
+ TREE_CHAIN (decl) = decls;
+ decls = decl;
+ }
+
+ last_function_parms = nreverse (decls);
+ }
+
/* If this is a type name (such as, in a cast or sizeof),
compute the type and return it now. */
@@ -11170,48 +11263,72 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
/* Note that the grammar rejects storage classes
in typenames, fields or parameters. */
if (type_quals != TYPE_UNQUALIFIED)
- {
- if (IS_SIGNATURE (type))
- error ("type qualifiers specified for signature type");
- type_quals = TYPE_UNQUALIFIED;
- }
+ type_quals = TYPE_UNQUALIFIED;
/* Special case: "friend class foo" looks like a TYPENAME context. */
if (friendp)
{
if (type_quals != TYPE_UNQUALIFIED)
{
- cp_error ("type qualifiers specified for friend class declaration");
+ error ("type qualifiers specified for friend class declaration");
type_quals = TYPE_UNQUALIFIED;
}
if (inlinep)
{
- cp_error ("`inline' specified for friend class declaration");
+ error ("`inline' specified for friend class declaration");
inlinep = 0;
}
+ /* Until core issue 180 is resolved, allow 'friend typename A::B'.
+ But don't allow implicit typenames except with a class-key. */
+ if (!current_aggr && (TREE_CODE (type) != TYPENAME_TYPE
+ || IMPLICIT_TYPENAME_P (type)))
+ {
+ if (TREE_CODE (type) == TEMPLATE_TYPE_PARM)
+ pedwarn ("template parameters cannot be friends");
+ else if (TREE_CODE (type) == TYPENAME_TYPE)
+ pedwarn ("\
+friend declaration requires class-key, i.e. `friend class %T::%T'",
+ constructor_name (current_class_type),
+ TYPE_IDENTIFIER (type));
+ else
+ pedwarn ("\
+friend declaration requires class-key, i.e. `friend %#T'",
+ type);
+ }
+
/* Only try to do this stuff if we didn't already give up. */
if (type != integer_type_node)
{
+ /* DR 209. The friendly class does not need to be accessible
+ in the scope of the class granting friendship. */
+ skip_type_access_control ();
+
/* A friendly class? */
if (current_class_type)
make_friend_class (current_class_type, TYPE_MAIN_VARIANT (type));
else
- error ("trying to make class `%s' a friend of global scope",
- TYPE_NAME_STRING (type));
+ error ("trying to make class `%T' a friend of global scope",
+ type);
+
type = void_type_node;
}
}
else if (quals)
{
- tree dummy = build_decl (TYPE_DECL, declarator, type);
if (ctype == NULL_TREE)
{
- my_friendly_assert (TREE_CODE (type) == METHOD_TYPE, 159);
- ctype = TYPE_METHOD_BASETYPE (type);
+ if (TREE_CODE (type) != METHOD_TYPE)
+ error ("invalid qualifiers on non-member function type");
+ else
+ ctype = TYPE_METHOD_BASETYPE (type);
+ }
+ if (ctype)
+ {
+ tree dummy = build_decl (TYPE_DECL, declarator, type);
+ grok_method_quals (ctype, dummy, quals);
+ type = TREE_TYPE (dummy);
}
- grok_method_quals (ctype, dummy, quals);
- type = TREE_TYPE (dummy);
}
return type;
@@ -11221,7 +11338,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
&& TREE_CODE (type) != UNION_TYPE
&& ! bitfield)
{
- cp_error ("abstract declarator `%T' used as declaration", type);
+ error ("abstract declarator `%T' used as declaration", type);
declarator = make_anon_name ();
}
@@ -11237,7 +11354,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
else if (TREE_CODE (declarator) == IDENTIFIER_NODE)
{
if (IDENTIFIER_OPNAME_P (declarator))
- my_friendly_abort (356);
+ abort ();
else
error ("variable or field `%s' declared void", name);
}
@@ -11268,13 +11385,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
type = build_pointer_type (type);
else if (TREE_CODE (type) == OFFSET_TYPE)
type = build_pointer_type (type);
- else if (TREE_CODE (type) == VOID_TYPE && declarator)
- {
- error ("declaration of `%s' as void", name);
- return NULL_TREE;
- }
}
-
+
{
register tree decl;
@@ -11284,16 +11396,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
bad_specifiers (decl, "parameter", virtualp, quals != NULL_TREE,
inlinep, friendp, raises != NULL_TREE);
- if (current_class_type
- && IS_SIGNATURE (current_class_type))
- {
- if (inlinep)
- error ("parameter of signature member function declared `inline'");
- if (RIDBIT_SETP (RID_AUTO, specbits))
- error ("parameter of signature member function declared `auto'");
- if (RIDBIT_SETP (RID_REGISTER, specbits))
- error ("parameter of signature member function declared `register'");
- }
/* Compute the type actually passed in the parmlist,
for the case where there is no prototype.
@@ -11313,7 +11415,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
else if (in_namespace && !friendp)
{
/* Something like struct S { int N::j; }; */
- cp_error ("invalid use of `::'");
+ error ("invalid use of `::'");
decl = NULL_TREE;
}
else if (TREE_CODE (type) == FUNCTION_TYPE)
@@ -11325,7 +11427,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
typedefs. */
if (friendp && declarator == ridpointers[(int) RID_SIGNED])
{
- cp_error ("function `%D' cannot be declared friend",
+ error ("function `%D' cannot be declared friend",
declarator);
friendp = 0;
}
@@ -11337,7 +11439,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (ctype == NULL_TREE)
{
- cp_error ("can't make `%D' into a method -- not in a class",
+ error ("can't make `%D' into a method -- not in a class",
declarator);
return void_type_node;
}
@@ -11346,19 +11448,19 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
ARM 9.5 */
if (virtualp && TREE_CODE (ctype) == UNION_TYPE)
{
- cp_error ("function `%D' declared virtual inside a union",
+ error ("function `%D' declared virtual inside a union",
declarator);
return void_type_node;
}
- if (declarator == ansi_opname[(int) NEW_EXPR]
- || declarator == ansi_opname[(int) VEC_NEW_EXPR]
- || declarator == ansi_opname[(int) DELETE_EXPR]
- || declarator == ansi_opname[(int) VEC_DELETE_EXPR])
+ if (declarator == ansi_opname (NEW_EXPR)
+ || declarator == ansi_opname (VEC_NEW_EXPR)
+ || declarator == ansi_opname (DELETE_EXPR)
+ || declarator == ansi_opname (VEC_DELETE_EXPR))
{
if (virtualp)
{
- cp_error ("`%D' cannot be declared virtual, since it is always static",
+ error ("`%D' cannot be declared virtual, since it is always static",
declarator);
virtualp = 0;
}
@@ -11369,11 +11471,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
}
/* Tell grokfndecl if it needs to set TREE_PUBLIC on the node. */
- function_context = (ctype != NULL_TREE) ?
- hack_decl_function_context (TYPE_MAIN_DECL (ctype)) : NULL_TREE;
+ function_context = (ctype != NULL_TREE) ?
+ decl_function_context (TYPE_MAIN_DECL (ctype)) : NULL_TREE;
publicp = (! friendp || ! staticp)
&& function_context == NULL_TREE;
- decl = grokfndecl (ctype, type,
+ decl = grokfndecl (ctype, type,
TREE_CODE (declarator) != TEMPLATE_ID_EXPR
? declarator : dname,
declarator,
@@ -11384,8 +11486,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
return decl;
#if 0
/* This clobbers the attrs stored in `decl' from `attrlist'. */
- /* The decl and setting of decl_machine_attr is also turned off. */
- decl = build_decl_attribute_variant (decl, decl_machine_attr);
+ /* The decl and setting of decl_attr is also turned off. */
+ decl = build_decl_attribute_variant (decl, decl_attr);
#endif
/* [class.conv.ctor]
@@ -11402,23 +11504,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
/* The constructor can be called with exactly one
parameter if there is at least one parameter, and
any subsequent parameters have default arguments.
- We don't look at the first parameter, which is
- really just the `this' parameter for the new
- object. */
- tree arg_types =
- TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (decl)));
-
- /* Skip the `in_chrg' argument too, if present. */
- if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (decl)))
- arg_types = TREE_CHAIN (arg_types);
-
- /* And the `vlist' argument. */
- if (TYPE_USES_PVBASES (DECL_CONTEXT (decl)))
- arg_types = TREE_CHAIN (arg_types);
+ Ignore any compiler-added parms. */
+ tree arg_types = FUNCTION_FIRST_USER_PARMTYPE (decl);
if (arg_types == void_list_node
- || (arg_types
- && TREE_CHAIN (arg_types)
+ || (arg_types
+ && TREE_CHAIN (arg_types)
&& TREE_CHAIN (arg_types) != void_list_node
&& !TREE_PURPOSE (TREE_CHAIN (arg_types))))
DECL_NONCONVERTING_P (decl) = 1;
@@ -11438,13 +11529,13 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
return NULL_TREE;
}
else if (!staticp && ! processing_template_decl
- && TYPE_SIZE (complete_type (type)) == NULL_TREE
+ && !COMPLETE_TYPE_P (complete_type (type))
&& (TREE_CODE (type) != ARRAY_TYPE || initialized == 0))
{
if (declarator)
- cp_error ("field `%D' has incomplete type", declarator);
+ error ("field `%D' has incomplete type", declarator);
else
- cp_error ("name `%T' has incomplete type", type);
+ error ("name `%T' has incomplete type", type);
/* If we're instantiating a template, tell them which
instantiation made the field's type be incomplete. */
@@ -11453,7 +11544,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
&& IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (current_class_type))
&& declspecs && TREE_VALUE (declspecs)
&& TREE_TYPE (TREE_VALUE (declspecs)) == type)
- cp_error (" in instantiation of template `%T'",
+ error (" in instantiation of template `%T'",
current_class_type);
type = error_mark_node;
@@ -11463,7 +11554,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
{
if (friendp)
{
- error ("`%s' is neither function nor method; cannot be declared friend",
+ error ("`%s' is neither function nor member function; cannot be declared friend",
IDENTIFIER_POINTER (declarator));
friendp = 0;
}
@@ -11473,32 +11564,33 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (friendp)
{
/* Friends are treated specially. */
+ tree t = NULL_TREE;
+
+ /* DR 209. The friend does not need to be accessible at this
+ point. */
+ skip_type_access_control ();
+
if (ctype == current_class_type)
warning ("member functions are implicitly friends of their class");
- else
- {
- tree t = NULL_TREE;
- if (decl && DECL_NAME (decl))
- {
- if (template_class_depth (current_class_type) == 0)
- {
- decl
- = check_explicit_specialization
- (declarator, decl,
- template_count, 2 * (funcdef_flag != 0) + 4);
- if (decl == error_mark_node)
- return error_mark_node;
- }
- t = do_friend (ctype, declarator, decl,
- last_function_parms, attrlist, flags, quals,
- funcdef_flag);
- }
- if (t && funcdef_flag)
- return t;
-
- return void_type_node;
- }
+ if (decl && DECL_NAME (decl))
+ {
+ if (template_class_depth (current_class_type) == 0)
+ {
+ decl = check_explicit_specialization
+ (declarator, decl,
+ template_count, 2 * (funcdef_flag != 0) + 4);
+ if (decl == error_mark_node)
+ return error_mark_node;
+ }
+
+ t = do_friend (ctype, declarator, decl,
+ last_function_parms, *attrlist, flags, quals,
+ funcdef_flag);
+ }
+ if (t && funcdef_flag)
+ return t;
+ return void_type_node;
}
/* Structure field. It may not be a function, except for C++ */
@@ -11511,19 +11603,19 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
{
/* An attempt is being made to initialize a non-static
member. But, from [class.mem]:
-
+
4 A member-declarator can contain a
constant-initializer only if it declares a static
member (_class.static_) of integral or enumeration
- type, see _class.static.data_.
+ type, see _class.static.data_.
This used to be relatively common practice, but
the rest of the compiler does not correctly
handle the initialization unless the member is
static so we make it static below. */
- cp_pedwarn ("ANSI C++ forbids initialization of member `%D'",
+ pedwarn ("ISO C++ forbids initialization of member `%D'",
declarator);
- cp_pedwarn ("making `%D' static", declarator);
+ pedwarn ("making `%D' static", declarator);
staticp = 1;
}
@@ -11542,27 +11634,27 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
/* 9.2p13 [class.mem] */
if (declarator == constructor_name (current_class_type)
- /* Divergence from the standard: In extern "C", we
- allow non-static data members here, because C does
- and /usr/include/netinet/in.h uses that. */
- && (staticp || ! in_system_header))
- cp_pedwarn ("ANSI C++ forbids data member `%D' with same name as enclosing class",
+ /* The standard does not allow non-static data members
+ here either, but we agreed at the 10/99 meeting
+ to change that in TC 1 so that they are allowed in
+ classes with no user-defined constructors. */
+ && staticp)
+ pedwarn ("ISO C++ forbids static data member `%D' with same name as enclosing class",
declarator);
if (staticp)
{
- /* C++ allows static class members.
- All other work for this is done by grokfield.
- This VAR_DCL is built by build_lang_field_decl.
- All other VAR_DECLs are built by build_decl. */
- decl = build_lang_field_decl (VAR_DECL, declarator, type);
+ /* C++ allows static class members. All other work
+ for this is done by grokfield. */
+ decl = build_lang_decl (VAR_DECL, declarator, type);
TREE_STATIC (decl) = 1;
/* In class context, 'static' means public access. */
TREE_PUBLIC (decl) = DECL_EXTERNAL (decl) = 1;
}
else
{
- decl = build_lang_field_decl (FIELD_DECL, declarator, type);
+ decl = build_decl (FIELD_DECL, declarator, type);
+ DECL_NONADDRESSABLE_P (decl) = bitfield;
if (RIDBIT_SETP (RID_MUTABLE, specbits))
{
DECL_MUTABLE_P (decl) = 1;
@@ -11605,7 +11697,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
else
pedwarn ("storage class `inline' invalid for function `%s' declared out of global scope", name);
}
-
+
if (ctype == NULL_TREE)
{
if (virtualp)
@@ -11626,7 +11718,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
decl = grokfndecl (ctype, type, original_name, declarator,
virtualp, flags, quals, raises,
1, friendp,
- publicp, inlinep, funcdef_flag,
+ publicp, inlinep, funcdef_flag,
template_count, in_namespace);
if (decl == NULL_TREE)
return NULL_TREE;
@@ -11639,7 +11731,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
declaring main to be static. */
if (TREE_CODE (type) == METHOD_TYPE)
{
- cp_pedwarn ("cannot declare member function `%D' to have static linkage", decl);
+ pedwarn ("cannot declare member function `%D' to have static linkage", decl);
illegal_static = 1;
}
else if (current_function_decl)
@@ -11661,9 +11753,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
/* It's a variable. */
/* An uninitialized decl with `extern' is a reference. */
- decl = grokvardecl (type, declarator, &specbits,
- initialized,
- (type_quals & TYPE_QUAL_CONST) != 0,
+ decl = grokvardecl (type, declarator, &specbits,
+ initialized,
+ (type_quals & TYPE_QUAL_CONST) != 0,
in_namespace);
bad_specifiers (decl, "variable", virtualp, quals != NULL_TREE,
inlinep, friendp, raises != NULL_TREE);
@@ -11673,28 +11765,25 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
DECL_CONTEXT (decl) = ctype;
if (staticp == 1)
{
- cp_pedwarn ("static member `%D' re-declared as static", decl);
+ pedwarn ("`static' may not be used when defining (as opposed to declaring) a static data member");
staticp = 0;
RIDBIT_RESET (RID_STATIC, specbits);
}
if (RIDBIT_SETP (RID_REGISTER, specbits) && TREE_STATIC (decl))
{
- cp_error ("static member `%D' declared `register'", decl);
+ error ("static member `%D' declared `register'", decl);
RIDBIT_RESET (RID_REGISTER, specbits);
}
if (RIDBIT_SETP (RID_EXTERN, specbits) && pedantic)
{
- cp_pedwarn ("cannot explicitly declare member `%#D' to have extern linkage",
+ pedwarn ("cannot explicitly declare member `%#D' to have extern linkage",
decl);
RIDBIT_RESET (RID_EXTERN, specbits);
}
}
}
- if (RIDBIT_SETP (RID_MUTABLE, specbits))
- {
- error ("`%s' cannot be declared mutable", name);
- }
+ my_friendly_assert (!RIDBIT_SETP (RID_MUTABLE, specbits), 19990927);
/* Record `register' declaration for warnings on &
and in case doing stupid register allocation. */
@@ -11708,9 +11797,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (RIDBIT_SETP (RID_STATIC, specbits))
DECL_THIS_STATIC (decl) = 1;
- /* Record constancy and volatility. */
- /* FIXME: Disallow `restrict' pointer-to-member declarations. */
- c_apply_type_quals_to_decl (type_quals, decl);
+ /* Record constancy and volatility. There's no need to do this
+ when processing a template; we'll do this for the instantiated
+ declaration based on the type of DECL. */
+ if (!processing_template_decl)
+ c_apply_type_quals_to_decl (type_quals, decl);
return decl;
}
@@ -11751,42 +11842,60 @@ static void
require_complete_types_for_parms (parms)
tree parms;
{
- while (parms)
+ for (; parms; parms = TREE_CHAIN (parms))
{
- tree type = TREE_TYPE (parms);
- if (TYPE_SIZE (complete_type (type)) == NULL_TREE)
- {
- if (DECL_NAME (parms))
- error ("parameter `%s' has incomplete type",
- IDENTIFIER_POINTER (DECL_NAME (parms)));
- else
- error ("parameter has incomplete type");
- TREE_TYPE (parms) = error_mark_node;
- }
- else
+ if (VOID_TYPE_P (TREE_TYPE (parms)))
+ /* grokparms will have already issued an error */
+ TREE_TYPE (parms) = error_mark_node;
+ else if (complete_type_or_else (TREE_TYPE (parms), parms))
layout_decl (parms, 0);
-
- parms = TREE_CHAIN (parms);
+ else
+ TREE_TYPE (parms) = error_mark_node;
}
}
-/* Returns DECL if DECL is a local variable (or parameter). Returns
- NULL_TREE otherwise. */
+/* Returns non-zero if T is a local variable. */
-static tree
+int
local_variable_p (t)
tree t;
{
- if ((TREE_CODE (t) == VAR_DECL
+ if ((TREE_CODE (t) == VAR_DECL
/* A VAR_DECL with a context that is a _TYPE is a static data
member. */
&& !TYPE_P (CP_DECL_CONTEXT (t))
/* Any other non-local variable must be at namespace scope. */
- && TREE_CODE (CP_DECL_CONTEXT (t)) != NAMESPACE_DECL)
+ && !DECL_NAMESPACE_SCOPE_P (t))
|| (TREE_CODE (t) == PARM_DECL))
- return t;
+ return 1;
- return NULL_TREE;
+ return 0;
+}
+
+/* Returns non-zero if T is an automatic local variable or a label.
+ (These are the declarations that need to be remapped when the code
+ containing them is duplicated.) */
+
+int
+nonstatic_local_decl_p (t)
+ tree t;
+{
+ return ((local_variable_p (t) && !TREE_STATIC (t))
+ || TREE_CODE (t) == LABEL_DECL
+ || TREE_CODE (t) == RESULT_DECL);
+}
+
+/* Like local_variable_p, but suitable for use as a tree-walking
+ function. */
+
+static tree
+local_variable_p_walkfn (tp, walk_subtrees, data)
+ tree *tp;
+ int *walk_subtrees ATTRIBUTE_UNUSED;
+ void *data ATTRIBUTE_UNUSED;
+{
+ return ((local_variable_p (*tp) && !DECL_ARTIFICIAL (*tp))
+ ? *tp : NULL_TREE);
}
/* Check that ARG, which is a default-argument expression for a
@@ -11823,7 +11932,7 @@ check_default_argument (decl, arg)
else
decl_type = TREE_TYPE (decl);
- if (arg == error_mark_node
+ if (arg == error_mark_node
|| decl == error_mark_node
|| TREE_TYPE (arg) == error_mark_node
|| decl_type == error_mark_node)
@@ -11832,17 +11941,17 @@ check_default_argument (decl, arg)
return error_mark_node;
/* [dcl.fct.default]
-
+
A default argument expression is implicitly converted to the
parameter type. */
if (!TREE_TYPE (arg)
|| !can_convert_arg (decl_type, TREE_TYPE (arg), arg))
{
if (decl)
- cp_error ("default argument for `%#D' has type `%T'",
+ error ("default argument for `%#D' has type `%T'",
decl, TREE_TYPE (arg));
else
- cp_error ("default argument for paramter of type `%T' has type `%T'",
+ error ("default argument for parameter of type `%T' has type `%T'",
decl_type, TREE_TYPE (arg));
return error_mark_node;
@@ -11851,14 +11960,15 @@ check_default_argument (decl, arg)
/* [dcl.fct.default]
Local variables shall not be used in default argument
- expressions.
+ expressions.
The keyword `this' shall not be used in a default argument of a
member function. */
- var = search_tree (arg, local_variable_p);
+ var = walk_tree_without_duplicates (&arg, local_variable_p_walkfn,
+ NULL);
if (var)
{
- cp_error ("default argument `%E' uses local variable `%D'",
+ error ("default argument `%E' uses local variable `%D'",
arg, var);
return error_mark_node;
}
@@ -11871,469 +11981,413 @@ check_default_argument (decl, arg)
Given the list of things declared inside the parens,
return a list of types.
- The list we receive can have three kinds of elements:
- an IDENTIFIER_NODE for names given without types,
- a TREE_LIST node for arguments given as typespecs or names with typespecs,
- or void_type_node, to mark the end of an argument list
- when additional arguments are not permitted (... was not used).
-
- FUNCDEF_FLAG is nonzero for a function definition, 0 for
- a mere declaration. A nonempty identifier-list gets an error message
- when FUNCDEF_FLAG is zero.
- If FUNCDEF_FLAG is 1, then parameter types must be complete.
- If FUNCDEF_FLAG is -1, then parameter types may be incomplete.
-
- If all elements of the input list contain types,
- we return a list of the types.
- If all elements contain no type (except perhaps a void_type_node
- at the end), we return a null list.
- If some have types and some do not, it is an error, and we
- return a null list.
-
- Also set last_function_parms to either
- a list of names (IDENTIFIER_NODEs) or a chain of PARM_DECLs.
- A list of names is converted to a chain of PARM_DECLs
- by store_parm_decls so that ultimately it is always a chain of decls.
-
- Note that in C++, parameters can take default values. These default
- values are in the TREE_PURPOSE field of the TREE_LIST. It is
- an error to specify default values which are followed by parameters
- that have no default values, or an ELLIPSES. For simplicities sake,
- only parameters which are specified with their types can take on
- default values. */
+ We determine whether ellipsis parms are used by PARMLIST_ELLIPSIS_P
+ flag. If unset, we append void_list_node. A parmlist declared
+ as `(void)' is accepted as the empty parmlist.
+
+ Also set last_function_parms to the chain of PARM_DECLs. */
static tree
-grokparms (first_parm, funcdef_flag)
+grokparms (first_parm)
tree first_parm;
- int funcdef_flag;
{
tree result = NULL_TREE;
tree decls = NULL_TREE;
+ int ellipsis = !first_parm || PARMLIST_ELLIPSIS_P (first_parm);
+ tree parm, chain;
+ int any_error = 0;
- if (first_parm != NULL_TREE
- && TREE_CODE (TREE_VALUE (first_parm)) == IDENTIFIER_NODE)
- {
- if (! funcdef_flag)
- pedwarn ("parameter names (without types) in function declaration");
- last_function_parms = first_parm;
- return NULL_TREE;
- }
- else if (first_parm != NULL_TREE
- && TREE_CODE (TREE_VALUE (first_parm)) != TREE_LIST
- && TREE_CODE (TREE_VALUE (first_parm)) != VOID_TYPE)
- my_friendly_abort (145);
- else
+ my_friendly_assert (!first_parm || TREE_PARMLIST (first_parm), 20001115);
+
+ for (parm = first_parm; parm != NULL_TREE; parm = chain)
{
- /* Types were specified. This is a list of declarators
- each represented as a TREE_LIST node. */
- register tree parm, chain;
- int any_init = 0, any_error = 0;
+ tree type = NULL_TREE;
+ tree decl = TREE_VALUE (parm);
+ tree init = TREE_PURPOSE (parm);
+ tree specs, attrs;
+
+ chain = TREE_CHAIN (parm);
+ /* @@ weak defense against parse errors. */
+ if (TREE_CODE (decl) != VOID_TYPE
+ && TREE_CODE (decl) != TREE_LIST)
+ {
+ /* Give various messages as the need arises. */
+ if (TREE_CODE (decl) == STRING_CST)
+ error ("invalid string constant `%E'", decl);
+ else if (TREE_CODE (decl) == INTEGER_CST)
+ error ("invalid integer constant in parameter list, did you forget to give parameter name?");
+ continue;
+ }
- if (first_parm != NULL_TREE)
- {
- tree last_result = NULL_TREE;
- tree last_decl = NULL_TREE;
+ if (parm == void_list_node)
+ break;
- for (parm = first_parm; parm != NULL_TREE; parm = chain)
- {
- tree type = NULL_TREE, list_node = parm;
- register tree decl = TREE_VALUE (parm);
- tree init = TREE_PURPOSE (parm);
-
- chain = TREE_CHAIN (parm);
- /* @@ weak defense against parse errors. */
- if (TREE_CODE (decl) != VOID_TYPE
- && TREE_CODE (decl) != TREE_LIST)
- {
- /* Give various messages as the need arises. */
- if (TREE_CODE (decl) == STRING_CST)
- cp_error ("invalid string constant `%E'", decl);
- else if (TREE_CODE (decl) == INTEGER_CST)
- error ("invalid integer constant in parameter list, did you forget to give parameter name?");
- continue;
- }
+ split_specs_attrs (TREE_PURPOSE (decl), &specs, &attrs);
+ decl = grokdeclarator (TREE_VALUE (decl), specs,
+ PARM, init != NULL_TREE, &attrs);
+ if (! decl || TREE_TYPE (decl) == error_mark_node)
+ continue;
- if (TREE_CODE (decl) != VOID_TYPE)
- {
- decl = grokdeclarator (TREE_VALUE (decl),
- TREE_PURPOSE (decl),
- PARM, init != NULL_TREE,
- NULL_TREE);
- if (! decl || TREE_TYPE (decl) == error_mark_node)
- continue;
-
- /* Top-level qualifiers on the parameters are
- ignored for function types. */
- type = TYPE_MAIN_VARIANT (TREE_TYPE (decl));
-
- if (TREE_CODE (type) == VOID_TYPE)
- decl = void_type_node;
- else if (TREE_CODE (type) == METHOD_TYPE)
- {
- if (DECL_NAME (decl))
- /* Cannot use the decl here because
- we don't have DECL_CONTEXT set up yet. */
- cp_error ("parameter `%D' invalidly declared method type",
- DECL_NAME (decl));
- else
- error ("parameter invalidly declared method type");
- type = build_pointer_type (type);
- TREE_TYPE (decl) = type;
- }
- else if (TREE_CODE (type) == OFFSET_TYPE)
- {
- if (DECL_NAME (decl))
- cp_error ("parameter `%D' invalidly declared offset type",
- DECL_NAME (decl));
- else
- error ("parameter invalidly declared offset type");
- type = build_pointer_type (type);
- TREE_TYPE (decl) = type;
- }
- else if (TREE_CODE (type) == RECORD_TYPE
- && TYPE_LANG_SPECIFIC (type)
- && CLASSTYPE_ABSTRACT_VIRTUALS (type))
- {
- abstract_virtuals_error (decl, type);
- any_error = 1; /* Seems like a good idea. */
- }
- else if (TREE_CODE (type) == RECORD_TYPE
- && TYPE_LANG_SPECIFIC (type)
- && IS_SIGNATURE (type))
- {
- signature_error (decl, type);
- any_error = 1; /* Seems like a good idea. */
- }
- else if (POINTER_TYPE_P (type))
- {
- tree t = type;
- while (POINTER_TYPE_P (t)
- || (TREE_CODE (t) == ARRAY_TYPE
- && TYPE_DOMAIN (t) != NULL_TREE))
- t = TREE_TYPE (t);
- if (TREE_CODE (t) == ARRAY_TYPE)
- cp_error ("parameter type `%T' includes %s to array of unknown bound",
- type,
- TYPE_PTR_P (type) ? "pointer" : "reference");
- }
- }
-
- if (TREE_CODE (decl) == VOID_TYPE)
- {
- if (result == NULL_TREE)
- {
- result = void_list_node;
- last_result = result;
- }
- else
- {
- TREE_CHAIN (last_result) = void_list_node;
- last_result = void_list_node;
- }
- if (chain
- && (chain != void_list_node || TREE_CHAIN (chain)))
- error ("`void' in parameter list must be entire list");
- break;
- }
+ if (attrs)
+ cplus_decl_attributes (&decl, attrs, 0);
- /* Since there is a prototype, args are passed in their own types. */
- DECL_ARG_TYPE (decl) = TREE_TYPE (decl);
-#ifdef PROMOTE_PROTOTYPES
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
- && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
- DECL_ARG_TYPE (decl) = integer_type_node;
-#endif
- if (!any_error && init)
- {
- any_init++;
- init = check_default_argument (decl, init);
- }
- else
- init = NULL_TREE;
+ type = TREE_TYPE (decl);
+ if (VOID_TYPE_P (type))
+ {
+ if (same_type_p (type, void_type_node)
+ && !DECL_NAME (decl) && !result && !chain && !ellipsis)
+ /* this is a parmlist of `(void)', which is ok. */
+ break;
+ incomplete_type_error (decl, type);
+ /* It's not a good idea to actually create parameters of
+ type `void'; other parts of the compiler assume that a
+ void type terminates the parameter list. */
+ type = error_mark_node;
+ TREE_TYPE (decl) = error_mark_node;
+ }
- if (decls == NULL_TREE)
- {
- decls = decl;
- last_decl = decls;
- }
- else
- {
- TREE_CHAIN (last_decl) = decl;
- last_decl = decl;
- }
- if (! current_function_decl && TREE_PERMANENT (list_node))
- {
- TREE_PURPOSE (list_node) = init;
- TREE_VALUE (list_node) = type;
- TREE_CHAIN (list_node) = NULL_TREE;
- }
- else
- list_node = saveable_tree_cons (init, type, NULL_TREE);
- if (result == NULL_TREE)
- {
- result = list_node;
- last_result = result;
- }
- else
- {
- TREE_CHAIN (last_result) = list_node;
- last_result = list_node;
- }
+ if (type != error_mark_node)
+ {
+ /* Top-level qualifiers on the parameters are
+ ignored for function types. */
+ type = TYPE_MAIN_VARIANT (type);
+ if (TREE_CODE (type) == METHOD_TYPE)
+ {
+ error ("parameter `%D' invalidly declared method type", decl);
+ type = build_pointer_type (type);
+ TREE_TYPE (decl) = type;
+ }
+ else if (TREE_CODE (type) == OFFSET_TYPE)
+ {
+ error ("parameter `%D' invalidly declared offset type", decl);
+ type = build_pointer_type (type);
+ TREE_TYPE (decl) = type;
+ }
+ else if (abstract_virtuals_error (decl, type))
+ any_error = 1; /* Seems like a good idea. */
+ else if (POINTER_TYPE_P (type))
+ {
+ /* [dcl.fct]/6, parameter types cannot contain pointers
+ (references) to arrays of unknown bound. */
+ tree t = TREE_TYPE (type);
+ int ptr = TYPE_PTR_P (type);
+
+ while (1)
+ {
+ if (TYPE_PTR_P (t))
+ ptr = 1;
+ else if (TREE_CODE (t) != ARRAY_TYPE)
+ break;
+ else if (!TYPE_DOMAIN (t))
+ break;
+ t = TREE_TYPE (t);
+ }
+ if (TREE_CODE (t) == ARRAY_TYPE)
+ error ("parameter `%D' includes %s to array of unknown bound `%T'",
+ decl, ptr ? "pointer" : "reference", t);
}
- if (last_result)
- TREE_CHAIN (last_result) = NULL_TREE;
- /* If there are no parameters, and the function does not end
- with `...', then last_decl will be NULL_TREE. */
- if (last_decl != NULL_TREE)
- TREE_CHAIN (last_decl) = NULL_TREE;
+
+ DECL_ARG_TYPE (decl) = TREE_TYPE (decl);
+ if (PROMOTE_PROTOTYPES
+ && INTEGRAL_TYPE_P (type)
+ && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
+ DECL_ARG_TYPE (decl) = integer_type_node;
+ if (!any_error && init)
+ init = check_default_argument (decl, init);
+ else
+ init = NULL_TREE;
}
- }
+ TREE_CHAIN (decl) = decls;
+ decls = decl;
+ result = tree_cons (init, type, result);
+ }
+ decls = nreverse (decls);
+ result = nreverse (result);
+ if (!ellipsis)
+ result = chainon (result, void_list_node);
last_function_parms = decls;
return result;
}
-/* Called from the parser to update an element of TYPE_ARG_TYPES for some
- FUNCTION_TYPE with the newly parsed version of its default argument, which
- was previously digested as text. See snarf_defarg et al in lex.c. */
-
-void
-replace_defarg (arg, init)
- tree arg, init;
-{
- if (! processing_template_decl
- && ! can_convert_arg (TREE_VALUE (arg), TREE_TYPE (init), init))
- cp_pedwarn ("invalid type `%T' for default argument to `%T'",
- TREE_TYPE (init), TREE_VALUE (arg));
- TREE_PURPOSE (arg) = init;
-}
-/* Return 1 if D copies its arguments. This is used to test for copy
- constructors and copy assignment operators. */
+/* D is a constructor or overloaded `operator='.
+
+ Let T be the class in which D is declared. Then, this function
+ returns:
+
+ -1 if D's is an ill-formed constructor or copy assignment operator
+ whose first parameter is of type `T'.
+ 0 if D is not a copy constructor or copy assignment
+ operator.
+ 1 if D is a copy constructor or copy assignment operator whose
+ first parameter is a reference to const qualified T.
+ 2 if D is a copy constructor or copy assignment operator whose
+ first parameter is a reference to non-const qualified T.
+
+ This function can be used as a predicate. Positive values indicate
+ a copy constructor and non-zero values indicate a copy assignment
+ operator. */
int
-copy_args_p (d)
+copy_fn_p (d)
tree d;
{
- tree t = FUNCTION_ARG_CHAIN (d);
- if (DECL_CONSTRUCTOR_P (d)
- && TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (d)))
- {
- t = TREE_CHAIN (t);
- if (TYPE_USES_PVBASES (DECL_CONTEXT (d)))
- t = TREE_CHAIN (t);
+ tree args;
+ tree arg_type;
+ int result = 1;
+
+ my_friendly_assert (DECL_FUNCTION_MEMBER_P (d), 20011208);
+
+ if (DECL_TEMPLATE_INFO (d) && is_member_template (DECL_TI_TEMPLATE (d)))
+ /* Instantiations of template member functions are never copy
+ functions. Note that member functions of templated classes are
+ represented as template functions internally, and we must
+ accept those as copy functions. */
+ return 0;
+
+ args = FUNCTION_FIRST_USER_PARMTYPE (d);
+ if (!args)
+ return 0;
+
+ arg_type = TREE_VALUE (args);
+
+ if (TYPE_MAIN_VARIANT (arg_type) == DECL_CONTEXT (d))
+ {
+ /* Pass by value copy assignment operator. */
+ result = -1;
+ }
+ else if (TREE_CODE (arg_type) == REFERENCE_TYPE
+ && TYPE_MAIN_VARIANT (TREE_TYPE (arg_type)) == DECL_CONTEXT (d))
+ {
+ if (CP_TYPE_CONST_P (TREE_TYPE (arg_type)))
+ result = 2;
}
+ else
+ return 0;
- 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;
+ args = TREE_CHAIN (args);
+
+ if (args && args != void_list_node && !TREE_PURPOSE (args))
+ /* There are more non-optional args. */
+ return 0;
+
+ return result;
+}
+
+/* Remember any special properties of member function DECL. */
+
+void grok_special_member_properties (decl)
+ tree decl;
+{
+ if (!DECL_NONSTATIC_MEMBER_FUNCTION_P(decl))
+ ; /* Not special. */
+ else if (DECL_CONSTRUCTOR_P (decl))
+ {
+ int ctor = copy_fn_p (decl);
+
+ if (ctor > 0)
+ {
+ /* [class.copy]
+
+ A non-template constructor for class X is a copy
+ constructor if its first parameter is of type X&, const
+ X&, volatile X& or const volatile X&, and either there
+ are no other parameters or else all other parameters have
+ default arguments. */
+ TYPE_HAS_INIT_REF (DECL_CONTEXT (decl)) = 1;
+ if (ctor > 1)
+ TYPE_HAS_CONST_INIT_REF (DECL_CONTEXT (decl)) = 1;
+ }
+ else if (sufficient_parms_p (FUNCTION_FIRST_USER_PARMTYPE (decl)))
+ TYPE_HAS_DEFAULT_CONSTRUCTOR (DECL_CONTEXT (decl)) = 1;
+ }
+ else if (DECL_OVERLOADED_OPERATOR_P (decl) == NOP_EXPR)
+ {
+ /* [class.copy]
+
+ A non-template assignment operator for class X is a copy
+ assignment operator if its parameter is of type X, X&, const
+ X&, volatile X& or const volatile X&. */
+
+ int assop = copy_fn_p (decl);
+
+ if (assop)
+ {
+ TYPE_HAS_ASSIGN_REF (DECL_CONTEXT (decl)) = 1;
+ if (assop != 1)
+ TYPE_HAS_CONST_ASSIGN_REF (DECL_CONTEXT (decl)) = 1;
+ if (DECL_PURE_VIRTUAL_P (decl))
+ TYPE_HAS_ABSTRACT_ASSIGN_REF (DECL_CONTEXT (decl)) = 1;
+ }
+ }
}
-/* These memoizing functions keep track of special properties which
- a class may have. `grok_ctor_properties' notices whether a class
- has a constructor of the form X(X&), and also complains
- if the class has a constructor of the form X(X).
- `grok_op_properties' takes notice of the various forms of
- operator= which are defined, as well as what sorts of type conversion
- may apply. Both functions take a FUNCTION_DECL as an argument. */
+/* Check a constructor DECL has the correct form. Complains
+ if the class has a constructor of the form X(X). */
int
grok_ctor_properties (ctype, decl)
tree ctype, decl;
{
- tree parmtypes = FUNCTION_ARG_CHAIN (decl);
- tree parmtype = parmtypes ? TREE_VALUE (parmtypes) : void_type_node;
-
- /* When a type has virtual baseclasses, a magical first int argument is
- added to any ctor so we can tell if the class has been initialized
- yet. This could screw things up in this function, so we deliberately
- ignore the leading int if we're in that situation. */
- if (TYPE_USES_VIRTUAL_BASECLASSES (ctype)
- && !CLASSTYPE_IS_TEMPLATE (ctype))
- {
- my_friendly_assert (parmtypes
- && TREE_VALUE (parmtypes) == integer_type_node,
- 980529);
- parmtypes = TREE_CHAIN (parmtypes);
- parmtype = TREE_VALUE (parmtypes);
- }
-
- if (TYPE_USES_PVBASES (ctype))
- {
- my_friendly_assert (parmtypes
- && TREE_VALUE (parmtypes) == vlist_type_node,
- 980529);
- parmtypes = TREE_CHAIN (parmtypes);
- parmtype = TREE_VALUE (parmtypes);
- }
-
- maybe_vlist_ctor_wrapper (decl, 0);
-
- /* [class.copy]
-
- A non-template constructor for class X is a copy constructor if
- its first parameter is of type X&, const X&, volatile X& or const
- volatile X&, and either there are no other parameters or else all
- other parameters have default arguments. */
- if (TREE_CODE (parmtype) == REFERENCE_TYPE
- && TYPE_MAIN_VARIANT (TREE_TYPE (parmtype)) == ctype
- && (TREE_CHAIN (parmtypes) == NULL_TREE
- || TREE_CHAIN (parmtypes) == void_list_node
- || TREE_PURPOSE (TREE_CHAIN (parmtypes)))
- && !(DECL_TEMPLATE_INSTANTIATION (decl)
- && is_member_template (DECL_TI_TEMPLATE (decl))))
- {
- TYPE_HAS_INIT_REF (ctype) = 1;
- if (CP_TYPE_CONST_P (TREE_TYPE (parmtype)))
- TYPE_HAS_CONST_INIT_REF (ctype) = 1;
- }
- /* [class.copy]
-
- A declaration of a constructor for a class X is ill-formed if its
- first parameter is of type (optionally cv-qualified) X and either
- there are no other parameters or else all other parameters have
- default arguments.
-
- We *don't* complain about member template instantiations that
- have this form, though; they can occur as we try to decide what
- constructor to use during overload resolution. Since overload
- resolution will never prefer such a constructor to the
- non-template copy constructor (which is either explicitly or
- implicitly defined), there's no need to worry about their
- existence. Theoretically, they should never even be
- instantiated, but that's hard to forestall. */
- else if (TYPE_MAIN_VARIANT (parmtype) == ctype
- && (TREE_CHAIN (parmtypes) == NULL_TREE
- || TREE_CHAIN (parmtypes) == void_list_node
- || TREE_PURPOSE (TREE_CHAIN (parmtypes)))
- && !(DECL_TEMPLATE_INSTANTIATION (decl)
- && is_member_template (DECL_TI_TEMPLATE (decl))))
- {
- cp_error ("invalid constructor; you probably meant `%T (const %T&)'",
+ int ctor_parm = copy_fn_p (decl);
+
+ if (ctor_parm < 0)
+ {
+ /* [class.copy]
+
+ A declaration of a constructor for a class X is ill-formed if
+ its first parameter is of type (optionally cv-qualified) X
+ and either there are no other parameters or else all other
+ parameters have default arguments.
+
+ We *don't* complain about member template instantiations that
+ have this form, though; they can occur as we try to decide
+ what constructor to use during overload resolution. Since
+ overload resolution will never prefer such a constructor to
+ the non-template copy constructor (which is either explicitly
+ or implicitly defined), there's no need to worry about their
+ existence. Theoretically, they should never even be
+ instantiated, but that's hard to forestall. */
+ error ("invalid constructor; you probably meant `%T (const %T&)'",
ctype, ctype);
SET_IDENTIFIER_ERROR_LOCUS (DECL_NAME (decl), ctype);
return 0;
}
- else if (TREE_CODE (parmtype) == VOID_TYPE
- || TREE_PURPOSE (parmtypes) != NULL_TREE)
- TYPE_HAS_DEFAULT_CONSTRUCTOR (ctype) = 1;
-
+
return 1;
}
-/* An operator with this name can be either unary or binary. */
+/* An operator with this code is unary, but can also be binary. */
static int
-ambi_op_p (name)
- tree name;
+ambi_op_p (code)
+ enum tree_code code;
{
- return (name == ansi_opname [(int) INDIRECT_REF]
- || name == ansi_opname [(int) ADDR_EXPR]
- || name == ansi_opname [(int) NEGATE_EXPR]
- || name == ansi_opname[(int) POSTINCREMENT_EXPR]
- || name == ansi_opname[(int) POSTDECREMENT_EXPR]
- || name == ansi_opname [(int) CONVERT_EXPR]);
+ return (code == INDIRECT_REF
+ || code == ADDR_EXPR
+ || code == CONVERT_EXPR
+ || code == NEGATE_EXPR
+ || code == PREINCREMENT_EXPR
+ || code == PREDECREMENT_EXPR);
}
/* An operator with this name can only be unary. */
static int
-unary_op_p (name)
- tree name;
+unary_op_p (code)
+ enum tree_code code;
{
- return (name == ansi_opname [(int) TRUTH_NOT_EXPR]
- || name == ansi_opname [(int) BIT_NOT_EXPR]
- || name == ansi_opname [(int) COMPONENT_REF]
- || IDENTIFIER_TYPENAME_P (name));
+ return (code == TRUTH_NOT_EXPR
+ || code == BIT_NOT_EXPR
+ || code == COMPONENT_REF
+ || code == TYPE_EXPR);
}
/* Do a little sanity-checking on how they declared their operator. */
void
-grok_op_properties (decl, virtualp, friendp)
+grok_op_properties (decl, friendp)
tree decl;
- int virtualp, friendp;
+ int friendp;
{
tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (decl));
+ tree argtype;
int methodp = (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE);
tree name = DECL_NAME (decl);
+ enum tree_code operator_code;
+ int arity;
+
+ /* Count the number of arguments. */
+ for (argtype = argtypes, arity = 0;
+ argtype && argtype != void_list_node;
+ argtype = TREE_CHAIN (argtype))
+ ++arity;
if (current_class_type == NULL_TREE)
friendp = 1;
+ if (DECL_CONV_FN_P (decl))
+ operator_code = TYPE_EXPR;
+ else
+ do
+ {
+#define DEF_OPERATOR(NAME, CODE, MANGLING, ARITY, ASSN_P) \
+ if (ansi_opname (CODE) == name) \
+ { \
+ operator_code = (CODE); \
+ break; \
+ } \
+ else if (ansi_assopname (CODE) == name) \
+ { \
+ operator_code = (CODE); \
+ DECL_ASSIGNMENT_OPERATOR_P (decl) = 1; \
+ break; \
+ }
+
+#include "operators.def"
+#undef DEF_OPERATOR
+
+ abort ();
+ }
+ while (0);
+ my_friendly_assert (operator_code != LAST_CPLUS_TREE_CODE, 20000526);
+ SET_OVERLOADED_OPERATOR_CODE (decl, operator_code);
+
if (! friendp)
{
- /* [class.copy]
+ switch (operator_code)
+ {
+ case CALL_EXPR:
+ TYPE_OVERLOADS_CALL_EXPR (current_class_type) = 1;
+ break;
- A user-declared copy assignment operator X::operator= is a
- non-static non-template member function of class X with
- exactly one parameter of type X, X&, const X&, volatile X& or
- const volatile X&. */
- if (name == ansi_opname[(int) MODIFY_EXPR]
- && !(DECL_TEMPLATE_INSTANTIATION (decl)
- && is_member_template (DECL_TI_TEMPLATE (decl))))
- ;
- else if (name == ansi_opname[(int) CALL_EXPR])
- TYPE_OVERLOADS_CALL_EXPR (current_class_type) = 1;
- else if (name == ansi_opname[(int) ARRAY_REF])
- TYPE_OVERLOADS_ARRAY_REF (current_class_type) = 1;
- else if (name == ansi_opname[(int) COMPONENT_REF]
- || name == ansi_opname[(int) MEMBER_REF])
- TYPE_OVERLOADS_ARROW (current_class_type) = 1;
- else if (name == ansi_opname[(int) NEW_EXPR])
- TYPE_GETS_NEW (current_class_type) |= 1;
- else if (name == ansi_opname[(int) DELETE_EXPR])
- TYPE_GETS_DELETE (current_class_type) |= 1;
- else if (name == ansi_opname[(int) VEC_NEW_EXPR])
- TYPE_GETS_NEW (current_class_type) |= 2;
- else if (name == ansi_opname[(int) VEC_DELETE_EXPR])
- TYPE_GETS_DELETE (current_class_type) |= 2;
- }
-
- if (name == ansi_opname[(int) NEW_EXPR]
- || name == ansi_opname[(int) VEC_NEW_EXPR])
+ case ARRAY_REF:
+ TYPE_OVERLOADS_ARRAY_REF (current_class_type) = 1;
+ break;
+
+ case COMPONENT_REF:
+ case MEMBER_REF:
+ TYPE_OVERLOADS_ARROW (current_class_type) = 1;
+ break;
+
+ case NEW_EXPR:
+ TYPE_HAS_NEW_OPERATOR (current_class_type) = 1;
+ break;
+
+ case DELETE_EXPR:
+ TYPE_GETS_DELETE (current_class_type) |= 1;
+ break;
+
+ case VEC_NEW_EXPR:
+ TYPE_HAS_ARRAY_NEW_OPERATOR (current_class_type) = 1;
+ break;
+
+ case VEC_DELETE_EXPR:
+ TYPE_GETS_DELETE (current_class_type) |= 2;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (operator_code == NEW_EXPR || operator_code == VEC_NEW_EXPR)
{
/* When the compiler encounters the definition of A::operator new, it
doesn't look at the class declaration to find out if it's static. */
if (methodp)
- revert_static_member_fn (&decl, NULL, NULL);
-
- /* Take care of function decl if we had syntax errors. */
- if (argtypes == NULL_TREE)
- TREE_TYPE (decl)
- = build_function_type (ptr_type_node,
- hash_tree_chain (integer_type_node,
- void_list_node));
- else
- TREE_TYPE (decl) = coerce_new_type (TREE_TYPE (decl));
+ revert_static_member_fn (decl);
+
+ TREE_TYPE (decl) = coerce_new_type (TREE_TYPE (decl));
}
- else if (name == ansi_opname[(int) DELETE_EXPR]
- || name == ansi_opname[(int) VEC_DELETE_EXPR])
+ else if (operator_code == DELETE_EXPR || operator_code == VEC_DELETE_EXPR)
{
if (methodp)
- revert_static_member_fn (&decl, NULL, NULL);
-
- if (argtypes == NULL_TREE)
- TREE_TYPE (decl)
- = build_function_type (void_type_node,
- hash_tree_chain (ptr_type_node,
- void_list_node));
- else
- {
- TREE_TYPE (decl) = coerce_delete_type (TREE_TYPE (decl));
+ revert_static_member_fn (decl);
- if (! friendp && name == ansi_opname[(int) VEC_DELETE_EXPR]
- && (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (decl)))
- != void_list_node))
- TYPE_VEC_DELETE_TAKES_SIZE (current_class_type) = 1;
- }
+ TREE_TYPE (decl) = coerce_delete_type (TREE_TYPE (decl));
}
else
{
@@ -12342,18 +12396,18 @@ grok_op_properties (decl, virtualp, friendp)
an enumeration, or a reference to an enumeration. 13.4.0.6 */
if (! methodp || DECL_STATIC_FUNCTION_P (decl))
{
- if (IDENTIFIER_TYPENAME_P (name)
- || name == ansi_opname[(int) CALL_EXPR]
- || name == ansi_opname[(int) MODIFY_EXPR]
- || name == ansi_opname[(int) COMPONENT_REF]
- || name == ansi_opname[(int) ARRAY_REF])
- cp_error ("`%D' must be a nonstatic member function", decl);
+ if (operator_code == TYPE_EXPR
+ || operator_code == CALL_EXPR
+ || operator_code == COMPONENT_REF
+ || operator_code == ARRAY_REF
+ || operator_code == NOP_EXPR)
+ error ("`%D' must be a nonstatic member function", decl);
else
{
tree p = argtypes;
if (DECL_STATIC_FUNCTION_P (decl))
- cp_error ("`%D' must be either a non-static member function or a non-member function", decl);
+ error ("`%D' must be either a non-static member function or a non-member function", decl);
if (p)
for (; TREE_CODE (TREE_VALUE (p)) != VOID_TYPE ; p = TREE_CHAIN (p))
@@ -12366,37 +12420,38 @@ grok_op_properties (decl, virtualp, friendp)
if (IS_AGGR_TYPE (arg)
|| TREE_CODE (arg) == ENUMERAL_TYPE
|| TREE_CODE (arg) == TEMPLATE_TYPE_PARM
- || TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM)
+ || TREE_CODE (arg) == BOUND_TEMPLATE_TEMPLATE_PARM)
goto foundaggr;
}
- cp_error
+ error
("`%D' must have an argument of class or enumerated type",
decl);
foundaggr:
;
}
}
-
- if (name == ansi_opname[(int) CALL_EXPR])
+
+ if (operator_code == CALL_EXPR)
return; /* No restrictions on args. */
if (IDENTIFIER_TYPENAME_P (name) && ! DECL_TEMPLATE_INFO (decl))
{
tree t = TREE_TYPE (name);
- if (TREE_CODE (t) == VOID_TYPE)
- pedwarn ("void is not a valid type conversion operator");
- else if (! friendp)
+ if (! friendp)
{
int ref = (TREE_CODE (t) == REFERENCE_TYPE);
const char *what = 0;
+
if (ref)
t = TYPE_MAIN_VARIANT (TREE_TYPE (t));
- if (t == current_class_type)
+ if (TREE_CODE (t) == VOID_TYPE)
+ what = "void";
+ else if (t == current_class_type)
what = "the same type";
/* Don't force t to be complete here. */
else if (IS_AGGR_TYPE (t)
- && TYPE_SIZE (t)
+ && COMPLETE_TYPE_P (t)
&& DERIVED_FROM_P (t, current_class_type))
what = "a base class";
@@ -12405,50 +12460,63 @@ grok_op_properties (decl, virtualp, friendp)
ref ? "a reference to " : "", what);
}
}
-
- if (name == ansi_opname[(int) MODIFY_EXPR])
+ if (operator_code == COND_EXPR)
{
- tree parmtype;
-
- if (list_length (argtypes) != 3 && methodp)
- {
- cp_error ("`%D' must take exactly one argument", decl);
- return;
- }
- parmtype = TREE_VALUE (TREE_CHAIN (argtypes));
-
- if (copy_assignment_arg_p (parmtype, virtualp)
- && ! friendp)
- {
- TYPE_HAS_ASSIGN_REF (current_class_type) = 1;
- if (TREE_CODE (parmtype) != REFERENCE_TYPE
- || CP_TYPE_CONST_P (TREE_TYPE (parmtype)))
- TYPE_HAS_CONST_ASSIGN_REF (current_class_type) = 1;
- }
+ /* 13.4.0.3 */
+ error ("ISO C++ prohibits overloading operator ?:");
}
- else if (name == ansi_opname[(int) COND_EXPR])
+ else if (ambi_op_p (operator_code))
{
- /* 13.4.0.3 */
- pedwarn ("ANSI C++ prohibits overloading operator ?:");
- if (list_length (argtypes) != 4)
- cp_error ("`%D' must take exactly three arguments", decl);
- }
- else if (ambi_op_p (name))
- {
- if (list_length (argtypes) == 2)
- /* prefix */;
- else if (list_length (argtypes) == 3)
+ if (arity == 1)
+ /* We pick the one-argument operator codes by default, so
+ we don't have to change anything. */
+ ;
+ else if (arity == 2)
{
- if ((name == ansi_opname[(int) POSTINCREMENT_EXPR]
- || name == ansi_opname[(int) POSTDECREMENT_EXPR])
+ /* If we thought this was a unary operator, we now know
+ it to be a binary operator. */
+ switch (operator_code)
+ {
+ case INDIRECT_REF:
+ operator_code = MULT_EXPR;
+ break;
+
+ case ADDR_EXPR:
+ operator_code = BIT_AND_EXPR;
+ break;
+
+ case CONVERT_EXPR:
+ operator_code = PLUS_EXPR;
+ break;
+
+ case NEGATE_EXPR:
+ operator_code = MINUS_EXPR;
+ break;
+
+ case PREINCREMENT_EXPR:
+ operator_code = POSTINCREMENT_EXPR;
+ break;
+
+ case PREDECREMENT_EXPR:
+ operator_code = POSTDECREMENT_EXPR;
+ break;
+
+ default:
+ abort ();
+ }
+
+ SET_OVERLOADED_OPERATOR_CODE (decl, operator_code);
+
+ if ((operator_code == POSTINCREMENT_EXPR
+ || operator_code == POSTDECREMENT_EXPR)
&& ! processing_template_decl
&& ! same_type_p (TREE_VALUE (TREE_CHAIN (argtypes)), integer_type_node))
{
if (methodp)
- cp_error ("postfix `%D' must take `int' as its argument",
+ error ("postfix `%D' must take `int' as its argument",
decl);
else
- cp_error
+ error
("postfix `%D' must take `int' as its second argument",
decl);
}
@@ -12456,90 +12524,94 @@ grok_op_properties (decl, virtualp, friendp)
else
{
if (methodp)
- cp_error ("`%D' must take either zero or one argument", decl);
+ error ("`%D' must take either zero or one argument", decl);
else
- cp_error ("`%D' must take either one or two arguments", decl);
+ error ("`%D' must take either one or two arguments", decl);
}
/* More Effective C++ rule 6. */
if (warn_ecpp
- && (name == ansi_opname[(int) POSTINCREMENT_EXPR]
- || name == ansi_opname[(int) POSTDECREMENT_EXPR]))
+ && (operator_code == POSTINCREMENT_EXPR
+ || operator_code == POSTDECREMENT_EXPR
+ || operator_code == PREINCREMENT_EXPR
+ || operator_code == PREDECREMENT_EXPR))
{
tree arg = TREE_VALUE (argtypes);
tree ret = TREE_TYPE (TREE_TYPE (decl));
if (methodp || TREE_CODE (arg) == REFERENCE_TYPE)
arg = TREE_TYPE (arg);
arg = TYPE_MAIN_VARIANT (arg);
- if (list_length (argtypes) == 2)
+ if (operator_code == PREINCREMENT_EXPR
+ || operator_code == PREDECREMENT_EXPR)
{
if (TREE_CODE (ret) != REFERENCE_TYPE
|| !same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (ret)),
arg))
- cp_warning ("prefix `%D' should return `%T'", decl,
+ warning ("prefix `%D' should return `%T'", decl,
build_reference_type (arg));
}
else
{
if (!same_type_p (TYPE_MAIN_VARIANT (ret), arg))
- cp_warning ("postfix `%D' should return `%T'", decl, arg);
+ warning ("postfix `%D' should return `%T'", decl, arg);
}
}
}
- else if (unary_op_p (name))
+ else if (unary_op_p (operator_code))
{
- if (list_length (argtypes) != 2)
+ if (arity != 1)
{
if (methodp)
- cp_error ("`%D' must take `void'", decl);
+ error ("`%D' must take `void'", decl);
else
- cp_error ("`%D' must take exactly one argument", decl);
+ error ("`%D' must take exactly one argument", decl);
}
}
- else /* if (binary_op_p (name)) */
+ else /* if (binary_op_p (operator_code)) */
{
- if (list_length (argtypes) != 3)
+ if (arity != 2)
{
if (methodp)
- cp_error ("`%D' must take exactly one argument", decl);
+ error ("`%D' must take exactly one argument", decl);
else
- cp_error ("`%D' must take exactly two arguments", decl);
+ error ("`%D' must take exactly two arguments", decl);
}
/* More Effective C++ rule 7. */
if (warn_ecpp
- && (name == ansi_opname [TRUTH_ANDIF_EXPR]
- || name == ansi_opname [TRUTH_ORIF_EXPR]
- || name == ansi_opname [COMPOUND_EXPR]))
- cp_warning ("user-defined `%D' always evaluates both arguments",
+ && (operator_code == TRUTH_ANDIF_EXPR
+ || operator_code == TRUTH_ORIF_EXPR
+ || operator_code == COMPOUND_EXPR))
+ warning ("user-defined `%D' always evaluates both arguments",
decl);
}
/* Effective C++ rule 23. */
if (warn_ecpp
- && list_length (argtypes) == 3
- && (name == ansi_opname [PLUS_EXPR]
- || name == ansi_opname [MINUS_EXPR]
- || name == ansi_opname [TRUNC_DIV_EXPR]
- || name == ansi_opname [MULT_EXPR])
+ && arity == 2
+ && (operator_code == PLUS_EXPR
+ || operator_code == MINUS_EXPR
+ || operator_code == TRUNC_DIV_EXPR
+ || operator_code == MULT_EXPR)
&& TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == REFERENCE_TYPE)
- cp_warning ("`%D' should return by value", decl);
+ warning ("`%D' should return by value", decl);
+
+ /* [over.oper]/8 */
+ for (; argtypes && argtypes != void_list_node;
+ argtypes = TREE_CHAIN (argtypes))
+ if (TREE_PURPOSE (argtypes))
+ {
+ TREE_PURPOSE (argtypes) = NULL_TREE;
+ if (operator_code == POSTINCREMENT_EXPR
+ || operator_code == POSTDECREMENT_EXPR)
+ {
+ if (pedantic)
+ pedwarn ("`%D' cannot have default arguments", decl);
+ }
+ else
+ error ("`%D' cannot have default arguments", decl);
+ }
- /* 13.4.0.8 */
- if (argtypes)
- for (; argtypes != void_list_node ; argtypes = TREE_CHAIN (argtypes))
- if (TREE_PURPOSE (argtypes))
- {
- TREE_PURPOSE (argtypes) = NULL_TREE;
- if (name == ansi_opname[(int) POSTINCREMENT_EXPR]
- || name == ansi_opname[(int) POSTDECREMENT_EXPR])
- {
- if (pedantic)
- cp_pedwarn ("`%D' cannot have default arguments", decl);
- }
- else
- cp_error ("`%D' cannot have default arguments", decl);
- }
}
}
@@ -12557,10 +12629,8 @@ tag_name (code)
return "union ";
case enum_type:
return "enum";
- case signature_type:
- return "signature";
default:
- my_friendly_abort (981122);
+ abort ();
}
}
@@ -12582,7 +12652,6 @@ xref_tag (code_type_node, name, globalize)
{
enum tag_types tag_code;
enum tree_code code;
- int temp = 0;
register tree ref, t;
struct binding_level *b = current_binding_level;
int got_type = 0;
@@ -12599,12 +12668,11 @@ xref_tag (code_type_node, name, globalize)
code_type_node = TREE_VALUE (code_type_node);
}
- tag_code = (enum tag_types) TREE_INT_CST_LOW (code_type_node);
+ tag_code = (enum tag_types) tree_low_cst (code_type_node, 1);
switch (tag_code)
{
case record_type:
case class_type:
- case signature_type:
code = RECORD_TYPE;
break;
case union_type:
@@ -12614,12 +12682,12 @@ xref_tag (code_type_node, name, globalize)
code = ENUMERAL_TYPE;
break;
default:
- my_friendly_abort (18);
+ abort ();
}
/* If a cross reference is requested, look up the type
already defined for this tag and return it. */
- if (TREE_CODE_CLASS (TREE_CODE (name)) == 't')
+ if (TYPE_P (name))
{
t = name;
name = TYPE_IDENTIFIER (t);
@@ -12628,8 +12696,34 @@ xref_tag (code_type_node, name, globalize)
else
t = IDENTIFIER_TYPE_VALUE (name);
+ /* Warn about 'friend struct Inherited;' doing the wrong thing. */
+ if (t && globalize && TREE_CODE (t) == TYPENAME_TYPE)
+ {
+ static int explained;
+ tree shadowed;
+
+ warning ("`%s %T' declares a new type at namespace scope",
+ tag_name (tag_code), name);
+ if (!explained++)
+ warning (" names from dependent base classes are not visible to unqualified name lookup - to refer to the inherited type, say `%s %T::%T'",
+ tag_name (tag_code),
+ constructor_name (current_class_type),
+ TYPE_IDENTIFIER (t));
+
+ /* We need to remove the class scope binding for the
+ TYPENAME_TYPE as otherwise poplevel_class gets confused. */
+ for (shadowed = b->class_shadowed;
+ shadowed;
+ shadowed = TREE_CHAIN (shadowed))
+ if (TREE_TYPE (shadowed) == TYPE_NAME (t))
+ {
+ TREE_PURPOSE (shadowed) = NULL_TREE;
+ break;
+ }
+ }
+
if (t && TREE_CODE (t) != code && TREE_CODE (t) != TEMPLATE_TYPE_PARM
- && TREE_CODE (t) != TEMPLATE_TEMPLATE_PARM)
+ && TREE_CODE (t) != BOUND_TEMPLATE_TEMPLATE_PARM)
t = NULL_TREE;
if (! globalize)
@@ -12647,21 +12741,21 @@ xref_tag (code_type_node, name, globalize)
elaborated-type-specifier is ill-formed. */
if (t != TYPE_MAIN_VARIANT (t)
|| (CLASS_TYPE_P (t) && TYPE_WAS_ANONYMOUS (t)))
- cp_pedwarn ("using typedef-name `%D' after `%s'",
+ pedwarn ("using typedef-name `%D' after `%s'",
TYPE_NAME (t), tag_name (tag_code));
else if (TREE_CODE (t) == TEMPLATE_TYPE_PARM)
- cp_error ("using template type parameter `%T' after `%s'",
+ error ("using template type parameter `%T' after `%s'",
t, tag_name (tag_code));
ref = t;
}
else
ref = lookup_tag (code, name, b, 0);
-
+
if (! ref)
{
/* Try finding it as a type declaration. If that wins,
- use it. */
+ use it. */
ref = lookup_name (name, 1);
if (ref != NULL_TREE
@@ -12670,7 +12764,7 @@ xref_tag (code_type_node, name, globalize)
&& template_class_depth (current_class_type) == 0)
/* Since GLOBALIZE is true, we're declaring a global
template, so we want this type. */
- ref = DECL_RESULT (ref);
+ ref = DECL_TEMPLATE_RESULT (ref);
if (ref && TREE_CODE (ref) == TYPE_DECL
&& TREE_CODE (TREE_TYPE (ref)) == code)
@@ -12679,9 +12773,9 @@ xref_tag (code_type_node, name, globalize)
ref = NULL_TREE;
}
- if (ref && current_class_type
- && template_class_depth (current_class_type)
- && PROCESSING_REAL_TEMPLATE_DECL_P ())
+ if (ref && current_class_type
+ && template_class_depth (current_class_type)
+ && PROCESSING_REAL_TEMPLATE_DECL_P ())
{
/* Since GLOBALIZE is non-zero, we are not looking at a
definition of this tag. Since, in addition, we are currently
@@ -12724,25 +12818,15 @@ xref_tag (code_type_node, name, globalize)
}
}
- push_obstacks_nochange ();
-
if (! ref)
{
/* If no such tag is yet defined, create a forward-reference node
and record it as the "definition".
When a real declaration of this type is found,
the forward-reference will be altered into a real type. */
-
- /* In C++, since these migrate into the global scope, we must
- build them on the permanent obstack. */
-
- temp = allocation_temporary_p ();
- if (temp)
- end_temporary_allocation ();
-
if (code == ENUMERAL_TYPE)
{
- cp_error ("use of enum `%#D' without previous declaration", name);
+ error ("use of enum `%#D' without previous declaration", name);
ref = make_node (ENUMERAL_TYPE);
@@ -12750,6 +12834,7 @@ xref_tag (code_type_node, name, globalize)
to avoid crashing if it does not get defined. */
TYPE_MODE (ref) = TYPE_MODE (unsigned_type_node);
TYPE_ALIGN (ref) = TYPE_ALIGN (unsigned_type_node);
+ TYPE_USER_ALIGN (ref) = 0;
TREE_UNSIGNED (ref) = 1;
TYPE_PRECISION (ref) = TYPE_PRECISION (unsigned_type_node);
TYPE_MIN_VALUE (ref) = TYPE_MIN_VALUE (unsigned_type_node);
@@ -12766,20 +12851,9 @@ xref_tag (code_type_node, name, globalize)
{
struct binding_level *old_b = class_binding_level;
- ref = make_lang_type (code);
+ ref = make_aggr_type (code);
TYPE_CONTEXT (ref) = context;
- if (tag_code == signature_type)
- {
- SET_SIGNATURE (ref);
- /* Since a signature type will be turned into the type
- of signature tables, it's not only an interface. */
- CLASSTYPE_INTERFACE_ONLY (ref) = 0;
- SET_CLASSTYPE_INTERFACE_KNOWN (ref);
- /* A signature doesn't have a vtable. */
- CLASSTYPE_VTABLE_NEEDS_WRITING (ref) = 0;
- }
-
#ifdef NONNESTED_CLASSES
/* Class types don't nest the way enums do. */
class_binding_level = (struct binding_level *)0;
@@ -12790,36 +12864,24 @@ xref_tag (code_type_node, name, globalize)
}
else
{
- /* If it no longer looks like a nested type, make sure it's
- in global scope.
- If it is not an IDENTIFIER, this is not a declaration */
- if (b->namespace_p && !class_binding_level
- && TREE_CODE (name) == IDENTIFIER_NODE)
- {
- if (IDENTIFIER_NAMESPACE_VALUE (name) == NULL_TREE)
- SET_IDENTIFIER_NAMESPACE_VALUE (name, TYPE_NAME (ref));
- }
-
if (!globalize && processing_template_decl && IS_AGGR_TYPE (ref))
redeclare_class_template (ref, current_template_parms);
}
/* Until the type is defined, tentatively accept whatever
structure tag the user hands us. */
- if (TYPE_SIZE (ref) == NULL_TREE
+ if (!COMPLETE_TYPE_P (ref)
&& ref != current_class_type
/* Have to check this, in case we have contradictory tag info. */
&& IS_AGGR_TYPE_CODE (TREE_CODE (ref)))
{
if (tag_code == class_type)
CLASSTYPE_DECLARED_CLASS (ref) = 1;
- else if (tag_code == record_type || tag_code == signature_type)
+ else if (tag_code == record_type)
CLASSTYPE_DECLARED_CLASS (ref) = 0;
}
- pop_obstacks ();
-
- TREE_TYPE (ref) = attributes;
+ TYPE_ATTRIBUTES (ref) = attributes;
return ref;
}
@@ -12861,16 +12923,24 @@ xref_basetypes (code_type_node, name, ref, binfo)
tree base;
int i, len;
- enum tag_types tag_code = (enum tag_types) TREE_INT_CST_LOW (code_type_node);
+ enum tag_types tag_code;
+
+ /* If we are called from the parser, code_type_node will sometimes be a
+ TREE_LIST. This indicates that the user wrote
+ "class __attribute__ ((foo)) bar". Extract the attributes so that
+ tree_low_cst doesn't crash. */
+ if (TREE_CODE (code_type_node) == TREE_LIST)
+ code_type_node = TREE_VALUE (code_type_node);
+
+ tag_code = (enum tag_types) tree_low_cst (code_type_node, 1);
if (tag_code == union_type)
{
- cp_error ("derived union `%T' invalid", ref);
+ error ("derived union `%T' invalid", ref);
return;
}
len = list_length (binfo);
- push_obstacks (TYPE_OBSTACK (ref), TYPE_OBSTACK (ref));
/* First, make sure that any templates in base-classes are
instantiated. This ensures that if we call ourselves recursively
@@ -12908,9 +12978,9 @@ xref_basetypes (code_type_node, name, ref, binfo)
|| (TREE_CODE (basetype) != RECORD_TYPE
&& TREE_CODE (basetype) != TYPENAME_TYPE
&& TREE_CODE (basetype) != TEMPLATE_TYPE_PARM
- && TREE_CODE (basetype) != TEMPLATE_TEMPLATE_PARM))
+ && TREE_CODE (basetype) != BOUND_TEMPLATE_TEMPLATE_PARM))
{
- cp_error ("base type `%T' fails to be a struct or class type",
+ error ("base type `%T' fails to be a struct or class type",
TREE_VALUE (binfo));
continue;
}
@@ -12919,10 +12989,10 @@ xref_basetypes (code_type_node, name, ref, binfo)
/* This code replaces similar code in layout_basetypes.
We put the complete_type first for implicit `typename'. */
- if (TYPE_SIZE (basetype) == NULL_TREE
+ if (!COMPLETE_TYPE_P (basetype)
&& ! (current_template_parms && uses_template_parms (basetype)))
{
- cp_error ("base class `%T' has incomplete type", basetype);
+ error ("base class `%T' has incomplete type", basetype);
continue;
}
else
@@ -12930,14 +13000,14 @@ xref_basetypes (code_type_node, name, ref, binfo)
if (CLASSTYPE_MARKED (basetype))
{
if (basetype == ref)
- cp_error ("recursive type `%T' undefined", basetype);
+ error ("recursive type `%T' undefined", basetype);
else
- cp_error ("duplicate base type `%T' invalid", basetype);
+ error ("duplicate base type `%T' invalid", basetype);
continue;
}
if (TYPE_FOR_JAVA (basetype)
- && current_lang_stack == current_lang_base)
+ && (current_lang_depth () == 0))
TYPE_FOR_JAVA (ref) = 1;
/* Note that the BINFO records which describe individual
@@ -12947,14 +13017,14 @@ xref_basetypes (code_type_node, name, ref, binfo)
derived classes. (Each BINFO record describing an
individual inheritance contains flags which say what
the `accessibility' of that particular inheritance is.) */
-
- base_binfo
- = make_binfo (integer_zero_node, basetype,
+
+ base_binfo
+ = make_binfo (size_zero_node, basetype,
CLASS_TYPE_P (basetype)
? TYPE_BINFO_VTABLE (basetype) : NULL_TREE,
CLASS_TYPE_P (basetype)
? TYPE_BINFO_VIRTUALS (basetype) : NULL_TREE);
-
+
TREE_VEC_ELT (binfos, i) = base_binfo;
TREE_VIA_PUBLIC (base_binfo) = via_public;
TREE_VIA_PROTECTED (base_binfo) = via_protected;
@@ -12972,23 +13042,26 @@ xref_basetypes (code_type_node, name, ref, binfo)
if (via_virtual || TYPE_USES_VIRTUAL_BASECLASSES (basetype))
{
TYPE_USES_VIRTUAL_BASECLASSES (ref) = 1;
- TYPE_USES_COMPLEX_INHERITANCE (ref) = 1;
- /* The PVBASES flag is never set for templates; we know
- only for instantiations whether the virtual bases are
- polymorphic. */
- if (flag_vtable_thunks >= 2 && !CLASSTYPE_IS_TEMPLATE (ref))
- {
- if (via_virtual && TYPE_VIRTUAL_P (basetype))
- TYPE_USES_PVBASES (ref) = 1;
- else if (TYPE_USES_PVBASES (basetype))
- TYPE_USES_PVBASES (ref) = 1;
- }
+ /* Converting to a virtual base class requires looking
+ up the offset of the virtual base. */
+ TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref) = 1;
}
if (CLASS_TYPE_P (basetype))
{
- TYPE_GETS_NEW (ref) |= TYPE_GETS_NEW (basetype);
+ TYPE_HAS_NEW_OPERATOR (ref)
+ |= TYPE_HAS_NEW_OPERATOR (basetype);
+ TYPE_HAS_ARRAY_NEW_OPERATOR (ref)
+ |= TYPE_HAS_ARRAY_NEW_OPERATOR (basetype);
TYPE_GETS_DELETE (ref) |= TYPE_GETS_DELETE (basetype);
+ /* If the base-class uses multiple inheritance, so do we. */
+ TYPE_USES_MULTIPLE_INHERITANCE (ref)
+ |= TYPE_USES_MULTIPLE_INHERITANCE (basetype);
+ /* Likewise, if converting to a base of the base may require
+ code, then we may need to generate code to convert to a
+ base as well. */
+ TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref)
+ |= TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (basetype);
}
i += 1;
@@ -13000,19 +13073,13 @@ xref_basetypes (code_type_node, name, ref, binfo)
BINFO_BASETYPES (TYPE_BINFO (ref)) = NULL_TREE;
if (i > 1)
- TYPE_USES_MULTIPLE_INHERITANCE (ref) = 1;
- else if (i == 1)
{
- tree basetype = BINFO_TYPE (TREE_VEC_ELT (binfos, 0));
-
- if (CLASS_TYPE_P (basetype))
- TYPE_USES_MULTIPLE_INHERITANCE (ref)
- = TYPE_USES_MULTIPLE_INHERITANCE (basetype);
+ TYPE_USES_MULTIPLE_INHERITANCE (ref) = 1;
+ /* If there is more than one non-empty they cannot be at the same
+ address. */
+ TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref) = 1;
}
- if (TYPE_USES_MULTIPLE_INHERITANCE (ref))
- TYPE_USES_COMPLEX_INHERITANCE (ref) = 1;
-
/* Unmark all the types. */
while (--i >= 0)
CLEAR_CLASSTYPE_MARKED (BINFO_TYPE (TREE_VEC_ELT (binfos, i)));
@@ -13020,11 +13087,9 @@ xref_basetypes (code_type_node, name, ref, binfo)
/* Now that we know all the base-classes, set up the list of virtual
bases. */
- CLASSTYPE_VBASECLASSES (ref) = get_vbase_types (ref);
-
- pop_obstacks ();
+ get_vbase_types (ref);
}
-
+
/* Begin compiling the definition of an enumeration type.
NAME is its name (or null if anonymous).
@@ -13039,10 +13104,6 @@ start_enum (name)
register tree enumtype = NULL_TREE;
struct binding_level *b = current_binding_level;
- /* We are wasting space here and putting these on the permanent_obstack so
- that typeid(local enum) will work correctly. */
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
/* If this is the real definition for a previous forward reference,
fill in the contents in the same object that used to be the
forward reference. */
@@ -13051,7 +13112,12 @@ start_enum (name)
enumtype = lookup_tag (ENUMERAL_TYPE, name, b, 1);
if (enumtype != NULL_TREE && TREE_CODE (enumtype) == ENUMERAL_TYPE)
- cp_error ("multiple definition of `%#T'", enumtype);
+ {
+ error ("multiple definition of `%#T'", enumtype);
+ cp_error_at ("previous definition here", enumtype);
+ /* Clear out TYPE_VALUES, and start again. */
+ TYPE_VALUES (enumtype) = NULL_TREE;
+ }
else
{
enumtype = make_node (ENUMERAL_TYPE);
@@ -13061,259 +13127,311 @@ start_enum (name)
if (current_class_type)
TREE_ADDRESSABLE (b->tags) = 1;
- /* We don't copy this value because build_enumerator needs to do it. */
- enum_next_value = integer_zero_node;
- enum_overflow = 0;
-
GNU_xref_decl (current_function_decl, enumtype);
return enumtype;
}
/* After processing and defining all the values of an enumeration type,
install their decls in the enumeration type and finish it off.
- ENUMTYPE is the type object and VALUES a list of name-value pairs.
- Returns ENUMTYPE. */
+ ENUMTYPE is the type object and VALUES a list of name-value pairs. */
-tree
+void
finish_enum (enumtype)
tree enumtype;
{
- register tree minnode = NULL_TREE, maxnode = NULL_TREE;
- /* Calculate the maximum value of any enumerator in this type. */
+ tree pair;
+ tree minnode;
+ tree maxnode;
+ tree t;
+ bool unsignedp;
+ int lowprec;
+ int highprec;
+ int precision;
+
+ /* We built up the VALUES in reverse order. */
+ TYPE_VALUES (enumtype) = nreverse (TYPE_VALUES (enumtype));
+
+ /* [dcl.enum]
+
+ Following the closing brace of an enum-specifier, each
+ enumerator has the type of its enumeration. Prior to the
+ closing brace, the type of each enumerator is the type of
+ its initializing value. */
+ for (pair = TYPE_VALUES (enumtype); pair; pair = TREE_CHAIN (pair))
+ TREE_TYPE (TREE_VALUE (pair)) = enumtype;
+
+ /* For a enum defined in a template, all further processing is
+ postponed until the template is instantiated. */
+ if (processing_template_decl)
+ {
+ tree scope = current_scope ();
+ if (scope && TREE_CODE (scope) == FUNCTION_DECL)
+ add_stmt (build_min (TAG_DEFN, enumtype));
+
- tree values = TYPE_VALUES (enumtype);
- if (values)
+ return;
+ }
+
+ /* Figure out what the minimum and maximum values of the enumerators
+ are. */
+ if (TYPE_VALUES (enumtype))
{
- tree pair;
+ minnode = maxnode = NULL_TREE;
- for (pair = values; pair; pair = TREE_CHAIN (pair))
+ for (pair = TYPE_VALUES (enumtype);
+ pair;
+ pair = TREE_CHAIN (pair))
{
- tree decl;
tree value;
- /* The TREE_VALUE is a CONST_DECL for this enumeration
- constant. */
- decl = TREE_VALUE (pair);
-
- /* The DECL_INITIAL will be NULL if we are processing a
- template declaration and this enumeration constant had no
- explicit initializer. */
- value = DECL_INITIAL (decl);
- if (value && !processing_template_decl)
- {
- /* Set the TREE_TYPE for the VALUE as well. That's so
- that when we call decl_constant_value we get an
- entity of the right type (but with the constant
- value). Since we shouldn't ever call
- decl_constant_value on a template type, there's no
- reason to do that when processing_template_decl.
- And, if the expression is something like a
- TEMPLATE_PARM_INDEX or a CAST_EXPR doing so will
- wreak havoc on the intended type of the expression.
-
- Of course, there's also no point in trying to compute
- minimum or maximum values if we're in a template. */
- TREE_TYPE (value) = enumtype;
-
- if (!minnode)
- minnode = maxnode = value;
- else if (tree_int_cst_lt (maxnode, value))
- maxnode = value;
- else if (tree_int_cst_lt (value, minnode))
- minnode = value;
- }
+ value = DECL_INITIAL (TREE_VALUE (pair));
- if (processing_template_decl)
- /* If this is just a template, leave the CONST_DECL
- alone. That way tsubst_copy will find CONST_DECLs for
- CONST_DECLs, and not INTEGER_CSTs. */
- ;
- else
- /* In the list we're building up, we want the enumeration
- values, not the CONST_DECLs. */
- TREE_VALUE (pair) = value;
+ if (!minnode)
+ minnode = maxnode = value;
+ else if (tree_int_cst_lt (maxnode, value))
+ maxnode = value;
+ else if (tree_int_cst_lt (value, minnode))
+ minnode = value;
}
}
else
- maxnode = minnode = integer_zero_node;
-
- TYPE_VALUES (enumtype) = nreverse (values);
-
- if (processing_template_decl)
- {
- tree scope = current_scope ();
- if (scope && TREE_CODE (scope) == FUNCTION_DECL)
- add_tree (build_min (TAG_DEFN, enumtype));
- }
+ minnode = maxnode = integer_zero_node;
+
+ /* Compute the number of bits require to represent all values of the
+ enumeration. We must do this before the type of MINNODE and
+ MAXNODE are transformed, since min_precision relies on the
+ TREE_TYPE of the value it is passed. */
+ unsignedp = tree_int_cst_sgn (minnode) >= 0;
+ lowprec = min_precision (minnode, unsignedp);
+ highprec = min_precision (maxnode, unsignedp);
+ precision = MAX (lowprec, highprec);
+
+ /* Set the TREE_TYPE for the values as well. That's so that when we
+ call decl_constant_value we get an entity of the right type (but
+ with the constant value). In addition, transform the TYPE_VALUES
+ list to contain the values, rather than the CONST_DECLs for them. */
+ for (pair = TYPE_VALUES (enumtype); pair; pair = TREE_CHAIN (pair))
+ {
+ tree value = DECL_INITIAL (TREE_VALUE (pair));
+
+ TREE_TYPE (value) = enumtype;
+ TREE_VALUE (pair) = value;
+ }
+
+ /* Set TYPE_MIN_VALUE and TYPE_MAX_VALUE according to `precision'. */
+ TYPE_SIZE (enumtype) = NULL_TREE;
+ TYPE_PRECISION (enumtype) = precision;
+ if (unsignedp)
+ fixup_unsigned_type (enumtype);
else
- {
- int unsignedp = tree_int_cst_sgn (minnode) >= 0;
- int lowprec = min_precision (minnode, unsignedp);
- int highprec = min_precision (maxnode, unsignedp);
- int precision = MAX (lowprec, highprec);
- tree tem;
-
- TYPE_SIZE (enumtype) = NULL_TREE;
+ fixup_signed_type (enumtype);
- /* Set TYPE_MIN_VALUE and TYPE_MAX_VALUE according to `precision'. */
-
- TYPE_PRECISION (enumtype) = precision;
- if (unsignedp)
- fixup_unsigned_type (enumtype);
- else
- fixup_signed_type (enumtype);
-
- if (flag_short_enums || (precision > TYPE_PRECISION (integer_type_node)))
- /* Use the width of the narrowest normal C type which is wide
- enough. */
- TYPE_PRECISION (enumtype) = TYPE_PRECISION (type_for_size
- (precision, 1));
- else
- TYPE_PRECISION (enumtype) = TYPE_PRECISION (integer_type_node);
+ if (flag_short_enums || (precision > TYPE_PRECISION (integer_type_node)))
+ /* Use the width of the narrowest normal C type which is wide
+ enough. */
+ TYPE_PRECISION (enumtype) = TYPE_PRECISION (type_for_size
+ (precision, 1));
+ else
+ TYPE_PRECISION (enumtype) = TYPE_PRECISION (integer_type_node);
- TYPE_SIZE (enumtype) = 0;
- layout_type (enumtype);
-
- /* Fix up all variant types of this enum type. */
- for (tem = TYPE_MAIN_VARIANT (enumtype); tem;
- tem = TYPE_NEXT_VARIANT (tem))
- {
- TYPE_VALUES (tem) = TYPE_VALUES (enumtype);
- TYPE_MIN_VALUE (tem) = TYPE_MIN_VALUE (enumtype);
- TYPE_MAX_VALUE (tem) = TYPE_MAX_VALUE (enumtype);
- TYPE_SIZE (tem) = TYPE_SIZE (enumtype);
- TYPE_SIZE_UNIT (tem) = TYPE_SIZE_UNIT (enumtype);
- TYPE_MODE (tem) = TYPE_MODE (enumtype);
- TYPE_PRECISION (tem) = TYPE_PRECISION (enumtype);
- TYPE_ALIGN (tem) = TYPE_ALIGN (enumtype);
- TREE_UNSIGNED (tem) = TREE_UNSIGNED (enumtype);
- }
+ TYPE_SIZE (enumtype) = NULL_TREE;
+ layout_type (enumtype);
- /* Finish debugging output for this type. */
- rest_of_type_compilation (enumtype, namespace_bindings_p ());
+ /* Fix up all variant types of this enum type. */
+ for (t = TYPE_MAIN_VARIANT (enumtype); t; t = TYPE_NEXT_VARIANT (t))
+ {
+ TYPE_VALUES (t) = TYPE_VALUES (enumtype);
+ TYPE_MIN_VALUE (t) = TYPE_MIN_VALUE (enumtype);
+ TYPE_MAX_VALUE (t) = TYPE_MAX_VALUE (enumtype);
+ TYPE_SIZE (t) = TYPE_SIZE (enumtype);
+ TYPE_SIZE_UNIT (t) = TYPE_SIZE_UNIT (enumtype);
+ TYPE_MODE (t) = TYPE_MODE (enumtype);
+ TYPE_PRECISION (t) = TYPE_PRECISION (enumtype);
+ TYPE_ALIGN (t) = TYPE_ALIGN (enumtype);
+ TYPE_USER_ALIGN (t) = TYPE_USER_ALIGN (enumtype);
+ TREE_UNSIGNED (t) = TREE_UNSIGNED (enumtype);
}
- /* In start_enum we pushed obstacks. Here, we must pop them. */
- pop_obstacks ();
-
- return enumtype;
+ /* Finish debugging output for this type. */
+ rest_of_type_compilation (enumtype, namespace_bindings_p ());
}
/* Build and install a CONST_DECL for an enumeration constant of the
- enumeration type TYPE whose NAME and VALUE (if any) are provided.
+ enumeration type ENUMTYPE whose NAME and VALUE (if any) are provided.
Assignment of sequential values by default is handled here. */
-tree
-build_enumerator (name, value, type)
+void
+build_enumerator (name, value, enumtype)
tree name;
tree value;
- tree type;
+ tree enumtype;
{
- tree decl, result;
+ tree decl;
tree context;
+ tree type;
+ tree values;
/* Remove no-op casts from the value. */
if (value)
STRIP_TYPE_NOPS (value);
- if (! processing_template_decl)
- {
- /* Validate and default VALUE. */
- if (value != NULL_TREE)
- {
- if (TREE_READONLY_DECL_P (value))
- value = decl_constant_value (value);
-
- if (TREE_CODE (value) == INTEGER_CST)
- {
- value = default_conversion (value);
- constant_expression_warning (value);
- }
- else
- {
- cp_error ("enumerator value for `%D' not integer constant", name);
- value = NULL_TREE;
- }
- }
-
- /* Default based on previous value. */
- if (value == NULL_TREE && ! processing_template_decl)
- {
- value = enum_next_value;
- if (enum_overflow)
- cp_error ("overflow in enumeration values at `%D'", name);
- }
-
- /* Remove no-op casts from the value. */
- if (value)
- STRIP_TYPE_NOPS (value);
+ if (! processing_template_decl)
+ {
+ /* Validate and default VALUE. */
+ if (value != NULL_TREE)
+ {
+ value = decl_constant_value (value);
+
+ if (TREE_CODE (value) == INTEGER_CST)
+ {
+ value = default_conversion (value);
+ constant_expression_warning (value);
+ }
+ else
+ {
+ error ("enumerator value for `%D' not integer constant", name);
+ value = NULL_TREE;
+ }
+ }
+
+ /* Default based on previous value. */
+ if (value == NULL_TREE && ! processing_template_decl)
+ {
+ tree prev_value;
+
+ if (TYPE_VALUES (enumtype))
+ {
+ /* The next value is the previous value ... */
+ prev_value = DECL_INITIAL (TREE_VALUE (TYPE_VALUES (enumtype)));
+ /* ... plus one. */
+ value = cp_build_binary_op (PLUS_EXPR,
+ prev_value,
+ integer_one_node);
+
+ if (tree_int_cst_lt (value, prev_value))
+ error ("overflow in enumeration values at `%D'", name);
+ }
+ else
+ value = integer_zero_node;
+ }
+
+ /* Remove no-op casts from the value. */
+ if (value)
+ STRIP_TYPE_NOPS (value);
#if 0
- /* To fix MAX_VAL enum consts. (bkoz) */
- TREE_TYPE (value) = integer_type_node;
+ /* To fix MAX_VAL enum consts. (bkoz) */
+ TREE_TYPE (value) = integer_type_node;
#endif
- }
+ }
- /* We always have to copy here; not all INTEGER_CSTs are unshared.
- Even in other cases, we will later (in finish_enum) be setting the
- type of VALUE. */
- if (value != NULL_TREE)
- value = copy_node (value);
+ /* We always have to copy here; not all INTEGER_CSTs are unshared.
+ Even in other cases, we will later (in finish_enum) be setting
+ the type of VALUE. But, we don't need to make a copy if this
+ VALUE is one of the enumeration constants for this same
+ enumeration type. */
+ for (values = TYPE_VALUES (enumtype); values; values = TREE_CHAIN (values))
+ if (TREE_VALUE (values) == value)
+ break;
+ /* If we didn't break out of the loop, then we do need a copy. */
+ if (!values && value)
+ value = copy_node (value);
/* C++ associates enums with global, function, or class declarations. */
-
- context = current_scope ();
- if (context && context == current_class_type)
- /* This enum declaration is local to the class. */
- decl = build_lang_field_decl (CONST_DECL, name, type);
- else
- /* It's a global enum, or it's local to a function. (Note local to
+ context = current_scope ();
+
+ /* Build the actual enumeration constant. Note that the enumeration
+ constants have the type of their initializers until the
+ enumeration is complete:
+
+ [ dcl.enum ]
+
+ Following the closing brace of an enum-specifier, each enumer-
+ ator has the type of its enumeration. Prior to the closing
+ brace, the type of each enumerator is the type of its
+ initializing value.
+
+ In finish_enum we will reset the type. Of course, if we're
+ processing a template, there may be no value. */
+ type = value ? TREE_TYPE (value) : NULL_TREE;
+
+ if (context && context == current_class_type)
+ /* This enum declaration is local to the class. We need the full
+ lang_decl so that we can record DECL_CLASS_CONTEXT, for example. */
+ decl = build_lang_decl (CONST_DECL, name, type);
+ else
+ /* It's a global enum, or it's local to a function. (Note local to
a function could mean local to a class method. */
- decl = build_decl (CONST_DECL, name, type);
+ decl = build_decl (CONST_DECL, name, type);
- DECL_CONTEXT (decl) = FROB_CONTEXT (context);
- DECL_INITIAL (decl) = value;
- TREE_READONLY (decl) = 1;
+ DECL_CONTEXT (decl) = FROB_CONTEXT (context);
+ DECL_INITIAL (decl) = value;
+ TREE_READONLY (decl) = 1;
- if (context && context == current_class_type)
- /* In something like `struct S { enum E { i = 7 }; };' we put `i'
+ if (context && context == current_class_type)
+ /* In something like `struct S { enum E { i = 7 }; };' we put `i'
on the TYPE_FIELDS list for `S'. (That's so that you can say
things like `S::i' later.) */
- finish_member_declaration (decl);
- else
- {
- pushdecl (decl);
- GNU_xref_decl (current_function_decl, decl);
- }
-
- if (! processing_template_decl)
- {
- /* Set basis for default for next value. */
- enum_next_value = build_binary_op_nodefault (PLUS_EXPR, value,
- integer_one_node, PLUS_EXPR);
- enum_overflow = tree_int_cst_lt (enum_next_value, value);
- }
-
- result = saveable_tree_cons (name, decl, NULL_TREE);
- return result;
+ finish_member_declaration (decl);
+ else
+ {
+ pushdecl (decl);
+ GNU_xref_decl (current_function_decl, decl);
+ }
+
+ /* Add this enumeration constant to the list for this type. */
+ TYPE_VALUES (enumtype) = tree_cons (name, decl, TYPE_VALUES (enumtype));
}
-static int function_depth;
+/* We're defining DECL. Make sure that it's type is OK. */
+
+static void
+check_function_type (decl, current_function_parms)
+ tree decl;
+ tree current_function_parms;
+{
+ tree fntype = TREE_TYPE (decl);
+ tree return_type = complete_type (TREE_TYPE (fntype));
+
+ /* In a function definition, arg types must be complete. */
+ require_complete_types_for_parms (current_function_parms);
+
+ if (!COMPLETE_OR_VOID_TYPE_P (return_type))
+ {
+ error ("return type `%#T' is incomplete", TREE_TYPE (fntype));
+
+ /* Make it return void instead, but don't change the
+ type of the DECL_RESULT, in case we have a named return value. */
+ if (TREE_CODE (fntype) == METHOD_TYPE)
+ {
+ tree ctype = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype)));
+ TREE_TYPE (decl)
+ = build_cplus_method_type (ctype,
+ void_type_node,
+ FUNCTION_ARG_CHAIN (decl));
+ }
+ else
+ TREE_TYPE (decl)
+ = build_function_type (void_type_node,
+ TYPE_ARG_TYPES (TREE_TYPE (decl)));
+ TREE_TYPE (decl)
+ = build_exception_variant (fntype,
+ TYPE_RAISES_EXCEPTIONS (fntype));
+ }
+ else
+ abstract_virtuals_error (decl, TREE_TYPE (fntype));
+}
/* Create the FUNCTION_DECL for a function definition.
DECLSPECS and DECLARATOR are the parts of the declaration;
they describe the function's name and the type it returns,
but twisted together in a fashion that parallels the syntax of C.
- If PRE_PARSED_P is non-zero then DECLARATOR is really the DECL for
- the function we are about to process; DECLSPECS are ignored. For
- example, we set PRE_PARSED_P when processing the definition of
- inline function that was defined in-class; the definition is
- actually processed when the class is complete. In this case,
- PRE_PARSED_P is 2. We also set PRE_PARSED_P when instanting the
- body of a template function, and when constructing thunk functions
- and such; in these cases PRE_PARSED_P is 1.
-
+ FLAGS is a bitwise or of SF_PRE_PARSED (indicating that the
+ DECLARATOR is really the DECL for the function we are about to
+ process and that DECLSPECS should be ignored), SF_INCLASS_INLINE
+ indicating that the function is an inline defined in-class.
+
This function creates a binding context for the function body
as well as setting up the FUNCTION_DECL in current_function_decl.
@@ -13324,16 +13442,12 @@ static int function_depth;
For C++, we must first check whether that datum makes any sense.
For example, "class A local_a(1,2);" means that variable local_a
is an aggregate of type A, which should have a constructor
- applied to it with the argument list [1, 2].
-
- @@ There is currently no way to retrieve the storage
- @@ allocated to FUNCTION (or all of its parms) if we return
- @@ something we had previously. */
+ applied to it with the argument list [1, 2]. */
int
-start_function (declspecs, declarator, attrs, pre_parsed_p)
+start_function (declspecs, declarator, attrs, flags)
tree declspecs, declarator, attrs;
- int pre_parsed_p;
+ int flags;
{
tree decl1;
tree ctype = NULL_TREE;
@@ -13342,68 +13456,33 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
extern int have_extern_spec;
extern int used_extern_spec;
int doing_friend = 0;
+ struct binding_level *bl;
+ tree current_function_parms;
/* Sanity check. */
my_friendly_assert (TREE_CODE (TREE_VALUE (void_list_node)) == VOID_TYPE, 160);
my_friendly_assert (TREE_CHAIN (void_list_node) == NULL_TREE, 161);
- /* Assume, until we see it does. */
- current_function_returns_value = 0;
- current_function_returns_null = 0;
- named_labels = 0;
- shadowed_labels = 0;
- current_function_assigns_this = 0;
- current_function_just_assigned_this = 0;
- current_function_parms_stored = 0;
- original_result_rtx = NULL_RTX;
- base_init_expr = NULL_TREE;
- current_base_init_list = NULL_TREE;
- current_member_init_list = NULL_TREE;
- ctor_label = dtor_label = NULL_TREE;
- static_labelno = 0;
-
- clear_temp_name ();
-
/* This should only be done once on the top most decl. */
if (have_extern_spec && !used_extern_spec)
{
- declspecs = decl_tree_cons (NULL_TREE, get_identifier ("extern"), declspecs);
+ declspecs = tree_cons (NULL_TREE, get_identifier ("extern"), declspecs);
used_extern_spec = 1;
}
- if (pre_parsed_p)
+ if (flags & SF_PRE_PARSED)
{
decl1 = declarator;
-#if 0
- /* What was this testing for, exactly? */
- if (! DECL_ARGUMENTS (decl1)
- && !DECL_STATIC_FUNCTION_P (decl1)
- && !DECL_ARTIFICIAL (decl1)
- && DECL_CLASS_SCOPE_P (decl1)
- && TYPE_IDENTIFIER (DECL_CONTEXT (decl1))
- && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (DECL_CONTEXT (decl1))))
- {
- tree binding = binding_for_name (DECL_NAME (decl1),
- current_namespace);
- cp_error ("redeclaration of `%#D'", decl1);
- if (IDENTIFIER_CLASS_VALUE (DECL_NAME (decl1)))
- cp_error_at ("previous declaration here", IDENTIFIER_CLASS_VALUE (DECL_NAME (decl1)));
- else if (BINDING_VALUE (binding))
- cp_error_at ("previous declaration here", BINDING_VALUE (binding));
- }
-#endif
-
fntype = TREE_TYPE (decl1);
if (TREE_CODE (fntype) == METHOD_TYPE)
ctype = TYPE_METHOD_BASETYPE (fntype);
- /* ANSI C++ June 5 1992 WP 11.4.5. A friend function defined in a
- class is in the (lexical) scope of the class in which it is
- defined. */
+ /* ISO C++ 11.4/5. A friend function defined in a class is in
+ the (lexical) scope of the class in which it is defined. */
if (!ctype && DECL_FRIEND_P (decl1))
{
- ctype = DECL_CLASS_CONTEXT (decl1);
+ ctype = DECL_FRIEND_CONTEXT (decl1);
/* CTYPE could be null here if we're dealing with a template;
for example, `inline friend float foo()' inside a template
@@ -13415,11 +13494,10 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
}
last_function_parms = DECL_ARGUMENTS (decl1);
- last_function_parm_tags = NULL_TREE;
}
else
{
- decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, NULL_TREE);
+ decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, NULL);
/* If the declarator is not suitable for a function definition,
cause a syntax error. */
if (decl1 == NULL_TREE || TREE_CODE (decl1) != FUNCTION_DECL) return 0;
@@ -13429,8 +13507,8 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
restype = TREE_TYPE (fntype);
if (CLASS_TYPE_P (restype) && !CLASSTYPE_GOT_SEMICOLON (restype))
{
- cp_error ("semicolon missing after declaration of `%#T'", restype);
- shadow_tag (build_expr_list (NULL_TREE, restype));
+ error ("semicolon missing after declaration of `%#T'", restype);
+ shadow_tag (build_tree_list (NULL_TREE, restype));
CLASSTYPE_GOT_SEMICOLON (restype) = 1;
if (TREE_CODE (fntype) == FUNCTION_TYPE)
fntype = build_function_type (integer_type_node,
@@ -13456,14 +13534,33 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
}
}
+ if (DECL_DECLARED_INLINE_P (decl1)
+ && lookup_attribute ("noinline", attrs))
+ warning_with_decl (decl1,
+ "inline function `%s' given attribute noinline");
+
+ if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl1))
+ /* This is a constructor, we must ensure that any default args
+ introduced by this definition are propagated to the clones
+ now. The clones are used directly in overload resolution. */
+ adjust_clone_args (decl1);
+
+ /* Sometimes we don't notice that a function is a static member, and
+ build a METHOD_TYPE for it. Fix that up now. */
+ if (ctype != NULL_TREE && DECL_STATIC_FUNCTION_P (decl1)
+ && TREE_CODE (TREE_TYPE (decl1)) == METHOD_TYPE)
+ {
+ revert_static_member_fn (decl1);
+ last_function_parms = TREE_CHAIN (last_function_parms);
+ ctype = NULL_TREE;
+ }
+
/* Warn if function was previously implicitly declared
(but not if we warned then). */
if (! warn_implicit
&& IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1)) != NULL_TREE)
cp_warning_at ("`%D' implicitly declared before its definition", IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1)));
- announce_function (decl1);
-
/* Set up current_class_type, and enter the scope of the class, if
appropriate. */
if (ctype)
@@ -13477,67 +13574,20 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
case where a template parameter has the same name as a field of
the class.) It is not until after this point that
PROCESSING_TEMPLATE_DECL is guaranteed to be set up correctly. */
- if (pre_parsed_p == 2)
+ if (flags & SF_INCLASS_INLINE)
maybe_begin_member_template_processing (decl1);
- /* We are now in the scope of the function being defined. */
- current_function_decl = decl1;
-
- /* Save the parm names or decls from this function's declarator
- where store_parm_decls will find them. */
- current_function_parms = last_function_parms;
- current_function_parm_tags = last_function_parm_tags;
-
- if (! processing_template_decl)
- {
- /* In a function definition, arg types must be complete. */
- require_complete_types_for_parms (current_function_parms);
-
- if (TYPE_SIZE (complete_type (TREE_TYPE (fntype))) == NULL_TREE)
- {
- cp_error ("return-type `%#T' is an incomplete type",
- TREE_TYPE (fntype));
-
- /* Make it return void instead, but don't change the
- type of the DECL_RESULT, in case we have a named return value. */
- if (ctype)
- TREE_TYPE (decl1)
- = build_cplus_method_type (build_type_variant (ctype,
- TREE_READONLY (decl1),
- TREE_SIDE_EFFECTS (decl1)),
- void_type_node,
- FUNCTION_ARG_CHAIN (decl1));
- else
- TREE_TYPE (decl1)
- = build_function_type (void_type_node,
- TYPE_ARG_TYPES (TREE_TYPE (decl1)));
- DECL_RESULT (decl1)
- = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (TREE_TYPE (fntype)));
- TREE_READONLY (DECL_RESULT (decl1))
- = CP_TYPE_CONST_P (TREE_TYPE (fntype));
- TREE_THIS_VOLATILE (DECL_RESULT (decl1))
- = CP_TYPE_VOLATILE_P (TREE_TYPE (fntype));
- }
-
- if (TYPE_LANG_SPECIFIC (TREE_TYPE (fntype))
- && CLASSTYPE_ABSTRACT_VIRTUALS (TREE_TYPE (fntype)))
- abstract_virtuals_error (decl1, TREE_TYPE (fntype));
- }
-
- /* Effective C++ rule 15. See also c_expand_return. */
+ /* Effective C++ rule 15. */
if (warn_ecpp
- && DECL_NAME (decl1) == ansi_opname[(int) MODIFY_EXPR]
+ && DECL_OVERLOADED_OPERATOR_P (decl1) == NOP_EXPR
&& TREE_CODE (TREE_TYPE (fntype)) == VOID_TYPE)
- cp_warning ("`operator=' should return a reference to `*this'");
+ warning ("`operator=' should return a reference to `*this'");
/* Make the init_value nonzero so pushdecl knows this is not tentative.
error_mark_node is replaced below (in poplevel) with the BLOCK. */
- DECL_INITIAL (decl1) = error_mark_node;
+ if (!DECL_INITIAL (decl1))
+ DECL_INITIAL (decl1) = error_mark_node;
-#ifdef SET_DEFAULT_DECL_ATTRIBUTES
- SET_DEFAULT_DECL_ATTRIBUTES (decl1, attrs);
-#endif
-
/* This function exists in static storage.
(This does not mean `static' in the C sense!) */
TREE_STATIC (decl1) = 1;
@@ -13549,14 +13599,64 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
if (processing_template_decl)
decl1 = push_template_decl (decl1);
+ /* We are now in the scope of the function being defined. */
+ current_function_decl = decl1;
+
+ /* Save the parm names or decls from this function's declarator
+ where store_parm_decls will find them. */
+ current_function_parms = last_function_parms;
+
+ /* Make sure the parameter and return types are reasonable. When
+ you declare a function, these types can be incomplete, but they
+ must be complete when you define the function. */
+ if (! processing_template_decl)
+ check_function_type (decl1, current_function_parms);
+
+ /* Build the return declaration for the function. */
+ restype = TREE_TYPE (fntype);
+ if (!processing_template_decl)
+ {
+ if (!DECL_RESULT (decl1))
+ {
+ DECL_RESULT (decl1)
+ = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (restype));
+ c_apply_type_quals_to_decl (cp_type_quals (restype),
+ DECL_RESULT (decl1));
+ }
+ }
+ else
+ /* Just use `void'. Nobody will ever look at this anyhow. */
+ DECL_RESULT (decl1) = build_decl (RESULT_DECL, 0, void_type_node);
+
+ /* Initialize RTL machinery. We cannot do this until
+ CURRENT_FUNCTION_DECL and DECL_RESULT are set up. We do this
+ even when processing a template; this is how we get
+ CFUN set up, and our per-function variables initialized.
+ FIXME factor out the non-RTL stuff. */
+ bl = current_binding_level;
+ init_function_start (decl1, input_filename, lineno);
+ current_binding_level = bl;
+
+ /* Even though we're inside a function body, we still don't want to
+ call expand_expr to calculate the size of a variable-sized array.
+ We haven't necessarily assigned RTL to all variables yet, so it's
+ not safe to try to expand expressions involving them. */
+ immediate_size_expand = 0;
+ cfun->x_dont_save_pending_sizes_p = 1;
+
+ /* Start the statement-tree, start the tree now. */
+ begin_stmt_tree (&DECL_SAVED_TREE (decl1));
+
+ /* Let the user know we're compiling this function. */
+ announce_function (decl1);
+
/* Record the decl so that the function name is defined.
If we already have a decl for this name, and it is a FUNCTION_DECL,
use the old decl. */
- if (!processing_template_decl && pre_parsed_p == 0)
+ if (!processing_template_decl && !(flags & SF_PRE_PARSED))
{
/* A specialization is not used to guide overload resolution. */
- if ((flag_guiding_decls
- || !DECL_TEMPLATE_SPECIALIZATION (decl1))
+ if (!DECL_TEMPLATE_SPECIALIZATION (decl1)
&& ! DECL_FUNCTION_MEMBER_P (decl1))
decl1 = pushdecl (decl1);
else
@@ -13567,20 +13667,63 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
/* And make sure we have enough default args. */
check_default_args (decl1);
}
- DECL_MAIN_VARIANT (decl1) = decl1;
fntype = TREE_TYPE (decl1);
}
+ /* Reset these in case the call to pushdecl changed them. */
current_function_decl = decl1;
+ cfun->decl = decl1;
+
+ /* If we are (erroneously) defining a function that we have already
+ defined before, wipe out what we knew before. */
+ if (!DECL_PENDING_INLINE_P (decl1)
+ && DECL_SAVED_FUNCTION_DATA (decl1))
+ {
+ free (DECL_SAVED_FUNCTION_DATA (decl1));
+ DECL_SAVED_FUNCTION_DATA (decl1) = NULL;
+ }
+
+ if (ctype && !doing_friend && !DECL_STATIC_FUNCTION_P (decl1))
+ {
+ /* We know that this was set up by `grokclassfn'. We do not
+ wait until `store_parm_decls', since evil parse errors may
+ never get us to that point. Here we keep the consistency
+ between `current_class_type' and `current_class_ptr'. */
+ tree t = DECL_ARGUMENTS (decl1);
+
+ my_friendly_assert (t != NULL_TREE && TREE_CODE (t) == PARM_DECL,
+ 162);
+ my_friendly_assert (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE,
+ 19990811);
+
+ cp_function_chain->x_current_class_ref
+ = build_indirect_ref (t, NULL);
+ cp_function_chain->x_current_class_ptr = t;
+
+ /* Constructors and destructors need to know whether they're "in
+ charge" of initializing virtual base classes. */
+ t = TREE_CHAIN (t);
+ if (DECL_HAS_IN_CHARGE_PARM_P (decl1))
+ {
+ current_in_charge_parm = t;
+ t = TREE_CHAIN (t);
+ }
+ if (DECL_HAS_VTT_PARM_P (decl1))
+ {
+ if (DECL_NAME (t) != vtt_parm_identifier)
+ abort ();
+ current_vtt_parm = t;
+ }
+ }
if (DECL_INTERFACE_KNOWN (decl1))
{
- tree ctx = hack_decl_function_context (decl1);
+ tree ctx = decl_function_context (decl1);
if (DECL_NOT_REALLY_EXTERN (decl1))
DECL_EXTERNAL (decl1) = 0;
- if (ctx != NULL_TREE && DECL_THIS_INLINE (ctx)
+ if (ctx != NULL_TREE && DECL_DECLARED_INLINE_P (ctx)
&& TREE_PUBLIC (ctx))
/* This is a function in a local class in an extern inline
function. */
@@ -13593,12 +13736,14 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
&& (! DECL_TEMPLATE_INSTANTIATION (decl1)
|| flag_alt_external_templates))
{
- if (DECL_THIS_INLINE (decl1) || DECL_TEMPLATE_INSTANTIATION (decl1)
+ if (DECL_DECLARED_INLINE_P (decl1)
+ || DECL_TEMPLATE_INSTANTIATION (decl1)
|| processing_template_decl)
{
DECL_EXTERNAL (decl1)
= (interface_only
- || (DECL_THIS_INLINE (decl1) && ! flag_implement_inlines
+ || (DECL_DECLARED_INLINE_P (decl1)
+ && ! flag_implement_inlines
&& !DECL_VINDEX (decl1)));
/* For WIN32 we also want to put these in linkonce sections. */
@@ -13629,92 +13774,25 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
So clear DECL_EXTERNAL. */
DECL_EXTERNAL (decl1) = 0;
- if ((DECL_THIS_INLINE (decl1) || DECL_TEMPLATE_INSTANTIATION (decl1))
+ if ((DECL_DECLARED_INLINE_P (decl1)
+ || DECL_TEMPLATE_INSTANTIATION (decl1))
&& ! DECL_INTERFACE_KNOWN (decl1)
/* Don't try to defer nested functions for now. */
- && ! hack_decl_function_context (decl1))
+ && ! decl_function_context (decl1))
DECL_DEFER_OUTPUT (decl1) = 1;
else
DECL_INTERFACE_KNOWN (decl1) = 1;
}
- if (ctype != NULL_TREE && DECL_STATIC_FUNCTION_P (decl1))
- {
- if (TREE_CODE (fntype) == METHOD_TYPE)
- TREE_TYPE (decl1) = fntype
- = build_function_type (TREE_TYPE (fntype),
- TREE_CHAIN (TYPE_ARG_TYPES (fntype)));
- current_function_parms = TREE_CHAIN (current_function_parms);
- DECL_ARGUMENTS (decl1) = current_function_parms;
- ctype = NULL_TREE;
- }
- restype = TREE_TYPE (fntype);
-
- if (ctype)
- {
- /* If we're compiling a friend function, neither of the variables
- current_class_ptr nor current_class_type will have values. */
- if (! doing_friend)
- {
- /* We know that this was set up by `grokclassfn'.
- We do not wait until `store_parm_decls', since evil
- parse errors may never get us to that point. Here
- we keep the consistency between `current_class_type'
- and `current_class_ptr'. */
- tree t = current_function_parms;
-
- my_friendly_assert (t != NULL_TREE
- && TREE_CODE (t) == PARM_DECL, 162);
-
- if (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE)
- {
- int i;
-
- if (! hack_decl_function_context (decl1))
- temporary_allocation ();
- i = suspend_momentary ();
-
- /* Normally, build_indirect_ref returns
- current_class_ref whenever current_class_ptr is
- dereferenced. This time, however, we want it to
- *create* current_class_ref, so we temporarily clear
- current_class_ptr to fool it. */
- current_class_ptr = NULL_TREE;
- current_class_ref = build_indirect_ref (t, NULL_PTR);
- current_class_ptr = t;
-
- resume_momentary (i);
- if (! hack_decl_function_context (decl1))
- end_temporary_allocation ();
- }
- else
- /* We're having a signature pointer here. */
- current_class_ref = current_class_ptr = t;
-
- }
- }
- else
- current_class_ptr = current_class_ref = NULL_TREE;
-
pushlevel (0);
current_binding_level->parm_flag = 1;
- GNU_xref_function (decl1, current_function_parms);
-
- if (attrs)
- cplus_decl_attributes (decl1, NULL_TREE, attrs);
-
- make_function_rtl (decl1);
+ cplus_decl_attributes (&decl1, attrs, 0);
/* Promote the value to int before returning it. */
- if (C_PROMOTING_INTEGER_TYPE_P (restype))
+ if (c_promoting_integer_type_p (restype))
restype = type_promotes_to (restype);
- /* If this fcn was already referenced via a block-scope `extern' decl
- (or an implicit decl), propagate certain information about the usage. */
- if (TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (decl1)))
- TREE_ADDRESSABLE (decl1) = 1;
-
if (DECL_RESULT (decl1) == NULL_TREE)
{
DECL_RESULT (decl1)
@@ -13723,138 +13801,68 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
TREE_THIS_VOLATILE (DECL_RESULT (decl1)) = CP_TYPE_VOLATILE_P (restype);
}
- /* Allocate further tree nodes temporarily during compilation
- of this function only. Tiemann moved up here from bottom of fn. */
- /* If this is a nested function, then we must continue to allocate RTL
- on the permanent obstack in case we need to inline it later. */
- if (! hack_decl_function_context (decl1))
- temporary_allocation ();
-
- if (processing_template_decl)
- {
- ++minimal_parse_mode;
- last_tree = DECL_SAVED_TREE (decl1)
- = build_nt (EXPR_STMT, void_zero_node);
- }
-
++function_depth;
- if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl1))
- && DECL_LANGUAGE (decl1) == lang_cplusplus)
+ if (DECL_DESTRUCTOR_P (decl1))
{
dtor_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
- ctor_label = NULL_TREE;
- }
- else
- {
- dtor_label = NULL_TREE;
- if (DECL_CONSTRUCTOR_P (decl1))
- ctor_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
+ DECL_CONTEXT (dtor_label) = current_function_decl;
}
+ start_fname_decls ();
+
+ store_parm_decls (current_function_parms);
+
return 1;
}
-/* Called after store_parm_decls for a function-try-block. We need to update
- last_parm_cleanup_insn so that the base initializers for a constructor
- are run within this block, not before it. */
-
-void
-expand_start_early_try_stmts ()
-{
- expand_start_try_stmts ();
- last_parm_cleanup_insn = get_last_insn ();
-}
-
/* Store the parameter declarations into the current function declaration.
This is called after parsing the parameter declarations, before
digesting the body of the function.
Also install to binding contour return value identifier, if any. */
-void
-store_parm_decls ()
+static void
+store_parm_decls (current_function_parms)
+ tree current_function_parms;
{
register tree fndecl = current_function_decl;
register tree parm;
- int parms_have_cleanups = 0;
- tree cleanups = NULL_TREE;
-
- /* This is either a chain of PARM_DECLs (when a prototype is used). */
- tree specparms = current_function_parms;
-
- /* This is a list of types declared among parms in a prototype. */
- tree parmtags = current_function_parm_tags;
/* This is a chain of any other decls that came in among the parm
declarations. If a parm is declared with enum {foo, bar} x;
then CONST_DECLs for foo and bar are put here. */
tree nonparms = NULL_TREE;
- if (toplevel_bindings_p ())
- fatal ("parse errors have confused me too much");
-
- /* Initialize RTL machinery. */
- init_function_start (fndecl, input_filename, lineno);
-
- /* Create a binding level for the parms. */
- expand_start_bindings (0);
-
- if (specparms != NULL_TREE)
+ if (current_function_parms)
{
/* This case is when the function was defined with an ANSI prototype.
The parms already have decls, so we need not do anything here
except record them as in effect
and complain if any redundant old-style parm decls were written. */
- register tree next;
+ tree specparms = current_function_parms;
+ tree next;
/* Must clear this because it might contain TYPE_DECLs declared
- at class level. */
+ at class level. */
storedecls (NULL_TREE);
- for (parm = nreverse (specparms); parm; parm = next)
+ /* If we're doing semantic analysis, then we'll call pushdecl
+ for each of these. We must do them in reverse order so that
+ they end in the correct forward order. */
+ specparms = nreverse (specparms);
+
+ for (parm = specparms; parm; parm = next)
{
next = TREE_CHAIN (parm);
if (TREE_CODE (parm) == PARM_DECL)
{
- tree cleanup;
- if (DECL_NAME (parm) == NULL_TREE)
- {
- pushdecl (parm);
- }
- else if (TREE_CODE (TREE_TYPE (parm)) == VOID_TYPE)
- cp_error ("parameter `%D' declared void", parm);
+ if (DECL_NAME (parm) == NULL_TREE
+ || TREE_CODE (parm) != VOID_TYPE)
+ pushdecl (parm);
else
- {
- /* Now fill in DECL_REFERENCE_SLOT for any of the parm decls.
- A parameter is assumed not to have any side effects.
- If this should change for any reason, then this
- will have to wrap the bashed reference type in a save_expr.
-
- Also, if the parameter type is declared to be an X
- and there is an X(X&) constructor, we cannot lay it
- into the stack (any more), so we make this parameter
- look like it is really of reference type. Functions
- which pass parameters to this function will know to
- create a temporary in their frame, and pass a reference
- to that. */
-
- if (TREE_CODE (TREE_TYPE (parm)) == REFERENCE_TYPE
- && TYPE_SIZE (TREE_TYPE (TREE_TYPE (parm))))
- SET_DECL_REFERENCE_SLOT (parm, convert_from_reference (parm));
-
- pushdecl (parm);
- }
- if (! processing_template_decl
- && (cleanup = maybe_build_cleanup (parm), cleanup))
- {
- expand_decl (parm);
- parms_have_cleanups = 1;
-
- /* Keep track of the cleanups. */
- cleanups = tree_cons (parm, cleanup, cleanups);
- }
+ error ("parameter `%D' declared void", parm);
}
else
{
@@ -13865,12 +13873,11 @@ store_parm_decls ()
}
}
- /* Get the decls in their original chain order
- and record in the function. This is all and only the
- PARM_DECLs that were pushed into scope by the loop above. */
+ /* Get the decls in their original chain order and record in the
+ function. This is all and only the PARM_DECLs that were
+ pushed into scope by the loop above. */
DECL_ARGUMENTS (fndecl) = getdecls ();
-
- storetags (chainon (parmtags, gettags ()));
+ storetags (gettags ());
}
else
DECL_ARGUMENTS (fndecl) = NULL_TREE;
@@ -13879,779 +13886,395 @@ store_parm_decls ()
as the decl-chain of the current lexical scope.
Put the enumerators in as well, at the front so that
DECL_ARGUMENTS is not modified. */
-
storedecls (chainon (nonparms, DECL_ARGUMENTS (fndecl)));
- /* Declare __FUNCTION__ and __PRETTY_FUNCTION__ for this function. */
- declare_function_name ();
-
- /* Initialize the RTL code for the function. */
- DECL_SAVED_INSNS (fndecl) = NULL_RTX;
- if (! processing_template_decl)
- expand_function_start (fndecl, parms_have_cleanups);
-
- current_function_parms_stored = 1;
-
- /* If this function is `main', emit a call to `__main'
- to run global initializers, etc. */
- if (DECL_MAIN_P (fndecl))
- expand_main_function ();
-
- /* Now that we have initialized the parms, we can start their
- cleanups. We cannot do this before, since expand_decl_cleanup
- should not be called before the parm can be used. */
- if (cleanups
- && ! processing_template_decl)
- {
- for (cleanups = nreverse (cleanups); cleanups; cleanups = TREE_CHAIN (cleanups))
- {
- if (! expand_decl_cleanup (TREE_PURPOSE (cleanups), TREE_VALUE (cleanups)))
- cp_error ("parser lost in parsing declaration of `%D'",
- TREE_PURPOSE (cleanups));
- }
- }
-
- /* Create a binding contour which can be used to catch
- cleanup-generated temporaries. Also, if the return value needs or
- has initialization, deal with that now. */
- if (parms_have_cleanups)
- {
- pushlevel (0);
- expand_start_bindings (0);
- }
-
- if (! processing_template_decl && flag_exceptions)
- {
- /* Do the starting of the exception specifications, if we have any. */
- if (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl)))
- expand_start_eh_spec ();
- }
-
- last_parm_cleanup_insn = get_last_insn ();
- last_dtor_insn = get_last_insn ();
-}
-
-/* Bind a name and initialization to the return value of
- the current function. */
-
-void
-store_return_init (return_id, init)
- tree return_id, init;
-{
- tree decl = DECL_RESULT (current_function_decl);
-
- if (pedantic)
- /* Give this error as many times as there are occurrences,
- so that users can use Emacs compilation buffers to find
- and fix all such places. */
- pedwarn ("ANSI C++ does not permit named return values");
-
- if (return_id != NULL_TREE)
- {
- if (DECL_NAME (decl) == NULL_TREE)
- {
- DECL_NAME (decl) = return_id;
- DECL_ASSEMBLER_NAME (decl) = return_id;
- }
- else
- cp_error ("return identifier `%D' already in place", decl);
- }
-
- /* Can't let this happen for constructors. */
- if (DECL_CONSTRUCTOR_P (current_function_decl))
- {
- error ("can't redefine default return value for constructors");
- return;
- }
-
- /* If we have a named return value, put that in our scope as well. */
- if (DECL_NAME (decl) != NULL_TREE)
- {
- /* If this named return value comes in a register,
- put it in a pseudo-register. */
- if (DECL_REGISTER (decl))
- {
- original_result_rtx = DECL_RTL (decl);
- DECL_RTL (decl) = gen_reg_rtx (DECL_MODE (decl));
- }
-
- /* Let `cp_finish_decl' know that this initializer is ok. */
- DECL_INITIAL (decl) = init;
- pushdecl (decl);
-
- if (minimal_parse_mode)
- add_tree (build_min_nt (RETURN_INIT, return_id,
- copy_to_permanent (init)));
- else
- cp_finish_decl (decl, init, NULL_TREE, 0, 0);
- }
+ /* Do the starting of the exception specifications, if we have any. */
+ if (flag_exceptions && !processing_template_decl
+ && flag_enforce_eh_specs
+ && TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl)))
+ current_eh_spec_block = begin_eh_spec_block ();
}
-/* Emit implicit code for a destructor. This is a subroutine of
- finish_function. */
+/* We have finished doing semantic analysis on DECL, but have not yet
+ generated RTL for its body. Save away our current state, so that
+ when we want to generate RTL later we know what to do. */
static void
-finish_dtor ()
+save_function_data (decl)
+ tree decl;
{
- tree binfo = TYPE_BINFO (current_class_type);
- tree cond = integer_one_node;
- tree exprstmt;
- tree in_charge_node = lookup_name (in_charge_identifier, 0);
- tree virtual_size;
- int ok_to_optimize_dtor = 0;
- int empty_dtor = get_last_insn () == last_dtor_insn;
- rtx insns, last_parm_insn;
-
- if (current_function_assigns_this)
- cond = build (NE_EXPR, boolean_type_node,
- current_class_ptr, integer_zero_node);
- else
- {
- int n_baseclasses = CLASSTYPE_N_BASECLASSES (current_class_type);
+ struct cp_language_function *f;
- /* If this destructor is empty, then we don't need to check
- whether `this' is NULL in some cases. */
- if ((flag_this_is_variable & 1) == 0)
- ok_to_optimize_dtor = 1;
- else if (empty_dtor)
- ok_to_optimize_dtor
- = (n_baseclasses == 0
- || (n_baseclasses == 1
- && TYPE_HAS_DESTRUCTOR (TYPE_BINFO_BASETYPE (current_class_type, 0))));
- }
+ /* Save the language-specific per-function data so that we can
+ get it back when we really expand this function. */
+ my_friendly_assert (!DECL_PENDING_INLINE_P (decl),
+ 19990908);
- /* If this has a vlist1 parameter, allocate the corresponding vlist
- parameter. */
- if (DECL_DESTRUCTOR_FOR_PVBASE_P (current_function_decl))
- {
- /* _Vlist __vlist; */
- tree vlist;
+ /* Make a copy. */
+ f = ((struct cp_language_function *)
+ xmalloc (sizeof (struct cp_language_function)));
+ memcpy (f, cp_function_chain, sizeof (struct cp_language_function));
+ DECL_SAVED_FUNCTION_DATA (decl) = f;
- mark_all_temps_used();
- vlist = pushdecl (build_decl (VAR_DECL, vlist_identifier,
- vlist_type_node));
- TREE_USED (vlist) = 1;
- DECL_ARTIFICIAL (vlist) = 1;
- expand_decl (vlist);
- expand_decl_init (vlist);
- }
+ /* Clear out the bits we don't need. */
+ f->base.x_stmt_tree.x_last_stmt = NULL_TREE;
+ f->base.x_stmt_tree.x_last_expr_type = NULL_TREE;
+ f->x_named_label_uses = NULL;
+ f->bindings = NULL;
+ f->x_local_names = NULL;
- /* These initializations might go inline. Protect
- the binding level of the parms. */
- pushlevel (0);
- expand_start_bindings (0);
+ /* When we get back here again, we will be expanding. */
+ f->x_expanding_p = 1;
- if (current_function_assigns_this)
+ /* If we've already decided that we cannot inline this function, we
+ must remember that fact when we actually go to expand the
+ function. */
+ if (current_function_cannot_inline)
{
- current_function_assigns_this = 0;
- current_function_just_assigned_this = 0;
+ f->cannot_inline = current_function_cannot_inline;
+ DECL_INLINE (decl) = 0;
}
+}
- /* Generate the code to call destructor on base class.
- If this destructor belongs to a class with virtual
- functions, then set the virtual function table
- pointer to represent the type of our base class. */
-
- /* This side-effect makes call to `build_delete' generate the
- code we have to have at the end of this destructor.
- `build_delete' will set the flag again. */
- TYPE_HAS_DESTRUCTOR (current_class_type) = 0;
-
- /* These are two cases where we cannot delegate deletion. */
- if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type)
- || TYPE_GETS_REG_DELETE (current_class_type))
- exprstmt = build_delete
- (current_class_type, current_class_ref, integer_zero_node,
- LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL, 0);
- else
- exprstmt = build_delete
- (current_class_type, current_class_ref, in_charge_node,
- LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL, 0);
-
- /* If we did not assign to this, then `this' is non-zero at
- the end of a destructor. As a special optimization, don't
- emit test if this is an empty destructor. If it does nothing,
- it does nothing. If it calls a base destructor, the base
- destructor will perform the test. */
-
- if (exprstmt != error_mark_node
- && (TREE_CODE (exprstmt) != NOP_EXPR
- || TREE_OPERAND (exprstmt, 0) != integer_zero_node
- || TYPE_USES_VIRTUAL_BASECLASSES (current_class_type)))
- {
- expand_label (dtor_label);
- if (cond != integer_one_node)
- expand_start_cond (cond, 0);
- if (exprstmt != void_zero_node)
- /* Don't call `expand_expr_stmt' if we're not going to do
- anything, since -Wall will give a diagnostic. */
- expand_expr_stmt (exprstmt);
-
- /* Run destructor on all virtual baseclasses. */
- if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
- {
- tree vbases = nreverse
- (copy_list (CLASSTYPE_VBASECLASSES (current_class_type)));
- expand_start_cond (build (BIT_AND_EXPR, integer_type_node,
- in_charge_node, integer_two_node), 0);
- while (vbases)
- {
- if (TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (vbases)))
- {
- tree vb = get_vbase
- (BINFO_TYPE (vbases),
- TYPE_BINFO (current_class_type));
+/* Add a note to mark the beginning of the main body of the constructor.
+ This is used to set up the data structures for the cleanup regions for
+ fully-constructed bases and members. */
- expand_expr_stmt
- (build_base_dtor_call (current_class_ref,
- vb, integer_zero_node));
- }
- vbases = TREE_CHAIN (vbases);
- }
- expand_end_cond ();
- }
+static void
+begin_constructor_body ()
+{
+ tree ctor_stmt = build_stmt (CTOR_STMT);
+ CTOR_BEGIN_P (ctor_stmt) = 1;
+ add_stmt (ctor_stmt);
+}
- do_pending_stack_adjust ();
- if (cond != integer_one_node)
- expand_end_cond ();
- }
+/* Add a note to mark the end of the main body of the constructor. This is
+ used to end the cleanup regions for fully-constructed bases and
+ members. */
- virtual_size = c_sizeof (current_class_type);
+static void
+finish_constructor_body ()
+{
+ /* Mark the end of the cleanups for a partially constructed object.
- /* At the end, call delete if that's what's requested. */
+ ??? These should really be handled automatically by closing the block,
+ as with the destructor cleanups; the only difference is that these are
+ only run if an exception is thrown. */
+ add_stmt (build_stmt (CTOR_STMT));
+}
- /* FDIS sez: At the point of definition of a virtual destructor
- (including an implicit definition), non-placement operator
- delete shall be looked up in the scope of the destructor's
- class and if found shall be accessible and unambiguous.
+/* Do all the processing for the beginning of a destructor; set up the
+ vtable pointers and cleanups for bases and members. */
- This is somewhat unclear, but I take it to mean that if the
- class only defines placement deletes we don't do anything here.
- So we pass LOOKUP_SPECULATIVELY; delete_sanity will complain
- for us if they ever try to delete one of these. */
+static void
+begin_destructor_body ()
+{
+ tree if_stmt;
+ tree compound_stmt;
- if (TYPE_GETS_REG_DELETE (current_class_type)
- || TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
- exprstmt = build_op_delete_call
- (DELETE_EXPR, current_class_ptr, virtual_size,
- LOOKUP_NORMAL | LOOKUP_SPECULATIVELY, NULL_TREE);
- else
- exprstmt = NULL_TREE;
-
- if (exprstmt)
- {
- cond = build (BIT_AND_EXPR, integer_type_node,
- in_charge_node, integer_one_node);
- expand_start_cond (cond, 0);
- expand_expr_stmt (exprstmt);
- expand_end_cond ();
- }
-
- /* End of destructor. */
- expand_end_bindings (NULL_TREE, getdecls () != NULL_TREE, 0);
- poplevel (getdecls () != NULL_TREE, 0, 0);
-
- /* Back to the top of destructor. */
- /* Don't execute destructor code if `this' is NULL. */
-
- start_sequence ();
-
- /* If we need thunk-style vlists, initialize them if the caller did
- not pass them. This requires a new temporary. The generated code
- looks like
- if (!(__in_charge & 4))
- __vlist = __vl.<type> + sizeof(__vl.<type>);
- else
- __vlist = __vlist1;
- */
- if (TYPE_USES_PVBASES (current_class_type))
- {
- tree vlist = lookup_name (vlist_identifier, 0);
- tree vlist1 = lookup_name (get_identifier (VLIST1_NAME), 0);
- cond = build (BIT_AND_EXPR, integer_type_node,
- in_charge_node, build_int_2 (4, 0));
- cond = build1 (TRUTH_NOT_EXPR, boolean_type_node, cond);
- expand_start_cond (cond, 0);
- init_vlist (current_class_type);
- expand_start_else ();
- expand_expr_stmt (build_modify_expr (vlist, NOP_EXPR, vlist1));
- expand_end_cond ();
- }
-
- /* If the dtor is empty, and we know there is not possible way we
- could use any vtable entries, before they are possibly set by
- a base class dtor, we don't have to setup the vtables, as we
- know that any base class dtoring will set up any vtables it
- needs. We avoid MI, because one base class dtor can do a
+ /* If the dtor is empty, and we know there is not any possible
+ way we could use any vtable entries, before they are possibly
+ set by a base class dtor, we don't have to setup the vtables,
+ as we know that any base class dtor will set up any vtables
+ it needs. We avoid MI, because one base class dtor can do a
virtual dispatch to an overridden function that would need to
have a non-related vtable set up, we cannot avoid setting up
- vtables in that case. We could change this to see if there is
- just one vtable. */
- if (! empty_dtor || TYPE_USES_COMPLEX_INHERITANCE (current_class_type))
- {
- /* Make all virtual function table pointers in non-virtual base
- classes point to CURRENT_CLASS_TYPE's virtual function
- tables. */
- expand_direct_vtbls_init (binfo, binfo, 1, 0, current_class_ptr);
+ vtables in that case. We could change this to see if there
+ is just one vtable.
- if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
- expand_indirect_vtbls_init (binfo, current_class_ref, current_class_ptr);
- }
+ ??? In the destructor for a class, the vtables are set
+ appropriately for that class. There will be no non-related
+ vtables. jason 2001-12-11. */
+ if_stmt = begin_if_stmt ();
- if (! ok_to_optimize_dtor)
- {
- cond = build_binary_op (NE_EXPR,
- current_class_ptr, integer_zero_node);
- expand_start_cond (cond, 0);
- }
+ /* If it is not safe to avoid setting up the vtables, then
+ someone will change the condition to be boolean_true_node.
+ (Actually, for now, we do not have code to set the condition
+ appropriately, so we just assume that we always need to
+ initialize the vtables.) */
+ finish_if_stmt_cond (boolean_true_node, if_stmt);
+ current_vcalls_possible_p = &IF_COND (if_stmt);
- insns = get_insns ();
- end_sequence ();
+ compound_stmt = begin_compound_stmt (/*has_no_scope=*/0);
- last_parm_insn = get_first_nonparm_insn ();
- if (last_parm_insn == NULL_RTX)
- last_parm_insn = get_last_insn ();
- else
- last_parm_insn = previous_insn (last_parm_insn);
+ /* Make all virtual function table pointers in non-virtual base
+ classes point to CURRENT_CLASS_TYPE's virtual function
+ tables. */
+ initialize_vtbl_ptrs (current_class_ptr);
- emit_insns_after (insns, last_parm_insn);
+ finish_compound_stmt (/*has_no_scope=*/0, compound_stmt);
+ finish_then_clause (if_stmt);
+ finish_if_stmt ();
- if (! ok_to_optimize_dtor)
- expand_end_cond ();
+ /* And insert cleanups for our bases and members so that they
+ will be properly destroyed if we throw. */
+ push_base_cleanups ();
}
-/* Emit implicit code for a constructor. This is a subroutine of
- finish_function. CALL_POPLEVEL is the same variable in
- finish_function. */
+/* At the end of every destructor we generate code to delete the object if
+ necessary. Do that now. */
static void
-finish_ctor (call_poplevel)
- int call_poplevel;
+finish_destructor_body ()
{
- register tree fndecl = current_function_decl;
- tree cond = NULL_TREE, thenclause = NULL_TREE;
- rtx insns;
- tree decls;
-
- /* Allow constructor for a type to get a new instance of the object
- using `build_new'. */
- tree abstract_virtuals = CLASSTYPE_ABSTRACT_VIRTUALS (current_class_type);
- CLASSTYPE_ABSTRACT_VIRTUALS (current_class_type) = NULL_TREE;
+ tree exprstmt;
- if (flag_this_is_variable > 0)
+ /* In a virtual destructor, we must call delete. */
+ if (DECL_VIRTUAL_P (current_function_decl))
{
- cond = build_binary_op (EQ_EXPR, current_class_ptr, integer_zero_node);
- thenclause =
- build_modify_expr (current_class_ptr, NOP_EXPR,
- build_new (NULL_TREE, current_class_type,
- void_type_node, 0));
- }
+ tree if_stmt;
+ tree virtual_size = c_sizeof (current_class_type);
- CLASSTYPE_ABSTRACT_VIRTUALS (current_class_type) = abstract_virtuals;
+ /* [class.dtor]
- start_sequence ();
+ At the point of definition of a virtual destructor (including
+ an implicit definition), non-placement operator delete shall
+ be looked up in the scope of the destructor's class and if
+ found shall be accessible and unambiguous. */
+ exprstmt = build_op_delete_call
+ (DELETE_EXPR, current_class_ptr, virtual_size,
+ LOOKUP_NORMAL | LOOKUP_SPECULATIVELY, NULL_TREE);
- if (flag_this_is_variable > 0)
- {
- expand_start_cond (cond, 0);
- expand_expr_stmt (thenclause);
- expand_end_cond ();
+ if_stmt = begin_if_stmt ();
+ finish_if_stmt_cond (build (BIT_AND_EXPR, integer_type_node,
+ current_in_charge_parm,
+ integer_one_node),
+ if_stmt);
+ finish_expr_stmt (exprstmt);
+ finish_then_clause (if_stmt);
+ finish_if_stmt ();
}
+}
- /* Emit insns from `emit_base_init' which sets up virtual
- function table pointer(s). */
- if (base_init_expr)
- {
- expand_expr_stmt (base_init_expr);
- base_init_expr = NULL_TREE;
- }
+/* Do the necessary processing for the beginning of a function body, which
+ in this case includes member-initializers, but not the catch clauses of
+ a function-try-block. Currently, this means opening a binding level
+ for the member-initializers (in a ctor) and member cleanups (in a dtor).
+ In other functions, this isn't necessary, but it doesn't hurt. */
- insns = get_insns ();
- end_sequence ();
+tree
+begin_function_body ()
+{
+ tree stmt;
- /* This is where the body of the constructor begins. */
+ if (processing_template_decl)
+ /* Do nothing now. */;
+ else
+ /* Always keep the BLOCK node associated with the outermost pair of
+ curly braces of a function. These are needed for correct
+ operation of dwarfout.c. */
+ keep_next_level (1);
- emit_insns_after (insns, last_parm_cleanup_insn);
+ stmt = begin_compound_stmt (0);
+ COMPOUND_STMT_BODY_BLOCK (stmt) = 1;
- end_protect_partials ();
+ if (processing_template_decl)
+ /* Do nothing now. */;
+ else if (DECL_CONSTRUCTOR_P (current_function_decl))
+ begin_constructor_body ();
+ else if (DECL_DESTRUCTOR_P (current_function_decl))
+ begin_destructor_body ();
- /* This is where the body of the constructor ends. */
- expand_label (ctor_label);
- ctor_label = NULL_TREE;
+ return stmt;
+}
- if (call_poplevel)
- {
- decls = getdecls ();
- expand_end_bindings (decls, decls != NULL_TREE, 0);
- poplevel (decls != NULL_TREE, 1, 0);
- }
+/* Do the processing for the end of a function body. Currently, this means
+ closing out the cleanups for fully-constructed bases and members, and in
+ the case of the destructor, deleting the object if desired. Again, this
+ is only meaningful for [cd]tors, since they are the only functions where
+ there is a significant distinction between the main body and any
+ function catch clauses. Handling, say, main() return semantics here
+ would be wrong, as flowing off the end of a function catch clause for
+ main() would also need to return 0. */
- /* c_expand_return knows to return 'this' from a constructor. */
- c_expand_return (NULL_TREE);
+void
+finish_function_body (compstmt)
+ tree compstmt;
+{
+ if (processing_template_decl)
+ /* Do nothing now. */;
+ else if (DECL_DESTRUCTOR_P (current_function_decl))
+ /* Any return from a destructor will end up here. Put it before the
+ cleanups so that an explicit return doesn't duplicate them. */
+ add_stmt (build_stmt (LABEL_STMT, dtor_label));
- current_function_assigns_this = 0;
- current_function_just_assigned_this = 0;
-}
+ /* Close the block; in a destructor, run the member cleanups. */
+ finish_compound_stmt (0, compstmt);
+ if (processing_template_decl)
+ /* Do nothing now. */;
+ else if (DECL_CONSTRUCTOR_P (current_function_decl))
+ finish_constructor_body ();
+ else if (DECL_DESTRUCTOR_P (current_function_decl))
+ finish_destructor_body ();
+}
/* Finish up a function declaration and compile that function
all the way to assembler language output. The free the storage
for the function definition.
- This is called after parsing the body of the function definition.
- LINENO is the current line number.
-
- FLAGS is a bitwise or of the following values:
- 1 - CALL_POPLEVEL
- An extra call to poplevel (and expand_end_bindings) must be
- made to take care of the binding contour for the base
- initializers. This is only relevant for constructors.
+ FLAGS is a bitwise or of the following values:
2 - INCLASS_INLINE
We just finished processing the body of an in-class inline
function definition. (This processing will have taken place
- after the class definition is complete.)
+ after the class definition is complete.) */
- NESTED is nonzero if we were in the middle of compiling another function
- when we started on this one. */
-
-void
-finish_function (lineno, flags, nested)
- int lineno;
+tree
+finish_function (flags)
int flags;
- int nested;
{
register tree fndecl = current_function_decl;
tree fntype, ctype = NULL_TREE;
- /* Label to use if this function is supposed to return a value. */
- tree no_return_label = NULL_TREE;
- tree decls = NULL_TREE;
- int call_poplevel = (flags & 1) != 0;
int inclass_inline = (flags & 2) != 0;
- int in_template;
+ int nested;
/* When we get some parse errors, we can end up without a
current_function_decl, so cope. */
if (fndecl == NULL_TREE)
- return;
-
- if (function_depth > 1)
- nested = 1;
+ return error_mark_node;
+ nested = function_depth > 1;
fntype = TREE_TYPE (fndecl);
-/* TREE_READONLY (fndecl) = 1;
- This caused &foo to be of type ptr-to-const-function
- which then got a warning when stored in a ptr-to-function variable. */
+ /* TREE_READONLY (fndecl) = 1;
+ This caused &foo to be of type ptr-to-const-function
+ which then got a warning when stored in a ptr-to-function variable. */
- /* This happens on strange parse errors. */
- if (! current_function_parms_stored)
- {
- call_poplevel = 0;
- store_parm_decls ();
- }
+ my_friendly_assert (building_stmt_tree (), 20000911);
- if (processing_template_decl)
- {
- if (DECL_CONSTRUCTOR_P (fndecl) && call_poplevel)
- {
- decls = getdecls ();
- expand_end_bindings (decls, decls != NULL_TREE, 0);
- poplevel (decls != NULL_TREE, 0, 0);
- }
- }
- else
+ finish_fname_decls ();
+
+ /* For a cloned function, we've already got all the code we need;
+ there's no need to add any extra bits. */
+ if (!DECL_CLONED_FUNCTION_P (fndecl))
{
- if (write_symbols != NO_DEBUG /*&& TREE_CODE (fntype) != METHOD_TYPE*/)
- {
- tree ttype = target_type (fntype);
- tree parmdecl;
-
- if (IS_AGGR_TYPE (ttype))
- /* Let debugger know it should output info for this type. */
- note_debug_info_needed (ttype);
-
- for (parmdecl = DECL_ARGUMENTS (fndecl); parmdecl; parmdecl = TREE_CHAIN (parmdecl))
- {
- ttype = target_type (TREE_TYPE (parmdecl));
- if (IS_AGGR_TYPE (ttype))
- /* Let debugger know it should output info for this type. */
- note_debug_info_needed (ttype);
- }
- }
-
- /* Clean house because we will need to reorder insns here. */
- do_pending_stack_adjust ();
-
- if (dtor_label)
- finish_dtor ();
- else if (current_function_assigns_this)
- {
- /* Does not need to call emit_base_init, because
- that is done (if needed) just after assignment to this
- is seen. */
-
- if (DECL_CONSTRUCTOR_P (current_function_decl))
- {
- end_protect_partials ();
- expand_label (ctor_label);
- ctor_label = NULL_TREE;
-
- if (call_poplevel)
- {
- decls = getdecls ();
- expand_end_bindings (decls, decls != NULL_TREE, 0);
- poplevel (decls != NULL_TREE, 0, 0);
- }
- /* c_expand_return knows to return 'this' from a constructor. */
- c_expand_return (NULL_TREE);
- }
- else if (TREE_CODE (TREE_TYPE (DECL_RESULT (current_function_decl))) != VOID_TYPE
- && return_label != NULL_RTX)
- no_return_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
-
- current_function_assigns_this = 0;
- current_function_just_assigned_this = 0;
- base_init_expr = NULL_TREE;
- }
- else if (DECL_CONSTRUCTOR_P (fndecl)
- && !DECL_VLIST_CTOR_WRAPPER_P (fndecl))
- finish_ctor (call_poplevel);
- else if (DECL_MAIN_P (fndecl))
+ if (DECL_MAIN_P (current_function_decl))
{
/* Make it so that `main' always returns 0 by default. */
-#ifdef VMS
- c_expand_return (integer_one_node);
+#ifdef VMS_TARGET
+ finish_return_stmt (integer_one_node);
#else
- c_expand_return (integer_zero_node);
+ finish_return_stmt (integer_zero_node);
#endif
}
- else if (return_label != NULL_RTX
- && current_function_return_value == NULL_TREE
- && ! DECL_NAME (DECL_RESULT (current_function_decl)))
- no_return_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
-
- if (flag_exceptions)
- expand_exception_blocks ();
-
- /* If this function is supposed to return a value, ensure that
- we do not fall into the cleanups by mistake. The end of our
- function will look like this:
-
- user code (may have return stmt somewhere)
- goto no_return_label
- cleanup_label:
- cleanups
- goto return_label
- no_return_label:
- NOTE_INSN_FUNCTION_END
- return_label:
- things for return
-
- If the user omits a return stmt in the USER CODE section, we
- will have a control path which reaches NOTE_INSN_FUNCTION_END.
- Otherwise, we won't. */
- if (no_return_label)
- {
- DECL_CONTEXT (no_return_label) = fndecl;
- DECL_INITIAL (no_return_label) = error_mark_node;
- DECL_SOURCE_FILE (no_return_label) = input_filename;
- DECL_SOURCE_LINE (no_return_label) = lineno;
- expand_goto (no_return_label);
- }
-
- if (cleanup_label)
- {
- /* Remove the binding contour which is used
- to catch cleanup-generated temporaries. */
- expand_end_bindings (0, 0, 0);
- poplevel (0, 0, 0);
-
- /* Emit label at beginning of cleanup code for parameters. */
- emit_label (cleanup_label);
- }
-
- /* Get return value into register if that's where it's supposed to be. */
- if (original_result_rtx)
- fixup_result_decl (DECL_RESULT (fndecl), original_result_rtx);
-
- /* Finish building code that will trigger warnings if users forget
- to make their functions return values. */
- if (no_return_label || cleanup_label)
- emit_jump (return_label);
- if (no_return_label)
- {
- /* We don't need to call `expand_*_return' here because we
- don't need any cleanups here--this path of code is only
- for error checking purposes. */
- expand_label (no_return_label);
- }
-
- /* Generate rtl for function exit. */
- expand_function_end (input_filename, lineno, 1);
- }
-
- /* If we're processing a template, squirrel away the definition
- until we do an instantiation. */
- if (processing_template_decl)
- {
- --minimal_parse_mode;
- DECL_SAVED_TREE (fndecl) = TREE_CHAIN (DECL_SAVED_TREE (fndecl));
- /* We have to save this value here in case
- maybe_end_member_template_processing decides to pop all the
- template parameters. */
- in_template = 1;
+
+ /* Finish dealing with exception specifiers. */
+ if (flag_exceptions && !processing_template_decl
+ && flag_enforce_eh_specs
+ && TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl)))
+ finish_eh_spec_block (TYPE_RAISES_EXCEPTIONS
+ (TREE_TYPE (current_function_decl)),
+ current_eh_spec_block);
}
- else
- in_template = 0;
+
+ /* If we're saving up tree structure, tie off the function now. */
+ finish_stmt_tree (&DECL_SAVED_TREE (fndecl));
/* This must come after expand_function_end because cleanups might
have declarations (from inline functions) that need to go into
this function's blocks. */
+
+ /* If the current binding level isn't the outermost binding level
+ for this function, either there is a bug, or we have experienced
+ syntax errors and the statement tree is malformed. */
if (current_binding_level->parm_flag != 1)
- my_friendly_abort (122);
- poplevel (1, 0, 1);
-
- /* If this is a in-class inline definition, we may have to pop the
- bindings for the template parameters that we added in
- maybe_begin_member_template_processing when start_function was
- called. */
- if (inclass_inline)
- maybe_end_member_template_processing ();
-
- /* Reset scope for C++: if we were in the scope of a class,
- then when we finish this function, we are not longer so.
- This cannot be done until we know for sure that no more
- class members will ever be referenced in this function
- (i.e., calls to destructors). */
- if (current_class_name)
{
- ctype = current_class_type;
- pop_nested_class ();
- }
+ /* Make sure we have already experienced errors. */
+ if (errorcount == 0)
+ abort ();
- /* Must mark the RESULT_DECL as being in this function. */
- DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl;
+ /* Throw away the broken statement tree and extra binding
+ levels. */
+ DECL_SAVED_TREE (fndecl) = build_stmt (COMPOUND_STMT, NULL_TREE);
- /* Set the BLOCK_SUPERCONTEXT of the outermost function scope to point
- to the FUNCTION_DECL node itself. */
- BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
+ while (current_binding_level->parm_flag != 1)
+ {
+ if (current_binding_level->parm_flag == 2)
+ pop_nested_class ();
+ else
+ poplevel (0, 0, 0);
+ }
+ }
+ poplevel (1, 0, 1);
- if (!in_template)
+ /* Set up the named return value optimization, if we can. Here, we
+ eliminate the copy from the nrv into the RESULT_DECL and any cleanup
+ for the nrv. genrtl_start_function and declare_return_variable
+ handle making the nrv and RESULT_DECL share space. */
+ if (current_function_return_value)
{
- int saved_flag_keep_inline_functions =
- flag_keep_inline_functions;
-
- /* So we can tell if jump_optimize sets it to 1. */
- can_reach_end = 0;
-
- if (DECL_CONTEXT (fndecl) != NULL_TREE
- && hack_decl_function_context (fndecl))
- /* Trick rest_of_compilation into not deferring output of this
- function, even if it is inline, since the rtl_obstack for
- this function is the function_obstack of the enclosing
- function and will be deallocated when the enclosing
- function is gone. See save_tree_status. */
- flag_keep_inline_functions = 1;
-
- /* Run the optimizers and output the assembler code for this
- function. */
-
- if (DECL_ARTIFICIAL (fndecl))
+ tree r = current_function_return_value;
+ /* This is only worth doing for fns that return in memory--and
+ simpler, since we don't have to worry about promoted modes. */
+ if (r != error_mark_node
+ && aggregate_value_p (TREE_TYPE (TREE_TYPE (fndecl))))
{
- /* Do we really *want* to inline this synthesized method? */
-
- int save_fif = flag_inline_functions;
- flag_inline_functions = 1;
-
- /* Turn off DECL_INLINE for the moment so function_cannot_inline_p
- will check our size. */
- DECL_INLINE (fndecl) = 0;
-
- rest_of_compilation (fndecl);
- flag_inline_functions = save_fif;
+ DECL_ALIGN (r) = DECL_ALIGN (DECL_RESULT (fndecl));
+ walk_tree_without_duplicates (&DECL_SAVED_TREE (fndecl),
+ nullify_returns_r, r);
}
else
- rest_of_compilation (fndecl);
+ /* Clear it so genrtl_start_function and declare_return_variable
+ know we're not optimizing. */
+ current_function_return_value = NULL_TREE;
+ }
- flag_keep_inline_functions = saved_flag_keep_inline_functions;
+ /* Remember that we were in class scope. */
+ if (current_class_name)
+ ctype = current_class_type;
- if (DECL_SAVED_INSNS (fndecl) && ! TREE_ASM_WRITTEN (fndecl))
- {
- /* Set DECL_EXTERNAL so that assemble_external will be called as
- necessary. We'll clear it again in finish_file. */
- if (! DECL_EXTERNAL (fndecl))
- DECL_NOT_REALLY_EXTERN (fndecl) = 1;
- DECL_EXTERNAL (fndecl) = 1;
- mark_inline_for_output (fndecl);
- }
+ /* Must mark the RESULT_DECL as being in this function. */
+ DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl;
- if (ctype && TREE_ASM_WRITTEN (fndecl))
- note_debug_info_needed (ctype);
+ /* Set the BLOCK_SUPERCONTEXT of the outermost function scope to point
+ to the FUNCTION_DECL node itself. */
+ BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
- current_function_returns_null |= can_reach_end;
+ /* Save away current state, if appropriate. */
+ if (!processing_template_decl)
+ save_function_data (fndecl);
+
+ /* If this function calls `setjmp' it cannot be inlined. When
+ `longjmp' is called it is not guaranteed to restore the value of
+ local variables that have been modified since the call to
+ `setjmp'. So, if were to inline this function into some caller
+ `c', then when we `longjmp', we might not restore all variables
+ in `c'. (It might seem, at first blush, that there's no way for
+ this function to modify local variables in `c', but their
+ addresses may have been stored somewhere accessible to this
+ function.) */
+ if (!processing_template_decl && calls_setjmp_p (fndecl))
+ DECL_UNINLINABLE (fndecl) = 1;
+
+ /* Clear out memory we no longer need. */
+ free_after_parsing (cfun);
+ /* Since we never call rest_of_compilation, we never clear
+ CFUN. Do so explicitly. */
+ free_after_compilation (cfun);
+ cfun = NULL;
- /* Since we don't normally go through c_expand_return for constructors,
- this normally gets the wrong value.
- Also, named return values have their return codes emitted after
- NOTE_INSN_FUNCTION_END, confusing jump.c. */
- if (DECL_CONSTRUCTOR_P (fndecl)
- || DECL_NAME (DECL_RESULT (fndecl)) != NULL_TREE)
- current_function_returns_null = 0;
+ /* If this is a in-class inline definition, we may have to pop the
+ bindings for the template parameters that we added in
+ maybe_begin_member_template_processing when start_function was
+ called. */
+ if (inclass_inline)
+ maybe_end_member_template_processing ();
- if (TREE_THIS_VOLATILE (fndecl) && current_function_returns_null)
- cp_warning ("`noreturn' function `%D' does return", fndecl);
- else if ((warn_return_type || pedantic)
- && current_function_returns_null
- && TREE_CODE (TREE_TYPE (fntype)) != VOID_TYPE)
- {
- /* If this function returns non-void and control can drop through,
- complain. */
- cp_warning ("control reaches end of non-void function `%D'", fndecl);
- }
- /* With just -W, complain only if function returns both with
- and without a value. */
- else if (extra_warnings
- && current_function_returns_value && current_function_returns_null)
- warning ("this function may return with or without a value");
- }
+ /* Leave the scope of the class. */
+ if (ctype)
+ pop_nested_class ();
--function_depth;
- /* Free all the tree nodes making up this function. */
- /* Switch back to allocating nodes permanently
- until we start another function. */
- if (! nested)
- permanent_allocation (1);
-
- if (DECL_SAVED_INSNS (fndecl) == NULL_RTX)
- {
- tree t;
-
- /* Stop pointing to the local nodes about to be freed. */
- /* But DECL_INITIAL must remain nonzero so we know this
- was an actual function definition. */
- DECL_INITIAL (fndecl) = error_mark_node;
- for (t = DECL_ARGUMENTS (fndecl); t; t = TREE_CHAIN (t))
- DECL_RTL (t) = DECL_INCOMING_RTL (t) = NULL_RTX;
- }
-
- if (DECL_STATIC_CONSTRUCTOR (fndecl))
- static_ctors = perm_tree_cons (NULL_TREE, fndecl, static_ctors);
- if (DECL_STATIC_DESTRUCTOR (fndecl))
- static_dtors = perm_tree_cons (NULL_TREE, fndecl, static_dtors);
-
+ /* Clean up. */
if (! nested)
- {
- /* Let the error reporting routines know that we're outside a
- function. For a nested function, this value is used in
- pop_cp_function_context and then reset via pop_function_context. */
- current_function_decl = NULL_TREE;
- }
+ /* Let the error reporting routines know that we're outside a
+ function. For a nested function, this value is used in
+ pop_cp_function_context and then reset via pop_function_context. */
+ current_function_decl = NULL_TREE;
- named_label_uses = NULL;
- current_class_ptr = NULL_TREE;
- current_class_ref = NULL_TREE;
+ return fndecl;
}
/* Create the FUNCTION_DECL for a function definition.
@@ -14680,12 +14303,15 @@ start_method (declspecs, declarator, attrlist)
tree declarator, declspecs, attrlist;
{
tree fndecl = grokdeclarator (declarator, declspecs, MEMFUNCDEF, 0,
- attrlist);
+ &attrlist);
/* Something too ugly to handle. */
if (fndecl == NULL_TREE)
return NULL_TREE;
+ if (attrlist)
+ cplus_decl_attributes (&fndecl, attrlist, 0);
+
/* Pass friends other than inline friend functions back. */
if (fndecl == void_type_node)
return fndecl;
@@ -14694,24 +14320,21 @@ start_method (declspecs, declarator, attrlist)
/* Not a function, tell parser to report parse error. */
return NULL_TREE;
- if (IS_SIGNATURE (current_class_type))
- IS_DEFAULT_IMPLEMENTATION (fndecl) = 1;
-
if (DECL_IN_AGGR_P (fndecl))
{
if (IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (fndecl)) != current_class_type)
{
- if (DECL_CONTEXT (fndecl)
+ if (DECL_CONTEXT (fndecl)
&& TREE_CODE( DECL_CONTEXT (fndecl)) != NAMESPACE_DECL)
- cp_error ("`%D' is already defined in class %s", fndecl,
- TYPE_NAME_STRING (DECL_CONTEXT (fndecl)));
+ error ("`%D' is already defined in class `%T'", fndecl,
+ DECL_CONTEXT (fndecl));
}
return void_type_node;
}
check_template_shadow (fndecl);
- DECL_THIS_INLINE (fndecl) = 1;
+ DECL_DECLARED_INLINE_P (fndecl) = 1;
if (flag_default_inline)
DECL_INLINE (fndecl) = 1;
@@ -14720,12 +14343,6 @@ start_method (declspecs, declarator, attrlist)
if (processing_template_decl && !DECL_TEMPLATE_SPECIALIZATION (fndecl))
fndecl = push_template_decl (fndecl);
- /* We read in the parameters on the maybepermanent_obstack,
- but we won't be getting back to them until after we
- may have clobbered them. So the call to preserve_data
- will keep them safe. */
- preserve_data ();
-
if (! DECL_FRIEND_P (fndecl))
{
if (TREE_CHAIN (fndecl))
@@ -14733,22 +14350,15 @@ start_method (declspecs, declarator, attrlist)
fndecl = copy_node (fndecl);
TREE_CHAIN (fndecl) = NULL_TREE;
}
-
- if (DECL_CONSTRUCTOR_P (fndecl))
- {
- if (! grok_ctor_properties (current_class_type, fndecl))
- return void_type_node;
- }
- else if (IDENTIFIER_OPNAME_P (DECL_NAME (fndecl)))
- grok_op_properties (fndecl, DECL_VIRTUAL_P (fndecl), 0);
+ grok_special_member_properties (fndecl);
}
- cp_finish_decl (fndecl, NULL_TREE, NULL_TREE, 0, 0);
+ cp_finish_decl (fndecl, NULL_TREE, NULL_TREE, 0);
/* Make a place for the parms */
pushlevel (0);
current_binding_level->parm_flag = 1;
-
+
DECL_IN_AGGR_P (fndecl) = 1;
return fndecl;
}
@@ -14797,8 +14407,8 @@ finish_method (decl)
DECL_CONTEXT (link) = NULL_TREE;
}
- GNU_xref_end_scope ((HOST_WIDE_INT) current_binding_level,
- (HOST_WIDE_INT) current_binding_level->level_chain,
+ GNU_xref_end_scope ((size_t) current_binding_level,
+ (size_t) current_binding_level->level_chain,
current_binding_level->parm_flag,
current_binding_level->keep);
@@ -14828,63 +14438,80 @@ hack_incomplete_structures (type)
tree type;
{
tree *list;
-
- if (current_binding_level->incomplete == NULL_TREE)
- return;
+ struct binding_level *level;
if (!type) /* Don't do this for class templates. */
return;
- for (list = &current_binding_level->incomplete; *list; )
- {
- tree decl = TREE_VALUE (*list);
- if ((decl && TREE_TYPE (decl) == type)
- || (TREE_TYPE (decl)
- && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
- && TREE_TYPE (TREE_TYPE (decl)) == type))
- {
- int toplevel = toplevel_bindings_p ();
- if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
- && TREE_TYPE (TREE_TYPE (decl)) == type)
- layout_type (TREE_TYPE (decl));
- layout_decl (decl, 0);
- rest_of_decl_compilation (decl, NULL_PTR, toplevel, 0);
- if (! toplevel)
+ if (namespace_bindings_p ())
+ {
+ level = 0;
+ list = &namespace_scope_incomplete;
+ }
+ else
+ {
+ level = innermost_nonclass_level ();
+ list = &level->incomplete;
+ }
+
+ while (1)
+ {
+ while (*list)
+ {
+ tree decl = TREE_VALUE (*list);
+ if ((decl && TREE_TYPE (decl) == type)
+ || (TREE_TYPE (decl)
+ && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
+ && TREE_TYPE (TREE_TYPE (decl)) == type))
{
- tree cleanup;
- expand_decl (decl);
- cleanup = maybe_build_cleanup (decl);
- expand_decl_init (decl);
- if (! expand_decl_cleanup (decl, cleanup))
- cp_error ("parser lost in parsing declaration of `%D'",
- decl);
+ int toplevel = toplevel_bindings_p ();
+ if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
+ && TREE_TYPE (TREE_TYPE (decl)) == type)
+ layout_type (TREE_TYPE (decl));
+ layout_decl (decl, 0);
+ rest_of_decl_compilation (decl, NULL, toplevel, 0);
+ if (! toplevel)
+ {
+ tree cleanup;
+ expand_decl (decl);
+ cleanup = maybe_build_cleanup (decl);
+ expand_decl_init (decl);
+ if (! expand_decl_cleanup (decl, cleanup))
+ error ("parser lost in parsing declaration of `%D'",
+ decl);
+ }
+ *list = TREE_CHAIN (*list);
}
- *list = TREE_CHAIN (*list);
+ else
+ list = &TREE_CHAIN (*list);
+ }
+
+ /* Keep looking through artificial binding levels generated
+ for local variables. */
+ if (level && level->keep == 2)
+ {
+ level = level->level_chain;
+ list = &level->incomplete;
}
else
- list = &TREE_CHAIN (*list);
+ break;
}
}
-/* If DECL is of a type which needs a cleanup, build that cleanup here.
- See build_delete for information about AUTO_DELETE.
-
- Don't build these on the momentary obstack; they must live
- the life of the binding contour. */
+/* If DECL is of a type which needs a cleanup, build that cleanup
+ here. */
-static tree
-maybe_build_cleanup_1 (decl, auto_delete)
- tree decl, auto_delete;
+tree
+maybe_build_cleanup (decl)
+ tree decl;
{
tree type = TREE_TYPE (decl);
- if (type != error_mark_node && TYPE_NEEDS_DESTRUCTOR (type))
+
+ if (type != error_mark_node && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
{
- int temp = 0, flags = LOOKUP_NORMAL|LOOKUP_DESTRUCTOR;
+ int flags = LOOKUP_NORMAL|LOOKUP_DESTRUCTOR;
tree rval;
- if (TREE_CODE (decl) != PARM_DECL)
- temp = suspend_momentary ();
-
if (TREE_CODE (type) == ARRAY_TYPE)
rval = decl;
else
@@ -14898,268 +14525,242 @@ maybe_build_cleanup_1 (decl, auto_delete)
|| flag_expensive_optimizations)
flags |= LOOKUP_NONVIRTUAL;
- rval = build_delete (TREE_TYPE (rval), rval, auto_delete, flags, 0);
+ rval = build_delete (TREE_TYPE (rval), rval,
+ sfk_complete_destructor, flags, 0);
if (TYPE_USES_VIRTUAL_BASECLASSES (type)
&& ! TYPE_HAS_DESTRUCTOR (type))
- rval = build_compound_expr (expr_tree_cons (NULL_TREE, rval,
- build_expr_list (NULL_TREE, build_vbase_delete (type, decl))));
-
- if (TREE_CODE (decl) != PARM_DECL)
- resume_momentary (temp);
+ rval = build_compound_expr (tree_cons (NULL_TREE, rval,
+ build_tree_list (NULL_TREE, build_vbase_delete (type, decl))));
return rval;
}
return 0;
}
+
+/* When a stmt has been parsed, this function is called. */
-/* If DECL is of a type which needs a cleanup, build that cleanup
- here. The cleanup does free the storage with a call to delete. */
-
-tree
-maybe_build_cleanup_and_delete (decl)
- tree decl;
+void
+finish_stmt ()
{
- return maybe_build_cleanup_1 (decl, integer_three_node);
+ /* Always assume this statement was not an expression statement. If
+ it actually was an expression statement, its our callers
+ responsibility to fix this up. */
+ last_expr_type = NULL_TREE;
}
-/* If DECL is of a type which needs a cleanup, build that cleanup
- here. The cleanup does not free the storage with a call a delete. */
+/* DECL was originally constructed as a non-static member function,
+ but turned out to be static. Update it accordingly. */
-tree
-maybe_build_cleanup (decl)
+void
+revert_static_member_fn (decl)
tree decl;
{
- return maybe_build_cleanup_1 (decl, integer_two_node);
+ tree tmp;
+ tree function = TREE_TYPE (decl);
+ tree args = TYPE_ARG_TYPES (function);
+
+ if (cp_type_quals (TREE_TYPE (TREE_VALUE (args)))
+ != TYPE_UNQUALIFIED)
+ error ("static member function `%#D' declared with type qualifiers",
+ decl);
+
+ args = TREE_CHAIN (args);
+ tmp = build_function_type (TREE_TYPE (function), args);
+ tmp = build_qualified_type (tmp, cp_type_quals (function));
+ tmp = build_exception_variant (tmp,
+ TYPE_RAISES_EXCEPTIONS (function));
+ TREE_TYPE (decl) = tmp;
+ if (DECL_ARGUMENTS (decl))
+ DECL_ARGUMENTS (decl) = TREE_CHAIN (DECL_ARGUMENTS (decl));
+ DECL_STATIC_FUNCTION_P (decl) = 1;
}
-
-/* Expand a C++ expression at the statement level.
- This is needed to ferret out nodes which have UNKNOWN_TYPE.
- The C++ type checker should get all of these out when
- expressions are combined with other, type-providing, expressions,
- leaving only orphan expressions, such as:
- &class::bar; / / takes its address, but does nothing with it. */
+/* Initialize the variables used during compilation of a C++
+ function. */
-void
-cplus_expand_expr_stmt (exp)
- tree exp;
+static void
+push_cp_function_context (f)
+ struct function *f;
{
- if (processing_template_decl)
- {
- add_tree (build_min_nt (EXPR_STMT, exp));
- return;
- }
+ struct cp_language_function *p
+ = ((struct cp_language_function *)
+ xcalloc (1, sizeof (struct cp_language_function)));
+ f->language = (struct language_function *) p;
- /* Arrange for all temps to disappear. */
- expand_start_target_temps ();
+ /* It takes an explicit call to expand_body to generate RTL for a
+ function. */
+ expanding_p = 0;
- exp = require_complete_type_in_void (exp);
-
- if (TREE_CODE (exp) == FUNCTION_DECL)
+ /* Whenever we start a new function, we destroy temporaries in the
+ usual way. */
+ current_stmt_tree ()->stmts_are_full_exprs_p = 1;
+}
+
+/* Free the language-specific parts of F, now that we've finished
+ compiling the function. */
+
+static void
+pop_cp_function_context (f)
+ struct function *f;
+{
+ if (f->language)
{
- cp_warning ("reference, not call, to function `%D'", exp);
- warning ("at this point in file");
+ struct cp_language_function *cp =
+ (struct cp_language_function *) f->language;
+ if (cp->x_local_names)
+ VARRAY_FREE (cp->x_local_names);
+ free (f->language);
}
+ f->language = 0;
+}
-#if 0
- /* We should do this eventually, but right now this causes regex.o from
- libg++ to miscompile, and tString to core dump. */
- exp = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (exp), exp);
-#endif
+/* Mark P for GC. */
+
+static void
+mark_lang_function (p)
+ struct cp_language_function *p;
+{
+ if (!p)
+ return;
- /* Strip unused implicit INDIRECT_REFs of references. */
- if (TREE_CODE (exp) == INDIRECT_REF
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == REFERENCE_TYPE)
- exp = TREE_OPERAND (exp, 0);
+ mark_c_language_function (&p->base);
- /* If we don't do this, we end up down inside expand_expr
- trying to do TYPE_MODE on the ERROR_MARK, and really
- go outside the bounds of the type. */
- if (exp != error_mark_node)
- expand_expr_stmt (break_out_cleanups (exp));
+ ggc_mark_tree (p->x_dtor_label);
+ ggc_mark_tree (p->x_current_class_ptr);
+ ggc_mark_tree (p->x_current_class_ref);
+ ggc_mark_tree (p->x_eh_spec_block);
+ ggc_mark_tree_varray (p->x_local_names);
- /* Clean up any pending cleanups. This happens when a function call
- returns a cleanup-needing value that nobody uses. */
- expand_end_target_temps ();
+ mark_named_label_lists (&p->x_named_labels, &p->x_named_label_uses);
+ mark_binding_level (&p->bindings);
+ mark_pending_inlines (&p->unparsed_inlines);
}
-/* When a stmt has been parsed, this function is called.
-
- Currently, this function only does something within a
- constructor's scope: if a stmt has just assigned to this,
- and we are in a derived class, we call `emit_base_init'. */
+/* Mark the language-specific data in F for GC. */
-void
-finish_stmt ()
+static void
+mark_cp_function_context (f)
+ struct function *f;
{
- extern struct nesting *cond_stack, *loop_stack, *case_stack;
-
-
- if (current_function_assigns_this
- || ! current_function_just_assigned_this)
- return;
- if (DECL_CONSTRUCTOR_P (current_function_decl))
- {
- /* Constructors must wait until we are out of control
- zones before calling base constructors. */
- if (cond_stack || loop_stack || case_stack)
- return;
- expand_expr_stmt (base_init_expr);
- check_base_init (current_class_type);
- }
- current_function_assigns_this = 1;
+ mark_lang_function ((struct cp_language_function *) f->language);
}
-/* Change a static member function definition into a FUNCTION_TYPE, instead
- of the METHOD_TYPE that we create when it's originally parsed.
-
- WARNING: DO NOT pass &TREE_TYPE (decl) to FN or &TYPE_ARG_TYPES
- (TREE_TYPE (decl)) to ARGTYPES, as doing so will corrupt the types of
- other decls. Either pass the addresses of local variables or NULL. */
-
void
-revert_static_member_fn (decl, fn, argtypes)
- tree *decl, *fn, *argtypes;
+lang_mark_tree (t)
+ tree t;
{
- tree tmp;
- tree function = fn ? *fn : TREE_TYPE (*decl);
- tree args = argtypes ? *argtypes : TYPE_ARG_TYPES (function);
-
- if (CP_TYPE_QUALS (TREE_TYPE (TREE_VALUE (args)))
- != TYPE_UNQUALIFIED)
- cp_error ("static member function `%#D' declared with type qualifiers",
- *decl);
-
- args = TREE_CHAIN (args);
- tmp = build_function_type (TREE_TYPE (function), args);
- tmp = build_qualified_type (tmp, CP_TYPE_QUALS (function));
- tmp = build_exception_variant (tmp,
- TYPE_RAISES_EXCEPTIONS (function));
- TREE_TYPE (*decl) = tmp;
- if (DECL_ARGUMENTS (*decl))
- DECL_ARGUMENTS (*decl) = TREE_CHAIN (DECL_ARGUMENTS (*decl));
- DECL_STATIC_FUNCTION_P (*decl) = 1;
- if (fn)
- *fn = tmp;
- if (argtypes)
- *argtypes = args;
-}
-
-struct cp_function
-{
- int returns_value;
- int returns_null;
- int assigns_this;
- int just_assigned_this;
- int parms_stored;
- int temp_name_counter;
- tree named_labels;
- struct named_label_list *named_label_uses;
- tree shadowed_labels;
- tree ctor_label;
- tree dtor_label;
- rtx last_dtor_insn;
- rtx last_parm_cleanup_insn;
- tree base_init_list;
- tree member_init_list;
- tree base_init_expr;
- tree current_class_ptr;
- tree current_class_ref;
- rtx result_rtx;
- struct cp_function *next;
- struct binding_level *binding_level;
- int static_labelno;
-};
+ enum tree_code code = TREE_CODE (t);
+ if (code == IDENTIFIER_NODE)
+ {
+ struct lang_identifier *li = (struct lang_identifier *) t;
+ struct lang_id2 *li2 = li->x;
+ ggc_mark_tree (li->namespace_bindings);
+ ggc_mark_tree (li->bindings);
+ ggc_mark_tree (li->class_value);
+ ggc_mark_tree (li->class_template_info);
-static struct cp_function *cp_function_chain;
+ if (li2)
+ {
+ ggc_mark_tree (li2->label_value);
+ ggc_mark_tree (li2->implicit_decl);
+ ggc_mark_tree (li2->error_locus);
+ }
+ }
+ else if (code == CPLUS_BINDING)
+ {
+ if (BINDING_HAS_LEVEL_P (t))
+ mark_binding_level (&BINDING_LEVEL (t));
+ else
+ ggc_mark_tree (BINDING_SCOPE (t));
+ ggc_mark_tree (BINDING_VALUE (t));
+ }
+ else if (code == OVERLOAD)
+ ggc_mark_tree (OVL_FUNCTION (t));
+ else if (code == TEMPLATE_PARM_INDEX)
+ ggc_mark_tree (TEMPLATE_PARM_DECL (t));
+ else if (TREE_CODE_CLASS (code) == 'd')
+ {
+ struct lang_decl *ld = DECL_LANG_SPECIFIC (t);
+
+ if (ld)
+ {
+ ggc_mark (ld);
+ c_mark_lang_decl (&ld->decl_flags.base);
+ if (!DECL_GLOBAL_CTOR_P (t)
+ && !DECL_GLOBAL_DTOR_P (t)
+ && !DECL_THUNK_P (t)
+ && !DECL_DISCRIMINATOR_P (t))
+ ggc_mark_tree (ld->decl_flags.u2.access);
+ else if (DECL_THUNK_P (t))
+ ggc_mark_tree (ld->decl_flags.u2.vcall_offset);
+ if (TREE_CODE (t) != NAMESPACE_DECL)
+ ggc_mark_tree (ld->decl_flags.u.template_info);
+ else
+ mark_binding_level (&NAMESPACE_LEVEL (t));
+ if (CAN_HAVE_FULL_LANG_DECL_P (t))
+ {
+ ggc_mark_tree (ld->befriending_classes);
+ ggc_mark_tree (ld->context);
+ ggc_mark_tree (ld->cloned_function);
+ if (TREE_CODE (t) == TYPE_DECL)
+ ggc_mark_tree (ld->u.sorted_fields);
+ else if (TREE_CODE (t) == FUNCTION_DECL
+ && !DECL_PENDING_INLINE_P (t))
+ mark_lang_function (DECL_SAVED_FUNCTION_DATA (t));
+ }
+ }
+ }
+ else if (TREE_CODE_CLASS (code) == 't')
+ {
+ struct lang_type *lt = TYPE_LANG_SPECIFIC (t);
-extern int temp_name_counter;
+ if (lt && !(TREE_CODE (t) == POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (t)) == METHOD_TYPE))
+ {
+ ggc_mark (lt);
+ ggc_mark_tree (lt->primary_base);
+ ggc_mark_tree (lt->vfields);
+ ggc_mark_tree (lt->vbases);
+ ggc_mark_tree (lt->tags);
+ ggc_mark_tree (lt->size);
+ ggc_mark_tree (lt->pure_virtuals);
+ ggc_mark_tree (lt->friend_classes);
+ ggc_mark_tree (lt->rtti);
+ ggc_mark_tree (lt->methods);
+ ggc_mark_tree (lt->template_info);
+ ggc_mark_tree (lt->befriending_classes);
+ }
+ else if (lt)
+ /* In the case of pointer-to-member function types, the
+ TYPE_LANG_SPECIFIC is really just a tree. */
+ ggc_mark_tree ((tree) lt);
+ }
+}
-/* Save and reinitialize the variables
- used during compilation of a C++ function. */
+/* Return the IDENTIFIER_GLOBAL_VALUE of T, for use in common code, since
+ the definition of IDENTIFIER_GLOBAL_VALUE is different for C and C++. */
-void
-push_cp_function_context (context)
- tree context;
+tree
+identifier_global_value (t)
+ tree t;
{
- struct cp_function *p
- = (struct cp_function *) xmalloc (sizeof (struct cp_function));
-
- push_function_context_to (context);
-
- p->next = cp_function_chain;
- cp_function_chain = p;
-
- p->named_labels = named_labels;
- p->named_label_uses = named_label_uses;
- p->shadowed_labels = shadowed_labels;
- p->returns_value = current_function_returns_value;
- p->returns_null = current_function_returns_null;
- p->binding_level = current_binding_level;
- p->ctor_label = ctor_label;
- p->dtor_label = dtor_label;
- p->last_dtor_insn = last_dtor_insn;
- p->last_parm_cleanup_insn = last_parm_cleanup_insn;
- p->assigns_this = current_function_assigns_this;
- p->just_assigned_this = current_function_just_assigned_this;
- p->parms_stored = current_function_parms_stored;
- p->result_rtx = original_result_rtx;
- p->base_init_expr = base_init_expr;
- p->temp_name_counter = temp_name_counter;
- p->base_init_list = current_base_init_list;
- p->member_init_list = current_member_init_list;
- p->current_class_ptr = current_class_ptr;
- p->current_class_ref = current_class_ref;
- p->static_labelno = static_labelno;
-}
-
-/* Restore the variables used during compilation of a C++ function. */
+ return IDENTIFIER_GLOBAL_VALUE (t);
+}
-void
-pop_cp_function_context (context)
- tree context;
+/* Build the void_list_node (void_type_node having been created). */
+tree
+build_void_list_node ()
{
- struct cp_function *p = cp_function_chain;
- tree link;
-
- /* Bring back all the labels that were shadowed. */
- for (link = shadowed_labels; link; link = TREE_CHAIN (link))
- if (DECL_NAME (TREE_VALUE (link)) != 0)
- SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link)),
- TREE_VALUE (link));
-
- pop_function_context_from (context);
-
- cp_function_chain = p->next;
-
- named_labels = p->named_labels;
- named_label_uses = p->named_label_uses;
- shadowed_labels = p->shadowed_labels;
- current_function_returns_value = p->returns_value;
- current_function_returns_null = p->returns_null;
- current_binding_level = p->binding_level;
- ctor_label = p->ctor_label;
- dtor_label = p->dtor_label;
- last_dtor_insn = p->last_dtor_insn;
- last_parm_cleanup_insn = p->last_parm_cleanup_insn;
- current_function_assigns_this = p->assigns_this;
- current_function_just_assigned_this = p->just_assigned_this;
- current_function_parms_stored = p->parms_stored;
- original_result_rtx = p->result_rtx;
- base_init_expr = p->base_init_expr;
- temp_name_counter = p->temp_name_counter;
- current_base_init_list = p->base_init_list;
- current_member_init_list = p->member_init_list;
- current_class_ptr = p->current_class_ptr;
- current_class_ref = p->current_class_ref;
- static_labelno = p->static_labelno;
-
- free (p);
+ tree t = build_tree_list (NULL_TREE, void_type_node);
+ TREE_PARMLIST (t) = 1;
+ return t;
}
-int
-in_function_p ()
+static int
+cp_missing_noreturn_ok_p (decl)
+ tree decl;
{
- return function_depth != 0;
+ /* A missing noreturn is ok for the `main' function. */
+ return DECL_MAIN_P (decl);
}
diff --git a/contrib/gcc/cp/decl.h b/contrib/gcc/cp/decl.h
index fcb247e..2316f06 100644
--- a/contrib/gcc/cp/decl.h
+++ b/contrib/gcc/cp/decl.h
@@ -1,5 +1,5 @@
/* Variables and structures for declaration processing.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -31,12 +31,8 @@ enum decl_context
};
/* We need this in here to get the decl_context definition. */
-extern tree grokdeclarator PROTO((tree, tree, enum decl_context, int, tree));
-
-/* C++: Keep these around to reduce calls to `get_identifier'.
- Identifiers for `this' in member functions and the auto-delete
- parameter for destructors. */
-extern tree this_identifier, in_charge_identifier;
+extern tree grokdeclarator PARAMS ((tree, tree, enum decl_context, int,
+ tree *));
/* Parsing a function declarator leaves a list of parameter names
or a chain or parameter decls here. */
diff --git a/contrib/gcc/cp/decl2.c b/contrib/gcc/cp/decl2.c
index d7f58bf..9b1c355 100644
--- a/contrib/gcc/cp/decl2.c
+++ b/contrib/gcc/cp/decl2.c
@@ -1,5 +1,6 @@
/* Process declarations and variables for C compiler.
- Copyright (C) 1988, 92-98, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -31,34 +32,23 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "tree.h"
#include "rtl.h"
+#include "expr.h"
#include "flags.h"
#include "cp-tree.h"
#include "decl.h"
#include "lex.h"
#include "output.h"
#include "except.h"
-#include "expr.h"
-#include "defaults.h"
#include "toplev.h"
-#include "dwarf2out.h"
-#include "dwarfout.h"
-#include "splay-tree.h"
-#include "varray.h"
-
-#if USE_CPPLIB
+#include "ggc.h"
+#include "timevar.h"
#include "cpplib.h"
-extern cpp_reader parse_in;
-#endif
+#include "target.h"
+extern cpp_reader *parse_in;
/* This structure contains information about the initializations
and/or destructions required for a particular priority level. */
typedef struct priority_info_s {
- /* A label indicating where we should generate the next
- initialization with this priority. */
- rtx initialization_sequence;
- /* A label indicating where we should generate the next destruction
- with this priority. */
- rtx destruction_sequence;
/* Non-zero if there have been any initializations at this priority
throughout the translation unit. */
int initializations_p;
@@ -67,59 +57,52 @@ typedef struct priority_info_s {
int destructions_p;
} *priority_info;
-static tree get_sentry PROTO((tree));
-static void mark_vtable_entries PROTO((tree));
-static void grok_function_init PROTO((tree, tree));
-static int finish_vtable_vardecl PROTO((tree *, void *));
-static int prune_vtable_vardecl PROTO((tree *, void *));
-static int finish_sigtable_vardecl PROTO((tree *, void *));
-static int is_namespace_ancestor PROTO((tree, tree));
-static void add_using_namespace PROTO((tree, tree, int));
-static tree ambiguous_decl PROTO((tree, tree, tree,int));
-static tree build_anon_union_vars PROTO((tree, tree*, int, int));
-static int acceptable_java_type PROTO((tree));
-static void output_vtable_inherit PROTO((tree));
-static void start_objects PROTO((int, int));
-static void finish_objects PROTO((int, int));
-static tree merge_functions PROTO((tree, tree));
-static tree decl_namespace PROTO((tree));
-static tree validate_nonmember_using_decl PROTO((tree, tree *, tree *));
-static void do_nonmember_using_decl PROTO((tree, tree, tree, tree,
+static void mark_vtable_entries PARAMS ((tree));
+static void grok_function_init PARAMS ((tree, tree));
+static int finish_vtable_vardecl PARAMS ((tree *, void *));
+static int prune_vtable_vardecl PARAMS ((tree *, void *));
+static int is_namespace_ancestor PARAMS ((tree, tree));
+static void add_using_namespace PARAMS ((tree, tree, int));
+static tree ambiguous_decl PARAMS ((tree, tree, tree,int));
+static tree build_anon_union_vars PARAMS ((tree, tree*, int, int));
+static int acceptable_java_type PARAMS ((tree));
+static void output_vtable_inherit PARAMS ((tree));
+static tree start_objects PARAMS ((int, int));
+static void finish_objects PARAMS ((int, int, tree));
+static tree merge_functions PARAMS ((tree, tree));
+static tree decl_namespace PARAMS ((tree));
+static tree validate_nonmember_using_decl PARAMS ((tree, tree *, tree *));
+static void do_nonmember_using_decl PARAMS ((tree, tree, tree, tree,
tree *, tree *));
-static void start_static_storage_duration_function PROTO((void));
-static int generate_inits_for_priority PROTO((splay_tree_node, void *));
-static void finish_static_storage_duration_function PROTO((void));
-static priority_info get_priority_info PROTO((int));
-static void do_static_initialization PROTO((tree, tree, tree, int));
-static void do_static_destruction PROTO((tree, tree, int));
-static void do_static_initialization_and_destruction PROTO((tree, tree));
-static void generate_ctor_or_dtor_function PROTO((int, int));
+static tree start_static_storage_duration_function PARAMS ((void));
+static void finish_static_storage_duration_function PARAMS ((tree));
+static priority_info get_priority_info PARAMS ((int));
+static void do_static_initialization PARAMS ((tree, tree));
+static void do_static_destruction PARAMS ((tree));
+static tree start_static_initialization_or_destruction PARAMS ((tree, int));
+static void finish_static_initialization_or_destruction PARAMS ((tree));
+static void generate_ctor_or_dtor_function PARAMS ((int, int));
static int generate_ctor_and_dtor_functions_for_priority
- PROTO((splay_tree_node, void *));
-extern int current_class_depth;
-
-/* A list of virtual function tables we must make sure to write out. */
-tree pending_vtables;
+ PARAMS ((splay_tree_node, void *));
+static tree prune_vars_needing_no_initialization PARAMS ((tree));
+static void write_out_vars PARAMS ((tree));
+static void import_export_class PARAMS ((tree));
+static tree key_method PARAMS ((tree));
+static int compare_options PARAMS ((const PTR, const PTR));
+static tree get_guard_bits PARAMS ((tree));
/* A list of static class variables. This is needed, because a
static class variable can be declared inside the class without
- an initializer, and then initialized, staticly, outside the class. */
+ an initializer, and then initialized, statically, outside the class. */
static varray_type pending_statics;
-static size_t pending_statics_used;
+#define pending_statics_used \
+ (pending_statics ? pending_statics->elements_used : 0)
/* A list of functions which were declared inline, but which we
may need to emit outline anyway. */
-static varray_type saved_inlines;
-static size_t saved_inlines_used;
-
-/* Used to help generate temporary names which are unique within
- a function. Reset to 0 by start_function. */
-
-int temp_name_counter;
-
-/* Same, but not reset. Local temp variables and global temp variables
- can have the same name. */
-static int global_temp_name_counter;
+static varray_type deferred_fns;
+#define deferred_fns_used \
+ (deferred_fns ? deferred_fns->elements_used : 0)
/* Flag used when debugging spew.c */
@@ -131,29 +114,15 @@ int at_eof;
/* Functions called along with real static constructors and destructors. */
-tree static_ctors, static_dtors;
+tree static_ctors;
+tree static_dtors;
-/* The current open namespace, and ::. */
+/* The :: namespace. */
-tree current_namespace;
tree global_namespace;
-
-/* The stack for namespaces of current declarations. */
-
-static tree decl_namespace_list;
-
/* C (and C++) language-specific option variables. */
-/* Nonzero means allow type mismatches in conditional expressions;
- just make their values `void'. */
-
-int flag_cond_mismatch;
-
-/* Nonzero means give `double' the same size as `float'. */
-
-int flag_short_double;
-
/* Nonzero means don't recognize the keyword `asm'. */
int flag_no_asm;
@@ -162,15 +131,6 @@ int flag_no_asm;
int flag_no_gnu_keywords;
-/* Nonzero means don't recognize the non-ANSI builtin functions. */
-
-int flag_no_builtin;
-
-/* Nonzero means don't recognize the non-ANSI builtin functions.
- -ansi sets this. */
-
-int flag_no_nonansi_builtin;
-
/* Nonzero means do some things the same way PCC does. Only provided so
the compiler will link. */
@@ -180,8 +140,9 @@ int flag_traditional;
int flag_signed_bitfields = 1;
-/* Nonzero means enable obscure ANSI features and disable GNU extensions
- that might cause ANSI-compliant code to be miscompiled. */
+/* Nonzero means enable obscure standard features and disable GNU
+ extensions that might cause standard-compliant code to be
+ miscompiled. */
int flag_ansi;
@@ -224,22 +185,8 @@ int warn_long_long = 1;
int warn_ctor_dtor_privacy = 1;
-/* 1 or 2 if we want to implement vtables using "thunks".
- The default is off. Version 1 indicates "old" implementation;
- Version 2 passes the __vlist argument in pvbase cases. */
-
-#ifndef DEFAULT_VTABLE_THUNKS
-#define DEFAULT_VTABLE_THUNKS 0
-#endif
-int flag_vtable_thunks = DEFAULT_VTABLE_THUNKS;
-
-#if DEFAULT_VTABLE_THUNKS == 2
-int flag_vtable_thunks_compat = 1;
-#else
-int flag_vtable_thunks_compat = 0;
-#endif
-
-/* True if we want to deal with repository information. */
+/* Nonzero means generate separate instantiation control files and juggle
+ them at link time. */
int flag_use_repository;
@@ -285,9 +232,13 @@ int warn_missing_braces;
int warn_sign_compare;
-/* Warn about *printf or *scanf format/argument anomalies. */
+/* Warn about testing equality of floating point numbers. */
+
+int warn_float_equal = 0;
+
+/* Warn about functions which might be candidates for format attributes. */
-int warn_format;
+int warn_missing_format_attribute;
/* Warn about a subscript that has type char. */
@@ -304,23 +255,25 @@ int warn_parentheses;
/* Non-zero means warn in function declared in derived class has the
same name as a virtual in the base class, but fails to match the
type signature of any virtual function in the base class. */
+
int warn_overloaded_virtual;
/* Non-zero means warn when declaring a class that has a non virtual
destructor, when it really ought to have a virtual one. */
-int warn_nonvdtor;
-/* Non-zero means warn when a function is declared extern and later inline. */
-int warn_extern_inline;
+int warn_nonvdtor;
/* Non-zero means warn when the compiler will reorder code. */
+
int warn_reorder;
/* Non-zero means warn when synthesis behavior differs from Cfront's. */
+
int warn_synth;
/* Non-zero means warn when we convert a pointer to member function
into a pointer to (void or function). */
+
int warn_pmf2ptr = 1;
/* Nonzero means warn about violation of some Effective C++ style rules. */
@@ -360,43 +313,16 @@ int warn_deprecated = 1;
#endif
int dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
-/* Nonzero for -fno-strict-prototype switch: do not consider empty
- argument prototype to mean function takes no arguments. */
-
-int flag_strict_prototype = 2;
-int strict_prototype = 1;
-int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus = 1;
-
-/* Nonzero means that labels can be used as first-class objects */
-
-int flag_labels_ok;
+/* Nonzero means allow Microsoft extensions without a pedwarn. */
-/* Non-zero means to collect statistics which might be expensive
- and to print them when we are done. */
-int flag_detailed_statistics;
+int flag_ms_extensions;
/* C++ specific flags. */
-/* Zero means that `this' is a *const. This gives nice behavior in the
- 2.0 world. 1 gives 1.2-compatible behavior. 2 gives Spring behavior.
- -2 means we're constructing an object and it has fixed type. */
-
-int flag_this_is_variable;
-
-/* 3 means write out only virtuals function tables `defined'
- in this implementation file.
- 0 means write out virtual function tables and give them
- (C) static access (default). */
-
-int write_virtuals;
/* Nonzero means we should attempt to elide constructors when possible. */
int flag_elide_constructors = 1;
-/* Nonzero means recognize and handle signature language constructs. */
-
-int flag_handle_signatures;
-
/* Nonzero means that member functions defined in class scope are
inline by default. */
@@ -404,11 +330,8 @@ int flag_default_inline = 1;
/* Controls whether compiler generates 'type descriptor' that give
run-time type information. */
-int flag_rtti = 1;
-/* Nonzero if we wish to output cross-referencing information
- for the GNU class browser. */
-extern int flag_gnu_xref;
+int flag_rtti = 1;
/* Nonzero if we want to support huge (> 2^(sizeof(short)*8-1) bytes)
objects. */
@@ -428,18 +351,18 @@ int flag_access_control = 1;
/* Nonzero if we want to understand the operator names, i.e. 'bitand'. */
-int flag_operator_names;
+int flag_operator_names = 1;
/* Nonzero if we want to check the return value of new and avoid calling
constructors if it is a null pointer. */
int flag_check_new;
-/* Nonzero if we want the new ANSI rules for pushing a new scope for `for'
+/* Nonzero if we want the new ISO rules for pushing a new scope for `for'
initialization variables.
0: Old rules, set by -fno-for-scope.
- 2: New ANSI rules, set by -ffor-scope.
- 1: Try to implement new ANSI rules, but with backup compatibility
+ 2: New ISO rules, set by -ffor-scope.
+ 1: Try to implement new ISO rules, but with backup compatibility
(and warnings). This is the default, for now. */
int flag_new_for_scope = 1;
@@ -450,31 +373,16 @@ int flag_new_for_scope = 1;
int flag_weak = 1;
-/* Nonzero to enable experimental ABI changes. */
-
-int flag_new_abi;
-
-/* Nonzero to not ignore namespace std. */
-
-int flag_honor_std;
-
-/* Maximum template instantiation depth. Must be at least 17 for ANSI
- compliance. */
-
-int max_tinst_depth = 17;
+/* Nonzero to use __cxa_atexit, rather than atexit, to register
+ destructors for local statics and global objects. */
-/* The name-mangling scheme to use. Must be 1 or greater to support
- template functions with identical types, but different template
- arguments. */
-int name_mangling_version = 2;
+int flag_use_cxa_atexit;
-/* Nonzero means that guiding declarations are allowed. */
-int flag_guiding_decls;
+/* Maximum template instantiation depth. This limit is rather
+ arbitrary, but it exists to limit the time it takes to notice
+ infinite template instantiations. */
-/* Nonzero if squashed mangling is to be performed.
- This uses the B and K codes to reference previously seen class types
- and class qualifiers. */
-int flag_do_squangling;
+int max_tinst_depth = 500;
/* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */
@@ -485,13 +393,20 @@ int flag_vtable_gc;
int flag_permissive;
+/* Nonzero means to implement standard semantics for exception
+ specifications, calling unexpected if an exception is thrown that
+ doesn't match the specification. Zero means to treat them as
+ assertions and optimize accordingly, but not check them. */
+
+int flag_enforce_eh_specs = 1;
+
/* Table of language-dependent -f options.
STRING is the option name. VARIABLE is the address of the variable.
ON_VALUE is the value to store in VARIABLE
if `-fSTRING' is seen as an option.
(If `-fno-STRING' is seen as an option, the opposite value is stored.) */
-static struct { const char *string; int *variable; int on_value;}
+static const struct { const char *const string; int *const variable; const int on_value;}
lang_f_options[] =
{
/* C/C++ options. */
@@ -501,7 +416,7 @@ lang_f_options[] =
{"unsigned-bitfields", &flag_signed_bitfields, 0},
{"short-enums", &flag_short_enums, 1},
{"short-double", &flag_short_double, 1},
- {"cond-mismatch", &flag_cond_mismatch, 1},
+ {"short-wchar", &flag_short_wchar, 1},
{"asm", &flag_no_asm, 0},
{"builtin", &flag_no_builtin, 0},
@@ -513,54 +428,72 @@ lang_f_options[] =
{"default-inline", &flag_default_inline, 1},
{"dollars-in-identifiers", &dollars_in_ident, 1},
{"elide-constructors", &flag_elide_constructors, 1},
+ {"enforce-eh-specs", &flag_enforce_eh_specs, 1},
{"external-templates", &flag_external_templates, 1},
{"for-scope", &flag_new_for_scope, 2},
{"gnu-keywords", &flag_no_gnu_keywords, 0},
{"handle-exceptions", &flag_exceptions, 1},
- {"handle-signatures", &flag_handle_signatures, 1},
- {"honor-std", &flag_honor_std, 1},
- {"huge-objects", &flag_huge_objects, 1},
{"implement-inlines", &flag_implement_inlines, 1},
{"implicit-inline-templates", &flag_implicit_inline_templates, 1},
{"implicit-templates", &flag_implicit_templates, 1},
- {"labels-ok", &flag_labels_ok, 1},
+ {"ms-extensions", &flag_ms_extensions, 1},
{"nonansi-builtins", &flag_no_nonansi_builtin, 0},
{"operator-names", &flag_operator_names, 1},
{"optional-diags", &flag_optional_diags, 1},
{"permissive", &flag_permissive, 1},
{"repo", &flag_use_repository, 1},
{"rtti", &flag_rtti, 1},
- {"squangle", &flag_do_squangling, 1},
{"stats", &flag_detailed_statistics, 1},
- {"strict-prototype", &flag_strict_prototype, 1},
- {"this-is-variable", &flag_this_is_variable, 1},
{"vtable-gc", &flag_vtable_gc, 1},
- {"vtable-thunks", &flag_vtable_thunks, 1},
- {"weak", &flag_weak, 1},
- {"xref", &flag_gnu_xref, 1}
+ {"use-cxa-atexit", &flag_use_cxa_atexit, 1},
+ {"weak", &flag_weak, 1}
+};
+
+/* The list of `-f' options that we no longer support. The `-f'
+ prefix is not given in this table. The `-fno-' variants are not
+ listed here. This table must be kept in alphabetical order. */
+static const char * const unsupported_options[] = {
+ "all-virtual",
+ "cond-mismatch",
+ "enum-int-equiv",
+ "guiding-decls",
+ "honor-std",
+ "huge-objects",
+ "labels-ok",
+ "new-abi",
+ "nonnull-objects",
+ "squangle",
+ "strict-prototype",
+ "this-is-variable",
+ "vtable-thunks",
+ "xref"
};
+/* Compare two option strings, pointed two by P1 and P2, for use with
+ bsearch. */
+
+static int
+compare_options (p1, p2)
+ const PTR p1;
+ const PTR p2;
+{
+ return strcmp (*((const char *const *) p1), *((const char *const *) p2));
+}
+
/* Decode the string P as a language-specific option.
Return the number of strings consumed for a valid option.
- Otherwise return 0. */
+ Otherwise return 0. Should not complain if it does not
+ recognise the option. */
int
-lang_decode_option (argc, argv)
- int argc
-#if !USE_CPPLIB
- ATTRIBUTE_UNUSED
-#endif
- ;
+cxx_decode_option (argc, argv)
+ int argc;
char **argv;
-
{
int strings_processed;
- char *p = argv[0];
-#if USE_CPPLIB
- strings_processed = cpp_handle_option (&parse_in, argc, argv);
-#else
- strings_processed = 0;
-#endif /* ! USE_CPPLIB */
+ const char *p = argv[0];
+
+ strings_processed = cpp_handle_option (parse_in, argc, argv, 0);
if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
/* ignore */;
@@ -569,150 +502,93 @@ lang_decode_option (argc, argv)
/* Some kind of -f option.
P's value is the option sans `-f'.
Search for it in the table of options. */
- int found = 0;
+ const char *option_value = NULL;
+ const char *positive_option;
size_t j;
p += 2;
/* Try special -f options. */
- if (!strcmp (p, "handle-exceptions")
- || !strcmp (p, "no-handle-exceptions"))
- warning ("-fhandle-exceptions has been renamed to -fexceptions (and is now on by default)");
-
- if (!strcmp (p, "memoize-lookups")
- || !strcmp (p, "no-memoize-lookups")
- || !strcmp (p, "save-memoized")
- || !strcmp (p, "no-save-memoized")
- || !strcmp (p, "no-all-virtual")
- || !strcmp (p, "no-enum-int-equiv")
- || !strcmp (p, "nonnull-objects")
- || !strcmp (p, "ansi-overloading"))
- {
- /* ignore */
- found = 1;
- }
- else if (!strcmp (p, "all-virtual")
- || !strcmp (p, "enum-int-equiv")
- || !strcmp (p, "no-nonnull-objects")
- || !strcmp (p, "no-ansi-overloading"))
+ /* See if this is one of the options no longer supported. We
+ used to support these options, so we continue to accept them,
+ with a warning. */
+ if (strncmp (p, "no-", strlen ("no-")) == 0)
+ positive_option = p + strlen ("no-");
+ else
+ positive_option = p;
+
+ /* If the option is present, issue a warning. Indicate to our
+ caller that the option was processed successfully. */
+ if (bsearch (&positive_option,
+ unsupported_options,
+ (sizeof (unsupported_options)
+ / sizeof (unsupported_options[0])),
+ sizeof (unsupported_options[0]),
+ compare_options))
{
warning ("-f%s is no longer supported", p);
- found = 1;
+ return 1;
}
+
+ if (!strcmp (p, "handle-exceptions")
+ || !strcmp (p, "no-handle-exceptions"))
+ warning ("-fhandle-exceptions has been renamed to -fexceptions (and is now on by default)");
else if (! strcmp (p, "alt-external-templates"))
{
flag_external_templates = 1;
flag_alt_external_templates = 1;
- found = 1;
cp_deprecated ("-falt-external-templates");
}
else if (! strcmp (p, "no-alt-external-templates"))
- {
- flag_alt_external_templates = 0;
- found = 1;
- }
+ flag_alt_external_templates = 0;
else if (!strcmp (p, "repo"))
{
flag_use_repository = 1;
flag_implicit_templates = 0;
- found = 1;
- }
- else if (!strcmp (p, "guiding-decls"))
- {
- flag_guiding_decls = 1;
- name_mangling_version = 0;
- found = 1;
- }
- else if (!strcmp (p, "no-guiding-decls"))
- {
- flag_guiding_decls = 0;
- found = 1;
}
- else if (!strcmp (p, "this-is-variable"))
- {
- flag_this_is_variable = 1;
- found = 1;
- cp_deprecated ("-fthis-is-variable");
- }
else if (!strcmp (p, "external-templates"))
{
flag_external_templates = 1;
- found = 1;
cp_deprecated ("-fexternal-templates");
}
- else if (!strncmp (p, "vtable-thunks", 13))
- {
- if (p[13] == '=')
- {
- flag_vtable_thunks =
- read_integral_parameter (p+14, p, 1);
- }
- else
- {
- /* If the machine file has a default setting, use that
- for -fvtable-thunks. Otherwise, set it to version
- 2. */
-#if DEFAULT_VTABLE_THUNKS
- flag_vtable_thunks = DEFAULT_VTABLE_THUNKS;
-#else
- flag_vtable_thunks = 1;
-#endif
- }
- if (flag_vtable_thunks == 2)
- /* v2 is a compatibility mode between v1 and v3. */
- flag_vtable_thunks_compat = 1;
- else if(flag_vtable_thunks == 3)
- flag_vtable_thunks_compat = 0;
- found = 1;
- }
- else if (!strcmp (p, "handle-signatures"))
- {
- flag_handle_signatures = 1;
- found = 1;
- cp_deprecated ("-fhandle-signatures");
- }
- else if (!strcmp (p, "new-abi"))
- {
- flag_new_abi = 1;
- flag_do_squangling = 1;
- flag_honor_std = 1;
- flag_vtable_thunks = 2;
- }
- else if (!strcmp (p, "no-new-abi"))
- {
- flag_new_abi = 0;
- flag_do_squangling = 0;
- flag_honor_std = 0;
- }
- else if (!strncmp (p, "template-depth-", 15))
- {
- max_tinst_depth =
- read_integral_parameter (p + 15, p - 2, max_tinst_depth);
- }
- else if (!strncmp (p, "name-mangling-version-", 22))
+ else if ((option_value
+ = skip_leading_substring (p, "template-depth-")))
+ max_tinst_depth
+ = read_integral_parameter (option_value, p - 2, max_tinst_depth);
+ else if ((option_value
+ = skip_leading_substring (p, "name-mangling-version-")))
{
- name_mangling_version =
- read_integral_parameter (p + 22, p - 2, name_mangling_version);
+ warning ("-fname-mangling-version is no longer supported");
+ return 1;
}
- else for (j = 0;
- !found && j < sizeof (lang_f_options) / sizeof (lang_f_options[0]);
- j++)
+ else if (dump_switch_p (p))
+ ;
+ else
{
- if (!strcmp (p, lang_f_options[j].string))
- {
- *lang_f_options[j].variable = lang_f_options[j].on_value;
- /* A goto here would be cleaner,
- but breaks the vax pcc. */
- found = 1;
- }
- if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
- && ! strcmp (p+3, lang_f_options[j].string))
+ int found = 0;
+
+ for (j = 0;
+ !found && j < (sizeof (lang_f_options)
+ / sizeof (lang_f_options[0]));
+ j++)
{
- *lang_f_options[j].variable = ! lang_f_options[j].on_value;
- found = 1;
+ if (!strcmp (p, lang_f_options[j].string))
+ {
+ *lang_f_options[j].variable = lang_f_options[j].on_value;
+ /* A goto here would be cleaner,
+ but breaks the VAX pcc. */
+ found = 1;
+ }
+ else if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
+ && ! strcmp (p+3, lang_f_options[j].string))
+ {
+ *lang_f_options[j].variable = ! lang_f_options[j].on_value;
+ found = 1;
+ }
}
+
+ return found;
}
- return found;
}
else if (p[0] == '-' && p[1] == 'W')
{
@@ -742,22 +618,39 @@ lang_decode_option (argc, argv)
warn_pointer_arith = setting;
else if (!strcmp (p, "missing-prototypes"))
warn_missing_prototypes = setting;
+ else if (!strcmp (p, "strict-prototypes"))
+ {
+ if (setting == 0)
+ warning ("-Wno-strict-prototypes is not supported in C++");
+ }
else if (!strcmp (p, "redundant-decls"))
warn_redundant_decls = setting;
else if (!strcmp (p, "missing-braces"))
warn_missing_braces = setting;
else if (!strcmp (p, "sign-compare"))
warn_sign_compare = setting;
+ else if (!strcmp (p, "float-equal"))
+ warn_float_equal = setting;
else if (!strcmp (p, "format"))
- warn_format = setting;
+ set_Wformat (setting);
+ else if (!strcmp (p, "format=2"))
+ set_Wformat (2);
+ else if (!strcmp (p, "format-y2k"))
+ warn_format_y2k = setting;
+ else if (!strcmp (p, "format-extra-args"))
+ warn_format_extra_args = setting;
+ else if (!strcmp (p, "format-nonliteral"))
+ warn_format_nonliteral = setting;
+ else if (!strcmp (p, "format-security"))
+ warn_format_security = setting;
+ else if (!strcmp (p, "missing-format-attribute"))
+ warn_missing_format_attribute = setting;
else if (!strcmp (p, "conversion"))
warn_conversion = setting;
else if (!strcmp (p, "parentheses"))
warn_parentheses = setting;
else if (!strcmp (p, "non-virtual-dtor"))
warn_nonvdtor = setting;
- else if (!strcmp (p, "extern-inline"))
- warn_extern_inline = setting;
else if (!strcmp (p, "reorder"))
warn_reorder = setting;
else if (!strcmp (p, "synth"))
@@ -793,10 +686,10 @@ lang_decode_option (argc, argv)
else if (!strcmp (p, "all"))
{
warn_return_type = setting;
- warn_unused = setting;
+ set_Wunused (setting);
warn_implicit = setting;
warn_switch = setting;
- warn_format = setting;
+ set_Wformat (setting);
warn_parentheses = setting;
warn_missing_braces = setting;
warn_sign_compare = setting;
@@ -820,7 +713,7 @@ lang_decode_option (argc, argv)
}
else if (!strcmp (p, "-ansi"))
flag_no_nonansi_builtin = 1, flag_ansi = 1,
- flag_no_gnu_keywords = 1, flag_operator_names = 1;
+ flag_noniso_default_format_attributes = 0, flag_no_gnu_keywords = 1;
#ifdef SPEW_DEBUG
/* Undocumented, only ever used when you're invoking cc1plus by hand, since
it's probably safe to assume no sane person would ever want to use this
@@ -836,9 +729,11 @@ lang_decode_option (argc, argv)
/* Incorporate `const' and `volatile' qualifiers for member functions.
FUNCTION is a TYPE_DECL or a FUNCTION_DECL.
- QUALS is a list of qualifiers. */
+ QUALS is a list of qualifiers. Returns any explicit
+ top-level qualifiers of the method's this pointer, anything other than
+ TYPE_UNQUALIFIED will be an extension. */
-tree
+int
grok_method_quals (ctype, function, quals)
tree ctype, function, quals;
{
@@ -846,13 +741,16 @@ grok_method_quals (ctype, function, quals)
tree raises = TYPE_RAISES_EXCEPTIONS (fntype);
int type_quals = TYPE_UNQUALIFIED;
int dup_quals = TYPE_UNQUALIFIED;
+ int this_quals = TYPE_UNQUALIFIED;
do
{
int tq = cp_type_qual_from_rid (TREE_VALUE (quals));
- if (type_quals & tq)
+ if ((type_quals | this_quals) & tq)
dup_quals |= tq;
+ else if (tq & TYPE_QUAL_RESTRICT)
+ this_quals |= tq;
else
type_quals |= tq;
quals = TREE_CHAIN (quals);
@@ -860,7 +758,7 @@ grok_method_quals (ctype, function, quals)
while (quals);
if (dup_quals != TYPE_UNQUALIFIED)
- cp_error ("duplicate type qualifiers in %s declaration",
+ error ("duplicate type qualifiers in %s declaration",
TREE_CODE (function) == FUNCTION_DECL
? "member function" : "type");
@@ -873,7 +771,7 @@ grok_method_quals (ctype, function, quals)
fntype = build_exception_variant (fntype, raises);
TREE_TYPE (function) = fntype;
- return ctype;
+ return this_quals;
}
/* Warn when -fexternal-templates is used and #pragma
@@ -890,16 +788,16 @@ warn_if_unknown_interface (decl)
if (flag_alt_external_templates)
{
- struct tinst_level *til = tinst_for_decl ();
+ tree til = tinst_for_decl ();
int sl = lineno;
- char *sf = input_filename;
+ const char *sf = input_filename;
if (til)
{
- lineno = til->line;
- input_filename = til->file;
+ lineno = TINST_LINE (til);
+ input_filename = TINST_FILE (til);
}
- cp_warning ("template `%#D' instantiated in file without #pragma interface",
+ warning ("template `%#D' instantiated in file without #pragma interface",
decl);
lineno = sl;
input_filename = sf;
@@ -915,30 +813,39 @@ void
grok_x_components (specs)
tree specs;
{
- struct pending_inline **p;
tree t;
specs = strip_attrs (specs);
check_tag_decl (specs);
- t = groktypename (build_decl_list (specs, NULL_TREE));
+ t = groktypename (build_tree_list (specs, NULL_TREE));
/* The only case where we need to do anything additional here is an
anonymous union field, e.g.: `struct S { union { int i; }; };'. */
- if (t == NULL_TREE || !ANON_UNION_TYPE_P (t))
+ if (t == NULL_TREE || !ANON_AGGR_TYPE_P (t))
return;
- fixup_anonymous_union (t);
- finish_member_declaration (build_lang_field_decl (FIELD_DECL,
- NULL_TREE,
- t));
-
- /* Ignore any inline function definitions in the anonymous union
- since an anonymous union may not have function members. */
- p = &pending_inlines;
- for (; *p; *p = (*p)->next)
- if (DECL_CONTEXT ((*p)->fndecl) != t)
- break;
+ fixup_anonymous_aggr (t);
+ finish_member_declaration (build_decl (FIELD_DECL, NULL_TREE, t));
+}
+
+/* Returns a PARM_DECL for a parameter of the indicated TYPE, with the
+ indicated NAME. */
+
+tree
+build_artificial_parm (name, type)
+ tree name;
+ tree type;
+{
+ tree parm;
+
+ parm = build_decl (PARM_DECL, name, type);
+ DECL_ARTIFICIAL (parm) = 1;
+ /* All our artificial parms are implicitly `const'; they cannot be
+ assigned to. */
+ TREE_READONLY (parm) = 1;
+ DECL_ARG_TYPE (parm) = type;
+ return parm;
}
/* Constructors for types with virtual baseclasses need an "in-charge" flag
@@ -951,87 +858,71 @@ grok_x_components (specs)
appropriate. It is called from grokclassfn and tsubst.
FN must be either a constructor or destructor.
- For vtable thunks, types with polymorphic virtual bases need an
- additional "vlist" argument which is an array of virtual tables.
- In addition, if backwards-compatibility to v1 thunks is requested,
- a wrapper constructor may be needed as well. */
+ The in-charge flag follows the 'this' parameter, and is followed by the
+ VTT parm (if any), then the user-written parms. */
void
maybe_retrofit_in_chrg (fn)
tree fn;
{
tree basetype, arg_types, parms, parm, fntype;
- tree wrapper;
- if (CLASSTYPE_IS_TEMPLATE (DECL_CLASS_CONTEXT (fn)))
- /* Never retrofit arguments on template methods. */
+ /* If we've already add the in-charge parameter don't do it again. */
+ if (DECL_HAS_IN_CHARGE_PARM_P (fn))
return;
- if (DECL_CONSTRUCTOR_P (fn)
- && TYPE_USES_VIRTUAL_BASECLASSES (DECL_CLASS_CONTEXT (fn))
- && DECL_CONSTRUCTOR_FOR_VBASE (fn) == 0)
- /* OK */;
- else if (! DECL_CONSTRUCTOR_P (fn)
- && TREE_CHAIN (DECL_ARGUMENTS (fn)) == NULL_TREE)
- /* OK */;
- else
+ /* When processing templates we can't know, in general, whether or
+ not we're going to have virtual baseclasses. */
+ if (uses_template_parms (fn))
return;
- if (DECL_CONSTRUCTOR_P (fn))
- {
- if (TYPE_USES_PVBASES (DECL_CLASS_CONTEXT (fn)))
- {
- DECL_CONSTRUCTOR_FOR_VBASE (fn) = CONSTRUCTOR_FOR_PVBASE;
- if (flag_vtable_thunks_compat && varargs_function_p (fn))
- sorry ("-fvtable-thunks=2 for vararg constructor", fn);
- }
- else
- DECL_CONSTRUCTOR_FOR_VBASE (fn) = CONSTRUCTOR_FOR_VBASE;
- }
- else if (TYPE_USES_PVBASES (DECL_CLASS_CONTEXT (fn)))
- DECL_CONSTRUCTOR_FOR_VBASE (fn) = DESTRUCTOR_FOR_PVBASE;
+ /* We don't need an in-charge parameter for constructors that don't
+ have virtual bases. */
+ if (DECL_CONSTRUCTOR_P (fn)
+ && !TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
+ return;
- /* Retrieve the arguments, because it is potentially modified twice. */
arg_types = TYPE_ARG_TYPES (TREE_TYPE (fn));
basetype = TREE_TYPE (TREE_VALUE (arg_types));
arg_types = TREE_CHAIN (arg_types);
- if (DECL_CONSTRUCTOR_FOR_PVBASE_P (fn)
- || DECL_DESTRUCTOR_FOR_PVBASE_P (fn))
+ parms = TREE_CHAIN (DECL_ARGUMENTS (fn));
+
+ /* If this is a subobject constructor or destructor, our caller will
+ pass us a pointer to our VTT. */
+ if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
{
- /* Add the __vlist argument first. See __in_chrg below. */
- tree id = vlist_identifier;
- if (DECL_DESTRUCTOR_FOR_PVBASE_P (fn))
- id = get_identifier (VLIST1_NAME);
- parm = build_decl (PARM_DECL, id, vlist_type_node);
- SET_DECL_ARTIFICIAL (parm);
- DECL_ARG_TYPE (parm) = vlist_type_node;
- parms = DECL_ARGUMENTS (fn);
- /* Add it after 'this'. */
- TREE_CHAIN (parm) = TREE_CHAIN (parms);
- TREE_CHAIN (parms) = parm;
-
- arg_types = hash_tree_chain (vlist_type_node, arg_types);
- }
+ parm = build_artificial_parm (vtt_parm_identifier, vtt_parm_type);
- /* First add it to DECL_ARGUMENTS... */
- parm = build_decl (PARM_DECL, in_charge_identifier, integer_type_node);
- /* Mark the artificial `__in_chrg' parameter as "artificial". */
- SET_DECL_ARTIFICIAL (parm);
- DECL_ARG_TYPE (parm) = integer_type_node;
- TREE_READONLY (parm) = 1;
- parms = DECL_ARGUMENTS (fn);
- TREE_CHAIN (parm) = TREE_CHAIN (parms);
- TREE_CHAIN (parms) = parm;
+ /* First add it to DECL_ARGUMENTS between 'this' and the real args... */
+ TREE_CHAIN (parm) = parms;
+ parms = parm;
+
+ /* ...and then to TYPE_ARG_TYPES. */
+ arg_types = hash_tree_chain (vtt_parm_type, arg_types);
+
+ DECL_HAS_VTT_PARM_P (fn) = 1;
+ }
- /* ...and then to TYPE_ARG_TYPES. */
+ /* Then add the in-charge parm (before the VTT parm). */
+ parm = build_artificial_parm (in_charge_identifier, integer_type_node);
+ TREE_CHAIN (parm) = parms;
+ parms = parm;
arg_types = hash_tree_chain (integer_type_node, arg_types);
+
+ /* Insert our new parameter(s) into the list. */
+ TREE_CHAIN (DECL_ARGUMENTS (fn)) = parms;
+
+ /* And rebuild the function type. */
fntype = build_cplus_method_type (basetype, TREE_TYPE (TREE_TYPE (fn)),
arg_types);
if (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn)))
fntype = build_exception_variant (fntype,
TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn)));
TREE_TYPE (fn) = fntype;
+
+ /* Now we've got the in-charge parameter. */
+ DECL_HAS_IN_CHARGE_PARM_P (fn) = 1;
}
/* Classes overload their constituent function names automatically.
@@ -1061,9 +952,11 @@ grokclassfn (ctype, function, flags, quals)
tree quals;
{
tree fn_name = DECL_NAME (function);
- tree arg_types;
- tree parm;
- tree qualtype;
+ int this_quals = TYPE_UNQUALIFIED;
+
+ /* Even within an `extern "C"' block, members get C++ linkage. See
+ [dcl.link] for details. */
+ SET_DECL_LANGUAGE (function, lang_cplusplus);
if (fn_name == NULL_TREE)
{
@@ -1073,101 +966,41 @@ grokclassfn (ctype, function, flags, quals)
}
if (quals)
- qualtype = grok_method_quals (ctype, function, quals);
- else
- qualtype = ctype;
+ this_quals = grok_method_quals (ctype, function, quals);
- arg_types = TYPE_ARG_TYPES (TREE_TYPE (function));
if (TREE_CODE (TREE_TYPE (function)) == METHOD_TYPE)
{
/* Must add the class instance variable up front. */
/* Right now we just make this a pointer. But later
we may wish to make it special. */
- tree type = TREE_VALUE (arg_types);
- int constp = 1;
-
- if ((flag_this_is_variable > 0)
- && (flags == DTOR_FLAG || DECL_CONSTRUCTOR_P (function)))
- constp = 0;
-
- parm = build_decl (PARM_DECL, this_identifier, type);
- /* Mark the artificial `this' parameter as "artificial". */
- SET_DECL_ARTIFICIAL (parm);
- DECL_ARG_TYPE (parm) = type;
- /* We can make this a register, so long as we don't
- accidentally complain if someone tries to take its address. */
- DECL_REGISTER (parm) = 1;
- if (constp)
- TREE_READONLY (parm) = 1;
+ tree type = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (function)));
+ tree qual_type;
+ tree parm;
+
+ /* The `this' parameter is implicitly `const'; it cannot be
+ assigned to. */
+ this_quals |= TYPE_QUAL_CONST;
+ qual_type = cp_build_qualified_type (type, this_quals);
+ parm = build_artificial_parm (this_identifier, qual_type);
+ c_apply_type_quals_to_decl (this_quals, parm);
TREE_CHAIN (parm) = last_function_parms;
last_function_parms = parm;
}
DECL_ARGUMENTS (function) = last_function_parms;
- /* First approximations. */
DECL_CONTEXT (function) = ctype;
- DECL_CLASS_CONTEXT (function) = ctype;
+
+ if (flags == DTOR_FLAG)
+ DECL_DESTRUCTOR_P (function) = 1;
if (flags == DTOR_FLAG || DECL_CONSTRUCTOR_P (function))
- {
- maybe_retrofit_in_chrg (function);
- arg_types = TYPE_ARG_TYPES (TREE_TYPE (function));
- }
+ maybe_retrofit_in_chrg (function);
if (flags == DTOR_FLAG)
{
- DECL_ASSEMBLER_NAME (function) =
- build_destructor_name (ctype, DECL_DESTRUCTOR_FOR_PVBASE_P (function));
+ DECL_DESTRUCTOR_P (function) = 1;
TYPE_HAS_DESTRUCTOR (ctype) = 1;
}
- else
- set_mangled_name_for_decl (function);
-}
-
-/* Work on the expr used by alignof (this is only called by the parser). */
-
-tree
-grok_alignof (expr)
- tree expr;
-{
- tree best, t;
- int bestalign;
-
- if (processing_template_decl)
- return build_min (ALIGNOF_EXPR, sizetype, expr);
-
- if (TREE_CODE (expr) == COMPONENT_REF
- && DECL_C_BIT_FIELD (TREE_OPERAND (expr, 1)))
- error ("`__alignof__' applied to a bit-field");
-
- if (TREE_CODE (expr) == INDIRECT_REF)
- {
- best = t = TREE_OPERAND (expr, 0);
- bestalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t)));
-
- while (TREE_CODE (t) == NOP_EXPR
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == POINTER_TYPE)
- {
- int thisalign;
- t = TREE_OPERAND (t, 0);
- thisalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t)));
- if (thisalign > bestalign)
- best = t, bestalign = thisalign;
- }
- return c_alignof (TREE_TYPE (TREE_TYPE (best)));
- }
- else
- {
- /* ANSI says arrays and fns are converted inside comma.
- But we can't convert them in build_compound_expr
- because that would break commas in lvalues.
- So do the conversion here if operand was a comma. */
- if (TREE_CODE (expr) == COMPOUND_EXPR
- && (TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE))
- expr = default_conversion (expr);
- return c_alignof (TREE_TYPE (expr));
- }
}
/* Create an ARRAY_REF, checking for the user doing things backwards
@@ -1229,7 +1062,7 @@ grok_array_decl (array_expr, index_exp)
array_expr = p2, index_exp = i1;
else
{
- cp_error ("invalid types `%T[%T]' for array subscript",
+ error ("invalid types `%T[%T]' for array subscript",
type, TREE_TYPE (index_exp));
return error_mark_node;
}
@@ -1277,14 +1110,14 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
if (t == NULL_TREE || t == error_mark_node)
{
- cp_error ("type `%#T' argument given to `delete', expected pointer",
+ error ("type `%#T' argument given to `delete', expected pointer",
TREE_TYPE (exp));
return error_mark_node;
}
if (doing_vec == 2)
{
- maxindex = build_binary_op (MINUS_EXPR, size, integer_one_node);
+ maxindex = cp_build_binary_op (MINUS_EXPR, size, integer_one_node);
pedwarn ("anachronistic use of array size in vector delete");
}
@@ -1295,27 +1128,30 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
/* You can't delete functions. */
if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
{
- error ("cannot delete a function");
+ error ("cannot delete a function. Only pointer-to-objects are valid arguments to `delete'");
return error_mark_node;
}
/* Deleting ptr to void is undefined behaviour [expr.delete/3]. */
if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE)
- cp_warning ("`%T' is not a pointer-to-object type", type);
-
+ {
+ warning ("deleting `%T' is undefined", type);
+ doing_vec = 0;
+ }
+
/* An array can't have been allocated by new, so complain. */
if (TREE_CODE (t) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (t, 0)) == VAR_DECL
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == ARRAY_TYPE)
- cp_warning ("deleting array `%#D'", TREE_OPERAND (t, 0));
+ warning ("deleting array `%#D'", TREE_OPERAND (t, 0));
/* Deleting a pointer with the value zero is valid and has no effect. */
if (integer_zerop (t))
return build1 (NOP_EXPR, void_type_node, t);
if (doing_vec)
- return build_vec_delete (t, maxindex, integer_one_node,
- integer_zero_node, use_global_delete);
+ return build_vec_delete (t, maxindex, sfk_deleting_destructor,
+ use_global_delete);
else
{
if (IS_AGGR_TYPE (TREE_TYPE (type))
@@ -1329,7 +1165,7 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
return error_mark_node;
}
- return build_delete (type, t, integer_three_node,
+ return build_delete (type, t, sfk_deleting_destructor,
LOOKUP_NORMAL, use_global_delete);
}
}
@@ -1354,7 +1190,7 @@ check_member_template (tmpl)
/* 14.5.2.2 [temp.mem]
A local class shall not have member templates. */
- cp_error ("declaration of member template `%#D' in local class",
+ error ("invalid declaration of member template `%#D' in local class",
decl);
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl))
@@ -1362,7 +1198,7 @@ check_member_template (tmpl)
/* 14.5.2.3 [temp.mem]
A member function template shall not be virtual. */
- cp_error
+ error
("invalid use of `virtual' in template declaration of `%#D'",
decl);
DECL_VIRTUAL_P (decl) = 0;
@@ -1373,7 +1209,7 @@ check_member_template (tmpl)
DECL_IGNORED_P (tmpl) = 1;
}
else
- cp_error ("template declaration of `%#D'", decl);
+ error ("template declaration of `%#D'", decl);
}
/* Return true iff TYPE is a valid Java parameter or return type. */
@@ -1384,7 +1220,7 @@ acceptable_java_type (type)
{
if (TREE_CODE (type) == VOID_TYPE || TYPE_FOR_JAVA (type))
return 1;
- if (TREE_CODE (type) == POINTER_TYPE)
+ if (TREE_CODE (type) == POINTER_TYPE || TREE_CODE (type) == REFERENCE_TYPE)
{
type = TREE_TYPE (type);
if (TREE_CODE (type) == RECORD_TYPE)
@@ -1423,7 +1259,7 @@ check_java_method (method)
tree ret_type = TREE_TYPE (TREE_TYPE (method));
if (! acceptable_java_type (ret_type))
{
- cp_error ("Java method '%D' has non-Java return type `%T'",
+ error ("Java method '%D' has non-Java return type `%T'",
method, ret_type);
jerr++;
}
@@ -1432,7 +1268,7 @@ check_java_method (method)
tree type = TREE_VALUE (arg_types);
if (! acceptable_java_type (type))
{
- cp_error ("Java method '%D' has non-Java parameter type `%T'",
+ error ("Java method '%D' has non-Java parameter type `%T'",
method, type);
jerr++;
}
@@ -1455,6 +1291,8 @@ check_classfn (ctype, function)
tree *end = 0;
if (DECL_USE_TEMPLATE (function)
+ && !(TREE_CODE (function) == TEMPLATE_DECL
+ && DECL_TEMPLATE_SPECIALIZATION (function))
&& is_member_template (DECL_TI_TEMPLATE (function)))
/* Since this is a specialization of a member template,
we're not going to find the declaration in the class.
@@ -1478,7 +1316,7 @@ check_classfn (ctype, function)
&& DECL_CONSTRUCTOR_P (function))
goto got_it;
if (*++methods && fn_name == DECL_NAME (OVL_CURRENT (*methods))
- && DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (function)))
+ && DECL_DESTRUCTOR_P (function))
goto got_it;
while (++methods != end && *methods)
@@ -1491,22 +1329,6 @@ check_classfn (ctype, function)
fndecls = OVL_NEXT (fndecls))
{
fndecl = OVL_CURRENT (fndecls);
- /* The DECL_ASSEMBLER_NAME for a TEMPLATE_DECL, or
- for a for member function of a template class, is
- not mangled, so the check below does not work
- correctly in that case. Since mangled destructor
- names do not include the type of the arguments,
- we can't use this short-cut for them, either.
- (It's not legal to declare arguments for a
- destructor, but some people try.) */
- if (!DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (function))
- && (DECL_ASSEMBLER_NAME (function)
- != DECL_NAME (function))
- && (DECL_ASSEMBLER_NAME (fndecl)
- != DECL_NAME (fndecl))
- && (DECL_ASSEMBLER_NAME (function)
- == DECL_ASSEMBLER_NAME (fndecl)))
- return fndecl;
/* We cannot simply call decls_match because this
doesn't work for static member functions that are
@@ -1542,7 +1364,7 @@ check_classfn (ctype, function)
if (methods != end && *methods)
{
tree fndecl = *methods;
- cp_error ("prototype for `%#D' does not match any in class `%T'",
+ error ("prototype for `%#D' does not match any in class `%T'",
function, ctype);
cp_error_at ("candidate%s: %+#D", OVL_NEXT (fndecl) ? "s are" : " is",
OVL_CURRENT (fndecl));
@@ -1552,10 +1374,10 @@ check_classfn (ctype, function)
else
{
methods = 0;
- if (TYPE_SIZE (ctype) == 0)
+ if (!COMPLETE_TYPE_P (ctype))
incomplete_type_error (function, ctype);
else
- cp_error ("no `%#D' member function declared in class `%T'",
+ error ("no `%#D' member function declared in class `%T'",
function, ctype);
}
@@ -1563,62 +1385,57 @@ check_classfn (ctype, function)
spurious errors (unless the CTYPE is not yet defined, in which
case we'll only confuse ourselves when the function is declared
properly within the class. */
- if (TYPE_SIZE (ctype))
- add_method (ctype, methods, function);
+ if (COMPLETE_TYPE_P (ctype))
+ add_method (ctype, function, /*error_p=*/1);
return NULL_TREE;
}
/* We have just processed the DECL, which is a static data member.
Its initializer, if present, is INIT. The ASMSPEC_TREE, if
present, is the assembly-language name for the data member.
- NEED_POP and FLAGS are as for cp_finish_decl. */
+ FLAGS is as for cp_finish_decl. */
void
-finish_static_data_member_decl (decl, init, asmspec_tree, need_pop, flags)
+finish_static_data_member_decl (decl, init, asmspec_tree, flags)
tree decl;
tree init;
tree asmspec_tree;
- int need_pop;
int flags;
{
- char* asmspec = 0;
-
- if (asmspec_tree)
- asmspec = TREE_STRING_POINTER (asmspec_tree);
-
my_friendly_assert (TREE_PUBLIC (decl), 0);
+ DECL_CONTEXT (decl) = current_class_type;
+
/* We cannot call pushdecl here, because that would fill in the
- decl of our TREE_CHAIN. Instead, we modify cp_finish_decl to do
+ TREE_CHAIN of our decl. Instead, we modify cp_finish_decl to do
the right thing, namely, to put this decl out straight away. */
/* current_class_type can be NULL_TREE in case of error. */
- if (!asmspec && current_class_type)
- {
- DECL_INITIAL (decl) = error_mark_node;
- DECL_ASSEMBLER_NAME (decl)
- = build_static_name (current_class_type, DECL_NAME (decl));
- }
+ if (!asmspec_tree && current_class_type)
+ DECL_INITIAL (decl) = error_mark_node;
+
if (! processing_template_decl)
{
if (!pending_statics)
VARRAY_TREE_INIT (pending_statics, 32, "pending_statics");
-
- if (pending_statics_used == pending_statics->num_elements)
- VARRAY_GROW (pending_statics,
- 2 * pending_statics->num_elements);
- VARRAY_TREE (pending_statics, pending_statics_used) = decl;
- ++pending_statics_used;
+ VARRAY_PUSH_TREE (pending_statics, decl);
}
+ if (LOCAL_CLASS_P (current_class_type))
+ pedwarn ("local class `%#T' shall not have static data member `%#D'",
+ current_class_type, decl);
+
/* Static consts need not be initialized in the class definition. */
if (init != NULL_TREE && TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))
{
- static int explanation = 0;
+ static int explained = 0;
error ("initializer invalid for static member with constructor");
- if (explanation++ == 0)
- error ("(you really want to initialize it separately)");
- init = 0;
+ if (!explained)
+ {
+ error ("(an out of class initialization is required)");
+ explained = 1;
+ }
+ init = NULL_TREE;
}
/* Force the compiler to know when an uninitialized static const
member is being used. */
@@ -1626,23 +1443,19 @@ finish_static_data_member_decl (decl, init, asmspec_tree, need_pop, flags)
TREE_USED (decl) = 1;
DECL_INITIAL (decl) = init;
DECL_IN_AGGR_P (decl) = 1;
- DECL_CONTEXT (decl) = current_class_type;
- DECL_CLASS_CONTEXT (decl) = current_class_type;
- cp_finish_decl (decl, init, asmspec_tree, need_pop, flags);
+ cp_finish_decl (decl, init, asmspec_tree, flags);
}
/* Process the specs, declarator (NULL if omitted) and width (NULL if omitted)
- of a structure component, returning a FIELD_DECL node.
+ of a structure component, returning a _DECL node.
QUALS is a list of type qualifiers for this decl (such as for declaring
const member functions).
This is done during the parsing of the struct declaration.
- The FIELD_DECL nodes are chained together and the lot of them
+ The _DECL nodes are chained together and the lot of them
are ultimately passed to `build_struct' to make the RECORD_TYPE node.
- C++:
-
If class A defines that certain functions in class B are friends, then
the way I have set things up, it is B who is interested in permission
granted by A. However, it is in A's context that these declarations
@@ -1656,8 +1469,8 @@ tree
grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
tree declarator, declspecs, init, asmspec_tree, attrlist;
{
- register tree value;
- char *asmspec = 0;
+ tree value;
+ const char *asmspec = 0;
int flags = LOOKUP_ONLYCONVERTING;
/* Convert () initializers to = initializers. */
@@ -1666,9 +1479,25 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
&& TREE_OPERAND (declarator, 0)
&& (TREE_CODE (TREE_OPERAND (declarator, 0)) == IDENTIFIER_NODE
|| TREE_CODE (TREE_OPERAND (declarator, 0)) == SCOPE_REF)
- && parmlist_is_exprlist (TREE_OPERAND (declarator, 1)))
+ && parmlist_is_exprlist (CALL_DECLARATOR_PARMS (declarator)))
{
- init = TREE_OPERAND (declarator, 1);
+ /* It's invalid to try to initialize a data member using a
+ functional notation, e.g.:
+
+ struct S {
+ static int i (3);
+ };
+
+ Explain that to the user. */
+ static int explained;
+
+ error ("invalid data member initialization");
+ if (!explained)
+ {
+ error ("(use `=' to initialize static data members)");
+ explained = 1;
+ }
+
declarator = TREE_OPERAND (declarator, 0);
flags = 0;
}
@@ -1691,10 +1520,12 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
&& TREE_CHAIN (init) == NULL_TREE)
init = NULL_TREE;
- value = grokdeclarator (declarator, declspecs, FIELD, init != 0, attrlist);
+ value = grokdeclarator (declarator, declspecs, FIELD, init != 0, &attrlist);
if (! value || value == error_mark_node)
/* friend or constructor went bad. */
return value;
+ if (TREE_TYPE (value) == error_mark_node)
+ return error_mark_node;
/* Pass friendly classes back. */
if (TREE_CODE (value) == VOID_TYPE)
@@ -1703,7 +1534,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
if (DECL_NAME (value) != NULL_TREE
&& IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_'
&& ! strcmp (IDENTIFIER_POINTER (DECL_NAME (value)), "_vptr"))
- cp_error ("member `%D' conflicts with virtual function table field name",
+ error ("member `%D' conflicts with virtual function table field name",
value);
/* Stash away type declarations. */
@@ -1711,28 +1542,19 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
{
DECL_NONLOCAL (value) = 1;
DECL_CONTEXT (value) = current_class_type;
- DECL_CLASS_CONTEXT (value) = current_class_type;
- /* Now that we've updated the context, we need to remangle the
- name for this TYPE_DECL. */
- DECL_ASSEMBLER_NAME (value) = DECL_NAME (value);
- if (!uses_template_parms (value))
- DECL_ASSEMBLER_NAME (value) =
- get_identifier (build_overload_name (TREE_TYPE (value), 1, 1));
+ if (CLASS_TYPE_P (TREE_TYPE (value)))
+ CLASSTYPE_GOT_SEMICOLON (TREE_TYPE (value)) = 1;
+
+ if (processing_template_decl)
+ value = push_template_decl (value);
return value;
}
- if (IS_SIGNATURE (current_class_type)
- && TREE_CODE (value) != FUNCTION_DECL)
- {
- error ("field declaration not allowed in signature");
- return void_type_node;
- }
-
if (DECL_IN_AGGR_P (value))
{
- cp_error ("`%D' is already defined in `%T'", value,
+ error ("`%D' is already defined in `%T'", value,
DECL_CONTEXT (value));
return void_type_node;
}
@@ -1742,13 +1564,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
if (init)
{
- if (IS_SIGNATURE (current_class_type)
- && TREE_CODE (value) == FUNCTION_DECL)
- {
- error ("function declarations cannot have initializers in signature");
- init = NULL_TREE;
- }
- else if (TREE_CODE (value) == FUNCTION_DECL)
+ if (TREE_CODE (value) == FUNCTION_DECL)
{
grok_function_init (value, init);
init = NULL_TREE;
@@ -1774,7 +1590,6 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
init = decl_constant_value (init);
else if (TREE_CODE (init) == CONSTRUCTOR)
init = digest_init (TREE_TYPE (value), init, (tree *)0);
- my_friendly_assert (TREE_PERMANENT (init), 192);
if (init == error_mark_node)
/* We must make this look different than `error_mark_node'
because `decl_const_value' would mis-interpret it
@@ -1788,8 +1603,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
static, since references are initialized with the address. */
if (TREE_CODE (TREE_TYPE (value)) != REFERENCE_TYPE
|| (TREE_STATIC (init) == 0
- && (TREE_CODE_CLASS (TREE_CODE (init)) != 'd'
- || DECL_EXTERNAL (init) == 0)))
+ && (!DECL_P (init) || DECL_EXTERNAL (init) == 0)))
{
error ("field initializer is not constant");
init = error_mark_node;
@@ -1798,35 +1612,26 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
}
}
- /* The corresponding pop_obstacks is in cp_finish_decl. */
- push_obstacks_nochange ();
-
if (processing_template_decl && ! current_function_decl
&& (TREE_CODE (value) == VAR_DECL || TREE_CODE (value) == FUNCTION_DECL))
value = push_template_decl (value);
if (attrlist)
- cplus_decl_attributes (value, TREE_PURPOSE (attrlist),
- TREE_VALUE (attrlist));
+ cplus_decl_attributes (&value, attrlist, 0);
if (TREE_CODE (value) == VAR_DECL)
{
finish_static_data_member_decl (value, init, asmspec_tree,
- /*need_pop=*/1, flags);
+ flags);
return value;
}
if (TREE_CODE (value) == FIELD_DECL)
{
if (asmspec)
- {
- /* This must override the asm specifier which was placed
- by grokclassfn. Lay this out fresh. */
- DECL_RTL (value) = NULL_RTX;
- DECL_ASSEMBLER_NAME (value) = get_identifier (asmspec);
- }
+ error ("`asm' specifiers are not permitted on non-static data members");
if (DECL_INITIAL (value) == error_mark_node)
init = error_mark_node;
- cp_finish_decl (value, init, asmspec_tree, 1, flags);
+ cp_finish_decl (value, init, NULL_TREE, flags);
DECL_INITIAL (value) = init;
DECL_IN_AGGR_P (value) = 1;
return value;
@@ -1837,25 +1642,22 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
{
/* This must override the asm specifier which was placed
by grokclassfn. Lay this out fresh. */
- DECL_RTL (value) = NULL_RTX;
- DECL_ASSEMBLER_NAME (value) = get_identifier (asmspec);
+ SET_DECL_RTL (value, NULL_RTX);
+ SET_DECL_ASSEMBLER_NAME (value, get_identifier (asmspec));
}
- cp_finish_decl (value, init, asmspec_tree, 1, flags);
+ if (!DECL_FRIEND_P (value))
+ grok_special_member_properties (value);
+
+ cp_finish_decl (value, init, asmspec_tree, flags);
/* Pass friends back this way. */
if (DECL_FRIEND_P (value))
return void_type_node;
-#if 0 /* Just because a fn is declared doesn't mean we'll try to define it. */
- if (current_function_decl && ! IS_SIGNATURE (current_class_type))
- cp_error ("method `%#D' of local class must be defined in class body",
- value);
-#endif
-
DECL_IN_AGGR_P (value) = 1;
return value;
}
- my_friendly_abort (21);
+ abort ();
/* NOTREACHED */
return NULL_TREE;
}
@@ -1868,7 +1670,7 @@ grokbitfield (declarator, declspecs, width)
tree declarator, declspecs, width;
{
register tree value = grokdeclarator (declarator, declspecs, BITFIELD,
- 0, NULL_TREE);
+ 0, NULL);
if (! value) return NULL_TREE; /* friends went bad. */
@@ -1878,30 +1680,24 @@ grokbitfield (declarator, declspecs, width)
if (TREE_CODE (value) == TYPE_DECL)
{
- cp_error ("cannot declare `%D' to be a bitfield type", value);
+ error ("cannot declare `%D' to be a bit-field type", value);
return NULL_TREE;
}
- /* Usually, finish_struct_1 catches bitifields with invalid types.
+ /* Usually, finish_struct_1 catches bitfields with invalid types.
But, in the case of bitfields with function type, we confuse
ourselves into thinking they are member functions, so we must
check here. */
if (TREE_CODE (value) == FUNCTION_DECL)
{
- cp_error ("cannot declare bitfield `%D' with funcion type",
- DECL_NAME (value));
+ error ("cannot declare bit-field `%D' with function type",
+ DECL_NAME (value));
return NULL_TREE;
}
- if (IS_SIGNATURE (current_class_type))
- {
- error ("field declaration not allowed in signature");
- return void_type_node;
- }
-
if (DECL_IN_AGGR_P (value))
{
- cp_error ("`%D' is already defined in the class %T", value,
+ error ("`%D' is already defined in the class %T", value,
DECL_CONTEXT (value));
return void_type_node;
}
@@ -1910,10 +1706,10 @@ grokbitfield (declarator, declspecs, width)
if (TREE_STATIC (value))
{
- cp_error ("static member `%D' cannot be a bitfield", value);
+ error ("static member `%D' cannot be a bit-field", value);
return NULL_TREE;
}
- cp_finish_decl (value, NULL_TREE, NULL_TREE, 0, 0);
+ cp_finish_decl (value, NULL_TREE, NULL_TREE, 0);
if (width != error_mark_node)
{
@@ -1930,8 +1726,8 @@ tree
grokoptypename (declspecs, declarator)
tree declspecs, declarator;
{
- tree t = grokdeclarator (declarator, declspecs, TYPENAME, 0, NULL_TREE);
- return build_typename_overload (t);
+ tree t = grokdeclarator (declarator, declspecs, TYPENAME, 0, NULL);
+ return mangle_conv_op_name_for_type (t);
}
/* When a function is declared with an initializer,
@@ -1969,28 +1765,6 @@ grokoptypename (declspecs, declarator)
*/
-int
-copy_assignment_arg_p (parmtype, virtualp)
- tree parmtype;
- int virtualp ATTRIBUTE_UNUSED;
-{
- if (current_class_type == NULL_TREE)
- return 0;
-
- if (TREE_CODE (parmtype) == REFERENCE_TYPE)
- parmtype = TREE_TYPE (parmtype);
-
- if ((TYPE_MAIN_VARIANT (parmtype) == current_class_type)
-#if 0
- /* Non-standard hack to support old Booch components. */
- || (! virtualp && DERIVED_FROM_P (parmtype, current_class_type))
-#endif
- )
- return 1;
-
- return 0;
-}
-
static void
grok_function_init (decl, init)
tree decl;
@@ -2001,55 +1775,28 @@ grok_function_init (decl, init)
tree type = TREE_TYPE (decl);
if (TREE_CODE (type) == FUNCTION_TYPE)
- cp_error ("initializer specified for non-member function `%D'", decl);
-#if 0
- /* We'll check for this in finish_struct_1. */
- else if (DECL_VINDEX (decl) == NULL_TREE)
- cp_error ("initializer specified for non-virtual method `%D'", decl);
-#endif
+ error ("initializer specified for non-member function `%D'", decl);
else if (integer_zerop (init))
- {
-#if 0
- /* Mark this function as being "defined". */
- DECL_INITIAL (decl) = error_mark_node;
- /* pure virtual destructors must be defined. */
- /* pure virtual needs to be defined (as abort) only when put in
- vtbl. For wellformed call, it should be itself. pr4737 */
- if (!DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl)))
- {
- extern tree abort_fndecl;
- /* Give this node rtl from `abort'. */
- DECL_RTL (decl) = DECL_RTL (abort_fndecl);
- }
-#endif
- DECL_ABSTRACT_VIRTUAL_P (decl) = 1;
- if (DECL_NAME (decl) == ansi_opname [(int) MODIFY_EXPR])
- {
- tree parmtype
- = TREE_VALUE (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (decl))));
-
- if (copy_assignment_arg_p (parmtype, 1))
- TYPE_HAS_ABSTRACT_ASSIGN_REF (current_class_type) = 1;
- }
- }
+ DECL_PURE_VIRTUAL_P (decl) = 1;
else
- cp_error ("invalid initializer for virtual method `%D'", decl);
+ error ("invalid initializer for virtual method `%D'", decl);
}
void
-cplus_decl_attributes (decl, attributes, prefix_attributes)
- tree decl, attributes, prefix_attributes;
+cplus_decl_attributes (decl, attributes, flags)
+ tree *decl, attributes;
+ int flags;
{
- if (decl == NULL_TREE || decl == void_type_node)
+ if (*decl == NULL_TREE || *decl == void_type_node)
return;
- if (TREE_CODE (decl) == TEMPLATE_DECL)
- decl = DECL_TEMPLATE_RESULT (decl);
+ if (TREE_CODE (*decl) == TEMPLATE_DECL)
+ decl = &DECL_TEMPLATE_RESULT (*decl);
- decl_attributes (decl, attributes, prefix_attributes);
+ decl_attributes (decl, attributes, flags);
- if (TREE_CODE (decl) == TYPE_DECL)
- SET_IDENTIFIER_TYPE_VALUE (DECL_NAME (decl), TREE_TYPE (decl));
+ if (TREE_CODE (*decl) == TYPE_DECL)
+ SET_IDENTIFIER_TYPE_VALUE (DECL_NAME (*decl), TREE_TYPE (*decl));
}
/* CONSTRUCTOR_NAME:
@@ -2063,7 +1810,7 @@ constructor_name_full (thing)
tree thing;
{
if (TREE_CODE (thing) == TEMPLATE_TYPE_PARM
- || TREE_CODE (thing) == TEMPLATE_TEMPLATE_PARM
+ || TREE_CODE (thing) == BOUND_TEMPLATE_TEMPLATE_PARM
|| TREE_CODE (thing) == TYPENAME_TYPE)
thing = TYPE_NAME (thing);
else if (IS_AGGR_TYPE_CODE (TREE_CODE (thing)))
@@ -2099,128 +1846,28 @@ constructor_name (thing)
return t;
}
-/* Cache the value of this class's main virtual function table pointer
- in a register variable. This will save one indirection if a
- more than one virtual function call is made this function. */
+/* Defer the compilation of the FN until the end of compilation. */
void
-setup_vtbl_ptr ()
-{
- extern tree base_init_expr;
-
- if (base_init_expr == 0
- && DECL_CONSTRUCTOR_P (current_function_decl))
- {
- if (processing_template_decl)
- add_tree (build_min_nt
- (CTOR_INITIALIZER,
- current_member_init_list, current_base_init_list));
- else
- emit_base_init (current_class_type, 0);
- }
-}
-
-/* Record the existence of an addressable inline function. */
-
-void
-mark_inline_for_output (decl)
- tree decl;
+defer_fn (fn)
+ tree fn;
{
- decl = DECL_MAIN_VARIANT (decl);
- if (DECL_SAVED_INLINE (decl))
+ if (DECL_DEFERRED_FN (fn))
return;
- my_friendly_assert (TREE_PERMANENT (decl), 363);
- DECL_SAVED_INLINE (decl) = 1;
- if (!saved_inlines)
- VARRAY_TREE_INIT (saved_inlines, 32, "saved_inlines");
-
- if (saved_inlines_used == saved_inlines->num_elements)
- VARRAY_GROW (saved_inlines,
- 2 * saved_inlines->num_elements);
- VARRAY_TREE (saved_inlines, saved_inlines_used) = decl;
- ++saved_inlines_used;
-}
+ DECL_DEFERRED_FN (fn) = 1;
+ if (!deferred_fns)
+ VARRAY_TREE_INIT (deferred_fns, 32, "deferred_fns");
-void
-clear_temp_name ()
-{
- temp_name_counter = 0;
-}
-
-/* Hand off a unique name which can be used for variable we don't really
- want to know about anyway, for example, the anonymous variables which
- are needed to make references work. Declare this thing so we can use it.
- The variable created will be of type TYPE.
-
- STATICP is nonzero if this variable should be static. */
-
-tree
-get_temp_name (type, staticp)
- tree type;
- int staticp;
-{
- char buf[sizeof (AUTO_TEMP_FORMAT) + 20];
- tree decl;
- int toplev = toplevel_bindings_p ();
-
- push_obstacks_nochange ();
- if (toplev || staticp)
- {
- end_temporary_allocation ();
- sprintf (buf, AUTO_TEMP_FORMAT, global_temp_name_counter++);
- decl = pushdecl_top_level (build_decl (VAR_DECL, get_identifier (buf), type));
- }
- else
- {
- sprintf (buf, AUTO_TEMP_FORMAT, temp_name_counter++);
- decl = pushdecl (build_decl (VAR_DECL, get_identifier (buf), type));
- }
- TREE_USED (decl) = 1;
- TREE_STATIC (decl) = staticp;
- DECL_ARTIFICIAL (decl) = 1;
-
- /* If this is a local variable, then lay out its rtl now.
- Otherwise, callers of this function are responsible for dealing
- with this variable's rtl. */
- if (! toplev)
- {
- expand_decl (decl);
- expand_decl_init (decl);
- }
- pop_obstacks ();
-
- return decl;
-}
-
-/* Get a variable which we can use for multiple assignments.
- It is not entered into current_binding_level, because
- that breaks things when it comes time to do final cleanups
- (which take place "outside" the binding contour of the function). */
-
-tree
-get_temp_regvar (type, init)
- tree type, init;
-{
- tree decl;
-
- decl = build_decl (VAR_DECL, NULL_TREE, type);
- TREE_USED (decl) = 1;
- DECL_REGISTER (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
-
- DECL_RTL (decl) = assign_temp (type, 2, 0, 1);
- /* We can expand these without fear, since they cannot need
- constructors or destructors. */
- expand_expr (build_modify_expr (decl, INIT_EXPR, init),
- NULL_RTX, VOIDmode, 0);
-
- return decl;
+ VARRAY_PUSH_TREE (deferred_fns, fn);
}
/* Hunts through the global anonymous union ANON_DECL, building
appropriate VAR_DECLs. Stores cleanups on the list of ELEMS, and
returns a VAR_DECL whose size is the same as the size of the
- ANON_DECL, if one is available. */
+ ANON_DECL, if one is available.
+
+ FIXME: we should really handle anonymous unions by binding the names
+ of the members to COMPONENT_REFs rather than this kludge. */
static tree
build_anon_union_vars (anon_decl, elems, static_p, external_p)
@@ -2233,6 +1880,11 @@ build_anon_union_vars (anon_decl, elems, static_p, external_p)
tree main_decl = NULL_TREE;
tree field;
+ /* Rather than write the code to handle the non-union case,
+ just give an error. */
+ if (TREE_CODE (type) != UNION_TYPE)
+ error ("anonymous struct not inside named type");
+
for (field = TYPE_FIELDS (type);
field != NULL_TREE;
field = TREE_CHAIN (field))
@@ -2254,7 +1906,7 @@ build_anon_union_vars (anon_decl, elems, static_p, external_p)
cp_pedwarn_at ("protected member `%#D' in anonymous union", field);
if (DECL_NAME (field) == NULL_TREE
- && TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
+ && ANON_AGGR_TYPE_P (TREE_TYPE (field)))
{
decl = build_anon_union_vars (field, elems, static_p, external_p);
if (!decl)
@@ -2274,77 +1926,83 @@ build_anon_union_vars (anon_decl, elems, static_p, external_p)
DECL_INITIAL (decl) = NULL_TREE;
}
- /* Only write out one anon union element--choose the one that
- can hold them all. */
+ /* Only write out one anon union element--choose the largest
+ one. We used to try to find one the same size as the union,
+ but that fails if the ABI forces us to align the union more
+ strictly. */
if (main_decl == NULL_TREE
- && simple_cst_equal (DECL_SIZE (decl),
- DECL_SIZE (anon_decl)) == 1)
- main_decl = decl;
+ || tree_int_cst_lt (DECL_SIZE (main_decl), DECL_SIZE (decl)))
+ {
+ if (main_decl)
+ TREE_ASM_WRITTEN (main_decl) = 1;
+ main_decl = decl;
+ }
else
/* ??? This causes there to be no debug info written out
about this decl. */
TREE_ASM_WRITTEN (decl) = 1;
if (DECL_NAME (field) == NULL_TREE
- && TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
+ && ANON_AGGR_TYPE_P (TREE_TYPE (field)))
/* The remainder of the processing was already done in the
recursive call. */
continue;
/* If there's a cleanup to do, it belongs in the
TREE_PURPOSE of the following TREE_LIST. */
- *elems = scratch_tree_cons (NULL_TREE, decl, *elems);
+ *elems = tree_cons (NULL_TREE, decl, *elems);
TREE_TYPE (*elems) = type;
}
return main_decl;
}
-/* Finish off the processing of a UNION_TYPE structure.
- If there are static members, then all members are
- static, and must be laid out together. If the
- union is an anonymous union, we arrange for that
- as well. PUBLIC_P is nonzero if this union is
- not declared static. */
+/* Finish off the processing of a UNION_TYPE structure. If the union is an
+ anonymous union, then all members must be laid out together. PUBLIC_P
+ is nonzero if this union is not declared static. */
void
finish_anon_union (anon_union_decl)
tree anon_union_decl;
{
tree type = TREE_TYPE (anon_union_decl);
- tree elems = NULL_TREE;
tree main_decl;
int public_p = TREE_PUBLIC (anon_union_decl);
int static_p = TREE_STATIC (anon_union_decl);
int external_p = DECL_EXTERNAL (anon_union_decl);
+ /* The VAR_DECL's context is the same as the TYPE's context. */
+ DECL_CONTEXT (anon_union_decl) = DECL_CONTEXT (TYPE_NAME (type));
+
if (TYPE_FIELDS (type) == NULL_TREE)
return;
if (public_p)
{
- error ("global anonymous unions must be declared static");
+ error ("namespace-scope anonymous aggregates must be static");
return;
}
- main_decl = build_anon_union_vars (anon_union_decl, &elems,
+ main_decl = build_anon_union_vars (anon_union_decl,
+ &DECL_ANON_UNION_ELEMS (anon_union_decl),
static_p, external_p);
if (main_decl == NULL_TREE)
{
- warning ("anonymous union with no members");
+ warning ("anonymous aggregate with no members");
return;
}
if (static_p)
{
- make_decl_rtl (main_decl, 0, toplevel_bindings_p ());
- DECL_RTL (anon_union_decl) = DECL_RTL (main_decl);
+ make_decl_rtl (main_decl, 0);
+ COPY_DECL_RTL (main_decl, anon_union_decl);
+ expand_anon_union_decl (anon_union_decl,
+ NULL_TREE,
+ DECL_ANON_UNION_ELEMS (anon_union_decl));
}
-
- /* The following call assumes that there are never any cleanups
- for anonymous unions--a reasonable assumption. */
- expand_anon_union_decl (anon_union_decl, NULL_TREE, elems);
+ else
+ add_decl_stmt (anon_union_decl);
}
/* Finish processing a builtin type TYPE. It's name is NAME,
@@ -2372,8 +2030,8 @@ finish_builtin_type (type, name, fields, len, align_type)
TREE_CHAIN (fields[i]) = fields[i+1];
}
DECL_FIELD_CONTEXT (fields[i]) = type;
- DECL_CLASS_CONTEXT (fields[i]) = type;
TYPE_ALIGN (type) = TYPE_ALIGN (align_type);
+ TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (align_type);
layout_type (type);
#if 0 /* not yet, should get fixed properly later */
TYPE_NAME (type) = make_type_decl (get_identifier (name), type);
@@ -2392,23 +2050,34 @@ tree
coerce_new_type (type)
tree type;
{
- int e1 = 0, e2 = 0;
-
- if (TREE_CODE (type) == METHOD_TYPE)
- type = build_function_type (TREE_TYPE (type), TREE_CHAIN (TYPE_ARG_TYPES (type)));
- if (! same_type_p (TREE_TYPE (type), ptr_type_node))
- e1 = 1, error ("`operator new' must return type `void *'");
-
- /* Technically the type must be `size_t', but we may not know
- what that is. */
- if (TYPE_ARG_TYPES (type) == NULL_TREE)
- e1 = 1, error ("`operator new' takes type `size_t' parameter");
- else if (! same_type_p (TREE_VALUE (TYPE_ARG_TYPES (type)), sizetype))
- e2 = 1, error ("`operator new' takes type `size_t' as first parameter");
- if (e2)
- type = build_function_type (ptr_type_node, tree_cons (NULL_TREE, sizetype, TREE_CHAIN (TYPE_ARG_TYPES (type))));
- else if (e1)
- type = build_function_type (ptr_type_node, TYPE_ARG_TYPES (type));
+ int e = 0;
+ tree args = TYPE_ARG_TYPES (type);
+
+ my_friendly_assert (TREE_CODE (type) == FUNCTION_TYPE, 20001107);
+
+ if (!same_type_p (TREE_TYPE (type), ptr_type_node))
+ e = 1, error ("`operator new' must return type `%T'", ptr_type_node);
+
+ if (!args || args == void_list_node
+ || !same_type_p (TREE_VALUE (args), c_size_type_node))
+ {
+ e = 2;
+ if (args && args != void_list_node)
+ args = TREE_CHAIN (args);
+ pedwarn ("`operator new' takes type `size_t' (`%T') as first parameter", c_size_type_node);
+ }
+ switch (e)
+ {
+ case 2:
+ args = tree_cons (NULL_TREE, c_size_type_node, args);
+ /* FALLTHROUGH */
+ case 1:
+ type = build_exception_variant
+ (build_function_type (ptr_type_node, args),
+ TYPE_RAISES_EXCEPTIONS (type));
+ /* FALLTHROUGH */
+ default:;
+ }
return type;
}
@@ -2416,69 +2085,38 @@ tree
coerce_delete_type (type)
tree type;
{
- int e1 = 0, e2 = 0;
-#if 0
- e3 = 0;
-#endif
- tree arg_types = TYPE_ARG_TYPES (type);
-
- if (TREE_CODE (type) == METHOD_TYPE)
- {
- type = build_function_type (TREE_TYPE (type), TREE_CHAIN (arg_types));
- arg_types = TREE_CHAIN (arg_types);
- }
-
- if (TREE_TYPE (type) != void_type_node)
- e1 = 1, error ("`operator delete' must return type `void'");
+ int e = 0;
+ tree args = TYPE_ARG_TYPES (type);
+
+ my_friendly_assert (TREE_CODE (type) == FUNCTION_TYPE, 20001107);
- if (arg_types == NULL_TREE
- || ! same_type_p (TREE_VALUE (arg_types), ptr_type_node))
- e2 = 1, error ("`operator delete' takes type `void *' as first parameter");
+ if (!same_type_p (TREE_TYPE (type), void_type_node))
+ e = 1, error ("`operator delete' must return type `%T'", void_type_node);
-#if 0
- if (arg_types
- && TREE_CHAIN (arg_types)
- && TREE_CHAIN (arg_types) != void_list_node)
+ if (!args || args == void_list_node
+ || !same_type_p (TREE_VALUE (args), ptr_type_node))
{
- /* Again, technically this argument must be `size_t', but again
- we may not know what that is. */
- tree t2 = TREE_VALUE (TREE_CHAIN (arg_types));
- if (! same_type_p (t2, sizetype))
- e3 = 1, error ("second argument to `operator delete' must be of type `size_t'");
- else if (TREE_CHAIN (TREE_CHAIN (arg_types)) != void_list_node)
- {
- e3 = 1;
- if (TREE_CHAIN (TREE_CHAIN (arg_types)))
- error ("too many arguments in declaration of `operator delete'");
- else
- error ("`...' invalid in specification of `operator delete'");
- }
+ e = 2;
+ if (args && args != void_list_node)
+ args = TREE_CHAIN (args);
+ error ("`operator delete' takes type `%T' as first parameter", ptr_type_node);
}
-
- if (e3)
- arg_types = tree_cons (NULL_TREE, ptr_type_node,
- build_tree_list (NULL_TREE, sizetype));
- else if (e3 |= e2)
- {
- if (arg_types == NULL_TREE)
- arg_types = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
- else
- arg_types = tree_cons (NULL_TREE, ptr_type_node, TREE_CHAIN (arg_types));
- }
- else e3 |= e1;
-#endif
-
- if (e2)
- arg_types = tree_cons (NULL_TREE, ptr_type_node,
- arg_types ? TREE_CHAIN (arg_types): NULL_TREE);
- if (e2 || e1)
- type = build_function_type (void_type_node, arg_types);
+ switch (e)
+ {
+ case 2:
+ args = tree_cons (NULL_TREE, ptr_type_node, args);
+ /* FALLTHROUGH */
+ case 1:
+ type = build_exception_variant
+ (build_function_type (void_type_node, args),
+ TYPE_RAISES_EXCEPTIONS (type));
+ /* FALLTHROUGH */
+ default:;
+ }
return type;
}
-extern tree abort_fndecl;
-
static void
mark_vtable_entries (decl)
tree decl;
@@ -2487,29 +2125,23 @@ mark_vtable_entries (decl)
for (; entries; entries = TREE_CHAIN (entries))
{
- tree fnaddr;
+ tree fnaddr = TREE_VALUE (entries);
tree fn;
-
- fnaddr = (flag_vtable_thunks ? TREE_VALUE (entries)
- : FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (entries)));
-
- if (TREE_CODE (fnaddr) == NOP_EXPR)
- /* RTTI offset. */
+
+ if (TREE_CODE (fnaddr) != ADDR_EXPR
+ && TREE_CODE (fnaddr) != FDESC_EXPR)
+ /* This entry is an offset: a virtual base class offset, a
+ virtual call offset, an RTTI offset, etc. */
continue;
fn = TREE_OPERAND (fnaddr, 0);
TREE_ADDRESSABLE (fn) = 1;
- if (DECL_LANG_SPECIFIC (fn) && DECL_ABSTRACT_VIRTUAL_P (fn))
- {
- TREE_OPERAND (fnaddr, 0) = fn = copy_node (fn);
- DECL_RTL (fn) = DECL_RTL (abort_fndecl);
- mark_used (abort_fndecl);
- }
- if (TREE_CODE (fn) == THUNK_DECL && DECL_EXTERNAL (fn))
- {
- DECL_EXTERNAL (fn) = 0;
- emit_thunk (fn);
- }
+ /* When we don't have vcall offsets, we output thunks whenever
+ we output the vtables that contain them. With vcall offsets,
+ we know all the thunks we'll need when we emit a virtual
+ function, so we emit the thunks there instead. */
+ if (DECL_THUNK_P (fn))
+ use_thunk (fn, /*emit_p=*/0);
mark_used (fn);
}
}
@@ -2523,9 +2155,24 @@ comdat_linkage (decl)
{
if (flag_weak)
make_decl_one_only (decl);
- else if (TREE_CODE (decl) == FUNCTION_DECL || DECL_VIRTUAL_P (decl))
- /* We can just emit functions and vtables statically; it doesn't really
- matter if we have multiple copies. */
+ else if (TREE_CODE (decl) == FUNCTION_DECL
+ || (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl)))
+ /* We can just emit function and compiler-generated variables
+ statically; having multiple copies is (for the most part) only
+ a waste of space.
+
+ There are two correctness issues, however: the address of a
+ template instantiation with external linkage should be the
+ same, independent of what translation unit asks for the
+ address, and this will not hold when we emit multiple copies of
+ the function. However, there's little else we can do.
+
+ Also, by default, the typeinfo implementation assumes that
+ there will be only one copy of the string used as the name for
+ each type. Therefore, if weak symbols are unavailable, the
+ run-time library should perform a more conservative check; it
+ should perform a string comparison, rather than an address
+ comparison. */
TREE_PUBLIC (decl) = 0;
else
{
@@ -2566,7 +2213,7 @@ maybe_make_one_only (decl)
after a weak one is an error. Also, not making explicit
instantiations one_only means that we can end up with two copies of
some template instantiations. */
- if (! supports_one_only ())
+ if (! flag_weak)
return;
/* We can't set DECL_COMDAT on functions, or finish_file will think
@@ -2580,6 +2227,35 @@ maybe_make_one_only (decl)
DECL_COMDAT (decl) = 1;
}
+/* Returns the virtual function with which the vtable for TYPE is
+ emitted, or NULL_TREE if that heuristic is not applicable to TYPE. */
+
+static tree
+key_method (type)
+ tree type;
+{
+ tree method;
+
+ if (TYPE_FOR_JAVA (type)
+ || CLASSTYPE_TEMPLATE_INSTANTIATION (type)
+ || CLASSTYPE_INTERFACE_KNOWN (type))
+ return NULL_TREE;
+
+ for (method = TYPE_METHODS (type); method != NULL_TREE;
+ method = TREE_CHAIN (method))
+ if (DECL_VINDEX (method) != NULL_TREE
+ && ! DECL_DECLARED_INLINE_P (method)
+ && (! DECL_PURE_VIRTUAL_P (method)
+#if 0
+ /* This would be nice, but we didn't think of it in time. */
+ || DECL_DESTRUCTOR_P (method)
+#endif
+ ))
+ return method;
+
+ return NULL_TREE;
+}
+
/* Set TREE_PUBLIC and/or DECL_EXTERN on the vtable DECL,
based on TYPE and other static flags.
@@ -2603,7 +2279,7 @@ import_export_vtable (decl, type, final)
else if (CLASSTYPE_INTERFACE_KNOWN (type))
{
TREE_PUBLIC (decl) = 1;
- DECL_EXTERNAL (decl) = ! CLASSTYPE_VTABLE_NEEDS_WRITING (type);
+ DECL_EXTERNAL (decl) = CLASSTYPE_INTERFACE_ONLY (type);
DECL_INTERFACE_KNOWN (decl) = 1;
}
else
@@ -2611,21 +2287,8 @@ import_export_vtable (decl, type, final)
/* We can only wait to decide if we have real non-inline virtual
functions in our class, or if we come from a template. */
- int found = CLASSTYPE_TEMPLATE_INSTANTIATION (type);
-
- if (! found && ! final)
- {
- tree method;
- for (method = TYPE_METHODS (type); method != NULL_TREE;
- method = TREE_CHAIN (method))
- if (DECL_VINDEX (method) != NULL_TREE
- && ! DECL_THIS_INLINE (method)
- && ! DECL_ABSTRACT_VIRTUAL_P (method))
- {
- found = 1;
- break;
- }
- }
+ int found = (CLASSTYPE_TEMPLATE_INSTANTIATION (type)
+ || key_method (type));
if (final || ! found)
{
@@ -2643,13 +2306,20 @@ import_export_vtable (decl, type, final)
/* Determine whether or not we want to specifically import or export CTYPE,
using various heuristics. */
-void
+static void
import_export_class (ctype)
tree ctype;
{
/* -1 for imported, 1 for exported. */
int import_export = 0;
+ /* It only makes sense to call this function at EOF. The reason is
+ that this function looks at whether or not the first non-inline
+ non-abstract virtual member function has been defined in this
+ translation unit. But, we can't possibly know that until we've
+ seen the entire translation unit. */
+ my_friendly_assert (at_eof, 20000226);
+
if (CLASSTYPE_INTERFACE_KNOWN (ctype))
return;
@@ -2661,13 +2331,10 @@ import_export_class (ctype)
if (CLASSTYPE_INTERFACE_ONLY (ctype))
return;
-#ifdef VALID_MACHINE_TYPE_ATTRIBUTE
- /* FIXME this should really use some sort of target-independent macro. */
if (lookup_attribute ("dllimport", TYPE_ATTRIBUTES (ctype)))
import_export = -1;
else if (lookup_attribute ("dllexport", TYPE_ATTRIBUTES (ctype)))
import_export = 1;
-#endif
/* If we got -fno-implicit-templates, we import template classes that
weren't explicitly instantiated. */
@@ -2677,23 +2344,13 @@ import_export_class (ctype)
import_export = -1;
/* Base our import/export status on that of the first non-inline,
- non-abstract virtual function, if any. */
+ non-pure virtual function, if any. */
if (import_export == 0
- && TYPE_VIRTUAL_P (ctype)
- && ! CLASSTYPE_TEMPLATE_INSTANTIATION (ctype))
+ && TYPE_POLYMORPHIC_P (ctype))
{
- tree method;
- for (method = TYPE_METHODS (ctype); method != NULL_TREE;
- method = TREE_CHAIN (method))
- {
- if (DECL_VINDEX (method) != NULL_TREE
- && !DECL_THIS_INLINE (method)
- && !DECL_ABSTRACT_VIRTUAL_P (method))
- {
- import_export = (DECL_REALLY_EXTERN (method) ? -1 : 1);
- break;
- }
- }
+ tree method = key_method (ctype);
+ if (method)
+ import_export = (DECL_REALLY_EXTERN (method) ? -1 : 1);
}
#ifdef MULTIPLE_SYMBOL_SPACES
@@ -2704,7 +2361,6 @@ import_export_class (ctype)
if (import_export)
{
SET_CLASSTYPE_INTERFACE_KNOWN (ctype);
- CLASSTYPE_VTABLE_NEEDS_WRITING (ctype) = (import_export > 0);
CLASSTYPE_INTERFACE_ONLY (ctype) = (import_export < 0);
}
}
@@ -2717,23 +2373,23 @@ output_vtable_inherit (vars)
tree vars;
{
tree parent;
- rtx op[2];
+ rtx child_rtx, parent_rtx;
- op[0] = XEXP (DECL_RTL (vars), 0); /* strip the mem ref */
+ child_rtx = XEXP (DECL_RTL (vars), 0); /* strip the mem ref */
parent = binfo_for_vtable (vars);
if (parent == TYPE_BINFO (DECL_CONTEXT (vars)))
- op[1] = const0_rtx;
+ parent_rtx = const0_rtx;
else if (parent)
{
- parent = TYPE_BINFO_VTABLE (BINFO_TYPE (parent));
- op[1] = XEXP (DECL_RTL (parent), 0); /* strip the mem ref */
+ parent = get_vtbl_decl_for_binfo (TYPE_BINFO (BINFO_TYPE (parent)));
+ parent_rtx = XEXP (DECL_RTL (parent), 0); /* strip the mem ref */
}
else
- my_friendly_abort (980826);
+ abort ();
- output_asm_insn (".vtable_inherit %c0, %c1", op);
+ assemble_vtable_inherit (child_rtx, parent_rtx);
}
static int
@@ -2747,11 +2403,13 @@ finish_vtable_vardecl (t, data)
import_export_vtable (vars, ctype, 1);
if (! DECL_EXTERNAL (vars)
- && (DECL_INTERFACE_KNOWN (vars)
- || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (vars))
- || (hack_decl_function_context (vars) && TREE_USED (vars)))
+ && DECL_NEEDED_P (vars)
&& ! TREE_ASM_WRITTEN (vars))
{
+ if (TREE_TYPE (vars) == void_type_node)
+ /* It is a dummy vtable made by get_vtable_decl. Ignore it. */
+ return 0;
+
/* Write it out. */
mark_vtable_entries (vars);
if (TREE_TYPE (DECL_INITIAL (vars)) == 0)
@@ -2787,18 +2445,29 @@ finish_vtable_vardecl (t, data)
if (flag_weak)
comdat_linkage (vars);
- rest_of_decl_compilation (vars, NULL_PTR, 1, 1);
+ rest_of_decl_compilation (vars, NULL, 1, 1);
if (flag_vtable_gc)
output_vtable_inherit (vars);
+ /* Because we're only doing syntax-checking, we'll never end up
+ actually marking the variable as written. */
+ if (flag_syntax_only)
+ TREE_ASM_WRITTEN (vars) = 1;
+
+ /* Since we're writing out the vtable here, also write the debug
+ info. */
+ note_debug_info_needed (ctype);
+
return 1;
}
- else if (! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (vars)))
- /* We don't know what to do with this one yet. */
- return 0;
- *t = TREE_CHAIN (vars);
+ /* If the references to this class' vtables were optimized away, still
+ emit the appropriate debugging information. See dfs_debug_mark. */
+ if (DECL_COMDAT (vars)
+ && CLASSTYPE_DEBUG_REQUESTED (ctype))
+ note_debug_info_needed (ctype);
+
return 0;
}
@@ -2811,20 +2480,6 @@ prune_vtable_vardecl (t, data)
return 1;
}
-static int
-finish_sigtable_vardecl (t, data)
- tree *t;
- void *data ATTRIBUTE_UNUSED;
-{
- /* We don't need to mark sigtable entries as addressable here as is done
- for vtables. Since sigtables, unlike vtables, are always written out,
- that was already done in build_signature_table_constructor. */
-
- rest_of_decl_compilation (*t, NULL_PTR, 1, 1);
- *t = TREE_CHAIN (*t);
- return 1;
-}
-
/* Determines the proper settings of TREE_PUBLIC and DECL_EXTERNAL for an
inline function or template instantiation at end-of-file. */
@@ -2842,7 +2497,8 @@ import_export_decl (decl)
if ((DECL_IMPLICIT_INSTANTIATION (decl)
|| DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl))
&& (flag_implicit_templates
- || (flag_implicit_inline_templates && DECL_THIS_INLINE (decl))))
+ || (flag_implicit_inline_templates
+ && DECL_DECLARED_INLINE_P (decl))))
{
if (!TREE_PUBLIC (decl))
/* Templates are allowed to have internal linkage. See
@@ -2854,52 +2510,31 @@ import_export_decl (decl)
else
DECL_NOT_REALLY_EXTERN (decl) = 0;
}
- else if (DECL_VLIST_CTOR_WRAPPER_P (decl))
- {
- int implement;
- tree ctype = DECL_CLASS_CONTEXT (decl);
- import_export_class (ctype);
- if (!DECL_THIS_INLINE (DECL_VLIST_CTOR_WRAPPED (decl)))
- {
- /* No change. */
- }
- else if (CLASSTYPE_INTERFACE_KNOWN (ctype))
- {
- implement = !CLASSTYPE_INTERFACE_ONLY (ctype)
- && flag_implement_inlines;
- DECL_NOT_REALLY_EXTERN (decl) = implement;
- DECL_EXTERNAL (decl) = !implement;
- }
- else
- {
- DECL_NOT_REALLY_EXTERN (decl) = 1;
- DECL_EXTERNAL (decl) = 1;
- }
- if (flag_weak)
- comdat_linkage (decl);
- }
else if (DECL_FUNCTION_MEMBER_P (decl))
{
- tree ctype = DECL_CLASS_CONTEXT (decl);
- import_export_class (ctype);
- if (CLASSTYPE_INTERFACE_KNOWN (ctype)
- && (! DECL_ARTIFICIAL (decl) || DECL_VINDEX (decl)))
+ if (!DECL_DECLARED_INLINE_P (decl))
{
- DECL_NOT_REALLY_EXTERN (decl)
- = ! (CLASSTYPE_INTERFACE_ONLY (ctype)
- || (DECL_THIS_INLINE (decl) && ! flag_implement_inlines
- && !DECL_VINDEX (decl)));
-
- /* Always make artificials weak. */
- if (DECL_ARTIFICIAL (decl) && flag_weak)
- comdat_linkage (decl);
- else
- maybe_make_one_only (decl);
+ tree ctype = DECL_CONTEXT (decl);
+ import_export_class (ctype);
+ if (CLASSTYPE_INTERFACE_KNOWN (ctype))
+ {
+ DECL_NOT_REALLY_EXTERN (decl)
+ = ! (CLASSTYPE_INTERFACE_ONLY (ctype)
+ || (DECL_DECLARED_INLINE_P (decl)
+ && ! flag_implement_inlines
+ && !DECL_VINDEX (decl)));
+
+ /* Always make artificials weak. */
+ if (DECL_ARTIFICIAL (decl) && flag_weak)
+ comdat_linkage (decl);
+ else
+ maybe_make_one_only (decl);
+ }
}
else
comdat_linkage (decl);
}
- else if (DECL_TINFO_FN_P (decl))
+ else if (tinfo_decl_p (decl, 0))
{
tree ctype = TREE_TYPE (DECL_NAME (decl));
@@ -2907,7 +2542,11 @@ import_export_decl (decl)
import_export_class (ctype);
if (IS_AGGR_TYPE (ctype) && CLASSTYPE_INTERFACE_KNOWN (ctype)
- && TYPE_VIRTUAL_P (ctype)
+ && TYPE_POLYMORPHIC_P (ctype)
+ /* If -fno-rtti, we're not necessarily emitting this stuff with
+ the class, so go ahead and emit it now. This can happen
+ when a class is used in exception handling. */
+ && flag_rtti
/* If the type is a cv-qualified variant of a type, then we
must emit the tinfo function in this translation unit
since it will not be emitted when the vtable for the type
@@ -2917,7 +2556,8 @@ import_export_decl (decl)
{
DECL_NOT_REALLY_EXTERN (decl)
= ! (CLASSTYPE_INTERFACE_ONLY (ctype)
- || (DECL_THIS_INLINE (decl) && ! flag_implement_inlines
+ || (DECL_DECLARED_INLINE_P (decl)
+ && ! flag_implement_inlines
&& !DECL_VINDEX (decl)));
/* Always make artificials weak. */
@@ -2951,47 +2591,111 @@ build_cleanup (decl)
temp = build1 (ADDR_EXPR, build_pointer_type (type), decl);
}
temp = build_delete (TREE_TYPE (temp), temp,
- integer_two_node,
+ sfk_complete_destructor,
LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR, 0);
return temp;
}
-extern int parse_time, varconst_time;
+/* Returns the initialization guard variable for the variable DECL,
+ which has static storage duration. */
-static tree
-get_sentry (base)
- tree base;
+tree
+get_guard (decl)
+ tree decl;
{
- tree sname = get_id_2 ("__sn", base);
- /* For struct X foo __attribute__((weak)), there is a counter
- __snfoo. Since base is already an assembler name, sname should
- be globally unique */
- tree sentry = IDENTIFIER_GLOBAL_VALUE (sname);
- if (! sentry)
+ tree sname;
+ tree guard;
+
+ sname = mangle_guard_variable (decl);
+ guard = IDENTIFIER_GLOBAL_VALUE (sname);
+ if (! guard)
{
- push_obstacks_nochange ();
- end_temporary_allocation ();
- sentry = build_decl (VAR_DECL, sname, integer_type_node);
- TREE_PUBLIC (sentry) = 1;
- DECL_ARTIFICIAL (sentry) = 1;
- TREE_STATIC (sentry) = 1;
- TREE_USED (sentry) = 1;
- DECL_COMMON (sentry) = 1;
- pushdecl_top_level (sentry);
- cp_finish_decl (sentry, NULL_TREE, NULL_TREE, 0, 0);
- pop_obstacks ();
+ tree guard_type;
+
+ /* We use a type that is big enough to contain a mutex as well
+ as an integer counter. */
+ guard_type = long_long_integer_type_node;
+ guard = build_decl (VAR_DECL, sname, guard_type);
+
+ /* The guard should have the same linkage as what it guards. */
+ TREE_PUBLIC (guard) = TREE_PUBLIC (decl);
+ TREE_STATIC (guard) = TREE_STATIC (decl);
+ DECL_COMMON (guard) = DECL_COMMON (decl);
+ DECL_ONE_ONLY (guard) = DECL_ONE_ONLY (decl);
+ if (TREE_PUBLIC (decl))
+ DECL_WEAK (guard) = DECL_WEAK (decl);
+
+ DECL_ARTIFICIAL (guard) = 1;
+ TREE_USED (guard) = 1;
+ pushdecl_top_level (guard);
+ cp_finish_decl (guard, NULL_TREE, NULL_TREE, 0);
}
- return sentry;
+ return guard;
+}
+
+/* Return those bits of the GUARD variable that should be set when the
+ guarded entity is actually initialized. */
+
+static tree
+get_guard_bits (guard)
+ tree guard;
+{
+ /* We only set the first byte of the guard, in order to leave room
+ for a mutex in the high-order bits. */
+ guard = build1 (ADDR_EXPR,
+ build_pointer_type (TREE_TYPE (guard)),
+ guard);
+ guard = build1 (NOP_EXPR,
+ build_pointer_type (char_type_node),
+ guard);
+ guard = build1 (INDIRECT_REF, char_type_node, guard);
+
+ return guard;
+}
+
+/* Return an expression which determines whether or not the GUARD
+ variable has already been initialized. */
+
+tree
+get_guard_cond (guard)
+ tree guard;
+{
+ tree guard_value;
+
+ /* Check to see if the GUARD is zero. */
+ guard = get_guard_bits (guard);
+ guard_value = integer_zero_node;
+ if (!same_type_p (TREE_TYPE (guard_value), TREE_TYPE (guard)))
+ guard_value = convert (TREE_TYPE (guard), guard_value);
+ return cp_build_binary_op (EQ_EXPR, guard, guard_value);
+}
+
+/* Return an expression which sets the GUARD variable, indicating that
+ the variable being guarded has been initialized. */
+
+tree
+set_guard (guard)
+ tree guard;
+{
+ tree guard_init;
+
+ /* Set the GUARD to one. */
+ guard = get_guard_bits (guard);
+ guard_init = integer_one_node;
+ if (!same_type_p (TREE_TYPE (guard_init), TREE_TYPE (guard)))
+ guard_init = convert (TREE_TYPE (guard), guard_init);
+ return build_modify_expr (guard, NOP_EXPR, guard_init);
}
/* Start the process of running a particular set of global constructors
or destructors. Subroutine of do_[cd]tors. */
-static void
+static tree
start_objects (method_type, initp)
int method_type, initp;
{
tree fnname;
+ tree body;
char type[10];
/* Make ctor or dtor function. METHOD_TYPE may be 'I' or 'D'. */
@@ -3016,19 +2720,23 @@ start_objects (method_type, initp)
start_function (void_list_node,
make_call_declarator (fnname, void_list_node, NULL_TREE,
NULL_TREE),
- NULL_TREE, 0);
+ NULL_TREE, SF_DEFAULT);
-#if defined(ASM_OUTPUT_CONSTRUCTOR) && defined(ASM_OUTPUT_DESTRUCTOR)
/* It can be a static function as long as collect2 does not have
to scan the object file to find its ctor/dtor routine. */
- TREE_PUBLIC (current_function_decl) = 0;
-#endif
+ TREE_PUBLIC (current_function_decl) = ! targetm.have_ctors_dtors;
+
+ /* Mark this declaration as used to avoid spurious warnings. */
+ TREE_USED (current_function_decl) = 1;
- store_parm_decls ();
- pushlevel (0);
- clear_last_expr ();
- push_momentary ();
- expand_start_bindings (0);
+ /* Mark this function as a global constructor or destructor. */
+ if (method_type == 'I')
+ DECL_GLOBAL_CTOR_P (current_function_decl) = 1;
+ else
+ DECL_GLOBAL_DTOR_P (current_function_decl) = 1;
+ GLOBAL_INIT_PRIORITY (current_function_decl) = initp;
+
+ body = begin_compound_stmt (/*has_no_scope=*/0);
/* We cannot allow these functions to be elided, even if they do not
have external linkage. And, there's no point in deferring
@@ -3036,48 +2744,39 @@ start_objects (method_type, initp)
out anyhow. */
current_function_cannot_inline
= "static constructors and destructors cannot be inlined";
+
+ return body;
}
/* Finish the process of running a particular set of global constructors
or destructors. Subroutine of do_[cd]tors. */
static void
-finish_objects (method_type, initp)
+finish_objects (method_type, initp, body)
int method_type, initp;
+ tree body;
{
- char *fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
+ tree fn;
- /* Finish up. */
- expand_end_bindings (getdecls (), 1, 0);
- poplevel (1, 0, 0);
- pop_momentary ();
- finish_function (lineno, 0, 0);
+ /* Finish up. */
+ finish_compound_stmt (/*has_no_scope=*/0, body);
+ fn = finish_function (0);
+ expand_body (fn);
- if (initp == DEFAULT_INIT_PRIORITY)
+ /* When only doing semantic analysis, and no RTL generation, we
+ can't call functions that directly emit assembly code; there is
+ no assembly file in which to put the code. */
+ if (flag_syntax_only)
+ return;
+
+ if (targetm.have_ctors_dtors)
{
+ rtx fnsym = XEXP (DECL_RTL (fn), 0);
if (method_type == 'I')
- assemble_constructor (fnname);
+ (* targetm.asm_out.constructor) (fnsym, initp);
else
- assemble_destructor (fnname);
- }
-
-#if defined (ASM_OUTPUT_SECTION_NAME) && defined (ASM_OUTPUT_CONSTRUCTOR)
- /* If we're using init priority we can't use assemble_*tor, but on ELF
- targets we can stick the references into named sections for GNU ld
- to collect. */
- else
- {
- char buf[15];
- sprintf (buf, ".%ctors.%.5u", method_type == 'I' ? 'c' : 'd',
- /* invert the numbering so the linker puts us in the proper
- order; constructors are run from right to left, and the
- linker sorts in increasing order. */
- MAX_INIT_PRIORITY - initp);
- named_section (NULL_TREE, buf, 0);
- assemble_integer (gen_rtx_SYMBOL_REF (Pmode, fnname),
- POINTER_SIZE / BITS_PER_UNIT, 1);
+ (* targetm.asm_out.destructor) (fnsym, initp);
}
-#endif
}
/* The names of the parameters to the function created to handle
@@ -3102,7 +2801,6 @@ static tree ssdf_decl;
/* All the static storage duration functions created in this
translation unit. */
static varray_type ssdf_decls;
-static size_t ssdf_decls_used;
/* A map from priority levels to information about that priority
level. There may be many such levels, so efficient lookup is
@@ -3121,13 +2819,14 @@ static splay_tree priority_info_map;
It is assumed that this function will only be called once per
translation unit. */
-static void
+static tree
start_static_storage_duration_function ()
{
static unsigned ssdf_number;
tree parm_types;
tree type;
+ tree body;
char id[sizeof (SSDF_IDENTIFIER) + 1 /* '\0' */ + 32];
/* Create the identifier for this function. It will be of the form
@@ -3138,13 +2837,13 @@ start_static_storage_duration_function ()
/* Overflow occurred. That means there are at least 4 billion
initialization functions. */
sorry ("too many initialization functions required");
- my_friendly_abort (19990430);
+ abort ();
}
/* Create the parameters. */
parm_types = void_list_node;
- parm_types = perm_tree_cons (NULL_TREE, integer_type_node, parm_types);
- parm_types = perm_tree_cons (NULL_TREE, integer_type_node, parm_types);
+ parm_types = tree_cons (NULL_TREE, integer_type_node, parm_types);
+ parm_types = tree_cons (NULL_TREE, integer_type_node, parm_types);
type = build_function_type (void_type_node, parm_types);
/* Create the FUNCTION_DECL itself. */
@@ -3174,10 +2873,7 @@ start_static_storage_duration_function ()
get_priority_info (DEFAULT_INIT_PRIORITY);
}
- if (ssdf_decls_used == ssdf_decls->num_elements)
- VARRAY_GROW (ssdf_decls, 2 * ssdf_decls_used);
- VARRAY_TREE (ssdf_decls, ssdf_decls_used) = ssdf_decl;
- ++ssdf_decls_used;
+ VARRAY_PUSH_TREE (ssdf_decls, ssdf_decl);
/* Create the argument list. */
initialize_p_decl = build_decl (PARM_DECL,
@@ -3195,6 +2891,9 @@ start_static_storage_duration_function ()
TREE_CHAIN (initialize_p_decl) = priority_decl;
DECL_ARGUMENTS (ssdf_decl) = initialize_p_decl;
+ /* Put the function in the global scope. */
+ pushdecl (ssdf_decl);
+
/* Start the function itself. This is equivalent to declarating the
function as:
@@ -3205,86 +2904,17 @@ start_static_storage_duration_function ()
start_function (/*specs=*/NULL_TREE,
ssdf_decl,
/*attrs=*/NULL_TREE,
- /*pre_parsed_p=*/1);
+ SF_PRE_PARSED);
/* Set up the scope of the outermost block in the function. */
- store_parm_decls ();
- pushlevel (0);
- clear_last_expr ();
- push_momentary ();
- expand_start_bindings (0);
+ body = begin_compound_stmt (/*has_no_scope=*/0);
/* This function must not be deferred because we are depending on
its compilation to tell us what is TREE_SYMBOL_REFERENCED. */
current_function_cannot_inline
= "static storage duration functions cannot be inlined";
-}
-
-/* Generate the initialization code for the priority indicated in N. */
-static int
-generate_inits_for_priority (n, data)
- splay_tree_node n;
- void *data ATTRIBUTE_UNUSED;
-{
- int priority = (int) n->key;
- priority_info pi = (priority_info) n->value;
-
- /* For each priority N which has been used generate code which looks
- like:
-
- if (__priority == N) {
- if (__initialize_p)
- ...
- else
- ...
- }
-
- We use the sequences we've accumulated to fill in the `...'s. */
- expand_start_cond (build_binary_op (EQ_EXPR,
- priority_decl,
- build_int_2 (priority, 0)),
- /*exit_flag=*/0);
-
- /* Do the initializations. */
- expand_start_cond (build_binary_op (NE_EXPR,
- initialize_p_decl,
- integer_zero_node),
- /*exit_flag=*/0);
- if (pi->initialization_sequence)
- {
- rtx insns;
-
- push_to_sequence (pi->initialization_sequence);
- insns = gen_sequence ();
- end_sequence ();
-
- emit_insn (insns);
- pi->initialization_sequence = NULL_RTX;
- pi->initializations_p = 1;
- }
-
- /* Do the destructions. */
- expand_start_else ();
- if (pi->destruction_sequence)
- {
- rtx insns;
-
- push_to_sequence (pi->destruction_sequence);
- insns = gen_sequence ();
- end_sequence ();
-
- emit_insn (insns);
- pi->destruction_sequence = NULL_RTX;
- pi->destructions_p = 1;
- }
-
- /* Close out the conditionals. */
- expand_end_cond ();
- expand_end_cond ();
-
- /* Don't stop iterating. */
- return 0;
+ return body;
}
/* Finish the generation of the function which performs initialization
@@ -3292,17 +2922,12 @@ generate_inits_for_priority (n, data)
this point, no more such objects can be created. */
static void
-finish_static_storage_duration_function ()
+finish_static_storage_duration_function (body)
+ tree body;
{
- splay_tree_foreach (priority_info_map,
- generate_inits_for_priority,
- /*data=*/0);
-
/* Close out the function. */
- expand_end_bindings (getdecls (), 1, 0);
- poplevel (1, 0, 0);
- pop_momentary ();
- finish_function (lineno, 0, 0);
+ finish_compound_stmt (/*has_no_scope=*/0, body);
+ expand_body (finish_function (0));
}
/* Return the information about the indicated PRIORITY level. If no
@@ -3323,8 +2948,6 @@ get_priority_info (priority)
/* Create a new priority information structure, and insert it
into the map. */
pi = (priority_info) xmalloc (sizeof (struct priority_info_s));
- pi->initialization_sequence = NULL_RTX;
- pi->destruction_sequence = NULL_RTX;
pi->initializations_p = 0;
pi->destructions_p = 0;
splay_tree_insert (priority_info_map,
@@ -3337,219 +2960,271 @@ get_priority_info (priority)
return pi;
}
-/* Generate code to do the static initialization of DECL. The
- initialization is INIT. If DECL may be initialized more than once
- in different object files, SENTRY is the guard variable to
- check. PRIORITY is the priority for the initialization. */
+/* Set up to handle the initialization or destruction of DECL. If
+ INITP is non-zero, we are initializing the variable. Otherwise, we
+ are destroying it. */
-static void
-do_static_initialization (decl, init, sentry, priority)
+static tree
+start_static_initialization_or_destruction (decl, initp)
tree decl;
- tree init;
- tree sentry;
- int priority;
+ int initp;
{
+ tree guard_if_stmt = NULL_TREE;
+ int priority;
+ tree cond;
+ tree guard;
+ tree init_cond;
priority_info pi;
- /* Get the priority information for this PRIORITY, */
+ /* Figure out the priority for this declaration. */
+ priority = DECL_INIT_PRIORITY (decl);
+ if (!priority)
+ priority = DEFAULT_INIT_PRIORITY;
+
+ /* Remember that we had an initialization or finalization at this
+ priority. */
pi = get_priority_info (priority);
- if (!pi->initialization_sequence)
- start_sequence ();
+ if (initp)
+ pi->initializations_p = 1;
else
- push_to_sequence (pi->initialization_sequence);
-
- /* Tell the debugger that we are at the location of the static
- variable in question. */
- emit_note (input_filename, lineno);
-
- /* If there's a SENTRY, we only do the initialization if it is
- zero, i.e., if we are the first to initialize it. */
- if (sentry)
- expand_start_cond (build_binary_op (EQ_EXPR,
- build_unary_op (PREINCREMENT_EXPR,
- sentry,
- /*noconvert=*/0),
- integer_one_node),
- /*exit_flag=*/0);
-
- /* Prepare a binding level for temporaries created during the
- initialization. */
- expand_start_target_temps ();
+ pi->destructions_p = 1;
- if (IS_AGGR_TYPE (TREE_TYPE (decl))
- || TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
- expand_aggr_init (decl, init, 0);
- else if (TREE_CODE (init) == TREE_VEC)
- expand_expr (expand_vec_init (decl, TREE_VEC_ELT (init, 0),
- TREE_VEC_ELT (init, 1),
- TREE_VEC_ELT (init, 2), 0),
- const0_rtx, VOIDmode, EXPAND_NORMAL);
- else
- expand_assignment (decl, init, 0, 0);
+ /* Trick the compiler into thinking we are at the file and line
+ where DECL was declared so that error-messages make sense, and so
+ that the debugger will show somewhat sensible file and line
+ information. */
+ input_filename = DECL_SOURCE_FILE (decl);
+ lineno = DECL_SOURCE_LINE (decl);
+
+ /* Because of:
+
+ [class.access.spec]
+
+ Access control for implicit calls to the constructors,
+ the conversion functions, or the destructor called to
+ create and destroy a static data member is performed as
+ if these calls appeared in the scope of the member's
+ class.
+
+ we pretend we are in a static member function of the class of
+ which the DECL is a member. */
+ if (member_p (decl))
+ {
+ DECL_CONTEXT (current_function_decl) = DECL_CONTEXT (decl);
+ DECL_STATIC_FUNCTION_P (current_function_decl) = 1;
+ }
- /* The expression might have involved increments and decrements. */
- emit_queue ();
+ /* Conditionalize this initialization on being in the right priority
+ and being initializing/finalizing appropriately. */
+ guard_if_stmt = begin_if_stmt ();
+ cond = cp_build_binary_op (EQ_EXPR,
+ priority_decl,
+ build_int_2 (priority, 0));
+ init_cond = initp ? integer_one_node : integer_zero_node;
+ init_cond = cp_build_binary_op (EQ_EXPR,
+ initialize_p_decl,
+ init_cond);
+ cond = cp_build_binary_op (TRUTH_ANDIF_EXPR, cond, init_cond);
+
+ /* Assume we don't need a guard. */
+ guard = NULL_TREE;
+ /* We need a guard if this is an object with external linkage that
+ might be initialized in more than one place. (For example, a
+ static data member of a template, when the data member requires
+ construction.) */
+ if (TREE_PUBLIC (decl) && (DECL_COMMON (decl)
+ || DECL_ONE_ONLY (decl)
+ || DECL_WEAK (decl)))
+ {
+ tree guard_cond;
+
+ guard = get_guard (decl);
- /* Cleanup any temporaries needed for the initial value. */
- expand_end_target_temps ();
+ /* When using __cxa_atexit, we just check the GUARD as we would
+ for a local static. */
+ if (flag_use_cxa_atexit)
+ {
+ /* When using __cxa_atexit, we never try to destroy
+ anything from a static destructor. */
+ my_friendly_assert (initp, 20000629);
+ guard_cond = get_guard_cond (guard);
+ }
+ /* If we don't have __cxa_atexit, then we will be running
+ destructors from .fini sections, or their equivalents. So,
+ we need to know how many times we've tried to initialize this
+ object. We do initializations only if the GUARD is zero,
+ i.e., if we are the first to initialize the variable. We do
+ destructions only if the GUARD is one, i.e., if we are the
+ last to destroy the variable. */
+ else if (initp)
+ guard_cond
+ = cp_build_binary_op (EQ_EXPR,
+ build_unary_op (PREINCREMENT_EXPR,
+ guard,
+ /*noconvert=*/1),
+ integer_one_node);
+ else
+ guard_cond
+ = cp_build_binary_op (EQ_EXPR,
+ build_unary_op (PREDECREMENT_EXPR,
+ guard,
+ /*noconvert=*/1),
+ integer_zero_node);
+
+ cond = cp_build_binary_op (TRUTH_ANDIF_EXPR, cond, guard_cond);
+ }
- /* Cleanup any deferred pops from function calls. This would be done
- by expand_end_cond, but we also need it when !SENTRY, since we are
- constructing these sequences by parts. */
- do_pending_stack_adjust ();
+ finish_if_stmt_cond (cond, guard_if_stmt);
- /* Close the conditional opened above. */
- if (sentry)
- expand_end_cond ();
+ /* If we're using __cxa_atexit, we have not already set the GUARD,
+ so we must do so now. */
+ if (guard && initp && flag_use_cxa_atexit)
+ finish_expr_stmt (set_guard (guard));
- /* Save the sequence for later use. */
- pi->initialization_sequence = get_insns ();
- end_sequence ();
+ return guard_if_stmt;
}
-/* Generate code to do the static destruction of DECL. If DECL may be
- initialized more than once in different object files, SENTRY is the
- guard variable to check. PRIORITY is the priority for the
- destruction. */
+/* We've just finished generating code to do an initialization or
+ finalization. GUARD_IF_STMT is the if-statement we used to guard
+ the initialization. */
static void
-do_static_destruction (decl, sentry, priority)
- tree decl;
- tree sentry;
- int priority;
+finish_static_initialization_or_destruction (guard_if_stmt)
+ tree guard_if_stmt;
{
- rtx new_insns;
- priority_info pi;
+ finish_then_clause (guard_if_stmt);
+ finish_if_stmt ();
- /* If we don't need a destructor, there's nothing to do. */
- if (!TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (decl)))
- return;
-
- /* Get the priority information for this PRIORITY, */
- pi = get_priority_info (priority);
- if (!pi->destruction_sequence)
- start_sequence ();
- else
- push_to_sequence (pi->destruction_sequence);
+ /* Now that we're done with DECL we don't need to pretend to be a
+ member of its class any longer. */
+ DECL_CONTEXT (current_function_decl) = NULL_TREE;
+ DECL_STATIC_FUNCTION_P (current_function_decl) = 0;
+}
- /* Start a new sequence to handle just this destruction. */
- start_sequence ();
+/* Generate code to do the static initialization of DECL. The
+ initialization is INIT. If DECL may be initialized more than once
+ in different object files, GUARD is the guard variable to
+ check. PRIORITY is the priority for the initialization. */
- /* Tell the debugger that we are at the location of the static
- variable in question. */
- emit_note (input_filename, lineno);
-
- /* If there's a SENTRY, we only do the destruction if it is one,
- i.e., if we are the last to destroy it. */
- if (sentry)
- expand_start_cond (build_binary_op (EQ_EXPR,
- build_unary_op (PREDECREMENT_EXPR,
- sentry,
- /*nonconvert=*/1),
- integer_zero_node),
- /*exit_flag=*/0);
+static void
+do_static_initialization (decl, init)
+ tree decl;
+ tree init;
+{
+ tree expr;
+ tree guard_if_stmt;
+
+ /* Set up for the initialization. */
+ guard_if_stmt
+ = start_static_initialization_or_destruction (decl,
+ /*initp=*/1);
- /* Actually to the destruction. */
- expand_expr_stmt (build_cleanup (decl));
-
- /* Cleanup any deferred pops from function calls. This would be done
- by expand_end_cond, but we also need it when !SENTRY, since we are
- constructing these sequences by parts. */
- do_pending_stack_adjust ();
-
- /* Close the conditional opened above. */
- if (sentry)
- expand_end_cond ();
-
- /* Insert the NEW_INSNS before the current insns. (Destructions are
- run in reverse order of initializations.) */
- new_insns = gen_sequence ();
- end_sequence ();
- if (pi->destruction_sequence)
- emit_insn_before (new_insns, pi->destruction_sequence);
+ /* Do the initialization itself. */
+ if (IS_AGGR_TYPE (TREE_TYPE (decl))
+ || TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
+ expr = build_aggr_init (decl, init, 0);
else
- emit_insn (new_insns);
+ {
+ expr = build (INIT_EXPR, TREE_TYPE (decl), decl, init);
+ TREE_SIDE_EFFECTS (expr) = 1;
+ }
+ finish_expr_stmt (expr);
+
+ /* If we're using __cxa_atexit, register a a function that calls the
+ destructor for the object. */
+ if (flag_use_cxa_atexit)
+ register_dtor_fn (decl);
- /* Save the sequence for later use. */
- pi->destruction_sequence = get_insns ();
- end_sequence ();
+ /* Finsh up. */
+ finish_static_initialization_or_destruction (guard_if_stmt);
}
-/* Add code to the static storage duration function that will handle
- DECL (a static variable that needs initializing and/or destruction)
- with the indicated PRIORITY. If DECL needs initializing, INIT is
- the initializer. */
+/* Generate code to do the static destruction of DECL. If DECL may be
+ initialized more than once in different object files, GUARD is the
+ guard variable to check. PRIORITY is the priority for the
+ destruction. */
static void
-do_static_initialization_and_destruction (decl, init)
+do_static_destruction (decl)
tree decl;
- tree init;
{
- tree sentry = NULL_TREE;
- int priority;
+ tree guard_if_stmt;
+
+ /* If we're using __cxa_atexit, then destructors are registered
+ immediately after objects are initialized. */
+ my_friendly_assert (!flag_use_cxa_atexit, 20000121);
- /* Deal gracefully with error. */
- if (decl == error_mark_node)
+ /* If we don't need a destructor, there's nothing to do. */
+ if (TYPE_HAS_TRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
return;
- /* The only things that can be initialized are variables. */
- my_friendly_assert (TREE_CODE (decl) == VAR_DECL, 19990420);
+ /* Actually do the destruction. */
+ guard_if_stmt = start_static_initialization_or_destruction (decl,
+ /*initp=*/0);
+ finish_expr_stmt (build_cleanup (decl));
+ finish_static_initialization_or_destruction (guard_if_stmt);
+}
- /* If this object is not defined, we don't need to do anything
- here. */
- if (DECL_EXTERNAL (decl))
- return;
+/* VARS is a list of variables with static storage duration which may
+ need initialization and/or finalization. Remove those variables
+ that don't really need to be initialized or finalized, and return
+ the resulting list. The order in which the variables appear in
+ VARS is in reverse order of the order in which they should actually
+ be initialized. The list we return is in the unreversed order;
+ i.e., the first variable should be initialized first. */
- /* Also, if the initializer already contains errors, we can bail out
- now. */
- if (init && TREE_CODE (init) == TREE_LIST
- && value_member (error_mark_node, init))
- return;
+static tree
+prune_vars_needing_no_initialization (vars)
+ tree vars;
+{
+ tree var;
+ tree result;
- /* Trick the compiler into thinking we are at the file and line
- where DECL was declared so that error-messages make sense, and so
- that the debugger will show somewhat sensible file and line
- information. */
- input_filename = DECL_SOURCE_FILE (decl);
- lineno = DECL_SOURCE_LINE (decl);
+ for (var = vars, result = NULL_TREE;
+ var;
+ var = TREE_CHAIN (var))
+ {
+ tree decl = TREE_VALUE (var);
+ tree init = TREE_PURPOSE (var);
- /* Because of:
+ /* Deal gracefully with error. */
+ if (decl == error_mark_node)
+ continue;
- [class.access.spec]
+ /* The only things that can be initialized are variables. */
+ my_friendly_assert (TREE_CODE (decl) == VAR_DECL, 19990420);
- Access control for implicit calls to the constructors,
- the conversion functions, or the destructor called to
- create and destroy a static data member is performed as
- if these calls appeared in the scope of the member's
- class.
+ /* If this object is not defined, we don't need to do anything
+ here. */
+ if (DECL_EXTERNAL (decl))
+ continue;
- we pretend we are in a static member function of the class of
- which the DECL is a member. */
- if (member_p (decl))
- {
- DECL_CLASS_CONTEXT (current_function_decl) = DECL_CONTEXT (decl);
- DECL_STATIC_FUNCTION_P (current_function_decl) = 1;
+ /* Also, if the initializer already contains errors, we can bail
+ out now. */
+ if (init && TREE_CODE (init) == TREE_LIST
+ && value_member (error_mark_node, init))
+ continue;
+
+ /* This variable is going to need initialization and/or
+ finalization, so we add it to the list. */
+ result = tree_cons (init, decl, result);
}
-
- /* We need a sentry if this is an object with external linkage that
- might be initialized in more than one place. */
- if (TREE_PUBLIC (decl) && (DECL_COMMON (decl)
- || DECL_ONE_ONLY (decl)
- || DECL_WEAK (decl)))
- sentry = get_sentry (DECL_ASSEMBLER_NAME (decl));
- /* Generate the code to actually do the intialization and
- destruction. */
- priority = DECL_INIT_PRIORITY (decl);
- if (!priority)
- priority = DEFAULT_INIT_PRIORITY;
- do_static_initialization (decl, init, sentry, priority);
- do_static_destruction (decl, sentry, priority);
+ return result;
+}
- /* Now that we're done with DECL we don't need to pretend to be a
- member of its class any longer. */
- DECL_CLASS_CONTEXT (current_function_decl) = NULL_TREE;
- DECL_STATIC_FUNCTION_P (current_function_decl) = 0;
+/* Make sure we have told the back end about all the variables in
+ VARS. */
+
+static void
+write_out_vars (vars)
+ tree vars;
+{
+ tree v;
+
+ for (v = vars; v; v = TREE_CHAIN (v))
+ if (! TREE_ASM_WRITTEN (TREE_VALUE (v)))
+ rest_of_decl_compilation (TREE_VALUE (v), 0, 1, 1);
}
/* Generate a static constructor (if CONSTRUCTOR_P) or destructor
@@ -3563,6 +3238,7 @@ generate_ctor_or_dtor_function (constructor_p, priority)
{
char function_key;
tree arguments;
+ tree body;
size_t i;
/* We use `I' to indicate initialization and `D' to indicate
@@ -3573,17 +3249,17 @@ generate_ctor_or_dtor_function (constructor_p, priority)
function_key = 'D';
/* Begin the function. */
- start_objects (function_key, priority);
+ body = start_objects (function_key, priority);
/* Call the static storage duration function with appropriate
arguments. */
- for (i = 0; i < ssdf_decls_used; ++i)
+ for (i = 0; i < ssdf_decls->elements_used; ++i)
{
arguments = tree_cons (NULL_TREE, build_int_2 (priority, 0),
NULL_TREE);
arguments = tree_cons (NULL_TREE, build_int_2 (constructor_p, 0),
arguments);
- expand_expr_stmt (build_function_call (VARRAY_TREE (ssdf_decls, i),
+ finish_expr_stmt (build_function_call (VARRAY_TREE (ssdf_decls, i),
arguments));
}
@@ -3597,11 +3273,11 @@ generate_ctor_or_dtor_function (constructor_p, priority)
for (fns = constructor_p ? static_ctors : static_dtors;
fns;
fns = TREE_CHAIN (fns))
- expand_expr_stmt (build_function_call (TREE_VALUE (fns), NULL_TREE));
+ finish_expr_stmt (build_function_call (TREE_VALUE (fns), NULL_TREE));
}
/* Close out the function. */
- finish_objects (function_key, priority);
+ finish_objects (function_key, priority, body);
}
/* Generate constructor and destructor functions for the priority
@@ -3630,33 +3306,6 @@ generate_ctor_and_dtor_functions_for_priority (n, data)
return 0;
}
-/* Returns non-zero if T is a vlist ctor wrapper. */
-
-static int
-vlist_ctor_wrapper_p (t, data)
- tree t;
- void *data ATTRIBUTE_UNUSED;
-{
- return (TREE_CODE (t) == FUNCTION_DECL) && DECL_VLIST_CTOR_WRAPPER_P (t);
-}
-
-/* Emits a vlist ctor wrapper if necessary. */
-
-static int
-finish_vlist_ctor_wrapper (t, data)
- tree *t;
- void *data ATTRIBUTE_UNUSED;
-{
- import_export_decl (*t);
- if (!DECL_EXTERNAL (*t) && !TREE_USED (*t))
- {
- mark_used (*t);
- synthesize_method (*t);
- return 1;
- }
- return 0;
-}
-
/* This routine is called from the last rule in yyparse ().
Its job is to create all the code needed to initialize and
destroy the global aggregates. We do the destruction
@@ -3665,8 +3314,6 @@ finish_vlist_ctor_wrapper (t, data)
void
finish_file ()
{
- extern int lineno;
- int start_time, this_time;
tree vars;
int reconsider;
size_t i;
@@ -3677,8 +3324,6 @@ finish_file ()
if (! global_bindings_p () || current_class_type || decl_namespace_list)
return;
- start_time = get_run_time ();
-
/* Otherwise, GDB can get confused, because in only knows
about source for LINENO-1 lines. */
lineno -= 1;
@@ -3702,84 +3347,90 @@ finish_file ()
generating the intiailzer for an object may cause templates to be
instantiated, etc., etc. */
- this_time = get_run_time ();
- parse_time -= this_time - start_time;
- varconst_time += this_time - start_time;
- start_time = get_run_time ();
- permanent_allocation (1);
+ timevar_push (TV_VARCONST);
+ emit_support_tinfos ();
+
do
{
- /* Non-zero if we need a static storage duration function on
- this iteration through the loop. */
- int need_ssdf_p = 0;
-
reconsider = 0;
/* If there are templates that we've put off instantiating, do
them now. */
instantiate_pending_templates ();
- /* Write out signature-tables and virtual tables as required.
- Note that writing out the virtual table for a template class
- may cause the instantiation of members of that class. */
- if (flag_handle_signatures
- && walk_globals (sigtable_decl_p,
- finish_sigtable_vardecl,
- /*data=*/0))
- reconsider = 1;
+ /* Write out virtual tables as required. Note that writing out
+ the virtual table for a template class may cause the
+ instantiation of members of that class. */
if (walk_globals (vtable_decl_p,
finish_vtable_vardecl,
/*data=*/0))
reconsider = 1;
- if (walk_globals (vlist_ctor_wrapper_p,
- finish_vlist_ctor_wrapper,
- /*data=*/0))
+ /* Write out needed type info variables. Writing out one variable
+ might cause others to be needed. */
+ if (walk_globals (tinfo_decl_p, emit_tinfo_decl, /*data=*/0))
reconsider = 1;
-
/* The list of objects with static storage duration is built up
- in reverse order, so we reverse it here. We also clear
- STATIC_AGGREGATES so that any new aggregates added during the
- initialization of these will be initialized in the correct
- order when we next come around the loop. */
- vars = nreverse (static_aggregates);
+ in reverse order. We clear STATIC_AGGREGATES so that any new
+ aggregates added during the initialization of these will be
+ initialized in the correct order when we next come around the
+ loop. */
+ vars = prune_vars_needing_no_initialization (static_aggregates);
static_aggregates = NULL_TREE;
- while (vars)
+
+ if (vars)
{
- if (! TREE_ASM_WRITTEN (TREE_VALUE (vars)))
- rest_of_decl_compilation (TREE_VALUE (vars), 0, 1, 1);
- if (!need_ssdf_p)
+ tree v;
+
+ /* We need to start a new initialization function each time
+ through the loop. That's because we need to know which
+ vtables have been referenced, and TREE_SYMBOL_REFERENCED
+ isn't computed until a function is finished, and written
+ out. That's a deficiency in the back-end. When this is
+ fixed, these initialization functions could all become
+ inline, with resulting performance improvements. */
+ tree ssdf_body = start_static_storage_duration_function ();
+
+ /* Make sure the back end knows about all the variables. */
+ write_out_vars (vars);
+
+ /* First generate code to do all the initializations. */
+ for (v = vars; v; v = TREE_CHAIN (v))
+ do_static_initialization (TREE_VALUE (v),
+ TREE_PURPOSE (v));
+
+ /* Then, generate code to do all the destructions. Do these
+ in reverse order so that the most recently constructed
+ variable is the first destroyed. If we're using
+ __cxa_atexit, then we don't need to do this; functions
+ were registered at initialization time to destroy the
+ local statics. */
+ if (!flag_use_cxa_atexit)
{
- /* We need to start a new initialization function each
- time through the loop. That's because we need to
- know which vtables have been referenced, and
- TREE_SYMBOL_REFERENCED isn't computed until a
- function is finished, and written out. That's a
- deficiency in the back-end. When this is fixed,
- these initialization functions could all become
- inline, with resulting performance improvements. */
- start_static_storage_duration_function ();
- need_ssdf_p = 1;
+ vars = nreverse (vars);
+ for (v = vars; v; v = TREE_CHAIN (v))
+ do_static_destruction (TREE_VALUE (v));
}
+ else
+ vars = NULL_TREE;
- do_static_initialization_and_destruction (TREE_VALUE (vars),
- TREE_PURPOSE (vars));
+ /* Finish up the static storage duration function for this
+ round. */
+ finish_static_storage_duration_function (ssdf_body);
+
+ /* All those initializations and finalizations might cause
+ us to need more inline functions, more template
+ instantiations, etc. */
reconsider = 1;
- vars = TREE_CHAIN (vars);
}
- /* Finish up the static storage duration function for this
- round. */
- if (need_ssdf_p)
- finish_static_storage_duration_function ();
-
/* Go through the various inline functions, and see if any need
synthesizing. */
- for (i = 0; i < saved_inlines_used; ++i)
+ for (i = 0; i < deferred_fns_used; ++i)
{
- tree decl = VARRAY_TREE (saved_inlines, i);
+ tree decl = VARRAY_TREE (deferred_fns, i);
import_export_decl (decl);
if (DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl)
&& TREE_USED (decl)
@@ -3791,38 +3442,59 @@ finish_file ()
finish_function doesn't clean things up, and we end
up with CURRENT_FUNCTION_DECL set. */
push_to_top_level ();
- if (DECL_TINFO_FN_P (decl))
- synthesize_tinfo_fn (decl);
- else
- synthesize_method (decl);
+ synthesize_method (decl);
pop_from_top_level ();
reconsider = 1;
}
}
- /* Mark all functions that might deal with exception-handling as
- referenced. */
- mark_all_runtime_matches ();
-
/* We lie to the back-end, pretending that some functions are
not defined when they really are. This keeps these functions
- from being put out unncessarily. But, we must stop lying
+ from being put out unnecessarily. But, we must stop lying
when the functions are referenced, or if they are not comdat
since they need to be put out now. */
- for (i = 0; i < saved_inlines_used; ++i)
+ for (i = 0; i < deferred_fns_used; ++i)
{
- tree decl = VARRAY_TREE (saved_inlines, i);
+ tree decl = VARRAY_TREE (deferred_fns, i);
if (DECL_NOT_REALLY_EXTERN (decl)
&& DECL_INITIAL (decl)
- && (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
- || !DECL_COMDAT (decl)))
+ && DECL_NEEDED_P (decl))
DECL_EXTERNAL (decl) = 0;
+
+ /* If we're going to need to write this function out, and
+ there's already a body for it, create RTL for it now.
+ (There might be no body if this is a method we haven't
+ gotten around to synthesizing yet.) */
+ if (!DECL_EXTERNAL (decl)
+ && DECL_NEEDED_P (decl)
+ && DECL_SAVED_TREE (decl)
+ && !TREE_ASM_WRITTEN (decl))
+ {
+ int saved_not_really_extern;
+
+ /* When we call finish_function in expand_body, it will
+ try to reset DECL_NOT_REALLY_EXTERN so we save and
+ restore it here. */
+ saved_not_really_extern = DECL_NOT_REALLY_EXTERN (decl);
+ /* Generate RTL for this function now that we know we
+ need it. */
+ expand_body (decl);
+ /* Undo the damage done by finish_function. */
+ DECL_EXTERNAL (decl) = 0;
+ DECL_NOT_REALLY_EXTERN (decl) = saved_not_really_extern;
+ /* If we're compiling -fsyntax-only pretend that this
+ function has been written out so that we don't try to
+ expand it again. */
+ if (flag_syntax_only)
+ TREE_ASM_WRITTEN (decl) = 1;
+ reconsider = 1;
+ }
}
- if (saved_inlines_used
- && wrapup_global_declarations (&VARRAY_TREE (saved_inlines, 0),
- saved_inlines_used))
+ if (deferred_fns_used
+ && wrapup_global_declarations (&VARRAY_TREE (deferred_fns, 0),
+ deferred_fns_used))
reconsider = 1;
if (walk_namespaces (wrapup_globals_for_namespace, /*data=*/0))
reconsider = 1;
@@ -3864,18 +3536,34 @@ finish_file ()
/* Now delete from the chain of variables all virtual function tables.
We output them all ourselves, because each will be treated
- specially. */
- walk_globals (vtable_decl_p, prune_vtable_vardecl, /*data=*/0);
+ specially. We don't do this if we're just doing semantic
+ analysis, and not code-generation. */
+ if (!flag_syntax_only)
+ walk_globals (vtable_decl_p, prune_vtable_vardecl, /*data=*/0);
/* Now, issue warnings about static, but not defined, functions,
- etc. */
+ etc., and emit debugging information. */
walk_namespaces (wrapup_globals_for_namespace, /*data=*/&reconsider);
+ if (pending_statics)
+ check_global_declarations (&VARRAY_TREE (pending_statics, 0),
+ pending_statics_used);
finish_repo ();
- this_time = get_run_time ();
- parse_time -= this_time - start_time;
- varconst_time += this_time - start_time;
+ /* The entire file is now complete. If requested, dump everything
+ to a file. */
+ {
+ int flags;
+ FILE *stream = dump_begin (TDI_all, &flags);
+
+ if (stream)
+ {
+ dump_node (global_namespace, flags & ~TDF_SLIM, stream);
+ dump_end (TDI_all, stream);
+ }
+ }
+
+ timevar_pop (TV_VARCONST);
if (flag_detailed_statistics)
{
@@ -3927,37 +3615,38 @@ reparse_absdcl_as_casts (decl, expr)
tree decl, expr;
{
tree type;
+ int non_void_p = 0;
if (TREE_CODE (expr) == CONSTRUCTOR
&& TREE_TYPE (expr) == 0)
{
- type = groktypename (TREE_VALUE (TREE_OPERAND (decl, 1)));
+ type = groktypename (TREE_VALUE (CALL_DECLARATOR_PARMS (decl)));
decl = TREE_OPERAND (decl, 0);
- if (IS_SIGNATURE (type))
- {
- error ("cast specifies signature type");
- return error_mark_node;
- }
-
- expr = digest_init (type, expr, (tree *) 0);
- if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == 0)
+ if (processing_template_decl)
+ TREE_TYPE (expr) = type;
+ else
{
- int failure = complete_array_type (type, expr, 1);
- if (failure)
- my_friendly_abort (78);
+ expr = digest_init (type, expr, (tree *) 0);
+ if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type))
+ {
+ int failure = complete_array_type (type, expr, 1);
+ my_friendly_assert (!failure, 78);
+ }
}
}
while (decl)
{
- type = groktypename (TREE_VALUE (TREE_OPERAND (decl, 1)));
+ type = groktypename (TREE_VALUE (CALL_DECLARATOR_PARMS (decl)));
decl = TREE_OPERAND (decl, 0);
+ if (!VOID_TYPE_P (type))
+ non_void_p = 1;
expr = build_c_cast (type, expr);
}
if (warn_old_style_cast && ! in_system_header
- && current_lang_name != lang_name_c)
+ && non_void_p && current_lang_name != lang_name_c)
warning ("use of old-style cast");
return expr;
@@ -4022,6 +3711,8 @@ build_expr_from_tree (t)
case TRUTH_NOT_EXPR:
case ADDR_EXPR:
case CONVERT_EXPR: /* Unary + */
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
if (TREE_TYPE (t))
return t;
return build_x_unary_op (TREE_CODE (t),
@@ -4074,8 +3765,8 @@ build_expr_from_tree (t)
case ARRAY_REF:
if (TREE_OPERAND (t, 0) == NULL_TREE)
/* new-type-id */
- return build_parse_node (ARRAY_REF, NULL_TREE,
- build_expr_from_tree (TREE_OPERAND (t, 1)));
+ return build_nt (ARRAY_REF, NULL_TREE,
+ build_expr_from_tree (TREE_OPERAND (t, 1)));
return grok_array_decl (build_expr_from_tree (TREE_OPERAND (t, 0)),
build_expr_from_tree (TREE_OPERAND (t, 1)));
@@ -4083,9 +3774,10 @@ build_expr_from_tree (t)
case ALIGNOF_EXPR:
{
tree r = build_expr_from_tree (TREE_OPERAND (t, 0));
- if (TREE_CODE_CLASS (TREE_CODE (r)) != 't')
- r = TREE_TYPE (r);
- return TREE_CODE (t) == SIZEOF_EXPR ? c_sizeof (r) : c_alignof (r);
+ if (!TYPE_P (r))
+ return TREE_CODE (t) == SIZEOF_EXPR ? expr_sizeof (r) : c_alignof_expr (r);
+ else
+ return TREE_CODE (t) == SIZEOF_EXPR ? c_sizeof (r) : c_alignof (r);
}
case MODOP_EXPR:
@@ -4116,16 +3808,23 @@ build_expr_from_tree (t)
return build_x_compound_expr
(build_expr_from_tree (TREE_OPERAND (t, 0)));
else
- my_friendly_abort (42);
+ abort ();
case METHOD_CALL_EXPR:
if (TREE_CODE (TREE_OPERAND (t, 0)) == SCOPE_REF)
{
tree ref = TREE_OPERAND (t, 0);
+ tree name = TREE_OPERAND (ref, 1);
+
+ if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
+ name = build_nt (TEMPLATE_ID_EXPR,
+ TREE_OPERAND (name, 0),
+ build_expr_from_tree (TREE_OPERAND (name, 1)));
+
return build_scoped_method_call
(build_expr_from_tree (TREE_OPERAND (t, 1)),
build_expr_from_tree (TREE_OPERAND (ref, 0)),
- TREE_OPERAND (ref, 1),
+ name,
build_expr_from_tree (TREE_OPERAND (t, 2)));
}
else
@@ -4157,9 +3856,16 @@ build_expr_from_tree (t)
if (TREE_CODE (TREE_OPERAND (t, 0)) == SCOPE_REF)
{
tree ref = TREE_OPERAND (t, 0);
+ tree name = TREE_OPERAND (ref, 1);
+
+ if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
+ name = build_nt (TEMPLATE_ID_EXPR,
+ TREE_OPERAND (name, 0),
+ build_expr_from_tree (TREE_OPERAND (name, 1)));
+
return build_member_call
(build_expr_from_tree (TREE_OPERAND (ref, 0)),
- TREE_OPERAND (ref, 1),
+ name,
build_expr_from_tree (TREE_OPERAND (t, 1)));
}
else
@@ -4188,6 +3894,12 @@ build_expr_from_tree (t)
build_expr_from_tree (TREE_OPERAND (t, 1)),
build_expr_from_tree (TREE_OPERAND (t, 2)));
+ case PSEUDO_DTOR_EXPR:
+ return (finish_pseudo_destructor_call_expr
+ (build_expr_from_tree (TREE_OPERAND (t, 0)),
+ build_expr_from_tree (TREE_OPERAND (t, 1)),
+ build_expr_from_tree (TREE_OPERAND (t, 2))));
+
case TREE_LIST:
{
tree purpose, value, chain;
@@ -4204,7 +3916,7 @@ build_expr_from_tree (t)
chain = TREE_CHAIN (t);
if (chain && chain != void_type_node)
chain = build_expr_from_tree (chain);
- return expr_tree_cons (purpose, value, chain);
+ return tree_cons (purpose, value, chain);
}
case COMPONENT_REF:
@@ -4230,28 +3942,50 @@ build_expr_from_tree (t)
case CONSTRUCTOR:
{
tree r;
+ tree elts;
+ tree type = TREE_TYPE (t);
+ bool purpose_p;
/* digest_init will do the wrong thing if we let it. */
- if (TREE_TYPE (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))
+ if (type && TYPE_PTRMEMFUNC_P (type))
return t;
- r = build_nt (CONSTRUCTOR, NULL_TREE,
- build_expr_from_tree (CONSTRUCTOR_ELTS (t)));
+ r = NULL_TREE;
+ /* We do not want to process the purpose of aggregate
+ initializers as they are identifier nodes which will be
+ looked up by digest_init. */
+ purpose_p = !(type && IS_AGGR_TYPE (type));
+ for (elts = CONSTRUCTOR_ELTS (t); elts; elts = TREE_CHAIN (elts))
+ {
+ tree purpose = TREE_PURPOSE (elts);
+ tree value = TREE_VALUE (elts);
+
+ if (purpose && purpose_p)
+ purpose = build_expr_from_tree (purpose);
+ value = build_expr_from_tree (value);
+ r = tree_cons (purpose, value, r);
+ }
+
+ r = build_nt (CONSTRUCTOR, NULL_TREE, nreverse (r));
TREE_HAS_CONSTRUCTOR (r) = TREE_HAS_CONSTRUCTOR (t);
- if (TREE_TYPE (t))
- return digest_init (TREE_TYPE (t), r, 0);
+ if (type)
+ return digest_init (type, r, 0);
return r;
}
case TYPEID_EXPR:
- if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t, 0))) == 't')
+ if (TYPE_P (TREE_OPERAND (t, 0)))
return get_typeid (TREE_OPERAND (t, 0));
- return build_x_typeid (build_expr_from_tree (TREE_OPERAND (t, 0)));
+ return build_typeid (build_expr_from_tree (TREE_OPERAND (t, 0)));
case VAR_DECL:
return convert_from_reference (t);
+ case VA_ARG_EXPR:
+ return build_va_arg (build_expr_from_tree (TREE_OPERAND (t, 0)),
+ TREE_TYPE (t));
+
default:
return t;
}
@@ -4270,7 +4004,7 @@ reparse_decl_as_expr (type, decl)
{
decl = build_expr_from_tree (decl);
if (type)
- return build_functional_cast (type, build_expr_list (NULL_TREE, decl));
+ return build_functional_cast (type, build_tree_list (NULL_TREE, decl));
else
return decl;
}
@@ -4283,8 +4017,6 @@ tree
finish_decl_parsing (decl)
tree decl;
{
- extern int current_class_depth;
-
switch (TREE_CODE (decl))
{
case IDENTIFIER_NODE:
@@ -4309,45 +4041,14 @@ finish_decl_parsing (decl)
/* For attribute handling. */
TREE_VALUE (decl) = finish_decl_parsing (TREE_VALUE (decl));
return decl;
+ case TEMPLATE_ID_EXPR:
+ return decl;
default:
- my_friendly_abort (5);
+ abort ();
return NULL_TREE;
}
}
-tree
-check_cp_case_value (value)
- tree value;
-{
- if (value == NULL_TREE)
- return value;
-
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- STRIP_TYPE_NOPS (value);
-
- if (TREE_READONLY_DECL_P (value))
- {
- value = decl_constant_value (value);
- STRIP_TYPE_NOPS (value);
- }
- value = fold (value);
-
- if (TREE_CODE (value) != INTEGER_CST
- && value != error_mark_node)
- {
- cp_error ("case label `%E' does not reduce to an integer constant",
- value);
- value = error_mark_node;
- }
- else
- /* Promote char or short to int. */
- value = default_conversion (value);
-
- constant_expression_warning (value);
-
- return value;
-}
-
/* Return 1 if root encloses child. */
static int
@@ -4403,14 +4104,14 @@ add_using_namespace (user, used, indirect)
/* Add used to the user's using list. */
DECL_NAMESPACE_USING (user)
- = perm_tree_cons (used, namespace_ancestor (user, used),
- DECL_NAMESPACE_USING (user));
+ = tree_cons (used, namespace_ancestor (user, used),
+ DECL_NAMESPACE_USING (user));
TREE_INDIRECT_USING (DECL_NAMESPACE_USING (user)) = indirect;
/* Add user to the used's users list. */
DECL_NAMESPACE_USERS (used)
- = perm_tree_cons (user, 0, DECL_NAMESPACE_USERS (used));
+ = tree_cons (user, 0, DECL_NAMESPACE_USERS (used));
/* Recursively add all namespaces used. */
for (t = DECL_NAMESPACE_USING (used); t; t = TREE_CHAIN (t))
@@ -4436,9 +4137,26 @@ merge_functions (s1, s2)
{
for (; s2; s2 = OVL_NEXT (s2))
{
- tree fn = OVL_CURRENT (s2);
- if (! ovl_member (fn, s1))
- s1 = build_overload (fn, s1);
+ tree fn2 = OVL_CURRENT (s2);
+ tree fns1;
+
+ for (fns1 = s1; fns1; fns1 = OVL_NEXT (fns1))
+ {
+ tree fn1 = OVL_CURRENT (fns1);
+
+ /* If the function from S2 is already in S1, there is no
+ need to add it again. For `extern "C"' functions, we
+ might have two FUNCTION_DECLs for the same function, in
+ different namespaces; again, we only need one of them. */
+ if (fn1 == fn2
+ || (DECL_EXTERN_C_P (fn1) && DECL_EXTERN_C_P (fn2)
+ && DECL_NAME (fn1) == DECL_NAME (fn2)))
+ break;
+ }
+
+ /* If we exhausted all of the functions in S1, FN2 is new. */
+ if (!fns1)
+ s1 = build_overload (fn2, s1);
}
return s1;
}
@@ -4505,13 +4223,13 @@ ambiguous_decl (name, old, new, flags)
repeat ourselves. */
if (BINDING_VALUE (old) != error_mark_node)
{
- cp_error ("use of `%D' is ambiguous", name);
+ error ("use of `%D' is ambiguous", name);
cp_error_at (" first declared as `%#D' here",
BINDING_VALUE (old));
}
cp_error_at (" also declared as `%#D' here", val);
}
- return error_mark_node;
+ BINDING_VALUE (old) = error_mark_node;
}
}
/* ... and copy the type. */
@@ -4524,7 +4242,7 @@ ambiguous_decl (name, old, new, flags)
{
if (flags & LOOKUP_COMPLAIN)
{
- cp_error ("`%D' denotes an ambiguous type",name);
+ error ("`%D' denotes an ambiguous type",name);
cp_error_at (" first type here", BINDING_TYPE (old));
cp_error_at (" other type here", type);
}
@@ -4532,14 +4250,18 @@ ambiguous_decl (name, old, new, flags)
return old;
}
-/* Add the bindings of name in used namespaces to val.
- The using list is defined by usings, and the lookup goes to scope.
+/* Subroutine of unualified_namespace_lookup:
+ Add the bindings of NAME in used namespaces to VAL.
+ We are currently looking for names in namespace SCOPE, so we
+ look through USINGS for using-directives of namespaces
+ which have SCOPE as a common ancestor with the current scope.
Returns zero on errors. */
int
-lookup_using_namespace (name, val, usings, scope, flags)
+lookup_using_namespace (name, val, usings, scope, flags, spacesp)
tree name, val, usings, scope;
int flags;
+ tree *spacesp;
{
tree iter;
tree val1;
@@ -4548,16 +4270,19 @@ lookup_using_namespace (name, val, usings, scope, flags)
for (iter = usings; iter; iter = TREE_CHAIN (iter))
if (TREE_VALUE (iter) == scope)
{
+ if (spacesp)
+ *spacesp = tree_cons (TREE_PURPOSE (iter), NULL_TREE,
+ *spacesp);
val1 = binding_for_name (name, TREE_PURPOSE (iter));
/* Resolve ambiguities. */
val = ambiguous_decl (name, val, val1, flags);
}
- return val != error_mark_node;
+ return BINDING_VALUE (val) != error_mark_node;
}
/* [namespace.qual]
- Excepts the name to lookup and its qualifying scope.
- Returns the name/type pair found into the CPLUS_BINDING result,
+ Accepts the NAME to lookup and its qualifying SCOPE.
+ Returns the name/type pair found into the CPLUS_BINDING RESULT,
or 0 on error. */
int
@@ -4572,9 +4297,11 @@ qualified_lookup_using_namespace (name, scope, result, flags)
/* ... and a list of namespace yet to see. */
tree todo = NULL_TREE;
tree usings;
+ /* Look through namespace aliases. */
+ scope = ORIGINAL_NAMESPACE (scope);
while (scope && (result != error_mark_node))
{
- seen = temp_tree_cons (scope, NULL_TREE, seen);
+ seen = tree_cons (scope, NULL_TREE, seen);
result = ambiguous_decl (name, result,
binding_for_name (name, scope), flags);
if (!BINDING_VALUE (result) && !BINDING_TYPE (result))
@@ -4584,7 +4311,7 @@ qualified_lookup_using_namespace (name, scope, result, flags)
/* If this was a real directive, and we have not seen it. */
if (!TREE_INDIRECT_USING (usings)
&& !purpose_member (TREE_PURPOSE (usings), seen))
- todo = temp_tree_cons (TREE_PURPOSE (usings), NULL_TREE, todo);
+ todo = tree_cons (TREE_PURPOSE (usings), NULL_TREE, todo);
if (todo)
{
scope = TREE_PURPOSE (todo);
@@ -4608,14 +4335,13 @@ set_decl_namespace (decl, scope, friendp)
int friendp;
{
tree old;
- if (scope == std_node)
- scope = global_namespace;
+
/* Get rid of namespace aliases. */
scope = ORIGINAL_NAMESPACE (scope);
/* It is ok for friends to be qualified in parallel space. */
if (!friendp && !is_namespace_ancestor (current_namespace, scope))
- cp_error ("declaration of `%D' not in a namespace surrounding `%D'",
+ error ("declaration of `%D' not in a namespace surrounding `%D'",
decl, scope);
DECL_CONTEXT (decl) = FROB_CONTEXT (scope);
if (scope != current_namespace)
@@ -4625,6 +4351,9 @@ set_decl_namespace (decl, scope, friendp)
if (!old)
/* No old declaration at all. */
goto complain;
+ /* A template can be explicitly specialized in any namespace. */
+ if (processing_explicit_instantiation)
+ return;
if (!is_overloaded_fn (decl))
/* Don't compare non-function decls with decls_match here,
since it can't check for the correct constness at this
@@ -4646,7 +4375,7 @@ set_decl_namespace (decl, scope, friendp)
else
return;
complain:
- cp_error ("`%D' should have been declared inside `%D'",
+ error ("`%D' should have been declared inside `%D'",
decl, scope);
}
@@ -4656,14 +4385,16 @@ static tree
decl_namespace (decl)
tree decl;
{
+ if (TYPE_P (decl))
+ decl = TYPE_STUB_DECL (decl);
while (DECL_CONTEXT (decl))
{
decl = DECL_CONTEXT (decl);
if (TREE_CODE (decl) == NAMESPACE_DECL)
return decl;
- if (TREE_CODE_CLASS (TREE_CODE (decl)) == 't')
+ if (TYPE_P (decl))
decl = TYPE_STUB_DECL (decl);
- my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd', 390);
+ my_friendly_assert (DECL_P (decl), 390);
}
return global_namespace;
@@ -4696,7 +4427,8 @@ push_decl_namespace (decl)
{
if (TREE_CODE (decl) != NAMESPACE_DECL)
decl = decl_namespace (decl);
- decl_namespace_list = tree_cons (decl, NULL_TREE, decl_namespace_list);
+ decl_namespace_list = tree_cons (ORIGINAL_NAMESPACE (decl),
+ NULL_TREE, decl_namespace_list);
}
void
@@ -4741,12 +4473,13 @@ struct arg_lookup
tree functions;
};
-static int arg_assoc PROTO((struct arg_lookup*, tree));
-static int arg_assoc_args PROTO((struct arg_lookup*, tree));
-static int arg_assoc_type PROTO((struct arg_lookup*, tree));
-static int add_function PROTO((struct arg_lookup *, tree));
-static int arg_assoc_namespace PROTO((struct arg_lookup *, tree));
-static int arg_assoc_class PROTO((struct arg_lookup *, tree));
+static int arg_assoc PARAMS ((struct arg_lookup*, tree));
+static int arg_assoc_args PARAMS ((struct arg_lookup*, tree));
+static int arg_assoc_type PARAMS ((struct arg_lookup*, tree));
+static int add_function PARAMS ((struct arg_lookup *, tree));
+static int arg_assoc_namespace PARAMS ((struct arg_lookup *, tree));
+static int arg_assoc_class PARAMS ((struct arg_lookup *, tree));
+static int arg_assoc_template_arg PARAMS ((struct arg_lookup*, tree));
/* Add a function to the lookup structure.
Returns 1 on error. */
@@ -4756,28 +4489,32 @@ add_function (k, fn)
struct arg_lookup *k;
tree fn;
{
- if (ovl_member (fn, k->functions))
- return 0;
+ /* We used to check here to see if the function was already in the list,
+ but that's O(n^2), which is just too expensive for function lookup.
+ Now we deal with the occasional duplicate in joust. In doing this, we
+ assume that the number of duplicates will be small compared to the
+ total number of functions being compared, which should usually be the
+ case. */
+
/* We must find only functions, or exactly one non-function. */
- if (k->functions && is_overloaded_fn (k->functions)
- && is_overloaded_fn (fn))
+ if (!k->functions)
+ k->functions = fn;
+ else if (is_overloaded_fn (k->functions) && is_overloaded_fn (fn))
k->functions = build_overload (fn, k->functions);
- else
- if(k->functions)
- {
- tree f1 = OVL_CURRENT (k->functions);
- tree f2 = fn;
- if (is_overloaded_fn (f1))
- {
- fn = f1; f1 = f2; f2 = fn;
- }
- cp_error_at ("`%D' is not a function,", f1);
- cp_error_at (" conflict with `%D'", f2);
- cp_error (" in call to `%D'", k->name);
- return 1;
- }
- else
- k->functions = fn;
+ else
+ {
+ tree f1 = OVL_CURRENT (k->functions);
+ tree f2 = fn;
+ if (is_overloaded_fn (f1))
+ {
+ fn = f1; f1 = f2; f2 = fn;
+ }
+ cp_error_at ("`%D' is not a function,", f1);
+ cp_error_at (" conflict with `%D'", f2);
+ error (" in call to `%D'", k->name);
+ return 1;
+ }
+
return 0;
}
@@ -4798,7 +4535,7 @@ arg_assoc_namespace (k, scope)
value = namespace_binding (k->name, scope);
if (!value)
return 0;
-
+
for (; value; value = OVL_NEXT (value))
if (add_function (k, OVL_CURRENT (value)))
return 1;
@@ -4806,6 +4543,49 @@ arg_assoc_namespace (k, scope)
return 0;
}
+/* Adds everything associated with a template argument to the lookup
+ structure. Returns 1 on error. */
+
+static int
+arg_assoc_template_arg (k, arg)
+ struct arg_lookup* k;
+ tree arg;
+{
+ /* [basic.lookup.koenig]
+
+ If T is a template-id, its associated namespaces and classes are
+ ... the namespaces and classes associated with the types of the
+ template arguments provided for template type parameters
+ (excluding template template parameters); the namespaces in which
+ any template template arguments are defined; and the classes in
+ which any member templates used as template template arguments
+ are defined. [Note: non-type template arguments do not
+ contribute to the set of associated namespaces. ] */
+
+ /* Consider first template template arguments. */
+ if (TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM
+ || TREE_CODE (arg) == UNBOUND_CLASS_TEMPLATE)
+ return 0;
+ else if (TREE_CODE (arg) == TEMPLATE_DECL)
+ {
+ tree ctx = CP_DECL_CONTEXT (arg);
+
+ /* It's not a member template. */
+ if (TREE_CODE (ctx) == NAMESPACE_DECL)
+ return arg_assoc_namespace (k, ctx);
+ /* Otherwise, it must be member template. */
+ else
+ return arg_assoc_class (k, ctx);
+ }
+ /* It's not a template template argument, but it is a type template
+ argument. */
+ else if (TYPE_P (arg))
+ return arg_assoc_type (k, arg);
+ /* It's a non-type template argument. */
+ else
+ return 0;
+}
+
/* Adds everything associated with class to the lookup structure.
Returns 1 on error. */
@@ -4817,6 +4597,11 @@ arg_assoc_class (k, type)
tree list, friends, context;
int i;
+ /* Backend build structures, such as __builtin_va_list, aren't
+ affected by all this. */
+ if (!CLASS_TYPE_P (type))
+ return 0;
+
if (purpose_member (type, k->classes))
return 0;
k->classes = tree_cons (type, NULL_TREE, k->classes);
@@ -4838,17 +4623,17 @@ arg_assoc_class (k, type)
friends = TREE_CHAIN (friends))
/* Only interested in global functions with potentially hidden
(i.e. unqualified) declarations. */
- if (TREE_PURPOSE (list) == error_mark_node && TREE_VALUE (list)
- && decl_namespace (TREE_VALUE (list)) == context)
- if (add_function (k, TREE_VALUE (list)))
+ if (TREE_PURPOSE (friends) == error_mark_node && TREE_VALUE (friends)
+ && decl_namespace (TREE_VALUE (friends)) == context)
+ if (add_function (k, TREE_VALUE (friends)))
return 1;
/* Process template arguments. */
if (CLASSTYPE_TEMPLATE_INFO (type))
{
- list = innermost_args (CLASSTYPE_TI_ARGS (type));
- for (i = 0; i < TREE_VEC_LENGTH (list); ++i)
- arg_assoc (k, TREE_VEC_ELT (list, i));
+ list = INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (type));
+ for (i = 0; i < TREE_VEC_LENGTH (list); ++i)
+ arg_assoc_template_arg (k, TREE_VEC_ELT (list, i));
}
return 0;
@@ -4868,6 +4653,7 @@ arg_assoc_type (k, type)
case INTEGER_TYPE:
case REAL_TYPE:
case COMPLEX_TYPE:
+ case VECTOR_TYPE:
case CHAR_TYPE:
case BOOLEAN_TYPE:
return 0;
@@ -4897,14 +4683,16 @@ arg_assoc_type (k, type)
/* Associate the return type. */
return arg_assoc_type (k, TREE_TYPE (type));
case TEMPLATE_TYPE_PARM:
- case TEMPLATE_TEMPLATE_PARM:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
+ return 0;
+ case TYPENAME_TYPE:
return 0;
case LANG_TYPE:
if (type == unknown_type_node)
return 0;
/* else fall through */
default:
- my_friendly_abort (390);
+ abort ();
}
return 0;
}
@@ -4932,7 +4720,7 @@ arg_assoc (k, n)
if (n == error_mark_node)
return 0;
- if (TREE_CODE_CLASS (TREE_CODE (n)) == 't')
+ if (TYPE_P (n))
return arg_assoc_type (k, n);
if (! type_unknown_p (n))
@@ -4955,19 +4743,15 @@ arg_assoc (k, n)
If T is a template-id, its associated namespaces and classes
are the namespace in which the template is defined; for
- member templates, the member template's class; the namespaces
- and classes associated with the types of the template
- arguments provided for template type parameters (excluding
- template template parameters); the namespaces in which any
- template template arguments are defined; and the classes in
- which any member templates used as template template
- arguments are defined. [Note: non-type template arguments do
- not contribute to the set of associated namespaces. ] */
+ member templates, the member template's class... */
tree template = TREE_OPERAND (n, 0);
tree args = TREE_OPERAND (n, 1);
tree ctx;
tree arg;
+ if (TREE_CODE (template) == COMPONENT_REF)
+ template = TREE_OPERAND (template, 1);
+
/* First, the template. There may actually be more than one if
this is an overloaded function template. But, in that case,
we only need the first; all the functions will be in the same
@@ -4987,24 +4771,8 @@ arg_assoc (k, n)
/* Now the arguments. */
for (arg = args; arg != NULL_TREE; arg = TREE_CHAIN (arg))
- {
- tree t = TREE_VALUE (arg);
-
- if (TREE_CODE (t) == TEMPLATE_DECL)
- {
- ctx = CP_DECL_CONTEXT (t);
- if (TREE_CODE (ctx) == NAMESPACE_DECL)
- {
- if (arg_assoc_namespace (k, ctx) == 1)
- return 1;
- }
- else if (arg_assoc_class (k, ctx) == 1)
- return 1;
- }
- else if (TREE_CODE_CLASS (TREE_CODE (t)) == 't'
- && arg_assoc_type (k, t) == 1)
- return 1;
- }
+ if (arg_assoc_template_arg (k, TREE_VALUE (arg)) == 1)
+ return 1;
}
else
{
@@ -5028,22 +4796,22 @@ lookup_arg_dependent (name, fns, args)
tree args;
{
struct arg_lookup k;
+ tree fn = NULL_TREE;
k.name = name;
k.functions = fns;
k.classes = NULL_TREE;
- /* Note that we've already looked at the current namespace during normal
+ /* Note that we've already looked at some namespaces during normal
unqualified lookup, unless we found a decl in function scope. */
- if (fns && ! TREE_PERMANENT (OVL_CURRENT (fns)))
+ if (fns)
+ fn = OVL_CURRENT (fns);
+ if (fn && TREE_CODE (fn) == FUNCTION_DECL && DECL_LOCAL_FUNCTION_P (fn))
k.namespaces = NULL_TREE;
else
- k.namespaces = scratch_tree_cons (current_decl_namespace (),
- NULL_TREE, NULL_TREE);
+ unqualified_namespace_lookup (name, 0, &k.namespaces);
- push_scratch_obstack ();
arg_assoc_args (&k, args);
- pop_obstacks ();
return k.functions;
}
@@ -5056,7 +4824,7 @@ do_namespace_alias (alias, namespace)
if (TREE_CODE (namespace) != NAMESPACE_DECL)
{
/* The parser did not find it, so it's not there. */
- cp_error ("unknown namespace `%D'", namespace);
+ error ("unknown namespace `%D'", namespace);
return;
}
@@ -5077,39 +4845,34 @@ validate_nonmember_using_decl (decl, scope, name)
tree *scope;
tree *name;
{
- if (TREE_CODE (decl) == SCOPE_REF
- && TREE_OPERAND (decl, 0) == std_node)
- {
- if (namespace_bindings_p ()
- && current_namespace == global_namespace)
- /* There's no need for a using declaration at all, here,
- since `std' is the same as `::'. We can't just pass this
- on because we'll complain later about declaring something
- in the same scope as a using declaration with the same
- name. We return NULL_TREE which indicates to the caller
- that there's no need to do any further processing. */
- return NULL_TREE;
-
- *scope = global_namespace;
- *name = TREE_OPERAND (decl, 1);
- }
- else if (TREE_CODE (decl) == SCOPE_REF)
+ if (TREE_CODE (decl) == SCOPE_REF)
{
*scope = TREE_OPERAND (decl, 0);
*name = TREE_OPERAND (decl, 1);
- /* [namespace.udecl]
-
- A using-declaration for a class member shall be a
- member-declaration. */
- if (TREE_CODE (*scope) != NAMESPACE_DECL)
- {
- if (TYPE_P (*scope))
- cp_error ("`%T' is not a namespace", *scope);
- else
- cp_error ("`%D' is not a namespace", *scope);
- return NULL_TREE;
- }
+ if (!processing_template_decl)
+ {
+ /* [namespace.udecl]
+ A using-declaration for a class member shall be a
+ member-declaration. */
+ if(TREE_CODE (*scope) != NAMESPACE_DECL)
+ {
+ if (TYPE_P (*scope))
+ error ("`%T' is not a namespace", *scope);
+ else
+ error ("`%D' is not a namespace", *scope);
+ return NULL_TREE;
+ }
+
+ /* 7.3.3/5
+ A using-declaration shall not name a template-id. */
+ if (TREE_CODE (*name) == TEMPLATE_ID_EXPR)
+ {
+ *name = TREE_OPERAND (*name, 0);
+ error ("a using-declaration cannot specify a template-id. Try `using %D'", *name);
+ return NULL_TREE;
+ }
+ }
}
else if (TREE_CODE (decl) == IDENTIFIER_NODE
|| TREE_CODE (decl) == TYPE_DECL
@@ -5118,9 +4881,14 @@ validate_nonmember_using_decl (decl, scope, name)
*scope = global_namespace;
*name = decl;
}
+ else if (TREE_CODE (decl) == NAMESPACE_DECL)
+ {
+ error ("namespace `%D' not allowed in using-declaration", decl);
+ return NULL_TREE;
+ }
else
- my_friendly_abort (382);
- if (TREE_CODE_CLASS (TREE_CODE (*name)) == 'd')
+ abort ();
+ if (DECL_P (*name))
*name = DECL_NAME (*name);
/* Make a USING_DECL. */
return push_using_decl (*scope, *name);
@@ -5135,17 +4903,16 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
tree *newval, *newtype;
{
tree decls;
- struct tree_binding _decls;
*newval = *newtype = NULL_TREE;
- decls = binding_init (&_decls);
+ decls = make_node (CPLUS_BINDING);
if (!qualified_lookup_using_namespace (name, scope, decls, 0))
/* Lookup error */
return;
if (!BINDING_VALUE (decls) && !BINDING_TYPE (decls))
{
- cp_error ("`%D' not declared", name);
+ error ("`%D' not declared", name);
return;
}
@@ -5175,20 +4942,21 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
{
tree old_fn = OVL_CURRENT (tmp1);
- if (!OVL_USED (tmp1)
- && compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)),
- TYPE_ARG_TYPES (TREE_TYPE (old_fn))))
+ if (new_fn == old_fn)
+ /* The function already exists in the current namespace. */
+ break;
+ else if (OVL_USED (tmp1))
+ continue; /* this is a using decl */
+ else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)),
+ TYPE_ARG_TYPES (TREE_TYPE (old_fn))))
{
- /* There was already a non-using declaration in
- this scope with the same parameter types. */
- cp_error ("`%D' is already declared in this scope",
- name);
+ /* There was already a non-using declaration in
+ this scope with the same parameter types. If both
+ are the same extern "C" functions, that's ok. */
+ if (!decls_match (new_fn, old_fn))
+ error ("`%D' is already declared in this scope", name);
break;
}
- else if (duplicate_decls (new_fn, old_fn))
- /* We're re-using something we already used
- before. We don't need to add it again. */
- break;
}
/* If we broke out of the loop, there's no reason to add
@@ -5213,7 +4981,7 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
*newtype = BINDING_TYPE (decls);
if (oldtype && *newtype && oldtype != *newtype)
{
- cp_error ("using directive `%D' introduced ambiguous type `%T'",
+ error ("using declaration `%D' introduced ambiguous type `%T'",
name, oldtype);
return;
}
@@ -5260,6 +5028,10 @@ do_local_using_decl (decl)
if (decl == NULL_TREE)
return;
+ if (building_stmt_tree ()
+ && at_function_scope_p ())
+ add_decl_stmt (decl);
+
oldval = lookup_name_current_level (name);
oldtype = lookup_type_current_level (name);
@@ -5298,23 +5070,29 @@ do_class_using_decl (decl)
tree name, value;
if (TREE_CODE (decl) != SCOPE_REF
- || TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (decl, 0))) != 't')
+ || !TYPE_P (TREE_OPERAND (decl, 0)))
{
- cp_error ("using-declaration for non-member at class scope");
+ error ("using-declaration for non-member at class scope");
return NULL_TREE;
}
name = TREE_OPERAND (decl, 1);
if (TREE_CODE (name) == BIT_NOT_EXPR)
{
- cp_error ("using-declaration for destructor");
+ error ("using-declaration for destructor");
+ return NULL_TREE;
+ }
+ else if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
+ {
+ name = TREE_OPERAND (name, 0);
+ error ("a using-declaration cannot specify a template-id. Try `using %T::%D'", TREE_OPERAND (decl, 0), name);
return NULL_TREE;
}
- if (TREE_CODE (name) == TYPE_DECL)
+ if (TREE_CODE (name) == TYPE_DECL || TREE_CODE (name) == TEMPLATE_DECL)
name = DECL_NAME (name);
my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 980716);
- value = build_lang_field_decl (USING_DECL, name, void_type_node);
+ value = build_lang_decl (USING_DECL, name, void_type_node);
DECL_INITIAL (value) = TREE_OPERAND (decl, 0);
return value;
}
@@ -5325,20 +5103,23 @@ void
do_using_directive (namespace)
tree namespace;
{
- if (namespace == std_node)
- return;
+ if (building_stmt_tree ())
+ add_stmt (build_stmt (USING_STMT, namespace));
+
/* using namespace A::B::C; */
if (TREE_CODE (namespace) == SCOPE_REF)
namespace = TREE_OPERAND (namespace, 1);
if (TREE_CODE (namespace) == IDENTIFIER_NODE)
{
/* Lookup in lexer did not find a namespace. */
- cp_error ("namespace `%T' undeclared", namespace);
+ if (!processing_template_decl)
+ error ("namespace `%T' undeclared", namespace);
return;
}
if (TREE_CODE (namespace) != NAMESPACE_DECL)
{
- cp_error ("`%T' is not a namespace", namespace);
+ if (!processing_template_decl)
+ error ("`%T' is not a namespace", namespace);
return;
}
namespace = ORIGINAL_NAMESPACE (namespace);
@@ -5378,59 +5159,127 @@ mark_used (decl)
assemble_external (decl);
/* Is it a synthesized method that needs to be synthesized? */
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_CLASS_CONTEXT (decl)
- && DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl)
+ if (TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
+ && DECL_ARTIFICIAL (decl)
+ && ! DECL_INITIAL (decl)
/* Kludge: don't synthesize for default args. */
&& current_function_decl)
- synthesize_method (decl);
+ {
+ synthesize_method (decl);
+ /* If we've already synthesized the method we don't need to
+ instantiate it, so we can return right away. */
+ return;
+ }
/* If this is a function or variable that is an instance of some
template, we now know that we will need to actually do the
- instantiation. A TEMPLATE_DECL may also have DECL_TEMPLATE_INFO,
- if it's a partial instantiation, but there's no need to
- instantiate such a thing. We check that DECL is not an explicit
+ instantiation. We check that DECL is not an explicit
instantiation because that is not checked in instantiate_decl. */
- if (TREE_CODE (decl) != TEMPLATE_DECL
+ if ((DECL_NON_THUNK_FUNCTION_P (decl) || TREE_CODE (decl) == VAR_DECL)
&& DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)
- && !DECL_EXPLICIT_INSTANTIATION (decl))
- instantiate_decl (decl);
+ && (!DECL_EXPLICIT_INSTANTIATION (decl)
+ || (TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl))))
+ instantiate_decl (decl, /*defer_ok=*/1);
}
-/* Helper function for named_class_head_sans_basetype nonterminal. We
- have just seen something of the form `AGGR SCOPE::ID'. Return a
- TYPE_DECL for the type declared by ID in SCOPE. */
+/* Helper function for class_head_decl and class_head_defn
+ nonterminals. AGGR is the class, union or struct tag. SCOPE is the
+ explicit scope used (NULL for no scope resolution). ID is the
+ name. DEFN_P is true, if this is a definition of the class and
+ NEW_TYPE_P is set to non-zero, if we push into the scope containing
+ the to be defined aggregate.
+
+ Return a TYPE_DECL for the type declared by ID in SCOPE. */
tree
-handle_class_head (aggr, scope, id)
+handle_class_head (aggr, scope, id, defn_p, new_type_p)
tree aggr, scope, id;
+ int defn_p;
+ int *new_type_p;
{
- tree decl;
+ tree decl = NULL_TREE;
+ tree current = current_scope ();
+ bool xrefd_p = false;
+
+ if (current == NULL_TREE)
+ current = current_namespace;
- if (TREE_CODE (id) == TYPE_DECL)
- decl = id;
- else if (DECL_CLASS_TEMPLATE_P (id))
- decl = DECL_TEMPLATE_RESULT (id);
- else
+ *new_type_p = 0;
+
+ if (scope)
{
- if (scope)
- cp_error ("`%T' does not have a nested type named `%D'", scope, id);
+ if (TREE_CODE (id) == TYPE_DECL)
+ /* We must bash typedefs back to the main decl of the
+ type. Otherwise we become confused about scopes. */
+ decl = TYPE_MAIN_DECL (TREE_TYPE (id));
+ else if (DECL_CLASS_TEMPLATE_P (id))
+ decl = DECL_TEMPLATE_RESULT (id);
else
- cp_error ("no file-scope type named `%D'", id);
-
- decl = TYPE_MAIN_DECL (xref_tag (aggr, make_anon_name (), 1));
+ {
+ if (TYPE_P (scope))
+ {
+ /* According to the suggested resolution of core issue
+ 180, 'typename' is assumed after a class-key. */
+ decl = make_typename_type (scope, id, 1);
+ if (decl != error_mark_node)
+ decl = TYPE_MAIN_DECL (decl);
+ else
+ decl = NULL_TREE;
+ }
+ else if (scope == current)
+ {
+ /* We've been given AGGR SCOPE::ID, when we're already
+ inside SCOPE. Be nice about it. */
+ if (pedantic)
+ pedwarn ("extra qualification `%T::' on member `%D' ignored",
+ scope, id);
+ }
+ else
+ error ("`%T' does not have a class or union named `%D'",
+ scope, id);
+ }
+ }
+
+ if (!decl)
+ {
+ decl = TYPE_MAIN_DECL (xref_tag (aggr, id, !defn_p));
+ xrefd_p = true;
}
- /* This syntax is only allowed when we're defining a type, so we
- enter the SCOPE. */
- push_scope (CP_DECL_CONTEXT (decl));
+ if (!TYPE_BINFO (TREE_TYPE (decl)))
+ {
+ error ("`%T' is not a class or union type", decl);
+ return error_mark_node;
+ }
+
+ if (defn_p)
+ {
+ /* For a definition, we want to enter the containing scope
+ before looking up any base classes etc. Only do so, if this
+ is different to the current scope. */
+ tree context = CP_DECL_CONTEXT (decl);
+
+ *new_type_p = current != context;
+ if (*new_type_p)
+ push_scope (context);
+
+ if (!xrefd_p && PROCESSING_REAL_TEMPLATE_DECL_P ())
+ decl = push_template_decl (decl);
+ }
- /* If we see something like:
+ return decl;
+}
- template <typename T> struct S::I ....
-
- we must create a TEMPLATE_DECL for the nested type. */
- if (PROCESSING_REAL_TEMPLATE_DECL_P ())
- decl = push_template_decl (decl);
+/* Initialize decl2.c. */
- return decl;
+void
+init_decl2 ()
+{
+ ggc_add_tree_varray_root (&deferred_fns, 1);
+ ggc_add_tree_varray_root (&pending_statics, 1);
+ ggc_add_tree_varray_root (&ssdf_decls, 1);
+ ggc_add_tree_root (&ssdf_decl, 1);
+ ggc_add_tree_root (&priority_decl, 1);
+ ggc_add_tree_root (&initialize_p_decl, 1);
}
diff --git a/contrib/gcc/cp/dump.c b/contrib/gcc/cp/dump.c
new file mode 100644
index 0000000..98c1fc4
--- /dev/null
+++ b/contrib/gcc/cp/dump.c
@@ -0,0 +1,440 @@
+/* Tree-dumping functionality for intermediate representation.
+ Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+ Written by Mark Mitchell <mark@codesourcery.com>
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "tree.h"
+#include "cp-tree.h"
+#include "tree-dump.h"
+
+static void dump_access
+ PARAMS ((dump_info_p, tree));
+
+static void dump_op
+ PARAMS ((dump_info_p, tree));
+
+/* Dump a representation of the accessibility information associated
+ with T. */
+
+static void
+dump_access (di, t)
+ dump_info_p di;
+ tree t;
+{
+ if (TREE_PROTECTED(t))
+ dump_string (di, "protected");
+ else if (TREE_PRIVATE(t))
+ dump_string (di, "private");
+ else
+ dump_string (di, "public");
+}
+
+/* Dump a representation of the specific operator for an overloaded
+ operator associated with node t.
+*/
+
+static void
+dump_op (di, t)
+ dump_info_p di;
+ tree t;
+{
+ switch (DECL_OVERLOADED_OPERATOR_P (t)) {
+ case NEW_EXPR:
+ dump_string (di, "new");
+ break;
+ case VEC_NEW_EXPR:
+ dump_string (di, "vecnew");
+ break;
+ case DELETE_EXPR:
+ dump_string (di, "delete");
+ break;
+ case VEC_DELETE_EXPR:
+ dump_string (di, "vecdelete");
+ break;
+ case CONVERT_EXPR:
+ dump_string (di, "pos");
+ break;
+ case NEGATE_EXPR:
+ dump_string (di, "neg");
+ break;
+ case ADDR_EXPR:
+ dump_string (di, "addr");
+ break;
+ case INDIRECT_REF:
+ dump_string(di, "deref");
+ break;
+ case BIT_NOT_EXPR:
+ dump_string(di, "not");
+ break;
+ case TRUTH_NOT_EXPR:
+ dump_string(di, "lnot");
+ break;
+ case PREINCREMENT_EXPR:
+ dump_string(di, "preinc");
+ break;
+ case PREDECREMENT_EXPR:
+ dump_string(di, "predec");
+ break;
+ case PLUS_EXPR:
+ if (DECL_ASSIGNMENT_OPERATOR_P (t))
+ dump_string (di, "plusassign");
+ else
+ dump_string(di, "plus");
+ break;
+ case MINUS_EXPR:
+ if (DECL_ASSIGNMENT_OPERATOR_P (t))
+ dump_string (di, "minusassign");
+ else
+ dump_string(di, "minus");
+ break;
+ case MULT_EXPR:
+ if (DECL_ASSIGNMENT_OPERATOR_P (t))
+ dump_string (di, "multassign");
+ else
+ dump_string (di, "mult");
+ break;
+ case TRUNC_DIV_EXPR:
+ if (DECL_ASSIGNMENT_OPERATOR_P (t))
+ dump_string (di, "divassign");
+ else
+ dump_string (di, "div");
+ break;
+ case TRUNC_MOD_EXPR:
+ if (DECL_ASSIGNMENT_OPERATOR_P (t))
+ dump_string (di, "modassign");
+ else
+ dump_string (di, "mod");
+ break;
+ case BIT_AND_EXPR:
+ if (DECL_ASSIGNMENT_OPERATOR_P (t))
+ dump_string (di, "andassign");
+ else
+ dump_string (di, "and");
+ break;
+ case BIT_IOR_EXPR:
+ if (DECL_ASSIGNMENT_OPERATOR_P (t))
+ dump_string (di, "orassign");
+ else
+ dump_string (di, "or");
+ break;
+ case BIT_XOR_EXPR:
+ if (DECL_ASSIGNMENT_OPERATOR_P (t))
+ dump_string (di, "xorassign");
+ else
+ dump_string (di, "xor");
+ break;
+ case LSHIFT_EXPR:
+ if (DECL_ASSIGNMENT_OPERATOR_P (t))
+ dump_string (di, "lshiftassign");
+ else
+ dump_string (di, "lshift");
+ break;
+ case RSHIFT_EXPR:
+ if (DECL_ASSIGNMENT_OPERATOR_P (t))
+ dump_string (di, "rshiftassign");
+ else
+ dump_string (di, "rshift");
+ break;
+ case EQ_EXPR:
+ dump_string (di, "eq");
+ break;
+ case NE_EXPR:
+ dump_string (di, "ne");
+ break;
+ case LT_EXPR:
+ dump_string (di, "lt");
+ break;
+ case GT_EXPR:
+ dump_string (di, "gt");
+ break;
+ case LE_EXPR:
+ dump_string (di, "le");
+ break;
+ case GE_EXPR:
+ dump_string (di, "ge");
+ break;
+ case TRUTH_ANDIF_EXPR:
+ dump_string (di, "land");
+ break;
+ case TRUTH_ORIF_EXPR:
+ dump_string (di, "lor");
+ break;
+ case COMPOUND_EXPR:
+ dump_string (di, "compound");
+ break;
+ case MEMBER_REF:
+ dump_string (di, "memref");
+ break;
+ case COMPONENT_REF:
+ dump_string (di, "ref");
+ break;
+ case ARRAY_REF:
+ dump_string (di, "subs");
+ break;
+ case POSTINCREMENT_EXPR:
+ dump_string (di, "postinc");
+ break;
+ case POSTDECREMENT_EXPR:
+ dump_string (di, "postdec");
+ break;
+ case CALL_EXPR:
+ dump_string (di, "call");
+ break;
+ case NOP_EXPR:
+ if (DECL_ASSIGNMENT_OPERATOR_P (t))
+ dump_string (di, "assign");
+ break;
+ default:
+ break;
+ }
+}
+
+int
+cp_dump_tree (dump_info, t)
+ void *dump_info;
+ tree t;
+{
+ enum tree_code code;
+ dump_info_p di = (dump_info_p) dump_info;
+
+ /* Figure out what kind of node this is. */
+ code = TREE_CODE (t);
+
+ if (DECL_P (t))
+ {
+ if (DECL_LANG_SPECIFIC (t) && DECL_LANGUAGE (t) != lang_cplusplus)
+ dump_string (di, language_to_string (DECL_LANGUAGE (t), 0));
+ }
+
+ switch (code)
+ {
+ case IDENTIFIER_NODE:
+ if (IDENTIFIER_OPNAME_P (t))
+ {
+ dump_string (di, "operator");
+ return 1;
+ }
+ else if (IDENTIFIER_TYPENAME_P (t))
+ {
+ dump_child ("tynm", TREE_TYPE (t));
+ return 1;
+ }
+ else if (t == anonymous_namespace_name)
+ {
+ dump_string (di, "unnamed");
+ return 1;
+ }
+ break;
+
+ case POINTER_TYPE:
+ if (TYPE_PTRMEM_P (t))
+ {
+ dump_string (di, "ptrmem");
+ dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
+ dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
+ return 1;
+ }
+ break;
+
+ case RECORD_TYPE:
+ case UNION_TYPE:
+ if (TYPE_PTRMEMFUNC_P (t))
+ {
+ dump_string (di, "ptrmem");
+ dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
+ dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
+ return 1;
+ }
+
+ dump_child ("vfld", TYPE_VFIELD (t));
+ if (CLASSTYPE_TEMPLATE_SPECIALIZATION(t))
+ dump_string(di, "spec");
+
+ if (!dump_flag (di, TDF_SLIM, t))
+ {
+ int i;
+
+ for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); ++i)
+ {
+ tree base_binfo = BINFO_BASETYPE (TYPE_BINFO (t), i);
+ dump_child ("base", BINFO_TYPE (base_binfo));
+ if (TREE_VIA_VIRTUAL (base_binfo))
+ dump_string (di, "virtual");
+ dump_access (di, base_binfo);
+ }
+ }
+ break;
+
+ case FIELD_DECL:
+ dump_access (di, t);
+ if (DECL_MUTABLE_P (t))
+ dump_string(di, "mutable");
+ break;
+
+ case VAR_DECL:
+ if (TREE_CODE (CP_DECL_CONTEXT (t)) == RECORD_TYPE)
+ dump_access (di, t);
+ if (TREE_STATIC (t) && !TREE_PUBLIC (t))
+ dump_string (di, "static");
+ break;
+
+ case FUNCTION_DECL:
+ if (!DECL_THUNK_P (t))
+ {
+ if (DECL_OVERLOADED_OPERATOR_P (t)) {
+ dump_string (di, "operator");
+ dump_op (di, t);
+ }
+ if (DECL_FUNCTION_MEMBER_P (t))
+ {
+ dump_string (di, "member");
+ dump_access (di, t);
+ }
+ if (DECL_PURE_VIRTUAL_P (t))
+ dump_string (di, "pure");
+ if (DECL_VIRTUAL_P (t))
+ dump_string (di, "virtual");
+ if (DECL_CONSTRUCTOR_P (t))
+ dump_string (di, "constructor");
+ if (DECL_DESTRUCTOR_P (t))
+ dump_string (di, "destructor");
+ if (DECL_CONV_FN_P (t))
+ dump_string (di, "conversion");
+ if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t))
+ {
+ if (DECL_GLOBAL_CTOR_P (t))
+ dump_string (di, "global init");
+ if (DECL_GLOBAL_DTOR_P (t))
+ dump_string (di, "global fini");
+ dump_int (di, "prio", GLOBAL_INIT_PRIORITY (t));
+ }
+ if (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t))
+ dump_string (di, "pseudo tmpl");
+ }
+ else
+ {
+ dump_string (di, "thunk");
+ dump_int (di, "dlta", THUNK_DELTA (t));
+ dump_child ("vcll", THUNK_VCALL_OFFSET (t));
+ dump_child ("fn", DECL_INITIAL (t));
+ }
+ break;
+
+ case NAMESPACE_DECL:
+ if (DECL_NAMESPACE_ALIAS (t))
+ dump_child ("alis", DECL_NAMESPACE_ALIAS (t));
+ else if (!dump_flag (di, TDF_SLIM, t))
+ dump_child ("dcls", cp_namespace_decls (t));
+ break;
+
+ case TEMPLATE_DECL:
+ dump_child ("rslt", DECL_TEMPLATE_RESULT (t));
+ dump_child ("inst", DECL_TEMPLATE_INSTANTIATIONS (t));
+ dump_child ("spcs", DECL_TEMPLATE_SPECIALIZATIONS (t));
+ dump_child ("prms", DECL_TEMPLATE_PARMS (t));
+ break;
+
+ case OVERLOAD:
+ dump_child ("crnt", OVL_CURRENT (t));
+ dump_child ("chan", OVL_CHAIN (t));
+ break;
+
+ case TRY_BLOCK:
+ dump_stmt (di, t);
+ if (CLEANUP_P (t))
+ dump_string (di, "cleanup");
+ dump_child ("body", TRY_STMTS (t));
+ dump_child ("hdlr", TRY_HANDLERS (t));
+ dump_next_stmt (di, t);
+ break;
+
+ case EH_SPEC_BLOCK:
+ dump_stmt (di, t);
+ dump_child ("body", EH_SPEC_STMTS (t));
+ dump_child ("raises", EH_SPEC_RAISES (t));
+ dump_next_stmt (di, t);
+ break;
+
+ case PTRMEM_CST:
+ dump_child ("clas", PTRMEM_CST_CLASS (t));
+ dump_child ("mbr", PTRMEM_CST_MEMBER (t));
+ break;
+
+ case THROW_EXPR:
+ /* These nodes are unary, but do not have code class `1'. */
+ dump_child ("op 0", TREE_OPERAND (t, 0));
+ break;
+
+ case AGGR_INIT_EXPR:
+ dump_int (di, "ctor", AGGR_INIT_VIA_CTOR_P (t));
+ dump_child ("fn", TREE_OPERAND (t, 0));
+ dump_child ("args", TREE_OPERAND (t, 1));
+ dump_child ("decl", TREE_OPERAND (t, 2));
+ break;
+
+ case CLEANUP_STMT:
+ dump_stmt (di, t);
+ dump_child ("decl", CLEANUP_DECL (t));
+ dump_child ("expr", CLEANUP_EXPR (t));
+ dump_next_stmt (di, t);
+ break;
+
+ case CTOR_STMT:
+ dump_stmt (di, t);
+ if (CTOR_BEGIN_P (t))
+ dump_string (di, "begn");
+ else
+ dump_string (di, "end");
+ dump_next_stmt (di, t);
+ break;
+
+ case HANDLER:
+ dump_stmt (di, t);
+ dump_child ("parm", HANDLER_PARMS (t));
+ dump_child ("body", HANDLER_BODY (t));
+ dump_next_stmt (di, t);
+ break;
+
+ case MUST_NOT_THROW_EXPR:
+ dump_stmt (di, t);
+ dump_child ("body", TREE_OPERAND (t, 0));
+ dump_next_stmt (di, t);
+ break;
+
+ case SUBOBJECT:
+ dump_stmt (di, t);
+ dump_child ("clnp", TREE_OPERAND (t, 0));
+ dump_next_stmt (di, t);
+ break;
+
+ case USING_STMT:
+ dump_stmt (di, t);
+ dump_child ("nmsp", USING_STMT_NAMESPACE (t));
+ dump_next_stmt (di, t);
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
diff --git a/contrib/gcc/cp/error.c b/contrib/gcc/cp/error.c
index 4da1d2f..594d4e4 100644
--- a/contrib/gcc/cp/error.c
+++ b/contrib/gcc/cp/error.c
@@ -1,7 +1,7 @@
/* Call-backs for C++ error reporting.
This code is non-reentrant.
- Copyright (C) 1993, 94-97, 1998, 1999 Free Software Foundation, Inc.
-
+ Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002
+ Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
@@ -23,240 +23,373 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "tree.h"
#include "cp-tree.h"
+#include "real.h"
#include "obstack.h"
#include "toplev.h"
-
-typedef char* cp_printer ();
-
-#define A args_as_string
-#define C code_as_string
-#define D decl_as_string
-#define E expr_as_string
-#define F fndecl_as_string
-#define L language_as_string
-#define O op_as_string
-#define P parm_as_string
-#define Q assop_as_string
-#define T type_as_string
-#define V cv_as_string
-
-#define o (cp_printer *) 0
-cp_printer * cp_printers[256] =
-{
-/*0 1 2 3 4 5 6 7 8 9 A B C D E F */
- o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x00 */
- o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x10 */
- o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x20 */
- o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x30 */
- o, A, o, C, D, E, F, o, o, o, o, o, L, o, o, O, /* 0x40 */
- P, Q, o, o, T, o, V, o, o, o, o, o, o, o, o, o, /* 0x50 */
- o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x60 */
- o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x70 */
-};
-#undef C
-#undef D
-#undef E
-#undef F
-#undef L
-#undef O
-#undef P
-#undef Q
-#undef T
-#undef V
-#undef o
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-/* Obstack where we build text strings for overloading, etc. */
-static struct obstack scratch_obstack;
-static char *scratch_firstobj;
-
-# define OB_INIT() (scratch_firstobj ? (obstack_free (&scratch_obstack, scratch_firstobj), 0) : 0)
-# define OB_PUTC(C) (obstack_1grow (&scratch_obstack, (C)))
-# define OB_PUTC2(C1,C2) \
- (obstack_1grow (&scratch_obstack, (C1)), obstack_1grow (&scratch_obstack, (C2)))
-# define OB_PUTS(S) (obstack_grow (&scratch_obstack, (S), sizeof (S) - 1))
-# define OB_PUTID(ID) \
- (obstack_grow (&scratch_obstack, IDENTIFIER_POINTER (ID), \
- IDENTIFIER_LENGTH (ID)))
-# define OB_PUTCP(S) (obstack_grow (&scratch_obstack, (S), strlen (S)))
-# define OB_FINISH() (obstack_1grow (&scratch_obstack, '\0'))
-# define OB_PUTI(CST) do { sprintf (digit_buffer, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)(CST)); \
- OB_PUTCP (digit_buffer); } while (0)
-# define OB_UNPUT(N) obstack_blank (&scratch_obstack, - (N));
-
-# define OB_END_TEMPLATE_ID() \
- ((obstack_next_free (&scratch_obstack) != obstack_base (&scratch_obstack) \
- && obstack_next_free (&scratch_obstack)[-1] == '>') \
- ? OB_PUTC2 (' ', '>') : OB_PUTC ('>'))
-
-# define NEXT_CODE(t) (TREE_CODE (TREE_TYPE (t)))
+#include "flags.h"
+#include "diagnostic.h"
enum pad { none, before, after };
-static void dump_type PROTO((tree, int));
-static void dump_type_real PROTO((tree, int, int));
-static void dump_simple_decl PROTO((tree, tree, int));
-static void dump_decl PROTO((tree, int));
-static void dump_function_decl PROTO((tree, int));
-static void dump_expr PROTO((tree, int));
-static void dump_unary_op PROTO((char *, tree, int));
-static void dump_binary_op PROTO((char *, tree));
-static void dump_aggr_type PROTO((tree, int, int));
-static void dump_type_prefix PROTO((tree, int, int));
-static void dump_type_suffix PROTO((tree, int, int));
-static void dump_function_name PROTO((tree));
-static void dump_expr_list PROTO((tree));
-static void dump_global_iord PROTO((tree));
-static void dump_qualifiers PROTO((tree, enum pad));
-static void dump_char PROTO((int));
-static void dump_parameters PROTO((tree, int, int));
-static void dump_exception_spec PROTO((tree, int));
-static char *aggr_variety PROTO((tree));
-static tree ident_fndecl PROTO((tree));
-static int interesting_scope_p PROTO((tree));
+#define sorry_for_unsupported_tree(T) \
+ sorry ("`%s' not supported by %s", tree_code_name[(int) TREE_CODE (T)], \
+ __FUNCTION__)
+
+#define print_scope_operator(BUFFER) output_add_string ((BUFFER), "::")
+#define print_left_paren(BUFFER) output_add_character ((BUFFER), '(')
+#define print_right_paren(BUFFER) output_add_character ((BUFFER), ')')
+#define print_left_bracket(BUFFER) output_add_character ((BUFFER), '[')
+#define print_right_bracket(BUFFER) output_add_character ((BUFFER), ']')
+#define print_template_argument_list_start(BUFFER) \
+ print_non_consecutive_character ((BUFFER), '<')
+#define print_template_argument_list_end(BUFFER) \
+ print_non_consecutive_character ((BUFFER), '>')
+#define print_whitespace(BUFFER, TFI) \
+ do { \
+ output_add_space (BUFFER); \
+ put_whitespace (TFI) = none; \
+ } while (0)
+#define print_tree_identifier(BUFFER, TID) \
+ output_add_string ((BUFFER), IDENTIFIER_POINTER (TID))
+#define print_identifier(BUFFER, ID) output_add_string ((BUFFER), (ID))
+#define separate_with_comma(BUFFER) output_add_string ((BUFFER), ", ")
+
+/* The global buffer where we dump everything. It is there only for
+ transitional purpose. It is expected, in the near future, to be
+ completely removed. */
+static output_buffer scratch_buffer_rec;
+static output_buffer *scratch_buffer = &scratch_buffer_rec;
+
+# define NEXT_CODE(T) (TREE_CODE (TREE_TYPE (T)))
+
+#define reinit_global_formatting_buffer() \
+ output_clear_message_text (scratch_buffer)
+
+static const char *args_to_string PARAMS ((tree, int));
+static const char *assop_to_string PARAMS ((enum tree_code, int));
+static const char *code_to_string PARAMS ((enum tree_code, int));
+static const char *cv_to_string PARAMS ((tree, int));
+static const char *decl_to_string PARAMS ((tree, int));
+static const char *expr_to_string PARAMS ((tree, int));
+static const char *fndecl_to_string PARAMS ((tree, int));
+static const char *op_to_string PARAMS ((enum tree_code, int));
+static const char *parm_to_string PARAMS ((int, int));
+static const char *type_to_string PARAMS ((tree, int));
+
+static void dump_type PARAMS ((tree, int));
+static void dump_typename PARAMS ((tree, int));
+static void dump_simple_decl PARAMS ((tree, tree, int));
+static void dump_decl PARAMS ((tree, int));
+static void dump_template_decl PARAMS ((tree, int));
+static void dump_function_decl PARAMS ((tree, int));
+static void dump_expr PARAMS ((tree, int));
+static void dump_unary_op PARAMS ((const char *, tree, int));
+static void dump_binary_op PARAMS ((const char *, tree, int));
+static void dump_aggr_type PARAMS ((tree, int));
+static enum pad dump_type_prefix PARAMS ((tree, int));
+static void dump_type_suffix PARAMS ((tree, int));
+static void dump_function_name PARAMS ((tree, int));
+static void dump_expr_list PARAMS ((tree, int));
+static void dump_global_iord PARAMS ((tree));
+static enum pad dump_qualifiers PARAMS ((tree, enum pad));
+static void dump_char PARAMS ((int));
+static void dump_parameters PARAMS ((tree, int));
+static void dump_exception_spec PARAMS ((tree, int));
+static const char *class_key_or_enum PARAMS ((tree));
+static void dump_template_argument PARAMS ((tree, int));
+static void dump_template_argument_list PARAMS ((tree, int));
+static void dump_template_parameter PARAMS ((tree, int));
+static void dump_template_bindings PARAMS ((tree, tree));
+static void dump_scope PARAMS ((tree, int));
+static void dump_template_parms PARAMS ((tree, int, int));
+
+static const char *function_category PARAMS ((tree));
+static void lang_print_error_function PARAMS ((diagnostic_context *,
+ const char *));
+static void maybe_print_instantiation_context PARAMS ((output_buffer *));
+static void print_instantiation_full_context PARAMS ((output_buffer *));
+static void print_instantiation_partial_context PARAMS ((output_buffer *, tree,
+ const char *, int));
+static void cp_diagnostic_starter PARAMS ((output_buffer *,
+ diagnostic_context *));
+static void cp_diagnostic_finalizer PARAMS ((output_buffer *,
+ diagnostic_context *));
+static void cp_print_error_function PARAMS ((output_buffer *,
+ diagnostic_context *));
+
+static int cp_printer PARAMS ((output_buffer *));
+static void print_non_consecutive_character PARAMS ((output_buffer *, int));
+static void print_integer PARAMS ((output_buffer *, HOST_WIDE_INT));
+static tree locate_error PARAMS ((const char *, va_list));
void
init_error ()
{
- gcc_obstack_init (&scratch_obstack);
- scratch_firstobj = (char *)obstack_alloc (&scratch_obstack, 0);
+ print_error_function = lang_print_error_function;
+ diagnostic_starter (global_dc) = cp_diagnostic_starter;
+ diagnostic_finalizer (global_dc) = cp_diagnostic_finalizer;
+ diagnostic_format_decoder (global_dc) = cp_printer;
+
+ init_output_buffer (scratch_buffer, /* prefix */NULL, /* line-width */0);
}
-/* Returns nonzero if SCOPE is something we want to print for random decls. */
+/* Dump a scope, if deemed necessary. */
-static int
-interesting_scope_p (scope)
+static void
+dump_scope (scope, flags)
tree scope;
+ int flags;
{
- if (scope == NULL_TREE
- || scope == global_namespace)
- return 0;
+ int f = ~TFF_RETURN_TYPE & (flags & (TFF_SCOPE | TFF_CHASE_TYPEDEF));
+
+ if (scope == NULL_TREE)
+ return;
- return (TREE_CODE (scope) == NAMESPACE_DECL
- || AGGREGATE_TYPE_P (scope));
+ if (TREE_CODE (scope) == NAMESPACE_DECL)
+ {
+ if (scope != global_namespace)
+ {
+ dump_decl (scope, f);
+ print_scope_operator (scratch_buffer);
+ }
+ }
+ else if (AGGREGATE_TYPE_P (scope))
+ {
+ dump_type (scope, f);
+ print_scope_operator (scratch_buffer);
+ }
+ else if ((flags & TFF_SCOPE) && TREE_CODE (scope) == FUNCTION_DECL)
+ {
+ dump_function_decl (scope, f);
+ print_scope_operator (scratch_buffer);
+ }
}
-static void
+/* Dump type qualifiers, providing padding as requested. Return an
+ indication of whether we dumped something. */
+
+static enum pad
dump_qualifiers (t, p)
tree t;
enum pad p;
{
- if (TYPE_QUALS (t))
+ static const int masks[] =
+ {TYPE_QUAL_CONST, TYPE_QUAL_VOLATILE, TYPE_QUAL_RESTRICT};
+ static const char *const names[] =
+ {"const", "volatile", "__restrict"};
+ int ix;
+ int quals = TYPE_QUALS (t);
+ int do_after = p == after;
+
+ if (quals)
{
- if (p == before) OB_PUTC (' ');
- switch (TYPE_QUALS (t))
- {
- case TYPE_QUAL_CONST:
- OB_PUTS ("const");
- break;
+ for (ix = 0; ix != 3; ix++)
+ if (masks[ix] & quals)
+ {
+ if (p == before)
+ output_add_space (scratch_buffer);
+ p = before;
+ print_identifier (scratch_buffer, names[ix]);
+ }
+ if (do_after)
+ output_add_space (scratch_buffer);
+ }
+ else
+ p = none;
+ return p;
+}
- case TYPE_QUAL_VOLATILE:
- OB_PUTS ("volatile");
- break;
+/* This must be large enough to hold any printed integer or floating-point
+ value. */
+static char digit_buffer[128];
- case TYPE_QUAL_RESTRICT:
- OB_PUTS ("__restrict");
- break;
+/* Dump the template ARGument under control of FLAGS. */
- case TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE:
- OB_PUTS ("const volatile");
- break;
+static void
+dump_template_argument (arg, flags)
+ tree arg;
+ int flags;
+{
+ if (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL)
+ dump_type (arg, flags & ~TFF_CLASS_KEY_OR_ENUM);
+ else
+ dump_expr (arg, (flags | TFF_EXPR_IN_PARENS) & ~TFF_CLASS_KEY_OR_ENUM);
+}
- case TYPE_QUAL_CONST | TYPE_QUAL_RESTRICT:
- OB_PUTS ("const __restrict");
- break;
+/* Dump a template-argument-list ARGS (always a TREE_VEC) under control
+ of FLAGS. */
- case TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT:
- OB_PUTS ("volatile __restrict");
- break;
+static void
+dump_template_argument_list (args, flags)
+ tree args;
+ int flags;
+{
+ int n = TREE_VEC_LENGTH (args);
+ int need_comma = 0;
+ int i;
- case TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT:
- OB_PUTS ("const volatile __restrict");
- break;
+ for (i = 0; i< n; ++i)
+ {
+ if (need_comma)
+ separate_with_comma (scratch_buffer);
+ dump_template_argument (TREE_VEC_ELT (args, i), flags);
+ need_comma = 1;
+ }
+}
- default:
- my_friendly_abort (0);
- }
- if (p == after) OB_PUTC (' ');
+/* Dump a template parameter PARM (a TREE_LIST) under control of FLAGS. */
+
+static void
+dump_template_parameter (parm, flags)
+ tree parm;
+ int flags;
+{
+ tree p = TREE_VALUE (parm);
+ tree a = TREE_PURPOSE (parm);
+
+ if (TREE_CODE (p) == TYPE_DECL)
+ {
+ if (flags & TFF_DECL_SPECIFIERS)
+ {
+ print_identifier (scratch_buffer, "class");
+ if (DECL_NAME (p))
+ {
+ output_add_space (scratch_buffer);
+ print_tree_identifier (scratch_buffer, DECL_NAME (p));
+ }
+ }
+ else if (DECL_NAME (p))
+ print_tree_identifier (scratch_buffer, DECL_NAME (p));
+ else
+ print_identifier (scratch_buffer, "{template default argument error}");
+ }
+ else
+ dump_decl (p, flags | TFF_DECL_SPECIFIERS);
+
+ if ((flags & TFF_FUNCTION_DEFAULT_ARGUMENTS) && a != NULL_TREE)
+ {
+ output_add_string (scratch_buffer, " = ");
+ if (TREE_CODE (p) == TYPE_DECL || TREE_CODE (p) == TEMPLATE_DECL)
+ dump_type (a, flags & ~TFF_CHASE_TYPEDEF);
+ else
+ dump_expr (a, flags | TFF_EXPR_IN_PARENS);
}
}
-/* This must be large enough to hold any printed integer or floating-point
- value. */
-static char digit_buffer[128];
+/* Dump, under control of FLAGS, a template-parameter-list binding.
+ PARMS is a TREE_LIST of TREE_VEC of TREE_LIST and ARGS is a
+ TREE_VEC. */
-/* Dump into the obstack a human-readable equivalent of TYPE. */
+static void
+dump_template_bindings (parms, args)
+ tree parms, args;
+{
+ int need_comma = 0;
+
+ while (parms)
+ {
+ tree p = TREE_VALUE (parms);
+ int lvl = TMPL_PARMS_DEPTH (parms);
+ int arg_idx = 0;
+ int i;
+
+ for (i = 0; i < TREE_VEC_LENGTH (p); ++i)
+ {
+ tree arg = NULL_TREE;
+
+ /* Don't crash if we had an invalid argument list. */
+ if (TMPL_ARGS_DEPTH (args) >= lvl)
+ {
+ tree lvl_args = TMPL_ARGS_LEVEL (args, lvl);
+ if (NUM_TMPL_ARGS (lvl_args) > arg_idx)
+ arg = TREE_VEC_ELT (lvl_args, arg_idx);
+ }
+
+ if (need_comma)
+ separate_with_comma (scratch_buffer);
+ dump_template_parameter (TREE_VEC_ELT (p, i), TFF_PLAIN_IDENTIFIER);
+ output_add_string (scratch_buffer, " = ");
+ if (arg)
+ dump_template_argument (arg, TFF_PLAIN_IDENTIFIER);
+ else
+ print_identifier (scratch_buffer, "<missing>");
+
+ ++arg_idx;
+ need_comma = 1;
+ }
+
+ parms = TREE_CHAIN (parms);
+ }
+}
+
+/* Dump into the obstack a human-readable equivalent of TYPE. FLAGS
+ controls the format. */
static void
-dump_type_real (t, v, canonical_name)
+dump_type (t, flags)
tree t;
- int v; /* verbose? */
- int canonical_name;
+ int flags;
{
if (t == NULL_TREE)
return;
-
+
if (TYPE_PTRMEMFUNC_P (t))
goto offset_type;
switch (TREE_CODE (t))
{
- case ERROR_MARK:
- OB_PUTS ("{error}");
- break;
-
case UNKNOWN_TYPE:
- OB_PUTS ("{unknown type}");
+ print_identifier (scratch_buffer, "<unknown type>");
break;
case TREE_LIST:
/* A list of function parms. */
- dump_parameters (t, 0, canonical_name);
+ dump_parameters (t, flags);
break;
case IDENTIFIER_NODE:
- OB_PUTID (t);
+ print_tree_identifier (scratch_buffer, t);
break;
case TREE_VEC:
- dump_type_real (BINFO_TYPE (t), v, canonical_name);
+ dump_type (BINFO_TYPE (t), flags);
break;
case RECORD_TYPE:
case UNION_TYPE:
case ENUMERAL_TYPE:
- if (TYPE_LANG_SPECIFIC (t)
- && (IS_SIGNATURE_POINTER (t) || IS_SIGNATURE_REFERENCE (t)))
- {
- dump_qualifiers (t, after);
- dump_type_real (SIGNATURE_TYPE (t), v, canonical_name);
- if (IS_SIGNATURE_POINTER (t))
- OB_PUTC ('*');
- else
- OB_PUTC ('&');
- }
- else
- dump_aggr_type (t, v, canonical_name);
+ dump_aggr_type (t, flags);
break;
case TYPE_DECL:
+ if (flags & TFF_CHASE_TYPEDEF)
+ {
+ dump_type (DECL_ORIGINAL_TYPE (t)
+ ? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t), flags);
+ break;
+ }
+ /* else fallthrough */
+
case TEMPLATE_DECL:
case NAMESPACE_DECL:
- dump_decl (t, v);
+ dump_decl (t, flags & ~TFF_DECL_SPECIFIERS);
break;
case COMPLEX_TYPE:
- OB_PUTS ("complex ");
- dump_type_real (TREE_TYPE (t), v, canonical_name);
+ output_add_string (scratch_buffer, "__complex__ ");
+ dump_type (TREE_TYPE (t), flags);
+ break;
+
+ case VECTOR_TYPE:
+ output_add_string (scratch_buffer, "vector ");
+ dump_type (TREE_TYPE (t), flags);
break;
case INTEGER_TYPE:
if (!TREE_UNSIGNED (TYPE_MAIN_VARIANT (t)) && TREE_UNSIGNED (t))
- OB_PUTS ("unsigned ");
+ output_add_string (scratch_buffer, "unsigned ");
else if (TREE_UNSIGNED (TYPE_MAIN_VARIANT (t)) && !TREE_UNSIGNED (t))
- OB_PUTS ("signed ");
+ output_add_string (scratch_buffer, "signed ");
/* fall through. */
case REAL_TYPE:
@@ -265,53 +398,43 @@ dump_type_real (t, v, canonical_name)
{
tree type;
dump_qualifiers (t, after);
- type = canonical_name ? TYPE_MAIN_VARIANT (t) : t;
+ type = flags & TFF_CHASE_TYPEDEF ? TYPE_MAIN_VARIANT (t) : t;
if (TYPE_NAME (type) && TYPE_IDENTIFIER (type))
- OB_PUTID (TYPE_IDENTIFIER (type));
+ print_tree_identifier (scratch_buffer, TYPE_IDENTIFIER (type));
else
/* Types like intQI_type_node and friends have no names.
These don't come up in user error messages, but it's nice
to be able to print them from the debugger. */
- OB_PUTS ("{anonymous}");
+ print_identifier (scratch_buffer, "<anonymous>");
}
break;
case TEMPLATE_TEMPLATE_PARM:
- if (!TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t))
- {
- /* For parameters inside template signature. */
- if (TYPE_IDENTIFIER (t))
- OB_PUTID (TYPE_IDENTIFIER (t));
- else
- OB_PUTS ("{anonymous template template parm}");
- }
+ /* For parameters inside template signature. */
+ if (TYPE_IDENTIFIER (t))
+ print_tree_identifier (scratch_buffer, TYPE_IDENTIFIER (t));
else
- {
- int i;
- tree args = TYPE_TI_ARGS (t);
- OB_PUTID (TYPE_IDENTIFIER (t));
- OB_PUTC ('<');
- for (i = 0; i < TREE_VEC_LENGTH (args); i++)
- {
- tree arg = TREE_VEC_ELT (args, i);
- if (TREE_CODE_CLASS (TREE_CODE (arg)) == 't'
- || TREE_CODE (arg) == TEMPLATE_DECL)
- dump_type_real (arg, 0, canonical_name);
- else
- dump_expr (arg, 0);
- if (i < TREE_VEC_LENGTH (args)-1)
- OB_PUTC2 (',', ' ');
- }
- OB_END_TEMPLATE_ID ();
- }
+ print_identifier
+ (scratch_buffer, "<anonymous template template parameter>");
+ break;
+
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
+ {
+ tree args = TYPE_TI_ARGS (t);
+ print_tree_identifier (scratch_buffer, TYPE_IDENTIFIER (t));
+ print_template_argument_list_start (scratch_buffer);
+ dump_template_argument_list (args, flags);
+ print_template_argument_list_end (scratch_buffer);
+ }
break;
case TEMPLATE_TYPE_PARM:
dump_qualifiers (t, after);
if (TYPE_IDENTIFIER (t))
- OB_PUTID (TYPE_IDENTIFIER (t));
+ print_tree_identifier (scratch_buffer, TYPE_IDENTIFIER (t));
else
- OB_PUTS ("{anonymous template type parm}");
+ print_identifier
+ (scratch_buffer, "<anonymous template type parameter>");
break;
/* This is not always necessary for pointers and such, but doing this
@@ -323,31 +446,61 @@ dump_type_real (t, v, canonical_name)
offset_type:
case FUNCTION_TYPE:
case METHOD_TYPE:
- dump_type_prefix (t, v, canonical_name);
- dump_type_suffix (t, v, canonical_name);
+ {
+ dump_type_prefix (t, flags);
+ dump_type_suffix (t, flags);
break;
-
+ }
case TYPENAME_TYPE:
- OB_PUTS ("typename ");
- dump_type_real (TYPE_CONTEXT (t), 0, canonical_name);
- OB_PUTS ("::");
- dump_decl (TYPENAME_TYPE_FULLNAME (t), v);
+ output_add_string (scratch_buffer, "typename ");
+ dump_typename (t, flags);
+ break;
+
+ case UNBOUND_CLASS_TEMPLATE:
+ dump_type (TYPE_CONTEXT (t), flags);
+ print_scope_operator (scratch_buffer);
+ print_identifier (scratch_buffer, "template ");
+ dump_type (DECL_NAME (TYPE_NAME (t)), flags);
break;
case TYPEOF_TYPE:
- OB_PUTS ("__typeof (");
- dump_expr (TYPE_FIELDS (t), 1);
- OB_PUTC (')');
+ output_add_string (scratch_buffer, "__typeof (");
+ dump_expr (TYPE_FIELDS (t), flags & ~TFF_EXPR_IN_PARENS);
+ print_left_paren (scratch_buffer);
break;
default:
- sorry ("`%s' not supported by dump_type",
- tree_code_name[(int) TREE_CODE (t)]);
+ sorry_for_unsupported_tree (t);
+ /* Fall through to error. */
+
+ case ERROR_MARK:
+ print_identifier (scratch_buffer, "<type error>");
+ break;
}
}
-static char *
-aggr_variety (t)
+/* Dump a TYPENAME_TYPE. We need to notice when the context is itself
+ a TYPENAME_TYPE. */
+
+static void
+dump_typename (t, flags)
+ tree t;
+ int flags;
+{
+ tree ctx = TYPE_CONTEXT (t);
+
+ if (TREE_CODE (ctx) == TYPENAME_TYPE)
+ dump_typename (ctx, flags);
+ else
+ dump_type (ctx, flags & ~TFF_CLASS_KEY_OR_ENUM);
+ print_scope_operator (scratch_buffer);
+ dump_decl (TYPENAME_TYPE_FULLNAME (t), flags);
+}
+
+/* Return the name of the supplied aggregate, or enumeral type. */
+
+static const char *
+class_key_or_enum (t)
tree t;
{
if (TREE_CODE (t) == ENUMERAL_TYPE)
@@ -356,64 +509,72 @@ aggr_variety (t)
return "union";
else if (TYPE_LANG_SPECIFIC (t) && CLASSTYPE_DECLARED_CLASS (t))
return "class";
- else if (TYPE_LANG_SPECIFIC (t) && IS_SIGNATURE (t))
- return "signature";
else
return "struct";
}
-static void
-dump_type (t, v)
- tree t;
- int v; /* verbose? */
-{
- dump_type_real (t, v, 0);
-}
-
-/* Print out a class declaration, in the form `class foo'. */
+/* Print out a class declaration T under the control of FLAGS,
+ in the form `class foo'. */
static void
-dump_aggr_type (t, v, canonical_name)
+dump_aggr_type (t, flags)
tree t;
- int v; /* verbose? */
- int canonical_name;
+ int flags;
{
tree name;
- char *variety = aggr_variety (t);
+ const char *variety = class_key_or_enum (t);
+ int typdef = 0;
+ int tmplate = 0;
dump_qualifiers (t, after);
- if (v > 0)
+ if (flags & TFF_CLASS_KEY_OR_ENUM)
{
- OB_PUTCP (variety);
- OB_PUTC (' ');
+ print_identifier (scratch_buffer, variety);
+ output_add_space (scratch_buffer);
}
-
- name = TYPE_NAME (canonical_name ? TYPE_MAIN_VARIANT (t) : t);
- if (name && CP_DECL_CONTEXT (name) != global_namespace)
+ if (flags & TFF_CHASE_TYPEDEF)
+ t = TYPE_MAIN_VARIANT (t);
+
+ name = TYPE_NAME (t);
+
+ if (name)
{
- /* FUNCTION_DECL or RECORD_TYPE */
- dump_decl (DECL_CONTEXT (name), 0);
- OB_PUTC2 (':', ':');
- }
+ typdef = !DECL_ARTIFICIAL (name);
+ tmplate = !typdef && TREE_CODE (t) != ENUMERAL_TYPE
+ && TYPE_LANG_SPECIFIC (t) && CLASSTYPE_TEMPLATE_INFO (t)
+ && (CLASSTYPE_TEMPLATE_SPECIALIZATION (t)
+ || TREE_CODE (CLASSTYPE_TI_TEMPLATE (t)) != TEMPLATE_DECL
+ || DECL_TEMPLATE_SPECIALIZATION (CLASSTYPE_TI_TEMPLATE (t))
+ || PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)));
+ dump_scope (CP_DECL_CONTEXT (name), flags | TFF_SCOPE);
+ if (tmplate)
+ {
+ /* Because the template names are mangled, we have to locate
+ the most general template, and use that name. */
+ tree tpl = CLASSTYPE_TI_TEMPLATE (t);
- /* kludge around weird behavior on g++.brendan/line1.C */
- if (name && TREE_CODE (name) != IDENTIFIER_NODE)
- name = DECL_NAME (name);
+ while (DECL_TEMPLATE_INFO (tpl))
+ tpl = DECL_TI_TEMPLATE (tpl);
+ name = tpl;
+ }
+ name = DECL_NAME (name);
+ }
if (name == 0 || ANON_AGGRNAME_P (name))
{
- OB_PUTS ("{anonymous");
- if (!v)
- {
- OB_PUTC (' ');
- OB_PUTCP (variety);
- }
- OB_PUTC ('}');
+ if (flags & TFF_CLASS_KEY_OR_ENUM)
+ print_identifier (scratch_buffer, "<anonymous>");
+ else
+ output_printf (scratch_buffer, "<anonymous %s>", variety);
}
else
- OB_PUTID (name);
+ print_tree_identifier (scratch_buffer, name);
+ if (tmplate)
+ dump_template_parms (TYPE_TEMPLATE_INFO (t),
+ !CLASSTYPE_USE_TEMPLATE (t),
+ flags & ~TFF_TEMPLATE_HEADER);
}
/* Dump into the obstack the initial part of the output for a given type.
@@ -425,94 +586,87 @@ dump_aggr_type (t, v, canonical_name)
deal with prefix and suffix.
Arrays must also do this for DECL nodes, like int a[], and for things like
- int *[]&. */
+ int *[]&.
-static void
-dump_type_prefix (t, v, canonical_name)
+ Return indicates how you should pad an object name after this. I.e. you
+ want to pad non-*, non-& cores, but not pad * or & types. */
+
+static enum pad
+dump_type_prefix (t, flags)
tree t;
- int v; /* verbosity */
- int canonical_name;
+ int flags;
{
+ enum pad padding = before;
+
if (TYPE_PTRMEMFUNC_P (t))
{
t = TYPE_PTRMEMFUNC_FN_TYPE (t);
goto offset_type;
}
-
+
switch (TREE_CODE (t))
{
case POINTER_TYPE:
case REFERENCE_TYPE:
{
tree sub = TREE_TYPE (t);
-
- dump_type_prefix (sub, v, canonical_name);
+
+ padding = dump_type_prefix (sub, flags);
/* A tree for a member pointer looks like pointer to offset,
so let the OFFSET_TYPE case handle it. */
if (!TYPE_PTRMEM_P (t))
{
- switch (TREE_CODE (sub))
- {
- /* We don't want int ( *)() */
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- break;
-
- case ARRAY_TYPE:
- OB_PUTC2 (' ', '(');
- break;
-
- case POINTER_TYPE:
- /* We don't want "char * *" */
- if (TYPE_QUALS (sub) == TYPE_UNQUALIFIED)
- break;
- /* But we do want "char *const *" */
-
- default:
- OB_PUTC (' ');
- }
- if (TREE_CODE (t) == POINTER_TYPE)
- OB_PUTC ('*');
- else
- OB_PUTC ('&');
- dump_qualifiers (t, none);
+ if (TREE_CODE (sub) == ARRAY_TYPE)
+ {
+ output_add_space (scratch_buffer);
+ print_left_paren (scratch_buffer);
+ }
+ output_add_character
+ (scratch_buffer, "&*"[TREE_CODE (t) == POINTER_TYPE]);
+ padding = dump_qualifiers (t, before);
}
}
break;
case OFFSET_TYPE:
offset_type:
- dump_type_prefix (TREE_TYPE (t), v, canonical_name);
+ padding = dump_type_prefix (TREE_TYPE (t), flags);
if (TREE_CODE (t) == OFFSET_TYPE) /* pmfs deal with this in d_t_p */
{
- OB_PUTC (' ');
- dump_type_real (TYPE_OFFSET_BASETYPE (t), 0, canonical_name);
- OB_PUTC2 (':', ':');
+ if (padding != none)
+ output_add_space (scratch_buffer);
+ dump_type (TYPE_OFFSET_BASETYPE (t), flags);
+ print_scope_operator (scratch_buffer);
}
- OB_PUTC ('*');
- dump_qualifiers (t, none);
+ output_add_character (scratch_buffer, '*');
+ padding = dump_qualifiers (t, none);
break;
/* Can only be reached through function pointer -- this would not be
correct if FUNCTION_DECLs used it. */
case FUNCTION_TYPE:
- dump_type_prefix (TREE_TYPE (t), v, canonical_name);
- OB_PUTC2 (' ', '(');
+ padding = dump_type_prefix (TREE_TYPE (t), flags);
+ if (padding != none)
+ output_add_space (scratch_buffer);
+ print_left_paren (scratch_buffer);
+ padding = none;
break;
case METHOD_TYPE:
- dump_type_prefix (TREE_TYPE (t), v, canonical_name);
- OB_PUTC2 (' ', '(');
- dump_aggr_type (TYPE_METHOD_BASETYPE (t), 0, canonical_name);
- OB_PUTC2 (':', ':');
+ padding = dump_type_prefix (TREE_TYPE (t), flags);
+ if (padding != none)
+ output_add_space (scratch_buffer);
+ print_left_paren (scratch_buffer);
+ padding = none;
+ dump_aggr_type (TYPE_METHOD_BASETYPE (t), flags);
+ print_scope_operator (scratch_buffer);
break;
case ARRAY_TYPE:
- dump_type_prefix (TREE_TYPE (t), v, canonical_name);
+ padding = dump_type_prefix (TREE_TYPE (t), flags);
break;
case ENUMERAL_TYPE:
- case ERROR_MARK:
case IDENTIFIER_NODE:
case INTEGER_TYPE:
case BOOLEAN_TYPE:
@@ -520,6 +674,7 @@ dump_type_prefix (t, v, canonical_name)
case RECORD_TYPE:
case TEMPLATE_TYPE_PARM:
case TEMPLATE_TEMPLATE_PARM:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
case TREE_LIST:
case TYPE_DECL:
case TREE_VEC:
@@ -528,20 +683,28 @@ dump_type_prefix (t, v, canonical_name)
case VOID_TYPE:
case TYPENAME_TYPE:
case COMPLEX_TYPE:
- dump_type_real (t, v, canonical_name);
+ case VECTOR_TYPE:
+ dump_type (t, flags);
+ padding = before;
break;
-
+
default:
- sorry ("`%s' not supported by dump_type_prefix",
- tree_code_name[(int) TREE_CODE (t)]);
+ sorry_for_unsupported_tree (t);
+ /* fall through. */
+ case ERROR_MARK:
+ print_identifier (scratch_buffer, "<typeprefixerror>");
+ break;
}
+ return padding;
}
+/* Dump the suffix of type T, under control of FLAGS. This is the part
+ which appears after the identifier (or function parms). */
+
static void
-dump_type_suffix (t, v, canonical_name)
+dump_type_suffix (t, flags)
tree t;
- int v; /* verbose? */
- int canonical_name;
+ int flags;
{
if (TYPE_PTRMEMFUNC_P (t))
t = TYPE_PTRMEMFUNC_FN_TYPE (t);
@@ -552,8 +715,8 @@ dump_type_suffix (t, v, canonical_name)
case REFERENCE_TYPE:
case OFFSET_TYPE:
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
- OB_PUTC (')');
- dump_type_suffix (TREE_TYPE (t), v, canonical_name);
+ print_right_paren (scratch_buffer);
+ dump_type_suffix (TREE_TYPE (t), flags);
break;
/* Can only be reached through function pointer */
@@ -561,42 +724,45 @@ dump_type_suffix (t, v, canonical_name)
case METHOD_TYPE:
{
tree arg;
- OB_PUTC (')');
+ print_right_paren (scratch_buffer);
arg = TYPE_ARG_TYPES (t);
if (TREE_CODE (t) == METHOD_TYPE)
arg = TREE_CHAIN (arg);
/* Function pointers don't have default args. Not in standard C++,
anyway; they may in g++, but we'll just pretend otherwise. */
- dump_parameters (arg, 0, canonical_name);
+ dump_parameters (arg, flags & ~TFF_FUNCTION_DEFAULT_ARGUMENTS);
if (TREE_CODE (t) == METHOD_TYPE)
dump_qualifiers
(TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))), before);
- dump_type_suffix (TREE_TYPE (t), v, canonical_name);
- dump_exception_spec (TYPE_RAISES_EXCEPTIONS (t), canonical_name);
+ dump_exception_spec (TYPE_RAISES_EXCEPTIONS (t), flags);
+ dump_type_suffix (TREE_TYPE (t), flags);
break;
}
case ARRAY_TYPE:
- OB_PUTC ('[');
+ print_left_bracket (scratch_buffer);
if (TYPE_DOMAIN (t))
{
- if (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (t))) == INTEGER_CST)
- OB_PUTI (TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (t))) + 1);
+ if (host_integerp (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0))
+ print_integer
+ (scratch_buffer,
+ tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0) + 1);
else if (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (t))) == MINUS_EXPR)
- dump_expr (TREE_OPERAND (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0), 0);
+ dump_expr (TREE_OPERAND (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0),
+ flags & ~TFF_EXPR_IN_PARENS);
else
- dump_expr (fold (build_binary_op
+ dump_expr (fold (cp_build_binary_op
(PLUS_EXPR, TYPE_MAX_VALUE (TYPE_DOMAIN (t)),
- integer_one_node)), 0);
+ integer_one_node)),
+ flags & ~TFF_EXPR_IN_PARENS);
}
- OB_PUTC (']');
- dump_type_suffix (TREE_TYPE (t), v, canonical_name);
+ print_right_bracket (scratch_buffer);
+ dump_type_suffix (TREE_TYPE (t), flags);
break;
-
+
case ENUMERAL_TYPE:
- case ERROR_MARK:
case IDENTIFIER_NODE:
case INTEGER_TYPE:
case BOOLEAN_TYPE:
@@ -604,6 +770,7 @@ dump_type_suffix (t, v, canonical_name)
case RECORD_TYPE:
case TEMPLATE_TYPE_PARM:
case TEMPLATE_TEMPLATE_PARM:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
case TREE_LIST:
case TYPE_DECL:
case TREE_VEC:
@@ -612,208 +779,151 @@ dump_type_suffix (t, v, canonical_name)
case VOID_TYPE:
case TYPENAME_TYPE:
case COMPLEX_TYPE:
+ case VECTOR_TYPE:
break;
default:
- sorry ("`%s' not supported by dump_type_suffix",
- tree_code_name[(int) TREE_CODE (t)]);
+ sorry_for_unsupported_tree (t);
+ case ERROR_MARK:
+ /* Don't mark it here, we should have already done in
+ dump_type_prefix. */
+ break;
}
}
-/* Return a function declaration which corresponds to the IDENTIFIER_NODE
- argument. */
-
-static tree
-ident_fndecl (t)
- tree t;
-{
- tree n = lookup_name (t, 0);
-
- if (n == NULL_TREE)
- return NULL_TREE;
-
- if (TREE_CODE (n) == FUNCTION_DECL)
- return n;
- else if (TREE_CODE (n) == TREE_LIST
- && TREE_CODE (TREE_VALUE (n)) == FUNCTION_DECL)
- return TREE_VALUE (n);
-
- my_friendly_abort (66);
- return NULL_TREE;
-}
-
-#ifndef NO_DOLLAR_IN_LABEL
-# define GLOBAL_THING "_GLOBAL_$"
-#else
-# ifndef NO_DOT_IN_LABEL
-# define GLOBAL_THING "_GLOBAL_."
-# else
-# define GLOBAL_THING "_GLOBAL__"
-# endif
-#endif
-
-#define GLOBAL_IORD_P(NODE) \
- ! strncmp (IDENTIFIER_POINTER(NODE), GLOBAL_THING, sizeof (GLOBAL_THING) - 1)
-
static void
dump_global_iord (t)
tree t;
{
- char *name = IDENTIFIER_POINTER (t);
+ const char *p = NULL;
- OB_PUTS ("(static ");
- if (name [sizeof (GLOBAL_THING) - 1] == 'I')
- OB_PUTS ("initializers");
- else if (name [sizeof (GLOBAL_THING) - 1] == 'D')
- OB_PUTS ("destructors");
+ if (DECL_GLOBAL_CTOR_P (t))
+ p = "initializers";
+ else if (DECL_GLOBAL_DTOR_P (t))
+ p = "destructors";
else
- my_friendly_abort (352);
-
- OB_PUTS (" for ");
- OB_PUTCP (input_filename);
- OB_PUTC (')');
+ abort ();
+
+ output_printf (scratch_buffer, "(static %s for %s)", p, input_filename);
}
static void
-dump_simple_decl (t, type, v)
+dump_simple_decl (t, type, flags)
tree t;
tree type;
- int v;
+ int flags;
{
- if (v > 0)
+ if (flags & TFF_DECL_SPECIFIERS)
{
- dump_type_prefix (type, v, 0);
- OB_PUTC (' ');
- }
- if (interesting_scope_p (DECL_CONTEXT (t)))
- {
- dump_decl (DECL_CONTEXT (t), 0);
- OB_PUTC2 (':',':');
+ if (dump_type_prefix (type, flags) != none)
+ output_add_space (scratch_buffer);
}
+ if (!DECL_INITIAL (t) || TREE_CODE (DECL_INITIAL (t)) != TEMPLATE_PARM_INDEX)
+ dump_scope (CP_DECL_CONTEXT (t), flags);
if (DECL_NAME (t))
- dump_decl (DECL_NAME (t), v);
+ dump_decl (DECL_NAME (t), flags);
else
- OB_PUTS ("{anon}");
- if (v > 0)
- dump_type_suffix (type, v, 0);
+ print_identifier (scratch_buffer, "<anonymous>");
+ if (flags & TFF_DECL_SPECIFIERS)
+ dump_type_suffix (type, flags);
}
+/* Dump a human readable string for the decl T under control of FLAGS. */
+
static void
-dump_decl (t, v)
+dump_decl (t, flags)
tree t;
- int v; /* verbosity */
+ int flags;
{
if (t == NULL_TREE)
return;
switch (TREE_CODE (t))
{
- case ERROR_MARK:
- OB_PUTS (" /* decl error */ ");
- break;
-
case TYPE_DECL:
{
/* Don't say 'typedef class A' */
if (DECL_ARTIFICIAL (t))
{
- if (v > 0 && TREE_CODE (TREE_TYPE (t)) == TEMPLATE_TYPE_PARM)
+ if ((flags & TFF_DECL_SPECIFIERS)
+ && TREE_CODE (TREE_TYPE (t)) == TEMPLATE_TYPE_PARM)
/* Say `class T' not just `T'. */
- OB_PUTS ("class ");
+ output_add_string (scratch_buffer, "class ");
- dump_type (TREE_TYPE (t), v);
+ dump_type (TREE_TYPE (t), flags);
break;
}
}
- if (v > 0)
- OB_PUTS ("typedef ");
- dump_simple_decl (t, DECL_ORIGINAL_TYPE (t)
- ? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t), v);
+ if (flags & TFF_DECL_SPECIFIERS)
+ output_add_string (scratch_buffer, "typedef ");
+ dump_simple_decl (t, DECL_ORIGINAL_TYPE (t)
+ ? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t),
+ flags);
break;
-
+
case VAR_DECL:
if (DECL_NAME (t) && VTABLE_NAME_P (DECL_NAME (t)))
{
- OB_PUTS ("vtable for ");
- if (TYPE_P (DECL_CONTEXT (t)))
- dump_type (DECL_CONTEXT (t), v);
- else
- /* This case can arise with -fno-vtable-thunks. See
- expand_upcast_fixups. It's not clear what to print
- here. */
- OB_PUTS ("{unknown type}");
+ output_add_string (scratch_buffer, "vtable for ");
+ my_friendly_assert (TYPE_P (DECL_CONTEXT (t)), 20010720);
+ dump_type (DECL_CONTEXT (t), flags);
break;
}
/* else fall through */
case FIELD_DECL:
case PARM_DECL:
- dump_simple_decl (t, TREE_TYPE (t), v);
+ dump_simple_decl (t, TREE_TYPE (t), flags);
+ break;
+
+ case RESULT_DECL:
+ output_add_string (scratch_buffer, "<return value> ");
+ dump_simple_decl (t, TREE_TYPE (t), flags);
break;
case NAMESPACE_DECL:
- if (CP_DECL_CONTEXT (t) != global_namespace)
- {
- dump_decl (DECL_CONTEXT (t), v);
- OB_PUTC2 (':',':');
- }
+ dump_scope (CP_DECL_CONTEXT (t), flags);
if (DECL_NAME (t) == anonymous_namespace_name)
- OB_PUTS ("{anonymous}");
+ print_identifier (scratch_buffer, "<unnamed>");
else
- OB_PUTID (DECL_NAME (t));
+ print_tree_identifier (scratch_buffer, DECL_NAME (t));
break;
case SCOPE_REF:
- dump_decl (TREE_OPERAND (t, 0), 0);
- OB_PUTS ("::");
- dump_decl (TREE_OPERAND (t, 1), 0);
- break;
+ dump_decl (TREE_OPERAND (t, 0), flags & ~TFF_DECL_SPECIFIERS);
+ print_scope_operator (scratch_buffer);
+ dump_decl (TREE_OPERAND (t, 1), flags);
+ break;
case ARRAY_REF:
- dump_decl (TREE_OPERAND (t, 0), v);
- OB_PUTC ('[');
- dump_decl (TREE_OPERAND (t, 1), v);
- OB_PUTC (']');
+ dump_decl (TREE_OPERAND (t, 0), flags);
+ print_left_bracket (scratch_buffer);
+ dump_decl (TREE_OPERAND (t, 1), flags);
+ print_right_bracket (scratch_buffer);
break;
- /* So that we can do dump_decl in dump_aggr_type and have it work for
- both class and function scope. */
+ /* So that we can do dump_decl on an aggr type. */
case RECORD_TYPE:
case UNION_TYPE:
case ENUMERAL_TYPE:
- dump_type (t, v);
+ dump_type (t, flags);
break;
case TYPE_EXPR:
- my_friendly_abort (69);
+ abort ();
break;
/* These special cases are duplicated here so that other functions
- can feed identifiers to cp_error and get them demangled properly. */
+ can feed identifiers to error and get them demangled properly. */
case IDENTIFIER_NODE:
- { tree f;
- if (DESTRUCTOR_NAME_P (t)
- && (f = ident_fndecl (t))
- && DECL_LANGUAGE (f) == lang_cplusplus)
- {
- OB_PUTC ('~');
- dump_decl (DECL_NAME (f), 0);
- }
- else if (IDENTIFIER_TYPENAME_P (t))
- {
- OB_PUTS ("operator ");
- /* Not exactly IDENTIFIER_TYPE_VALUE. */
- dump_type (TREE_TYPE (t), 0);
- break;
- }
- else if (IDENTIFIER_OPNAME_P (t))
- {
- char *name_string = operator_name_string (t);
- OB_PUTS ("operator ");
- OB_PUTCP (name_string);
- }
- else
- OB_PUTID (t);
- }
+ if (IDENTIFIER_TYPENAME_P (t))
+ {
+ output_add_string (scratch_buffer, "operator ");
+ /* Not exactly IDENTIFIER_TYPE_VALUE. */
+ dump_type (TREE_TYPE (t), flags);
+ break;
+ }
+ else
+ print_tree_identifier (scratch_buffer, t);
break;
case OVERLOAD:
@@ -821,81 +931,16 @@ dump_decl (t, v)
/* Fall through. */
case FUNCTION_DECL:
- if (GLOBAL_IORD_P (DECL_ASSEMBLER_NAME (t)))
- dump_global_iord (DECL_ASSEMBLER_NAME (t));
+ if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t))
+ dump_global_iord (t);
else if (! DECL_LANG_SPECIFIC (t))
- OB_PUTS ("{internal}");
+ print_identifier (scratch_buffer, "<internal>");
else
- dump_function_decl (t, v);
+ dump_function_decl (t, flags);
break;
case TEMPLATE_DECL:
- {
- tree orig_args = DECL_TEMPLATE_PARMS (t);
- tree args;
- int i;
- for (args = orig_args = nreverse (orig_args);
- args;
- args = TREE_CHAIN (args))
- {
- int len = TREE_VEC_LENGTH (TREE_VALUE (args));
-
- OB_PUTS ("template <");
- for (i = 0; i < len; i++)
- {
- tree arg = TREE_VEC_ELT (TREE_VALUE (args), i);
- tree defval = TREE_PURPOSE (arg);
- arg = TREE_VALUE (arg);
- if (TREE_CODE (arg) == TYPE_DECL)
- {
- if (DECL_NAME (arg))
- {
- OB_PUTS ("class ");
- OB_PUTID (DECL_NAME (arg));
- }
- else
- OB_PUTS ("class");
- }
- else
- dump_decl (arg, 1);
-
- if (defval)
- {
- OB_PUTS (" = ");
- if (TREE_CODE (arg) == TYPE_DECL
- || TREE_CODE (arg) == TEMPLATE_DECL)
- dump_type (defval, 1);
- else
- dump_expr (defval, 1);
- }
-
- OB_PUTC2 (',', ' ');
- }
- if (len != 0)
- OB_UNPUT (2);
- OB_END_TEMPLATE_ID ();
- OB_PUTC (' ');
- }
- nreverse(orig_args);
-
- if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL)
- dump_type (TREE_TYPE (t), v);
- else if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL)
- dump_decl (DECL_TEMPLATE_RESULT (t), v);
- else if (TREE_TYPE (t) == NULL_TREE)
- my_friendly_abort (353);
- else switch (NEXT_CODE (t))
- {
- case METHOD_TYPE:
- case FUNCTION_TYPE:
- dump_function_decl (t, v);
- break;
-
- default:
- /* This case can occur with some illegal code. */
- dump_type (TREE_TYPE (t), v);
- }
- }
+ dump_template_decl (t, flags);
break;
case TEMPLATE_ID_EXPR:
@@ -904,207 +949,273 @@ dump_decl (t, v)
tree name = TREE_OPERAND (t, 0);
if (is_overloaded_fn (name))
name = DECL_NAME (get_first_fn (name));
- dump_decl (name, v);
- OB_PUTC ('<');
+ dump_decl (name, flags);
+ print_template_argument_list_start (scratch_buffer);
for (args = TREE_OPERAND (t, 1); args; args = TREE_CHAIN (args))
{
- if (TREE_CODE_CLASS (TREE_CODE (TREE_VALUE (args))) == 't'
- || TREE_CODE (TREE_VALUE (args)) == TEMPLATE_DECL)
- dump_type (TREE_VALUE (args), 0);
- else
- dump_expr (TREE_VALUE (args), 0);
+ dump_template_argument (TREE_VALUE (args), flags);
if (TREE_CHAIN (args))
- OB_PUTC2 (',', ' ');
+ separate_with_comma (scratch_buffer);
}
- OB_END_TEMPLATE_ID ();
+ print_template_argument_list_end (scratch_buffer);
}
break;
case LOOKUP_EXPR:
- dump_decl (TREE_OPERAND (t, 0), v);
+ dump_decl (TREE_OPERAND (t, 0), flags);
break;
case LABEL_DECL:
- OB_PUTID (DECL_NAME (t));
+ print_tree_identifier (scratch_buffer, DECL_NAME (t));
break;
case CONST_DECL:
if ((TREE_TYPE (t) != NULL_TREE && NEXT_CODE (t) == ENUMERAL_TYPE)
|| (DECL_INITIAL (t) &&
TREE_CODE (DECL_INITIAL (t)) == TEMPLATE_PARM_INDEX))
- dump_simple_decl (t, TREE_TYPE (t), v);
+ dump_simple_decl (t, TREE_TYPE (t), flags);
else if (DECL_NAME (t))
- dump_decl (DECL_NAME (t), v);
+ dump_decl (DECL_NAME (t), flags);
else if (DECL_INITIAL (t))
- dump_expr (DECL_INITIAL (t), 0);
+ dump_expr (DECL_INITIAL (t), flags | TFF_EXPR_IN_PARENS);
else
- OB_PUTS ("enumerator");
+ print_identifier (scratch_buffer, "enumerator");
break;
case USING_DECL:
- OB_PUTS ("using ");
- dump_type (DECL_INITIAL (t), 0);
- OB_PUTS ("::");
- OB_PUTID (DECL_NAME (t));
+ output_add_string (scratch_buffer, "using ");
+ dump_type (DECL_INITIAL (t), flags);
+ print_scope_operator (scratch_buffer);
+ print_tree_identifier (scratch_buffer, DECL_NAME (t));
break;
default:
- sorry ("`%s' not supported by dump_decl",
- tree_code_name[(int) TREE_CODE (t)]);
+ sorry_for_unsupported_tree (t);
+ /* Fallthrough to error. */
+
+ case ERROR_MARK:
+ print_identifier (scratch_buffer, "<declaration error>");
+ break;
+ }
+}
+
+/* Dump a template declaration T under control of FLAGS. This means the
+ 'template <...> leaders plus the 'class X' or 'void fn(...)' part. */
+
+static void
+dump_template_decl (t, flags)
+ tree t;
+ int flags;
+{
+ tree orig_parms = DECL_TEMPLATE_PARMS (t);
+ tree parms;
+ int i;
+
+ if (flags & TFF_TEMPLATE_HEADER)
+ {
+ for (parms = orig_parms = nreverse (orig_parms);
+ parms;
+ parms = TREE_CHAIN (parms))
+ {
+ tree inner_parms = INNERMOST_TEMPLATE_PARMS (parms);
+ int len = TREE_VEC_LENGTH (inner_parms);
+
+ output_add_string (scratch_buffer, "template<");
+
+ /* If we've shown the template prefix, we'd better show the
+ parameters' and decl's type too. */
+ flags |= TFF_DECL_SPECIFIERS;
+
+ for (i = 0; i < len; i++)
+ {
+ if (i)
+ separate_with_comma (scratch_buffer);
+ dump_template_parameter (TREE_VEC_ELT (inner_parms, i), flags);
+ }
+ print_template_argument_list_end (scratch_buffer);
+ output_add_space (scratch_buffer);
+ }
+ nreverse(orig_parms);
+
+ if (DECL_TEMPLATE_TEMPLATE_PARM_P (t))
+ /* Say `template<arg> class TT' not just `template<arg> TT'. */
+ output_add_string (scratch_buffer, "class ");
+ }
+
+ if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL)
+ dump_type (TREE_TYPE (t),
+ ((flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME
+ | (flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0)));
+ else if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL)
+ dump_decl (DECL_TEMPLATE_RESULT (t), flags | TFF_TEMPLATE_NAME);
+ else if (TREE_TYPE (t) == NULL_TREE)
+ abort ();
+ else
+ switch (NEXT_CODE (t))
+ {
+ case METHOD_TYPE:
+ case FUNCTION_TYPE:
+ dump_function_decl (t, flags | TFF_TEMPLATE_NAME);
+ break;
+ default:
+ /* This case can occur with some illegal code. */
+ dump_type (TREE_TYPE (t),
+ (flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME
+ | (flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0));
}
}
/* Pretty print a function decl. There are several ways we want to print a
- function declaration. We use V to tell us what.
- V - 01 23
- args - ++ ++
- retval - -+ ++
- default- -+ -+
- throw - -- ++
- As cp_error can only apply the '#' flag once to give 0 and 1 for V, there
+ function declaration. The TFF_ bits in FLAGS tells us how to behave.
+ As error can only apply the '#' flag once to give 0 and 1 for V, there
is %D which doesn't print the throw specs, and %F which does. */
static void
-dump_function_decl (t, v)
+dump_function_decl (t, flags)
tree t;
- int v;
+ int flags;
{
- tree name;
tree fntype;
tree parmtypes;
tree cname = NULL_TREE;
+ tree template_args = NULL_TREE;
+ tree template_parms = NULL_TREE;
+ int show_return = flags & TFF_RETURN_TYPE || flags & TFF_DECL_SPECIFIERS;
if (TREE_CODE (t) == TEMPLATE_DECL)
t = DECL_TEMPLATE_RESULT (t);
- name = DECL_ASSEMBLER_NAME (t);
+ /* Pretty print template instantiations only. */
+ if (DECL_USE_TEMPLATE (t) && DECL_TEMPLATE_INFO (t))
+ {
+ tree tmpl;
+
+ template_args = DECL_TI_ARGS (t);
+ tmpl = most_general_template (t);
+ if (tmpl && TREE_CODE (tmpl) == TEMPLATE_DECL)
+ {
+ template_parms = DECL_TEMPLATE_PARMS (tmpl);
+ t = tmpl;
+ }
+ }
+
fntype = TREE_TYPE (t);
- parmtypes = TYPE_ARG_TYPES (fntype);
+ parmtypes = FUNCTION_FIRST_USER_PARMTYPE (t);
- /* Friends have DECL_CLASS_CONTEXT set, but not DECL_CONTEXT. */
if (DECL_CLASS_SCOPE_P (t))
- cname = DECL_CLASS_CONTEXT (t);
+ cname = DECL_CONTEXT (t);
/* this is for partially instantiated template methods */
else if (TREE_CODE (fntype) == METHOD_TYPE)
cname = TREE_TYPE (TREE_VALUE (parmtypes));
- /* Print the return type. */
- if (v > 0)
+ if (!(flags & TFF_DECL_SPECIFIERS))
+ /* OK */;
+ else if (DECL_STATIC_FUNCTION_P (t))
+ print_identifier (scratch_buffer, "static ");
+ else if (DECL_VIRTUAL_P (t))
+ print_identifier (scratch_buffer, "virtual ");
+
+ /* Print the return type? */
+ if (show_return)
+ show_return = !DECL_CONV_FN_P (t) && !DECL_CONSTRUCTOR_P (t)
+ && !DECL_DESTRUCTOR_P (t);
+ if (show_return)
{
- if (DECL_STATIC_FUNCTION_P (t))
- OB_PUTS ("static ");
-
- if (! DECL_CONV_FN_P (t)
- && ! DECL_CONSTRUCTOR_P (t)
- && ! DECL_DESTRUCTOR_P (t))
- {
- dump_type_prefix (TREE_TYPE (fntype), 1, 0);
- OB_PUTC (' ');
- }
+ dump_type_prefix (TREE_TYPE (fntype), flags);
+ output_add_space (scratch_buffer);
}
/* Print the function name. */
if (cname)
{
- dump_type (cname, 0);
- OB_PUTC2 (':', ':');
- if (TREE_CODE (fntype) == METHOD_TYPE && parmtypes)
- parmtypes = TREE_CHAIN (parmtypes);
- if (DECL_CONSTRUCTOR_FOR_VBASE_P (t))
- /* Skip past "in_charge" identifier. */
- parmtypes = TREE_CHAIN (parmtypes);
+ dump_type (cname, flags);
+ print_scope_operator (scratch_buffer);
}
- else if (CP_DECL_CONTEXT (t) != global_namespace)
+ else
+ dump_scope (CP_DECL_CONTEXT (t), flags);
+
+ dump_function_name (t, flags);
+
+ if (1)
{
- dump_decl (DECL_CONTEXT (t), 0);
- OB_PUTC2 (':',':');
- }
+ dump_parameters (parmtypes, flags);
- if (DESTRUCTOR_NAME_P (name) && DECL_LANGUAGE (t) == lang_cplusplus)
- parmtypes = TREE_CHAIN (parmtypes);
-
- dump_function_name (t);
+ if (TREE_CODE (fntype) == METHOD_TYPE)
+ dump_qualifiers (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype))),
+ before);
- /* If V is negative, we don't print the argument types. */
- if (v < 0)
- return;
+ if (flags & TFF_EXCEPTION_SPECIFICATION)
+ dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), flags);
- dump_parameters (parmtypes, v & 1, 0);
-
- if (v && ! DECL_CONV_FN_P (t))
- dump_type_suffix (TREE_TYPE (fntype), 1, 0);
+ if (show_return)
+ dump_type_suffix (TREE_TYPE (fntype), flags);
+ }
- if (TREE_CODE (fntype) == METHOD_TYPE)
+ /* If T is a template instantiation, dump the parameter binding. */
+ if (template_parms != NULL_TREE && template_args != NULL_TREE)
{
- if (IS_SIGNATURE (cname))
- /* We look at the type pointed to by the `optr' field of `this.' */
- dump_qualifiers
- (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_VALUE (TYPE_ARG_TYPES (fntype))))), before);
- else
- dump_qualifiers
- (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype))), before);
+ output_add_string (scratch_buffer, " [with ");
+ dump_template_bindings (template_parms, template_args);
+ print_right_bracket (scratch_buffer);
}
-
- if (v >= 2)
- dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), 0);
}
-/* Print a parameter list. V indicates if we show default values or not. If
- these are for a member function, the member object ptr
- (and any other hidden args) should have already been removed. */
+/* Print a parameter list. If this is for a member function, the
+ member object ptr (and any other hidden args) should have
+ already been removed. */
static void
-dump_parameters (parmtypes, v, canonical_name)
+dump_parameters (parmtypes, flags)
tree parmtypes;
- int v;
- int canonical_name;
+ int flags;
{
int first;
- OB_PUTC ('(');
+
+ print_left_paren (scratch_buffer);
for (first = 1; parmtypes != void_list_node;
parmtypes = TREE_CHAIN (parmtypes))
{
if (!first)
- OB_PUTC2 (',', ' ');
+ separate_with_comma (scratch_buffer);
first = 0;
if (!parmtypes)
{
- OB_PUTS ("...");
+ print_identifier (scratch_buffer, "...");
break;
}
- dump_type_real (TREE_VALUE (parmtypes), 0, canonical_name);
-
- if (TREE_PURPOSE (parmtypes) && v)
+ dump_type (TREE_VALUE (parmtypes), flags);
+
+ if ((flags & TFF_FUNCTION_DEFAULT_ARGUMENTS) && TREE_PURPOSE (parmtypes))
{
- OB_PUTS (" = ");
- dump_expr (TREE_PURPOSE (parmtypes), 0);
+ output_add_string (scratch_buffer, " = ");
+ dump_expr (TREE_PURPOSE (parmtypes), flags | TFF_EXPR_IN_PARENS);
}
}
- OB_PUTC (')');
+ print_right_paren (scratch_buffer);
}
/* Print an exception specification. T is the exception specification. */
static void
-dump_exception_spec (t, canonical_name)
+dump_exception_spec (t, flags)
tree t;
- int canonical_name;
+ int flags;
{
if (t)
{
- OB_PUTS (" throw (");
+ output_add_string (scratch_buffer, " throw (");
if (TREE_VALUE (t) != NULL_TREE)
while (1)
{
- dump_type_real (TREE_VALUE (t), 0, canonical_name);
+ dump_type (TREE_VALUE (t), flags);
t = TREE_CHAIN (t);
if (!t)
break;
- OB_PUTC2 (',', ' ');
+ separate_with_comma (scratch_buffer);
}
- OB_PUTC (')');
+ print_right_paren (scratch_buffer);
}
}
@@ -1112,15 +1223,21 @@ dump_exception_spec (t, canonical_name)
and destructors properly. */
static void
-dump_function_name (t)
+dump_function_name (t, flags)
tree t;
+ int flags;
{
tree name = DECL_NAME (t);
+ /* Don't let the user see __comp_ctor et al. */
+ if (DECL_CONSTRUCTOR_P (t)
+ || DECL_DESTRUCTOR_P (t))
+ name = constructor_name (DECL_CONTEXT (t));
+
if (DECL_DESTRUCTOR_P (t))
{
- OB_PUTC ('~');
- dump_decl (name, 0);
+ output_add_character (scratch_buffer, '~');
+ dump_decl (name, TFF_PLAIN_IDENTIFIER);
}
else if (DECL_CONV_FN_P (t))
{
@@ -1130,88 +1247,103 @@ dump_function_name (t)
declarations, both will have the same name, yet
the types will be different, hence the TREE_TYPE field
of the first name will be clobbered by the second. */
- OB_PUTS ("operator ");
- dump_type (TREE_TYPE (TREE_TYPE (t)), 0);
+ output_add_string (scratch_buffer, "operator ");
+ dump_type (TREE_TYPE (TREE_TYPE (t)), flags);
}
else if (IDENTIFIER_OPNAME_P (name))
- {
- char *name_string = operator_name_string (name);
- OB_PUTS ("operator ");
- OB_PUTCP (name_string);
- }
+ print_tree_identifier (scratch_buffer, name);
else
- dump_decl (name, 0);
+ dump_decl (name, flags);
- if (DECL_LANG_SPECIFIC (t) && DECL_USE_TEMPLATE (t)
- && DECL_TEMPLATE_INFO (t)
- && (DECL_TEMPLATE_SPECIALIZATION (t)
+ if (DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t)
+ && !DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t)
+ && (DECL_TEMPLATE_SPECIALIZATION (t)
|| TREE_CODE (DECL_TI_TEMPLATE (t)) != TEMPLATE_DECL
|| DECL_TEMPLATE_SPECIALIZATION (DECL_TI_TEMPLATE (t))
|| PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (t))))
- {
- tree args = DECL_TEMPLATE_INFO (t) ? DECL_TI_ARGS (t) : NULL_TREE;
- OB_PUTC ('<');
+ dump_template_parms (DECL_TEMPLATE_INFO (t), !DECL_USE_TEMPLATE (t), flags);
+}
+
+/* Dump the template parameters from the template info INFO under control of
+ FLAGS. PRIMARY indicates whether this is a primary template decl, or
+ specialization (partial or complete). For partial specializations we show
+ the specialized parameter values. For a primary template we show no
+ decoration. */
+
+static void
+dump_template_parms (info, primary, flags)
+ tree info;
+ int primary;
+ int flags;
+{
+ tree args = info ? TI_ARGS (info) : NULL_TREE;
+
+ if (primary && flags & TFF_TEMPLATE_NAME)
+ return;
+ flags &= ~(TFF_CLASS_KEY_OR_ENUM | TFF_TEMPLATE_NAME);
+ print_template_argument_list_start (scratch_buffer);
- /* Be careful only to print things when we have them, so as not
+ /* Be careful only to print things when we have them, so as not
to crash producing error messages. */
- if (args)
- {
- if (TREE_CODE (args) == TREE_LIST)
- {
- tree arg;
- int need_comma = 0;
-
- for (arg = args; arg; arg = TREE_CHAIN (arg))
- {
- tree a = TREE_VALUE (arg);
-
- if (need_comma)
- OB_PUTS (", ");
-
- if (a)
- {
- if (TREE_CODE_CLASS (TREE_CODE (a)) == 't'
- || TREE_CODE (a) == TEMPLATE_DECL)
- dump_type (a, 0);
- else
- dump_expr (a, 0);
- }
-
- need_comma = 1;
- }
- }
- else if (TREE_CODE (args) == TREE_VEC)
- {
- int i;
- int need_comma = 0;
-
- if (TREE_VEC_LENGTH (args) > 0
- && TREE_CODE (TREE_VEC_ELT (args, 0)) == TREE_VEC)
- args = TREE_VEC_ELT (args,
- TREE_VEC_LENGTH (args) - 1);
-
- for (i = 0; i < TREE_VEC_LENGTH (args); i++)
- {
- tree a = TREE_VEC_ELT (args, i);
-
- if (need_comma)
- OB_PUTS (", ");
-
- if (a)
- {
- if (TREE_CODE_CLASS (TREE_CODE (a)) == 't'
- || TREE_CODE (a) == TEMPLATE_DECL)
- dump_type (a, 0);
- else
- dump_expr (a, 0);
- }
-
- need_comma = 1;
- }
- }
- }
- OB_END_TEMPLATE_ID ();
+ if (args && !primary)
+ {
+ int len = 0;
+ int ix = 0;
+ int need_comma = 0;
+
+ if (TREE_CODE (args) == TREE_VEC)
+ {
+ if (TREE_VEC_LENGTH (args) > 0
+ && TREE_CODE (TREE_VEC_ELT (args, 0)) == TREE_VEC)
+ args = TREE_VEC_ELT (args, TREE_VEC_LENGTH (args) - 1);
+
+ len = TREE_VEC_LENGTH (args);
+ }
+ else if (TREE_CODE (args) == TREE_LIST)
+ len = -1;
+ while (ix != len && args)
+ {
+ tree arg;
+ if (len >= 0)
+ {
+ arg = TREE_VEC_ELT (args, ix);
+ ix++;
+ }
+ else
+ {
+ arg = TREE_VALUE (args);
+ args = TREE_CHAIN (args);
+ }
+ if (need_comma)
+ separate_with_comma (scratch_buffer);
+
+ if (!arg)
+ print_identifier (scratch_buffer, "<template parameter error>");
+ else
+ dump_template_argument (arg, flags);
+ need_comma = 1;
+ }
+ }
+ else if (primary)
+ {
+ tree tpl = TI_TEMPLATE (info);
+ tree parms = DECL_TEMPLATE_PARMS (tpl);
+ int len, ix;
+
+ parms = TREE_CODE (parms) == TREE_LIST ? TREE_VALUE (parms) : NULL_TREE;
+ len = parms ? TREE_VEC_LENGTH (parms) : 0;
+
+ for (ix = 0; ix != len; ix++)
+ {
+ tree parm = TREE_VALUE (TREE_VEC_ELT (parms, ix));
+
+ if (ix)
+ separate_with_comma (scratch_buffer);
+
+ dump_decl (parm, flags & ~TFF_DECL_SPECIFIERS);
+ }
}
+ print_template_argument_list_end (scratch_buffer);
}
static void
@@ -1221,42 +1353,42 @@ dump_char (c)
switch (c)
{
case TARGET_NEWLINE:
- OB_PUTS ("\\n");
+ output_add_string (scratch_buffer, "\\n");
break;
case TARGET_TAB:
- OB_PUTS ("\\t");
+ output_add_string (scratch_buffer, "\\t");
break;
case TARGET_VT:
- OB_PUTS ("\\v");
+ output_add_string (scratch_buffer, "\\v");
break;
case TARGET_BS:
- OB_PUTS ("\\b");
+ output_add_string (scratch_buffer, "\\b");
break;
case TARGET_CR:
- OB_PUTS ("\\r");
+ output_add_string (scratch_buffer, "\\r");
break;
case TARGET_FF:
- OB_PUTS ("\\f");
+ output_add_string (scratch_buffer, "\\f");
break;
case TARGET_BELL:
- OB_PUTS ("\\a");
+ output_add_string (scratch_buffer, "\\a");
break;
case '\\':
- OB_PUTS ("\\\\");
+ output_add_string (scratch_buffer, "\\\\");
break;
case '\'':
- OB_PUTS ("\\'");
+ output_add_string (scratch_buffer, "\\'");
break;
case '\"':
- OB_PUTS ("\\\"");
+ output_add_string (scratch_buffer, "\\\"");
break;
default:
if (ISPRINT (c))
- OB_PUTC (c);
+ output_add_character (scratch_buffer, c);
else
{
sprintf (digit_buffer, "\\%03o", (int) c);
- OB_PUTCP (digit_buffer);
+ output_add_string (scratch_buffer, digit_buffer);
}
}
}
@@ -1264,24 +1396,25 @@ dump_char (c)
/* Print out a list of initializers (subr of dump_expr) */
static void
-dump_expr_list (l)
+dump_expr_list (l, flags)
tree l;
+ int flags;
{
while (l)
{
- dump_expr (TREE_VALUE (l), 0);
- if (TREE_CHAIN (l))
- OB_PUTC2 (',', ' ');
+ dump_expr (TREE_VALUE (l), flags | TFF_EXPR_IN_PARENS);
l = TREE_CHAIN (l);
+ if (l)
+ separate_with_comma (scratch_buffer);
}
}
-/* Print out an expression */
+/* Print out an expression E under control of FLAGS. */
static void
-dump_expr (t, nop)
+dump_expr (t, flags)
tree t;
- int nop; /* suppress parens */
+ int flags;
{
switch (TREE_CODE (t))
{
@@ -1292,7 +1425,8 @@ dump_expr (t, nop)
case FUNCTION_DECL:
case TEMPLATE_DECL:
case NAMESPACE_DECL:
- dump_decl (t, -1);
+ case OVERLOAD:
+ dump_decl (t, flags & ~TFF_DECL_SPECIFIERS);
break;
case INTEGER_CST:
@@ -1303,47 +1437,65 @@ dump_expr (t, nop)
/* If it's an enum, output its tag, rather than its value. */
if (TREE_CODE (type) == ENUMERAL_TYPE)
{
- char *p = enum_name_string (t, type);
- OB_PUTCP (p);
+ tree values = TYPE_VALUES (type);
+
+ for (; values;
+ values = TREE_CHAIN (values))
+ if (tree_int_cst_equal (TREE_VALUE (values), t))
+ break;
+
+ if (values)
+ print_tree_identifier (scratch_buffer, TREE_PURPOSE (values));
+ else
+ {
+ /* Value must have been cast. */
+ print_left_paren (scratch_buffer);
+ dump_type (type, flags);
+ print_right_paren (scratch_buffer);
+ goto do_int;
+ }
}
else if (type == boolean_type_node)
{
- if (t == boolean_false_node
- || (TREE_INT_CST_LOW (t) == 0
- && TREE_INT_CST_HIGH (t) == 0))
- OB_PUTS ("false");
+ if (t == boolean_false_node || integer_zerop (t))
+ print_identifier (scratch_buffer, "false");
else if (t == boolean_true_node)
- OB_PUTS ("true");
+ print_identifier (scratch_buffer, "true");
}
else if (type == char_type_node)
{
- OB_PUTC ('\'');
- dump_char (TREE_INT_CST_LOW (t));
- OB_PUTC ('\'');
+ output_add_character (scratch_buffer, '\'');
+ dump_char (tree_low_cst (t, 0));
+ output_add_character (scratch_buffer, '\'');
}
- else if (TREE_INT_CST_HIGH (t)
- != (TREE_INT_CST_LOW (t) >> (HOST_BITS_PER_WIDE_INT - 1)))
+ else
{
- tree val = t;
- if (TREE_INT_CST_HIGH (val) < 0)
+ do_int:
+ if (! host_integerp (t, 0))
{
- OB_PUTC ('-');
- val = build_int_2 (~TREE_INT_CST_LOW (val),
- -TREE_INT_CST_HIGH (val));
+ tree val = t;
+
+ if (tree_int_cst_sgn (val) < 0)
+ {
+ output_add_character (scratch_buffer, '-');
+ val = build_int_2 (-TREE_INT_CST_LOW (val),
+ ~TREE_INT_CST_HIGH (val)
+ + !TREE_INT_CST_LOW (val));
+ }
+ /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
+ systems? */
+ {
+ static char format[10]; /* "%x%09999x\0" */
+ if (!format[0])
+ sprintf (format, "%%x%%0%dx", HOST_BITS_PER_INT / 4);
+ sprintf (digit_buffer, format, TREE_INT_CST_HIGH (val),
+ TREE_INT_CST_LOW (val));
+ output_add_string (scratch_buffer, digit_buffer);
+ }
}
- /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
- systems? */
- {
- static char format[10]; /* "%x%09999x\0" */
- if (!format[0])
- sprintf (format, "%%x%%0%dx", HOST_BITS_PER_INT / 4);
- sprintf (digit_buffer, format, TREE_INT_CST_HIGH (val),
- TREE_INT_CST_LOW (val));
- OB_PUTCP (digit_buffer);
- }
+ else
+ print_integer (scratch_buffer, TREE_INT_CST_LOW (t));
}
- else
- OB_PUTI (TREE_INT_CST_LOW (t));
}
break;
@@ -1352,75 +1504,96 @@ dump_expr (t, nop)
sprintf (digit_buffer, "%g", TREE_REAL_CST (t));
#else
{
- unsigned char *p = (unsigned char *) &TREE_REAL_CST (t);
+ const unsigned char *p = (const unsigned char *) &TREE_REAL_CST (t);
size_t i;
strcpy (digit_buffer, "0x");
for (i = 0; i < sizeof TREE_REAL_CST (t); i++)
sprintf (digit_buffer + 2 + 2*i, "%02x", *p++);
}
#endif
- OB_PUTCP (digit_buffer);
+ output_add_string (scratch_buffer, digit_buffer);
break;
case PTRMEM_CST:
- OB_PUTC ('&');
- dump_type (PTRMEM_CST_CLASS (t), 0);
- OB_PUTS ("::");
- OB_PUTID (DECL_NAME (PTRMEM_CST_MEMBER (t)));
+ output_add_character (scratch_buffer, '&');
+ dump_type (PTRMEM_CST_CLASS (t), flags);
+ print_scope_operator (scratch_buffer);
+ print_tree_identifier
+ (scratch_buffer, DECL_NAME (PTRMEM_CST_MEMBER (t)));
break;
case STRING_CST:
{
- char *p = TREE_STRING_POINTER (t);
+ const char *p = TREE_STRING_POINTER (t);
int len = TREE_STRING_LENGTH (t) - 1;
int i;
- OB_PUTC ('\"');
+ output_add_character (scratch_buffer, '\"');
for (i = 0; i < len; i++)
dump_char (p[i]);
- OB_PUTC ('\"');
+ output_add_character (scratch_buffer, '\"');
}
break;
case COMPOUND_EXPR:
- dump_binary_op (",", t);
+ print_left_paren (scratch_buffer);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
+ separate_with_comma (scratch_buffer);
+ dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
+ print_right_paren (scratch_buffer);
break;
case COND_EXPR:
- OB_PUTC ('(');
- dump_expr (TREE_OPERAND (t, 0), 0);
- OB_PUTS (" ? ");
- dump_expr (TREE_OPERAND (t, 1), 0);
- OB_PUTS (" : ");
- dump_expr (TREE_OPERAND (t, 2), 0);
- OB_PUTC (')');
+ print_left_paren (scratch_buffer);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
+ output_add_string (scratch_buffer, " ? ");
+ dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
+ output_add_string (scratch_buffer, " : ");
+ dump_expr (TREE_OPERAND (t, 2), flags | TFF_EXPR_IN_PARENS);
+ print_right_paren (scratch_buffer);
break;
case SAVE_EXPR:
if (TREE_HAS_CONSTRUCTOR (t))
{
- OB_PUTS ("new ");
- dump_type (TREE_TYPE (TREE_TYPE (t)), 0);
+ output_add_string (scratch_buffer, "new ");
+ dump_type (TREE_TYPE (TREE_TYPE (t)), flags);
}
else
{
- dump_expr (TREE_OPERAND (t, 0), 0);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
}
break;
case AGGR_INIT_EXPR:
- OB_PUTID (TYPE_IDENTIFIER (TREE_TYPE (t)));
- OB_PUTC ('(');
+ {
+ tree fn = NULL_TREE;
+
+ if (TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR)
+ fn = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
+
+ if (fn && TREE_CODE (fn) == FUNCTION_DECL)
+ {
+ if (DECL_CONSTRUCTOR_P (fn))
+ print_tree_identifier
+ (scratch_buffer, TYPE_IDENTIFIER (TREE_TYPE (t)));
+ else
+ dump_decl (fn, 0);
+ }
+ else
+ dump_expr (TREE_OPERAND (t, 0), 0);
+ }
+ print_left_paren (scratch_buffer);
if (TREE_OPERAND (t, 1))
- dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1)));
- OB_PUTC (')');
+ dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1)), flags);
+ print_right_paren (scratch_buffer);
break;
case CALL_EXPR:
{
tree fn = TREE_OPERAND (t, 0);
tree args = TREE_OPERAND (t, 1);
-
+
if (TREE_CODE (fn) == ADDR_EXPR)
fn = TREE_OPERAND (fn, 0);
@@ -1429,21 +1602,21 @@ dump_expr (t, nop)
tree ob = TREE_VALUE (args);
if (TREE_CODE (ob) == ADDR_EXPR)
{
- dump_expr (TREE_OPERAND (ob, 0), 0);
- OB_PUTC ('.');
+ dump_expr (TREE_OPERAND (ob, 0), flags | TFF_EXPR_IN_PARENS);
+ output_add_character (scratch_buffer, '.');
}
else if (TREE_CODE (ob) != PARM_DECL
|| strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))
{
- dump_expr (ob, 0);
- OB_PUTC2 ('-', '>');
+ dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
+ output_add_string (scratch_buffer, "->");
}
args = TREE_CHAIN (args);
}
- dump_expr (fn, 0);
- OB_PUTC ('(');
- dump_expr_list (args);
- OB_PUTC (')');
+ dump_expr (fn, flags | TFF_EXPR_IN_PARENS);
+ print_left_paren (scratch_buffer);
+ dump_expr_list (args, flags);
+ print_right_paren (scratch_buffer);
}
break;
@@ -1451,25 +1624,26 @@ dump_expr (t, nop)
{
tree type = TREE_OPERAND (t, 1);
if (NEW_EXPR_USE_GLOBAL (t))
- OB_PUTS ("::");
- OB_PUTS ("new ");
+ print_scope_operator (scratch_buffer);
+ output_add_string (scratch_buffer, "new ");
if (TREE_OPERAND (t, 0))
{
- OB_PUTC ('(');
- dump_expr_list (TREE_OPERAND (t, 0));
- OB_PUTS (") ");
+ print_left_paren (scratch_buffer);
+ dump_expr_list (TREE_OPERAND (t, 0), flags);
+ output_add_string (scratch_buffer, ") ");
}
if (TREE_CODE (type) == ARRAY_REF)
type = build_cplus_array_type
(TREE_OPERAND (type, 0),
- build_index_type (size_binop (MINUS_EXPR, TREE_OPERAND (type, 1),
- integer_one_node)));
- dump_type (type, 0);
+ build_index_type (fold (build (MINUS_EXPR, integer_type_node,
+ TREE_OPERAND (type, 1),
+ integer_one_node))));
+ dump_type (type, flags);
if (TREE_OPERAND (t, 2))
{
- OB_PUTC ('(');
- dump_expr_list (TREE_OPERAND (t, 2));
- OB_PUTC (')');
+ print_left_paren (scratch_buffer);
+ dump_expr_list (TREE_OPERAND (t, 2), flags);
+ print_right_paren (scratch_buffer);
}
}
break;
@@ -1481,9 +1655,10 @@ dump_expr (t, nop)
default argument. Note we may have cleared out the first
operand in expand_expr, so don't go killing ourselves. */
if (TREE_OPERAND (t, 1))
- dump_expr (TREE_OPERAND (t, 1), 0);
+ dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
break;
+ case INIT_EXPR:
case MODIFY_EXPR:
case PLUS_EXPR:
case MINUS_EXPR:
@@ -1506,19 +1681,20 @@ dump_expr (t, nop)
case GE_EXPR:
case EQ_EXPR:
case NE_EXPR:
- dump_binary_op (opname_tab[(int) TREE_CODE (t)], t);
+ case EXACT_DIV_EXPR:
+ dump_binary_op (operator_name_info[(int) TREE_CODE (t)].name, t, flags);
break;
case CEIL_DIV_EXPR:
case FLOOR_DIV_EXPR:
case ROUND_DIV_EXPR:
- dump_binary_op ("/", t);
+ dump_binary_op ("/", t, flags);
break;
case CEIL_MOD_EXPR:
case FLOOR_MOD_EXPR:
case ROUND_MOD_EXPR:
- dump_binary_op ("%", t);
+ dump_binary_op ("%", t, flags);
break;
case COMPONENT_REF:
@@ -1530,36 +1706,49 @@ dump_expr (t, nop)
if (TREE_CODE (ob) != PARM_DECL
|| strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))
{
- dump_expr (ob, 0);
- OB_PUTC2 ('-', '>');
+ dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
+ output_add_string (scratch_buffer, "->");
}
}
else
{
- dump_expr (ob, 0);
- OB_PUTC ('.');
+ dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
+ output_add_character (scratch_buffer, '.');
}
- dump_expr (TREE_OPERAND (t, 1), 1);
+ dump_expr (TREE_OPERAND (t, 1), flags & ~TFF_EXPR_IN_PARENS);
}
break;
case ARRAY_REF:
- dump_expr (TREE_OPERAND (t, 0), 0);
- OB_PUTC ('[');
- dump_expr (TREE_OPERAND (t, 1), 0);
- OB_PUTC (']');
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
+ print_left_bracket (scratch_buffer);
+ dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
+ print_right_bracket (scratch_buffer);
break;
case CONVERT_EXPR:
- dump_unary_op ("+", t, nop);
+ if (VOID_TYPE_P (TREE_TYPE (t)))
+ {
+ print_left_paren (scratch_buffer);
+ dump_type (TREE_TYPE (t), flags);
+ print_right_paren (scratch_buffer);
+ dump_expr (TREE_OPERAND (t, 0), flags);
+ }
+ else
+ dump_unary_op ("+", t, flags);
break;
case ADDR_EXPR:
if (TREE_CODE (TREE_OPERAND (t, 0)) == FUNCTION_DECL
- || TREE_CODE (TREE_OPERAND (t, 0)) == STRING_CST)
- dump_expr (TREE_OPERAND (t, 0), 0);
+ || TREE_CODE (TREE_OPERAND (t, 0)) == STRING_CST
+ /* An ADDR_EXPR can have reference type. In that case, we
+ shouldn't print the `&' doing so indicates to the user
+ that the expression has pointer type. */
+ || (TREE_TYPE (t)
+ && TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE))
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
else
- dump_unary_op ("&", t, nop);
+ dump_unary_op ("&", t, flags);
break;
case INDIRECT_REF:
@@ -1567,19 +1756,19 @@ dump_expr (t, nop)
{
t = TREE_OPERAND (t, 0);
my_friendly_assert (TREE_CODE (t) == CALL_EXPR, 237);
- dump_expr (TREE_OPERAND (t, 0), 0);
- OB_PUTC ('(');
- dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1)));
- OB_PUTC (')');
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
+ print_left_paren (scratch_buffer);
+ dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1)), flags);
+ print_right_paren (scratch_buffer);
}
else
{
if (TREE_OPERAND (t,0) != NULL_TREE
&& TREE_TYPE (TREE_OPERAND (t, 0))
&& NEXT_CODE (TREE_OPERAND (t, 0)) == REFERENCE_TYPE)
- dump_expr (TREE_OPERAND (t, 0), nop);
+ dump_expr (TREE_OPERAND (t, 0), flags);
else
- dump_unary_op ("*", t, nop);
+ dump_unary_op ("*", t, flags);
}
break;
@@ -1588,15 +1777,16 @@ dump_expr (t, nop)
case TRUTH_NOT_EXPR:
case PREDECREMENT_EXPR:
case PREINCREMENT_EXPR:
- dump_unary_op (opname_tab [(int)TREE_CODE (t)], t, nop);
+ dump_unary_op (operator_name_info [(int)TREE_CODE (t)].name, t, flags);
break;
case POSTDECREMENT_EXPR:
case POSTINCREMENT_EXPR:
- OB_PUTC ('(');
- dump_expr (TREE_OPERAND (t, 0), 0);
- OB_PUTCP (opname_tab[(int)TREE_CODE (t)]);
- OB_PUTC (')');
+ print_left_paren (scratch_buffer);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
+ print_identifier
+ (scratch_buffer, operator_name_info[(int)TREE_CODE (t)].name);
+ print_right_paren (scratch_buffer);
break;
case NON_LVALUE_EXPR:
@@ -1609,55 +1799,53 @@ dump_expr (t, nop)
while (TREE_CODE (next) == POINTER_TYPE)
next = TREE_TYPE (next);
-
+
if (TREE_CODE (next) == FUNCTION_TYPE)
{
- if (!nop) OB_PUTC ('(');
- OB_PUTC ('*');
- dump_expr (TREE_OPERAND (t, 0), 1);
- if (!nop) OB_PUTC (')');
+ if (flags & TFF_EXPR_IN_PARENS)
+ print_left_paren (scratch_buffer);
+ output_add_character (scratch_buffer, '*');
+ dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
+ if (flags & TFF_EXPR_IN_PARENS)
+ print_right_paren (scratch_buffer);
break;
}
/* else FALLTHRU */
}
- dump_expr (TREE_OPERAND (t, 0), 0);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
break;
case NOP_EXPR:
- dump_expr (TREE_OPERAND (t, 0), nop);
+ dump_expr (TREE_OPERAND (t, 0), flags);
+ break;
+
+ case EXPR_WITH_FILE_LOCATION:
+ dump_expr (EXPR_WFL_NODE (t), flags);
break;
case CONSTRUCTOR:
if (TREE_TYPE (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))
{
- tree idx = build_component_ref (t, index_identifier, NULL_TREE, 0);
+ tree idx = build_component_ref (t, pfn_identifier, NULL_TREE, 0);
- if (integer_all_onesp (idx))
- {
- tree pfn = PFN_FROM_PTRMEMFUNC (t);
- dump_unary_op ("&", pfn, 0);
- break;
- }
- else if (TREE_CODE (idx) == INTEGER_CST
- && tree_int_cst_equal (idx, integer_zero_node))
+ if (integer_zerop (idx))
{
/* A NULL pointer-to-member constant. */
- OB_PUTS ("((");
- dump_type (TREE_TYPE (t), 0);
- OB_PUTS (") 0)");
+ output_add_string (scratch_buffer, "((");
+ dump_type (TREE_TYPE (t), flags);
+ output_add_string (scratch_buffer, ") 0)");
break;
}
- else if (TREE_CODE (idx) == INTEGER_CST
- && TREE_INT_CST_HIGH (idx) == 0)
+ else if (host_integerp (idx, 0))
{
tree virtuals;
unsigned HOST_WIDE_INT n;
t = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (t)));
t = TYPE_METHOD_BASETYPE (t);
- virtuals = BINFO_VIRTUALS (TYPE_BINFO (TYPE_MAIN_VARIANT (t)));
-
- n = TREE_INT_CST_LOW (idx);
+ virtuals = TYPE_BINFO_VIRTUALS (TYPE_MAIN_VARIANT (t));
+
+ n = tree_low_cst (idx, 0);
/* Map vtable index back one, to allow for the null pointer to
member. */
@@ -1670,14 +1858,15 @@ dump_expr (t, nop)
}
if (virtuals)
{
- dump_expr (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals)), 0);
+ dump_expr (BV_FN (virtuals),
+ flags | TFF_EXPR_IN_PARENS);
break;
}
}
}
- OB_PUTC ('{');
- dump_expr_list (CONSTRUCTOR_ELTS (t));
- OB_PUTC ('}');
+ output_add_character (scratch_buffer, '{');
+ dump_expr_list (CONSTRUCTOR_ELTS (t), flags);
+ output_add_character (scratch_buffer, '}');
break;
case OFFSET_REF:
@@ -1688,268 +1877,287 @@ dump_expr (t, nop)
t = TREE_OPERAND (t, 1);
if (TREE_CODE (t) == FUNCTION_DECL)
/* A::f */
- dump_expr (t, 0);
+ dump_expr (t, flags | TFF_EXPR_IN_PARENS);
else if (BASELINK_P (t))
- dump_expr (OVL_CURRENT (TREE_VALUE (t)), 0);
+ dump_expr (OVL_CURRENT (TREE_VALUE (t)), flags | TFF_EXPR_IN_PARENS);
else
- dump_decl (t, 0);
+ dump_decl (t, flags);
}
else
{
if (TREE_CODE (ob) == INDIRECT_REF)
{
- dump_expr (TREE_OPERAND (ob, 0), 0);
- OB_PUTS (" ->* ");
+ dump_expr (TREE_OPERAND (ob, 0), flags | TFF_EXPR_IN_PARENS);
+ output_add_string (scratch_buffer, "->*");
}
else
{
- dump_expr (ob, 0);
- OB_PUTS (" .* ");
+ dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
+ output_add_string (scratch_buffer, ".*");
}
- dump_expr (TREE_OPERAND (t, 1), 0);
+ dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
}
break;
}
case TEMPLATE_PARM_INDEX:
- dump_decl (TEMPLATE_PARM_DECL (t), -1);
+ dump_decl (TEMPLATE_PARM_DECL (t), flags & ~TFF_DECL_SPECIFIERS);
break;
case IDENTIFIER_NODE:
- OB_PUTID (t);
+ print_tree_identifier (scratch_buffer, t);
break;
case SCOPE_REF:
- dump_type (TREE_OPERAND (t, 0), 0);
- OB_PUTS ("::");
- dump_expr (TREE_OPERAND (t, 1), 0);
+ dump_type (TREE_OPERAND (t, 0), flags);
+ print_scope_operator (scratch_buffer);
+ dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
break;
case CAST_EXPR:
if (TREE_OPERAND (t, 0) == NULL_TREE
|| TREE_CHAIN (TREE_OPERAND (t, 0)))
{
- dump_type (TREE_TYPE (t), 0);
- OB_PUTC ('(');
- dump_expr_list (TREE_OPERAND (t, 0));
- OB_PUTC (')');
+ dump_type (TREE_TYPE (t), flags);
+ print_left_paren (scratch_buffer);
+ dump_expr_list (TREE_OPERAND (t, 0), flags);
+ print_right_paren (scratch_buffer);
}
else
{
- OB_PUTC ('(');
- dump_type (TREE_TYPE (t), 0);
- OB_PUTC (')');
- OB_PUTC ('(');
- dump_expr_list (TREE_OPERAND (t, 0));
- OB_PUTC (')');
+ print_left_paren (scratch_buffer);
+ dump_type (TREE_TYPE (t), flags);
+ output_add_string (scratch_buffer, ")(");
+ dump_expr_list (TREE_OPERAND (t, 0), flags);
+ print_right_paren (scratch_buffer);
}
break;
+ case STATIC_CAST_EXPR:
+ output_add_string (scratch_buffer, "static_cast<");
+ goto cast;
+ case REINTERPRET_CAST_EXPR:
+ output_add_string (scratch_buffer, "reinterpret_cast<");
+ goto cast;
+ case CONST_CAST_EXPR:
+ output_add_string (scratch_buffer, "const_cast<");
+ goto cast;
+ case DYNAMIC_CAST_EXPR:
+ output_add_string (scratch_buffer, "dynamic_cast<");
+ cast:
+ dump_type (TREE_TYPE (t), flags);
+ output_add_string (scratch_buffer, ">(");
+ dump_expr (TREE_OPERAND (t, 0), flags);
+ print_right_paren (scratch_buffer);
+ break;
+
case LOOKUP_EXPR:
- OB_PUTID (TREE_OPERAND (t, 0));
+ print_tree_identifier (scratch_buffer, TREE_OPERAND (t, 0));
break;
case ARROW_EXPR:
- dump_expr (TREE_OPERAND (t, 0), nop);
- OB_PUTS ("->");
+ dump_expr (TREE_OPERAND (t, 0), flags);
+ output_add_string (scratch_buffer, "->");
break;
case SIZEOF_EXPR:
case ALIGNOF_EXPR:
if (TREE_CODE (t) == SIZEOF_EXPR)
- OB_PUTS ("sizeof (");
- else
+ output_add_string (scratch_buffer, "sizeof (");
+ else
{
my_friendly_assert (TREE_CODE (t) == ALIGNOF_EXPR, 0);
- OB_PUTS ("__alignof__ (");
+ output_add_string (scratch_buffer, "__alignof__ (");
}
- if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t, 0))) == 't')
- dump_type (TREE_OPERAND (t, 0), 0);
+ if (TYPE_P (TREE_OPERAND (t, 0)))
+ dump_type (TREE_OPERAND (t, 0), flags);
else
- dump_unary_op ("*", t, 0);
- OB_PUTC (')');
+ dump_unary_op ("*", t, flags | TFF_EXPR_IN_PARENS);
+ print_right_paren (scratch_buffer);
break;
case DEFAULT_ARG:
- OB_PUTS ("{unparsed}");
+ print_identifier (scratch_buffer, "<unparsed>");
break;
case TRY_CATCH_EXPR:
case WITH_CLEANUP_EXPR:
case CLEANUP_POINT_EXPR:
- dump_expr (TREE_OPERAND (t, 0), nop);
+ dump_expr (TREE_OPERAND (t, 0), flags);
+ break;
+
+ case PSEUDO_DTOR_EXPR:
+ dump_expr (TREE_OPERAND (t, 2), flags);
+ output_add_character (scratch_buffer, '.');
+ dump_type (TREE_OPERAND (t, 0), flags);
+ output_add_string (scratch_buffer, "::~");
+ dump_type (TREE_OPERAND (t, 1), flags);
break;
case TEMPLATE_ID_EXPR:
- dump_decl (t, 0);
+ dump_decl (t, flags);
+ break;
+
+ case STMT_EXPR:
+ /* We don't yet have a way of dumping statements in a
+ human-readable format. */
+ output_add_string (scratch_buffer, "({...})");
+ break;
+
+ case BIND_EXPR:
+ output_add_character (scratch_buffer, '{');
+ dump_expr (TREE_OPERAND (t, 1), flags & ~TFF_EXPR_IN_PARENS);
+ output_add_character (scratch_buffer, '}');
+ break;
+
+ case LOOP_EXPR:
+ output_add_string (scratch_buffer, "while (1) { ");
+ dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
+ output_add_character (scratch_buffer, '}');
+ break;
+
+ case EXIT_EXPR:
+ output_add_string (scratch_buffer, "if (");
+ dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
+ output_add_string (scratch_buffer, ") break; ");
break;
case TREE_LIST:
if (TREE_VALUE (t) && TREE_CODE (TREE_VALUE (t)) == FUNCTION_DECL)
{
- OB_PUTID (DECL_NAME (TREE_VALUE (t)));
+ print_tree_identifier (scratch_buffer, DECL_NAME (TREE_VALUE (t)));
break;
}
- /* else fall through */
+ /* else fall through */
/* This list is incomplete, but should suffice for now.
It is very important that `sorry' does not call
`report_error_function'. That could cause an infinite loop. */
default:
- sorry ("`%s' not supported by dump_expr",
- tree_code_name[(int) TREE_CODE (t)]);
-
+ sorry_for_unsupported_tree (t);
/* fall through to ERROR_MARK... */
case ERROR_MARK:
- OB_PUTCP ("{error}");
+ print_identifier (scratch_buffer, "<expression error>");
break;
}
}
static void
-dump_binary_op (opstring, t)
- char *opstring;
+dump_binary_op (opstring, t, flags)
+ const char *opstring;
tree t;
+ int flags;
{
- OB_PUTC ('(');
- dump_expr (TREE_OPERAND (t, 0), 1);
- OB_PUTC (' ');
- OB_PUTCP (opstring);
- OB_PUTC (' ');
- dump_expr (TREE_OPERAND (t, 1), 1);
- OB_PUTC (')');
+ print_left_paren (scratch_buffer);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
+ output_add_space (scratch_buffer);
+ if (opstring)
+ print_identifier (scratch_buffer, opstring);
+ else
+ print_identifier (scratch_buffer, "<unknown operator>");
+ output_add_space (scratch_buffer);
+ dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
+ print_right_paren (scratch_buffer);
}
static void
-dump_unary_op (opstring, t, nop)
- char *opstring;
+dump_unary_op (opstring, t, flags)
+ const char *opstring;
tree t;
- int nop;
+ int flags;
{
- if (!nop) OB_PUTC ('(');
- OB_PUTCP (opstring);
- dump_expr (TREE_OPERAND (t, 0), 1);
- if (!nop) OB_PUTC (')');
+ if (flags & TFF_EXPR_IN_PARENS)
+ print_left_paren (scratch_buffer);
+ print_identifier (scratch_buffer, opstring);
+ dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
+ if (flags & TFF_EXPR_IN_PARENS)
+ print_right_paren (scratch_buffer);
}
-/* Print a function decl with exception specification included. */
+/* Exported interface to stringifying types, exprs and decls under TFF_*
+ control. */
-char *
-fndecl_as_string (fndecl, print_default_args_p)
- tree fndecl;
- int print_default_args_p;
+const char *
+type_as_string (typ, flags)
+ tree typ;
+ int flags;
{
- OB_INIT ();
+ reinit_global_formatting_buffer ();
- dump_function_decl (fndecl, 2 + print_default_args_p);
-
- OB_FINISH ();
+ dump_type (typ, flags);
- return (char *)obstack_base (&scratch_obstack);
+ return output_finalize_message (scratch_buffer);
}
-/* Same, but handle a _TYPE.
- Called from convert_to_reference, mangle_class_name_for_template,
- build_unary_op, and GNU_xref_decl. If CANONICAL_NAME is non-zero,
- when describing a typedef, we use the name of the type described,
- rather than the name of the typedef. */
-
-char *
-type_as_string_real (typ, v, canonical_name)
- tree typ;
- int v;
- int canonical_name;
+const char *
+expr_as_string (decl, flags)
+ tree decl;
+ int flags;
{
- OB_INIT ();
-
- dump_type_real (typ, v, canonical_name);
-
- OB_FINISH ();
-
- return (char *)obstack_base (&scratch_obstack);
-}
+ reinit_global_formatting_buffer ();
+ dump_expr (decl, flags);
-char *
-type_as_string (typ, v)
- tree typ;
- int v;
-{
- return type_as_string_real (typ, v, 0);
+ return output_finalize_message (scratch_buffer);
}
-char *
-expr_as_string (decl, v)
+const char *
+decl_as_string (decl, flags)
tree decl;
- int v ATTRIBUTE_UNUSED;
+ int flags;
{
- OB_INIT ();
+ reinit_global_formatting_buffer ();
- dump_expr (decl, 1);
+ dump_decl (decl, flags);
- OB_FINISH ();
-
- return (char *)obstack_base (&scratch_obstack);
+ return output_finalize_message (scratch_buffer);
}
-/* A cross between type_as_string and fndecl_as_string.
- Only called from substitute_nice_name. */
-
-char *
-decl_as_string (decl, v)
- tree decl;
- int v;
+const char *
+context_as_string (context, flags)
+ tree context;
+ int flags;
{
- OB_INIT ();
+ reinit_global_formatting_buffer ();
- dump_decl (decl, v);
+ dump_scope (context, flags);
- OB_FINISH ();
-
- return (char *)obstack_base (&scratch_obstack);
+ return output_finalize_message (scratch_buffer);
}
/* Generate the three forms of printable names for lang_printable_name. */
-char *
+const char *
lang_decl_name (decl, v)
tree decl;
int v;
{
if (v >= 2)
- return decl_as_string (decl, 1);
+ return decl_as_string (decl, TFF_DECL_SPECIFIERS);
- OB_INIT ();
+ reinit_global_formatting_buffer ();
if (v == 1 && DECL_CLASS_SCOPE_P (decl))
{
- tree cname;
- if (TREE_CODE (decl) == FUNCTION_DECL)
- cname = DECL_CLASS_CONTEXT (decl);
- else
- cname = DECL_CONTEXT (decl);
- dump_type (cname, 0);
- OB_PUTC2 (':', ':');
+ dump_type (CP_DECL_CONTEXT (decl), TFF_PLAIN_IDENTIFIER);
+ print_scope_operator (scratch_buffer);
}
if (TREE_CODE (decl) == FUNCTION_DECL)
- dump_function_name (decl);
+ dump_function_name (decl, TFF_PLAIN_IDENTIFIER);
else
- dump_decl (DECL_NAME (decl), 0);
+ dump_decl (DECL_NAME (decl), TFF_PLAIN_IDENTIFIER);
- OB_FINISH ();
-
- return (char *)obstack_base (&scratch_obstack);
+ return output_finalize_message (scratch_buffer);
}
-
-char *
+const char *
cp_file_of (t)
tree t;
{
if (TREE_CODE (t) == PARM_DECL && DECL_CONTEXT (t))
return DECL_SOURCE_FILE (DECL_CONTEXT (t));
- else if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
+ else if (TYPE_P (t))
return DECL_SOURCE_FILE (TYPE_MAIN_DECL (t));
else if (TREE_CODE (t) == OVERLOAD)
return DECL_SOURCE_FILE (OVL_FUNCTION (t));
@@ -1968,7 +2176,7 @@ cp_line_of (t)
&& TYPE_MAIN_DECL (TREE_TYPE (t)))
t = TREE_TYPE (t);
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
+ if (TYPE_P (t))
line = DECL_SOURCE_LINE (TYPE_MAIN_DECL (t));
else if (TREE_CODE (t) == OVERLOAD)
line = DECL_SOURCE_LINE (OVL_FUNCTION (t));
@@ -1981,16 +2189,73 @@ cp_line_of (t)
return line;
}
-char *
-code_as_string (c, v)
+/* Now the interfaces from error et al to dump_type et al. Each takes an
+ on/off VERBOSE flag and supply the appropriate TFF_ flags to a dump_
+ function. */
+
+static const char *
+decl_to_string (decl, verbose)
+ tree decl;
+ int verbose;
+{
+ int flags = 0;
+
+ if (TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == RECORD_TYPE
+ || TREE_CODE (decl) == UNION_TYPE || TREE_CODE (decl) == ENUMERAL_TYPE)
+ flags = TFF_CLASS_KEY_OR_ENUM;
+ if (verbose)
+ flags |= TFF_DECL_SPECIFIERS | TFF_FUNCTION_DEFAULT_ARGUMENTS;
+ else if (TREE_CODE (decl) == FUNCTION_DECL)
+ flags |= TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE;
+ flags |= TFF_TEMPLATE_HEADER;
+
+ reinit_global_formatting_buffer ();
+
+ dump_decl (decl, flags);
+
+ return output_finalize_message (scratch_buffer);
+}
+
+static const char *
+expr_to_string (decl, verbose)
+ tree decl;
+ int verbose ATTRIBUTE_UNUSED;
+{
+ reinit_global_formatting_buffer ();
+
+ dump_expr (decl, 0);
+
+ return output_finalize_message (scratch_buffer);
+}
+
+static const char *
+fndecl_to_string (fndecl, verbose)
+ tree fndecl;
+ int verbose;
+{
+ int flags;
+
+ flags = TFF_EXCEPTION_SPECIFICATION | TFF_DECL_SPECIFIERS;
+ if (verbose)
+ flags |= TFF_FUNCTION_DEFAULT_ARGUMENTS;
+ reinit_global_formatting_buffer ();
+
+ dump_decl (fndecl, flags);
+
+ return output_finalize_message (scratch_buffer);
+}
+
+
+static const char *
+code_to_string (c, v)
enum tree_code c;
int v ATTRIBUTE_UNUSED;
{
return tree_code_name [c];
}
-char *
-language_as_string (c, v)
+const char *
+language_to_string (c, v)
enum languages c;
int v ATTRIBUTE_UNUSED;
{
@@ -2006,15 +2271,15 @@ language_as_string (c, v)
return "Java";
default:
- my_friendly_abort (355);
+ abort ();
return 0;
}
}
/* Return the proper printed version of a parameter to a C++ function. */
-char *
-parm_as_string (p, v)
+static const char *
+parm_to_string (p, v)
int p;
int v ATTRIBUTE_UNUSED;
{
@@ -2025,69 +2290,453 @@ parm_as_string (p, v)
return digit_buffer;
}
-char *
-op_as_string (p, v)
+static const char *
+op_to_string (p, v)
enum tree_code p;
int v ATTRIBUTE_UNUSED;
{
- static char buf[] = "operator ";
+ tree id;
+
+ id = operator_name_info[(int) p].identifier;
+ return id ? IDENTIFIER_POINTER (id) : "{unknown}";
+}
+
+static const char *
+type_to_string (typ, verbose)
+ tree typ;
+ int verbose;
+{
+ int flags;
- if (p == 0)
- return "{unknown}";
-
- strcpy (buf + 9, opname_tab [p]);
- return buf;
+ flags = 0;
+ if (verbose)
+ flags |= TFF_CLASS_KEY_OR_ENUM;
+ flags |= TFF_TEMPLATE_HEADER;
+
+ reinit_global_formatting_buffer ();
+
+ dump_type (typ, flags);
+
+ return output_finalize_message (scratch_buffer);
}
-char *
-assop_as_string (p, v)
+static const char *
+assop_to_string (p, v)
enum tree_code p;
int v ATTRIBUTE_UNUSED;
{
- static char buf[] = "operator ";
+ tree id;
- if (p == 0)
- return "{unknown}";
-
- strcpy (buf + 9, assignop_tab [p]);
- return buf;
+ id = assignment_operator_name_info[(int) p].identifier;
+ return id ? IDENTIFIER_POINTER (id) : "{unknown}";
}
-char *
-args_as_string (p, v)
+static const char *
+args_to_string (p, verbose)
tree p;
- int v;
+ int verbose;
{
+ int flags = 0;
+ if (verbose)
+ flags |= TFF_CLASS_KEY_OR_ENUM;
+
if (p == NULL_TREE)
return "";
- if (TREE_CODE_CLASS (TREE_CODE (TREE_VALUE (p))) == 't')
- return type_as_string (p, v);
+ if (TYPE_P (TREE_VALUE (p)))
+ return type_as_string (p, flags);
- OB_INIT ();
+ reinit_global_formatting_buffer ();
for (; p; p = TREE_CHAIN (p))
{
if (TREE_VALUE (p) == null_node)
- OB_PUTS ("NULL");
+ print_identifier (scratch_buffer, "NULL");
else
- dump_type (error_type (TREE_VALUE (p)), v);
+ dump_type (error_type (TREE_VALUE (p)), flags);
if (TREE_CHAIN (p))
- OB_PUTS (", ");
+ separate_with_comma (scratch_buffer);
}
- OB_FINISH ();
- return (char *)obstack_base (&scratch_obstack);
+ return output_finalize_message (scratch_buffer);
}
-char *
-cv_as_string (p, v)
+static const char *
+cv_to_string (p, v)
tree p;
- int v ATTRIBUTE_UNUSED;
+ int v;
+{
+ reinit_global_formatting_buffer ();
+
+ dump_qualifiers (p, v ? before : none);
+
+ return output_finalize_message (scratch_buffer);
+}
+
+static void
+lang_print_error_function (context, file)
+ diagnostic_context *context;
+ const char *file;
+{
+ output_state os;
+
+ default_print_error_function (context, file);
+ os = output_buffer_state (context);
+ output_set_prefix ((output_buffer *)context, file);
+ maybe_print_instantiation_context ((output_buffer *)context);
+ output_buffer_state (context) = os;
+}
+
+static void
+cp_diagnostic_starter (buffer, dc)
+ output_buffer *buffer;
+ diagnostic_context *dc;
+{
+ report_problematic_module (buffer);
+ cp_print_error_function (buffer, dc);
+ maybe_print_instantiation_context (buffer);
+ output_set_prefix (buffer,
+ context_as_prefix (diagnostic_file_location (dc),
+ diagnostic_line_location (dc),
+ diagnostic_is_warning (dc)));
+}
+
+static void
+cp_diagnostic_finalizer (buffer, dc)
+ output_buffer *buffer;
+ diagnostic_context *dc __attribute__ ((__unused__));
+{
+ output_destroy_prefix (buffer);
+}
+
+/* Print current function onto BUFFER, in the process of reporting
+ a diagnostic message. Called from cp_diagnostic_starter. */
+static void
+cp_print_error_function (buffer, dc)
+ output_buffer *buffer;
+ diagnostic_context *dc;
+{
+ if (error_function_changed ())
+ {
+ char *prefix = diagnostic_file_location (dc)
+ ? file_name_as_prefix (diagnostic_file_location (dc))
+ : NULL;
+ output_state os;
+
+ os = output_buffer_state (buffer);
+ output_set_prefix (buffer, prefix);
+
+ if (current_function_decl == NULL)
+ output_add_string (buffer, "At global scope:");
+ else
+ output_printf
+ (buffer, "In %s `%s':", function_category (current_function_decl),
+ (*decl_printable_name) (current_function_decl, 2));
+ output_add_newline (buffer);
+
+ record_last_error_function ();
+ output_destroy_prefix (buffer);
+ output_buffer_state (buffer) = os;
+ }
+}
+
+/* Returns a description of FUNCTION using standard terminology. */
+static const char *
+function_category (fn)
+ tree fn;
+{
+ if (DECL_FUNCTION_MEMBER_P (fn))
+ {
+ if (DECL_STATIC_FUNCTION_P (fn))
+ return "static member function";
+ else if (DECL_COPY_CONSTRUCTOR_P (fn))
+ return "copy constructor";
+ else if (DECL_CONSTRUCTOR_P (fn))
+ return "constructor";
+ else if (DECL_DESTRUCTOR_P (fn))
+ return "destructor";
+ else
+ return "member function";
+ }
+ else
+ return "function";
+}
+
+/* Report the full context of a current template instantiation,
+ onto BUFFER. */
+static void
+print_instantiation_full_context (buffer)
+ output_buffer *buffer;
+{
+ tree p = current_instantiation ();
+ int line = lineno;
+ const char *file = input_filename;
+
+ if (p)
+ {
+ if (current_function_decl != TINST_DECL (p)
+ && current_function_decl != NULL_TREE)
+ /* We can get here during the processing of some synthesized
+ method. Then, TINST_DECL (p) will be the function that's causing
+ the synthesis. */
+ ;
+ else
+ {
+ if (current_function_decl == TINST_DECL (p))
+ /* Avoid redundancy with the the "In function" line. */;
+ else
+ output_verbatim (buffer, "%s: In instantiation of `%s':\n", file,
+ decl_as_string (TINST_DECL (p),
+ TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
+
+ line = TINST_LINE (p);
+ file = TINST_FILE (p);
+ p = TREE_CHAIN (p);
+ }
+ }
+
+ print_instantiation_partial_context (buffer, p, file, line);
+}
+
+/* Same as above but less verbose. */
+static void
+print_instantiation_partial_context (buffer, t, file, line)
+ output_buffer *buffer;
+ tree t;
+ const char *file;
+ int line;
+{
+ for (; t; t = TREE_CHAIN (t))
+ {
+ output_verbatim
+ (buffer, "%s:%d: instantiated from `%s'\n", file, line,
+ decl_as_string (TINST_DECL (t), TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
+ line = TINST_LINE (t);
+ file = TINST_FILE (t);
+ }
+ output_verbatim (buffer, "%s:%d: instantiated from here\n", file, line);
+}
+
+/* Called from cp_thing to print the template context for an error. */
+static void
+maybe_print_instantiation_context (buffer)
+ output_buffer *buffer;
+{
+ if (!problematic_instantiation_changed () || current_instantiation () == 0)
+ return;
+
+ record_last_problematic_instantiation ();
+ print_instantiation_full_context (buffer);
+}
+
+/* Report the bare minimum context of a template instantiation. */
+void
+print_instantiation_context ()
+{
+ print_instantiation_partial_context
+ (diagnostic_buffer, current_instantiation (), input_filename, lineno);
+ flush_diagnostic_buffer ();
+}
+
+/* Called from output_format -- during diagnostic message processing --
+ to handle C++ specific format specifier with the following meanings:
+ %A function argument-list.
+ %C tree code.
+ %D declaration.
+ %E expression.
+ %F function declaration.
+ %L language as used in extern "lang".
+ %O binary operator.
+ %P function parameter whose position is indicated by an integer.
+ %Q assignment operator.
+ %T type.
+ %V cv-qualifier. */
+static int
+cp_printer (buffer)
+ output_buffer *buffer;
+{
+ int verbose = 0;
+ const char *result;
+#define next_tree va_arg (output_buffer_format_args (buffer), tree)
+#define next_tcode va_arg (output_buffer_format_args (buffer), enum tree_code)
+#define next_lang va_arg (output_buffer_format_args (buffer), enum languages)
+#define next_int va_arg (output_buffer_format_args (buffer), int)
+
+ if (*output_buffer_text_cursor (buffer) == '+')
+ ++output_buffer_text_cursor (buffer);
+ if (*output_buffer_text_cursor (buffer) == '#')
+ {
+ verbose = 1;
+ ++output_buffer_text_cursor (buffer);
+ }
+
+ switch (*output_buffer_text_cursor (buffer))
+ {
+ case 'A': result = args_to_string (next_tree, verbose); break;
+ case 'C': result = code_to_string (next_tcode, verbose); break;
+ case 'D': result = decl_to_string (next_tree, verbose); break;
+ case 'E': result = expr_to_string (next_tree, verbose); break;
+ case 'F': result = fndecl_to_string (next_tree, verbose); break;
+ case 'L': result = language_to_string (next_lang, verbose); break;
+ case 'O': result = op_to_string (next_tcode, verbose); break;
+ case 'P': result = parm_to_string (next_int, verbose); break;
+ case 'Q': result = assop_to_string (next_tcode, verbose); break;
+ case 'T': result = type_to_string (next_tree, verbose); break;
+ case 'V': result = cv_to_string (next_tree, verbose); break;
+
+ default:
+ return 0;
+ }
+
+ output_add_string (buffer, result);
+ return 1;
+#undef next_tree
+#undef next_tcode
+#undef next_lang
+#undef next_int
+}
+
+static void
+print_integer (buffer, i)
+ output_buffer *buffer;
+ HOST_WIDE_INT i;
+{
+ sprintf (digit_buffer, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) i);
+ output_add_string (buffer, digit_buffer);
+}
+
+static void
+print_non_consecutive_character (buffer, c)
+ output_buffer *buffer;
+ int c;
+{
+ const char *p = output_last_position (buffer);
+
+ if (p != NULL && *p == c)
+ output_add_space (buffer);
+ output_add_character (buffer, c);
+}
+
+/* These are temporary wrapper functions which handle the historic
+ behavior of cp_*_at. */
+
+static tree
+locate_error (msgid, ap)
+ const char *msgid;
+ va_list ap;
{
- OB_INIT ();
+ tree here = 0, t;
+ int plus = 0;
+ const char *f;
- dump_qualifiers (p, before);
+ for (f = msgid; *f; f++)
+ {
+ plus = 0;
+ if (*f == '%')
+ {
+ f++;
+ if (*f == '+')
+ f++, plus = 1;
+ if (*f == '#')
+ f++;
- OB_FINISH ();
+ switch (*f)
+ {
+ /* Just ignore these possibilities. */
+ case '%': break;
+ case 'd': (void) va_arg (ap, int); break;
+ case 's': (void) va_arg (ap, char *); break;
+ case 'L': (void) va_arg (ap, enum languages); break;
+ case 'C':
+ case 'O':
+ case 'Q': (void) va_arg (ap, enum tree_code); break;
+
+ /* These take a tree, which may be where the error is
+ located. */
+ case 'A':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'P':
+ case 'T':
+ case 'V':
+ t = va_arg (ap, tree);
+ if (!here || plus)
+ here = t;
+ break;
- return (char *)obstack_base (&scratch_obstack);
+ default:
+ errorcount = 0; /* damn ICE suppression */
+ internal_error ("unexpected letter `%c' in locate_error\n", *f);
+ }
+ }
+ }
+
+ if (here == 0)
+ here = va_arg (ap, tree);
+
+ return here;
+}
+
+
+void
+cp_error_at VPARAMS ((const char *msgid, ...))
+{
+ tree here;
+ diagnostic_context dc;
+
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, const char *, msgid);
+ here = locate_error (msgid, ap);
+ VA_CLOSE (ap);
+
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, const char *, msgid);
+
+ set_diagnostic_context (&dc, msgid, &ap,
+ cp_file_of (here),
+ cp_line_of (here), /* warning = */ 0);
+ report_diagnostic (&dc);
+ VA_CLOSE (ap);
+}
+
+void
+cp_warning_at VPARAMS ((const char *msgid, ...))
+{
+ tree here;
+ diagnostic_context dc;
+
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, const char *, msgid);
+ here = locate_error (msgid, ap);
+ VA_CLOSE (ap);
+
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, const char *, msgid);
+
+ set_diagnostic_context (&dc, msgid, &ap,
+ cp_file_of (here),
+ cp_line_of (here), /* warning = */ 1);
+ report_diagnostic (&dc);
+ VA_CLOSE (ap);
+}
+
+void
+cp_pedwarn_at VPARAMS ((const char *msgid, ...))
+{
+ tree here;
+ diagnostic_context dc;
+
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, const char *, msgid);
+ here = locate_error (msgid, ap);
+ VA_CLOSE (ap);
+
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, const char *, msgid);
+
+ set_diagnostic_context (&dc, msgid, &ap,
+ cp_file_of (here),
+ cp_line_of (here),
+ /* warning = */ !flag_pedantic_errors);
+ report_diagnostic (&dc);
+ VA_CLOSE (ap);
}
diff --git a/contrib/gcc/cp/except.c b/contrib/gcc/cp/except.c
index 9e2d6af..3f3cdcf 100644
--- a/contrib/gcc/cp/except.c
+++ b/contrib/gcc/cp/except.c
@@ -1,5 +1,6 @@
/* Handle exceptional things in C++.
- Copyright (C) 1989, 92-97, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 2000, 2001 Free Software Foundation, Inc.
Contributed by Michael Tiemann <tiemann@cygnus.com>
Rewritten by Mike Stump <mrs@cygnus.com>, based upon an
initial re-implementation courtesy Tad Hunt.
@@ -26,382 +27,83 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "tree.h"
#include "rtl.h"
+#include "expr.h"
+#include "libfuncs.h"
#include "cp-tree.h"
#include "flags.h"
#include "obstack.h"
-#include "expr.h"
#include "output.h"
#include "except.h"
-#include "function.h"
-#include "defaults.h"
#include "toplev.h"
-#include "eh-common.h"
-
-rtx expand_builtin_return_addr PROTO((enum built_in_function, int, rtx));
-
-/* Holds the fndecl for __builtin_return_address. */
-tree builtin_return_address_fndecl;
-
-/* A couple of backend routines from m88k.c */
-
-static void push_eh_cleanup PROTO((void));
-static tree build_eh_type_type PROTO((tree));
-static tree build_eh_type PROTO((tree));
-static void expand_end_eh_spec PROTO((tree));
-static tree call_eh_info PROTO((void));
-static void push_eh_info PROTO((void));
-static tree get_eh_info PROTO((void));
-static tree get_eh_value PROTO((void));
-#if 0
-static tree get_eh_type PROTO((void));
-static tree get_eh_caught PROTO((void));
-static tree get_eh_handlers PROTO((void));
-#endif
-static tree do_pop_exception PROTO((void));
-static void process_start_catch_block PROTO((tree, tree));
-static tree build_eh_type_type_ref PROTO((tree));
-static tree build_terminate_handler PROTO((void));
-static tree alloc_eh_object PROTO((tree));
-
-#if 0
-/* This is the startup, and finish stuff per exception table. */
-
-/* XXX - Tad: exception handling section */
-#ifndef EXCEPT_SECTION_ASM_OP
-#define EXCEPT_SECTION_ASM_OP "section\t.gcc_except_table,\"a\",@progbits"
-#endif
-
-#ifdef EXCEPT_SECTION_ASM_OP
-
- /* on machines which support it, the exception table lives in another section,
- but it needs a label so we can reference it... This sets up that
- label! */
-asm (EXCEPT_SECTION_ASM_OP);
-exception_table __EXCEPTION_TABLE__[1] = { (void*)0, (void*)0, (void*)0 };
-asm (TEXT_SECTION_ASM_OP);
-
-#endif /* EXCEPT_SECTION_ASM_OP */
-
-#ifdef EXCEPT_SECTION_ASM_OP
-
- /* we need to know where the end of the exception table is... so this
- is how we do it! */
-asm (EXCEPT_SECTION_ASM_OP);
-exception_table __EXCEPTION_END__[1] = { (void*)-1, (void*)-1, (void*)-1 };
-asm (TEXT_SECTION_ASM_OP);
-
-#endif /* EXCEPT_SECTION_ASM_OP */
-
-#endif
+static void push_eh_cleanup PARAMS ((tree));
+static tree prepare_eh_type PARAMS ((tree));
+static tree build_eh_type_type PARAMS ((tree));
+static tree do_begin_catch PARAMS ((void));
+static int dtor_nothrow PARAMS ((tree));
+static tree do_end_catch PARAMS ((tree));
+static void push_eh_cleanup PARAMS ((tree));
+static bool decl_is_java_type PARAMS ((tree decl, int err));
+static void initialize_handler_parm PARAMS ((tree, tree));
+static tree do_allocate_exception PARAMS ((tree));
+static int complete_ptr_ref_or_void_ptr_p PARAMS ((tree, tree));
+static bool is_admissible_throw_operand PARAMS ((tree));
+static int can_convert_eh PARAMS ((tree, tree));
+static void check_handlers_1 PARAMS ((tree, tree));
+static tree cp_protect_cleanup_actions PARAMS ((void));
#include "decl.h"
-#include "insn-flags.h"
#include "obstack.h"
-/* ======================================================================
- Briefly the algorithm works like this:
-
- When a constructor or start of a try block is encountered,
- push_eh_entry (&eh_stack) is called. Push_eh_entry () creates a
- new entry in the unwind protection stack and returns a label to
- output to start the protection for that block.
-
- When a destructor or end try block is encountered, pop_eh_entry
- (&eh_stack) is called. Pop_eh_entry () returns the eh_entry it
- created when push_eh_entry () was called. The eh_entry structure
- contains three things at this point. The start protect label,
- the end protect label, and the exception handler label. The end
- protect label should be output before the call to the destructor
- (if any). If it was a destructor, then its parse tree is stored
- in the finalization variable in the eh_entry structure. Otherwise
- the finalization variable is set to NULL to reflect the fact that
- it is the end of a try block. Next, this modified eh_entry node
- is enqueued in the finalizations queue by calling
- enqueue_eh_entry (&queue,entry).
-
- +---------------------------------------------------------------+
- |XXX: Will need modification to deal with partially |
- | constructed arrays of objects |
- | |
- | Basically, this consists of keeping track of how many |
- | of the objects have been constructed already (this |
- | should be in a register though, so that shouldn't be a |
- | problem. |
- +---------------------------------------------------------------+
-
- When a catch block is encountered, there is a lot of work to be
- done.
-
- Since we don't want to generate the catch block inline with the
- regular flow of the function, we need to have some way of doing
- so. Luckily, we can use sequences to defer the catch sections.
- When the start of a catch block is encountered, we start the
- sequence. After the catch block is generated, we end the
- sequence.
-
- Next we must insure that when the catch block is executed, all
- finalizations for the matching try block have been completed. If
- any of those finalizations throw an exception, we must call
- terminate according to the ARM (section r.15.6.1). What this
- means is that we need to dequeue and emit finalizations for each
- entry in the eh_queue until we get to an entry with a NULL
- finalization field. For any of the finalization entries, if it
- is not a call to terminate (), we must protect it by giving it
- another start label, end label, and exception handler label,
- setting its finalization tree to be a call to terminate (), and
- enqueue'ing this new eh_entry to be output at an outer level.
- Finally, after all that is done, we can get around to outputting
- the catch block which basically wraps all the "catch (...) {...}"
- statements in a big if/then/else construct that matches the
- correct block to call.
-
- ===================================================================== */
-
-/* local globals for function calls
- ====================================================================== */
-
-/* Used to cache "terminate" and "__throw_type_match*". */
-static tree Terminate, CatchMatch;
-
-/* Used to cache __find_first_exception_table_match for throw. */
-static tree FirstExceptionMatch;
-
-/* Used to cache a call to __unwind_function. */
-static tree Unwind;
-
-/* ====================================================================== */
-
-
-/* ========================================================================= */
-
-
-
-/* local globals - these local globals are for storing data necessary for
- generating the exception table and code in the correct order.
-
- ========================================================================= */
-
-extern rtx catch_clauses;
-extern tree const_ptr_type_node;
-
-/* ========================================================================= */
-
-/* sets up all the global eh stuff that needs to be initialized at the
- start of compilation.
-
- This includes:
- - Setting up all the function call trees. */
+/* Sets up all the global eh stuff that needs to be initialized at the
+ start of compilation. */
void
init_exception_processing ()
{
- /* void vtype () */
- tree vtype = build_function_type (void_type_node, void_list_node);
-
- if (flag_honor_std)
- push_namespace (get_identifier ("std"));
- Terminate = auto_function (get_identifier ("terminate"),
- vtype, NOT_BUILT_IN);
- TREE_THIS_VOLATILE (Terminate) = 1;
- if (flag_honor_std)
- pop_namespace ();
-
- push_lang_context (lang_name_c);
-
- set_exception_lang_code (EH_LANG_C_plus_plus);
- set_exception_version_code (1);
-
- CatchMatch
- = builtin_function (flag_rtti
- ? "__throw_type_match_rtti"
- : "__throw_type_match",
- build_function_type (ptr_type_node,
- tree_cons (NULL_TREE, const_ptr_type_node,
- tree_cons (NULL_TREE, const_ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- void_list_node)))),
- NOT_BUILT_IN, NULL_PTR);
- FirstExceptionMatch
- = builtin_function ("__find_first_exception_table_match",
- build_function_type (ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- void_list_node)),
- NOT_BUILT_IN, NULL_PTR);
- Unwind
- = builtin_function ("__unwind_function",
- build_function_type (void_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- void_list_node)),
- NOT_BUILT_IN, NULL_PTR);
-
- pop_lang_context ();
-
- /* If we use setjmp/longjmp EH, arrange for all cleanup actions to
- be protected with __terminate. */
- protect_cleanup_actions_with_terminate = 1;
-}
-
-/* Retrieve a pointer to the cp_eh_info node for the current exception. */
-
-static tree
-call_eh_info ()
-{
- tree fn;
-
- fn = get_identifier ("__start_cp_handler");
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
- {
- tree t1, t, fields[7];
-
- /* Declare cp_eh_info * __start_cp_handler (void),
- as defined in exception.cc. */
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- /* struct cp_eh_info. This must match exception.cc. Note that this
- type is not pushed anywhere. */
- t1= make_lang_type (RECORD_TYPE);
- fields[0] = build_lang_field_decl (FIELD_DECL,
- get_identifier ("handler_label"), ptr_type_node);
- fields[1] = build_lang_field_decl (FIELD_DECL,
- get_identifier ("dynamic_handler_chain"), ptr_type_node);
- fields[2] = build_lang_field_decl (FIELD_DECL,
- get_identifier ("info"), ptr_type_node);
- fields[3] = build_lang_field_decl (FIELD_DECL,
- get_identifier ("table_index"), ptr_type_node);
- /* N.B.: The fourth field LEN is expected to be
- the number of fields - 1, not the total number of fields. */
- finish_builtin_type (t1, "eh_context", fields, 3, ptr_type_node);
- t1 = build_pointer_type (t1);
-
- t1= make_lang_type (RECORD_TYPE);
- fields[0] = build_lang_field_decl (FIELD_DECL,
- get_identifier ("match_function"), ptr_type_node);
- fields[1] = build_lang_field_decl (FIELD_DECL,
- get_identifier ("language"), short_integer_type_node);
- fields[2] = build_lang_field_decl (FIELD_DECL,
- get_identifier ("version"), short_integer_type_node);
- /* N.B.: The fourth field LEN is expected to be
- the number of fields - 1, not the total number of fields. */
- finish_builtin_type (t1, "__eh_info", fields, 2, ptr_type_node);
- t = make_lang_type (RECORD_TYPE);
- fields[0] = build_lang_field_decl (FIELD_DECL,
- get_identifier ("eh_info"), t1);
- fields[1] = build_lang_field_decl (FIELD_DECL, get_identifier ("value"),
- ptr_type_node);
- fields[2] = build_lang_field_decl (FIELD_DECL, get_identifier ("type"),
- ptr_type_node);
- fields[3] = build_lang_field_decl
- (FIELD_DECL, get_identifier ("cleanup"),
- build_pointer_type (build_function_type
- (ptr_type_node, tree_cons
- (NULL_TREE, ptr_type_node, void_list_node))));
- fields[4] = build_lang_field_decl (FIELD_DECL, get_identifier ("caught"),
- boolean_type_node);
- fields[5] = build_lang_field_decl (FIELD_DECL, get_identifier ("next"),
- build_pointer_type (t));
- fields[6] = build_lang_field_decl
- (FIELD_DECL, get_identifier ("handlers"), long_integer_type_node);
- /* N.B.: The fourth field LEN is expected to be
- the number of fields - 1, not the total number of fields. */
- finish_builtin_type (t, "cp_eh_info", fields, 6, ptr_type_node);
- t = build_pointer_type (t);
-
- /* And now the function. */
- fn = build_lang_decl (FUNCTION_DECL, fn,
- build_function_type (t, void_list_node));
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- pop_obstacks ();
- }
- mark_used (fn);
- return build_function_call (fn, NULL_TREE);
-}
-
-/* Retrieve a pointer to the cp_eh_info node for the current exception
- and save it in the current binding level. */
-
-static void
-push_eh_info ()
-{
- tree decl, fn = call_eh_info ();
-
- /* Remember the pointer to the current exception info; it won't change
- during this catch block. */
- decl = build_decl (VAR_DECL, get_identifier ("__exception_info"),
- TREE_TYPE (fn));
- DECL_ARTIFICIAL (decl) = 1;
- DECL_INITIAL (decl) = fn;
- decl = pushdecl (decl);
- cp_finish_decl (decl, fn, NULL_TREE, 0, 0);
+ tree tmp;
+
+ /* void std::terminate (); */
+ push_namespace (std_identifier);
+ tmp = build_function_type (void_type_node, void_list_node);
+ terminate_node = build_cp_library_fn_ptr ("terminate", tmp);
+ TREE_THIS_VOLATILE (terminate_node) = 1;
+ TREE_NOTHROW (terminate_node) = 1;
+ pop_namespace ();
+
+ /* void __cxa_call_unexpected(void *); */
+ tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
+ tmp = build_function_type (void_type_node, tmp);
+ call_unexpected_node
+ = push_throw_library_fn (get_identifier ("__cxa_call_unexpected"), tmp);
+
+ eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS
+ ? "__gxx_personality_sj0"
+ : "__gxx_personality_v0");
+
+ lang_eh_runtime_type = build_eh_type_type;
+ lang_protect_cleanup_actions = &cp_protect_cleanup_actions;
}
-/* Returns a reference to the cp_eh_info node for the current exception. */
+/* Returns an expression to be executed if an unhandled exception is
+ propagated out of a cleanup region. */
static tree
-get_eh_info ()
+cp_protect_cleanup_actions ()
{
- /* Look for the pointer pushed in push_eh_info. */
- tree t = lookup_name (get_identifier ("__exception_info"), 0);
- return build_indirect_ref (t, NULL_PTR);
-}
+ /* [except.terminate]
-/* Returns a reference to the current exception object. */
+ When the destruction of an object during stack unwinding exits
+ using an exception ... void terminate(); is called. */
+ return build_call (terminate_node, NULL_TREE);
+}
static tree
-get_eh_value ()
-{
- return build_component_ref (get_eh_info (), get_identifier ("value"),
- NULL_TREE, 0);
-}
-
-/* Returns a reference to the current exception type. */
-
-#if 0
-static tree
-get_eh_type ()
-{
- return build_component_ref (get_eh_info (), get_identifier ("type"),
- NULL_TREE, 0);
-}
-
-/* Returns a reference to whether or not the current exception
- has been caught. */
-
-static tree
-get_eh_caught ()
-{
- return build_component_ref (get_eh_info (), get_identifier ("caught"),
- NULL_TREE, 0);
-}
-
-/* Returns a reference to whether or not the current exception
- has been caught. */
-
-static tree
-get_eh_handlers ()
-{
- return build_component_ref (get_eh_info (), get_identifier ("handlers"),
- NULL_TREE, 0);
-}
-#endif
-
-/* Build a type value for use at runtime for a type that is matched
- against by the exception handling system. */
-
-static tree
-build_eh_type_type (type)
+prepare_eh_type (type)
tree type;
{
- const char *typestring;
- tree exp;
-
+ if (type == NULL_TREE)
+ return type;
if (type == error_mark_node)
return error_mark_node;
@@ -412,295 +114,338 @@ build_eh_type_type (type)
/* Peel off cv qualifiers. */
type = TYPE_MAIN_VARIANT (type);
- if (flag_rtti)
- return build1 (ADDR_EXPR, ptr_type_node, get_typeid_1 (type));
-
- typestring = build_overload_name (type, 1, 1);
- exp = combine_strings (build_string (strlen (typestring)+1, typestring));
- return build1 (ADDR_EXPR, ptr_type_node, exp);
+ return type;
}
-/* Build the address of a runtime type for use in the runtime matching
- field of the new exception model */
+/* Build the address of a typeinfo decl for use in the runtime
+ matching field of the exception model. */
static tree
-build_eh_type_type_ref (type)
+build_eh_type_type (type)
tree type;
{
- const char *typestring;
tree exp;
- if (type == error_mark_node)
- return error_mark_node;
+ if (type == NULL_TREE || type == error_mark_node)
+ return type;
- /* peel back references, so they match. */
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- /* Peel off cv qualifiers. */
- type = TYPE_MAIN_VARIANT (type);
+ if (decl_is_java_type (type, 0))
+ exp = build_java_class_ref (TREE_TYPE (type));
+ else
+ exp = get_tinfo_decl (type);
- push_obstacks_nochange ();
- end_temporary_allocation ();
+ mark_used (exp);
+ exp = build1 (ADDR_EXPR, ptr_type_node, exp);
- if (flag_rtti)
- {
- exp = get_tinfo_fn (type);
- TREE_USED (exp) = 1;
- mark_inline_for_output (exp);
- exp = build1 (ADDR_EXPR, ptr_type_node, exp);
- }
- else
- {
- typestring = build_overload_name (type, 1, 1);
- exp = combine_strings (build_string (strlen (typestring)+1, typestring));
- exp = build1 (ADDR_EXPR, ptr_type_node, exp);
- }
- pop_obstacks ();
- return (exp);
+ return exp;
}
+tree
+build_exc_ptr ()
+{
+ return build (EXC_PTR_EXPR, ptr_type_node);
+}
-/* Build a type value for use at runtime for a exp that is thrown or
- matched against by the exception handling system. */
+/* Build up a call to __cxa_begin_catch, to tell the runtime that the
+ exception has been handled. */
static tree
-build_eh_type (exp)
- tree exp;
+do_begin_catch ()
{
- if (flag_rtti)
+ tree fn;
+
+ fn = get_identifier ("__cxa_begin_catch");
+ if (IDENTIFIER_GLOBAL_VALUE (fn))
+ fn = IDENTIFIER_GLOBAL_VALUE (fn);
+ else
{
- exp = build_typeid (exp);
- return build1 (ADDR_EXPR, ptr_type_node, exp);
+ /* Declare void* __cxa_begin_catch (void *). */
+ tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
+ fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp));
}
- return build_eh_type_type (TREE_TYPE (exp));
+
+ return build_function_call (fn, tree_cons (NULL_TREE, build_exc_ptr (),
+ NULL_TREE));
}
-/* This routine is called to mark all the symbols representing runtime
- type functions in the exception table as haveing been referenced.
- This will make sure code is emitted for them. Called from finish_file. */
-void
-mark_all_runtime_matches ()
+/* Returns nonzero if cleaning up an exception of type TYPE (which can be
+ NULL_TREE for a ... handler) will not throw an exception. */
+
+static int
+dtor_nothrow (type)
+ tree type;
{
- int x,num;
- void **ptr;
- tree exp;
-
- num = find_all_handler_type_matches (&ptr);
- if (num == 0 || ptr == NULL)
- return;
-
- for (x=0; x <num; x++)
- {
- exp = (tree) ptr[x];
- if (TREE_CODE (exp) == ADDR_EXPR)
- {
- exp = TREE_OPERAND (exp, 0);
- if (TREE_CODE (exp) == FUNCTION_DECL)
- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (exp)) = 1;
- }
- }
-
- free (ptr);
+ tree fn;
+
+ if (type == NULL_TREE)
+ return 0;
+
+ if (! TYPE_HAS_DESTRUCTOR (type))
+ return 1;
+
+ fn = lookup_member (type, dtor_identifier, 0, 0);
+ fn = TREE_VALUE (fn);
+ return TREE_NOTHROW (fn);
}
-/* Build up a call to __cp_pop_exception, to destroy the exception object
- for the current catch block. HANDLER is either true or false, telling
- the library whether or not it is being called from an exception handler;
- if it is, it avoids destroying the object on rethrow. */
+/* Build up a call to __cxa_end_catch, to destroy the exception object
+ for the current catch block if no others are currently using it. */
static tree
-do_pop_exception ()
+do_end_catch (type)
+ tree type;
{
tree fn, cleanup;
- fn = get_identifier ("__cp_pop_exception");
+
+ fn = get_identifier ("__cxa_end_catch");
if (IDENTIFIER_GLOBAL_VALUE (fn))
fn = IDENTIFIER_GLOBAL_VALUE (fn);
else
{
- /* Declare void __cp_pop_exception (void *),
- as defined in exception.cc. */
- push_obstacks_nochange ();
- end_temporary_allocation ();
- fn = build_lang_decl
- (FUNCTION_DECL, fn,
- build_function_type (void_type_node, tree_cons
- (NULL_TREE, ptr_type_node, void_list_node)));
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- pop_obstacks ();
+ /* Declare void __cxa_end_catch (). */
+ fn = push_void_library_fn (fn, void_list_node);
+ /* This can throw if the destructor for the exception throws. */
+ TREE_NOTHROW (fn) = 0;
}
- mark_used (fn);
- /* Arrange to do a dynamically scoped cleanup upon exit from this region. */
- cleanup = lookup_name (get_identifier ("__exception_info"), 0);
- cleanup = build_function_call (fn, expr_tree_cons
- (NULL_TREE, cleanup, NULL_TREE));
+ cleanup = build_function_call (fn, NULL_TREE);
+ TREE_NOTHROW (cleanup) = dtor_nothrow (type);
+
return cleanup;
}
/* This routine creates the cleanup for the current exception. */
static void
-push_eh_cleanup ()
+push_eh_cleanup (type)
+ tree type;
{
- int yes;
-
- yes = suspend_momentary ();
- /* All cleanups must last longer than normal. */
- expand_decl_cleanup (NULL_TREE, do_pop_exception ());
- resume_momentary (yes);
+ finish_decl_cleanup (NULL_TREE, do_end_catch (type));
}
-/* Build up a call to terminate on the function obstack, for use as an
- exception handler. */
+/* Return nonzero value if DECL is a Java type suitable for catch or
+ throw. */
-static tree
-build_terminate_handler ()
+static bool
+decl_is_java_type (decl, err)
+ tree decl;
+ int err;
{
- int yes = suspend_momentary ();
- tree term = build_function_call (Terminate, NULL_TREE);
- resume_momentary (yes);
- return term;
-}
+ bool r = (TREE_CODE (decl) == POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
+ && TYPE_FOR_JAVA (TREE_TYPE (decl)));
+
+ if (err)
+ {
+ if (TREE_CODE (decl) == REFERENCE_TYPE
+ && TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
+ && TYPE_FOR_JAVA (TREE_TYPE (decl)))
+ {
+ /* Can't throw a reference. */
+ error ("type `%T' is disallowed in Java `throw' or `catch'",
+ decl);
+ }
+
+ if (r)
+ {
+ tree jthrow_node
+ = IDENTIFIER_GLOBAL_VALUE (get_identifier ("jthrowable"));
+
+ if (jthrow_node == NULL_TREE)
+ fatal_error
+ ("call to Java `catch' or `throw' with `jthrowable' undefined");
-/* Call this to start a catch block. Typename is the typename, and identifier
- is the variable to place the object in or NULL if the variable doesn't
- matter. If typename is NULL, that means its a "catch (...)" or catch
- everything. In that case we don't need to do any type checking.
- (ie: it ends up as the "else" clause rather than an "else if" clause) */
+ jthrow_node = TREE_TYPE (TREE_TYPE (jthrow_node));
+ if (! DERIVED_FROM_P (jthrow_node, TREE_TYPE (decl)))
+ {
+ /* Thrown object must be a Throwable. */
+ error ("type `%T' is not derived from `java::lang::Throwable'",
+ TREE_TYPE (decl));
+ }
+ }
+ }
+
+ return r;
+}
+
+/* Select the personality routine to be used for exception handling,
+ or issue an error if we need two different ones in the same
+ translation unit.
+ ??? At present eh_personality_libfunc is set to
+ __gxx_personality_(sj|v)0 in init_exception_processing - should it
+ be done here instead? */
void
-expand_start_catch_block (declspecs, declarator)
- tree declspecs, declarator;
+choose_personality_routine (lang)
+ enum languages lang;
{
- tree decl;
-
- if (processing_template_decl)
+ static enum {
+ chose_none,
+ chose_cpp,
+ chose_java,
+ gave_error
+ } state;
+
+ switch (state)
{
- if (declspecs)
- {
- decl = grokdeclarator (declarator, declspecs, CATCHPARM,
- 1, NULL_TREE);
- pushdecl (decl);
- decl = build_min_nt (DECL_STMT, copy_to_permanent (declarator),
- copy_to_permanent (declspecs),
- NULL_TREE);
- add_tree (decl);
- }
+ case gave_error:
return;
+
+ case chose_cpp:
+ if (lang != lang_cplusplus)
+ goto give_error;
+ return;
+
+ case chose_java:
+ if (lang != lang_java)
+ goto give_error;
+ return;
+
+ case chose_none:
+ ; /* proceed to language selection */
}
- if (! doing_eh (1))
- return;
+ switch (lang)
+ {
+ case lang_cplusplus:
+ state = chose_cpp;
+ break;
+
+ case lang_java:
+ state = chose_java;
+ eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS
+ ? "__gcj_personality_sj0"
+ : "__gcj_personality_v0");
+ break;
+
+ default:
+ abort ();
+ }
+ return;
- process_start_catch_block (declspecs, declarator);
+ give_error:
+ error ("mixing C++ and Java catches in a single translation unit");
+ state = gave_error;
}
-
-/* This function performs the expand_start_catch_block functionality for
- exceptions implemented in the new style. __throw determines whether
- a handler needs to be called or not, so the handler itself has to do
- nothing additional. */
+/* Initialize the catch parameter DECL. */
static void
-process_start_catch_block (declspecs, declarator)
- tree declspecs, declarator;
+initialize_handler_parm (decl, exp)
+ tree decl;
+ tree exp;
{
- tree decl = NULL_TREE;
tree init;
+ tree init_type;
- /* Create a binding level for the eh_info and the exception object
- cleanup. */
- pushlevel (0);
- expand_start_bindings (0);
+ /* Make sure we mark the catch param as used, otherwise we'll get a
+ warning about an unused ((anonymous)). */
+ TREE_USED (decl) = 1;
+ /* Figure out the type that the initializer is. Pointers are returned
+ adjusted by value from __cxa_begin_catch. Others are returned by
+ reference. */
+ init_type = TREE_TYPE (decl);
+ if (! TYPE_PTR_P (init_type)
+ && TREE_CODE (init_type) != REFERENCE_TYPE)
+ init_type = build_reference_type (init_type);
- if (declspecs)
- {
- decl = grokdeclarator (declarator, declspecs, CATCHPARM, 1, NULL_TREE);
-
- if (decl == NULL_TREE)
- error ("invalid catch parameter");
- }
+ choose_personality_routine (decl_is_java_type (init_type, 0)
+ ? lang_java : lang_cplusplus);
- if (decl)
- start_catch_handler (build_eh_type_type_ref (TREE_TYPE (decl)));
- else
- start_catch_handler (CATCH_ALL_TYPE);
+ /* Since pointers are passed by value, initialize a reference to
+ pointer catch parm with the address of the temporary. */
+ if (TREE_CODE (init_type) == REFERENCE_TYPE
+ && TYPE_PTR_P (TREE_TYPE (init_type)))
+ exp = build_unary_op (ADDR_EXPR, exp, 1);
- emit_line_note (input_filename, lineno);
+ exp = ocp_convert (init_type, exp, CONV_IMPLICIT|CONV_FORCE_TEMP, 0);
- push_eh_info ();
+ init = convert_from_reference (exp);
- if (decl)
+ /* If the constructor for the catch parm exits via an exception, we
+ must call terminate. See eh23.C. */
+ if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))
{
- tree exp;
- tree init_type;
+ /* Generate the copy constructor call directly so we can wrap it.
+ See also expand_default_init. */
+ init = ocp_convert (TREE_TYPE (decl), init,
+ CONV_IMPLICIT|CONV_FORCE_TEMP, 0);
+ init = build1 (MUST_NOT_THROW_EXPR, TREE_TYPE (init), init);
+ }
- /* Make sure we mark the catch param as used, otherwise we'll get
- a warning about an unused ((anonymous)). */
- TREE_USED (decl) = 1;
+ /* Let `cp_finish_decl' know that this initializer is ok. */
+ DECL_INITIAL (decl) = error_mark_node;
+ decl = pushdecl (decl);
- /* Figure out the type that the initializer is. */
- init_type = TREE_TYPE (decl);
- if (TREE_CODE (init_type) != REFERENCE_TYPE
- && TREE_CODE (init_type) != POINTER_TYPE)
- init_type = build_reference_type (init_type);
+ start_decl_1 (decl);
+ cp_finish_decl (decl, init, NULL_TREE,
+ LOOKUP_ONLYCONVERTING|DIRECT_BIND);
+}
- exp = get_eh_value ();
+/* Call this to start a catch block. DECL is the catch parameter. */
- /* Since pointers are passed by value, initialize a reference to
- pointer catch parm with the address of the value slot. */
- if (TREE_CODE (init_type) == REFERENCE_TYPE
- && TREE_CODE (TREE_TYPE (init_type)) == POINTER_TYPE)
- exp = build_unary_op (ADDR_EXPR, exp, 1);
+tree
+expand_start_catch_block (decl)
+ tree decl;
+{
+ tree exp = NULL_TREE;
+ tree type;
+ bool is_java;
- exp = ocp_convert (init_type , exp, CONV_IMPLICIT|CONV_FORCE_TEMP, 0);
+ if (! doing_eh (1))
+ return NULL_TREE;
- push_eh_cleanup ();
+ /* Make sure this declaration is reasonable. */
+ if (decl && !complete_ptr_ref_or_void_ptr_p (TREE_TYPE (decl), NULL_TREE))
+ decl = NULL_TREE;
- /* Create a binding level for the parm. */
- pushlevel (0);
- expand_start_bindings (0);
+ if (decl)
+ type = prepare_eh_type (TREE_TYPE (decl));
+ else
+ type = NULL_TREE;
- init = convert_from_reference (exp);
+ is_java = false;
+ if (decl)
+ {
+ tree init;
- /* If the constructor for the catch parm exits via an exception, we
- must call terminate. See eh23.C. */
- if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))
+ if (decl_is_java_type (type, 1))
{
- /* Generate the copy constructor call directly so we can wrap it.
- See also expand_default_init. */
- init = ocp_convert (TREE_TYPE (decl), init,
- CONV_IMPLICIT|CONV_FORCE_TEMP, 0);
- init = build (TRY_CATCH_EXPR, TREE_TYPE (init), init,
- build_terminate_handler ());
+ /* Java only passes object via pointer and doesn't require
+ adjusting. The java object is immediately before the
+ generic exception header. */
+ init = build_exc_ptr ();
+ init = build1 (NOP_EXPR, build_pointer_type (type), init);
+ init = build (MINUS_EXPR, TREE_TYPE (init), init,
+ TYPE_SIZE_UNIT (TREE_TYPE (init)));
+ init = build_indirect_ref (init, NULL);
+ is_java = true;
}
-
- /* Let `cp_finish_decl' know that this initializer is ok. */
- DECL_INITIAL (decl) = init;
- decl = pushdecl (decl);
-
- start_decl_1 (decl);
- cp_finish_decl (decl, init, NULL_TREE, 0,
- LOOKUP_ONLYCONVERTING|DIRECT_BIND);
+ else
+ {
+ /* C++ requires that we call __cxa_begin_catch to get the
+ pointer to the actual object. */
+ init = do_begin_catch ();
+ }
+
+ exp = create_temporary_var (ptr_type_node);
+ DECL_REGISTER (exp) = 1;
+ cp_finish_decl (exp, init, NULL_TREE, LOOKUP_ONLYCONVERTING);
+ finish_expr_stmt (build_modify_expr (exp, INIT_EXPR, init));
}
else
- {
- push_eh_cleanup ();
+ finish_expr_stmt (do_begin_catch ());
- /* Create a binding level for the parm. */
- pushlevel (0);
- expand_start_bindings (0);
+ /* C++ requires that we call __cxa_end_catch at the end of
+ processing the exception. */
+ if (! is_java)
+ push_eh_cleanup (type);
- /* Fall into the catch all section. */
- }
+ if (decl)
+ initialize_handler_parm (decl, exp);
- emit_line_note (input_filename, lineno);
+ return type;
}
@@ -714,448 +459,435 @@ expand_end_catch_block ()
if (! doing_eh (1))
return;
- /* Cleanup the EH parameter. */
- expand_end_bindings (getdecls (), kept_level_p (), 0);
- poplevel (kept_level_p (), 1, 0);
-
- /* Cleanup the EH object. */
- expand_end_bindings (getdecls (), kept_level_p (), 0);
- poplevel (kept_level_p (), 1, 0);
-
- /* Fall to outside the try statement when done executing handler and
- we fall off end of handler. This is jump Lresume in the
- documentation. */
- expand_goto (top_label_entry (&caught_return_label_stack));
-
- end_catch_handler ();
+ /* The exception being handled is rethrown if control reaches the end of
+ a handler of the function-try-block of a constructor or destructor. */
+ if (in_function_try_handler
+ && (DECL_CONSTRUCTOR_P (current_function_decl)
+ || DECL_DESTRUCTOR_P (current_function_decl)))
+ finish_expr_stmt (build_throw (NULL_TREE));
}
-/* An exception spec is implemented more or less like:
-
- try {
- function body;
- } catch (...) {
- void *p[] = { typeid(raises) };
- __check_eh_spec (p, count);
- }
-
- __check_eh_spec in exception.cc handles all the details. */
-
-void
-expand_start_eh_spec ()
+tree
+begin_eh_spec_block ()
{
- expand_start_try_stmts ();
+ tree r = build_stmt (EH_SPEC_BLOCK, NULL_TREE, NULL_TREE);
+ add_stmt (r);
+ return r;
}
-static void
-expand_end_eh_spec (raises)
- tree raises;
+void
+finish_eh_spec_block (raw_raises, eh_spec_block)
+ tree raw_raises;
+ tree eh_spec_block;
{
- tree tmp, fn, decl, types = NULL_TREE;
- int count = 0;
+ tree raises;
- expand_start_all_catch ();
- expand_start_catch_block (NULL_TREE, NULL_TREE);
+ RECHAIN_STMTS (eh_spec_block, EH_SPEC_STMTS (eh_spec_block));
- /* Build up an array of type_infos. */
- for (; raises && TREE_VALUE (raises); raises = TREE_CHAIN (raises))
- {
- types = expr_tree_cons
- (NULL_TREE, build_eh_type_type (TREE_VALUE (raises)), types);
- ++count;
- }
+ /* Strip cv quals, etc, from the specification types. */
+ for (raises = NULL_TREE;
+ raw_raises && TREE_VALUE (raw_raises);
+ raw_raises = TREE_CHAIN (raw_raises))
+ raises = tree_cons (NULL_TREE, prepare_eh_type (TREE_VALUE (raw_raises)),
+ raises);
- types = build_nt (CONSTRUCTOR, NULL_TREE, types);
- TREE_HAS_CONSTRUCTOR (types) = 1;
+ EH_SPEC_RAISES (eh_spec_block) = raises;
+}
- /* We can't pass the CONSTRUCTOR directly, so stick it in a variable. */
- tmp = build_cplus_array_type (const_ptr_type_node, NULL_TREE);
- decl = build_decl (VAR_DECL, NULL_TREE, tmp);
- DECL_ARTIFICIAL (decl) = 1;
- DECL_INITIAL (decl) = types;
- cp_finish_decl (decl, types, NULL_TREE, 0, 0);
+/* Return a pointer to a buffer for an exception object of type TYPE. */
- decl = decay_conversion (decl);
+static tree
+do_allocate_exception (type)
+ tree type;
+{
+ tree fn;
- fn = get_identifier ("__check_eh_spec");
+ fn = get_identifier ("__cxa_allocate_exception");
if (IDENTIFIER_GLOBAL_VALUE (fn))
fn = IDENTIFIER_GLOBAL_VALUE (fn);
else
{
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- tmp = tree_cons
- (NULL_TREE, integer_type_node, tree_cons
- (NULL_TREE, TREE_TYPE (decl), void_list_node));
- tmp = build_function_type (void_type_node, tmp);
-
- fn = build_lang_decl (FUNCTION_DECL, fn, tmp);
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- TREE_THIS_VOLATILE (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- pop_obstacks ();
- }
-
- mark_used (fn);
- tmp = expr_tree_cons (NULL_TREE, build_int_2 (count, 0), expr_tree_cons
- (NULL_TREE, decl, NULL_TREE));
- tmp = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), tmp);
- expand_expr (tmp, const0_rtx, VOIDmode, EXPAND_NORMAL);
-
- expand_end_catch_block ();
- expand_end_all_catch ();
-}
-
-/* This is called to expand all the toplevel exception handling
- finalization for a function. It should only be called once per
- function. */
-
-void
-expand_exception_blocks ()
-{
- do_pending_stack_adjust ();
- push_to_sequence (catch_clauses);
- expand_leftover_cleanups ();
- do_pending_stack_adjust ();
- catch_clauses = get_insns ();
- end_sequence ();
-
- /* Do this after we expand leftover cleanups, so that the
- expand_eh_region_end that expand_end_eh_spec does will match the
- right expand_eh_region_start, and make sure it comes out before
- the terminate protected region. */
- if (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl)))
- {
- expand_end_eh_spec (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl)));
- do_pending_stack_adjust ();
- push_to_sequence (catch_clauses);
- expand_leftover_cleanups ();
- do_pending_stack_adjust ();
- catch_clauses = get_insns ();
- end_sequence ();
- }
-
- if (catch_clauses)
- {
- rtx funcend = gen_label_rtx ();
- emit_jump (funcend);
-
- /* We cannot protect n regions this way if we must flow into the
- EH region through the top of the region, as we have to with
- the setjmp/longjmp approach. */
- if (exceptions_via_longjmp == 0)
- expand_eh_region_start ();
-
- emit_insns (catch_clauses);
- catch_clauses = NULL_RTX;
-
- if (exceptions_via_longjmp == 0)
- expand_eh_region_end (build_terminate_handler ());
-
- expand_leftover_cleanups ();
-
- emit_label (funcend);
+ /* Declare void *__cxa_allocate_exception(size_t). */
+ tree tmp = tree_cons (NULL_TREE, c_size_type_node, void_list_node);
+ fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp));
}
+
+ return build_function_call (fn, tree_cons (NULL_TREE, size_in_bytes (type),
+ NULL_TREE));
}
-tree
-start_anon_func ()
-{
- static int counter = 0;
- int old_interface_unknown = interface_unknown;
- char name[32];
- tree params;
- tree t;
-
- push_cp_function_context (NULL_TREE);
- push_to_top_level ();
-
- /* No need to mangle this. */
- push_lang_context (lang_name_c);
-
- interface_unknown = 1;
-
- params = void_list_node;
- /* tcf stands for throw clean function. */
- sprintf (name, "__tcf_%d", counter++);
- t = make_call_declarator (get_identifier (name), params, NULL_TREE,
- NULL_TREE);
- start_function (decl_tree_cons (NULL_TREE, get_identifier ("static"),
- void_list_node),
- t, NULL_TREE, 0);
- store_parm_decls ();
- pushlevel (0);
- clear_last_expr ();
- push_momentary ();
- expand_start_bindings (0);
- emit_line_note (input_filename, lineno);
-
- interface_unknown = old_interface_unknown;
-
- pop_lang_context ();
-
- return current_function_decl;
-}
-
-void
-end_anon_func ()
-{
- expand_end_bindings (getdecls (), 1, 0);
- poplevel (1, 0, 0);
- pop_momentary ();
-
- finish_function (lineno, 0, 0);
-
- pop_from_top_level ();
- pop_cp_function_context (NULL_TREE);
-}
-
-/* Return a pointer to a buffer for an exception object of type TYPE. */
+#if 0
+/* Call __cxa_free_exception from a cleanup. This is never invoked
+ directly. */
static tree
-alloc_eh_object (type)
- tree type;
+do_free_exception (ptr)
+ tree ptr;
{
- tree fn, exp;
+ tree fn;
- fn = get_identifier ("__eh_alloc");
+ fn = get_identifier ("__cxa_free_exception");
if (IDENTIFIER_GLOBAL_VALUE (fn))
fn = IDENTIFIER_GLOBAL_VALUE (fn);
else
{
- /* Declare __eh_alloc (size_t), as defined in exception.cc. */
- tree tmp;
- push_obstacks_nochange ();
- end_temporary_allocation ();
- tmp = tree_cons (NULL_TREE, sizetype, void_list_node);
- fn = build_lang_decl (FUNCTION_DECL, fn,
- build_function_type (ptr_type_node, tmp));
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- pop_obstacks ();
+ /* Declare void __cxa_free_exception (void *). */
+ fn = push_void_library_fn (fn, tree_cons (NULL_TREE, ptr_type_node,
+ void_list_node));
}
- mark_used (fn);
- exp = build_function_call (fn, expr_tree_cons
- (NULL_TREE, size_in_bytes (type), NULL_TREE));
- exp = build1 (NOP_EXPR, build_pointer_type (type), exp);
- return exp;
+ return build_function_call (fn, tree_cons (NULL_TREE, ptr, NULL_TREE));
}
+#endif
-/* Expand a throw statement. This follows the following
- algorithm:
-
- 1. Allocate space to save the current PC onto the stack.
- 2. Generate and emit a label and save its address into the
- newly allocated stack space since we can't save the pc directly.
- 3. If this is the first call to throw in this function:
- generate a label for the throw block
- 4. jump to the throw block label. */
+/* Build a throw expression. */
-void
-expand_throw (exp)
+tree
+build_throw (exp)
tree exp;
{
tree fn;
- static tree cleanup_type;
- if (! doing_eh (1))
- return;
+ if (exp == error_mark_node)
+ return exp;
+
+ if (processing_template_decl)
+ return build_min (THROW_EXPR, void_type_node, exp);
- if (exp)
+ if (exp == null_node)
+ warning ("throwing NULL, which has integral, not pointer type");
+
+ if (exp != NULL_TREE)
{
- tree throw_type;
- tree cleanup = NULL_TREE, e;
+ if (!is_admissible_throw_operand (exp))
+ return error_mark_node;
+ }
- /* throw expression */
- /* First, decay it. */
- exp = decay_conversion (exp);
+ if (! doing_eh (1))
+ return error_mark_node;
- /* cleanup_type is void (*)(void *, int),
- the internal type of a destructor. */
- if (cleanup_type == NULL_TREE)
+ if (exp && decl_is_java_type (TREE_TYPE (exp), 1))
+ {
+ tree fn = get_identifier ("_Jv_Throw");
+ if (IDENTIFIER_GLOBAL_VALUE (fn))
+ fn = IDENTIFIER_GLOBAL_VALUE (fn);
+ else
{
- push_obstacks_nochange ();
- end_temporary_allocation ();
- cleanup_type = build_pointer_type
- (build_function_type
- (void_type_node, tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, integer_type_node, void_list_node))));
- pop_obstacks ();
+ /* Declare void _Jv_Throw (void *). */
+ tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
+ tmp = build_function_type (ptr_type_node, tmp);
+ fn = push_throw_library_fn (fn, tmp);
}
- if (TYPE_PTR_P (TREE_TYPE (exp)))
- throw_type = build_eh_type (exp);
+ exp = build_function_call (fn, tree_cons (NULL_TREE, exp, NULL_TREE));
+ }
+ else if (exp)
+ {
+ tree throw_type;
+ tree cleanup;
+ tree stmt_expr;
+ tree compound_stmt;
+ tree object, ptr;
+ tree tmp;
+
+ fn = get_identifier ("__cxa_throw");
+ if (IDENTIFIER_GLOBAL_VALUE (fn))
+ fn = IDENTIFIER_GLOBAL_VALUE (fn);
else
{
- tree object, ptr;
-
- /* OK, this is kind of wacky. The WP says that we call
- terminate
-
- when the exception handling mechanism, after completing
- evaluation of the expression to be thrown but before the
- exception is caught (_except.throw_), calls a user function
- that exits via an uncaught exception.
-
- So we have to protect the actual initialization of the
- exception object with terminate(), but evaluate the expression
- first. We also expand the call to __eh_alloc
- first. Since there could be temps in the expression, we need
- to handle that, too. */
-
- expand_start_target_temps ();
-
-#if 0
- /* Unfortunately, this doesn't work. */
- preexpand_calls (exp);
-#else
- /* Store the throw expression into a temp. This can be less
- efficient than storing it into the allocated space directly, but
- oh well. To do this efficiently we would need to insinuate
- ourselves into expand_call. */
- if (TREE_SIDE_EFFECTS (exp))
+ /* The CLEANUP_TYPE is the internal type of a destructor. */
+ if (cleanup_type == NULL_TREE)
{
- tree temp = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE (exp));
- DECL_ARTIFICIAL (temp) = 1;
- DECL_RTL (temp) = assign_temp (TREE_TYPE (exp), 2, 0, 1);
- DECL_INITIAL (temp) = exp;
- cp_finish_decl (temp, exp, NULL_TREE, 0, LOOKUP_ONLYCONVERTING);
- exp = temp;
+ tmp = void_list_node;
+ tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
+ tmp = build_function_type (void_type_node, tmp);
+ cleanup_type = build_pointer_type (tmp);
}
-#endif
- /* Allocate the space for the exception. */
- ptr = save_expr (alloc_eh_object (TREE_TYPE (exp)));
- expand_expr (ptr, const0_rtx, VOIDmode, 0);
+ /* Declare void __cxa_throw (void*, void*, void (*)(void*)). */
+ /* ??? Second argument is supposed to be "std::type_info*". */
+ tmp = void_list_node;
+ tmp = tree_cons (NULL_TREE, cleanup_type, tmp);
+ tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
+ tmp = tree_cons (NULL_TREE, ptr_type_node, tmp);
+ tmp = build_function_type (void_type_node, tmp);
+ fn = push_throw_library_fn (fn, tmp);
+ }
- expand_eh_region_start ();
+ begin_init_stmts (&stmt_expr, &compound_stmt);
- object = build_indirect_ref (ptr, NULL_PTR);
- exp = build_modify_expr (object, INIT_EXPR, exp);
+ /* throw expression */
+ /* First, decay it. */
+ exp = decay_conversion (exp);
- if (exp == error_mark_node)
- error (" in thrown expression");
+ /* OK, this is kind of wacky. The standard says that we call
+ terminate when the exception handling mechanism, after
+ completing evaluation of the expression to be thrown but
+ before the exception is caught (_except.throw_), calls a
+ user function that exits via an uncaught exception.
+
+ So we have to protect the actual initialization of the
+ exception object with terminate(), but evaluate the
+ expression first. Since there could be temps in the
+ expression, we need to handle that, too. We also expand
+ the call to __cxa_allocate_exception first (which doesn't
+ matter, since it can't throw). */
+
+ my_friendly_assert (stmts_are_full_exprs_p () == 1, 19990926);
+
+ /* Store the throw expression into a temp. This can be less
+ efficient than storing it into the allocated space directly, but
+ if we allocated the space first we would have to deal with
+ cleaning it up if evaluating this expression throws. */
+ if (TREE_SIDE_EFFECTS (exp))
+ {
+ tmp = create_temporary_var (TREE_TYPE (exp));
+ DECL_INITIAL (tmp) = exp;
+ cp_finish_decl (tmp, exp, NULL_TREE, LOOKUP_ONLYCONVERTING);
+ exp = tmp;
+ }
- expand_expr (exp, const0_rtx, VOIDmode, 0);
- expand_eh_region_end (build_terminate_handler ());
- expand_end_target_temps ();
+ /* Allocate the space for the exception. */
+ ptr = create_temporary_var (ptr_type_node);
+ DECL_REGISTER (ptr) = 1;
+ cp_finish_decl (ptr, NULL_TREE, NULL_TREE, LOOKUP_ONLYCONVERTING);
+ tmp = do_allocate_exception (TREE_TYPE (exp));
+ tmp = build_modify_expr (ptr, INIT_EXPR, tmp);
+ finish_expr_stmt (tmp);
- throw_type = build_eh_type (object);
+ object = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (exp)), ptr);
+ object = build_indirect_ref (object, NULL);
- if (TYPE_HAS_DESTRUCTOR (TREE_TYPE (object)))
- {
- cleanup = lookup_fnfields (TYPE_BINFO (TREE_TYPE (object)),
- dtor_identifier, 0);
- cleanup = TREE_VALUE (cleanup);
- mark_used (cleanup);
- mark_addressable (cleanup);
- /* Pretend it's a normal function. */
- cleanup = build1 (ADDR_EXPR, cleanup_type, cleanup);
- }
+ exp = build_modify_expr (object, INIT_EXPR, exp);
+ if (exp == error_mark_node)
+ error (" in thrown expression");
- exp = ptr;
- }
+ exp = build1 (MUST_NOT_THROW_EXPR, TREE_TYPE (exp), exp);
+ finish_expr_stmt (exp);
- /* Cast EXP to `void *' so that it will match the prototype for
- __cp_push_exception. */
- exp = convert (ptr_type_node, exp);
+ throw_type = build_eh_type_type (prepare_eh_type (TREE_TYPE (object)));
- if (cleanup == NULL_TREE)
+ if (TYPE_HAS_DESTRUCTOR (TREE_TYPE (object)))
{
- cleanup = build_int_2 (0, 0);
- TREE_TYPE (cleanup) = cleanup_type;
+ cleanup = lookup_fnfields (TYPE_BINFO (TREE_TYPE (object)),
+ complete_dtor_identifier, 0);
+ cleanup = TREE_VALUE (cleanup);
+ mark_used (cleanup);
+ mark_addressable (cleanup);
+ /* Pretend it's a normal function. */
+ cleanup = build1 (ADDR_EXPR, cleanup_type, cleanup);
}
-
- fn = get_identifier ("__cp_push_exception");
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
else
{
- /* Declare __cp_push_exception (void*, void*, void (*)(void*, int)),
- as defined in exception.cc. */
- tree tmp;
- push_obstacks_nochange ();
- end_temporary_allocation ();
- tmp = tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, cleanup_type, void_list_node)));
- fn = build_lang_decl (FUNCTION_DECL, fn,
- build_function_type (void_type_node, tmp));
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- pop_obstacks ();
+ cleanup = build_int_2 (0, 0);
+ TREE_TYPE (cleanup) = cleanup_type;
}
- mark_used (fn);
- e = expr_tree_cons (NULL_TREE, exp, expr_tree_cons
- (NULL_TREE, throw_type, expr_tree_cons
- (NULL_TREE, cleanup, NULL_TREE)));
- e = build_function_call (fn, e);
- expand_expr (e, const0_rtx, VOIDmode, 0);
+ tmp = tree_cons (NULL_TREE, cleanup, NULL_TREE);
+ tmp = tree_cons (NULL_TREE, throw_type, tmp);
+ tmp = tree_cons (NULL_TREE, ptr, tmp);
+ tmp = build_function_call (fn, tmp);
+
+ /* ??? Indicate that this function call throws throw_type. */
+
+ finish_expr_stmt (tmp);
+
+ exp = finish_init_stmts (stmt_expr, compound_stmt);
}
else
{
- /* rethrow current exception; note that it's no longer caught. */
+ /* Rethrow current exception. */
- tree fn = get_identifier ("__uncatch_exception");
+ tree fn = get_identifier ("__cxa_rethrow");
if (IDENTIFIER_GLOBAL_VALUE (fn))
fn = IDENTIFIER_GLOBAL_VALUE (fn);
else
{
- /* Declare void __uncatch_exception (void)
- as defined in exception.cc. */
- push_obstacks_nochange ();
- end_temporary_allocation ();
- fn = build_lang_decl (FUNCTION_DECL, fn,
- build_function_type (void_type_node,
- void_list_node));
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- pop_obstacks ();
+ /* Declare void __cxa_rethrow (void). */
+ fn = push_throw_library_fn
+ (fn, build_function_type (void_type_node, void_list_node));
}
- mark_used (fn);
exp = build_function_call (fn, NULL_TREE);
- expand_expr (exp, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
- expand_internal_throw ();
+ exp = build1 (THROW_EXPR, void_type_node, exp);
+
+ return exp;
}
-/* Build a throw expression. */
+/* Make sure TYPE is complete, pointer to complete, reference to
+ complete, or pointer to cv void. Issue diagnostic on failure.
+ Return the zero on failure and non-zero on success. FROM can be
+ the expr or decl from whence TYPE came, if available. */
-tree
-build_throw (e)
- tree e;
+static int
+complete_ptr_ref_or_void_ptr_p (type, from)
+ tree type;
+ tree from;
{
- if (e == error_mark_node)
- return e;
+ int is_ptr;
+
+ /* Check complete. */
+ type = complete_type_or_else (type, from);
+ if (!type)
+ return 0;
+
+ /* Or a pointer or ref to one, or cv void *. */
+ is_ptr = TREE_CODE (type) == POINTER_TYPE;
+ if (is_ptr || TREE_CODE (type) == REFERENCE_TYPE)
+ {
+ tree core = TREE_TYPE (type);
+
+ if (is_ptr && VOID_TYPE_P (core))
+ /* OK */;
+ else if (!complete_type_or_else (core, from))
+ return 0;
+ }
+ return 1;
+}
- if (processing_template_decl)
- return build_min (THROW_EXPR, void_type_node, e);
+/* Return truth-value if EXPRESSION is admissible in throw-expression,
+ i.e. if it is not of incomplete type or a pointer/reference to such
+ a type or of an abstract class type. */
+
+static bool
+is_admissible_throw_operand (expr)
+ tree expr;
+{
+ tree type = TREE_TYPE (expr);
+
+ /* 15.1/4 [...] The type of the throw-expression shall not be an
+ incomplete type, or a pointer or a reference to an incomplete
+ type, other than void*, const void*, volatile void*, or
+ const volatile void*. Except for these restriction and the
+ restrictions on type matching mentioned in 15.3, the operand
+ of throw is treated exactly as a function argument in a call
+ (5.2.2) or the operand of a return statement. */
+ if (!complete_ptr_ref_or_void_ptr_p (type, expr))
+ return false;
+
+ /* 10.4/3 An abstract class shall not be used as a parameter type,
+ as a function return type or as type of an explicit
+ conversion. */
+ else if (CLASS_TYPE_P (type) && CLASSTYPE_PURE_VIRTUALS (type))
+ {
+ error ("expression '%E' of abstract class type '%T' cannot be used in throw-expression", expr, type);
+ return false;
+ }
+
+ return true;
+}
+
+/* Returns nonzero if FN is a declaration of a standard C library
+ function which is known not to throw.
+
+ [lib.res.on.exception.handling]: None of the functions from the
+ Standard C library shall report an error by throwing an
+ exception, unless it calls a program-supplied function that
+ throws an exception. */
+
+#include "cfns.h"
+
+int
+nothrow_libfn_p (fn)
+ tree fn;
+{
+ tree id;
+
+ if (TREE_PUBLIC (fn)
+ && DECL_EXTERNAL (fn)
+ && DECL_NAMESPACE_SCOPE_P (fn)
+ && DECL_EXTERN_C_P (fn))
+ /* OK */;
+ else
+ /* Can't be a C library function. */
+ return 0;
+
+ id = DECL_ASSEMBLER_NAME (fn);
+ return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
+}
+
+/* Returns nonzero if an exception of type FROM will be caught by a
+ handler for type TO, as per [except.handle]. */
+
+static int
+can_convert_eh (to, from)
+ tree to, from;
+{
+ if (TREE_CODE (to) == REFERENCE_TYPE)
+ to = TREE_TYPE (to);
+ if (TREE_CODE (from) == REFERENCE_TYPE)
+ from = TREE_TYPE (from);
+
+ if (TREE_CODE (to) == POINTER_TYPE && TREE_CODE (from) == POINTER_TYPE)
+ {
+ to = TREE_TYPE (to);
+ from = TREE_TYPE (from);
- if (e == null_node)
- cp_warning ("throwing NULL, which has integral, not pointer type");
+ if (! at_least_as_qualified_p (to, from))
+ return 0;
+
+ if (TREE_CODE (to) == VOID_TYPE)
+ return 1;
+
+ /* else fall through */
+ }
- e = build1 (THROW_EXPR, void_type_node, e);
- TREE_SIDE_EFFECTS (e) = 1;
- TREE_USED (e) = 1;
+ if (CLASS_TYPE_P (to) && CLASS_TYPE_P (from)
+ && PUBLICLY_UNIQUELY_DERIVED_P (to, from))
+ return 1;
- return e;
+ return 0;
+}
+
+/* Check whether any of HANDLERS are shadowed by another handler accepting
+ TYPE. Note that the shadowing may not be complete; even if an exception
+ of type B would be caught by a handler for A, there could be a derived
+ class C for which A is an ambiguous base but B is not, so the handler
+ for B would catch an exception of type C. */
+
+static void
+check_handlers_1 (master, handlers)
+ tree master;
+ tree handlers;
+{
+ tree type = TREE_TYPE (master);
+ tree handler;
+
+ for (handler = handlers; handler; handler = TREE_CHAIN (handler))
+ if (TREE_TYPE (handler)
+ && can_convert_eh (type, TREE_TYPE (handler)))
+ {
+ lineno = STMT_LINENO (handler);
+ warning ("exception of type `%T' will be caught",
+ TREE_TYPE (handler));
+ lineno = STMT_LINENO (master);
+ warning (" by earlier handler for `%T'", type);
+ break;
+ }
+}
+
+/* Given a chain of HANDLERs, make sure that they're OK. */
+
+void
+check_handlers (handlers)
+ tree handlers;
+{
+ tree handler;
+ int save_line = lineno;
+ for (handler = handlers; handler; handler = TREE_CHAIN (handler))
+ {
+ if (TREE_CHAIN (handler) == NULL_TREE)
+ /* No more handlers; nothing to shadow. */;
+ else if (TREE_TYPE (handler) == NULL_TREE)
+ {
+ lineno = STMT_LINENO (handler);
+ pedwarn
+ ("`...' handler must be the last handler for its try block");
+ }
+ else
+ check_handlers_1 (handler, TREE_CHAIN (handler));
+ }
+ lineno = save_line;
}
diff --git a/contrib/gcc/cp/expr.c b/contrib/gcc/cp/expr.c
index 83bdff9..34f779e 100644
--- a/contrib/gcc/cp/expr.c
+++ b/contrib/gcc/cp/expr.c
@@ -1,6 +1,7 @@
/* Convert language-specific tree expression to rtl instructions,
for GNU compiler.
- Copyright (C) 1988, 92-97, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -28,18 +29,16 @@ Boston, MA 02111-1307, USA. */
#include "expr.h"
#include "cp-tree.h"
#include "toplev.h"
+#include "except.h"
+#include "tm_p.h"
-#if 0
-static tree extract_aggr_init PROTO((tree, tree));
-static tree extract_scalar_init PROTO((tree, tree));
-#endif
-static rtx cplus_expand_expr PROTO((tree, rtx, enum machine_mode,
+static rtx cplus_expand_expr PARAMS ((tree, rtx, enum machine_mode,
enum expand_modifier));
/* Hook used by output_constant to expand language-specific
constants. */
-static tree
+tree
cplus_expand_constant (cst)
tree cst;
{
@@ -49,7 +48,6 @@ cplus_expand_constant (cst)
{
tree type = TREE_TYPE (cst);
tree member;
- tree offset;
/* Find the member. */
member = PTRMEM_CST_MEMBER (cst);
@@ -57,29 +55,16 @@ cplus_expand_constant (cst)
if (TREE_CODE (member) == FIELD_DECL)
{
/* Find the offset for the field. */
- offset = convert (sizetype,
- size_binop (EASY_DIV_EXPR,
- DECL_FIELD_BITPOS (member),
- size_int (BITS_PER_UNIT)));
-
- /* We offset all pointer to data members by 1 so that we
- can distinguish between a null pointer to data member
- and the first data member of a structure. */
- offset = size_binop (PLUS_EXPR, offset, size_int (1));
-
- cst = cp_convert (type, offset);
+ tree offset = byte_position (member);
+ cst = fold (build1 (NOP_EXPR, type, offset));
}
else
{
tree delta;
- tree idx;
tree pfn;
- tree delta2;
-
- expand_ptrmemfunc_cst (cst, &delta, &idx, &pfn, &delta2);
- cst = build_ptrmemfunc1 (type, delta, idx,
- pfn, delta2);
+ expand_ptrmemfunc_cst (cst, &delta, &pfn);
+ cst = build_ptrmemfunc1 (type, delta, pfn);
}
}
break;
@@ -104,10 +89,7 @@ cplus_expand_expr (exp, target, tmode, modifier)
tree type = TREE_TYPE (exp);
register enum machine_mode mode = TYPE_MODE (type);
register enum tree_code code = TREE_CODE (exp);
- int ignore = target == const0_rtx;
-
- if (ignore)
- target = 0;
+ rtx ret;
/* No sense saving up arithmetic to be done
if it's all in the wrong mode to form part of an address.
@@ -118,138 +100,33 @@ cplus_expand_expr (exp, target, tmode, modifier)
switch (code)
{
- case AGGR_INIT_EXPR:
- {
- /* Something needs to be initialized, but we didn't know
- where that thing was when building the tree. For example,
- it could be the return value of a function, or a parameter
- to a function which lays down in the stack, or a temporary
- variable which must be passed by reference.
-
- Cleanups are handled in a language-specific way: they
- might be run by the called function (true in GNU C++
- for parameters with cleanups), or they might be
- run by the caller, after the call (true in GNU C++
- for other cleanup needs). */
-
- tree func = TREE_OPERAND (exp, 0);
- tree args = TREE_OPERAND (exp, 1);
- tree type = TREE_TYPE (exp), slot;
- tree call_exp;
- rtx call_target, return_target;
- int pcc_struct_return = 0;
-
- /* The expression `init' wants to initialize what
- `target' represents. SLOT holds the slot for TARGET. */
- slot = TREE_OPERAND (exp, 2);
-
- /* Should always be called with a target. */
- my_friendly_assert (target != NULL_RTX, 205);
-
- /* The target the initializer will initialize (CALL_TARGET)
- must now be directed to initialize the target we are
- supposed to initialize (TARGET). The semantics for
- choosing what CALL_TARGET is is language-specific,
- as is building the call which will perform the
- initialization. It is left here to show the choices that
- exist for C++. */
-
- if (TREE_CODE (func) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (func, 0)) == FUNCTION_DECL
- && DECL_CONSTRUCTOR_P (TREE_OPERAND (func, 0)))
- {
- type = build_pointer_type (type);
- /* Don't clobber a value that might be part of a default
- parameter value. */
- mark_addressable (slot);
- if (TREE_PERMANENT (args))
- args = expr_tree_cons (0, build1 (ADDR_EXPR, type, slot),
- TREE_CHAIN (args));
- else
- TREE_VALUE (args) = build1 (ADDR_EXPR, type, slot);
- call_target = 0;
- }
- else
- {
- call_target = target;
-#ifdef PCC_STATIC_STRUCT_RETURN
- if (aggregate_value_p (type))
- {
- pcc_struct_return = 1;
- call_target = 0;
- }
-#endif
- }
-
- call_exp = build (CALL_EXPR, type, func, args, NULL_TREE);
- TREE_SIDE_EFFECTS (call_exp) = 1;
- return_target = expand_call (call_exp, call_target, ignore);
-
- if (call_target)
- /* Trust that the right thing has been done; it's too hard to
- verify. */
- return return_target;
-
- /* If we're suffering under the ancient PCC_STATIC_STRUCT_RETURN
- calling convention, we need to copy the return value out of
- the static return buffer into slot. */
- if (pcc_struct_return)
- {
- extern int flag_access_control;
- int old_ac = flag_access_control;
-
- tree init = build_decl (VAR_DECL, NULL_TREE,
- build_reference_type (type));
- DECL_RTL (init) = XEXP (return_target, 0);
- init = convert_from_reference (init);
-
- flag_access_control = 0;
- expand_aggr_init (slot, init, LOOKUP_ONLYCONVERTING);
- flag_access_control = old_ac;
-
- if (TYPE_NEEDS_DESTRUCTOR (type))
- {
- init = maybe_build_cleanup (init);
- if (init != NULL_TREE)
- expand_expr (init, const0_rtx, VOIDmode, 0);
- }
- }
-
- return DECL_RTL (slot);
- }
-
case PTRMEM_CST:
return expand_expr (cplus_expand_constant (exp),
target, tmode, modifier);
case OFFSET_REF:
- {
- return expand_expr (default_conversion (resolve_offset_ref (exp)),
- target, tmode, EXPAND_NORMAL);
- }
-
- case THUNK_DECL:
- return DECL_RTL (exp);
-
+ /* Offset refs should not make it through to here. */
+ abort ();
+ return const0_rtx;
+
case THROW_EXPR:
- expand_throw (TREE_OPERAND (exp, 0));
+ expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
return NULL;
- case VEC_INIT_EXPR:
- return expand_expr
- (expand_vec_init
- (NULL_TREE, TREE_OPERAND (exp, 0),
- build_binary_op (MINUS_EXPR, TREE_OPERAND (exp, 2),
- integer_one_node),
- TREE_OPERAND (exp, 1), 0), target, tmode, modifier);
+ case MUST_NOT_THROW_EXPR:
+ expand_eh_region_start ();
+ ret = expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
+ expand_eh_region_end_must_not_throw (build_call (terminate_node, 0));
+ return ret;
- case NEW_EXPR:
- return expand_expr (build_new_1 (exp), target, tmode, modifier);
+ case EMPTY_CLASS_EXPR:
+ /* We don't need to generate any code for an empty class. */
+ return const0_rtx;
default:
- break;
+ return c_expand_expr (exp, target, tmode, modifier);
}
- my_friendly_abort (40);
+ abort ();
/* NOTREACHED */
return NULL;
}
@@ -258,204 +135,12 @@ void
init_cplus_expand ()
{
lang_expand_expr = cplus_expand_expr;
- lang_expand_constant = cplus_expand_constant;
}
-/* If DECL had its rtl moved from where callers expect it
- to be, fix it up. RESULT is the nominal rtl for the RESULT_DECL,
- which may be a pseudo instead of a hard register. */
-
-void
-fixup_result_decl (decl, result)
- tree decl;
- rtx result;
-{
- if (REG_P (result))
- {
- if (REGNO (result) >= FIRST_PSEUDO_REGISTER)
- {
- rtx real_decl_result;
-
-#ifdef FUNCTION_OUTGOING_VALUE
- real_decl_result
- = FUNCTION_OUTGOING_VALUE (TREE_TYPE (decl), current_function_decl);
-#else
- real_decl_result
- = FUNCTION_VALUE (TREE_TYPE (decl), current_function_decl);
-#endif
- REG_FUNCTION_VALUE_P (real_decl_result) = 1;
- result = real_decl_result;
- }
- store_expr (decl, result, 0);
- emit_insn (gen_rtx (USE, VOIDmode, result));
- }
-}
-
-#if 0
-/* Expand this initialization inline and see if it's simple enough that
- it can be done at compile-time. */
-
-static tree
-extract_aggr_init (decl, init)
- tree decl, init;
-{
- return 0;
-}
-
-static tree
-extract_scalar_init (decl, init)
- tree decl, init;
-{
- rtx value, insns, insn;
- extern struct obstack temporary_obstack;
- tree t = NULL_TREE;
-
- push_obstacks (&temporary_obstack, &temporary_obstack);
- start_sequence ();
- value = expand_expr (init, NULL_RTX, VOIDmode, 0);
- insns = get_insns ();
- end_sequence ();
- reg_scan (insns, max_reg_num (), 0);
- jump_optimize (insns, 0, 0, 1);
- pop_obstacks ();
-
- for (insn = insns; insn; insn = NEXT_INSN (insn))
- {
- rtx r, to;
-
- if (GET_CODE (insn) == NOTE)
- continue;
- else if (GET_CODE (insn) != INSN)
- return 0;
-
- r = PATTERN (insn);
- if (GET_CODE (r) != SET)
- return 0;
-
- to = XEXP (r, 0);
-
- if (! (to == value
- || (GET_CODE (to) == SUBREG && XEXP (to, 0) == value)))
- return 0;
-
- r = XEXP (r, 1);
-
- switch (GET_CODE (r))
- {
- case CONST_INT:
- t = build_int_2 (XEXP (r, 0), 0);
- break;
- default:
- return 0;
- }
- }
-
- return t;
-}
-#endif
-
int
extract_init (decl, init)
tree decl ATTRIBUTE_UNUSED, init ATTRIBUTE_UNUSED;
{
return 0;
-
-#if 0
- if (IS_AGGR_TYPE (TREE_TYPE (decl))
- || TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
- init = extract_aggr_init (decl, init);
- else
- init = extract_scalar_init (decl, init);
-
- if (init == NULL_TREE)
- return 0;
-
- DECL_INITIAL (decl) = init;
- return 1;
-#endif
}
-void
-do_case (start, end)
- tree start, end;
-{
- tree value1 = NULL_TREE, value2 = NULL_TREE, label;
-
- if (start != NULL_TREE && TREE_TYPE (start) != NULL_TREE
- && POINTER_TYPE_P (TREE_TYPE (start)))
- error ("pointers are not permitted as case values");
-
- if (end && pedantic)
- pedwarn ("ANSI C++ forbids range expressions in switch statement");
-
- if (processing_template_decl)
- {
- add_tree (build_min_nt (CASE_LABEL, start, end));
- return;
- }
-
- if (start)
- value1 = check_cp_case_value (start);
- if (end)
- value2 = check_cp_case_value (end);
-
- label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
-
- if (value1 != error_mark_node
- && value2 != error_mark_node)
- {
- tree duplicate;
- int success;
-
- if (end)
- success = pushcase_range (value1, value2, convert_and_check,
- label, &duplicate);
- else if (start)
- success = pushcase (value1, convert_and_check, label, &duplicate);
- else
- success = pushcase (NULL_TREE, 0, label, &duplicate);
-
- if (success == 1)
- {
- if (end)
- error ("case label not within a switch statement");
- else if (start)
- cp_error ("case label `%E' not within a switch statement", start);
- else
- error ("default label not within a switch statement");
- }
- else if (success == 2)
- {
- if (end)
- {
- error ("duplicate (or overlapping) case value");
- cp_error_at ("this is the first entry overlapping that value",
- duplicate);
- }
- else if (start)
- {
- cp_error ("duplicate case value `%E'", start);
- cp_error_at ("previously used here", duplicate);
- }
- else
- {
- error ("multiple default labels in one switch");
- cp_error_at ("this is the first default label", duplicate);
- }
- }
- else if (success == 3)
- warning ("case value out of range");
- else if (success == 4)
- warning ("empty range specified");
- else if (success == 5)
- {
- if (end)
- error ("case label within scope of cleanup or variable array");
- else if (! start)
- error ("`default' label within scope of cleanup or variable array");
- else
- cp_error ("case label `%E' within scope of cleanup or variable array", start);
- }
- }
- define_case_label ();
-}
diff --git a/contrib/gcc/cp/friend.c b/contrib/gcc/cp/friend.c
index 5085ebc..1d96701 100644
--- a/contrib/gcc/cp/friend.c
+++ b/contrib/gcc/cp/friend.c
@@ -1,5 +1,5 @@
/* Help friends in C++.
- Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -22,6 +22,7 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "tree.h"
#include "rtl.h"
+#include "expr.h"
#include "cp-tree.h"
#include "flags.h"
#include "output.h"
@@ -42,19 +43,13 @@ is_friend (type, supplicant)
if (supplicant == NULL_TREE || type == NULL_TREE)
return 0;
- declp = (TREE_CODE_CLASS (TREE_CODE (supplicant)) == 'd');
+ declp = DECL_P (supplicant);
if (declp)
/* It's a function decl. */
{
tree list = DECL_FRIENDLIST (TYPE_MAIN_DECL (type));
tree name = DECL_NAME (supplicant);
- tree ctype;
-
- if (DECL_FUNCTION_MEMBER_P (supplicant))
- ctype = DECL_CLASS_CONTEXT (supplicant);
- else
- ctype = NULL_TREE;
for (; list ; list = TREE_CHAIN (list))
{
@@ -63,28 +58,18 @@ is_friend (type, supplicant)
tree friends = FRIEND_DECLS (list);
for (; friends ; friends = TREE_CHAIN (friends))
{
- if (same_type_p (ctype, TREE_PURPOSE (friends)))
- return 1;
-
if (TREE_VALUE (friends) == NULL_TREE)
continue;
if (supplicant == TREE_VALUE (friends))
return 1;
- /* With -fguiding-decls we are more lenient about
- friendship. This is bogus in general since two
- specializations of a template with non-type
- template parameters may have the same type, but
- be different.
-
- Temporarily, we are also more lenient to deal
- with nested friend functions, for which there can
- be more than one FUNCTION_DECL, despite being the
- same function. When that's fixed, the
- FUNCTION_MEMBER_P bit can go. */
- if ((flag_guiding_decls
- || DECL_FUNCTION_MEMBER_P (supplicant))
+ /* Temporarily, we are more lenient to deal with
+ nested friend functions, for which there can be
+ more than one FUNCTION_DECL, despite being the
+ same function. When that's fixed, this bit can
+ go. */
+ if (DECL_FUNCTION_MEMBER_P (supplicant)
&& same_type_p (TREE_TYPE (supplicant),
TREE_TYPE (TREE_VALUE (friends))))
return 1;
@@ -101,8 +86,13 @@ is_friend (type, supplicant)
else
/* It's a type. */
{
- if (type == supplicant)
- return 1;
+ /* Nested classes are implicitly friends of their enclosing types, as
+ per core issue 45 (this is a change from the standard). */
+ for (context = supplicant;
+ context && TYPE_P (context);
+ context = TYPE_CONTEXT (context))
+ if (type == context)
+ return 1;
list = CLASSTYPE_FRIEND_CLASSES (TREE_TYPE (TYPE_MAIN_DECL (type)));
for (; list ; list = TREE_CHAIN (list))
@@ -117,10 +107,10 @@ is_friend (type, supplicant)
}
if (declp && DECL_FUNCTION_MEMBER_P (supplicant))
- context = DECL_CLASS_CONTEXT (supplicant);
+ context = DECL_CONTEXT (supplicant);
else if (! declp)
/* Local classes have the same access as the enclosing function. */
- context = hack_decl_function_context (TYPE_MAIN_DECL (supplicant));
+ context = decl_function_context (TYPE_MAIN_DECL (supplicant));
else
context = NULL_TREE;
@@ -162,7 +152,7 @@ add_friend (type, decl)
{
if (decl == TREE_VALUE (friends))
{
- cp_warning ("`%D' is already a friend of class `%T'",
+ warning ("`%D' is already a friend of class `%T'",
decl, type);
cp_warning_at ("previous friend declaration of `%D'",
TREE_VALUE (friends));
@@ -185,47 +175,6 @@ add_friend (type, decl)
DECL_BEFRIENDING_CLASSES (decl));
}
-/* Declare that every member function NAME in FRIEND_TYPE
- (which may be NULL_TREE) is a friend of type TYPE. */
-
-void
-add_friends (type, name, friend_type)
- tree type, name, friend_type;
-{
- tree typedecl = TYPE_MAIN_DECL (type);
- tree list = DECL_FRIENDLIST (typedecl);
-
- while (list)
- {
- if (name == FRIEND_NAME (list))
- {
- tree friends = FRIEND_DECLS (list);
- while (friends && TREE_PURPOSE (friends) != friend_type)
- friends = TREE_CHAIN (friends);
- if (friends)
- {
- if (friend_type)
- warning ("method `%s::%s' is already a friend of class",
- TYPE_NAME_STRING (friend_type),
- IDENTIFIER_POINTER (name));
- else
- warning ("function `%s' is already a friend of class `%s'",
- IDENTIFIER_POINTER (name),
- IDENTIFIER_POINTER (DECL_NAME (typedecl)));
- }
- else
- TREE_VALUE (list) = tree_cons (friend_type, NULL_TREE,
- TREE_VALUE (list));
- return;
- }
- list = TREE_CHAIN (list);
- }
- DECL_FRIENDLIST (typedecl)
- = tree_cons (name,
- build_tree_list (friend_type, NULL_TREE),
- DECL_FRIENDLIST (typedecl));
-}
-
/* Make FRIEND_TYPE a friend class to TYPE. If FRIEND_TYPE has already
been defined, we make all of its member functions friends of
TYPE. If not, we make it a pending friend, which can later be added
@@ -243,14 +192,9 @@ make_friend_class (type, friend_type)
tree classes;
int is_template_friend;
- if (IS_SIGNATURE (type))
+ if (! IS_AGGR_TYPE (friend_type))
{
- error ("`friend' declaration in signature definition");
- return;
- }
- if (IS_SIGNATURE (friend_type) || ! IS_AGGR_TYPE (friend_type))
- {
- cp_error ("invalid type `%T' declared `friend'", friend_type);
+ error ("invalid type `%T' declared `friend'", friend_type);
return;
}
@@ -262,11 +206,11 @@ make_friend_class (type, friend_type)
Friend declarations shall not declare partial
specializations. */
- cp_error ("partial specialization `%T' declared `friend'",
+ error ("partial specialization `%T' declared `friend'",
friend_type);
return;
}
-
+
if (processing_template_decl > template_class_depth (type))
/* If the TYPE is a template then it makes sense for it to be
friends with itself; this means that each instantiation is
@@ -274,13 +218,40 @@ make_friend_class (type, friend_type)
is_template_friend = 1;
else if (same_type_p (type, friend_type))
{
- pedwarn ("class `%s' is implicitly friends with itself",
- TYPE_NAME_STRING (type));
+ pedwarn ("class `%T' is implicitly friends with itself",
+ type);
return;
}
else
is_template_friend = 0;
+ /* [temp.friend]
+
+ A friend of a class or class template can be a function or
+ class template, a specialization of a function template or
+ class template, or an ordinary (nontemplate) function or
+ class. */
+ if (!is_template_friend)
+ ;/* ok */
+ else if (TREE_CODE (friend_type) == TYPENAME_TYPE)
+ {
+ /* template <class T> friend typename S<T>::X; */
+ error ("typename type `%#T' declared `friend'", friend_type);
+ return;
+ }
+ else if (TREE_CODE (friend_type) == TEMPLATE_TYPE_PARM)
+ {
+ /* template <class T> friend class T; */
+ error ("template parameter type `%T' declared `friend'", friend_type);
+ return;
+ }
+ else if (!CLASSTYPE_TEMPLATE_INFO (friend_type))
+ {
+ /* template <class T> friend class A; where A is not a template */
+ error ("`%#T' is not a template", friend_type);
+ return;
+ }
+
GNU_xref_hier (type, friend_type, 0, 0, 1);
if (is_template_friend)
@@ -294,7 +265,7 @@ make_friend_class (type, friend_type)
same_type_p (TREE_VALUE (classes), friend_type)))
classes = TREE_CHAIN (classes);
if (classes)
- cp_warning ("`%T' is already a friend of `%T'",
+ warning ("`%T' is already a friend of `%T'",
TREE_VALUE (classes), type);
else
{
@@ -338,7 +309,6 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
int funcdef_flag;
{
int is_friend_template = 0;
- tree prefix_attributes, attributes;
/* Every decl that gets here is a friend of something. */
DECL_FRIEND_P (decl) = 1;
@@ -353,7 +323,7 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
}
if (TREE_CODE (decl) != FUNCTION_DECL)
- my_friendly_abort (990513);
+ abort ();
is_friend_template = PROCESSING_REAL_TEMPLATE_DECL_P ();
@@ -378,12 +348,12 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
/* We can't do lookup in a type that involves template
parameters. Instead, we rely on tsubst_friend_function
to check the validity of the declaration later. */
- if (uses_template_parms (ctype))
+ if (processing_template_decl)
add_friend (current_class_type, decl);
/* A nested class may declare a member of an enclosing class
to be a friend, so we do lookup here even if CTYPE is in
the process of being defined. */
- else if (TYPE_SIZE (ctype) != 0 || TYPE_BEING_DEFINED (ctype))
+ else if (COMPLETE_TYPE_P (ctype) || TYPE_BEING_DEFINED (ctype))
{
decl = check_classfn (ctype, decl);
@@ -391,7 +361,7 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
add_friend (current_class_type, decl);
}
else
- cp_error ("member `%D' declared as friend before type `%T' defined",
+ error ("member `%D' declared as friend before type `%T' defined",
decl, ctype);
}
/* A global friend.
@@ -405,42 +375,56 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
in their scope, their friend wind up in top-level scope as well. */
DECL_ARGUMENTS (decl) = parmdecls;
if (funcdef_flag)
- DECL_CLASS_CONTEXT (decl) = current_class_type;
+ SET_DECL_FRIEND_CONTEXT (decl, current_class_type);
if (! DECL_USE_TEMPLATE (decl))
{
- /* We can call pushdecl here, because the TREE_CHAIN of this
- FUNCTION_DECL is not needed for other purposes. Don't do
- this for a template instantiation. However, we don't
- call pushdecl() for a friend function of a template
- class, since in general, such a declaration depends on
- template parameters. Instead, we call pushdecl when the
- class is instantiated. */
- if (!is_friend_template
- && template_class_depth (current_class_type) == 0)
- decl = pushdecl (decl);
- else
+ /* We must check whether the decl refers to template
+ arguments before push_template_decl_real adds a
+ reference to the containing template class. */
+ int warn = (warn_nontemplate_friend
+ && ! funcdef_flag && ! is_friend_template
+ && current_template_parms
+ && uses_template_parms (decl));
+
+ if (is_friend_template
+ || template_class_depth (current_class_type) != 0)
+ /* We can't call pushdecl for a template class, since in
+ general, such a declaration depends on template
+ parameters. Instead, we call pushdecl when the class
+ is instantiated. */
decl = push_template_decl_real (decl, /*is_friend=*/1);
+ else if (current_function_decl)
+ /* This must be a local class, so pushdecl will be ok, and
+ insert an unqualified friend into the local scope
+ (rather than the containing namespace scope, which the
+ next choice will do). */
+ decl = pushdecl (decl);
+ else
+ {
+ /* We can't use pushdecl, as we might be in a template
+ class specialization, and pushdecl will insert an
+ unqualified friend decl into the template parameter
+ scope, rather than the namespace containing it. */
+ tree ns = decl_namespace_context (decl);
+
+ push_nested_namespace (ns);
+ decl = pushdecl_namespace_level (decl);
+ pop_nested_namespace (ns);
+ }
- if (warn_nontemplate_friend
- && ! funcdef_flag && ! flag_guiding_decls && ! is_friend_template
- && current_template_parms && uses_template_parms (decl))
+ if (warn)
{
static int explained;
- cp_warning ("friend declaration `%#D'", decl);
- warning (" declares a non-template function");
+ warning ("friend declaration `%#D' declares a non-template function", decl);
if (! explained)
{
- warning (" (if this is not what you intended, make sure");
- warning (" the function template has already been declared,");
- warning (" and add <> after the function name here)");
- warning (" -Wno-non-template-friend disables this warning.");
+ warning ("(if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warning");
explained = 1;
}
}
}
- make_decl_rtl (decl, NULL_PTR, 1);
add_friend (current_class_type,
is_friend_template ? DECL_TI_TEMPLATE (decl) : decl);
DECL_FRIEND_P (decl) = 1;
@@ -450,23 +434,8 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist,
handle them in start_decl_1, but since this is a friend decl start_decl_1
never gets to see it. */
- if (attrlist)
- {
- attributes = TREE_PURPOSE (attrlist);
- prefix_attributes = TREE_VALUE (attrlist);
- }
- else
- {
- attributes = NULL_TREE;
- prefix_attributes = NULL_TREE;
- }
-
-#ifdef SET_DEFAULT_DECL_ATTRIBUTES
- SET_DEFAULT_DECL_ATTRIBUTES (decl, attributes);
-#endif
-
/* Set attributes here so if duplicate decl, will have proper attributes. */
- cplus_decl_attributes (decl, attributes, prefix_attributes);
+ cplus_decl_attributes (&decl, attrlist, 0);
return decl;
}
diff --git a/contrib/gcc/cp/g++.1 b/contrib/gcc/cp/g++.1
index 5101d5f..a5be7bce 100644
--- a/contrib/gcc/cp/g++.1
+++ b/contrib/gcc/cp/g++.1
@@ -1,642 +1 @@
-.\" Copyright (c) 1991, 1992 Free Software Foundation -*-Text-*-
-.\" See section COPYING for conditions for redistribution
-.\" FIXME: no info here on predefines. Should there be? extra for C++...
-.TH G++ 1 "30apr1993" "GNU Tools" "GNU Tools"
-.de BP
-.sp
-.ti \-.2i
-\(**
-..
-.SH NAME
-g++ \- GNU project C++ Compiler
-.SH SYNOPSIS
-.RB g++ " [" \c
-.IR option " | " filename " ].\|.\|.
-.SH DESCRIPTION
-The C and C++ compilers are integrated;
-.B g++
-is a script to call
-.B gcc with options to recognize C++.
-.B gcc
-processes input files
-through one or more of four stages: preprocessing, compilation,
-assembly, and linking. This man page contains full descriptions for
-.I only
-C++ specific aspects of the compiler, though it also contains
-summaries of some general-purpose options. For a fuller explanation
-of the compiler, see
-.BR gcc ( 1 ).
-
-C++ source files use one of the suffixes `\|\c
-.B .C\c
-\&\|', `\|\c
-.B .cc\c
-\&\|', `\|\c
-.B .cxx\c
-\&\|', `\|\c
-.B .cpp\c
-\&\|', or `\|\c
-.B .c++\c
-\&\|'; preprocessed C++ files use the suffix `\|\c
-.B .ii\c
-\&\|'.
-.SH OPTIONS
-There are many command-line options, including options to control
-details of optimization, warnings, and code generation, which are
-common to both
-.B gcc
-and
-.B g++\c
-\&. For full information on all options, see
-.BR gcc ( 1 ).
-
-Options must be separate: `\|\c
-.B \-dr\c
-\&\|' is quite different from `\|\c
-.B \-d \-r
-\&\|'.
-
-Most `\|\c
-.B \-f\c
-\&\|' and `\|\c
-.B \-W\c
-\&\|' options have two contrary forms:
-.BI \-f name
-and
-.BI \-fno\- name\c
-\& (or
-.BI \-W name
-and
-.BI \-Wno\- name\c
-\&). Only the non-default forms are shown here.
-
-.TP
-.B \-c
-Compile or assemble the source files, but do not link. The compiler
-output is an object file corresponding to each source file.
-.TP
-.BI \-D macro
-Define macro \c
-.I macro\c
-\& with the string `\|\c
-.B 1\c
-\&\|' as its definition.
-.TP
-.BI \-D macro = defn
-Define macro \c
-.I macro\c
-\& as \c
-.I defn\c
-\&.
-.TP
-.B \-E
-Stop after the preprocessing stage; do not run the compiler proper. The
-output is preprocessed source code, which is sent to the
-standard output.
-.TP
-.B \-fall\-virtual
-Treat all possible member functions as virtual, implicitly. All
-member functions (except for constructor functions and
-.B new
-or
-.B delete
-member operators) are treated as virtual functions of the class where
-they appear.
-
-This does not mean that all calls to these member functions will be
-made through the internal table of virtual functions. Under some
-circumstances, the compiler can determine that a call to a given
-virtual function can be made directly; in these cases the calls are
-direct in any case.
-.TP
-.B \-fdollars\-in\-identifiers
-Permit the use of `\|\c
-.B $\c
-\&\|' in identifiers.
-Traditional C allowed the character `\|\c
-.B $\c
-\&\|' to form part of identifiers; by default, GNU C also
-allows this. However, ANSI C forbids `\|\c
-.B $\c
-\&\|' in identifiers, and GNU C++ also forbids it by default on most
-platforms (though on some platforms it's enabled by default for GNU
-C++ as well).
-.TP
-.B \-felide\-constructors
-Use this option to instruct the compiler to be smarter about when it can
-elide constructors. Without this flag, GNU C++ and cfront both
-generate effectively the same code for:
-.sp
-.br
-A\ foo\ ();
-.br
-A\ x\ (foo\ ());\ \ \ //\ x\ initialized\ by\ `foo\ ()',\ no\ ctor\ called
-.br
-A\ y\ =\ foo\ ();\ \ \ //\ call\ to\ `foo\ ()'\ heads\ to\ temporary,
-.br
-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ //\ y\ is\ initialized\ from\ the\ temporary.
-.br
-.sp
-Note the difference! With this flag, GNU C++ initializes `\|\c
-.B y\c
-\&\|' directly
-from the call to
-.B foo ()
-without going through a temporary.
-.TP
-.B \-fenum\-int\-equiv
-Normally GNU C++ allows conversion of
-.B enum
-to
-.B int\c
-\&, but not the other way around. Use this option if you want GNU C++
-to allow conversion of
-.B int
-to
-.B enum
-as well.
-.TP
-.B \-fexternal\-templates
-Produce smaller code for template declarations, by generating only a
-single copy of each template function where it is defined.
-To use this option successfully, you must also mark all files that
-use templates with either `\|\c
-.B #pragma implementation\c
-\&\|' (the definition) or
-`\|\c
-.B #pragma interface\c
-\&\|' (declarations).
-
-When your code is compiled with `\|\c
-.B \-fexternal\-templates\c
-\&\|', all
-template instantiations are external. You must arrange for all
-necessary instantiations to appear in the implementation file; you can
-do this with a \c
-.B typedef\c
-\& that references each instantiation needed.
-Conversely, when you compile using the default option
-`\|\c
-.B \-fno\-external\-templates\c
-\&\|', all template instantiations are
-explicitly internal.
-.TP
-.B \-fno\-gnu\-linker
-Do not output global initializations (such as C++ constructors and
-destructors) in the form used by the GNU linker (on systems where the GNU
-linker is the standard method of handling them). Use this option when
-you want to use a non-GNU linker, which also requires using the
-.B collect2
-program to make sure the system linker includes
-constructors and destructors. (\c
-.B collect2
-is included in the GNU CC distribution.) For systems which
-.I must
-use
-.B collect2\c
-\&, the compiler driver
-.B gcc
-is configured to do this automatically.
-.TP
-.B \-fmemoize\-lookups
-.TP
-.B \-fsave\-memoized
-These flags are used to get the compiler to compile programs faster
-using heuristics. They are not on by default since they are only effective
-about half the time. The other half of the time programs compile more
-slowly (and take more memory).
-
-The first time the compiler must build a call to a member function (or
-reference to a data member), it must (1) determine whether the class
-implements member functions of that name; (2) resolve which member
-function to call (which involves figuring out what sorts of type
-conversions need to be made); and (3) check the visibility of the member
-function to the caller. All of this adds up to slower compilation.
-Normally, the second time a call is made to that member function (or
-reference to that data member), it must go through the same lengthy
-process again. This means that code like this
-.sp
-.br
-\ \ cout\ <<\ "This\ "\ <<\ p\ <<\ "\ has\ "\ <<\ n\ <<\ "\ legs.\en";
-.br
-.sp
-makes six passes through all three steps. By using a software cache,
-a ``hit'' significantly reduces this cost. Unfortunately, using the
-cache introduces another layer of mechanisms which must be implemented,
-and so incurs its own overhead. `\|\c
-.B \-fmemoize\-lookups\c
-\&\|' enables
-the software cache.
-
-Because access privileges (visibility) to members and member functions
-may differ from one function context to the next,
-.B g++
-may need to flush the cache. With the `\|\c
-.B \-fmemoize\-lookups\c
-\&\|' flag, the cache is flushed after every
-function that is compiled. The `\|\c
-\-fsave\-memoized\c
-\&\|' flag enables the same software cache, but when the compiler
-determines that the context of the last function compiled would yield
-the same access privileges of the next function to compile, it
-preserves the cache.
-This is most helpful when defining many member functions for the same
-class: with the exception of member functions which are friends of
-other classes, each member function has exactly the same access
-privileges as every other, and the cache need not be flushed.
-.TP
-.B \-fno\-default\-inline
-Do not make member functions inline by default merely because they are
-defined inside the class scope. Otherwise, when you specify
-.B \-O\c
-\&, member functions defined inside class scope are compiled
-inline by default; i.e., you don't need to add `\|\c
-.B inline\c
-\&\|' in front of
-the member function name.
-.TP
-.B \-fno\-strict\-prototype
-Consider the declaration \c
-.B int foo ();\c
-\&. In C++, this means that the
-function \c
-.B foo\c
-\& takes no arguments. In ANSI C, this is declared
-.B int foo(void);\c
-\&. With the flag `\|\c
-.B \-fno\-strict\-prototype\c
-\&\|',
-declaring functions with no arguments is equivalent to declaring its
-argument list to be untyped, i.e., \c
-.B int foo ();\c
-\& is equivalent to
-saying \c
-.B int foo (...);\c
-\&.
-.TP
-.B \-fnonnull\-objects
-Normally, GNU C++ makes conservative assumptions about objects reached
-through references. For example, the compiler must check that `\|\c
-.B a\c
-\&\|' is not null in code like the following:
-.br
-\ \ \ \ obj\ &a\ =\ g\ ();
-.br
-\ \ \ \ a.f\ (2);
-.br
-Checking that references of this sort have non-null values requires
-extra code, however, and it is unnecessary for many programs. You can
-use `\|\c
-.B \-fnonnull\-objects\c
-\&\|' to omit the checks for null, if your program doesn't require the
-default checking.
-.TP
-.B \-fhandle\-signatures
-.TP
-.B \-fno\-handle\-signatures
-These options control the recognition of the \c
-.B signature\c
-\& and \c
-.B sigof\c
-\& constructs for specifying abstract types. By default, these
-constructs are not recognized.
-.TP
-.B \-fthis\-is\-variable
-The incorporation of user-defined free store management into C++ has
-made assignment to \c
-.B this\c
-\& an anachronism. Therefore, by default GNU
-C++ treats the type of \c
-.B this\c
-\& in a member function of \c
-.B class X\c
-\&
-to be \c
-.B X *const\c
-\&. In other words, it is illegal to assign to
-\c
-.B this\c
-\& within a class member function. However, for backwards
-compatibility, you can invoke the old behavior by using
-\&`\|\c
-.B \-fthis\-is\-variable\c
-\&\|'.
-.TP
-.B \-g
-Produce debugging information in the operating system's native format
-(for DBX or SDB or DWARF). GDB also can work with this debugging
-information. On most systems that use DBX format, `\|\c
-.B \-g\c
-\&\|' enables use
-of extra debugging information that only GDB can use.
-
-Unlike most other C compilers, GNU CC allows you to use `\|\c
-.B \-g\c
-\&\|' with
-`\|\c
-.B \-O\c
-\&\|'. The shortcuts taken by optimized code may occasionally
-produce surprising results: some variables you declared may not exist
-at all; flow of control may briefly move where you did not expect it;
-some statements may not be executed because they compute constant
-results or their values were already at hand; some statements may
-execute in different places because they were moved out of loops.
-
-Nevertheless it proves possible to debug optimized output. This makes
-it reasonable to use the optimizer for programs that might have bugs.
-.TP
-.BI "\-I" "dir"\c
-\&
-Append directory \c
-.I dir\c
-\& to the list of directories searched for include files.
-.TP
-.BI "\-L" "dir"\c
-\&
-Add directory \c
-.I dir\c
-\& to the list of directories to be searched
-for `\|\c
-.B \-l\c
-\&\|'.
-.TP
-.BI \-l library\c
-\&
-Use the library named \c
-.I library\c
-\& when linking. (C++ programs often require `\|\c
-\-lg++\c
-\&\|' for successful linking.)
-.TP
-.B \-nostdinc
-Do not search the standard system directories for header files. Only
-the directories you have specified with
-.B \-I
-options (and the current directory, if appropriate) are searched.
-.TP
-.B \-nostdinc++
-Do not search for header files in the standard directories specific to
-C++, but do still search the other standard directories. (This option
-is used when building libg++.)
-.TP
-.B \-O
-Optimize. Optimizing compilation takes somewhat more time, and a lot
-more memory for a large function.
-.TP
-.BI "\-o " file\c
-\&
-Place output in file \c
-.I file\c
-\&.
-.TP
-.B \-S
-Stop after the stage of compilation proper; do not assemble. The output
-is an assembler code file for each non-assembler input
-file specified.
-.TP
-.B \-traditional
-Attempt to support some aspects of traditional C compilers.
-
-Specifically, for both C and C++ programs:
-.TP
-\ \ \ \(bu
-In the preprocessor, comments convert to nothing at all, rather than
-to a space. This allows traditional token concatenation.
-.TP
-\ \ \ \(bu
-In the preprocessor, macro arguments are recognized within string
-constants in a macro definition (and their values are stringified,
-though without additional quote marks, when they appear in such a
-context). The preprocessor always considers a string constant to end
-at a newline.
-.TP
-\ \ \ \(bu
-The preprocessor does not predefine the macro \c
-.B __STDC__\c
-\& when you use
-`\|\c
-.B \-traditional\c
-\&\|', but still predefines\c
-.B __GNUC__\c
-\& (since the GNU extensions indicated by
-.B __GNUC__\c
-\& are not affected by
-`\|\c
-.B \-traditional\c
-\&\|'). If you need to write header files that work
-differently depending on whether `\|\c
-.B \-traditional\c
-\&\|' is in use, by
-testing both of these predefined macros you can distinguish four
-situations: GNU C, traditional GNU C, other ANSI C compilers, and
-other old C compilers.
-.PP
-.TP
-\ \ \ \(bu
-String ``constants'' are not necessarily constant; they are stored in
-writable space, and identical looking constants are allocated
-separately.
-
-For C++ programs only (not C), `\|\c
-.B \-traditional\c
-\&\|' has one additional effect: assignment to
-.B this
-is permitted. This is the same as the effect of `\|\c
-.B \-fthis\-is\-variable\c
-\&\|'.
-.TP
-.BI \-U macro
-Undefine macro \c
-.I macro\c
-\&.
-.TP
-.B \-Wall
-Issue warnings for conditions which pertain to usage that we recommend
-avoiding and that we believe is easy to avoid, even in conjunction
-with macros.
-.TP
-.B \-Wenum\-clash
-Warn when converting between different enumeration types.
-.TP
-.B \-Woverloaded\-virtual
-In a derived class, the definitions of virtual functions must match
-the type signature of a virtual function declared in the base class.
-Use this option to request warnings when a derived class declares a
-function that may be an erroneous attempt to define a virtual
-function: that is, warn when a function with the same name as a
-virtual function in the base class, but with a type signature that
-doesn't match any virtual functions from the base class.
-.TP
-.B \-Wtemplate\-debugging
-When using templates in a C++ program, warn if debugging is not yet
-fully available.
-.TP
-.B \-w
-Inhibit all warning messages.
-.TP
-.BI +e N
-Control how virtual function definitions are used, in a fashion
-compatible with
-.B cfront
-1.x.
-.PP
-
-.SH PRAGMAS
-Two `\|\c
-.B #pragma\c
-\&\|' directives are supported for GNU C++, to permit using the same
-header file for two purposes: as a definition of interfaces to a given
-object class, and as the full definition of the contents of that object class.
-.TP
-.B #pragma interface
-Use this directive in header files that define object classes, to save
-space in most of the object files that use those classes. Normally,
-local copies of certain information (backup copies of inline member
-functions, debugging information, and the internal tables that
-implement virtual functions) must be kept in each object file that
-includes class definitions. You can use this pragma to avoid such
-duplication. When a header file containing `\|\c
-.B #pragma interface\c
-\&\|' is included in a compilation, this auxiliary information
-will not be generated (unless the main input source file itself uses
-`\|\c
-.B #pragma implementation\c
-\&\|'). Instead, the object files will contain references to be
-resolved at link time.
-.tr !"
-.TP
-.B #pragma implementation
-.TP
-.BI "#pragma implementation !" objects .h!
-Use this pragma in a main input file, when you want full output from
-included header files to be generated (and made globally visible).
-The included header file, in turn, should use `\|\c
-.B #pragma interface\c
-\&\|'.
-Backup copies of inline member functions, debugging information, and
-the internal tables used to implement virtual functions are all
-generated in implementation files.
-
-If you use `\|\c
-.B #pragma implementation\c
-\&\|' with no argument, it applies to an include file with the same
-basename as your source file; for example, in `\|\c
-.B allclass.cc\c
-\&\|', `\|\c
-.B #pragma implementation\c
-\&\|' by itself is equivalent to `\|\c
-.B
-#pragma implementation "allclass.h"\c
-\&\|'. Use the string argument if you want a single implementation
-file to include code from multiple header files.
-
-There is no way to split up the contents of a single header file into
-multiple implementation files.
-.SH FILES
-.ta \w'LIBDIR/g++\-include 'u
-file.h C header (preprocessor) file
-.br
-file.i preprocessed C source file
-.br
-file.C C++ source file
-.br
-file.cc C++ source file
-.br
-file.cxx C++ source file
-.br
-file.s assembly language file
-.br
-file.o object file
-.br
-a.out link edited output
-.br
-\fITMPDIR\fR/cc\(** temporary files
-.br
-\fILIBDIR\fR/cpp preprocessor
-.br
-\fILIBDIR\fR/cc1plus compiler
-.br
-\fILIBDIR\fR/collect linker front end needed on some machines
-.br
-\fILIBDIR\fR/libgcc.a GCC subroutine library
-.br
-/lib/crt[01n].o start-up routine
-.br
-\fILIBDIR\fR/ccrt0 additional start-up routine for C++
-.br
-/lib/libc.a standard C library, see
-.IR intro (3)
-.br
-/usr/include standard directory for
-.B #include
-files
-.br
-\fILIBDIR\fR/include standard gcc directory for
-.B #include
-files
-.br
-\fILIBDIR\fR/g++\-include additional g++ directory for
-.B #include
-.sp
-.I LIBDIR
-is usually
-.B /usr/local/lib/\c
-.IR machine / version .
-.br
-.I TMPDIR
-comes from the environment variable
-.B TMPDIR
-(default
-.B /usr/tmp
-if available, else
-.B /tmp\c
-\&).
-.SH "SEE ALSO"
-gcc(1), cpp(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1).
-.br
-.RB "`\|" gcc "\|', `\|" cpp \|',
-.RB `\| as \|', `\| ld \|',
-and
-.RB `\| gdb \|'
-entries in
-.B info\c
-\&.
-.br
-.I
-Using and Porting GNU CC (for version 2.0)\c
-, Richard M. Stallman;
-.I
-The C Preprocessor\c
-, Richard M. Stallman;
-.I
-Debugging with GDB: the GNU Source-Level Debugger\c
-, Richard M. Stallman and Roland H. Pesch;
-.I
-Using as: the GNU Assembler\c
-, Dean Elsner, Jay Fenlason & friends;
-.I
-gld: the GNU linker\c
-, Steve Chamberlain and Roland Pesch.
-
-.SH BUGS
-For instructions on how to report bugs, see the GCC manual.
-
-.SH COPYING
-Copyright (c) 1991, 1992, 1993 Free Software Foundation, Inc.
-.PP
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-.PP
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the
-entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-.PP
-Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions, except that this permission notice may be included in
-translations approved by the Free Software Foundation instead of in
-the original English.
-.SH AUTHORS
-See the GNU CC Manual for the contributors to GNU CC.
+.so man1/gcc.1
diff --git a/contrib/gcc/cp/g++spec.c b/contrib/gcc/cp/g++spec.c
index 806b90e..fbbe599 100644
--- a/contrib/gcc/cp/g++spec.c
+++ b/contrib/gcc/cp/g++spec.c
@@ -1,5 +1,5 @@
/* Specific flags and argument handling of the C++ front-end.
- Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -20,6 +20,7 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
+#include "gcc.h"
/* This bit is set if we saw a `-xfoo' language specification. */
#define LANGSPEC (1<<1)
@@ -37,10 +38,9 @@ Boston, MA 02111-1307, USA. */
#endif
void
-lang_specific_driver (fn, in_argc, in_argv, in_added_libraries)
- void (*fn)();
+lang_specific_driver (in_argc, in_argv, in_added_libraries)
int *in_argc;
- char ***in_argv;
+ const char *const **in_argv;
int *in_added_libraries;
{
int i, j;
@@ -59,10 +59,10 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries)
/* Used to track options that take arguments, so we don't go wrapping
those with -xc++/-xnone. */
- char *quote = NULL;
+ const char *quote = NULL;
/* The new argument list will be contained in this. */
- char **arglist;
+ const char **arglist;
/* Non-zero if we saw a `-xfoo' language specification on the
command line. Used to avoid adding our own -xc++ if the user
@@ -70,10 +70,10 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries)
int saw_speclang = 0;
/* "-lm" or "-lmath" if it appears on the command line. */
- char *saw_math = 0;
+ const char *saw_math = 0;
/* "-lc" if it appears on the command line. */
- char *saw_libc = 0;
+ const char *saw_libc = 0;
/* An array used to flag each argument that needs a bit set for
LANGSPEC, MATHLIB, or WITHLIBC. */
@@ -82,11 +82,14 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries)
/* By default, we throw on the math library if we have one. */
int need_math = (MATH_LIBRARY[0] != '\0');
+ /* True if we should add -shared-libgcc to the command-line. */
+ int shared_libgcc = 1;
+
/* The total number of arguments with the new stuff. */
int argc;
/* The argument list. */
- char **argv;
+ const char *const *argv;
/* The number of libraries added in. */
int added_libraries;
@@ -98,8 +101,7 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries)
argv = *in_argv;
added_libraries = *in_added_libraries;
- args = (int *) xmalloc (argc * sizeof (int));
- bzero ((char *) args, argc * sizeof (int));
+ args = (int *) xcalloc (argc, sizeof (int));
for (i = 1; i < argc; i++)
{
@@ -149,17 +151,22 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries)
saw_speclang = 1;
else if (((argv[i][2] == '\0'
&& (char *)strchr ("bBVDUoeTuIYmLiA", argv[i][1]) != NULL)
+ || strcmp (argv[i], "-Xlinker") == 0
|| strcmp (argv[i], "-Tdata") == 0))
quote = argv[i];
else if (library != 0 && ((argv[i][2] == '\0'
&& (char *) strchr ("cSEM", argv[i][1]) != NULL)
- || strcmp (argv[i], "-MM") == 0))
+ || strcmp (argv[i], "-MM") == 0
+ || strcmp (argv[i], "-fsyntax-only") == 0))
{
/* Don't specify libraries if we won't link, since that would
cause a warning. */
library = 0;
added -= 2;
}
+ else if (strcmp (argv[i], "-static-libgcc") == 0
+ || strcmp (argv[i], "-static") == 0)
+ shared_libgcc = 0;
else
/* Pass other options through. */
continue;
@@ -188,7 +195,7 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries)
}
if (quote)
- (*fn) ("argument to `%s' missing\n", quote);
+ fatal ("argument to `%s' missing\n", quote);
/* If we know we don't have to do anything, bail now. */
if (! added && ! library)
@@ -197,11 +204,24 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries)
return;
}
- num_args = argc + added + need_math;
- arglist = (char **) xmalloc (num_args * sizeof (char *));
+ /* There's no point adding -shared-libgcc if we don't have a shared
+ libgcc. */
+#ifndef ENABLE_SHARED_LIBGCC
+ shared_libgcc = 0;
+#endif
+
+ /* Make sure to have room for the trailing NULL argument. */
+ num_args = argc + added + need_math + shared_libgcc + 1;
+ arglist = (const char **) xmalloc (num_args * sizeof (char *));
+
+ i = 0;
+ j = 0;
+
+ /* Copy the 0th argument, i.e., the name of the program itself. */
+ arglist[i++] = argv[j++];
/* NOTE: We start at 1 now, not 0. */
- for (i = 0, j = 0; i < argc; i++, j++)
+ while (i < argc)
{
arglist[j] = argv[i];
@@ -231,7 +251,10 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries)
arglist[j++] = argv[i];
arglist[j] = "-xnone";
}
- }
+
+ i++;
+ j++;
+ }
/* Add `-lstdc++' if we haven't already done so. */
if (library)
@@ -248,6 +271,8 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries)
}
if (saw_libc)
arglist[j++] = saw_libc;
+ if (shared_libgcc)
+ arglist[j++] = "-shared-libgcc";
arglist[j] = NULL;
diff --git a/contrib/gcc/cp/init.c b/contrib/gcc/cp/init.c
index d70fc32..017b894 100644
--- a/contrib/gcc/cp/init.c
+++ b/contrib/gcc/cp/init.c
@@ -1,5 +1,6 @@
/* Handle initialization things in C++.
- Copyright (C) 1987, 89, 92-98, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -25,145 +26,240 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "tree.h"
#include "rtl.h"
+#include "expr.h"
#include "cp-tree.h"
#include "flags.h"
#include "output.h"
#include "except.h"
-#include "expr.h"
#include "toplev.h"
-
-/* In C++, structures with well-defined constructors are initialized by
- those constructors, unasked. CURRENT_BASE_INIT_LIST
- holds a list of stmts for a BASE_INIT term in the grammar.
- This list has one element for each base class which must be
- initialized. The list elements are [basename, init], with
- type basetype. This allows the possibly anachronistic form
- (assuming d : a, b, c) "d (int a) : c(a+5), b (a-4), a (a+3)"
- where each successive term can be handed down the constructor
- line. Perhaps this was not intended. */
-tree current_base_init_list, current_member_init_list;
-
-static void expand_aggr_vbase_init_1 PROTO((tree, tree, tree, tree));
-static void construct_virtual_bases PROTO((tree, tree, tree, tree, tree));
-static void expand_aggr_init_1 PROTO((tree, tree, tree, tree, int));
-static void expand_default_init PROTO((tree, tree, tree, tree, int));
-static tree build_vec_delete_1 PROTO((tree, tree, tree, tree, tree,
- int));
-static void perform_member_init PROTO((tree, tree, tree, int));
-static void sort_base_init PROTO((tree, tree *, tree *));
-static tree build_builtin_delete_call PROTO((tree));
-static int member_init_ok_or_else PROTO((tree, tree, const char *));
-static void expand_virtual_init PROTO((tree, tree));
-static tree sort_member_init PROTO((tree));
-static tree initializing_context PROTO((tree));
-static void expand_vec_init_try_block PROTO((tree));
-static void expand_vec_init_catch_clause PROTO((tree, tree, tree, tree));
-static tree build_java_class_ref PROTO((tree));
-static void expand_cleanup_for_base PROTO((tree, tree, tree));
-static int pvbasecount PROTO((tree, int));
-
-/* Cache the identifier nodes for the magic field of a new cookie. */
-static tree nc_nelts_field_id;
-
-static tree minus_one;
+#include "ggc.h"
+
+static void expand_aggr_vbase_init_1 PARAMS ((tree, tree, tree, tree));
+static void construct_virtual_bases PARAMS ((tree, tree, tree, tree, tree));
+static void expand_aggr_init_1 PARAMS ((tree, tree, tree, tree, int));
+static void expand_default_init PARAMS ((tree, tree, tree, tree, int));
+static tree build_vec_delete_1 PARAMS ((tree, tree, tree, special_function_kind, int));
+static void perform_member_init PARAMS ((tree, tree, int));
+static void sort_base_init PARAMS ((tree, tree, tree *, tree *));
+static tree build_builtin_delete_call PARAMS ((tree));
+static int member_init_ok_or_else PARAMS ((tree, tree, tree));
+static void expand_virtual_init PARAMS ((tree, tree));
+static tree sort_member_init PARAMS ((tree, tree));
+static tree initializing_context PARAMS ((tree));
+static void expand_cleanup_for_base PARAMS ((tree, tree));
+static tree get_temp_regvar PARAMS ((tree, tree));
+static tree dfs_initialize_vtbl_ptrs PARAMS ((tree, void *));
+static tree build_default_init PARAMS ((tree));
+static tree build_new_1 PARAMS ((tree));
+static tree get_cookie_size PARAMS ((tree));
+static tree build_dtor_call PARAMS ((tree, special_function_kind, int));
+static tree build_field_list PARAMS ((tree, tree, int *));
+static tree build_vtbl_address PARAMS ((tree));
/* Set up local variable for this file. MUST BE CALLED AFTER
INIT_DECL_PROCESSING. */
-static tree BI_header_type, BI_header_size;
+static tree BI_header_type;
void init_init_processing ()
{
tree fields[1];
- minus_one = build_int_2 (-1, -1);
-
/* Define the structure that holds header information for
arrays allocated via operator new. */
- BI_header_type = make_lang_type (RECORD_TYPE);
- nc_nelts_field_id = get_identifier ("nelts");
- fields[0] = build_lang_field_decl (FIELD_DECL, nc_nelts_field_id, sizetype);
+ BI_header_type = make_aggr_type (RECORD_TYPE);
+ fields[0] = build_decl (FIELD_DECL, nelts_identifier, sizetype);
+
finish_builtin_type (BI_header_type, "__new_cookie", fields,
0, double_type_node);
- BI_header_size = size_in_bytes (BI_header_type);
+
+ ggc_add_tree_root (&BI_header_type, 1);
+}
+
+/* We are about to generate some complex initialization code.
+ Conceptually, it is all a single expression. However, we may want
+ to include conditionals, loops, and other such statement-level
+ constructs. Therefore, we build the initialization code inside a
+ statement-expression. This function starts such an expression.
+ STMT_EXPR_P and COMPOUND_STMT_P are filled in by this function;
+ pass them back to finish_init_stmts when the expression is
+ complete. */
+
+void
+begin_init_stmts (stmt_expr_p, compound_stmt_p)
+ tree *stmt_expr_p;
+ tree *compound_stmt_p;
+{
+ if (building_stmt_tree ())
+ *stmt_expr_p = begin_stmt_expr ();
+ else
+ *stmt_expr_p = begin_global_stmt_expr ();
+
+ if (building_stmt_tree ())
+ *compound_stmt_p = begin_compound_stmt (/*has_no_scope=*/1);
+ /*
+ else
+ *compound_stmt_p = genrtl_begin_compound_stmt (has_no_scope=1);
+ */
}
-/* Subroutine of emit_base_init. For BINFO, initialize all the
- virtual function table pointers, except those that come from
- virtual base classes. Initialize binfo's vtable pointer, if
- INIT_SELF is true. CAN_ELIDE is true when we know that all virtual
- function table pointers in all bases have been initialized already,
- probably because their constructors have just be run. ADDR is the
- pointer to the object whos vtables we are going to initialize.
+/* Finish out the statement-expression begun by the previous call to
+ begin_init_stmts. Returns the statement-expression itself. */
- REAL_BINFO is usually the same as BINFO, except when addr is not of
- pointer to the type of the real derived type that we want to
- initialize for. This is the case when addr is a pointer to a sub
- object of a complete object, and we only want to do part of the
- complete object's initialization of vtable pointers. This is done
- for all virtual table pointers in virtual base classes. REAL_BINFO
- is used to find the BINFO_VTABLE that we initialize with. BINFO is
- used for conversions of addr to subobjects.
+tree
+finish_init_stmts (stmt_expr, compound_stmt)
+ tree stmt_expr;
+ tree compound_stmt;
- BINFO_TYPE (real_binfo) must be BINFO_TYPE (binfo).
+{
+ if (building_stmt_tree ())
+ finish_compound_stmt (/*has_no_scope=*/1, compound_stmt);
+
+ if (building_stmt_tree ())
+ stmt_expr = finish_stmt_expr (stmt_expr);
+ else
+ stmt_expr = finish_global_stmt_expr (stmt_expr);
+
+ /* To avoid spurious warnings about unused values, we set
+ TREE_USED. */
+ if (stmt_expr)
+ TREE_USED (stmt_expr) = 1;
- Relies upon binfo being inside TYPE_BINFO (TREE_TYPE (TREE_TYPE
- (addr))). */
+ return stmt_expr;
+}
+
+/* Constructors */
+
+/* Called from initialize_vtbl_ptrs via dfs_walk. BINFO is the base
+ which we want to initialize the vtable pointer for, DATA is
+ TREE_LIST whose TREE_VALUE is the this ptr expression. */
+
+static tree
+dfs_initialize_vtbl_ptrs (binfo, data)
+ tree binfo;
+ void *data;
+{
+ if ((!BINFO_PRIMARY_P (binfo) || TREE_VIA_VIRTUAL (binfo))
+ && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
+ {
+ tree base_ptr = TREE_VALUE ((tree) data);
+
+ base_ptr = build_base_path (PLUS_EXPR, base_ptr, binfo, /*nonnull=*/1);
+
+ expand_virtual_init (binfo, base_ptr);
+ }
+
+ SET_BINFO_MARKED (binfo);
+
+ return NULL_TREE;
+}
+
+/* Initialize all the vtable pointers in the object pointed to by
+ ADDR. */
void
-expand_direct_vtbls_init (real_binfo, binfo, init_self, can_elide, addr)
- tree real_binfo, binfo, addr;
- int init_self, can_elide;
+initialize_vtbl_ptrs (addr)
+ tree addr;
{
- tree real_binfos = BINFO_BASETYPES (real_binfo);
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = real_binfos ? TREE_VEC_LENGTH (real_binfos) : 0;
+ tree list;
+ tree type;
+
+ type = TREE_TYPE (TREE_TYPE (addr));
+ list = build_tree_list (type, addr);
+
+ /* Walk through the hierarchy, initializing the vptr in each base
+ class. We do these in pre-order because can't find the virtual
+ bases for a class until we've initialized the vtbl for that
+ class. */
+ dfs_walk_real (TYPE_BINFO (type), dfs_initialize_vtbl_ptrs,
+ NULL, dfs_unmarked_real_bases_queue_p, list);
+ dfs_walk (TYPE_BINFO (type), dfs_unmark,
+ dfs_marked_real_bases_queue_p, type);
+}
+
+/* [dcl.init]:
+
+ To default-initialize an object of type T means:
+
+ --if T is a non-POD class type (clause _class_), the default construc-
+ tor for T is called (and the initialization is ill-formed if T has
+ no accessible default constructor);
+
+ --if T is an array type, each element is default-initialized;
+
+ --otherwise, the storage for the object is zero-initialized.
+
+ A program that calls for default-initialization of an entity of refer-
+ ence type is ill-formed. */
- for (i = 0; i < n_baselinks; i++)
+static tree
+build_default_init (type)
+ tree type;
+{
+ tree init = NULL_TREE;
+
+ if (TYPE_NEEDS_CONSTRUCTING (type))
+ /* Other code will handle running the default constructor. We can't do
+ anything with a CONSTRUCTOR for arrays here, as that would imply
+ copy-initialization. */
+ return NULL_TREE;
+ else if (AGGREGATE_TYPE_P (type) && !TYPE_PTRMEMFUNC_P (type))
{
- tree real_base_binfo = TREE_VEC_ELT (real_binfos, i);
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable
- = i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (real_binfo));
- if (! TREE_VIA_VIRTUAL (real_base_binfo))
- expand_direct_vtbls_init (real_base_binfo, base_binfo,
- is_not_base_vtable, can_elide, addr);
- }
-#if 0
- /* Before turning this on, make sure it is correct. */
- if (can_elide && ! BINFO_MODIFIED (binfo))
- return;
-#endif
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (init_self && CLASSTYPE_VFIELDS (BINFO_TYPE (real_binfo)))
+ /* This is a default initialization of an aggregate, but not one of
+ non-POD class type. We cleverly notice that the initialization
+ rules in such a case are the same as for initialization with an
+ empty brace-initialization list. */
+ init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, NULL_TREE);
+ }
+ else if (TREE_CODE (type) == REFERENCE_TYPE)
+ /* --if T is a reference type, no initialization is performed. */
+ return NULL_TREE;
+ else
{
- tree base_ptr = convert_pointer_to_real (binfo, addr);
- expand_virtual_init (real_binfo, base_ptr);
+ init = integer_zero_node;
+
+ if (TREE_CODE (type) == ENUMERAL_TYPE)
+ /* We must make enumeral types the right type. */
+ init = fold (build1 (NOP_EXPR, type, init));
}
+
+ init = digest_init (type, init, 0);
+ return init;
}
-
-/* 348 - 351 */
+
/* Subroutine of emit_base_init. */
static void
-perform_member_init (member, name, init, explicit)
- tree member, name, init;
+perform_member_init (member, init, explicit)
+ tree member, init;
int explicit;
{
tree decl;
tree type = TREE_TYPE (member);
- expand_start_target_temps ();
+ decl = build_component_ref (current_class_ref, member, NULL_TREE, explicit);
+
+ if (decl == error_mark_node)
+ return;
- if (TYPE_NEEDS_CONSTRUCTING (type)
- || (init && TYPE_HAS_CONSTRUCTOR (type)))
+ /* Deal with this here, as we will get confused if we try to call the
+ assignment op for an anonymous union. This can happen in a
+ synthesized copy constructor. */
+ if (ANON_AGGR_TYPE_P (type))
+ {
+ if (init)
+ {
+ init = build (INIT_EXPR, type, decl, TREE_VALUE (init));
+ finish_expr_stmt (init);
+ }
+ }
+ else if (TYPE_NEEDS_CONSTRUCTING (type)
+ || (init && TYPE_HAS_CONSTRUCTOR (type)))
{
- /* Since `init' is already a TREE_LIST on the current_member_init_list,
+ /* Since `init' is already a TREE_LIST on the member_init_list,
only build it into one if we aren't already a list. */
if (init != NULL_TREE && TREE_CODE (init) != TREE_LIST)
- init = build_expr_list (NULL_TREE, init);
-
- decl = build_component_ref (current_class_ref, name, NULL_TREE, explicit);
+ init = build_tree_list (NULL_TREE, init);
if (explicit
&& TREE_CODE (type) == ARRAY_TYPE
@@ -172,11 +268,10 @@ perform_member_init (member, name, init, explicit)
&& TREE_CODE (TREE_TYPE (TREE_VALUE (init))) == ARRAY_TYPE)
{
/* Initialization of one array from another. */
- expand_vec_init (TREE_OPERAND (decl, 1), decl,
- array_type_nelts (type), TREE_VALUE (init), 1);
+ finish_expr_stmt (build_vec_init (decl, TREE_VALUE (init), 1));
}
else
- expand_aggr_init (decl, init, 0);
+ finish_expr_stmt (build_aggr_init (decl, init, 0));
}
else
{
@@ -184,21 +279,15 @@ perform_member_init (member, name, init, explicit)
{
if (explicit)
{
- /* default-initialization. */
- if (AGGREGATE_TYPE_P (type))
- init = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE);
- else if (TREE_CODE (type) == REFERENCE_TYPE)
- {
- cp_error ("default-initialization of `%#D', which has reference type",
- member);
- init = error_mark_node;
- }
- else
- init = integer_zero_node;
+ init = build_default_init (type);
+ if (TREE_CODE (type) == REFERENCE_TYPE)
+ warning
+ ("default-initialization of `%#D', which has reference type",
+ member);
}
/* member traversal: note it leaves init NULL */
- else if (TREE_CODE (TREE_TYPE (member)) == REFERENCE_TYPE)
- cp_pedwarn ("uninitialized reference member `%D'", member);
+ else if (TREE_CODE (type) == REFERENCE_TYPE)
+ pedwarn ("uninitialized reference member `%D'", member);
}
else if (TREE_CODE (init) == TREE_LIST)
{
@@ -213,138 +302,238 @@ perform_member_init (member, name, init, explicit)
init = TREE_VALUE (init);
}
- /* We only build this with a null init if we got it from the
- current_member_init_list. */
- if (init || explicit)
- {
- decl = build_component_ref (current_class_ref, name, NULL_TREE,
- explicit);
- expand_expr_stmt (build_modify_expr (decl, INIT_EXPR, init));
- }
+ if (init)
+ finish_expr_stmt (build_modify_expr (decl, INIT_EXPR, init));
}
- expand_end_target_temps ();
- free_temp_slots ();
-
- if (TYPE_NEEDS_DESTRUCTOR (type))
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
{
tree expr;
- /* All cleanups must be on the function_obstack. */
- push_obstacks_nochange ();
- resume_temporary_allocation ();
-
- expr = build_component_ref (current_class_ref, name, NULL_TREE,
+ expr = build_component_ref (current_class_ref, member, NULL_TREE,
explicit);
- expr = build_delete (type, expr, integer_zero_node,
+ expr = build_delete (type, expr, sfk_complete_destructor,
LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR, 0);
if (expr != error_mark_node)
- add_partial_entry (expr);
-
- pop_obstacks ();
+ finish_subobject (expr);
}
}
-extern int warn_reorder;
+/* Returns a TREE_LIST containing (as the TREE_PURPOSE of each node) all
+ the FIELD_DECLs on the TYPE_FIELDS list for T, in reverse order. */
-/* Subroutine of emit_member_init. */
-
-static tree
-sort_member_init (t)
+static tree
+build_field_list (t, list, uses_unions_p)
tree t;
+ tree list;
+ int *uses_unions_p;
{
- tree x, member, name, field;
- tree init_list = NULL_TREE;
- int last_pos = 0;
- tree last_field = NULL_TREE;
+ tree fields;
- for (member = TYPE_FIELDS (t); member ; member = TREE_CHAIN (member))
- {
- int pos;
+ /* Note whether or not T is a union. */
+ if (TREE_CODE (t) == UNION_TYPE)
+ *uses_unions_p = 1;
- /* member could be, for example, a CONST_DECL for an enumerated
- tag; we don't want to try to initialize that, since it already
- has a value. */
- if (TREE_CODE (member) != FIELD_DECL || !DECL_NAME (member))
+ for (fields = TYPE_FIELDS (t); fields; fields = TREE_CHAIN (fields))
+ {
+ /* Skip CONST_DECLs for enumeration constants and so forth. */
+ if (TREE_CODE (fields) != FIELD_DECL)
continue;
+
+ /* Keep track of whether or not any fields are unions. */
+ if (TREE_CODE (TREE_TYPE (fields)) == UNION_TYPE)
+ *uses_unions_p = 1;
+
+ /* For an anonymous struct or union, we must recursively
+ consider the fields of the anonymous type. They can be
+ directly initialized from the constructor. */
+ if (ANON_AGGR_TYPE_P (TREE_TYPE (fields)))
+ {
+ /* Add this field itself. Synthesized copy constructors
+ initialize the entire aggregate. */
+ list = tree_cons (fields, NULL_TREE, list);
+ /* And now add the fields in the anonymous aggregate. */
+ list = build_field_list (TREE_TYPE (fields), list,
+ uses_unions_p);
+ }
+ /* Add this field. */
+ else if (DECL_NAME (fields))
+ list = tree_cons (fields, NULL_TREE, list);
+ }
- for (x = current_member_init_list, pos = 0; x; x = TREE_CHAIN (x), ++pos)
+ return list;
+}
+
+/* The MEMBER_INIT_LIST is a TREE_LIST. The TREE_PURPOSE of each list
+ gives a FIELD_DECL in T that needs initialization. The TREE_VALUE
+ gives the initializer, or list of initializer arguments. Sort the
+ MEMBER_INIT_LIST, returning a version that contains the same
+ information but in the order that the fields should actually be
+ initialized. Perform error-checking in the process. */
+
+static tree
+sort_member_init (t, member_init_list)
+ tree t;
+ tree member_init_list;
+{
+ tree init_list;
+ tree last_field;
+ tree init;
+ int uses_unions_p;
+
+ /* Build up a list of the various fields, in sorted order. */
+ init_list = nreverse (build_field_list (t, NULL_TREE, &uses_unions_p));
+
+ /* Go through the explicit initializers, adding them to the
+ INIT_LIST. */
+ last_field = init_list;
+ for (init = member_init_list; init; init = TREE_CHAIN (init))
+ {
+ tree f;
+ tree initialized_field;
+
+ initialized_field = TREE_PURPOSE (init);
+ my_friendly_assert (TREE_CODE (initialized_field) == FIELD_DECL,
+ 20000516);
+
+ /* If the explicit initializers are in sorted order, then the
+ INITIALIZED_FIELD will be for a field following the
+ LAST_FIELD. */
+ for (f = last_field; f; f = TREE_CHAIN (f))
+ if (TREE_PURPOSE (f) == initialized_field)
+ break;
+
+ /* Give a warning, if appropriate. */
+ if (warn_reorder && !f)
{
- /* If we cleared this out, then pay no attention to it. */
- if (TREE_PURPOSE (x) == NULL_TREE)
- continue;
- name = TREE_PURPOSE (x);
-
-#if 0
- /* This happens in templates, since the IDENTIFIER is replaced
- with the COMPONENT_REF in tsubst_expr. */
- field = (TREE_CODE (name) == COMPONENT_REF
- ? TREE_OPERAND (name, 1) : IDENTIFIER_CLASS_VALUE (name));
-#else
- /* Let's find out when this happens. */
- my_friendly_assert (TREE_CODE (name) != COMPONENT_REF, 348);
- field = IDENTIFIER_CLASS_VALUE (name);
-#endif
-
- /* If one member shadows another, get the outermost one. */
- if (TREE_CODE (field) == TREE_LIST)
- field = TREE_VALUE (field);
-
- if (field == member)
- {
- if (warn_reorder)
- {
- if (pos < last_pos)
- {
- cp_warning_at ("member initializers for `%#D'", last_field);
- cp_warning_at (" and `%#D'", field);
- warning (" will be re-ordered to match declaration order");
- }
- last_pos = pos;
- last_field = field;
- }
+ cp_warning_at ("member initializers for `%#D'",
+ TREE_PURPOSE (last_field));
+ cp_warning_at (" and `%#D'", initialized_field);
+ warning (" will be re-ordered to match declaration order");
+ }
- /* Make sure we won't try to work on this init again. */
- TREE_PURPOSE (x) = NULL_TREE;
- x = build_tree_list (name, TREE_VALUE (x));
- goto got_it;
- }
+ /* Look again, from the beginning of the list. We must find the
+ field on this loop. */
+ if (!f)
+ {
+ f = init_list;
+ while (TREE_PURPOSE (f) != initialized_field)
+ f = TREE_CHAIN (f);
}
- /* If we didn't find MEMBER in the list, create a dummy entry
- so the two lists (INIT_LIST and the list of members) will be
- symmetrical. */
- x = build_tree_list (NULL_TREE, NULL_TREE);
- got_it:
- init_list = chainon (init_list, x);
+ /* If there was already an explicit initializer for this field,
+ issue an error. */
+ if (TREE_TYPE (f))
+ error ("multiple initializations given for member `%D'",
+ initialized_field);
+ else
+ {
+ /* Mark the field as explicitly initialized. */
+ TREE_TYPE (f) = error_mark_node;
+ /* And insert the initializer. */
+ TREE_VALUE (f) = TREE_VALUE (init);
+ }
+
+ /* Remember the location of the last explicitly initialized
+ field. */
+ last_field = f;
}
- /* Initializers for base members go at the end. */
- for (x = current_member_init_list ; x ; x = TREE_CHAIN (x))
+ /* [class.base.init]
+
+ If a ctor-initializer specifies more than one mem-initializer for
+ multiple members of the same union (including members of
+ anonymous unions), the ctor-initializer is ill-formed. */
+ if (uses_unions_p)
{
- name = TREE_PURPOSE (x);
- if (name)
+ last_field = NULL_TREE;
+ for (init = init_list; init; init = TREE_CHAIN (init))
{
- if (purpose_member (name, init_list))
+ tree field;
+ tree field_type;
+ int done;
+
+ /* Skip uninitialized members. */
+ if (!TREE_TYPE (init))
+ continue;
+ /* See if this field is a member of a union, or a member of a
+ structure contained in a union, etc. */
+ field = TREE_PURPOSE (init);
+ for (field_type = DECL_CONTEXT (field);
+ !same_type_p (field_type, t);
+ field_type = TYPE_CONTEXT (field_type))
+ if (TREE_CODE (field_type) == UNION_TYPE)
+ break;
+ /* If this field is not a member of a union, skip it. */
+ if (TREE_CODE (field_type) != UNION_TYPE)
+ continue;
+
+ /* It's only an error if we have two initializers for the same
+ union type. */
+ if (!last_field)
{
- cp_error ("multiple initializations given for member `%D'",
- IDENTIFIER_CLASS_VALUE (name));
+ last_field = field;
continue;
}
+
+ /* See if LAST_FIELD and the field initialized by INIT are
+ members of the same union. If so, there's a problem,
+ unless they're actually members of the same structure
+ which is itself a member of a union. For example, given:
+
+ union { struct { int i; int j; }; };
+
+ initializing both `i' and `j' makes sense. */
+ field_type = DECL_CONTEXT (field);
+ done = 0;
+ do
+ {
+ tree last_field_type;
+
+ last_field_type = DECL_CONTEXT (last_field);
+ while (1)
+ {
+ if (same_type_p (last_field_type, field_type))
+ {
+ if (TREE_CODE (field_type) == UNION_TYPE)
+ error ("initializations for multiple members of `%T'",
+ last_field_type);
+ done = 1;
+ break;
+ }
+
+ if (same_type_p (last_field_type, t))
+ break;
+
+ last_field_type = TYPE_CONTEXT (last_field_type);
+ }
- init_list = chainon (init_list,
- build_tree_list (name, TREE_VALUE (x)));
- TREE_PURPOSE (x) = NULL_TREE;
+ /* If we've reached the outermost class, then we're
+ done. */
+ if (same_type_p (field_type, t))
+ break;
+
+ field_type = TYPE_CONTEXT (field_type);
+ }
+ while (!done);
+
+ last_field = field;
}
}
return init_list;
}
+/* Like sort_member_init, but used for initializers of base classes.
+ *RBASE_PTR is filled in with the initializers for non-virtual bases;
+ vbase_ptr gets the virtual bases. */
+
static void
-sort_base_init (t, rbase_ptr, vbase_ptr)
- tree t, *rbase_ptr, *vbase_ptr;
+sort_base_init (t, base_init_list, rbase_ptr, vbase_ptr)
+ tree t;
+ tree base_init_list;
+ tree *rbase_ptr, *vbase_ptr;
{
tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
int n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
@@ -361,71 +550,40 @@ sort_base_init (t, rbase_ptr, vbase_ptr)
tree vbases = NULL_TREE;
/* First walk through and splice out vbase and invalid initializers.
- Also replace names with binfos. */
+ Also replace types with binfos. */
- last = tree_cons (NULL_TREE, NULL_TREE, current_base_init_list);
+ last = tree_cons (NULL_TREE, NULL_TREE, base_init_list);
for (x = TREE_CHAIN (last); x; x = TREE_CHAIN (x))
{
tree basetype = TREE_PURPOSE (x);
- tree binfo = NULL_TREE;
+ tree binfo = (TREE_CODE (basetype) == TREE_VEC
+ ? basetype : binfo_or_else (basetype, t));
+
+ if (binfo == NULL_TREE)
+ /* BASETYPE might be an inaccessible direct base (because it
+ is also an indirect base). */
+ continue;
- if (basetype == NULL_TREE)
+ if (TREE_VIA_VIRTUAL (binfo))
{
- /* Initializer for single base class. Must not
- use multiple inheritance or this is ambiguous. */
- switch (n_baseclasses)
- {
- case 0:
- cp_error ("`%T' does not have a base class to initialize",
- current_class_type);
- return;
- case 1:
- break;
- default:
- cp_error ("unnamed initializer ambiguous for `%T' which uses multiple inheritance",
- current_class_type);
- return;
- }
- binfo = TREE_VEC_ELT (binfos, 0);
+ /* Virtual base classes are special cases. Their
+ initializers are recorded with this constructor, and they
+ are used when this constructor is the top-level
+ constructor called. */
+ tree v = binfo_for_vbase (BINFO_TYPE (binfo), t);
+ vbases = tree_cons (v, TREE_VALUE (x), vbases);
}
- else if (is_aggr_type (basetype, 1))
+ else
{
- binfo = binfo_or_else (basetype, t);
- if (binfo == NULL_TREE)
- continue;
-
- /* Virtual base classes are special cases. Their initializers
- are recorded with this constructor, and they are used when
- this constructor is the top-level constructor called. */
- if (TREE_VIA_VIRTUAL (binfo))
- {
- tree v = CLASSTYPE_VBASECLASSES (t);
- while (BINFO_TYPE (v) != BINFO_TYPE (binfo))
- v = TREE_CHAIN (v);
-
- vbases = tree_cons (v, TREE_VALUE (x), vbases);
- continue;
- }
- else
- {
- /* Otherwise, if it is not an immediate base class, complain. */
- for (i = n_baseclasses-1; i >= 0; i--)
- if (BINFO_TYPE (binfo) == BINFO_TYPE (TREE_VEC_ELT (binfos, i)))
- break;
- if (i < 0)
- {
- cp_error ("`%T' is not an immediate base class of `%T'",
- basetype, current_class_type);
- continue;
- }
- }
+ /* Otherwise, it must be an immediate base class. */
+ my_friendly_assert
+ (same_type_p (BINFO_TYPE (BINFO_INHERITANCE_CHAIN (binfo)),
+ t), 20011113);
+
+ TREE_PURPOSE (x) = binfo;
+ TREE_CHAIN (last) = x;
+ last = x;
}
- else
- my_friendly_abort (365);
-
- TREE_PURPOSE (x) = binfo;
- TREE_CHAIN (last) = x;
- last = x;
}
TREE_CHAIN (last) = NULL_TREE;
@@ -433,20 +591,24 @@ sort_base_init (t, rbase_ptr, vbase_ptr)
for (i = 0; i < n_baseclasses; ++i)
{
+ /* The base for which we're currently initializing. */
tree base_binfo = TREE_VEC_ELT (binfos, i);
+ /* The initializer for BASE_BINFO. */
+ tree init;
int pos;
if (TREE_VIA_VIRTUAL (base_binfo))
continue;
- for (x = current_base_init_list, pos = 0; x; x = TREE_CHAIN (x), ++pos)
+ /* We haven't found the BASE_BINFO yet. */
+ init = NULL_TREE;
+ /* Loop through all the explicitly initialized bases, looking
+ for an appropriate initializer. */
+ for (x = base_init_list, pos = 0; x; x = TREE_CHAIN (x), ++pos)
{
tree binfo = TREE_PURPOSE (x);
- if (binfo == NULL_TREE)
- continue;
-
- if (binfo == base_binfo)
+ if (binfo == base_binfo && !init)
{
if (warn_reorder)
{
@@ -462,169 +624,52 @@ sort_base_init (t, rbase_ptr, vbase_ptr)
/* Make sure we won't try to work on this init again. */
TREE_PURPOSE (x) = NULL_TREE;
- x = build_tree_list (binfo, TREE_VALUE (x));
- goto got_it;
+ init = build_tree_list (binfo, TREE_VALUE (x));
+ }
+ else if (binfo == base_binfo)
+ {
+ error ("base class `%T' already initialized",
+ BINFO_TYPE (binfo));
+ break;
}
}
/* If we didn't find BASE_BINFO in the list, create a dummy entry
so the two lists (RBASES and the list of bases) will be
symmetrical. */
- x = build_tree_list (NULL_TREE, NULL_TREE);
- got_it:
- rbases = chainon (rbases, x);
+ if (!init)
+ init = build_tree_list (NULL_TREE, NULL_TREE);
+ rbases = chainon (rbases, init);
}
*rbase_ptr = rbases;
*vbase_ptr = vbases;
}
-/* Invoke a base-class destructor. REF is the object being destroyed,
- BINFO is the base class, and DTOR_ARG indicates whether the base
- class should invoke delete. */
-
-tree
-build_base_dtor_call (ref, binfo, dtor_arg)
- tree ref, binfo, dtor_arg;
-{
- tree args = NULL_TREE;
- tree vlist = lookup_name (vlist_identifier, 0);
- tree call, decr;
-
- if (TYPE_USES_PVBASES (BINFO_TYPE (binfo)))
- {
- args = expr_tree_cons (NULL_TREE, vlist, args);
- dtor_arg = build (BIT_IOR_EXPR, integer_type_node,
- dtor_arg, build_int_2 (4, 0));
- dtor_arg = fold (dtor_arg);
- }
- args = expr_tree_cons (NULL_TREE, dtor_arg, args);
- call = build_scoped_method_call (ref, binfo, dtor_identifier, args);
-
- if (!TYPE_USES_PVBASES (BINFO_TYPE (binfo)))
- /* For plain inheritance, do not try to adjust __vlist. */
- return call;
-
- /* Now decrement __vlist by the number of slots consumed by the base
- dtor. */
- decr = build_int_2 (pvbasecount (BINFO_TYPE (binfo), 0), 0);
- decr = build_binary_op (MINUS_EXPR, vlist, decr);
- decr = build_modify_expr (vlist, NOP_EXPR, decr);
-
- return build (COMPOUND_EXPR, void_type_node, call, decr);
-}
-
-/* Return the number of vlist entries needed to initialize TYPE,
- depending on whether it is IN_CHARGE. */
-
-static int
-pvbasecount (type, in_charge)
- tree type;
- int in_charge;
-{
- int i;
- int result = 0;
- tree vbase;
-
- for (vbase = (CLASSTYPE_VBASECLASSES (type)); vbase;
- vbase = TREE_CHAIN (vbase))
- {
- result += list_length (CLASSTYPE_VFIELDS (BINFO_TYPE (vbase)));
- if (in_charge)
- result += pvbasecount (BINFO_TYPE (vbase), 0);
- }
-
- for (i=0; i < CLASSTYPE_N_BASECLASSES (type); i++)
- {
- tree base = TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), i);
- if (TREE_VIA_VIRTUAL (base))
- continue;
- result += pvbasecount (BINFO_TYPE (base), 0);
- }
- return result;
-}
-
-void
-init_vlist (t)
- tree t;
-{
- char *name;
- tree expr;
- tree vlist = lookup_name (vlist_identifier, 0);
-
- name = alloca (strlen (VLIST_NAME_FORMAT)
- + TYPE_ASSEMBLER_NAME_LENGTH (t) + 2);
- sprintf (name, VLIST_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (t));
-
- expr = get_identifier (name);
- expr = lookup_name (expr, 0);
- expr = build1 (ADDR_EXPR, TREE_TYPE (vlist), expr);
- if (DECL_DESTRUCTOR_FOR_PVBASE_P (current_function_decl))
- /* Move to the end of the vlist. */
- expr = build_binary_op (PLUS_EXPR, expr,
- build_int_2 (pvbasecount (t, 1), 0));
- expand_expr_stmt (build_modify_expr (vlist, NOP_EXPR, expr));
-}
-
/* Perform whatever initializations have yet to be done on the base
- class of the class variable. These actions are in the global
- variable CURRENT_BASE_INIT_LIST. Such an action could be
- NULL_TREE, meaning that the user has explicitly called the base
- class constructor with no arguments.
+ class, and non-static data members, of the CURRENT_CLASS_TYPE.
+ These actions are given by the BASE_INIT_LIST and MEM_INIT_LIST,
+ respectively.
If there is a need for a call to a constructor, we must surround
that call with a pushlevel/poplevel pair, since we are technically
- at the PARM level of scope.
-
- Argument IMMEDIATELY, if zero, forces a new sequence to be
- generated to contain these new insns, so it can be emitted later.
- This sequence is saved in the global variable BASE_INIT_EXPR.
- Otherwise, the insns are emitted into the current sequence.
-
- Note that emit_base_init does *not* initialize virtual base
- classes. That is done specially, elsewhere. */
-
-extern tree base_init_expr, rtl_expr_chain;
+ at the PARM level of scope. */
void
-emit_base_init (t, immediately)
- tree t;
- int immediately;
+emit_base_init (mem_init_list, base_init_list)
+ tree mem_init_list;
+ tree base_init_list;
{
tree member;
- tree mem_init_list;
tree rbase_init_list, vbase_init_list;
+ tree t = current_class_type;
tree t_binfo = TYPE_BINFO (t);
tree binfos = BINFO_BASETYPES (t_binfo);
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- tree expr = NULL_TREE;
- tree vlist = lookup_name (vlist_identifier, 0);
-
- if (! immediately)
- {
- int momentary;
- do_pending_stack_adjust ();
- /* Make the RTL_EXPR node temporary, not momentary,
- so that rtl_expr_chain doesn't become garbage. */
- momentary = suspend_momentary ();
- expr = make_node (RTL_EXPR);
- resume_momentary (momentary);
- start_sequence_for_rtl_expr (expr);
- }
-
- if (write_symbols == NO_DEBUG)
- /* As a matter of principle, `start_sequence' should do this. */
- emit_note (0, -1);
- else
- /* Always emit a line number note so we can step into constructors. */
- emit_line_note_force (DECL_SOURCE_FILE (current_function_decl),
- DECL_SOURCE_LINE (current_function_decl));
-
- mem_init_list = sort_member_init (t);
- current_member_init_list = NULL_TREE;
+ int i;
+ int n_baseclasses = BINFO_N_BASETYPES (t_binfo);
- sort_base_init (t, &rbase_init_list, &vbase_init_list);
- current_base_init_list = NULL_TREE;
+ mem_init_list = sort_member_init (t, mem_init_list);
+ sort_base_init (t, base_init_list, &rbase_init_list, &vbase_init_list);
/* First, initialize the virtual base classes, if we are
constructing the most-derived object. */
@@ -652,151 +697,94 @@ emit_base_init (t, immediately)
else if (TYPE_NEEDS_CONSTRUCTING (BINFO_TYPE (base_binfo)))
{
init = NULL_TREE;
- if (extra_warnings && copy_args_p (current_function_decl))
- cp_warning ("base class `%#T' should be explicitly initialized in the copy constructor",
+ if (extra_warnings
+ && DECL_COPY_CONSTRUCTOR_P (current_function_decl))
+ warning ("base class `%#T' should be explicitly initialized in the copy constructor",
BINFO_TYPE (base_binfo));
}
if (init != void_list_node)
{
- expand_start_target_temps ();
-
- member = convert_pointer_to_real (base_binfo, current_class_ptr);
+ member = build_base_path (PLUS_EXPR, current_class_ptr,
+ base_binfo, 1);
expand_aggr_init_1 (base_binfo, NULL_TREE,
- build_indirect_ref (member, NULL_PTR), init,
+ build_indirect_ref (member, NULL), init,
LOOKUP_NORMAL);
-
- expand_end_target_temps ();
- free_temp_slots ();
}
- expand_cleanup_for_base (base_binfo, vlist, NULL_TREE);
+ expand_cleanup_for_base (base_binfo, NULL_TREE);
rbase_init_list = TREE_CHAIN (rbase_init_list);
}
- /* Initialize all the virtual function table fields that
- do come from virtual base classes. */
- if (TYPE_USES_VIRTUAL_BASECLASSES (t))
- expand_indirect_vtbls_init (t_binfo, current_class_ref, current_class_ptr);
-
- /* Initialize all the virtual function table fields that
- do not come from virtual base classes. */
- expand_direct_vtbls_init (t_binfo, t_binfo, 1, 1, current_class_ptr);
+ /* Initialize the vtable pointers for the class. */
+ initialize_vtbl_ptrs (current_class_ptr);
- for (member = TYPE_FIELDS (t); member; member = TREE_CHAIN (member))
+ while (mem_init_list)
{
- tree init, name;
+ tree init;
+ tree member;
int from_init_list;
- /* member could be, for example, a CONST_DECL for an enumerated
- tag; we don't want to try to initialize that, since it already
- has a value. */
- if (TREE_CODE (member) != FIELD_DECL || !DECL_NAME (member))
- continue;
+ member = TREE_PURPOSE (mem_init_list);
/* See if we had a user-specified member initialization. */
- if (TREE_PURPOSE (mem_init_list))
+ if (TREE_TYPE (mem_init_list))
{
- name = TREE_PURPOSE (mem_init_list);
init = TREE_VALUE (mem_init_list);
from_init_list = 1;
-
-#if 0
- if (TREE_CODE (name) == COMPONENT_REF)
- name = DECL_NAME (TREE_OPERAND (name, 1));
-#else
- /* Also see if it's ever a COMPONENT_REF here. If it is, we
- need to do `expand_assignment (name, init, 0, 0);' and
- a continue. */
- my_friendly_assert (TREE_CODE (name) != COMPONENT_REF, 349);
-#endif
}
else
{
- name = DECL_NAME (member);
init = DECL_INITIAL (member);
-
from_init_list = 0;
/* Effective C++ rule 12. */
if (warn_ecpp && init == NULL_TREE
&& !DECL_ARTIFICIAL (member)
&& TREE_CODE (TREE_TYPE (member)) != ARRAY_TYPE)
- cp_warning ("`%D' should be initialized in the member initialization list", member);
+ warning ("`%D' should be initialized in the member initialization list", member);
}
- perform_member_init (member, name, init, from_init_list);
+ perform_member_init (member, init, from_init_list);
mem_init_list = TREE_CHAIN (mem_init_list);
}
+}
- /* Now initialize any members from our bases. */
- while (mem_init_list)
- {
- tree name, init, field;
-
- if (TREE_PURPOSE (mem_init_list))
- {
- name = TREE_PURPOSE (mem_init_list);
- init = TREE_VALUE (mem_init_list);
- /* XXX: this may need the COMPONENT_REF operand 0 check if
- it turns out we actually get them. */
- field = IDENTIFIER_CLASS_VALUE (name);
-
- /* If one member shadows another, get the outermost one. */
- if (TREE_CODE (field) == TREE_LIST)
- {
- field = TREE_VALUE (field);
- if (decl_type_context (field) != current_class_type)
- cp_error ("field `%D' not in immediate context", field);
- }
-
-#if 0
- /* It turns out if you have an anonymous union in the
- class, a member from it can end up not being on the
- list of fields (rather, the type is), and therefore
- won't be seen by the for loop above. */
-
- /* The code in this for loop is derived from a general loop
- which had this check in it. Theoretically, we've hit
- every initialization for the list of members in T, so
- we shouldn't have anything but these left in this list. */
- my_friendly_assert (DECL_FIELD_CONTEXT (field) != t, 351);
-#endif
+/* Returns the address of the vtable (i.e., the value that should be
+ assigned to the vptr) for BINFO. */
- perform_member_init (field, name, init, 1);
- }
- mem_init_list = TREE_CHAIN (mem_init_list);
- }
+static tree
+build_vtbl_address (binfo)
+ tree binfo;
+{
+ tree binfo_for = binfo;
+ tree vtbl;
+
+ if (BINFO_VPTR_INDEX (binfo) && TREE_VIA_VIRTUAL (binfo)
+ && BINFO_PRIMARY_P (binfo))
+ /* If this is a virtual primary base, then the vtable we want to store
+ is that for the base this is being used as the primary base of. We
+ can't simply skip the initialization, because we may be expanding the
+ inits of a subobject constructor where the virtual base layout
+ can be different. */
+ while (BINFO_PRIMARY_BASE_OF (binfo_for))
+ binfo_for = BINFO_PRIMARY_BASE_OF (binfo_for);
+
+ /* Figure out what vtable BINFO's vtable is based on, and mark it as
+ used. */
+ vtbl = get_vtbl_decl_for_binfo (binfo_for);
+ assemble_external (vtbl);
+ TREE_USED (vtbl) = 1;
- if (! immediately)
+ /* Now compute the address to use when initializing the vptr. */
+ vtbl = BINFO_VTABLE (binfo_for);
+ if (TREE_CODE (vtbl) == VAR_DECL)
{
- do_pending_stack_adjust ();
- my_friendly_assert (base_init_expr == 0, 207);
- base_init_expr = expr;
- TREE_TYPE (expr) = void_type_node;
- RTL_EXPR_RTL (expr) = const0_rtx;
- RTL_EXPR_SEQUENCE (expr) = get_insns ();
- rtl_expr_chain = tree_cons (NULL_TREE, expr, rtl_expr_chain);
- end_sequence ();
- TREE_SIDE_EFFECTS (expr) = 1;
+ vtbl = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (vtbl)), vtbl);
+ TREE_CONSTANT (vtbl) = 1;
}
- /* All the implicit try blocks we built up will be zapped
- when we come to a real binding contour boundary. */
-}
-
-/* Check that all fields are properly initialized after
- an assignment to `this'. */
-
-void
-check_base_init (t)
- tree t;
-{
- tree member;
- for (member = TYPE_FIELDS (t); member; member = TREE_CHAIN (member))
- if (DECL_NAME (member) && TREE_USED (member))
- cp_error ("field `%D' used before initialized (after assignment to `this')",
- member);
+ return vtbl;
}
/* This code sets up the virtual function tables appropriate for
@@ -809,27 +797,47 @@ static void
expand_virtual_init (binfo, decl)
tree binfo, decl;
{
- tree type = BINFO_TYPE (binfo);
tree vtbl, vtbl_ptr;
- tree vtype, vtype_binfo;
-
- /* This code is crusty. Should be simple, like:
- vtbl = BINFO_VTABLE (binfo);
- */
- vtype = DECL_CONTEXT (CLASSTYPE_VFIELD (type));
- vtype_binfo = get_binfo (vtype, TREE_TYPE (TREE_TYPE (decl)), 0);
- vtbl = BINFO_VTABLE (binfo_value (DECL_FIELD_CONTEXT (CLASSTYPE_VFIELD (type)), binfo));
- assemble_external (vtbl);
- TREE_USED (vtbl) = 1;
- vtbl = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (vtbl)), vtbl);
- decl = convert_pointer_to_real (vtype_binfo, decl);
- vtbl_ptr = build_vfield_ref (build_indirect_ref (decl, NULL_PTR), vtype);
- if (vtbl_ptr == error_mark_node)
- return;
-
- /* Have to convert VTBL since array sizes may be different. */
+ tree vtt_index;
+
+ /* Compute the initializer for vptr. */
+ vtbl = build_vtbl_address (binfo);
+
+ /* We may get this vptr from a VTT, if this is a subobject
+ constructor or subobject destructor. */
+ vtt_index = BINFO_VPTR_INDEX (binfo);
+ if (vtt_index)
+ {
+ tree vtbl2;
+ tree vtt_parm;
+
+ /* Compute the value to use, when there's a VTT. */
+ vtt_parm = current_vtt_parm;
+ vtbl2 = build (PLUS_EXPR,
+ TREE_TYPE (vtt_parm),
+ vtt_parm,
+ vtt_index);
+ vtbl2 = build1 (INDIRECT_REF, TREE_TYPE (vtbl), vtbl2);
+
+ /* The actual initializer is the VTT value only in the subobject
+ constructor. In maybe_clone_body we'll substitute NULL for
+ the vtt_parm in the case of the non-subobject constructor. */
+ vtbl = build (COND_EXPR,
+ TREE_TYPE (vtbl),
+ build (EQ_EXPR, boolean_type_node,
+ current_in_charge_parm, integer_zero_node),
+ vtbl2,
+ vtbl);
+ }
+
+ /* Compute the location of the vtpr. */
+ vtbl_ptr = build_vfield_ref (build_indirect_ref (decl, NULL),
+ TREE_TYPE (binfo));
+ my_friendly_assert (vtbl_ptr != error_mark_node, 20010730);
+
+ /* Assign the vtable to the vptr. */
vtbl = convert_force (TREE_TYPE (vtbl_ptr), vtbl, 0);
- expand_expr_stmt (build_modify_expr (vtbl_ptr, NOP_EXPR, vtbl));
+ finish_expr_stmt (build_modify_expr (vtbl_ptr, NOP_EXPR, vtbl));
}
/* If an exception is thrown in a constructor, those base classes already
@@ -839,39 +847,24 @@ expand_virtual_init (binfo, decl)
destroyed. */
static void
-expand_cleanup_for_base (binfo, vlist, flag)
+expand_cleanup_for_base (binfo, flag)
tree binfo;
- tree vlist;
tree flag;
{
tree expr;
- if (TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (binfo)))
- {
- /* All cleanups must be on the function_obstack. */
- push_obstacks_nochange ();
- resume_temporary_allocation ();
+ if (TYPE_HAS_TRIVIAL_DESTRUCTOR (BINFO_TYPE (binfo)))
+ return;
- /* Call the destructor. */
- expr = build_base_dtor_call (current_class_ref, binfo,
- integer_zero_node);
- if (flag)
- expr = fold (build (COND_EXPR, void_type_node,
- truthvalue_conversion (flag),
- expr, integer_zero_node));
+ /* Call the destructor. */
+ expr = (build_scoped_method_call
+ (current_class_ref, binfo, base_dtor_identifier, NULL_TREE));
+ if (flag)
+ expr = fold (build (COND_EXPR, void_type_node,
+ truthvalue_conversion (flag),
+ expr, integer_zero_node));
- pop_obstacks ();
- add_partial_entry (expr);
- }
-
- if (TYPE_USES_PVBASES (BINFO_TYPE (binfo)))
- {
- /* Increment vlist by number of base's vbase classes. */
- expr = build_int_2 (pvbasecount (BINFO_TYPE (binfo), 0), 0);
- expr = build_binary_op (PLUS_EXPR, vlist, expr);
- expr = build_modify_expr (vlist, NOP_EXPR, expr);
- expand_expr_stmt (expr);
- }
+ finish_subobject (expr);
}
/* Subroutine of `expand_aggr_vbase_init'.
@@ -883,23 +876,18 @@ expand_aggr_vbase_init_1 (binfo, exp, addr, init_list)
tree binfo, exp, addr, init_list;
{
tree init = purpose_member (binfo, init_list);
- tree ref = build_indirect_ref (addr, NULL_PTR);
-
- expand_start_target_temps ();
+ tree ref = build_indirect_ref (addr, NULL);
if (init)
init = TREE_VALUE (init);
/* Call constructors, but don't set up vtables. */
expand_aggr_init_1 (binfo, exp, ref, init, LOOKUP_COMPLAIN);
-
- expand_end_target_temps ();
- free_temp_slots ();
}
/* Construct the virtual base-classes of THIS_REF (whose address is
THIS_PTR). The object has the indicated TYPE. The construction
actually takes place only if FLAG is non-zero. INIT_LIST is list
- of initialization for constructor to perform. */
+ of initializations for constructors to perform. */
static void
construct_virtual_bases (type, this_ref, this_ptr, init_list, flag)
@@ -910,31 +898,19 @@ construct_virtual_bases (type, this_ref, this_ptr, init_list, flag)
tree flag;
{
tree vbases;
- tree result;
- tree vlist = NULL_TREE;
/* If there are no virtual baseclasses, we shouldn't even be here. */
my_friendly_assert (TYPE_USES_VIRTUAL_BASECLASSES (type), 19990621);
- /* First set the pointers in our object that tell us where to find
- our virtual baseclasses. */
- expand_start_cond (flag, 0);
- if (TYPE_USES_PVBASES (type))
- {
- init_vlist (type);
- vlist = lookup_name (vlist_identifier, 0);
- }
- result = init_vbase_pointers (type, this_ptr);
- if (result)
- expand_expr_stmt (build_compound_expr (result));
- expand_end_cond ();
-
/* Now, run through the baseclasses, initializing each. */
for (vbases = CLASSTYPE_VBASECLASSES (type); vbases;
vbases = TREE_CHAIN (vbases))
{
- tree tmp = purpose_member (vbases, result);
-
+ tree inner_if_stmt;
+ tree compound_stmt;
+ tree exp;
+ tree vbase;
+
/* If there are virtual base classes with destructors, we need to
emit cleanups to destroy them if an exception is thrown during
the construction process. These exception regions (i.e., the
@@ -949,13 +925,30 @@ construct_virtual_bases (type, this_ref, this_ptr, init_list, flag)
in the outer block.) We trust the back-end to figure out
that the FLAG will not change across initializations, and
avoid doing multiple tests. */
- expand_start_cond (flag, 0);
- expand_aggr_vbase_init_1 (vbases, this_ref,
- TREE_OPERAND (TREE_VALUE (tmp), 0),
- init_list);
- expand_end_cond ();
+ inner_if_stmt = begin_if_stmt ();
+ finish_if_stmt_cond (flag, inner_if_stmt);
+ compound_stmt = begin_compound_stmt (/*has_no_scope=*/1);
+
+ /* Compute the location of the virtual base. If we're
+ constructing virtual bases, then we must be the most derived
+ class. Therefore, we don't have to look up the virtual base;
+ we already know where it is. */
+ vbase = TREE_VALUE (vbases);
+ exp = build (PLUS_EXPR,
+ TREE_TYPE (this_ptr),
+ this_ptr,
+ fold (build1 (NOP_EXPR, TREE_TYPE (this_ptr),
+ BINFO_OFFSET (vbase))));
+ exp = build1 (NOP_EXPR,
+ build_pointer_type (BINFO_TYPE (vbase)),
+ exp);
+
+ expand_aggr_vbase_init_1 (vbase, this_ref, exp, init_list);
+ finish_compound_stmt (/*has_no_scope=*/1, compound_stmt);
+ finish_then_clause (inner_if_stmt);
+ finish_if_stmt ();
- expand_cleanup_for_base (vbases, vlist, flag);
+ expand_cleanup_for_base (vbase, flag);
}
}
@@ -969,7 +962,7 @@ initializing_context (field)
/* Anonymous union members can be initialized in the first enclosing
non-anonymous union context. */
- while (t && ANON_UNION_TYPE_P (t))
+ while (t && ANON_AGGR_TYPE_P (t))
t = TYPE_CONTEXT (t);
return t;
}
@@ -985,19 +978,19 @@ static int
member_init_ok_or_else (field, type, member_name)
tree field;
tree type;
- const char *member_name;
+ tree member_name;
{
if (field == error_mark_node)
return 0;
if (field == NULL_TREE || initializing_context (field) != type)
{
- cp_error ("class `%T' does not have any field named `%s'", type,
+ error ("class `%T' does not have any field named `%D'", type,
member_name);
return 0;
}
if (TREE_STATIC (field))
{
- cp_error ("field `%#D' is static; only point of initialization is its declaration",
+ error ("field `%#D' is static; the only point of initialization is its definition",
field);
return 0;
}
@@ -1005,23 +998,18 @@ member_init_ok_or_else (field, type, member_name)
return 1;
}
-/* If NAME is a viable field name for the aggregate DECL,
- and PARMS is a viable parameter list, then expand an _EXPR
- which describes this initialization.
-
- Note that we do not need to chase through the class's base classes
- to look for NAME, because if it's in that list, it will be handled
- by the constructor for that base class.
-
- We do not yet have a fixed-point finder to instantiate types
- being fed to overloaded constructors. If there is a unique
- constructor, then argument types can be got from that one.
+/* EXP is an expression of aggregate type. NAME is an IDENTIFIER_NODE
+ which names a field, or it is a _TYPE node or TYPE_DECL which names
+ a base for that type. INIT is a parameter list for that field's or
+ base's constructor. Check the validity of NAME, and return a
+ TREE_LIST of the base _TYPE or FIELD_DECL and the INIT. EXP is used
+ only to get its type. If NAME is invalid, return NULL_TREE and
+ issue a diagnostic.
- If INIT is non-NULL, then it the initialization should
- be placed in `current_base_init_list', where it will be processed
- by `emit_base_init'. */
+ An old style unnamed direct single base construction is permitted,
+ where NAME is NULL. */
-void
+tree
expand_member_init (exp, name, init)
tree exp, name, init;
{
@@ -1029,109 +1017,75 @@ expand_member_init (exp, name, init)
tree type;
if (exp == NULL_TREE)
- return; /* complain about this later */
+ return NULL_TREE;
type = TYPE_MAIN_VARIANT (TREE_TYPE (exp));
+ my_friendly_assert (IS_AGGR_TYPE (type), 20011113);
- if (name && TREE_CODE (name) == TYPE_DECL)
- {
- basetype = TYPE_MAIN_VARIANT (TREE_TYPE (name));
- name = DECL_NAME (name);
- }
-
- if (name == NULL_TREE && IS_AGGR_TYPE (type))
- switch (CLASSTYPE_N_BASECLASSES (type))
- {
- case 0:
- error ("base class initializer specified, but no base class to initialize");
- return;
- case 1:
- basetype = TYPE_BINFO_BASETYPE (type, 0);
- break;
- default:
- error ("initializer for unnamed base class ambiguous");
- cp_error ("(type `%T' uses multiple inheritance)", type);
- return;
+ if (!name)
+ {
+ /* This is an obsolete unnamed base class initializer. The
+ parser will already have warned about its use. */
+ switch (CLASSTYPE_N_BASECLASSES (type))
+ {
+ case 0:
+ error ("unnamed initializer for `%T', which has no base classes",
+ type);
+ return NULL_TREE;
+ case 1:
+ basetype = TYPE_BINFO_BASETYPE (type, 0);
+ break;
+ default:
+ error ("unnamed initializer for `%T', which uses multiple inheritance",
+ type);
+ return NULL_TREE;
}
+ }
+ else if (TYPE_P (name))
+ {
+ basetype = name;
+ name = TYPE_NAME (name);
+ }
+ else if (TREE_CODE (name) == TYPE_DECL)
+ basetype = TYPE_MAIN_VARIANT (TREE_TYPE (name));
my_friendly_assert (init != NULL_TREE, 0);
- /* The grammar should not allow fields which have names that are
- TYPENAMEs. Therefore, if the field has a non-NULL TREE_TYPE, we
- may assume that this is an attempt to initialize a base class
- member of the current type. Otherwise, it is an attempt to
- initialize a member field. */
-
if (init == void_type_node)
init = NULL_TREE;
- if (name == NULL_TREE || basetype)
+ if (basetype)
{
- tree base_init;
-
- if (name == NULL_TREE)
- {
-#if 0
- if (basetype)
- name = TYPE_IDENTIFIER (basetype);
- else
- {
- error ("no base class to initialize");
- return;
- }
-#endif
- }
- else if (basetype != type
- && ! current_template_parms
- && ! vec_binfo_member (basetype,
- TYPE_BINFO_BASETYPES (type))
- && ! binfo_member (basetype, CLASSTYPE_VBASECLASSES (type)))
+ if (current_template_parms)
+ ;
+ else if (vec_binfo_member (basetype, TYPE_BINFO_BASETYPES (type)))
+ /* A direct base. */;
+ else if (binfo_for_vbase (basetype, type))
+ /* A virtual base. */;
+ else
{
- if (IDENTIFIER_CLASS_VALUE (name))
- goto try_member;
if (TYPE_USES_VIRTUAL_BASECLASSES (type))
- cp_error ("type `%T' is not an immediate or virtual basetype for `%T'",
- basetype, type);
+ error ("type `%D' is not a direct or virtual base of `%T'",
+ name, type);
else
- cp_error ("type `%T' is not an immediate basetype for `%T'",
- basetype, type);
- return;
- }
-
- if (purpose_member (basetype, current_base_init_list))
- {
- cp_error ("base class `%T' already initialized", basetype);
- return;
- }
-
- if (warn_reorder && current_member_init_list)
- {
- cp_warning ("base initializer for `%T'", basetype);
- warning (" will be re-ordered to precede member initializations");
+ error ("type `%D' is not a direct base of `%T'",
+ name, type);
+ return NULL_TREE;
}
- base_init = build_tree_list (basetype, init);
- current_base_init_list = chainon (current_base_init_list, base_init);
+ init = build_tree_list (basetype, init);
}
else
{
- tree member_init;
-
- try_member:
field = lookup_field (type, name, 1, 0);
- if (! member_init_ok_or_else (field, type, IDENTIFIER_POINTER (name)))
- return;
-
- if (purpose_member (name, current_member_init_list))
- {
- cp_error ("field `%D' already initialized", field);
- return;
- }
+ if (! member_init_ok_or_else (field, type, name))
+ return NULL_TREE;
- member_init = build_tree_list (name, init);
- current_member_init_list = chainon (current_member_init_list, member_init);
+ init = build_tree_list (field, init);
}
+
+ return init;
}
/* This is like `expand_member_init', only it stores one aggregate
@@ -1147,11 +1101,6 @@ expand_member_init (exp, name, init)
If `init' is a CONSTRUCTOR, then we emit a warning message,
explaining that such initializations are invalid.
- ALIAS_THIS is nonzero iff we are initializing something which is
- essentially an alias for current_class_ref. In this case, the base
- constructor may move it on us, and we must keep track of such
- deviations.
-
If INIT resolves to a CALL_EXPR which happens to return
something of the type we are looking for, then we know
that we can safely use that call to perform the
@@ -1172,17 +1121,20 @@ expand_member_init (exp, name, init)
A constructor or a conversion operator may have to be used to
perform the initialization, but not both, as it would be ambiguous. */
-void
-expand_aggr_init (exp, init, flags)
+tree
+build_aggr_init (exp, init, flags)
tree exp, init;
int flags;
{
+ tree stmt_expr;
+ tree compound_stmt;
+ int destroy_temps;
tree type = TREE_TYPE (exp);
int was_const = TREE_READONLY (exp);
int was_volatile = TREE_THIS_VOLATILE (exp);
if (init == error_mark_node)
- return;
+ return error_mark_node;
TREE_READONLY (exp) = 0;
TREE_THIS_VOLATILE (exp) = 0;
@@ -1195,13 +1147,8 @@ expand_aggr_init (exp, init, flags)
/* Must arrange to initialize each element of EXP
from elements of INIT. */
tree itype = init ? TREE_TYPE (init) : NULL_TREE;
- if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED)
- {
- TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type);
- if (init)
- TREE_TYPE (init) = TYPE_MAIN_VARIANT (itype);
- }
- if (init && TREE_TYPE (init) == NULL_TREE)
+
+ if (init && !itype)
{
/* Handle bad initializers like:
class COMPLEX {
@@ -1216,85 +1163,43 @@ expand_aggr_init (exp, init, flags)
}
*/
error ("bad array initializer");
- return;
+ return error_mark_node;
+ }
+ if (cp_type_quals (type) != TYPE_UNQUALIFIED)
+ {
+ TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type);
+ if (init)
+ TREE_TYPE (init) = TYPE_MAIN_VARIANT (itype);
}
- expand_vec_init (exp, exp, array_type_nelts (type), init,
- init && same_type_p (TREE_TYPE (init),
- TREE_TYPE (exp)));
+ stmt_expr = build_vec_init (exp, init,
+ init && same_type_p (TREE_TYPE (init),
+ TREE_TYPE (exp)));
TREE_READONLY (exp) = was_const;
TREE_THIS_VOLATILE (exp) = was_volatile;
TREE_TYPE (exp) = type;
if (init)
TREE_TYPE (init) = itype;
- return;
+ return stmt_expr;
}
if (TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == PARM_DECL)
/* just know that we've seen something for this node */
TREE_USED (exp) = 1;
-#if 0
- /* If initializing from a GNU C CONSTRUCTOR, consider the elts in the
- constructor as parameters to an implicit GNU C++ constructor. */
- if (init && TREE_CODE (init) == CONSTRUCTOR
- && TYPE_HAS_CONSTRUCTOR (type)
- && TREE_TYPE (init) == type)
- init = CONSTRUCTOR_ELTS (init);
-#endif
-
TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type);
+ begin_init_stmts (&stmt_expr, &compound_stmt);
+ destroy_temps = stmts_are_full_exprs_p ();
+ current_stmt_tree ()->stmts_are_full_exprs_p = 0;
expand_aggr_init_1 (TYPE_BINFO (type), exp, exp,
init, LOOKUP_NORMAL|flags);
+ stmt_expr = finish_init_stmts (stmt_expr, compound_stmt);
+ current_stmt_tree ()->stmts_are_full_exprs_p = destroy_temps;
TREE_TYPE (exp) = type;
TREE_READONLY (exp) = was_const;
TREE_THIS_VOLATILE (exp) = was_volatile;
-}
-
-static tree
-no_vlist_base_init (rval, exp, init, binfo, flags)
- tree rval, exp, init, binfo;
- int flags;
-{
- tree nrval, func, parms;
-
- /* Obtain the vlist-expecting ctor. */
- func = rval;
- my_friendly_assert (TREE_CODE (func) == CALL_EXPR, 20000131);
- func = TREE_OPERAND (func, 0);
- my_friendly_assert (TREE_CODE (func) == ADDR_EXPR, 20000132);
- func = TREE_OPERAND (func, 0);
- my_friendly_assert (TREE_CODE (func) == FUNCTION_DECL, 20000133);
-
- /* If we have already seen a definition for the wrapped function,
- we don't need to declare it weak. Also, declare_weak will complain
- if we do. */
- if (!TREE_ASM_WRITTEN (func))
- declare_weak (func);
-
- if (init == NULL_TREE
- || (TREE_CODE (init) == TREE_LIST && ! TREE_TYPE (init)))
- {
- parms = init;
- if (parms)
- init = TREE_VALUE (parms);
- }
- else
- parms = build_expr_list (NULL_TREE, init);
-
- flags &= ~LOOKUP_HAS_VLIST;
-
- parms = expr_tree_cons (NULL_TREE, integer_zero_node, parms);
- flags |= LOOKUP_HAS_IN_CHARGE;
-
- nrval = build_method_call (exp, ctor_identifier,
- parms, binfo, flags);
- func = build (NE_EXPR, boolean_type_node,
- func, null_pointer_node);
- nrval = build (COND_EXPR, void_type_node,
- func, rval, nrval);
- return nrval;
-}
+ return stmt_expr;
+}
static void
expand_default_init (binfo, true_exp, exp, init, flags)
@@ -1304,6 +1209,7 @@ expand_default_init (binfo, true_exp, exp, init, flags)
int flags;
{
tree type = TREE_TYPE (exp);
+ tree ctor_name;
/* It fails because there may not be a constructor which takes
its own type as the first (or only parameter), but which does
@@ -1313,8 +1219,6 @@ expand_default_init (binfo, true_exp, exp, init, flags)
out, then look hard. */
tree rval;
tree parms;
- tree vlist = NULL_TREE;
- tree orig_init = init;
if (init && TREE_CODE (init) != TREE_LIST
&& (flags & LOOKUP_ONLYCONVERTING))
@@ -1329,6 +1233,10 @@ expand_default_init (binfo, true_exp, exp, init, flags)
to run a new constructor; and catching an exception, where we
have already built up the constructor call so we could wrap it
in an exception region. */;
+ else if (TREE_CODE (init) == CONSTRUCTOR)
+ /* A brace-enclosed initializer has whatever type is
+ required. There's no need to convert it. */
+ ;
else
init = ocp_convert (type, init, CONV_IMPLICIT|CONV_FORCE_TEMP, flags);
@@ -1342,7 +1250,7 @@ expand_default_init (binfo, true_exp, exp, init, flags)
else
init = build (INIT_EXPR, TREE_TYPE (exp), exp, init);
TREE_SIDE_EFFECTS (init) = 1;
- expand_expr_stmt (init);
+ finish_expr_stmt (init);
return;
}
@@ -1354,40 +1262,21 @@ expand_default_init (binfo, true_exp, exp, init, flags)
init = TREE_VALUE (parms);
}
else
- parms = build_expr_list (NULL_TREE, init);
+ parms = build_tree_list (NULL_TREE, init);
- if (TYPE_USES_VIRTUAL_BASECLASSES (type))
- {
- if (TYPE_USES_PVBASES (type))
- {
- /* In compatibility mode, when not calling a base ctor,
- we do not pass the vlist argument. */
- if (true_exp == exp)
- vlist = flag_vtable_thunks_compat? NULL_TREE : vlist_zero_node;
- else
- vlist = lookup_name (vlist_identifier, 0);
-
- if (vlist)
- {
- parms = expr_tree_cons (NULL_TREE, vlist, parms);
- flags |= LOOKUP_HAS_VLIST;
- }
- }
- if (true_exp == exp)
- parms = expr_tree_cons (NULL_TREE, integer_one_node, parms);
- else
- parms = expr_tree_cons (NULL_TREE, integer_zero_node, parms);
- flags |= LOOKUP_HAS_IN_CHARGE;
- }
+ if (true_exp == exp)
+ ctor_name = complete_ctor_identifier;
+ else
+ ctor_name = base_ctor_identifier;
- rval = build_method_call (exp, ctor_identifier,
- parms, binfo, flags);
- if (vlist && true_exp != exp && flag_vtable_thunks_compat)
+ rval = build_method_call (exp, ctor_name, parms, binfo, flags);
+ if (TREE_SIDE_EFFECTS (rval))
{
- rval = no_vlist_base_init (rval, exp, orig_init, binfo, flags);
+ if (building_stmt_tree ())
+ finish_expr_stmt (rval);
+ else
+ genrtl_expr_stmt (rval);
}
- if (TREE_SIDE_EFFECTS (rval))
- expand_expr_stmt (rval);
}
/* This function is responsible for initializing EXP with INIT
@@ -1407,8 +1296,6 @@ expand_default_init (binfo, true_exp, exp, init, flags)
from TRUE_EXP. In constructors, we don't know anything about
the value being initialized.
- ALIAS_THIS serves the same purpose it serves for expand_aggr_init.
-
FLAGS is just passes to `build_method_call'. See that function for
its description. */
@@ -1433,15 +1320,16 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, flags)
&& TREE_CODE (init) == CONSTRUCTOR
&& TREE_HAS_CONSTRUCTOR (init))
{
- tree t = store_init_value (exp, init);
- if (!t)
+ /* If store_init_value returns NULL_TREE, the INIT has been
+ record in the DECL_INITIAL for EXP. That means there's
+ nothing more we have to do. */
+ if (!store_init_value (exp, init))
{
- expand_decl_init (exp);
- return;
+ if (!building_stmt_tree ())
+ expand_decl_init (exp);
}
- t = build (INIT_EXPR, type, exp, init);
- TREE_SIDE_EFFECTS (t) = 1;
- expand_expr_stmt (t);
+ else
+ finish_expr_stmt (build (INIT_EXPR, type, exp, init));
return;
}
@@ -1450,39 +1338,6 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, flags)
expand_default_init (binfo, true_exp, exp, init, flags);
}
-/* Report an error if NAME is not the name of a user-defined,
- aggregate type. If OR_ELSE is nonzero, give an error message. */
-
-int
-is_aggr_typedef (name, or_else)
- tree name;
- int or_else;
-{
- tree type;
-
- if (name == error_mark_node)
- return 0;
-
- if (IDENTIFIER_HAS_TYPE_VALUE (name))
- type = IDENTIFIER_TYPE_VALUE (name);
- else
- {
- if (or_else)
- cp_error ("`%T' is not an aggregate typedef", name);
- return 0;
- }
-
- if (! IS_AGGR_TYPE (type)
- && TREE_CODE (type) != TEMPLATE_TYPE_PARM
- && TREE_CODE (type) != TEMPLATE_TEMPLATE_PARM)
- {
- if (or_else)
- cp_error ("`%T' is not an aggregate type", type);
- return 0;
- }
- return 1;
-}
-
/* Report an error if TYPE is not a user-defined, aggregate type. If
OR_ELSE is nonzero, give an error message. */
@@ -1496,10 +1351,10 @@ is_aggr_type (type, or_else)
if (! IS_AGGR_TYPE (type)
&& TREE_CODE (type) != TEMPLATE_TYPE_PARM
- && TREE_CODE (type) != TEMPLATE_TEMPLATE_PARM)
+ && TREE_CODE (type) != BOUND_TEMPLATE_TEMPLATE_PARM)
{
if (or_else)
- cp_error ("`%T' is not an aggregate type", type);
+ error ("`%T' is not an aggregate type", type);
return 0;
}
return 1;
@@ -1522,16 +1377,16 @@ get_aggr_from_typedef (name, or_else)
else
{
if (or_else)
- cp_error ("`%T' fails to be an aggregate typedef", name);
+ error ("`%T' fails to be an aggregate typedef", name);
return NULL_TREE;
}
if (! IS_AGGR_TYPE (type)
&& TREE_CODE (type) != TEMPLATE_TYPE_PARM
- && TREE_CODE (type) != TEMPLATE_TEMPLATE_PARM)
+ && TREE_CODE (type) != BOUND_TEMPLATE_TEMPLATE_PARM)
{
if (or_else)
- cp_error ("type `%T' is of non-aggregate type", type);
+ error ("type `%T' is of non-aggregate type", type);
return NULL_TREE;
}
return type;
@@ -1549,7 +1404,7 @@ get_type_value (name)
else
return NULL_TREE;
}
-
+
/* This code could just as well go in `class.c', but is placed here for
modularity. */
@@ -1586,9 +1441,9 @@ build_member_call (type, name, parmlist)
return build_x_function_call (name, parmlist, current_class_ref);
}
- if (type == std_node)
- return build_x_function_call (do_scoped_id (name, 0), parmlist,
- current_class_ref);
+ if (DECL_P (name))
+ name = DECL_NAME (name);
+
if (TREE_CODE (type) == NAMESPACE_DECL)
return build_x_function_call (lookup_namespace_name (type, name),
parmlist, current_class_ref);
@@ -1619,7 +1474,8 @@ build_member_call (type, name, parmlist)
tree ns = lookup_name (type, 0);
if (ns && TREE_CODE (ns) == NAMESPACE_DECL)
{
- return build_x_function_call (build_offset_ref (type, name), parmlist, current_class_ref);
+ return build_x_function_call (build_offset_ref (type, name),
+ parmlist, current_class_ref);
}
}
@@ -1632,7 +1488,7 @@ build_member_call (type, name, parmlist)
if (dtor)
{
- cp_error ("cannot call destructor `%T::~%T' without object", type,
+ error ("cannot call destructor `%T::~%T' without object", type,
method_name);
return error_mark_node;
}
@@ -1652,7 +1508,7 @@ build_member_call (type, name, parmlist)
{
tree newtype = build_qualified_type (type, TYPE_QUALS (oldtype));
decl = convert_force (build_pointer_type (newtype), olddecl, 0);
- decl = build_indirect_ref (decl, NULL_PTR);
+ decl = build_indirect_ref (decl, NULL);
}
}
@@ -1674,7 +1530,7 @@ build_member_call (type, name, parmlist)
{
if (is_dummy_object (decl))
{
- cp_error ("invalid use of non-static field `%D'", t);
+ error ("invalid use of non-static field `%D'", t);
return error_mark_node;
}
decl = build (COMPONENT_REF, TREE_TYPE (t), decl, t);
@@ -1683,7 +1539,7 @@ build_member_call (type, name, parmlist)
decl = t;
else
{
- cp_error ("invalid use of member `%D'", t);
+ error ("invalid use of member `%D'", t);
return error_mark_node;
}
if (TYPE_LANG_SPECIFIC (TREE_TYPE (decl)))
@@ -1693,7 +1549,7 @@ build_member_call (type, name, parmlist)
}
else
{
- cp_error ("no method `%T::%D'", type, name);
+ error ("no method `%T::%D'", type, name);
return error_mark_node;
}
}
@@ -1721,17 +1577,50 @@ build_offset_ref (type, name)
if (TREE_CODE (name) == TEMPLATE_DECL)
return name;
- if (type == std_node)
- return do_scoped_id (name, 0);
-
if (processing_template_decl || uses_template_parms (type))
return build_min_nt (SCOPE_REF, type, name);
+ if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
+ {
+ /* If the NAME is a TEMPLATE_ID_EXPR, we are looking at
+ something like `a.template f<int>' or the like. For the most
+ part, we treat this just like a.f. We do remember, however,
+ the template-id that was used. */
+ name = TREE_OPERAND (orig_name, 0);
+
+ if (DECL_P (name))
+ name = DECL_NAME (name);
+ else
+ {
+ if (TREE_CODE (name) == LOOKUP_EXPR)
+ /* This can happen during tsubst'ing. */
+ name = TREE_OPERAND (name, 0);
+ else
+ {
+ if (TREE_CODE (name) == COMPONENT_REF)
+ name = TREE_OPERAND (name, 1);
+ if (TREE_CODE (name) == OVERLOAD)
+ name = DECL_NAME (OVL_CURRENT (name));
+ }
+ }
+
+ my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 0);
+ }
+
+ if (type == NULL_TREE)
+ return error_mark_node;
+
/* Handle namespace names fully here. */
if (TREE_CODE (type) == NAMESPACE_DECL)
{
t = lookup_namespace_name (type, name);
- if (t != error_mark_node && ! type_unknown_p (t))
+ if (t == error_mark_node)
+ return t;
+ if (TREE_CODE (orig_name) == TEMPLATE_ID_EXPR)
+ /* Reconstruct the TEMPLATE_ID_EXPR. */
+ t = build (TEMPLATE_ID_EXPR, TREE_TYPE (t),
+ t, TREE_OPERAND (orig_name, 1));
+ if (! type_unknown_p (t))
{
mark_used (t);
t = convert_from_reference (t);
@@ -1739,42 +1628,21 @@ build_offset_ref (type, name)
return t;
}
- if (type == NULL_TREE || ! is_aggr_type (type, 1))
+ if (! is_aggr_type (type, 1))
return error_mark_node;
- if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
- {
- /* If the NAME is a TEMPLATE_ID_EXPR, we are looking at
- something like `a.template f<int>' or the like. For the most
- part, we treat this just like a.f. We do remember, however,
- the template-id that was used. */
- name = TREE_OPERAND (orig_name, 0);
-
- if (TREE_CODE (name) == LOOKUP_EXPR)
- /* This can happen during tsubst'ing. */
- name = TREE_OPERAND (name, 0);
-
- my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 0);
- }
-
if (TREE_CODE (name) == BIT_NOT_EXPR)
{
if (! check_dtor_name (type, name))
- cp_error ("qualified type `%T' does not match destructor name `~%T'",
+ error ("qualified type `%T' does not match destructor name `~%T'",
type, TREE_OPERAND (name, 0));
name = dtor_identifier;
}
-#if 0
- /* I think this is wrong, but the draft is unclear. --jason 6/15/98 */
- else if (name == constructor_name_full (type)
- || name == constructor_name (type))
- name = ctor_identifier;
-#endif
- if (TYPE_SIZE (complete_type (type)) == 0
+ if (!COMPLETE_TYPE_P (complete_type (type))
&& !TYPE_BEING_DEFINED (type))
{
- cp_error ("incomplete type `%T' does not have member `%D'", type,
+ error ("incomplete type `%T' does not have member `%D'", type,
name);
return error_mark_node;
}
@@ -1786,8 +1654,7 @@ build_offset_ref (type, name)
if (member == error_mark_node)
return error_mark_node;
- /* A lot of this logic is now handled in lookup_field and
- lookup_fnfield. */
+ /* A lot of this logic is now handled in lookup_member. */
if (member && BASELINK_P (member))
{
/* Go from the TREE_BASELINK to the member function info. */
@@ -1807,14 +1674,14 @@ build_offset_ref (type, name)
/* The code in instantiate_type which will process this
expects to encounter OVERLOADs, not raw functions. */
t = ovl_cons (t, NULL_TREE);
-
- return build (OFFSET_REF,
- unknown_type_node,
- decl,
- build (TEMPLATE_ID_EXPR,
- TREE_TYPE (t),
- t,
- TREE_OPERAND (orig_name, 1)));
+
+ t = build (TEMPLATE_ID_EXPR, TREE_TYPE (t), t,
+ TREE_OPERAND (orig_name, 1));
+ t = build (OFFSET_REF, unknown_type_node, decl, t);
+
+ PTRMEM_OK_P (t) = 1;
+
+ return t;
}
if (!really_overloaded_fn (t))
@@ -1823,35 +1690,28 @@ build_offset_ref (type, name)
t = OVL_CURRENT (t);
/* unique functions are handled easily. */
- basebinfo = TREE_PURPOSE (fnfields);
if (!enforce_access (basebinfo, t))
return error_mark_node;
mark_used (t);
if (DECL_STATIC_FUNCTION_P (t))
return t;
- return build (OFFSET_REF, TREE_TYPE (t), decl, t);
+ t = build (OFFSET_REF, TREE_TYPE (t), decl, t);
+ PTRMEM_OK_P (t) = 1;
+ return t;
}
- /* FNFIELDS is most likely allocated on the search_obstack,
- which will go away after this class scope. If we need
- to save this value for later (i.e. for use as an initializer
- for a static variable), then do so here.
-
- ??? The smart thing to do for the case of saving initializers
- is to resolve them before we're done with this scope. */
- if (!TREE_PERMANENT (fnfields)
- && ! allocation_temporary_p ())
- fnfields = copy_list (fnfields);
-
TREE_TYPE (fnfields) = unknown_type_node;
- return build (OFFSET_REF, unknown_type_node, decl, fnfields);
+
+ t = build (OFFSET_REF, unknown_type_node, decl, fnfields);
+ PTRMEM_OK_P (t) = 1;
+ return t;
}
t = member;
if (t == NULL_TREE)
{
- cp_error ("`%D' is not a member of type `%T'", name, type);
+ error ("`%D' is not a member of type `%T'", name, type);
return error_mark_node;
}
@@ -1870,19 +1730,21 @@ build_offset_ref (type, name)
if (TREE_CODE (t) == FIELD_DECL && DECL_C_BIT_FIELD (t))
{
- cp_error ("illegal pointer to bit field `%D'", t);
+ error ("illegal pointer to bit-field `%D'", t);
return error_mark_node;
}
/* static class functions too. */
if (TREE_CODE (t) == FUNCTION_DECL
&& TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
- my_friendly_abort (53);
+ abort ();
/* In member functions, the form `type::name' is no longer
equivalent to `this->type::name', at least not until
resolve_offset_ref. */
- return build (OFFSET_REF, build_offset_type (type, TREE_TYPE (t)), decl, t);
+ t = build (OFFSET_REF, build_offset_type (type, TREE_TYPE (t)), decl, t);
+ PTRMEM_OK_P (t) = 1;
+ return t;
}
/* If a OFFSET_REF made it through to here, then it did
@@ -1915,18 +1777,19 @@ resolve_offset_ref (exp)
base = current_class_ref;
}
- if (BASELINK_P (member))
- {
- cp_pedwarn ("assuming & on overloaded member function");
- return build_unary_op (ADDR_EXPR, exp, 0);
- }
-
+ if (BASELINK_P (member) || TREE_CODE (member) == TEMPLATE_ID_EXPR)
+ return build_unary_op (ADDR_EXPR, exp, 0);
+
if (TREE_CODE (TREE_TYPE (member)) == METHOD_TYPE)
{
- cp_pedwarn ("assuming & on `%E'", member);
+ if (!flag_ms_extensions)
+ /* A single non-static member, make sure we don't allow a
+ pointer-to-member. */
+ exp = ovl_cons (member, NULL_TREE);
+
return build_unary_op (ADDR_EXPR, exp, 0);
}
-
+
if ((TREE_CODE (member) == VAR_DECL
&& ! TYPE_PTRMEMFUNC_P (TREE_TYPE (member))
&& ! TYPE_PTRMEM_P (TREE_TYPE (member)))
@@ -1946,13 +1809,9 @@ resolve_offset_ref (exp)
have been seen as static to be grok'd as non-static. */
if (TREE_CODE (member) == FIELD_DECL && current_class_ref == NULL_TREE)
{
- if (TREE_ADDRESSABLE (member) == 0)
- {
- cp_error_at ("member `%D' is non-static but referenced as a static member",
- member);
- error ("at this point in file");
- TREE_ADDRESSABLE (member) = 1;
- }
+ cp_error_at ("member `%D' is non-static but referenced as a static member",
+ member);
+ error ("at this point in file");
return error_mark_node;
}
@@ -1960,31 +1819,39 @@ resolve_offset_ref (exp)
if (TREE_CODE (member) == FIELD_DECL
&& (base == current_class_ref || is_dummy_object (base)))
{
- tree basetype_path;
tree expr;
+ basetype = DECL_CONTEXT (member);
+
+ /* Try to get to basetype from 'this'; if that doesn't work,
+ nothing will. */
+ base = current_class_ref;
+
+ /* First convert to the intermediate base specified, if appropriate. */
if (TREE_CODE (exp) == OFFSET_REF && TREE_CODE (type) == OFFSET_TYPE)
- basetype = TYPE_OFFSET_BASETYPE (type);
- else
- basetype = DECL_CONTEXT (member);
+ base = build_scoped_ref (base, TYPE_OFFSET_BASETYPE (type));
- base = current_class_ptr;
-
- if (get_base_distance (basetype, TREE_TYPE (TREE_TYPE (base)), 0, &basetype_path) < 0)
+ /* Don't check access on the conversion; we might be after a member
+ promoted by an access- or using-declaration, and we have already
+ checked access for the member itself. */
+ basetype = lookup_base (TREE_TYPE (base), basetype, ba_ignore, NULL);
+ expr = build_base_path (PLUS_EXPR, base, basetype, 1);
+
+ if (expr == error_mark_node)
+ return error_mark_node;
+
+ type = TREE_TYPE (member);
+ if (TREE_CODE (type) != REFERENCE_TYPE)
{
- error_not_base_type (basetype, TREE_TYPE (TREE_TYPE (base)));
- return error_mark_node;
+ int quals = cp_type_quals (type) | cp_type_quals (TREE_TYPE (expr));
+
+ if (DECL_MUTABLE_P (member))
+ quals &= ~TYPE_QUAL_CONST;
+
+ type = cp_build_qualified_type (type, quals);
}
- /* Kludge: we need to use basetype_path now, because
- convert_pointer_to will bash it. */
- enforce_access (basetype_path, member);
- addr = convert_pointer_to (basetype, base);
-
- /* Even in the case of illegal access, we form the
- COMPONENT_REF; that will allow better error recovery than
- just feeding back error_mark_node. */
- expr = build (COMPONENT_REF, TREE_TYPE (member),
- build_indirect_ref (addr, NULL_PTR), member);
+
+ expr = build (COMPONENT_REF, type, expr, member);
return convert_from_reference (expr);
}
@@ -2002,40 +1869,38 @@ resolve_offset_ref (exp)
{
if (addr == error_mark_node)
{
- cp_error ("object missing in `%E'", exp);
+ error ("object missing in `%E'", exp);
return error_mark_node;
}
basetype = TYPE_OFFSET_BASETYPE (TREE_TYPE (TREE_TYPE (member)));
- addr = convert_pointer_to (basetype, addr);
- member = cp_convert (ptrdiff_type_node, member);
+ basetype = lookup_base (TREE_TYPE (TREE_TYPE (addr)),
+ basetype, ba_check, NULL);
+ addr = build_base_path (PLUS_EXPR, addr, basetype, 1);
- /* Pointer to data members are offset by one, so that a null
- pointer with a real value of 0 is distinguishable from an
- offset of the first member of a structure. */
- member = build_binary_op (MINUS_EXPR, member,
- cp_convert (ptrdiff_type_node, integer_one_node));
+ member = cp_convert (ptrdiff_type_node, member);
- return build1 (INDIRECT_REF, type,
- build (PLUS_EXPR, build_pointer_type (type),
- addr, member));
+ addr = build (PLUS_EXPR, build_pointer_type (type), addr, member);
+ return build_indirect_ref (addr, 0);
}
else if (TYPE_PTRMEMFUNC_P (TREE_TYPE (member)))
{
return get_member_function_from_ptrfunc (&addr, member);
}
- my_friendly_abort (56);
+ abort ();
/* NOTREACHED */
return NULL_TREE;
}
-/* Return either DECL or its known constant value (if it has one). */
+/* If DECL is a `const' declaration, and its value is a known
+ constant, then return that value. */
tree
decl_constant_value (decl)
tree decl;
{
- if (! TREE_THIS_VOLATILE (decl)
+ if (TREE_READONLY_DECL_P (decl)
+ && ! TREE_THIS_VOLATILE (decl)
&& DECL_INITIAL (decl)
&& DECL_INITIAL (decl) != error_mark_node
/* This is invalid if initial value is not constant.
@@ -2057,8 +1922,7 @@ build_builtin_delete_call (addr)
tree addr;
{
mark_used (global_delete_fndecl);
- return build_call (global_delete_fndecl,
- void_type_node, build_expr_list (NULL_TREE, addr));
+ return build_call (global_delete_fndecl, build_tree_list (NULL_TREE, addr));
}
/* Generate a C++ "new" expression. DECL is either a TREE_LIST
@@ -2087,8 +1951,6 @@ build_builtin_delete_call (addr)
PLACEMENT is the `placement' list for user-defined operator new (). */
-extern int flag_check_new;
-
tree
build_new (placement, decl, init, use_global_new)
tree placement;
@@ -2099,8 +1961,6 @@ build_new (placement, decl, init, use_global_new)
tree nelts = NULL_TREE, t;
int has_array = 0;
- tree pending_sizes = NULL_TREE;
-
if (decl == error_mark_node)
return error_mark_node;
@@ -2108,19 +1968,15 @@ build_new (placement, decl, init, use_global_new)
{
tree absdcl = TREE_VALUE (decl);
tree last_absdcl = NULL_TREE;
- int old_immediate_size_expand = 0;
if (current_function_decl
&& DECL_CONSTRUCTOR_P (current_function_decl))
- {
- old_immediate_size_expand = immediate_size_expand;
- immediate_size_expand = 0;
- }
+ my_friendly_assert (immediate_size_expand == 0, 19990926);
nelts = integer_one_node;
if (absdcl && TREE_CODE (absdcl) == CALL_EXPR)
- my_friendly_abort (215);
+ abort ();
while (absdcl && TREE_CODE (absdcl) == INDIRECT_REF)
{
last_absdcl = absdcl;
@@ -2152,8 +2008,8 @@ build_new (placement, decl, init, use_global_new)
}
else
{
- int flags = pedantic ? WANT_INT : (WANT_INT | WANT_ENUM);
- if (build_expr_type_conversion (flags, this_nelts, 0)
+ if (build_expr_type_conversion (WANT_INT | WANT_ENUM,
+ this_nelts, 0)
== NULL_TREE)
pedwarn ("size in array new must have integral type");
@@ -2165,7 +2021,7 @@ build_new (placement, decl, init, use_global_new)
nelts = integer_zero_node;
}
else
- nelts = build_binary_op (MULT_EXPR, nelts, this_nelts);
+ nelts = cp_build_binary_op (MULT_EXPR, nelts, this_nelts);
}
}
else
@@ -2179,17 +2035,7 @@ build_new (placement, decl, init, use_global_new)
type = groktypename (decl);
if (! type || type == error_mark_node)
- {
- immediate_size_expand = old_immediate_size_expand;
- return error_mark_node;
- }
-
- if (current_function_decl
- && DECL_CONSTRUCTOR_P (current_function_decl))
- {
- pending_sizes = get_pending_sizes ();
- immediate_size_expand = old_immediate_size_expand;
- }
+ return error_mark_node;
}
else if (TREE_CODE (decl) == IDENTIFIER_NODE)
{
@@ -2220,9 +2066,9 @@ build_new (placement, decl, init, use_global_new)
if (processing_template_decl)
{
if (has_array)
- t = min_tree_cons (min_tree_cons (NULL_TREE, type, NULL_TREE),
- build_min_nt (ARRAY_REF, NULL_TREE, nelts),
- NULL_TREE);
+ t = tree_cons (tree_cons (NULL_TREE, type, NULL_TREE),
+ build_min_nt (ARRAY_REF, NULL_TREE, nelts),
+ NULL_TREE);
else
t = type;
@@ -2264,45 +2110,53 @@ build_new (placement, decl, init, use_global_new)
rval = build (NEW_EXPR, build_pointer_type (type), placement, t, init);
NEW_EXPR_USE_GLOBAL (rval) = use_global_new;
TREE_SIDE_EFFECTS (rval) = 1;
+ rval = build_new_1 (rval);
+ if (rval == error_mark_node)
+ return error_mark_node;
/* Wrap it in a NOP_EXPR so warn_if_unused_value doesn't complain. */
rval = build1 (NOP_EXPR, TREE_TYPE (rval), rval);
TREE_NO_UNUSED_WARNING (rval) = 1;
- if (pending_sizes)
- rval = build_compound_expr (chainon (pending_sizes,
- build_expr_list (NULL_TREE, rval)));
-
return rval;
}
-/* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*). */
-
-static tree jclass_node = NULL_TREE;
-
/* Given a Java class, return a decl for the corresponding java.lang.Class. */
-static tree
+tree
build_java_class_ref (type)
tree type;
{
- tree name, class_decl;
- static tree CL_prefix = NULL_TREE;
- if (CL_prefix == NULL_TREE)
- CL_prefix = get_identifier("_CL_");
+ tree name = NULL_TREE, class_decl;
+ static tree CL_suffix = NULL_TREE;
+ if (CL_suffix == NULL_TREE)
+ CL_suffix = get_identifier("class$");
if (jclass_node == NULL_TREE)
{
- jclass_node = IDENTIFIER_GLOBAL_VALUE (get_identifier("jclass"));
+ jclass_node = IDENTIFIER_GLOBAL_VALUE (get_identifier ("jclass"));
if (jclass_node == NULL_TREE)
- fatal("call to Java constructor, while `jclass' undefined");
+ fatal_error ("call to Java constructor, while `jclass' undefined");
+
jclass_node = TREE_TYPE (jclass_node);
}
- name = build_overload_with_type (CL_prefix, type);
+
+ /* Mangle the class$ field */
+ {
+ tree field;
+ for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
+ if (DECL_NAME (field) == CL_suffix)
+ {
+ mangle_decl (field);
+ name = DECL_ASSEMBLER_NAME (field);
+ break;
+ }
+ if (!field)
+ internal_error ("can't find class$");
+ }
+
class_decl = IDENTIFIER_GLOBAL_VALUE (name);
if (class_decl == NULL_TREE)
{
- push_obstacks_nochange ();
- end_temporary_allocation ();
class_decl = build_decl (VAR_DECL, name, TREE_TYPE (jclass_node));
TREE_STATIC (class_decl) = 1;
DECL_EXTERNAL (class_decl) = 1;
@@ -2310,62 +2164,103 @@ build_java_class_ref (type)
DECL_ARTIFICIAL (class_decl) = 1;
DECL_IGNORED_P (class_decl) = 1;
pushdecl_top_level (class_decl);
- make_decl_rtl (class_decl, NULL_PTR, 1);
- pop_obstacks ();
+ make_decl_rtl (class_decl, NULL);
}
return class_decl;
}
+/* Returns the size of the cookie to use when allocating an array
+ whose elements have the indicated TYPE. Assumes that it is already
+ known that a cookie is needed. */
+
+static tree
+get_cookie_size (type)
+ tree type;
+{
+ tree cookie_size;
+
+ /* We need to allocate an additional max (sizeof (size_t), alignof
+ (true_type)) bytes. */
+ tree sizetype_size;
+ tree type_align;
+
+ sizetype_size = size_in_bytes (sizetype);
+ type_align = size_int (TYPE_ALIGN_UNIT (type));
+ if (INT_CST_LT_UNSIGNED (type_align, sizetype_size))
+ cookie_size = sizetype_size;
+ else
+ cookie_size = type_align;
+
+ return cookie_size;
+}
+
/* Called from cplus_expand_expr when expanding a NEW_EXPR. The return
value is immediately handed to expand_expr. */
-tree
+static tree
build_new_1 (exp)
tree exp;
{
tree placement, init;
- tree type, true_type, size, rval;
+ tree type, true_type, size, rval, t;
+ tree full_type;
tree nelts = NULL_TREE;
- tree alloc_expr, alloc_node = NULL_TREE;
+ tree alloc_call, alloc_expr, alloc_node;
+ tree cookie_expr, init_expr;
int has_array = 0;
- enum tree_code code = NEW_EXPR;
+ enum tree_code code;
int use_cookie, nothrow, check_new;
+ /* Nonzero if the user wrote `::new' rather than just `new'. */
+ int globally_qualified_p;
+ /* Nonzero if we're going to call a global operator new, rather than
+ a class-specific version. */
int use_global_new;
int use_java_new = 0;
+ /* If non-NULL, the number of extra bytes to allocate at the
+ beginning of the storage allocated for an array-new expression in
+ order to store the number of elements. */
+ tree cookie_size = NULL_TREE;
+ /* True if the function we are calling is a placement allocation
+ function. */
+ bool placement_allocation_fn_p;
placement = TREE_OPERAND (exp, 0);
type = TREE_OPERAND (exp, 1);
init = TREE_OPERAND (exp, 2);
- use_global_new = NEW_EXPR_USE_GLOBAL (exp);
+ globally_qualified_p = NEW_EXPR_USE_GLOBAL (exp);
if (TREE_CODE (type) == ARRAY_REF)
{
has_array = 1;
nelts = TREE_OPERAND (type, 1);
type = TREE_OPERAND (type, 0);
+
+ full_type = cp_build_binary_op (MINUS_EXPR, nelts, integer_one_node);
+ full_type = build_index_type (full_type);
+ full_type = build_cplus_array_type (type, full_type);
}
+ else
+ full_type = type;
+
true_type = type;
- if (CP_TYPE_QUALS (type))
- type = TYPE_MAIN_VARIANT (type);
+ code = has_array ? VEC_NEW_EXPR : NEW_EXPR;
/* If our base type is an array, then make sure we know how many elements
it has. */
while (TREE_CODE (true_type) == ARRAY_TYPE)
{
tree this_nelts = array_type_nelts_top (true_type);
- nelts = build_binary_op (MULT_EXPR, nelts, this_nelts);
+ nelts = cp_build_binary_op (MULT_EXPR, nelts, this_nelts);
true_type = TREE_TYPE (true_type);
}
if (!complete_type_or_else (true_type, exp))
return error_mark_node;
+ size = size_in_bytes (true_type);
if (has_array)
- size = fold (build_binary_op (MULT_EXPR, size_in_bytes (true_type),
- nelts));
- else
- size = size_in_bytes (type);
+ size = fold (cp_build_binary_op (MULT_EXPR, size, nelts));
if (TREE_CODE (true_type) == VOID_TYPE)
{
@@ -2373,97 +2268,104 @@ build_new_1 (exp)
return error_mark_node;
}
- if (TYPE_LANG_SPECIFIC (true_type)
- && CLASSTYPE_ABSTRACT_VIRTUALS (true_type))
- {
- abstract_virtuals_error (NULL_TREE, true_type);
- return error_mark_node;
- }
-
- if (TYPE_LANG_SPECIFIC (true_type) && IS_SIGNATURE (true_type))
- {
- 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.
-
- Well, that's what we should do. For backwards compatibility, we
- have to do this whenever there's a two-argument array-delete
- operator.
+ if (abstract_virtuals_error (NULL_TREE, true_type))
+ return error_mark_node;
- 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));
+ /* Figure out whether or not we're going to use the global operator
+ new. */
+ if (!globally_qualified_p
+ && IS_AGGR_TYPE (true_type)
+ && (has_array
+ ? TYPE_HAS_ARRAY_NEW_OPERATOR (true_type)
+ : TYPE_HAS_NEW_OPERATOR (true_type)))
+ use_global_new = 0;
+ else
+ use_global_new = 1;
+
+ /* We only need cookies for arrays containing types for which we
+ need cookies. */
+ if (!has_array || !TYPE_VEC_NEW_USES_COOKIE (true_type))
+ use_cookie = 0;
+ /* When using placement new, users may not realize that they need
+ the extra storage. We require that the operator called be
+ the global placement operator delete[]. */
+ else if (placement && !TREE_CHAIN (placement)
+ && same_type_p (TREE_TYPE (TREE_VALUE (placement)),
+ ptr_type_node))
+ use_cookie = !use_global_new;
+ /* Otherwise, we need the cookie. */
+ else
+ use_cookie = 1;
+ /* Compute the number of extra bytes to allocate, now that we know
+ whether or not we need the cookie. */
if (use_cookie)
{
- tree extra = BI_header_size;
-
- size = size_binop (PLUS_EXPR, size, extra);
- }
-
- if (has_array)
- {
- code = VEC_NEW_EXPR;
-
- if (init && pedantic)
- cp_pedwarn ("initialization in array new");
+ cookie_size = get_cookie_size (true_type);
+ size = size_binop (PLUS_EXPR, size, cookie_size);
}
/* Allocate the object. */
- if (! has_array && ! placement && flag_this_is_variable > 0
- && TYPE_NEEDS_CONSTRUCTING (true_type) && init != void_type_node)
- {
- if (init == NULL_TREE || TREE_CODE (init) == TREE_LIST)
- rval = NULL_TREE;
- else
- {
- error ("constructors take parameter lists");
- return error_mark_node;
- }
- }
- else if (! placement && TYPE_FOR_JAVA (true_type))
+ if (! placement && TYPE_FOR_JAVA (true_type))
{
tree class_addr, alloc_decl;
tree class_decl = build_java_class_ref (true_type);
tree class_size = size_in_bytes (true_type);
- static char alloc_name[] = "_Jv_AllocObject";
+ static const char alloc_name[] = "_Jv_AllocObject";
use_java_new = 1;
alloc_decl = IDENTIFIER_GLOBAL_VALUE (get_identifier (alloc_name));
if (alloc_decl == NULL_TREE)
- fatal("call to Java constructor, while `%s' undefined", alloc_name);
+ fatal_error ("call to Java constructor with `%s' undefined",
+ alloc_name);
+
class_addr = build1 (ADDR_EXPR, jclass_node, class_decl);
- rval = build_function_call (alloc_decl,
- tree_cons (NULL_TREE, class_addr,
- build_tree_list (NULL_TREE,
- class_size)));
- rval = cp_convert (build_pointer_type (true_type), rval);
+ alloc_call = (build_function_call
+ (alloc_decl,
+ tree_cons (NULL_TREE, class_addr,
+ build_tree_list (NULL_TREE, class_size))));
}
else
{
- int susp = 0;
-
- if (flag_exceptions)
- /* We will use RVAL when generating an exception handler for
- this new-expression, so we must save it. */
- susp = suspend_momentary ();
+ tree fnname;
+ tree args;
- rval = build_op_new_call
- (code, true_type, expr_tree_cons (NULL_TREE, size, placement),
- LOOKUP_NORMAL | (use_global_new * LOOKUP_GLOBAL));
- rval = cp_convert (build_pointer_type (true_type), rval);
+ args = tree_cons (NULL_TREE, size, placement);
+ fnname = ansi_opname (code);
- if (flag_exceptions)
- resume_momentary (susp);
+ if (use_global_new)
+ alloc_call = (build_new_function_call
+ (lookup_function_nonclass (fnname, args),
+ args));
+ else
+ alloc_call = build_method_call (build_dummy_object (true_type),
+ fnname, args, NULL_TREE,
+ LOOKUP_NORMAL);
}
+ if (alloc_call == error_mark_node)
+ return error_mark_node;
+
+ /* The ALLOC_CALL should be a CALL_EXPR, and the first operand
+ should be the address of a known FUNCTION_DECL. */
+ my_friendly_assert (TREE_CODE (alloc_call) == CALL_EXPR, 20000521);
+ t = TREE_OPERAND (alloc_call, 0);
+ my_friendly_assert (TREE_CODE (t) == ADDR_EXPR, 20000521);
+ t = TREE_OPERAND (t, 0);
+ my_friendly_assert (TREE_CODE (t) == FUNCTION_DECL, 20000521);
+ /* Now, check to see if this function is actually a placement
+ allocation function. This can happen even when PLACEMENT is NULL
+ because we might have something like:
+
+ struct S { void* operator new (size_t, int i = 0); };
+
+ A call to `new S' will get this allocation function, even though
+ there is no explicit placement argument. If there is more than
+ one argument, or there are variable arguments, then this is a
+ placement allocation function. */
+ placement_allocation_fn_p
+ = (type_num_arguments (TREE_TYPE (t)) > 1 || varargs_function_p (t));
+
/* 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_,
@@ -2474,144 +2376,88 @@ build_new_1 (exp)
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);
- nothrow = TYPE_NOTHROW_P (TREE_TYPE (t));
- }
+ /* The ADDR_EXPR. */
+ t = TREE_OPERAND (alloc_call, 0);
+ /* The function. */
+ t = TREE_OPERAND (t, 0);
+ nothrow = TYPE_NOTHROW_P (TREE_TYPE (t));
check_new = (flag_check_new || nothrow) && ! use_java_new;
- if ((check_new || flag_exceptions) && rval)
+ alloc_expr = alloc_call;
+
+ if (use_cookie)
+ /* Adjust so we're pointing to the start of the object. */
+ alloc_expr = build (PLUS_EXPR, TREE_TYPE (alloc_expr),
+ alloc_expr, cookie_size);
+
+ /* While we're working, use a pointer to the type we've actually
+ allocated. */
+ alloc_expr = convert (build_pointer_type (full_type), alloc_expr);
+
+ /* Now save the allocation expression so we only evaluate it once. */
+ alloc_expr = get_target_expr (alloc_expr);
+ alloc_node = TREE_OPERAND (alloc_expr, 0);
+
+ /* Now initialize the cookie. */
+ if (use_cookie)
{
- alloc_expr = get_target_expr (rval);
- alloc_node = rval = TREE_OPERAND (alloc_expr, 0);
- }
- else
- alloc_expr = NULL_TREE;
-
- /* if rval is NULL_TREE I don't have to allocate it, but are we totally
- sure we have some extra bytes in that case for the BI_header_size
- cookies? And how does that interact with the code below? (mrs) */
- /* Finish up some magic for new'ed arrays */
- if (use_cookie && rval != NULL_TREE)
- {
- tree extra = BI_header_size;
- tree cookie, exp1;
- rval = convert (string_type_node, rval); /* for ptr arithmetic */
- rval = save_expr (build_binary_op (PLUS_EXPR, rval, extra));
- /* Store header info. */
- cookie = build_indirect_ref (build (MINUS_EXPR,
- build_pointer_type (BI_header_type),
- rval, extra), NULL_PTR);
- exp1 = build (MODIFY_EXPR, void_type_node,
- build_component_ref (cookie, nc_nelts_field_id,
- NULL_TREE, 0),
- nelts);
- TREE_SIDE_EFFECTS (exp1) = 1;
- rval = cp_convert (build_pointer_type (true_type), rval);
- rval = build_compound_expr
- (expr_tree_cons (NULL_TREE, exp1,
- build_expr_list (NULL_TREE, rval)));
- }
+ tree cookie;
- if (rval == error_mark_node)
- return error_mark_node;
+ /* Store the number of bytes allocated so that we can know how
+ many elements to destroy later. We use the last sizeof
+ (size_t) bytes to store the number of elements. */
+ cookie = build (MINUS_EXPR, build_pointer_type (sizetype),
+ alloc_node, size_in_bytes (sizetype));
+ cookie = build_indirect_ref (cookie, NULL);
- /* Don't call any constructors or do any initialization. */
- if (init == void_type_node)
- goto done;
+ cookie_expr = build (MODIFY_EXPR, void_type_node, cookie, nelts);
+ TREE_SIDE_EFFECTS (cookie_expr) = 1;
+ }
+ else
+ cookie_expr = NULL_TREE;
+ /* Now initialize the allocated object. */
+ init_expr = NULL_TREE;
if (TYPE_NEEDS_CONSTRUCTING (type) || init)
{
- if (! TYPE_NEEDS_CONSTRUCTING (type)
- && ! IS_AGGR_TYPE (type) && ! has_array)
+ init_expr = build_indirect_ref (alloc_node, NULL);
+
+ if (init == void_zero_node)
+ init = build_default_init (full_type);
+ else if (init && pedantic && has_array)
+ pedwarn ("ISO C++ forbids initialization in array new");
+
+ if (has_array)
+ init_expr = build_vec_init (init_expr, init, 0);
+ else if (TYPE_NEEDS_CONSTRUCTING (type))
+ init_expr = build_method_call (init_expr,
+ complete_ctor_identifier,
+ init, TYPE_BINFO (true_type),
+ LOOKUP_NORMAL);
+ else
{
/* We are processing something like `new int (10)', which
means allocate an int, and initialize it with 10. */
- tree deref;
- tree deref_type;
-
- /* At present RVAL is a temporary variable, created to hold
- the value from the call to `operator new'. We transform
- it to (*RVAL = INIT, RVAL). */
- rval = save_expr (rval);
- deref = build_indirect_ref (rval, NULL_PTR);
-
- /* Even for something like `new const int (10)' we must
- allow the expression to be non-const while we do the
- initialization. */
- deref_type = TREE_TYPE (deref);
- if (CP_TYPE_CONST_P (deref_type))
- TREE_TYPE (deref)
- = cp_build_qualified_type (deref_type,
- CP_TYPE_QUALS (deref_type)
- & ~TYPE_QUAL_CONST);
- TREE_READONLY (deref) = 0;
-
- if (TREE_CHAIN (init) != NULL_TREE)
- pedwarn ("initializer list being treated as compound expression");
- else if (TREE_CODE (init) == CONSTRUCTOR)
+
+ if (TREE_CODE (init) == TREE_LIST)
{
- pedwarn ("initializer list appears where operand should be used");
- init = TREE_OPERAND (init, 1);
+ if (TREE_CHAIN (init) != NULL_TREE)
+ pedwarn
+ ("initializer list being treated as compound expression");
+ init = build_compound_expr (init);
}
- init = build_compound_expr (init);
-
- init = convert_for_initialization (deref, type, init, LOOKUP_NORMAL,
- "new", NULL_TREE, 0);
- rval = build (COMPOUND_EXPR, TREE_TYPE (rval),
- build_modify_expr (deref, NOP_EXPR, init),
- rval);
- TREE_NO_UNUSED_WARNING (rval) = 1;
- TREE_SIDE_EFFECTS (rval) = 1;
- }
- else if (! has_array)
- {
- tree newrval;
- /* Constructors are never virtual. If it has an initialization, we
- need to complain if we aren't allowed to use the ctor that took
- that argument. */
- int flags = LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_COMPLAIN;
-
- if (rval && TYPE_USES_VIRTUAL_BASECLASSES (true_type))
+ else if (TREE_CODE (init) == CONSTRUCTOR
+ && TREE_TYPE (init) == NULL_TREE)
{
- if (TYPE_USES_PVBASES (true_type)
- && !flag_vtable_thunks_compat)
- {
- init = expr_tree_cons (NULL_TREE, vlist_zero_node, init);
- flags |= LOOKUP_HAS_VLIST;
- }
- init = expr_tree_cons (NULL_TREE, integer_one_node, init);
- flags |= LOOKUP_HAS_IN_CHARGE;
+ pedwarn ("ISO C++ forbids aggregate initializer to new");
+ init = digest_init (type, init, 0);
}
- if (use_java_new)
- rval = save_expr (rval);
- newrval = rval;
-
- if (newrval && TREE_CODE (TREE_TYPE (newrval)) == POINTER_TYPE)
- newrval = build_indirect_ref (newrval, NULL_PTR);
-
- newrval = build_method_call (newrval, ctor_identifier,
- init, TYPE_BINFO (true_type), flags);
-
- if (newrval == NULL_TREE || newrval == error_mark_node)
- return error_mark_node;
-
- /* Java constructors compiled by jc1 do not return this. */
- if (use_java_new)
- newrval = build (COMPOUND_EXPR, TREE_TYPE (newrval),
- newrval, rval);
- rval = newrval;
- TREE_HAS_CONSTRUCTOR (rval) = 1;
+ init_expr = build_modify_expr (init_expr, INIT_EXPR, init);
}
- else
- rval = build (VEC_INIT_EXPR, TREE_TYPE (rval),
- save_expr (rval), init, nelts);
+
+ if (init_expr == error_mark_node)
+ return error_mark_node;
/* If any part of the object initialization terminates by throwing an
exception and a suitable deallocation function can be found, the
@@ -2621,100 +2467,101 @@ build_new_1 (exp)
unambiguous matching deallocation function can be found,
propagating the exception does not cause the object's memory to be
freed. */
- if (flag_exceptions && alloc_expr && ! use_java_new)
+ if (flag_exceptions && ! use_java_new)
{
enum tree_code dcode = has_array ? VEC_DELETE_EXPR : DELETE_EXPR;
- tree cleanup, fn = NULL_TREE;
- int flags = LOOKUP_NORMAL | (use_global_new * LOOKUP_GLOBAL);
+ tree cleanup;
+ int flags = (LOOKUP_NORMAL
+ | (globally_qualified_p * LOOKUP_GLOBAL));
- /* All cleanups must last longer than normal. */
- int yes = suspend_momentary ();
+ /* The Standard is unclear here, but the right thing to do
+ is to use the same method for finding deallocation
+ functions that we use for finding allocation functions. */
+ flags |= LOOKUP_SPECULATIVELY;
- if (placement)
- {
- flags |= LOOKUP_SPECULATIVELY;
-
- /* We expect alloc_expr to look like a TARGET_EXPR around
- a NOP_EXPR around the CALL_EXPR we want. */
- fn = TREE_OPERAND (alloc_expr, 1);
- fn = TREE_OPERAND (fn, 0);
- }
-
- /* Copy size to the saveable obstack. */
- size = mapcar (size, permanent_p);
-
- cleanup = build_op_delete_call (dcode, alloc_node, size, flags, fn);
-
- resume_momentary (yes);
+ cleanup = build_op_delete_call (dcode, alloc_node, size, flags,
+ (placement_allocation_fn_p
+ ? alloc_call : NULL_TREE));
/* Ack! First we allocate the memory. Then we set our sentry
variable to true, and expand a cleanup that deletes the memory
- if sentry is true. Then we run the constructor and store the
- returned pointer in buf. Then we clear sentry and return buf. */
+ if sentry is true. Then we run the constructor, and finally
+ clear the sentry.
+
+ It would be nice to be able to handle this without the sentry
+ variable, perhaps with a TRY_CATCH_EXPR, but this doesn't
+ work. We allocate the space first, so if there are any
+ temporaries with cleanups in the constructor args we need this
+ EH region to extend until end of full-expression to preserve
+ nesting.
+
+ If the backend had some mechanism so that we could force the
+ allocation to be expanded after all the other args to the
+ constructor, that would fix the nesting problem and we could
+ do away with this complexity. But that would complicate other
+ things; in particular, it would make it difficult to bail out
+ if the allocation function returns null. */
if (cleanup)
{
- tree end, sentry, begin, buf, t = TREE_TYPE (rval);
+ tree end, sentry, begin;
begin = get_target_expr (boolean_true_node);
sentry = TREE_OPERAND (begin, 0);
- yes = suspend_momentary ();
TREE_OPERAND (begin, 2)
= build (COND_EXPR, void_type_node, sentry,
cleanup, void_zero_node);
- resume_momentary (yes);
-
- rval = get_target_expr (rval);
end = build (MODIFY_EXPR, TREE_TYPE (sentry),
sentry, boolean_false_node);
- TREE_SIDE_EFFECTS (end) = 1;
-
- buf = TREE_OPERAND (rval, 0);
- rval = build (COMPOUND_EXPR, t, begin,
- build (COMPOUND_EXPR, t, rval,
- build (COMPOUND_EXPR, t, end, buf)));
+ init_expr
+ = build (COMPOUND_EXPR, void_type_node, begin,
+ build (COMPOUND_EXPR, void_type_node, init_expr,
+ end));
}
}
}
else if (CP_TYPE_CONST_P (true_type))
- cp_error ("uninitialized const in `new' of `%#T'", true_type);
-
- done:
+ error ("uninitialized const in `new' of `%#T'", true_type);
- if (alloc_expr && rval == alloc_node)
- {
- rval = TREE_OPERAND (alloc_expr, 1);
- alloc_expr = NULL_TREE;
- }
+ /* Now build up the return value in reverse order. */
- if (check_new && alloc_expr)
- {
- /* Did we modify the storage? */
- tree ifexp = build_binary_op (NE_EXPR, alloc_node,
- integer_zero_node);
- rval = build_conditional_expr (ifexp, rval, alloc_node);
- }
+ rval = alloc_node;
- if (alloc_expr)
- rval = build (COMPOUND_EXPR, TREE_TYPE (rval), alloc_expr, rval);
+ if (init_expr)
+ rval = build (COMPOUND_EXPR, TREE_TYPE (rval), init_expr, rval);
+ if (cookie_expr)
+ rval = build (COMPOUND_EXPR, TREE_TYPE (rval), cookie_expr, rval);
- if (rval && TREE_TYPE (rval) != build_pointer_type (type))
+ if (rval == alloc_node)
+ /* If we didn't modify anything, strip the TARGET_EXPR and return the
+ (adjusted) call. */
+ rval = TREE_OPERAND (alloc_expr, 1);
+ else
{
- /* The type of new int [3][3] is not int *, but int [3] * */
- rval = build_c_cast (build_pointer_type (type), rval);
+ if (check_new)
+ {
+ tree ifexp = cp_build_binary_op (NE_EXPR, alloc_node,
+ integer_zero_node);
+ rval = build_conditional_expr (ifexp, rval, alloc_node);
+ }
+
+ rval = build (COMPOUND_EXPR, TREE_TYPE (rval), alloc_expr, rval);
}
+ /* Now strip the outer ARRAY_TYPE, so we return a pointer to the first
+ element. */
+ rval = convert (build_pointer_type (type), rval);
+
return rval;
}
static tree
-build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete,
- use_global_delete)
+build_vec_delete_1 (base, maxindex, type, auto_delete_vec, use_global_delete)
tree base, maxindex, type;
- tree auto_delete_vec, auto_delete;
+ special_function_kind auto_delete_vec;
int use_global_delete;
{
tree virtual_size;
@@ -2740,16 +2587,17 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete,
This is also the containing expression returned by this function. */
tree controller = NULL_TREE;
- if (! IS_AGGR_TYPE (type) || ! TYPE_NEEDS_DESTRUCTOR (type))
+ if (! IS_AGGR_TYPE (type) || TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
{
loop = integer_zero_node;
goto no_destructor;
}
- /* The below is short by BI_header_size */
- virtual_size = fold (size_binop (MULT_EXPR, size_exp, maxindex));
+ /* The below is short by the cookie size. */
+ virtual_size = size_binop (MULT_EXPR, size_exp,
+ convert (sizetype, maxindex));
- tbase = build_decl (VAR_DECL, NULL_TREE, ptype);
+ tbase = create_temporary_var (ptype);
tbase_init = build_modify_expr (tbase, NOP_EXPR,
fold (build (PLUS_EXPR, ptype,
base,
@@ -2758,94 +2606,78 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete,
controller = build (BIND_EXPR, void_type_node, tbase, NULL_TREE, NULL_TREE);
TREE_SIDE_EFFECTS (controller) = 1;
- if (auto_delete != integer_zero_node
- && auto_delete != integer_two_node)
- {
- tree base_tbd = cp_convert (ptype,
- build_binary_op (MINUS_EXPR,
- cp_convert (ptr_type_node, base),
- BI_header_size));
- /* This is the real size */
- virtual_size = size_binop (PLUS_EXPR, virtual_size, BI_header_size);
- body = build_expr_list (NULL_TREE,
- build_x_delete (base_tbd,
- 2 | use_global_delete,
- virtual_size));
- body = build (COND_EXPR, void_type_node,
- build (BIT_AND_EXPR, integer_type_node,
- auto_delete, integer_one_node),
- body, integer_zero_node);
- }
- else
- body = NULL_TREE;
+ body = NULL_TREE;
- body = expr_tree_cons (NULL_TREE,
- build_delete (ptype, tbase, auto_delete,
+ body = tree_cons (NULL_TREE,
+ build_delete (ptype, tbase, sfk_complete_destructor,
LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 1),
body);
- body = expr_tree_cons (NULL_TREE,
+ body = tree_cons (NULL_TREE,
build_modify_expr (tbase, NOP_EXPR, build (MINUS_EXPR, ptype, tbase, size_exp)),
body);
- body = expr_tree_cons (NULL_TREE,
+ body = tree_cons (NULL_TREE,
build (EXIT_EXPR, void_type_node,
build (EQ_EXPR, boolean_type_node, base, tbase)),
body);
loop = build (LOOP_EXPR, void_type_node, build_compound_expr (body));
- loop = expr_tree_cons (NULL_TREE, tbase_init,
- expr_tree_cons (NULL_TREE, loop, NULL_TREE));
+ loop = tree_cons (NULL_TREE, tbase_init,
+ tree_cons (NULL_TREE, loop, NULL_TREE));
loop = build_compound_expr (loop);
no_destructor:
/* If the delete flag is one, or anything else with the low bit set,
delete the storage. */
- if (auto_delete_vec == integer_zero_node)
- deallocate_expr = integer_zero_node;
- else
+ deallocate_expr = integer_zero_node;
+ if (auto_delete_vec != sfk_base_destructor)
{
tree base_tbd;
- /* The below is short by BI_header_size */
- virtual_size = fold (size_binop (MULT_EXPR, size_exp, maxindex));
+ /* The below is short by the cookie size. */
+ virtual_size = size_binop (MULT_EXPR, size_exp,
+ convert (sizetype, maxindex));
if (! TYPE_VEC_NEW_USES_COOKIE (type))
/* no header */
base_tbd = base;
else
{
- base_tbd = cp_convert (ptype,
- build_binary_op (MINUS_EXPR,
- cp_convert (string_type_node, base),
- BI_header_size));
+ tree cookie_size;
+
+ cookie_size = get_cookie_size (type);
+ base_tbd
+ = cp_convert (ptype,
+ cp_build_binary_op (MINUS_EXPR,
+ cp_convert (string_type_node,
+ base),
+ cookie_size));
/* True size with header. */
- virtual_size = size_binop (PLUS_EXPR, virtual_size, BI_header_size);
+ virtual_size = size_binop (PLUS_EXPR, virtual_size, cookie_size);
}
- deallocate_expr = build_x_delete (base_tbd,
- 2 | use_global_delete,
- virtual_size);
- if (auto_delete_vec != integer_one_node)
- deallocate_expr = build (COND_EXPR, void_type_node,
- build (BIT_AND_EXPR, integer_type_node,
- auto_delete_vec, integer_one_node),
- deallocate_expr, integer_zero_node);
+
+ if (auto_delete_vec == sfk_deleting_destructor)
+ deallocate_expr = build_x_delete (base_tbd,
+ 2 | use_global_delete,
+ virtual_size);
}
if (loop && deallocate_expr != integer_zero_node)
{
- body = expr_tree_cons (NULL_TREE, loop,
- expr_tree_cons (NULL_TREE, deallocate_expr, NULL_TREE));
+ body = tree_cons (NULL_TREE, loop,
+ tree_cons (NULL_TREE, deallocate_expr, NULL_TREE));
body = build_compound_expr (body);
}
else
body = loop;
/* Outermost wrapper: If pointer is null, punt. */
- body = build (COND_EXPR, void_type_node,
- build (NE_EXPR, boolean_type_node, base, integer_zero_node),
- body, integer_zero_node);
+ body = fold (build (COND_EXPR, void_type_node,
+ fold (build (NE_EXPR, boolean_type_node, base,
+ integer_zero_node)),
+ body, integer_zero_node));
body = build1 (NOP_EXPR, void_type_node, body);
if (controller)
@@ -2857,90 +2689,52 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete,
return cp_convert (void_type_node, body);
}
-/* Protect the vector initialization with a try-block so that we can
- destroy the first few elements if constructing a later element
- causes an exception to be thrown. TYPE is the type of the array
- elements. */
+/* Create an unnamed variable of the indicated TYPE. */
-static void
-expand_vec_init_try_block (type)
+tree
+create_temporary_var (type)
tree type;
{
- if (!TYPE_NEEDS_DESTRUCTOR (type) || !flag_exceptions)
- return;
-
- /* The code we generate looks like:
-
- try {
- // Initialize the vector.
- } catch (...) {
- // Destory the elements that need destroying.
- throw;
- }
-
- Here we're just beginning the `try'. */
+ tree decl;
+
+ decl = build_decl (VAR_DECL, NULL_TREE, type);
+ TREE_USED (decl) = 1;
+ DECL_ARTIFICIAL (decl) = 1;
+ DECL_SOURCE_FILE (decl) = input_filename;
+ DECL_SOURCE_LINE (decl) = lineno;
+ DECL_IGNORED_P (decl) = 1;
+ DECL_CONTEXT (decl) = current_function_decl;
- expand_eh_region_start ();
+ return decl;
}
-/* Add code to destroy the array elements constructed so far if the
- construction of some element in the array causes an exception to be
- thrown. RVAL is the address of the last element in the array.
- TYPE is the type of the array elements. MAXINDEX is the maximum
- allowable index into the array. ITERATOR is an integer variable
- indicating how many elements remain to be constructed. */
+/* Create a new temporary variable of the indicated TYPE, initialized
+ to INIT.
-static void
-expand_vec_init_catch_clause (rval, type, maxindex, iterator)
- tree rval;
- tree type;
- tree maxindex;
- tree iterator;
+ It is not entered into current_binding_level, because that breaks
+ things when it comes time to do final cleanups (which take place
+ "outside" the binding contour of the function). */
+
+static tree
+get_temp_regvar (type, init)
+ tree type, init;
{
- tree e;
- tree cleanup;
+ tree decl;
- if (!TYPE_NEEDS_DESTRUCTOR (type) || !flag_exceptions)
- return;
-
- /* We have to ensure that this can live to the cleanup expansion
- time, since we know it is only ever needed once, generate code
- now. */
- push_obstacks_nochange ();
- resume_temporary_allocation ();
-
- cleanup = make_node (RTL_EXPR);
- TREE_TYPE (cleanup) = void_type_node;
- RTL_EXPR_RTL (cleanup) = const0_rtx;
- TREE_SIDE_EFFECTS (cleanup) = 1;
- do_pending_stack_adjust ();
- start_sequence_for_rtl_expr (cleanup);
-
- e = build_vec_delete_1 (rval,
- build_binary_op (MINUS_EXPR, maxindex,
- iterator),
- type,
- /*auto_delete_vec=*/integer_zero_node,
- /*auto_delete=*/integer_zero_node,
- /*use_global_delete=*/0);
- expand_expr (e, const0_rtx, VOIDmode, EXPAND_NORMAL);
-
- do_pending_stack_adjust ();
- RTL_EXPR_SEQUENCE (cleanup) = get_insns ();
- end_sequence ();
- cleanup = protect_with_terminate (cleanup);
- expand_eh_region_end (cleanup);
- pop_obstacks ();
+ decl = create_temporary_var (type);
+ if (building_stmt_tree ())
+ add_decl_stmt (decl);
+ if (!building_stmt_tree ())
+ SET_DECL_RTL (decl, assign_temp (type, 2, 0, 1));
+ finish_expr_stmt (build_modify_expr (decl, INIT_EXPR, init));
+
+ return decl;
}
-/* `expand_vec_init' performs initialization of a vector of aggregate
- types.
+/* `build_vec_init' returns tree structure that performs
+ initialization of a vector of aggregate types.
- DECL is passed only for error reporting, and provides line number
- and source file name information.
- BASE is the space where the vector will be.
- MAXINDEX is the maximum index of the array (one less than the
- number of elements).
+ BASE is a reference to the vector, of ARRAY_TYPE.
INIT is the (possibly NULL) initializer.
FROM_ARRAY is 0 if we should init everything with INIT
@@ -2951,91 +2745,138 @@ expand_vec_init_catch_clause (rval, type, maxindex, iterator)
but use assignment instead of initialization. */
tree
-expand_vec_init (decl, base, maxindex, init, from_array)
- tree decl, base, maxindex, init;
+build_vec_init (base, init, from_array)
+ tree base, init;
int from_array;
{
tree rval;
tree base2 = NULL_TREE;
- tree type = TREE_TYPE (TREE_TYPE (base));
tree size;
tree itype = NULL_TREE;
tree iterator;
+ /* The type of the array. */
+ tree atype = TREE_TYPE (base);
+ /* The type of an element in the array. */
+ tree type = TREE_TYPE (atype);
+ /* The type of a pointer to an element in the array. */
+ tree ptype;
+ tree stmt_expr;
+ tree compound_stmt;
+ int destroy_temps;
+ tree try_block = NULL_TREE;
+ tree try_body = NULL_TREE;
int num_initialized_elts = 0;
+ tree maxindex = array_type_nelts (TREE_TYPE (base));
- maxindex = cp_convert (ptrdiff_type_node, maxindex);
if (maxindex == error_mark_node)
return error_mark_node;
- if (current_function_decl == NULL_TREE)
+ /* For g++.ext/arrnew.C. */
+ if (init && TREE_CODE (init) == CONSTRUCTOR && TREE_TYPE (init) == NULL_TREE)
+ init = digest_init (atype, init, 0);
+
+ if (init && !TYPE_NEEDS_CONSTRUCTING (type)
+ && ((TREE_CODE (init) == CONSTRUCTOR
+ /* Don't do this if the CONSTRUCTOR might contain something
+ that might throw and require us to clean up. */
+ && (CONSTRUCTOR_ELTS (init) == NULL_TREE
+ || ! TYPE_HAS_NONTRIVIAL_DESTRUCTOR (target_type (type))))
+ || from_array))
{
- rval = make_tree_vec (3);
- TREE_VEC_ELT (rval, 0) = base;
- TREE_VEC_ELT (rval, 1) = maxindex;
- TREE_VEC_ELT (rval, 2) = init;
- return rval;
+ /* Do non-default initialization of POD arrays resulting from
+ brace-enclosed initializers. In this case, digest_init and
+ store_constructor will handle the semantics for us. */
+
+ stmt_expr = build (INIT_EXPR, atype, base, init);
+ TREE_SIDE_EFFECTS (stmt_expr) = 1;
+ return stmt_expr;
}
+ maxindex = cp_convert (ptrdiff_type_node, maxindex);
+ ptype = build_pointer_type (type);
size = size_in_bytes (type);
+ if (TREE_CODE (TREE_TYPE (base)) == ARRAY_TYPE)
+ base = cp_convert (ptype, default_conversion (base));
+
+ /* The code we are generating looks like:
- base = default_conversion (base);
- base = cp_convert (build_pointer_type (type), base);
- rval = get_temp_regvar (build_pointer_type (type), base);
- base = get_temp_regvar (build_pointer_type (type), base);
+ T* t1 = (T*) base;
+ T* rval = t1;
+ ptrdiff_t iterator = maxindex;
+ try {
+ do {
+ ... initialize *t1 ...
+ ++t1;
+ } while (--iterator != -1);
+ } catch (...) {
+ ... destroy elements that were constructed ...
+ }
+ return rval;
+
+ We can omit the try and catch blocks if we know that the
+ initialization will never throw an exception, or if the array
+ elements do not have destructors. We can omit the loop completely if
+ the elements of the array do not have constructors.
+
+ We actually wrap the entire body of the above in a STMT_EXPR, for
+ tidiness.
+
+ When copying from array to another, when the array elements have
+ only trivial copy constructors, we should use __builtin_memcpy
+ rather than generating a loop. That way, we could take advantage
+ of whatever cleverness the back-end has for dealing with copies
+ of blocks of memory. */
+
+ begin_init_stmts (&stmt_expr, &compound_stmt);
+ destroy_temps = stmts_are_full_exprs_p ();
+ current_stmt_tree ()->stmts_are_full_exprs_p = 0;
+ rval = get_temp_regvar (ptype, base);
+ base = get_temp_regvar (ptype, rval);
iterator = get_temp_regvar (ptrdiff_type_node, maxindex);
/* Protect the entire array initialization so that we can destroy
- the partially constructed array if an exception is thrown. */
- expand_vec_init_try_block (type);
+ the partially constructed array if an exception is thrown.
+ But don't do this if we're assigning. */
+ if (flag_exceptions && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
+ && from_array != 2)
+ {
+ try_block = begin_try_block ();
+ try_body = begin_compound_stmt (/*has_no_scope=*/1);
+ }
- if (init != NULL_TREE && TREE_CODE (init) == CONSTRUCTOR
- && (!decl || same_type_p (TREE_TYPE (init), TREE_TYPE (decl))))
+ if (init != NULL_TREE && TREE_CODE (init) == CONSTRUCTOR)
{
- /* Do non-default initialization resulting from brace-enclosed
- initializers. */
+ /* Do non-default initialization of non-POD arrays resulting from
+ brace-enclosed initializers. */
tree elts;
- tree baseref = build1 (INDIRECT_REF, type, base);
-
from_array = 0;
for (elts = CONSTRUCTOR_ELTS (init); elts; elts = TREE_CHAIN (elts))
{
tree elt = TREE_VALUE (elts);
+ tree baseref = build1 (INDIRECT_REF, type, base);
num_initialized_elts++;
if (IS_AGGR_TYPE (type) || TREE_CODE (type) == ARRAY_TYPE)
- expand_aggr_init (baseref, elt, 0);
+ finish_expr_stmt (build_aggr_init (baseref, elt, 0));
else
- expand_assignment (baseref, elt, 0, 0);
-
- expand_assignment (base,
- build (PLUS_EXPR, build_pointer_type (type),
- base, size),
- 0, 0);
- expand_assignment (iterator,
- build (MINUS_EXPR, ptrdiff_type_node,
- iterator, integer_one_node),
- 0, 0);
+ finish_expr_stmt (build_modify_expr (baseref, NOP_EXPR,
+ elt));
+
+ finish_expr_stmt (build_unary_op (PREINCREMENT_EXPR, base, 0));
+ finish_expr_stmt (build_unary_op (PREDECREMENT_EXPR, iterator, 0));
}
/* Clear out INIT so that we don't get confused below. */
init = NULL_TREE;
-
- if (obey_regdecls)
- use_variable (DECL_RTL (base));
}
else if (from_array)
{
/* If initializing one array from another, initialize element by
element. We rely upon the below calls the do argument
checking. */
- if (decl == NULL_TREE)
- {
- sorry ("initialization of array from dissimilar array type");
- return error_mark_node;
- }
if (init)
{
base2 = default_conversion (init);
@@ -3060,20 +2901,39 @@ expand_vec_init (decl, base, maxindex, init, from_array)
if (from_array
|| (TYPE_NEEDS_CONSTRUCTING (type)
- && !(TREE_CODE (maxindex) == INTEGER_CST
- && num_initialized_elts == TREE_INT_CST_LOW (maxindex) + 1)))
+ && ! (host_integerp (maxindex, 0)
+ && (num_initialized_elts
+ == tree_low_cst (maxindex, 0) + 1))))
{
/* If the ITERATOR is equal to -1, then we don't have to loop;
we've already initialized all the elements. */
- expand_start_cond (build (NE_EXPR, boolean_type_node,
- iterator, minus_one),
- 0);
+ tree if_stmt;
+ tree do_stmt;
+ tree do_body;
+ tree elt_init;
+
+ if_stmt = begin_if_stmt ();
+ finish_if_stmt_cond (build (NE_EXPR, boolean_type_node,
+ iterator, integer_minus_one_node),
+ if_stmt);
/* Otherwise, loop through the elements. */
- expand_start_loop_continue_elsewhere (1);
-
- /* The initialization of each array element is a full-expression. */
- expand_start_target_temps ();
+ do_stmt = begin_do_stmt ();
+ do_body = begin_compound_stmt (/*has_no_scope=*/1);
+
+ /* When we're not building a statement-tree, things are a little
+ complicated. If, when we recursively call build_aggr_init,
+ an expression containing a TARGET_EXPR is expanded, then it
+ may get a cleanup. Then, the result of that expression is
+ passed to finish_expr_stmt, which will call
+ expand_start_target_temps/expand_end_target_temps. However,
+ the latter call will not cause the cleanup to run because
+ that block will still be on the block stack. So, we call
+ expand_start_target_temps here manually; the corresponding
+ call to expand_end_target_temps below will cause the cleanup
+ to be performed. */
+ if (!building_stmt_tree ())
+ expand_start_target_temps ();
if (from_array)
{
@@ -3086,68 +2946,79 @@ expand_vec_init (decl, base, maxindex, init, from_array)
from = NULL_TREE;
if (from_array == 2)
- expand_expr_stmt (build_modify_expr (to, NOP_EXPR, from));
+ elt_init = build_modify_expr (to, NOP_EXPR, from);
else if (TYPE_NEEDS_CONSTRUCTING (type))
- expand_aggr_init (to, from, 0);
+ elt_init = build_aggr_init (to, from, 0);
else if (from)
- expand_assignment (to, from, 0, 0);
+ elt_init = build_modify_expr (to, NOP_EXPR, from);
else
- my_friendly_abort (57);
+ abort ();
}
else if (TREE_CODE (type) == ARRAY_TYPE)
{
if (init != 0)
- sorry ("cannot initialize multi-dimensional array with initializer");
- expand_vec_init (decl,
- build1 (NOP_EXPR,
- build_pointer_type (TREE_TYPE
- (type)),
- base),
- array_type_nelts (type), 0, 0);
+ sorry
+ ("cannot initialize multi-dimensional array with initializer");
+ elt_init = build_vec_init (build1 (INDIRECT_REF, type, base),
+ 0, 0);
}
else
- expand_aggr_init (build1 (INDIRECT_REF, type, base), init, 0);
+ elt_init = build_aggr_init (build1 (INDIRECT_REF, type, base),
+ init, 0);
+
+ /* The initialization of each array element is a
+ full-expression, as per core issue 124. */
+ if (!building_stmt_tree ())
+ {
+ genrtl_expr_stmt (elt_init);
+ expand_end_target_temps ();
+ }
+ else
+ {
+ current_stmt_tree ()->stmts_are_full_exprs_p = 1;
+ finish_expr_stmt (elt_init);
+ current_stmt_tree ()->stmts_are_full_exprs_p = 0;
+ }
- expand_assignment (base,
- build (PLUS_EXPR, build_pointer_type (type),
- base, size), 0, 0);
+ finish_expr_stmt (build_unary_op (PREINCREMENT_EXPR, base, 0));
if (base2)
- expand_assignment (base2,
- build (PLUS_EXPR, build_pointer_type (type),
- base2, size), 0, 0);
+ finish_expr_stmt (build_unary_op (PREINCREMENT_EXPR, base2, 0));
- /* Cleanup any temporaries needed for the initial value. */
- expand_end_target_temps ();
-
- expand_loop_continue_here ();
- expand_exit_loop_if_false (0, build (NE_EXPR, boolean_type_node,
- build (PREDECREMENT_EXPR,
- ptrdiff_type_node,
- iterator,
- integer_one_node),
- minus_one));
-
- if (obey_regdecls)
- {
- use_variable (DECL_RTL (base));
- if (base2)
- use_variable (DECL_RTL (base2));
- }
+ finish_compound_stmt (/*has_no_scope=*/1, do_body);
+ finish_do_body (do_stmt);
+ finish_do_stmt (build (NE_EXPR, boolean_type_node,
+ build_unary_op (PREDECREMENT_EXPR, iterator, 0),
+ integer_minus_one_node),
+ do_stmt);
- expand_end_loop ();
- expand_end_cond ();
+ finish_then_clause (if_stmt);
+ finish_if_stmt ();
}
/* Make sure to cleanup any partially constructed elements. */
- expand_vec_init_catch_clause (rval, type, maxindex, iterator);
-
- if (obey_regdecls)
+ if (flag_exceptions && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
+ && from_array != 2)
{
- use_variable (DECL_RTL (iterator));
- use_variable (DECL_RTL (rval));
+ tree e;
+
+ finish_compound_stmt (/*has_no_scope=*/1, try_body);
+ finish_cleanup_try_block (try_block);
+ e = build_vec_delete_1 (rval,
+ cp_build_binary_op (MINUS_EXPR, maxindex,
+ iterator),
+ type,
+ sfk_base_destructor,
+ /*use_global_delete=*/0);
+ finish_cleanup (e, try_block);
}
- return rval;
+ /* The value of the array initialization is the address of the
+ first element in the array. */
+ finish_expr_stmt (rval);
+
+ stmt_expr = finish_init_stmts (stmt_expr, compound_stmt);
+ current_stmt_tree ()->stmts_are_full_exprs_p = destroy_temps;
+ return stmt_expr;
}
/* Free up storage of type TYPE, at address ADDR.
@@ -3160,7 +3031,7 @@ expand_vec_init (decl, base, maxindex, init, from_array)
things like padding and magic size cookies. It has virtual in it,
because if you have a base pointer and you delete through a virtual
destructor, it should be the size of the dynamic object, not the
- static object, see Free Store 12.5 ANSI C++ WP.
+ static object, see Free Store 12.5 ISO C++.
This does not call any destructors. */
@@ -3178,28 +3049,54 @@ build_x_delete (addr, which_delete, virtual_size)
return build_op_delete_call (code, addr, virtual_size, flags, NULL_TREE);
}
+/* Call the DTOR_KIND destructor for EXP. FLAGS are as for
+ build_delete. */
+
+static tree
+build_dtor_call (exp, dtor_kind, flags)
+ tree exp;
+ special_function_kind dtor_kind;
+ int flags;
+{
+ tree name;
+
+ switch (dtor_kind)
+ {
+ case sfk_complete_destructor:
+ name = complete_dtor_identifier;
+ break;
+
+ case sfk_base_destructor:
+ name = base_dtor_identifier;
+ break;
+
+ case sfk_deleting_destructor:
+ name = deleting_dtor_identifier;
+ break;
+
+ default:
+ abort ();
+ }
+ return build_method_call (exp, name, NULL_TREE, NULL_TREE, flags);
+}
+
/* Generate a call to a destructor. TYPE is the type to cast ADDR to.
ADDR is an expression which yields the store to be destroyed.
- AUTO_DELETE is nonzero if a call to DELETE should be made or not.
- If in the program, (AUTO_DELETE & 2) is non-zero, we tear down the
- virtual baseclasses.
- If in the program, (AUTO_DELETE & 1) is non-zero, then we deallocate.
+ AUTO_DELETE is the name of the destructor to call, i.e., either
+ sfk_complete_destructor, sfk_base_destructor, or
+ sfk_deleting_destructor.
FLAGS is the logical disjunction of zero or more LOOKUP_
- flags. See cp-tree.h for more info.
-
- This function does not delete an object's virtual base classes. */
+ flags. See cp-tree.h for more info. */
tree
build_delete (type, addr, auto_delete, flags, use_global_delete)
tree type, addr;
- tree auto_delete;
+ special_function_kind auto_delete;
int flags;
int use_global_delete;
{
- tree member;
tree expr;
- tree ref;
if (addr == error_mark_node)
return error_mark_node;
@@ -3214,7 +3111,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
if (TREE_CODE (type) == POINTER_TYPE)
{
type = TYPE_MAIN_VARIANT (TREE_TYPE (type));
- if (type != void_type_node && !complete_type_or_else (type, addr))
+ if (!VOID_TYPE_P (type) && !complete_type_or_else (type, addr))
return error_mark_node;
if (TREE_CODE (type) == ARRAY_TYPE)
goto handle_array;
@@ -3228,7 +3125,6 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
/* throw away const and volatile on target type of addr */
addr = convert_force (build_pointer_type (type), addr, 0);
- ref = build_indirect_ref (addr, NULL_PTR);
}
else if (TREE_CODE (type) == ARRAY_TYPE)
{
@@ -3241,8 +3137,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
return error_mark_node;
}
return build_vec_delete (addr, array_type_nelts (type),
- auto_delete, integer_zero_node,
- use_global_delete);
+ auto_delete, use_global_delete);
}
else
{
@@ -3253,19 +3148,14 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
if (TREE_SIDE_EFFECTS (addr))
addr = save_expr (addr);
- if (TREE_CONSTANT (addr))
- addr = convert_pointer_to (type, addr);
- else
- addr = convert_force (build_pointer_type (type), addr, 0);
-
- ref = build_indirect_ref (addr, NULL_PTR);
+ addr = convert_force (build_pointer_type (type), addr, 0);
}
my_friendly_assert (IS_AGGR_TYPE (type), 220);
- if (! TYPE_NEEDS_DESTRUCTOR (type))
+ if (TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
{
- if (auto_delete == integer_zero_node)
+ if (auto_delete != sfk_deleting_destructor)
return void_zero_node;
return build_op_delete_call
@@ -3273,49 +3163,46 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
LOOKUP_NORMAL | (use_global_delete * LOOKUP_GLOBAL),
NULL_TREE);
}
-
- /* Below, we will reverse the order in which these calls are made.
- If we have a destructor, then that destructor will take care
- of the base classes; otherwise, we must do that here. */
- if (TYPE_HAS_DESTRUCTOR (type))
+ else
{
- tree passed_auto_delete;
tree do_delete = NULL_TREE;
tree ifexp;
- if (use_global_delete)
- {
- tree cond = fold (build (BIT_AND_EXPR, integer_type_node,
- auto_delete, integer_one_node));
- tree call = build_builtin_delete_call (addr);
-
- cond = fold (build (COND_EXPR, void_type_node, cond,
- call, void_zero_node));
- if (cond != void_zero_node)
- do_delete = cond;
+ my_friendly_assert (TYPE_HAS_DESTRUCTOR (type), 20011213);
- passed_auto_delete = fold (build (BIT_AND_EXPR, integer_type_node,
- auto_delete, integer_two_node));
+ /* For `::delete x', we must not use the deleting destructor
+ since then we would not be sure to get the global `operator
+ delete'. */
+ if (use_global_delete && auto_delete == sfk_deleting_destructor)
+ {
+ /* We will use ADDR multiple times so we must save it. */
+ addr = save_expr (addr);
+ /* Delete the object. */
+ do_delete = build_builtin_delete_call (addr);
+ /* Otherwise, treat this like a complete object destructor
+ call. */
+ auto_delete = sfk_complete_destructor;
}
- else
- passed_auto_delete = auto_delete;
-
- /* Maybe pass vlist pointer to destructor. */
- if (TYPE_USES_PVBASES (type))
+ /* If the destructor is non-virtual, there is no deleting
+ variant. Instead, we must explicitly call the appropriate
+ `operator delete' here. */
+ else if (!DECL_VIRTUAL_P (CLASSTYPE_DESTRUCTORS (type))
+ && auto_delete == sfk_deleting_destructor)
{
- /* Pass vlist_zero even if in backwards compatibility mode,
- as the extra argument should not hurt if it is not used. */
- expr = build_expr_list (NULL_TREE, vlist_zero_node);
- flags |= LOOKUP_HAS_VLIST;
+ /* We will use ADDR multiple times so we must save it. */
+ addr = save_expr (addr);
+ /* Build the call. */
+ do_delete = build_op_delete_call (DELETE_EXPR,
+ addr,
+ c_sizeof_nowarn (type),
+ LOOKUP_NORMAL,
+ NULL_TREE);
+ /* Call the complete object destructor. */
+ auto_delete = sfk_complete_destructor;
}
- else
- expr = NULL_TREE;
-
- expr = expr_tree_cons (NULL_TREE, passed_auto_delete, expr);
-
- expr = build_method_call (ref, dtor_identifier, expr,
- NULL_TREE, flags);
+ expr = build_dtor_call (build_indirect_ref (addr, NULL),
+ auto_delete, flags);
if (do_delete)
expr = build (COMPOUND_EXPR, void_type_node, expr, do_delete);
@@ -3324,7 +3211,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
ifexp = integer_one_node;
else
/* Handle deleting a null pointer. */
- ifexp = fold (build_binary_op (NE_EXPR, addr, integer_zero_node));
+ ifexp = fold (cp_build_binary_op (NE_EXPR, addr, integer_zero_node));
if (ifexp != integer_one_node)
expr = build (COND_EXPR, void_type_node,
@@ -3332,84 +3219,98 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
return expr;
}
- else
- {
- /* We only get here from finish_function for a destructor. */
- tree binfos = BINFO_BASETYPES (TYPE_BINFO (type));
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- tree base_binfo = n_baseclasses > 0 ? TREE_VEC_ELT (binfos, 0) : NULL_TREE;
- tree exprstmt = NULL_TREE;
- tree parent_auto_delete = auto_delete;
- tree cond;
-
- /* Set this again before we call anything, as we might get called
- recursively. */
- TYPE_HAS_DESTRUCTOR (type) = 1;
-
- /* If we have member delete or vbases, we call delete in
- finish_function. */
- if (auto_delete == integer_zero_node)
- cond = NULL_TREE;
- else if (base_binfo == NULL_TREE
- || ! TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (base_binfo)))
- {
- cond = build (COND_EXPR, void_type_node,
- build (BIT_AND_EXPR, integer_type_node, auto_delete, integer_one_node),
- build_builtin_delete_call (addr),
- void_zero_node);
- }
- else
- cond = NULL_TREE;
+}
- if (cond)
- exprstmt = build_expr_list (NULL_TREE, cond);
+/* At the beginning of a destructor, push cleanups that will call the
+ destructors for our base classes and members.
- if (base_binfo
- && ! TREE_VIA_VIRTUAL (base_binfo)
- && TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (base_binfo)))
- {
- tree this_auto_delete;
+ Called from setup_vtbl_ptr. */
- /* Should the base invoke delete? */
- if (BINFO_OFFSET_ZEROP (base_binfo))
- this_auto_delete = parent_auto_delete;
- else
- this_auto_delete = integer_zero_node;
+void
+push_base_cleanups ()
+{
+ tree binfos;
+ int i, n_baseclasses;
+ tree member;
+ tree expr;
- expr = build_base_dtor_call (ref, base_binfo, this_auto_delete);
- exprstmt = expr_tree_cons (NULL_TREE, expr, exprstmt);
- }
+ /* Run destructors for all virtual baseclasses. */
+ if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
+ {
+ tree vbases;
+ tree cond = (condition_conversion
+ (build (BIT_AND_EXPR, integer_type_node,
+ current_in_charge_parm,
+ integer_two_node)));
- /* Take care of the remaining baseclasses. */
- for (i = 1; i < n_baseclasses; i++)
+ vbases = CLASSTYPE_VBASECLASSES (current_class_type);
+ /* The CLASSTYPE_VBASECLASSES list is in initialization
+ order, which is also the right order for pushing cleanups. */
+ for (; vbases;
+ vbases = TREE_CHAIN (vbases))
{
- base_binfo = TREE_VEC_ELT (binfos, i);
- if (! TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (base_binfo))
- || TREE_VIA_VIRTUAL (base_binfo))
- continue;
-
- expr = build_base_dtor_call (ref, base_binfo, integer_zero_node);
-
- exprstmt = expr_tree_cons (NULL_TREE, expr, exprstmt);
- }
+ tree vbase = TREE_VALUE (vbases);
+ tree base_type = BINFO_TYPE (vbase);
- for (member = TYPE_FIELDS (type); member; member = TREE_CHAIN (member))
- {
- if (TREE_CODE (member) != FIELD_DECL)
- continue;
- if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (member)))
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (base_type))
{
- tree this_member = build_component_ref (ref, DECL_NAME (member), NULL_TREE, 0);
- tree this_type = TREE_TYPE (member);
- expr = build_delete (this_type, this_member, integer_two_node, flags, 0);
- exprstmt = expr_tree_cons (NULL_TREE, expr, exprstmt);
+ tree base_ptr_type = build_pointer_type (base_type);
+ expr = current_class_ptr;
+
+ /* Convert to the basetype here, as we know the layout is
+ fixed. What is more, if we let build_method_call do it,
+ it will use the vtable, which may have been clobbered
+ by the deletion of our primary base. */
+
+ expr = build1 (NOP_EXPR, base_ptr_type, expr);
+ expr = build (PLUS_EXPR, base_ptr_type, expr,
+ BINFO_OFFSET (vbase));
+ expr = build_indirect_ref (expr, NULL);
+ expr = build_method_call (expr, base_dtor_identifier,
+ NULL_TREE, vbase,
+ LOOKUP_NORMAL);
+ expr = build (COND_EXPR, void_type_node, cond,
+ expr, void_zero_node);
+ finish_decl_cleanup (NULL_TREE, expr);
}
}
+ }
+
+ binfos = BINFO_BASETYPES (TYPE_BINFO (current_class_type));
+ n_baseclasses = CLASSTYPE_N_BASECLASSES (current_class_type);
- if (exprstmt)
- return build_compound_expr (exprstmt);
- /* Virtual base classes make this function do nothing. */
- return void_zero_node;
+ /* Take care of the remaining baseclasses. */
+ for (i = 0; i < n_baseclasses; i++)
+ {
+ tree base_binfo = TREE_VEC_ELT (binfos, i);
+ if (TYPE_HAS_TRIVIAL_DESTRUCTOR (BINFO_TYPE (base_binfo))
+ || TREE_VIA_VIRTUAL (base_binfo))
+ continue;
+
+ expr = build_scoped_method_call (current_class_ref, base_binfo,
+ base_dtor_identifier,
+ NULL_TREE);
+
+ finish_decl_cleanup (NULL_TREE, expr);
+ }
+
+ for (member = TYPE_FIELDS (current_class_type); member;
+ member = TREE_CHAIN (member))
+ {
+ if (TREE_CODE (member) != FIELD_DECL)
+ continue;
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (member)))
+ {
+ tree this_member = (build_component_ref
+ (current_class_ref, DECL_NAME (member),
+ NULL_TREE, 0));
+ tree this_type = TREE_TYPE (member);
+ expr = build_delete (this_type, this_member,
+ sfk_complete_destructor,
+ LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL,
+ 0);
+ finish_decl_cleanup (NULL_TREE, expr);
+ }
}
}
@@ -3427,11 +3328,12 @@ build_vbase_delete (type, decl)
while (vbases)
{
- tree this_addr = convert_force (build_pointer_type (BINFO_TYPE (vbases)),
- addr, 0);
- result = expr_tree_cons (NULL_TREE,
+ tree this_addr
+ = convert_force (build_pointer_type (BINFO_TYPE (TREE_VALUE (vbases))),
+ addr, 0);
+ result = tree_cons (NULL_TREE,
build_delete (TREE_TYPE (this_addr), this_addr,
- integer_zero_node,
+ sfk_base_destructor,
LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 0),
result);
vbases = TREE_CHAIN (vbases);
@@ -3445,7 +3347,6 @@ build_vbase_delete (type, decl)
BASE is the expression that should yield the store to be deleted.
This function expands (or synthesizes) these calls itself.
AUTO_DELETE_VEC says whether the container (vector) should be deallocated.
- AUTO_DELETE say whether each item in the container should be deallocated.
This also calls delete for virtual baseclasses of elements of the vector.
@@ -3457,10 +3358,9 @@ build_vbase_delete (type, decl)
be worth bothering.) */
tree
-build_vec_delete (base, maxindex, auto_delete_vec, auto_delete,
- use_global_delete)
+build_vec_delete (base, maxindex, auto_delete_vec, use_global_delete)
tree base, maxindex;
- tree auto_delete_vec, auto_delete;
+ special_function_kind auto_delete_vec;
int use_global_delete;
{
tree type;
@@ -3479,20 +3379,20 @@ build_vec_delete (base, maxindex, auto_delete_vec, auto_delete,
if (TREE_CODE (type) == POINTER_TYPE)
{
/* Step back one from start of vector, and read dimension. */
- tree cookie_addr = build (MINUS_EXPR, build_pointer_type (BI_header_type),
- base, BI_header_size);
- tree cookie = build_indirect_ref (cookie_addr, NULL_PTR);
- maxindex = build_component_ref (cookie, nc_nelts_field_id, NULL_TREE, 0);
- do
- type = TREE_TYPE (type);
- while (TREE_CODE (type) == ARRAY_TYPE);
+ tree cookie_addr;
+
+ type = strip_array_types (TREE_TYPE (type));
+ cookie_addr = build (MINUS_EXPR,
+ build_pointer_type (sizetype),
+ base,
+ TYPE_SIZE_UNIT (sizetype));
+ maxindex = build_indirect_ref (cookie_addr, NULL);
}
else if (TREE_CODE (type) == ARRAY_TYPE)
{
/* get the total number of things in the array, maxindex is a bad name */
maxindex = array_type_nelts_total (type);
- while (TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
+ type = strip_array_types (type);
base = build_unary_op (ADDR_EXPR, base, 1);
}
else
@@ -3502,6 +3402,6 @@ build_vec_delete (base, maxindex, auto_delete_vec, auto_delete,
return error_mark_node;
}
- return build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete,
+ return build_vec_delete_1 (base, maxindex, type, auto_delete_vec,
use_global_delete);
}
diff --git a/contrib/gcc/cp/lang-options.h b/contrib/gcc/cp/lang-options.h
index cfc6456..10daa40 100644
--- a/contrib/gcc/cp/lang-options.h
+++ b/contrib/gcc/cp/lang-options.h
@@ -1,5 +1,6 @@
/* Definitions for switches for C++.
- Copyright (C) 1995, 96-97, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
+ Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -20,115 +21,139 @@ Boston, MA 02111-1307, USA. */
DEFINE_LANG_NAME ("C++")
-/* This is the contribution to the `lang_options' array in gcc.c for
- g++. */
+/* This is the contribution to the `documented_lang_options' array in
+ toplev.c for g++. */
{ "-faccess-control", "" },
- { "-fno-access-control", "Do not obey access control semantics" },
- { "-fall-virtual", "Make all member functions virtual" },
- { "-fno-all-virtual", "" },
- { "-falt-external-templates", "Change when template instances are emitted" },
+ { "-fno-access-control",
+ N_("Do not obey access control semantics") },
+ { "-falt-external-templates",
+ N_("Change when template instances are emitted") },
{ "-fno-alt-external-templates", "" },
{ "-fansi-overloading", "" },
{ "-fno-ansi-overloading", "" },
- { "-fcheck-new", "Check the return value of new" },
+ { "-fcheck-new",
+ N_("Check the return value of new") },
{ "-fno-check-new", "" },
- { "-fconserve-space", "Reduce size of object files" },
+ { "-fconserve-space",
+ N_("Reduce size of object files") },
{ "-fno-conserve-space", "" },
{ "-fconst-strings", "" },
- { "-fno-const-strings", "Make string literals `char[]' instead of `const char[]'" },
+ { "-fno-const-strings",
+ N_("Make string literals `char[]' instead of `const char[]'") },
{ "-fdefault-inline", "" },
- { "-fno-default-inline", "Do not inline member functions by default"},
+ { "-fdump-translation-unit-",
+ N_("Dump the entire translation unit to a file") },
+ { "-fno-default-inline",
+ N_("Do not inline member functions by default") },
{ "-frtti", "" },
- { "-fno-rtti", "Do not generate run time type descriptor information" },
+ { "-fno-rtti",
+ N_("Do not generate run time type descriptor information") },
{ "-felide-constructors", "" },
{ "-fno-elide-constructors", "" },
- { "-fenum-int-equiv", "" },
- { "-fno-enum-int-equiv", "" },
+ { "-fenforce-eh-specs", "" },
+ { "-fno-enforce-eh-specs",
+ N_("Do not generate code to check exception specifications") },
{ "-fexternal-templates", "" },
{ "-fno-external-templates", "" },
{ "-ffor-scope", "" },
- { "-fno-for-scope", "Scope of for-init-statement vars extends outside" },
- { "-fguiding-decls", "Implement guiding declarations" },
- { "-fno-guiding-decls", "" },
+ { "-fno-for-scope",
+ N_("Scope of for-init-statement vars extends outside") },
{ "-fgnu-keywords", "" },
- { "-fno-gnu-keywords", "Do not recognise GNU defined keywords" },
+ { "-fno-gnu-keywords",
+ N_("Do not recognize GNU defined keywords") },
{ "-fhandle-exceptions", "" },
{ "-fno-handle-exceptions", "" },
- { "-fhandle-signatures", "Handle signature language constructs" },
- { "-fno-handle-signatures", "" },
- { "-fhonor-std", "Treat the namespace `std' as a normal namespace" },
- { "-fno-honor-std", "" },
- { "-fhuge-objects", "Enable support for huge objects" },
+ { "-fhuge-objects",
+ N_("Enable support for huge objects") },
{ "-fno-huge-objects", "" },
{ "-fimplement-inlines", "" },
- { "-fno-implement-inlines", "Export functions even if they can be inlined" },
+ { "-fno-implement-inlines",
+ N_("Export functions even if they can be inlined") },
{ "-fimplicit-templates", "" },
- { "-fno-implicit-templates", "Only emit explicit template instatiations" },
+ { "-fno-implicit-templates",
+ N_("Only emit explicit template instatiations") },
{ "-fimplicit-inline-templates", "" },
- { "-fno-implicit-inline-templates", "Only emit explicit instatiations of inline templates" },
- { "-finit-priority", "Handle the init_priority attribute" },
+ { "-fno-implicit-inline-templates",
+ N_("Only emit explicit instatiations of inline templates") },
+ { "-finit-priority", "" },
{ "-fno-init-priority", "" },
- { "-flabels-ok", "Labels can be used as first class objects" },
- { "-fno-labels-ok", "" },
{ "-fmemoize-lookups", "" },
{ "-fno-memoize-lookups", "" },
- { "-fname-mangling-version-", "" },
- { "-fnew-abi", "Enable experimental ABI changes" },
- { "-fno-new-abi", "" },
- { "-fnonnull-objects", "" },
- { "-fno-nonnull-objects", "Do not assume that a reference is always valid" },
- { "-foperator-names", "Recognise and/bitand/bitor/compl/not/or/xor" },
+ { "-fms-extensions",
+ N_("Don't pedwarn about uses of Microsoft extensions") },
+ { "-fno-ms-extensions", "" },
+ { "-foperator-names",
+ N_("Recognize and/bitand/bitor/compl/not/or/xor") },
{ "-fno-operator-names", "" },
{ "-foptional-diags", "" },
- { "-fno-optional-diags", "Disable optional diagnostics" },
- { "-fpermissive", "Downgrade conformance errors to warnings" },
+ { "-fno-optional-diags",
+ N_("Disable optional diagnostics") },
+ { "-fpermissive",
+ N_("Downgrade conformance errors to warnings") },
{ "-fno-permissive", "" },
- { "-frepo", "Enable automatic template instantiation" },
+ { "-frepo",
+ N_("Enable automatic template instantiation") },
{ "-fno-repo", "" },
{ "-fsave-memoized", "" },
{ "-fno-save-memoized", "" },
- { "-fsquangle", "Enable squashed name mangling" },
- { "-fno-squangle", "" },
- { "-fstats", "Display statistics accumulated during compilation" },
+ { "-fstats",
+ N_("Display statistics accumulated during compilation") },
{ "-fno-stats", "" },
- { "-fstrict-prototype", "" },
- { "-fno-strict-prototype", "Do not assume that empty prototype means no args" },
- { "-ftemplate-depth-", "Specify maximum template instantiation depth"},
- { "-fthis-is-variable", "Make 'this' not be type '* const'" },
- { "-fno-this-is-variable", "" },
- { "-fvtable-gc", "Discard unused virtual functions" },
+ { "-ftemplate-depth-",
+ N_("Specify maximum template instantiation depth") },
+ { "-fuse-cxa-atexit",
+ N_("Use __cxa_atexit to register destructors") },
+ { "-fno-use-cxa-atexit", "" },
+ { "-fvtable-gc",
+ N_("Discard unused virtual functions") },
{ "-fno-vtable-gc", "" },
- { "-fvtable-thunks", "Implement vtables using thunks" },
+ { "-fvtable-thunks",
+ N_("Implement vtables using thunks") },
{ "-fno-vtable-thunks", "" },
- { "-fweak", "Emit common-like symbols as weak symbols" },
+ { "-fweak",
+ N_("Emit common-like symbols as weak symbols") },
{ "-fno-weak", "" },
- { "-fxref", "Emit cross referencing information" },
+ { "-fxref",
+ N_("Emit cross referencing information") },
{ "-fno-xref", "" },
- { "-Wreturn-type", "Warn about inconsistent return types" },
+ { "-Wreturn-type",
+ N_("Warn about inconsistent return types") },
{ "-Wno-return-type", "" },
- { "-Woverloaded-virtual", "Warn about overloaded virtual function names" },
+ { "-Woverloaded-virtual",
+ N_("Warn about overloaded virtual function names") },
{ "-Wno-overloaded-virtual", "" },
{ "-Wctor-dtor-privacy", "" },
- { "-Wno-ctor-dtor-privacy", "Don't warn when all ctors/dtors are private" },
- { "-Wnon-virtual-dtor", "Warn about non virtual destructors" },
+ { "-Wno-ctor-dtor-privacy",
+ N_("Don't warn when all ctors/dtors are private") },
+ { "-Wnon-virtual-dtor",
+ N_("Warn about non virtual destructors") },
{ "-Wno-non-virtual-dtor", "" },
- { "-Wextern-inline", "Warn when a function is declared extern, then inline" },
+ { "-Wextern-inline",
+ N_("Warn when a function is declared extern, then inline") },
{ "-Wno-extern-inline", "" },
- { "-Wreorder", "Warn when the compiler reorders code" },
+ { "-Wreorder",
+ N_("Warn when the compiler reorders code") },
{ "-Wno-reorder", "" },
- { "-Wsynth", "Warn when synthesis behaviour differs from Cfront" },
+ { "-Wsynth",
+ N_("Warn when synthesis behavior differs from Cfront") },
{ "-Wno-synth", "" },
{ "-Wpmf-conversions", "" },
- { "-Wno-pmf-conversions", "Don't warn when type converting pointers to member functions" },
- { "-Weffc++", "Warn about violations of Effective C++ style rules" },
+ { "-Wno-pmf-conversions",
+ N_("Don't warn when type converting pointers to member functions") },
+ { "-Weffc++",
+ N_("Warn about violations of Effective C++ style rules") },
{ "-Wno-effc++", "" },
- { "-Wsign-promo", "Warn when overload promotes from unsigned to signed" },
+ { "-Wsign-promo",
+ N_("Warn when overload promotes from unsigned to signed") },
{ "-Wno-sign-promo", "" },
- { "-Wold-style-cast", "Warn if a C style cast is used in a program" },
+ { "-Wold-style-cast",
+ N_("Warn if a C style cast is used in a program") },
{ "-Wno-old-style-cast", "" },
{ "-Wnon-template-friend", "" },
- { "-Wno-non-template-friend", "Don't warn when non-templatized friend functions are declared within a template" },
+ { "-Wno-non-template-friend",
+ N_("Don't warn when non-templatized friend functions are declared within a template") },
{ "-Wdeprecated", "" },
- { "-Wno-deprecated", "Don't announce deprecation of compiler features" },
+ { "-Wno-deprecated",
+ N_("Don't announce deprecation of compiler features") },
diff --git a/contrib/gcc/cp/lang-specs.h b/contrib/gcc/cp/lang-specs.h
index 92cdf3a..e48bf74 100644
--- a/contrib/gcc/cp/lang-specs.h
+++ b/contrib/gcc/cp/lang-specs.h
@@ -1,5 +1,6 @@
/* Definitions for specs for C++.
- Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -21,77 +22,45 @@ Boston, MA 02111-1307, USA. */
/* This is the contribution to the `default_compilers' array in gcc.c for
g++. */
- {".cc", {"@c++"}},
- {".cp", {"@c++"}},
- {".cxx", {"@c++"}},
- {".cpp", {"@c++"}},
- {".c++", {"@c++"}},
- {".C", {"@c++"}},
+#ifndef CPLUSPLUS_CPP_SPEC
+#define CPLUSPLUS_CPP_SPEC 0
+#endif
+
+ {".cc", "@c++", 0},
+ {".cp", "@c++", 0},
+ {".cxx", "@c++", 0},
+ {".cpp", "@c++", 0},
+ {".c++", "@c++", 0},
+ {".C", "@c++", 0},
{"@c++",
-#if USE_CPPLIB
- {
- "%{E|M|MM:cpp0 -lang-c++ %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
- %{C:%{!E:%eGNU C++ does not support -C without using -E}}\
- %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
- %{!no-gcc:-D__GNUC__=%v1 -D__GNUG__=%v1 -D__GNUC_MINOR__=%v2}\
- -D__cplusplus\
- %{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
- %{!fno-exceptions:-D__EXCEPTIONS}\
- %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\
- %{ffast-math:-D__FAST_MATH__}\
- %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
- %i %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}\n}\
- %{!E:%{!M:%{!MM:cc1plus %i %1 %2\
- -lang-c++ %{nostdinc*} %{C} %{A*} %{I*} %{P} %{$} %I\
- %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
- %{!no-gcc:-D__GNUC__=%v1 -D__GNUG__=%v1\
- -D__GNUC_MINOR__=%v2} -D__cplusplus\
- %{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
- %{!fno-exceptions:-D__EXCEPTIONS}\
- %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
- %{ffast-math:-D__FAST_MATH__}\
- %{trigraphs}\
- %{!Q:-quiet} -dumpbase %b.cc %{d*} %{m*} %{a}\
- %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\
- %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
- %{v:-version} %{pg:-p} %{p}\
- %{f*} %{+e*} %{aux-info*} %{Qn:-fno-ident}\
- %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
- %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}}|\n\
- %{!S:as %a %Y\
- %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
- %{!pipe:%g.s} %A\n }}}}"}},
-#else /* ! USE_CPPLIB */
- {"cpp0 -lang-c++ %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\
- %{C:%{!E:%eGNU C++ does not support -C without using -E}}\
- %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
- %{!no-gcc:-D__GNUC__=%v1 -D__GNUG__=%v1 -D__GNUC_MINOR__=%v2}\
- -D__cplusplus\
- %{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
- %{!fno-exceptions:-D__EXCEPTIONS}\
- %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\
- %{ffast-math:-D__FAST_MATH__}\
- %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
- %i %{!M:%{!MM:%{!E:%{!pipe:%g.ii}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
- "%{!M:%{!MM:%{!E:cc1plus %{!pipe:%g.ii} %1 %2\
- %{!Q:-quiet} -dumpbase %b.cc %{d*} %{m*} %{a}\
- %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\
- %{v:-version} %{pg:-p} %{p}\
- %{f*} %{+e*} %{aux-info*} %{Qn:-fno-ident}\
- %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
- %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}}|\n\
- %{!S:as %a %Y\
- %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
- %{!pipe:%g.s} %A\n }}}}"}},
-#endif /* ! USE_CPPLIB */
- {".ii", {"@c++-cpp-output"}},
+ /* cc1plus has an integrated ISO C preprocessor. We should invoke
+ the external preprocessor if -save-temps is given. */
+ "%{E|M|MM:cpp0 -lang-c++ %{!no-gcc:-D__GNUG__=%v1}\
+ %{!Wno-deprecated:-D__DEPRECATED}\
+ %{!fno-exceptions:-D__EXCEPTIONS}\
+ -D__GXX_ABI_VERSION=100\
+ %{ansi:-D__STRICT_ANSI__ -trigraphs -$} %(cpp_options)}\
+ %{!E:%{!M:%{!MM:\
+ %{save-temps:cpp0 -lang-c++ \
+ %{!no-gcc:-D__GNUG__=%v1}\
+ %{!Wno-deprecated:-D__DEPRECATED}\
+ %{!fno-exceptions:-D__EXCEPTIONS}\
+ -D__GXX_ABI_VERSION=100\
+ %{ansi:-D__STRICT_ANSI__ -trigraphs -$}\
+ %(cpp_options) %b.ii \n}\
+ cc1plus %{save-temps:-fpreprocessed %b.ii}\
+ %{!save-temps:%(cpp_unique_options)\
+ %{!no-gcc:-D__GNUG__=%v1} \
+ %{!Wno-deprecated:-D__DEPRECATED}\
+ %{!fno-exceptions:-D__EXCEPTIONS}\
+ -D__GXX_ABI_VERSION=100\
+ %{ansi:-D__STRICT_ANSI__}}\
+ %{ansi:-trigraphs -$}\
+ %(cc1_options) %2 %{+e1*}\
+ %{!fsyntax-only:%(invoke_as)}}}}",
+ CPLUSPLUS_CPP_SPEC},
+ {".ii", "@c++-cpp-output", 0},
{"@c++-cpp-output",
- {"%{!M:%{!MM:%{!E:cc1plus %i %1 %2 %{!Q:-quiet} %{d*} %{m*} %{a}\
- %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\
- %{v:-version} %{pg:-p} %{p}\
- %{f*} %{+e*} %{aux-info*} %{Qn:-fno-ident}\
- %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
- %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
- %{!S:as %a %Y\
- %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
- %{!pipe:%g.s} %A\n }}}}"}},
+ "%{!M:%{!MM:%{!E:\
+ cc1plus -fpreprocessed %i %(cc1_options) %2 %{+e*}\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0},
diff --git a/contrib/gcc/cp/lex.c b/contrib/gcc/cp/lex.c
index d9f2262..0287f70 100644
--- a/contrib/gcc/cp/lex.c
+++ b/contrib/gcc/cp/lex.c
@@ -1,5 +1,6 @@
/* Separate lexical analyzer for GNU C++.
- Copyright (C) 1987, 89, 92-98, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -29,126 +30,65 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "input.h"
#include "tree.h"
-#include "lex.h"
#include "cp-tree.h"
+#include "cpplib.h"
+#include "c-lex.h"
+#include "lex.h"
#include "parse.h"
#include "flags.h"
-#include "obstack.h"
#include "c-pragma.h"
#include "toplev.h"
#include "output.h"
+#include "ggc.h"
+#include "tm_p.h"
+#include "timevar.h"
+#include "diagnostic.h"
#ifdef MULTIBYTE_CHARS
#include "mbchar.h"
#include <locale.h>
#endif
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
+extern void yyprint PARAMS ((FILE *, int, YYSTYPE));
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
-#endif
+static int interface_strcmp PARAMS ((const char *));
+static int *init_cpp_parse PARAMS ((void));
+static void init_cp_pragma PARAMS ((void));
+
+static tree parse_strconst_pragma PARAMS ((const char *, int));
+static void handle_pragma_vtable PARAMS ((cpp_reader *));
+static void handle_pragma_unit PARAMS ((cpp_reader *));
+static void handle_pragma_interface PARAMS ((cpp_reader *));
+static void handle_pragma_implementation PARAMS ((cpp_reader *));
+static void handle_pragma_java_exceptions PARAMS ((cpp_reader *));
-extern struct obstack permanent_obstack;
-extern struct obstack *current_obstack, *saveable_obstack;
-
-extern void yyprint PROTO((FILE *, int, YYSTYPE));
-
-static tree get_time_identifier PROTO((const char *));
-static int check_newline PROTO((void));
-static int skip_white_space PROTO((int));
-static void finish_defarg PROTO((void));
-static int my_get_run_time PROTO((void));
-static int get_last_nonwhite_on_line PROTO((void));
-static int interface_strcmp PROTO((const char *));
-static int readescape PROTO((int *));
-static char *extend_token_buffer PROTO((const char *));
-static void consume_string PROTO((struct obstack *, int));
-static int set_typedecl_interface_info PROTO((tree *, void *));
-static void feed_defarg PROTO((tree, tree));
-static int set_vardecl_interface_info PROTO((tree *, void *));
-static void store_pending_inline PROTO((tree, struct pending_inline *));
-static void reinit_parse_for_expr PROTO((struct obstack *));
-static int *init_cpp_parse PROTO((void));
-static int handle_cp_pragma PROTO((const char *));
-#ifdef HANDLE_GENERIC_PRAGMAS
-static int handle_generic_pragma PROTO((int));
-#endif
#ifdef GATHER_STATISTICS
#ifdef REDUCE_LENGTH
-static int reduce_cmp PROTO((int *, int *));
-static int token_cmp PROTO((int *, int *));
+static int reduce_cmp PARAMS ((int *, int *));
+static int token_cmp PARAMS ((int *, int *));
#endif
#endif
-static void begin_definition_of_inclass_inline PROTO((struct pending_inline*));
-static void parse_float PROTO((PTR));
-static int is_global PROTO((tree));
-static void init_filename_times PROTO((void));
-
-/* Given a file name X, return the nondirectory portion.
- Keep in mind that X can be computed more than once. */
-char *
-file_name_nondirectory (x)
- const char *x;
-{
- char *tmp = (char *) rindex (x, '/');
- if (DIR_SEPARATOR != '/' && ! tmp)
- tmp = (char *) rindex (x, DIR_SEPARATOR);
- if (tmp)
- return (char *) (tmp + 1);
- else
- return (char *) x;
-}
+static int is_global PARAMS ((tree));
+static void init_operators PARAMS ((void));
+static void copy_lang_type PARAMS ((tree));
-/* This obstack is needed to hold text. It is not safe to use
- TOKEN_BUFFER because `check_newline' calls `yylex'. */
-struct obstack inline_text_obstack;
-char *inline_text_firstobj;
-
-#if USE_CPPLIB
-#include "cpplib.h"
-extern cpp_reader parse_in;
-extern cpp_options parse_options;
-extern unsigned char *yy_cur, *yy_lim;
+/* A constraint that can be tested at compile time. */
+#ifdef __STDC__
+#define CONSTRAINT(name, expr) extern int constraint_##name [(expr) ? 1 : -1]
#else
-FILE *finput;
+#define CONSTRAINT(name, expr) extern int constraint_/**/name [(expr) ? 1 : -1]
#endif
-int end_of_file;
-
-/* Pending language change.
- Positive is push count, negative is pop count. */
-int pending_lang_change = 0;
-
-/* Wrap the current header file in extern "C". */
-static int c_header_level = 0;
-extern int first_token;
-extern struct obstack token_obstack;
-
-/* ??? Don't really know where this goes yet. */
-#if 1
-#include "input.c"
-#else
-extern void put_back (/* int */);
-extern int input_redirected ();
-extern void feed_input (/* char *, int */);
-#endif
+#include "cpplib.h"
-/* Holds translations from TREE_CODEs to operator name strings,
- i.e., opname_tab[PLUS_EXPR] == "+". */
-char **opname_tab;
-char **assignop_tab;
-
extern int yychar; /* the lookahead symbol */
extern YYSTYPE yylval; /* the semantic value of the */
/* lookahead symbol */
-#if 0
-YYLTYPE yylloc; /* location data for the lookahead */
- /* symbol */
-#endif
-
+/* These flags are used by c-lex.c. In C++, they're always off and on,
+ respectively. */
+int warn_traditional = 0;
+int flag_digraphs = 1;
/* the declaration found for the last IDENTIFIER token read in.
yylex must look this up to detect typedefs, which get token type TYPENAME,
@@ -156,18 +96,36 @@ YYLTYPE yylloc; /* location data for the lookahead */
used in a context which makes it a reference to a variable. */
tree lastiddecl;
-/* The elements of `ridpointers' are identifier nodes
- for the reserved type names and storage classes.
- It is indexed by a RID_... value. */
-tree ridpointers[(int) RID_MAX];
-
-/* We may keep statistics about how long which files took to compile. */
-static int header_time, body_time;
-static tree filename_times;
-static tree this_filename_time;
-
/* Array for holding counts of the numbers of tokens seen. */
extern int *token_count;
+
+/* Functions and data structures for #pragma interface.
+
+ `#pragma implementation' means that the main file being compiled
+ is considered to implement (provide) the classes that appear in
+ its main body. I.e., if this is file "foo.cc", and class `bar'
+ is defined in "foo.cc", then we say that "foo.cc implements bar".
+
+ All main input files "implement" themselves automagically.
+
+ `#pragma interface' means that unless this file (of the form "foo.h"
+ is not presently being included by file "foo.cc", the
+ CLASSTYPE_INTERFACE_ONLY bit gets set. The effect is that none
+ of the vtables nor any of the inline functions defined in foo.h
+ will ever be output.
+
+ There are cases when we want to link files such as "defs.h" and
+ "main.cc". In this case, we give "defs.h" a `#pragma interface',
+ and "main.cc" has `#pragma implementation "defs.h"'. */
+
+struct impl_files
+{
+ const char *filename;
+ struct impl_files *next;
+};
+
+static struct impl_files *impl_file_chain;
+
/* Return something to represent absolute declarators containing a *.
TARGET is the absolute declarator that the * contains.
@@ -184,7 +142,7 @@ make_pointer_declarator (cv_qualifiers, target)
if (target && TREE_CODE (target) == IDENTIFIER_NODE
&& ANON_AGGRNAME_P (target))
error ("type name expected before `*'");
- target = build_parse_node (INDIRECT_REF, target);
+ target = build_nt (INDIRECT_REF, target);
TREE_TYPE (target) = cv_qualifiers;
return target;
}
@@ -196,7 +154,7 @@ make_pointer_declarator (cv_qualifiers, target)
We return an ADDR_EXPR whose "contents" are TARGET
and whose type is the modifier list. */
-
+
tree
make_reference_declarator (cv_qualifiers, target)
tree cv_qualifiers, target;
@@ -216,7 +174,7 @@ make_reference_declarator (cv_qualifiers, target)
if (TREE_CODE (target) == IDENTIFIER_NODE && ANON_AGGRNAME_P (target))
error ("type name expected before `&'");
}
- target = build_parse_node (ADDR_EXPR, target);
+ target = build_nt (ADDR_EXPR, target);
TREE_TYPE (target) = cv_qualifiers;
return target;
}
@@ -225,8 +183,12 @@ 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;
+ target = build_nt (CALL_EXPR, target,
+ tree_cons (parms, cv_qualifiers, NULL_TREE),
+ /* The third operand is really RTL. We
+ shouldn't put anything there. */
+ NULL_TREE);
+ CALL_DECLARATOR_EXCEPTION_SPEC (target) = exception_specification;
return target;
}
@@ -234,54 +196,8 @@ 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. */
-
-tree ansi_opname[LAST_CPLUS_TREE_CODE];
-tree ansi_assopname[LAST_CPLUS_TREE_CODE];
-
-char *
-operator_name_string (name)
- tree name;
-{
- char *opname = IDENTIFIER_POINTER (name) + 2;
- tree *opname_table;
- int i, assign;
-
- /* Works for builtin and user defined types. */
- if (IDENTIFIER_GLOBAL_VALUE (name)
- && TREE_CODE (IDENTIFIER_GLOBAL_VALUE (name)) == TYPE_DECL)
- return IDENTIFIER_POINTER (name);
-
- if (opname[0] == 'a' && opname[2] != '\0' && opname[2] != '_')
- {
- opname += 1;
- assign = 1;
- opname_table = ansi_assopname;
- }
- else
- {
- assign = 0;
- opname_table = ansi_opname;
- }
-
- for (i = 0; i < (int) LAST_CPLUS_TREE_CODE; i++)
- {
- if (opname[0] == IDENTIFIER_POINTER (opname_table[i])[2+assign]
- && opname[1] == IDENTIFIER_POINTER (opname_table[i])[3+assign])
- break;
- }
-
- if (i == LAST_CPLUS_TREE_CODE)
- return "<invalid operator>";
-
- if (assign)
- return assignop_tab[i];
- else
- return opname_tab[i];
+ CALL_DECLARATOR_QUALS (call_declarator) = cv_qualifiers;
+ CALL_DECLARATOR_EXCEPTION_SPEC (call_declarator) = exception_specification;
}
int interface_only; /* whether or not current file is only for
@@ -289,75 +205,11 @@ int interface_only; /* whether or not current file is only for
int interface_unknown; /* whether or not we know this class
to behave according to #pragma interface. */
-/* lexical analyzer */
-
-#ifndef WCHAR_TYPE_SIZE
-#ifdef INT_TYPE_SIZE
-#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
-#else
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-#endif
-#endif
-
-/* Number of bytes in a wide character. */
-#define WCHAR_BYTES (WCHAR_TYPE_SIZE / BITS_PER_UNIT)
-
-static int maxtoken; /* Current nominal length of token buffer. */
-char *token_buffer; /* Pointer to token buffer.
- Actual allocated length is maxtoken + 2. */
-
-#include "hash.h"
-
-
-/* Nonzero tells yylex to ignore \ in string constants. */
-static int ignore_escape_flag = 0;
-
-static tree
-get_time_identifier (name)
- const char *name;
-{
- tree time_identifier;
- int len = strlen (name);
- char *buf = (char *) alloca (len + 6);
- strcpy (buf, "file ");
- bcopy (name, buf+5, len);
- buf[len+5] = '\0';
- time_identifier = get_identifier (buf);
- if (TIME_IDENTIFIER_TIME (time_identifier) == NULL_TREE)
- {
- push_obstacks_nochange ();
- end_temporary_allocation ();
- TIME_IDENTIFIER_TIME (time_identifier) = build_int_2 (0, 0);
- TIME_IDENTIFIER_FILEINFO (time_identifier)
- = build_int_2 (0, 1);
- SET_IDENTIFIER_GLOBAL_VALUE (time_identifier, filename_times);
- filename_times = time_identifier;
- pop_obstacks ();
- }
- return time_identifier;
-}
-
-#ifdef __GNUC__
-__inline
-#endif
-static int
-my_get_run_time ()
-{
- int old_quiet_flag = quiet_flag;
- int this_time;
- quiet_flag = 0;
- this_time = get_run_time ();
- quiet_flag = old_quiet_flag;
- return this_time;
-}
-
-/* Table indexed by tree code giving a string containing a character
- classifying the tree code. Possibilities are
- t, d, s, c, r, <, 1 and 2. See cp/cp-tree.def for details. */
+/* Tree code classes. */
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-char cplus_tree_code_type[] = {
+static const char cplus_tree_code_type[] = {
'x',
#include "cp-tree.def"
};
@@ -369,7 +221,7 @@ char cplus_tree_code_type[] = {
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
-int cplus_tree_code_length[] = {
+static const int cplus_tree_code_length[] = {
0,
#include "cp-tree.def"
};
@@ -379,335 +231,485 @@ int cplus_tree_code_length[] = {
Used for printing out the tree and error messages. */
#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
-const char *cplus_tree_code_name[] = {
+static const char *const cplus_tree_code_name[] = {
"@@dummy",
#include "cp-tree.def"
};
#undef DEFTREECODE
-/* toplev.c needs to call these. */
-
-void
-lang_init_options ()
-{
-#if USE_CPPLIB
- cpp_reader_init (&parse_in);
- parse_in.opts = &parse_options;
- cpp_options_init (&parse_options);
-#endif
-
- /* Default exceptions on. */
- flag_exceptions = 1;
-}
-
+/* Post-switch processing. */
void
-lang_init ()
+cxx_post_options ()
{
- /* the beginning of the file is a new line; check for # */
- /* With luck, we discover the real source file's name from that
- and put it in input_filename. */
-#if ! USE_CPPLIB
- put_back (check_newline ());
-#else
- check_newline ();
- yy_cur--;
-#endif
- if (flag_gnu_xref) GNU_xref_begin (input_filename);
- init_repo (input_filename);
+ c_common_post_options ();
}
+/* Initialization before switch parsing. */
void
-lang_finish ()
+cxx_init_options ()
{
- extern int errorcount, sorrycount;
- if (flag_gnu_xref) GNU_xref_end (errorcount+sorrycount);
-}
-
-char *
-lang_identify ()
-{
- return "cplusplus";
-}
+ c_common_init_options (clk_cplusplus);
-static void
-init_filename_times ()
-{
- this_filename_time = get_time_identifier ("<top level>");
- if (flag_detailed_statistics)
- {
- header_time = 0;
- body_time = my_get_run_time ();
- TREE_INT_CST_LOW (TIME_IDENTIFIER_TIME (this_filename_time))
- = body_time;
- }
+ /* Default exceptions on. */
+ flag_exceptions = 1;
+ /* By default wrap lines at 80 characters. Is getenv ("COLUMNS")
+ preferable? */
+ diagnostic_line_cutoff (global_dc) = 80;
+ /* By default, emit location information once for every
+ diagnostic message. */
+ diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
}
-/* Change by Bryan Boreham, Kewill, Thu Jul 27 09:46:05 1989.
- Stuck this hack in to get the files open correctly; this is called
- in place of init_parse if we are an unexec'd binary. */
-
-#if 0
void
-reinit_lang_specific ()
+cxx_finish ()
{
- init_filename_times ();
- reinit_search_statistics ();
+ if (flag_gnu_xref)
+ GNU_xref_end (errorcount + sorrycount);
+ c_common_finish ();
}
-#endif
static int *
init_cpp_parse ()
{
#ifdef GATHER_STATISTICS
#ifdef REDUCE_LENGTH
- reduce_count = (int *)malloc (sizeof (int) * (REDUCE_LENGTH + 1));
- bzero (reduce_count, sizeof (int) * (REDUCE_LENGTH + 1));
+ reduce_count = (int *) xcalloc (sizeof (int), (REDUCE_LENGTH + 1));
reduce_count += 1;
- token_count = (int *)malloc (sizeof (int) * (TOKEN_LENGTH + 1));
- bzero (token_count, sizeof (int) * (TOKEN_LENGTH + 1));
+ token_count = (int *) xcalloc (sizeof (int), (TOKEN_LENGTH + 1));
token_count += 1;
#endif
#endif
return token_count;
}
-char *
-init_parse (filename)
- char *filename;
-{
- extern int flag_no_gnu_keywords;
- extern int flag_operator_names;
+/* A mapping from tree codes to operator name information. */
+operator_name_info_t operator_name_info[(int) LAST_CPLUS_TREE_CODE];
+/* Similar, but for assignment operators. */
+operator_name_info_t assignment_operator_name_info[(int) LAST_CPLUS_TREE_CODE];
- int i;
+/* Initialize data structures that keep track of operator names. */
-#ifdef MULTIBYTE_CHARS
- /* Change to the native locale for multibyte conversions. */
- setlocale (LC_CTYPE, "");
- literal_codeset = getenv ("LANG");
-#endif
+#define DEF_OPERATOR(NAME, C, M, AR, AP) \
+ CONSTRAINT (C, sizeof "operator " + sizeof NAME <= 256);
+#include "operators.def"
+#undef DEF_OPERATOR
-#if USE_CPPLIB
- parse_in.show_column = 1;
- if (! cpp_start_read (&parse_in, filename))
- abort ();
+static void
+init_operators ()
+{
+ tree identifier;
+ char buffer[256];
+ struct operator_name_info_t *oni;
+
+#define DEF_OPERATOR(NAME, CODE, MANGLING, ARITY, ASSN_P) \
+ sprintf (buffer, ISALPHA (NAME[0]) ? "operator %s" : "operator%s", NAME); \
+ identifier = get_identifier (buffer); \
+ IDENTIFIER_OPNAME_P (identifier) = 1; \
+ \
+ oni = (ASSN_P \
+ ? &assignment_operator_name_info[(int) CODE] \
+ : &operator_name_info[(int) CODE]); \
+ oni->identifier = identifier; \
+ oni->name = NAME; \
+ oni->mangled_name = MANGLING;
+
+#include "operators.def"
+#undef DEF_OPERATOR
+
+ operator_name_info[(int) ERROR_MARK].identifier
+ = get_identifier ("<invalid operator>");
+
+ /* Handle some special cases. These operators are not defined in
+ the language, but can be produced internally. We may need them
+ for error-reporting. (Eventually, we should ensure that this
+ does not happen. Error messages involving these operators will
+ be confusing to users.) */
+
+ operator_name_info [(int) INIT_EXPR].name
+ = operator_name_info [(int) MODIFY_EXPR].name;
+ operator_name_info [(int) EXACT_DIV_EXPR].name = "(ceiling /)";
+ operator_name_info [(int) CEIL_DIV_EXPR].name = "(ceiling /)";
+ operator_name_info [(int) FLOOR_DIV_EXPR].name = "(floor /)";
+ operator_name_info [(int) ROUND_DIV_EXPR].name = "(round /)";
+ operator_name_info [(int) CEIL_MOD_EXPR].name = "(ceiling %)";
+ operator_name_info [(int) FLOOR_MOD_EXPR].name = "(floor %)";
+ operator_name_info [(int) ROUND_MOD_EXPR].name = "(round %)";
+ operator_name_info [(int) ABS_EXPR].name = "abs";
+ operator_name_info [(int) FFS_EXPR].name = "ffs";
+ operator_name_info [(int) BIT_ANDTC_EXPR].name = "&~";
+ operator_name_info [(int) TRUTH_AND_EXPR].name = "strict &&";
+ operator_name_info [(int) TRUTH_OR_EXPR].name = "strict ||";
+ operator_name_info [(int) IN_EXPR].name = "in";
+ operator_name_info [(int) RANGE_EXPR].name = "...";
+ operator_name_info [(int) CONVERT_EXPR].name = "+";
+
+ assignment_operator_name_info [(int) EXACT_DIV_EXPR].name
+ = "(exact /=)";
+ assignment_operator_name_info [(int) CEIL_DIV_EXPR].name
+ = "(ceiling /=)";
+ assignment_operator_name_info [(int) FLOOR_DIV_EXPR].name
+ = "(floor /=)";
+ assignment_operator_name_info [(int) ROUND_DIV_EXPR].name
+ = "(round /=)";
+ assignment_operator_name_info [(int) CEIL_MOD_EXPR].name
+ = "(ceiling %=)";
+ assignment_operator_name_info [(int) FLOOR_MOD_EXPR].name
+ = "(floor %=)";
+ assignment_operator_name_info [(int) ROUND_MOD_EXPR].name
+ = "(round %=)";
+}
+
+/* The reserved keyword table. */
+struct resword
+{
+ const char *const word;
+ const ENUM_BITFIELD(rid) rid : 16;
+ const unsigned int disable : 16;
+};
- /* cpp_start_read always puts at least one line directive into the
- token buffer. We must arrange to read it out here. */
- yy_cur = parse_in.token_buffer;
- yy_lim = CPP_PWRITTEN (&parse_in);
+/* Disable mask. Keywords are disabled if (reswords[i].disable & mask) is
+ _true_. */
+#define D_EXT 0x01 /* GCC extension */
+#define D_ASM 0x02 /* in C99, but has a switch to turn it off */
+#define D_OPNAME 0x04 /* operator names */
+
+CONSTRAINT(ridbits_fit, RID_LAST_MODIFIER < sizeof(unsigned long) * CHAR_BIT);
+
+static const struct resword reswords[] =
+{
+ { "_Complex", RID_COMPLEX, 0 },
+ { "__FUNCTION__", RID_FUNCTION_NAME, 0 },
+ { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
+ { "__alignof", RID_ALIGNOF, 0 },
+ { "__alignof__", RID_ALIGNOF, 0 },
+ { "__asm", RID_ASM, 0 },
+ { "__asm__", RID_ASM, 0 },
+ { "__attribute", RID_ATTRIBUTE, 0 },
+ { "__attribute__", RID_ATTRIBUTE, 0 },
+ { "__builtin_va_arg", RID_VA_ARG, 0 },
+ { "__complex", RID_COMPLEX, 0 },
+ { "__complex__", RID_COMPLEX, 0 },
+ { "__const", RID_CONST, 0 },
+ { "__const__", RID_CONST, 0 },
+ { "__extension__", RID_EXTENSION, 0 },
+ { "__func__", RID_C99_FUNCTION_NAME, 0 },
+ { "__imag", RID_IMAGPART, 0 },
+ { "__imag__", RID_IMAGPART, 0 },
+ { "__inline", RID_INLINE, 0 },
+ { "__inline__", RID_INLINE, 0 },
+ { "__label__", RID_LABEL, 0 },
+ { "__null", RID_NULL, 0 },
+ { "__real", RID_REALPART, 0 },
+ { "__real__", RID_REALPART, 0 },
+ { "__restrict", RID_RESTRICT, 0 },
+ { "__restrict__", RID_RESTRICT, 0 },
+ { "__signed", RID_SIGNED, 0 },
+ { "__signed__", RID_SIGNED, 0 },
+ { "__typeof", RID_TYPEOF, 0 },
+ { "__typeof__", RID_TYPEOF, 0 },
+ { "__volatile", RID_VOLATILE, 0 },
+ { "__volatile__", RID_VOLATILE, 0 },
+ { "asm", RID_ASM, D_ASM },
+ { "and", RID_AND, D_OPNAME },
+ { "and_eq", RID_AND_EQ, D_OPNAME },
+ { "auto", RID_AUTO, 0 },
+ { "bitand", RID_BITAND, D_OPNAME },
+ { "bitor", RID_BITOR, D_OPNAME },
+ { "bool", RID_BOOL, 0 },
+ { "break", RID_BREAK, 0 },
+ { "case", RID_CASE, 0 },
+ { "catch", RID_CATCH, 0 },
+ { "char", RID_CHAR, 0 },
+ { "class", RID_CLASS, 0 },
+ { "compl", RID_COMPL, D_OPNAME },
+ { "const", RID_CONST, 0 },
+ { "const_cast", RID_CONSTCAST, 0 },
+ { "continue", RID_CONTINUE, 0 },
+ { "default", RID_DEFAULT, 0 },
+ { "delete", RID_DELETE, 0 },
+ { "do", RID_DO, 0 },
+ { "double", RID_DOUBLE, 0 },
+ { "dynamic_cast", RID_DYNCAST, 0 },
+ { "else", RID_ELSE, 0 },
+ { "enum", RID_ENUM, 0 },
+ { "explicit", RID_EXPLICIT, 0 },
+ { "export", RID_EXPORT, 0 },
+ { "extern", RID_EXTERN, 0 },
+ { "false", RID_FALSE, 0 },
+ { "float", RID_FLOAT, 0 },
+ { "for", RID_FOR, 0 },
+ { "friend", RID_FRIEND, 0 },
+ { "goto", RID_GOTO, 0 },
+ { "if", RID_IF, 0 },
+ { "inline", RID_INLINE, 0 },
+ { "int", RID_INT, 0 },
+ { "long", RID_LONG, 0 },
+ { "mutable", RID_MUTABLE, 0 },
+ { "namespace", RID_NAMESPACE, 0 },
+ { "new", RID_NEW, 0 },
+ { "not", RID_NOT, D_OPNAME },
+ { "not_eq", RID_NOT_EQ, D_OPNAME },
+ { "operator", RID_OPERATOR, 0 },
+ { "or", RID_OR, D_OPNAME },
+ { "or_eq", RID_OR_EQ, D_OPNAME },
+ { "private", RID_PRIVATE, 0 },
+ { "protected", RID_PROTECTED, 0 },
+ { "public", RID_PUBLIC, 0 },
+ { "register", RID_REGISTER, 0 },
+ { "reinterpret_cast", RID_REINTCAST, 0 },
+ { "return", RID_RETURN, 0 },
+ { "short", RID_SHORT, 0 },
+ { "signed", RID_SIGNED, 0 },
+ { "sizeof", RID_SIZEOF, 0 },
+ { "static", RID_STATIC, 0 },
+ { "static_cast", RID_STATCAST, 0 },
+ { "struct", RID_STRUCT, 0 },
+ { "switch", RID_SWITCH, 0 },
+ { "template", RID_TEMPLATE, 0 },
+ { "this", RID_THIS, 0 },
+ { "throw", RID_THROW, 0 },
+ { "true", RID_TRUE, 0 },
+ { "try", RID_TRY, 0 },
+ { "typedef", RID_TYPEDEF, 0 },
+ { "typename", RID_TYPENAME, 0 },
+ { "typeid", RID_TYPEID, 0 },
+ { "typeof", RID_TYPEOF, D_ASM|D_EXT },
+ { "union", RID_UNION, 0 },
+ { "unsigned", RID_UNSIGNED, 0 },
+ { "using", RID_USING, 0 },
+ { "virtual", RID_VIRTUAL, 0 },
+ { "void", RID_VOID, 0 },
+ { "volatile", RID_VOLATILE, 0 },
+ { "wchar_t", RID_WCHAR, 0 },
+ { "while", RID_WHILE, 0 },
+ { "xor", RID_XOR, D_OPNAME },
+ { "xor_eq", RID_XOR_EQ, D_OPNAME },
-#else
- /* Open input file. */
- if (filename == 0 || !strcmp (filename, "-"))
+};
+#define N_reswords (sizeof reswords / sizeof (struct resword))
+
+/* Table mapping from RID_* constants to yacc token numbers.
+ Unfortunately we have to have entries for all the keywords in all
+ three languages. */
+const short rid_to_yy[RID_MAX] =
+{
+ /* RID_STATIC */ SCSPEC,
+ /* RID_UNSIGNED */ TYPESPEC,
+ /* RID_LONG */ TYPESPEC,
+ /* RID_CONST */ CV_QUALIFIER,
+ /* RID_EXTERN */ SCSPEC,
+ /* RID_REGISTER */ SCSPEC,
+ /* RID_TYPEDEF */ SCSPEC,
+ /* RID_SHORT */ TYPESPEC,
+ /* RID_INLINE */ SCSPEC,
+ /* RID_VOLATILE */ CV_QUALIFIER,
+ /* RID_SIGNED */ TYPESPEC,
+ /* RID_AUTO */ SCSPEC,
+ /* RID_RESTRICT */ CV_QUALIFIER,
+
+ /* C extensions. Bounded pointers are not yet in C++ */
+ /* RID_BOUNDED */ 0,
+ /* RID_UNBOUNDED */ 0,
+ /* RID_COMPLEX */ TYPESPEC,
+
+ /* C++ */
+ /* RID_FRIEND */ SCSPEC,
+ /* RID_VIRTUAL */ SCSPEC,
+ /* RID_EXPLICIT */ SCSPEC,
+ /* RID_EXPORT */ EXPORT,
+ /* RID_MUTABLE */ SCSPEC,
+
+ /* ObjC */
+ /* RID_IN */ 0,
+ /* RID_OUT */ 0,
+ /* RID_INOUT */ 0,
+ /* RID_BYCOPY */ 0,
+ /* RID_BYREF */ 0,
+ /* RID_ONEWAY */ 0,
+
+ /* C */
+ /* RID_INT */ TYPESPEC,
+ /* RID_CHAR */ TYPESPEC,
+ /* RID_FLOAT */ TYPESPEC,
+ /* RID_DOUBLE */ TYPESPEC,
+ /* RID_VOID */ TYPESPEC,
+ /* RID_ENUM */ ENUM,
+ /* RID_STRUCT */ AGGR,
+ /* RID_UNION */ AGGR,
+ /* RID_IF */ IF,
+ /* RID_ELSE */ ELSE,
+ /* RID_WHILE */ WHILE,
+ /* RID_DO */ DO,
+ /* RID_FOR */ FOR,
+ /* RID_SWITCH */ SWITCH,
+ /* RID_CASE */ CASE,
+ /* RID_DEFAULT */ DEFAULT,
+ /* RID_BREAK */ BREAK,
+ /* RID_CONTINUE */ CONTINUE,
+ /* RID_RETURN */ RETURN_KEYWORD,
+ /* RID_GOTO */ GOTO,
+ /* RID_SIZEOF */ SIZEOF,
+
+ /* C extensions */
+ /* RID_ASM */ ASM_KEYWORD,
+ /* RID_TYPEOF */ TYPEOF,
+ /* RID_ALIGNOF */ ALIGNOF,
+ /* RID_ATTRIBUTE */ ATTRIBUTE,
+ /* RID_VA_ARG */ VA_ARG,
+ /* RID_EXTENSION */ EXTENSION,
+ /* RID_IMAGPART */ IMAGPART,
+ /* RID_REALPART */ REALPART,
+ /* RID_LABEL */ LABEL,
+ /* RID_PTRBASE */ 0,
+ /* RID_PTREXTENT */ 0,
+ /* RID_PTRVALUE */ 0,
+ /* RID_CHOOSE_EXPR */ 0,
+ /* RID_TYPES_COMPATIBLE_P */ 0,
+
+ /* RID_FUNCTION_NAME */ VAR_FUNC_NAME,
+ /* RID_PRETTY_FUNCTION_NAME */ VAR_FUNC_NAME,
+ /* RID_c99_FUNCTION_NAME */ VAR_FUNC_NAME,
+
+ /* C++ */
+ /* RID_BOOL */ TYPESPEC,
+ /* RID_WCHAR */ TYPESPEC,
+ /* RID_CLASS */ AGGR,
+ /* RID_PUBLIC */ VISSPEC,
+ /* RID_PRIVATE */ VISSPEC,
+ /* RID_PROTECTED */ VISSPEC,
+ /* RID_TEMPLATE */ TEMPLATE,
+ /* RID_NULL */ CONSTANT,
+ /* RID_CATCH */ CATCH,
+ /* RID_DELETE */ DELETE,
+ /* RID_FALSE */ CXX_FALSE,
+ /* RID_NAMESPACE */ NAMESPACE,
+ /* RID_NEW */ NEW,
+ /* RID_OPERATOR */ OPERATOR,
+ /* RID_THIS */ THIS,
+ /* RID_THROW */ THROW,
+ /* RID_TRUE */ CXX_TRUE,
+ /* RID_TRY */ TRY,
+ /* RID_TYPENAME */ TYPENAME_KEYWORD,
+ /* RID_TYPEID */ TYPEID,
+ /* RID_USING */ USING,
+
+ /* casts */
+ /* RID_CONSTCAST */ CONST_CAST,
+ /* RID_DYNCAST */ DYNAMIC_CAST,
+ /* RID_REINTCAST */ REINTERPRET_CAST,
+ /* RID_STATCAST */ STATIC_CAST,
+
+ /* alternate spellings */
+ /* RID_AND */ ANDAND,
+ /* RID_AND_EQ */ ASSIGN,
+ /* RID_NOT */ '!',
+ /* RID_NOT_EQ */ EQCOMPARE,
+ /* RID_OR */ OROR,
+ /* RID_OR_EQ */ ASSIGN,
+ /* RID_XOR */ '^',
+ /* RID_XOR_EQ */ ASSIGN,
+ /* RID_BITAND */ '&',
+ /* RID_BITOR */ '|',
+ /* RID_COMPL */ '~',
+
+ /* Objective C */
+ /* RID_ID */ 0,
+ /* RID_AT_ENCODE */ 0,
+ /* RID_AT_END */ 0,
+ /* RID_AT_CLASS */ 0,
+ /* RID_AT_ALIAS */ 0,
+ /* RID_AT_DEFS */ 0,
+ /* RID_AT_PRIVATE */ 0,
+ /* RID_AT_PROTECTED */ 0,
+ /* RID_AT_PUBLIC */ 0,
+ /* RID_AT_PROTOCOL */ 0,
+ /* RID_AT_SELECTOR */ 0,
+ /* RID_AT_INTERFACE */ 0,
+ /* RID_AT_IMPLEMENTATION */ 0
+};
+
+void
+init_reswords ()
+{
+ unsigned int i;
+ tree id;
+ int mask = ((flag_operator_names ? 0 : D_OPNAME)
+ | (flag_no_asm ? D_ASM : 0)
+ | (flag_no_gnu_keywords ? D_EXT : 0));
+
+ /* It is not necessary to register ridpointers as a GC root, because
+ all the trees it points to are permanently interned in the
+ get_identifier hash anyway. */
+ ridpointers = (tree *) xcalloc ((int) RID_MAX, sizeof (tree));
+ for (i = 0; i < N_reswords; i++)
{
- finput = stdin;
- filename = "stdin";
+ id = get_identifier (reswords[i].word);
+ C_RID_CODE (id) = reswords[i].rid;
+ ridpointers [(int) reswords[i].rid] = id;
+ if (! (reswords[i].disable & mask))
+ C_IS_RESERVED_WORD (id) = 1;
}
- else
- finput = fopen (filename, "r");
- if (finput == 0)
- pfatal_with_name (filename);
+}
-#ifdef IO_BUFFER_SIZE
- setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
-#endif
-#endif /* !USE_CPPLIB */
+static void
+init_cp_pragma ()
+{
+ cpp_register_pragma (parse_in, 0, "vtable", handle_pragma_vtable);
+ cpp_register_pragma (parse_in, 0, "unit", handle_pragma_unit);
- /* Initialize the lookahead machinery. */
- init_spew ();
+ cpp_register_pragma (parse_in, 0, "interface", handle_pragma_interface);
+ cpp_register_pragma (parse_in, 0, "implementation",
+ handle_pragma_implementation);
+
+ cpp_register_pragma (parse_in, "GCC", "interface", handle_pragma_interface);
+ cpp_register_pragma (parse_in, "GCC", "implementation",
+ handle_pragma_implementation);
+ cpp_register_pragma (parse_in, "GCC", "java_exceptions",
+ handle_pragma_java_exceptions);
+}
- /* Make identifier nodes long enough for the language-specific slots. */
- set_identifier_size (sizeof (struct lang_identifier));
+/* Initialize the C++ front end. This function is very sensitive to
+ the exact order that things are done here. It would be nice if the
+ initialization done by this routine were moved to its subroutines,
+ and the ordering dependencies clarified and reduced. */
+const char *
+cxx_init (filename)
+ const char *filename;
+{
decl_printable_name = lang_printable_name;
+ input_filename = "<internal>";
+ init_reswords ();
+ init_spew ();
+ init_tree ();
init_cplus_expand ();
+ init_cp_semantics ();
- bcopy (cplus_tree_code_type,
- tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE,
- (int)LAST_CPLUS_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE);
- bcopy ((char *)cplus_tree_code_length,
- (char *)(tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE),
- (LAST_CPLUS_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE) * sizeof (int));
- bcopy ((char *)cplus_tree_code_name,
- (char *)(tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE),
- (LAST_CPLUS_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE) * sizeof (char *));
-
- opname_tab = (char **)oballoc ((int)LAST_CPLUS_TREE_CODE * sizeof (char *));
- bzero ((char *)opname_tab, (int)LAST_CPLUS_TREE_CODE * sizeof (char *));
- assignop_tab = (char **)oballoc ((int)LAST_CPLUS_TREE_CODE * sizeof (char *));
- bzero ((char *)assignop_tab, (int)LAST_CPLUS_TREE_CODE * sizeof (char *));
-
- ansi_opname[0] = get_identifier ("<invalid operator>");
- for (i = 0; i < (int) LAST_CPLUS_TREE_CODE; i++)
- {
- ansi_opname[i] = ansi_opname[0];
- ansi_assopname[i] = ansi_opname[0];
- }
+ add_c_tree_codes ();
- ansi_opname[(int) MULT_EXPR] = get_identifier ("__ml");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) MULT_EXPR]) = 1;
- ansi_opname[(int) INDIRECT_REF] = ansi_opname[(int) MULT_EXPR];
- ansi_assopname[(int) MULT_EXPR] = get_identifier ("__aml");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) MULT_EXPR]) = 1;
- ansi_assopname[(int) INDIRECT_REF] = ansi_assopname[(int) MULT_EXPR];
- ansi_opname[(int) TRUNC_MOD_EXPR] = get_identifier ("__md");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) TRUNC_MOD_EXPR]) = 1;
- ansi_assopname[(int) TRUNC_MOD_EXPR] = get_identifier ("__amd");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) TRUNC_MOD_EXPR]) = 1;
- ansi_opname[(int) CEIL_MOD_EXPR] = ansi_opname[(int) TRUNC_MOD_EXPR];
- ansi_opname[(int) FLOOR_MOD_EXPR] = ansi_opname[(int) TRUNC_MOD_EXPR];
- ansi_opname[(int) ROUND_MOD_EXPR] = ansi_opname[(int) TRUNC_MOD_EXPR];
- ansi_opname[(int) MINUS_EXPR] = get_identifier ("__mi");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) MINUS_EXPR]) = 1;
- ansi_opname[(int) NEGATE_EXPR] = ansi_opname[(int) MINUS_EXPR];
- ansi_assopname[(int) MINUS_EXPR] = get_identifier ("__ami");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) MINUS_EXPR]) = 1;
- ansi_assopname[(int) NEGATE_EXPR] = ansi_assopname[(int) MINUS_EXPR];
- ansi_opname[(int) RSHIFT_EXPR] = get_identifier ("__rs");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) RSHIFT_EXPR]) = 1;
- ansi_assopname[(int) RSHIFT_EXPR] = get_identifier ("__ars");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) RSHIFT_EXPR]) = 1;
- ansi_opname[(int) NE_EXPR] = get_identifier ("__ne");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) NE_EXPR]) = 1;
- ansi_opname[(int) GT_EXPR] = get_identifier ("__gt");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) GT_EXPR]) = 1;
- ansi_opname[(int) GE_EXPR] = get_identifier ("__ge");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) GE_EXPR]) = 1;
- ansi_opname[(int) BIT_IOR_EXPR] = get_identifier ("__or");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) BIT_IOR_EXPR]) = 1;
- ansi_assopname[(int) BIT_IOR_EXPR] = get_identifier ("__aor");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) BIT_IOR_EXPR]) = 1;
- ansi_opname[(int) TRUTH_ANDIF_EXPR] = get_identifier ("__aa");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) TRUTH_ANDIF_EXPR]) = 1;
- ansi_opname[(int) TRUTH_NOT_EXPR] = get_identifier ("__nt");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) TRUTH_NOT_EXPR]) = 1;
- ansi_opname[(int) PREINCREMENT_EXPR] = get_identifier ("__pp");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) PREINCREMENT_EXPR]) = 1;
- ansi_opname[(int) POSTINCREMENT_EXPR] = ansi_opname[(int) PREINCREMENT_EXPR];
- ansi_opname[(int) MODIFY_EXPR] = get_identifier ("__as");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) MODIFY_EXPR]) = 1;
- ansi_assopname[(int) NOP_EXPR] = ansi_opname[(int) MODIFY_EXPR];
- ansi_opname[(int) COMPOUND_EXPR] = get_identifier ("__cm");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) COMPOUND_EXPR]) = 1;
- ansi_opname[(int) EXACT_DIV_EXPR] = get_identifier ("__dv");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) EXACT_DIV_EXPR]) = 1;
- ansi_assopname[(int) EXACT_DIV_EXPR] = get_identifier ("__adv");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) EXACT_DIV_EXPR]) = 1;
- ansi_opname[(int) TRUNC_DIV_EXPR] = ansi_opname[(int) EXACT_DIV_EXPR];
- ansi_opname[(int) CEIL_DIV_EXPR] = ansi_opname[(int) EXACT_DIV_EXPR];
- ansi_opname[(int) FLOOR_DIV_EXPR] = ansi_opname[(int) EXACT_DIV_EXPR];
- ansi_opname[(int) ROUND_DIV_EXPR] = ansi_opname[(int) EXACT_DIV_EXPR];
- ansi_opname[(int) PLUS_EXPR] = get_identifier ("__pl");
- ansi_assopname[(int) TRUNC_DIV_EXPR] = ansi_assopname[(int) EXACT_DIV_EXPR];
- ansi_assopname[(int) CEIL_DIV_EXPR] = ansi_assopname[(int) EXACT_DIV_EXPR];
- ansi_assopname[(int) FLOOR_DIV_EXPR] = ansi_assopname[(int) EXACT_DIV_EXPR];
- ansi_assopname[(int) ROUND_DIV_EXPR] = ansi_assopname[(int) EXACT_DIV_EXPR];
- IDENTIFIER_OPNAME_P (ansi_opname[(int) PLUS_EXPR]) = 1;
- ansi_assopname[(int) PLUS_EXPR] = get_identifier ("__apl");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) PLUS_EXPR]) = 1;
- ansi_opname[(int) CONVERT_EXPR] = ansi_opname[(int) PLUS_EXPR];
- ansi_assopname[(int) CONVERT_EXPR] = ansi_assopname[(int) PLUS_EXPR];
- ansi_opname[(int) LSHIFT_EXPR] = get_identifier ("__ls");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) LSHIFT_EXPR]) = 1;
- ansi_assopname[(int) LSHIFT_EXPR] = get_identifier ("__als");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) LSHIFT_EXPR]) = 1;
- ansi_opname[(int) EQ_EXPR] = get_identifier ("__eq");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) EQ_EXPR]) = 1;
- ansi_opname[(int) LT_EXPR] = get_identifier ("__lt");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) LT_EXPR]) = 1;
- ansi_opname[(int) LE_EXPR] = get_identifier ("__le");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) LE_EXPR]) = 1;
- ansi_opname[(int) BIT_AND_EXPR] = get_identifier ("__ad");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) BIT_AND_EXPR]) = 1;
- ansi_assopname[(int) BIT_AND_EXPR] = get_identifier ("__aad");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) BIT_AND_EXPR]) = 1;
- ansi_opname[(int) ADDR_EXPR] = ansi_opname[(int) BIT_AND_EXPR];
- ansi_assopname[(int) ADDR_EXPR] = ansi_assopname[(int) BIT_AND_EXPR];
- ansi_opname[(int) BIT_XOR_EXPR] = get_identifier ("__er");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) BIT_XOR_EXPR]) = 1;
- ansi_assopname[(int) BIT_XOR_EXPR] = get_identifier ("__aer");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) BIT_XOR_EXPR]) = 1;
- ansi_opname[(int) TRUTH_ORIF_EXPR] = get_identifier ("__oo");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) TRUTH_ORIF_EXPR]) = 1;
- ansi_opname[(int) BIT_NOT_EXPR] = get_identifier ("__co");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) BIT_NOT_EXPR]) = 1;
- ansi_opname[(int) PREDECREMENT_EXPR] = get_identifier ("__mm");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) PREDECREMENT_EXPR]) = 1;
- ansi_opname[(int) POSTDECREMENT_EXPR] = ansi_opname[(int) PREDECREMENT_EXPR];
- ansi_opname[(int) COMPONENT_REF] = get_identifier ("__rf");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) COMPONENT_REF]) = 1;
- ansi_opname[(int) MEMBER_REF] = get_identifier ("__rm");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) MEMBER_REF]) = 1;
- ansi_opname[(int) CALL_EXPR] = get_identifier ("__cl");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) CALL_EXPR]) = 1;
- ansi_opname[(int) ARRAY_REF] = get_identifier ("__vc");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) ARRAY_REF]) = 1;
- ansi_opname[(int) NEW_EXPR] = get_identifier ("__nw");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) NEW_EXPR]) = 1;
- ansi_opname[(int) DELETE_EXPR] = get_identifier ("__dl");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) DELETE_EXPR]) = 1;
- ansi_opname[(int) VEC_NEW_EXPR] = get_identifier ("__vn");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) VEC_NEW_EXPR]) = 1;
- ansi_opname[(int) VEC_DELETE_EXPR] = get_identifier ("__vd");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) VEC_DELETE_EXPR]) = 1;
- ansi_opname[(int) TYPE_EXPR] = get_identifier (OPERATOR_TYPENAME_FORMAT);
- IDENTIFIER_OPNAME_P (ansi_opname[(int) TYPE_EXPR]) = 1;
-
- /* This is not true: these operators are not defined in ANSI,
- but we need them anyway. */
- ansi_opname[(int) MIN_EXPR] = get_identifier ("__mn");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) MIN_EXPR]) = 1;
- ansi_opname[(int) MAX_EXPR] = get_identifier ("__mx");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) MAX_EXPR]) = 1;
- ansi_opname[(int) COND_EXPR] = get_identifier ("__cn");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) COND_EXPR]) = 1;
- ansi_opname[(int) SIZEOF_EXPR] = get_identifier ("__sz");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) SIZEOF_EXPR]) = 1;
+ memcpy (tree_code_type + (int) LAST_C_TREE_CODE,
+ cplus_tree_code_type,
+ (int)LAST_CPLUS_TREE_CODE - (int)LAST_C_TREE_CODE);
+ memcpy (tree_code_length + (int) LAST_C_TREE_CODE,
+ cplus_tree_code_length,
+ (LAST_CPLUS_TREE_CODE - (int)LAST_C_TREE_CODE) * sizeof (int));
+ memcpy (tree_code_name + (int) LAST_C_TREE_CODE,
+ cplus_tree_code_name,
+ (LAST_CPLUS_TREE_CODE - (int)LAST_C_TREE_CODE) * sizeof (char *));
+ init_operators ();
init_method ();
init_error ();
- gcc_obstack_init (&inline_text_obstack);
- inline_text_firstobj = (char *) obstack_alloc (&inline_text_obstack, 0);
- /* Start it at 0, because check_newline is called at the very beginning
- and will increment it to 1. */
- lineno = 0;
- input_filename = "<internal>";
current_function_decl = NULL;
- maxtoken = 40;
- token_buffer = (char *) xmalloc (maxtoken + 2);
-
- ridpointers[(int) RID_INT] = get_identifier ("int");
- ridpointers[(int) RID_BOOL] = get_identifier ("bool");
- ridpointers[(int) RID_CHAR] = get_identifier ("char");
- ridpointers[(int) RID_VOID] = get_identifier ("void");
- ridpointers[(int) RID_FLOAT] = get_identifier ("float");
- ridpointers[(int) RID_DOUBLE] = get_identifier ("double");
- ridpointers[(int) RID_SHORT] = get_identifier ("short");
- ridpointers[(int) RID_LONG] = get_identifier ("long");
- ridpointers[(int) RID_UNSIGNED] = get_identifier ("unsigned");
- ridpointers[(int) RID_SIGNED] = get_identifier ("signed");
- ridpointers[(int) RID_INLINE] = get_identifier ("inline");
- ridpointers[(int) RID_CONST] = get_identifier ("const");
- ridpointers[(int) RID_VOLATILE] = get_identifier ("volatile");
- ridpointers[(int) RID_RESTRICT] = get_identifier ("__restrict");
- ridpointers[(int) RID_AUTO] = get_identifier ("auto");
- ridpointers[(int) RID_STATIC] = get_identifier ("static");
- ridpointers[(int) RID_EXTERN] = get_identifier ("extern");
- ridpointers[(int) RID_TYPEDEF] = get_identifier ("typedef");
- ridpointers[(int) RID_REGISTER] = get_identifier ("register");
- ridpointers[(int) RID_COMPLEX] = get_identifier ("__complex");
-
- /* C++ extensions. These are probably not correctly named. */
- ridpointers[(int) RID_WCHAR] = get_identifier ("__wchar_t");
class_type_node = build_int_2 (class_type, 0);
TREE_TYPE (class_type_node) = class_type_node;
ridpointers[(int) RID_CLASS] = class_type_node;
record_type_node = build_int_2 (record_type, 0);
TREE_TYPE (record_type_node) = record_type_node;
- ridpointers[(int) RID_RECORD] = record_type_node;
+ ridpointers[(int) RID_STRUCT] = record_type_node;
union_type_node = build_int_2 (union_type, 0);
TREE_TYPE (union_type_node) = union_type_node;
@@ -717,186 +719,28 @@ init_parse (filename)
TREE_TYPE (enum_type_node) = enum_type_node;
ridpointers[(int) RID_ENUM] = enum_type_node;
- ridpointers[(int) RID_VIRTUAL] = get_identifier ("virtual");
- ridpointers[(int) RID_EXPLICIT] = get_identifier ("explicit");
- ridpointers[(int) RID_EXPORT] = get_identifier ("export");
- ridpointers[(int) RID_FRIEND] = get_identifier ("friend");
-
- ridpointers[(int) RID_PUBLIC] = get_identifier ("public");
- ridpointers[(int) RID_PRIVATE] = get_identifier ("private");
- ridpointers[(int) RID_PROTECTED] = get_identifier ("protected");
- ridpointers[(int) RID_TEMPLATE] = get_identifier ("template");
- /* This is for ANSI C++. */
- ridpointers[(int) RID_MUTABLE] = get_identifier ("mutable");
-
- /* Signature handling extensions. */
- signature_type_node = build_int_2 (signature_type, 0);
- TREE_TYPE (signature_type_node) = signature_type_node;
- ridpointers[(int) RID_SIGNATURE] = signature_type_node;
-
- /* Create the built-in __null node. Note that we can't yet call for
- type_for_size here because integer_type_node and so forth are not
- set up. Therefore, we don't set the type of these nodes until
- init_decl_processing. */
+ cxx_init_decl_processing ();
+
+ /* Create the built-in __null node. */
null_node = build_int_2 (0, 0);
+ TREE_TYPE (null_node) = type_for_size (POINTER_SIZE, 0);
ridpointers[RID_NULL] = null_node;
- opname_tab[(int) COMPONENT_REF] = "->";
- opname_tab[(int) MEMBER_REF] = "->*";
- opname_tab[(int) INDIRECT_REF] = "*";
- opname_tab[(int) ARRAY_REF] = "[]";
- opname_tab[(int) MODIFY_EXPR] = "=";
- opname_tab[(int) NEW_EXPR] = "new";
- opname_tab[(int) DELETE_EXPR] = "delete";
- opname_tab[(int) VEC_NEW_EXPR] = "new []";
- opname_tab[(int) VEC_DELETE_EXPR] = "delete []";
- opname_tab[(int) COND_EXPR] = "?:";
- opname_tab[(int) CALL_EXPR] = "()";
- opname_tab[(int) PLUS_EXPR] = "+";
- opname_tab[(int) MINUS_EXPR] = "-";
- opname_tab[(int) MULT_EXPR] = "*";
- opname_tab[(int) TRUNC_DIV_EXPR] = "/";
- opname_tab[(int) CEIL_DIV_EXPR] = "(ceiling /)";
- opname_tab[(int) FLOOR_DIV_EXPR] = "(floor /)";
- opname_tab[(int) ROUND_DIV_EXPR] = "(round /)";
- opname_tab[(int) TRUNC_MOD_EXPR] = "%";
- opname_tab[(int) CEIL_MOD_EXPR] = "(ceiling %)";
- opname_tab[(int) FLOOR_MOD_EXPR] = "(floor %)";
- opname_tab[(int) ROUND_MOD_EXPR] = "(round %)";
- opname_tab[(int) NEGATE_EXPR] = "-";
- opname_tab[(int) MIN_EXPR] = "<?";
- opname_tab[(int) MAX_EXPR] = ">?";
- opname_tab[(int) ABS_EXPR] = "abs";
- opname_tab[(int) FFS_EXPR] = "ffs";
- opname_tab[(int) LSHIFT_EXPR] = "<<";
- opname_tab[(int) RSHIFT_EXPR] = ">>";
- opname_tab[(int) BIT_IOR_EXPR] = "|";
- opname_tab[(int) BIT_XOR_EXPR] = "^";
- opname_tab[(int) BIT_AND_EXPR] = "&";
- opname_tab[(int) BIT_ANDTC_EXPR] = "&~";
- opname_tab[(int) BIT_NOT_EXPR] = "~";
- opname_tab[(int) TRUTH_ANDIF_EXPR] = "&&";
- opname_tab[(int) TRUTH_ORIF_EXPR] = "||";
- opname_tab[(int) TRUTH_AND_EXPR] = "strict &&";
- opname_tab[(int) TRUTH_OR_EXPR] = "strict ||";
- opname_tab[(int) TRUTH_NOT_EXPR] = "!";
- opname_tab[(int) LT_EXPR] = "<";
- opname_tab[(int) LE_EXPR] = "<=";
- opname_tab[(int) GT_EXPR] = ">";
- opname_tab[(int) GE_EXPR] = ">=";
- opname_tab[(int) EQ_EXPR] = "==";
- opname_tab[(int) NE_EXPR] = "!=";
- opname_tab[(int) IN_EXPR] = "in";
- opname_tab[(int) RANGE_EXPR] = "...";
- opname_tab[(int) CONVERT_EXPR] = "+";
- opname_tab[(int) ADDR_EXPR] = "&";
- opname_tab[(int) PREDECREMENT_EXPR] = "--";
- opname_tab[(int) PREINCREMENT_EXPR] = "++";
- opname_tab[(int) POSTDECREMENT_EXPR] = "--";
- opname_tab[(int) POSTINCREMENT_EXPR] = "++";
- opname_tab[(int) COMPOUND_EXPR] = ",";
-
- assignop_tab[(int) NOP_EXPR] = "=";
- assignop_tab[(int) PLUS_EXPR] = "+=";
- assignop_tab[(int) CONVERT_EXPR] = "+=";
- assignop_tab[(int) MINUS_EXPR] = "-=";
- assignop_tab[(int) NEGATE_EXPR] = "-=";
- assignop_tab[(int) MULT_EXPR] = "*=";
- assignop_tab[(int) INDIRECT_REF] = "*=";
- assignop_tab[(int) TRUNC_DIV_EXPR] = "/=";
- assignop_tab[(int) EXACT_DIV_EXPR] = "(exact /=)";
- assignop_tab[(int) CEIL_DIV_EXPR] = "(ceiling /=)";
- assignop_tab[(int) FLOOR_DIV_EXPR] = "(floor /=)";
- assignop_tab[(int) ROUND_DIV_EXPR] = "(round /=)";
- assignop_tab[(int) TRUNC_MOD_EXPR] = "%=";
- assignop_tab[(int) CEIL_MOD_EXPR] = "(ceiling %=)";
- assignop_tab[(int) FLOOR_MOD_EXPR] = "(floor %=)";
- assignop_tab[(int) ROUND_MOD_EXPR] = "(round %=)";
- assignop_tab[(int) MIN_EXPR] = "<?=";
- assignop_tab[(int) MAX_EXPR] = ">?=";
- assignop_tab[(int) LSHIFT_EXPR] = "<<=";
- assignop_tab[(int) RSHIFT_EXPR] = ">>=";
- assignop_tab[(int) BIT_IOR_EXPR] = "|=";
- assignop_tab[(int) BIT_XOR_EXPR] = "^=";
- assignop_tab[(int) BIT_AND_EXPR] = "&=";
- assignop_tab[(int) ADDR_EXPR] = "&=";
-
- init_filename_times ();
-
- /* Some options inhibit certain reserved words.
- Clear those words out of the hash table so they won't be recognized. */
-#define UNSET_RESERVED_WORD(STRING) \
- do { struct resword *s = is_reserved_word (STRING, sizeof (STRING) - 1); \
- if (s) s->name = ""; } while (0)
-
-#if 0
- /* let's parse things, and if they use it, then give them an error. */
- if (!flag_exceptions)
- {
- UNSET_RESERVED_WORD ("throw");
- UNSET_RESERVED_WORD ("try");
- UNSET_RESERVED_WORD ("catch");
- }
-#endif
-
- if (!flag_rtti || flag_no_gnu_keywords)
- {
- UNSET_RESERVED_WORD ("classof");
- UNSET_RESERVED_WORD ("headof");
- }
-
- if (! flag_handle_signatures || flag_no_gnu_keywords)
- {
- /* Easiest way to not recognize signature
- handling extensions... */
- UNSET_RESERVED_WORD ("signature");
- UNSET_RESERVED_WORD ("sigof");
- }
- if (flag_no_asm || flag_no_gnu_keywords)
- UNSET_RESERVED_WORD ("typeof");
- if (! flag_operator_names)
- {
- /* These are new ANSI keywords that may break code. */
- UNSET_RESERVED_WORD ("and");
- UNSET_RESERVED_WORD ("and_eq");
- UNSET_RESERVED_WORD ("bitand");
- UNSET_RESERVED_WORD ("bitor");
- UNSET_RESERVED_WORD ("compl");
- UNSET_RESERVED_WORD ("not");
- UNSET_RESERVED_WORD ("not_eq");
- UNSET_RESERVED_WORD ("or");
- UNSET_RESERVED_WORD ("or_eq");
- UNSET_RESERVED_WORD ("xor");
- UNSET_RESERVED_WORD ("xor_eq");
- }
-
token_count = init_cpp_parse ();
interface_unknown = 1;
- return filename;
-}
+ filename = c_common_init (filename);
-void
-finish_parse ()
-{
-#if USE_CPPLIB
- cpp_finish (&parse_in);
-#else
- fclose (finput);
-#endif
-}
+ init_cp_pragma ();
-void
-reinit_parse_for_function ()
-{
- current_base_init_list = NULL_TREE;
- current_member_init_list = NULL_TREE;
+ if (flag_gnu_xref)
+ GNU_xref_begin (filename);
+ init_repo (filename);
+
+ return filename;
}
-#ifdef __GNUC__
-__inline
-#endif
-void
+inline void
yyprint (file, yychar, yylval)
FILE *file;
int yychar;
@@ -909,6 +753,7 @@ yyprint (file, yychar, yylval)
case TYPENAME:
case TYPESPEC:
case PTYPENAME:
+ case PFUNCNAME:
case IDENTIFIER_DEFN:
case TYPENAME_DEFN:
case PTYPENAME_DEFN:
@@ -924,6 +769,7 @@ yyprint (file, yychar, yylval)
if (IDENTIFIER_POINTER (t))
fprintf (file, " `%s'", IDENTIFIER_POINTER (t));
break;
+
case AGGR:
if (yylval.ttype == class_type_node)
fprintf (file, " `class'");
@@ -933,10 +779,32 @@ yyprint (file, yychar, yylval)
fprintf (file, " `union'");
else if (yylval.ttype == enum_type_node)
fprintf (file, " `enum'");
- else if (yylval.ttype == signature_type_node)
- fprintf (file, " `signature'");
else
- my_friendly_abort (80);
+ abort ();
+ break;
+
+ case CONSTANT:
+ t = yylval.ttype;
+ if (TREE_CODE (t) == INTEGER_CST)
+ fprintf (file,
+#if HOST_BITS_PER_WIDE_INT == 64
+#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+ " 0x%x%016x",
+#else
+#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+ " 0x%lx%016lx",
+#else
+ " 0x%llx%016llx",
+#endif
+#endif
+#else
+#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
+ " 0x%lx%08lx",
+#else
+ " 0x%x%08x",
+#endif
+#endif
+ TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t));
break;
}
}
@@ -986,7 +854,7 @@ print_parse_statistics ()
int i;
int maxlen = REDUCE_LENGTH;
unsigned *sorted;
-
+
if (reduce_count[-1] == 0)
return;
@@ -1032,65 +900,40 @@ print_parse_statistics ()
in order to build the compiler. */
void
-set_yydebug (value)
+cxx_set_yydebug (value)
int value;
{
#if YYDEBUG != 0
extern int yydebug;
yydebug = value;
#else
- warning ("YYDEBUG not defined.");
+ warning ("YYDEBUG not defined");
#endif
}
-
-/* Functions and data structures for #pragma interface.
-
- `#pragma implementation' means that the main file being compiled
- is considered to implement (provide) the classes that appear in
- its main body. I.e., if this is file "foo.cc", and class `bar'
- is defined in "foo.cc", then we say that "foo.cc implements bar".
-
- All main input files "implement" themselves automagically.
-
- `#pragma interface' means that unless this file (of the form "foo.h"
- is not presently being included by file "foo.cc", the
- CLASSTYPE_INTERFACE_ONLY bit gets set. The effect is that none
- of the vtables nor any of the inline functions defined in foo.h
- will ever be output.
-
- There are cases when we want to link files such as "defs.h" and
- "main.cc". In this case, we give "defs.h" a `#pragma interface',
- and "main.cc" has `#pragma implementation "defs.h"'. */
-
-struct impl_files
-{
- char *filename;
- struct impl_files *next;
-};
-
-static struct impl_files *impl_file_chain;
-
/* Helper function to load global variables with interface
information. */
void
extract_interface_info ()
{
- tree fileinfo = 0;
+ struct c_fileinfo *finfo = 0;
if (flag_alt_external_templates)
{
- struct tinst_level *til = tinst_for_decl ();
-
+ tree til = tinst_for_decl ();
+
if (til)
- fileinfo = get_time_identifier (til->file);
+ finfo = get_fileinfo (TINST_FILE (til));
}
- if (!fileinfo)
- fileinfo = get_time_identifier (input_filename);
- fileinfo = TIME_IDENTIFIER_FILEINFO (fileinfo);
- interface_only = TREE_INT_CST_LOW (fileinfo);
- interface_unknown = TREE_INT_CST_HIGH (fileinfo);
+ if (!finfo)
+ finfo = get_fileinfo (input_filename);
+
+ interface_only = finfo->interface_only;
+ interface_unknown = finfo->interface_unknown;
+
+ /* This happens to be a convenient place to put this. */
+ if (flag_gnu_xref) GNU_xref_file (input_filename);
}
/* Return nonzero if S is not considered part of an
@@ -1120,7 +963,7 @@ interface_strcmp (s)
return 0;
/* Don't get faked out by xxx.yyy.cc vs xxx.zzz.cc. */
- if (index (s1, '.') || index (t1, '.'))
+ if (strchr (s1, '.') || strchr (t1, '.'))
continue;
if (*s1 == '\0' || s1[-1] != '.' || t1[-1] != '.')
@@ -1134,907 +977,6 @@ interface_strcmp (s)
return 1;
}
-static int
-set_typedecl_interface_info (t, data)
- tree *t;
- void *data ATTRIBUTE_UNUSED;
-{
- tree id = get_time_identifier (DECL_SOURCE_FILE (*t));
- tree fileinfo = TIME_IDENTIFIER_FILEINFO (id);
- tree type = TREE_TYPE (*t);
-
- CLASSTYPE_INTERFACE_ONLY (type) = TREE_INT_CST_LOW (fileinfo)
- = interface_strcmp (file_name_nondirectory (DECL_SOURCE_FILE (*t)));
- return 0;
-}
-
-static int
-set_vardecl_interface_info (t, data)
- tree *t;
- void *data ATTRIBUTE_UNUSED;
-{
- tree type = DECL_CONTEXT (*t);
-
- if (CLASSTYPE_INTERFACE_KNOWN (type))
- {
- if (CLASSTYPE_INTERFACE_ONLY (type))
- set_typedecl_interface_info (&TYPE_MAIN_DECL (type), data);
- else
- CLASSTYPE_VTABLE_NEEDS_WRITING (type) = 1;
- DECL_EXTERNAL (*t) = CLASSTYPE_INTERFACE_ONLY (type);
- TREE_PUBLIC (*t) = 1;
- return 1;
- }
- return 0;
-}
-
-/* Set up the state required to correctly handle the definition of the
- inline function whose preparsed state has been saved in PI. */
-
-static void
-begin_definition_of_inclass_inline (pi)
- struct pending_inline* pi;
-{
- tree context;
-
- if (!pi->fndecl)
- return;
-
- /* If this is an inline function in a local class, we must make sure
- that we save all pertinent information about the function
- surrounding the local class. */
- context = hack_decl_function_context (pi->fndecl);
- if (context)
- push_cp_function_context (context);
-
- feed_input (pi->buf, pi->len);
- lineno = pi->lineno;
- input_filename = pi->filename;
- yychar = PRE_PARSED_FUNCTION_DECL;
- yylval.ttype = build_tree_list ((tree) pi, pi->fndecl);
- /* Pass back a handle to the rest of the inline functions, so that they
- can be processed later. */
- DECL_PENDING_INLINE_INFO (pi->fndecl) = 0;
- interface_unknown = pi->interface == 1;
- interface_only = pi->interface == 0;
-}
-
-/* Called from the top level: if there are any pending inlines to
- do, set up to process them now. This function sets up the first function
- to be parsed; after it has been, the rule for fndef in parse.y will
- call process_next_inline to start working on the next one. */
-
-void
-do_pending_inlines ()
-{
- struct pending_inline *t;
-
- /* Oops, we're still dealing with the last batch. */
- if (yychar == PRE_PARSED_FUNCTION_DECL)
- return;
-
- /* Reverse the pending inline functions, since
- they were cons'd instead of appended. */
- {
- struct pending_inline *prev = 0, *tail;
- t = pending_inlines;
- pending_inlines = 0;
-
- for (; t; t = tail)
- {
- tail = t->next;
- t->next = prev;
- t->deja_vu = 1;
- prev = t;
- }
- t = prev;
- }
-
- if (t == 0)
- return;
-
- /* Now start processing the first inline function. */
- begin_definition_of_inclass_inline (t);
-}
-
-static int nextchar = -1;
-
-/* Called from the fndecl rule in the parser when the function just parsed
- was declared using a PRE_PARSED_FUNCTION_DECL (i.e. came from
- do_pending_inlines). */
-
-void
-process_next_inline (t)
- tree t;
-{
- tree context;
- struct pending_inline *i = (struct pending_inline *) TREE_PURPOSE (t);
- context = hack_decl_function_context (i->fndecl);
- if (context)
- pop_cp_function_context (context);
- i = i->next;
- if (yychar == YYEMPTY)
- yychar = yylex ();
- if (yychar != END_OF_SAVED_INPUT)
- {
- error ("parse error at end of saved function text");
-
- /* restore_pending_input will abort unless yychar is either
- END_OF_SAVED_INPUT or YYEMPTY; since we already know we're
- hosed, feed back YYEMPTY. We also need to discard nextchar,
- since that may have gotten set as well. */
- nextchar = -1;
- }
- yychar = YYEMPTY;
- end_input ();
- if (i)
- begin_definition_of_inclass_inline (i);
- else
- extract_interface_info ();
-}
-
-/* Since inline methods can refer to text which has not yet been seen,
- we store the text of the method in a structure which is placed in the
- DECL_PENDING_INLINE_INFO field of the FUNCTION_DECL.
- After parsing the body of the class definition, the FUNCTION_DECL's are
- scanned to see which ones have this field set. Those are then digested
- one at a time.
-
- This function's FUNCTION_DECL will have a bit set in its common so
- that we know to watch out for it. */
-
-static void
-consume_string (this_obstack, matching_char)
- register struct obstack *this_obstack;
- int matching_char;
-{
- register int c;
- int starting_lineno = lineno;
- do
- {
- c = getch ();
- if (c == EOF)
- {
- int save_lineno = lineno;
- lineno = starting_lineno;
- if (matching_char == '"')
- error ("end of file encountered inside string constant");
- else
- error ("end of file encountered inside character constant");
- lineno = save_lineno;
- return;
- }
- if (c == '\\')
- {
- obstack_1grow (this_obstack, c);
- c = getch ();
- obstack_1grow (this_obstack, c);
-
- /* Make sure we continue the loop */
- c = 0;
- continue;
- }
- if (c == '\n')
- {
- if (pedantic)
- pedwarn ("ANSI C++ forbids newline in string constant");
- lineno++;
- }
- obstack_1grow (this_obstack, c);
- }
- while (c != matching_char);
-}
-
-static int nextyychar = YYEMPTY;
-static YYSTYPE nextyylval;
-
-struct pending_input {
- int nextchar, yychar, nextyychar, eof;
- YYSTYPE yylval, nextyylval;
- struct obstack token_obstack;
- int first_token;
-};
-
-struct pending_input *
-save_pending_input ()
-{
- struct pending_input *p;
- p = (struct pending_input *) xmalloc (sizeof (struct pending_input));
- p->nextchar = nextchar;
- p->yychar = yychar;
- p->nextyychar = nextyychar;
- p->yylval = yylval;
- p->nextyylval = nextyylval;
- p->eof = end_of_file;
- yychar = nextyychar = YYEMPTY;
- nextchar = -1;
- p->first_token = first_token;
- p->token_obstack = token_obstack;
-
- first_token = 0;
- gcc_obstack_init (&token_obstack);
- end_of_file = 0;
- return p;
-}
-
-void
-restore_pending_input (p)
- struct pending_input *p;
-{
- my_friendly_assert (nextchar == -1, 229);
- nextchar = p->nextchar;
- my_friendly_assert (yychar == YYEMPTY || yychar == END_OF_SAVED_INPUT, 230);
- yychar = p->yychar;
- my_friendly_assert (nextyychar == YYEMPTY, 231);
- nextyychar = p->nextyychar;
- yylval = p->yylval;
- nextyylval = p->nextyylval;
- first_token = p->first_token;
- obstack_free (&token_obstack, (char *) 0);
- token_obstack = p->token_obstack;
- end_of_file = p->eof;
- free (p);
-}
-
-/* Unget character CH from the input stream.
- If RESCAN is non-zero, then we want to `see' this
- character as the next input token. */
-
-void
-yyungetc (ch, rescan)
- int ch;
- int rescan;
-{
- /* Unget a character from the input stream. */
- if (yychar == YYEMPTY || rescan == 0)
- {
- if (nextchar >= 0)
- put_back (nextchar);
- nextchar = ch;
- }
- else
- {
- my_friendly_assert (nextyychar == YYEMPTY, 232);
- nextyychar = yychar;
- nextyylval = yylval;
- yychar = ch;
- }
-}
-
-void
-clear_inline_text_obstack ()
-{
- obstack_free (&inline_text_obstack, inline_text_firstobj);
-}
-
-/* This function stores away the text for an inline function that should
- be processed later. It decides how much later, and may need to move
- the info between obstacks; therefore, the caller should not refer to
- the T parameter after calling this function. */
-
-static void
-store_pending_inline (decl, t)
- tree decl;
- struct pending_inline *t;
-{
- t->fndecl = decl;
- DECL_PENDING_INLINE_INFO (decl) = t;
-
- /* Because we use obstacks, we must process these in precise order. */
- t->next = pending_inlines;
- pending_inlines = t;
-}
-
-void
-reinit_parse_for_method (yychar, decl)
- int yychar;
- tree decl;
-{
- int len;
- int starting_lineno = lineno;
- char *starting_filename = input_filename;
-
- reinit_parse_for_block (yychar, &inline_text_obstack);
-
- len = obstack_object_size (&inline_text_obstack);
- current_base_init_list = NULL_TREE;
- current_member_init_list = NULL_TREE;
- if (decl == void_type_node
- || (current_class_type && TYPE_REDEFINED (current_class_type)))
- {
- /* Happens when we get two declarations of the same
- function in the same scope. */
- char *buf = obstack_finish (&inline_text_obstack);
- obstack_free (&inline_text_obstack, buf);
- return;
- }
- else
- {
- struct pending_inline *t;
- char *buf = obstack_finish (&inline_text_obstack);
-
- t = (struct pending_inline *) obstack_alloc (&inline_text_obstack,
- sizeof (struct pending_inline));
- t->lineno = starting_lineno;
- t->filename = starting_filename;
- t->token = YYEMPTY;
- t->token_value = 0;
- t->buf = buf;
- t->len = len;
- t->deja_vu = 0;
-#if 0
- if (interface_unknown && processing_template_defn && flag_external_templates && ! DECL_IN_SYSTEM_HEADER (decl))
- warn_if_unknown_interface (decl);
-#endif
- t->interface = (interface_unknown ? 1 : (interface_only ? 0 : 2));
- store_pending_inline (decl, t);
- }
-}
-
-/* Consume a block -- actually, a method beginning
- with `:' or `{' -- and save it away on the specified obstack. */
-
-void
-reinit_parse_for_block (pyychar, obstackp)
- int pyychar;
- struct obstack *obstackp;
-{
- register int c = 0;
- int blev = 1;
- int starting_lineno = lineno;
- char *starting_filename = input_filename;
- int len;
- int look_for_semicolon = 0;
- int look_for_lbrac = 0;
-
- if (pyychar == '{')
- obstack_1grow (obstackp, '{');
- else if (pyychar == '=')
- look_for_semicolon = 1;
- else if (pyychar == ':')
- {
- obstack_1grow (obstackp, pyychar);
- /* Add a space so we don't get confused by ': ::A(20)'. */
- obstack_1grow (obstackp, ' ');
- look_for_lbrac = 1;
- blev = 0;
- }
- else if (pyychar == RETURN_KEYWORD)
- {
- obstack_grow (obstackp, "return", 6);
- look_for_lbrac = 1;
- blev = 0;
- }
- else if (pyychar == TRY)
- {
- obstack_grow (obstackp, "try", 3);
- look_for_lbrac = 1;
- blev = 0;
- }
- else
- {
- yyerror ("parse error in method specification");
- obstack_1grow (obstackp, '{');
- }
-
- if (nextchar != EOF)
- {
- c = nextchar;
- nextchar = EOF;
- }
- else
- c = getch ();
-
- while (c != EOF)
- {
- int this_lineno = lineno;
-
- c = skip_white_space (c);
-
- /* Don't lose our cool if there are lots of comments. */
- if (lineno == this_lineno + 1)
- obstack_1grow (obstackp, '\n');
- else if (lineno == this_lineno)
- ;
- else if (lineno - this_lineno < 10)
- {
- int i;
- for (i = lineno - this_lineno; i > 0; i--)
- obstack_1grow (obstackp, '\n');
- }
- else
- {
- char buf[16];
- sprintf (buf, "\n# %d \"", lineno);
- len = strlen (buf);
- obstack_grow (obstackp, buf, len);
-
- len = strlen (input_filename);
- obstack_grow (obstackp, input_filename, len);
- obstack_1grow (obstackp, '\"');
- obstack_1grow (obstackp, '\n');
- }
-
- while (c > ' ') /* ASCII dependent... */
- {
- obstack_1grow (obstackp, c);
- if (c == '{')
- {
- look_for_lbrac = 0;
- blev++;
- }
- else if (c == '}')
- {
- blev--;
- if (blev == 0 && !look_for_semicolon)
- {
- if (pyychar == TRY)
- {
- if (peekyylex () == CATCH)
- {
- yylex ();
- obstack_grow (obstackp, " catch ", 7);
- look_for_lbrac = 1;
- }
- else
- {
- yychar = '{';
- goto done;
- }
- }
- else
- {
- goto done;
- }
- }
- }
- else if (c == '\\')
- {
- /* Don't act on the next character...e.g, doing an escaped
- double-quote. */
- c = getch ();
- if (c == EOF)
- {
- error_with_file_and_line (starting_filename,
- starting_lineno,
- "end of file read inside definition");
- goto done;
- }
- obstack_1grow (obstackp, c);
- }
- else if (c == '\"')
- consume_string (obstackp, c);
- else if (c == '\'')
- consume_string (obstackp, c);
- else if (c == ';')
- {
- if (look_for_lbrac)
- {
- error ("function body for constructor missing");
- obstack_1grow (obstackp, '{');
- obstack_1grow (obstackp, '}');
- len += 2;
- goto done;
- }
- else if (look_for_semicolon && blev == 0)
- goto done;
- }
- c = getch ();
- }
-
- if (c == EOF)
- {
- error_with_file_and_line (starting_filename,
- starting_lineno,
- "end of file read inside definition");
- goto done;
- }
- else if (c != '\n')
- {
- obstack_1grow (obstackp, c);
- c = getch ();
- }
- }
- done:
- obstack_1grow (obstackp, '\0');
-}
-
-/* Consume a no-commas expression -- actually, a default argument -- and
- save it away on the specified obstack. */
-
-static void
-reinit_parse_for_expr (obstackp)
- struct obstack *obstackp;
-{
- register int c = 0;
- int starting_lineno = lineno;
- char *starting_filename = input_filename;
- int len;
- int plev = 0;
-
- if (nextchar != EOF)
- {
- c = nextchar;
- nextchar = EOF;
- }
- else
- c = getch ();
-
- while (c != EOF)
- {
- int this_lineno = lineno;
-
- c = skip_white_space (c);
-
- /* Don't lose our cool if there are lots of comments. */
- if (lineno == this_lineno + 1)
- obstack_1grow (obstackp, '\n');
- else if (lineno == this_lineno)
- ;
- else if (lineno - this_lineno < 10)
- {
- int i;
- for (i = lineno - this_lineno; i > 0; --i)
- obstack_1grow (obstackp, '\n');
- }
- else
- {
- char buf[16];
- sprintf (buf, "\n# %d \"", lineno);
- len = strlen (buf);
- obstack_grow (obstackp, buf, len);
-
- len = strlen (input_filename);
- obstack_grow (obstackp, input_filename, len);
- obstack_1grow (obstackp, '\"');
- obstack_1grow (obstackp, '\n');
- }
-
- while (c > ' ') /* ASCII dependent... */
- {
- if (plev <= 0 && (c == ')' || c == ','))
- {
- put_back (c);
- goto done;
- }
- obstack_1grow (obstackp, c);
- if (c == '(' || c == '[')
- ++plev;
- else if (c == ']' || c == ')')
- --plev;
- else if (c == '\\')
- {
- /* Don't act on the next character...e.g, doing an escaped
- double-quote. */
- c = getch ();
- if (c == EOF)
- {
- error_with_file_and_line (starting_filename,
- starting_lineno,
- "end of file read inside definition");
- goto done;
- }
- obstack_1grow (obstackp, c);
- }
- else if (c == '\"')
- consume_string (obstackp, c);
- else if (c == '\'')
- consume_string (obstackp, c);
- c = getch ();
- }
-
- if (c == EOF)
- {
- error_with_file_and_line (starting_filename,
- starting_lineno,
- "end of file read inside definition");
- goto done;
- }
- else if (c != '\n')
- {
- obstack_1grow (obstackp, c);
- c = getch ();
- }
- }
- done:
- obstack_1grow (obstackp, '\0');
-}
-
-int do_snarf_defarg;
-
-/* Decide whether the default argument we are about to see should be
- gobbled up as text for later parsing. */
-
-void
-maybe_snarf_defarg ()
-{
- if (current_class_type && TYPE_BEING_DEFINED (current_class_type))
- do_snarf_defarg = 1;
-}
-
-/* When we see a default argument in a method declaration, we snarf it as
- text using snarf_defarg. When we get up to namespace scope, we then go
- through and parse all of them using do_pending_defargs. Since yacc
- parsers are not reentrant, we retain defargs state in these two
- variables so that subsequent calls to do_pending_defargs can resume
- where the previous call left off. */
-
-tree defarg_fns;
-tree defarg_parm;
-
-tree
-snarf_defarg ()
-{
- int len;
- char *buf;
- tree arg;
-
- reinit_parse_for_expr (&inline_text_obstack);
- len = obstack_object_size (&inline_text_obstack);
- buf = obstack_finish (&inline_text_obstack);
-
- push_obstacks (&inline_text_obstack, &inline_text_obstack);
- arg = make_node (DEFAULT_ARG);
- DEFARG_LENGTH (arg) = len - 1;
- DEFARG_POINTER (arg) = buf;
- pop_obstacks ();
-
- return arg;
-}
-
-/* Called from grokfndecl to note a function decl with unparsed default
- arguments for later processing. Also called from grokdeclarator
- for function types with unparsed defargs; the call from grokfndecl
- will always come second, so we can overwrite the entry from the type. */
-
-void
-add_defarg_fn (decl)
- tree decl;
-{
- if (TREE_CODE (decl) == FUNCTION_DECL)
- TREE_VALUE (defarg_fns) = decl;
- else
- {
- push_obstacks (&inline_text_obstack, &inline_text_obstack);
- defarg_fns = tree_cons (current_class_type, decl, defarg_fns);
- pop_obstacks ();
- }
-}
-
-/* Helper for do_pending_defargs. Starts the parsing of a default arg. */
-
-static void
-feed_defarg (f, p)
- tree f, p;
-{
- tree d = TREE_PURPOSE (p);
- feed_input (DEFARG_POINTER (d), DEFARG_LENGTH (d));
- if (TREE_CODE (f) == FUNCTION_DECL)
- {
- lineno = DECL_SOURCE_LINE (f);
- input_filename = DECL_SOURCE_FILE (f);
- }
- yychar = DEFARG_MARKER;
- yylval.ttype = p;
-}
-
-/* Helper for do_pending_defargs. Ends the parsing of a default arg. */
-
-static void
-finish_defarg ()
-{
- if (yychar == YYEMPTY)
- yychar = yylex ();
- if (yychar != END_OF_SAVED_INPUT)
- {
- error ("parse error at end of saved function text");
-
- /* restore_pending_input will abort unless yychar is either
- END_OF_SAVED_INPUT or YYEMPTY; since we already know we're
- hosed, feed back YYEMPTY. We also need to discard nextchar,
- since that may have gotten set as well. */
- nextchar = -1;
- }
- yychar = YYEMPTY;
- end_input ();
-}
-
-/* Main function for deferred parsing of default arguments. Called from
- the parser. */
-
-void
-do_pending_defargs ()
-{
- if (defarg_parm)
- finish_defarg ();
-
- for (; defarg_fns; defarg_fns = TREE_CHAIN (defarg_fns))
- {
- tree defarg_fn = TREE_VALUE (defarg_fns);
- if (defarg_parm == NULL_TREE)
- {
- push_nested_class (TREE_PURPOSE (defarg_fns), 1);
- pushlevel (0);
- if (TREE_CODE (defarg_fn) == FUNCTION_DECL)
- maybe_begin_member_template_processing (defarg_fn);
-
- if (TREE_CODE (defarg_fn) == FUNCTION_DECL)
- {
-#if 0
- tree p;
- for (p = DECL_ARGUMENTS (defarg_fn); p; p = TREE_CHAIN (p))
- pushdecl (copy_node (p));
-#endif
- defarg_parm = TYPE_ARG_TYPES (TREE_TYPE (defarg_fn));
- }
- else
- defarg_parm = TYPE_ARG_TYPES (defarg_fn);
- }
- else
- defarg_parm = TREE_CHAIN (defarg_parm);
-
- for (; defarg_parm; defarg_parm = TREE_CHAIN (defarg_parm))
- if (TREE_PURPOSE (defarg_parm)
- && TREE_CODE (TREE_PURPOSE (defarg_parm)) == DEFAULT_ARG)
- {
- feed_defarg (defarg_fn, defarg_parm);
-
- /* Return to the parser, which will process this defarg
- and call us again. */
- return;
- }
-
- if (TREE_CODE (defarg_fn) == FUNCTION_DECL)
- {
- maybe_end_member_template_processing ();
- check_default_args (defarg_fn);
- }
-
- poplevel (0, 0, 0);
- pop_nested_class ();
- }
-}
-
-/* Build a default function named NAME for type TYPE.
- KIND says what to build.
-
- When KIND == 0, build default destructor.
- When KIND == 1, build virtual destructor.
- When KIND == 2, build default constructor.
- When KIND == 3, build default X(const X&) constructor.
- When KIND == 4, build default X(X&) constructor.
- When KIND == 5, build default operator = (const X&).
- When KIND == 6, build default operator = (X&). */
-
-tree
-cons_up_default_function (type, full_name, kind)
- tree type, full_name;
- int kind;
-{
- extern tree void_list_node;
- tree declspecs = NULL_TREE;
- tree fn, args = NULL_TREE;
- tree argtype;
- int retref = 0;
- tree name = constructor_name (full_name);
-
- switch (kind)
- {
- /* Destructors. */
- case 1:
- declspecs = build_decl_list (NULL_TREE, ridpointers [(int) RID_VIRTUAL]);
- /* Fall through... */
- case 0:
- name = build_parse_node (BIT_NOT_EXPR, name);
- args = void_list_node;
- break;
-
- case 2:
- /* Default constructor. */
- args = void_list_node;
- break;
-
- case 3:
- type = build_qualified_type (type, TYPE_QUAL_CONST);
- /* Fall through... */
- case 4:
- /* According to ARM $12.8, the default copy ctor will be declared, but
- not defined, unless it's needed. */
- argtype = build_reference_type (type);
- args = tree_cons (NULL_TREE,
- build_tree_list (hash_tree_chain (argtype, NULL_TREE),
- get_identifier ("_ctor_arg")),
- void_list_node);
- break;
-
- case 5:
- case 6:
- retref = 1;
- declspecs = build_decl_list (NULL_TREE, type);
-
- if (kind == 5)
- type = build_qualified_type (type, TYPE_QUAL_CONST);
-
- name = ansi_opname [(int) MODIFY_EXPR];
-
- argtype = build_reference_type (type);
- args = tree_cons (NULL_TREE,
- build_tree_list (hash_tree_chain (argtype, NULL_TREE),
- get_identifier ("_ctor_arg")),
- void_list_node);
- break;
-
- default:
- my_friendly_abort (59);
- }
-
- declspecs = decl_tree_cons (NULL_TREE, ridpointers [(int) RID_INLINE],
- declspecs);
-
- TREE_PARMLIST (args) = 1;
-
- {
- tree declarator = make_call_declarator (name, args, NULL_TREE, NULL_TREE);
- if (retref)
- declarator = build_parse_node (ADDR_EXPR, declarator);
-
- fn = grokfield (declarator, declspecs, NULL_TREE, NULL_TREE, NULL_TREE);
- }
-
- if (fn == void_type_node)
- return fn;
-
- if (kind > 2)
- SET_DECL_ARTIFICIAL (TREE_CHAIN (DECL_ARGUMENTS (fn)));
-
-#if 0
- if (processing_template_defn)
- {
- SET_DECL_IMPLICIT_INSTANTIATION (fn);
- repo_template_used (fn);
- }
-#endif
-
-#if 0
- if (CLASSTYPE_INTERFACE_KNOWN (type))
- {
- DECL_INTERFACE_KNOWN (fn) = 1;
- DECL_NOT_REALLY_EXTERN (fn) = (!CLASSTYPE_INTERFACE_ONLY (type)
- && flag_implement_inlines);
- }
- else
-#endif
- DECL_NOT_REALLY_EXTERN (fn) = 1;
-
- mark_inline_for_output (fn);
-
-#ifdef DEBUG_DEFAULT_FUNCTIONS
- { char *fn_type = NULL;
- tree t = name;
- switch (kind)
- {
- case 0: fn_type = "default destructor"; break;
- case 1: fn_type = "virtual destructor"; break;
- case 2: fn_type = "default constructor"; break;
- case 3: fn_type = "default X(const X&)"; break;
- case 4: fn_type = "default X(X&)"; break;
- }
- if (fn_type)
- {
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- t = TREE_OPERAND (name, 0);
- fprintf (stderr, "[[[[ %s for %s:\n%s]]]]\n", fn_type,
- IDENTIFIER_POINTER (t), func_buf);
- }
- }
-#endif /* DEBUG_DEFAULT_FUNCTIONS */
-
- /* Show that this function was generated by the compiler. */
- SET_DECL_ARTIFICIAL (fn);
-
- return fn;
-}
-
/* Heuristic to tell whether the user is missing a semicolon
after a struct or enum declaration. Emit an error message
if we know the user has blown it. */
@@ -2052,13 +994,13 @@ check_for_missing_semicolon (type)
&& yychar != TYPENAME
&& yychar != CV_QUALIFIER
&& yychar != SELFNAME)
- || end_of_file)
+ || yychar == 0 /* EOF */)
{
- if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (type)))
+ if (TYPE_ANONYMOUS_P (type))
error ("semicolon missing after %s declaration",
TREE_CODE (type) == ENUMERAL_TYPE ? "enum" : "struct");
else
- cp_error ("semicolon missing after declaration of `%T'", type);
+ error ("semicolon missing after declaration of `%T'", type);
shadow_tag (build_tree_list (0, type));
}
/* Could probably also hack cases where class { ... } f (); appears. */
@@ -2069,8 +1011,8 @@ void
note_got_semicolon (type)
tree type;
{
- if (TREE_CODE_CLASS (TREE_CODE (type)) != 't')
- my_friendly_abort (60);
+ if (!TYPE_P (type))
+ abort ();
if (CLASS_TYPE_P (type))
CLASSTYPE_GOT_SEMICOLON (type) = 1;
}
@@ -2084,735 +1026,158 @@ note_list_got_semicolon (declspecs)
for (link = declspecs; link; link = TREE_CHAIN (link))
{
tree type = TREE_VALUE (link);
- if (TREE_CODE_CLASS (TREE_CODE (type)) == 't')
+ if (type && TYPE_P (type))
note_got_semicolon (type);
}
clear_anon_tags ();
}
-/* If C is not whitespace, return C.
- Otherwise skip whitespace and return first nonwhite char read. */
-static int
-skip_white_space (c)
- register int c;
+/* Parse a #pragma whose sole argument is a string constant.
+ If OPT is true, the argument is optional. */
+static tree
+parse_strconst_pragma (name, opt)
+ const char *name;
+ int opt;
{
- for (;;)
- {
- switch (c)
- {
- case '\n':
- c = check_newline ();
- break;
-
- case ' ':
- case '\t':
- case '\f':
- case '\r':
- case '\v':
- case '\b':
- do
- c = getch ();
- while (c == ' ' || c == '\t');
- break;
-
- case '\\':
- c = getch ();
- if (c == '\n')
- lineno++;
- else
- error ("stray '\\' in program");
- c = getch ();
- break;
+ tree result, x;
+ enum cpp_ttype t;
- default:
- return (c);
- }
+ t = c_lex (&x);
+ if (t == CPP_STRING)
+ {
+ result = x;
+ if (c_lex (&x) != CPP_EOF)
+ warning ("junk at end of #pragma %s", name);
+ return result;
}
-}
-
-
-
-/* Make the token buffer longer, preserving the data in it.
- P should point to just beyond the last valid character in the old buffer.
- The value we return is a pointer to the new buffer
- at a place corresponding to P. */
-static char *
-extend_token_buffer (p)
- const char *p;
-{
- int offset = p - token_buffer;
-
- maxtoken = maxtoken * 2 + 10;
- token_buffer = (char *) xrealloc (token_buffer, maxtoken + 2);
-
- return token_buffer + offset;
-}
-
-static int
-get_last_nonwhite_on_line ()
-{
- register int c;
-
- /* Is this the last nonwhite stuff on the line? */
- if (nextchar >= 0)
- c = nextchar, nextchar = -1;
- else
- c = getch ();
+ if (t == CPP_EOF && opt)
+ return 0;
- while (c == ' ' || c == '\t')
- c = getch ();
- return c;
+ error ("invalid #pragma %s", name);
+ return (tree)-1;
}
-#if defined HANDLE_PRAGMA
-/* Local versions of these macros, that can be passed as function pointers. */
-static int
-pragma_getc ()
+static void
+handle_pragma_vtable (dfile)
+ cpp_reader *dfile ATTRIBUTE_UNUSED;
{
- int c;
-
- if (nextchar != EOF)
- {
- c = nextchar;
- nextchar = EOF;
- }
- else
- c = getch ();
-
- return c;
+ parse_strconst_pragma ("vtable", 0);
+ sorry ("#pragma vtable no longer supported");
}
static void
-pragma_ungetc (arg)
- int arg;
+handle_pragma_unit (dfile)
+ cpp_reader *dfile ATTRIBUTE_UNUSED;
{
- yyungetc (arg, 0);
+ /* Validate syntax, but don't do anything. */
+ parse_strconst_pragma ("unit", 0);
}
-#endif /* HANDLE_PRAGMA */
-
-/* At the beginning of a line, increment the line number
- and process any #-directive on this line.
- If the line is a #-directive, read the entire line and return a newline.
- Otherwise, return the line's first non-whitespace character. */
-
-int linemode;
-static int
-check_newline ()
+static void
+handle_pragma_interface (dfile)
+ cpp_reader *dfile ATTRIBUTE_UNUSED;
{
- register int c;
- register int token;
- int saw_line = 0;
+ tree fname = parse_strconst_pragma ("interface", 1);
+ struct c_fileinfo *finfo;
+ const char *main_filename;
- /* Read first nonwhite char on the line. Do this before incrementing the
- line number, in case we're at the end of saved text. */
-
- do
- c = getch ();
- while (c == ' ' || c == '\t');
+ if (fname == (tree)-1)
+ return;
+ else if (fname == 0)
+ main_filename = lbasename (input_filename);
+ else
+ main_filename = TREE_STRING_POINTER (fname);
- lineno++;
+ finfo = get_fileinfo (input_filename);
- if (c != '#')
+ if (impl_file_chain == 0)
{
- /* If not #, return it so caller will use it. */
- return c;
+ /* If this is zero at this point, then we are
+ auto-implementing. */
+ if (main_input_filename == 0)
+ main_input_filename = input_filename;
}
- /* Don't read beyond this line. */
- linemode = 1;
-
- /* Read first nonwhite char after the `#'. */
-
- do
- c = getch ();
- while (c == ' ' || c == '\t');
-
- /* If a letter follows, then if the word here is `line', skip
- it and ignore it; otherwise, ignore the line, with an error
- if the word isn't `pragma'. */
-
- if (ISALPHA (c))
- {
- if (c == 'p')
- {
- if (getch () == 'r'
- && getch () == 'a'
- && getch () == 'g'
- && getch () == 'm'
- && getch () == 'a')
- {
- token = real_yylex ();
- if (token == IDENTIFIER
- && TREE_CODE (yylval.ttype) == IDENTIFIER_NODE)
- {
- /* If this is 1, we handled it; if it's -1, it was one we
- wanted but had something wrong with it. Only if it's
- 0 was it not handled. */
- if (handle_cp_pragma (IDENTIFIER_POINTER (yylval.ttype)))
- goto skipline;
- }
- else if (token == END_OF_LINE)
- goto skipline;
-
-#ifdef HANDLE_PRAGMA
- /* We invoke HANDLE_PRAGMA before HANDLE_GENERIC_PRAGMAS
- (if both are defined), in order to give the back
- end a chance to override the interpretation of
- SYSV style pragmas. */
- if (HANDLE_PRAGMA (pragma_getc, pragma_ungetc,
- IDENTIFIER_POINTER (yylval.ttype)))
- goto skipline;
-#endif /* HANDLE_PRAGMA */
-
-#ifdef HANDLE_GENERIC_PRAGMAS
- if (handle_generic_pragma (token))
- goto skipline;
-#endif /* HANDLE_GENERIC_PRAGMAS */
-
- /* Issue a warning message if we have been asked to do so.
- Ignoring unknown pragmas in system header file unless
- an explcit -Wunknown-pragmas has been given. */
- if (warn_unknown_pragmas > 1
- || (warn_unknown_pragmas && ! in_system_header))
- warning ("ignoring pragma: %s", token_buffer);
- }
-
- goto skipline;
- }
- else if (c == 'd')
- {
- if (getch () == 'e'
- && getch () == 'f'
- && getch () == 'i'
- && getch () == 'n'
- && getch () == 'e'
- && ((c = getch ()) == ' ' || c == '\t'))
- {
- debug_define (lineno, GET_DIRECTIVE_LINE ());
- goto skipline;
- }
- }
- else if (c == 'u')
- {
- if (getch () == 'n'
- && getch () == 'd'
- && getch () == 'e'
- && getch () == 'f'
- && ((c = getch ()) == ' ' || c == '\t'))
- {
- debug_undef (lineno, GET_DIRECTIVE_LINE ());
- goto skipline;
- }
- }
- else if (c == 'l')
- {
- if (getch () == 'i'
- && getch () == 'n'
- && getch () == 'e'
- && ((c = getch ()) == ' ' || c == '\t'))
- {
- saw_line = 1;
- goto linenum;
- }
- }
- else if (c == 'i')
- {
- if (getch () == 'd'
- && getch () == 'e'
- && getch () == 'n'
- && getch () == 't'
- && ((c = getch ()) == ' ' || c == '\t'))
- {
- /* #ident. The pedantic warning is now in cccp.c. */
-
- /* Here we have just seen `#ident '.
- A string constant should follow. */
-
- token = real_yylex ();
- if (token == END_OF_LINE)
- goto skipline;
- if (token != STRING
- || TREE_CODE (yylval.ttype) != STRING_CST)
- {
- error ("invalid #ident");
- goto skipline;
- }
-
- if (! flag_no_ident)
- {
-#ifdef ASM_OUTPUT_IDENT
- ASM_OUTPUT_IDENT (asm_out_file,
- TREE_STRING_POINTER (yylval.ttype));
+ interface_only = interface_strcmp (main_filename);
+#ifdef MULTIPLE_SYMBOL_SPACES
+ if (! interface_only)
#endif
- }
-
- /* Skip the rest of this line. */
- goto skipline;
- }
- }
- else if (c == 'n')
- {
- if (getch () == 'e'
- && getch () == 'w'
- && getch () == 'w'
- && getch () == 'o'
- && getch () == 'r'
- && getch () == 'l'
- && getch () == 'd'
- && ((c = getch ()) == ' ' || c == '\t'))
- {
- /* Used to test incremental compilation. */
- sorry ("#pragma newworld");
- goto skipline;
- }
- }
- error ("undefined or invalid # directive");
- goto skipline;
- }
+ interface_unknown = 0;
-linenum:
- /* Here we have either `#line' or `# <nonletter>'.
- In either case, it should be a line number; a digit should follow. */
+ finfo->interface_only = interface_only;
+ finfo->interface_unknown = interface_unknown;
+}
- while (c == ' ' || c == '\t')
- c = getch ();
+/* Note that we have seen a #pragma implementation for the key MAIN_FILENAME.
+ We used to only allow this at toplevel, but that restriction was buggy
+ in older compilers and it seems reasonable to allow it in the headers
+ themselves, too. It only needs to precede the matching #p interface.
- /* If the # is the only nonwhite char on the line,
- just ignore it. Check the new newline. */
- if (c == EOF)
- goto skipline;
+ We don't touch interface_only or interface_unknown; the user must specify
+ a matching #p interface for this to have any effect. */
- /* Something follows the #; read a token. */
+static void
+handle_pragma_implementation (dfile)
+ cpp_reader *dfile ATTRIBUTE_UNUSED;
+{
+ tree fname = parse_strconst_pragma ("implementation", 1);
+ const char *main_filename;
+ struct impl_files *ifiles = impl_file_chain;
- put_back (c);
- token = real_yylex ();
+ if (fname == (tree)-1)
+ return;
- if (token == CONSTANT
- && TREE_CODE (yylval.ttype) == INTEGER_CST)
+ if (fname == 0)
{
- int old_lineno = lineno;
- enum { act_none, act_push, act_pop } action = act_none;
- int entering_system_header = 0;
- int entering_c_header = 0;
-
- /* subtract one, because it is the following line that
- gets the specified number */
-
- int l = TREE_INT_CST_LOW (yylval.ttype) - 1;
- c = get_last_nonwhite_on_line ();
- if (c == EOF)
- {
- /* No more: store the line number and check following line. */
- lineno = l;
- goto skipline;
- }
- put_back (c);
-
- /* More follows: it must be a string constant (filename). */
-
- if (saw_line)
- {
- /* Don't treat \ as special if we are processing #line 1 "...".
- If you want it to be treated specially, use # 1 "...". */
- ignore_escape_flag = 1;
- }
-
- /* Read the string constant. */
- token = real_yylex ();
-
- ignore_escape_flag = 0;
-
- if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
- {
- error ("invalid #line");
- goto skipline;
- }
-
- /* Changing files again. This means currently collected time
- is charged against header time, and body time starts back
- at 0. */
- if (flag_detailed_statistics)
- {
- int this_time = my_get_run_time ();
- tree time_identifier = get_time_identifier (TREE_STRING_POINTER (yylval.ttype));
- header_time += this_time - body_time;
- TREE_INT_CST_LOW (TIME_IDENTIFIER_TIME (this_filename_time))
- += this_time - body_time;
- this_filename_time = time_identifier;
- body_time = this_time;
- }
-
- input_filename
- = (char *) permalloc (TREE_STRING_LENGTH (yylval.ttype) + 1);
- strcpy (input_filename, TREE_STRING_POINTER (yylval.ttype));
- lineno = l;
- GNU_xref_file (input_filename);
-
- if (main_input_filename == 0)
- {
- struct impl_files *ifiles = impl_file_chain;
-
- if (ifiles)
- {
- while (ifiles->next)
- ifiles = ifiles->next;
- ifiles->filename = file_name_nondirectory (input_filename);
- }
-
- main_input_filename = input_filename;
- if (write_virtuals == 3)
- {
- walk_globals (vtable_decl_p,
- set_vardecl_interface_info,
- /*data=*/0);
- walk_globals (vtype_decl_p,
- set_typedecl_interface_info,
- /*data=*/0);
- }
- }
-
- extract_interface_info ();
-
- c = get_last_nonwhite_on_line ();
- if (c == EOF)
- {
- /* Update the name in the top element of input_file_stack. */
- if (input_file_stack)
- input_file_stack->name = input_filename;
- }
+ if (main_input_filename)
+ main_filename = main_input_filename;
else
- {
- put_back (c);
-
- token = real_yylex ();
-
- /* `1' after file name means entering new file.
- `2' after file name means just left a file. */
-
- if (token == CONSTANT
- && TREE_CODE (yylval.ttype) == INTEGER_CST)
- {
- if (TREE_INT_CST_LOW (yylval.ttype) == 1)
- action = act_push;
- else if (TREE_INT_CST_LOW (yylval.ttype) == 2)
- action = act_pop;
-
- if (action)
- {
- c = get_last_nonwhite_on_line ();
- if (c != EOF)
- {
- put_back (c);
- token = real_yylex ();
- }
- }
- }
-
- /* `3' after file name means this is a system header file. */
-
- if (token == CONSTANT
- && TREE_CODE (yylval.ttype) == INTEGER_CST
- && TREE_INT_CST_LOW (yylval.ttype) == 3)
- {
- entering_system_header = 1;
-
- c = get_last_nonwhite_on_line ();
- if (c != EOF)
- {
- put_back (c);
- token = real_yylex ();
- }
- }
-
- /* `4' after file name means this is a C header file. */
-
- if (token == CONSTANT
- && TREE_CODE (yylval.ttype) == INTEGER_CST
- && TREE_INT_CST_LOW (yylval.ttype) == 4)
- {
- entering_c_header = 1;
-
- c = get_last_nonwhite_on_line ();
- if (c != EOF)
- {
- put_back (c);
- token = real_yylex ();
- }
- }
-
- /* Do the actions implied by the preceding numbers. */
-
- if (action == act_push)
- {
- /* Pushing to a new file. */
- struct file_stack *p;
-
- p = (struct file_stack *) xmalloc (sizeof (struct file_stack));
- input_file_stack->line = old_lineno;
- p->next = input_file_stack;
- p->name = input_filename;
- input_file_stack = p;
- input_file_stack_tick++;
- debug_start_source_file (input_filename);
- in_system_header = entering_system_header;
- if (c_header_level)
- ++c_header_level;
- else if (entering_c_header)
- {
- c_header_level = 1;
- ++pending_lang_change;
- }
- }
- else if (action == act_pop)
- {
- /* Popping out of a file. */
- if (input_file_stack->next)
- {
- struct file_stack *p;
-
- if (c_header_level && --c_header_level == 0)
- {
- if (entering_c_header)
- warning ("badly nested C headers from preprocessor");
- --pending_lang_change;
- }
- in_system_header = entering_system_header;
-
- p = input_file_stack;
- input_file_stack = p->next;
- free (p);
- input_file_stack_tick++;
- debug_end_source_file (input_file_stack->line);
- }
- else
- error ("#-lines for entering and leaving files don't match");
- }
- else
- in_system_header = entering_system_header;
- }
-
- /* If NEXTCHAR is not end of line, we don't care what it is. */
- if (nextchar == EOF)
- c = EOF;
+ main_filename = input_filename;
+ main_filename = lbasename (main_filename);
}
else
- error ("invalid #-line");
-
- /* skip the rest of this line. */
- skipline:
- linemode = 0;
- end_of_file = 0;
- nextchar = -1;
- while ((c = getch ()) != EOF && c != '\n');
- return c;
-}
-
-void
-do_pending_lang_change ()
-{
- for (; pending_lang_change > 0; --pending_lang_change)
- push_lang_context (lang_name_c);
- for (; pending_lang_change < 0; ++pending_lang_change)
- pop_lang_context ();
-}
-
-#define ENDFILE -1 /* token that represents end-of-file */
-
-/* Read an escape sequence, returning its equivalent as a character,
- or store 1 in *ignore_ptr if it is backslash-newline. */
-
-static int
-readescape (ignore_ptr)
- int *ignore_ptr;
-{
- register int c = getch ();
- register int code;
- register unsigned count;
- unsigned firstdig = 0;
- int nonnull;
-
- switch (c)
{
- case 'x':
- code = 0;
- count = 0;
- nonnull = 0;
- while (1)
- {
- c = getch ();
- if (! ISXDIGIT (c))
- {
- put_back (c);
- break;
- }
- code *= 16;
- if (c >= 'a' && c <= 'f')
- code += c - 'a' + 10;
- if (c >= 'A' && c <= 'F')
- code += c - 'A' + 10;
- if (c >= '0' && c <= '9')
- code += c - '0';
- if (code != 0 || count != 0)
- {
- if (count == 0)
- firstdig = code;
- count++;
- }
- nonnull = 1;
- }
- if (! nonnull)
- error ("\\x used with no following hex digits");
- else if (count == 0)
- /* Digits are all 0's. Ok. */
- ;
- else if ((count - 1) * 4 >= TYPE_PRECISION (integer_type_node)
- || (count > 1
- && (((unsigned)1 <<
- (TYPE_PRECISION (integer_type_node) - (count - 1) * 4))
- <= firstdig)))
- pedwarn ("hex escape out of range");
- return code;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7':
- code = 0;
- count = 0;
- while ((c <= '7') && (c >= '0') && (count++ < 3))
- {
- code = (code * 8) + (c - '0');
- c = getch ();
- }
- put_back (c);
- return code;
-
- case '\\': case '\'': case '"':
- return c;
-
- case '\n':
- lineno++;
- *ignore_ptr = 1;
- return 0;
-
- case 'n':
- return TARGET_NEWLINE;
-
- case 't':
- return TARGET_TAB;
-
- case 'r':
- return TARGET_CR;
-
- case 'f':
- return TARGET_FF;
-
- case 'b':
- return TARGET_BS;
-
- case 'a':
- return TARGET_BELL;
-
- case 'v':
- return TARGET_VT;
-
- case 'e':
- case 'E':
- if (pedantic)
- pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c);
- return 033;
-
- case '?':
- return c;
-
- /* `\(', etc, are used at beginning of line to avoid confusing Emacs. */
- case '(':
- case '{':
- case '[':
- /* `\%' is used to prevent SCCS from getting confused. */
- case '%':
- if (pedantic)
- pedwarn ("unknown escape sequence `\\%c'", c);
- return c;
+ main_filename = TREE_STRING_POINTER (fname);
+ if (cpp_included (parse_in, main_filename))
+ warning ("#pragma implementation for %s appears after file is included",
+ main_filename);
}
- if (ISGRAPH (c))
- pedwarn ("unknown escape sequence `\\%c'", c);
- else
- pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c);
- return c;
-}
-/* Value is 1 (or 2) if we should try to make the next identifier look like
- a typename (when it may be a local variable or a class variable).
- Value is 0 if we treat this name in a default fashion. */
-int looking_for_typename;
-
-#ifdef __GNUC__
-__inline
-#endif
-int
-identifier_type (decl)
- tree decl;
-{
- tree t;
- if (TREE_CODE (decl) == TEMPLATE_DECL)
+ for (; ifiles; ifiles = ifiles->next)
{
- if (TREE_CODE (DECL_RESULT (decl)) == TYPE_DECL)
- return PTYPENAME;
- else if (looking_for_template)
- return PFUNCNAME;
+ if (! strcmp (ifiles->filename, main_filename))
+ break;
}
- if (looking_for_template && really_overloaded_fn (decl))
+ if (ifiles == 0)
{
- /* See through a baselink. */
- if (TREE_CODE (decl) == TREE_LIST)
- decl = TREE_VALUE (decl);
-
- for (t = decl; t != NULL_TREE; t = OVL_CHAIN (t))
- if (DECL_FUNCTION_TEMPLATE_P (OVL_FUNCTION (t)))
- return PFUNCNAME;
+ ifiles = (struct impl_files*) xmalloc (sizeof (struct impl_files));
+ ifiles->filename = main_filename;
+ ifiles->next = impl_file_chain;
+ impl_file_chain = ifiles;
}
- if (TREE_CODE (decl) == NAMESPACE_DECL)
- return NSNAME;
- if (TREE_CODE (decl) != TYPE_DECL)
- return IDENTIFIER;
- if (DECL_ARTIFICIAL (decl) && TREE_TYPE (decl) == current_class_type)
- return SELFNAME;
-
- /* A constructor declarator for a template type will get here as an
- implicit typename, a TYPENAME_TYPE with a type. */
- t = got_scope;
- if (t && TREE_CODE (t) == TYPENAME_TYPE)
- t = TREE_TYPE (t);
- decl = TREE_TYPE (decl);
- if (TREE_CODE (decl) == TYPENAME_TYPE)
- decl = TREE_TYPE (decl);
- if (t && t == decl)
- return SELFNAME;
-
- return TYPENAME;
+}
+
+/* Indicate that this file uses Java-personality exception handling. */
+static void
+handle_pragma_java_exceptions (dfile)
+ cpp_reader *dfile ATTRIBUTE_UNUSED;
+{
+ tree x;
+ if (c_lex (&x) != CPP_EOF)
+ warning ("junk at end of #pragma GCC java_exceptions");
+
+ choose_personality_routine (lang_java);
}
void
-see_typename ()
+do_pending_lang_change ()
{
- /* Only types expected, not even namespaces. */
- looking_for_typename = 2;
- if (yychar < 0)
- if ((yychar = yylex ()) < 0) yychar = 0;
- looking_for_typename = 0;
- if (yychar == IDENTIFIER)
- {
- lastiddecl = lookup_name (yylval.ttype, -2);
- if (lastiddecl == 0)
- {
- if (flag_labels_ok)
- lastiddecl = IDENTIFIER_LABEL_VALUE (yylval.ttype);
- }
- else
- yychar = identifier_type (lastiddecl);
- }
+ for (; pending_lang_change > 0; --pending_lang_change)
+ push_lang_context (lang_name_c);
+ for (; pending_lang_change < 0; ++pending_lang_change)
+ pop_lang_context ();
}
/* Return true if d is in a global scope. */
@@ -2830,9 +1195,9 @@ is_global (d)
case OVERLOAD: d = OVL_FUNCTION (d); continue;
case TREE_LIST: d = TREE_VALUE (d); continue;
default:
- my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (d)) == 'd', 980629);
- d = CP_DECL_CONTEXT (d);
- return TREE_CODE (d) == NAMESPACE_DECL;
+ my_friendly_assert (DECL_P (d), 980629);
+
+ return DECL_NAMESPACE_SCOPE_P (d);
}
}
@@ -2844,64 +1209,28 @@ do_identifier (token, parsing, args)
{
register tree id;
int lexing = (parsing == 1);
- int in_call = (parsing == 2);
- if (! lexing || IDENTIFIER_OPNAME_P (token))
+ if (! lexing)
id = lookup_name (token, 0);
else
id = lastiddecl;
- /* Scope class declarations before global
- declarations. */
- if ((!id || is_global (id))
- && current_class_type != 0
- && TYPE_SIZE (current_class_type) == 0)
- {
- /* Could be from one of the base classes. */
- tree field = lookup_field (current_class_type, token, 1, 0);
- if (field == 0)
- ;
- else if (field == error_mark_node)
- /* We have already generated the error message.
- But we still want to return this value. */
- id = lookup_field (current_class_type, token, 0, 0);
- else if (TREE_CODE (field) == VAR_DECL
- || TREE_CODE (field) == CONST_DECL
- || TREE_CODE (field) == TEMPLATE_DECL)
- id = field;
- else if (TREE_CODE (field) == TYPE_DECL
- && DECL_ARTIFICIAL (field)
- && IMPLICIT_TYPENAME_P (TREE_TYPE (field)))
- /* When we did name-lookup before, we will have eschewed
- implicit typenames in favor of global bindings. Therefore,
- if lookup_field returns an implicit typename, but ID is not
- an implicit typename, then we should skip this one, too. */
- ;
- else if (TREE_CODE (field) != FIELD_DECL)
- my_friendly_abort (61);
- else
- {
- cp_error ("invalid use of member `%D'", field);
- id = error_mark_node;
- return id;
- }
- }
+ if (lexing && id && TREE_DEPRECATED (id))
+ warn_deprecated_use (id);
/* Do Koenig lookup if appropriate (inside templates we build lookup
- expressions instead). */
+ expressions instead).
+
+ [basic.lookup.koenig]: If the ordinary unqualified lookup of the name
+ finds the declaration of a class member function, the associated
+ namespaces and classes are not considered. */
+
if (args && !current_template_parms && (!id || is_global (id)))
- /* If we have arguments and we only found global names, do Koenig
- lookup. */
id = lookup_arg_dependent (token, id, args);
/* Remember that this name has been used in the class definition, as per
[class.scope0] */
- if (id && parsing
- /* Avoid breaking if we get called for a default argument that
- refers to an overloaded method. Eventually this will not be
- necessary, since default arguments shouldn't be parsed until
- after the class is complete. (jason 3/12/97) */
- && TREE_CODE (id) != OVERLOAD)
+ if (id && parsing)
maybe_note_name_used_in_class (token, id);
if (id == error_mark_node)
@@ -2913,24 +1242,21 @@ do_identifier (token, parsing, args)
id = lookup_name (token, 0);
return error_mark_node;
}
-
- if (!id)
+
+ if (!id || (TREE_CODE (id) == FUNCTION_DECL
+ && DECL_ANTICIPATED (id)))
{
if (current_template_parms)
return build_min_nt (LOOKUP_EXPR, token);
else if (IDENTIFIER_OPNAME_P (token))
{
- if (token != ansi_opname[ERROR_MARK])
- cp_error ("`%D' not defined", token);
+ if (token != ansi_opname (ERROR_MARK))
+ error ("`%D' not defined", token);
id = error_mark_node;
}
- else if (in_call && ! flag_strict_prototype)
- {
- id = implicitly_declare (token);
- }
else if (current_function_decl == 0)
{
- cp_error ("`%D' was not declared in this scope", token);
+ error ("`%D' was not declared in this scope", token);
id = error_mark_node;
}
else
@@ -2940,12 +1266,11 @@ do_identifier (token, parsing, args)
{
static int undeclared_variable_notice;
- cp_error ("`%D' undeclared (first use this function)", token);
+ error ("`%D' undeclared (first use this function)", token);
if (! undeclared_variable_notice)
{
- error ("(Each undeclared identifier is reported only once");
- error ("for each function it appears in.)");
+ error ("(Each undeclared identifier is reported only once for each function it appears in.)");
undeclared_variable_notice = 1;
}
}
@@ -2970,7 +1295,7 @@ do_identifier (token, parsing, args)
{
warning ("name lookup of `%s' changed",
IDENTIFIER_POINTER (token));
- cp_warning_at (" matches this `%D' under current ANSI rules",
+ cp_warning_at (" matches this `%D' under ISO standard rules",
shadowed);
cp_warning_at (" matches this `%D' under old rules", id);
DECL_ERROR_REPORTED (id) = 1;
@@ -2979,18 +1304,18 @@ do_identifier (token, parsing, args)
}
else if (!DECL_ERROR_REPORTED (id))
{
- static char msg[]
- = "name lookup of `%s' changed for new ANSI `for' scoping";
DECL_ERROR_REPORTED (id) = 1;
- if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (id)))
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (id)))
{
- error (msg, IDENTIFIER_POINTER (token));
+ error ("name lookup of `%s' changed for new ISO `for' scoping",
+ IDENTIFIER_POINTER (token));
cp_error_at (" cannot use obsolete binding at `%D' because it has a destructor", id);
id = error_mark_node;
}
else
{
- pedwarn (msg, IDENTIFIER_POINTER (token));
+ pedwarn ("name lookup of `%s' changed for new ISO `for' scoping",
+ IDENTIFIER_POINTER (token));
cp_pedwarn_at (" using obsolete binding at `%D'", id);
}
}
@@ -3000,7 +1325,7 @@ do_identifier (token, parsing, args)
{
/* Check access. */
if (IDENTIFIER_CLASS_VALUE (token) == id)
- enforce_access (DECL_REAL_CONTEXT(id), id);
+ enforce_access (CP_DECL_CONTEXT(id), id);
if (!processing_template_decl || DECL_TEMPLATE_PARM_P (id))
id = DECL_INITIAL (id);
}
@@ -3016,22 +1341,15 @@ do_identifier (token, parsing, args)
like local variables, rather than creating TEMPLATE_DECLs for the
local variables and then finding matching instantiations. */
if (current_template_parms
- && (is_overloaded_fn (id)
- /* If it's not going to be around at instantiation time, we
- look it up then. This is a hack, and should go when we
- really get dependent/independent name lookup right. */
- || !TREE_PERMANENT (id)
- /* Some local VAR_DECLs (such as those for local variables
- in member functions of local classes) are built on the
- permanent obstack. */
- || (TREE_CODE (id) == VAR_DECL
+ && (is_overloaded_fn (id)
+ || (TREE_CODE (id) == VAR_DECL
&& CP_DECL_CONTEXT (id)
&& TREE_CODE (CP_DECL_CONTEXT (id)) == FUNCTION_DECL)
|| TREE_CODE (id) == PARM_DECL
|| TREE_CODE (id) == RESULT_DECL
|| TREE_CODE (id) == USING_DECL))
id = build_min_nt (LOOKUP_EXPR, token);
-
+
return id;
}
@@ -3044,13 +1362,12 @@ do_scoped_id (token, parsing)
/* during parsing, this is ::name. Otherwise, it is black magic. */
if (parsing)
{
- struct tree_binding _b;
- id = binding_init (&_b);
+ id = make_node (CPLUS_BINDING);
if (!qualified_lookup_using_namespace (token, global_namespace, id, 0))
id = NULL_TREE;
else
id = BINDING_VALUE (id);
- }
+ }
else
id = IDENTIFIER_GLOBAL_VALUE (token);
if (parsing && yychar == YYEMPTY)
@@ -3063,17 +1380,11 @@ do_scoped_id (token, parsing)
LOOKUP_EXPR_GLOBAL (id) = 1;
return id;
}
- if (parsing && (yychar == '(' || yychar == LEFT_RIGHT)
- && ! flag_strict_prototype)
- id = implicitly_declare (token);
- else
- {
- if (IDENTIFIER_NAMESPACE_VALUE (token) != error_mark_node)
- cp_error ("`::%D' undeclared (first use here)", token);
- id = error_mark_node;
- /* Prevent repeated error messages. */
- SET_IDENTIFIER_NAMESPACE_VALUE (token, error_mark_node);
- }
+ if (IDENTIFIER_NAMESPACE_VALUE (token) != error_mark_node)
+ error ("`::%D' undeclared (first use here)", token);
+ id = error_mark_node;
+ /* Prevent repeated error messages. */
+ SET_IDENTIFIER_NAMESPACE_VALUE (token, error_mark_node);
}
else
{
@@ -3136,1372 +1447,6 @@ identifier_typedecl_value (node)
return NULL_TREE;
}
-struct pf_args
-{
- /* Input */
- /* I/O */
- char *p;
- int c;
- int imag;
- tree type;
- /* Output */
- REAL_VALUE_TYPE value;
-};
-
-static void
-parse_float (data)
- PTR data;
-{
- struct pf_args * args = (struct pf_args *) data;
- int fflag = 0, lflag = 0;
- /* Copy token_buffer now, while it has just the number
- and not the suffixes; once we add `f' or `i',
- REAL_VALUE_ATOF may not work any more. */
- char *copy = (char *) alloca (args->p - token_buffer + 1);
- bcopy (token_buffer, copy, args->p - token_buffer + 1);
-
- while (1)
- {
- int lose = 0;
-
- /* Read the suffixes to choose a data type. */
- switch (args->c)
- {
- case 'f': case 'F':
- if (fflag)
- error ("more than one `f' in numeric constant");
- fflag = 1;
- break;
-
- case 'l': case 'L':
- if (lflag)
- error ("more than one `l' in numeric constant");
- lflag = 1;
- break;
-
- case 'i': case 'I':
- if (args->imag)
- error ("more than one `i' or `j' in numeric constant");
- else if (pedantic)
- pedwarn ("ANSI C++ forbids imaginary numeric constants");
- args->imag = 1;
- break;
-
- default:
- lose = 1;
- }
-
- if (lose)
- break;
-
- if (args->p >= token_buffer + maxtoken - 3)
- args->p = extend_token_buffer (args->p);
- *(args->p++) = args->c;
- *(args->p) = 0;
- args->c = getch ();
- }
-
- /* The second argument, machine_mode, of REAL_VALUE_ATOF
- tells the desired precision of the binary result
- of decimal-to-binary conversion. */
-
- if (fflag)
- {
- if (lflag)
- error ("both `f' and `l' in floating constant");
-
- args->type = float_type_node;
- args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type));
- /* A diagnostic is required here by some ANSI C testsuites.
- This is not pedwarn, become some people don't want
- an error for this. */
- if (REAL_VALUE_ISINF (args->value) && pedantic)
- warning ("floating point number exceeds range of `float'");
- }
- else if (lflag)
- {
- args->type = long_double_type_node;
- args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type));
- if (REAL_VALUE_ISINF (args->value) && pedantic)
- warning ("floating point number exceeds range of `long double'");
- }
- else
- {
- args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type));
- if (REAL_VALUE_ISINF (args->value) && pedantic)
- warning ("floating point number exceeds range of `double'");
- }
-}
-
-int
-real_yylex ()
-{
- register int c;
- register int value;
- int wide_flag = 0;
- int dollar_seen = 0;
- int i;
-
- if (nextchar >= 0)
- c = nextchar, nextchar = -1;
- else
- c = getch ();
-
- /* Effectively do c = skip_white_space (c)
- but do it faster in the usual cases. */
- while (1)
- switch (c)
- {
- case ' ':
- case '\t':
- case '\f':
- case '\v':
- case '\b':
- c = getch ();
- break;
-
- case '\r':
- /* Call skip_white_space so we can warn if appropriate. */
-
- case '\n':
- case '/':
- case '\\':
- c = skip_white_space (c);
- default:
- goto found_nonwhite;
- }
- found_nonwhite:
-
- token_buffer[0] = c;
- token_buffer[1] = 0;
-
-/* yylloc.first_line = lineno; */
-
- switch (c)
- {
- case EOF:
- token_buffer[0] = '\0';
- end_of_file = 1;
- if (input_redirected ())
- value = END_OF_SAVED_INPUT;
- else if (linemode)
- value = END_OF_LINE;
- else
- value = ENDFILE;
- break;
-
- case '$':
- if (! dollars_in_ident)
- error ("`$' in identifier");
- else if (pedantic)
- pedwarn ("`$' in identifier");
- dollar_seen = 1;
- goto letter;
-
- case 'L':
- /* Capital L may start a wide-string or wide-character constant. */
- {
- register int c = getch ();
- if (c == '\'')
- {
- wide_flag = 1;
- goto char_constant;
- }
- if (c == '"')
- {
- wide_flag = 1;
- goto string_constant;
- }
- put_back (c);
- }
-
- case 'A': case 'B': case 'C': case 'D': case 'E':
- case 'F': case 'G': case 'H': case 'I': case 'J':
- case 'K': case 'M': case 'N': case 'O':
- case 'P': case 'Q': case 'R': case 'S': case 'T':
- case 'U': case 'V': case 'W': case 'X': case 'Y':
- case 'Z':
- case 'a': case 'b': case 'c': case 'd': case 'e':
- case 'f': case 'g': case 'h': case 'i': case 'j':
- case 'k': case 'l': case 'm': case 'n': case 'o':
- case 'p': case 'q': case 'r': case 's': case 't':
- case 'u': case 'v': case 'w': case 'x': case 'y':
- case 'z':
- case '_':
- letter:
- {
- register char *p;
-
- p = token_buffer;
- if (input == 0)
- {
- /* We know that `token_buffer' can hold at least on char,
- so we install C immediately.
- We may have to read the value in `putback_char', so call
- `getch' once. */
- *p++ = c;
- c = getch ();
-
- /* Make this run fast. We know that we are reading straight
- from FINPUT in this case (since identifiers cannot straddle
- input sources. */
- while (ISALNUM (c) || (c == '_') || c == '$')
- {
- if (c == '$')
- {
- if (! dollars_in_ident)
- error ("`$' in identifier");
- else if (pedantic)
- pedwarn ("`$' in identifier");
- }
-
- if (p >= token_buffer + maxtoken)
- p = extend_token_buffer (p);
-
- *p++ = c;
- c = getch ();
- }
-
- if (linemode && c == '\n')
- {
- put_back (c);
- c = EOF;
- }
- }
- else
- {
- /* We know that `token_buffer' can hold at least on char,
- so we install C immediately. */
- *p++ = c;
- c = getch ();
-
- while (ISALNUM (c) || (c == '_') || c == '$')
- {
- if (c == '$')
- {
- if (! dollars_in_ident)
- error ("`$' in identifier");
- else if (pedantic)
- pedwarn ("`$' in identifier");
- }
-
- if (p >= token_buffer + maxtoken)
- p = extend_token_buffer (p);
-
- *p++ = c;
- c = getch ();
- }
- }
-
- *p = 0;
- nextchar = c;
-
- value = IDENTIFIER;
- yylval.itype = 0;
-
- /* Try to recognize a keyword. Uses minimum-perfect hash function */
-
- {
- register struct resword *ptr;
-
- if ((ptr = is_reserved_word (token_buffer, p - token_buffer)))
- {
- if (ptr->rid)
- {
- tree old_ttype = ridpointers[(int) ptr->rid];
-
- /* If this provides a type for us, then revert lexical
- state to standard state. */
- if (TREE_CODE (old_ttype) == IDENTIFIER_NODE
- && IDENTIFIER_GLOBAL_VALUE (old_ttype) != 0
- && TREE_CODE (IDENTIFIER_GLOBAL_VALUE (old_ttype)) == TYPE_DECL)
- looking_for_typename = 0;
- else if (ptr->token == AGGR || ptr->token == ENUM)
- looking_for_typename = 2;
-
- /* Check if this is a language-type declaration.
- Just glimpse the next non-white character. */
- nextchar = skip_white_space (nextchar);
- if (nextchar == '"')
- {
- /* We are looking at a string. Complain
- if the token before the string is no `extern'.
-
- Could cheat some memory by placing this string
- on the temporary_, instead of the saveable_
- obstack. */
-
- if (ptr->rid != RID_EXTERN)
- error ("invalid modifier `%s' for language string",
- ptr->name);
- real_yylex ();
- value = EXTERN_LANG_STRING;
- yylval.ttype = get_identifier (TREE_STRING_POINTER (yylval.ttype));
- break;
- }
- if (ptr->token == VISSPEC)
- {
- switch (ptr->rid)
- {
- case RID_PUBLIC:
- yylval.ttype = access_public_node;
- break;
- case RID_PRIVATE:
- yylval.ttype = access_private_node;
- break;
- case RID_PROTECTED:
- yylval.ttype = access_protected_node;
- break;
- default:
- my_friendly_abort (63);
- }
- }
- else
- yylval.ttype = old_ttype;
- }
- else if (ptr->token == EQCOMPARE)
- {
- yylval.code = NE_EXPR;
- token_buffer[0] = '!';
- token_buffer[1] = '=';
- token_buffer[2] = 0;
- }
- else if (ptr->token == ASSIGN)
- {
- if (strcmp ("and_eq", token_buffer) == 0)
- {
- yylval.code = BIT_AND_EXPR;
- token_buffer[0] = '&';
- }
- else if (strcmp ("or_eq", token_buffer) == 0)
- {
- yylval.code = BIT_IOR_EXPR;
- token_buffer[0] = '|';
- }
- else if (strcmp ("xor_eq", token_buffer) == 0)
- {
- yylval.code = BIT_XOR_EXPR;
- token_buffer[0] = '^';
- }
- token_buffer[1] = '=';
- token_buffer[2] = 0;
- }
- else if (ptr->token == '&')
- {
- yylval.code = BIT_AND_EXPR;
- token_buffer[0] = '&';
- token_buffer[1] = 0;
- }
- else if (ptr->token == '|')
- {
- yylval.code = BIT_IOR_EXPR;
- token_buffer[0] = '|';
- token_buffer[1] = 0;
- }
- else if (ptr->token == '^')
- {
- yylval.code = BIT_XOR_EXPR;
- token_buffer[0] = '^';
- token_buffer[1] = 0;
- }
-
- value = (int) ptr->token;
- }
- }
-
- /* If we did not find a keyword, look for an identifier
- (or a typename). */
-
- if (value == IDENTIFIER || value == TYPESPEC)
- GNU_xref_ref (current_function_decl, token_buffer);
-
- if (value == IDENTIFIER)
- {
- register tree tmp = get_identifier (token_buffer);
-
-#if !defined(VMS) && defined(JOINER)
- /* Make sure that user does not collide with our internal
- naming scheme. */
- if (JOINER == '$'
- && dollar_seen
- && (THIS_NAME_P (tmp)
- || VPTR_NAME_P (tmp)
- || DESTRUCTOR_NAME_P (tmp)
- || VTABLE_NAME_P (tmp)
- || TEMP_NAME_P (tmp)
- || ANON_AGGRNAME_P (tmp)
- || ANON_PARMNAME_P (tmp)))
- warning ("identifier name `%s' conflicts with GNU C++ internal naming strategy",
- token_buffer);
-#endif
-
- yylval.ttype = tmp;
- }
- if (value == NEW && ! global_bindings_p ())
- {
- value = NEW;
- goto done;
- }
- }
- break;
-
- case '.':
- {
- register int c1 = getch ();
- token_buffer[0] = c;
- token_buffer[1] = c1;
- if (c1 == '*')
- {
- value = DOT_STAR;
- token_buffer[2] = 0;
- goto done;
- }
- if (c1 == '.')
- {
- c1 = getch ();
- if (c1 == '.')
- {
- token_buffer[2] = c1;
- token_buffer[3] = 0;
- value = ELLIPSIS;
- goto done;
- }
- error ("parse error at `..'");
- }
- if (ISDIGIT (c1))
- {
- put_back (c1);
- goto resume_numerical_scan;
- }
- nextchar = c1;
- value = '.';
- token_buffer[1] = 0;
- goto done;
- }
- case '0': case '1':
- /* Optimize for most frequent case. */
- {
- register int c1 = getch ();
- if (! ISALNUM (c1) && c1 != '.')
- {
- /* Terminate string. */
- token_buffer[0] = c;
- token_buffer[1] = 0;
- if (c == '0')
- yylval.ttype = integer_zero_node;
- else
- yylval.ttype = integer_one_node;
- nextchar = c1;
- value = CONSTANT;
- goto done;
- }
- put_back (c1);
- }
- /* fall through... */
- case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- resume_numerical_scan:
- {
- register char *p;
- int base = 10;
- int count = 0;
- int largest_digit = 0;
- int numdigits = 0;
- /* for multi-precision arithmetic,
- we actually store only HOST_BITS_PER_CHAR bits in each part.
- The number of parts is chosen so as to be sufficient to hold
- the enough bits to fit into the two HOST_WIDE_INTs that contain
- the integer value (this is always at least as many bits as are
- in a target `long long' value, but may be wider). */
-#define TOTAL_PARTS ((HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR) * 2 + 2)
- int parts[TOTAL_PARTS];
- int overflow = 0;
-
- enum anon1 { NOT_FLOAT, AFTER_POINT, TOO_MANY_POINTS} floatflag
- = NOT_FLOAT;
-
- for (count = 0; count < TOTAL_PARTS; count++)
- parts[count] = 0;
-
- p = token_buffer;
- *p++ = c;
-
- if (c == '0')
- {
- *p++ = (c = getch ());
- if ((c == 'x') || (c == 'X'))
- {
- base = 16;
- *p++ = (c = getch ());
- }
- /* Leading 0 forces octal unless the 0 is the only digit. */
- else if (c >= '0' && c <= '9')
- {
- base = 8;
- numdigits++;
- }
- else
- numdigits++;
- }
-
- /* Read all the digits-and-decimal-points. */
-
- while (c == '.'
- || (ISALNUM (c) && (c != 'l') && (c != 'L')
- && (c != 'u') && (c != 'U')
- && c != 'i' && c != 'I' && c != 'j' && c != 'J'
- && (floatflag == NOT_FLOAT || ((c != 'f') && (c != 'F')))))
- {
- if (c == '.')
- {
- if (base == 16)
- error ("floating constant may not be in radix 16");
- if (floatflag == TOO_MANY_POINTS)
- /* We have already emitted an error. Don't need another. */
- ;
- else if (floatflag == AFTER_POINT)
- {
- error ("malformed floating constant");
- floatflag = TOO_MANY_POINTS;
- /* Avoid another error from atof by forcing all characters
- from here on to be ignored. */
- p[-1] = '\0';
- }
- else
- floatflag = AFTER_POINT;
-
- base = 10;
- *p++ = c = getch ();
- /* Accept '.' as the start of a floating-point number
- only when it is followed by a digit.
- Otherwise, unread the following non-digit
- and use the '.' as a structural token. */
- if (p == token_buffer + 2 && !ISDIGIT (c))
- {
- if (c == '.')
- {
- c = getch ();
- if (c == '.')
- {
- *p++ = '.';
- *p = '\0';
- value = ELLIPSIS;
- goto done;
- }
- error ("parse error at `..'");
- }
- nextchar = c;
- token_buffer[1] = '\0';
- value = '.';
- goto done;
- }
- }
- else
- {
- /* It is not a decimal point.
- It should be a digit (perhaps a hex digit). */
-
- if (ISDIGIT (c))
- {
- c = c - '0';
- }
- else if (base <= 10)
- {
- if (c == 'e' || c == 'E')
- {
- base = 10;
- floatflag = AFTER_POINT;
- break; /* start of exponent */
- }
- error ("nondigits in number and not hexadecimal");
- c = 0;
- }
- else if (c >= 'a')
- {
- c = c - 'a' + 10;
- }
- else
- {
- c = c - 'A' + 10;
- }
- if (c >= largest_digit)
- largest_digit = c;
- numdigits++;
-
- for (count = 0; count < TOTAL_PARTS; count++)
- {
- parts[count] *= base;
- if (count)
- {
- parts[count]
- += (parts[count-1] >> HOST_BITS_PER_CHAR);
- parts[count-1]
- &= (1 << HOST_BITS_PER_CHAR) - 1;
- }
- else
- parts[0] += c;
- }
-
- /* If the extra highest-order part ever gets anything in it,
- the number is certainly too big. */
- if (parts[TOTAL_PARTS - 1] != 0)
- overflow = 1;
-
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = (c = getch ());
- }
- }
-
- if (numdigits == 0)
- error ("numeric constant with no digits");
-
- if (largest_digit >= base)
- error ("numeric constant contains digits beyond the radix");
-
- /* Remove terminating char from the token buffer and delimit the string */
- *--p = 0;
-
- if (floatflag != NOT_FLOAT)
- {
- tree type = double_type_node;
- int exceeds_double = 0;
- int imag = 0;
- REAL_VALUE_TYPE value;
- struct pf_args args;
-
- /* Read explicit exponent if any, and put it in tokenbuf. */
-
- if ((c == 'e') || (c == 'E'))
- {
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = c;
- c = getch ();
- if ((c == '+') || (c == '-'))
- {
- *p++ = c;
- c = getch ();
- }
- if (! ISDIGIT (c))
- error ("floating constant exponent has no digits");
- while (ISDIGIT (c))
- {
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = c;
- c = getch ();
- }
- }
-
- *p = 0;
- errno = 0;
-
- /* Setup input for parse_float() */
- args.p = p;
- args.c = c;
- args.imag = imag;
- args.type = type;
-
- /* Convert string to a double, checking for overflow. */
- if (do_float_handler (parse_float, (PTR) &args))
- {
- /* Receive output from parse_float() */
- value = args.value;
- }
- else
- {
- /* We got an exception from parse_float() */
- error ("floating constant out of range");
- value = dconst0;
- }
-
- /* Receive output from parse_float() */
- p = args.p;
- c = args.c;
- imag = args.imag;
- type = args.type;
-
-#ifdef ERANGE
- if (errno == ERANGE && pedantic)
- {
- /* ERANGE is also reported for underflow,
- so test the value to distinguish overflow from that. */
- if (REAL_VALUES_LESS (dconst1, value)
- || REAL_VALUES_LESS (value, dconstm1))
- {
- pedwarn ("floating point number exceeds range of `%s'",
- IDENTIFIER_POINTER (TYPE_IDENTIFIER (type)));
- exceeds_double = 1;
- }
- }
-#endif
-
- /* If the result is not a number, assume it must have been
- due to some error message above, so silently convert
- it to a zero. */
- if (REAL_VALUE_ISNAN (value))
- value = dconst0;
-
- /* Create a node with determined type and value. */
- if (imag)
- yylval.ttype = build_complex (NULL_TREE,
- cp_convert (type, integer_zero_node),
- build_real (type, value));
- else
- yylval.ttype = build_real (type, value);
- }
- else
- {
- tree type;
- HOST_WIDE_INT high, low;
- int spec_unsigned = 0;
- int spec_long = 0;
- int spec_long_long = 0;
- int spec_imag = 0;
- int bytes, warn;
-
- while (1)
- {
- if (c == 'u' || c == 'U')
- {
- if (spec_unsigned)
- error ("two `u's in integer constant");
- spec_unsigned = 1;
- }
- else if (c == 'l' || c == 'L')
- {
- if (spec_long)
- {
- if (spec_long_long)
- error ("three `l's in integer constant");
- else if (pedantic && ! in_system_header && warn_long_long)
- pedwarn ("ANSI C++ forbids long long integer constants");
- spec_long_long = 1;
- }
- spec_long = 1;
- }
- else if (c == 'i' || c == 'j' || c == 'I' || c == 'J')
- {
- if (spec_imag)
- error ("more than one `i' or `j' in numeric constant");
- else if (pedantic)
- pedwarn ("ANSI C++ forbids imaginary numeric constants");
- spec_imag = 1;
- }
- else
- break;
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = c;
- c = getch ();
- }
-
- /* If the constant is not long long and it won't fit in an
- unsigned long, or if the constant is long long and won't fit
- in an unsigned long long, then warn that the constant is out
- of range. */
-
- /* ??? This assumes that long long and long integer types are
- a multiple of 8 bits. This better than the original code
- though which assumed that long was exactly 32 bits and long
- long was exactly 64 bits. */
-
- if (spec_long_long)
- bytes = TYPE_PRECISION (long_long_integer_type_node) / 8;
- else
- bytes = TYPE_PRECISION (long_integer_type_node) / 8;
-
- warn = overflow;
- for (i = bytes; i < TOTAL_PARTS; i++)
- if (parts[i])
- warn = 1;
- if (warn)
- pedwarn ("integer constant out of range");
-
- /* This is simplified by the fact that our constant
- is always positive. */
- high = low = 0;
-
- for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; i++)
- {
- high |= ((HOST_WIDE_INT) parts[i + (HOST_BITS_PER_WIDE_INT
- / HOST_BITS_PER_CHAR)]
- << (i * HOST_BITS_PER_CHAR));
- low |= (HOST_WIDE_INT) parts[i] << (i * HOST_BITS_PER_CHAR);
- }
-
-
- yylval.ttype = build_int_2 (low, high);
- TREE_TYPE (yylval.ttype) = long_long_unsigned_type_node;
-
- /* Calculate the ANSI type. */
- if (!spec_long && !spec_unsigned
- && int_fits_type_p (yylval.ttype, integer_type_node))
- type = integer_type_node;
- else if (!spec_long && (base != 10 || spec_unsigned)
- && int_fits_type_p (yylval.ttype, unsigned_type_node))
- /* Nondecimal constants try unsigned even in traditional C. */
- type = unsigned_type_node;
- else if (!spec_unsigned && !spec_long_long
- && int_fits_type_p (yylval.ttype, long_integer_type_node))
- type = long_integer_type_node;
- else if (! spec_long_long)
- type = long_unsigned_type_node;
- else if (! spec_unsigned
- /* Verify value does not overflow into sign bit. */
- && TREE_INT_CST_HIGH (yylval.ttype) >= 0
- && int_fits_type_p (yylval.ttype,
- long_long_integer_type_node))
- type = long_long_integer_type_node;
- else
- type = long_long_unsigned_type_node;
-
- if (!int_fits_type_p (yylval.ttype, type) && !warn)
- pedwarn ("integer constant out of range");
-
- if (base == 10 && ! spec_unsigned && TREE_UNSIGNED (type))
- warning ("decimal integer constant is so large that it is unsigned");
-
- if (spec_imag)
- {
- if (TYPE_PRECISION (type)
- <= TYPE_PRECISION (integer_type_node))
- yylval.ttype
- = build_complex (NULL_TREE, integer_zero_node,
- cp_convert (integer_type_node,
- yylval.ttype));
- else
- error ("complex integer constant is too wide for `__complex int'");
- }
- else
- TREE_TYPE (yylval.ttype) = type;
- }
-
- put_back (c);
- *p = 0;
-
- value = CONSTANT; break;
- }
-
- case '\'':
- char_constant:
- {
- register int result = 0;
- register int num_chars = 0;
- int chars_seen = 0;
- unsigned width = TYPE_PRECISION (char_type_node);
- int max_chars;
-#ifdef MULTIBYTE_CHARS
- int longest_char = local_mb_cur_max ();
- (void) local_mbtowc (NULL_PTR, NULL_PTR, 0);
-#endif
-
- max_chars = TYPE_PRECISION (integer_type_node) / width;
- if (wide_flag)
- width = WCHAR_TYPE_SIZE;
-
- while (1)
- {
- tryagain:
- c = getch ();
-
- if (c == '\'' || c == EOF)
- break;
-
- ++chars_seen;
- if (c == '\\')
- {
- int ignore = 0;
- c = readescape (&ignore);
- if (ignore)
- goto tryagain;
- if (width < HOST_BITS_PER_INT
- && (unsigned) c >= ((unsigned)1 << width))
- pedwarn ("escape sequence out of range for character");
-#ifdef MAP_CHARACTER
- if (ISPRINT (c))
- c = MAP_CHARACTER (c);
-#endif
- }
- else if (c == '\n')
- {
- if (pedantic)
- pedwarn ("ANSI C forbids newline in character constant");
- lineno++;
- }
- else
- {
-#ifdef MULTIBYTE_CHARS
- wchar_t wc;
- int i;
- int char_len = -1;
- for (i = 1; i <= longest_char; ++i)
- {
- if (i > maxtoken - 4)
- extend_token_buffer (token_buffer);
-
- token_buffer[i] = c;
- char_len = local_mbtowc (& wc,
- token_buffer + 1,
- i);
- if (char_len != -1)
- break;
- c = getch ();
- }
- if (char_len > 1)
- {
- /* mbtowc sometimes needs an extra char before accepting */
- if (char_len < i)
- put_back (c);
- if (! wide_flag)
- {
- /* Merge character into result; ignore excess chars. */
- for (i = 1; i <= char_len; ++i)
- {
- if (i > max_chars)
- break;
- if (width < HOST_BITS_PER_INT)
- result = (result << width)
- | (token_buffer[i]
- & ((1 << width) - 1));
- else
- result = token_buffer[i];
- }
- num_chars += char_len;
- goto tryagain;
- }
- c = wc;
- }
- else
- {
- if (char_len == -1)
- warning ("Ignoring invalid multibyte character");
- if (wide_flag)
- c = wc;
-#ifdef MAP_CHARACTER
- else
- c = MAP_CHARACTER (c);
-#endif
- }
-#else /* ! MULTIBYTE_CHARS */
-#ifdef MAP_CHARACTER
- c = MAP_CHARACTER (c);
-#endif
-#endif /* ! MULTIBYTE_CHARS */
- }
-
- if (wide_flag)
- {
- if (chars_seen == 1) /* only keep the first one */
- result = c;
- goto tryagain;
- }
-
- /* Merge character into result; ignore excess chars. */
- num_chars++;
- if (num_chars < max_chars + 1)
- {
- if (width < HOST_BITS_PER_INT)
- result = (result << width) | (c & ((1 << width) - 1));
- else
- result = c;
- }
- }
-
- if (c != '\'')
- error ("malformatted character constant");
- else if (chars_seen == 0)
- error ("empty character constant");
- else if (num_chars > max_chars)
- {
- num_chars = max_chars;
- error ("character constant too long");
- }
- else if (chars_seen != 1 && warn_multichar)
- warning ("multi-character character constant");
-
- /* If char type is signed, sign-extend the constant. */
- if (! wide_flag)
- {
- int num_bits = num_chars * width;
- if (num_bits == 0)
- /* We already got an error; avoid invalid shift. */
- yylval.ttype = build_int_2 (0, 0);
- else if (TREE_UNSIGNED (char_type_node)
- || ((result >> (num_bits - 1)) & 1) == 0)
- yylval.ttype
- = build_int_2 (result & (~(unsigned HOST_WIDE_INT) 0
- >> (HOST_BITS_PER_WIDE_INT - num_bits)),
- 0);
- else
- yylval.ttype
- = build_int_2 (result | ~(~(unsigned HOST_WIDE_INT) 0
- >> (HOST_BITS_PER_WIDE_INT - num_bits)),
- -1);
- if (chars_seen <= 1)
- TREE_TYPE (yylval.ttype) = char_type_node;
- else
- TREE_TYPE (yylval.ttype) = integer_type_node;
- }
- else
- {
- yylval.ttype = build_int_2 (result, 0);
- TREE_TYPE (yylval.ttype) = wchar_type_node;
- }
-
- value = CONSTANT;
- break;
- }
-
- case '"':
- string_constant:
- {
- register char *p;
- unsigned width = wide_flag ? WCHAR_TYPE_SIZE
- : TYPE_PRECISION (char_type_node);
-#ifdef MULTIBYTE_CHARS
- int longest_char = local_mb_cur_max ();
- (void) local_mbtowc (NULL_PTR, NULL_PTR, 0);
-#endif
-
- c = getch ();
- p = token_buffer + 1;
-
- while (c != '"' && c >= 0)
- {
- /* ignore_escape_flag is set for reading the filename in #line. */
- if (!ignore_escape_flag && c == '\\')
- {
- int ignore = 0;
- c = readescape (&ignore);
- if (ignore)
- goto skipnewline;
- if (width < HOST_BITS_PER_INT
- && (unsigned) c >= ((unsigned)1 << width))
- warning ("escape sequence out of range for character");
- }
- else if (c == '\n')
- {
- if (pedantic)
- pedwarn ("ANSI C++ forbids newline in string constant");
- lineno++;
- }
- else
- {
-#ifdef MULTIBYTE_CHARS
- wchar_t wc;
- int i;
- int char_len = -1;
- for (i = 0; i < longest_char; ++i)
- {
- if (p + i >= token_buffer + maxtoken)
- p = extend_token_buffer (p);
- p[i] = c;
-
- char_len = local_mbtowc (& wc, p, i + 1);
- if (char_len != -1)
- break;
- c = getch ();
- }
- if (char_len == -1)
- warning ("Ignoring invalid multibyte character");
- else
- {
- /* mbtowc sometimes needs an extra char before accepting */
- if (char_len <= i)
- put_back (c);
- if (! wide_flag)
- {
- p += (i + 1);
- c = getch ();
- continue;
- }
- c = wc;
- }
-#endif /* MULTIBYTE_CHARS */
- }
-
- /* Add this single character into the buffer either as a wchar_t
- or as a single byte. */
- if (wide_flag)
- {
- unsigned width = TYPE_PRECISION (char_type_node);
- unsigned bytemask = (1 << width) - 1;
- int byte;
-
- if (p + WCHAR_BYTES > token_buffer + maxtoken)
- p = extend_token_buffer (p);
-
- for (byte = 0; byte < WCHAR_BYTES; ++byte)
- {
- int value;
- if (byte >= (int) sizeof(c))
- value = 0;
- else
- value = (c >> (byte * width)) & bytemask;
- if (BYTES_BIG_ENDIAN)
- p[WCHAR_BYTES - byte - 1] = value;
- else
- p[byte] = value;
- }
- p += WCHAR_BYTES;
- }
- else
- {
- if (p >= token_buffer + maxtoken)
- p = extend_token_buffer (p);
- *p++ = c;
- }
-
- skipnewline:
- c = getch ();
- if (c == EOF) {
- error ("Unterminated string");
- break;
- }
- }
-
- /* Terminate the string value, either with a single byte zero
- or with a wide zero. */
- if (wide_flag)
- {
- if (p + WCHAR_BYTES > token_buffer + maxtoken)
- p = extend_token_buffer (p);
- bzero (p, WCHAR_BYTES);
- p += WCHAR_BYTES;
- }
- else
- {
- if (p >= token_buffer + maxtoken)
- p = extend_token_buffer (p);
- *p++ = 0;
- }
-
- /* We have read the entire constant.
- Construct a STRING_CST for the result. */
-
- if (processing_template_decl)
- push_obstacks (&permanent_obstack, &permanent_obstack);
- yylval.ttype = build_string (p - (token_buffer + 1), token_buffer + 1);
- if (processing_template_decl)
- pop_obstacks ();
-
- if (wide_flag)
- TREE_TYPE (yylval.ttype) = wchar_array_type_node;
- else
- TREE_TYPE (yylval.ttype) = char_array_type_node;
-
- value = STRING; break;
- }
-
- case '+':
- case '-':
- case '&':
- case '|':
- case '<':
- case '>':
- case '*':
- case '/':
- case '%':
- case '^':
- case '!':
- case '=':
- {
- register int c1;
-
- combine:
-
- switch (c)
- {
- case '+':
- yylval.code = PLUS_EXPR; break;
- case '-':
- yylval.code = MINUS_EXPR; break;
- case '&':
- yylval.code = BIT_AND_EXPR; break;
- case '|':
- yylval.code = BIT_IOR_EXPR; break;
- case '*':
- yylval.code = MULT_EXPR; break;
- case '/':
- yylval.code = TRUNC_DIV_EXPR; break;
- case '%':
- yylval.code = TRUNC_MOD_EXPR; break;
- case '^':
- yylval.code = BIT_XOR_EXPR; break;
- case LSHIFT:
- yylval.code = LSHIFT_EXPR; break;
- case RSHIFT:
- yylval.code = RSHIFT_EXPR; break;
- case '<':
- yylval.code = LT_EXPR; break;
- case '>':
- yylval.code = GT_EXPR; break;
- }
-
- token_buffer[1] = c1 = getch ();
- token_buffer[2] = 0;
-
- if (c1 == '=')
- {
- switch (c)
- {
- case '<':
- value = ARITHCOMPARE; yylval.code = LE_EXPR; goto done;
- case '>':
- value = ARITHCOMPARE; yylval.code = GE_EXPR; goto done;
- case '!':
- value = EQCOMPARE; yylval.code = NE_EXPR; goto done;
- case '=':
- value = EQCOMPARE; yylval.code = EQ_EXPR; goto done;
- }
- value = ASSIGN; goto done;
- }
- else if (c == c1)
- switch (c)
- {
- case '+':
- value = PLUSPLUS; goto done;
- case '-':
- value = MINUSMINUS; goto done;
- case '&':
- value = ANDAND; goto done;
- case '|':
- value = OROR; goto done;
- case '<':
- c = LSHIFT;
- goto combine;
- case '>':
- c = RSHIFT;
- goto combine;
- }
- else if ((c == '-') && (c1 == '>'))
- {
- nextchar = getch ();
- if (nextchar == '*')
- {
- nextchar = -1;
- value = POINTSAT_STAR;
- }
- else
- value = POINTSAT;
- goto done;
- }
- else if (c1 == '?' && (c == '<' || c == '>'))
- {
- token_buffer[3] = 0;
-
- c1 = getch ();
- yylval.code = (c == '<' ? MIN_EXPR : MAX_EXPR);
- if (c1 == '=')
- {
- /* <?= or >?= expression. */
- token_buffer[2] = c1;
- value = ASSIGN;
- }
- else
- {
- value = MIN_MAX;
- nextchar = c1;
- }
- if (pedantic)
- pedwarn ("use of `operator %s' is not standard C++",
- token_buffer);
- goto done;
- }
- /* digraphs */
- else if (c == '<' && c1 == '%')
- { value = '{'; goto done; }
- else if (c == '<' && c1 == ':')
- { value = '['; goto done; }
- else if (c == '%' && c1 == '>')
- { value = '}'; goto done; }
- else if (c == '%' && c1 == ':')
- { value = '#'; goto done; }
-
- nextchar = c1;
- token_buffer[1] = 0;
-
- value = c;
- goto done;
- }
-
- case ':':
- c = getch ();
- if (c == ':')
- {
- token_buffer[1] = ':';
- token_buffer[2] = '\0';
- value = SCOPE;
- yylval.itype = 1;
- }
- else if (c == '>')
- {
- value = ']';
- goto done;
- }
- else
- {
- nextchar = c;
- value = ':';
- }
- break;
-
- case 0:
- /* Don't make yyparse think this is eof. */
- value = 1;
- break;
-
- case '(':
- /* try, weakly, to handle casts to pointers to functions. */
- nextchar = skip_white_space (getch ());
- if (nextchar == '*')
- {
- int next_c = skip_white_space (getch ());
- if (next_c == ')')
- {
- nextchar = -1;
- yylval.ttype = build1 (INDIRECT_REF, 0, 0);
- value = PAREN_STAR_PAREN;
- }
- else
- {
- put_back (next_c);
- value = c;
- }
- }
- else if (nextchar == ')')
- {
- nextchar = -1;
- yylval.ttype = NULL_TREE;
- value = LEFT_RIGHT;
- }
- else value = c;
- break;
-
- default:
- value = c;
- }
-
-done:
-/* yylloc.last_line = lineno; */
-#ifdef GATHER_STATISTICS
-#ifdef REDUCE_LENGTH
- token_count[value] += 1;
-#endif
-#endif
-
- return value;
-}
-
-int
-is_rid (t)
- tree t;
-{
- return !!is_reserved_word (IDENTIFIER_POINTER (t), IDENTIFIER_LENGTH (t));
-}
-
#ifdef GATHER_STATISTICS
/* The original for tree_node_kind is in the toplevel tree.c; changes there
need to be brought into here, unless this were actually put into a header
@@ -4531,18 +1476,17 @@ extern int tree_node_counts[];
extern int tree_node_sizes[];
#endif
-/* Place to save freed lang_decls which were allocated on the
- permanent_obstack. @@ Not currently used. */
-tree free_lang_decl_chain;
-
tree
build_lang_decl (code, name, type)
enum tree_code code;
tree name;
tree type;
{
- register tree t = build_decl (code, name, type);
+ tree t;
+
+ t = build_decl (code, name, type);
retrofit_lang_decl (t);
+
return t;
}
@@ -4553,133 +1497,130 @@ void
retrofit_lang_decl (t)
tree t;
{
- struct obstack *obstack = current_obstack;
- register int i = sizeof (struct lang_decl) / sizeof (int);
- register int *pi;
-
- if (! TREE_PERMANENT (t))
- obstack = saveable_obstack;
- else
- /* Could be that saveable is permanent and current is not. */
- obstack = &permanent_obstack;
+ struct lang_decl *ld;
+ size_t size;
- if (free_lang_decl_chain && obstack == &permanent_obstack)
- {
- pi = (int *)free_lang_decl_chain;
- free_lang_decl_chain = TREE_CHAIN (free_lang_decl_chain);
- }
+ if (CAN_HAVE_FULL_LANG_DECL_P (t))
+ size = sizeof (struct lang_decl);
else
- pi = (int *) obstack_alloc (obstack, sizeof (struct lang_decl));
+ size = sizeof (struct lang_decl_flags);
- while (i > 0)
- pi[--i] = 0;
+ ld = (struct lang_decl *) ggc_alloc_cleared (size);
- DECL_LANG_SPECIFIC (t) = (struct lang_decl *) pi;
- LANG_DECL_PERMANENT ((struct lang_decl *) pi)
- = obstack == &permanent_obstack;
- my_friendly_assert (LANG_DECL_PERMANENT ((struct lang_decl *) pi)
- == TREE_PERMANENT (t), 234);
- DECL_MAIN_VARIANT (t) = t;
+ DECL_LANG_SPECIFIC (t) = ld;
if (current_lang_name == lang_name_cplusplus)
- DECL_LANGUAGE (t) = lang_cplusplus;
+ SET_DECL_LANGUAGE (t, lang_cplusplus);
else if (current_lang_name == lang_name_c)
- DECL_LANGUAGE (t) = lang_c;
+ SET_DECL_LANGUAGE (t, lang_c);
else if (current_lang_name == lang_name_java)
- DECL_LANGUAGE (t) = lang_java;
- else my_friendly_abort (64);
+ SET_DECL_LANGUAGE (t, lang_java);
+ else abort ();
-#if 0 /* not yet, should get fixed properly later */
- if (code == TYPE_DECL)
- {
- tree id;
- id = get_identifier (build_overload_name (type, 1, 1));
- DECL_ASSEMBLER_NAME (t) = id;
- }
-
-#endif
#ifdef GATHER_STATISTICS
tree_node_counts[(int)lang_decl] += 1;
- tree_node_sizes[(int)lang_decl] += sizeof (struct lang_decl);
+ tree_node_sizes[(int)lang_decl] += size;
#endif
}
-tree
-build_lang_field_decl (code, name, type)
- enum tree_code code;
- tree name;
- tree type;
+void
+copy_lang_decl (node)
+ tree node;
{
- extern struct obstack *current_obstack, *saveable_obstack;
- register tree t = build_decl (code, name, type);
- struct obstack *obstack = current_obstack;
- register int i = sizeof (struct lang_decl_flags) / sizeof (int);
- register int *pi;
-#if 0 /* not yet, should get fixed properly later */
-
- if (code == TYPE_DECL)
- {
- tree id;
- id = get_identifier (build_overload_name (type, 1, 1));
- DECL_ASSEMBLER_NAME (t) = id;
- }
-#endif
+ int size;
+ struct lang_decl *ld;
+
+ if (! DECL_LANG_SPECIFIC (node))
+ return;
- if (! TREE_PERMANENT (t))
- obstack = saveable_obstack;
+ if (!CAN_HAVE_FULL_LANG_DECL_P (node))
+ size = sizeof (struct lang_decl_flags);
else
- my_friendly_assert (obstack == &permanent_obstack, 235);
+ size = sizeof (struct lang_decl);
+ ld = (struct lang_decl *) ggc_alloc (size);
+ memcpy (ld, DECL_LANG_SPECIFIC (node), size);
+ DECL_LANG_SPECIFIC (node) = ld;
+
+#ifdef GATHER_STATISTICS
+ tree_node_counts[(int)lang_decl] += 1;
+ tree_node_sizes[(int)lang_decl] += size;
+#endif
+}
- pi = (int *) obstack_alloc (obstack, sizeof (struct lang_decl_flags));
- while (i > 0)
- pi[--i] = 0;
+/* Copy DECL, including any language-specific parts. */
- DECL_LANG_SPECIFIC (t) = (struct lang_decl *) pi;
- return t;
+tree
+copy_decl (decl)
+ tree decl;
+{
+ tree copy;
+
+ copy = copy_node (decl);
+ copy_lang_decl (copy);
+ return copy;
}
-void
-copy_lang_decl (node)
+/* Replace the shared language-specific parts of NODE with a new copy. */
+
+static void
+copy_lang_type (node)
tree node;
{
int size;
- int *pi;
+ struct lang_type *lt;
- if (! DECL_LANG_SPECIFIC (node))
+ if (! TYPE_LANG_SPECIFIC (node))
return;
- if (TREE_CODE (node) == FIELD_DECL)
- size = sizeof (struct lang_decl_flags);
- else
- size = sizeof (struct lang_decl);
- pi = (int *)obstack_alloc (&permanent_obstack, size);
- bcopy ((char *)DECL_LANG_SPECIFIC (node), (char *)pi, size);
- DECL_LANG_SPECIFIC (node) = (struct lang_decl *)pi;
+ size = sizeof (struct lang_type);
+ lt = (struct lang_type *) ggc_alloc (size);
+ memcpy (lt, TYPE_LANG_SPECIFIC (node), size);
+ TYPE_LANG_SPECIFIC (node) = lt;
+
+#ifdef GATHER_STATISTICS
+ tree_node_counts[(int)lang_type] += 1;
+ tree_node_sizes[(int)lang_type] += size;
+#endif
}
+/* Copy TYPE, including any language-specific parts. */
+
tree
-make_lang_type (code)
+copy_type (type)
+ tree type;
+{
+ tree copy;
+
+ copy = copy_node (type);
+ copy_lang_type (copy);
+ return copy;
+}
+
+tree
+cp_make_lang_type (code)
enum tree_code code;
{
- extern struct obstack *current_obstack, *saveable_obstack;
register tree t = make_node (code);
- /* Set up some flags that give proper default behavior. */
- if (IS_AGGR_TYPE_CODE (code))
+ /* Create lang_type structure. */
+ if (IS_AGGR_TYPE_CODE (code)
+ || code == BOUND_TEMPLATE_TEMPLATE_PARM)
{
- struct obstack *obstack = current_obstack;
struct lang_type *pi;
- SET_IS_AGGR_TYPE (t, 1);
+ pi = ((struct lang_type *)
+ ggc_alloc_cleared (sizeof (struct lang_type)));
- if (! TREE_PERMANENT (t))
- obstack = saveable_obstack;
- else
- my_friendly_assert (obstack == &permanent_obstack, 236);
+ TYPE_LANG_SPECIFIC (t) = pi;
- pi = (struct lang_type *) obstack_alloc (obstack, sizeof (struct lang_type));
- bzero ((char *) pi, (int) sizeof (struct lang_type));
+#ifdef GATHER_STATISTICS
+ tree_node_counts[(int)lang_type] += 1;
+ tree_node_sizes[(int)lang_type] += sizeof (struct lang_type);
+#endif
+ }
- TYPE_LANG_SPECIFIC (t) = pi;
+ /* Set up some flags that give proper default behavior. */
+ if (IS_AGGR_TYPE_CODE (code))
+ {
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, interface_unknown);
CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
@@ -4687,11 +1628,6 @@ make_lang_type (code)
presence of parse errors, the normal was of assuring this
might not ever get executed, so we lay it out *immediately*. */
build_pointer_type (t);
-
-#ifdef GATHER_STATISTICS
- tree_node_counts[(int)lang_type] += 1;
- tree_node_sizes[(int)lang_type] += sizeof (struct lang_type);
-#endif
}
else
/* We use TYPE_ALIAS_SET for the CLASSTYPE_MARKED bits. But,
@@ -4699,269 +1635,42 @@ make_lang_type (code)
clear it here. */
TYPE_ALIAS_SET (t) = 0;
- /* We need to allocate a TYPE_BINFO even for TEMPALTE_TYPE_PARMs
+ /* We need to allocate a TYPE_BINFO even for TEMPLATE_TYPE_PARMs
since they can be virtual base types, and we then need a
canonical binfo for them. Ideally, this would be done lazily for
all types. */
- if (IS_AGGR_TYPE_CODE (code) || code == TEMPLATE_TYPE_PARM)
- TYPE_BINFO (t) = make_binfo (integer_zero_node, t, NULL_TREE, NULL_TREE);
+ if (IS_AGGR_TYPE_CODE (code) || code == TEMPLATE_TYPE_PARM
+ || code == BOUND_TEMPLATE_TEMPLATE_PARM
+ || code == TYPENAME_TYPE)
+ TYPE_BINFO (t) = make_binfo (size_zero_node, t, NULL_TREE, NULL_TREE);
return t;
}
-void
-dump_time_statistics ()
+tree
+make_aggr_type (code)
+ enum tree_code code;
{
- register tree prev = 0, decl, next;
- int this_time = my_get_run_time ();
- TREE_INT_CST_LOW (TIME_IDENTIFIER_TIME (this_filename_time))
- += this_time - body_time;
-
- fprintf (stderr, "\n******\n");
- print_time ("header files (total)", header_time);
- print_time ("main file (total)", this_time - body_time);
- fprintf (stderr, "ratio = %g : 1\n",
- (double)header_time / (double)(this_time - body_time));
- fprintf (stderr, "\n******\n");
-
- for (decl = filename_times; decl; decl = next)
- {
- next = IDENTIFIER_GLOBAL_VALUE (decl);
- SET_IDENTIFIER_GLOBAL_VALUE (decl, prev);
- prev = decl;
- }
+ tree t = cp_make_lang_type (code);
+
+ if (IS_AGGR_TYPE_CODE (code))
+ SET_IS_AGGR_TYPE (t, 1);
- for (decl = prev; decl; decl = IDENTIFIER_GLOBAL_VALUE (decl))
- print_time (IDENTIFIER_POINTER (decl),
- TREE_INT_CST_LOW (TIME_IDENTIFIER_TIME (decl)));
+ return t;
}
void
-compiler_error VPROTO ((const char *msg, ...))
+compiler_error VPARAMS ((const char *msg, ...))
{
-#ifndef ANSI_PROTOTYPES
- const char *msg;
-#endif
char buf[1024];
- va_list ap;
-
- VA_START (ap, msg);
-
-#ifndef ANSI_PROTOTYPES
- msg = va_arg (ap, const char *);
-#endif
-
- vsprintf (buf, msg, ap);
- error_with_file_and_line (input_filename, lineno, "%s (compiler error)", buf);
-}
-
-void
-yyerror (string)
- const char *string;
-{
- extern int end_of_file;
- char buf[200];
-
- strcpy (buf, string);
-
- /* We can't print string and character constants well
- because the token_buffer contains the result of processing escapes. */
- if (end_of_file)
- strcat (buf, input_redirected ()
- ? " at end of saved text"
- : " at end of input");
- else if (token_buffer[0] == 0)
- strcat (buf, " at null character");
- else if (token_buffer[0] == '"')
- strcat (buf, " before string constant");
- else if (token_buffer[0] == '\'')
- strcat (buf, " before character constant");
- else if (!ISGRAPH ((unsigned char)token_buffer[0]))
- sprintf (buf + strlen (buf), " before character 0%o",
- (unsigned char) token_buffer[0]);
- else
- strcat (buf, " before `%s'");
-
- error (buf, token_buffer);
-}
-
-static int
-handle_cp_pragma (pname)
- const char *pname;
-{
- register int token;
-
- if (! strcmp (pname, "vtable"))
- {
- extern tree pending_vtables;
-
- /* More follows: it must be a string constant (class name). */
- token = real_yylex ();
- if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
- {
- error ("invalid #pragma vtable");
- return -1;
- }
-
- if (write_virtuals != 2)
- {
- warning ("use `+e2' option to enable #pragma vtable");
- return -1;
- }
- pending_vtables
- = perm_tree_cons (NULL_TREE,
- get_identifier (TREE_STRING_POINTER (yylval.ttype)),
- pending_vtables);
- token = real_yylex ();
- if (token != END_OF_LINE)
- warning ("trailing characters ignored");
- return 1;
- }
- else if (! strcmp (pname, "unit"))
- {
- /* More follows: it must be a string constant (unit name). */
- token = real_yylex ();
- if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
- {
- error ("invalid #pragma unit");
- return -1;
- }
- token = real_yylex ();
- if (token != END_OF_LINE)
- warning ("trailing characters ignored");
- return 1;
- }
- else if (! strcmp (pname, "interface"))
- {
- tree fileinfo
- = TIME_IDENTIFIER_FILEINFO (get_time_identifier (input_filename));
- char *main_filename = input_filename;
-
- main_filename = file_name_nondirectory (main_filename);
-
- token = real_yylex ();
-
- if (token != END_OF_LINE)
- {
- if (token != STRING
- || TREE_CODE (yylval.ttype) != STRING_CST)
- {
- error ("invalid `#pragma interface'");
- return -1;
- }
- main_filename = TREE_STRING_POINTER (yylval.ttype);
- token = real_yylex ();
- }
-
- if (token != END_OF_LINE)
- warning ("garbage after `#pragma interface' ignored");
-
- write_virtuals = 3;
-
- if (impl_file_chain == 0)
- {
- /* If this is zero at this point, then we are
- auto-implementing. */
- if (main_input_filename == 0)
- main_input_filename = input_filename;
-
-#ifdef AUTO_IMPLEMENT
- filename = file_name_nondirectory (main_input_filename);
- fi = get_time_identifier (filename);
- fi = TIME_IDENTIFIER_FILEINFO (fi);
- TREE_INT_CST_LOW (fi) = 0;
- TREE_INT_CST_HIGH (fi) = 1;
- /* Get default. */
- impl_file_chain = (struct impl_files *)permalloc (sizeof (struct impl_files));
- impl_file_chain->filename = filename;
- impl_file_chain->next = 0;
-#endif
- }
-
- interface_only = interface_strcmp (main_filename);
-#ifdef MULTIPLE_SYMBOL_SPACES
- if (! interface_only)
- interface_unknown = 0;
-#else /* MULTIPLE_SYMBOL_SPACES */
- interface_unknown = 0;
-#endif /* MULTIPLE_SYMBOL_SPACES */
- TREE_INT_CST_LOW (fileinfo) = interface_only;
- TREE_INT_CST_HIGH (fileinfo) = interface_unknown;
-
- return 1;
- }
- else if (! strcmp (pname, "implementation"))
- {
- tree fileinfo
- = TIME_IDENTIFIER_FILEINFO (get_time_identifier (input_filename));
- char *main_filename = main_input_filename ? main_input_filename : input_filename;
-
- main_filename = file_name_nondirectory (main_filename);
- token = real_yylex ();
- if (token != END_OF_LINE)
- {
- if (token != STRING
- || TREE_CODE (yylval.ttype) != STRING_CST)
- {
- error ("invalid `#pragma implementation'");
- return -1;
- }
- main_filename = TREE_STRING_POINTER (yylval.ttype);
- token = real_yylex ();
- }
-
- if (token != END_OF_LINE)
- warning ("garbage after `#pragma implementation' ignored");
- if (write_virtuals == 3)
- {
- struct impl_files *ifiles = impl_file_chain;
- while (ifiles)
- {
- if (! strcmp (ifiles->filename, main_filename))
- break;
- ifiles = ifiles->next;
- }
- if (ifiles == 0)
- {
- ifiles = (struct impl_files*) permalloc (sizeof (struct impl_files));
- ifiles->filename = main_filename;
- ifiles->next = impl_file_chain;
- impl_file_chain = ifiles;
- }
- }
- else if ((main_input_filename != 0
- && ! strcmp (main_input_filename, input_filename))
- || ! strcmp (input_filename, main_filename))
- {
- write_virtuals = 3;
- if (impl_file_chain == 0)
- {
- impl_file_chain = (struct impl_files*) permalloc (sizeof (struct impl_files));
- impl_file_chain->filename = main_filename;
- impl_file_chain->next = 0;
- }
- }
- else
- error ("`#pragma implementation' can only appear at top-level");
- interface_only = 0;
-#if 1
- /* We make this non-zero so that we infer decl linkage
- in the impl file only for variables first declared
- in the interface file. */
- interface_unknown = 1;
-#else
- /* We make this zero so that templates in the impl
- file will be emitted properly. */
- interface_unknown = 0;
-#endif
- TREE_INT_CST_LOW (fileinfo) = interface_only;
- TREE_INT_CST_HIGH (fileinfo) = interface_unknown;
+ VA_OPEN (ap, msg);
+ VA_FIXEDARG (ap, const char *, msg);
- return 1;
- }
+ vsprintf (buf, msg, ap);
+ VA_CLOSE (ap);
- return 0;
+ error_with_file_and_line (input_filename, lineno, "%s (compiler error)", buf);
}
/* Return the type-qualifier corresponding to the identifier given by
@@ -4978,48 +1687,6 @@ cp_type_qual_from_rid (rid)
else if (rid == ridpointers[(int) RID_RESTRICT])
return TYPE_QUAL_RESTRICT;
- my_friendly_abort (0);
+ abort ();
return TYPE_UNQUALIFIED;
}
-
-
-#ifdef HANDLE_GENERIC_PRAGMAS
-
-/* Handle a #pragma directive. TOKEN is the type of the word following
- the #pragma directive on the line. Process the entire input line and
- return non-zero iff the directive successfully parsed. */
-
-/* This function has to be in this file, in order to get at
- the token types. */
-
-static int
-handle_generic_pragma (token)
- register int token;
-{
- for (;;)
- {
- switch (token)
- {
- case IDENTIFIER:
- case TYPENAME:
- case STRING:
- case CONSTANT:
- handle_pragma_token (token_buffer, yylval.ttype);
- break;
-
- case LEFT_RIGHT:
- handle_pragma_token ("(", NULL_TREE);
- handle_pragma_token (")", NULL_TREE);
- break;
-
- case END_OF_LINE:
- return handle_pragma_token (NULL_PTR, NULL_TREE);
-
- default:
- handle_pragma_token (token_buffer, NULL_TREE);
- }
-
- token = real_yylex ();
- }
-}
-#endif /* HANDLE_GENERIC_PRAGMAS */
diff --git a/contrib/gcc/cp/lex.h b/contrib/gcc/cp/lex.h
index 249eef9..9f868337 100644
--- a/contrib/gcc/cp/lex.h
+++ b/contrib/gcc/cp/lex.h
@@ -1,5 +1,6 @@
/* Define constants and variables for communication with parse.y.
- Copyright (C) 1987, 92-97, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 2000 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
and by Brendan Kehoe (brendan@cygnus.com).
@@ -20,71 +21,13 @@ can know your rights and responsibilities. It should be in a
file named COPYING. Among other things, the copyright notice
and this notice must be preserved on all copies. */
+#ifndef GCC_CP_LEX_H
+#define GCC_CP_LEX_H
-
-enum rid
-{
- RID_UNUSED,
- RID_INT,
- RID_BOOL,
- RID_CHAR,
- RID_WCHAR,
- RID_FLOAT,
- RID_DOUBLE,
- RID_VOID,
-
- /* C++ extension */
- RID_CLASS,
- RID_RECORD,
- RID_UNION,
- RID_ENUM,
- RID_LONGLONG,
-
- /* This is where grokdeclarator starts its search when setting the specbits.
- The first seven are in the order of most frequently used, as found
- building libg++. */
-
- RID_EXTERN,
- RID_CONST,
- RID_LONG,
- RID_TYPEDEF,
- RID_UNSIGNED,
- RID_SHORT,
- RID_INLINE,
-
- RID_STATIC,
-
- RID_REGISTER,
- RID_VOLATILE,
- RID_FRIEND,
- RID_VIRTUAL,
- RID_EXPLICIT,
- RID_EXPORT,
- RID_SIGNED,
- RID_AUTO,
- RID_MUTABLE,
- RID_COMPLEX,
- RID_RESTRICT,
-
- /* This is where grokdeclarator ends its search when setting the
- specbits. */
-
- RID_PUBLIC,
- RID_PRIVATE,
- RID_PROTECTED,
- RID_EXCEPTION,
- RID_TEMPLATE,
- RID_SIGNATURE,
- RID_NULL,
- /* Before adding enough to get up to 64, the RIDBIT_* macros
- will have to be changed a little. */
- RID_MAX
-};
-
-#define NORID RID_UNUSED
-
-#define RID_FIRST_MODIFIER RID_EXTERN
-#define RID_LAST_MODIFIER RID_COMPLEX
+#if 0
+/* Formerly, the RID_* values used as mask bits did not fit into a
+ single 32-bit word. Now they do, but let's preserve the old logic
+ in case they ever stop fitting again. -zw, 8 Aug 2000 */
/* The type that can represent all values of RIDBIT. */
/* We assume that we can stick in at least 32 bits into this. */
@@ -108,11 +51,18 @@ typedef struct { unsigned long idata[2]; }
(V).idata[1] = 0; \
} while (0)
#define RIDBIT_ANY_SET(V) ((V).idata[0] || (V).idata[1])
+#else
+typedef unsigned long RID_BIT_TYPE; /* assumed at least 32 bits */
+#define RIDBIT_OF(R) ((unsigned long)1 << (int) (R))
-/* The elements of `ridpointers' are identifier nodes
- for the reserved type names and storage classes.
- It is indexed by a RID_... value. */
-extern tree ridpointers[(int) RID_MAX];
+#define RIDBIT_SETP(N, V) ((V) & RIDBIT_OF (N))
+#define RIDBIT_NOTSETP(N, V) (! ((V) & RIDBIT_OF (N)))
+#define RIDBIT_ANY_SET(V) (V)
+
+#define RIDBIT_SET(N, V) do { (V) |= RIDBIT_OF (N); } while (0)
+#define RIDBIT_RESET(N, V) do { (V) &= ~RIDBIT_OF (N); } while (0)
+#define RIDBIT_RESET_ALL(V) do { (V) = 0; } while (0)
+#endif
/* the declaration found for the last IDENTIFIER token read in.
yylex must look this up to detect typedefs, which get token type TYPENAME,
@@ -120,8 +70,6 @@ extern tree ridpointers[(int) RID_MAX];
used in a context which makes it a reference to a variable. */
extern tree lastiddecl;
-extern char *token_buffer; /* Pointer to token buffer. */
-
/* Back-door communication channel to the lexer. */
extern int looking_for_typename;
extern int looking_for_template;
@@ -134,4 +82,6 @@ extern tree got_object;
Positive is push count, negative is pop count. */
extern int pending_lang_change;
-extern int yylex PROTO((void));
+extern int yylex PARAMS ((void));
+
+#endif /* ! GCC_CP_LEX_H */
diff --git a/contrib/gcc/cp/mangle.c b/contrib/gcc/cp/mangle.c
new file mode 100644
index 0000000..00e5143
--- /dev/null
+++ b/contrib/gcc/cp/mangle.c
@@ -0,0 +1,2482 @@
+/* Name mangling for the 3.0 C++ ABI.
+ Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+ Written by Alex Samuel <sameul@codesourcery.com>
+
+ This file is part of GNU CC.
+
+ GNU CC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU CC is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU CC; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA. */
+
+/* This file implements mangling of C++ names according to the IA64
+ C++ ABI specification. A mangled name encodes a function or
+ variable's name, scope, type, and/or template arguments into a text
+ identifier. This identifier is used as the function's or
+ variable's linkage name, to preserve compatibility between C++'s
+ language features (templates, scoping, and overloading) and C
+ linkers.
+
+ Additionally, g++ uses mangled names internally. To support this,
+ mangling of types is allowed, even though the mangled name of a
+ type should not appear by itself as an exported name. Ditto for
+ uninstantiated templates.
+
+ The primary entry point for this module is mangle_decl, which
+ returns an identifier containing the mangled name for a decl.
+ Additional entry points are provided to build mangled names of
+ particular constructs when the appropriate decl for that construct
+ is not available. These are:
+
+ mangle_typeinfo_for_type: typeinfo data
+ mangle_typeinfo_string_for_type: typeinfo type name
+ mangle_vtbl_for_type: virtual table data
+ mangle_vtt_for_type: VTT data
+ mangle_ctor_vtbl_for_type: `C-in-B' constructor virtual table data
+ mangle_thunk: thunk function or entry
+
+*/
+
+#include "config.h"
+#include "system.h"
+#include "tree.h"
+#include "cp-tree.h"
+#include "obstack.h"
+#include "toplev.h"
+#include "varray.h"
+
+/* Debugging support. */
+
+/* Define DEBUG_MANGLE to enable very verbose trace messages. */
+#ifndef DEBUG_MANGLE
+#define DEBUG_MANGLE 0
+#endif
+
+/* Macros for tracing the write_* functions. */
+#if DEBUG_MANGLE
+# define MANGLE_TRACE(FN, INPUT) \
+ fprintf (stderr, " %-24s: %-24s\n", (FN), (INPUT))
+# define MANGLE_TRACE_TREE(FN, NODE) \
+ fprintf (stderr, " %-24s: %-24s (%p)\n", \
+ (FN), tree_code_name[TREE_CODE (NODE)], (void *) (NODE))
+#else
+# define MANGLE_TRACE(FN, INPUT)
+# define MANGLE_TRACE_TREE(FN, NODE)
+#endif
+
+/* Non-zero if NODE is a class template-id. We can't rely on
+ CLASSTYPE_USE_TEMPLATE here because of tricky bugs in the parser
+ that hard to distinguish A<T> from A, where A<T> is the type as
+ instantiated outside of the template, and A is the type used
+ without parameters inside the template. */
+#define CLASSTYPE_TEMPLATE_ID_P(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE) != NULL \
+ && CLASSTYPE_TEMPLATE_INFO (NODE) != NULL \
+ && (PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE))))
+
+/* Things we only need one of. This module is not reentrant. */
+static struct globals
+{
+ /* The name in which we're building the mangled name. */
+ struct obstack name_obstack;
+
+ /* An array of the current substitution candidates, in the order
+ we've seen them. */
+ varray_type substitutions;
+} G;
+
+/* Indices into subst_identifiers. These are identifiers used in
+ special substitution rules. */
+typedef enum
+{
+ SUBID_ALLOCATOR,
+ SUBID_BASIC_STRING,
+ SUBID_CHAR_TRAITS,
+ SUBID_BASIC_ISTREAM,
+ SUBID_BASIC_OSTREAM,
+ SUBID_BASIC_IOSTREAM,
+ SUBID_MAX
+}
+substitution_identifier_index_t;
+
+/* For quick substitution checks, look up these common identifiers
+ once only. */
+static tree subst_identifiers[SUBID_MAX];
+
+/* Single-letter codes for builtin integer types, defined in
+ <builtin-type>. These are indexed by integer_type_kind values. */
+static char
+integer_type_codes[itk_none] =
+{
+ 'c', /* itk_char */
+ 'a', /* itk_signed_char */
+ 'h', /* itk_unsigned_char */
+ 's', /* itk_short */
+ 't', /* itk_unsigned_short */
+ 'i', /* itk_int */
+ 'j', /* itk_unsigned_int */
+ 'l', /* itk_long */
+ 'm', /* itk_unsigned_long */
+ 'x', /* itk_long_long */
+ 'y' /* itk_unsigned_long_long */
+};
+
+static int decl_is_template_id PARAMS ((tree, tree*));
+
+/* Functions for handling substitutions. */
+
+static inline tree canonicalize_for_substitution PARAMS ((tree));
+static void add_substitution PARAMS ((tree));
+static inline int is_std_substitution PARAMS ((tree, substitution_identifier_index_t));
+static inline int is_std_substitution_char PARAMS ((tree, substitution_identifier_index_t));
+static int find_substitution PARAMS ((tree));
+
+/* Functions for emitting mangled representations of things. */
+
+static void write_mangled_name PARAMS ((tree));
+static void write_encoding PARAMS ((tree));
+static void write_name PARAMS ((tree, int));
+static void write_unscoped_name PARAMS ((tree));
+static void write_unscoped_template_name PARAMS ((tree));
+static void write_nested_name PARAMS ((tree));
+static void write_prefix PARAMS ((tree));
+static void write_template_prefix PARAMS ((tree));
+static void write_unqualified_name PARAMS ((tree));
+static void write_source_name PARAMS ((tree));
+static int hwint_to_ascii PARAMS ((unsigned HOST_WIDE_INT, unsigned int, char *, unsigned));
+static void write_number PARAMS ((unsigned HOST_WIDE_INT, int,
+ unsigned int));
+static void write_integer_cst PARAMS ((tree));
+static void write_identifier PARAMS ((const char *));
+static void write_special_name_constructor PARAMS ((tree));
+static void write_special_name_destructor PARAMS ((tree));
+static void write_type PARAMS ((tree));
+static int write_CV_qualifiers_for_type PARAMS ((tree));
+static void write_builtin_type PARAMS ((tree));
+static void write_function_type PARAMS ((tree));
+static void write_bare_function_type PARAMS ((tree, int, tree));
+static void write_method_parms PARAMS ((tree, int, tree));
+static void write_class_enum_type PARAMS ((tree));
+static void write_template_args PARAMS ((tree));
+static void write_expression PARAMS ((tree));
+static void write_template_arg_literal PARAMS ((tree));
+static void write_template_arg PARAMS ((tree));
+static void write_template_template_arg PARAMS ((tree));
+static void write_array_type PARAMS ((tree));
+static void write_pointer_to_member_type PARAMS ((tree));
+static void write_template_param PARAMS ((tree));
+static void write_template_template_param PARAMS ((tree));
+static void write_substitution PARAMS ((int));
+static int discriminator_for_local_entity PARAMS ((tree));
+static int discriminator_for_string_literal PARAMS ((tree, tree));
+static void write_discriminator PARAMS ((int));
+static void write_local_name PARAMS ((tree, tree, tree));
+static void dump_substitution_candidates PARAMS ((void));
+static const char *mangle_decl_string PARAMS ((tree));
+
+/* Control functions. */
+
+static inline void start_mangling PARAMS ((void));
+static inline const char *finish_mangling PARAMS ((void));
+static tree mangle_special_for_type PARAMS ((tree, const char *));
+
+/* Foreign language functions. */
+
+static void write_java_integer_type_codes PARAMS ((tree));
+
+/* Append a single character to the end of the mangled
+ representation. */
+#define write_char(CHAR) \
+ obstack_1grow (&G.name_obstack, (CHAR))
+
+/* Append a sized buffer to the end of the mangled representation. */
+#define write_chars(CHAR, LEN) \
+ obstack_grow (&G.name_obstack, (CHAR), (LEN))
+
+/* Append a NUL-terminated string to the end of the mangled
+ representation. */
+#define write_string(STRING) \
+ obstack_grow (&G.name_obstack, (STRING), strlen (STRING))
+
+/* Return the position at which the next character will be appended to
+ the mangled representation. */
+#define mangled_position() \
+ obstack_object_size (&G.name_obstack)
+
+/* Non-zero if NODE1 and NODE2 are both TREE_LIST nodes and have the
+ same purpose (context, which may be a type) and value (template
+ decl). See write_template_prefix for more information on what this
+ is used for. */
+#define NESTED_TEMPLATE_MATCH(NODE1, NODE2) \
+ (TREE_CODE (NODE1) == TREE_LIST \
+ && TREE_CODE (NODE2) == TREE_LIST \
+ && ((TYPE_P (TREE_PURPOSE (NODE1)) \
+ && same_type_p (TREE_PURPOSE (NODE1), TREE_PURPOSE (NODE2)))\
+ || TREE_PURPOSE (NODE1) == TREE_PURPOSE (NODE2)) \
+ && TREE_VALUE (NODE1) == TREE_VALUE (NODE2))
+
+/* Write out a signed quantity in base 10. */
+#define write_signed_number(NUMBER) \
+ write_number ((NUMBER), /*unsigned_p=*/0, 10)
+
+/* Write out an unsigned quantity in base 10. */
+#define write_unsigned_number(NUMBER) \
+ write_number ((NUMBER), /*unsigned_p=*/1, 10)
+
+/* If DECL is a template instance, return non-zero and, if
+ TEMPLATE_INFO is non-NULL, set *TEMPLATE_INFO to its template info.
+ Otherwise return zero. */
+
+static int
+decl_is_template_id (decl, template_info)
+ tree decl;
+ tree* template_info;
+{
+ if (TREE_CODE (decl) == TYPE_DECL)
+ {
+ /* TYPE_DECLs are handled specially. Look at its type to decide
+ if this is a template instantiation. */
+ tree type = TREE_TYPE (decl);
+
+ if (CLASS_TYPE_P (type) && CLASSTYPE_TEMPLATE_ID_P (type))
+ {
+ if (template_info != NULL)
+ /* For a templated TYPE_DECL, the template info is hanging
+ off the type. */
+ *template_info = CLASSTYPE_TEMPLATE_INFO (type);
+ return 1;
+ }
+ }
+ else
+ {
+ /* Check if this is a primary template. */
+ if (DECL_LANG_SPECIFIC (decl) != NULL
+ && DECL_USE_TEMPLATE (decl)
+ && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl))
+ && TREE_CODE (decl) != TEMPLATE_DECL)
+ {
+ if (template_info != NULL)
+ /* For most templated decls, the template info is hanging
+ off the decl. */
+ *template_info = DECL_TEMPLATE_INFO (decl);
+ return 1;
+ }
+ }
+
+ /* It's not a template id. */
+ return 0;
+}
+
+/* Produce debugging output of current substitution candidates. */
+
+static void
+dump_substitution_candidates ()
+{
+ unsigned i;
+
+ fprintf (stderr, " ++ substitutions ");
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (G.substitutions); ++i)
+ {
+ tree el = VARRAY_TREE (G.substitutions, i);
+ const char *name = "???";
+
+ if (i > 0)
+ fprintf (stderr, " ");
+ if (DECL_P (el))
+ name = IDENTIFIER_POINTER (DECL_NAME (el));
+ else if (TREE_CODE (el) == TREE_LIST)
+ name = IDENTIFIER_POINTER (DECL_NAME (TREE_VALUE (el)));
+ else if (TYPE_NAME (el))
+ name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (el)));
+ fprintf (stderr, " S%d_ = ", i - 1);
+ if (TYPE_P (el) &&
+ (CP_TYPE_RESTRICT_P (el)
+ || CP_TYPE_VOLATILE_P (el)
+ || CP_TYPE_CONST_P (el)))
+ fprintf (stderr, "CV-");
+ fprintf (stderr, "%s (%s at %p)\n",
+ name, tree_code_name[TREE_CODE (el)], (void *) el);
+ }
+}
+
+/* Both decls and types can be substitution candidates, but sometimes
+ they refer to the same thing. For instance, a TYPE_DECL and
+ RECORD_TYPE for the same class refer to the same thing, and should
+ be treated accordinginly in substitutions. This function returns a
+ canonicalized tree node representing NODE that is used when adding
+ and substitution candidates and finding matches. */
+
+static inline tree
+canonicalize_for_substitution (node)
+ tree node;
+{
+ /* For a TYPE_DECL, use the type instead. */
+ if (TREE_CODE (node) == TYPE_DECL)
+ node = TREE_TYPE (node);
+ if (TYPE_P (node))
+ node = canonical_type_variant (node);
+
+ return node;
+}
+
+/* Add NODE as a substitution candidate. NODE must not already be on
+ the list of candidates. */
+
+static void
+add_substitution (node)
+ tree node;
+{
+ tree c;
+
+ if (DEBUG_MANGLE)
+ fprintf (stderr, " ++ add_substitution (%s at %10p)\n",
+ tree_code_name[TREE_CODE (node)], (void *) node);
+
+ /* Get the canonicalized substitution candidate for NODE. */
+ c = canonicalize_for_substitution (node);
+ if (DEBUG_MANGLE && c != node)
+ fprintf (stderr, " ++ using candidate (%s at %10p)\n",
+ tree_code_name[TREE_CODE (node)], (void *) node);
+ node = c;
+
+#if ENABLE_CHECKING
+ /* Make sure NODE isn't already a candidate. */
+ {
+ int i;
+ for (i = VARRAY_ACTIVE_SIZE (G.substitutions); --i >= 0; )
+ {
+ tree candidate = VARRAY_TREE (G.substitutions, i);
+ if ((DECL_P (node)
+ && node == candidate)
+ || (TYPE_P (node)
+ && TYPE_P (candidate)
+ && same_type_p (node, candidate)))
+ abort ();
+ }
+ }
+#endif /* ENABLE_CHECKING */
+
+ /* Put the decl onto the varray of substitution candidates. */
+ VARRAY_PUSH_TREE (G.substitutions, node);
+
+ if (DEBUG_MANGLE)
+ dump_substitution_candidates ();
+}
+
+/* Helper function for find_substitution. Returns non-zero if NODE,
+ which may be a decl or a CLASS_TYPE, is a template-id with template
+ name of substitution_index[INDEX] in the ::std namespace. */
+
+static inline int
+is_std_substitution (node, index)
+ tree node;
+ substitution_identifier_index_t index;
+{
+ tree type = NULL;
+ tree decl = NULL;
+
+ if (DECL_P (node))
+ {
+ type = TREE_TYPE (node);
+ decl = node;
+ }
+ else if (CLASS_TYPE_P (node))
+ {
+ type = node;
+ decl = TYPE_NAME (node);
+ }
+ else
+ /* These are not the droids you're looking for. */
+ return 0;
+
+ return (DECL_NAMESPACE_STD_P (CP_DECL_CONTEXT (decl))
+ && TYPE_LANG_SPECIFIC (type)
+ && CLASSTYPE_TEMPLATE_INFO (type)
+ && (DECL_NAME (CLASSTYPE_TI_TEMPLATE (type))
+ == subst_identifiers[index]));
+}
+
+/* Helper function for find_substitution. Returns non-zero if NODE,
+ which may be a decl or a CLASS_TYPE, is the template-id
+ ::std::identifier<char>, where identifier is
+ substitution_index[INDEX]. */
+
+static inline int
+is_std_substitution_char (node, index)
+ tree node;
+ substitution_identifier_index_t index;
+{
+ tree args;
+ /* Check NODE's name is ::std::identifier. */
+ if (!is_std_substitution (node, index))
+ return 0;
+ /* Figure out its template args. */
+ if (DECL_P (node))
+ args = DECL_TI_ARGS (node);
+ else if (CLASS_TYPE_P (node))
+ args = CLASSTYPE_TI_ARGS (node);
+ else
+ /* Oops, not a template. */
+ return 0;
+ /* NODE's template arg list should be <char>. */
+ return
+ TREE_VEC_LENGTH (args) == 1
+ && TREE_VEC_ELT (args, 0) == char_type_node;
+}
+
+/* Check whether a substitution should be used to represent NODE in
+ the mangling.
+
+ First, check standard special-case substitutions.
+
+ <substitution> ::= St
+ # ::std
+
+ ::= Sa
+ # ::std::allocator
+
+ ::= Sb
+ # ::std::basic_string
+
+ ::= Ss
+ # ::std::basic_string<char,
+ ::std::char_traits<char>,
+ ::std::allocator<char> >
+
+ ::= Si
+ # ::std::basic_istream<char, ::std::char_traits<char> >
+
+ ::= So
+ # ::std::basic_ostream<char, ::std::char_traits<char> >
+
+ ::= Sd
+ # ::std::basic_iostream<char, ::std::char_traits<char> >
+
+ Then examine the stack of currently available substitution
+ candidates for entities appearing earlier in the same mangling
+
+ If a substitution is found, write its mangled representation and
+ return non-zero. If none is found, just return zero. */
+
+static int
+find_substitution (node)
+ tree node;
+{
+ int i;
+ int size = VARRAY_ACTIVE_SIZE (G.substitutions);
+ tree decl;
+ tree type;
+
+ if (DEBUG_MANGLE)
+ fprintf (stderr, " ++ find_substitution (%s at %p)\n",
+ tree_code_name[TREE_CODE (node)], (void *) node);
+
+ /* Obtain the canonicalized substitution representation for NODE.
+ This is what we'll compare against. */
+ node = canonicalize_for_substitution (node);
+
+ /* Check for builtin substitutions. */
+
+ decl = TYPE_P (node) ? TYPE_NAME (node) : node;
+ type = TYPE_P (node) ? node : TREE_TYPE (node);
+
+ /* Check for std::allocator. */
+ if (decl
+ && is_std_substitution (decl, SUBID_ALLOCATOR)
+ && !CLASSTYPE_USE_TEMPLATE (TREE_TYPE (decl)))
+ {
+ write_string ("Sa");
+ return 1;
+ }
+
+ /* Check for std::basic_string. */
+ if (decl && is_std_substitution (decl, SUBID_BASIC_STRING))
+ {
+ if (TYPE_P (node))
+ {
+ /* If this is a type (i.e. a fully-qualified template-id),
+ check for
+ std::basic_string <char,
+ std::char_traits<char>,
+ std::allocator<char> > . */
+ if (cp_type_quals (type) == TYPE_UNQUALIFIED
+ && CLASSTYPE_USE_TEMPLATE (type))
+ {
+ tree args = CLASSTYPE_TI_ARGS (type);
+ if (TREE_VEC_LENGTH (args) == 3
+ && same_type_p (TREE_VEC_ELT (args, 0), char_type_node)
+ && is_std_substitution_char (TREE_VEC_ELT (args, 1),
+ SUBID_CHAR_TRAITS)
+ && is_std_substitution_char (TREE_VEC_ELT (args, 2),
+ SUBID_ALLOCATOR))
+ {
+ write_string ("Ss");
+ return 1;
+ }
+ }
+ }
+ else
+ /* Substitute for the template name only if this isn't a type. */
+ {
+ write_string ("Sb");
+ return 1;
+ }
+ }
+
+ /* Check for basic_{i,o,io}stream. */
+ if (TYPE_P (node)
+ && cp_type_quals (type) == TYPE_UNQUALIFIED
+ && CLASS_TYPE_P (type)
+ && CLASSTYPE_USE_TEMPLATE (type)
+ && CLASSTYPE_TEMPLATE_INFO (type) != NULL)
+ {
+ /* First, check for the template
+ args <char, std::char_traits<char> > . */
+ tree args = CLASSTYPE_TI_ARGS (type);
+ if (TREE_VEC_LENGTH (args) == 2
+ && same_type_p (TREE_VEC_ELT (args, 0), char_type_node)
+ && is_std_substitution_char (TREE_VEC_ELT (args, 1),
+ SUBID_CHAR_TRAITS))
+ {
+ /* Got them. Is this basic_istream? */
+ tree name = DECL_NAME (CLASSTYPE_TI_TEMPLATE (type));
+ if (name == subst_identifiers[SUBID_BASIC_ISTREAM])
+ {
+ write_string ("Si");
+ return 1;
+ }
+ /* Or basic_ostream? */
+ else if (name == subst_identifiers[SUBID_BASIC_OSTREAM])
+ {
+ write_string ("So");
+ return 1;
+ }
+ /* Or basic_iostream? */
+ else if (name == subst_identifiers[SUBID_BASIC_IOSTREAM])
+ {
+ write_string ("Sd");
+ return 1;
+ }
+ }
+ }
+
+ /* Check for namespace std. */
+ if (decl && DECL_NAMESPACE_STD_P (decl))
+ {
+ write_string ("St");
+ return 1;
+ }
+
+ /* Now check the list of available substitutions for this mangling
+ operation. */
+ for (i = 0; i < size; ++i)
+ {
+ tree candidate = VARRAY_TREE (G.substitutions, i);
+ /* NODE is a matched to a candidate if it's the same decl node or
+ if it's the same type. */
+ if (decl == candidate
+ || (TYPE_P (candidate) && type && TYPE_P (type)
+ && same_type_p (type, candidate))
+ || NESTED_TEMPLATE_MATCH (node, candidate))
+ {
+ write_substitution (i);
+ return 1;
+ }
+ }
+
+ /* No substitution found. */
+ return 0;
+}
+
+
+/* <mangled-name> ::= _Z <encoding> */
+
+static inline void
+write_mangled_name (decl)
+ tree decl;
+{
+ MANGLE_TRACE_TREE ("mangled-name", decl);
+
+ if (DECL_LANG_SPECIFIC (decl)
+ && DECL_EXTERN_C_FUNCTION_P (decl)
+ && ! DECL_OVERLOADED_OPERATOR_P (decl))
+ /* The standard notes:
+ "The <encoding> of an extern "C" function is treated like
+ global-scope data, i.e. as its <source-name> without a type."
+ We cannot write overloaded operators that way though,
+ because it contains characters invalid in assembler. */
+ write_source_name (DECL_NAME (decl));
+ else
+ /* C++ name; needs to be mangled. */
+ {
+ write_string ("_Z");
+ write_encoding (decl);
+ }
+}
+
+/* <encoding> ::= <function name> <bare-function-type>
+ ::= <data name> */
+
+static void
+write_encoding (decl)
+ tree decl;
+{
+ MANGLE_TRACE_TREE ("encoding", decl);
+
+ if (DECL_LANG_SPECIFIC (decl) && DECL_EXTERN_C_FUNCTION_P (decl))
+ {
+ /* For overloaded operators write just the mangled name
+ without arguments. */
+ if (DECL_OVERLOADED_OPERATOR_P (decl))
+ write_name (decl, /*ignore_local_scope=*/0);
+ else
+ write_source_name (DECL_NAME (decl));
+ return;
+ }
+
+ write_name (decl, /*ignore_local_scope=*/0);
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ {
+ tree fn_type;
+
+ if (decl_is_template_id (decl, NULL))
+ fn_type = get_mostly_instantiated_function_type (decl, NULL, NULL);
+ else
+ fn_type = TREE_TYPE (decl);
+
+ write_bare_function_type (fn_type,
+ (!DECL_CONSTRUCTOR_P (decl)
+ && !DECL_DESTRUCTOR_P (decl)
+ && !DECL_CONV_FN_P (decl)
+ && decl_is_template_id (decl, NULL)),
+ decl);
+ }
+}
+
+/* <name> ::= <unscoped-name>
+ ::= <unscoped-template-name> <template-args>
+ ::= <nested-name>
+ ::= <local-name>
+
+ If IGNORE_LOCAL_SCOPE is non-zero, this production of <name> is
+ called from <local-name>, which mangles the enclosing scope
+ elsewhere and then uses this function to mangle just the part
+ underneath the function scope. So don't use the <local-name>
+ production, to avoid an infinite recursion. */
+
+static void
+write_name (decl, ignore_local_scope)
+ tree decl;
+ int ignore_local_scope;
+{
+ tree context;
+
+ MANGLE_TRACE_TREE ("name", decl);
+
+ if (TREE_CODE (decl) == TYPE_DECL)
+ {
+ /* In case this is a typedef, fish out the corresponding
+ TYPE_DECL for the main variant. */
+ decl = TYPE_NAME (TYPE_MAIN_VARIANT (TREE_TYPE (decl)));
+ context = TYPE_CONTEXT (TYPE_MAIN_VARIANT (TREE_TYPE (decl)));
+ }
+ else
+ context = (DECL_CONTEXT (decl) == NULL) ? NULL : CP_DECL_CONTEXT (decl);
+
+ /* A decl in :: or ::std scope is treated specially. The former is
+ mangled using <unscoped-name> or <unscoped-template-name>, the
+ latter with a special substitution. Also, a name that is
+ directly in a local function scope is also mangled with
+ <unscoped-name> rather than a full <nested-name>. */
+ if (context == NULL
+ || context == global_namespace
+ || DECL_NAMESPACE_STD_P (context)
+ || (ignore_local_scope && TREE_CODE (context) == FUNCTION_DECL))
+ {
+ tree template_info;
+ /* Is this a template instance? */
+ if (decl_is_template_id (decl, &template_info))
+ {
+ /* Yes: use <unscoped-template-name>. */
+ write_unscoped_template_name (TI_TEMPLATE (template_info));
+ write_template_args (TI_ARGS (template_info));
+ }
+ else
+ /* Everything else gets an <unqualified-name>. */
+ write_unscoped_name (decl);
+ }
+ else
+ {
+ /* Handle local names, unless we asked not to (that is, invoked
+ under <local-name>, to handle only the part of the name under
+ the local scope). */
+ if (!ignore_local_scope)
+ {
+ /* Scan up the list of scope context, looking for a
+ function. If we find one, this entity is in local
+ function scope. local_entity tracks context one scope
+ level down, so it will contain the element that's
+ directly in that function's scope, either decl or one of
+ its enclosing scopes. */
+ tree local_entity = decl;
+ while (context != NULL && context != global_namespace)
+ {
+ /* Make sure we're always dealing with decls. */
+ if (context != NULL && TYPE_P (context))
+ context = TYPE_NAME (context);
+ /* Is this a function? */
+ if (TREE_CODE (context) == FUNCTION_DECL)
+ {
+ /* Yes, we have local scope. Use the <local-name>
+ production for the innermost function scope. */
+ write_local_name (context, local_entity, decl);
+ return;
+ }
+ /* Up one scope level. */
+ local_entity = context;
+ context = CP_DECL_CONTEXT (context);
+ }
+
+ /* No local scope found? Fall through to <nested-name>. */
+ }
+
+ /* Other decls get a <nested-name> to encode their scope. */
+ write_nested_name (decl);
+ }
+}
+
+/* <unscoped-name> ::= <unqualified-name>
+ ::= St <unqualified-name> # ::std:: */
+
+static void
+write_unscoped_name (decl)
+ tree decl;
+{
+ tree context = CP_DECL_CONTEXT (decl);
+
+ MANGLE_TRACE_TREE ("unscoped-name", decl);
+
+ /* Is DECL in ::std? */
+ if (DECL_NAMESPACE_STD_P (context))
+ {
+ write_string ("St");
+ write_unqualified_name (decl);
+ }
+ /* If not, it should be either in the global namespace, or directly
+ in a local function scope. */
+ else if (context == global_namespace
+ || context == NULL
+ || TREE_CODE (context) == FUNCTION_DECL)
+ write_unqualified_name (decl);
+ else
+ abort ();
+}
+
+/* <unscoped-template-name> ::= <unscoped-name>
+ ::= <substitution> */
+
+static void
+write_unscoped_template_name (decl)
+ tree decl;
+{
+ MANGLE_TRACE_TREE ("unscoped-template-name", decl);
+
+ if (find_substitution (decl))
+ return;
+ write_unscoped_name (decl);
+ add_substitution (decl);
+}
+
+/* Write the nested name, including CV-qualifiers, of DECL.
+
+ <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqualified-name> E
+ ::= N [<CV-qualifiers>] <template-prefix> <template-args> E
+
+ <CV-qualifiers> ::= [r] [V] [K] */
+
+static void
+write_nested_name (decl)
+ tree decl;
+{
+ tree template_info;
+
+ MANGLE_TRACE_TREE ("nested-name", decl);
+
+ write_char ('N');
+
+ /* Write CV-qualifiers, if this is a member function. */
+ if (TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
+ {
+ if (DECL_VOLATILE_MEMFUNC_P (decl))
+ write_char ('V');
+ if (DECL_CONST_MEMFUNC_P (decl))
+ write_char ('K');
+ }
+
+ /* Is this a template instance? */
+ if (decl_is_template_id (decl, &template_info))
+ {
+ /* Yes, use <template-prefix>. */
+ write_template_prefix (decl);
+ write_template_args (TI_ARGS (template_info));
+ }
+ else
+ {
+ /* No, just use <prefix> */
+ write_prefix (DECL_CONTEXT (decl));
+ write_unqualified_name (decl);
+ }
+ write_char ('E');
+}
+
+/* <prefix> ::= <prefix> <unqualified-name>>
+ ::= <template-prefix> <template-args>
+ ::= # empty
+ ::= <substitution> */
+
+static void
+write_prefix (node)
+ tree node;
+{
+ tree decl;
+ /* Non-NULL if NODE represents a template-id. */
+ tree template_info = NULL;
+
+ MANGLE_TRACE_TREE ("prefix", node);
+
+ if (node == NULL
+ || node == global_namespace)
+ return;
+
+ if (find_substitution (node))
+ return;
+
+ if (DECL_P (node))
+ /* Node is a decl. */
+ {
+ /* If this is a function decl, that means we've hit function
+ scope, so this prefix must be for a local name. In this
+ case, we're under the <local-name> production, which encodes
+ the enclosing function scope elsewhere. So don't continue
+ here. */
+ if (TREE_CODE (node) == FUNCTION_DECL)
+ return;
+
+ decl = node;
+ decl_is_template_id (decl, &template_info);
+ }
+ else
+ /* Node is a type. */
+ {
+ decl = TYPE_NAME (node);
+ if (CLASSTYPE_TEMPLATE_ID_P (node))
+ template_info = CLASSTYPE_TEMPLATE_INFO (node);
+ }
+
+ if (template_info != NULL)
+ /* Templated. */
+ {
+ write_template_prefix (decl);
+ write_template_args (TI_ARGS (template_info));
+ }
+ else
+ /* Not templated. */
+ {
+ write_prefix (CP_DECL_CONTEXT (decl));
+ write_unqualified_name (decl);
+ }
+
+ add_substitution (node);
+}
+
+/* <template-prefix> ::= <prefix> <template component>
+ ::= <substitution> */
+
+static void
+write_template_prefix (node)
+ tree node;
+{
+ tree decl = DECL_P (node) ? node : TYPE_NAME (node);
+ tree type = DECL_P (node) ? TREE_TYPE (node) : node;
+ tree context = CP_DECL_CONTEXT (decl);
+ tree template_info;
+ tree template;
+ tree substitution;
+
+ MANGLE_TRACE_TREE ("template-prefix", node);
+
+ /* Find the template decl. */
+ if (decl_is_template_id (decl, &template_info))
+ template = TI_TEMPLATE (template_info);
+ else if (CLASSTYPE_TEMPLATE_ID_P (type))
+ template = CLASSTYPE_TI_TEMPLATE (type);
+ else
+ /* Oops, not a template. */
+ abort ();
+
+ /* For a member template, though, the template name for the
+ innermost name must have all the outer template levels
+ instantiated. For instance, consider
+
+ template<typename T> struct Outer {
+ template<typename U> struct Inner {};
+ };
+
+ The template name for `Inner' in `Outer<int>::Inner<float>' is
+ `Outer<int>::Inner<U>'. In g++, we don't instantiate the template
+ levels separately, so there's no TEMPLATE_DECL available for this
+ (there's only `Outer<T>::Inner<U>').
+
+ In order to get the substitutions right, we create a special
+ TREE_LIST to represent the substitution candidate for a nested
+ template. The TREE_PURPOSE is the template's context, fully
+ instantiated, and the TREE_VALUE is the TEMPLATE_DECL for the inner
+ template.
+
+ So, for the example above, `Outer<int>::Inner' is represented as a
+ substitution candidate by a TREE_LIST whose purpose is `Outer<int>'
+ and whose value is `Outer<T>::Inner<U>'. */
+ if (TYPE_P (context))
+ substitution = build_tree_list (context, template);
+ else
+ substitution = template;
+
+ if (find_substitution (substitution))
+ return;
+
+ write_prefix (context);
+ write_unqualified_name (decl);
+
+ add_substitution (substitution);
+}
+
+/* We don't need to handle thunks, vtables, or VTTs here. Those are
+ mangled through special entry points.
+
+ <unqualified-name> ::= <operator-name>
+ ::= <special-name>
+ ::= <source-name> */
+
+static void
+write_unqualified_name (decl)
+ tree decl;
+{
+ MANGLE_TRACE_TREE ("unqualified-name", decl);
+
+ if (DECL_LANG_SPECIFIC (decl) != NULL && DECL_CONSTRUCTOR_P (decl))
+ write_special_name_constructor (decl);
+ else if (DECL_LANG_SPECIFIC (decl) != NULL && DECL_DESTRUCTOR_P (decl))
+ write_special_name_destructor (decl);
+ else if (DECL_CONV_FN_P (decl))
+ {
+ /* Conversion operator. Handle it right here.
+ <operator> ::= cv <type> */
+ write_string ("cv");
+ write_type (TREE_TYPE (DECL_NAME (decl)));
+ }
+ else if (DECL_OVERLOADED_OPERATOR_P (decl))
+ {
+ operator_name_info_t *oni;
+ if (DECL_ASSIGNMENT_OPERATOR_P (decl))
+ oni = assignment_operator_name_info;
+ else
+ oni = operator_name_info;
+
+ write_string (oni[DECL_OVERLOADED_OPERATOR_P (decl)].mangled_name);
+ }
+ else
+ write_source_name (DECL_NAME (decl));
+}
+
+/* Non-termial <source-name>. IDENTIFIER is an IDENTIFIER_NODE.
+
+ <source-name> ::= </length/ number> <identifier> */
+
+static void
+write_source_name (identifier)
+ tree identifier;
+{
+ MANGLE_TRACE_TREE ("source-name", identifier);
+
+ /* Never write the whole template-id name including the template
+ arguments; we only want the template name. */
+ if (IDENTIFIER_TEMPLATE (identifier))
+ identifier = IDENTIFIER_TEMPLATE (identifier);
+
+ write_unsigned_number (IDENTIFIER_LENGTH (identifier));
+ write_identifier (IDENTIFIER_POINTER (identifier));
+}
+
+/* Convert NUMBER to ascii using base BASE and generating at least
+ MIN_DIGITS characters. BUFFER points to the _end_ of the buffer
+ into which to store the characters. Returns the number of
+ characters generated (these will be layed out in advance of where
+ BUFFER points). */
+
+static int
+hwint_to_ascii (number, base, buffer, min_digits)
+ unsigned HOST_WIDE_INT number;
+ unsigned int base;
+ char *buffer;
+ unsigned min_digits;
+{
+ static const char base_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ unsigned digits = 0;
+
+ while (number)
+ {
+ unsigned HOST_WIDE_INT d = number / base;
+
+ *--buffer = base_digits[number - d * base];
+ digits++;
+ number = d;
+ }
+ while (digits < min_digits)
+ {
+ *--buffer = base_digits[0];
+ digits++;
+ }
+ return digits;
+}
+
+/* Non-terminal <number>.
+
+ <number> ::= [n] </decimal integer/> */
+
+static void
+write_number (number, unsigned_p, base)
+ unsigned HOST_WIDE_INT number;
+ int unsigned_p;
+ unsigned int base;
+{
+ char buffer[sizeof (HOST_WIDE_INT) * 8];
+ unsigned count = 0;
+
+ if (!unsigned_p && (HOST_WIDE_INT) number < 0)
+ {
+ write_char ('n');
+ number = -((HOST_WIDE_INT) number);
+ }
+ count = hwint_to_ascii (number, base, buffer + sizeof (buffer), 1);
+ write_chars (buffer + sizeof (buffer) - count, count);
+}
+
+/* Write out an integral CST in decimal. Most numbers are small, and
+ representable in a HOST_WIDE_INT. Occasionally we'll have numbers
+ bigger than that, which we must deal with. */
+
+static inline void
+write_integer_cst (cst)
+ tree cst;
+{
+ int sign = tree_int_cst_sgn (cst);
+
+ if (TREE_INT_CST_HIGH (cst) + (sign < 0))
+ {
+ /* A bignum. We do this in chunks, each of which fits in a
+ HOST_WIDE_INT. */
+ char buffer[sizeof (HOST_WIDE_INT) * 8 * 2];
+ unsigned HOST_WIDE_INT chunk;
+ unsigned chunk_digits;
+ char *ptr = buffer + sizeof (buffer);
+ unsigned count = 0;
+ tree n, base, type;
+ int done;
+
+ /* HOST_WIDE_INT must be at least 32 bits, so 10^9 is
+ representable. */
+ chunk = 1000000000;
+ chunk_digits = 9;
+
+ if (sizeof (HOST_WIDE_INT) >= 8)
+ {
+ /* It is at least 64 bits, so 10^18 is representable. */
+ chunk_digits = 18;
+ chunk *= chunk;
+ }
+
+ type = signed_or_unsigned_type (1, TREE_TYPE (cst));
+ base = build_int_2 (chunk, 0);
+ n = build_int_2 (TREE_INT_CST_LOW (cst), TREE_INT_CST_HIGH (cst));
+ TREE_TYPE (n) = TREE_TYPE (base) = type;
+
+ if (sign < 0)
+ {
+ write_char ('n');
+ n = fold (build1 (NEGATE_EXPR, type, n));
+ }
+ do
+ {
+ tree d = fold (build (FLOOR_DIV_EXPR, type, n, base));
+ tree tmp = fold (build (MULT_EXPR, type, d, base));
+ unsigned c;
+
+ done = integer_zerop (d);
+ tmp = fold (build (MINUS_EXPR, type, n, tmp));
+ c = hwint_to_ascii (TREE_INT_CST_LOW (tmp), 10, ptr,
+ done ? 1 : chunk_digits);
+ ptr -= c;
+ count += c;
+ n = d;
+ }
+ while (!done);
+ write_chars (ptr, count);
+ }
+ else
+ {
+ /* A small num. */
+ unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (cst);
+
+ if (sign < 0)
+ {
+ write_char ('n');
+ low = -low;
+ }
+ write_unsigned_number (low);
+ }
+}
+
+/* Non-terminal <identifier>.
+
+ <identifier> ::= </unqualified source code identifier> */
+
+static void
+write_identifier (identifier)
+ const char *identifier;
+{
+ MANGLE_TRACE ("identifier", identifier);
+ write_string (identifier);
+}
+
+/* Handle constructor productions of non-terminal <special-name>.
+ CTOR is a constructor FUNCTION_DECL.
+
+ <special-name> ::= C1 # complete object constructor
+ ::= C2 # base object constructor
+ ::= C3 # complete object allocating constructor
+
+ Currently, allocating constructors are never used.
+
+ We also need to provide mangled names for the maybe-in-charge
+ constructor, so we treat it here too. mangle_decl_string will
+ append *INTERNAL* to that, to make sure we never emit it. */
+
+static void
+write_special_name_constructor (ctor)
+ tree ctor;
+{
+ if (DECL_COMPLETE_CONSTRUCTOR_P (ctor)
+ /* Even though we don't ever emit a definition of the
+ old-style destructor, we still have to consider entities
+ (like static variables) nested inside it. */
+ || DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (ctor))
+ write_string ("C1");
+ else if (DECL_BASE_CONSTRUCTOR_P (ctor))
+ write_string ("C2");
+ else
+ abort ();
+}
+
+/* Handle destructor productions of non-terminal <special-name>.
+ DTOR is a destructor FUNCTION_DECL.
+
+ <special-name> ::= D0 # deleting (in-charge) destructor
+ ::= D1 # complete object (in-charge) destructor
+ ::= D2 # base object (not-in-charge) destructor
+
+ We also need to provide mangled names for the maybe-incharge
+ destructor, so we treat it here too. mangle_decl_string will
+ append *INTERNAL* to that, to make sure we never emit it. */
+
+static void
+write_special_name_destructor (dtor)
+ tree dtor;
+{
+ if (DECL_DELETING_DESTRUCTOR_P (dtor))
+ write_string ("D0");
+ else if (DECL_COMPLETE_DESTRUCTOR_P (dtor)
+ /* Even though we don't ever emit a definition of the
+ old-style destructor, we still have to consider entities
+ (like static variables) nested inside it. */
+ || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (dtor))
+ write_string ("D1");
+ else if (DECL_BASE_DESTRUCTOR_P (dtor))
+ write_string ("D2");
+ else
+ abort ();
+}
+
+/* Return the discriminator for ENTITY appearing inside
+ FUNCTION. The discriminator is the lexical ordinal of VAR among
+ entities with the same name in the same FUNCTION. */
+
+static int
+discriminator_for_local_entity (entity)
+ tree entity;
+{
+ tree *type;
+ int discriminator;
+
+ /* Assume this is the only local entity with this name. */
+ discriminator = 0;
+
+ if (DECL_DISCRIMINATOR_P (entity) && DECL_LANG_SPECIFIC (entity))
+ discriminator = DECL_DISCRIMINATOR (entity);
+ else if (TREE_CODE (entity) == TYPE_DECL)
+ {
+ /* Scan the list of local classes. */
+ entity = TREE_TYPE (entity);
+ for (type = &VARRAY_TREE (local_classes, 0); *type != entity; ++type)
+ if (TYPE_IDENTIFIER (*type) == TYPE_IDENTIFIER (entity)
+ && TYPE_CONTEXT (*type) == TYPE_CONTEXT (entity))
+ ++discriminator;
+ }
+
+ return discriminator;
+}
+
+/* Return the discriminator for STRING, a string literal used inside
+ FUNCTION. The disciminator is the lexical ordinal of STRING among
+ string literals used in FUNCTION. */
+
+static int
+discriminator_for_string_literal (function, string)
+ tree function ATTRIBUTE_UNUSED;
+ tree string ATTRIBUTE_UNUSED;
+{
+ /* For now, we don't discriminate amongst string literals. */
+ return 0;
+}
+
+/* <discriminator> := _ <number>
+
+ The discriminator is used only for the second and later occurrences
+ of the same name within a single function. In this case <number> is
+ n - 2, if this is the nth occurrence, in lexical order. */
+
+static void
+write_discriminator (discriminator)
+ int discriminator;
+{
+ /* If discriminator is zero, don't write anything. Otherwise... */
+ if (discriminator > 0)
+ {
+ write_char ('_');
+ write_unsigned_number (discriminator - 1);
+ }
+}
+
+/* Mangle the name of a function-scope entity. FUNCTION is the
+ FUNCTION_DECL for the enclosing function. ENTITY is the decl for
+ the entity itself. LOCAL_ENTITY is the entity that's directly
+ scoped in FUNCTION_DECL, either ENTITY itself or an enclosing scope
+ of ENTITY.
+
+ <local-name> := Z <function encoding> E <entity name> [<discriminator>]
+ := Z <function encoding> E s [<discriminator>] */
+
+static void
+write_local_name (function, local_entity, entity)
+ tree function;
+ tree local_entity;
+ tree entity;
+{
+ MANGLE_TRACE_TREE ("local-name", entity);
+
+ write_char ('Z');
+ write_encoding (function);
+ write_char ('E');
+ if (TREE_CODE (entity) == STRING_CST)
+ {
+ write_char ('s');
+ write_discriminator (discriminator_for_string_literal (function,
+ entity));
+ }
+ else
+ {
+ /* Now the <entity name>. Let write_name know its being called
+ from <local-name>, so it doesn't try to process the enclosing
+ function scope again. */
+ write_name (entity, /*ignore_local_scope=*/1);
+ write_discriminator (discriminator_for_local_entity (local_entity));
+ }
+}
+
+/* Non-terminals <type> and <CV-qualifier>.
+
+ <type> ::= <builtin-type>
+ ::= <function-type>
+ ::= <class-enum-type>
+ ::= <array-type>
+ ::= <pointer-to-member-type>
+ ::= <template-param>
+ ::= <substitution>
+ ::= <CV-qualifier>
+ ::= P <type> # pointer-to
+ ::= R <type> # reference-to
+ ::= C <type> # complex pair (C 2000)
+ ::= G <type> # imaginary (C 2000) [not supported]
+ ::= U <source-name> <type> # vendor extended type qualifier
+
+ TYPE is a type node. */
+
+static void
+write_type (type)
+ tree type;
+{
+ /* This gets set to non-zero if TYPE turns out to be a (possibly
+ CV-qualified) builtin type. */
+ int is_builtin_type = 0;
+
+ MANGLE_TRACE_TREE ("type", type);
+
+ if (type == error_mark_node)
+ return;
+
+ if (find_substitution (type))
+ return;
+
+ if (write_CV_qualifiers_for_type (type) > 0)
+ /* If TYPE was CV-qualified, we just wrote the qualifiers; now
+ mangle the unqualified type. The recursive call is needed here
+ since both the qualified and uqualified types are substitution
+ candidates. */
+ write_type (TYPE_MAIN_VARIANT (type));
+ else
+ {
+ /* See through any typedefs. */
+ type = TYPE_MAIN_VARIANT (type);
+
+ switch (TREE_CODE (type))
+ {
+ case VOID_TYPE:
+ case BOOLEAN_TYPE:
+ case INTEGER_TYPE: /* Includes wchar_t. */
+ case REAL_TYPE:
+ /* If this is a typedef, TYPE may not be one of
+ the standard builtin type nodes, but an alias of one. Use
+ TYPE_MAIN_VARIANT to get to the underlying builtin type. */
+ write_builtin_type (TYPE_MAIN_VARIANT (type));
+ ++is_builtin_type;
+ break;
+
+ case COMPLEX_TYPE:
+ write_char ('C');
+ write_type (TREE_TYPE (type));
+ break;
+
+ case FUNCTION_TYPE:
+ case METHOD_TYPE:
+ write_function_type (type);
+ break;
+
+ case UNION_TYPE:
+ case RECORD_TYPE:
+ case ENUMERAL_TYPE:
+ /* A pointer-to-member function is represented as a special
+ RECORD_TYPE, so check for this first. */
+ if (TYPE_PTRMEMFUNC_P (type))
+ write_pointer_to_member_type (type);
+ else
+ write_class_enum_type (type);
+ break;
+
+ case TYPENAME_TYPE:
+ case UNBOUND_CLASS_TEMPLATE:
+ /* We handle TYPENAME_TYPEs and UNBOUND_CLASS_TEMPLATEs like
+ ordinary nested names. */
+ write_nested_name (TYPE_STUB_DECL (type));
+ break;
+
+ case ARRAY_TYPE:
+ write_array_type (type);
+ break;
+
+ case POINTER_TYPE:
+ /* A pointer-to-member variable is represented by a POINTER_TYPE
+ to an OFFSET_TYPE, so check for this first. */
+ if (TYPE_PTRMEM_P (type))
+ write_pointer_to_member_type (type);
+ else
+ {
+ write_char ('P');
+ write_type (TREE_TYPE (type));
+ }
+ break;
+
+ case REFERENCE_TYPE:
+ write_char ('R');
+ write_type (TREE_TYPE (type));
+ break;
+
+ case TEMPLATE_TYPE_PARM:
+ case TEMPLATE_PARM_INDEX:
+ write_template_param (type);
+ break;
+
+ case TEMPLATE_TEMPLATE_PARM:
+ write_template_template_param (type);
+ break;
+
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
+ write_template_template_param (type);
+ write_template_args
+ (TI_ARGS (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (type)));
+ break;
+
+ case OFFSET_TYPE:
+ write_pointer_to_member_type (build_pointer_type (type));
+ break;
+
+ case VECTOR_TYPE:
+ write_string ("U8__vector");
+ write_type (TREE_TYPE (type));
+ break;
+
+ default:
+ abort ();
+ }
+ }
+
+ /* Types other than builtin types are substitution candidates. */
+ if (!is_builtin_type)
+ add_substitution (type);
+}
+
+/* Non-terminal <CV-qualifiers> for type nodes. Returns the number of
+ CV-qualifiers written for TYPE.
+
+ <CV-qualifiers> ::= [r] [V] [K] */
+
+static int
+write_CV_qualifiers_for_type (type)
+ tree type;
+{
+ int num_qualifiers = 0;
+
+ /* The order is specified by:
+
+ "In cases where multiple order-insensitive qualifiers are
+ present, they should be ordered 'K' (closest to the base type),
+ 'V', 'r', and 'U' (farthest from the base type) ..." */
+
+ if (CP_TYPE_RESTRICT_P (type))
+ {
+ write_char ('r');
+ ++num_qualifiers;
+ }
+ if (CP_TYPE_VOLATILE_P (type))
+ {
+ write_char ('V');
+ ++num_qualifiers;
+ }
+ if (CP_TYPE_CONST_P (type))
+ {
+ write_char ('K');
+ ++num_qualifiers;
+ }
+
+ return num_qualifiers;
+}
+
+/* Non-terminal <builtin-type>.
+
+ <builtin-type> ::= v # void
+ ::= b # bool
+ ::= w # wchar_t
+ ::= c # char
+ ::= a # signed char
+ ::= h # unsigned char
+ ::= s # short
+ ::= t # unsigned short
+ ::= i # int
+ ::= j # unsigned int
+ ::= l # long
+ ::= m # unsigned long
+ ::= x # long long, __int64
+ ::= y # unsigned long long, __int64
+ ::= n # __int128 [not supported]
+ ::= o # unsigned __int128 [not supported]
+ ::= f # float
+ ::= d # double
+ ::= e # long double, __float80
+ ::= g # __float128 [not supported]
+ ::= u <source-name> # vendor extended type */
+
+static void
+write_builtin_type (type)
+ tree type;
+{
+ switch (TREE_CODE (type))
+ {
+ case VOID_TYPE:
+ write_char ('v');
+ break;
+
+ case BOOLEAN_TYPE:
+ write_char ('b');
+ break;
+
+ case INTEGER_TYPE:
+ /* If this is size_t, get the underlying int type. */
+ if (TYPE_IS_SIZETYPE (type))
+ type = TYPE_DOMAIN (type);
+
+ /* TYPE may still be wchar_t, since that isn't in
+ integer_type_nodes. */
+ if (type == wchar_type_node)
+ write_char ('w');
+ else if (TYPE_FOR_JAVA (type))
+ write_java_integer_type_codes (type);
+ else
+ {
+ size_t itk;
+ /* Assume TYPE is one of the shared integer type nodes. Find
+ it in the array of these nodes. */
+ iagain:
+ for (itk = 0; itk < itk_none; ++itk)
+ if (type == integer_types[itk])
+ {
+ /* Print the corresponding single-letter code. */
+ write_char (integer_type_codes[itk]);
+ break;
+ }
+
+ if (itk == itk_none)
+ {
+ tree t = type_for_mode (TYPE_MODE (type), TREE_UNSIGNED (type));
+ if (type == t)
+ /* Couldn't find this type. */
+ abort ();
+ type = t;
+ goto iagain;
+ }
+ }
+ break;
+
+ case REAL_TYPE:
+ if (type == float_type_node
+ || type == java_float_type_node)
+ write_char ('f');
+ else if (type == double_type_node
+ || type == java_double_type_node)
+ write_char ('d');
+ else if (type == long_double_type_node)
+ write_char ('e');
+ else
+ abort ();
+ break;
+
+ default:
+ abort ();
+ }
+}
+
+/* Non-terminal <function-type>. NODE is a FUNCTION_TYPE or
+ METHOD_TYPE. The return type is mangled before the parameter
+ types.
+
+ <function-type> ::= F [Y] <bare-function-type> E */
+
+static void
+write_function_type (type)
+ tree type;
+{
+ MANGLE_TRACE_TREE ("function-type", type);
+
+ write_char ('F');
+ /* We don't track whether or not a type is `extern "C"'. Note that
+ you can have an `extern "C"' function that does not have
+ `extern "C"' type, and vice versa:
+
+ extern "C" typedef void function_t();
+ function_t f; // f has C++ linkage, but its type is
+ // `extern "C"'
+
+ typedef void function_t();
+ extern "C" function_t f; // Vice versa.
+
+ See [dcl.link]. */
+ write_bare_function_type (type, /*include_return_type_p=*/1,
+ /*decl=*/NULL);
+ write_char ('E');
+}
+
+/* Non-terminal <bare-function-type>. TYPE is a FUNCTION_TYPE or
+ METHOD_TYPE. If INCLUDE_RETURN_TYPE is non-zero, the return value
+ is mangled before the parameter types. If non-NULL, DECL is
+ FUNCTION_DECL for the function whose type is being emitted.
+
+ <bare-function-type> ::= </signature/ type>+ */
+
+static void
+write_bare_function_type (type, include_return_type_p, decl)
+ tree type;
+ int include_return_type_p;
+ tree decl;
+{
+ MANGLE_TRACE_TREE ("bare-function-type", type);
+
+ /* Mangle the return type, if requested. */
+ if (include_return_type_p)
+ write_type (TREE_TYPE (type));
+
+ /* Now mangle the types of the arguments. */
+ write_method_parms (TYPE_ARG_TYPES (type),
+ TREE_CODE (type) == METHOD_TYPE,
+ decl);
+}
+
+/* Write the mangled representation of a method parameter list of
+ types given in PARM_TYPES. If METHOD_P is non-zero, the function is
+ considered a non-static method, and the this parameter is omitted.
+ If non-NULL, DECL is the FUNCTION_DECL for the function whose
+ parameters are being emitted. */
+
+static void
+write_method_parms (parm_types, method_p, decl)
+ tree decl;
+ tree parm_types;
+ int method_p;
+{
+ tree first_parm_type;
+ tree parm_decl = decl ? DECL_ARGUMENTS (decl) : NULL_TREE;
+
+ /* Assume this parameter type list is variable-length. If it ends
+ with a void type, then it's not. */
+ int varargs_p = 1;
+
+ /* If this is a member function, skip the first arg, which is the
+ this pointer.
+ "Member functions do not encode the type of their implicit this
+ parameter."
+
+ Similarly, there's no need to mangle artificial parameters, like
+ the VTT parameters for constructors and destructors. */
+ if (method_p)
+ {
+ parm_types = TREE_CHAIN (parm_types);
+ parm_decl = parm_decl ? TREE_CHAIN (parm_decl) : NULL_TREE;
+
+ while (parm_decl && DECL_ARTIFICIAL (parm_decl))
+ {
+ parm_types = TREE_CHAIN (parm_types);
+ parm_decl = TREE_CHAIN (parm_decl);
+ }
+ }
+
+ for (first_parm_type = parm_types;
+ parm_types;
+ parm_types = TREE_CHAIN (parm_types))
+ {
+ tree parm = TREE_VALUE (parm_types);
+ if (parm == void_type_node)
+ {
+ /* "Empty parameter lists, whether declared as () or
+ conventionally as (void), are encoded with a void parameter
+ (v)." */
+ if (parm_types == first_parm_type)
+ write_type (parm);
+ /* If the parm list is terminated with a void type, it's
+ fixed-length. */
+ varargs_p = 0;
+ /* A void type better be the last one. */
+ my_friendly_assert (TREE_CHAIN (parm_types) == NULL, 20000523);
+ }
+ else
+ write_type (parm);
+ }
+
+ if (varargs_p)
+ /* <builtin-type> ::= z # ellipsis */
+ write_char ('z');
+}
+
+/* <class-enum-type> ::= <name> */
+
+static void
+write_class_enum_type (type)
+ tree type;
+{
+ write_name (TYPE_NAME (type), /*ignore_local_scope=*/0);
+}
+
+/* Non-terminal <template-args>. ARGS is a TREE_VEC of template
+ arguments.
+
+ <template-args> ::= I <template-arg>+ E */
+
+static void
+write_template_args (args)
+ tree args;
+{
+ int i;
+ int length = TREE_VEC_LENGTH (args);
+
+ MANGLE_TRACE_TREE ("template-args", args);
+
+ my_friendly_assert (length > 0, 20000422);
+
+ if (TREE_CODE (TREE_VEC_ELT (args, 0)) == TREE_VEC)
+ {
+ /* We have nested template args. We want the innermost template
+ argument list. */
+ args = TREE_VEC_ELT (args, length - 1);
+ length = TREE_VEC_LENGTH (args);
+ }
+
+ write_char ('I');
+ for (i = 0; i < length; ++i)
+ write_template_arg (TREE_VEC_ELT (args, i));
+ write_char ('E');
+}
+
+/* <expression> ::= <unary operator-name> <expression>
+ ::= <binary operator-name> <expression> <expression>
+ ::= <expr-primary>
+
+ <expr-primary> ::= <template-param>
+ ::= L <type> <value number> E # literal
+ ::= L <mangled-name> E # external name */
+
+static void
+write_expression (expr)
+ tree expr;
+{
+ enum tree_code code;
+
+ code = TREE_CODE (expr);
+
+ /* Handle pointers-to-members by making them look like expression
+ nodes. */
+ if (code == PTRMEM_CST)
+ {
+ expr = build_nt (ADDR_EXPR,
+ build_nt (SCOPE_REF,
+ PTRMEM_CST_CLASS (expr),
+ PTRMEM_CST_MEMBER (expr)));
+ code = TREE_CODE (expr);
+ }
+
+ /* Handle template parameters. */
+ if (code == TEMPLATE_TYPE_PARM
+ || code == TEMPLATE_TEMPLATE_PARM
+ || code == BOUND_TEMPLATE_TEMPLATE_PARM
+ || code == TEMPLATE_PARM_INDEX)
+ write_template_param (expr);
+ /* Handle literals. */
+ else if (TREE_CODE_CLASS (code) == 'c')
+ write_template_arg_literal (expr);
+ else if (DECL_P (expr))
+ {
+ write_char ('L');
+ write_mangled_name (expr);
+ write_char ('E');
+ }
+ else
+ {
+ int i;
+
+ /* Skip NOP_EXPRs. They can occur when (say) a pointer argument
+ is converted (via qualification conversions) to another
+ type. */
+ while (TREE_CODE (expr) == NOP_EXPR)
+ {
+ expr = TREE_OPERAND (expr, 0);
+ code = TREE_CODE (expr);
+ }
+
+ /* When we bind a variable or function to a non-type template
+ argument with reference type, we create an ADDR_EXPR to show
+ the fact that the entity's address has been taken. But, we
+ don't actually want to output a mangling code for the `&'. */
+ if (TREE_CODE (expr) == ADDR_EXPR
+ && TREE_TYPE (expr)
+ && TREE_CODE (TREE_TYPE (expr)) == REFERENCE_TYPE)
+ {
+ expr = TREE_OPERAND (expr, 0);
+ if (DECL_P (expr))
+ {
+ write_expression (expr);
+ return;
+ }
+
+ code = TREE_CODE (expr);
+ }
+
+ /* If it wasn't any of those, recursively expand the expression. */
+ write_string (operator_name_info[(int) code].mangled_name);
+
+ switch (code)
+ {
+ case CAST_EXPR:
+ write_type (TREE_TYPE (expr));
+ write_expression (TREE_VALUE (TREE_OPERAND (expr, 0)));
+ break;
+
+ case STATIC_CAST_EXPR:
+ case CONST_CAST_EXPR:
+ write_type (TREE_TYPE (expr));
+ write_expression (TREE_OPERAND (expr, 0));
+ break;
+
+ /* Handle pointers-to-members specially. */
+ case SCOPE_REF:
+ write_type (TREE_OPERAND (expr, 0));
+ if (TREE_CODE (TREE_OPERAND (expr, 1)) == IDENTIFIER_NODE)
+ write_source_name (TREE_OPERAND (expr, 1));
+ else
+ write_encoding (TREE_OPERAND (expr, 1));
+ break;
+
+ default:
+ for (i = 0; i < TREE_CODE_LENGTH (code); ++i)
+ write_expression (TREE_OPERAND (expr, i));
+ }
+ }
+}
+
+/* Literal subcase of non-terminal <template-arg>.
+
+ "Literal arguments, e.g. "A<42L>", are encoded with their type
+ and value. Negative integer values are preceded with "n"; for
+ example, "A<-42L>" becomes "1AILln42EE". The bool value false is
+ encoded as 0, true as 1. If floating-point arguments are accepted
+ as an extension, their values should be encoded using a
+ fixed-length lowercase hexadecimal string corresponding to the
+ internal representation (IEEE on IA-64), high-order bytes first,
+ without leading zeroes. For example: "Lfbff000000E" is -1.0f." */
+
+static void
+write_template_arg_literal (value)
+ tree value;
+{
+ tree type = TREE_TYPE (value);
+ write_char ('L');
+ write_type (type);
+
+ if (TREE_CODE (value) == CONST_DECL)
+ write_integer_cst (DECL_INITIAL (value));
+ else if (TREE_CODE (value) == INTEGER_CST)
+ {
+ if (same_type_p (type, boolean_type_node))
+ {
+ if (value == boolean_false_node || integer_zerop (value))
+ write_unsigned_number (0);
+ else if (value == boolean_true_node)
+ write_unsigned_number (1);
+ else
+ abort ();
+ }
+ else
+ write_integer_cst (value);
+ }
+ else if (TREE_CODE (value) == REAL_CST)
+ {
+#ifdef CROSS_COMPILE
+ static int explained;
+
+ if (!explained)
+ {
+ sorry ("real-valued template parameters when cross-compiling");
+ explained = 1;
+ }
+#else
+ size_t i;
+ for (i = 0; i < sizeof (TREE_REAL_CST (value)); ++i)
+ write_number (((unsigned char *)
+ &TREE_REAL_CST (value))[i],
+ /*unsigned_p=*/1,
+ 16);
+#endif
+ }
+ else
+ abort ();
+
+ write_char ('E');
+}
+
+/* Non-terminal <tempalate-arg>.
+
+ <template-arg> ::= <type> # type
+ ::= L <type> </value/ number> E # literal
+ ::= LZ <name> E # external name
+ ::= X <expression> E # expression */
+
+static void
+write_template_arg (node)
+ tree node;
+{
+ enum tree_code code = TREE_CODE (node);
+
+ MANGLE_TRACE_TREE ("template-arg", node);
+
+ /* A template template paramter's argument list contains TREE_LIST
+ nodes of which the value field is the the actual argument. */
+ if (code == TREE_LIST)
+ {
+ node = TREE_VALUE (node);
+ /* If it's a decl, deal with its type instead. */
+ if (DECL_P (node))
+ {
+ node = TREE_TYPE (node);
+ code = TREE_CODE (node);
+ }
+ }
+
+ if (TYPE_P (node))
+ write_type (node);
+ else if (code == TEMPLATE_DECL)
+ /* A template appearing as a template arg is a template template arg. */
+ write_template_template_arg (node);
+ else if (DECL_P (node))
+ {
+ write_char ('L');
+ write_char ('Z');
+ write_encoding (node);
+ write_char ('E');
+ }
+ else if (TREE_CODE_CLASS (code) == 'c' && code != PTRMEM_CST)
+ write_template_arg_literal (node);
+ else
+ {
+ /* Template arguments may be expressions. */
+ write_char ('X');
+ write_expression (node);
+ write_char ('E');
+ }
+}
+
+/* <template-template-arg>
+ ::= <name>
+ ::= <substitution> */
+
+void
+write_template_template_arg (tree decl)
+{
+ MANGLE_TRACE_TREE ("template-template-arg", decl);
+
+ if (find_substitution (decl))
+ return;
+ write_name (decl, /*ignore_local_scope=*/0);
+ add_substitution (decl);
+}
+
+
+/* Non-terminal <array-type>. TYPE is an ARRAY_TYPE.
+
+ <array-type> ::= A [</dimension/ number>] _ </element/ type>
+ ::= A <expression> _ </element/ type>
+
+ "Array types encode the dimension (number of elements) and the
+ element type. For variable length arrays, the dimension (but not
+ the '_' separator) is omitted." */
+
+static void
+write_array_type (type)
+ tree type;
+{
+ write_char ('A');
+ if (TYPE_DOMAIN (type))
+ {
+ tree index_type;
+ tree max;
+
+ index_type = TYPE_DOMAIN (type);
+ /* The INDEX_TYPE gives the upper and lower bounds of the
+ array. */
+ max = TYPE_MAX_VALUE (index_type);
+ if (TREE_CODE (max) == INTEGER_CST)
+ {
+ /* The ABI specifies that we should mangle the number of
+ elements in the array, not the largest allowed index. */
+ max = size_binop (PLUS_EXPR, max, size_one_node);
+ write_unsigned_number (tree_low_cst (max, 1));
+ }
+ else
+ write_expression (TREE_OPERAND (max, 0));
+ }
+ write_char ('_');
+ write_type (TREE_TYPE (type));
+}
+
+/* Non-terminal <pointer-to-member-type> for pointer-to-member
+ variables. TYPE is a pointer-to-member POINTER_TYPE.
+
+ <pointer-to-member-type> ::= M </class/ type> </member/ type> */
+
+static void
+write_pointer_to_member_type (type)
+ tree type;
+{
+ write_char ('M');
+ /* For a pointer-to-function member, the class type may be
+ cv-qualified, but that won't be reflected in
+ TYPE_PTRMEM_CLASS_TYPE. So, we go fishing around in
+ TYPE_PTRMEM_POINTED_TO_TYPE instead. */
+ if (TYPE_PTRMEMFUNC_P (type))
+ {
+ tree fn_type;
+ tree this_type;
+
+ fn_type = TYPE_PTRMEM_POINTED_TO_TYPE (type);
+ /* The first parameter must be a POINTER_TYPE pointing to the
+ `this' parameter. */
+ this_type = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fn_type)));
+ write_type (this_type);
+ }
+ /* For a pointer-to-data member, things are simpler. */
+ else
+ write_type (TYPE_PTRMEM_CLASS_TYPE (type));
+ write_type (TYPE_PTRMEM_POINTED_TO_TYPE (type));
+}
+
+/* Non-terminal <template-param>. PARM is a TEMPLATE_TYPE_PARM,
+ TEMPLATE_TEMPLATE_PARM, BOUND_TEMPLATE_TEMPLATE_PARM or a
+ TEMPLATE_PARM_INDEX.
+
+ <template-param> ::= T </parameter/ number> _ */
+
+static void
+write_template_param (parm)
+ tree parm;
+{
+ int parm_index;
+
+ MANGLE_TRACE_TREE ("template-parm", parm);
+
+ switch (TREE_CODE (parm))
+ {
+ case TEMPLATE_TYPE_PARM:
+ case TEMPLATE_TEMPLATE_PARM:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
+ parm_index = TEMPLATE_TYPE_IDX (parm);
+ break;
+
+ case TEMPLATE_PARM_INDEX:
+ parm_index = TEMPLATE_PARM_IDX (parm);
+ break;
+
+ default:
+ abort ();
+ }
+
+ write_char ('T');
+ /* NUMBER as it appears in the mangling is (-1)-indexed, with the
+ earliest template param denoted by `_'. */
+ if (parm_index > 0)
+ write_unsigned_number (parm_index - 1);
+ write_char ('_');
+}
+
+/* <template-template-param>
+ ::= <template-param>
+ ::= <substitution> */
+
+static void
+write_template_template_param (parm)
+ tree parm;
+{
+ tree template = NULL_TREE;
+
+ /* PARM, a TEMPLATE_TEMPLATE_PARM, is an instantiation of the
+ template template parameter. The substitution candidate here is
+ only the template. */
+ if (TREE_CODE (parm) == BOUND_TEMPLATE_TEMPLATE_PARM)
+ {
+ template
+ = TI_TEMPLATE (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (parm));
+ if (find_substitution (template))
+ return;
+ }
+
+ /* <template-param> encodes only the template parameter position,
+ not its template arguments, which is fine here. */
+ write_template_param (parm);
+ if (template)
+ add_substitution (template);
+}
+
+/* Non-terminal <substitution>.
+
+ <substitution> ::= S <seq-id> _
+ ::= S_ */
+
+static void
+write_substitution (seq_id)
+ int seq_id;
+{
+ MANGLE_TRACE ("substitution", "");
+
+ write_char ('S');
+ if (seq_id > 0)
+ write_number (seq_id - 1, /*unsigned=*/1, 36);
+ write_char ('_');
+}
+
+/* Start mangling a new name or type. */
+
+static inline void
+start_mangling ()
+{
+ obstack_free (&G.name_obstack, obstack_base (&G.name_obstack));
+}
+
+/* Done with mangling. Return the generated mangled name. */
+
+static inline const char *
+finish_mangling ()
+{
+ /* Clear all the substitutions. */
+ VARRAY_POP_ALL (G.substitutions);
+
+ /* Null-terminate the string. */
+ write_char ('\0');
+
+ return (const char *) obstack_base (&G.name_obstack);
+}
+
+/* Initialize data structures for mangling. */
+
+void
+init_mangle ()
+{
+ gcc_obstack_init (&G.name_obstack);
+ VARRAY_TREE_INIT (G.substitutions, 1, "mangling substitutions");
+
+ /* Cache these identifiers for quick comparison when checking for
+ standard substitutions. */
+ subst_identifiers[SUBID_ALLOCATOR] = get_identifier ("allocator");
+ subst_identifiers[SUBID_BASIC_STRING] = get_identifier ("basic_string");
+ subst_identifiers[SUBID_CHAR_TRAITS] = get_identifier ("char_traits");
+ subst_identifiers[SUBID_BASIC_ISTREAM] = get_identifier ("basic_istream");
+ subst_identifiers[SUBID_BASIC_OSTREAM] = get_identifier ("basic_ostream");
+ subst_identifiers[SUBID_BASIC_IOSTREAM] = get_identifier ("basic_iostream");
+}
+
+/* Generate the mangled name of DECL. */
+
+static const char *
+mangle_decl_string (decl)
+ tree decl;
+{
+ const char *result;
+
+ start_mangling ();
+
+ if (TREE_CODE (decl) == TYPE_DECL)
+ write_type (TREE_TYPE (decl));
+ else if (/* The names of `extern "C"' functions are not mangled. */
+ (DECL_EXTERN_C_FUNCTION_P (decl)
+ /* But overloaded operator names *are* mangled. */
+ && !DECL_OVERLOADED_OPERATOR_P (decl))
+ /* The names of global variables aren't mangled either. */
+ || (TREE_CODE (decl) == VAR_DECL
+ && CP_DECL_CONTEXT (decl) == global_namespace)
+ /* And neither are `extern "C"' variables. */
+ || (TREE_CODE (decl) == VAR_DECL
+ && DECL_EXTERN_C_P (decl)))
+ write_string (IDENTIFIER_POINTER (DECL_NAME (decl)));
+ else
+ {
+ write_mangled_name (decl);
+ if (DECL_LANG_SPECIFIC (decl)
+ && (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl)
+ || DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl)))
+ /* We need a distinct mangled name for these entities, but
+ we should never actually output it. So, we append some
+ characters the assembler won't like. */
+ write_string (" *INTERNAL* ");
+ }
+
+ result = finish_mangling ();
+ if (DEBUG_MANGLE)
+ fprintf (stderr, "mangle_decl_string = '%s'\n\n", result);
+ return result;
+}
+
+/* Create an identifier for the external mangled name of DECL. */
+
+void
+mangle_decl (decl)
+ tree decl;
+{
+ tree id = get_identifier (mangle_decl_string (decl));
+
+ SET_DECL_ASSEMBLER_NAME (decl, id);
+}
+
+/* Generate the mangled representation of TYPE. */
+
+const char *
+mangle_type_string (type)
+ tree type;
+{
+ const char *result;
+
+ start_mangling ();
+ write_type (type);
+ result = finish_mangling ();
+ if (DEBUG_MANGLE)
+ fprintf (stderr, "mangle_type_string = '%s'\n\n", result);
+ return result;
+}
+
+/* Create an identifier for the mangled representation of TYPE. */
+
+tree
+mangle_type (type)
+ tree type;
+{
+ return get_identifier (mangle_type_string (type));
+}
+
+/* Create an identifier for the mangled name of a special component
+ for belonging to TYPE. CODE is the ABI-specified code for this
+ component. */
+
+static tree
+mangle_special_for_type (type, code)
+ tree type;
+ const char *code;
+{
+ const char *result;
+
+ /* We don't have an actual decl here for the special component, so
+ we can't just process the <encoded-name>. Instead, fake it. */
+ start_mangling ();
+
+ /* Start the mangling. */
+ write_string ("_Z");
+ write_string (code);
+
+ /* Add the type. */
+ write_type (type);
+ result = finish_mangling ();
+
+ if (DEBUG_MANGLE)
+ fprintf (stderr, "mangle_special_for_type = %s\n\n", result);
+
+ return get_identifier (result);
+}
+
+/* Create an identifier for the mangled representation of the typeinfo
+ structure for TYPE. */
+
+tree
+mangle_typeinfo_for_type (type)
+ tree type;
+{
+ return mangle_special_for_type (type, "TI");
+}
+
+/* Create an identifier for the mangled name of the NTBS containing
+ the mangled name of TYPE. */
+
+tree
+mangle_typeinfo_string_for_type (type)
+ tree type;
+{
+ return mangle_special_for_type (type, "TS");
+}
+
+/* Create an identifier for the mangled name of the vtable for TYPE. */
+
+tree
+mangle_vtbl_for_type (type)
+ tree type;
+{
+ return mangle_special_for_type (type, "TV");
+}
+
+/* Returns an identifier for the mangled name of the VTT for TYPE. */
+
+tree
+mangle_vtt_for_type (type)
+ tree type;
+{
+ return mangle_special_for_type (type, "TT");
+}
+
+/* Return an identifier for a construction vtable group. TYPE is
+ the most derived class in the hierarchy; BINFO is the base
+ subobject for which this construction vtable group will be used.
+
+ This mangling isn't part of the ABI specification; in the ABI
+ specification, the vtable group is dumped in the same COMDAT as the
+ main vtable, and is referenced only from that vtable, so it doesn't
+ need an external name. For binary formats without COMDAT sections,
+ though, we need external names for the vtable groups.
+
+ We use the production
+
+ <special-name> ::= CT <type> <offset number> _ <base type> */
+
+tree
+mangle_ctor_vtbl_for_type (type, binfo)
+ tree type;
+ tree binfo;
+{
+ const char *result;
+
+ start_mangling ();
+
+ write_string ("_Z");
+ write_string ("TC");
+ write_type (type);
+ write_integer_cst (BINFO_OFFSET (binfo));
+ write_char ('_');
+ write_type (BINFO_TYPE (binfo));
+
+ result = finish_mangling ();
+ if (DEBUG_MANGLE)
+ fprintf (stderr, "mangle_ctor_vtbl_for_type = %s\n\n", result);
+ return get_identifier (result);
+}
+
+/* Return an identifier for the mangled name of a thunk to FN_DECL.
+ OFFSET is the initial adjustment to this used to find the vptr. If
+ VCALL_OFFSET is non-NULL, this is a virtual thunk, and it is the
+ vtbl offset in bytes.
+
+ <special-name> ::= Th <offset number> _ <base encoding>
+ ::= Tv <offset number> _ <vcall offset number> _
+ <base encoding>
+*/
+
+tree
+mangle_thunk (fn_decl, offset, vcall_offset)
+ tree fn_decl;
+ tree offset;
+ tree vcall_offset;
+{
+ const char *result;
+
+ start_mangling ();
+
+ write_string ("_Z");
+ /* The <special-name> for virtual thunks is Tv, for non-virtual
+ thunks Th. */
+ write_char ('T');
+ if (vcall_offset != 0)
+ write_char ('v');
+ else
+ write_char ('h');
+
+ /* For either flavor, write the offset to this. */
+ write_integer_cst (offset);
+ write_char ('_');
+
+ /* For a virtual thunk, add the vcall offset. */
+ if (vcall_offset)
+ {
+ /* Virtual thunk. Write the vcall offset and base type name. */
+ write_integer_cst (vcall_offset);
+ write_char ('_');
+ }
+
+ /* Scoped name. */
+ write_encoding (fn_decl);
+
+ result = finish_mangling ();
+ if (DEBUG_MANGLE)
+ fprintf (stderr, "mangle_thunk = %s\n\n", result);
+ return get_identifier (result);
+}
+
+/* Return an identifier for the mangled unqualified name for a
+ conversion operator to TYPE. This mangling is not specified by the
+ ABI spec; it is only used internally. */
+
+tree
+mangle_conv_op_name_for_type (type)
+ tree type;
+{
+ tree identifier;
+
+ /* Build the mangling for TYPE. */
+ const char *mangled_type = mangle_type_string (type);
+ /* Allocate a temporary buffer for the complete name. */
+ char *op_name = concat ("operator ", mangled_type, NULL);
+ /* Find or create an identifier. */
+ identifier = get_identifier (op_name);
+ /* Done with the temporary buffer. */
+ free (op_name);
+ /* Set bits on the identifier so we know later it's a conversion. */
+ IDENTIFIER_OPNAME_P (identifier) = 1;
+ IDENTIFIER_TYPENAME_P (identifier) = 1;
+ /* Hang TYPE off the identifier so it can be found easily later when
+ performing conversions. */
+ TREE_TYPE (identifier) = type;
+
+ return identifier;
+}
+
+/* Return an identifier for the name of an initialization guard
+ variable for indicated VARIABLE. */
+
+tree
+mangle_guard_variable (variable)
+ tree variable;
+{
+ start_mangling ();
+ write_string ("_ZGV");
+ if (strncmp (IDENTIFIER_POINTER (DECL_NAME (variable)), "_ZGR", 4) == 0)
+ /* The name of a guard variable for a reference temporary should refer
+ to the reference, not the temporary. */
+ write_string (IDENTIFIER_POINTER (DECL_NAME (variable)) + 4);
+ else
+ write_name (variable, /*ignore_local_scope=*/0);
+ return get_identifier (finish_mangling ());
+}
+
+/* Return an identifier for the name of a temporary variable used to
+ initialize a static reference. This isn't part of the ABI, but we might
+ as well call them something readable. */
+
+tree
+mangle_ref_init_variable (variable)
+ tree variable;
+{
+ start_mangling ();
+ write_string ("_ZGR");
+ write_name (variable, /*ignore_local_scope=*/0);
+ return get_identifier (finish_mangling ());
+}
+
+
+/* Foreign language type mangling section. */
+
+/* How to write the type codes for the integer Java type. */
+
+static void
+write_java_integer_type_codes (type)
+ tree type;
+{
+ if (type == java_int_type_node)
+ write_char ('i');
+ else if (type == java_short_type_node)
+ write_char ('s');
+ else if (type == java_byte_type_node)
+ write_char ('c');
+ else if (type == java_char_type_node)
+ write_char ('w');
+ else if (type == java_long_type_node)
+ write_char ('x');
+ else if (type == java_boolean_type_node)
+ write_char ('b');
+ else
+ abort ();
+}
+
diff --git a/contrib/gcc/cp/method.c b/contrib/gcc/cp/method.c
index 79a9692..b0cc63a 100644
--- a/contrib/gcc/cp/method.c
+++ b/contrib/gcc/cp/method.c
@@ -1,6 +1,7 @@
/* Handle the hair of processing (but not expanding) inline functions.
Also manage function and variable name overloading.
- Copyright (C) 1987, 89, 92-97, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -21,14 +22,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifndef __GNUC__
-#define __inline
-#endif
-
-#ifndef PARM_CAN_BE_ARRAY_TYPE
-#define PARM_CAN_BE_ARRAY_TYPE 1
-#endif
-
/* Handle method declarations. */
#include "config.h"
#include "system.h"
@@ -38,1848 +31,61 @@ Boston, MA 02111-1307, USA. */
#include "rtl.h"
#include "expr.h"
#include "output.h"
-#include "hard-reg-set.h"
#include "flags.h"
#include "toplev.h"
-#include "decl.h"
+#include "ggc.h"
+#include "tm_p.h"
-/* TREE_LIST of the current inline functions that need to be
- processed. */
-struct pending_inline *pending_inlines;
+/* Various flags to control the mangling process. */
-int static_labelno;
+enum mangling_flags
+{
+ /* No flags. */
+ mf_none = 0,
+ /* The thing we are presently mangling is part of a template type,
+ rather than a fully instantiated type. Therefore, we may see
+ complex expressions where we would normally expect to see a
+ simple integer constant. */
+ mf_maybe_uninstantiated = 1,
+ /* When mangling a numeric value, use the form `_XX_' (instead of
+ just `XX') if the value has more than one digit. */
+ mf_use_underscores_around_value = 2,
+};
+
+typedef enum mangling_flags mangling_flags;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-/* Obstack where we build text strings for overloading, etc. */
-static struct obstack scratch_obstack;
-static char *scratch_firstobj;
-
-static void icat PROTO((HOST_WIDE_INT));
-static void dicat PROTO((HOST_WIDE_INT, HOST_WIDE_INT));
-static int old_backref_index PROTO((tree));
-static int flush_repeats PROTO((int, tree));
-static void build_overload_identifier PROTO((tree));
-static void build_overload_nested_name PROTO((tree));
-static void build_overload_int PROTO((tree, int));
-static void build_overload_identifier PROTO((tree));
-static void build_qualified_name PROTO((tree));
-static void build_overload_value PROTO((tree, tree, int));
-static void issue_nrepeats PROTO((int, tree));
-static char *build_mangled_name PROTO((tree,int,int));
-static void process_modifiers PROTO((tree));
-static void process_overload_item PROTO((tree,int));
-static void do_build_assign_ref PROTO((tree));
-static void do_build_copy_constructor PROTO((tree));
-static tree largest_union_member PROTO((tree));
-static void build_template_template_parm_names PROTO((tree));
-static void build_template_parm_names PROTO((tree, tree));
-static void build_underscore_int PROTO((int));
-static void start_squangling PROTO((void));
-static void end_squangling PROTO((void));
-static int check_ktype PROTO((tree, int));
-static int issue_ktype PROTO((tree));
-static void build_overload_scope_ref PROTO((tree));
-static void build_mangled_template_parm_index PROTO((char *, tree));
-#if HOST_BITS_PER_WIDE_INT >= 64
-static void build_mangled_C9x_name PROTO((int));
-#endif
-static int is_back_referenceable_type PROTO((tree));
-static int check_btype PROTO((tree));
-static void build_mangled_name_for_type PROTO((tree));
-static void build_mangled_name_for_type_with_Gcode PROTO((tree, int));
-static tree build_base_path PROTO((tree, int));
-
-
-# define OB_INIT() (scratch_firstobj ? (obstack_free (&scratch_obstack, scratch_firstobj), 0) : 0)
-# define OB_PUTC(C) (obstack_1grow (&scratch_obstack, (C)))
-# define OB_PUTC2(C1,C2) \
- (obstack_1grow (&scratch_obstack, (C1)), obstack_1grow (&scratch_obstack, (C2)))
-# define OB_PUTS(S) (obstack_grow (&scratch_obstack, (S), sizeof (S) - 1))
-# define OB_PUTID(ID) \
- (obstack_grow (&scratch_obstack, IDENTIFIER_POINTER (ID), \
- IDENTIFIER_LENGTH (ID)))
-# define OB_PUTCP(S) (obstack_grow (&scratch_obstack, (S), strlen (S)))
-# define OB_FINISH() (obstack_1grow (&scratch_obstack, '\0'))
-# define OB_LAST() (obstack_next_free (&scratch_obstack)[-1])
-
-void
-init_method ()
-{
- gcc_obstack_init (&scratch_obstack);
- scratch_firstobj = (char *)obstack_alloc (&scratch_obstack, 0);
-}
-
-/* This must be large enough to hold any printed integer or floating-point
- value. */
-static char digit_buffer[128];
+static void do_build_assign_ref PARAMS ((tree));
+static void do_build_copy_constructor PARAMS ((tree));
+static tree synthesize_exception_spec PARAMS ((tree, tree (*) (tree, void *), void *));
+static tree locate_dtor PARAMS ((tree, void *));
+static tree locate_ctor PARAMS ((tree, void *));
+static tree locate_copy PARAMS ((tree, void *));
-/* Move inline function definitions out of structure so that they
- can be processed normally. CNAME is the name of the class
- we are working from, METHOD_LIST is the list of method lists
- of the structure. We delete friend methods here, after
- saving away their inline function definitions (if any). */
+/* Called once to initialize method.c. */
void
-do_inline_function_hair (type, friend_list)
- tree type, friend_list;
-{
- tree method = TYPE_METHODS (type);
-
- if (method && TREE_CODE (method) == TREE_VEC)
- {
- if (TREE_VEC_ELT (method, 1))
- method = TREE_VEC_ELT (method, 1);
- else if (TREE_VEC_ELT (method, 0))
- method = TREE_VEC_ELT (method, 0);
- else
- method = TREE_VEC_ELT (method, 2);
- }
-
- while (method)
- {
- /* Do inline member functions. */
- struct pending_inline *info = DECL_PENDING_INLINE_INFO (method);
- if (info)
- {
- tree args;
-
- my_friendly_assert (info->fndecl == method, 238);
- args = DECL_ARGUMENTS (method);
- while (args)
- {
- DECL_CONTEXT (args) = method;
- args = TREE_CHAIN (args);
- }
- }
- method = TREE_CHAIN (method);
- }
- while (friend_list)
- {
- tree fndecl = TREE_VALUE (friend_list);
- struct pending_inline *info = DECL_PENDING_INLINE_INFO (fndecl);
- if (info)
- {
- tree args;
-
- my_friendly_assert (info->fndecl == fndecl, 239);
- args = DECL_ARGUMENTS (fndecl);
- while (args)
- {
- DECL_CONTEXT (args) = fndecl;
- args = TREE_CHAIN (args);
- }
- }
-
- friend_list = TREE_CHAIN (friend_list);
- }
-}
-
-/* Here is where overload code starts. */
-
-/* type tables for K and B type compression */
-static tree *btypelist = NULL;
-static tree *ktypelist = NULL;
-static int maxbsize = 0;
-static int maxksize = 0;
-
-/* number of each type seen */
-static int maxbtype = 0;
-static int maxktype = 0;
-
-/* Array of types seen so far in top-level call to `build_mangled_name'.
- Allocated and deallocated by caller. */
-static tree *typevec = NULL;
-static int typevec_size;
-
-/* Number of types interned by `build_mangled_name' so far. */
-static int maxtype = 0;
-
-/* Nonzero if we should not try folding parameter types. */
-static int nofold;
-
-/* This appears to be set to true if an underscore is required to be
- comcatenated before another number can be outputed. */
-static int numeric_output_need_bar;
-
-static __inline void
-start_squangling ()
-{
- if (flag_do_squangling)
- {
- nofold = 0;
- maxbtype = 0;
- maxktype = 0;
- maxbsize = 50;
- maxksize = 50;
- btypelist = (tree *)xmalloc (sizeof (tree) * maxbsize);
- ktypelist = (tree *)xmalloc (sizeof (tree) * maxksize);
- }
-}
-
-static __inline void
-end_squangling ()
-{
- if (flag_do_squangling)
- {
- if (ktypelist)
- free (ktypelist);
- if (btypelist)
- free (btypelist);
- maxbsize = 0;
- maxksize = 0;
- maxbtype = 0;
- maxktype = 0;
- ktypelist = NULL;
- btypelist = NULL;
- }
-}
-
-/* Code to concatenate an asciified integer to a string. */
-
-static __inline void
-icat (i)
- HOST_WIDE_INT i;
-{
- unsigned HOST_WIDE_INT ui;
-
- /* Handle this case first, to go really quickly. For many common values,
- the result of ui/10 below is 1. */
- if (i == 1)
- {
- OB_PUTC ('1');
- return;
- }
-
- if (i >= 0)
- ui = i;
- else
- {
- OB_PUTC ('m');
- ui = -i;
- }
-
- if (ui >= 10)
- icat (ui / 10);
-
- OB_PUTC ('0' + (ui % 10));
-}
-
-static void
-dicat (lo, hi)
- HOST_WIDE_INT lo, hi;
-{
- unsigned HOST_WIDE_INT ulo, uhi, qlo, qhi;
-
- if (hi >= 0)
- {
- uhi = hi;
- ulo = lo;
- }
- else
- {
- uhi = (lo == 0 ? -hi : -hi-1);
- ulo = -lo;
- }
- if (uhi == 0
- && ulo < ((unsigned HOST_WIDE_INT)1 << (HOST_BITS_PER_WIDE_INT - 1)))
- {
- icat (ulo);
- return;
- }
- /* Divide 2^HOST_WIDE_INT*uhi+ulo by 10. */
- qhi = uhi / 10;
- uhi = uhi % 10;
- qlo = uhi * (((unsigned HOST_WIDE_INT)1 << (HOST_BITS_PER_WIDE_INT - 1)) / 5);
- qlo += ulo / 10;
- ulo = ulo % 10;
- ulo += uhi * (((unsigned HOST_WIDE_INT)1 << (HOST_BITS_PER_WIDE_INT - 1)) % 5)
- * 2;
- qlo += ulo / 10;
- ulo = ulo % 10;
- /* Quotient is 2^HOST_WIDE_INT*qhi+qlo, remainder is ulo. */
- dicat (qlo, qhi);
- OB_PUTC ('0' + ulo);
-}
-
-/* Returns the index of TYPE in the typevec, or -1 if it's not there. */
-
-static __inline int
-old_backref_index (type)
- tree type;
-{
- int tindex = 0;
-
- if (! is_back_referenceable_type (type))
- return -1;
-
- /* The entry for this parm is at maxtype-1, so don't look there for
- something to repeat. */
- for (tindex = 0; tindex < maxtype - 1; ++tindex)
- if (same_type_p (typevec[tindex], type))
- break;
-
- if (tindex == maxtype - 1)
- return -1;
-
- return tindex;
-}
-
-/* Old mangling style: If TYPE has already been used in the parameter list,
- emit a backward reference and return non-zero; otherwise, return 0.
-
- NREPEATS is the number of repeats we've recorded of this type, or 0 if
- this is the first time we've seen it and we're just looking to see if
- it had been used before. */
-
-static __inline int
-flush_repeats (nrepeats, type)
- int nrepeats;
- tree type;
-{
- int tindex = old_backref_index (type);
-
- if (tindex == -1)
- {
- my_friendly_assert (nrepeats == 0, 990316);
- return 0;
- }
-
- if (nrepeats > 1)
- {
- OB_PUTC ('N');
- icat (nrepeats);
- if (nrepeats > 9)
- OB_PUTC ('_');
- }
- else
- OB_PUTC ('T');
- icat (tindex);
- if (tindex > 9)
- OB_PUTC ('_');
-
- return 1;
-}
-
-/* Returns nonzero iff this is a type to which we will want to make
- back-references (using the `B' code). */
-
-static int
-is_back_referenceable_type (type)
- tree type;
-{
- /* For some reason, the Java folks don't want back refs on these. */
- if (TYPE_FOR_JAVA (type))
- return 0;
-
- switch (TREE_CODE (type))
- {
- case BOOLEAN_TYPE:
- if (!flag_do_squangling)
- /* Even though the mangling of this is just `b', we did
- historically generate back-references for it. */
- return 1;
- /* Fall through. */
-
- case INTEGER_TYPE:
- case REAL_TYPE:
- case VOID_TYPE:
- /* These types have single-character manglings, so there's no
- point in generating back-references. */
- return 0;
-
- case TEMPLATE_TYPE_PARM:
- /* It would be a bit complex to demangle signatures correctly if
- we generated back-references to these, and the manglings of
- type parameters are short. */
- return 0;
-
- default:
- return 1;
- }
-}
-
-/* Issue the squangling code indicating NREPEATS repetitions of TYPE,
- which was the last parameter type output. */
-
-static void
-issue_nrepeats (nrepeats, type)
- int nrepeats;
- tree type;
-{
- if (nrepeats == 1 && !is_back_referenceable_type (type))
- /* For types whose manglings are short, don't bother using the
- repetition code if there's only one repetition, since the
- repetition code will be about as long as the ordinary mangling. */
- build_mangled_name_for_type (type);
- else
- {
- OB_PUTC ('n');
- icat (nrepeats);
- if (nrepeats > 9)
- OB_PUTC ('_');
- }
-}
-
-/* Check to see if a tree node has been entered into the Kcode typelist.
- If not, add it. Returns -1 if it isn't found, otherwise returns the
- index. */
-
-static int
-check_ktype (node, add)
- tree node;
- int add;
-{
- int x;
- tree localnode = node;
-
- if (ktypelist == NULL)
- return -1;
-
- if (TREE_CODE (node) == TYPE_DECL)
- localnode = TREE_TYPE (node);
-
- for (x=0; x < maxktype; x++)
- {
- if (same_type_p (localnode, ktypelist[x]))
- return x;
- }
- /* Didn't find it, so add it here. */
- if (add)
- {
- if (maxksize <= maxktype)
- {
- maxksize = maxksize* 3 / 2;
- ktypelist = (tree *)xrealloc (ktypelist, sizeof (tree) * maxksize);
- }
- ktypelist[maxktype++] = localnode;
- }
- return -1;
-}
-
-
-static __inline int
-issue_ktype (decl)
- tree decl;
-{
- int kindex;
- kindex = check_ktype (decl, FALSE);
- if (kindex != -1)
- {
- OB_PUTC ('K');
- icat (kindex);
- if (kindex > 9)
- OB_PUTC ('_');
- return TRUE;
- }
- return FALSE;
-}
-
-/* Build a representation for DECL, which may be an entity not at
- global scope. If so, a marker indicating that the name is
- qualified has already been output, but the qualifying context has
- not. */
-
-static void
-build_overload_nested_name (decl)
- tree decl;
-{
- tree context;
-
- if (ktypelist && issue_ktype (decl))
- return;
-
- if (decl == global_namespace)
- return;
-
- context = CP_DECL_CONTEXT (decl);
-
- /* try to issue a K type, and if we can't continue the normal path */
- if (!(ktypelist && issue_ktype (context)))
- {
- /* For a template type parameter, we want to output an 'Xn'
- rather than 'T' or some such. */
- if (TREE_CODE (context) == TEMPLATE_TYPE_PARM
- || TREE_CODE (context) == TEMPLATE_TEMPLATE_PARM)
- build_mangled_name_for_type (context);
- else
- {
- if (TREE_CODE_CLASS (TREE_CODE (context)) == 't')
- context = TYPE_NAME (context);
- build_overload_nested_name (context);
- }
- }
-
- if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- tree name = DECL_ASSEMBLER_NAME (decl);
- char *label;
-
- ASM_FORMAT_PRIVATE_NAME (label, IDENTIFIER_POINTER (name), static_labelno);
- static_labelno++;
-
- if (numeric_output_need_bar)
- OB_PUTC ('_');
- icat (strlen (label));
- OB_PUTCP (label);
- numeric_output_need_bar = 1;
- }
- else if (TREE_CODE (decl) == NAMESPACE_DECL)
- build_overload_identifier (DECL_NAME (decl));
- else /* TYPE_DECL */
- build_overload_identifier (decl);
-}
-
-/* Output the decimal representation of I. If I > 9, the decimal
- representation is preceeded and followed by an underscore. */
-
-static void
-build_underscore_int (i)
- int i;
-{
- if (i > 9)
- OB_PUTC ('_');
- icat (i);
- if (i > 9)
- OB_PUTC ('_');
-}
-
-static void
-build_overload_scope_ref (value)
- tree value;
-{
- OB_PUTC2 ('Q', '2');
- numeric_output_need_bar = 0;
- build_mangled_name_for_type (TREE_OPERAND (value, 0));
- build_overload_identifier (TREE_OPERAND (value, 1));
-}
-
-/* Encoding for an INTEGER_CST value. */
-
-static void
-build_overload_int (value, in_template)
- tree value;
- int in_template;
-{
- if (in_template && TREE_CODE (value) != INTEGER_CST)
- {
- if (TREE_CODE (value) == SCOPE_REF)
- {
- build_overload_scope_ref (value);
- return;
- }
-
- OB_PUTC ('E');
- numeric_output_need_bar = 0;
-
- if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (value))))
- {
- int i;
- int operands = tree_code_length[(int) TREE_CODE (value)];
- tree id;
- char* name;
-
- id = ansi_opname [(int) TREE_CODE (value)];
- my_friendly_assert (id != NULL_TREE, 0);
- name = IDENTIFIER_POINTER (id);
- if (name[0] != '_' || name[1] != '_')
- /* On some erroneous inputs, we can get here with VALUE a
- LOOKUP_EXPR. In that case, the NAME will be the
- identifier for "<invalid operator>". We must survive
- this routine in order to issue a sensible error
- message, so we fall through to the case below. */
- goto bad_value;
-
- for (i = 0; i < operands; ++i)
- {
- tree operand;
- enum tree_code tc;
-
- /* We just outputted either the `E' or the name of the
- operator. */
- numeric_output_need_bar = 0;
-
- if (i != 0)
- /* Skip the leading underscores. */
- OB_PUTCP (name + 2);
-
- operand = TREE_OPERAND (value, i);
- tc = TREE_CODE (operand);
-
- if (TREE_CODE_CLASS (tc) == 't')
- /* We can get here with sizeof, e.g.:
-
- template <class T> void f(A<sizeof(T)>); */
- build_mangled_name_for_type (operand);
- else if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (tc)))
- build_overload_int (operand, in_template);
- else
- build_overload_value (TREE_TYPE (operand),
- operand,
- in_template);
- }
- }
- else
- {
- /* We don't ever want this output, but it's
- inconvenient not to be able to build the string.
- This should cause assembler errors we'll notice. */
-
- static int n;
- bad_value:
- sprintf (digit_buffer, " *%d", n++);
- OB_PUTCP (digit_buffer);
- }
-
- OB_PUTC ('W');
- numeric_output_need_bar = 0;
- return;
- }
-
- my_friendly_assert (TREE_CODE (value) == INTEGER_CST, 243);
- if (TYPE_PRECISION (TREE_TYPE (value)) == 2 * HOST_BITS_PER_WIDE_INT)
- {
- if (TREE_INT_CST_HIGH (value)
- != (TREE_INT_CST_LOW (value) >> (HOST_BITS_PER_WIDE_INT - 1)))
- {
- /* need to print a DImode value in decimal */
- dicat (TREE_INT_CST_LOW (value), TREE_INT_CST_HIGH (value));
- numeric_output_need_bar = 1;
- return;
- }
- /* else fall through to print in smaller mode */
- }
- /* Wordsize or smaller */
- icat (TREE_INT_CST_LOW (value));
- numeric_output_need_bar = 1;
-}
-
-
-/* Output S followed by a representation of the TEMPLATE_PARM_INDEX
- supplied in INDEX. */
-
-static void
-build_mangled_template_parm_index (s, index)
- char* s;
- tree index;
-{
- OB_PUTCP (s);
- build_underscore_int (TEMPLATE_PARM_IDX (index));
- /* We use the LEVEL, not the ORIG_LEVEL, because the mangling is a
- representation of the function from the point of view of its
- type. */
- build_underscore_int (TEMPLATE_PARM_LEVEL (index));
-}
-
-
-/* Mangling for C9X integer types (and Cygnus extensions for 128-bit
- and other types) is based on the letter "I" followed by the hex
- representations of the bitsize for the type in question. For
- encodings that result in larger than two digits, a leading and
- trailing underscore is added.
-
- Thus:
- int1_t = 001 = I01
- int8_t = 008 = I08
- int16_t = 010 = I10
- int24_t = 018 = I18
- int32_t = 020 = I20
- int64_t = 040 = I40
- int80_t = 050 = I50
- int128_t = 080 = I80
- int256_t = 100 = I_100_
- int512_t = 200 = I_200_
-
- Given an integer in decimal format, mangle according to this scheme. */
-
-#if HOST_BITS_PER_WIDE_INT >= 64
-static void
-build_mangled_C9x_name (bits)
- int bits;
-{
- char mangled[10] = "";
-
- if (bits > 255)
- sprintf (mangled, "I_%x_", bits);
- else
- sprintf (mangled, "I%.2x", bits);
-
- OB_PUTCP (mangled);
-}
-#endif
-
-static void
-build_overload_value (type, value, in_template)
- tree type, value;
- int in_template;
-{
- my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (type)) == 't', 0);
-
- while (TREE_CODE (value) == NON_LVALUE_EXPR
- || TREE_CODE (value) == NOP_EXPR)
- value = TREE_OPERAND (value, 0);
-
- if (numeric_output_need_bar)
- {
- OB_PUTC ('_');
- numeric_output_need_bar = 0;
- }
-
- if (TREE_CODE (value) == TEMPLATE_PARM_INDEX)
- {
- build_mangled_template_parm_index ("Y", value);
- return;
- }
-
- if (TYPE_PTRMEM_P (type))
- {
- if (TREE_CODE (value) != PTRMEM_CST)
- /* We should have already rejected this pointer to member,
- since it is not a constant. */
- my_friendly_abort (0);
-
- /* Get the actual FIELD_DECL. */
- value = PTRMEM_CST_MEMBER (value);
- my_friendly_assert (TREE_CODE (value) == FIELD_DECL, 0);
-
- /* Output the name of the field. */
- build_overload_identifier (DECL_NAME (value));
- return;
- }
-
- switch (TREE_CODE (type))
- {
- case INTEGER_TYPE:
- case ENUMERAL_TYPE:
- case BOOLEAN_TYPE:
- {
- build_overload_int (value, in_template);
- return;
- }
- case REAL_TYPE:
- {
- REAL_VALUE_TYPE val;
- char *bufp = digit_buffer;
-
- pedwarn ("ANSI C++ forbids floating-point template arguments");
-
- my_friendly_assert (TREE_CODE (value) == REAL_CST, 244);
- val = TREE_REAL_CST (value);
- if (REAL_VALUE_ISNAN (val))
- {
- sprintf (bufp, "NaN");
- }
- else
- {
- if (REAL_VALUE_NEGATIVE (val))
- {
- val = REAL_VALUE_NEGATE (val);
- *bufp++ = 'm';
- }
- if (REAL_VALUE_ISINF (val))
- {
- sprintf (bufp, "Infinity");
- }
- else
- {
- REAL_VALUE_TO_DECIMAL (val, "%.20e", bufp);
- bufp = (char *) index (bufp, 'e');
- if (!bufp)
- strcat (digit_buffer, "e0");
- else
- {
- char *p;
- bufp++;
- if (*bufp == '-')
- {
- *bufp++ = 'm';
- }
- p = bufp;
- if (*p == '+')
- p++;
- while (*p == '0')
- p++;
- if (*p == 0)
- {
- *bufp++ = '0';
- *bufp = 0;
- }
- else if (p != bufp)
- {
- while (*p)
- *bufp++ = *p++;
- *bufp = 0;
- }
- }
-#ifdef NO_DOT_IN_LABEL
- bufp = (char *) index (bufp, '.');
- if (bufp)
- *bufp = '_';
-#endif
- }
- }
- OB_PUTCP (digit_buffer);
- numeric_output_need_bar = 1;
- return;
- }
- case POINTER_TYPE:
- if (TREE_CODE (value) == INTEGER_CST)
- {
- build_overload_int (value, in_template);
- return;
- }
- else if (TREE_CODE (value) == TEMPLATE_PARM_INDEX)
- {
- build_mangled_template_parm_index ("", value);
- numeric_output_need_bar = 1;
- return;
- }
-
- value = TREE_OPERAND (value, 0);
-
- /* Fall through. */
-
- case REFERENCE_TYPE:
- if (TREE_CODE (value) == VAR_DECL)
- {
- my_friendly_assert (DECL_NAME (value) != 0, 245);
- build_overload_identifier (DECL_ASSEMBLER_NAME (value));
- return;
- }
- else if (TREE_CODE (value) == FUNCTION_DECL)
- {
- my_friendly_assert (DECL_NAME (value) != 0, 246);
- build_overload_identifier (DECL_ASSEMBLER_NAME (value));
- return;
- }
- else if (TREE_CODE (value) == SCOPE_REF)
- build_overload_scope_ref (value);
- else
- my_friendly_abort (71);
- break; /* not really needed */
-
- case RECORD_TYPE:
- {
- tree delta;
- tree idx;
- tree pfn;
- tree delta2;
-
- my_friendly_assert (TYPE_PTRMEMFUNC_P (type), 0);
-
- /* We'll get a ADDR_EXPR of a SCOPE_REF here if we're
- mangling, an instantiation of something like:
-
- template <class T, void (T::*fp)()> class C {};
- template <class T> C<T, &T::f> x();
-
- We mangle the return type of the function, and that
- contains template parameters. */
- if (TREE_CODE (value) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (value, 0)) == SCOPE_REF)
- {
- build_overload_scope_ref (TREE_OPERAND (value, 0));
- break;
- }
-
- my_friendly_assert (TREE_CODE (value) == PTRMEM_CST, 0);
-
- expand_ptrmemfunc_cst (value, &delta, &idx, &pfn, &delta2);
- build_overload_int (delta, in_template);
- OB_PUTC ('_');
- build_overload_int (idx, in_template);
- OB_PUTC ('_');
- if (pfn)
- {
- numeric_output_need_bar = 0;
- build_overload_identifier (DECL_ASSEMBLER_NAME
- (PTRMEM_CST_MEMBER (value)));
- }
- else
- {
- OB_PUTC ('i');
- build_overload_int (delta2, in_template);
- }
- }
- break;
-
- default:
- sorry ("conversion of %s as template parameter",
- tree_code_name [(int) TREE_CODE (type)]);
- my_friendly_abort (72);
- }
-}
-
-
-/* Add encodings for the declaration of template template parameters.
- PARMLIST must be a TREE_VEC. */
-
-static void
-build_template_template_parm_names (parmlist)
- tree parmlist;
-{
- int i, nparms;
-
- my_friendly_assert (TREE_CODE (parmlist) == TREE_VEC, 246.5);
- nparms = TREE_VEC_LENGTH (parmlist);
- icat (nparms);
- for (i = 0; i < nparms; i++)
- {
- tree parm = TREE_VALUE (TREE_VEC_ELT (parmlist, i));
- if (TREE_CODE (parm) == TYPE_DECL)
- {
- /* This parameter is a type. */
- OB_PUTC ('Z');
- }
- else if (TREE_CODE (parm) == TEMPLATE_DECL)
- {
- /* This parameter is a template. */
- OB_PUTC ('z');
- build_template_template_parm_names (DECL_INNERMOST_TEMPLATE_PARMS (parm));
- }
- else
- /* It's a PARM_DECL. */
- build_mangled_name_for_type (TREE_TYPE (parm));
- }
-}
-
-
-/* Add encodings for the vector of template parameters in PARMLIST,
- given the vector of arguments to be substituted in ARGLIST. */
-
-static void
-build_template_parm_names (parmlist, arglist)
- tree parmlist;
- tree arglist;
-{
- int i, nparms;
- tree inner_args = innermost_args (arglist);
-
- nparms = TREE_VEC_LENGTH (parmlist);
- icat (nparms);
- for (i = 0; i < nparms; i++)
- {
- tree parm = TREE_VALUE (TREE_VEC_ELT (parmlist, i));
- tree arg = TREE_VEC_ELT (inner_args, i);
- if (TREE_CODE (parm) == TYPE_DECL)
- {
- /* This parameter is a type. */
- OB_PUTC ('Z');
- build_mangled_name_for_type (arg);
- }
- else if (TREE_CODE (parm) == TEMPLATE_DECL)
- {
- /* This parameter is a template. */
- if (TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM)
- /* Output parameter declaration, argument index and level. */
- build_mangled_name_for_type (arg);
- else
- {
- /* A TEMPLATE_DECL node, output the parameter declaration
- and template name */
-
- OB_PUTC ('z');
- build_template_template_parm_names
- (DECL_INNERMOST_TEMPLATE_PARMS (parm));
- icat (IDENTIFIER_LENGTH (DECL_NAME (arg)));
- OB_PUTID (DECL_NAME (arg));
- }
- }
- else
- {
- parm = tsubst (parm, arglist, /*complain=*/1, NULL_TREE);
- /* It's a PARM_DECL. */
- build_mangled_name_for_type (TREE_TYPE (parm));
- build_overload_value (TREE_TYPE (parm), arg,
- uses_template_parms (arglist));
- }
- }
- }
-
-/* Output the representation for NAME, which is either a TYPE_DECL or
- an IDENTIFIER. */
-
-static void
-build_overload_identifier (name)
- tree name;
-{
- if (TREE_CODE (name) == TYPE_DECL
- && CLASS_TYPE_P (TREE_TYPE (name))
- && CLASSTYPE_TEMPLATE_INFO (TREE_TYPE (name))
- && (PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (TREE_TYPE (name)))
- || (TREE_CODE (DECL_CONTEXT (CLASSTYPE_TI_TEMPLATE
- (TREE_TYPE (name))))
- == FUNCTION_DECL)))
- {
- /* NAME is the TYPE_DECL for a template specialization. */
- tree template, parmlist, arglist, tname;
- template = CLASSTYPE_TI_TEMPLATE (TREE_TYPE (name));
- arglist = CLASSTYPE_TI_ARGS (TREE_TYPE (name));
- tname = DECL_NAME (template);
- parmlist = DECL_INNERMOST_TEMPLATE_PARMS (template);
- OB_PUTC ('t');
- icat (IDENTIFIER_LENGTH (tname));
- OB_PUTID (tname);
- build_template_parm_names (parmlist, arglist);
- }
- else
- {
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
- if (numeric_output_need_bar)
- {
- OB_PUTC ('_');
- numeric_output_need_bar = 0;
- }
- icat (IDENTIFIER_LENGTH (name));
- OB_PUTID (name);
- }
-}
-
-/* Given DECL, either a class TYPE, TYPE_DECL or FUNCTION_DECL, produce
- the mangling for it. Used by build_mangled_name and build_static_name. */
-
-static void
-build_qualified_name (decl)
- tree decl;
-{
- tree context;
- int i = 1;
-
- if (TREE_CODE_CLASS (TREE_CODE (decl)) == 't')
- decl = TYPE_NAME (decl);
-
- /* If DECL_ASSEMBLER_NAME has been set properly, use it. */
- if (TREE_CODE (decl) == TYPE_DECL
- && DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl) && !flag_do_squangling)
- {
- tree id = DECL_ASSEMBLER_NAME (decl);
- OB_PUTID (id);
- if (ISDIGIT (IDENTIFIER_POINTER (id) [IDENTIFIER_LENGTH (id) - 1]))
- numeric_output_need_bar = 1;
- return;
- }
-
- context = decl;
- /* If we can't find a Ktype, do it the hard way. */
- if (check_ktype (context, FALSE) == -1)
- {
- /* Count type and namespace scopes. */
- while (1)
- {
- context = CP_DECL_CONTEXT (context);
- if (context == global_namespace)
- break;
- i += 1;
- if (check_ktype (context, FALSE) != -1)
- /* Found one! */
- break;
- if (TREE_CODE_CLASS (TREE_CODE (context)) == 't')
- context = TYPE_NAME (context);
- }
- }
-
- if (i > 1)
- {
- OB_PUTC ('Q');
- build_underscore_int (i);
- numeric_output_need_bar = 0;
- }
- build_overload_nested_name (decl);
-}
-
-/* Output the mangled representation for TYPE. If EXTRA_GCODE is
- non-zero, mangled names for structure/union types are intentionally
- mangled differently from the method described in the ARM. */
-
-static void
-build_mangled_name_for_type_with_Gcode (type, extra_Gcode)
- tree type;
- int extra_Gcode;
-{
- if (TYPE_PTRMEMFUNC_P (type))
- type = TYPE_PTRMEMFUNC_FN_TYPE (type);
- process_modifiers (type);
- process_overload_item (type, extra_Gcode);
-}
-
-/* Like build_mangled_name_for_type_with_Gcode, but never outputs the
- `G'. */
-
-static void
-build_mangled_name_for_type (type)
- tree type;
-{
- build_mangled_name_for_type_with_Gcode (type, 0);
-}
-
-/* Given a list of parameters in PARMTYPES, create an unambiguous
- overload string. Should distinguish any type that C (or C++) can
- distinguish. I.e., pointers to functions are treated correctly.
-
- Caller must deal with whether a final `e' goes on the end or not.
-
- Any default conversions must take place before this function
- is called.
-
- BEGIN and END control initialization and finalization of the
- obstack where we build the string. */
-
-char *
-build_overload_name (parmtypes, begin, end)
- tree parmtypes;
- int begin, end;
-{
- char *ret;
- start_squangling ();
- ret = build_mangled_name (parmtypes, begin, end);
- end_squangling ();
- return ret ;
-}
-
-/* Output the mangled representation for PARMTYPES. If PARMTYPES is a
- TREE_LIST, then it is a list of parameter types. Otherwise,
- PARMTYPES must be a single type. */
-
-static char *
-build_mangled_name (parmtypes, begin, end)
- tree parmtypes;
- int begin, end;
-{
- if (begin)
- OB_INIT ();
-
- if (TREE_CODE (parmtypes) != TREE_LIST)
- /* There is only one type. */
- build_mangled_name_for_type (parmtypes);
- else
- {
- /* There are several types in a parameter list. */
- int nrepeats = 0;
- int old_style_repeats = !flag_do_squangling && !nofold && typevec;
- tree last_type = NULL_TREE;
-
- for (; parmtypes && parmtypes != void_list_node;
- parmtypes = TREE_CHAIN (parmtypes))
- {
- /* We used to call canonical_type_variant here, but that isn't
- good enough; it doesn't handle pointers to typedef types. So
- we can't just set TREE_USED to say we've seen a type already;
- we have to check each of the earlier types with same_type_p. */
- tree parmtype = TREE_VALUE (parmtypes);
-
- if (old_style_repeats)
- {
- /* Every argument gets counted. */
- my_friendly_assert (maxtype < typevec_size, 387);
- typevec[maxtype++] = parmtype;
- }
-
- if (last_type && same_type_p (parmtype, last_type))
- {
- if (flag_do_squangling
- || (old_style_repeats
- && is_back_referenceable_type (parmtype)))
- {
- /* The next type is the same as this one. Keep
- track of the repetition, and output the repeat
- count later. */
- nrepeats++;
- continue;
- }
- }
- else if (nrepeats != 0)
- {
- /* Indicate how many times the previous parameter was
- repeated. */
- if (old_style_repeats)
- flush_repeats (nrepeats, last_type);
- else
- issue_nrepeats (nrepeats, last_type);
- nrepeats = 0;
- }
-
- last_type = parmtype;
-
- /* Note that for bug-compatibility with 2.7.2, we can't build up
- repeats of types other than the most recent one. So we call
- flush_repeats every round, if we get this far. */
- if (old_style_repeats && flush_repeats (0, parmtype))
- continue;
-
- /* Output the PARMTYPE. */
- build_mangled_name_for_type_with_Gcode (parmtype, 1);
- }
-
- /* Output the repeat count for the last parameter, if
- necessary. */
- if (nrepeats != 0)
- {
- if (old_style_repeats)
- flush_repeats (nrepeats, last_type);
- else
- issue_nrepeats (nrepeats, last_type);
- nrepeats = 0;
- }
-
- if (!parmtypes)
- /* The parameter list ends in an ellipsis. */
- OB_PUTC ('e');
- }
-
- if (end)
- OB_FINISH ();
- return (char *)obstack_base (&scratch_obstack);
-}
-
-/* Emit modifiers such as constant, read-only, and volatile. */
-
-static void
-process_modifiers (parmtype)
- tree parmtype;
-{
- /* Note that here we do not use CP_TYPE_CONST_P and friends because
- we describe types recursively; we will get the `const' in
- `const int ()[10]' when processing the `const int' part. */
- if (TYPE_READONLY (parmtype))
- OB_PUTC ('C');
- if (TREE_CODE (parmtype) == INTEGER_TYPE
- && parmtype != char_type_node
- && parmtype != wchar_type_node
- && (TYPE_MAIN_VARIANT (parmtype)
- == unsigned_type (TYPE_MAIN_VARIANT (parmtype)))
- && ! TYPE_FOR_JAVA (parmtype))
- OB_PUTC ('U');
- if (TYPE_VOLATILE (parmtype))
- OB_PUTC ('V');
- /* It would be better to use `R' for `restrict', but that's already
- used for reference types. And `r' is used for `long double'. */
- if (TYPE_RESTRICT (parmtype))
- OB_PUTC ('u');
-}
-
-/* Check to see if TYPE has been entered into the Bcode typelist. If
- so, return 1 and emit a backreference to TYPE. Otherwise, add TYPE
- to the list of back-referenceable types and return 0. */
-
-static int
-check_btype (type)
- tree type;
-{
- int x;
-
- if (btypelist == NULL)
- return 0;
-
- if (!is_back_referenceable_type (type))
- return 0;
-
- for (x = 0; x < maxbtype; x++)
- if (same_type_p (type, btypelist[x]))
- {
- OB_PUTC ('B');
- icat (x);
- if (x > 9)
- OB_PUTC ('_');
- return 1 ;
- }
-
- if (maxbsize <= maxbtype)
- {
- /* Enlarge the table. */
- maxbsize = maxbsize * 3 / 2;
- btypelist = (tree *)xrealloc (btypelist, sizeof (tree) * maxbsize);
- }
-
- /* Register the TYPE. */
- btypelist[maxbtype++] = type;
-
- return 0;
-}
-
-/* Emit the correct code for various node types. */
-
-static void
-process_overload_item (parmtype, extra_Gcode)
- tree parmtype;
- int extra_Gcode;
+init_method ()
{
- numeric_output_need_bar = 0;
-
- /* Our caller should have already handed any qualifiers, so pull out the
- TYPE_MAIN_VARIANT to avoid typedef confusion. Except we can't do that
- for arrays, because they are transparent to qualifiers. Sigh. */
- if (TREE_CODE (parmtype) == ARRAY_TYPE)
- parmtype = canonical_type_variant (parmtype);
- else
- parmtype = TYPE_MAIN_VARIANT (parmtype);
-
- /* These tree types are considered modifiers for B code squangling,
- and therefore should not get entries in the Btypelist. They are,
- however, repeatable types. */
-
- switch (TREE_CODE (parmtype))
- {
- case REFERENCE_TYPE:
- OB_PUTC ('R');
- goto more;
-
- case ARRAY_TYPE:
-#if PARM_CAN_BE_ARRAY_TYPE
- {
- OB_PUTC ('A');
- if (TYPE_DOMAIN (parmtype) == NULL_TREE)
- OB_PUTC ('_');
- else
- {
- tree length = array_type_nelts (parmtype);
- if (TREE_CODE (length) != INTEGER_CST || flag_do_squangling)
- {
- length = fold (build (PLUS_EXPR, TREE_TYPE (length),
- length, integer_one_node));
- STRIP_NOPS (length);
- }
- build_overload_value (sizetype, length, 1);
- }
- if (numeric_output_need_bar && ! flag_do_squangling)
- OB_PUTC ('_');
- goto more;
- }
-#else
- OB_PUTC ('P');
- goto more;
-#endif
-
- case POINTER_TYPE:
- /* Even though the vlist_type_node is PPPFe (i.e. `int
- (***)(...)'), it is different from the any other occurence of
- the pointer type, because the underlying function type is
- different. */
- if (parmtype == vlist_type_node)
- {
- OB_PUTS (VLIST_TYPE_NAME);
- return;
- }
- OB_PUTC ('P');
- more:
- build_mangled_name_for_type (TREE_TYPE (parmtype));
- return;
- break;
-
- default:
- break;
- }
-
- if (flag_do_squangling && check_btype (parmtype))
- /* If PARMTYPE is already in the list of back-referenceable types,
- then check_btype will output the appropriate reference, and
- there's nothing more to do. */
- return;
-
- switch (TREE_CODE (parmtype))
- {
- case OFFSET_TYPE:
- OB_PUTC ('O');
- build_mangled_name_for_type (TYPE_OFFSET_BASETYPE (parmtype));
- OB_PUTC ('_');
- build_mangled_name_for_type (TREE_TYPE (parmtype));
- break;
-
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- {
- tree parms = TYPE_ARG_TYPES (parmtype);
-
- /* Rather than implementing a reentrant TYPEVEC, we turn off
- repeat codes here, unless we're squangling. Squangling
- doesn't make use of the TYPEVEC, so there's no reentrancy
- problem. */
- int old_nofold = nofold;
- if (!flag_do_squangling)
- nofold = 1;
-
- if (TREE_CODE (parmtype) == METHOD_TYPE)
- {
- /* Mark this as a method. */
- OB_PUTC ('M');
- /* Output the class of which this method is a member. */
- build_mangled_name_for_type (TYPE_METHOD_BASETYPE (parmtype));
- /* Output any qualifiers for the `this' parameter. */
- process_modifiers (TREE_TYPE (TREE_VALUE (parms)));
- }
-
- /* Output the parameter types. */
- OB_PUTC ('F');
- if (parms == NULL_TREE)
- OB_PUTC ('e');
- else if (parms == void_list_node)
- OB_PUTC ('v');
- else
- build_mangled_name (parms, 0, 0);
-
- /* Output the return type. */
- OB_PUTC ('_');
- build_mangled_name_for_type (TREE_TYPE (parmtype));
-
- nofold = old_nofold;
- break;
- }
-
- case INTEGER_TYPE:
- if (parmtype == integer_type_node
- || parmtype == unsigned_type_node
- || parmtype == java_int_type_node)
- OB_PUTC ('i');
- else if (parmtype == long_integer_type_node
- || parmtype == long_unsigned_type_node)
- OB_PUTC ('l');
- else if (parmtype == short_integer_type_node
- || parmtype == short_unsigned_type_node
- || parmtype == java_short_type_node)
- OB_PUTC ('s');
- else if (parmtype == signed_char_type_node)
- {
- OB_PUTC ('S');
- OB_PUTC ('c');
- }
- else if (parmtype == char_type_node
- || parmtype == unsigned_char_type_node
- || parmtype == java_byte_type_node)
- OB_PUTC ('c');
- else if (parmtype == wchar_type_node
- || parmtype == java_char_type_node)
- OB_PUTC ('w');
- else if (parmtype == long_long_integer_type_node
- || parmtype == long_long_unsigned_type_node
- || parmtype == java_long_type_node)
- OB_PUTC ('x');
- else if (parmtype == java_boolean_type_node)
- OB_PUTC ('b');
-#if HOST_BITS_PER_WIDE_INT >= 64
- else if (parmtype == intTI_type_node
- || parmtype == unsigned_intTI_type_node)
- {
- /* Should just check a flag here instead of specific
- *_type_nodes, because all C9x types could use this. */
- int bits = TREE_INT_CST_LOW (TYPE_SIZE (parmtype));
- build_mangled_C9x_name (bits);
- }
-#endif
- else
- my_friendly_abort (73);
- break;
-
- case BOOLEAN_TYPE:
- OB_PUTC ('b');
- break;
-
- case REAL_TYPE:
- if (parmtype == long_double_type_node)
- OB_PUTC ('r');
- else if (parmtype == double_type_node
- || parmtype == java_double_type_node)
- OB_PUTC ('d');
- else if (parmtype == float_type_node
- || parmtype == java_float_type_node)
- OB_PUTC ('f');
- else my_friendly_abort (74);
- break;
-
- case COMPLEX_TYPE:
- OB_PUTC ('J');
- build_mangled_name_for_type (TREE_TYPE (parmtype));
- break;
-
- case VOID_TYPE:
- OB_PUTC ('v');
- break;
-
- case ERROR_MARK: /* not right, but nothing is anyway */
- break;
-
- /* have to do these */
- case UNION_TYPE:
- case RECORD_TYPE:
- {
- if (extra_Gcode)
- OB_PUTC ('G'); /* make it look incompatible with AT&T */
- /* drop through into next case */
- }
- case ENUMERAL_TYPE:
- {
- tree name = TYPE_NAME (parmtype);
-
- my_friendly_assert (TREE_CODE (name) == TYPE_DECL, 248);
-
- build_qualified_name (name);
- break;
- }
-
- case UNKNOWN_TYPE:
- /* This will take some work. */
- OB_PUTC ('?');
- break;
-
- case TEMPLATE_TEMPLATE_PARM:
- /* Find and output the original template parameter
- declaration. */
- if (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (parmtype))
- {
- build_mangled_template_parm_index ("tzX",
- TEMPLATE_TYPE_PARM_INDEX
- (parmtype));
- build_template_parm_names
- (DECL_INNERMOST_TEMPLATE_PARMS (TYPE_TI_TEMPLATE (parmtype)),
- TYPE_TI_ARGS (parmtype));
- }
- else
- {
- build_mangled_template_parm_index ("ZzX",
- TEMPLATE_TYPE_PARM_INDEX
- (parmtype));
- build_template_template_parm_names
- (DECL_INNERMOST_TEMPLATE_PARMS (TYPE_STUB_DECL (parmtype)));
- }
- break;
-
- case TEMPLATE_TYPE_PARM:
- build_mangled_template_parm_index ("X",
- TEMPLATE_TYPE_PARM_INDEX
- (parmtype));
- break;
-
- case TYPENAME_TYPE:
- /* When mangling the type of a function template whose
- declaration looks like:
-
- template <class T> void foo(typename T::U)
-
- we have to mangle these. */
- build_qualified_name (parmtype);
- break;
-
- default:
- my_friendly_abort (75);
- }
-
+ init_mangle ();
}
-/* Produce the mangling for a variable named NAME in CONTEXT, which can
- be either a class TYPE or a FUNCTION_DECL. */
-
-tree
-build_static_name (context, name)
- tree context, name;
-{
- OB_INIT ();
- numeric_output_need_bar = 0;
- start_squangling ();
-#ifdef JOINER
- OB_PUTC ('_');
- build_qualified_name (context);
- OB_PUTC (JOINER);
-#else
- OB_PUTS ("__static_");
- build_qualified_name (context);
- OB_PUTC ('_');
-#endif
- OB_PUTID (name);
- OB_FINISH ();
- end_squangling ();
-
- return get_identifier ((char *)obstack_base (&scratch_obstack));
-}
-/* FOR_METHOD should be 1 if the declaration in question is for a member
- of a class (including a static member) and 2 if the declaration is
- for a constructor. */
-tree
-build_decl_overload_real (dname, parms, ret_type, tparms, targs,
- for_method)
- tree dname;
- tree parms;
- tree ret_type;
- tree tparms;
- tree targs;
- int for_method;
-{
- 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
- && 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");
- 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");
- }
-
- start_squangling ();
- OB_INIT ();
- if (for_method != 2)
- OB_PUTCP (name);
- /* Otherwise, we can divine that this is a constructor,
- and figure out its name without any extra encoding. */
-
- OB_PUTC2 ('_', '_');
- numeric_output_need_bar = 0;
-
- if (tparms)
- {
- OB_PUTC ('H');
- build_template_parm_names (tparms, targs);
- OB_PUTC ('_');
- }
- else if (!for_method && current_namespace == global_namespace)
- /* XXX this works only if we call this in the same namespace
- as the declaration. Unfortunately, we don't have the _DECL,
- only its name */
- OB_PUTC ('F');
-
- if (!for_method && current_namespace != global_namespace)
- /* qualify with namespace */
- build_qualified_name (current_namespace);
-
- if (parms == NULL_TREE)
- OB_PUTC ('e');
- else if (parms == void_list_node)
- OB_PUTC ('v');
- else
- {
- if (!flag_do_squangling)
- {
- /* Allocate typevec array. */
- maxtype = 0;
- typevec_size = list_length (parms);
- if (!for_method && current_namespace != global_namespace)
- /* The namespace of a global function needs one slot. */
- typevec_size++;
- typevec = (tree *)alloca (typevec_size * sizeof (tree));
- }
- nofold = 0;
-
- if (for_method)
- {
- tree this_type = TREE_VALUE (parms);
-
- if (TREE_CODE (this_type) == RECORD_TYPE) /* a signature pointer */
- this_type = SIGNATURE_TYPE (this_type);
- else
- this_type = TREE_TYPE (this_type);
-
- build_mangled_name_for_type (this_type);
-
- if (!flag_do_squangling)
- {
- my_friendly_assert (maxtype < typevec_size, 387);
- typevec[maxtype++] = this_type;
- }
-
- if (TREE_CHAIN (parms))
- build_mangled_name (TREE_CHAIN (parms), 0, 0);
- else
- OB_PUTC ('e');
- }
- else
- {
- /* the namespace qualifier for a global function
- will count as type */
- if (current_namespace != global_namespace
- && !flag_do_squangling)
- {
- my_friendly_assert (maxtype < typevec_size, 387);
- typevec[maxtype++] = current_namespace;
- }
- build_mangled_name (parms, 0, 0);
- }
-
- if (!flag_do_squangling)
- /* Deallocate typevec array. */
- typevec = NULL;
- }
-
- if (ret_type != NULL_TREE && for_method != 2)
- {
- /* Add the return type. */
- OB_PUTC ('_');
- build_mangled_name_for_type (ret_type);
- }
-
- OB_FINISH ();
- end_squangling ();
- {
- tree n = get_identifier (obstack_base (&scratch_obstack));
- if (IDENTIFIER_OPNAME_P (dname))
- IDENTIFIER_OPNAME_P (n) = 1;
- return n;
- }
-}
-
-/* Change the name of a function definition so that it may be
- overloaded. NAME is the name of the function to overload,
- PARMS is the parameter list (which determines what name the
- final function obtains).
-
- FOR_METHOD is 1 if this overload is being performed
- for a method, rather than a function type. It is 2 if
- this overload is being performed for a constructor. */
-
-tree
-build_decl_overload (dname, parms, for_method)
- tree dname;
- tree parms;
- int for_method;
-{
- return build_decl_overload_real (dname, parms, NULL_TREE, NULL_TREE,
- NULL_TREE, for_method);
-}
-
/* Set the mangled name (DECL_ASSEMBLER_NAME) for DECL. */
void
set_mangled_name_for_decl (decl)
tree decl;
{
- tree parm_types;
-
if (processing_template_decl)
/* There's no need to mangle the name of a template function. */
return;
- parm_types = TYPE_ARG_TYPES (TREE_TYPE (decl));
-
- if (DECL_STATIC_FUNCTION_P (decl))
- parm_types =
- hash_tree_chain (build_pointer_type (DECL_CLASS_CONTEXT (decl)),
- parm_types);
- else
- /* The only member functions whose type is a FUNCTION_TYPE, rather
- than a METHOD_TYPE, should be static members. */
- my_friendly_assert (!DECL_CONTEXT (decl)
- || !IS_AGGR_TYPE_CODE (TREE_CODE (DECL_CONTEXT (decl)))
- || TREE_CODE (TREE_TYPE (decl)) != FUNCTION_TYPE,
- 0);
-
- DECL_ASSEMBLER_NAME (decl)
- = build_decl_overload (DECL_NAME (decl), parm_types,
- DECL_FUNCTION_MEMBER_P (decl)
- + DECL_CONSTRUCTOR_P (decl));
+ mangle_decl (decl);
}
-/* Build an overload name for the type expression TYPE. */
-
-tree
-build_typename_overload (type)
- tree type;
-{
- tree id;
-
- OB_INIT ();
- OB_PUTID (ansi_opname[(int) TYPE_EXPR]);
- nofold = 1;
- start_squangling ();
- build_mangled_name (type, 0, 1);
- id = get_identifier (obstack_base (&scratch_obstack));
- IDENTIFIER_OPNAME_P (id) = 1;
-#if 0
- IDENTIFIER_GLOBAL_VALUE (id) = TYPE_MAIN_DECL (type);
-#endif
- TREE_TYPE (id) = type;
- end_squangling ();
- return id;
-}
-
-tree
-build_overload_with_type (name, type)
- tree name, type;
-{
- OB_INIT ();
- OB_PUTID (name);
- nofold = 1;
-
- start_squangling ();
- build_mangled_name (type, 0, 1);
- end_squangling ();
- return get_identifier (obstack_base (&scratch_obstack));
-}
-
-tree
-get_id_2 (name, name2)
- char *name;
- tree name2;
-{
- OB_INIT ();
- OB_PUTCP (name);
- OB_PUTID (name2);
- OB_FINISH ();
- return get_identifier (obstack_base (&scratch_obstack));
-}
-
-/* Print a binfo path T, starting with the most derived class. If
- OMIT_LAST is set, drop and return the most derived class. */
-
-static tree
-build_base_path (t, omit_last)
- tree t;
- int omit_last;
-{
- tree ret = NULL_TREE;
- if (BINFO_INHERITANCE_CHAIN (t))
- ret = build_base_path (BINFO_INHERITANCE_CHAIN (t), omit_last);
- else if (omit_last)
- return t;
- process_overload_item (BINFO_TYPE (t), 0);
- return ret;
-}
-
-/* Return a mangled name for a vlist vtable, using the path of both
- BASE and VBASE. */
-
-tree
-get_vlist_vtable_id (base, vbase)
- tree base, vbase;
-{
- tree last;
- OB_INIT ();
- OB_PUTS (VCTABLE_NAME);
- build_base_path (base, 0);
- OB_PUTC ('_');
- /* Since the base path should end where the vbase path starts, we
- can omit the most-derived class in the vbase path. Check below
- that this really happens. */
- last = build_base_path (vbase, 1);
- my_friendly_assert (BINFO_TYPE (last) == BINFO_TYPE (base), 990402);
- OB_FINISH ();
- return get_identifier (obstack_base (&scratch_obstack));
-}
-
-/* Returns a DECL_ASSEMBLER_NAME for the destructor of type TYPE. If
- HAS_VLIST is set, also add the vlist argument. */
-
-tree
-build_destructor_name (type, has_vlist)
- tree type;
- int has_vlist;
-{
- OB_INIT ();
- OB_PUTS (DESTRUCTOR_DECL_PREFIX);
- start_squangling ();
- build_mangled_name_for_type (type);
- /* If we need backwards compatibility, we can get aways by
- not linking type-safely, as the dtor will check whether
- the argument was provided. */
- if (has_vlist && !flag_vtable_thunks_compat)
- OB_PUTS (VLIST_TYPE_NAME);
- OB_FINISH ();
- end_squangling ();
- return get_identifier (obstack_base (&scratch_obstack));
-}
/* Given a tree_code CODE, and some arguments (at least one),
attempt to use an overloaded operator on the arguments.
@@ -1939,41 +145,7 @@ hack_identifier (value, name)
tree type;
if (value == error_mark_node)
- {
- if (current_class_name)
- {
- tree fields = lookup_fnfields (TYPE_BINFO (current_class_type), name, 1);
- if (fields == error_mark_node)
- return error_mark_node;
- if (fields)
- {
- tree fndecl;
-
- fndecl = TREE_VALUE (fields);
- my_friendly_assert (TREE_CODE (fndecl) == FUNCTION_DECL, 251);
- /* I could not trigger this code. MvL */
- my_friendly_abort (980325);
-#ifdef DEAD
- if (DECL_CHAIN (fndecl) == NULL_TREE)
- {
- warning ("methods cannot be converted to function pointers");
- return fndecl;
- }
- else
- {
- error ("ambiguous request for method pointer `%s'",
- IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
-#endif
- }
- }
- if (flag_labels_ok && IDENTIFIER_LABEL_VALUE (name))
- {
- return IDENTIFIER_LABEL_VALUE (name);
- }
- return error_mark_node;
- }
+ return error_mark_node;
type = TREE_TYPE (value);
if (TREE_CODE (value) == FIELD_DECL)
@@ -1982,13 +154,13 @@ hack_identifier (value, name)
{
if (current_function_decl
&& DECL_STATIC_FUNCTION_P (current_function_decl))
- cp_error ("invalid use of member `%D' in static member function",
+ error ("invalid use of member `%D' in static member function",
value);
else
/* We can get here when processing a bad default
argument, like:
struct S { int a; void f(int i = a); } */
- cp_error ("invalid use of member `%D'", value);
+ error ("invalid use of member `%D'", value);
return error_mark_node;
}
@@ -2010,10 +182,7 @@ hack_identifier (value, name)
if (TREE_CODE (value) == OVERLOAD)
value = OVL_CURRENT (value);
- if (IS_SIGNATURE (DECL_CLASS_CONTEXT (value)))
- return value;
-
- decl = maybe_dummy_object (DECL_CLASS_CONTEXT (value), 0);
+ decl = maybe_dummy_object (DECL_CONTEXT (value), 0);
value = build_component_ref (decl, name, NULL_TREE, 1);
}
else if (really_overloaded_fn (value))
@@ -2033,12 +202,12 @@ hack_identifier (value, name)
}
else if (TREE_CODE (value) == NAMESPACE_DECL)
{
- cp_error ("use of namespace `%D' as expression", value);
+ error ("use of namespace `%D' as expression", value);
return error_mark_node;
}
else if (DECL_CLASS_TEMPLATE_P (value))
{
- cp_error ("use of class template `%T' as expression", value);
+ error ("use of class template `%T' as expression", value);
return error_mark_node;
}
else
@@ -2051,7 +220,7 @@ hack_identifier (value, name)
if (context != NULL_TREE && context != current_function_decl
&& ! TREE_STATIC (value))
{
- cp_error ("use of %s from containing function",
+ error ("use of %s from containing function",
(TREE_CODE (value) == VAR_DECL
? "`auto' variable" : "parameter"));
cp_error_at (" `%#D' declared here", value);
@@ -2059,27 +228,22 @@ hack_identifier (value, name)
}
}
- if (TREE_CODE_CLASS (TREE_CODE (value)) == 'd' && DECL_NONLOCAL (value))
+ if (DECL_P (value) && DECL_NONLOCAL (value))
{
- if (DECL_LANG_SPECIFIC (value)
- && DECL_CLASS_CONTEXT (value) != current_class_type)
+ if (DECL_CLASS_SCOPE_P (value)
+ && DECL_CONTEXT (value) != current_class_type)
{
tree path;
- register tree context
- = (TREE_CODE (value) == FUNCTION_DECL && DECL_VIRTUAL_P (value))
- ? DECL_CLASS_CONTEXT (value)
- : DECL_CONTEXT (value);
-
- get_base_distance (context, current_class_type, 0, &path);
- if (path && !enforce_access (current_class_type, value))
- return error_mark_node;
+ path = currently_open_derived_class (DECL_CONTEXT (value));
+ enforce_access (path, value);
}
}
else if (TREE_CODE (value) == TREE_LIST
&& TREE_TYPE (value) == error_mark_node)
{
- error ("request for member `%s' is ambiguous in multiple inheritance lattice",
- IDENTIFIER_POINTER (name));
+ error ("\
+request for member `%D' is ambiguous in multiple inheritance lattice",
+ name);
print_candidates (value);
return error_mark_node;
}
@@ -2090,14 +254,34 @@ hack_identifier (value, name)
}
+/* Return a thunk to FUNCTION. For a virtual thunk, DELTA is the
+ offset to this used to locate the vptr, and VCALL_INDEX is used to
+ look up the eventual subobject location. For a non-virtual thunk,
+ DELTA is the offset to this and VCALL_INDEX is NULL. */
+
tree
-make_thunk (function, delta)
+make_thunk (function, delta, vcall_index)
tree function;
- int delta;
+ tree delta;
+ tree vcall_index;
{
tree thunk_id;
tree thunk;
tree func_decl;
+ tree vcall_offset;
+ HOST_WIDE_INT d;
+
+ /* Scale the VCALL_INDEX to be in terms of bytes. */
+ if (vcall_index)
+ vcall_offset
+ = size_binop (MULT_EXPR,
+ vcall_index,
+ convert (ssizetype,
+ TYPE_SIZE_UNIT (vtable_entry_type)));
+ else
+ vcall_offset = NULL_TREE;
+
+ d = tree_low_cst (delta, 0);
if (TREE_CODE (function) != ADDR_EXPR)
abort ();
@@ -2105,85 +289,129 @@ make_thunk (function, delta)
if (TREE_CODE (func_decl) != FUNCTION_DECL)
abort ();
- OB_INIT ();
- OB_PUTS ("__thunk_");
- if (delta > 0)
- {
- OB_PUTC ('n');
- icat (delta);
- }
- else
- icat (-delta);
- OB_PUTC ('_');
- OB_PUTID (DECL_ASSEMBLER_NAME (func_decl));
- OB_FINISH ();
- thunk_id = get_identifier (obstack_base (&scratch_obstack));
-
+ thunk_id = mangle_thunk (TREE_OPERAND (function, 0),
+ delta, vcall_offset);
thunk = IDENTIFIER_GLOBAL_VALUE (thunk_id);
- if (thunk && TREE_CODE (thunk) != THUNK_DECL)
+ if (thunk && !DECL_THUNK_P (thunk))
{
- cp_error ("implementation-reserved name `%D' used", thunk_id);
+ error ("implementation-reserved name `%D' used", thunk_id);
thunk = NULL_TREE;
SET_IDENTIFIER_GLOBAL_VALUE (thunk_id, thunk);
}
if (thunk == NULL_TREE)
{
thunk = build_decl (FUNCTION_DECL, thunk_id, TREE_TYPE (func_decl));
+ DECL_LANG_SPECIFIC (thunk) = DECL_LANG_SPECIFIC (func_decl);
+ copy_lang_decl (func_decl);
+ SET_DECL_ASSEMBLER_NAME (thunk, thunk_id);
+ DECL_CONTEXT (thunk) = DECL_CONTEXT (func_decl);
TREE_READONLY (thunk) = TREE_READONLY (func_decl);
TREE_THIS_VOLATILE (thunk) = TREE_THIS_VOLATILE (func_decl);
- comdat_linkage (thunk);
- TREE_SET_CODE (thunk, THUNK_DECL);
+ TREE_PUBLIC (thunk) = TREE_PUBLIC (func_decl);
+ if (flag_weak)
+ comdat_linkage (thunk);
+ SET_DECL_THUNK_P (thunk);
DECL_INITIAL (thunk) = function;
- THUNK_DELTA (thunk) = delta;
+ THUNK_DELTA (thunk) = d;
+ THUNK_VCALL_OFFSET (thunk) = vcall_offset;
+ /* The thunk itself is not a constructor or destructor, even if
+ the thing it is thunking to is. */
+ DECL_INTERFACE_KNOWN (thunk) = 1;
+ DECL_NOT_REALLY_EXTERN (thunk) = 1;
+ DECL_SAVED_FUNCTION_DATA (thunk) = NULL;
+ DECL_DESTRUCTOR_P (thunk) = 0;
+ DECL_CONSTRUCTOR_P (thunk) = 0;
+ /* And neither is it a clone. */
+ DECL_CLONED_FUNCTION (thunk) = NULL_TREE;
DECL_EXTERNAL (thunk) = 1;
DECL_ARTIFICIAL (thunk) = 1;
+ /* Even if this thunk is a member of a local class, we don't
+ need a static chain. */
+ DECL_NO_STATIC_CHAIN (thunk) = 1;
+ /* The THUNK is not a pending inline, even if the FUNC_DECL is. */
+ DECL_PENDING_INLINE_P (thunk) = 0;
+ /* Nor has it been deferred. */
+ DECL_DEFERRED_FN (thunk) = 0;
/* So that finish_file can write out any thunks that need to be: */
pushdecl_top_level (thunk);
+ SET_IDENTIFIER_GLOBAL_VALUE (thunk_id, thunk);
}
return thunk;
}
-/* Emit the definition of a C++ multiple inheritance vtable thunk. */
+/* Emit the definition of a C++ multiple inheritance vtable thunk. If
+ EMIT_P is non-zero, the thunk is emitted immediately. */
void
-emit_thunk (thunk_fndecl)
+use_thunk (thunk_fndecl, emit_p)
tree thunk_fndecl;
+ int emit_p;
{
- tree function = TREE_OPERAND (DECL_INITIAL (thunk_fndecl), 0);
- int delta = THUNK_DELTA (thunk_fndecl);
+ tree fnaddr;
+ tree function;
+ tree vcall_offset;
+ HOST_WIDE_INT delta;
if (TREE_ASM_WRITTEN (thunk_fndecl))
return;
+
+ fnaddr = DECL_INITIAL (thunk_fndecl);
+ if (TREE_CODE (DECL_INITIAL (thunk_fndecl)) != ADDR_EXPR)
+ /* We already turned this thunk into an ordinary function.
+ There's no need to process this thunk again. */
+ return;
- TREE_ASM_WRITTEN (thunk_fndecl) = 1;
+ /* Thunks are always addressable; they only appear in vtables. */
+ TREE_ADDRESSABLE (thunk_fndecl) = 1;
+ /* Figure out what function is being thunked to. It's referenced in
+ this translation unit. */
+ function = TREE_OPERAND (fnaddr, 0);
TREE_ADDRESSABLE (function) = 1;
mark_used (function);
+ TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (function)) = 1;
+ if (!emit_p)
+ return;
- if (current_function_decl)
- abort ();
+ delta = THUNK_DELTA (thunk_fndecl);
+ vcall_offset = THUNK_VCALL_OFFSET (thunk_fndecl);
- TREE_SET_CODE (thunk_fndecl, FUNCTION_DECL);
+ /* And, if we need to emit the thunk, it's used. */
+ mark_used (thunk_fndecl);
+ /* This thunk is actually defined. */
+ DECL_EXTERNAL (thunk_fndecl) = 0;
+ /* The linkage of the function may have changed. FIXME in linkage
+ rewrite. */
+ TREE_PUBLIC (thunk_fndecl) = TREE_PUBLIC (function);
+
+ if (flag_syntax_only)
+ {
+ TREE_ASM_WRITTEN (thunk_fndecl) = 1;
+ return;
+ }
+
+ push_to_top_level ();
- {
#ifdef ASM_OUTPUT_MI_THUNK
- char *fnname;
- current_function_decl = thunk_fndecl;
- /* Make sure we build up its RTL before we go onto the
- temporary obstack. */
- make_function_rtl (thunk_fndecl);
- temporary_allocation ();
- DECL_RESULT (thunk_fndecl)
- = build_decl (RESULT_DECL, 0, integer_type_node);
- fnname = XSTR (XEXP (DECL_RTL (thunk_fndecl), 0), 0);
- init_function_start (thunk_fndecl, input_filename, lineno);
- current_function_is_thunk = 1;
- assemble_start_function (thunk_fndecl, fnname);
- ASM_OUTPUT_MI_THUNK (asm_out_file, thunk_fndecl, delta, function);
- assemble_end_function (thunk_fndecl, fnname);
- permanent_allocation (1);
- current_function_decl = 0;
-#else /* ASM_OUTPUT_MI_THUNK */
+ if (!vcall_offset)
+ {
+ const char *fnname;
+ current_function_decl = thunk_fndecl;
+ DECL_RESULT (thunk_fndecl)
+ = build_decl (RESULT_DECL, 0, integer_type_node);
+ fnname = XSTR (XEXP (DECL_RTL (thunk_fndecl), 0), 0);
+ init_function_start (thunk_fndecl, input_filename, lineno);
+ current_function_is_thunk = 1;
+ assemble_start_function (thunk_fndecl, fnname);
+ ASM_OUTPUT_MI_THUNK (asm_out_file, thunk_fndecl, delta, function);
+ assemble_end_function (thunk_fndecl, fnname);
+ current_function_decl = 0;
+ cfun = 0;
+ TREE_ASM_WRITTEN (thunk_fndecl) = 1;
+ }
+ else
+#endif /* ASM_OUTPUT_MI_THUNK */
+ {
/* If we don't have the necessary macro for efficient thunks, generate a
thunk function that just makes a call to the real function.
Unfortunately, this doesn't work for varargs. */
@@ -2191,7 +419,7 @@ emit_thunk (thunk_fndecl)
tree a, t;
if (varargs_function_p (function))
- cp_error ("generic thunk code fails for method `%#D' which uses `...'",
+ error ("generic thunk code fails for method `%#D' which uses `...'",
function);
/* Set up clone argument trees for the thunk. */
@@ -2206,219 +434,80 @@ emit_thunk (thunk_fndecl)
a = nreverse (t);
DECL_ARGUMENTS (thunk_fndecl) = a;
DECL_RESULT (thunk_fndecl) = NULL_TREE;
- DECL_LANG_SPECIFIC (thunk_fndecl) = DECL_LANG_SPECIFIC (function);
- copy_lang_decl (thunk_fndecl);
- DECL_INTERFACE_KNOWN (thunk_fndecl) = 1;
- DECL_NOT_REALLY_EXTERN (thunk_fndecl) = 1;
- start_function (NULL_TREE, thunk_fndecl, NULL_TREE, 1);
- store_parm_decls ();
- current_function_is_thunk = 1;
+ start_function (NULL_TREE, thunk_fndecl, NULL_TREE, SF_PRE_PARSED);
+ /* We don't bother with a body block for thunks. */
- /* Build up the call to the real function. */
- t = build_int_2 (delta, -1 * (delta < 0));
- TREE_TYPE (t) = signed_type (sizetype);
+ /* Adjust the this pointer by the constant. */
+ t = ssize_int (delta);
t = fold (build (PLUS_EXPR, TREE_TYPE (a), a, t));
- t = expr_tree_cons (NULL_TREE, t, NULL_TREE);
- for (a = TREE_CHAIN (a); a; a = TREE_CHAIN (a))
- t = expr_tree_cons (NULL_TREE, a, t);
- t = nreverse (t);
- t = build_call (function, TREE_TYPE (TREE_TYPE (function)), t);
- c_expand_return (t);
-
- finish_function (lineno, 0, 0);
-
- /* Don't let the backend defer this function. */
- if (DECL_DEFER_OUTPUT (thunk_fndecl))
+ /* If there's a vcall offset, look up that value in the vtable and
+ adjust the `this' pointer again. */
+ if (vcall_offset && !integer_zerop (vcall_offset))
{
- output_inline_function (thunk_fndecl);
- permanent_allocation (1);
+ tree orig_this;
+
+ t = save_expr (t);
+ orig_this = t;
+ /* The vptr is always at offset zero in the object. */
+ t = build1 (NOP_EXPR,
+ build_pointer_type (build_pointer_type
+ (vtable_entry_type)),
+ t);
+ /* Form the vtable address. */
+ t = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (t)), t);
+ /* Find the entry with the vcall offset. */
+ t = build (PLUS_EXPR, TREE_TYPE (t), t, vcall_offset);
+ /* Calculate the offset itself. */
+ t = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (t)), t);
+ /* Adjust the `this' pointer. */
+ t = fold (build (PLUS_EXPR,
+ TREE_TYPE (orig_this),
+ orig_this,
+ t));
}
-#endif /* ASM_OUTPUT_MI_THUNK */
- }
-
- TREE_SET_CODE (thunk_fndecl, THUNK_DECL);
-}
-
-void
-maybe_vlist_ctor_wrapper (fn, definep)
- tree fn;
- int definep;
-{
- tree fntype, decl;
- tree arg_types, parms, parm, basetype, pbasetype;
- tree t, ctors;
-
- if (!flag_vtable_thunks_compat
- || !DECL_CONSTRUCTOR_FOR_PVBASE_P (fn))
- return;
-
- arg_types = TYPE_ARG_TYPES (TREE_TYPE (fn));
- pbasetype = TREE_VALUE (arg_types);
- basetype = TREE_TYPE (pbasetype);
- parms = DECL_ARGUMENTS (fn);
- /* Skip this, __in_chrg, and _vlist */
- arg_types = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (arg_types)));
+ /* Build up the call to the real function. */
+ t = tree_cons (NULL_TREE, t, NULL_TREE);
+ for (a = TREE_CHAIN (a); a; a = TREE_CHAIN (a))
+ t = tree_cons (NULL_TREE, a, t);
+ t = nreverse (t);
+ t = build_call (function, t);
+ if (VOID_TYPE_P (TREE_TYPE (t)))
+ finish_expr_stmt (t);
+ else
+ finish_return_stmt (t);
+ /* The back-end expects DECL_INITIAL to contain a BLOCK, so we
+ create one. */
+ DECL_INITIAL (thunk_fndecl) = make_node (BLOCK);
+ BLOCK_VARS (DECL_INITIAL (thunk_fndecl))
+ = DECL_ARGUMENTS (thunk_fndecl);
- /* Add __in_charge. */
- arg_types = hash_tree_chain (integer_type_node, arg_types);
+ /* Since we want to emit the thunk, we explicitly mark its name as
+ referenced. */
+ TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (thunk_fndecl)) = 1;
- /* Don't add this to arg_types, as build_cplus_method_type does so. */
+ /* But we don't want debugging information about it. */
+ DECL_IGNORED_P (thunk_fndecl) = 1;
- fntype = build_cplus_method_type (basetype, TREE_TYPE (TREE_TYPE (fn)),
- arg_types);
-
- decl = build_lang_decl (FUNCTION_DECL, DECL_NAME (fn), fntype);
- DECL_LANG_SPECIFIC (decl)->decl_flags = DECL_LANG_SPECIFIC (fn)->decl_flags;
- DECL_EXTERNAL (decl) = 0;
- TREE_PUBLIC (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- DECL_CONSTRUCTOR_P (decl) = 1;
- DECL_CONSTRUCTOR_FOR_VBASE (decl) = CONSTRUCTOR_FOR_VBASE;
- /* Claim that this is never a template instantiation. */
- DECL_USE_TEMPLATE (decl) = 0;
- DECL_TEMPLATE_INFO (decl) = NULL_TREE;
-
- /* Set up clone argument trees for the thunk. */
- parms = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (parms)));
- /* Add this */
- t = build_decl (PARM_DECL, this_identifier, pbasetype);
- SET_DECL_ARTIFICIAL (t);
- DECL_ARG_TYPE (t) = pbasetype;
- DECL_REGISTER (t) = 1;
- /* Add __in_charge. */
- parm = build_decl (PARM_DECL, in_charge_identifier, integer_type_node);
- SET_DECL_ARTIFICIAL (parm);
- DECL_ARG_TYPE (parm) = integer_type_node;
- TREE_CHAIN (parm) = t;
- t = parm;
-
- while (parms)
- {
- tree x = copy_node (parms);
- TREE_CHAIN (x) = t;
- DECL_CONTEXT (x) = decl;
- t = x;
- parms = TREE_CHAIN (parms);
- }
- parms = nreverse (t);
- DECL_ARGUMENTS (decl) = parms;
-
- DECL_ASSEMBLER_NAME (decl)
- = build_decl_overload (DECL_NAME (decl),
- TYPE_ARG_TYPES (TREE_TYPE (decl)), 2);
-
- ctors = CLASSTYPE_METHOD_VEC (basetype);
- if (ctors)
- ctors = TREE_VEC_ELT (ctors, 0);
- for ( ; ctors; ctors = OVL_NEXT (ctors))
- if (DECL_ASSEMBLER_NAME (OVL_CURRENT (ctors))
- == DECL_ASSEMBLER_NAME (decl))
- break;
-
- if (!ctors)
- {
- add_method (basetype, 0, decl);
- cp_finish_decl (decl, NULL_TREE, NULL_TREE, 0, 0);
- }
- else
- decl = OVL_CURRENT (ctors);
-
- /* Remember the original function. */
- DECL_VLIST_CTOR_WRAPPED (decl) = fn;
+ expand_body (finish_function (0));
+ }
- /* If this is called from start_method, definep is -1. Then we
- are inside the class, and fn is inline by default. */
- if (definep)
- {
- /* Record that the ctor is being defined, so we also emit the
- wrapper later. */
- if (DECL_THIS_INLINE (fn) || (definep == -1))
- {
- DECL_THIS_INLINE (decl) = 1;
- DECL_INLINE (decl) = 1;
- pushdecl_top_level (decl);
- }
- else
- {
- TREE_USED (decl) = 1;
- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) = 1;
- }
- mark_inline_for_output (decl);
- }
+ pop_from_top_level ();
}
-
-static void
-emit_vlist_ctor_wrapper (decl)
- tree decl;
-{
- tree t, parms, fn;
-
- current_function_is_thunk = 1;
-
- parms = DECL_ARGUMENTS (decl);
- fn = DECL_VLIST_CTOR_WRAPPED (decl);
- mark_used (fn);
-
- /* Build up the call to the real function. */
- t = NULL_TREE;
- /* Push this, __in_charge. */
- t = expr_tree_cons (NULL_TREE, parms, t);
- parms = TREE_CHAIN (parms);
- t = expr_tree_cons (NULL_TREE, parms, t);
- parms = TREE_CHAIN (parms);
- /* Push 0 as __vlist. */
- t = expr_tree_cons (NULL_TREE, vlist_zero_node, t);
- /* Push rest of arguments. */
- while (parms)
- {
- t = expr_tree_cons (NULL_TREE, parms, t);
- parms = TREE_CHAIN (parms);
- }
- t = nreverse (t);
- t = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), t);
- expand_expr_stmt (t);
-}
-
/* Code for synthesizing methods which have default semantics defined. */
-/* For the anonymous union in TYPE, return the member that is at least as
- large as the rest of the members, so we can copy it. */
-
-static tree
-largest_union_member (type)
- tree type;
-{
- tree f, type_size = TYPE_SIZE (type);
-
- for (f = TYPE_FIELDS (type); f; f = TREE_CHAIN (f))
- if (simple_cst_equal (DECL_SIZE (f), type_size) == 1)
- return f;
-
- /* We should always find one. */
- my_friendly_abort (323);
- return NULL_TREE;
-}
-
/* Generate code for default X(X&) constructor. */
static void
do_build_copy_constructor (fndecl)
tree fndecl;
{
- tree parm = TREE_CHAIN (DECL_ARGUMENTS (fndecl));
+ tree parm = FUNCTION_FIRST_USER_PARM (fndecl);
tree t;
- clear_last_expr ();
- push_momentary ();
-
- if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
- parm = TREE_CHAIN (parm);
- if (TYPE_USES_PVBASES (current_class_type))
- parm = TREE_CHAIN (parm);
parm = convert_from_reference (parm);
if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type)
@@ -2428,34 +517,49 @@ do_build_copy_constructor (fndecl)
else if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type))
{
t = build (INIT_EXPR, void_type_node, current_class_ref, parm);
- TREE_SIDE_EFFECTS (t) = 1;
- cplus_expand_expr_stmt (t);
+ finish_expr_stmt (t);
}
else
{
tree fields = TYPE_FIELDS (current_class_type);
int n_bases = CLASSTYPE_N_BASECLASSES (current_class_type);
tree binfos = TYPE_BINFO_BASETYPES (current_class_type);
+ tree member_init_list = NULL_TREE;
+ tree base_init_list = NULL_TREE;
+ int cvquals = cp_type_quals (TREE_TYPE (parm));
int i;
- /* Initialize all the base-classes. */
+ /* Initialize all the base-classes with the parameter converted
+ to their type so that we get their copy constructor and not
+ another constructor that takes current_class_type. We must
+ deal with the binfo's directly as a direct base might be
+ inaccessible due to ambiguity. */
for (t = CLASSTYPE_VBASECLASSES (current_class_type); t;
t = TREE_CHAIN (t))
- current_base_init_list
- = tree_cons (BINFO_TYPE (t), parm, current_base_init_list);
+ {
+ tree binfo = TREE_VALUE (t);
+
+ base_init_list = tree_cons (binfo,
+ build_base_path (PLUS_EXPR, parm,
+ binfo, 1),
+ base_init_list);
+ }
+
for (i = 0; i < n_bases; ++i)
{
- t = TREE_VEC_ELT (binfos, i);
- if (TREE_VIA_VIRTUAL (t))
+ tree binfo = TREE_VEC_ELT (binfos, i);
+ if (TREE_VIA_VIRTUAL (binfo))
continue;
- current_base_init_list
- = tree_cons (BINFO_TYPE (t), parm, current_base_init_list);
+ base_init_list = tree_cons (binfo,
+ build_base_path (PLUS_EXPR, parm,
+ binfo, 1),
+ base_init_list);
}
for (; fields; fields = TREE_CHAIN (fields))
{
- tree init, t;
+ tree init;
tree field = fields;
if (TREE_CODE (field) != FIELD_DECL)
@@ -2466,41 +570,31 @@ do_build_copy_constructor (fndecl)
{
if (VFIELD_NAME_P (DECL_NAME (field)))
continue;
- if (VBASE_NAME_P (DECL_NAME (field)))
- continue;
/* True for duplicate members. */
if (IDENTIFIER_CLASS_VALUE (DECL_NAME (field)) != field)
continue;
}
else if ((t = TREE_TYPE (field)) != NULL_TREE
- && ANON_UNION_TYPE_P (t)
+ && ANON_AGGR_TYPE_P (t)
&& TYPE_FIELDS (t) != NULL_TREE)
- {
- do
- {
- init = build (COMPONENT_REF, t, init, field);
- field = largest_union_member (t);
- }
- while ((t = TREE_TYPE (field)) != NULL_TREE
- && ANON_UNION_TYPE_P (t)
- && TYPE_FIELDS (t) != NULL_TREE);
- }
+ /* Just use the field; anonymous types can't have
+ nontrivial copy ctors or assignment ops. */;
else
continue;
- init = build (COMPONENT_REF, TREE_TYPE (field), init, field);
+ init = build (COMPONENT_REF,
+ build_qualified_type (TREE_TYPE (field), cvquals),
+ init, field);
init = build_tree_list (NULL_TREE, init);
- current_member_init_list
- = tree_cons (DECL_NAME (field), init, current_member_init_list);
+ member_init_list
+ = tree_cons (field, init, member_init_list);
}
- current_member_init_list = nreverse (current_member_init_list);
- current_base_init_list = nreverse (current_base_init_list);
- setup_vtbl_ptr ();
+ member_init_list = nreverse (member_init_list);
+ base_init_list = nreverse (base_init_list);
+ emit_base_init (member_init_list, base_init_list);
}
-
- pop_momentary ();
}
static void
@@ -2508,10 +602,9 @@ do_build_assign_ref (fndecl)
tree fndecl;
{
tree parm = TREE_CHAIN (DECL_ARGUMENTS (fndecl));
+ tree compound_stmt;
- clear_last_expr ();
- push_momentary ();
-
+ compound_stmt = begin_compound_stmt (/*has_no_scope=*/0);
parm = convert_from_reference (parm);
if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type)
@@ -2521,26 +614,30 @@ do_build_assign_ref (fndecl)
else if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type))
{
tree t = build (MODIFY_EXPR, void_type_node, current_class_ref, parm);
- TREE_SIDE_EFFECTS (t) = 1;
- cplus_expand_expr_stmt (t);
+ finish_expr_stmt (t);
}
else
{
tree fields = TYPE_FIELDS (current_class_type);
int n_bases = CLASSTYPE_N_BASECLASSES (current_class_type);
tree binfos = TYPE_BINFO_BASETYPES (current_class_type);
+ int cvquals = cp_type_quals (TREE_TYPE (parm));
int i;
for (i = 0; i < n_bases; ++i)
{
- tree basetype = BINFO_TYPE (TREE_VEC_ELT (binfos, i));
- tree p = convert_to_reference
- (build_reference_type (basetype), parm,
- CONV_IMPLICIT|CONV_CONST, LOOKUP_COMPLAIN, NULL_TREE);
- p = convert_from_reference (p);
- p = build_member_call (basetype, ansi_opname [MODIFY_EXPR],
- build_expr_list (NULL_TREE, p));
- expand_expr_stmt (p);
+ /* We must deal with the binfo's directly as a direct base
+ might be inaccessible due to ambiguity. */
+ tree binfo = TREE_VEC_ELT (binfos, i);
+ tree src = build_base_path (PLUS_EXPR, parm, binfo, 1);
+ tree dst = build_base_path (PLUS_EXPR, current_class_ref, binfo, 1);
+
+ tree expr = build_method_call (dst,
+ ansi_assopname (NOP_EXPR),
+ build_tree_list (NULL_TREE, src),
+ NULL,
+ LOOKUP_NORMAL | LOOKUP_NONVIRTUAL);
+ finish_expr_stmt (expr);
}
for (; fields; fields = TREE_CHAIN (fields))
{
@@ -2552,18 +649,12 @@ do_build_assign_ref (fndecl)
if (CP_TYPE_CONST_P (TREE_TYPE (field)))
{
- if (DECL_NAME (field))
- cp_error ("non-static const member `%#D', can't use default assignment operator", field);
- else
- cp_error ("non-static const member in type `%T', can't use default assignment operator", current_class_type);
+ error ("non-static const member `%#D', can't use default assignment operator", field);
continue;
}
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
{
- if (DECL_NAME (field))
- cp_error ("non-static reference member `%#D', can't use default assignment operator", field);
- else
- cp_error ("non-static reference member in type `%T', can't use default assignment operator", current_class_type);
+ error ("non-static reference member `%#D', can't use default assignment operator", field);
continue;
}
@@ -2574,38 +665,33 @@ do_build_assign_ref (fndecl)
{
if (VFIELD_NAME_P (DECL_NAME (field)))
continue;
- if (VBASE_NAME_P (DECL_NAME (field)))
- continue;
/* True for duplicate members. */
if (IDENTIFIER_CLASS_VALUE (DECL_NAME (field)) != field)
continue;
}
else if ((t = TREE_TYPE (field)) != NULL_TREE
- && ANON_UNION_TYPE_P (t)
+ && ANON_AGGR_TYPE_P (t)
&& TYPE_FIELDS (t) != NULL_TREE)
- {
- do
- {
- comp = build (COMPONENT_REF, t, comp, field);
- init = build (COMPONENT_REF, t, init, field);
- field = largest_union_member (t);
- }
- while ((t = TREE_TYPE (field)) != NULL_TREE
- && ANON_UNION_TYPE_P (t)
- && TYPE_FIELDS (t) != NULL_TREE);
- }
+ /* Just use the field; anonymous types can't have
+ nontrivial copy ctors or assignment ops. */;
else
continue;
comp = build (COMPONENT_REF, TREE_TYPE (field), comp, field);
- init = build (COMPONENT_REF, TREE_TYPE (field), init, field);
+ init = build (COMPONENT_REF,
+ build_qualified_type (TREE_TYPE (field), cvquals),
+ init, field);
- expand_expr_stmt (build_modify_expr (comp, NOP_EXPR, init));
+ if (DECL_NAME (field))
+ finish_expr_stmt (build_modify_expr (comp, NOP_EXPR, init));
+ else
+ finish_expr_stmt (build (MODIFY_EXPR, TREE_TYPE (comp), comp,
+ init));
}
}
- c_expand_return (current_class_ref);
- pop_momentary ();
+ finish_return_stmt (current_class_ref);
+ finish_compound_stmt (/*has_no_scope=*/0, compound_stmt);
}
void
@@ -2613,54 +699,338 @@ synthesize_method (fndecl)
tree fndecl;
{
int nested = (current_function_decl != NULL_TREE);
- tree context = hack_decl_function_context (fndecl);
-
- /* If this is a wrapper around a undefined vlist ctor, don't emit it
- even if it is used. */
- if (DECL_VLIST_CTOR_WRAPPER_P (fndecl))
- {
- tree orig_fn = DECL_VLIST_CTOR_WRAPPED (fndecl);
- mark_used (orig_fn);
- if (DECL_INITIAL (orig_fn) == NULL_TREE)
- return;
- }
+ tree context = decl_function_context (fndecl);
+ int need_body = 1;
+ tree stmt;
if (at_eof)
import_export_decl (fndecl);
+ /* If we've been asked to synthesize a clone, just synthesize the
+ cloned function instead. Doing so will automatically fill in the
+ body for the clone. */
+ if (DECL_CLONED_FUNCTION_P (fndecl))
+ {
+ synthesize_method (DECL_CLONED_FUNCTION (fndecl));
+ return;
+ }
+
if (! context)
push_to_top_level ();
else if (nested)
- push_cp_function_context (context);
+ push_function_context_to (context);
+
+ /* Put the function definition at the position where it is needed,
+ rather than within the body of the class. That way, an error
+ during the generation of the implicit body points at the place
+ where the attempt to generate the function occurs, giving the
+ user a hint as to why we are attempting to generate the
+ function. */
+ DECL_SOURCE_LINE (fndecl) = lineno;
+ DECL_SOURCE_FILE (fndecl) = input_filename;
interface_unknown = 1;
- start_function (NULL_TREE, fndecl, NULL_TREE, 1);
- store_parm_decls ();
+ start_function (NULL_TREE, fndecl, NULL_TREE, SF_DEFAULT | SF_PRE_PARSED);
+ clear_last_expr ();
+ stmt = begin_function_body ();
- if (DECL_NAME (fndecl) == ansi_opname[MODIFY_EXPR])
- do_build_assign_ref (fndecl);
- else if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (fndecl)))
- ;
- else
+ if (DECL_OVERLOADED_OPERATOR_P (fndecl) == NOP_EXPR)
+ {
+ do_build_assign_ref (fndecl);
+ need_body = 0;
+ }
+ else if (DECL_CONSTRUCTOR_P (fndecl))
{
- tree arg_chain = FUNCTION_ARG_CHAIN (fndecl);
- if (DECL_CONSTRUCTOR_FOR_VBASE_P (fndecl))
- arg_chain = TREE_CHAIN (arg_chain);
- else if (DECL_CONSTRUCTOR_FOR_PVBASE_P (fndecl))
- arg_chain = TREE_CHAIN (TREE_CHAIN (arg_chain));
- if (DECL_VLIST_CTOR_WRAPPER_P (fndecl))
- emit_vlist_ctor_wrapper (fndecl);
- else if (arg_chain != void_list_node)
+ tree arg_chain = FUNCTION_FIRST_USER_PARMTYPE (fndecl);
+ if (arg_chain != void_list_node)
do_build_copy_constructor (fndecl);
else if (TYPE_NEEDS_CONSTRUCTING (current_class_type))
- setup_vtbl_ptr ();
+ finish_mem_initializers (NULL_TREE);
+ }
+
+ /* If we haven't yet generated the body of the function, just
+ generate an empty compound statement. */
+ if (need_body)
+ {
+ tree compound_stmt;
+ compound_stmt = begin_compound_stmt (/*has_no_scope=*/0);
+ finish_compound_stmt (/*has_no_scope=*/0, compound_stmt);
}
- finish_function (lineno, 0, nested);
+ finish_function_body (stmt);
+ expand_body (finish_function (0));
extract_interface_info ();
if (! context)
pop_from_top_level ();
else if (nested)
- pop_cp_function_context (context);
+ pop_function_context_from (context);
+}
+
+/* Use EXTRACTOR to locate the relevant function called for each base &
+ class field of TYPE. CLIENT allows additional information to be passed
+ to EXTRACTOR. Generates the union of all exceptions generated by
+ those functions. */
+
+static tree
+synthesize_exception_spec (type, extractor, client)
+ tree type;
+ tree (*extractor) (tree, void *);
+ void *client;
+{
+ tree raises = empty_except_spec;
+ tree fields = TYPE_FIELDS (type);
+ int i, n_bases = CLASSTYPE_N_BASECLASSES (type);
+ tree binfos = TYPE_BINFO_BASETYPES (type);
+
+ for (i = 0; i != n_bases; i++)
+ {
+ tree base = BINFO_TYPE (TREE_VEC_ELT (binfos, i));
+ tree fn = (*extractor) (base, client);
+ if (fn)
+ {
+ tree fn_raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn));
+
+ raises = merge_exception_specifiers (raises, fn_raises);
+ }
+ }
+ for (; fields; fields = TREE_CHAIN (fields))
+ {
+ tree type = TREE_TYPE (fields);
+ tree fn;
+
+ if (TREE_CODE (fields) != FIELD_DECL)
+ continue;
+ while (TREE_CODE (type) == ARRAY_TYPE)
+ type = TREE_TYPE (type);
+ if (TREE_CODE (type) != RECORD_TYPE)
+ continue;
+
+ fn = (*extractor) (type, client);
+ if (fn)
+ {
+ tree fn_raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn));
+
+ raises = merge_exception_specifiers (raises, fn_raises);
+ }
+ }
+ return raises;
+}
+
+/* Locate the dtor of TYPE. */
+
+static tree
+locate_dtor (type, client)
+ tree type;
+ void *client ATTRIBUTE_UNUSED;
+{
+ tree fns;
+
+ if (!TYPE_HAS_DESTRUCTOR (type))
+ return NULL_TREE;
+ fns = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type),
+ CLASSTYPE_DESTRUCTOR_SLOT);
+ return fns;
+}
+
+/* Locate the default ctor of TYPE. */
+
+static tree
+locate_ctor (type, client)
+ tree type;
+ void *client ATTRIBUTE_UNUSED;
+{
+ tree fns;
+
+ if (!TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
+ return NULL_TREE;
+
+ fns = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type),
+ CLASSTYPE_CONSTRUCTOR_SLOT);
+ for (; fns; fns = OVL_NEXT (fns))
+ {
+ tree fn = OVL_CURRENT (fns);
+ tree parms = TYPE_ARG_TYPES (TREE_TYPE (fn));
+
+ if (sufficient_parms_p (TREE_CHAIN (parms)))
+ return fn;
+ }
+ return NULL_TREE;
+}
+
+struct copy_data
+{
+ tree name;
+ int quals;
+};
+
+/* Locate the copy ctor or copy assignment of TYPE. CLIENT_
+ points to a COPY_DATA holding the name (NULL for the ctor)
+ and desired qualifiers of the source operand. */
+
+static tree
+locate_copy (type, client_)
+ tree type;
+ void *client_;
+{
+ struct copy_data *client = (struct copy_data *)client_;
+ tree fns;
+ int ix = -1;
+ tree best = NULL_TREE;
+ int excess_p = 0;
+
+ if (client->name)
+ {
+ if (TYPE_HAS_ASSIGN_REF (type))
+ ix = lookup_fnfields_1 (type, client->name);
+ }
+ else if (TYPE_HAS_INIT_REF (type))
+ ix = CLASSTYPE_CONSTRUCTOR_SLOT;
+ if (ix < 0)
+ return NULL_TREE;
+ fns = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), ix);
+
+ for (; fns; fns = OVL_NEXT (fns))
+ {
+ tree fn = OVL_CURRENT (fns);
+ tree parms = TYPE_ARG_TYPES (TREE_TYPE (fn));
+ tree src_type;
+ int excess;
+ int quals;
+
+ parms = TREE_CHAIN (parms);
+ if (!parms)
+ continue;
+ src_type = TREE_VALUE (parms);
+ if (TREE_CODE (src_type) == REFERENCE_TYPE)
+ src_type = TREE_TYPE (src_type);
+ if (!same_type_ignoring_top_level_qualifiers_p (src_type, type))
+ continue;
+ if (!sufficient_parms_p (TREE_CHAIN (parms)))
+ continue;
+ quals = cp_type_quals (src_type);
+ if (client->quals & ~quals)
+ continue;
+ excess = quals & ~client->quals;
+ if (!best || (excess_p && !excess))
+ {
+ best = fn;
+ excess_p = excess;
+ }
+ else
+ /* Ambiguous */
+ return NULL_TREE;
+ }
+ return best;
+}
+
+/* Implicitly declare the special function indicated by KIND, as a
+ member of TYPE. For copy constructors and assignment operators,
+ CONST_P indicates whether these functions should take a const
+ reference argument or a non-const reference. */
+
+tree
+implicitly_declare_fn (kind, type, const_p)
+ special_function_kind kind;
+ tree type;
+ int const_p;
+{
+ tree declspecs = NULL_TREE;
+ tree fn, args = NULL_TREE;
+ tree raises = empty_except_spec;
+ int retref = 0;
+ int has_parm = 0;
+ tree name = constructor_name (TYPE_IDENTIFIER (type));
+
+ switch (kind)
+ {
+ case sfk_destructor:
+ /* Destructor. */
+ name = build_nt (BIT_NOT_EXPR, name);
+ args = void_list_node;
+ raises = synthesize_exception_spec (type, &locate_dtor, 0);
+ break;
+
+ case sfk_constructor:
+ /* Default constructor. */
+ args = void_list_node;
+ raises = synthesize_exception_spec (type, &locate_ctor, 0);
+ break;
+
+ case sfk_copy_constructor:
+ case sfk_assignment_operator:
+ {
+ struct copy_data data;
+ tree argtype;
+
+ has_parm = 1;
+ data.name = NULL;
+ data.quals = 0;
+ if (kind == sfk_assignment_operator)
+ {
+ retref = 1;
+ declspecs = build_tree_list (NULL_TREE, type);
+
+ name = ansi_assopname (NOP_EXPR);
+ data.name = name;
+ }
+ if (const_p)
+ {
+ data.quals = TYPE_QUAL_CONST;
+ type = build_qualified_type (type, TYPE_QUAL_CONST);
+ }
+
+ argtype = build_reference_type (type);
+ args = build_tree_list (hash_tree_chain (argtype, NULL_TREE),
+ get_identifier ("_ctor_arg"));
+ args = tree_cons (NULL_TREE, args, void_list_node);
+
+ raises = synthesize_exception_spec (type, &locate_copy, &data);
+ break;
+ }
+ default:
+ abort ();
+ }
+
+ TREE_PARMLIST (args) = 1;
+
+ {
+ tree declarator = make_call_declarator (name, args, NULL_TREE, raises);
+
+ if (retref)
+ declarator = build_nt (ADDR_EXPR, declarator);
+
+ fn = grokfield (declarator, declspecs, NULL_TREE, NULL_TREE, NULL_TREE);
+ if (has_parm)
+ TREE_USED (FUNCTION_FIRST_USER_PARM (fn)) = 1;
+ }
+
+ my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL, 20000408);
+
+ DECL_ARTIFICIAL (fn) = 1;
+ DECL_NOT_REALLY_EXTERN (fn) = 1;
+ DECL_DECLARED_INLINE_P (fn) = 1;
+ DECL_INLINE (fn) = 1;
+ defer_fn (fn);
+
+ return fn;
+}
+
+/* Given a FUNCTION_DECL FN and a chain LIST, skip as many elements of LIST
+ as there are artificial parms in FN. */
+
+tree
+skip_artificial_parms_for (fn, list)
+ tree fn, list;
+{
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
+ list = TREE_CHAIN (list);
+ else
+ return list;
+
+ if (DECL_HAS_IN_CHARGE_PARM_P (fn))
+ list = TREE_CHAIN (list);
+ if (DECL_HAS_VTT_PARM_P (fn))
+ list = TREE_CHAIN (list);
+ return list;
}
diff --git a/contrib/gcc/cp/operators.def b/contrib/gcc/cp/operators.def
new file mode 100644
index 0000000..775f59d
--- /dev/null
+++ b/contrib/gcc/cp/operators.def
@@ -0,0 +1,157 @@
+/* -*-C-*-
+
+ This file contains definitions of the various C++ operators,
+ including both overloadable operators (like `+') and
+ non-overloadable operators (like the `?:' ternary operator).
+ Writtey by Mark Mitchell <mark@codesourcery.com>
+
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* The DEF_OPERATOR macro takes the following arguments:
+
+ NAME
+
+ The name of the operator, as a C string, but without the
+ preceding `operator'. This is the name that would be given in
+ the source program. For `operator +', for example, this would be
+ `+'.
+
+ CODE
+
+ The tree_code for this operator. For `operator +', for example,
+ this would be PLUS_EXPR. Because there are no tree codes for
+ assignment operators, the same tree-codes are reused; i.e.,
+ `operator +' will also have PLUS_EXPR as its CODE.
+
+ NEW_MANGLING
+
+ The mangling prefix for the operator, as a C string, and as
+ mangled under the new ABI. For `operator +', for example, this
+ would be "pl".
+
+ OLD_MANGLING
+
+ Analogous, but for the old ABI.
+
+ ARITY
+
+ The arity of the operator, or -1 if any arity is allowed. (As
+ for `operator ()'.) Postincrement and postdecrement operators
+ are marked as binary.
+
+ ASSN_P
+
+ A boolean value. If non-zero, this is an assignment operator.
+
+ Before including this file, you should define DEFOPERATOR
+ to take these arguments.
+
+ There is code (such as in grok_op_properties) that depends on the
+ order the operators are presented in this file. In particular,
+ unary operators must precede binary operators. */
+
+/* Use DEF_SIMPLE_OPERATOR to define a non-assignment operator. Its
+ arguments are as for DEF_OPERATOR, but there is no need to provide
+ an ASSIGNMENT_P argument; it is always zero. */
+
+#define DEF_SIMPLE_OPERATOR(NAME, CODE, MANGLING, ARITY) \
+ DEF_OPERATOR(NAME, CODE, MANGLING, ARITY, 0)
+
+/* Use DEF_ASSN_OPERATOR to define an assignment operator. Its
+ arguments are as for DEF_OPERATOR, but there is no need to provide
+ an ASSIGNMENT_P argument; it is always one. */
+
+#define DEF_ASSN_OPERATOR(NAME, CODE, MANGLING, ARITY) \
+ DEF_OPERATOR(NAME, CODE, MANGLING, ARITY, 1)
+
+/* Memory allocation operators. */
+DEF_SIMPLE_OPERATOR ("new", NEW_EXPR, "nw", -1)
+DEF_SIMPLE_OPERATOR ("new []", VEC_NEW_EXPR, "na", -1)
+DEF_SIMPLE_OPERATOR ("delete", DELETE_EXPR, "dl", -1)
+DEF_SIMPLE_OPERATOR ("delete []", VEC_DELETE_EXPR, "da", -1)
+
+/* Unary operators. */
+DEF_SIMPLE_OPERATOR ("+", CONVERT_EXPR, "ps", 1)
+DEF_SIMPLE_OPERATOR ("-", NEGATE_EXPR, "ng", 1)
+DEF_SIMPLE_OPERATOR ("&", ADDR_EXPR, "ad", 1)
+DEF_SIMPLE_OPERATOR ("*", INDIRECT_REF, "de", 1)
+DEF_SIMPLE_OPERATOR ("~", BIT_NOT_EXPR, "co", 1)
+DEF_SIMPLE_OPERATOR ("!", TRUTH_NOT_EXPR, "nt", 1)
+DEF_SIMPLE_OPERATOR ("++", PREINCREMENT_EXPR, "pp", 1)
+DEF_SIMPLE_OPERATOR ("--", PREDECREMENT_EXPR, "mm", 1)
+DEF_SIMPLE_OPERATOR ("sizeof", SIZEOF_EXPR, "sz", 1)
+/* This is an extension. */
+DEF_SIMPLE_OPERATOR ("alignof", ALIGNOF_EXPR, "v17alignof", 1)
+
+/* The cast operator. */
+DEF_SIMPLE_OPERATOR ("", TYPE_EXPR, "cv", 1)
+DEF_SIMPLE_OPERATOR ("", CAST_EXPR, "cv", 1)
+DEF_SIMPLE_OPERATOR ("", CONST_CAST_EXPR, "cv", 1)
+DEF_SIMPLE_OPERATOR ("", STATIC_CAST_EXPR, "cv", 1)
+
+/* Binary operators. */
+DEF_SIMPLE_OPERATOR ("+", PLUS_EXPR, "pl", 2)
+DEF_SIMPLE_OPERATOR ("-", MINUS_EXPR, "mi", 2)
+DEF_SIMPLE_OPERATOR ("*", MULT_EXPR, "ml", 2)
+DEF_SIMPLE_OPERATOR ("/", TRUNC_DIV_EXPR, "dv", 2)
+DEF_SIMPLE_OPERATOR ("%", TRUNC_MOD_EXPR, "rm", 2)
+DEF_SIMPLE_OPERATOR ("&", BIT_AND_EXPR, "an", 2)
+DEF_SIMPLE_OPERATOR ("|", BIT_IOR_EXPR, "or", 2)
+DEF_SIMPLE_OPERATOR ("^", BIT_XOR_EXPR, "eo", 2)
+DEF_SIMPLE_OPERATOR ("<<", LSHIFT_EXPR, "ls", 2)
+DEF_SIMPLE_OPERATOR (">>", RSHIFT_EXPR, "rs", 2)
+DEF_SIMPLE_OPERATOR ("==", EQ_EXPR, "eq", 2)
+DEF_SIMPLE_OPERATOR ("!=", NE_EXPR, "ne", 2)
+DEF_SIMPLE_OPERATOR ("<", LT_EXPR, "lt", 2)
+DEF_SIMPLE_OPERATOR (">", GT_EXPR, "gt", 2)
+DEF_SIMPLE_OPERATOR ("<=", LE_EXPR, "le", 2)
+DEF_SIMPLE_OPERATOR (">=", GE_EXPR, "ge", 2)
+DEF_SIMPLE_OPERATOR ("&&", TRUTH_ANDIF_EXPR, "aa", 2)
+DEF_SIMPLE_OPERATOR ("||", TRUTH_ORIF_EXPR, "oo", 2)
+DEF_SIMPLE_OPERATOR (",", COMPOUND_EXPR, "cm", 2)
+DEF_SIMPLE_OPERATOR ("->*", MEMBER_REF, "pm", 2)
+DEF_SIMPLE_OPERATOR ("->", COMPONENT_REF, "pt", 2)
+DEF_SIMPLE_OPERATOR ("[]", ARRAY_REF, "ix", 2)
+DEF_SIMPLE_OPERATOR ("++", POSTINCREMENT_EXPR, "pp", 2)
+DEF_SIMPLE_OPERATOR ("--", POSTDECREMENT_EXPR, "mm", 2)
+/* These are extensions. */
+DEF_SIMPLE_OPERATOR ("<?", MIN_EXPR, "v23min", 2)
+DEF_SIMPLE_OPERATOR (">?", MAX_EXPR, "v23max", 2)
+/* This one is needed for mangling. */
+DEF_SIMPLE_OPERATOR ("::", SCOPE_REF, "sr", 2);
+
+/* Assignment operators. */
+DEF_ASSN_OPERATOR ("=", NOP_EXPR, "aS", 2)
+DEF_ASSN_OPERATOR ("+=", PLUS_EXPR, "pL", 2)
+DEF_ASSN_OPERATOR ("-=", MINUS_EXPR, "mI", 2)
+DEF_ASSN_OPERATOR ("*=", MULT_EXPR, "mL", 2)
+DEF_ASSN_OPERATOR ("/=", TRUNC_DIV_EXPR, "dV", 2)
+DEF_ASSN_OPERATOR ("%=", TRUNC_MOD_EXPR, "rM", 2)
+DEF_ASSN_OPERATOR ("&=", BIT_AND_EXPR, "aN", 2)
+DEF_ASSN_OPERATOR ("|=", BIT_IOR_EXPR, "oR", 2)
+DEF_ASSN_OPERATOR ("^=", BIT_XOR_EXPR, "eO", 2)
+DEF_ASSN_OPERATOR ("<<=", LSHIFT_EXPR, "lS", 2)
+DEF_ASSN_OPERATOR (">>=", RSHIFT_EXPR, "rS", 2)
+
+/* Ternary operators. */
+DEF_SIMPLE_OPERATOR ("?:", COND_EXPR, "qu", 3)
+
+/* Miscellaneous. */
+DEF_SIMPLE_OPERATOR ("()", CALL_EXPR, "cl", -1)
diff --git a/contrib/gcc/cp/optimize.c b/contrib/gcc/cp/optimize.c
new file mode 100644
index 0000000..ac51cda
--- /dev/null
+++ b/contrib/gcc/cp/optimize.c
@@ -0,0 +1,303 @@
+/* Perform optimizations on tree structure.
+ Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Written by Mark Michell (mark@codesourcery.com).
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "tree.h"
+#include "cp-tree.h"
+#include "rtl.h"
+#include "insn-config.h"
+#include "input.h"
+#include "integrate.h"
+#include "toplev.h"
+#include "varray.h"
+#include "ggc.h"
+#include "params.h"
+#include "hashtab.h"
+#include "debug.h"
+#include "tree-inline.h"
+
+/* Prototypes. */
+
+static tree calls_setjmp_r PARAMS ((tree *, int *, void *));
+static void update_cloned_parm PARAMS ((tree, tree));
+static void dump_function PARAMS ((enum tree_dump_index, tree));
+
+/* Optimize the body of FN. */
+
+void
+optimize_function (fn)
+ tree fn;
+{
+ dump_function (TDI_original, fn);
+
+ /* While in this function, we may choose to go off and compile
+ another function. For example, we might instantiate a function
+ in the hopes of inlining it. Normally, that wouldn't trigger any
+ actual RTL code-generation -- but it will if the template is
+ actually needed. (For example, if it's address is taken, or if
+ some other function already refers to the template.) If
+ code-generation occurs, then garbage collection will occur, so we
+ must protect ourselves, just as we do while building up the body
+ of the function. */
+ ++function_depth;
+
+ if (flag_inline_trees
+ /* We do not inline thunks, as (a) the backend tries to optimize
+ the call to the thunkee, (b) tree based inlining breaks that
+ optimization, (c) virtual functions are rarely inlineable,
+ and (d) ASM_OUTPUT_MI_THUNK is there to DTRT anyway. */
+ && !DECL_THUNK_P (fn))
+ {
+ optimize_inline_calls (fn);
+
+ dump_function (TDI_inlined, fn);
+ }
+
+ /* Undo the call to ggc_push_context above. */
+ --function_depth;
+
+ dump_function (TDI_optimized, fn);
+}
+
+/* Called from calls_setjmp_p via walk_tree. */
+
+static tree
+calls_setjmp_r (tp, walk_subtrees, data)
+ tree *tp;
+ int *walk_subtrees ATTRIBUTE_UNUSED;
+ void *data ATTRIBUTE_UNUSED;
+{
+ /* We're only interested in FUNCTION_DECLS. */
+ if (TREE_CODE (*tp) != FUNCTION_DECL)
+ return NULL_TREE;
+
+ return setjmp_call_p (*tp) ? *tp : NULL_TREE;
+}
+
+/* Returns non-zero if FN calls `setjmp' or some other function that
+ can return more than once. This function is conservative; it may
+ occasionally return a non-zero value even when FN does not actually
+ call `setjmp'. */
+
+int
+calls_setjmp_p (fn)
+ tree fn;
+{
+ return walk_tree_without_duplicates (&DECL_SAVED_TREE (fn),
+ calls_setjmp_r,
+ NULL) != NULL_TREE;
+}
+
+/* CLONED_PARM is a copy of CLONE, generated for a cloned constructor
+ or destructor. Update it to ensure that the source-position for
+ the cloned parameter matches that for the original, and that the
+ debugging generation code will be able to find the original PARM. */
+
+static void
+update_cloned_parm (parm, cloned_parm)
+ tree parm;
+ tree cloned_parm;
+{
+ DECL_ABSTRACT_ORIGIN (cloned_parm) = parm;
+
+ /* We may have taken its address. */
+ TREE_ADDRESSABLE (cloned_parm) = TREE_ADDRESSABLE (parm);
+
+ /* The definition might have different constness. */
+ TREE_READONLY (cloned_parm) = TREE_READONLY (parm);
+
+ TREE_USED (cloned_parm) = TREE_USED (parm);
+
+ /* The name may have changed from the declaration. */
+ DECL_NAME (cloned_parm) = DECL_NAME (parm);
+ DECL_SOURCE_FILE (cloned_parm) = DECL_SOURCE_FILE (parm);
+ DECL_SOURCE_LINE (cloned_parm) = DECL_SOURCE_LINE (parm);
+}
+
+/* FN is a function that has a complete body. Clone the body as
+ necessary. Returns non-zero if there's no longer any need to
+ process the main body. */
+
+int
+maybe_clone_body (fn)
+ tree fn;
+{
+ tree clone;
+ int first = 1;
+
+ /* We only clone constructors and destructors. */
+ if (!DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn)
+ && !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn))
+ return 0;
+
+ /* Emit the DWARF1 abstract instance. */
+ (*debug_hooks->deferred_inline_function) (fn);
+
+ /* We know that any clones immediately follow FN in the TYPE_METHODS
+ list. */
+ for (clone = TREE_CHAIN (fn);
+ clone && DECL_CLONED_FUNCTION_P (clone);
+ clone = TREE_CHAIN (clone), first = 0)
+ {
+ tree parm;
+ tree clone_parm;
+ int parmno;
+ splay_tree decl_map;
+
+ /* Update CLONE's source position information to match FN's. */
+ DECL_SOURCE_FILE (clone) = DECL_SOURCE_FILE (fn);
+ DECL_SOURCE_LINE (clone) = DECL_SOURCE_LINE (fn);
+ DECL_INLINE (clone) = DECL_INLINE (fn);
+ DECL_DECLARED_INLINE_P (clone) = DECL_DECLARED_INLINE_P (fn);
+ DECL_COMDAT (clone) = DECL_COMDAT (fn);
+ DECL_WEAK (clone) = DECL_WEAK (fn);
+ DECL_ONE_ONLY (clone) = DECL_ONE_ONLY (fn);
+ DECL_SECTION_NAME (clone) = DECL_SECTION_NAME (fn);
+ DECL_USE_TEMPLATE (clone) = DECL_USE_TEMPLATE (fn);
+ DECL_EXTERNAL (clone) = DECL_EXTERNAL (fn);
+ DECL_INTERFACE_KNOWN (clone) = DECL_INTERFACE_KNOWN (fn);
+ DECL_NOT_REALLY_EXTERN (clone) = DECL_NOT_REALLY_EXTERN (fn);
+ TREE_PUBLIC (clone) = TREE_PUBLIC (fn);
+
+ /* Adjust the parameter names and locations. */
+ parm = DECL_ARGUMENTS (fn);
+ clone_parm = DECL_ARGUMENTS (clone);
+ /* Update the `this' parameter, which is always first. */
+ update_cloned_parm (parm, clone_parm);
+ parm = TREE_CHAIN (parm);
+ clone_parm = TREE_CHAIN (clone_parm);
+ if (DECL_HAS_IN_CHARGE_PARM_P (fn))
+ parm = TREE_CHAIN (parm);
+ if (DECL_HAS_VTT_PARM_P (fn))
+ parm = TREE_CHAIN (parm);
+ if (DECL_HAS_VTT_PARM_P (clone))
+ clone_parm = TREE_CHAIN (clone_parm);
+ for (; parm;
+ parm = TREE_CHAIN (parm), clone_parm = TREE_CHAIN (clone_parm))
+ {
+ /* Update this parameter. */
+ update_cloned_parm (parm, clone_parm);
+ /* We should only give unused information for one clone. */
+ if (!first)
+ TREE_USED (clone_parm) = 1;
+ }
+
+ /* Start processing the function. */
+ push_to_top_level ();
+ start_function (NULL_TREE, clone, NULL_TREE, SF_PRE_PARSED);
+
+ /* Remap the parameters. */
+ decl_map = splay_tree_new (splay_tree_compare_pointers, NULL, NULL);
+ for (parmno = 0,
+ parm = DECL_ARGUMENTS (fn),
+ clone_parm = DECL_ARGUMENTS (clone);
+ parm;
+ ++parmno,
+ parm = TREE_CHAIN (parm))
+ {
+ /* Map the in-charge parameter to an appropriate constant. */
+ if (DECL_HAS_IN_CHARGE_PARM_P (fn) && parmno == 1)
+ {
+ tree in_charge;
+ in_charge = in_charge_arg_for_name (DECL_NAME (clone));
+ splay_tree_insert (decl_map,
+ (splay_tree_key) parm,
+ (splay_tree_value) in_charge);
+ }
+ else if (DECL_ARTIFICIAL (parm)
+ && DECL_NAME (parm) == vtt_parm_identifier)
+ {
+ /* For a subobject constructor or destructor, the next
+ argument is the VTT parameter. Remap the VTT_PARM
+ from the CLONE to this parameter. */
+ if (DECL_HAS_VTT_PARM_P (clone))
+ {
+ DECL_ABSTRACT_ORIGIN (clone_parm) = parm;
+ splay_tree_insert (decl_map,
+ (splay_tree_key) parm,
+ (splay_tree_value) clone_parm);
+ clone_parm = TREE_CHAIN (clone_parm);
+ }
+ /* Otherwise, map the VTT parameter to `NULL'. */
+ else
+ {
+ splay_tree_insert (decl_map,
+ (splay_tree_key) parm,
+ (splay_tree_value) null_pointer_node);
+ }
+ }
+ /* Map other parameters to their equivalents in the cloned
+ function. */
+ else
+ {
+ splay_tree_insert (decl_map,
+ (splay_tree_key) parm,
+ (splay_tree_value) clone_parm);
+ clone_parm = TREE_CHAIN (clone_parm);
+ }
+ }
+
+ /* Clone the body. */
+ clone_body (clone, fn, decl_map);
+
+ /* There are as many statements in the clone as in the
+ original. */
+ DECL_NUM_STMTS (clone) = DECL_NUM_STMTS (fn);
+
+ /* Clean up. */
+ splay_tree_delete (decl_map);
+
+ /* Now, expand this function into RTL, if appropriate. */
+ finish_function (0);
+ BLOCK_ABSTRACT_ORIGIN (DECL_INITIAL (clone)) = DECL_INITIAL (fn);
+ expand_body (clone);
+ pop_from_top_level ();
+ }
+
+ /* We don't need to process the original function any further. */
+ return 1;
+}
+
+/* Dump FUNCTION_DECL FN as tree dump PHASE. */
+
+static void
+dump_function (phase, fn)
+ enum tree_dump_index phase;
+ tree fn;
+{
+ FILE *stream;
+ int flags;
+
+ stream = dump_begin (phase, &flags);
+ if (stream)
+ {
+ fprintf (stream, "\n;; Function %s",
+ decl_as_string (fn, TFF_DECL_SPECIFIERS));
+ fprintf (stream, " (%s)\n",
+ decl_as_string (DECL_ASSEMBLER_NAME (fn), 0));
+ fprintf (stream, ";; enabled by -%s\n", dump_flag_name (phase));
+ fprintf (stream, "\n");
+
+ dump_node (fn, TDF_SLIM | flags, stream);
+ dump_end (phase, stream);
+ }
+}
diff --git a/contrib/gcc/cp/parse.y b/contrib/gcc/cp/parse.y
index 7b5d3bd..7941a89 100644
--- a/contrib/gcc/cp/parse.y
+++ b/contrib/gcc/cp/parse.y
@@ -1,5 +1,6 @@
/* YACC parser for C++ syntax.
- Copyright (C) 1988, 89, 93-98, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1988, 1989, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -37,21 +38,15 @@ Boston, MA 02111-1307, USA. */
#include "tree.h"
#include "input.h"
#include "flags.h"
-#include "lex.h"
#include "cp-tree.h"
+#include "lex.h"
#include "output.h"
#include "except.h"
#include "toplev.h"
+#include "ggc.h"
-/* Since parsers are distinct for each language, put the language string
- definition here. (fnf) */
-char *language_string = "GNU C++";
-
-extern tree void_list_node;
extern struct obstack permanent_obstack;
-extern int end_of_file;
-
/* Like YYERROR but do call yyerror. */
#define YYERROR1 { yyerror ("syntax error"); YYERROR; }
@@ -62,35 +57,180 @@ extern int end_of_file;
error message if the user supplies an empty conditional expression. */
static const char *cond_stmt_keyword;
-static tree empty_parms PROTO((void));
-static int parse_decl PROTO((tree, tree, tree, int, tree *));
-
/* Nonzero if we have an `extern "C"' acting as an extern specifier. */
int have_extern_spec;
int used_extern_spec;
+/* List of types and structure classes of the current declaration. */
+static tree current_declspecs;
+
+/* List of prefix attributes in effect.
+ Prefix attributes are parsed by the reserved_declspecs and declmods
+ rules. They create a list that contains *both* declspecs and attrs. */
+/* ??? It is not clear yet that all cases where an attribute can now appear in
+ a declspec list have been updated. */
+static tree prefix_attributes;
+
+/* When defining an enumeration, this is the type of the enumeration. */
+static tree current_enum_type;
+
+/* When parsing a conversion operator name, this is the scope of the
+ operator itself. */
+static tree saved_scopes;
+
+static tree empty_parms PARAMS ((void));
+static tree parse_decl0 PARAMS ((tree, tree, tree, tree, int));
+static tree parse_decl PARAMS ((tree, tree, int));
+static void parse_end_decl PARAMS ((tree, tree, tree));
+static tree parse_field0 PARAMS ((tree, tree, tree, tree, tree, tree));
+static tree parse_field PARAMS ((tree, tree, tree, tree));
+static tree parse_bitfield0 PARAMS ((tree, tree, tree, tree, tree));
+static tree parse_bitfield PARAMS ((tree, tree, tree));
+static tree parse_method PARAMS ((tree, tree, tree));
+static void frob_specs PARAMS ((tree, tree));
+
/* Cons up an empty parameter list. */
-#ifdef __GNUC__
-__inline
-#endif
-static tree
+static inline tree
empty_parms ()
{
tree parms;
- if (strict_prototype
- || current_class_type != NULL)
- parms = void_list_node;
- else
+#ifndef NO_IMPLICIT_EXTERN_C
+ if (in_system_header && current_class_type == NULL
+ && current_lang_name == lang_name_c)
parms = NULL_TREE;
+ else
+#endif
+ parms = void_list_node;
return parms;
}
+/* Record the decl-specifiers, attributes and type lookups from the
+ decl-specifier-seq in a declaration. */
+
+static void
+frob_specs (specs_attrs, lookups)
+ tree specs_attrs, lookups;
+{
+ save_type_access_control (lookups);
+ split_specs_attrs (specs_attrs, &current_declspecs, &prefix_attributes);
+ if (current_declspecs
+ && TREE_CODE (current_declspecs) != TREE_LIST)
+ current_declspecs = build_tree_list (NULL_TREE, current_declspecs);
+ if (have_extern_spec && !used_extern_spec)
+ {
+ /* We have to indicate that there is an "extern", but that it
+ was part of a language specifier. For instance,
+
+ extern "C" typedef int (*Ptr) ();
+
+ is well formed. */
+ current_declspecs = tree_cons (error_mark_node,
+ get_identifier ("extern"),
+ current_declspecs);
+ used_extern_spec = 1;
+ }
+}
+
+static tree
+parse_decl (declarator, attributes, initialized)
+ tree declarator, attributes;
+ int initialized;
+{
+ return start_decl (declarator, current_declspecs, initialized,
+ attributes, prefix_attributes);
+}
+
+static tree
+parse_decl0 (declarator, specs_attrs, lookups, attributes, initialized)
+ tree declarator, specs_attrs, lookups, attributes;
+ int initialized;
+{
+ frob_specs (specs_attrs, lookups);
+ return parse_decl (declarator, attributes, initialized);
+}
+
+static void
+parse_end_decl (decl, init, asmspec)
+ tree decl, init, asmspec;
+{
+ /* If decl is NULL_TREE, then this was a variable declaration using
+ () syntax for the initializer, so we handled it in grokdeclarator. */
+ if (decl)
+ decl_type_access_control (decl);
+ cp_finish_decl (decl, init, asmspec, init ? LOOKUP_ONLYCONVERTING : 0);
+}
+
+static tree
+parse_field (declarator, attributes, asmspec, init)
+ tree declarator, attributes, asmspec, init;
+{
+ tree d = grokfield (declarator, current_declspecs, init, asmspec,
+ chainon (attributes, prefix_attributes));
+ decl_type_access_control (d);
+ return d;
+}
+
+static tree
+parse_field0 (declarator, specs_attrs, lookups, attributes, asmspec, init)
+ tree declarator, specs_attrs, lookups, attributes, asmspec, init;
+{
+ frob_specs (specs_attrs, lookups);
+ return parse_field (declarator, attributes, asmspec, init);
+}
+
+static tree
+parse_bitfield (declarator, attributes, width)
+ tree declarator, attributes, width;
+{
+ tree d = grokbitfield (declarator, current_declspecs, width);
+ cplus_decl_attributes (&d, chainon (attributes, prefix_attributes), 0);
+ decl_type_access_control (d);
+ return d;
+}
+
+static tree
+parse_bitfield0 (declarator, specs_attrs, lookups, attributes, width)
+ tree declarator, specs_attrs, lookups, attributes, width;
+{
+ frob_specs (specs_attrs, lookups);
+ return parse_bitfield (declarator, attributes, width);
+}
+
+static tree
+parse_method (declarator, specs_attrs, lookups)
+ tree declarator, specs_attrs, lookups;
+{
+ tree d;
+ frob_specs (specs_attrs, lookups);
+ d = start_method (current_declspecs, declarator, prefix_attributes);
+ decl_type_access_control (d);
+ return d;
+}
+
+void
+cp_parse_init ()
+{
+ ggc_add_tree_root (&current_declspecs, 1);
+ ggc_add_tree_root (&prefix_attributes, 1);
+ ggc_add_tree_root (&current_enum_type, 1);
+ ggc_add_tree_root (&saved_scopes, 1);
+}
+
+/* Rename the "yyparse" function so that we can override it elsewhere. */
+#define yyparse yyparse_1
%}
%start program
-%union {long itype; tree ttype; char *strtype; enum tree_code code; flagged_type_tree ftype; }
+%union {
+ long itype;
+ tree ttype;
+ char *strtype;
+ enum tree_code code;
+ flagged_type_tree ftype;
+ struct unparsed_text *pi;
+}
/* All identifiers that are not reserved words
and are not declared typedefs in the current block */
@@ -121,6 +261,10 @@ empty_parms ()
yylval is the node for the constant. */
%token CONSTANT
+/* __func__, __FUNCTION__ or __PRETTY_FUNCTION__.
+ yylval contains an IDENTIFIER_NODE which indicates which one. */
+%token VAR_FUNC_NAME
+
/* String constants in raw form.
yylval is a STRING_CST node. */
%token STRING
@@ -134,7 +278,7 @@ empty_parms ()
%token BREAK CONTINUE RETURN_KEYWORD GOTO ASM_KEYWORD TYPEOF ALIGNOF
%token SIGOF
%token ATTRIBUTE EXTENSION LABEL
-%token REALPART IMAGPART
+%token REALPART IMAGPART VA_ARG
/* the reserved words... C++ extensions */
%token <ttype> AGGR
@@ -143,7 +287,7 @@ empty_parms ()
%token NAMESPACE TYPENAME_KEYWORD USING
%token LEFT_RIGHT TEMPLATE
%token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
-%token <itype> SCOPE
+%token SCOPE EXPORT
/* Define the operator tokens and their precedences.
The value is an integer because, if used, it is the tree code
@@ -157,7 +301,7 @@ empty_parms ()
%nonassoc IF
%nonassoc ELSE
-%left IDENTIFIER PFUNCNAME TYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD
+%left IDENTIFIER PFUNCNAME TYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD ATTRIBUTE
%left '{' ',' ';'
@@ -179,7 +323,7 @@ empty_parms ()
%left <code> POINTSAT_STAR DOT_STAR
%right <code> UNARY PLUSPLUS MINUSMINUS '~'
%left HYPERUNARY
-%left <ttype> PAREN_STAR_PAREN LEFT_RIGHT
+%left <ttype> LEFT_RIGHT
%left <code> POINTSAT '.' '(' '['
%right SCOPE /* C++ extension */
@@ -190,18 +334,18 @@ empty_parms ()
%type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist
%type <ttype> PFUNCNAME maybe_identifier
%type <ttype> paren_expr_or_null nontrivial_exprlist SELFNAME
-%type <ttype> expr_no_commas cast_expr unary_expr primary string STRING
+%type <ttype> expr_no_commas expr_no_comma_rangle
+%type <ttype> cast_expr unary_expr primary string STRING
%type <ttype> reserved_declspecs boolean.literal
%type <ttype> reserved_typespecquals
-%type <ttype> declmods
%type <ttype> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
-%type <itype> initdecls notype_initdecls initdcl /* C++ modification */
%type <ttype> init initlist maybeasm maybe_init defarg defarg1
%type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
%type <ttype> maybe_attribute attributes attribute attribute_list attrib
%type <ttype> any_word
-%type <ttype> compstmt implicitly_scoped_stmt
+%type <itype> save_lineno
+%type <ttype> simple_stmt simple_if
%type <ttype> declarator notype_declarator after_type_declarator
%type <ttype> notype_declarator_intern absdcl_intern
@@ -212,7 +356,6 @@ empty_parms ()
%type <ttype> component_declarator component_declarator0
%type <ttype> notype_component_declarator notype_component_declarator0
%type <ttype> after_type_component_declarator after_type_component_declarator0
-%type <ttype> enumlist enumerator
%type <ttype> absdcl cv_qualifiers
%type <ttype> direct_abstract_declarator conversion_declarator
%type <ttype> new_declarator direct_new_declarator
@@ -231,29 +374,33 @@ empty_parms ()
%type <ftype> type_id new_type_id typed_typespecs typespec typed_declspecs
%type <ftype> typed_declspecs1 type_specifier_seq nonempty_cv_qualifiers
%type <ftype> structsp typespecqual_reserved parm named_parm full_parm
+%type <ftype> declmods
+
+%type <itype> extension
/* C++ extensions */
%token <ttype> PTYPENAME
-%token <ttype> PRE_PARSED_FUNCTION_DECL EXTERN_LANG_STRING ALL
+%token <ttype> EXTERN_LANG_STRING ALL
%token <ttype> PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER
+%token <pi> PRE_PARSED_FUNCTION_DECL
%type <ttype> component_constructor_declarator
-%type <ttype> fn.def2 return_id fn.defpen constructor_declarator
-%type <itype> ctor_initializer_opt function_try_block
-%type <ttype> named_class_head_sans_basetype
-%type <ftype> class_head named_class_head
-%type <ftype> named_complex_class_head_sans_basetype
-%type <ttype> unnamed_class_head
+%type <ttype> fn.def2 return_id constructor_declarator
+%type <ttype> .begin_function_body
+%type <ttype> class_head class_head_apparent_template
+%type <ftype> class_head_decl class_head_defn
%type <ttype> base_class_list
%type <ttype> base_class_access_list
%type <ttype> base_class maybe_base_class_list base_class.1
%type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
%type <ttype> operator_name
%type <ttype> object aggr
-%type <itype> new delete .begin_new_placement
+%type <itype> new delete
/* %type <ttype> primary_no_id */
-%type <ttype> nonmomentary_expr maybe_parmlist
-%type <itype> initdcl0 notype_initdcl0 member_init_list initdcl0_innards
-%type <ttype> template_header template_parm_list template_parm
+%type <ttype> maybe_parmlist
+%type <ttype> member_init
+%type <ftype> member_init_list
+%type <ttype> template_parm_header template_spec_header template_header
+%type <ttype> template_parm_list template_parm
%type <ttype> template_type_parm template_template_parm
%type <code> template_close_bracket
%type <ttype> apparent_template_type
@@ -269,9 +416,8 @@ empty_parms ()
%type <ttype> explicit_template_type
/* in order to recognize aggr tags as defining and thus shadowing. */
%token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
-%type <ttype> named_class_head_sans_basetype_defn
%type <ttype> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
-
+%type <ttype> handler_args
%type <ttype> self_template_type .finish_template_type
%token NSNAME
@@ -285,60 +431,15 @@ empty_parms ()
%token END_OF_SAVED_INPUT
%{
-/* List of types and structure classes of the current declaration. */
-static tree current_declspecs;
-
-/* List of prefix attributes in effect.
- Prefix attributes are parsed by the reserved_declspecs and declmods
- rules. They create a list that contains *both* declspecs and attrs. */
-/* ??? It is not clear yet that all cases where an attribute can now appear in
- a declspec list have been updated. */
-static tree prefix_attributes;
-
-/* When defining an aggregate, this is the kind of the most recent one
- being defined. (For example, this might be class_type_node.) */
-static tree current_aggr;
-
-/* When defining an enumeration, this is the type of the enumeration. */
-static tree current_enum_type;
-
/* Tell yyparse how to print a token's value, if yydebug is set. */
-
#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
-extern void yyprint PROTO((FILE *, int, YYSTYPE));
-extern tree combine_strings PROTO((tree));
-
-static int
-parse_decl(declarator, specs_attrs, attributes, initialized, decl)
- tree declarator;
- tree specs_attrs;
- tree attributes;
- int initialized;
- tree* decl;
-{
- int sm;
-
- split_specs_attrs (specs_attrs, &current_declspecs, &prefix_attributes);
- if (current_declspecs
- && TREE_CODE (current_declspecs) != TREE_LIST)
- current_declspecs = build_decl_list (NULL_TREE, current_declspecs);
- if (have_extern_spec && !used_extern_spec)
- {
- current_declspecs = decl_tree_cons (NULL_TREE,
- get_identifier ("extern"),
- current_declspecs);
- used_extern_spec = 1;
- }
- sm = suspend_momentary ();
- *decl = start_decl (declarator, current_declspecs, initialized,
- attributes, prefix_attributes);
- return sm;
-}
+extern void yyprint PARAMS ((FILE *, int, YYSTYPE));
%}
%%
program:
/* empty */
+ { finish_translation_unit (); }
| extdefs
{ finish_translation_unit (); }
;
@@ -350,9 +451,9 @@ program:
extdefs:
{ $<ttype>$ = NULL_TREE; }
lang_extdef
- { $<ttype>$ = NULL_TREE; }
+ { $<ttype>$ = NULL_TREE; ggc_collect (); }
| extdefs lang_extdef
- { $<ttype>$ = NULL_TREE; }
+ { $<ttype>$ = NULL_TREE; ggc_collect (); }
;
extdefs_opt:
@@ -371,7 +472,7 @@ extdefs_opt:
extension:
EXTENSION
- { $<itype>$ = pedantic;
+ { $$ = pedantic;
pedantic = 0; }
;
@@ -380,30 +481,34 @@ asm_keyword:
;
lang_extdef:
- { if (pending_lang_change) do_pending_lang_change(); }
+ { if (pending_lang_change) do_pending_lang_change();
+ type_lookups = NULL_TREE; }
extdef
- { if (! toplevel_bindings_p () && ! pseudo_global_level_p())
+ { if (! toplevel_bindings_p ())
pop_everything (); }
;
extdef:
fndef eat_saved_input
- { if (pending_inlines) do_pending_inlines (); }
+ { do_pending_inlines (); }
| datadef
- { if (pending_inlines) do_pending_inlines (); }
+ { do_pending_inlines (); }
+
+ | EXPORT
+ { warning ("keyword `export' not implemented, and will be ignored"); }
+ template_def
+ { do_pending_inlines (); }
| template_def
- { if (pending_inlines) do_pending_inlines (); }
+ { do_pending_inlines (); }
| asm_keyword '(' string ')' ';'
{ if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
assemble_asm ($3); }
| extern_lang_string '{' extdefs_opt '}'
{ pop_lang_context (); }
| extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
- { if (pending_inlines) do_pending_inlines ();
- pop_lang_context (); }
+ { do_pending_inlines (); pop_lang_context (); }
| extern_lang_string .hush_warning datadef .warning_ok
- { if (pending_inlines) do_pending_inlines ();
- pop_lang_context (); }
+ { do_pending_inlines (); pop_lang_context (); }
| NAMESPACE identifier '{'
{ push_namespace ($2); }
extdefs_opt '}'
@@ -417,7 +522,7 @@ extdef:
{ do_toplevel_using_decl ($1); }
| using_directive
| extension extdef
- { pedantic = $<itype>1; }
+ { pedantic = $1; }
;
namespace_alias:
@@ -443,11 +548,11 @@ using_decl:
namespace_using_decl:
USING namespace_qualifier identifier
- { $$ = build_parse_node (SCOPE_REF, $2, $3); }
+ { $$ = build_nt (SCOPE_REF, $2, $3); }
| USING global_scope identifier
- { $$ = build_parse_node (SCOPE_REF, global_namespace, $3); }
+ { $$ = build_nt (SCOPE_REF, global_namespace, $3); }
| USING global_scope namespace_qualifier identifier
- { $$ = build_parse_node (SCOPE_REF, $3, $4); }
+ { $$ = build_nt (SCOPE_REF, $3, $4); }
;
using_directive:
@@ -494,20 +599,28 @@ extern_lang_string:
{ push_lang_context ($1); }
| extern_lang_string EXTERN_LANG_STRING
{ if (current_lang_name != $2)
- cp_error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name);
+ error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name);
pop_lang_context (); push_lang_context ($2); }
;
-template_header:
+template_parm_header:
TEMPLATE '<'
{ begin_template_parm_list (); }
template_parm_list '>'
{ $$ = end_template_parm_list ($4); }
- | TEMPLATE '<' '>'
+ ;
+
+template_spec_header:
+ TEMPLATE '<' '>'
{ begin_specialization();
$$ = NULL_TREE; }
;
+template_header:
+ template_parm_header
+ | template_spec_header
+ ;
+
template_parm_list:
template_parm
{ $$ = process_template_parm (NULL_TREE, $1); }
@@ -529,7 +642,7 @@ template_type_parm:
;
template_template_parm:
- template_header aggr maybe_identifier
+ template_parm_header aggr maybe_identifier
{ $$ = finish_template_template_parm ($2, $3); }
;
@@ -547,7 +660,7 @@ template_parm:
{ $$ = build_tree_list (groktypename ($3.t), $1); }
| parm
{ $$ = build_tree_list (NULL_TREE, $1.t); }
- | parm '=' expr_no_commas %prec ARITHCOMPARE
+ | parm '=' expr_no_comma_rangle
{ $$ = build_tree_list ($3, $1.t); }
| template_template_parm
{ $$ = build_tree_list (NULL_TREE, $1); }
@@ -555,7 +668,8 @@ template_parm:
{
if (TREE_CODE ($3) != TEMPLATE_DECL
&& TREE_CODE ($3) != TEMPLATE_TEMPLATE_PARM
- && TREE_CODE ($3) != TYPE_DECL)
+ && TREE_CODE ($3) != TYPE_DECL
+ && TREE_CODE ($3) != UNBOUND_CLASS_TEMPLATE)
{
error ("invalid default template argument");
$3 = error_mark_node;
@@ -573,19 +687,19 @@ template_def:
template_extdef:
fndef eat_saved_input
- { if (pending_inlines) do_pending_inlines (); }
+ { do_pending_inlines (); }
| template_datadef
- { if (pending_inlines) do_pending_inlines (); }
+ { do_pending_inlines (); }
| template_def
- { if (pending_inlines) do_pending_inlines (); }
+ { do_pending_inlines (); }
| extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
- { if (pending_inlines) do_pending_inlines ();
+ { do_pending_inlines ();
pop_lang_context (); }
| extern_lang_string .hush_warning template_datadef .warning_ok
- { if (pending_inlines) do_pending_inlines ();
+ { do_pending_inlines ();
pop_lang_context (); }
| extension template_extdef
- { pedantic = $<itype>1; }
+ { pedantic = $1; }
;
template_datadef:
@@ -595,8 +709,13 @@ template_datadef:
| typed_declspecs initdecls ';'
{ note_list_got_semicolon ($1.t); }
| structsp ';'
- { maybe_process_partial_specialization ($1.t);
- note_got_semicolon ($1.t); }
+ {
+ if ($1.t != error_mark_node)
+ {
+ maybe_process_partial_specialization ($1.t);
+ note_got_semicolon ($1.t);
+ }
+ }
;
datadef:
@@ -617,14 +736,15 @@ datadef:
}
| error ';'
| error '}'
+ | error END_OF_SAVED_INPUT
+ { end_input (); }
| ';'
+ | bad_decl
;
ctor_initializer_opt:
nodecls
- { $$ = 0; }
| base_init
- { $$ = 1; }
;
maybe_return_init:
@@ -638,15 +758,25 @@ eat_saved_input:
| END_OF_SAVED_INPUT
;
+/* The outermost block of a function really begins before the
+ mem-initializer-list, so we open one there and suppress the one that
+ actually corresponds to the curly braces. */
+function_body:
+ .begin_function_body ctor_initializer_opt save_lineno '{'
+ { $<ttype>$ = begin_compound_stmt (/*has_no_scope=*/1); }
+ compstmtend
+ {
+ STMT_LINENO ($<ttype>5) = $3;
+ finish_compound_stmt (/*has_no_scope=*/1, $<ttype>5);
+ finish_function_body ($1);
+ }
+ ;
+
fndef:
- fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
- { finish_function (lineno, (int)$3, 0); }
+ fn.def1 maybe_return_init function_body
+ { expand_body (finish_function (0)); }
| fn.def1 maybe_return_init function_try_block
- {
- int nested = (hack_decl_function_context
- (current_function_decl) != NULL_TREE);
- finish_function (lineno, (int)$3, nested);
- }
+ { expand_body (finish_function (0)); }
| fn.def1 maybe_return_init error
{ }
;
@@ -688,27 +818,36 @@ constructor_declarator:
fn.def1:
typed_declspecs declarator
- { if (!begin_function_definition ($1.t, $2))
+ { check_for_new_type ("return type", $1);
+ if (!begin_function_definition ($1.t, $2))
YYERROR1; }
| declmods notype_declarator
- { if (!begin_function_definition ($1, $2))
+ { if (!begin_function_definition ($1.t, $2))
YYERROR1; }
| notype_declarator
{ if (!begin_function_definition (NULL_TREE, $1))
YYERROR1; }
| declmods constructor_declarator
- { if (!begin_function_definition ($1, $2))
+ { if (!begin_function_definition ($1.t, $2))
YYERROR1; }
| constructor_declarator
{ if (!begin_function_definition (NULL_TREE, $1))
YYERROR1; }
;
+/* ANSI allows optional parentheses around constructor class names.
+ See ISO/IEC 14882:1998(E) 12.1. */
+
component_constructor_declarator:
- SELFNAME '(' parmlist ')' cv_qualifiers exception_specification_opt
- { $$ = make_call_declarator ($1, $3, $5, $6); }
- | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
- { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
+ SELFNAME '(' parmlist ')' cv_qualifiers exception_specification_opt
+ { $$ = make_call_declarator ($1, $3, $5, $6); }
+ | '(' SELFNAME ')' '(' parmlist ')' cv_qualifiers
+ exception_specification_opt
+ { $$ = make_call_declarator ($2, $5, $7, $8); }
+ | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
+ { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
+ | '(' SELFNAME ')' LEFT_RIGHT cv_qualifiers exception_specification_opt
+ { $$ = make_call_declarator ($2, empty_parms (), $5, $6); }
| self_template_type '(' parmlist ')' cv_qualifiers exception_specification_opt
{ $$ = make_call_declarator ($1, $3, $5, $6); }
| self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
@@ -719,99 +858,87 @@ component_constructor_declarator:
reduce/reduce conflict introduced by these rules. */
fn.def2:
declmods component_constructor_declarator
- { tree specs, attrs;
- split_specs_attrs ($1, &specs, &attrs);
- attrs = build_tree_list (attrs, NULL_TREE);
- $$ = start_method (specs, $2, attrs);
+ { $$ = parse_method ($2, $1.t, $1.lookups);
rest_of_mdef:
if (! $$)
YYERROR1;
if (yychar == YYEMPTY)
yychar = YYLEX;
- reinit_parse_for_method (yychar, $$); }
+ snarf_method ($$); }
| component_constructor_declarator
- { $$ = start_method (NULL_TREE, $1, NULL_TREE);
+ { $$ = parse_method ($1, NULL_TREE, NULL_TREE);
goto rest_of_mdef; }
| typed_declspecs declarator
- { tree specs, attrs;
- split_specs_attrs ($1.t, &specs, &attrs);
- attrs = build_tree_list (attrs, NULL_TREE);
- $$ = start_method (specs, $2, attrs); goto rest_of_mdef; }
+ { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
| declmods notype_declarator
- { tree specs, attrs;
- split_specs_attrs ($1, &specs, &attrs);
- attrs = build_tree_list (attrs, NULL_TREE);
- $$ = start_method (specs, $2, attrs); goto rest_of_mdef; }
+ { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
| notype_declarator
- { $$ = start_method (NULL_TREE, $$, NULL_TREE);
+ { $$ = parse_method ($1, NULL_TREE, NULL_TREE);
goto rest_of_mdef; }
| declmods constructor_declarator
- { tree specs, attrs;
- split_specs_attrs ($1, &specs, &attrs);
- attrs = build_tree_list (attrs, NULL_TREE);
- $$ = start_method (specs, $2, attrs); goto rest_of_mdef; }
+ { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
| constructor_declarator
- { $$ = start_method (NULL_TREE, $$, NULL_TREE);
+ { $$ = parse_method ($1, NULL_TREE, NULL_TREE);
goto rest_of_mdef; }
;
return_id:
RETURN_KEYWORD IDENTIFIER
{
- if (! current_function_parms_stored)
- store_parm_decls ();
$$ = $2;
}
;
return_init:
return_id maybe_init
- { store_return_init ($<ttype>$, $2); }
+ { finish_named_return_value ($<ttype>$, $2); }
| return_id '(' nonnull_exprlist ')'
- { store_return_init ($<ttype>$, $3); }
+ { finish_named_return_value ($<ttype>$, $3); }
| return_id LEFT_RIGHT
- { store_return_init ($<ttype>$, NULL_TREE); }
+ { finish_named_return_value ($<ttype>$, NULL_TREE); }
;
base_init:
- ':' .set_base_init member_init_list
+ ':' member_init_list
{
- if ($3 == 0)
- error ("no base initializers given following ':'");
- setup_vtbl_ptr ();
- /* Always keep the BLOCK node associated with the outermost
- pair of curley braces of a function. These are needed
- for correct operation of dwarfout.c. */
- keep_next_level ();
+ if (! DECL_CONSTRUCTOR_P (current_function_decl))
+ error ("only constructors take base initializers");
+ else if ($2.new_type_flag == 0)
+ error ("no base or member initializers given following ':'");
+
+ finish_mem_initializers ($2.t);
}
;
-.set_base_init:
+.begin_function_body:
/* empty */
{
- if (! current_function_parms_stored)
- store_parm_decls ();
-
- if (DECL_CONSTRUCTOR_P (current_function_decl))
- {
- /* Make a contour for the initializer list. */
- pushlevel (0);
- clear_last_expr ();
- expand_start_bindings (0);
- }
- else if (current_class_type == NULL_TREE)
- error ("base initializers not allowed for non-member functions");
- else if (! DECL_CONSTRUCTOR_P (current_function_decl))
- error ("only constructors take base initializers");
+ $$ = begin_function_body ();
}
;
member_init_list:
/* empty */
- { $$ = 0; }
+ {
+ $$.new_type_flag = 0;
+ $$.t = NULL_TREE;
+ }
| member_init
- { $$ = 1; }
+ {
+ $$.new_type_flag = 1;
+ $$.t = $1;
+ }
| member_init_list ',' member_init
+ {
+ if ($3)
+ {
+ $$.new_type_flag = 1;
+ TREE_CHAIN ($3) = $1.t;
+ $$.t = $3;
+ }
+ else
+ $$ = $1;
+ }
| member_init_list error
;
@@ -820,28 +947,33 @@ member_init:
{
if (current_class_name)
pedwarn ("anachronistic old style base class initializer");
- expand_member_init (current_class_ref, NULL_TREE, $2);
+ $$ = expand_member_init (current_class_ref, NULL_TREE, $2);
}
| LEFT_RIGHT
{
if (current_class_name)
pedwarn ("anachronistic old style base class initializer");
- expand_member_init (current_class_ref, NULL_TREE, void_type_node);
+ $$ = expand_member_init (current_class_ref,
+ NULL_TREE,
+ void_type_node);
}
| notype_identifier '(' nonnull_exprlist ')'
- { expand_member_init (current_class_ref, $1, $3); }
+ { $$ = expand_member_init (current_class_ref, $1, $3); }
| notype_identifier LEFT_RIGHT
- { expand_member_init (current_class_ref, $1, void_type_node); }
+ { $$ = expand_member_init (current_class_ref, $1,
+ void_type_node); }
| nonnested_type '(' nonnull_exprlist ')'
- { expand_member_init (current_class_ref, $1, $3); }
+ { $$ = expand_member_init (current_class_ref, $1, $3); }
| nonnested_type LEFT_RIGHT
- { expand_member_init (current_class_ref, $1, void_type_node); }
+ { $$ = expand_member_init (current_class_ref, $1,
+ void_type_node); }
| typename_sub '(' nonnull_exprlist ')'
- { expand_member_init (current_class_ref, TYPE_MAIN_DECL ($1),
- $3); }
+ { $$ = expand_member_init (current_class_ref, $1, $3); }
| typename_sub LEFT_RIGHT
- { expand_member_init (current_class_ref, TYPE_MAIN_DECL ($1),
- void_type_node); }
+ { $$ = expand_member_init (current_class_ref, $1,
+ void_type_node); }
+ | error
+ { $$ = NULL_TREE; }
;
identifier:
@@ -866,7 +998,7 @@ identifier_defn:
explicit_instantiation:
TEMPLATE begin_explicit_instantiation typespec ';'
- { do_type_instantiation ($3.t, NULL_TREE);
+ { do_type_instantiation ($3.t, NULL_TREE, 1);
yyungetc (';', 1); }
end_explicit_instantiation
| TEMPLATE begin_explicit_instantiation typed_declspecs declarator
@@ -880,7 +1012,7 @@ explicit_instantiation:
{ do_decl_instantiation (NULL_TREE, $3, NULL_TREE); }
end_explicit_instantiation
| SCSPEC TEMPLATE begin_explicit_instantiation typespec ';'
- { do_type_instantiation ($4.t, $1);
+ { do_type_instantiation ($4.t, $1, 1);
yyungetc (';', 1); }
end_explicit_instantiation
| SCSPEC TEMPLATE begin_explicit_instantiation typed_declspecs
@@ -964,8 +1096,28 @@ template_arg:
type_id
{ $$ = groktypename ($1.t); }
| PTYPENAME
- { $$ = lastiddecl; }
- | expr_no_commas %prec ARITHCOMPARE
+ {
+ $$ = lastiddecl;
+ if (DECL_TEMPLATE_TEMPLATE_PARM_P ($$))
+ $$ = TREE_TYPE ($$);
+ }
+ | global_scope PTYPENAME
+ {
+ $$ = lastiddecl;
+ if (DECL_TEMPLATE_TEMPLATE_PARM_P ($$))
+ $$ = TREE_TYPE ($$);
+ }
+ | expr_no_comma_rangle
+ | nested_name_specifier TEMPLATE identifier
+ {
+ if (!processing_template_decl)
+ {
+ error ("use of template qualifier outside template");
+ $$ = error_mark_node;
+ }
+ else
+ $$ = make_unbound_class_template ($1, $3, 1);
+ }
;
unop:
@@ -989,7 +1141,7 @@ expr:
paren_expr_or_null:
LEFT_RIGHT
- { error ("ANSI C++ forbids an empty condition for `%s'",
+ { error ("ISO C++ forbids an empty condition for `%s'",
cond_stmt_keyword);
$$ = integer_zero_node; }
| '(' expr ')'
@@ -998,7 +1150,7 @@ paren_expr_or_null:
paren_cond_or_null:
LEFT_RIGHT
- { error ("ANSI C++ forbids an empty condition for `%s'",
+ { error ("ISO C++ forbids an empty condition for `%s'",
cond_stmt_keyword);
$$ = integer_zero_node; }
| '(' condition ')'
@@ -1021,23 +1173,20 @@ condition:
if (TREE_CODE (d) == TYPE_DECL) {
tree s = TREE_TYPE (d);
if (TREE_CODE (s) == RECORD_TYPE)
- cp_error ("definition of class `%T' in condition", s);
+ error ("definition of class `%T' in condition", s);
else if (TREE_CODE (s) == ENUMERAL_TYPE)
- cp_error ("definition of enum `%T' in condition", s);
+ error ("definition of enum `%T' in condition", s);
}
}
current_declspecs = $1.t;
- $<itype>5 = suspend_momentary ();
- $<ttype>$ = start_decl ($<ttype>2, current_declspecs, 1,
- $4, /*prefix_attributes*/ NULL_TREE);
+ $<ttype>$ = parse_decl ($<ttype>2, $4, 1);
}
init
{
- cp_finish_decl ($<ttype>6, $7, $4, 1, LOOKUP_ONLYCONVERTING);
- resume_momentary ($<itype>5);
+ parse_end_decl ($<ttype>6, $7, $4);
$$ = convert_from_reference ($<ttype>6);
if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
- cp_error ("definition of array `%#D' in condition", $$);
+ error ("definition of array `%#D' in condition", $$);
}
| expr
;
@@ -1049,31 +1198,22 @@ compstmtend:
| maybe_label_decls error '}'
;
-already_scoped_stmt:
- '{'
- { $<ttype>$ = begin_compound_stmt (1); }
- compstmtend
- { finish_compound_stmt (1, $<ttype>2); }
- | simple_stmt
- ;
-
-
nontrivial_exprlist:
expr_no_commas ',' expr_no_commas
- { $$ = expr_tree_cons (NULL_TREE, $$,
- build_expr_list (NULL_TREE, $3)); }
+ { $$ = tree_cons (NULL_TREE, $$,
+ build_tree_list (NULL_TREE, $3)); }
| expr_no_commas ',' error
- { $$ = expr_tree_cons (NULL_TREE, $$,
- build_expr_list (NULL_TREE, error_mark_node)); }
+ { $$ = tree_cons (NULL_TREE, $$,
+ build_tree_list (NULL_TREE, error_mark_node)); }
| nontrivial_exprlist ',' expr_no_commas
- { chainon ($$, build_expr_list (NULL_TREE, $3)); }
+ { chainon ($$, build_tree_list (NULL_TREE, $3)); }
| nontrivial_exprlist ',' error
- { chainon ($$, build_expr_list (NULL_TREE, error_mark_node)); }
+ { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); }
;
nonnull_exprlist:
expr_no_commas
- { $$ = build_expr_list (NULL_TREE, $$); }
+ { $$ = build_tree_list (NULL_TREE, $$); }
| nontrivial_exprlist
;
@@ -1083,7 +1223,7 @@ unary_expr:
/* __extension__ turns off -pedantic for following primary. */
| extension cast_expr %prec UNARY
{ $$ = $2;
- pedantic = $<itype>1; }
+ pedantic = $1; }
| '*' cast_expr %prec UNARY
{ $$ = build_x_indirect_ref ($2, "unary *"); }
| '&' cast_expr %prec UNARY
@@ -1094,18 +1234,16 @@ unary_expr:
{ $$ = finish_unary_op_expr ($1, $2); }
/* Refer to the address of a label as a pointer. */
| ANDAND identifier
- { if (pedantic)
- pedwarn ("ANSI C++ forbids `&&'");
- $$ = finish_label_address_expr ($2); }
+ { $$ = finish_label_address_expr ($2); }
| SIZEOF unary_expr %prec UNARY
- { $$ = expr_sizeof ($2); }
+ { $$ = finish_sizeof ($2); }
| SIZEOF '(' type_id ')' %prec HYPERUNARY
- { $$ = c_sizeof (groktypename ($3.t));
+ { $$ = finish_sizeof (groktypename ($3.t));
check_for_new_type ("sizeof", $3); }
| ALIGNOF unary_expr %prec UNARY
- { $$ = grok_alignof ($2); }
+ { $$ = finish_alignof ($2); }
| ALIGNOF '(' type_id ')' %prec HYPERUNARY
- { $$ = c_alignof (groktypename ($3.t));
+ { $$ = finish_alignof (groktypename ($3.t));
check_for_new_type ("alignof", $3); }
/* The %prec EMPTY's here are required by the = init initializer
@@ -1122,32 +1260,20 @@ unary_expr:
| new new_placement new_type_id new_initializer
{ $$ = build_new ($2, $3.t, $4, $1);
check_for_new_type ("new", $3); }
- /* The .begin_new_placement in the following rules is
- necessary to avoid shift/reduce conflicts that lead to
- mis-parsing some expressions. Of course, these constructs
- are not really new-placement and it is bogus to call
- begin_new_placement. But, the parser cannot always tell at this
- point whether the next thing is an expression or a type-id,
- so there is nothing we can do. Fortunately,
- begin_new_placement does nothing harmful. When we rewrite
- the parser, this lossage should be removed, of course. */
- | new '(' .begin_new_placement type_id .finish_new_placement
+ | new '(' type_id ')'
%prec EMPTY
- { $$ = build_new (NULL_TREE, groktypename($4.t),
+ { $$ = build_new (NULL_TREE, groktypename($3.t),
NULL_TREE, $1);
+ check_for_new_type ("new", $3); }
+ | new '(' type_id ')' new_initializer
+ { $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1);
+ check_for_new_type ("new", $3); }
+ | new new_placement '(' type_id ')' %prec EMPTY
+ { $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1);
check_for_new_type ("new", $4); }
- | new '(' .begin_new_placement type_id .finish_new_placement
- new_initializer
- { $$ = build_new (NULL_TREE, groktypename($4.t), $6, $1);
+ | new new_placement '(' type_id ')' new_initializer
+ { $$ = build_new ($2, groktypename($4.t), $6, $1);
check_for_new_type ("new", $4); }
- | new new_placement '(' .begin_new_placement type_id
- .finish_new_placement %prec EMPTY
- { $$ = build_new ($2, groktypename($5.t), NULL_TREE, $1);
- check_for_new_type ("new", $5); }
- | new new_placement '(' .begin_new_placement type_id
- .finish_new_placement new_initializer
- { $$ = build_new ($2, groktypename($5.t), $7, $1);
- check_for_new_type ("new", $5); }
| delete cast_expr %prec UNARY
{ $$ = delete_sanity ($2, NULL_TREE, 0, $1); }
@@ -1165,46 +1291,37 @@ unary_expr:
{ $$ = build_x_unary_op (IMAGPART_EXPR, $2); }
;
- /* Note this rule is not suitable for use in new_placement
- since it uses NULL_TREE as the argument to
- finish_new_placement. This rule serves only to avoid
- reduce/reduce conflicts in unary_expr. See the comments
- there on the use of begin/finish_new_placement. */
-.finish_new_placement:
- ')'
- { finish_new_placement (NULL_TREE, $<itype>-1); }
-
-.begin_new_placement:
- { $$ = begin_new_placement (); }
-
new_placement:
- '(' .begin_new_placement nonnull_exprlist ')'
- { $$ = finish_new_placement ($3, $2); }
- | '{' .begin_new_placement nonnull_exprlist '}'
- { cp_pedwarn ("old style placement syntax, use () instead");
- $$ = finish_new_placement ($3, $2); }
+ '(' nonnull_exprlist ')'
+ { $$ = $2; }
+ | '{' nonnull_exprlist '}'
+ { pedwarn ("old style placement syntax, use () instead");
+ $$ = $2; }
;
new_initializer:
'(' nonnull_exprlist ')'
{ $$ = $2; }
| LEFT_RIGHT
- { $$ = NULL_TREE; }
+ { $$ = void_zero_node; }
| '(' typespec ')'
{
- cp_error ("`%T' is not a valid expression", $2.t);
+ error ("`%T' is not a valid expression", $2.t);
$$ = error_mark_node;
}
/* GNU extension so people can use initializer lists. Note that
this alters the meaning of `new int = 1', which was previously
- syntactically valid but semantically invalid. */
+ syntactically valid but semantically invalid.
+ This feature is now deprecated and will be removed in a future
+ release. */
| '=' init
{
if (pedantic)
- pedwarn ("ANSI C++ forbids initialization of new expression with `='");
+ pedwarn ("ISO C++ forbids initialization of new expression with `='");
+ cp_deprecated ("new initializer lists extension");
if (TREE_CODE ($2) != TREE_LIST
&& TREE_CODE ($2) != CONSTRUCTOR)
- $$ = build_expr_list (NULL_TREE, $2);
+ $$ = build_tree_list (NULL_TREE, $2);
else
$$ = $2;
}
@@ -1231,8 +1348,8 @@ cast_expr:
tree init = build_nt (CONSTRUCTOR, NULL_TREE,
nreverse ($3));
if (pedantic)
- pedwarn ("ANSI C++ forbids constructor-expressions");
- /* Indicate that this was a GNU C constructor expression. */
+ pedwarn ("ISO C++ forbids compound literals");
+ /* Indicate that this was a C99 compound literal. */
TREE_HAS_CONSTRUCTOR (init) = 1;
$$ = reparse_absdcl_as_casts ($$, init);
@@ -1292,26 +1409,66 @@ expr_no_commas:
{ $$ = build_throw (NULL_TREE); }
| THROW expr_no_commas
{ $$ = build_throw ($2); }
-/* These extensions are not defined. The second arg to build_m_component_ref
- is old, build_m_component_ref now does an implicit
- build_indirect_ref (x, NULL_PTR) on the second argument.
- | object '&' expr_no_commas %prec UNARY
- { $$ = build_m_component_ref ($$, build_x_unary_op (ADDR_EXPR, $3)); }
- | object unop expr_no_commas %prec UNARY
- { $$ = build_m_component_ref ($$, build_x_unary_op ($2, $3)); }
- | object '(' type_id ')' expr_no_commas %prec UNARY
- { tree type = groktypename ($3.t);
- $$ = build_m_component_ref ($$, build_c_cast (type, $5)); }
- | object primary_no_id %prec UNARY
- { $$ = build_m_component_ref ($$, $2); }
-*/
+ ;
+
+expr_no_comma_rangle:
+ cast_expr
+ /* Handle general members. */
+ | expr_no_comma_rangle POINTSAT_STAR expr_no_comma_rangle
+ { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
+ | expr_no_comma_rangle DOT_STAR expr_no_comma_rangle
+ { $$ = build_m_component_ref ($$, $3); }
+ | expr_no_comma_rangle '+' expr_no_comma_rangle
+ { $$ = build_x_binary_op ($2, $$, $3); }
+ | expr_no_comma_rangle '-' expr_no_comma_rangle
+ { $$ = build_x_binary_op ($2, $$, $3); }
+ | expr_no_comma_rangle '*' expr_no_comma_rangle
+ { $$ = build_x_binary_op ($2, $$, $3); }
+ | expr_no_comma_rangle '/' expr_no_comma_rangle
+ { $$ = build_x_binary_op ($2, $$, $3); }
+ | expr_no_comma_rangle '%' expr_no_comma_rangle
+ { $$ = build_x_binary_op ($2, $$, $3); }
+ | expr_no_comma_rangle LSHIFT expr_no_comma_rangle
+ { $$ = build_x_binary_op ($2, $$, $3); }
+ | expr_no_comma_rangle RSHIFT expr_no_comma_rangle
+ { $$ = build_x_binary_op ($2, $$, $3); }
+ | expr_no_comma_rangle ARITHCOMPARE expr_no_comma_rangle
+ { $$ = build_x_binary_op ($2, $$, $3); }
+ | expr_no_comma_rangle '<' expr_no_comma_rangle
+ { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
+ | expr_no_comma_rangle EQCOMPARE expr_no_comma_rangle
+ { $$ = build_x_binary_op ($2, $$, $3); }
+ | expr_no_comma_rangle MIN_MAX expr_no_comma_rangle
+ { $$ = build_x_binary_op ($2, $$, $3); }
+ | expr_no_comma_rangle '&' expr_no_comma_rangle
+ { $$ = build_x_binary_op ($2, $$, $3); }
+ | expr_no_comma_rangle '|' expr_no_comma_rangle
+ { $$ = build_x_binary_op ($2, $$, $3); }
+ | expr_no_comma_rangle '^' expr_no_comma_rangle
+ { $$ = build_x_binary_op ($2, $$, $3); }
+ | expr_no_comma_rangle ANDAND expr_no_comma_rangle
+ { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
+ | expr_no_comma_rangle OROR expr_no_comma_rangle
+ { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
+ | expr_no_comma_rangle '?' xexpr ':' expr_no_comma_rangle
+ { $$ = build_x_conditional_expr ($$, $3, $5); }
+ | expr_no_comma_rangle '=' expr_no_comma_rangle
+ { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
+ if ($$ != error_mark_node)
+ C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
+ | expr_no_comma_rangle ASSIGN expr_no_comma_rangle
+ { $$ = build_x_modify_expr ($$, $2, $3); }
+ | THROW
+ { $$ = build_throw (NULL_TREE); }
+ | THROW expr_no_comma_rangle
+ { $$ = build_throw ($2); }
;
notype_unqualified_id:
'~' see_typename identifier
- { $$ = build_parse_node (BIT_NOT_EXPR, $3); }
+ { $$ = build_nt (BIT_NOT_EXPR, $3); }
| '~' see_typename template_type
- { $$ = build_parse_node (BIT_NOT_EXPR, $3); }
+ { $$ = build_nt (BIT_NOT_EXPR, $3); }
| template_id
| operator_name
| IDENTIFIER
@@ -1325,7 +1482,7 @@ do_id:
means that we're in an expression like S::f<int>, so
don't do_identifier; we only do that for unqualified
identifiers. */
- if (lastiddecl && TREE_CODE (lastiddecl) != TREE_LIST)
+ if (!lastiddecl || TREE_CODE (lastiddecl) != TREE_LIST)
$$ = do_identifier ($<ttype>-1, 1, NULL_TREE);
else
$$ = $<ttype>-1;
@@ -1360,16 +1517,16 @@ expr_or_declarator_intern:
{
/* Provide support for '(' attributes '*' declarator ')'
etc */
- $$ = decl_tree_cons ($1, $2, NULL_TREE);
+ $$ = tree_cons ($1, $2, NULL_TREE);
}
;
expr_or_declarator:
notype_unqualified_id
| '*' expr_or_declarator_intern %prec UNARY
- { $$ = build_parse_node (INDIRECT_REF, $2); }
+ { $$ = build_nt (INDIRECT_REF, $2); }
| '&' expr_or_declarator_intern %prec UNARY
- { $$ = build_parse_node (ADDR_EXPR, $2); }
+ { $$ = build_nt (ADDR_EXPR, $2); }
| '(' expr_or_declarator_intern ')'
{ $$ = $2; }
;
@@ -1403,8 +1560,6 @@ primary:
| boolean.literal
| string
{
- if (processing_template_decl)
- push_obstacks (&permanent_obstack, &permanent_obstack);
$$ = combine_strings ($$);
/* combine_strings doesn't set up TYPE_MAIN_VARIANT of
a const array the way we want, so fix it. */
@@ -1412,8 +1567,12 @@ primary:
TREE_TYPE ($$) = build_cplus_array_type
(TREE_TYPE (TREE_TYPE ($$)),
TYPE_DOMAIN (TREE_TYPE ($$)));
+ }
+ | VAR_FUNC_NAME
+ {
+ $$ = fname_decl (C_RID_CODE ($$), $$);
if (processing_template_decl)
- pop_obstacks ();
+ $$ = build_min_nt (LOOKUP_EXPR, DECL_NAME ($$));
}
| '(' expr ')'
{ $$ = finish_parenthesized_expr ($2); }
@@ -1430,11 +1589,11 @@ primary:
YYERROR;
}
if (pedantic)
- pedwarn ("ANSI C++ forbids braced-groups within expressions");
+ pedwarn ("ISO C++ forbids braced-groups within expressions");
$<ttype>$ = begin_stmt_expr ();
}
compstmt ')'
- { $$ = finish_stmt_expr ($<ttype>2, $3); }
+ { $$ = finish_stmt_expr ($<ttype>2); }
/* Koenig lookup support
We could store lastiddecl in $1 to avoid another lookup,
but that would result in many additional reduce/reduce conflicts. */
@@ -1446,6 +1605,9 @@ primary:
{ $$ = finish_call_expr ($1, $3, 0); }
| primary LEFT_RIGHT
{ $$ = finish_call_expr ($1, NULL_TREE, 0); }
+ | VA_ARG '(' expr_no_commas ',' type_id ')'
+ { $$ = build_x_va_arg ($3, groktypename ($5.t));
+ check_for_new_type ("__builtin_va_arg", $5); }
| primary '[' expr ']'
{ $$ = grok_array_decl ($$, $3); }
| primary PLUSPLUS
@@ -1462,15 +1624,9 @@ primary:
`const (3)' is equivalent to `const int (3)'. */
tree type;
- if ($3 == error_mark_node)
- {
- $$ = error_mark_node;
- break;
- }
-
- type = cp_build_qualified_type (integer_type_node,
- cp_type_qual_from_rid ($1));
- $$ = build_c_cast (type, build_compound_expr ($3));
+ type = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
+ type = groktypename (build_tree_list (type, NULL_TREE));
+ $$ = build_functional_cast (type, $3);
}
| functional_cast
| DYNAMIC_CAST '<' type_id '>' '(' expr ')'
@@ -1490,11 +1646,11 @@ primary:
check_for_new_type ("const_cast", $3);
$$ = build_const_cast (type, $6); }
| TYPEID '(' expr ')'
- { $$ = build_x_typeid ($3); }
+ { $$ = build_typeid ($3); }
| TYPEID '(' type_id ')'
{ tree type = groktypename ($3.t);
check_for_new_type ("typeid", $3);
- $$ = get_typeid (TYPE_MAIN_VARIANT (type)); }
+ $$ = get_typeid (type); }
| global_scope IDENTIFIER
{ $$ = do_scoped_id ($2, 1); }
| global_scope template_id
@@ -1525,7 +1681,7 @@ primary:
{ $$ = build_x_component_ref ($$, $2, NULL_TREE, 1); }
| object overqualified_id %prec UNARY
{ if (processing_template_decl)
- $$ = build_min_nt (COMPONENT_REF, $1, copy_to_permanent ($2));
+ $$ = build_min_nt (COMPONENT_REF, $1, $2);
else
$$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); }
| object unqualified_id '(' nonnull_exprlist ')'
@@ -1563,7 +1719,7 @@ primary_no_id:
$<ttype>$ = expand_start_stmt_expr (); }
compstmt ')'
{ if (pedantic)
- pedwarn ("ANSI C++ forbids braced-groups within expressions");
+ pedwarn ("ISO C++ forbids braced-groups within expressions");
$$ = expand_end_stmt_expr ($<ttype>2); }
| primary_no_id '(' nonnull_exprlist ')'
{ $$ = build_x_function_call ($$, $3, current_class_ref); }
@@ -1616,13 +1772,8 @@ string:
nodecls:
/* empty */
{
- if (! current_function_parms_stored)
- store_parm_decls ();
- setup_vtbl_ptr ();
- /* Always keep the BLOCK node associated with the outermost
- pair of curley braces of a function. These are needed
- for correct operation of dwarfout.c. */
- keep_next_level ();
+ if (DECL_CONSTRUCTOR_P (current_function_decl))
+ finish_mem_initializers (NULL_TREE);
}
;
@@ -1639,17 +1790,15 @@ object:
decl:
typespec initdecls ';'
{
- resume_momentary ($2);
if ($1.t && IS_AGGR_TYPE_CODE (TREE_CODE ($1.t)))
note_got_semicolon ($1.t);
}
| typed_declspecs initdecls ';'
{
- resume_momentary ($2);
note_list_got_semicolon ($1.t);
}
| declmods notype_initdecls ';'
- { resume_momentary ($2); }
+ {}
| typed_declspecs ';'
{
shadow_tag ($1.t);
@@ -1658,7 +1807,7 @@ decl:
| declmods ';'
{ warning ("empty declaration"); }
| extension decl
- { pedantic = $<itype>1; }
+ { pedantic = $1; }
;
/* Any kind of declarator (thus, all declarators allowed
@@ -1679,23 +1828,23 @@ fcast_or_absdcl:
NULL_TREE); }
;
-/* ANSI type-id (8.1) */
+/* ISO type-id (8.1) */
type_id:
typed_typespecs absdcl
- { $$.t = build_decl_list ($1.t, $2);
+ { $$.t = build_tree_list ($1.t, $2);
$$.new_type_flag = $1.new_type_flag; }
| nonempty_cv_qualifiers absdcl
- { $$.t = build_decl_list ($1.t, $2);
+ { $$.t = build_tree_list ($1.t, $2);
$$.new_type_flag = $1.new_type_flag; }
| typespec absdcl
- { $$.t = build_decl_list (build_decl_list (NULL_TREE, $1.t),
+ { $$.t = build_tree_list (build_tree_list (NULL_TREE, $1.t),
$2);
$$.new_type_flag = $1.new_type_flag; }
| typed_typespecs %prec EMPTY
- { $$.t = build_decl_list ($1.t, NULL_TREE);
+ { $$.t = build_tree_list ($1.t, NULL_TREE);
$$.new_type_flag = $1.new_type_flag; }
| nonempty_cv_qualifiers %prec EMPTY
- { $$.t = build_decl_list ($1.t, NULL_TREE);
+ { $$.t = build_tree_list ($1.t, NULL_TREE);
$$.new_type_flag = $1.new_type_flag; }
;
@@ -1706,28 +1855,30 @@ type_id:
typed_declspecs:
typed_typespecs %prec EMPTY
+ { $$.lookups = type_lookups; }
| typed_declspecs1
+ { $$.lookups = type_lookups; }
;
typed_declspecs1:
declmods typespec
- { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1);
+ { $$.t = tree_cons (NULL_TREE, $2.t, $1.t);
$$.new_type_flag = $2.new_type_flag; }
| typespec reserved_declspecs %prec HYPERUNARY
- { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
+ { $$.t = tree_cons (NULL_TREE, $1.t, $2);
$$.new_type_flag = $1.new_type_flag; }
| typespec reserved_typespecquals reserved_declspecs
- { $$.t = decl_tree_cons (NULL_TREE, $1.t, chainon ($2, $3));
+ { $$.t = tree_cons (NULL_TREE, $1.t, chainon ($2, $3));
$$.new_type_flag = $1.new_type_flag; }
| declmods typespec reserved_declspecs
- { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1));
+ { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
$$.new_type_flag = $2.new_type_flag; }
| declmods typespec reserved_typespecquals
- { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1));
+ { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
$$.new_type_flag = $2.new_type_flag; }
| declmods typespec reserved_typespecquals reserved_declspecs
- { $$.t = decl_tree_cons (NULL_TREE, $2.t,
- chainon ($3, chainon ($4, $1)));
+ { $$.t = tree_cons (NULL_TREE, $2.t,
+ chainon ($3, chainon ($4, $1.t)));
$$.new_type_flag = $2.new_type_flag; }
;
@@ -1736,18 +1887,18 @@ reserved_declspecs:
{ if (extra_warnings)
warning ("`%s' is not at beginning of declaration",
IDENTIFIER_POINTER ($$));
- $$ = build_decl_list (NULL_TREE, $$); }
+ $$ = build_tree_list (NULL_TREE, $$); }
| reserved_declspecs typespecqual_reserved
- { $$ = decl_tree_cons (NULL_TREE, $2.t, $$); }
+ { $$ = tree_cons (NULL_TREE, $2.t, $$); }
| reserved_declspecs SCSPEC
{ if (extra_warnings)
warning ("`%s' is not at beginning of declaration",
IDENTIFIER_POINTER ($2));
- $$ = decl_tree_cons (NULL_TREE, $2, $$); }
+ $$ = tree_cons (NULL_TREE, $2, $$); }
| reserved_declspecs attributes
- { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
+ { $$ = tree_cons ($2, NULL_TREE, $1); }
| attributes
- { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
+ { $$ = tree_cons ($1, NULL_TREE, NULL_TREE); }
;
/* List of just storage classes and type modifiers.
@@ -1766,22 +1917,27 @@ reserved_declspecs:
declmods:
nonempty_cv_qualifiers %prec EMPTY
- { $$ = $1.t; TREE_STATIC ($$) = 1; }
+ { $$.lookups = NULL_TREE; TREE_STATIC ($$.t) = 1; }
| SCSPEC
- { $$ = hash_tree_cons (NULL_TREE, $$, NULL_TREE); }
+ {
+ $$.t = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
+ $$.new_type_flag = 0; $$.lookups = NULL_TREE;
+ }
| declmods CV_QUALIFIER
- { $$ = hash_tree_cons (NULL_TREE, $2, $$);
- TREE_STATIC ($$) = 1; }
+ {
+ $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
+ TREE_STATIC ($$.t) = 1;
+ }
| declmods SCSPEC
- { if (extra_warnings && TREE_STATIC ($$))
+ {
+ if (extra_warnings && TREE_STATIC ($$.t))
warning ("`%s' is not at beginning of declaration",
IDENTIFIER_POINTER ($2));
- $$ = hash_tree_cons (NULL_TREE, $2, $$);
- TREE_STATIC ($$) = TREE_STATIC ($1); }
+ $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
+ TREE_STATIC ($$.t) = TREE_STATIC ($1.t);
+ }
| declmods attributes
- { $$ = hash_tree_cons ($2, NULL_TREE, $1); }
- | attributes %prec EMPTY
- { $$ = hash_tree_cons ($1, NULL_TREE, NULL_TREE); }
+ { $$.t = hash_tree_cons ($2, NULL_TREE, $1.t); }
;
/* Used instead of declspecs where storage classes are not allowed
@@ -1792,24 +1948,24 @@ declmods:
typed_typespecs:
typespec %prec EMPTY
- { $$.t = build_decl_list (NULL_TREE, $1.t);
+ { $$.t = build_tree_list (NULL_TREE, $1.t);
$$.new_type_flag = $1.new_type_flag; }
| nonempty_cv_qualifiers typespec
- { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1.t);
+ { $$.t = tree_cons (NULL_TREE, $2.t, $1.t);
$$.new_type_flag = $2.new_type_flag; }
| typespec reserved_typespecquals
- { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
+ { $$.t = tree_cons (NULL_TREE, $1.t, $2);
$$.new_type_flag = $1.new_type_flag; }
| nonempty_cv_qualifiers typespec reserved_typespecquals
- { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
- $$.new_type_flag = $1.new_type_flag; }
+ { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
+ $$.new_type_flag = $2.new_type_flag; }
;
reserved_typespecquals:
typespecqual_reserved
- { $$ = build_decl_list (NULL_TREE, $1.t); }
+ { $$ = build_tree_list (NULL_TREE, $1.t); }
| reserved_typespecquals typespecqual_reserved
- { $$ = decl_tree_cons (NULL_TREE, $2.t, $1); }
+ { $$ = tree_cons (NULL_TREE, $2.t, $1); }
;
/* A typespec (but not a type qualifier).
@@ -1818,20 +1974,21 @@ reserved_typespecquals:
typespec:
structsp
+ { $$.lookups = NULL_TREE; }
| TYPESPEC %prec EMPTY
- { $$.t = $1; $$.new_type_flag = 0; }
+ { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
| complete_type_name
- { $$.t = $1; $$.new_type_flag = 0; }
+ { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
| TYPEOF '(' expr ')'
{ $$.t = finish_typeof ($3);
- $$.new_type_flag = 0; }
+ $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
| TYPEOF '(' type_id ')'
{ $$.t = groktypename ($3.t);
- $$.new_type_flag = 0; }
+ $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
| SIGOF '(' expr ')'
{ tree type = TREE_TYPE ($3);
- $$.new_type_flag = 0;
+ $$.new_type_flag = 0; $$.lookups = NULL_TREE;
if (IS_AGGR_TYPE (type))
{
sorry ("sigof type specifier");
@@ -1846,7 +2003,7 @@ typespec:
| SIGOF '(' type_id ')'
{ tree type = groktypename ($3.t);
- $$.new_type_flag = 0;
+ $$.new_type_flag = 0; $$.lookups = NULL_TREE;
if (IS_AGGR_TYPE (type))
{
sorry ("sigof type specifier");
@@ -1897,15 +2054,15 @@ maybeasm:
initdcl:
declarator maybeasm maybe_attribute '='
- { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1,
- $3, prefix_attributes); }
+ { $<ttype>$ = parse_decl ($<ttype>1, $3, 1); }
init
/* Note how the declaration of the variable is in effect while its init is parsed! */
- { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING); }
+ { parse_end_decl ($<ttype>5, $6, $2); }
| declarator maybeasm maybe_attribute
- { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 0,
- $3, prefix_attributes);
- cp_finish_decl ($<ttype>$, NULL_TREE, $2, 1, 0); }
+ {
+ $<ttype>$ = parse_decl ($<ttype>1, $3, 0);
+ parse_end_decl ($<ttype>$, NULL_TREE, $2);
+ }
;
/* This rule assumes a certain configuration of the parser stack.
@@ -1916,40 +2073,40 @@ initdcl:
we need that reduce so we prefer fn.def1 when appropriate. */
initdcl0_innards:
maybe_attribute '='
- { $<itype>2 = parse_decl ($<ttype>-1, $<ttype>-2,
- $1, 1, &$<ttype>$); }
+ { $<ttype>$ = parse_decl0 ($<ttype>-1, $<ftype>-2.t,
+ $<ftype>-2.lookups, $1, 1); }
/* Note how the declaration of the variable is in effect
while its init is parsed! */
init
- { cp_finish_decl ($<ttype>3, $4, $<ttype>0, 1,
- LOOKUP_ONLYCONVERTING);
- $$ = $<itype>2; }
+ { parse_end_decl ($<ttype>3, $4, $<ttype>0); }
| maybe_attribute
- { tree d;
- $$ = parse_decl ($<ttype>-1, $<ttype>-2, $1, 0, &d);
- cp_finish_decl (d, NULL_TREE, $<ttype>0, 1, 0); }
+ { tree d = parse_decl0 ($<ttype>-1, $<ftype>-2.t,
+ $<ftype>-2.lookups, $1, 0);
+ parse_end_decl (d, NULL_TREE, $<ttype>0); }
;
initdcl0:
declarator maybeasm initdcl0_innards
- { $$ = $3; }
-
+ {}
+ ;
+
notype_initdcl0:
notype_declarator maybeasm initdcl0_innards
- { $$ = $3; }
+ {}
;
nomods_initdcl0:
notype_declarator maybeasm
{ /* Set things up as initdcl0_innards expects. */
- $<ttype>2 = $1;
- $1 = NULL_TREE; }
+ $<ttype>3 = $2;
+ $2 = $1;
+ $<ftype>1.t = NULL_TREE;
+ $<ftype>1.lookups = NULL_TREE; }
initdcl0_innards
{}
| constructor_declarator maybeasm maybe_attribute
- { tree d;
- parse_decl($1, NULL_TREE, $3, 0, &d);
- cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
+ { tree d = parse_decl0 ($1, NULL_TREE, NULL_TREE, $3, 0);
+ parse_end_decl (d, NULL_TREE, $2); }
;
/* the * rules are dummies to accept the Apollo extended syntax
@@ -2041,39 +2198,31 @@ initlist:
init
{ $$ = build_tree_list (NULL_TREE, $$); }
| initlist ',' init
- { $$ = expr_tree_cons (NULL_TREE, $3, $$); }
+ { $$ = tree_cons (NULL_TREE, $3, $$); }
/* These are for labeled elements. */
| '[' expr_no_commas ']' init
- { $$ = build_expr_list ($2, $4); }
+ { $$ = build_tree_list ($2, $4); }
| identifier ':' init
- { $$ = build_expr_list ($$, $3); }
+ { $$ = build_tree_list ($$, $3); }
| initlist ',' identifier ':' init
- { $$ = expr_tree_cons ($3, $5, $$); }
+ { $$ = tree_cons ($3, $5, $$); }
;
-fn.defpen:
- PRE_PARSED_FUNCTION_DECL
- { start_function (NULL_TREE, TREE_VALUE ($1),
- NULL_TREE, 2);
- reinit_parse_for_function (); }
-
pending_inline:
- fn.defpen maybe_return_init ctor_initializer_opt compstmt_or_error
+ PRE_PARSED_FUNCTION_DECL maybe_return_init function_body
{
- int nested = (hack_decl_function_context
- (current_function_decl) != NULL_TREE);
- finish_function (lineno, (int)$3 | 2, nested);
+ expand_body (finish_function (2));
process_next_inline ($1);
}
- | fn.defpen maybe_return_init function_try_block
+ | PRE_PARSED_FUNCTION_DECL maybe_return_init function_try_block
{
- int nested = (hack_decl_function_context
- (current_function_decl) != NULL_TREE);
- finish_function (lineno, (int)$3 | 2, nested);
+ expand_body (finish_function (2));
process_next_inline ($1);
}
- | fn.defpen maybe_return_init error
- { process_next_inline ($1); }
+ | PRE_PARSED_FUNCTION_DECL maybe_return_init error
+ {
+ finish_function (2);
+ process_next_inline ($1); }
;
pending_inlines:
@@ -2099,34 +2248,22 @@ pending_defargs:
structsp:
ENUM identifier '{'
- { $<itype>3 = suspend_momentary ();
- $<ttype>$ = current_enum_type;
+ { $<ttype>$ = current_enum_type;
current_enum_type = start_enum ($2); }
- enumlist maybecomma_warn '}'
- { TYPE_VALUES (current_enum_type) = $5;
- $$.t = finish_enum (current_enum_type);
+ enumlist_opt '}'
+ { $$.t = current_enum_type;
+ finish_enum (current_enum_type);
$$.new_type_flag = 1;
current_enum_type = $<ttype>4;
- resume_momentary ((int) $<itype>3);
- check_for_missing_semicolon ($$.t); }
- | ENUM identifier '{' '}'
- { $$.t = finish_enum (start_enum ($2));
- $$.new_type_flag = 1;
check_for_missing_semicolon ($$.t); }
| ENUM '{'
- { $<itype>2 = suspend_momentary ();
- $<ttype>$ = current_enum_type;
+ { $<ttype>$ = current_enum_type;
current_enum_type = start_enum (make_anon_name ()); }
- enumlist maybecomma_warn '}'
- { TYPE_VALUES (current_enum_type) = $4;
- $$.t = finish_enum (current_enum_type);
+ enumlist_opt '}'
+ { $$.t = current_enum_type;
+ finish_enum (current_enum_type);
$$.new_type_flag = 1;
current_enum_type = $<ttype>3;
- resume_momentary ((int) $<itype>1);
- check_for_missing_semicolon ($$.t); }
- | ENUM '{' '}'
- { $$.t = finish_enum (start_enum (make_anon_name()));
- $$.new_type_flag = 1;
check_for_missing_semicolon ($$.t); }
| ENUM identifier
{ $$.t = xref_tag (enum_type_node, $2, 1);
@@ -2138,50 +2275,57 @@ structsp:
{ $$.t = $2;
$$.new_type_flag = 0;
if (!processing_template_decl)
- cp_pedwarn ("using `typename' outside of template"); }
+ pedwarn ("using `typename' outside of template"); }
/* C++ extensions, merged with C to avoid shift/reduce conflicts */
- | class_head '{'
- { $1.t = begin_class_definition ($1.t); }
+ | class_head_defn maybe_base_class_list '{'
+ {
+ if ($2 && $1.t != error_mark_node)
+ {
+ tree type = TREE_TYPE ($1.t);
+
+ if (TREE_CODE (type) == TYPENAME_TYPE)
+ /* In a definition of a member class template,
+ we will get here with an implicit typename,
+ a TYPENAME_TYPE with a type. */
+ type = TREE_TYPE (type);
+ maybe_process_partial_specialization (type);
+ xref_basetypes (current_aggr, $1.t, type, $2);
+ }
+ $1.t = begin_class_definition (TREE_TYPE ($1.t));
+ current_aggr = NULL_TREE; }
opt.component_decl_list '}' maybe_attribute
{
int semi;
+ tree t;
if (yychar == YYEMPTY)
yychar = YYLEX;
semi = yychar == ';';
- $<ttype>$ = finish_class_definition ($1.t, $6, semi,
- $1.new_type_flag);
+ t = finish_class_definition ($1.t, $7, semi, $1.new_type_flag);
+ $<ttype>$ = t;
+
+ /* restore current_aggr */
+ current_aggr = TREE_CODE (t) != RECORD_TYPE
+ ? union_type_node
+ : CLASSTYPE_DECLARED_CLASS (t)
+ ? class_type_node : record_type_node;
}
pending_defargs
{
+ done_pending_defargs ();
begin_inline_definitions ();
}
pending_inlines
{
finish_inline_definitions ();
- $$.t = $<ttype>7;
+ $$.t = $<ttype>8;
$$.new_type_flag = 1;
}
- | class_head %prec EMPTY
+ | class_head_decl
{
- if ($1.new_type_flag)
- pop_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL ($1.t)));
- $$.new_type_flag = 0;
- if (TYPE_BINFO ($1.t) == NULL_TREE)
- {
- cp_error ("%T is not a class type", $1.t);
- $$.t = error_mark_node;
- }
- else
- {
- $$.t = $1.t;
- /* struct B: public A; is not accepted by the WP grammar. */
- if (TYPE_BINFO_BASETYPES ($$.t) && !TYPE_SIZE ($$.t)
- && ! TYPE_BEING_DEFINED ($$.t))
- cp_error ("base clause without member specification for `%#T'",
- $$.t);
- }
+ $$.t = TREE_TYPE ($1.t);
+ $$.new_type_flag = $1.new_type_flag;
}
;
@@ -2208,131 +2352,139 @@ aggr:
| aggr AGGR
{ error ("no body nor ';' separates two class, struct or union declarations"); }
| aggr attributes
- { $$ = build_decl_list ($2, $1); }
+ { $$ = build_tree_list ($2, $1); }
;
-named_class_head_sans_basetype:
+class_head:
aggr identifier
- {
- current_aggr = $1;
- $$ = $2;
+ {
+ current_aggr = $1;
+ $$ = build_tree_list (NULL_TREE, $2);
}
- ;
-
-named_class_head_sans_basetype_defn:
- aggr identifier_defn %prec EMPTY
- { current_aggr = $$; $$ = $2; }
- | named_class_head_sans_basetype '{'
- { yyungetc ('{', 1); }
- | named_class_head_sans_basetype ':'
- { yyungetc (':', 1); }
- ;
-
-named_complex_class_head_sans_basetype:
- aggr nested_name_specifier identifier
+ | aggr nested_name_specifier identifier
{
current_aggr = $1;
- $$.t = handle_class_head ($1, $2, $3);
- $$.new_type_flag = 1;
+ $$ = build_tree_list ($2, $3);
}
| aggr global_scope nested_name_specifier identifier
{
current_aggr = $1;
- $$.t = handle_class_head ($1, $3, $4);
- $$.new_type_flag = 1;
+ $$ = build_tree_list ($3, $4);
}
| aggr global_scope identifier
{
current_aggr = $1;
- $$.t = handle_class_head ($1, NULL_TREE, $3);
- $$.new_type_flag = 1;
+ $$ = build_tree_list (global_namespace, $3);
}
- | aggr apparent_template_type
+ ;
+
+class_head_apparent_template:
+ aggr apparent_template_type
{
current_aggr = $1;
- $$.t = $2;
- $$.new_type_flag = 0;
+ $$ = $2;
}
| aggr nested_name_specifier apparent_template_type
{
current_aggr = $1;
- $$.t = $3;
- if (CP_DECL_CONTEXT ($$.t))
- push_scope (CP_DECL_CONTEXT ($$.t));
- $$.new_type_flag = 1;
+ $$ = $3;
+ }
+ | aggr global_scope nested_name_specifier apparent_template_type
+ {
+ current_aggr = $1;
+ $$ = $4;
}
;
-named_class_head:
- named_class_head_sans_basetype %prec EMPTY
- {
- $$.t = xref_tag (current_aggr, $1, 1);
- $$.new_type_flag = 0;
+class_head_decl:
+ class_head %prec EMPTY
+ {
+ $$.t = handle_class_head (current_aggr,
+ TREE_PURPOSE ($1), TREE_VALUE ($1),
+ 0, &$$.new_type_flag);
}
- | named_class_head_sans_basetype_defn
- { $<ttype>$ = xref_tag (current_aggr, $1, 0); }
- /* Class name is unqualified, so we look for base classes
- in the current scope. */
- maybe_base_class_list %prec EMPTY
- {
- $$.t = $<ttype>2;
- $$.new_type_flag = 0;
- if ($3)
- xref_basetypes (current_aggr, $1, $<ttype>2, $3);
+ | aggr identifier_defn %prec EMPTY
+ {
+ current_aggr = $1;
+ $$.t = TYPE_MAIN_DECL (xref_tag (current_aggr, $2, 0));
+ $$.new_type_flag = 1;
}
- | named_complex_class_head_sans_basetype
- maybe_base_class_list
- {
- if ($1.t != error_mark_node)
- {
- $$.t = TREE_TYPE ($1.t);
- $$.new_type_flag = $1.new_type_flag;
- if (current_aggr == union_type_node
- && TREE_CODE ($$.t) != UNION_TYPE)
- cp_pedwarn ("`union' tag used in declaring `%#T'",
- $$.t);
- else if (TREE_CODE ($$.t) == UNION_TYPE
- && current_aggr != union_type_node)
- cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
- else if (TREE_CODE ($$.t) == RECORD_TYPE)
- /* We might be specializing a template with a different
- class-key; deal. */
- CLASSTYPE_DECLARED_CLASS ($$.t)
- = (current_aggr == class_type_node);
- if ($2)
- {
- maybe_process_partial_specialization ($$.t);
- xref_basetypes (current_aggr, $1.t, $$.t, $2);
- }
- }
+ | class_head_apparent_template %prec EMPTY
+ {
+ $$.t = $1;
+ $$.new_type_flag = 0;
}
;
-unnamed_class_head:
- aggr '{'
- { $$ = xref_tag ($$, make_anon_name (), 0);
- yyungetc ('{', 1); }
- ;
-
-/* The tree output of this nonterminal a declarationf or the type
- named. If NEW_TYPE_FLAG is set, then the name used in this
- class-head was explicitly qualified, e.g.: `struct X::Y'. We have
- already called push_scope for X. */
-class_head:
- unnamed_class_head
- {
+class_head_defn:
+ class_head '{'
+ {
+ yyungetc ('{', 1);
+ $$.t = handle_class_head (current_aggr,
+ TREE_PURPOSE ($1), TREE_VALUE ($1),
+ 1, &$$.new_type_flag);
+ }
+ | class_head ':'
+ {
+ yyungetc (':', 1);
+ $$.t = handle_class_head (current_aggr,
+ TREE_PURPOSE ($1), TREE_VALUE ($1),
+ 1, &$$.new_type_flag);
+ }
+ | class_head_apparent_template '{'
+ {
+ yyungetc ('{', 1);
$$.t = $1;
$$.new_type_flag = 0;
+ if (TREE_CODE (TREE_TYPE ($1)) == RECORD_TYPE)
+ /* We might be specializing a template with a different
+ class-key. */
+ CLASSTYPE_DECLARED_CLASS (TREE_TYPE ($1))
+ = (current_aggr == class_type_node);
+ }
+ | class_head_apparent_template ':'
+ {
+ yyungetc (':', 1);
+ $$.t = $1;
+ $$.new_type_flag = 0;
+ if (TREE_CODE (TREE_TYPE ($1)) == RECORD_TYPE)
+ /* We might be specializing a template with a different
+ class-key. */
+ CLASSTYPE_DECLARED_CLASS (TREE_TYPE ($1))
+ = (current_aggr == class_type_node);
+ }
+ | aggr identifier_defn '{'
+ {
+ yyungetc ('{', 1);
+ current_aggr = $1;
+ $$.t = handle_class_head (current_aggr,
+ NULL_TREE, $2,
+ 1, &$$.new_type_flag);
+ }
+ | aggr identifier_defn ':'
+ {
+ yyungetc (':', 1);
+ current_aggr = $1;
+ $$.t = handle_class_head (current_aggr,
+ NULL_TREE, $2,
+ 1, &$$.new_type_flag);
+ }
+ | aggr '{'
+ {
+ current_aggr = $1;
+ $$.t = TYPE_MAIN_DECL (xref_tag ($1, make_anon_name (), 0));
+ $$.new_type_flag = 0;
+ yyungetc ('{', 1);
}
- | named_class_head
;
maybe_base_class_list:
- /* empty */ %prec EMPTY
+ /* empty */
{ $$ = NULL_TREE; }
- | ':' see_typename %prec EMPTY
- { yyungetc(':', 1); $$ = NULL_TREE; }
- | ':' see_typename base_class_list %prec EMPTY
+ | ':' see_typename
+ { error ("no bases given following `:'");
+ $$ = NULL_TREE; }
+ | ':' see_typename base_class_list
{ $$ = $3; }
;
@@ -2344,68 +2496,24 @@ base_class_list:
base_class:
base_class.1
- { $$ = finish_base_specifier (access_default_node, $1,
- current_aggr
- == signature_type_node); }
+ { $$ = finish_base_specifier (access_default_node, $1); }
| base_class_access_list see_typename base_class.1
- { $$ = finish_base_specifier ($1, $3,
- current_aggr
- == signature_type_node); }
+ { $$ = finish_base_specifier ($1, $3); }
;
base_class.1:
typename_sub
- { if ($$ != error_mark_node) $$ = TYPE_MAIN_DECL ($1); }
+ { if (!TYPE_P ($$))
+ $$ = error_mark_node; }
| nonnested_type
- | SIGOF '(' expr ')'
- {
- if (current_aggr == signature_type_node)
- {
- if (IS_AGGR_TYPE (TREE_TYPE ($3)))
- {
- sorry ("`sigof' as base signature specifier");
- $$ = TREE_TYPE ($3);
- }
- else
- {
- error ("`sigof' applied to non-aggregate expression");
- $$ = error_mark_node;
- }
- }
- else
- {
- error ("`sigof' in struct or class declaration");
- $$ = error_mark_node;
- }
- }
- | SIGOF '(' type_id ')'
- {
- if (current_aggr == signature_type_node)
- {
- if (IS_AGGR_TYPE (groktypename ($3.t)))
- {
- sorry ("`sigof' as base signature specifier");
- $$ = groktypename ($3.t);
- }
- else
- {
- error ("`sigof' applied to non-aggregate expression");
- $$ = error_mark_node;
- }
- }
- else
- {
- error ("`sigof' in struct or class declaration");
- $$ = error_mark_node;
- }
- }
+ { $$ = TREE_TYPE ($$); }
;
base_class_access_list:
VISSPEC see_typename
| SCSPEC see_typename
{ if ($1 != ridpointers[(int)RID_VIRTUAL])
- cp_error ("`%D' access", $1);
+ error ("`%D' access", $1);
$$ = access_default_virtual_node; }
| base_class_access_list VISSPEC see_typename
{
@@ -2420,7 +2528,7 @@ base_class_access_list:
}
| base_class_access_list SCSPEC see_typename
{ if ($2 != ridpointers[(int)RID_VIRTUAL])
- cp_error ("`%D' access", $2);
+ error ("`%D' access", $2);
else if ($$ == access_public_node)
$$ = access_public_virtual_node;
else if ($$ == access_protected_node)
@@ -2441,12 +2549,6 @@ opt.component_decl_list:
access_specifier:
VISSPEC ':'
{
- if (current_aggr == signature_type_node)
- {
- error ("access specifier not allowed in signature");
- $1 = access_public_node;
- }
-
current_access_specifier = $1;
}
;
@@ -2457,10 +2559,14 @@ component_decl_list:
component_decl
{
finish_member_declaration ($1);
+ current_aggr = NULL_TREE;
+ reset_type_access_control ();
}
| component_decl_list component_decl
{
finish_member_declaration ($2);
+ current_aggr = NULL_TREE;
+ reset_type_access_control ();
}
;
@@ -2483,7 +2589,7 @@ component_decl:
{ $$ = NULL_TREE; }
| extension component_decl
{ $$ = $2;
- pedantic = $<itype>1; }
+ pedantic = $1; }
| template_header component_decl
{
if ($2)
@@ -2499,6 +2605,8 @@ component_decl:
$$ = finish_member_class_template ($2.t);
finish_template_decl ($1);
}
+ | bad_decl
+ { $$ = NULL_TREE; }
;
component_decl_1:
@@ -2529,15 +2637,13 @@ component_decl_1:
| declmods notype_components
{
if (!$2)
- grok_x_components ($1);
+ grok_x_components ($1.t);
$$ = NULL_TREE;
}
| notype_declarator maybeasm maybe_attribute maybe_init
- { $$ = grokfield ($$, NULL_TREE, $4, $2,
- build_tree_list ($3, NULL_TREE)); }
+ { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); }
| constructor_declarator maybeasm maybe_attribute maybe_init
- { $$ = grokfield ($$, NULL_TREE, $4, $2,
- build_tree_list ($3, NULL_TREE)); }
+ { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); }
| ':' expr_no_commas
{ $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
| error
@@ -2553,12 +2659,11 @@ component_decl_1:
parmlist? */
| declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
{ tree specs, attrs;
- split_specs_attrs ($1, &specs, &attrs);
+ split_specs_attrs ($1.t, &specs, &attrs);
$$ = grokfield ($2, specs, $5, $3,
- build_tree_list ($4, attrs)); }
+ chainon ($4, attrs)); }
| component_constructor_declarator maybeasm maybe_attribute maybe_init
- { $$ = grokfield ($$, NULL_TREE, $4, $2,
- build_tree_list ($3, NULL_TREE)); }
+ { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); }
| using_decl
{ $$ = do_class_using_decl ($1); }
@@ -2616,65 +2721,47 @@ component_declarator:
after_type_component_declarator0:
after_type_declarator maybeasm maybe_attribute maybe_init
- { split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- $<ttype>0 = current_declspecs;
- $$ = grokfield ($$, current_declspecs, $4, $2,
- build_tree_list ($3, prefix_attributes)); }
+ { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
+ $3, $2, $4); }
| TYPENAME ':' expr_no_commas maybe_attribute
- { split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- $<ttype>0 = current_declspecs;
- $$ = grokbitfield ($$, current_declspecs, $3);
- cplus_decl_attributes ($$, $4, prefix_attributes); }
+ { $$ = parse_bitfield0 ($1, $<ftype>0.t, $<ftype>0.lookups,
+ $4, $3); }
;
notype_component_declarator0:
notype_declarator maybeasm maybe_attribute maybe_init
- { split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- $<ttype>0 = current_declspecs;
- $$ = grokfield ($$, current_declspecs, $4, $2,
- build_tree_list ($3, prefix_attributes)); }
+ { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
+ $3, $2, $4); }
| constructor_declarator maybeasm maybe_attribute maybe_init
- { split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- $<ttype>0 = current_declspecs;
- $$ = grokfield ($$, current_declspecs, $4, $2,
- build_tree_list ($3, prefix_attributes)); }
+ { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
+ $3, $2, $4); }
| IDENTIFIER ':' expr_no_commas maybe_attribute
- { split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- $<ttype>0 = current_declspecs;
- $$ = grokbitfield ($$, current_declspecs, $3);
- cplus_decl_attributes ($$, $4, prefix_attributes); }
+ { $$ = parse_bitfield0 ($1, $<ftype>0.t, $<ftype>0.lookups,
+ $4, $3); }
| ':' expr_no_commas maybe_attribute
- { split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- $<ttype>0 = current_declspecs;
- $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
- cplus_decl_attributes ($$, $3, prefix_attributes); }
+ { $$ = parse_bitfield0 (NULL_TREE, $<ftype>0.t,
+ $<ftype>0.lookups, $3, $2); }
;
after_type_component_declarator:
after_type_declarator maybeasm maybe_attribute maybe_init
- { $$ = grokfield ($$, current_declspecs, $4, $2,
- build_tree_list ($3, prefix_attributes)); }
+ { $$ = parse_field ($1, $3, $2, $4); }
| TYPENAME ':' expr_no_commas maybe_attribute
- { $$ = grokbitfield ($$, current_declspecs, $3);
- cplus_decl_attributes ($$, $4, prefix_attributes); }
+ { $$ = parse_bitfield ($1, $4, $3); }
;
notype_component_declarator:
notype_declarator maybeasm maybe_attribute maybe_init
- { $$ = grokfield ($$, current_declspecs, $4, $2,
- build_tree_list ($3, prefix_attributes)); }
+ { $$ = parse_field ($1, $3, $2, $4); }
| IDENTIFIER ':' expr_no_commas maybe_attribute
- { $$ = grokbitfield ($$, current_declspecs, $3);
- cplus_decl_attributes ($$, $4, prefix_attributes); }
+ { $$ = parse_bitfield ($1, $4, $3); }
| ':' expr_no_commas maybe_attribute
- { $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
- cplus_decl_attributes ($$, $3, prefix_attributes); }
+ { $$ = parse_bitfield (NULL_TREE, $3, $2); }
+ ;
+
+enumlist_opt:
+ enumlist maybecomma_warn
+ | maybecomma_warn
;
/* We chain the enumerators in reverse order.
@@ -2684,35 +2771,32 @@ notype_component_declarator:
enumlist:
enumerator
| enumlist ',' enumerator
- { TREE_CHAIN ($3) = $$; $$ = $3; }
;
enumerator:
identifier
- { $$ = build_enumerator ($$, NULL_TREE, current_enum_type); }
+ { build_enumerator ($1, NULL_TREE, current_enum_type); }
| identifier '=' expr_no_commas
- { $$ = build_enumerator ($$, $3, current_enum_type); }
+ { build_enumerator ($1, $3, current_enum_type); }
;
-/* ANSI new-type-id (5.3.4) */
+/* ISO new-type-id (5.3.4) */
new_type_id:
type_specifier_seq new_declarator
- { $$.t = build_decl_list ($1.t, $2);
+ { $$.t = build_tree_list ($1.t, $2);
$$.new_type_flag = $1.new_type_flag; }
| type_specifier_seq %prec EMPTY
- { $$.t = build_decl_list ($1.t, NULL_TREE);
+ { $$.t = build_tree_list ($1.t, NULL_TREE);
$$.new_type_flag = $1.new_type_flag; }
/* GNU extension to allow arrays of arbitrary types with
- non-constant dimension. For the use of begin_new_placement
- here, see the comments in unary_expr above. */
- | '(' .begin_new_placement type_id .finish_new_placement
- '[' expr ']'
+ non-constant dimension. */
+ | '(' type_id ')' '[' expr ']'
{
if (pedantic)
- pedwarn ("ANSI C++ forbids array dimensions with parenthesized type in new");
- $$.t = build_parse_node (ARRAY_REF, TREE_VALUE ($3.t), $6);
- $$.t = build_decl_list (TREE_PURPOSE ($3.t), $$.t);
- $$.new_type_flag = $3.new_type_flag;
+ pedwarn ("ISO C++ forbids array dimensions with parenthesized type in new");
+ $$.t = build_nt (ARRAY_REF, TREE_VALUE ($2.t), $5);
+ $$.t = build_tree_list (TREE_PURPOSE ($2.t), $$.t);
+ $$.new_type_flag = $2.new_type_flag;
}
;
@@ -2720,7 +2804,7 @@ cv_qualifiers:
/* empty */ %prec EMPTY
{ $$ = NULL_TREE; }
| cv_qualifiers CV_QUALIFIER
- { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
+ { $$ = tree_cons (NULL_TREE, $2, $$); }
;
nonempty_cv_qualifiers:
@@ -2730,31 +2814,27 @@ nonempty_cv_qualifiers:
| nonempty_cv_qualifiers CV_QUALIFIER
{ $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
$$.new_type_flag = $1.new_type_flag; }
+ | attributes %prec EMPTY
+ { $$.t = hash_tree_cons ($1, NULL_TREE, NULL_TREE);
+ $$.new_type_flag = 0; }
+ | nonempty_cv_qualifiers attributes %prec EMPTY
+ { $$.t = hash_tree_cons ($2, NULL_TREE, $1.t);
+ $$.new_type_flag = $1.new_type_flag; }
;
/* These rules must follow the rules for function declarations
and component declarations. That way, longer rules are preferred. */
-suspend_mom:
- /* empty */
- { $<itype>$ = suspend_momentary (); }
-
-/* An expression which will not live on the momentary obstack. */
-nonmomentary_expr:
- suspend_mom expr
- { resume_momentary ((int) $<itype>1); $$ = $2; }
- ;
-
/* An expression which will not live on the momentary obstack. */
maybe_parmlist:
- suspend_mom '(' nonnull_exprlist ')'
- { resume_momentary ((int) $<itype>1); $$ = $3; }
- | suspend_mom '(' parmlist ')'
- { resume_momentary ((int) $<itype>1); $$ = $3; }
- | suspend_mom LEFT_RIGHT
- { resume_momentary ((int) $<itype>1); $$ = empty_parms (); }
- | suspend_mom '(' error ')'
- { resume_momentary ((int) $<itype>1); $$ = NULL_TREE; }
+ '(' nonnull_exprlist ')'
+ { $$ = $2; }
+ | '(' parmlist ')'
+ { $$ = $2; }
+ | LEFT_RIGHT
+ { $$ = empty_parms (); }
+ | '(' error ')'
+ { $$ = NULL_TREE; }
;
/* A declarator that is allowed only after an explicit typespec. */
@@ -2765,7 +2845,7 @@ after_type_declarator_intern:
{
/* Provide support for '(' attributes '*' declarator ')'
etc */
- $$ = decl_tree_cons ($1, $2, NULL_TREE);
+ $$ = tree_cons ($1, $2, NULL_TREE);
}
;
@@ -2781,7 +2861,7 @@ after_type_declarator:
{ $$ = make_reference_declarator (NULL_TREE, $2); }
| ptr_to_mem cv_qualifiers after_type_declarator_intern
{ tree arg = make_pointer_declarator ($2, $3);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
+ $$ = build_nt (SCOPE_REF, $1, arg);
}
| direct_after_type_declarator
;
@@ -2789,15 +2869,15 @@ after_type_declarator:
direct_after_type_declarator:
direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
{ $$ = make_call_declarator ($$, $2, $3, $4); }
- | direct_after_type_declarator '[' nonmomentary_expr ']'
- { $$ = build_parse_node (ARRAY_REF, $$, $3); }
+ | direct_after_type_declarator '[' expr ']'
+ { $$ = build_nt (ARRAY_REF, $$, $3); }
| direct_after_type_declarator '[' ']'
- { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
+ { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); }
| '(' after_type_declarator_intern ')'
{ $$ = $2; }
| nested_name_specifier type_name %prec EMPTY
{ push_nested_class ($1, 3);
- $$ = build_parse_node (SCOPE_REF, $$, $2);
+ $$ = build_nt (SCOPE_REF, $$, $2);
TREE_COMPLEXITY ($$) = current_class_depth; }
| type_name %prec EMPTY
;
@@ -2844,7 +2924,7 @@ notype_declarator_intern:
{
/* Provide support for '(' attributes '*' declarator ')'
etc */
- $$ = decl_tree_cons ($1, $2, NULL_TREE);
+ $$ = tree_cons ($1, $2, NULL_TREE);
}
;
@@ -2859,7 +2939,7 @@ notype_declarator:
{ $$ = make_reference_declarator (NULL_TREE, $2); }
| ptr_to_mem cv_qualifiers notype_declarator_intern
{ tree arg = make_pointer_declarator ($2, $3);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
+ $$ = build_nt (SCOPE_REF, $1, arg);
}
| direct_notype_declarator
;
@@ -2875,7 +2955,7 @@ complex_notype_declarator:
{ $$ = make_reference_declarator (NULL_TREE, $2); }
| ptr_to_mem cv_qualifiers notype_declarator_intern
{ tree arg = make_pointer_declarator ($2, $3);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
+ $$ = build_nt (SCOPE_REF, $1, arg);
}
| complex_direct_notype_declarator
;
@@ -2885,15 +2965,21 @@ complex_direct_notype_declarator:
{ $$ = make_call_declarator ($$, $2, $3, $4); }
| '(' complex_notype_declarator ')'
{ $$ = $2; }
- | direct_notype_declarator '[' nonmomentary_expr ']'
- { $$ = build_parse_node (ARRAY_REF, $$, $3); }
+ | direct_notype_declarator '[' expr ']'
+ { $$ = build_nt (ARRAY_REF, $$, $3); }
| direct_notype_declarator '[' ']'
- { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
+ { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); }
| notype_qualified_id
{ enter_scope_of ($1); }
+ | global_scope notype_qualified_id
+ { enter_scope_of ($2); $$ = $2;}
+ | global_scope notype_unqualified_id
+ { $$ = build_nt (SCOPE_REF, global_namespace, $2);
+ enter_scope_of ($$);
+ }
| nested_name_specifier notype_template_declarator
{ got_scope = NULL_TREE;
- $$ = build_parse_node (SCOPE_REF, $1, $2);
+ $$ = build_nt (SCOPE_REF, $1, $2);
enter_scope_of ($$);
}
;
@@ -2901,19 +2987,19 @@ complex_direct_notype_declarator:
qualified_id:
nested_name_specifier unqualified_id
{ got_scope = NULL_TREE;
- $$ = build_parse_node (SCOPE_REF, $$, $2); }
+ $$ = build_nt (SCOPE_REF, $$, $2); }
| nested_name_specifier object_template_id
{ got_scope = NULL_TREE;
- $$ = build_parse_node (SCOPE_REF, $1, $2); }
+ $$ = build_nt (SCOPE_REF, $1, $2); }
;
notype_qualified_id:
nested_name_specifier notype_unqualified_id
{ got_scope = NULL_TREE;
- $$ = build_parse_node (SCOPE_REF, $$, $2); }
+ $$ = build_nt (SCOPE_REF, $$, $2); }
| nested_name_specifier object_template_id
{ got_scope = NULL_TREE;
- $$ = build_parse_node (SCOPE_REF, $1, $2); }
+ $$ = build_nt (SCOPE_REF, $1, $2); }
;
overqualified_id:
@@ -2930,6 +3016,7 @@ functional_cast:
| typespec fcast_or_absdcl %prec EMPTY
{ $$ = reparse_absdcl_as_expr ($1.t, $2); }
;
+
type_name:
TYPENAME
| SELFNAME
@@ -2941,7 +3028,15 @@ nested_name_specifier:
| nested_name_specifier nested_name_specifier_1
{ $$ = $2; }
| nested_name_specifier TEMPLATE explicit_template_type SCOPE
- { got_scope = $$ = make_typename_type ($1, $3); }
+ { got_scope = $$
+ = make_typename_type ($1, $3, /*complain=*/1); }
+ /* Error handling per Core 125. */
+ | nested_name_specifier IDENTIFIER SCOPE
+ { got_scope = $$
+ = make_typename_type ($1, $2, /*complain=*/1); }
+ | nested_name_specifier PTYPENAME SCOPE
+ { got_scope = $$
+ = make_typename_type ($1, $2, /*complain=*/1); }
;
/* Why the @#$%^& do type_name and notype_identifier need to be expanded
@@ -2971,16 +3066,6 @@ nested_name_specifier_1:
}
| template_type SCOPE
{ got_scope = $$ = complete_type (TREE_TYPE ($1)); }
-/* These break 'const i;'
- | IDENTIFIER SCOPE
- {
- failed_scope:
- cp_error ("`%D' is not an aggregate typedef",
- lastiddecl ? lastiddecl : $$);
- $$ = error_mark_node;
- }
- | PTYPENAME SCOPE
- { goto failed_scope; } */
;
typename_sub:
@@ -2992,10 +3077,10 @@ typename_sub:
typename_sub0:
typename_sub1 identifier %prec EMPTY
{
- if (TREE_CODE_CLASS (TREE_CODE ($1)) == 't')
- $$ = make_typename_type ($1, $2);
+ if (TYPE_P ($1))
+ $$ = make_typename_type ($1, $2, /*complain=*/1);
else if (TREE_CODE ($2) == IDENTIFIER_NODE)
- cp_error ("`%T' is not a class or namespace", $2);
+ error ("`%T' is not a class or namespace", $2);
else
{
$$ = $2;
@@ -3006,23 +3091,25 @@ typename_sub0:
| typename_sub1 template_type %prec EMPTY
{ $$ = TREE_TYPE ($2); }
| typename_sub1 explicit_template_type %prec EMPTY
- { $$ = make_typename_type ($1, $2); }
+ { $$ = make_typename_type ($1, $2, /*complain=*/1); }
| typename_sub1 TEMPLATE explicit_template_type %prec EMPTY
- { $$ = make_typename_type ($1, $3); }
+ { $$ = make_typename_type ($1, $3, /*complain=*/1); }
;
typename_sub1:
typename_sub2
{
if (TREE_CODE ($1) == IDENTIFIER_NODE)
- cp_error ("`%T' is not a class or namespace", $1);
+ error ("`%T' is not a class or namespace", $1);
+ else if (TREE_CODE ($1) == TYPE_DECL)
+ $$ = TREE_TYPE ($1);
}
| typename_sub1 typename_sub2
{
- if (TREE_CODE_CLASS (TREE_CODE ($1)) == 't')
- $$ = make_typename_type ($1, $2);
+ if (TYPE_P ($1))
+ $$ = make_typename_type ($1, $2, /*complain=*/1);
else if (TREE_CODE ($2) == IDENTIFIER_NODE)
- cp_error ("`%T' is not a class or namespace", $2);
+ error ("`%T' is not a class or namespace", $2);
else
{
$$ = $2;
@@ -3031,29 +3118,33 @@ typename_sub1:
}
}
| typename_sub1 explicit_template_type SCOPE
- { got_scope = $$ = make_typename_type ($1, $2); }
+ { got_scope = $$
+ = make_typename_type ($1, $2, /*complain=*/1); }
| typename_sub1 TEMPLATE explicit_template_type SCOPE
- { got_scope = $$ = make_typename_type ($1, $3); }
+ { got_scope = $$
+ = make_typename_type ($1, $3, /*complain=*/1); }
;
+/* This needs to return a TYPE_DECL for simple names so that we don't
+ forget what name was used. */
typename_sub2:
TYPENAME SCOPE
{
- if (TREE_CODE ($1) != IDENTIFIER_NODE)
- $1 = lastiddecl;
+ if (TREE_CODE ($1) != TYPE_DECL)
+ $$ = lastiddecl;
/* Retrieve the type for the identifier, which might involve
some computation. */
- got_scope = $$ = complete_type (IDENTIFIER_TYPE_VALUE ($1));
+ got_scope = complete_type (TREE_TYPE ($$));
if ($$ == error_mark_node)
- cp_error ("`%T' is not a class or namespace", $1);
+ error ("`%T' is not a class or namespace", $1);
}
| SELFNAME SCOPE
{
- if (TREE_CODE ($1) != IDENTIFIER_NODE)
+ if (TREE_CODE ($1) != TYPE_DECL)
$$ = lastiddecl;
- got_scope = $$ = complete_type (TREE_TYPE ($$));
+ got_scope = complete_type (TREE_TYPE ($$));
}
| template_type SCOPE
{ got_scope = $$ = complete_type (TREE_TYPE ($$)); }
@@ -3100,7 +3191,7 @@ global_scope:
{ got_scope = void_type_node; }
;
-/* ANSI new-declarator (5.3.4) */
+/* ISO new-declarator (5.3.4) */
new_declarator:
'*' cv_qualifiers new_declarator
{ $$ = make_pointer_declarator ($2, $3); }
@@ -3112,21 +3203,21 @@ new_declarator:
{ $$ = make_reference_declarator ($2, NULL_TREE); }
| ptr_to_mem cv_qualifiers %prec EMPTY
{ tree arg = make_pointer_declarator ($2, NULL_TREE);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
+ $$ = build_nt (SCOPE_REF, $1, arg);
}
| ptr_to_mem cv_qualifiers new_declarator
{ tree arg = make_pointer_declarator ($2, $3);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
+ $$ = build_nt (SCOPE_REF, $1, arg);
}
| direct_new_declarator %prec EMPTY
;
-/* ANSI direct-new-declarator (5.3.4) */
+/* ISO direct-new-declarator (5.3.4) */
direct_new_declarator:
'[' expr ']'
- { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
- | direct_new_declarator '[' nonmomentary_expr ']'
- { $$ = build_parse_node (ARRAY_REF, $$, $3); }
+ { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); }
+ | direct_new_declarator '[' expr ']'
+ { $$ = build_nt (ARRAY_REF, $$, $3); }
;
absdcl_intern:
@@ -3135,11 +3226,11 @@ absdcl_intern:
{
/* Provide support for '(' attributes '*' declarator ')'
etc */
- $$ = decl_tree_cons ($1, $2, NULL_TREE);
+ $$ = tree_cons ($1, $2, NULL_TREE);
}
;
-/* ANSI abstract-declarator (8.1) */
+/* ISO abstract-declarator (8.1) */
absdcl:
'*' nonempty_cv_qualifiers absdcl_intern
{ $$ = make_pointer_declarator ($2.t, $3); }
@@ -3159,39 +3250,38 @@ absdcl:
{ $$ = make_reference_declarator (NULL_TREE, NULL_TREE); }
| ptr_to_mem cv_qualifiers %prec EMPTY
{ tree arg = make_pointer_declarator ($2, NULL_TREE);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
+ $$ = build_nt (SCOPE_REF, $1, arg);
}
| ptr_to_mem cv_qualifiers absdcl_intern
{ tree arg = make_pointer_declarator ($2, $3);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
+ $$ = build_nt (SCOPE_REF, $1, arg);
}
| direct_abstract_declarator %prec EMPTY
;
-/* ANSI direct-abstract-declarator (8.1) */
+/* ISO direct-abstract-declarator (8.1) */
direct_abstract_declarator:
'(' absdcl_intern ')'
{ $$ = $2; }
/* `(typedef)1' is `int'. */
- | PAREN_STAR_PAREN
| direct_abstract_declarator '(' parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
{ $$ = make_call_declarator ($$, $3, $5, $6); }
| direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec '.'
{ $$ = make_call_declarator ($$, empty_parms (), $3, $4); }
- | direct_abstract_declarator '[' nonmomentary_expr ']' %prec '.'
- { $$ = build_parse_node (ARRAY_REF, $$, $3); }
+ | direct_abstract_declarator '[' expr ']' %prec '.'
+ { $$ = build_nt (ARRAY_REF, $$, $3); }
| direct_abstract_declarator '[' ']' %prec '.'
- { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
+ { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); }
| '(' complex_parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
{ $$ = make_call_declarator (NULL_TREE, $2, $4, $5); }
| regcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
{ set_quals_and_spec ($$, $2, $3); }
| fcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
{ set_quals_and_spec ($$, $2, $3); }
- | '[' nonmomentary_expr ']' %prec '.'
- { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
+ | '[' expr ']' %prec '.'
+ { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); }
| '[' ']' %prec '.'
- { $$ = build_parse_node (ARRAY_REF, NULL_TREE, NULL_TREE); }
+ { $$ = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); }
;
/* For C++, decls and stmts can be intermixed, so we don't need to
@@ -3215,7 +3305,7 @@ maybe_label_decls:
/* empty */
| label_decls
{ if (pedantic)
- pedwarn ("ANSI C++ forbids label declarations"); }
+ pedwarn ("ISO C++ forbids label declarations"); }
;
label_decls:
@@ -3225,70 +3315,67 @@ label_decls:
label_decl:
LABEL identifiers_or_typenames ';'
- { tree link;
- for (link = $2; link; link = TREE_CHAIN (link))
+ {
+ while ($2)
{
- tree label = shadow_label (TREE_VALUE (link));
- C_DECLARED_LABEL_FLAG (label) = 1;
- declare_nonlocal_label (label);
+ finish_label_decl (TREE_VALUE ($2));
+ $2 = TREE_CHAIN ($2);
}
}
;
-/* This is the body of a function definition.
- It causes syntax errors to ignore to the next openbrace. */
-compstmt_or_error:
- compstmt
- {}
- | error compstmt
- ;
-
compstmt:
- '{'
+ save_lineno '{'
{ $<ttype>$ = begin_compound_stmt (0); }
compstmtend
- { $$ = finish_compound_stmt (0, $<ttype>2); }
+ { STMT_LINENO ($<ttype>3) = $1;
+ finish_compound_stmt (0, $<ttype>3); }
;
simple_if:
IF
- {
- $<ttype>$ = begin_if_stmt ();
- cond_stmt_keyword = "if";
- }
+ { $<ttype>$ = begin_if_stmt ();
+ cond_stmt_keyword = "if"; }
paren_cond_or_null
{ finish_if_stmt_cond ($3, $<ttype>2); }
implicitly_scoped_stmt
- { $<ttype>$ = finish_then_clause ($<ttype>2); }
+ { $$ = $<ttype>2;
+ finish_then_clause ($<ttype>2); }
;
implicitly_scoped_stmt:
compstmt
- | { $<ttype>$ = begin_compound_stmt (0); }
- simple_stmt
- { $$ = finish_compound_stmt (0, $<ttype>1); }
+ |
+ { $<ttype>$ = begin_compound_stmt (0); }
+ save_lineno simple_stmt
+ { STMT_LINENO ($<ttype>1) = $2;
+ if ($3) STMT_LINENO ($3) = $2;
+ finish_compound_stmt (0, $<ttype>1); }
;
stmt:
compstmt
- {}
- | simple_stmt
+ | save_lineno simple_stmt
+ { if ($2) STMT_LINENO ($2) = $1; }
;
simple_stmt:
decl
- { finish_stmt (); }
+ { finish_stmt ();
+ $$ = NULL_TREE; }
| expr ';'
- { finish_expr_stmt ($1); }
+ { $$ = finish_expr_stmt ($1); }
| simple_if ELSE
{ begin_else_clause (); }
implicitly_scoped_stmt
{
- finish_else_clause ($<ttype>1);
+ $$ = $1;
+ finish_else_clause ($1);
finish_if_stmt ();
}
| simple_if %prec IF
- { finish_if_stmt (); }
+ { $$ = $1;
+ finish_if_stmt (); }
| WHILE
{
$<ttype>$ = begin_while_stmt ();
@@ -3296,8 +3383,9 @@ simple_stmt:
}
paren_cond_or_null
{ finish_while_stmt_cond ($3, $<ttype>2); }
- already_scoped_stmt
- { finish_while_stmt ($<ttype>2); }
+ implicitly_scoped_stmt
+ { $$ = $<ttype>2;
+ finish_while_stmt ($<ttype>2); }
| DO
{ $<ttype>$ = begin_do_stmt (); }
implicitly_scoped_stmt WHILE
@@ -3306,7 +3394,8 @@ simple_stmt:
cond_stmt_keyword = "do";
}
paren_expr_or_null ';'
- { finish_do_stmt ($6, $<ttype>2); }
+ { $$ = $<ttype>2;
+ finish_do_stmt ($6, $<ttype>2); }
| FOR
{ $<ttype>$ = begin_for_stmt (); }
'(' for.init.statement
@@ -3315,89 +3404,94 @@ simple_stmt:
{ finish_for_cond ($6, $<ttype>2); }
xexpr ')'
{ finish_for_expr ($9, $<ttype>2); }
- already_scoped_stmt
- { finish_for_stmt ($9, $<ttype>2); }
+ implicitly_scoped_stmt
+ { $$ = $<ttype>2;
+ finish_for_stmt ($<ttype>2); }
| SWITCH
- { begin_switch_stmt (); }
+ { $<ttype>$ = begin_switch_stmt (); }
'(' condition ')'
- { $<ttype>$ = finish_switch_cond ($4); }
+ { finish_switch_cond ($4, $<ttype>2); }
implicitly_scoped_stmt
- { finish_switch_stmt ($4, $<ttype>6); }
+ { $$ = $<ttype>2;
+ finish_switch_stmt ($<ttype>2); }
| CASE expr_no_commas ':'
- { finish_case_label ($2, NULL_TREE); }
+ { $<ttype>$ = finish_case_label ($2, NULL_TREE); }
stmt
+ { $$ = $<ttype>4; }
| CASE expr_no_commas ELLIPSIS expr_no_commas ':'
- { finish_case_label ($2, $4); }
+ { $<ttype>$ = finish_case_label ($2, $4); }
stmt
+ { $$ = $<ttype>6; }
| DEFAULT ':'
- { finish_case_label (NULL_TREE, NULL_TREE); }
+ { $<ttype>$ = finish_case_label (NULL_TREE, NULL_TREE); }
stmt
+ { $$ = $<ttype>3; }
| BREAK ';'
- { finish_break_stmt (); }
+ { $$ = finish_break_stmt (); }
| CONTINUE ';'
- { finish_continue_stmt (); }
+ { $$ = finish_continue_stmt (); }
| RETURN_KEYWORD ';'
- { finish_return_stmt (NULL_TREE); }
+ { $$ = finish_return_stmt (NULL_TREE); }
| RETURN_KEYWORD expr ';'
- { finish_return_stmt ($2); }
+ { $$ = finish_return_stmt ($2); }
| asm_keyword maybe_cv_qualifier '(' string ')' ';'
- {
- finish_asm_stmt ($2, $4, NULL_TREE, NULL_TREE,
- NULL_TREE);
- }
+ { $$ = finish_asm_stmt ($2, $4, NULL_TREE, NULL_TREE,
+ NULL_TREE);
+ ASM_INPUT_P ($$) = 1; }
/* This is the case with just output operands. */
| asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';'
- {
- finish_asm_stmt ($2, $4, $6, NULL_TREE,
- NULL_TREE);
- }
+ { $$ = finish_asm_stmt ($2, $4, $6, NULL_TREE, NULL_TREE); }
/* This is the case with input operands as well. */
- | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':' asm_operands ')' ';'
- { finish_asm_stmt ($2, $4, $6, $8, NULL_TREE); }
+ | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
+ asm_operands ')' ';'
+ { $$ = finish_asm_stmt ($2, $4, $6, $8, NULL_TREE); }
+ | asm_keyword maybe_cv_qualifier '(' string SCOPE asm_operands ')' ';'
+ { $$ = finish_asm_stmt ($2, $4, NULL_TREE, $6, NULL_TREE); }
/* This is the case with clobbered registers as well. */
| asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
asm_operands ':' asm_clobbers ')' ';'
- { finish_asm_stmt ($2, $4, $6, $8, $10); }
+ { $$ = finish_asm_stmt ($2, $4, $6, $8, $10); }
+ | asm_keyword maybe_cv_qualifier '(' string SCOPE asm_operands ':'
+ asm_clobbers ')' ';'
+ { $$ = finish_asm_stmt ($2, $4, NULL_TREE, $6, $8); }
+ | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands SCOPE
+ asm_clobbers ')' ';'
+ { $$ = finish_asm_stmt ($2, $4, $6, NULL_TREE, $8); }
| GOTO '*' expr ';'
{
if (pedantic)
- pedwarn ("ANSI C++ forbids computed gotos");
- finish_goto_stmt ($3);
+ pedwarn ("ISO C++ forbids computed gotos");
+ $$ = finish_goto_stmt ($3);
}
| GOTO identifier ';'
- { finish_goto_stmt ($2); }
+ { $$ = finish_goto_stmt ($2); }
| label_colon stmt
- { finish_stmt (); }
+ { $$ = NULL_TREE; }
| label_colon '}'
{ error ("label must be followed by statement");
yyungetc ('}', 0);
- finish_stmt (); }
+ $$ = NULL_TREE; }
| ';'
- { finish_stmt (); }
+ { finish_stmt ();
+ $$ = NULL_TREE; }
| try_block
+ { $$ = NULL_TREE; }
| using_directive
+ { $$ = NULL_TREE; }
| namespace_using_decl
- { do_local_using_decl ($1); }
+ { do_local_using_decl ($1);
+ $$ = NULL_TREE; }
| namespace_alias
+ { $$ = NULL_TREE; }
;
function_try_block:
TRY
- {
- if (! current_function_parms_stored)
- store_parm_decls ();
- expand_start_early_try_stmts ();
- }
- ctor_initializer_opt compstmt
- {
- end_protect_partials ();
- expand_start_all_catch ();
- }
+ { $<ttype>$ = begin_function_try_block (); }
+ function_body
+ { finish_function_try_block ($<ttype>2); }
handler_seq
- {
- expand_end_all_catch ();
- $$ = $3;
- }
+ { finish_function_handler_sequence ($<ttype>2); }
;
try_block:
@@ -3412,13 +3506,22 @@ try_block:
handler_seq:
handler
| handler_seq handler
+ | /* empty */
+ { /* Generate a fake handler block to avoid later aborts. */
+ tree fake_handler = begin_handler ();
+ finish_handler_parms (NULL_TREE, fake_handler);
+ finish_handler (fake_handler);
+ $<ttype>$ = fake_handler;
+
+ error ("must have at least one catch per try block");
+ }
;
handler:
CATCH
- { $<ttype>$ = begin_handler(); }
+ { $<ttype>$ = begin_handler (); }
handler_args
- { finish_handler_parms ($<ttype>2); }
+ { finish_handler_parms ($3, $<ttype>2); }
compstmt
{ finish_handler ($<ttype>2); }
;
@@ -3430,7 +3533,7 @@ type_specifier_seq:
handler_args:
'(' ELLIPSIS ')'
- { expand_start_catch_block (NULL_TREE, NULL_TREE); }
+ { $$ = NULL_TREE; }
/* This doesn't allow reference parameters, the below does.
| '(' type_specifier_seq absdcl ')'
{ check_for_new_type ("inside exception declarations", $2);
@@ -3446,34 +3549,31 @@ handler_args:
expand_start_catch_block ($2.t, $3); }
This allows reference parameters... */
| '(' parm ')'
- { check_for_new_type ("inside exception declarations", $2);
- expand_start_catch_block (TREE_PURPOSE ($2.t),
- TREE_VALUE ($2.t)); }
+ {
+ check_for_new_type ("inside exception declarations", $2);
+ $$ = start_handler_parms (TREE_PURPOSE ($2.t),
+ TREE_VALUE ($2.t));
+ }
;
label_colon:
IDENTIFIER ':'
- { tree label;
- do_label:
- label = define_label (input_filename, lineno, $1);
- if (label && ! minimal_parse_mode)
- expand_label (label);
- }
+ { finish_label_stmt ($1); }
| PTYPENAME ':'
- { goto do_label; }
+ { finish_label_stmt ($1); }
| TYPENAME ':'
- { goto do_label; }
+ { finish_label_stmt ($1); }
| SELFNAME ':'
- { goto do_label; }
+ { finish_label_stmt ($1); }
;
for.init.statement:
xexpr ';'
- { if ($1) cplus_expand_expr_stmt ($1); }
+ { finish_expr_stmt ($1); }
| decl
| '{' compstmtend
{ if (pedantic)
- pedwarn ("ANSI C++ forbids compound statements inside for initializations");
+ pedwarn ("ISO C++ forbids compound statements inside for initializations");
}
;
@@ -3481,10 +3581,8 @@ for.init.statement:
maybe_cv_qualifier:
/* empty */
- { emit_line_note (input_filename, lineno);
- $$ = NULL_TREE; }
+ { $$ = NULL_TREE; }
| CV_QUALIFIER
- { emit_line_note (input_filename, lineno); }
;
xexpr:
@@ -3511,14 +3609,16 @@ nonnull_asm_operands:
asm_operand:
STRING '(' expr ')'
- { $$ = build_tree_list ($$, $3); }
+ { $$ = build_tree_list (build_tree_list (NULL_TREE, $1), $3); }
+ | '[' identifier ']' STRING '(' expr ')'
+ { $$ = build_tree_list (build_tree_list ($2, $4), $6); }
;
asm_clobbers:
- STRING
- { $$ = tree_cons (NULL_TREE, $$, NULL_TREE); }
- | asm_clobbers ',' STRING
- { $$ = tree_cons (NULL_TREE, $3, $$); }
+ string
+ { $$ = tree_cons (NULL_TREE, combine_strings ($1), NULL_TREE);}
+ | asm_clobbers ',' string
+ { $$ = tree_cons (NULL_TREE, combine_strings ($3), $1); }
;
/* This is what appears inside the parens in a function declarator.
@@ -3619,27 +3719,23 @@ named_parm:
/* Here we expand typed_declspecs inline to avoid mis-parsing of
TYPESPEC IDENTIFIER. */
typed_declspecs1 declarator
- { tree specs = strip_attrs ($1.t);
- $$.new_type_flag = $1.new_type_flag;
- $$.t = build_tree_list (specs, $2); }
+ { $$.new_type_flag = $1.new_type_flag;
+ $$.t = build_tree_list ($1.t, $2); }
| typed_typespecs declarator
{ $$.t = build_tree_list ($1.t, $2);
$$.new_type_flag = $1.new_type_flag; }
| typespec declarator
- { $$.t = build_tree_list (build_decl_list (NULL_TREE, $1.t),
+ { $$.t = build_tree_list (build_tree_list (NULL_TREE, $1.t),
$2);
$$.new_type_flag = $1.new_type_flag; }
| typed_declspecs1 absdcl
- { tree specs = strip_attrs ($1.t);
- $$.t = build_tree_list (specs, $2);
+ { $$.t = build_tree_list ($1.t, $2);
$$.new_type_flag = $1.new_type_flag; }
| typed_declspecs1 %prec EMPTY
- { tree specs = strip_attrs ($1.t);
- $$.t = build_tree_list (specs, NULL_TREE);
+ { $$.t = build_tree_list ($1.t, NULL_TREE);
$$.new_type_flag = $1.new_type_flag; }
| declmods notype_declarator
- { tree specs = strip_attrs ($1);
- $$.t = build_tree_list (specs, $2);
+ { $$.t = build_tree_list ($1.t, $2);
$$.new_type_flag = 0; }
;
@@ -3670,36 +3766,64 @@ bad_parm:
}
| notype_declarator
{
- error ("type specifier omitted for parameter");
- if (TREE_CODE ($$) == SCOPE_REF
- && (TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM
- || TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TEMPLATE_PARM))
- cp_error (" perhaps you want `typename %E' to make it a type", $$);
+ if (TREE_CODE ($$) == SCOPE_REF)
+ {
+ if (TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM
+ || TREE_CODE (TREE_OPERAND ($$, 0)) == BOUND_TEMPLATE_TEMPLATE_PARM)
+ error ("`%E' is not a type, use `typename %E' to make it one", $$);
+ else
+ error ("no type `%D' in `%T'", TREE_OPERAND ($$, 1), TREE_OPERAND ($$, 0));
+ }
+ else
+ error ("type specifier omitted for parameter `%E'", $$);
$$ = build_tree_list (integer_type_node, $$);
}
;
+bad_decl:
+ IDENTIFIER template_arg_list_ignore IDENTIFIER arg_list_ignore ';'
+ {
+ error("'%D' is used as a type, but is not defined as a type.", $1);
+ $3 = error_mark_node;
+ }
+ ;
+
+template_arg_list_ignore:
+ '<' template_arg_list_opt template_close_bracket
+ { }
+ | /* empty */
+ ;
+
+arg_list_ignore:
+ '(' nonnull_exprlist ')'
+ { }
+ | /* empty */
+ ;
+
exception_specification_opt:
/* empty */ %prec EMPTY
{ $$ = NULL_TREE; }
| THROW '(' ansi_raise_identifiers ')' %prec EMPTY
{ $$ = $3; }
| THROW LEFT_RIGHT %prec EMPTY
- { $$ = build_decl_list (NULL_TREE, NULL_TREE); }
+ { $$ = empty_except_spec; }
;
ansi_raise_identifier:
type_id
- { $$ = build_decl_list (NULL_TREE, groktypename($1.t)); }
+ {
+ check_for_new_type ("exception specifier", $1);
+ $$ = groktypename ($1.t);
+ }
+ | error
+ { $$ = error_mark_node; }
;
ansi_raise_identifiers:
ansi_raise_identifier
+ { $$ = add_exception_specifier (NULL_TREE, $1, 1); }
| ansi_raise_identifiers ',' ansi_raise_identifier
- {
- TREE_CHAIN ($3) = $$;
- $$ = $3;
- }
+ { $$ = add_exception_specifier ($1, $3, 1); }
;
conversion_declarator:
@@ -3711,89 +3835,112 @@ conversion_declarator:
{ $$ = make_reference_declarator ($2, $3); }
| ptr_to_mem cv_qualifiers conversion_declarator
{ tree arg = make_pointer_declarator ($2, $3);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
+ $$ = build_nt (SCOPE_REF, $1, arg);
}
;
operator:
- OPERATOR
- { got_scope = NULL_TREE; }
- ;
+ OPERATOR
+ {
+ saved_scopes = tree_cons (got_scope, got_object, saved_scopes);
+ TREE_LANG_FLAG_0 (saved_scopes) = looking_for_typename;
+ /* We look for conversion-type-id's in both the class and current
+ scopes, just as for ID in 'ptr->ID::'. */
+ looking_for_typename = 1;
+ got_object = got_scope;
+ got_scope = NULL_TREE;
+ }
+ ;
+
+unoperator:
+ { got_scope = TREE_PURPOSE (saved_scopes);
+ got_object = TREE_VALUE (saved_scopes);
+ looking_for_typename = TREE_LANG_FLAG_0 (saved_scopes);
+ saved_scopes = TREE_CHAIN (saved_scopes);
+ }
+ ;
operator_name:
- operator '*'
- { $$ = ansi_opname[MULT_EXPR]; }
- | operator '/'
- { $$ = ansi_opname[TRUNC_DIV_EXPR]; }
- | operator '%'
- { $$ = ansi_opname[TRUNC_MOD_EXPR]; }
- | operator '+'
- { $$ = ansi_opname[PLUS_EXPR]; }
- | operator '-'
- { $$ = ansi_opname[MINUS_EXPR]; }
- | operator '&'
- { $$ = ansi_opname[BIT_AND_EXPR]; }
- | operator '|'
- { $$ = ansi_opname[BIT_IOR_EXPR]; }
- | operator '^'
- { $$ = ansi_opname[BIT_XOR_EXPR]; }
- | operator '~'
- { $$ = ansi_opname[BIT_NOT_EXPR]; }
- | operator ','
- { $$ = ansi_opname[COMPOUND_EXPR]; }
- | operator ARITHCOMPARE
- { $$ = ansi_opname[$2]; }
- | operator '<'
- { $$ = ansi_opname[LT_EXPR]; }
- | operator '>'
- { $$ = ansi_opname[GT_EXPR]; }
- | operator EQCOMPARE
- { $$ = ansi_opname[$2]; }
- | operator ASSIGN
- { $$ = ansi_assopname[$2]; }
- | operator '='
- { $$ = ansi_opname [MODIFY_EXPR]; }
- | operator LSHIFT
- { $$ = ansi_opname[$2]; }
- | operator RSHIFT
- { $$ = ansi_opname[$2]; }
- | operator PLUSPLUS
- { $$ = ansi_opname[POSTINCREMENT_EXPR]; }
- | operator MINUSMINUS
- { $$ = ansi_opname[PREDECREMENT_EXPR]; }
- | operator ANDAND
- { $$ = ansi_opname[TRUTH_ANDIF_EXPR]; }
- | operator OROR
- { $$ = ansi_opname[TRUTH_ORIF_EXPR]; }
- | operator '!'
- { $$ = ansi_opname[TRUTH_NOT_EXPR]; }
- | operator '?' ':'
- { $$ = ansi_opname[COND_EXPR]; }
- | operator MIN_MAX
- { $$ = ansi_opname[$2]; }
- | operator POINTSAT %prec EMPTY
- { $$ = ansi_opname[COMPONENT_REF]; }
- | operator POINTSAT_STAR %prec EMPTY
- { $$ = ansi_opname[MEMBER_REF]; }
- | operator LEFT_RIGHT
- { $$ = ansi_opname[CALL_EXPR]; }
- | operator '[' ']'
- { $$ = ansi_opname[ARRAY_REF]; }
- | operator NEW %prec EMPTY
- { $$ = ansi_opname[NEW_EXPR]; }
- | operator DELETE %prec EMPTY
- { $$ = ansi_opname[DELETE_EXPR]; }
- | operator NEW '[' ']'
- { $$ = ansi_opname[VEC_NEW_EXPR]; }
- | operator DELETE '[' ']'
- { $$ = ansi_opname[VEC_DELETE_EXPR]; }
- /* Names here should be looked up in class scope ALSO. */
- | operator type_specifier_seq conversion_declarator
- { $$ = grokoptypename ($2.t, $3); }
- | operator error
- { $$ = ansi_opname[ERROR_MARK]; }
+ operator '*' unoperator
+ { $$ = frob_opname (ansi_opname (MULT_EXPR)); }
+ | operator '/' unoperator
+ { $$ = frob_opname (ansi_opname (TRUNC_DIV_EXPR)); }
+ | operator '%' unoperator
+ { $$ = frob_opname (ansi_opname (TRUNC_MOD_EXPR)); }
+ | operator '+' unoperator
+ { $$ = frob_opname (ansi_opname (PLUS_EXPR)); }
+ | operator '-' unoperator
+ { $$ = frob_opname (ansi_opname (MINUS_EXPR)); }
+ | operator '&' unoperator
+ { $$ = frob_opname (ansi_opname (BIT_AND_EXPR)); }
+ | operator '|' unoperator
+ { $$ = frob_opname (ansi_opname (BIT_IOR_EXPR)); }
+ | operator '^' unoperator
+ { $$ = frob_opname (ansi_opname (BIT_XOR_EXPR)); }
+ | operator '~' unoperator
+ { $$ = frob_opname (ansi_opname (BIT_NOT_EXPR)); }
+ | operator ',' unoperator
+ { $$ = frob_opname (ansi_opname (COMPOUND_EXPR)); }
+ | operator ARITHCOMPARE unoperator
+ { $$ = frob_opname (ansi_opname ($2)); }
+ | operator '<' unoperator
+ { $$ = frob_opname (ansi_opname (LT_EXPR)); }
+ | operator '>' unoperator
+ { $$ = frob_opname (ansi_opname (GT_EXPR)); }
+ | operator EQCOMPARE unoperator
+ { $$ = frob_opname (ansi_opname ($2)); }
+ | operator ASSIGN unoperator
+ { $$ = frob_opname (ansi_assopname ($2)); }
+ | operator '=' unoperator
+ { $$ = frob_opname (ansi_assopname (NOP_EXPR)); }
+ | operator LSHIFT unoperator
+ { $$ = frob_opname (ansi_opname ($2)); }
+ | operator RSHIFT unoperator
+ { $$ = frob_opname (ansi_opname ($2)); }
+ | operator PLUSPLUS unoperator
+ { $$ = frob_opname (ansi_opname (POSTINCREMENT_EXPR)); }
+ | operator MINUSMINUS unoperator
+ { $$ = frob_opname (ansi_opname (PREDECREMENT_EXPR)); }
+ | operator ANDAND unoperator
+ { $$ = frob_opname (ansi_opname (TRUTH_ANDIF_EXPR)); }
+ | operator OROR unoperator
+ { $$ = frob_opname (ansi_opname (TRUTH_ORIF_EXPR)); }
+ | operator '!' unoperator
+ { $$ = frob_opname (ansi_opname (TRUTH_NOT_EXPR)); }
+ | operator '?' ':' unoperator
+ { $$ = frob_opname (ansi_opname (COND_EXPR)); }
+ | operator MIN_MAX unoperator
+ { $$ = frob_opname (ansi_opname ($2)); }
+ | operator POINTSAT unoperator %prec EMPTY
+ { $$ = frob_opname (ansi_opname (COMPONENT_REF)); }
+ | operator POINTSAT_STAR unoperator %prec EMPTY
+ { $$ = frob_opname (ansi_opname (MEMBER_REF)); }
+ | operator LEFT_RIGHT unoperator
+ { $$ = frob_opname (ansi_opname (CALL_EXPR)); }
+ | operator '[' ']' unoperator
+ { $$ = frob_opname (ansi_opname (ARRAY_REF)); }
+ | operator NEW unoperator %prec EMPTY
+ { $$ = frob_opname (ansi_opname (NEW_EXPR)); }
+ | operator DELETE unoperator %prec EMPTY
+ { $$ = frob_opname (ansi_opname (DELETE_EXPR)); }
+ | operator NEW '[' ']' unoperator
+ { $$ = frob_opname (ansi_opname (VEC_NEW_EXPR)); }
+ | operator DELETE '[' ']' unoperator
+ { $$ = frob_opname (ansi_opname (VEC_DELETE_EXPR)); }
+ | operator type_specifier_seq conversion_declarator unoperator
+ { $$ = frob_opname (grokoptypename ($2.t, $3)); }
+ | operator error unoperator
+ { $$ = frob_opname (ansi_opname (ERROR_MARK)); }
+ ;
+
+/* The forced readahead in here is because we might be at the end of a
+ line, and lineno won't be bumped until yylex absorbs the first token
+ on the next line. */
+save_lineno:
+ { if (yychar == YYEMPTY)
+ yychar = YYLEX;
+ $$ = lineno; }
;
-
%%
#ifdef SPEW_DEBUG
diff --git a/contrib/gcc/cp/pt.c b/contrib/gcc/cp/pt.c
index 28c2956..5084f72 100644
--- a/contrib/gcc/cp/pt.c
+++ b/contrib/gcc/cp/pt.c
@@ -1,5 +1,6 @@
/* Handle parameterized types (templates) for GNU C++.
- Copyright (C) 1992, 93-97, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+ 2001, 2002 Free Software Foundation, Inc.
Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing.
Rewritten by Jason Merrill (jason@cygnus.com).
@@ -28,32 +29,26 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
#include "obstack.h"
-
#include "tree.h"
#include "flags.h"
#include "cp-tree.h"
+#include "tree-inline.h"
#include "decl.h"
#include "parse.h"
#include "lex.h"
#include "output.h"
-#include "defaults.h"
#include "except.h"
#include "toplev.h"
#include "rtl.h"
-#include "varray.h"
+#include "ggc.h"
+#include "timevar.h"
/* The type of functions taking a tree, and some additional data, and
returning an int. */
-typedef int (*tree_fn_t) PROTO((tree, void*));
+typedef int (*tree_fn_t) PARAMS ((tree, void*));
extern struct obstack permanent_obstack;
-extern int lineno;
-extern char *input_filename;
-
-tree current_template_parms;
-HOST_WIDE_INT processing_template_decl;
-
/* The PENDING_TEMPLATES is a TREE_LIST of templates whose
instantiations have been deferred, either because their definitions
were not yet available, or because we were putting off doing the
@@ -62,15 +57,8 @@ HOST_WIDE_INT processing_template_decl;
(for a function or static data member), or a TYPE (for a class)
indicating what we are hoping to instantiate. */
static tree pending_templates;
-static tree *template_tail = &pending_templates;
-
-static tree maybe_templates;
-static tree *maybe_template_tail = &maybe_templates;
-
-int minimal_parse_mode;
+static tree last_pending_template;
-int processing_specialization;
-int processing_explicit_instantiation;
int processing_template_parmlist;
static int template_header_count;
@@ -78,6 +66,13 @@ static tree saved_trees;
static varray_type inline_parm_levels;
static size_t inline_parm_levels_used;
+static tree current_tinst_level;
+
+/* A map from local variable declarations in the body of the template
+ presently being instantiated to the corresponding instantiated
+ local variables. */
+static htab_t local_specializations;
+
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
@@ -86,6 +81,10 @@ static size_t inline_parm_levels_used;
#define UNIFY_ALLOW_LESS_CV_QUAL 2
#define UNIFY_ALLOW_DERIVED 4
#define UNIFY_ALLOW_INTEGER 8
+#define UNIFY_ALLOW_OUTER_LEVEL 16
+#define UNIFY_ALLOW_OUTER_MORE_CV_QUAL 32
+#define UNIFY_ALLOW_OUTER_LESS_CV_QUAL 64
+#define UNIFY_ALLOW_MAX_CORRECTION 128
#define GTB_VIA_VIRTUAL 1 /* The base class we are examining is
virtual, or a base class of a virtual
@@ -93,135 +92,89 @@ static size_t inline_parm_levels_used;
#define GTB_IGNORE_TYPE 2 /* We don't need to try to unify the current
type with the desired type. */
-static int resolve_overloaded_unification PROTO((tree, tree, tree, tree,
+static int resolve_overloaded_unification PARAMS ((tree, tree, tree, tree,
unification_kind_t, int));
-static int try_one_overload PROTO((tree, tree, tree, tree, tree,
+static int try_one_overload PARAMS ((tree, tree, tree, tree, tree,
unification_kind_t, int));
-static int unify PROTO((tree, tree, tree, tree, int));
-static void add_pending_template PROTO((tree));
-static int push_tinst_level PROTO((tree));
-static tree classtype_mangled_name PROTO((tree));
-static char *mangle_class_name_for_template PROTO((char *, tree, tree));
-static tree tsubst_expr_values PROTO((tree, tree));
-static int list_eq PROTO((tree, tree));
-static tree get_class_bindings PROTO((tree, tree, tree));
-static tree coerce_template_parms PROTO((tree, tree, tree, int, int));
-static void tsubst_enum PROTO((tree, tree, tree));
-static tree add_to_template_args PROTO((tree, tree));
-static tree add_outermost_template_args PROTO((tree, tree));
-static void maybe_adjust_types_for_deduction PROTO((unification_kind_t, tree*,
+static int unify PARAMS ((tree, tree, tree, tree, int));
+static void add_pending_template PARAMS ((tree));
+static void reopen_tinst_level PARAMS ((tree));
+static tree classtype_mangled_name PARAMS ((tree));
+static char *mangle_class_name_for_template PARAMS ((const char *, tree, tree));
+static tree tsubst_initializer_list PARAMS ((tree, tree));
+static int list_eq PARAMS ((tree, tree));
+static tree get_class_bindings PARAMS ((tree, tree, tree));
+static tree coerce_template_parms PARAMS ((tree, tree, tree, int, int));
+static void tsubst_enum PARAMS ((tree, tree, tree));
+static tree add_to_template_args PARAMS ((tree, tree));
+static tree add_outermost_template_args PARAMS ((tree, tree));
+static int maybe_adjust_types_for_deduction PARAMS ((unification_kind_t, tree*,
tree*));
-static int type_unification_real PROTO((tree, tree, tree, tree,
- int, unification_kind_t, int));
-static void note_template_header PROTO((int));
-static tree maybe_fold_nontype_arg PROTO((tree));
-static tree convert_nontype_argument PROTO((tree, tree));
-static tree convert_template_argument PROTO ((tree, tree, tree, int,
+static int type_unification_real PARAMS ((tree, tree, tree, tree,
+ int, unification_kind_t, int, int));
+static void note_template_header PARAMS ((int));
+static tree maybe_fold_nontype_arg PARAMS ((tree));
+static tree convert_nontype_argument PARAMS ((tree, tree));
+static tree convert_template_argument PARAMS ((tree, tree, tree, int,
int , tree));
-static tree get_bindings_overload PROTO((tree, tree, tree));
-static int for_each_template_parm PROTO((tree, tree_fn_t, void*));
-static tree build_template_parm_index PROTO((int, int, int, tree, tree));
-static int inline_needs_template_parms PROTO((tree));
-static void push_inline_template_parms_recursive PROTO((tree, int));
-static tree retrieve_specialization PROTO((tree, tree));
-static tree register_specialization PROTO((tree, tree, tree));
-static int unregister_specialization PROTO((tree, tree));
-static tree reduce_template_parm_level PROTO((tree, tree, int));
-static tree build_template_decl PROTO((tree, tree));
-static int mark_template_parm PROTO((tree, void *));
-static tree tsubst_friend_function PROTO((tree, tree));
-static tree tsubst_friend_class PROTO((tree, tree));
-static tree get_bindings_real PROTO((tree, tree, tree, int));
-static int template_decl_level PROTO((tree));
-static tree maybe_get_template_decl_from_type_decl PROTO((tree));
-static int check_cv_quals_for_unify PROTO((int, tree, tree));
-static tree tsubst_template_arg_vector PROTO((tree, tree, int));
-static tree tsubst_template_parms PROTO((tree, tree, int));
-static void regenerate_decl_from_template PROTO((tree, tree));
-static tree most_specialized PROTO((tree, tree, tree));
-static tree most_specialized_class PROTO((tree, tree));
-static tree most_general_template PROTO((tree));
-static void set_mangled_name_for_template_decl PROTO((tree));
-static int template_class_depth_real PROTO((tree, int));
-static tree tsubst_aggr_type PROTO((tree, tree, int, tree, int));
-static tree tsubst_decl PROTO((tree, tree, tree, tree));
-static tree tsubst_arg_types PROTO((tree, tree, int, tree));
-static tree tsubst_function_type PROTO((tree, tree, int, tree));
-static void check_specialization_scope PROTO((void));
-static tree process_partial_specialization PROTO((tree));
-static void set_current_access_from_decl PROTO((tree));
-static void check_default_tmpl_args PROTO((tree, tree, int, int));
-static tree tsubst_call_declarator_parms PROTO((tree, tree, int, tree));
-static tree get_template_base_recursive PROTO((tree, tree,
+static tree get_bindings_overload PARAMS ((tree, tree, tree));
+static int for_each_template_parm PARAMS ((tree, tree_fn_t, void*));
+static tree build_template_parm_index PARAMS ((int, int, int, tree, tree));
+static int inline_needs_template_parms PARAMS ((tree));
+static void push_inline_template_parms_recursive PARAMS ((tree, int));
+static tree retrieve_specialization PARAMS ((tree, tree));
+static tree retrieve_local_specialization PARAMS ((tree));
+static tree register_specialization PARAMS ((tree, tree, tree));
+static void register_local_specialization PARAMS ((tree, tree));
+static int unregister_specialization PARAMS ((tree, tree));
+static tree reduce_template_parm_level PARAMS ((tree, tree, int));
+static tree build_template_decl PARAMS ((tree, tree));
+static int mark_template_parm PARAMS ((tree, void *));
+static tree tsubst_friend_function PARAMS ((tree, tree));
+static tree tsubst_friend_class PARAMS ((tree, tree));
+static tree get_bindings_real PARAMS ((tree, tree, tree, int, int, int));
+static int template_decl_level PARAMS ((tree));
+static tree maybe_get_template_decl_from_type_decl PARAMS ((tree));
+static int check_cv_quals_for_unify PARAMS ((int, tree, tree));
+static tree tsubst_template_arg_vector PARAMS ((tree, tree, int));
+static tree tsubst_template_parms PARAMS ((tree, tree, int));
+static void regenerate_decl_from_template PARAMS ((tree, tree));
+static tree most_specialized PARAMS ((tree, tree, tree));
+static tree most_specialized_class PARAMS ((tree, tree));
+static int template_class_depth_real PARAMS ((tree, int));
+static tree tsubst_aggr_type PARAMS ((tree, tree, int, tree, int));
+static tree tsubst_decl PARAMS ((tree, tree, tree));
+static tree tsubst_arg_types PARAMS ((tree, tree, int, tree));
+static tree tsubst_function_type PARAMS ((tree, tree, int, tree));
+static void check_specialization_scope PARAMS ((void));
+static tree process_partial_specialization PARAMS ((tree));
+static void set_current_access_from_decl PARAMS ((tree));
+static void check_default_tmpl_args PARAMS ((tree, tree, int, int));
+static tree tsubst_call_declarator_parms PARAMS ((tree, tree, int, tree));
+static tree get_template_base_recursive PARAMS ((tree, tree,
tree, tree, tree, int));
-static tree get_template_base PROTO((tree, tree, tree, tree));
-static tree try_class_unification PROTO((tree, tree, tree, tree));
-static int coerce_template_template_parms PROTO((tree, tree, int,
+static tree get_template_base PARAMS ((tree, tree, tree, tree));
+static int verify_class_unification PARAMS ((tree, tree, tree));
+static tree try_class_unification PARAMS ((tree, tree, tree, tree));
+static int coerce_template_template_parms PARAMS ((tree, tree, int,
tree, tree));
-static tree determine_specialization PROTO((tree, tree, tree *, int));
-static int template_args_equal PROTO((tree, tree));
-static void print_template_context PROTO((int));
-static int has_pvbases_p PROTO((tree, tree));
-
-/* We use TREE_VECs to hold template arguments. If there is only one
- level of template arguments, then the TREE_VEC contains the
- arguments directly. If there is more than one level of template
- arguments, then each entry in the TREE_VEC is itself a TREE_VEC,
- containing the template arguments for a single level. The first
- entry in the outer TREE_VEC is the outermost level of template
- parameters; the last is the innermost.
-
- It is incorrect to ever form a template argument vector containing
- only one level of arguments, but which is a TREE_VEC containing as
- its only entry the TREE_VEC for that level. */
-
-/* Non-zero if the template arguments is actually a vector of vectors,
- rather than just a vector. */
-#define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \
- (NODE != NULL_TREE \
- && TREE_CODE (NODE) == TREE_VEC \
- && TREE_VEC_LENGTH (NODE) > 0 \
- && TREE_VEC_ELT (NODE, 0) != NULL_TREE \
- && TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC)
-
-/* The depth of a template argument vector. When called directly by
- the parser, we use a TREE_LIST rather than a TREE_VEC to represent
- template arguments. In fact, we may even see NULL_TREE if there
- are no template arguments. In both of those cases, there is only
- one level of template arguments. */
-#define TMPL_ARGS_DEPTH(NODE) \
- (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (NODE) ? TREE_VEC_LENGTH (NODE) : 1)
-
-/* The LEVELth level of the template ARGS. Note that template
- parameter levels are indexed from 1, not from 0. */
-#define TMPL_ARGS_LEVEL(ARGS, LEVEL) \
- (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS) \
- ? TREE_VEC_ELT ((ARGS), (LEVEL) - 1) : ARGS)
-
-/* Set the LEVELth level of the template ARGS to VAL. This macro does
- not work with single-level argument vectors. */
-#define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL) \
- (TREE_VEC_ELT ((ARGS), (LEVEL) - 1) = (VAL))
-
-/* Accesses the IDXth parameter in the LEVELth level of the ARGS. */
-#define TMPL_ARG(ARGS, LEVEL, IDX) \
- (TREE_VEC_ELT (TMPL_ARGS_LEVEL (ARGS, LEVEL), IDX))
-
-/* Set the IDXth element in the LEVELth level of ARGS to VAL. This
- macro does not work with single-level argument vectors. */
-#define SET_TMPL_ARG(ARGS, LEVEL, IDX, VAL) \
- (TREE_VEC_ELT (TREE_VEC_ELT ((ARGS), (LEVEL) - 1), (IDX)) = (VAL))
-
-/* Given a single level of template arguments in NODE, return the
- number of arguments. */
-#define NUM_TMPL_ARGS(NODE) \
- ((NODE) == NULL_TREE ? 0 \
- : (TREE_CODE (NODE) == TREE_VEC \
- ? TREE_VEC_LENGTH (NODE) : list_length (NODE)))
-
-/* The number of levels of template parameters given by NODE. */
-#define TMPL_PARMS_DEPTH(NODE) \
- (TREE_INT_CST_HIGH (TREE_PURPOSE (NODE)))
+static tree determine_specialization PARAMS ((tree, tree, tree *, int));
+static int template_args_equal PARAMS ((tree, tree));
+static void tsubst_default_arguments PARAMS ((tree));
+static tree for_each_template_parm_r PARAMS ((tree *, int *, void *));
+static tree copy_default_args_to_explicit_spec_1 PARAMS ((tree, tree));
+static void copy_default_args_to_explicit_spec PARAMS ((tree));
+static int invalid_nontype_parm_type_p PARAMS ((tree, int));
+
+/* Called once to initialize pt.c. */
+
+void
+init_pt ()
+{
+ ggc_add_tree_root (&pending_templates, 1);
+ ggc_add_tree_root (&saved_trees, 1);
+ ggc_add_tree_root (&current_tinst_level, 1);
+}
/* Do any processing required when DECL (a member template declaration
using TEMPLATE_PARAMETERS as its innermost parameter list) is
@@ -251,6 +204,8 @@ finish_member_template_decl (decl)
}
return NULL_TREE;
}
+ else if (TREE_CODE (decl) == FIELD_DECL)
+ error ("data member `%D' cannot be a member template", decl);
else if (DECL_TEMPLATE_INFO (decl))
{
if (!DECL_TEMPLATE_SPECIALIZATION (decl))
@@ -262,7 +217,7 @@ finish_member_template_decl (decl)
return decl;
}
else
- cp_error ("invalid member template declaration `%D'", decl);
+ error ("invalid member template declaration `%D'", decl);
return error_mark_node;
}
@@ -296,7 +251,7 @@ template_class_depth_real (type, count_specializations)
for (depth = 0;
type && TREE_CODE (type) != NAMESPACE_DECL;
type = (TREE_CODE (type) == FUNCTION_DECL)
- ? DECL_REAL_CONTEXT (type) : TYPE_CONTEXT (type))
+ ? CP_DECL_CONTEXT (type) : TYPE_CONTEXT (type))
{
if (TREE_CODE (type) != FUNCTION_DECL)
{
@@ -364,7 +319,7 @@ push_inline_template_parms_recursive (parmlist, levels)
++processing_template_decl;
current_template_parms
- = tree_cons (build_int_2 (0, processing_template_decl),
+ = tree_cons (size_int (processing_template_decl),
parms, current_template_parms);
TEMPLATE_PARMS_FOR_INLINE (current_template_parms) = 1;
@@ -372,7 +327,7 @@ push_inline_template_parms_recursive (parmlist, levels)
for (i = 0; i < TREE_VEC_LENGTH (parms); ++i)
{
tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i));
- my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (parm)) == 'd', 0);
+ my_friendly_assert (DECL_P (parm), 0);
switch (TREE_CODE (parm))
{
@@ -389,15 +344,15 @@ push_inline_template_parms_recursive (parmlist, levels)
available. */
tree decl = build_decl (CONST_DECL, DECL_NAME (parm),
TREE_TYPE (parm));
- SET_DECL_ARTIFICIAL (decl);
+ DECL_ARTIFICIAL (decl) = 1;
DECL_INITIAL (decl) = DECL_INITIAL (parm);
- DECL_TEMPLATE_PARM_P (decl) = 1;
+ SET_DECL_TEMPLATE_PARM_P (decl);
pushdecl (decl);
}
break;
default:
- my_friendly_abort (0);
+ abort ();
}
}
}
@@ -482,7 +437,7 @@ is_member_template (t)
return 0;
/* A local class can't have member templates. */
- if (hack_decl_function_context (t))
+ if (decl_function_context (t))
return 0;
return (DECL_FUNCTION_MEMBER_P (DECL_TEMPLATE_RESULT (t))
@@ -490,7 +445,7 @@ is_member_template (t)
there are template classes surrounding the declaration,
then we have a member template. */
&& (TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (t)) >
- template_class_depth (DECL_CLASS_CONTEXT (t))));
+ template_class_depth (DECL_CONTEXT (t))));
}
#if 0 /* UNUSED */
@@ -521,9 +476,7 @@ is_member_template_class (t)
#endif
/* Return a new template argument vector which contains all of ARGS,
- but has as its innermost set of arguments the EXTRA_ARGS. The
- resulting vector will be built on a temporary obstack, and so must
- be explicitly copied to the permanent obstack, if required. */
+ but has as its innermost set of arguments the EXTRA_ARGS. */
static tree
add_to_template_args (args, extra_args)
@@ -536,7 +489,7 @@ add_to_template_args (args, extra_args)
int j;
extra_depth = TMPL_ARGS_DEPTH (extra_args);
- new_args = make_temp_vec (TMPL_ARGS_DEPTH (args) + extra_depth);
+ new_args = make_tree_vec (TMPL_ARGS_DEPTH (args) + extra_depth);
for (i = 1; i <= TMPL_ARGS_DEPTH (args); ++i)
SET_TMPL_ARGS_LEVEL (new_args, i, TMPL_ARGS_LEVEL (args, i));
@@ -582,6 +535,39 @@ add_outermost_template_args (args, extra_args)
return new_args;
}
+/* Return the N levels of innermost template arguments from the ARGS. */
+
+tree
+get_innermost_template_args (args, n)
+ tree args;
+ int n;
+{
+ tree new_args;
+ int extra_levels;
+ int i;
+
+ my_friendly_assert (n >= 0, 20000603);
+
+ /* If N is 1, just return the innermost set of template arguments. */
+ if (n == 1)
+ return TMPL_ARGS_LEVEL (args, TMPL_ARGS_DEPTH (args));
+
+ /* If we're not removing anything, just return the arguments we were
+ given. */
+ extra_levels = TMPL_ARGS_DEPTH (args) - n;
+ my_friendly_assert (extra_levels >= 0, 20000603);
+ if (extra_levels == 0)
+ return args;
+
+ /* Make a new set of arguments, not containing the outer arguments. */
+ new_args = make_tree_vec (n);
+ for (i = 1; i <= n; ++i)
+ SET_TMPL_ARGS_LEVEL (new_args, i,
+ TMPL_ARGS_LEVEL (args, i + extra_levels));
+
+ return new_args;
+}
+
/* We've got a template header coming up; push to a new level for storing
the parms. */
@@ -602,8 +588,7 @@ begin_template_parm_list ()
pushtag contains special code to call pushdecl_with_scope on the
TEMPLATE_DECL for S2. */
- pushlevel (0);
- declare_pseudo_global_level ();
+ begin_scope (sk_template_parms);
++processing_template_decl;
++processing_template_parmlist;
note_template_header (0);
@@ -627,7 +612,7 @@ check_specialization_scope ()
shall be declared in the namespace of which the class template
is a member. */
if (scope && TREE_CODE (scope) != NAMESPACE_DECL)
- cp_error ("explicit specialization in non-namespace scope `%D'",
+ error ("explicit specialization in non-namespace scope `%D'",
scope);
/* [temp.expl.spec]
@@ -639,7 +624,7 @@ check_specialization_scope ()
explicitly specialize a class member template if its enclosing
class templates are not explicitly specialized as well. */
if (current_template_parms)
- cp_error ("enclosing class templates are not explicitly specialized");
+ error ("enclosing class templates are not explicitly specialized");
}
/* We've just seen template <>. */
@@ -647,16 +632,18 @@ check_specialization_scope ()
void
begin_specialization ()
{
+ begin_scope (sk_template_spec);
note_template_header (1);
check_specialization_scope ();
}
-/* Called at then end of processing a declaration preceeded by
+/* Called at then end of processing a declaration preceded by
template<>. */
void
end_specialization ()
{
+ finish_scope ();
reset_specialization ();
}
@@ -707,12 +694,12 @@ maybe_process_partial_specialization (type)
if (IS_AGGR_TYPE (type) && CLASSTYPE_USE_TEMPLATE (type))
{
if (CLASSTYPE_IMPLICIT_INSTANTIATION (type)
- && TYPE_SIZE (type) == NULL_TREE)
+ && !COMPLETE_TYPE_P (type))
{
if (current_namespace
!= decl_namespace_context (CLASSTYPE_TI_TEMPLATE (type)))
{
- cp_pedwarn ("specializing `%#T' in different namespace", type);
+ pedwarn ("specializing `%#T' in different namespace", type);
cp_pedwarn_at (" from definition of `%#D'",
CLASSTYPE_TI_TEMPLATE (type));
}
@@ -721,10 +708,10 @@ maybe_process_partial_specialization (type)
push_template_decl (TYPE_MAIN_DECL (type));
}
else if (CLASSTYPE_TEMPLATE_INSTANTIATION (type))
- cp_error ("specialization of `%T' after instantiation", type);
+ error ("specialization of `%T' after instantiation", type);
}
else if (processing_specialization)
- cp_error ("explicit specialization of non-template `%T'", type);
+ error ("explicit specialization of non-template `%T'", type);
}
/* Retrieve the specialization (in the sense of [temp.spec] - a
@@ -758,6 +745,15 @@ retrieve_specialization (tmpl, args)
return NULL_TREE;
}
+/* Like retrieve_specialization, but for local declarations. */
+
+static tree
+retrieve_local_specialization (tmpl)
+ tree tmpl;
+{
+ return (tree) htab_find (local_specializations, tmpl);
+}
+
/* Returns non-zero iff DECL is a specialization of TMPL. */
int
@@ -783,8 +779,7 @@ is_specialization_of (decl, tmpl)
t != NULL_TREE;
t = CLASSTYPE_USE_TEMPLATE (t)
? TREE_TYPE (CLASSTYPE_TI_TEMPLATE (t)) : NULL_TREE)
- if (same_type_p (TYPE_MAIN_VARIANT (t),
- TYPE_MAIN_VARIANT (TREE_TYPE (tmpl))))
+ if (same_type_ignoring_top_level_qualifiers_p (t, TREE_TYPE (tmpl)))
return 1;
}
@@ -829,63 +824,72 @@ register_specialization (spec, tmpl, args)
for (s = DECL_TEMPLATE_SPECIALIZATIONS (tmpl);
s != NULL_TREE;
s = TREE_CHAIN (s))
- if (comp_template_args (TREE_PURPOSE (s), args))
- {
- tree fn = TREE_VALUE (s);
+ {
+ tree fn = TREE_VALUE (s);
- if (DECL_TEMPLATE_SPECIALIZATION (spec))
- {
- if (DECL_TEMPLATE_INSTANTIATION (fn))
- {
- if (TREE_USED (fn)
- || DECL_EXPLICIT_INSTANTIATION (fn))
- {
- cp_error ("specialization of %D after instantiation",
- fn);
- return spec;
- }
- else
- {
- /* This situation should occur only if the first
- specialization is an implicit instantiation,
- the second is an explicit specialization, and
- the implicit instantiation has not yet been
- used. That situation can occur if we have
- implicitly instantiated a member function and
- then specialized it later.
-
- We can also wind up here if a friend
- declaration that looked like an instantiation
- turns out to be a specialization:
-
- template <class T> void foo(T);
- class S { friend void foo<>(int) };
- template <> void foo(int);
-
- We transform the existing DECL in place so that
- any pointers to it become pointers to the
- updated declaration.
-
- If there was a definition for the template, but
- not for the specialization, we want this to
- look as if there is no definition, and vice
- versa. */
- DECL_INITIAL (fn) = NULL_TREE;
- duplicate_decls (spec, fn);
-
- return fn;
- }
- }
- else if (DECL_TEMPLATE_SPECIALIZATION (fn))
- {
- duplicate_decls (spec, fn);
- return fn;
- }
- }
+ /* We can sometimes try to re-register a specialization that we've
+ already got. In particular, regenerate_decl_from_template
+ calls duplicate_decls which will update the specialization
+ list. But, we'll still get called again here anyhow. It's
+ more convenient to simply allow this than to try to prevent it. */
+ if (fn == spec)
+ return spec;
+ else if (comp_template_args (TREE_PURPOSE (s), args))
+ {
+ if (DECL_TEMPLATE_SPECIALIZATION (spec))
+ {
+ if (DECL_TEMPLATE_INSTANTIATION (fn))
+ {
+ if (TREE_USED (fn)
+ || DECL_EXPLICIT_INSTANTIATION (fn))
+ {
+ error ("specialization of %D after instantiation",
+ fn);
+ return spec;
+ }
+ else
+ {
+ /* This situation should occur only if the first
+ specialization is an implicit instantiation,
+ the second is an explicit specialization, and
+ the implicit instantiation has not yet been
+ used. That situation can occur if we have
+ implicitly instantiated a member function and
+ then specialized it later.
+
+ We can also wind up here if a friend
+ declaration that looked like an instantiation
+ turns out to be a specialization:
+
+ template <class T> void foo(T);
+ class S { friend void foo<>(int) };
+ template <> void foo(int);
+
+ We transform the existing DECL in place so that
+ any pointers to it become pointers to the
+ updated declaration.
+
+ If there was a definition for the template, but
+ not for the specialization, we want this to
+ look as if there is no definition, and vice
+ versa. */
+ DECL_INITIAL (fn) = NULL_TREE;
+ duplicate_decls (spec, fn);
+
+ return fn;
+ }
+ }
+ else if (DECL_TEMPLATE_SPECIALIZATION (fn))
+ {
+ duplicate_decls (spec, fn);
+ return fn;
+ }
+ }
+ }
}
DECL_TEMPLATE_SPECIALIZATIONS (tmpl)
- = perm_tree_cons (args, spec, DECL_TEMPLATE_SPECIALIZATIONS (tmpl));
+ = tree_cons (args, spec, DECL_TEMPLATE_SPECIALIZATIONS (tmpl));
return spec;
}
@@ -913,6 +917,20 @@ unregister_specialization (spec, tmpl)
return 0;
}
+/* Like register_specialization, but for local declarations. We are
+ registering SPEC, an instantiation of TMPL. */
+
+static void
+register_local_specialization (spec, tmpl)
+ tree spec;
+ tree tmpl;
+{
+ void **slot;
+
+ slot = htab_find_slot (local_specializations, tmpl, INSERT);
+ *slot = spec;
+}
+
/* Print the list of candidate FNS in an error message. */
void
@@ -956,7 +974,6 @@ determine_specialization (template_id, decl, targs_out,
tree* targs_out;
int need_member_template;
{
- tree fn;
tree fns;
tree targs;
tree explicit_targs;
@@ -975,14 +992,20 @@ determine_specialization (template_id, decl, targs_out,
return error_mark_node;
/* Check for baselinks. */
- if (TREE_CODE (fns) == TREE_LIST)
+ if (BASELINK_P (fns))
fns = TREE_VALUE (fns);
+ if (!is_overloaded_fn (fns))
+ {
+ error ("`%D' is not a function template", fns);
+ return error_mark_node;
+ }
+
for (; fns; fns = OVL_NEXT (fns))
{
tree tmpl;
- fn = OVL_CURRENT (fns);
+ tree fn = OVL_CURRENT (fns);
if (TREE_CODE (fn) == TEMPLATE_DECL)
/* DECL might be a specialization of FN. */
@@ -999,6 +1022,9 @@ determine_specialization (template_id, decl, targs_out,
/* This is just an ordinary non-member function. Nothing can
be a specialization of that. */
continue;
+ else if (DECL_ARTIFICIAL (fn))
+ /* Cannot specialize functions that are created implicitly. */
+ continue;
else
{
tree decl_arg_types;
@@ -1013,6 +1039,12 @@ determine_specialization (template_id, decl, targs_out,
Here, S<int>::f is a non-template, but S<int> is a
template class. If FN has the same type as DECL, we
might be in business. */
+
+ if (!DECL_TEMPLATE_INFO (fn))
+ /* Its enclosing class is an explicit specialization
+ of a template class. This is not a candidate. */
+ continue;
+
if (!same_type_p (TREE_TYPE (TREE_TYPE (decl)),
TREE_TYPE (TREE_TYPE (fn))))
/* The return types differ. */
@@ -1042,7 +1074,7 @@ determine_specialization (template_id, decl, targs_out,
continue;
/* Save this template, and the arguments deduced. */
- templates = scratch_tree_cons (targs, tmpl, templates);
+ templates = tree_cons (targs, tmpl, templates);
}
if (templates && TREE_CHAIN (templates))
@@ -1082,7 +1114,7 @@ determine_specialization (template_id, decl, targs_out,
if (tmpl && tmpl != error_mark_node)
{
targs = get_bindings (tmpl, decl, explicit_targs);
- templates = scratch_tree_cons (targs, tmpl, NULL_TREE);
+ templates = tree_cons (targs, tmpl, NULL_TREE);
}
}
@@ -1113,7 +1145,7 @@ determine_specialization (template_id, decl, targs_out,
}
/* It was a specialization of a template. */
- targs = DECL_TI_ARGS (DECL_RESULT (TREE_VALUE (templates)));
+ targs = DECL_TI_ARGS (DECL_TEMPLATE_RESULT (TREE_VALUE (templates)));
if (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (targs))
{
*targs_out = copy_node (targs);
@@ -1125,7 +1157,128 @@ determine_specialization (template_id, decl, targs_out,
*targs_out = TREE_PURPOSE (templates);
return TREE_VALUE (templates);
}
+
+/* Returns a chain of parameter types, exactly like the SPEC_TYPES,
+ but with the default argument values filled in from those in the
+ TMPL_TYPES. */
+
+static tree
+copy_default_args_to_explicit_spec_1 (spec_types,
+ tmpl_types)
+ tree spec_types;
+ tree tmpl_types;
+{
+ tree new_spec_types;
+
+ if (!spec_types)
+ return NULL_TREE;
+
+ if (spec_types == void_list_node)
+ return void_list_node;
+
+ /* Substitute into the rest of the list. */
+ new_spec_types =
+ copy_default_args_to_explicit_spec_1 (TREE_CHAIN (spec_types),
+ TREE_CHAIN (tmpl_types));
+
+ /* Add the default argument for this parameter. */
+ return hash_tree_cons (TREE_PURPOSE (tmpl_types),
+ TREE_VALUE (spec_types),
+ new_spec_types);
+}
+
+/* DECL is an explicit specialization. Replicate default arguments
+ from the template it specializes. (That way, code like:
+
+ template <class T> void f(T = 3);
+ template <> void f(double);
+ void g () { f (); }
+
+ works, as required.) An alternative approach would be to look up
+ the correct default arguments at the call-site, but this approach
+ is consistent with how implicit instantiations are handled. */
+
+static void
+copy_default_args_to_explicit_spec (decl)
+ tree decl;
+{
+ tree tmpl;
+ tree spec_types;
+ tree tmpl_types;
+ tree new_spec_types;
+ tree old_type;
+ tree new_type;
+ tree t;
+ tree object_type = NULL_TREE;
+ tree in_charge = NULL_TREE;
+ tree vtt = NULL_TREE;
+
+ /* See if there's anything we need to do. */
+ tmpl = DECL_TI_TEMPLATE (decl);
+ tmpl_types = TYPE_ARG_TYPES (TREE_TYPE (DECL_TEMPLATE_RESULT (tmpl)));
+ for (t = tmpl_types; t; t = TREE_CHAIN (t))
+ if (TREE_PURPOSE (t))
+ break;
+ if (!t)
+ return;
+
+ old_type = TREE_TYPE (decl);
+ spec_types = TYPE_ARG_TYPES (old_type);
+
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
+ {
+ /* Remove the this pointer, but remember the object's type for
+ CV quals. */
+ object_type = TREE_TYPE (TREE_VALUE (spec_types));
+ spec_types = TREE_CHAIN (spec_types);
+ tmpl_types = TREE_CHAIN (tmpl_types);
+ if (DECL_HAS_IN_CHARGE_PARM_P (decl))
+ {
+ /* DECL may contain more parameters than TMPL due to the extra
+ in-charge parameter in constructors and destructors. */
+ in_charge = spec_types;
+ spec_types = TREE_CHAIN (spec_types);
+ }
+ if (DECL_HAS_VTT_PARM_P (decl))
+ {
+ vtt = spec_types;
+ spec_types = TREE_CHAIN (spec_types);
+ }
+ }
+
+ /* Compute the merged default arguments. */
+ new_spec_types =
+ copy_default_args_to_explicit_spec_1 (spec_types, tmpl_types);
+
+ /* Compute the new FUNCTION_TYPE. */
+ if (object_type)
+ {
+ if (vtt)
+ new_spec_types = hash_tree_cons (TREE_PURPOSE (vtt),
+ TREE_VALUE (vtt),
+ new_spec_types);
+
+ if (in_charge)
+ /* Put the in-charge parameter back. */
+ new_spec_types = hash_tree_cons (TREE_PURPOSE (in_charge),
+ TREE_VALUE (in_charge),
+ new_spec_types);
+
+ new_type = build_cplus_method_type (object_type,
+ TREE_TYPE (old_type),
+ new_spec_types);
+ }
+ else
+ new_type = build_function_type (TREE_TYPE (old_type),
+ new_spec_types);
+ new_type = build_type_attribute_variant (new_type,
+ TYPE_ATTRIBUTES (old_type));
+ new_type = build_exception_variant (new_type,
+ TYPE_RAISES_EXCEPTIONS (old_type));
+ TREE_TYPE (decl) = new_type;
+}
+
/* Check to see if the function just declared, as indicated in
DECLARATOR, and in DECL, is a specialization of a function
template. We may also discover that the declaration is an explicit
@@ -1175,117 +1328,127 @@ check_explicit_specialization (declarator, decl, template_count, flags)
int specialization = 0;
int explicit_instantiation = 0;
int member_specialization = 0;
-
tree ctype = DECL_CLASS_CONTEXT (decl);
tree dname = DECL_NAME (decl);
+ tmpl_spec_kind tsk;
- if (processing_specialization)
- {
- /* The last template header was of the form template <>. */
-
- if (template_header_count > template_count)
- {
- /* There were more template headers than qualifying template
- classes. */
- if (template_header_count - template_count > 1)
- /* There shouldn't be that many template parameter lists.
- There can be at most one parameter list for every
- qualifying class, plus one for the function itself. */
- cp_error ("too many template parameter lists in declaration of `%D'", decl);
+ tsk = current_tmpl_spec_kind (template_count);
- SET_DECL_TEMPLATE_SPECIALIZATION (decl);
- if (ctype)
- member_specialization = 1;
- else
- specialization = 1;
- }
- else if (template_header_count == template_count)
+ switch (tsk)
+ {
+ case tsk_none:
+ if (processing_specialization)
{
- /* The counts are equal. So, this might be a
- specialization, but it is not a specialization of a
- member template. It might be something like
-
- template <class T> struct S {
- void f(int i);
- };
- template <>
- void S<int>::f(int i) {} */
specialization = 1;
SET_DECL_TEMPLATE_SPECIALIZATION (decl);
}
- else
+ else if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR)
{
- /* This cannot be an explicit specialization. There are not
- enough headers for all of the qualifying classes. For
- example, we might have:
-
- template <>
- void S<int>::T<char>::f();
+ if (is_friend)
+ /* This could be something like:
- But, we're missing another template <>. */
- cp_error("too few template parameter lists in declaration of `%D'", decl);
- return decl;
- }
- }
- else if (processing_explicit_instantiation)
- {
- if (template_header_count)
- cp_error ("template parameter list used in explicit instantiation");
-
- if (have_def)
- cp_error ("definition provided for explicit instantiation");
+ template <class T> void f(T);
+ class S { friend void f<>(int); } */
+ specialization = 1;
+ else
+ {
+ /* This case handles bogus declarations like template <>
+ template <class T> void f<int>(); */
- explicit_instantiation = 1;
- }
- else if (ctype != NULL_TREE
- && !TYPE_BEING_DEFINED (ctype)
- && CLASSTYPE_TEMPLATE_INSTANTIATION (ctype)
- && !is_friend)
- {
- /* This case catches outdated code that looks like this:
+ error ("template-id `%D' in declaration of primary template",
+ declarator);
+ return decl;
+ }
+ }
+ break;
+
+ case tsk_invalid_member_spec:
+ /* The error has already been reported in
+ check_specialization_scope. */
+ return error_mark_node;
+
+ case tsk_invalid_expl_inst:
+ error ("template parameter list used in explicit instantiation");
+
+ /* Fall through. */
- template <class T> struct S { void f(); };
- void S<int>::f() {} // Missing template <>
+ case tsk_expl_inst:
+ if (have_def)
+ error ("definition provided for explicit instantiation");
+
+ explicit_instantiation = 1;
+ break;
- We disable this check when the type is being defined to
- avoid complaining about default compiler-generated
- constructors, destructors, and assignment operators.
- Since the type is an instantiation, not a specialization,
- these are the only functions that can be defined before
- the class is complete. */
+ case tsk_excessive_parms:
+ error ("too many template parameter lists in declaration of `%D'",
+ decl);
+ return error_mark_node;
- /* If they said
- template <class T> void S<int>::f() {}
- that's bogus. */
+ /* Fall through. */
+ case tsk_expl_spec:
+ SET_DECL_TEMPLATE_SPECIALIZATION (decl);
+ if (ctype)
+ member_specialization = 1;
+ else
+ specialization = 1;
+ break;
+
+ case tsk_insufficient_parms:
if (template_header_count)
{
- cp_error ("template parameters specified in specialization");
+ error("too few template parameter lists in declaration of `%D'",
+ decl);
return decl;
}
+ else if (ctype != NULL_TREE
+ && !TYPE_BEING_DEFINED (ctype)
+ && CLASSTYPE_TEMPLATE_INSTANTIATION (ctype)
+ && !is_friend)
+ {
+ /* For backwards compatibility, we accept:
- if (pedantic)
- cp_pedwarn
- ("explicit specialization not preceded by `template <>'");
- specialization = 1;
- SET_DECL_TEMPLATE_SPECIALIZATION (decl);
- }
- else if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR)
- {
- if (is_friend)
- /* This could be something like:
+ template <class T> struct S { void f(); };
+ void S<int>::f() {} // Missing template <>
- template <class T> void f(T);
- class S { friend void f<>(int); } */
- specialization = 1;
- else
+ That used to be legal C++. */
+ if (pedantic)
+ pedwarn
+ ("explicit specialization not preceded by `template <>'");
+ specialization = 1;
+ SET_DECL_TEMPLATE_SPECIALIZATION (decl);
+ }
+ break;
+
+ case tsk_template:
+ if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR)
{
/* This case handles bogus declarations like template <>
template <class T> void f<int>(); */
- cp_error ("template-id `%D' in declaration of primary template",
- declarator);
+ if (uses_template_parms (declarator))
+ error ("partial specialization `%D' of function template",
+ declarator);
+ else
+ error ("template-id `%D' in declaration of primary template",
+ declarator);
return decl;
}
+
+ if (ctype && CLASSTYPE_TEMPLATE_INSTANTIATION (ctype))
+ /* This is a specialization of a member template, without
+ specialization the containing class. Something like:
+
+ template <class T> struct S {
+ template <class U> void f (U);
+ };
+ template <> template <class U> void S<int>::f(U) {}
+
+ That's a specialization -- but of the entire template. */
+ specialization = 1;
+ break;
+
+ default:
+ abort ();
}
if (specialization || member_specialization)
@@ -1294,12 +1457,12 @@ check_explicit_specialization (declarator, decl, template_count, flags)
for (; t; t = TREE_CHAIN (t))
if (TREE_PURPOSE (t))
{
- cp_pedwarn
+ pedwarn
("default argument specified in explicit specialization");
break;
}
if (current_lang_name == lang_name_c)
- cp_error ("template specialization with C linkage");
+ error ("template specialization with C linkage");
}
if (specialization || member_specialization || explicit_instantiation)
@@ -1355,7 +1518,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
else if (TREE_CODE (TREE_OPERAND (declarator, 0)) == LOOKUP_EXPR)
{
/* A friend declaration. We can't do much, because we don't
- know what this resolves to, yet. */
+ know what this resolves to, yet. */
my_friendly_assert (is_friend != 0, 0);
my_friendly_assert (!explicit_instantiation, 0);
SET_DECL_IMPLICIT_INSTANTIATION (decl);
@@ -1387,14 +1550,14 @@ check_explicit_specialization (declarator, decl, template_count, flags)
program is ill-formed.
Similar language is found in [temp.explicit]. */
- cp_error ("specialization of implicitly-declared special member function");
+ error ("specialization of implicitly-declared special member function");
return error_mark_node;
}
name = is_constructor ? ctor_identifier : dtor_identifier;
}
- if (!IDENTIFIER_TYPENAME_P (name))
+ if (!DECL_CONV_FN_P (decl))
{
idx = lookup_fnfields_1 (ctype, name);
if (idx >= 0)
@@ -1430,7 +1593,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
if (fns == NULL_TREE)
{
- cp_error ("no member function `%D' declared in `%T'",
+ error ("no member function `%D' declared in `%T'",
name, ctype);
return error_mark_node;
}
@@ -1471,60 +1634,63 @@ check_explicit_specialization (declarator, decl, template_count, flags)
/* If TMPL is not the most general template (for
example, if TMPL is a friend template that is
injected into namespace scope), then there will
- be too many levels fo TARGS. Remove some of them
+ be too many levels of TARGS. Remove some of them
here. */
int i;
tree new_targs;
- new_targs = make_temp_vec (parm_depth);
+ new_targs = make_tree_vec (parm_depth);
for (i = arg_depth - parm_depth; i < arg_depth; ++i)
TREE_VEC_ELT (new_targs, i - (arg_depth - parm_depth))
= TREE_VEC_ELT (targs, i);
targs = new_targs;
}
- decl = instantiate_template (tmpl, targs);
- return decl;
+ return instantiate_template (tmpl, targs);
}
-
- /* If we though that the DECL was a member function, but it
+
+ /* If this is a specialization of a member template of a
+ template class. In we want to return the TEMPLATE_DECL,
+ not the specialization of it. */
+ if (tsk == tsk_template)
+ {
+ SET_DECL_TEMPLATE_SPECIALIZATION (tmpl);
+ DECL_INITIAL (DECL_TEMPLATE_RESULT (tmpl)) = NULL_TREE;
+ return tmpl;
+ }
+
+ /* If we thought that the DECL was a member function, but it
turns out to be specializing a static member function,
make DECL a static member function as well. */
if (DECL_STATIC_FUNCTION_P (tmpl)
&& DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
{
- revert_static_member_fn (&decl, 0, 0);
+ revert_static_member_fn (decl);
last_function_parms = TREE_CHAIN (last_function_parms);
}
/* Set up the DECL_TEMPLATE_INFO for DECL. */
- DECL_TEMPLATE_INFO (decl)
- = perm_tree_cons (tmpl, targs, NULL_TREE);
-
- /* Mangle the function name appropriately. Note that we do
- not mangle specializations of non-template member
- functions of template classes, e.g. with
+ DECL_TEMPLATE_INFO (decl) = tree_cons (tmpl, targs, NULL_TREE);
- template <class T> struct S { void f(); }
+ /* Inherit default function arguments from the template
+ DECL is specializing. */
+ copy_default_args_to_explicit_spec (decl);
- and given the specialization
-
- template <> void S<int>::f() {}
-
- we do not mangle S<int>::f() here. That's because it's
- just an ordinary member function and doesn't need special
- treatment. We do this here so that the ordinary,
- non-template, name-mangling algorith will not be used
- later. */
- if ((is_member_template (tmpl) || ctype == NULL_TREE)
- && name_mangling_version >= 1)
- set_mangled_name_for_template_decl (decl);
+ /* This specialization has the same protection as the
+ template it specializes. */
+ TREE_PRIVATE (decl) = TREE_PRIVATE (gen_tmpl);
+ TREE_PROTECTED (decl) = TREE_PROTECTED (gen_tmpl);
if (is_friend && !have_def)
/* This is not really a declaration of a specialization.
It's just the name of an instantiation. But, it's not
a request for an instantiation, either. */
SET_DECL_IMPLICIT_INSTANTIATION (decl);
+ else if (DECL_CONSTRUCTOR_P (decl) || DECL_DESTRUCTOR_P (decl))
+ /* This is indeed a specialization. In case of constructors
+ and destructors, we need in-charge and not-in-charge
+ versions in V3 ABI. */
+ clone_function_decl (decl, /*update_method_vec_p=*/0);
/* Register this specialization so that we can find it
again. */
@@ -1575,7 +1741,7 @@ maybe_check_template_type (type)
;
else if (template_header_count > context_depth + 1)
/* There are two many template parameter lists. */
- cp_error ("too many template parameter lists in declaration of `%T'", type);
+ error ("too many template parameter lists in declaration of `%T'", type);
}
}
@@ -1660,8 +1826,7 @@ check_template_shadow (decl)
that OLDDECL might be an OVERLOAD (or perhaps even an
ERROR_MARK), so we can't just blithely assume it to be a _DECL
node. */
- if (TREE_CODE_CLASS (TREE_CODE (olddecl)) != 'd'
- || !DECL_TEMPLATE_PARM_P (olddecl))
+ if (!DECL_P (olddecl) || !DECL_TEMPLATE_PARM_P (olddecl))
return;
/* We check for decl != olddecl to avoid bogus errors for using a
@@ -1722,6 +1887,9 @@ reduce_template_parm_level (index, type, levels)
decl, type);
TEMPLATE_PARM_DESCENDANTS (index) = t;
+ DECL_ARTIFICIAL (decl) = 1;
+ SET_DECL_TEMPLATE_PARM_P (decl);
+
/* Template template parameters need this. */
DECL_TEMPLATE_PARMS (decl)
= DECL_TEMPLATE_PARMS (TEMPLATE_PARM_DECL (index));
@@ -1752,10 +1920,8 @@ process_template_parm (list, next)
{
tree p = TREE_VALUE (tree_last (list));
- if (TREE_CODE (p) == TYPE_DECL)
+ if (TREE_CODE (p) == TYPE_DECL || TREE_CODE (p) == TEMPLATE_DECL)
idx = TEMPLATE_TYPE_IDX (TREE_TYPE (p));
- else if (TREE_CODE (p) == TEMPLATE_DECL)
- idx = TEMPLATE_TYPE_IDX (TREE_TYPE (DECL_TEMPLATE_RESULT (p)));
else
idx = TEMPLATE_PARM_IDX (DECL_INITIAL (p));
++idx;
@@ -1768,7 +1934,8 @@ process_template_parm (list, next)
my_friendly_assert (TREE_CODE (TREE_PURPOSE (parm)) == TREE_LIST, 260);
/* is a const-param */
parm = grokdeclarator (TREE_VALUE (parm), TREE_PURPOSE (parm),
- PARM, 0, NULL_TREE);
+ PARM, 0, NULL);
+ SET_DECL_TEMPLATE_PARM_P (parm);
/* [temp.param]
@@ -1778,26 +1945,8 @@ process_template_parm (list, next)
/* A template parameter is not modifiable. */
TREE_READONLY (parm) = 1;
- if (IS_AGGR_TYPE (TREE_TYPE (parm))
- && TREE_CODE (TREE_TYPE (parm)) != TEMPLATE_TYPE_PARM
- && TREE_CODE (TREE_TYPE (parm)) != TYPENAME_TYPE)
- {
- cp_error ("`%#T' is not a valid type for a template constant parameter",
- TREE_TYPE (parm));
- if (DECL_NAME (parm) == NULL_TREE)
- error (" a template type parameter must begin with `class' or `typename'");
- TREE_TYPE (parm) = void_type_node;
- }
- else if (pedantic
- && (TREE_CODE (TREE_TYPE (parm)) == REAL_TYPE
- || TREE_CODE (TREE_TYPE (parm)) == COMPLEX_TYPE))
- cp_pedwarn ("`%T' is not a valid type for a template constant parameter",
- TREE_TYPE (parm));
- if (TREE_PERMANENT (parm) == 0)
- {
- parm = copy_node (parm);
- TREE_PERMANENT (parm) = 1;
- }
+ if (invalid_nontype_parm_type_p (TREE_TYPE (parm), 1))
+ TREE_TYPE (parm) = void_type_node;
decl = build_decl (CONST_DECL, DECL_NAME (parm), TREE_TYPE (parm));
DECL_INITIAL (parm) = DECL_INITIAL (decl)
= build_template_parm_index (idx, processing_template_decl,
@@ -1811,7 +1960,7 @@ process_template_parm (list, next)
if (parm && TREE_CODE (parm) == TEMPLATE_DECL)
{
- t = make_lang_type (TEMPLATE_TEMPLATE_PARM);
+ t = make_aggr_type (TEMPLATE_TEMPLATE_PARM);
/* This is for distinguishing between real templates and template
template parameters */
TREE_TYPE (parm) = t;
@@ -1820,7 +1969,7 @@ process_template_parm (list, next)
}
else
{
- t = make_lang_type (TEMPLATE_TYPE_PARM);
+ t = make_aggr_type (TEMPLATE_TYPE_PARM);
/* parm is either IDENTIFIER_NODE or NULL_TREE */
decl = build_decl (TYPE_DECL, parm, t);
}
@@ -1833,8 +1982,8 @@ process_template_parm (list, next)
processing_template_decl,
decl, TREE_TYPE (parm));
}
- SET_DECL_ARTIFICIAL (decl);
- DECL_TEMPLATE_PARM_P (decl) = 1;
+ DECL_ARTIFICIAL (decl) = 1;
+ SET_DECL_TEMPLATE_PARM_P (decl);
pushdecl (decl);
parm = build_tree_list (defval, parm);
return chainon (list, parm);
@@ -1850,15 +1999,19 @@ end_template_parm_list (parms)
tree parms;
{
int nparms;
- tree parm;
+ tree parm, next;
tree saved_parmlist = make_tree_vec (list_length (parms));
current_template_parms
- = tree_cons (build_int_2 (0, processing_template_decl),
+ = tree_cons (size_int (processing_template_decl),
saved_parmlist, current_template_parms);
- for (parm = parms, nparms = 0; parm; parm = TREE_CHAIN (parm), nparms++)
- TREE_VEC_ELT (saved_parmlist, nparms) = parm;
+ for (parm = parms, nparms = 0; parm; parm = next, nparms++)
+ {
+ next = TREE_CHAIN (parm);
+ TREE_VEC_ELT (saved_parmlist, nparms) = parm;
+ TREE_CHAIN (parm) = NULL_TREE;
+ }
--processing_template_parmlist;
@@ -1876,11 +2029,10 @@ end_template_decl ()
return;
/* This matches the pushlevel in begin_template_parm_list. */
- poplevel (0, 0, 0);
+ finish_scope ();
--processing_template_decl;
current_template_parms = TREE_CHAIN (current_template_parms);
- (void) get_pending_sizes (); /* Why? */
}
/* Given a template argument vector containing the template PARMS.
@@ -1948,9 +2100,15 @@ build_template_decl (decl, parms)
DECL_CONTEXT (tmpl) = DECL_CONTEXT (decl);
if (DECL_LANG_SPECIFIC (decl))
{
- DECL_CLASS_CONTEXT (tmpl) = DECL_CLASS_CONTEXT (decl);
+ if (CAN_HAVE_FULL_LANG_DECL_P (decl))
+ DECL_VIRTUAL_CONTEXT (tmpl) = DECL_VIRTUAL_CONTEXT (decl);
DECL_STATIC_FUNCTION_P (tmpl) = DECL_STATIC_FUNCTION_P (decl);
DECL_CONSTRUCTOR_P (tmpl) = DECL_CONSTRUCTOR_P (decl);
+ DECL_NONCONVERTING_P (tmpl) = DECL_NONCONVERTING_P (decl);
+ DECL_ASSIGNMENT_OPERATOR_P (tmpl) = DECL_ASSIGNMENT_OPERATOR_P (decl);
+ if (DECL_OVERLOADED_OPERATOR_P (decl))
+ SET_OVERLOADED_OPERATOR_CODE (tmpl,
+ DECL_OVERLOADED_OPERATOR_P (decl));
}
return tmpl;
@@ -2023,7 +2181,7 @@ process_partial_specialization (decl)
tree type = TREE_TYPE (decl);
tree maintmpl = CLASSTYPE_TI_TEMPLATE (type);
tree specargs = CLASSTYPE_TI_ARGS (type);
- tree inner_args = innermost_args (specargs);
+ tree inner_args = INNERMOST_TEMPLATE_ARGS (specargs);
tree inner_parms = INNERMOST_TEMPLATE_PARMS (current_template_parms);
tree main_inner_parms = DECL_INNERMOST_TEMPLATE_PARMS (maintmpl);
int nargs = TREE_VEC_LENGTH (inner_args);
@@ -2065,10 +2223,10 @@ process_partial_specialization (decl)
or some such would have been OK. */
tpd.level = TMPL_PARMS_DEPTH (current_template_parms);
tpd.parms = alloca (sizeof (int) * ntparms);
- bzero ((PTR) tpd.parms, sizeof (int) * ntparms);
+ memset ((PTR) tpd.parms, 0, sizeof (int) * ntparms);
tpd.arg_uses_template_parms = alloca (sizeof (int) * nargs);
- bzero ((PTR) tpd.arg_uses_template_parms, sizeof (int) * nargs);
+ memset ((PTR) tpd.arg_uses_template_parms, 0, sizeof (int) * nargs);
for (i = 0; i < nargs; ++i)
{
tpd.current_arg = i;
@@ -2080,14 +2238,14 @@ process_partial_specialization (decl)
if (tpd.parms[i] == 0)
{
/* One of the template parms was not used in the
- specialization. */
+ specialization. */
if (!did_error_intro)
{
- cp_error ("template parameters not used in partial specialization:");
+ error ("template parameters not used in partial specialization:");
did_error_intro = 1;
}
- cp_error (" `%D'",
+ error (" `%D'",
TREE_VALUE (TREE_VEC_ELT (inner_parms, i)));
}
@@ -2095,10 +2253,11 @@ process_partial_specialization (decl)
The argument list of the specialization shall not be identical to
the implicit argument list of the primary template. */
- if (comp_template_args (inner_args,
- innermost_args (CLASSTYPE_TI_ARGS (TREE_TYPE
- (maintmpl)))))
- cp_error ("partial specialization `%T' does not specialize any template arguments", type);
+ if (comp_template_args
+ (inner_args,
+ INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (TREE_TYPE
+ (maintmpl)))))
+ error ("partial specialization `%T' does not specialize any template arguments", type);
/* [temp.class.spec]
@@ -2115,7 +2274,7 @@ process_partial_specialization (decl)
{
tree arg = TREE_VEC_ELT (inner_args, i);
if (/* These first two lines are the `non-type' bit. */
- TREE_CODE_CLASS (TREE_CODE (arg)) != 't'
+ !TYPE_P (arg)
&& TREE_CODE (arg) != TEMPLATE_DECL
/* This next line is the `argument expression is not just a
simple identifier' condition and also the `specialized
@@ -2123,7 +2282,7 @@ process_partial_specialization (decl)
&& TREE_CODE (arg) != TEMPLATE_PARM_INDEX)
{
if (tpd.arg_uses_template_parms[i])
- cp_error ("template argument `%E' involves template parameter(s)", arg);
+ error ("template argument `%E' involves template parameter(s)", arg);
else
{
/* Look at the corresponding template parameter,
@@ -2151,7 +2310,7 @@ process_partial_specialization (decl)
template, not in the specialization. */
tpd2.current_arg = i;
tpd2.arg_uses_template_parms[i] = 0;
- bzero ((PTR) tpd2.parms, sizeof (int) * nargs);
+ memset ((PTR) tpd2.parms, 0, sizeof (int) * nargs);
for_each_template_parm (type,
&mark_template_parm,
&tpd2);
@@ -2166,7 +2325,7 @@ process_partial_specialization (decl)
if (tpd2.parms[j] != 0
&& tpd.arg_uses_template_parms [j])
{
- cp_error ("type `%T' of template argument `%E' depends on template parameter(s)",
+ error ("type `%T' of template argument `%E' depends on template parameter(s)",
type,
arg);
break;
@@ -2180,9 +2339,9 @@ process_partial_specialization (decl)
/* We've already got this specialization. */
return decl;
- DECL_TEMPLATE_SPECIALIZATIONS (maintmpl) = CLASSTYPE_TI_SPEC_INFO (type)
- = perm_tree_cons (inner_args, inner_parms,
- DECL_TEMPLATE_SPECIALIZATIONS (maintmpl));
+ DECL_TEMPLATE_SPECIALIZATIONS (maintmpl)
+ = tree_cons (inner_args, inner_parms,
+ DECL_TEMPLATE_SPECIALIZATIONS (maintmpl));
TREE_TYPE (DECL_TEMPLATE_SPECIALIZATIONS (maintmpl)) = type;
return decl;
}
@@ -2200,7 +2359,8 @@ check_default_tmpl_args (decl, parms, is_primary, is_partial)
int is_partial;
{
const char *msg;
- int last_level_to_check;
+ int last_level_to_check;
+ tree parm_level;
/* [temp.param]
@@ -2209,21 +2369,58 @@ check_default_tmpl_args (decl, parms, is_primary, is_partial)
in the template-parameter-list of the definition of a member of a
class template. */
+ if (TREE_CODE (CP_DECL_CONTEXT (decl)) == FUNCTION_DECL)
+ /* You can't have a function template declaration in a local
+ scope, nor you can you define a member of a class template in a
+ local scope. */
+ return;
+
if (current_class_type
&& !TYPE_BEING_DEFINED (current_class_type)
&& DECL_LANG_SPECIFIC (decl)
/* If this is either a friend defined in the scope of the class
or a member function. */
- && DECL_CLASS_CONTEXT (decl) == current_class_type
+ && ((DECL_CONTEXT (decl)
+ && same_type_p (DECL_CONTEXT (decl), current_class_type))
+ || (DECL_FRIEND_CONTEXT (decl)
+ && same_type_p (DECL_FRIEND_CONTEXT (decl),
+ current_class_type)))
/* And, if it was a member function, it really was defined in
the scope of the class. */
- && (!DECL_FUNCTION_MEMBER_P (decl) || DECL_DEFINED_IN_CLASS_P (decl)))
+ && (!DECL_FUNCTION_MEMBER_P (decl) || DECL_INITIALIZED_IN_CLASS_P (decl)))
/* We already checked these parameters when the template was
declared, so there's no need to do it again now. This function
was defined in class scope, but we're processing it's body now
that the class is complete. */
return;
+ /* [temp.param]
+
+ If a template-parameter has a default template-argument, all
+ subsequent template-parameters shall have a default
+ template-argument supplied. */
+ for (parm_level = parms; parm_level; parm_level = TREE_CHAIN (parm_level))
+ {
+ tree inner_parms = TREE_VALUE (parm_level);
+ int ntparms = TREE_VEC_LENGTH (inner_parms);
+ int seen_def_arg_p = 0;
+ int i;
+
+ for (i = 0; i < ntparms; ++i)
+ {
+ tree parm = TREE_VEC_ELT (inner_parms, i);
+ if (TREE_PURPOSE (parm))
+ seen_def_arg_p = 1;
+ else if (seen_def_arg_p)
+ {
+ error ("no default argument for `%D'", TREE_VALUE (parm));
+ /* For better subsequent error-recovery, we indicate that
+ there should have been a default argument. */
+ TREE_PURPOSE (parm) = error_mark_node;
+ }
+ }
+ }
+
if (TREE_CODE (decl) != TYPE_DECL || is_partial || !is_primary)
/* For an ordinary class template, default template arguments are
allowed at the innermost level, e.g.:
@@ -2246,9 +2443,9 @@ check_default_tmpl_args (decl, parms, is_primary, is_partial)
/* Figure out what error message to issue. */
if (TREE_CODE (decl) == FUNCTION_DECL)
- msg = "default argument for template parameter in function template `%D'";
+ msg = "default template arguments may not be used in function templates";
else if (is_partial)
- msg = "default argument in partial specialization `%D'";
+ msg = "default template arguments may not be used in partial specializations";
else
msg = "default argument for template parameter for class enclosing `%D'";
@@ -2266,11 +2463,13 @@ check_default_tmpl_args (decl, parms, is_primary, is_partial)
/* Check everything. */
last_level_to_check = 0;
- for (; parms && TMPL_PARMS_DEPTH (parms) >= last_level_to_check;
- parms = TREE_CHAIN (parms))
+ for (parm_level = parms;
+ parm_level && TMPL_PARMS_DEPTH (parm_level) >= last_level_to_check;
+ parm_level = TREE_CHAIN (parm_level))
{
- tree inner_parms = TREE_VALUE (parms);
- int i, ntparms;
+ tree inner_parms = TREE_VALUE (parm_level);
+ int i;
+ int ntparms;
ntparms = TREE_VEC_LENGTH (inner_parms);
for (i = 0; i < ntparms; ++i)
@@ -2278,7 +2477,7 @@ check_default_tmpl_args (decl, parms, is_primary, is_partial)
{
if (msg)
{
- cp_error (msg, decl);
+ error (msg, decl);
msg = 0;
}
@@ -2312,9 +2511,10 @@ push_template_decl_real (decl, is_friend)
tree ctx;
int primary;
int is_partial;
+ int new_template_p = 0;
/* See if this is a partial specialization. */
- is_partial = (TREE_CODE (decl) == TYPE_DECL && DECL_ARTIFICIAL (decl)
+ is_partial = (DECL_IMPLICIT_TYPEDEF_P (decl)
&& TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE
&& CLASSTYPE_TEMPLATE_SPECIALIZATION (TREE_TYPE (decl)));
@@ -2324,15 +2524,15 @@ push_template_decl_real (decl, is_friend)
/* For a friend, we want the context of the friend function, not
the type of which it is a friend. */
ctx = DECL_CONTEXT (decl);
- else if (DECL_REAL_CONTEXT (decl)
- && TREE_CODE (DECL_REAL_CONTEXT (decl)) != NAMESPACE_DECL)
+ else if (CP_DECL_CONTEXT (decl)
+ && TREE_CODE (CP_DECL_CONTEXT (decl)) != NAMESPACE_DECL)
/* In the case of a virtual function, we want the class in which
it is defined. */
- ctx = DECL_REAL_CONTEXT (decl);
+ ctx = CP_DECL_CONTEXT (decl);
else
- /* Otherwise, if we're currently definining some class, the DECL
+ /* Otherwise, if we're currently defining some class, the DECL
is assumed to be a member of the class. */
- ctx = current_class_type;
+ ctx = current_scope ();
if (ctx && TREE_CODE (ctx) == NAMESPACE_DECL)
ctx = NULL_TREE;
@@ -2340,32 +2540,23 @@ push_template_decl_real (decl, is_friend)
if (!DECL_CONTEXT (decl))
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
- /* For determining whether this is a primary template or not, we're really
- interested in the lexical context, not the true context. */
- if (is_friend)
- info = current_class_type;
- else
- info = ctx;
-
/* See if this is a primary template. */
- if (info && TREE_CODE (info) == FUNCTION_DECL)
- primary = 0;
- /* Note that template_class_depth returns 0 if given NULL_TREE, so
- this next line works even when we are at global scope. */
- else if (processing_template_decl > template_class_depth (info))
- primary = 1;
- else
- primary = 0;
+ primary = template_parm_scope_p ();
if (primary)
{
if (current_lang_name == lang_name_c)
- cp_error ("template with C linkage");
- if (TREE_CODE (decl) == TYPE_DECL && ANON_AGGRNAME_P (DECL_NAME (decl)))
- cp_error ("template class without a name");
- if (TREE_CODE (decl) == TYPE_DECL
- && TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE)
- cp_error ("template declaration of `%#T'", TREE_TYPE (decl));
+ error ("template with C linkage");
+ else if (TREE_CODE (decl) == TYPE_DECL
+ && ANON_AGGRNAME_P (DECL_NAME (decl)))
+ error ("template class without a name");
+ else if ((DECL_IMPLICIT_TYPEDEF_P (decl)
+ && CLASS_TYPE_P (TREE_TYPE (decl)))
+ || (TREE_CODE (decl) == VAR_DECL && ctx && CLASS_TYPE_P (ctx))
+ || TREE_CODE (decl) == FUNCTION_DECL)
+ /* OK */;
+ else
+ error ("template declaration of `%#D'", decl);
}
/* Check to see that the rules regarding the use of default
@@ -2387,10 +2578,27 @@ push_template_decl_real (decl, is_friend)
&& DECL_TEMPLATE_INFO (decl)
&& DECL_TI_TEMPLATE (decl))
tmpl = DECL_TI_TEMPLATE (decl);
+ /* If DECL is a TYPE_DECL for a class-template, then there won't
+ be DECL_LANG_SPECIFIC. The information equivalent to
+ DECL_TEMPLATE_INFO is found in TYPE_TEMPLATE_INFO instead. */
+ else if (DECL_IMPLICIT_TYPEDEF_P (decl)
+ && TYPE_TEMPLATE_INFO (TREE_TYPE (decl))
+ && TYPE_TI_TEMPLATE (TREE_TYPE (decl)))
+ {
+ /* Since a template declaration already existed for this
+ class-type, we must be redeclaring it here. Make sure
+ that the redeclaration is legal. */
+ redeclare_class_template (TREE_TYPE (decl),
+ current_template_parms);
+ /* We don't need to create a new TEMPLATE_DECL; just use the
+ one we already had. */
+ tmpl = TYPE_TI_TEMPLATE (TREE_TYPE (decl));
+ }
else
{
tmpl = build_template_decl (decl, current_template_parms);
-
+ new_template_p = 1;
+
if (DECL_LANG_SPECIFIC (decl)
&& DECL_TEMPLATE_SPECIALIZATION (decl))
{
@@ -2407,9 +2615,6 @@ push_template_decl_real (decl, is_friend)
tree a, t, current, parms;
int i;
- if (CLASSTYPE_TEMPLATE_INSTANTIATION (ctx))
- cp_error ("must specialize `%#T' before defining member `%#D'",
- ctx, decl);
if (TREE_CODE (decl) == TYPE_DECL)
{
if ((IS_AGGR_TYPE_CODE (TREE_CODE (TREE_TYPE (decl)))
@@ -2419,13 +2624,13 @@ push_template_decl_real (decl, is_friend)
tmpl = TYPE_TI_TEMPLATE (TREE_TYPE (decl));
else
{
- cp_error ("`%D' does not declare a template type", decl);
+ error ("`%D' does not declare a template type", decl);
return decl;
}
}
- else if (! DECL_TEMPLATE_INFO (decl))
+ else if (!DECL_LANG_SPECIFIC (decl) || !DECL_TEMPLATE_INFO (decl))
{
- cp_error ("template definition of non-template `%#D'", decl);
+ error ("template definition of non-template `%#D'", decl);
return decl;
}
else
@@ -2451,10 +2656,12 @@ push_template_decl_real (decl, is_friend)
TREE_TYPE (new_tmpl) = TREE_TYPE (decl);
DECL_TI_TEMPLATE (decl) = new_tmpl;
SET_DECL_TEMPLATE_SPECIALIZATION (new_tmpl);
- DECL_TEMPLATE_INFO (new_tmpl) =
- perm_tree_cons (tmpl, args, NULL_TREE);
+ DECL_TEMPLATE_INFO (new_tmpl)
+ = tree_cons (tmpl, args, NULL_TREE);
- register_specialization (new_tmpl, tmpl, args);
+ register_specialization (new_tmpl,
+ most_general_template (tmpl),
+ args);
return decl;
}
@@ -2464,7 +2671,7 @@ push_template_decl_real (decl, is_friend)
i = TMPL_PARMS_DEPTH (parms);
if (TMPL_ARGS_DEPTH (args) != i)
{
- cp_error ("expected %d levels of template parms for `%#D', got %d",
+ error ("expected %d levels of template parms for `%#D', got %d",
i, decl, TMPL_ARGS_DEPTH (args));
}
else
@@ -2476,12 +2683,12 @@ push_template_decl_real (decl, is_friend)
if (TREE_VEC_LENGTH (t) != TREE_VEC_LENGTH (a))
{
if (current == decl)
- cp_error ("got %d template parameters for `%#D'",
+ error ("got %d template parameters for `%#D'",
TREE_VEC_LENGTH (a), decl);
else
- cp_error ("got %d template parameters for `%#T'",
+ error ("got %d template parameters for `%#T'",
TREE_VEC_LENGTH (a), current);
- cp_error (" but %d required", TREE_VEC_LENGTH (t));
+ error (" but %d required", TREE_VEC_LENGTH (t));
}
/* Perhaps we should also check that the parms are used in the
@@ -2501,25 +2708,25 @@ push_template_decl_real (decl, is_friend)
that we do not try to push a global template friend declared in a
template class; such a thing may well depend on the template
parameters of the class. */
- if (! ctx
+ if (new_template_p && !ctx
&& !(is_friend && template_class_depth (current_class_type) > 0))
tmpl = pushdecl_namespace_level (tmpl);
if (primary)
DECL_PRIMARY_TEMPLATE (tmpl) = tmpl;
- info = perm_tree_cons (tmpl, args, NULL_TREE);
+ info = tree_cons (tmpl, args, NULL_TREE);
- if (TREE_CODE (decl) == TYPE_DECL && DECL_ARTIFICIAL (decl))
+ if (DECL_IMPLICIT_TYPEDEF_P (decl))
{
SET_TYPE_TEMPLATE_INFO (TREE_TYPE (tmpl), info);
if ((!ctx || TREE_CODE (ctx) != FUNCTION_DECL)
- && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE)
+ && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE
+ /* Don't change the name if we've already set it up. */
+ && !IDENTIFIER_TEMPLATE (DECL_NAME (decl)))
DECL_NAME (decl) = classtype_mangled_name (TREE_TYPE (decl));
}
- else if (! DECL_LANG_SPECIFIC (decl))
- cp_error ("template declaration of `%#D'", decl);
- else
+ else if (DECL_LANG_SPECIFIC (decl))
DECL_TEMPLATE_INFO (decl) = info;
return DECL_TEMPLATE_RESULT (tmpl);
@@ -2549,7 +2756,7 @@ redeclare_class_template (type, parms)
if (!TYPE_TEMPLATE_INFO (type))
{
- cp_error ("`%T' is not a template type", type);
+ error ("`%T' is not a template type", type);
return;
}
@@ -2566,7 +2773,7 @@ redeclare_class_template (type, parms)
if (TREE_VEC_LENGTH (parms) != TREE_VEC_LENGTH (tmpl_parms))
{
cp_error_at ("previous declaration `%D'", tmpl);
- cp_error ("used %d template parameter%s instead of %d",
+ error ("used %d template parameter%s instead of %d",
TREE_VEC_LENGTH (tmpl_parms),
TREE_VEC_LENGTH (tmpl_parms) == 1 ? "" : "s",
TREE_VEC_LENGTH (parms));
@@ -2583,7 +2790,7 @@ redeclare_class_template (type, parms)
if (TREE_CODE (tmpl_parm) != TREE_CODE (parm))
{
cp_error_at ("template parameter `%#D'", tmpl_parm);
- cp_error ("redeclared here as `%#D'", parm);
+ error ("redeclared here as `%#D'", parm);
return;
}
@@ -2593,7 +2800,7 @@ redeclare_class_template (type, parms)
A template-parameter may not be given default arguments
by two different declarations in the same scope. */
- cp_error ("redefinition of default argument for `%#D'", parm);
+ error ("redefinition of default argument for `%#D'", parm);
cp_error_at (" original definition appeared here", tmpl_parm);
return;
}
@@ -2602,12 +2809,16 @@ redeclare_class_template (type, parms)
/* Update the previous template parameters (which are the ones
that will really count) with the new default value. */
TREE_PURPOSE (TREE_VEC_ELT (tmpl_parms, i)) = parm_default;
+ else if (tmpl_default != NULL_TREE)
+ /* Update the new parameters, too; they'll be used as the
+ parameters for any members. */
+ TREE_PURPOSE (TREE_VEC_ELT (parms, i)) = tmpl_default;
}
}
/* Attempt to convert the non-type template parameter EXPR to the
indicated TYPE. If the conversion is successful, return the
- converted value. If the conversion is unsuccesful, return
+ converted value. If the conversion is unsuccessful, return
NULL_TREE if we issued an error message, or error_mark_node if we
did not. We issue error messages for out-and-out bad template
parameters, but not simply because the conversion failed, since we
@@ -2643,9 +2854,12 @@ convert_nontype_argument (type, expr)
--a pointer to member expressed as described in _expr.unary.op_. */
- /* An integral constant-expression can include const variables
- or enumerators. */
- if (INTEGRAL_TYPE_P (expr_type) && TREE_READONLY_DECL_P (expr))
+ /* An integral constant-expression can include const variables or
+ enumerators. Simplify things by folding them to their values,
+ unless we're about to bind the declaration to a reference
+ parameter. */
+ if (INTEGRAL_TYPE_P (expr_type)
+ && TREE_CODE (type) != REFERENCE_TYPE)
expr = decl_constant_value (expr);
if (is_overloaded_fn (expr))
@@ -2671,25 +2885,26 @@ convert_nontype_argument (type, expr)
tree e = expr;
STRIP_NOPS (e);
- if (TREE_CODE (type) == REFERENCE_TYPE
- || TREE_CODE (expr_type) == ARRAY_TYPE)
+ if (TREE_CODE (expr_type) == ARRAY_TYPE
+ || (TREE_CODE (type) == REFERENCE_TYPE
+ && TREE_CODE (e) != ADDR_EXPR))
referent = e;
else
{
if (TREE_CODE (e) != ADDR_EXPR)
{
bad_argument:
- cp_error ("`%E' is not a valid template argument", expr);
+ error ("`%E' is not a valid template argument", expr);
if (TYPE_PTR_P (expr_type))
{
if (TREE_CODE (TREE_TYPE (expr_type)) == FUNCTION_TYPE)
- cp_error ("it must be the address of a function with external linkage");
+ error ("it must be the address of a function with external linkage");
else
- cp_error ("it must be the address of an object with external linkage");
+ error ("it must be the address of an object with external linkage");
}
else if (TYPE_PTRMEM_P (expr_type)
|| TYPE_PTRMEMFUNC_P (expr_type))
- cp_error ("it must be a pointer-to-member of the form `&X::Y'");
+ error ("it must be a pointer-to-member of the form `&X::Y'");
return NULL_TREE;
}
@@ -2700,9 +2915,8 @@ convert_nontype_argument (type, expr)
if (TREE_CODE (referent) == STRING_CST)
{
- cp_error ("string literal %E is not a valid template argument",
+ error ("string literal %E is not a valid template argument because it is the address of an object with static linkage",
referent);
- error ("because it is the address of an object with static linkage");
return NULL_TREE;
}
@@ -2711,30 +2925,27 @@ convert_nontype_argument (type, expr)
;
else if (TREE_CODE (referent) != VAR_DECL)
goto bad_argument;
- else if (!TREE_PUBLIC (referent))
+ else if (!DECL_EXTERNAL_LINKAGE_P (referent))
{
- cp_error ("address of non-extern `%E' cannot be used as template argument", referent);
+ error ("address of non-extern `%E' cannot be used as template argument", referent);
return error_mark_node;
}
}
else if (INTEGRAL_TYPE_P (expr_type)
|| TYPE_PTRMEM_P (expr_type)
- || TYPE_PTRMEMFUNC_P (expr_type)
- /* The next two are g++ extensions. */
- || TREE_CODE (expr_type) == REAL_TYPE
- || TREE_CODE (expr_type) == COMPLEX_TYPE)
+ || TYPE_PTRMEMFUNC_P (expr_type))
{
if (! TREE_CONSTANT (expr))
{
non_constant:
- cp_error ("non-constant `%E' cannot be used as template argument",
+ error ("non-constant `%E' cannot be used as template argument",
expr);
return NULL_TREE;
}
}
else
{
- cp_error ("object `%E' cannot be used as template argument", expr);
+ error ("object `%E' cannot be used as template argument", expr);
return NULL_TREE;
}
@@ -2761,19 +2972,6 @@ convert_nontype_argument (type, expr)
return expr;
- case REAL_TYPE:
- case COMPLEX_TYPE:
- /* These are g++ extensions. */
- if (TREE_CODE (expr_type) != TREE_CODE (type))
- return error_mark_node;
-
- expr = digest_init (type, expr, (tree*) 0);
-
- if (TREE_CODE (expr) != REAL_CST)
- goto non_constant;
-
- return expr;
-
case POINTER_TYPE:
{
tree type_pointed_to = TREE_TYPE (type);
@@ -2813,12 +3011,12 @@ convert_nontype_argument (type, expr)
else
fns = expr;
- fn = instantiate_type (type_pointed_to, fns, 0);
+ fn = instantiate_type (type_pointed_to, fns, itf_none);
if (fn == error_mark_node)
return error_mark_node;
- if (!TREE_PUBLIC (fn))
+ if (!DECL_EXTERNAL_LINKAGE_P (fn))
{
if (really_overloaded_fn (fns))
return error_mark_node;
@@ -2860,6 +3058,15 @@ convert_nontype_argument (type, expr)
{
tree type_referred_to = TREE_TYPE (type);
+ /* If this expression already has reference type, get the
+ underling object. */
+ if (TREE_CODE (expr_type) == REFERENCE_TYPE)
+ {
+ my_friendly_assert (TREE_CODE (expr) == ADDR_EXPR, 20000604);
+ expr = TREE_OPERAND (expr, 0);
+ expr_type = TREE_TYPE (expr);
+ }
+
if (TREE_CODE (type_referred_to) == FUNCTION_TYPE)
{
/* For a non-type template-parameter of type reference to
@@ -2867,17 +3074,16 @@ convert_nontype_argument (type, expr)
template-argument represents a set of overloaded
functions, the matching function is selected from the
set (_over.over_). */
- tree fns = expr;
tree fn;
- fn = instantiate_type (type_referred_to, fns, 0);
+ fn = instantiate_type (type_referred_to, expr, itf_none);
if (fn == error_mark_node)
return error_mark_node;
- if (!TREE_PUBLIC (fn))
+ if (!DECL_EXTERNAL_LINKAGE_P (fn))
{
- if (really_overloaded_fn (fns))
+ if (really_overloaded_fn (expr))
/* Don't issue an error here; we might get a different
function if the overloading had worked out
differently. */
@@ -2890,7 +3096,7 @@ convert_nontype_argument (type, expr)
TREE_TYPE (fn)),
0);
- return fn;
+ expr = fn;
}
else
{
@@ -2900,27 +3106,22 @@ convert_nontype_argument (type, expr)
identical) type of the template-argument. The
template-parameter is bound directly to the
template-argument, which must be an lvalue. */
- if ((TYPE_MAIN_VARIANT (expr_type)
- != TYPE_MAIN_VARIANT (type_referred_to))
+ if (!same_type_p (TYPE_MAIN_VARIANT (expr_type),
+ TYPE_MAIN_VARIANT (type_referred_to))
|| !at_least_as_qualified_p (type_referred_to,
expr_type)
|| !real_lvalue_p (expr))
return error_mark_node;
- else
- return expr;
}
+
+ mark_addressable (expr);
+ return build1 (ADDR_EXPR, type, expr);
}
break;
case RECORD_TYPE:
{
- if (!TYPE_PTRMEMFUNC_P (type))
- /* This handles templates like
- template<class T, T t> void f();
- when T is substituted with any class. The second template
- parameter becomes invalid and the template candidate is
- rejected. */
- return error_mark_node;
+ my_friendly_assert (TYPE_PTRMEMFUNC_P (type), 20010112);
/* For a non-type template-parameter of type pointer to member
function, no conversions apply. If the template-argument
@@ -2944,7 +3145,7 @@ convert_nontype_argument (type, expr)
if (TREE_CODE (expr) != ADDR_EXPR)
return error_mark_node;
- expr = instantiate_type (type, expr, 0);
+ expr = instantiate_type (type, expr, itf_none);
if (expr == error_mark_node)
return error_mark_node;
@@ -2957,7 +3158,7 @@ convert_nontype_argument (type, expr)
default:
/* All non-type parameters must have one of these types. */
- my_friendly_abort (0);
+ abort ();
break;
}
@@ -3046,7 +3247,7 @@ coerce_template_template_parms (parm_parms, arg_parms, complain,
break;
default:
- my_friendly_abort (0);
+ abort ();
}
}
return 1;
@@ -3072,7 +3273,7 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
tree inner_args;
int is_type, requires_type, is_tmpl_type, requires_tmpl_type;
- inner_args = innermost_args (args);
+ inner_args = INNERMOST_TEMPLATE_ARGS (args);
if (TREE_CODE (arg) == TREE_LIST
&& TREE_TYPE (arg) != NULL_TREE
@@ -3091,38 +3292,44 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
requires_type = (TREE_CODE (parm) == TYPE_DECL
|| requires_tmpl_type);
- /* Check if it is a class template. If REQUIRES_TMPL_TYPE is true,
- we also accept implicitly created TYPE_DECL as a valid argument.
- This is necessary to handle the case where we pass a template name
- to a template template parameter in a scope where we've derived from
- in instantiation of that template, so the template name refers to that
- instantiation. We really ought to handle this better. */
- is_tmpl_type
- = ((TREE_CODE (arg) == TEMPLATE_DECL
- && TREE_CODE (DECL_TEMPLATE_RESULT (arg)) == TYPE_DECL)
- || (TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM
- && !TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (arg))
- || (TREE_CODE (arg) == RECORD_TYPE
- && CLASSTYPE_TEMPLATE_INFO (arg)
- && TREE_CODE (TYPE_NAME (arg)) == TYPE_DECL
- && DECL_ARTIFICIAL (TYPE_NAME (arg))
- && requires_tmpl_type
- && is_base_of_enclosing_class (arg, current_class_type)));
- if (is_tmpl_type && TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM)
+ if (TREE_CODE (arg) != RECORD_TYPE)
+ is_tmpl_type = ((TREE_CODE (arg) == TEMPLATE_DECL
+ && TREE_CODE (DECL_TEMPLATE_RESULT (arg)) == TYPE_DECL)
+ || TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM
+ || TREE_CODE (arg) == UNBOUND_CLASS_TEMPLATE);
+ else if (CLASSTYPE_TEMPLATE_INFO (arg) && !CLASSTYPE_USE_TEMPLATE (arg)
+ && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (arg)))
+ {
+ if (is_base_of_enclosing_class (arg, current_class_type))
+ /* This is a template name used within the scope of the
+ template. It could be the template, or it could be the
+ instantiation. Choose whichever makes sense. */
+ is_tmpl_type = requires_tmpl_type;
+ else
+ is_tmpl_type = 1;
+ }
+ else
+ /* It is a non-template class, or a specialization of a template
+ class, or a non-template member of a template class. */
+ is_tmpl_type = 0;
+
+ if (is_tmpl_type
+ && (TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM
+ || TREE_CODE (arg) == UNBOUND_CLASS_TEMPLATE))
arg = TYPE_STUB_DECL (arg);
else if (is_tmpl_type && TREE_CODE (arg) == RECORD_TYPE)
arg = CLASSTYPE_TI_TEMPLATE (arg);
- is_type = TREE_CODE_CLASS (TREE_CODE (arg)) == 't' || is_tmpl_type;
+ is_type = TYPE_P (arg) || is_tmpl_type;
if (requires_type && ! is_type && TREE_CODE (arg) == SCOPE_REF
&& TREE_CODE (TREE_OPERAND (arg, 0)) == TEMPLATE_TYPE_PARM)
{
- cp_pedwarn ("to refer to a type member of a template parameter,");
- cp_pedwarn (" use `typename %E'", arg);
+ pedwarn ("to refer to a type member of a template parameter, use `typename %E'", arg);
arg = make_typename_type (TREE_OPERAND (arg, 0),
- TREE_OPERAND (arg, 1));
+ TREE_OPERAND (arg, 1),
+ complain);
is_type = 1;
}
if (is_type != requires_type)
@@ -3131,14 +3338,14 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
{
if (complain)
{
- cp_error ("type/value mismatch at argument %d in template parameter list for `%D'",
+ error ("type/value mismatch at argument %d in template parameter list for `%D'",
i + 1, in_decl);
if (is_type)
- cp_error (" expected a constant of type `%T', got `%T'",
+ error (" expected a constant of type `%T', got `%T'",
TREE_TYPE (parm),
(is_tmpl_type ? DECL_NAME (arg) : arg));
else
- cp_error (" expected a type, got `%E'", arg);
+ error (" expected a type, got `%E'", arg);
}
}
return error_mark_node;
@@ -3147,12 +3354,12 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
{
if (in_decl && complain)
{
- cp_error ("type/value mismatch at argument %d in template parameter list for `%D'",
+ error ("type/value mismatch at argument %d in template parameter list for `%D'",
i + 1, in_decl);
if (is_tmpl_type)
- cp_error (" expected a type, got `%T'", DECL_NAME (arg));
+ error (" expected a type, got `%T'", DECL_NAME (arg));
else
- cp_error (" expected a class template, got `%T'", arg);
+ error (" expected a class template, got `%T'", arg);
}
return error_mark_node;
}
@@ -3161,30 +3368,38 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
{
if (requires_tmpl_type)
{
- tree parmparm = DECL_INNERMOST_TEMPLATE_PARMS (parm);
- tree argparm = DECL_INNERMOST_TEMPLATE_PARMS (arg);
-
- if (coerce_template_template_parms (parmparm, argparm, complain,
- in_decl, inner_args))
- {
- val = arg;
-
- /* TEMPLATE_TEMPLATE_PARM node is preferred over
- TEMPLATE_DECL. */
- if (val != error_mark_node
- && DECL_TEMPLATE_TEMPLATE_PARM_P (val))
- val = TREE_TYPE (val);
- }
+ if (TREE_CODE (TREE_TYPE (arg)) == UNBOUND_CLASS_TEMPLATE)
+ /* The number of argument required is not known yet.
+ Just accept it for now. */
+ val = TREE_TYPE (arg);
else
{
- if (in_decl && complain)
+ tree parmparm = DECL_INNERMOST_TEMPLATE_PARMS (parm);
+ tree argparm = DECL_INNERMOST_TEMPLATE_PARMS (arg);
+
+ if (coerce_template_template_parms (parmparm, argparm,
+ complain, in_decl,
+ inner_args))
{
- cp_error ("type/value mismatch at argument %d in template parameter list for `%D'",
- i + 1, in_decl);
- cp_error (" expected a template of type `%D', got `%D'", parm, arg);
+ val = arg;
+
+ /* TEMPLATE_TEMPLATE_PARM node is preferred over
+ TEMPLATE_DECL. */
+ if (val != error_mark_node
+ && DECL_TEMPLATE_TEMPLATE_PARM_P (val))
+ val = TREE_TYPE (val);
}
+ else
+ {
+ if (in_decl && complain)
+ {
+ error ("type/value mismatch at argument %d in template parameter list for `%D'",
+ i + 1, in_decl);
+ error (" expected a template of type `%D', got `%D'", parm, arg);
+ }
- val = error_mark_node;
+ val = error_mark_node;
+ }
}
}
else
@@ -3200,11 +3415,11 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
tree t = no_linkage_check (val);
if (t)
{
- if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
- cp_pedwarn
+ if (TYPE_ANONYMOUS_P (t))
+ pedwarn
("template-argument `%T' uses anonymous type", val);
else
- cp_error
+ error
("template-argument `%T' uses local type `%T'",
val, t);
return error_mark_node;
@@ -3216,6 +3431,9 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
{
tree t = tsubst (TREE_TYPE (parm), args, complain, in_decl);
+ if (invalid_nontype_parm_type_p (t, complain))
+ return error_mark_node;
+
if (processing_template_decl)
arg = maybe_fold_nontype_arg (arg);
@@ -3228,7 +3446,7 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
the standard. Accepting this is not merely an
extension, since deciding whether or not these
conversions can occur is part of determining which
- function template to call, or whether a given epxlicit
+ function template to call, or whether a given explicit
argument specification is legal. */
val = convert_nontype_argument (t, arg);
else
@@ -3237,7 +3455,7 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
if (val == NULL_TREE)
val = error_mark_node;
else if (val == error_mark_node && complain)
- cp_error ("could not convert template argument `%E' to `%T'",
+ error ("could not convert template argument `%E' to `%T'",
arg, t);
}
@@ -3254,10 +3472,7 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
If REQUIRE_ALL_ARGUMENTS is non-zero, all arguments must be
provided in ARGLIST, or else trailing parameters must have default
values. If REQUIRE_ALL_ARGUMENTS is zero, we will attempt argument
- deduction for any unspecified trailing arguments.
-
- The resulting TREE_VEC is allocated on a temporary obstack, and
- must be explicitly copied if it will be permanent. */
+ deduction for any unspecified trailing arguments. */
static tree
coerce_template_parms (parms, args, in_decl,
@@ -3273,7 +3488,7 @@ coerce_template_parms (parms, args, in_decl,
tree new_args;
tree new_inner_args;
- inner_args = innermost_args (args);
+ inner_args = INNERMOST_TEMPLATE_ARGS (args);
nargs = NUM_TMPL_ARGS (inner_args);
nparms = TREE_VEC_LENGTH (parms);
@@ -3284,7 +3499,7 @@ coerce_template_parms (parms, args, in_decl,
{
if (complain)
{
- cp_error ("wrong number of template arguments (%d, should be %d)",
+ error ("wrong number of template arguments (%d, should be %d)",
nargs, nparms);
if (in_decl)
@@ -3294,7 +3509,7 @@ coerce_template_parms (parms, args, in_decl,
return error_mark_node;
}
- new_inner_args = make_temp_vec (nparms);
+ new_inner_args = make_tree_vec (nparms);
new_args = add_outermost_template_args (args, new_inner_args);
for (i = 0; i < nparms; i++)
{
@@ -3335,7 +3550,7 @@ coerce_template_parms (parms, args, in_decl,
}
else if (arg == error_mark_node)
{
- cp_error ("template argument %d is invalid", i + 1);
+ error ("template argument %d is invalid", i + 1);
arg = error_mark_node;
}
else
@@ -3362,13 +3577,14 @@ template_args_equal (ot, nt)
{
if (nt == ot)
return 1;
- if (TREE_CODE (nt) != TREE_CODE (ot))
- return 0;
+
if (TREE_CODE (nt) == TREE_VEC)
/* For member templates */
- return comp_template_args (ot, nt);
- else if (TREE_CODE_CLASS (TREE_CODE (ot)) == 't')
- return same_type_p (ot, nt);
+ return TREE_CODE (ot) == TREE_VEC && comp_template_args (ot, nt);
+ else if (TYPE_P (nt))
+ return TYPE_P (ot) && same_type_p (ot, nt);
+ else if (TREE_CODE (ot) == TREE_VEC || TYPE_P (ot))
+ return 0;
else
return (cp_tree_equal (ot, nt) > 0);
}
@@ -3401,7 +3617,7 @@ comp_template_args (oldargs, newargs)
static char *
mangle_class_name_for_template (name, parms, arglist)
- char *name;
+ const char *name;
tree parms, arglist;
{
static struct obstack scratch_obstack;
@@ -3414,13 +3630,13 @@ mangle_class_name_for_template (name, parms, arglist)
obstack_free (&scratch_obstack, scratch_firstobj);
scratch_firstobj = obstack_alloc (&scratch_obstack, 1);
-#define ccat(c) obstack_1grow (&scratch_obstack, (c));
-#define cat(s) obstack_grow (&scratch_obstack, (s), strlen (s))
+#define ccat(C) obstack_1grow (&scratch_obstack, (C));
+#define cat(S) obstack_grow (&scratch_obstack, (S), strlen (S))
cat (name);
ccat ('<');
nparms = TREE_VEC_LENGTH (parms);
- arglist = innermost_args (arglist);
+ arglist = INNERMOST_TEMPLATE_ARGS (arglist);
my_friendly_assert (nparms == TREE_VEC_LENGTH (arglist), 268);
for (i = 0; i < nparms; i++)
{
@@ -3432,7 +3648,7 @@ mangle_class_name_for_template (name, parms, arglist)
if (TREE_CODE (parm) == TYPE_DECL)
{
- cat (type_as_string_real (arg, 0, 1));
+ cat (type_as_string (arg, TFF_CHASE_TYPEDEF));
continue;
}
else if (TREE_CODE (parm) == TEMPLATE_DECL)
@@ -3442,17 +3658,21 @@ mangle_class_name_for_template (name, parms, arglist)
/* Already substituted with real template. Just output
the template name here */
tree context = DECL_CONTEXT (arg);
- if (context)
- {
- my_friendly_assert (TREE_CODE (context) == NAMESPACE_DECL, 980422);
- cat(decl_as_string (DECL_CONTEXT (arg), 0));
+ if (context)
+ {
+ /* The template may be defined in a namespace, or
+ may be a member template. */
+ my_friendly_assert (TREE_CODE (context) == NAMESPACE_DECL
+ || CLASS_TYPE_P (context),
+ 980422);
+ cat(decl_as_string (DECL_CONTEXT (arg), TFF_PLAIN_IDENTIFIER));
cat("::");
}
cat (IDENTIFIER_POINTER (DECL_NAME (arg)));
}
else
/* Output the parameter declaration */
- cat (type_as_string_real (arg, 0, 1));
+ cat (type_as_string (arg, TFF_CHASE_TYPEDEF));
continue;
}
else
@@ -3467,7 +3687,7 @@ mangle_class_name_for_template (name, parms, arglist)
}
/* No need to check arglist against parmlist here; we did that
in coerce_template_parms, called from lookup_template_class. */
- cat (expr_as_string (arg, 0));
+ cat (expr_as_string (arg, TFF_PLAIN_IDENTIFIER));
}
{
char *bufp = obstack_next_free (&scratch_obstack);
@@ -3518,20 +3738,35 @@ static void
add_pending_template (d)
tree d;
{
- tree ti;
-
- if (TREE_CODE_CLASS (TREE_CODE (d)) == 't')
- ti = CLASSTYPE_TEMPLATE_INFO (d);
- else
- ti = DECL_TEMPLATE_INFO (d);
+ tree ti = (TYPE_P (d)
+ ? CLASSTYPE_TEMPLATE_INFO (d)
+ : DECL_TEMPLATE_INFO (d));
+ tree pt;
+ int level;
if (TI_PENDING_TEMPLATE_FLAG (ti))
return;
- *template_tail = perm_tree_cons
- (build_srcloc_here (), d, NULL_TREE);
- template_tail = &TREE_CHAIN (*template_tail);
+ /* We are called both from instantiate_decl, where we've already had a
+ tinst_level pushed, and instantiate_template, where we haven't.
+ Compensate. */
+ level = !(current_tinst_level && TINST_DECL (current_tinst_level) == d);
+
+ if (level)
+ push_tinst_level (d);
+
+ pt = tree_cons (current_tinst_level, d, NULL_TREE);
+ if (last_pending_template)
+ TREE_CHAIN (last_pending_template) = pt;
+ else
+ pending_templates = pt;
+
+ last_pending_template = pt;
+
TI_PENDING_TEMPLATE_FLAG (ti) = 1;
+
+ if (level)
+ pop_tinst_level ();
}
@@ -3547,7 +3782,7 @@ lookup_template_function (fns, arglist)
if (fns == NULL_TREE)
{
- cp_error ("non-template used as template");
+ error ("non-template used as template");
return error_mark_node;
}
@@ -3586,26 +3821,27 @@ maybe_get_template_decl_from_type_decl (decl)
D1 is the PTYPENAME terminal, and ARGLIST is the list of arguments.
(Actually ARGLIST may be either a TREE_LIST or a TREE_VEC. It will
be a TREE_LIST if called directly from the parser, and a TREE_VEC
- otherwise.) Since ARGLIST is build on the decl_obstack, we must
- copy it here to keep it from being reclaimed when the decl storage
- is reclaimed.
+ otherwise.)
IN_DECL, if non-NULL, is the template declaration we are trying to
instantiate.
If ENTERING_SCOPE is non-zero, we are about to enter the scope of
the class we are looking up.
+
+ If COMPLAIN is non-zero, issue error messages.
If the template class is really a local class in a template
function, then the FUNCTION_CONTEXT is the function in which it is
being instantiated. */
tree
-lookup_template_class (d1, arglist, in_decl, context, entering_scope)
+lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
tree d1, arglist;
tree in_decl;
tree context;
int entering_scope;
+ int complain;
{
tree template = NULL_TREE, parmlist;
tree t;
@@ -3619,12 +3855,8 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
{
if (context)
push_decl_namespace (context);
- if (current_class_type != NULL_TREE)
- template =
- maybe_get_template_decl_from_type_decl
- (IDENTIFIER_CLASS_VALUE (d1));
- if (template == NULL_TREE)
- template = lookup_name_nonclass (d1);
+ template = lookup_name (d1, /*prefer_type=*/0);
+ template = maybe_get_template_decl_from_type_decl (template);
if (context)
pop_decl_namespace ();
}
@@ -3647,41 +3879,44 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
}
}
else if (TREE_CODE (d1) == ENUMERAL_TYPE
- || (TREE_CODE_CLASS (TREE_CODE (d1)) == 't'
- && IS_AGGR_TYPE (d1)))
+ || (TYPE_P (d1) && IS_AGGR_TYPE (d1)))
{
template = TYPE_TI_TEMPLATE (d1);
d1 = DECL_NAME (template);
}
else if (TREE_CODE (d1) == TEMPLATE_DECL
- && TREE_CODE (DECL_RESULT (d1)) == TYPE_DECL)
+ && TREE_CODE (DECL_TEMPLATE_RESULT (d1)) == TYPE_DECL)
{
template = d1;
d1 = DECL_NAME (template);
context = DECL_CONTEXT (template);
}
- else
- my_friendly_abort (272);
/* With something like `template <class T> class X class X { ... };'
we could end up with D1 having nothing but an IDENTIFIER_VALUE.
We don't want to do that, but we have to deal with the situation,
so let's give them some syntax errors to chew on instead of a
- crash. */
+ crash. Alternatively D1 might not be a template type at all. */
if (! template)
{
- cp_error ("`%T' is not a template", d1);
+ if (complain)
+ error ("`%T' is not a template", d1);
return error_mark_node;
}
- if (context == NULL_TREE)
- context = global_namespace;
-
- if (TREE_CODE (template) != TEMPLATE_DECL)
+ if (TREE_CODE (template) != TEMPLATE_DECL
+ /* If we're called from the parser, make sure it's a user visible
+ template. */
+ || ((!arglist || TREE_CODE (arglist) == TREE_LIST)
+ && !DECL_TEMPLATE_PARM_P (template)
+ && !PRIMARY_TEMPLATE_P (template)))
{
- cp_error ("non-template type `%T' used as a template", d1);
- if (in_decl)
- cp_error_at ("for template declaration `%D'", in_decl);
+ if (complain)
+ {
+ error ("non-template type `%T' used as a template", d1);
+ if (in_decl)
+ cp_error_at ("for template declaration `%D'", in_decl);
+ }
return error_mark_node;
}
@@ -3690,20 +3925,30 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
/* Create a new TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM node to store
template arguments */
- tree parm = copy_template_template_parm (TREE_TYPE (template));
- tree template2 = TYPE_STUB_DECL (parm);
+ tree parm;
tree arglist2;
parmlist = DECL_INNERMOST_TEMPLATE_PARMS (template);
- arglist2 = coerce_template_parms (parmlist, arglist, template, 1, 1);
+ /* Consider an example where a template template parameter declared as
+
+ template <class T, class U = std::allocator<T> > class TT
+
+ The template parameter level of T and U are one level larger than
+ of TT. To proper process the default argument of U, say when an
+ instantiation `TT<int>' is seen, we need to build the full
+ arguments containing {int} as the innermost level. Outer levels
+ can be obtained from `current_template_args ()'. */
+
+ if (processing_template_decl)
+ arglist = add_to_template_args (current_template_args (), arglist);
+
+ arglist2 = coerce_template_parms (parmlist, arglist, template,
+ complain, /*require_all_args=*/1);
if (arglist2 == error_mark_node)
return error_mark_node;
- arglist2 = copy_to_permanent (arglist2);
- TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (parm)
- = perm_tree_cons (template2, arglist2, NULL_TREE);
- TYPE_SIZE (parm) = 0;
+ parm = bind_template_template_parm (TREE_TYPE (template), arglist2);
return parm;
}
else
@@ -3712,6 +3957,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
tree gen_tmpl;
tree type_decl;
tree found = NULL_TREE;
+ tree *tp;
int arg_depth;
int parm_depth;
int is_partial_instantiation;
@@ -3721,10 +3967,6 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
parm_depth = TMPL_PARMS_DEPTH (parmlist);
arg_depth = TMPL_ARGS_DEPTH (arglist);
- /* We build up the coerced arguments and such on the
- momentary_obstack. */
- push_momentary ();
-
if (arg_depth == 1 && parm_depth > 1)
{
/* We've been given an incomplete set of template arguments.
@@ -3745,7 +3987,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
arg_depth = TMPL_ARGS_DEPTH (arglist);
}
- /* Now we should enough arguments. */
+ /* Now we should have enough arguments. */
my_friendly_assert (parm_depth == arg_depth, 0);
/* From here on, we're only interested in the most general
@@ -3761,7 +4003,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
int i;
int saved_depth = TMPL_ARGS_DEPTH (arglist);
- tree bound_args = make_temp_vec (parm_depth);
+ tree bound_args = make_tree_vec (parm_depth);
for (i = saved_depth,
t = DECL_TEMPLATE_PARMS (template);
@@ -3769,7 +4011,8 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
--i, t = TREE_CHAIN (t))
{
tree a = coerce_template_parms (TREE_VALUE (t),
- arglist, template, 1, 1);
+ arglist, template,
+ complain, /*require_all_args=*/1);
SET_TMPL_ARGS_LEVEL (bound_args, i, a);
/* We temporarily reduce the length of the ARGLIST so
@@ -3787,8 +4030,9 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
else
arglist
= coerce_template_parms (INNERMOST_TEMPLATE_PARMS (parmlist),
- innermost_args (arglist),
- template, 1, 1);
+ INNERMOST_TEMPLATE_ARGS (arglist),
+ template,
+ complain, /*require_all_args=*/1);
if (arglist == error_mark_node)
/* We were unable to bind the arguments. */
@@ -3813,12 +4057,11 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
/* Note that we use DECL_CONTEXT, rather than
CP_DECL_CONTEXT, so that the termination test is
- always just `ctx'. We're not interested in namepace
+ always just `ctx'. We're not interested in namespace
scopes. */
for (ctx = current_class_type;
ctx;
- ctx = (TREE_CODE_CLASS (TREE_CODE (ctx)) == 't')
- ? TYPE_CONTEXT (ctx) : DECL_CONTEXT (ctx))
+ ctx = (TYPE_P (ctx)) ? TYPE_CONTEXT (ctx) : DECL_CONTEXT (ctx))
if (same_type_p (ctx, template_type))
break;
@@ -3829,40 +4072,55 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
found = NULL_TREE;
}
}
-
- if (!found)
- {
- for (found = DECL_TEMPLATE_INSTANTIATIONS (template);
- found; found = TREE_CHAIN (found))
- if (comp_template_args (TREE_PURPOSE (found), arglist))
- break;
-
- if (found)
- found = TREE_VALUE (found);
- }
-
if (found)
- {
- pop_momentary ();
- return found;
- }
+ return found;
+
+ for (tp = &DECL_TEMPLATE_INSTANTIATIONS (template);
+ *tp;
+ tp = &TREE_CHAIN (*tp))
+ if (comp_template_args (TREE_PURPOSE (*tp), arglist))
+ {
+ found = *tp;
+
+ /* Use the move-to-front heuristic to speed up future
+ searches. */
+ *tp = TREE_CHAIN (*tp);
+ TREE_CHAIN (found)
+ = DECL_TEMPLATE_INSTANTIATIONS (template);
+ DECL_TEMPLATE_INSTANTIATIONS (template) = found;
+
+ return TREE_VALUE (found);
+ }
- /* Since we didn't find the type, we'll have to create it.
- Since we'll be saving this type on the
- DECL_TEMPLATE_INSTANTIATIONS list, it must be permanent. */
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
/* This type is a "partial instantiation" if any of the template
- arguments still inolve template parameters. Note that we set
+ arguments still involve template parameters. Note that we set
IS_PARTIAL_INSTANTIATION for partial specializations as
well. */
is_partial_instantiation = uses_template_parms (arglist);
+ if (!is_partial_instantiation
+ && !PRIMARY_TEMPLATE_P (template)
+ && TREE_CODE (CP_DECL_CONTEXT (template)) == NAMESPACE_DECL)
+ {
+ found = xref_tag_from_type (TREE_TYPE (template),
+ DECL_NAME (template),
+ /*globalize=*/1);
+ return found;
+ }
+
+ context = tsubst (DECL_CONTEXT (template), arglist,
+ /*complain=*/0, in_decl);
+ if (!context)
+ context = global_namespace;
+
/* Create the type. */
if (TREE_CODE (template_type) == ENUMERAL_TYPE)
{
if (!is_partial_instantiation)
- t = start_enum (TYPE_IDENTIFIER (template_type));
+ {
+ set_current_access_from_decl (TYPE_NAME (template_type));
+ t = start_enum (TYPE_IDENTIFIER (template_type));
+ }
else
/* We don't want to call start_enum for this type, since
the values for the enumeration constants may involve
@@ -3872,29 +4130,31 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
}
else
{
- t = make_lang_type (TREE_CODE (template_type));
+ t = make_aggr_type (TREE_CODE (template_type));
CLASSTYPE_DECLARED_CLASS (t)
= CLASSTYPE_DECLARED_CLASS (template_type);
CLASSTYPE_GOT_SEMICOLON (t) = 1;
SET_CLASSTYPE_IMPLICIT_INSTANTIATION (t);
TYPE_FOR_JAVA (t) = TYPE_FOR_JAVA (template_type);
+
+ /* A local class. Make sure the decl gets registered properly. */
+ if (context == current_function_decl)
+ pushtag (DECL_NAME (template), t, 0);
}
- /* If we called start_enum above, this information will already
- be set up. */
+ /* If we called start_enum or pushtag above, this information
+ will already be set up. */
if (!TYPE_NAME (t))
{
TYPE_CONTEXT (t) = FROB_CONTEXT (context);
- /* Create a stub TYPE_DECL for it. */
- type_decl = build_decl (TYPE_DECL, DECL_NAME (template), t);
- SET_DECL_ARTIFICIAL (type_decl);
+ type_decl = create_implicit_typedef (DECL_NAME (template), t);
DECL_CONTEXT (type_decl) = TYPE_CONTEXT (t);
+ TYPE_STUB_DECL (t) = type_decl;
DECL_SOURCE_FILE (type_decl)
= DECL_SOURCE_FILE (TYPE_STUB_DECL (template_type));
DECL_SOURCE_LINE (type_decl)
= DECL_SOURCE_LINE (TYPE_STUB_DECL (template_type));
- TYPE_STUB_DECL (t) = TYPE_NAME (t) = type_decl;
}
else
type_decl = TYPE_NAME (t);
@@ -3908,9 +4168,8 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
found = template;
else
{
- /* This is a full instantiation of a member template. There
- should be some partial instantiation of which this is an
- instance. */
+ /* This is a full instantiation of a member template. Look
+ for a partial instantiation of which this is an instance. */
for (found = DECL_TEMPLATE_INSTANTIATIONS (template);
found; found = TREE_CHAIN (found))
@@ -3946,12 +4205,23 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
}
if (!found)
- my_friendly_abort (0);
+ {
+ /* There was no partial instantiation. This happens
+ where C<T> is a member template of A<T> and it's used
+ in something like
+
+ template <typename T> struct B { A<T>::C<int> m; };
+ B<float>;
+
+ Create the partial instantiation.
+ */
+ TREE_VEC_LENGTH (arglist)--;
+ found = tsubst (template, arglist, /*complain=*/0, NULL_TREE);
+ TREE_VEC_LENGTH (arglist)++;
+ }
}
- arglist = copy_to_permanent (arglist);
- SET_TYPE_TEMPLATE_INFO (t,
- tree_cons (found, arglist, NULL_TREE));
+ SET_TYPE_TEMPLATE_INFO (t, tree_cons (found, arglist, NULL_TREE));
DECL_TEMPLATE_INSTANTIATIONS (template)
= tree_cons (arglist, t,
DECL_TEMPLATE_INSTANTIATIONS (template));
@@ -3967,22 +4237,12 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
the instantiation and exit above. */
tsubst_enum (template_type, t, arglist);
- /* We're done with the permanent obstack, now. */
- pop_obstacks ();
- /* We're also done with the momentary allocation we started
- above. */
- pop_momentary ();
-
/* Reset the name of the type, now that CLASSTYPE_TEMPLATE_INFO
is set up. */
if (TREE_CODE (t) != ENUMERAL_TYPE)
DECL_NAME (type_decl) = classtype_mangled_name (t);
- DECL_ASSEMBLER_NAME (type_decl) = DECL_NAME (type_decl);
if (!is_partial_instantiation)
{
- DECL_ASSEMBLER_NAME (type_decl)
- = get_identifier (build_overload_name (t, 1, 1));
-
/* For backwards compatibility; code that uses
-fexternal-templates expects looking up a template to
instantiate it. I think DDD still relies on this.
@@ -4002,90 +4262,57 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
}
}
-/* For each TEMPLATE_TYPE_PARM, TEMPLATE_TEMPLATE_PARM, or
- TEMPLATE_PARM_INDEX in T, call FN with the parameter and the DATA.
- If FN returns non-zero, the iteration is terminated, and
- for_each_template_parm returns 1. Otherwise, the iteration
- continues. If FN never returns a non-zero value, the value
- returned by for_each_template_parm is 0. If FN is NULL, it is
- considered to be the function which always returns 1. */
-
-static int
-for_each_template_parm (t, fn, data)
- tree t;
- tree_fn_t fn;
- void* data;
+struct pair_fn_data
{
- if (!t)
- return 0;
+ tree_fn_t fn;
+ void *data;
+};
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 't'
+/* Called from for_each_template_parm via walk_tree. */
+
+static tree
+for_each_template_parm_r (tp, walk_subtrees, d)
+ tree *tp;
+ int *walk_subtrees;
+ void *d;
+{
+ tree t = *tp;
+ struct pair_fn_data *pfd = (struct pair_fn_data *) d;
+ tree_fn_t fn = pfd->fn;
+ void *data = pfd->data;
+
+ if (TYPE_P (t)
&& for_each_template_parm (TYPE_CONTEXT (t), fn, data))
- return 1;
+ return error_mark_node;
switch (TREE_CODE (t))
{
- case INDIRECT_REF:
- case COMPONENT_REF:
- /* We assume that the object must be instantiated in order to build
- the COMPONENT_REF, so we test only whether the type of the
- COMPONENT_REF uses template parms. */
- return for_each_template_parm (TREE_TYPE (t), fn, data);
-
- case ARRAY_REF:
- case OFFSET_REF:
- return (for_each_template_parm (TREE_OPERAND (t, 0), fn, data)
- || for_each_template_parm (TREE_OPERAND (t, 1), fn, data));
-
- case IDENTIFIER_NODE:
- if (!IDENTIFIER_TEMPLATE (t))
- return 0;
- my_friendly_abort (42);
-
- /* aggregates of tree nodes */
- case TREE_VEC:
- {
- int i = TREE_VEC_LENGTH (t);
- while (i--)
- if (for_each_template_parm (TREE_VEC_ELT (t, i), fn, data))
- return 1;
- return 0;
- }
- case TREE_LIST:
- if (for_each_template_parm (TREE_PURPOSE (t), fn, data)
- || for_each_template_parm (TREE_VALUE (t), fn, data))
- return 1;
- return for_each_template_parm (TREE_CHAIN (t), fn, data);
-
- case OVERLOAD:
- if (for_each_template_parm (OVL_FUNCTION (t), fn, data))
- return 1;
- return for_each_template_parm (OVL_CHAIN (t), fn, data);
-
- /* constructed type nodes */
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- return for_each_template_parm (TREE_TYPE (t), fn, data);
-
case RECORD_TYPE:
- if (TYPE_PTRMEMFUNC_FLAG (t))
- return for_each_template_parm (TYPE_PTRMEMFUNC_FN_TYPE (t),
- fn, data);
+ if (TYPE_PTRMEMFUNC_P (t))
+ break;
/* Fall through. */
case UNION_TYPE:
case ENUMERAL_TYPE:
- if (! TYPE_TEMPLATE_INFO (t))
- return 0;
- return for_each_template_parm (TREE_VALUE
- (TYPE_TEMPLATE_INFO (t)),
- fn, data);
+ if (!TYPE_TEMPLATE_INFO (t))
+ *walk_subtrees = 0;
+ else if (for_each_template_parm (TREE_VALUE (TYPE_TEMPLATE_INFO (t)),
+ fn, data))
+ return error_mark_node;
+ break;
+
case METHOD_TYPE:
+ /* Since we're not going to walk subtrees, we have to do this
+ explicitly here. */
if (for_each_template_parm (TYPE_METHOD_BASETYPE (t), fn, data))
- return 1;
+ return error_mark_node;
/* Fall through. */
case FUNCTION_TYPE:
+ /* Check the return type. */
+ if (for_each_template_parm (TREE_TYPE (t), fn, data))
+ return error_mark_node;
+
/* Check the parameter types. Since default arguments are not
instantiated until they are needed, the TYPE_ARG_TYPES may
contain expressions that involve template parameters. But,
@@ -4097,113 +4324,72 @@ for_each_template_parm (t, fn, data)
for (parm = TYPE_ARG_TYPES (t); parm; parm = TREE_CHAIN (parm))
if (for_each_template_parm (TREE_VALUE (parm), fn, data))
- return 1;
- }
-
- /* Check the return type, too. */
- return for_each_template_parm (TREE_TYPE (t), fn, data);
-
- case ARRAY_TYPE:
- if (for_each_template_parm (TYPE_DOMAIN (t), fn, data))
- return 1;
- return for_each_template_parm (TREE_TYPE (t), fn, data);
- case OFFSET_TYPE:
- if (for_each_template_parm (TYPE_OFFSET_BASETYPE (t), fn, data))
- return 1;
- return for_each_template_parm (TREE_TYPE (t), fn, data);
-
- /* decl nodes */
- case TYPE_DECL:
- return for_each_template_parm (TREE_TYPE (t), fn, data);
+ return error_mark_node;
- case TEMPLATE_DECL:
- /* A template template parameter is encountered */
- if (DECL_TEMPLATE_TEMPLATE_PARM_P (t))
- return for_each_template_parm (TREE_TYPE (t), fn, data);
- /* Already substituted template template parameter */
- return 0;
-
- case CONST_DECL:
- if (for_each_template_parm (DECL_INITIAL (t), fn, data))
- return 1;
- goto check_type_and_context;
+ /* Since we've already handled the TYPE_ARG_TYPES, we don't
+ want walk_tree walking into them itself. */
+ *walk_subtrees = 0;
+ }
+ break;
case FUNCTION_DECL:
case VAR_DECL:
- /* ??? What about FIELD_DECLs? */
if (DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t)
&& for_each_template_parm (DECL_TI_ARGS (t), fn, data))
- return 1;
- /* fall through */
+ return error_mark_node;
+ /* Fall through. */
+
+ case CONST_DECL:
case PARM_DECL:
- check_type_and_context:
- if (for_each_template_parm (TREE_TYPE (t), fn, data))
- return 1;
if (DECL_CONTEXT (t)
&& for_each_template_parm (DECL_CONTEXT (t), fn, data))
- return 1;
- return 0;
+ return error_mark_node;
+ break;
- case CALL_EXPR:
- return (for_each_template_parm (TREE_OPERAND (t, 0), fn, data)
- || for_each_template_parm (TREE_OPERAND (t, 1), fn, data));
-
- case ADDR_EXPR:
- return for_each_template_parm (TREE_OPERAND (t, 0), fn, data);
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
+ /* Record template parameters such as `T' inside `TT<T>'. */
+ if (for_each_template_parm (TYPE_TI_ARGS (t), fn, data))
+ return error_mark_node;
+ /* Fall through. */
- /* template parm nodes */
case TEMPLATE_TEMPLATE_PARM:
- /* Record template parameters such as `T' inside `TT<T>'. */
- if (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t)
- && for_each_template_parm (TYPE_TI_ARGS (t), fn, data))
- return 1;
case TEMPLATE_TYPE_PARM:
case TEMPLATE_PARM_INDEX:
- if (fn)
- return (*fn)(t, data);
- else
- return 1;
-
- /* simple type nodes */
- case INTEGER_TYPE:
- if (for_each_template_parm (TYPE_MIN_VALUE (t), fn, data))
- return 1;
- return for_each_template_parm (TYPE_MAX_VALUE (t), fn, data);
-
- case REAL_TYPE:
- case COMPLEX_TYPE:
- case VOID_TYPE:
- case BOOLEAN_TYPE:
- case NAMESPACE_DECL:
- return 0;
+ if (fn && (*fn)(t, data))
+ return error_mark_node;
+ else if (!fn)
+ return error_mark_node;
+ break;
- /* constants */
- case INTEGER_CST:
- case REAL_CST:
- case STRING_CST:
- return 0;
+ case TEMPLATE_DECL:
+ /* A template template parameter is encountered */
+ if (DECL_TEMPLATE_TEMPLATE_PARM_P (t)
+ && for_each_template_parm (TREE_TYPE (t), fn, data))
+ return error_mark_node;
- case ERROR_MARK:
- /* Non-error_mark_node ERROR_MARKs are bad things. */
- my_friendly_assert (t == error_mark_node, 274);
- /* NOTREACHED */
- return 0;
+ /* Already substituted template template parameter */
+ *walk_subtrees = 0;
+ break;
- case LOOKUP_EXPR:
case TYPENAME_TYPE:
- return 1;
-
- case PTRMEM_CST:
- return for_each_template_parm (TREE_TYPE (t), fn, data);
-
- case SCOPE_REF:
- return for_each_template_parm (TREE_OPERAND (t, 0), fn, data);
+ if (!fn || for_each_template_parm (TYPENAME_TYPE_FULLNAME (t), fn, data))
+ return error_mark_node;
+ break;
case CONSTRUCTOR:
- if (TREE_TYPE (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))
- return for_each_template_parm (TYPE_PTRMEMFUNC_FN_TYPE
- (TREE_TYPE (t)), fn, data);
- return for_each_template_parm (TREE_OPERAND (t, 1), fn, data);
+ if (TREE_TYPE (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t))
+ && for_each_template_parm (TYPE_PTRMEMFUNC_FN_TYPE
+ (TREE_TYPE (t)), fn, data))
+ return error_mark_node;
+ break;
+
+ case INDIRECT_REF:
+ case COMPONENT_REF:
+ /* If there's no type, then this thing must be some expression
+ involving template parameters. */
+ if (!fn && !TREE_TYPE (t))
+ return error_mark_node;
+ break;
case MODOP_EXPR:
case CAST_EXPR:
@@ -4214,35 +4400,49 @@ for_each_template_parm (t, fn, data)
case ARROW_EXPR:
case DOTSTAR_EXPR:
case TYPEID_EXPR:
- return 1;
-
- case SIZEOF_EXPR:
- case ALIGNOF_EXPR:
- return for_each_template_parm (TREE_OPERAND (t, 0), fn, data);
+ case LOOKUP_EXPR:
+ case PSEUDO_DTOR_EXPR:
+ if (!fn)
+ return error_mark_node;
+ break;
default:
- switch (TREE_CODE_CLASS (TREE_CODE (t)))
- {
- case '1':
- case '2':
- case 'e':
- case '<':
- {
- int i;
- for (i = first_rtl_op (TREE_CODE (t)); --i >= 0;)
- if (for_each_template_parm (TREE_OPERAND (t, i), fn, data))
- return 1;
- return 0;
- }
- default:
- break;
- }
- sorry ("testing %s for template parms",
- tree_code_name [(int) TREE_CODE (t)]);
- my_friendly_abort (82);
- /* NOTREACHED */
- return 0;
+ break;
}
+
+ /* We didn't find any template parameters we liked. */
+ return NULL_TREE;
+}
+
+/* For each TEMPLATE_TYPE_PARM, TEMPLATE_TEMPLATE_PARM,
+ BOUND_TEMPLATE_TEMPLATE_PARM or TEMPLATE_PARM_INDEX in T,
+ call FN with the parameter and the DATA.
+ If FN returns non-zero, the iteration is terminated, and
+ for_each_template_parm returns 1. Otherwise, the iteration
+ continues. If FN never returns a non-zero value, the value
+ returned by for_each_template_parm is 0. If FN is NULL, it is
+ considered to be the function which always returns 1. */
+
+static int
+for_each_template_parm (t, fn, data)
+ tree t;
+ tree_fn_t fn;
+ void* data;
+{
+ struct pair_fn_data pfd;
+
+ /* Set up. */
+ pfd.fn = fn;
+ pfd.data = data;
+
+ /* Walk the tree. (Conceptually, we would like to walk without
+ duplicates, but for_each_template_parm_r recursively calls
+ for_each_template_parm, so we would need to reorganize a fair
+ bit to use walk_tree_without_duplicates.) */
+ return walk_tree (&t,
+ for_each_template_parm_r,
+ &pfd,
+ NULL) != NULL_TREE;
}
int
@@ -4252,78 +4452,22 @@ uses_template_parms (t)
return for_each_template_parm (t, 0, 0);
}
-static struct tinst_level *current_tinst_level;
-static struct tinst_level *free_tinst_level;
static int tinst_depth;
extern int max_tinst_depth;
#ifdef GATHER_STATISTICS
int depth_reached;
#endif
-int tinst_level_tick;
-int last_template_error_tick;
+static int tinst_level_tick;
+static int last_template_error_tick;
-/* Print out all the template instantiations that we are currently
- working on. If ERR, we are being called from cp_thing, so do
- the right thing for an error message. */
-
-static void
-print_template_context (err)
- int err;
-{
- struct tinst_level *p = current_tinst_level;
- int line = lineno;
- char *file = input_filename;
-
- if (err && p)
- {
- if (current_function_decl != p->decl
- && current_function_decl != NULL_TREE)
- /* We can get here during the processing of some synthesized
- method. Then, p->decl will be the function that's causing
- the synthesis. */
- ;
- else
- {
- if (current_function_decl == p->decl)
- /* Avoid redundancy with the the "In function" line. */;
- else
- fprintf (stderr, "%s: In instantiation of `%s':\n",
- file, decl_as_string (p->decl, 0));
-
- line = p->line;
- file = p->file;
- p = p->next;
- }
- }
+/* We're starting to instantiate D; record the template instantiation context
+ for diagnostics and to restore it later. */
- for (; p; p = p->next)
- {
- fprintf (stderr, "%s:%d: instantiated from `%s'\n", file, line,
- decl_as_string (p->decl, 0));
- line = p->line;
- file = p->file;
- }
- fprintf (stderr, "%s:%d: instantiated from here\n", file, line);
-}
-
-/* Called from cp_thing to print the template context for an error. */
-
-void
-maybe_print_template_context ()
-{
- if (last_template_error_tick == tinst_level_tick
- || current_tinst_level == 0)
- return;
-
- last_template_error_tick = tinst_level_tick;
- print_template_context (1);
-}
-
-static int
+int
push_tinst_level (d)
tree d;
{
- struct tinst_level *new;
+ tree new;
if (tinst_depth >= max_tinst_depth)
{
@@ -4334,28 +4478,16 @@ push_tinst_level (d)
return 0;
last_template_error_tick = tinst_level_tick;
- error ("template instantiation depth exceeds maximum of %d",
- max_tinst_depth);
- error (" (use -ftemplate-depth-NN to increase the maximum)");
- cp_error (" instantiating `%D'", d);
+ error ("template instantiation depth exceeds maximum of %d (use -ftemplate-depth-NN to increase the maximum) instantiating `%D'",
+ max_tinst_depth, d);
- print_template_context (0);
+ print_instantiation_context ();
return 0;
}
- if (free_tinst_level)
- {
- new = free_tinst_level;
- free_tinst_level = new->next;
- }
- else
- new = (struct tinst_level *) xmalloc (sizeof (struct tinst_level));
-
- new->decl = d;
- new->line = lineno;
- new->file = input_filename;
- new->next = current_tinst_level;
+ new = build_expr_wfl (d, input_filename, lineno, 0);
+ TREE_CHAIN (new) = current_tinst_level;
current_tinst_level = new;
++tinst_depth;
@@ -4368,31 +4500,53 @@ push_tinst_level (d)
return 1;
}
+/* We're done instantiating this template; return to the instantiation
+ context. */
+
void
pop_tinst_level ()
{
- struct tinst_level *old = current_tinst_level;
+ tree old = current_tinst_level;
/* Restore the filename and line number stashed away when we started
this instantiation. */
- lineno = old->line;
- input_filename = old->file;
+ lineno = TINST_LINE (old);
+ input_filename = TINST_FILE (old);
extract_interface_info ();
- current_tinst_level = old->next;
- old->next = free_tinst_level;
- free_tinst_level = old;
+ current_tinst_level = TREE_CHAIN (old);
--tinst_depth;
++tinst_level_tick;
}
-struct tinst_level *
+/* We're instantiating a deferred template; restore the template
+ instantiation context in which the instantiation was requested, which
+ is one step out from LEVEL. */
+
+static void
+reopen_tinst_level (level)
+ tree level;
+{
+ tree t;
+
+ tinst_depth = 0;
+ for (t = level; t; t = TREE_CHAIN (t))
+ ++tinst_depth;
+
+ current_tinst_level = level;
+ pop_tinst_level ();
+}
+
+/* Return the outermost template instantiation context, for use with
+ -falt-external-templates. */
+
+tree
tinst_for_decl ()
{
- struct tinst_level *p = current_tinst_level;
+ tree p = current_tinst_level;
if (p)
- for (; p->next ; p = p->next )
+ for (; TREE_CHAIN (p) ; p = TREE_CHAIN (p))
;
return p;
}
@@ -4400,7 +4554,7 @@ tinst_for_decl ()
/* DECL is a friend FUNCTION_DECL or TEMPLATE_DECL. ARGS is the
vector of template arguments, as for tsubst.
- Returns an appropriate tsbust'd friend declaration. */
+ Returns an appropriate tsubst'd friend declaration. */
static tree
tsubst_friend_function (decl, args)
@@ -4409,7 +4563,7 @@ tsubst_friend_function (decl, args)
{
tree new_friend;
int line = lineno;
- char *file = input_filename;
+ const char *file = input_filename;
lineno = DECL_SOURCE_LINE (decl);
input_filename = DECL_SOURCE_FILE (decl);
@@ -4426,19 +4580,22 @@ tsubst_friend_function (decl, args)
function declaration. Now, we have to figure out what
instantiation of what template. */
{
- tree template_id;
+ tree template_id, arglist, fns;
tree new_args;
tree tmpl;
-
- template_id
- = lookup_template_function (tsubst_expr (DECL_TI_TEMPLATE (decl),
- args, /*complain=*/1,
- NULL_TREE),
- tsubst (DECL_TI_ARGS (decl),
- args, /*complain=*/1,
- NULL_TREE));
- /* FIXME: The decl we create via the next tsubst could be
- created on a temporary obstack. */
+ tree ns = CP_DECL_CONTEXT (TYPE_MAIN_DECL (current_class_type));
+
+ /* Friend functions are looked up in the containing namespace scope.
+ We must enter that scope, to avoid finding member functions of the
+ current cless with same name. */
+ push_nested_namespace (ns);
+ fns = tsubst_expr (DECL_TI_TEMPLATE (decl), args,
+ /*complain=*/1, NULL_TREE);
+ pop_nested_namespace (ns);
+ arglist = tsubst (DECL_TI_ARGS (decl), args,
+ /*complain=*/1, NULL_TREE);
+ template_id = lookup_template_function (fns, arglist);
+
new_friend = tsubst (decl, args, /*complain=*/1, NULL_TREE);
tmpl = determine_specialization (template_id, new_friend,
&new_args,
@@ -4461,21 +4618,20 @@ tsubst_friend_function (decl, args)
instantiation of anything. */
DECL_USE_TEMPLATE (new_friend) = 0;
if (TREE_CODE (decl) == TEMPLATE_DECL)
- DECL_USE_TEMPLATE (DECL_TEMPLATE_RESULT (new_friend)) = 0;
-
- /* The mangled name for the NEW_FRIEND is incorrect. The call to
- tsubst will have resulted in a call to
- set_mangled_name_for_template_decl. But, the function is not a
- template instantiation and should not be mangled like one.
- Therefore, we remangle the function name. We don't have to do
- this if the NEW_FRIEND is a template since
- set_mangled_name_for_template_decl doesn't do anything if the
- function declaration still uses template arguments. */
+ {
+ DECL_USE_TEMPLATE (DECL_TEMPLATE_RESULT (new_friend)) = 0;
+ DECL_SAVED_TREE (DECL_TEMPLATE_RESULT (new_friend))
+ = DECL_SAVED_TREE (DECL_TEMPLATE_RESULT (decl));
+ }
+
+ /* The mangled name for the NEW_FRIEND is incorrect. The function
+ is not a template instantiation and should not be mangled like
+ one. Therefore, we forget the mangling here; we'll recompute it
+ later if we need it. */
if (TREE_CODE (new_friend) != TEMPLATE_DECL)
{
- set_mangled_name_for_decl (new_friend);
- DECL_RTL (new_friend) = 0;
- make_decl_rtl (new_friend, NULL_PTR, 1);
+ SET_DECL_RTL (new_friend, NULL_RTX);
+ SET_DECL_ASSEMBLER_NAME (new_friend, NULL_TREE);
}
if (DECL_NAMESPACE_SCOPE_P (new_friend))
@@ -4483,6 +4639,7 @@ tsubst_friend_function (decl, args)
tree old_decl;
tree new_friend_template_info;
tree new_friend_result_template_info;
+ tree ns;
int new_friend_is_defn;
/* We must save some information from NEW_FRIEND before calling
@@ -4495,9 +4652,9 @@ tsubst_friend_function (decl, args)
DECL_PRIMARY_TEMPLATE (new_friend) = new_friend;
new_friend_is_defn
- = DECL_INITIAL (DECL_RESULT (new_friend)) != NULL_TREE;
+ = DECL_INITIAL (DECL_TEMPLATE_RESULT (new_friend)) != NULL_TREE;
new_friend_result_template_info
- = DECL_TEMPLATE_INFO (DECL_RESULT (new_friend));
+ = DECL_TEMPLATE_INFO (DECL_TEMPLATE_RESULT (new_friend));
}
else
{
@@ -4505,7 +4662,13 @@ tsubst_friend_function (decl, args)
new_friend_result_template_info = NULL_TREE;
}
+ /* Inside pushdecl_namespace_level, we will push into the
+ current namespace. However, the friend function should go
+ into the namespace of the template. */
+ ns = decl_namespace_context (new_friend);
+ push_nested_namespace (ns);
old_decl = pushdecl_namespace_level (new_friend);
+ pop_nested_namespace (ns);
if (old_decl != new_friend)
{
@@ -4564,7 +4727,7 @@ tsubst_friend_function (decl, args)
tree t;
tree new_friend_args;
- DECL_TEMPLATE_INFO (DECL_RESULT (old_decl))
+ DECL_TEMPLATE_INFO (DECL_TEMPLATE_RESULT (old_decl))
= new_friend_result_template_info;
new_friend_args = TI_ARGS (new_friend_template_info);
@@ -4577,8 +4740,6 @@ tsubst_friend_function (decl, args)
DECL_TI_ARGS (spec)
= add_outermost_template_args (new_friend_args,
DECL_TI_ARGS (spec));
- DECL_TI_ARGS (spec)
- = copy_to_permanent (DECL_TI_ARGS (spec));
}
/* Now, since specializations are always supposed to
@@ -4600,7 +4761,7 @@ tsubst_friend_function (decl, args)
new_friend = old_decl;
}
}
- else if (TYPE_SIZE (DECL_CONTEXT (new_friend)))
+ else if (COMPLETE_TYPE_P (DECL_CONTEXT (new_friend)))
{
/* Check to see that the declaration is really present, and,
possibly obtain an improved declaration. */
@@ -4620,7 +4781,8 @@ tsubst_friend_function (decl, args)
/* FRIEND_TMPL is a friend TEMPLATE_DECL. ARGS is the vector of
template arguments, as for tsubst.
- Returns an appropriate tsbust'd friend type. */
+ Returns an appropriate tsubst'd friend type or error_mark_node on
+ failure. */
static tree
tsubst_friend_class (friend_tmpl, args)
@@ -4661,6 +4823,8 @@ tsubst_friend_class (friend_tmpl, args)
tree parms
= tsubst_template_parms (DECL_TEMPLATE_PARMS (friend_tmpl),
args, /*complain=*/1);
+ if (!parms)
+ return error_mark_node;
redeclare_class_template (TREE_TYPE (tmpl), parms);
friend_type = TREE_TYPE (tmpl);
}
@@ -4686,23 +4850,6 @@ tsubst_friend_class (friend_tmpl, args)
return friend_type;
}
-static int
-has_pvbases_p (t, pattern)
- tree t, pattern;
-{
- if (!TYPE_USES_VIRTUAL_BASECLASSES (t))
- return 0;
-
- if (TYPE_USES_PVBASES (pattern))
- return 1;
-
- for (t = CLASSTYPE_VBASECLASSES (t); t; t = TREE_CHAIN (t))
- if (TYPE_VIRTUAL_P (BINFO_TYPE (t)))
- return 1;
-
- return 0;
-}
-
tree
instantiate_class_template (type)
tree type;
@@ -4713,15 +4860,9 @@ instantiate_class_template (type)
if (type == error_mark_node)
return error_mark_node;
- if (TYPE_BEING_DEFINED (type) || TYPE_SIZE (type))
+ if (TYPE_BEING_DEFINED (type) || COMPLETE_TYPE_P (type))
return type;
- /* We want to allocate temporary vectors of template arguments and
- template argument expressions on the momentary obstack, not on
- the expression obstack. Otherwise, all the space allocated in
- argument coercion and such is simply lost. */
- push_momentary ();
-
/* Figure out which template is being instantiated. */
template = most_general_template (CLASSTYPE_TI_TEMPLATE (type));
my_friendly_assert (TREE_CODE (template) == TEMPLATE_DECL, 279);
@@ -4749,7 +4890,7 @@ instantiate_class_template (type)
Now, the `S<U>' in `f<int>' is the specialization, not an
instantiation of the original template. */
- goto end;
+ return type;
/* Determine what specialization of the original template to
instantiate. */
@@ -4772,7 +4913,7 @@ instantiate_class_template (type)
if (t == error_mark_node)
{
const char *str = "candidates are:";
- cp_error ("ambiguous class template instantiation for `%#T'", type);
+ error ("ambiguous class template instantiation for `%#T'", type);
for (t = DECL_TEMPLATE_SPECIALIZATIONS (template); t;
t = TREE_CHAIN (t))
{
@@ -4784,8 +4925,7 @@ instantiate_class_template (type)
}
}
TYPE_BEING_DEFINED (type) = 1;
- type = error_mark_node;
- goto end;
+ return error_mark_node;
}
}
@@ -4796,8 +4936,8 @@ instantiate_class_template (type)
/* If the template we're instantiating is incomplete, then clearly
there's nothing we can do. */
- if (TYPE_SIZE (pattern) == NULL_TREE)
- goto end;
+ if (!COMPLETE_TYPE_P (pattern))
+ return type;
/* If this is a partial instantiation, don't tsubst anything. We will
only use this type for implicit typename, so the actual contents don't
@@ -4810,15 +4950,17 @@ instantiate_class_template (type)
TYPE_FIELDS (type) = TYPE_FIELDS (pattern);
TYPE_METHODS (type) = TYPE_METHODS (pattern);
CLASSTYPE_TAGS (type) = CLASSTYPE_TAGS (pattern);
+ CLASSTYPE_VBASECLASSES (type) = CLASSTYPE_VBASECLASSES (pattern);
+
/* Pretend that the type is complete, so that we will look
inside it during name lookup and such. */
- TYPE_SIZE (type) = integer_zero_node;
- goto end;
+ TYPE_SIZE (type) = bitsize_zero_node;
+ return type;
}
/* If we've recursively instantiated too many templates, stop. */
if (! push_tinst_level (type))
- goto end;
+ return type;
/* Now we're really doing the instantiation. Mark the type as in
the process of being defined. */
@@ -4860,24 +5002,17 @@ instantiate_class_template (type)
{
CLASSTYPE_INTERFACE_ONLY (type) = interface_only;
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (type, interface_unknown);
- CLASSTYPE_VTABLE_NEEDS_WRITING (type)
- = (! CLASSTYPE_INTERFACE_ONLY (type)
- && CLASSTYPE_INTERFACE_KNOWN (type));
}
else
{
CLASSTYPE_INTERFACE_ONLY (type) = CLASSTYPE_INTERFACE_ONLY (pattern);
SET_CLASSTYPE_INTERFACE_UNKNOWN_X
(type, CLASSTYPE_INTERFACE_UNKNOWN (pattern));
- CLASSTYPE_VTABLE_NEEDS_WRITING (type)
- = (! CLASSTYPE_INTERFACE_ONLY (type)
- && CLASSTYPE_INTERFACE_KNOWN (type));
}
}
else
{
SET_CLASSTYPE_INTERFACE_UNKNOWN (type);
- CLASSTYPE_VTABLE_NEEDS_WRITING (type) = 1;
}
TYPE_HAS_CONSTRUCTOR (type) = TYPE_HAS_CONSTRUCTOR (pattern);
@@ -4885,9 +5020,9 @@ instantiate_class_template (type)
TYPE_OVERLOADS_CALL_EXPR (type) = TYPE_OVERLOADS_CALL_EXPR (pattern);
TYPE_OVERLOADS_ARRAY_REF (type) = TYPE_OVERLOADS_ARRAY_REF (pattern);
TYPE_OVERLOADS_ARROW (type) = TYPE_OVERLOADS_ARROW (pattern);
- TYPE_GETS_NEW (type) = TYPE_GETS_NEW (pattern);
+ TYPE_HAS_NEW_OPERATOR (type) = TYPE_HAS_NEW_OPERATOR (pattern);
+ TYPE_HAS_ARRAY_NEW_OPERATOR (type) = TYPE_HAS_ARRAY_NEW_OPERATOR (pattern);
TYPE_GETS_DELETE (type) = TYPE_GETS_DELETE (pattern);
- TYPE_VEC_DELETE_TAKES_SIZE (type) = TYPE_VEC_DELETE_TAKES_SIZE (pattern);
TYPE_HAS_ASSIGN_REF (type) = TYPE_HAS_ASSIGN_REF (pattern);
TYPE_HAS_CONST_ASSIGN_REF (type) = TYPE_HAS_CONST_ASSIGN_REF (pattern);
TYPE_HAS_ABSTRACT_ASSIGN_REF (type) = TYPE_HAS_ABSTRACT_ASSIGN_REF (pattern);
@@ -4895,22 +5030,18 @@ instantiate_class_template (type)
TYPE_HAS_CONST_INIT_REF (type) = TYPE_HAS_CONST_INIT_REF (pattern);
TYPE_HAS_DEFAULT_CONSTRUCTOR (type) = TYPE_HAS_DEFAULT_CONSTRUCTOR (pattern);
TYPE_HAS_CONVERSION (type) = TYPE_HAS_CONVERSION (pattern);
- TYPE_USES_COMPLEX_INHERITANCE (type)
- = TYPE_USES_COMPLEX_INHERITANCE (pattern);
+ TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (type)
+ = TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (pattern);
TYPE_USES_MULTIPLE_INHERITANCE (type)
= TYPE_USES_MULTIPLE_INHERITANCE (pattern);
TYPE_USES_VIRTUAL_BASECLASSES (type)
= TYPE_USES_VIRTUAL_BASECLASSES (pattern);
TYPE_PACKED (type) = TYPE_PACKED (pattern);
TYPE_ALIGN (type) = TYPE_ALIGN (pattern);
+ TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (pattern);
TYPE_FOR_JAVA (type) = TYPE_FOR_JAVA (pattern); /* For libjava's JArray<T> */
- if (ANON_UNION_TYPE_P (pattern))
- SET_ANON_UNION_TYPE_P (type);
-
- /* We must copy the arguments to the permanent obstack since
- during the tsubst'ing below they may wind up in the
- DECL_TI_ARGS of some instantiated member template. */
- args = copy_to_permanent (args);
+ if (ANON_AGGR_TYPE_P (pattern))
+ SET_ANON_AGGR_TYPE_P (type);
if (TYPE_BINFO_BASETYPES (pattern))
{
@@ -4928,7 +5059,7 @@ instantiate_class_template (type)
pbase = TREE_VEC_ELT (pbases, i);
- /* Substitue to figure out the base class. */
+ /* Substitute to figure out the base class. */
base = tsubst (BINFO_TYPE (pbase), args,
/*complain=*/1, NULL_TREE);
if (base == error_mark_node)
@@ -4973,7 +5104,7 @@ instantiate_class_template (type)
/* Now that our base classes are set up, enter the scope of the
class, so that name lookups into base classes, etc. will work
- corectly. This is precisely analagous to what we do in
+ correctly. This is precisely analogous to what we do in
begin_class_definition when defining an ordinary non-template
class. */
pushclass (type, 1);
@@ -4985,6 +5116,7 @@ instantiate_class_template (type)
tree newtag;
newtag = tsubst (tag, args, /*complain=*/1, NULL_TREE);
+ my_friendly_assert (newtag != error_mark_node, 20010206);
if (TREE_CODE (newtag) != ENUMERAL_TYPE)
{
if (TYPE_LANG_SPECIFIC (tag) && CLASSTYPE_IS_TEMPLATE (tag))
@@ -5026,7 +5158,7 @@ instantiate_class_template (type)
{
tree init;
- if (DECL_DEFINED_IN_CLASS_P (r))
+ if (DECL_INITIALIZED_IN_CLASS_P (r))
init = tsubst_expr (DECL_INITIAL (t), args,
/*complain=*/1, NULL_TREE);
else
@@ -5034,10 +5166,9 @@ instantiate_class_template (type)
finish_static_data_member_decl (r, init,
/*asmspec_tree=*/NULL_TREE,
- /*need_pop=*/0,
/*flags=*/0);
- if (DECL_DEFINED_IN_CLASS_P (r))
+ if (DECL_INITIALIZED_IN_CLASS_P (r))
check_static_variable_definition (r, TREE_TYPE (r));
}
@@ -5053,19 +5184,13 @@ instantiate_class_template (type)
}
}
- /* After we have calculated the bases, we can now compute whether we
- have polymorphic vbases. This needs to happen before we
- instantiate the methods, because the constructors may take
- additional arguments. */
- if (flag_vtable_thunks >= 2)
- TYPE_USES_PVBASES (type) = has_pvbases_p (type, pattern);
-
/* Set up the list (TYPE_METHODS) and vector (CLASSTYPE_METHOD_VEC)
for this instantiation. */
for (t = TYPE_METHODS (pattern); t; t = TREE_CHAIN (t))
{
tree r = tsubst (t, args, /*complain=*/1, NULL_TREE);
set_current_access_from_decl (r);
+ grok_special_member_properties (r);
finish_member_declaration (r);
}
@@ -5085,11 +5210,7 @@ instantiate_class_template (type)
tsubst_friend_function (TREE_VALUE (friends),
args));
else
- add_friends (type,
- tsubst_copy (TREE_PURPOSE (t), args,
- /*complain=*/1, NULL_TREE),
- tsubst (TREE_PURPOSE (friends), args,
- /*complain=*/1, NULL_TREE));
+ abort ();
}
for (t = CLASSTYPE_FRIEND_CLASSES (pattern);
@@ -5105,11 +5226,16 @@ instantiate_class_template (type)
new_friend_type = tsubst (friend_type, args, /*complain=*/1,
NULL_TREE);
else
- /* The call to xref_tag_from_type does injection for friend
- classes. */
- new_friend_type =
- xref_tag_from_type (friend_type, NULL_TREE, 1);
+ {
+ tree ns = decl_namespace_context (TYPE_MAIN_DECL (friend_type));
+ /* The call to xref_tag_from_type does injection for friend
+ classes. */
+ push_nested_namespace (ns);
+ new_friend_type =
+ xref_tag_from_type (friend_type, NULL_TREE, 1);
+ pop_nested_namespace (ns);
+ }
if (TREE_CODE (friend_type) == TEMPLATE_DECL)
/* Trick make_friend_class into realizing that the friend
@@ -5119,29 +5245,13 @@ instantiate_class_template (type)
information. */
++processing_template_decl;
- make_friend_class (type, new_friend_type);
+ if (new_friend_type != error_mark_node)
+ make_friend_class (type, new_friend_type);
if (TREE_CODE (friend_type) == TEMPLATE_DECL)
--processing_template_decl;
}
- /* This does injection for friend functions. */
- if (!processing_template_decl)
- {
- t = tsubst (DECL_TEMPLATE_INJECT (template), args,
- /*complain=*/1, NULL_TREE);
-
- for (; t; t = TREE_CHAIN (t))
- {
- tree d = TREE_VALUE (t);
-
- if (TREE_CODE (d) == TYPE_DECL)
- /* Already injected. */;
- else
- pushdecl (d);
- }
- }
-
for (t = TYPE_FIELDS (type); t; t = TREE_CHAIN (t))
if (TREE_CODE (t) == FIELD_DECL)
{
@@ -5157,20 +5267,29 @@ instantiate_class_template (type)
input_filename = DECL_SOURCE_FILE (typedecl);
unreverse_member_declarations (type);
- finish_struct_1 (type, 0);
+ finish_struct_1 (type);
CLASSTYPE_GOT_SEMICOLON (type) = 1;
/* Clear this now so repo_template_used is happy. */
TYPE_BEING_DEFINED (type) = 0;
repo_template_used (type);
+ /* Now that the class is complete, instantiate default arguments for
+ any member functions. We don't do this earlier because the
+ default arguments may reference members of the class. */
+ if (!PRIMARY_TEMPLATE_P (template))
+ for (t = TYPE_METHODS (type); t; t = TREE_CHAIN (t))
+ if (TREE_CODE (t) == FUNCTION_DECL
+ /* Implicitly generated member functions will not have template
+ information; they are not instantiations, but instead are
+ created "fresh" for each instantiation. */
+ && DECL_TEMPLATE_INFO (t))
+ tsubst_default_arguments (t);
+
popclass ();
pop_from_top_level ();
pop_tinst_level ();
- end:
- pop_momentary ();
-
return type;
}
@@ -5197,8 +5316,7 @@ static tree
maybe_fold_nontype_arg (arg)
tree arg;
{
- if (TREE_CODE_CLASS (TREE_CODE (arg)) != 't'
- && !uses_template_parms (arg))
+ if (arg && !TYPE_P (arg) && !uses_template_parms (arg))
{
/* Sometimes, one of the args was an expression involving a
template constant parameter, like N - 1. Now that we've
@@ -5208,25 +5326,22 @@ maybe_fold_nontype_arg (arg)
fool build_expr_from_tree() into building an actual
tree. */
- int saved_processing_template_decl = processing_template_decl;
- processing_template_decl = 0;
- arg = fold (build_expr_from_tree (arg));
- processing_template_decl = saved_processing_template_decl;
+ /* If the TREE_TYPE of ARG is not NULL_TREE, ARG is already
+ as simple as it's going to get, and trying to reprocess
+ the trees will break. */
+ if (!TREE_TYPE (arg))
+ {
+ int saved_processing_template_decl = processing_template_decl;
+ processing_template_decl = 0;
+ arg = build_expr_from_tree (arg);
+ processing_template_decl = saved_processing_template_decl;
+ }
+
+ arg = fold (arg);
}
return arg;
}
-/* Return the TREE_VEC with the arguments for the innermost template header,
- where ARGS is either that or the VEC of VECs for all the
- arguments. */
-
-tree
-innermost_args (args)
- tree args;
-{
- return TMPL_ARGS_LEVEL (args, TMPL_ARGS_DEPTH (args));
-}
-
/* Substitute ARGS into the vector of template arguments T. */
static tree
@@ -5238,7 +5353,7 @@ tsubst_template_arg_vector (t, args, complain)
int len = TREE_VEC_LENGTH (t), need_new = 0, i;
tree *elts = (tree *) alloca (len * sizeof (tree));
- bzero ((char *) elts, len * sizeof (tree));
+ memset ((char *) elts, 0, len * sizeof (tree));
for (i = 0; i < len; i++)
{
@@ -5251,6 +5366,9 @@ tsubst_template_arg_vector (t, args, complain)
(tsubst_expr (TREE_VEC_ELT (t, i), args, complain,
NULL_TREE));
+ if (elts[i] == error_mark_node)
+ return error_mark_node;
+
if (elts[i] != TREE_VEC_ELT (t, i))
need_new = 1;
}
@@ -5258,7 +5376,7 @@ tsubst_template_arg_vector (t, args, complain)
if (!need_new)
return t;
- t = make_temp_vec (len);
+ t = make_tree_vec (len);
for (i = 0; i < len; i++)
TREE_VEC_ELT (t, i) = elts[i];
@@ -5278,8 +5396,8 @@ tsubst_template_parms (parms, args, complain)
tree args;
int complain;
{
- tree r;
- tree* new_parms = &r;
+ tree r = NULL_TREE;
+ tree* new_parms;
for (new_parms = &r;
TMPL_PARMS_DEPTH (parms) > TMPL_ARGS_DEPTH (args);
@@ -5292,21 +5410,21 @@ tsubst_template_parms (parms, args, complain)
for (i = 0; i < TREE_VEC_LENGTH (new_vec); ++i)
{
- tree default_value =
- TREE_PURPOSE (TREE_VEC_ELT (TREE_VALUE (parms), i));
- tree parm_decl =
- TREE_VALUE (TREE_VEC_ELT (TREE_VALUE (parms), i));
-
- TREE_VEC_ELT (new_vec, i)
- = build_tree_list (tsubst (default_value, args, complain,
- NULL_TREE),
- tsubst (parm_decl, args, complain,
- NULL_TREE));
+ tree tuple = TREE_VEC_ELT (TREE_VALUE (parms), i);
+ tree default_value = TREE_PURPOSE (tuple);
+ tree parm_decl = TREE_VALUE (tuple);
+
+ parm_decl = tsubst (parm_decl, args, complain, NULL_TREE);
+ default_value = tsubst_expr (default_value, args,
+ complain, NULL_TREE);
+ tuple = build_tree_list (maybe_fold_nontype_arg (default_value),
+ parm_decl);
+ TREE_VEC_ELT (new_vec, i) = tuple;
}
*new_parms =
- tree_cons (build_int_2 (0, (TMPL_PARMS_DEPTH (parms)
- - TMPL_ARGS_DEPTH (args))),
+ tree_cons (size_int (TMPL_PARMS_DEPTH (parms)
+ - TMPL_ARGS_DEPTH (args)),
new_vec, NULL_TREE);
}
@@ -5317,7 +5435,7 @@ tsubst_template_parms (parms, args, complain)
type T. If T is not an aggregate or enumeration type, it is
handled as if by tsubst. IN_DECL is as for tsubst. If
ENTERING_SCOPE is non-zero, T is the context for a template which
- we are presently tsubst'ing. Return the subsituted value. */
+ we are presently tsubst'ing. Return the substituted value. */
static tree
tsubst_aggr_type (t, args, complain, in_decl, entering_scope)
@@ -5334,11 +5452,7 @@ tsubst_aggr_type (t, args, complain, in_decl, entering_scope)
{
case RECORD_TYPE:
if (TYPE_PTRMEMFUNC_P (t))
- {
- tree r = build_ptrmemfunc_type
- (tsubst (TYPE_PTRMEMFUNC_FN_TYPE (t), args, complain, in_decl));
- return cp_build_qualified_type (r, TYPE_QUALS (t));
- }
+ return tsubst (TYPE_PTRMEMFUNC_FN_TYPE (t), args, complain, in_decl);
/* else fall through */
case ENUMERAL_TYPE:
@@ -5367,15 +5481,16 @@ tsubst_aggr_type (t, args, complain, in_decl, entering_scope)
and supposing that we are instantiating f<int, double>,
then our ARGS will be {int, double}, but, when looking up
S we only want {double}. */
- push_momentary ();
argvec = tsubst_template_arg_vector (TYPE_TI_ARGS (t), args,
complain);
+ if (argvec == error_mark_node)
+ return error_mark_node;
r = lookup_template_class (t, argvec, in_decl, context,
- entering_scope);
- pop_momentary ();
+ entering_scope, complain);
- return cp_build_qualified_type (r, TYPE_QUALS (t));
+ return cp_build_qualified_type_real (r, TYPE_QUALS (t),
+ complain);
}
else
/* This is not a template type, so there's nothing to do. */
@@ -5386,21 +5501,80 @@ tsubst_aggr_type (t, args, complain, in_decl, entering_scope)
}
}
+/* Substitute into the default argument ARG (a default argument for
+ FN), which has the indicated TYPE. */
+
+tree
+tsubst_default_argument (fn, type, arg)
+ tree fn;
+ tree type;
+ tree arg;
+{
+ /* This default argument came from a template. Instantiate the
+ default argument here, not in tsubst. In the case of
+ something like:
+
+ template <class T>
+ struct S {
+ static T t();
+ void f(T = t());
+ };
+
+ we must be careful to do name lookup in the scope of S<T>,
+ rather than in the current class. */
+ if (DECL_CLASS_SCOPE_P (fn))
+ pushclass (DECL_CONTEXT (fn), 2);
+
+ arg = tsubst_expr (arg, DECL_TI_ARGS (fn), /*complain=*/1, NULL_TREE);
+
+ if (DECL_CLASS_SCOPE_P (fn))
+ popclass ();
+
+ /* Make sure the default argument is reasonable. */
+ arg = check_default_argument (type, arg);
+
+ return arg;
+}
+
+/* Substitute into all the default arguments for FN. */
+
+static void
+tsubst_default_arguments (fn)
+ tree fn;
+{
+ tree arg;
+ tree tmpl_args;
+
+ tmpl_args = DECL_TI_ARGS (fn);
+
+ /* If this function is not yet instantiated, we certainly don't need
+ its default arguments. */
+ if (uses_template_parms (tmpl_args))
+ return;
+
+ for (arg = TYPE_ARG_TYPES (TREE_TYPE (fn));
+ arg;
+ arg = TREE_CHAIN (arg))
+ if (TREE_PURPOSE (arg))
+ TREE_PURPOSE (arg) = tsubst_default_argument (fn,
+ TREE_VALUE (arg),
+ TREE_PURPOSE (arg));
+}
+
/* Substitute the ARGS into the T, which is a _DECL. TYPE is the
(already computed) substitution of ARGS into TREE_TYPE (T), if
- appropriate. Return the result of the substitution. IN_DECL is as
- for tsubst. */
+ appropriate. Return the result of the substitution. */
static tree
-tsubst_decl (t, args, type, in_decl)
+tsubst_decl (t, args, type)
tree t;
tree args;
tree type;
- tree in_decl;
{
int saved_lineno;
- char* saved_filename;
+ const char *saved_filename;
tree r = NULL_TREE;
+ tree in_decl = t;
/* Set the filename and linenumber to improve error-reporting. */
saved_lineno = lineno;
@@ -5426,10 +5600,9 @@ tsubst_decl (t, args, type, in_decl)
plus the innermost args from the template decl. */
tree tmpl_args = DECL_CLASS_TEMPLATE_P (t)
? CLASSTYPE_TI_ARGS (TREE_TYPE (t))
- : DECL_TI_ARGS (DECL_RESULT (t));
+ : DECL_TI_ARGS (DECL_TEMPLATE_RESULT (t));
tree full_args;
- push_momentary ();
full_args = tsubst_template_arg_vector (tmpl_args, args,
/*complain=*/1);
@@ -5439,7 +5612,6 @@ tsubst_decl (t, args, type, in_decl)
my_friendly_assert (full_args != tmpl_args, 0);
spec = retrieve_specialization (t, full_args);
- pop_momentary ();
if (spec != NULL_TREE)
{
r = spec;
@@ -5452,26 +5624,26 @@ tsubst_decl (t, args, type, in_decl)
We also create a new function declaration, which is just
like the old one, but points to this new template, rather
than the old one. */
- r = copy_node (t);
- copy_lang_decl (r);
+ r = copy_decl (t);
my_friendly_assert (DECL_LANG_SPECIFIC (r) != 0, 0);
TREE_CHAIN (r) = NULL_TREE;
if (is_template_template_parm)
{
tree new_decl = tsubst (decl, args, /*complain=*/1, in_decl);
- DECL_RESULT (r) = new_decl;
+ DECL_TEMPLATE_RESULT (r) = new_decl;
TREE_TYPE (r) = TREE_TYPE (new_decl);
break;
}
DECL_CONTEXT (r)
- = tsubst_aggr_type (DECL_CONTEXT (t), args, /*complain=*/1,
- in_decl, /*entering_scope=*/1);
- DECL_CLASS_CONTEXT (r)
- = tsubst_aggr_type (DECL_CLASS_CONTEXT (t), args,
+ = tsubst_aggr_type (DECL_CONTEXT (t), args,
/*complain=*/1, in_decl,
/*entering_scope=*/1);
+ DECL_VIRTUAL_CONTEXT (r)
+ = tsubst_aggr_type (DECL_VIRTUAL_CONTEXT (t), args,
+ /*complain=*/1, in_decl,
+ /*entering_scope=*/1);
DECL_TEMPLATE_INFO (r) = build_tree_list (t, args);
if (TREE_CODE (decl) == TYPE_DECL)
@@ -5480,13 +5652,14 @@ tsubst_decl (t, args, type, in_decl)
/*complain=*/1, in_decl);
TREE_TYPE (r) = new_type;
CLASSTYPE_TI_TEMPLATE (new_type) = r;
- DECL_RESULT (r) = TYPE_MAIN_DECL (new_type);
+ DECL_TEMPLATE_RESULT (r) = TYPE_MAIN_DECL (new_type);
DECL_TI_ARGS (r) = CLASSTYPE_TI_ARGS (new_type);
}
else
{
tree new_decl = tsubst (decl, args, /*complain=*/1, in_decl);
- DECL_RESULT (r) = new_decl;
+
+ DECL_TEMPLATE_RESULT (r) = new_decl;
DECL_TI_TEMPLATE (new_decl) = r;
TREE_TYPE (r) = TREE_TYPE (new_decl);
DECL_TI_ARGS (r) = DECL_TI_ARGS (new_decl);
@@ -5510,63 +5683,9 @@ tsubst_decl (t, args, type, in_decl)
if (TREE_CODE (decl) == TYPE_DECL)
break;
- for (spec = DECL_TEMPLATE_SPECIALIZATIONS (t);
- spec != NULL_TREE;
- spec = TREE_CHAIN (spec))
- {
- /* It helps to consider example here. Consider:
-
- template <class T>
- struct S {
- template <class U>
- void f(U u);
-
- template <>
- void f(T* t) {}
- };
-
- Now, for example, we are instantiating S<int>::f(U u).
- We want to make a template:
-
- template <class U>
- void S<int>::f(U);
-
- It will have a specialization, for the case U = int*, of
- the form:
-
- template <>
- void S<int>::f<int*>(int*);
-
- This specialization will be an instantiation of
- the specialization given in the declaration of S, with
- argument list int*. */
-
- tree fn = TREE_VALUE (spec);
- tree spec_args;
- tree new_fn;
-
- if (!DECL_TEMPLATE_SPECIALIZATION (fn))
- /* Instantiations are on the same list, but they're of
- no concern to us. */
- continue;
-
- if (TREE_CODE (fn) != TEMPLATE_DECL)
- /* A full specialization. There's no need to record
- that here. */
- continue;
-
- spec_args = tsubst (DECL_TI_ARGS (fn), args,
- /*complain=*/1, in_decl);
- new_fn = tsubst (DECL_RESULT (most_general_template (fn)),
- spec_args, /*complain=*/1, in_decl);
- DECL_TI_TEMPLATE (new_fn) = fn;
- register_specialization (new_fn, r,
- innermost_args (spec_args));
- }
-
/* Record this partial instantiation. */
register_specialization (r, t,
- DECL_TI_ARGS (DECL_RESULT (r)));
+ DECL_TI_ARGS (DECL_TEMPLATE_RESULT (r)));
}
break;
@@ -5588,10 +5707,6 @@ tsubst_decl (t, args, type, in_decl)
{
tree spec;
- /* Allocate template arguments on the momentary obstack,
- in case we don't need to keep them. */
- push_momentary ();
-
/* Calculate the most general template of which R is a
specialization, and the complete set of arguments used to
specialize R. */
@@ -5607,21 +5722,27 @@ tsubst_decl (t, args, type, in_decl)
if (spec)
{
r = spec;
- pop_momentary ();
break;
}
- /* We're going to need to keep the ARGVEC, so we copy it
- here. */
- argvec = copy_to_permanent (argvec);
- pop_momentary ();
+ /* We can see more levels of arguments than parameters if
+ there was a specialization of a member template, like
+ this:
+
+ template <class T> struct S { template <class U> void f(); }
+ template <> template <class U> void S<int>::f(U);
+
+ Here, we'll be substituting into the specialization,
+ because that's where we can find the code we actually
+ want to generate, but we'll have enough arguments for
+ the most general template.
- /* Here, we deal with the peculiar case:
+ We also deal with the peculiar case:
template <class T> struct S {
template <class U> friend void f();
};
- template <class U> friend void f() {}
+ template <class U> void f() {}
template S<int>;
template void f<double>();
@@ -5641,21 +5762,7 @@ tsubst_decl (t, args, type, in_decl)
TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (DECL_TI_TEMPLATE (t)));
if (args_depth > parms_depth
&& !DECL_TEMPLATE_SPECIALIZATION (t))
- {
- my_friendly_assert (DECL_FRIEND_P (t), 0);
-
- if (parms_depth > 1)
- {
- int i;
-
- args = make_temp_vec (parms_depth);
- for (i = 0; i < parms_depth; ++i)
- TREE_VEC_ELT (args, i) =
- TREE_VEC_ELT (args, i + (args_depth - parms_depth));
- }
- else
- args = TREE_VEC_ELT (args, args_depth - parms_depth);
- }
+ args = get_innermost_template_args (args, parms_depth);
}
else
{
@@ -5683,40 +5790,43 @@ tsubst_decl (t, args, type, in_decl)
member = 2;
else
member = 1;
- ctx = tsubst_aggr_type (DECL_CLASS_CONTEXT (t), args,
+ ctx = tsubst_aggr_type (DECL_CONTEXT (t), args,
/*complain=*/1, t,
/*entering_scope=*/1);
}
else
{
member = 0;
- ctx = NULL_TREE;
+ ctx = DECL_CONTEXT (t);
}
type = tsubst (type, args, /*complain=*/1, in_decl);
+ if (type == error_mark_node)
+ return error_mark_node;
/* We do NOT check for matching decls pushed separately at this
point, as they may not represent instantiations of this
template, and in any case are considered separate under the
- discrete model. Instead, see add_maybe_template. */
-
- r = copy_node (t);
- copy_lang_decl (r);
+ discrete model. */
+ r = copy_decl (t);
DECL_USE_TEMPLATE (r) = 0;
TREE_TYPE (r) = type;
+ /* Clear out the mangled name and RTL for the instantiation. */
+ SET_DECL_ASSEMBLER_NAME (r, NULL_TREE);
+ SET_DECL_RTL (r, NULL_RTX);
- DECL_CONTEXT (r)
- = tsubst_aggr_type (DECL_CONTEXT (t), args, /*complain=*/1, t,
+ DECL_CONTEXT (r) = ctx;
+ DECL_VIRTUAL_CONTEXT (r)
+ = tsubst_aggr_type (DECL_VIRTUAL_CONTEXT (t), args,
+ /*complain=*/1, t,
/*entering_scope=*/1);
- DECL_CLASS_CONTEXT (r) = ctx;
- if (member && IDENTIFIER_TYPENAME_P (DECL_NAME (r)))
+ if (member && DECL_CONV_FN_P (r))
/* Type-conversion operator. Reconstruct the name, in
case it's the name of one of the template's parameters. */
- DECL_NAME (r) = build_typename_overload (TREE_TYPE (type));
+ DECL_NAME (r) = mangle_conv_op_name_for_type (TREE_TYPE (type));
DECL_ARGUMENTS (r) = tsubst (DECL_ARGUMENTS (t), args,
/*complain=*/1, t);
- DECL_MAIN_VARIANT (r) = r;
DECL_RESULT (r) = NULL_TREE;
TREE_STATIC (r) = 0;
@@ -5726,61 +5836,42 @@ tsubst_decl (t, args, type, in_decl)
DECL_DEFER_OUTPUT (r) = 0;
TREE_CHAIN (r) = NULL_TREE;
DECL_PENDING_INLINE_INFO (r) = 0;
+ DECL_PENDING_INLINE_P (r) = 0;
+ DECL_SAVED_TREE (r) = NULL_TREE;
TREE_USED (r) = 0;
+ if (DECL_CLONED_FUNCTION (r))
+ {
+ DECL_CLONED_FUNCTION (r) = tsubst (DECL_CLONED_FUNCTION (t),
+ args, /*complain=*/1, t);
+ TREE_CHAIN (r) = TREE_CHAIN (DECL_CLONED_FUNCTION (r));
+ TREE_CHAIN (DECL_CLONED_FUNCTION (r)) = r;
+ }
- /* Set up the DECL_TEMPLATE_INFO for R and compute its mangled
- name. There's no need to do this in the special friend
- case mentioned above where GEN_TMPL is NULL. */
+ /* Set up the DECL_TEMPLATE_INFO for R. There's no need to do
+ this in the special friend case mentioned above where
+ GEN_TMPL is NULL. */
if (gen_tmpl)
{
- /* The ARGVEC was built on the momentary obstack. Make it
- permanent now. */
- argvec = copy_to_permanent (argvec);
DECL_TEMPLATE_INFO (r)
- = perm_tree_cons (gen_tmpl, argvec, NULL_TREE);
+ = tree_cons (gen_tmpl, argvec, NULL_TREE);
SET_DECL_IMPLICIT_INSTANTIATION (r);
register_specialization (r, gen_tmpl, argvec);
+ /* We're not supposed to instantiate default arguments
+ until they are called, for a template. But, for a
+ declaration like:
- if (DECL_CONSTRUCTOR_P (r) || DECL_DESTRUCTOR_P (r))
- {
- maybe_retrofit_in_chrg (r);
- grok_ctor_properties (ctx, r);
- }
-
- /* Set the mangled name for R. */
- if (DECL_DESTRUCTOR_P (t))
- DECL_ASSEMBLER_NAME (r) =
- build_destructor_name (ctx, DECL_DESTRUCTOR_FOR_PVBASE_P (r));
- else
- {
- /* Instantiations of template functions must be mangled
- specially, in order to conform to 14.5.5.1
- [temp.over.link]. */
- tree tmpl = DECL_TI_TEMPLATE (t);
-
- /* TMPL will be NULL if this is a specialization of a
- member function of a template class. */
- if (name_mangling_version < 1
- || tmpl == NULL_TREE
- || (member && !is_member_template (tmpl)
- && !DECL_TEMPLATE_INFO (tmpl)))
- set_mangled_name_for_decl (r);
- else
- set_mangled_name_for_template_decl (r);
- }
-
- DECL_RTL (r) = 0;
- make_decl_rtl (r, NULL_PTR, 1);
-
- /* Like grokfndecl. If we don't do this, pushdecl will
- mess up our TREE_CHAIN because it doesn't find a
- previous decl. Sigh. */
- if (member
- && ! uses_template_parms (r)
- && (IDENTIFIER_GLOBAL_VALUE (DECL_ASSEMBLER_NAME (r))
- == NULL_TREE))
- SET_IDENTIFIER_GLOBAL_VALUE (DECL_ASSEMBLER_NAME (r), r);
+ template <class T> void f ()
+ { extern void g(int i = T()); }
+
+ we should do the substitution when the template is
+ instantiated. We handle the member function case in
+ instantiate_class_template since the default arguments
+ might refer to other members of the class. */
+ if (!member
+ && !PRIMARY_TEMPLATE_P (gen_tmpl)
+ && !uses_template_parms (argvec))
+ tsubst_default_arguments (r);
}
/* Copy the list of befriending classes. */
@@ -5794,24 +5885,30 @@ tsubst_decl (t, args, type, in_decl)
in_decl);
}
-#if 0
- /* This has now moved further up. */
- if (DECL_CONSTRUCTOR_P (r))
+ if (DECL_CONSTRUCTOR_P (r) || DECL_DESTRUCTOR_P (r))
{
maybe_retrofit_in_chrg (r);
- grok_ctor_properties (ctx, r);
+ if (DECL_CONSTRUCTOR_P (r))
+ grok_ctor_properties (ctx, r);
+ /* If this is an instantiation of a member template, clone it.
+ If it isn't, that'll be handled by
+ clone_constructors_and_destructors. */
+ if (PRIMARY_TEMPLATE_P (gen_tmpl))
+ clone_function_decl (r, /*update_method_vec_p=*/0);
}
-#endif
- if (IDENTIFIER_OPNAME_P (DECL_NAME (r)))
- grok_op_properties (r, DECL_VIRTUAL_P (r), DECL_FRIEND_P (r));
+ else if (IDENTIFIER_OPNAME_P (DECL_NAME (r)))
+ grok_op_properties (r, DECL_FRIEND_P (r));
}
break;
case PARM_DECL:
{
r = copy_node (t);
+ if (DECL_TEMPLATE_PARM_P (t))
+ SET_DECL_TEMPLATE_PARM_P (r);
+
TREE_TYPE (r) = type;
- c_apply_type_quals_to_decl (CP_TYPE_QUALS (type), r);
+ c_apply_type_quals_to_decl (cp_type_quals (type), r);
if (TREE_CODE (DECL_INITIAL (r)) != TEMPLATE_PARM_INDEX)
DECL_INITIAL (r) = TREE_TYPE (r);
@@ -5820,12 +5917,10 @@ tsubst_decl (t, args, type, in_decl)
/*complain=*/1, in_decl);
DECL_CONTEXT (r) = NULL_TREE;
-#ifdef PROMOTE_PROTOTYPES
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
+ if (!DECL_TEMPLATE_PARM_P (r) && PROMOTE_PROTOTYPES
+ && INTEGRAL_TYPE_P (type)
&& TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
DECL_ARG_TYPE (r) = integer_type_node;
-#endif
if (TREE_CHAIN (t))
TREE_CHAIN (r) = tsubst (TREE_CHAIN (t), args,
/*complain=*/1, TREE_CHAIN (t));
@@ -5834,18 +5929,17 @@ tsubst_decl (t, args, type, in_decl)
case FIELD_DECL:
{
- r = copy_node (t);
- copy_lang_decl (r);
+ r = copy_decl (t);
TREE_TYPE (r) = type;
- c_apply_type_quals_to_decl (CP_TYPE_QUALS (type), r);
+ c_apply_type_quals_to_decl (cp_type_quals (type), r);
/* We don't have to set DECL_CONTEXT here; it is set by
finish_member_declaration. */
DECL_INITIAL (r) = tsubst_expr (DECL_INITIAL (t), args,
/*complain=*/1, in_decl);
TREE_CHAIN (r) = NULL_TREE;
- if (TREE_CODE (type) == VOID_TYPE)
- cp_error_at ("instantiation of `%D' as type void", r);
+ if (VOID_TYPE_P (type))
+ cp_error_at ("instantiation of `%D' as type `%T'", r, type);
}
break;
@@ -5858,74 +5952,113 @@ tsubst_decl (t, args, type, in_decl)
}
break;
+ case TYPE_DECL:
+ if (TREE_CODE (type) == TEMPLATE_TEMPLATE_PARM
+ || t == TYPE_MAIN_DECL (TREE_TYPE (t)))
+ {
+ /* If this is the canonical decl, we don't have to mess with
+ instantiations, and often we can't (for typename, template
+ type parms and such). Note that TYPE_NAME is not correct for
+ the above test if we've copied the type for a typedef. */
+ r = TYPE_NAME (type);
+ break;
+ }
+
+ /* Fall through. */
+
case VAR_DECL:
{
- tree argvec;
- tree gen_tmpl;
+ tree argvec = NULL_TREE;
+ tree gen_tmpl = NULL_TREE;
tree spec;
- tree tmpl;
- tree ctx = tsubst_aggr_type (DECL_CONTEXT (t), args,
- /*complain=*/1,
- in_decl, /*entering_scope=*/1);
-
- /* Nobody should be tsubst'ing into non-template variables. */
- my_friendly_assert (DECL_LANG_SPECIFIC (t)
- && DECL_TEMPLATE_INFO (t) != NULL_TREE, 0);
+ tree tmpl = NULL_TREE;
+ tree ctx;
+ int local_p;
+
+ /* Assume this is a non-local variable. */
+ local_p = 0;
+
+ if (TYPE_P (CP_DECL_CONTEXT (t)))
+ ctx = tsubst_aggr_type (DECL_CONTEXT (t), args,
+ /*complain=*/1,
+ in_decl, /*entering_scope=*/1);
+ else if (DECL_NAMESPACE_SCOPE_P (t))
+ ctx = DECL_CONTEXT (t);
+ else
+ {
+ /* Subsequent calls to pushdecl will fill this in. */
+ ctx = NULL_TREE;
+ local_p = 1;
+ }
/* Check to see if we already have this specialization. */
- tmpl = DECL_TI_TEMPLATE (t);
- gen_tmpl = most_general_template (tmpl);
- argvec = tsubst (DECL_TI_ARGS (t), args, /*complain=*/1, in_decl);
- spec = retrieve_specialization (gen_tmpl, argvec);
-
+ if (!local_p)
+ {
+ tmpl = DECL_TI_TEMPLATE (t);
+ gen_tmpl = most_general_template (tmpl);
+ argvec = tsubst (DECL_TI_ARGS (t), args, /*complain=*/1, in_decl);
+ spec = retrieve_specialization (gen_tmpl, argvec);
+ }
+ else
+ spec = retrieve_local_specialization (t);
+
if (spec)
{
r = spec;
break;
}
- r = copy_node (t);
+ r = copy_decl (t);
TREE_TYPE (r) = type;
- c_apply_type_quals_to_decl (CP_TYPE_QUALS (type), r);
+ c_apply_type_quals_to_decl (cp_type_quals (type), r);
DECL_CONTEXT (r) = ctx;
+ /* Clear out the mangled name and RTL for the instantiation. */
+ SET_DECL_ASSEMBLER_NAME (r, NULL_TREE);
+ SET_DECL_RTL (r, NULL_RTX);
/* Don't try to expand the initializer until someone tries to use
this variable; otherwise we run into circular dependencies. */
DECL_INITIAL (r) = NULL_TREE;
- DECL_RTL (r) = 0;
- DECL_SIZE (r) = 0;
- copy_lang_decl (r);
- DECL_CLASS_CONTEXT (r) = DECL_CONTEXT (r);
-
- /* A static data member declaration is always marked external
- when it is declared in-class, even if an initializer is
- present. We mimic the non-template processing here. */
- DECL_EXTERNAL (r) = 1;
+ SET_DECL_RTL (r, NULL_RTX);
+ DECL_SIZE (r) = DECL_SIZE_UNIT (r) = 0;
- DECL_TEMPLATE_INFO (r) = perm_tree_cons (tmpl, argvec, NULL_TREE);
- SET_DECL_IMPLICIT_INSTANTIATION (r);
- register_specialization (r, gen_tmpl, argvec);
+ /* For __PRETTY_FUNCTION__ we have to adjust the initializer. */
+ if (DECL_PRETTY_FUNCTION_P (r))
+ {
+ const char *const name = (*decl_printable_name)
+ (current_function_decl, 2);
+ DECL_INITIAL (r) = cp_fname_init (name);
+ TREE_TYPE (r) = TREE_TYPE (DECL_INITIAL (r));
+ }
+
+ /* Even if the original location is out of scope, the newly
+ substituted one is not. */
+ if (TREE_CODE (r) == VAR_DECL)
+ DECL_DEAD_FOR_LOCAL (r) = 0;
+
+ if (!local_p)
+ {
+ /* A static data member declaration is always marked
+ external when it is declared in-class, even if an
+ initializer is present. We mimic the non-template
+ processing here. */
+ DECL_EXTERNAL (r) = 1;
+
+ register_specialization (r, gen_tmpl, argvec);
+ DECL_TEMPLATE_INFO (r) = tree_cons (tmpl, argvec, NULL_TREE);
+ SET_DECL_IMPLICIT_INSTANTIATION (r);
+ }
+ else
+ register_local_specialization (r, t);
TREE_CHAIN (r) = NULL_TREE;
- if (TREE_CODE (type) == VOID_TYPE)
- cp_error_at ("instantiation of `%D' as type void", r);
+ if (TREE_CODE (r) == VAR_DECL && VOID_TYPE_P (type))
+ cp_error_at ("instantiation of `%D' as type `%T'", r, type);
}
break;
- case TYPE_DECL:
- if (t == TYPE_NAME (TREE_TYPE (t)))
- r = TYPE_NAME (type);
- else
- {
- r = copy_node (t);
- TREE_TYPE (r) = type;
- DECL_CONTEXT (r) = current_class_type;
- TREE_CHAIN (r) = NULL_TREE;
- }
- break;
-
default:
- my_friendly_abort (0);
+ abort ();
}
/* Restore the file and line information. */
@@ -5958,6 +6091,16 @@ tsubst_arg_types (arg_types, args, complain, in_decl)
type = tsubst (TREE_VALUE (arg_types), args, complain, in_decl);
if (type == error_mark_node)
return error_mark_node;
+ if (VOID_TYPE_P (type))
+ {
+ if (complain)
+ {
+ error ("invalid parameter type `%T'", type);
+ if (in_decl)
+ cp_error_at ("in declaration `%D'", in_decl);
+ }
+ return error_mark_node;
+ }
/* Do array-to-pointer, function-to-pointer conversion, and ignore
top-level qualifiers as required. */
@@ -6002,7 +6145,7 @@ tsubst_function_type (t, args, complain, in_decl)
/* The TYPE_CONTEXT is not used for function/method types. */
my_friendly_assert (TYPE_CONTEXT (t) == NULL_TREE, 0);
- /* Substitue the return type. */
+ /* Substitute the return type. */
return_type = tsubst (TREE_TYPE (t), args, complain, in_decl);
if (return_type == error_mark_node)
return error_mark_node;
@@ -6029,7 +6172,7 @@ tsubst_function_type (t, args, complain, in_decl)
-- Attempting to create "pointer to member of T" when T
is not a class type. */
if (complain)
- cp_error ("creating pointer to member function of non-class type `%T'",
+ error ("creating pointer to member function of non-class type `%T'",
r);
return error_mark_node;
}
@@ -6116,7 +6259,7 @@ tsubst (t, args, complain, in_decl)
else
type = TREE_TYPE (t);
if (type == unknown_type_node)
- my_friendly_abort (42);
+ abort ();
if (type && TREE_CODE (t) != FUNCTION_DECL
&& TREE_CODE (t) != TYPENAME_TYPE
@@ -6128,8 +6271,8 @@ tsubst (t, args, complain, in_decl)
if (type == error_mark_node)
return error_mark_node;
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 'd')
- return tsubst_decl (t, args, type, in_decl);
+ if (DECL_P (t))
+ return tsubst_decl (t, args, type);
switch (TREE_CODE (t))
{
@@ -6141,10 +6284,10 @@ tsubst (t, args, complain, in_decl)
case ERROR_MARK:
case IDENTIFIER_NODE:
- case OP_IDENTIFIER:
case VOID_TYPE:
case REAL_TYPE:
case COMPLEX_TYPE:
+ case VECTOR_TYPE:
case BOOLEAN_TYPE:
case INTEGER_CST:
case REAL_CST:
@@ -6168,15 +6311,18 @@ tsubst (t, args, complain, in_decl)
/* See if we can reduce this expression to something simpler. */
max = maybe_fold_nontype_arg (max);
- if (!processing_template_decl && TREE_READONLY_DECL_P (max))
+ if (!processing_template_decl)
max = decl_constant_value (max);
if (processing_template_decl
/* When providing explicit arguments to a template
function, but leaving some arguments for subsequent
deduction, MAX may be template-dependent even if we're
- not PROCESSING_TEMPLATE_DECL. */
- || TREE_CODE (max) != INTEGER_CST)
+ not PROCESSING_TEMPLATE_DECL. We still need to check for
+ template parms, though; MAX won't be an INTEGER_CST for
+ dynamic arrays, either. */
+ || (TREE_CODE (max) != INTEGER_CST
+ && uses_template_parms (max)))
{
tree itype = make_node (INTEGER_TYPE);
TYPE_MIN_VALUE (itype) = size_zero_node;
@@ -6191,7 +6337,9 @@ tsubst (t, args, complain, in_decl)
if (pedantic)
pedwarn ("creating array with size zero");
}
- else if (integer_zerop (max) || INT_CST_LT (max, integer_zero_node))
+ else if (integer_zerop (max)
+ || (TREE_CODE (max) == INTEGER_CST
+ && INT_CST_LT (max, integer_zero_node)))
{
/* [temp.deduct]
@@ -6201,19 +6349,17 @@ tsubst (t, args, complain, in_decl)
Attempting to create an array with a size that is
zero or negative. */
if (complain)
- cp_error ("creating array with size `%E'", max);
+ error ("creating array with size zero (`%E')", max);
return error_mark_node;
}
- max = fold (build_binary_op (MINUS_EXPR, max, integer_one_node));
- if (!TREE_PERMANENT (max) && !allocation_temporary_p ())
- max = copy_to_permanent (max);
- return build_index_type (max);
+ return compute_array_index_type (NULL_TREE, max);
}
case TEMPLATE_TYPE_PARM:
case TEMPLATE_TEMPLATE_PARM:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
case TEMPLATE_PARM_INDEX:
{
int idx;
@@ -6223,7 +6369,8 @@ tsubst (t, args, complain, in_decl)
r = NULL_TREE;
if (TREE_CODE (t) == TEMPLATE_TYPE_PARM
- || TREE_CODE (t) == TEMPLATE_TEMPLATE_PARM)
+ || TREE_CODE (t) == TEMPLATE_TEMPLATE_PARM
+ || TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM)
{
idx = TEMPLATE_TYPE_IDX (t);
level = TEMPLATE_TYPE_LEVEL (t);
@@ -6248,46 +6395,44 @@ tsubst (t, args, complain, in_decl)
{
if (TREE_CODE (t) == TEMPLATE_TYPE_PARM)
{
- my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (arg))
- == 't', 0);
- return cp_build_qualified_type
- (arg, CP_TYPE_QUALS (arg) | CP_TYPE_QUALS (t));
+ my_friendly_assert (TYPE_P (arg), 0);
+ return cp_build_qualified_type_real
+ (arg, cp_type_quals (arg) | cp_type_quals (t),
+ complain);
}
- else if (TREE_CODE (t) == TEMPLATE_TEMPLATE_PARM)
+ else if (TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM)
{
- if (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t))
- {
- /* We are processing a type constructed from
- a template template parameter */
- tree argvec = tsubst (TYPE_TI_ARGS (t),
- args, complain, in_decl);
- if (argvec == error_mark_node)
- return error_mark_node;
+ /* We are processing a type constructed from
+ a template template parameter */
+ tree argvec = tsubst (TYPE_TI_ARGS (t),
+ args, complain, in_decl);
+ if (argvec == error_mark_node)
+ return error_mark_node;
- /* We can get a TEMPLATE_TEMPLATE_PARM here when
- we are resolving nested-types in the signature of
- a member function templates.
- Otherwise ARG is a TEMPLATE_DECL and is the real
- template to be instantiated. */
- if (TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM)
- arg = TYPE_NAME (arg);
-
- r = lookup_template_class (DECL_NAME (arg),
- argvec, in_decl,
- DECL_CONTEXT (arg),
- /*entering_scope=*/0);
- return cp_build_qualified_type (r, TYPE_QUALS (t));
- }
- else
- /* We are processing a template argument list. */
- return arg;
+ /* We can get a TEMPLATE_TEMPLATE_PARM here when
+ we are resolving nested-types in the signature of
+ a member function templates.
+ Otherwise ARG is a TEMPLATE_DECL and is the real
+ template to be instantiated. */
+ if (TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM)
+ arg = TYPE_NAME (arg);
+
+ r = lookup_template_class (arg,
+ argvec, in_decl,
+ DECL_CONTEXT (arg),
+ /*entering_scope=*/0,
+ complain);
+ return cp_build_qualified_type_real (r,
+ TYPE_QUALS (t),
+ complain);
}
else
+ /* TEMPLATE_TEMPLATE_PARM or TEMPLATE_PARM_INDEX. */
return arg;
}
}
else
- my_friendly_abort (981018);
+ abort ();
if (level == 1)
/* This can happen during the attempted tsubst'ing in
@@ -6302,25 +6447,34 @@ tsubst (t, args, complain, in_decl)
{
case TEMPLATE_TYPE_PARM:
case TEMPLATE_TEMPLATE_PARM:
- r = copy_node (t);
- TEMPLATE_TYPE_PARM_INDEX (r)
- = reduce_template_parm_level (TEMPLATE_TYPE_PARM_INDEX (t),
- r, levels);
- TYPE_STUB_DECL (r) = TYPE_NAME (r) = TEMPLATE_TYPE_DECL (r);
- TYPE_MAIN_VARIANT (r) = r;
- TYPE_POINTER_TO (r) = NULL_TREE;
- TYPE_REFERENCE_TO (r) = NULL_TREE;
-
- if (TREE_CODE (t) == TEMPLATE_TEMPLATE_PARM
- && TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t))
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
+ if (cp_type_quals (t))
{
- tree argvec = tsubst (TYPE_TI_ARGS (t), args,
- complain, in_decl);
- if (argvec == error_mark_node)
- return error_mark_node;
+ r = tsubst (TYPE_MAIN_VARIANT (t), args, complain, in_decl);
+ r = cp_build_qualified_type_real (r, cp_type_quals (t),
+ complain);
+ }
+ else
+ {
+ r = copy_type (t);
+ TEMPLATE_TYPE_PARM_INDEX (r)
+ = reduce_template_parm_level (TEMPLATE_TYPE_PARM_INDEX (t),
+ r, levels);
+ TYPE_STUB_DECL (r) = TYPE_NAME (r) = TEMPLATE_TYPE_DECL (r);
+ TYPE_MAIN_VARIANT (r) = r;
+ TYPE_POINTER_TO (r) = NULL_TREE;
+ TYPE_REFERENCE_TO (r) = NULL_TREE;
+
+ if (TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM)
+ {
+ tree argvec = tsubst (TYPE_TI_ARGS (t), args,
+ complain, in_decl);
+ if (argvec == error_mark_node)
+ return error_mark_node;
- TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (r)
- = perm_tree_cons (TYPE_NAME (t), argvec, NULL_TREE);
+ TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (r)
+ = tree_cons (TYPE_TI_TEMPLATE (t), argvec, NULL_TREE);
+ }
}
break;
@@ -6329,7 +6483,7 @@ tsubst (t, args, complain, in_decl)
break;
default:
- my_friendly_abort (0);
+ abort ();
}
return r;
@@ -6367,8 +6521,13 @@ tsubst (t, args, complain, in_decl)
&& value == TREE_VALUE (t)
&& chain == TREE_CHAIN (t))
return t;
- result = hash_tree_cons (purpose, value, chain);
- TREE_PARMLIST (result) = TREE_PARMLIST (t);
+ if (TREE_PARMLIST (t))
+ {
+ result = tree_cons (purpose, value, chain);
+ TREE_PARMLIST (result) = 1;
+ }
+ else
+ result = hash_tree_cons (purpose, value, chain);
return result;
}
case TREE_VEC:
@@ -6401,7 +6560,7 @@ tsubst (t, args, complain, in_decl)
{
enum tree_code code;
- if (type == TREE_TYPE (t))
+ if (type == TREE_TYPE (t) && TREE_CODE (type) != METHOD_TYPE)
return t;
code = TREE_CODE (t);
@@ -6419,7 +6578,7 @@ tsubst (t, args, complain, in_decl)
|| (code == REFERENCE_TYPE && TREE_CODE (type) == VOID_TYPE))
{
static int last_line = 0;
- static char* last_file = 0;
+ static const char* last_file = 0;
/* We keep track of the last time we issued this error
message to avoid spewing a ton of messages during a
@@ -6428,9 +6587,9 @@ tsubst (t, args, complain, in_decl)
last_file != input_filename))
{
if (TREE_CODE (type) == VOID_TYPE)
- cp_error ("forming reference to void");
+ error ("forming reference to void");
else
- cp_error ("forming %s to reference type `%T'",
+ error ("forming %s to reference type `%T'",
(code == POINTER_TYPE) ? "pointer" : "reference",
type);
last_line = lineno;
@@ -6440,13 +6599,19 @@ tsubst (t, args, complain, in_decl)
return error_mark_node;
}
else if (code == POINTER_TYPE)
- r = build_pointer_type (type);
+ {
+ r = build_pointer_type (type);
+ if (TREE_CODE (type) == METHOD_TYPE)
+ r = build_ptrmemfunc_type (r);
+ }
else
r = build_reference_type (type);
- r = cp_build_qualified_type (r, TYPE_QUALS (t));
+ r = cp_build_qualified_type_real (r, TYPE_QUALS (t), complain);
- /* Will this ever be needed for TYPE_..._TO values? */
- layout_type (r);
+ if (r != error_mark_node)
+ /* Will this ever be needed for TYPE_..._TO values? */
+ layout_type (r);
+
return r;
}
case OFFSET_TYPE:
@@ -6462,11 +6627,34 @@ tsubst (t, args, complain, in_decl)
-- Attempting to create "pointer to member of T" when T
is not a class type. */
if (complain)
- cp_error ("creating pointer to member of non-class type `%T'",
+ error ("creating pointer to member of non-class type `%T'",
r);
return error_mark_node;
}
- return build_offset_type (r, type);
+ if (TREE_CODE (type) == REFERENCE_TYPE)
+ {
+ if (complain)
+ error ("creating pointer to member reference type `%T'", type);
+
+ return error_mark_node;
+ }
+ my_friendly_assert (TREE_CODE (type) != METHOD_TYPE, 20011231);
+ if (TREE_CODE (type) == FUNCTION_TYPE)
+ /* This is really a method type. The cv qualifiers of the
+ this pointer should _not_ be determined by the cv
+ qualifiers of the class type. They should be held
+ somewhere in the FUNCTION_TYPE, but we don't do that at
+ the moment. Consider
+ typedef void (Func) () const;
+
+ template <typename T1> void Foo (Func T1::*);
+
+ */
+ return build_cplus_method_type (TYPE_MAIN_VARIANT (r),
+ TREE_TYPE (type),
+ TYPE_ARG_TYPES (type));
+ else
+ return build_offset_type (r, type);
}
case FUNCTION_TYPE:
case METHOD_TYPE:
@@ -6482,10 +6670,21 @@ tsubst (t, args, complain, in_decl)
raises = TYPE_RAISES_EXCEPTIONS (t);
if (raises)
{
- raises = tsubst (raises, args, complain, in_decl);
- if (raises == error_mark_node)
- return raises;
- fntype = build_exception_variant (fntype, raises);
+ tree list = NULL_TREE;
+
+ if (! TREE_VALUE (raises))
+ list = raises;
+ else
+ for (; raises != NULL_TREE; raises = TREE_CHAIN (raises))
+ {
+ tree spec = TREE_VALUE (raises);
+
+ spec = tsubst (spec, args, complain, in_decl);
+ if (spec == error_mark_node)
+ return spec;
+ list = add_exception_specifier (list, spec, complain);
+ }
+ fntype = build_exception_variant (fntype, list);
}
return fntype;
}
@@ -6513,7 +6712,7 @@ tsubst (t, args, complain, in_decl)
|| TREE_CODE (type) == REFERENCE_TYPE)
{
if (complain)
- cp_error ("creating array of `%T'", type);
+ error ("creating array of `%T'", type);
return error_mark_node;
}
@@ -6559,7 +6758,7 @@ tsubst (t, args, complain, in_decl)
if (!IS_AGGR_TYPE (ctx))
{
if (complain)
- cp_error ("`%T' is not a class, struct, or union type",
+ error ("`%T' is not a class, struct, or union type",
ctx);
return error_mark_node;
}
@@ -6574,7 +6773,7 @@ tsubst (t, args, complain, in_decl)
point, so here CTX really should have complete type, unless
it's a partial instantiation. */
ctx = complete_type (ctx);
- if (!TYPE_SIZE (ctx))
+ if (!COMPLETE_TYPE_P (ctx))
{
if (complain)
incomplete_type_error (NULL_TREE, ctx);
@@ -6582,12 +6781,25 @@ tsubst (t, args, complain, in_decl)
}
}
- f = make_typename_type (ctx, f);
+ f = make_typename_type (ctx, f, complain);
if (f == error_mark_node)
return f;
- return cp_build_qualified_type (f,
- CP_TYPE_QUALS (f)
- | CP_TYPE_QUALS (t));
+ return cp_build_qualified_type_real (f,
+ cp_type_quals (f)
+ | cp_type_quals (t),
+ complain);
+ }
+
+ case UNBOUND_CLASS_TEMPLATE:
+ {
+ tree ctx = tsubst_aggr_type (TYPE_CONTEXT (t), args, complain,
+ in_decl, /*entering_scope=*/1);
+ tree name = TYPE_IDENTIFIER (t);
+
+ if (ctx == error_mark_node || name == error_mark_node)
+ return error_mark_node;
+
+ return make_unbound_class_template (ctx, name, complain);
}
case INDIRECT_REF:
@@ -6617,22 +6829,23 @@ tsubst (t, args, complain, in_decl)
if (e1 == error_mark_node || e2 == error_mark_node)
return error_mark_node;
- return build_parse_node (ARRAY_REF, e1, e2, tsubst_expr);
+ return build_nt (ARRAY_REF, e1, e2, tsubst_expr);
}
case CALL_EXPR:
{
tree e1 = tsubst (TREE_OPERAND (t, 0), args, complain,
in_decl);
- tree e2 = tsubst_call_declarator_parms (TREE_OPERAND (t, 1), args,
- complain, in_decl);
- tree e3 = tsubst (TREE_TYPE (t), args, complain, in_decl);
+ tree e2 = (tsubst_call_declarator_parms
+ (CALL_DECLARATOR_PARMS (t), args, complain, in_decl));
+ tree e3 = tsubst (CALL_DECLARATOR_EXCEPTION_SPEC (t), args,
+ complain, in_decl);
if (e1 == error_mark_node || e2 == error_mark_node
|| e3 == error_mark_node)
return error_mark_node;
- return make_call_declarator (e1, e2, TREE_OPERAND (t, 2), e3);
+ return make_call_declarator (e1, e2, CALL_DECLARATOR_QUALS (t), e3);
}
case SCOPE_REF:
@@ -6643,7 +6856,7 @@ tsubst (t, args, complain, in_decl)
if (e1 == error_mark_node || e2 == error_mark_node)
return error_mark_node;
- return build_parse_node (TREE_CODE (t), e1, e2);
+ return build_nt (TREE_CODE (t), e1, e2);
}
case TYPEOF_TYPE:
@@ -6663,35 +6876,6 @@ tsubst (t, args, complain, in_decl)
}
}
-void
-do_pushlevel ()
-{
- emit_line_note (input_filename, lineno);
- pushlevel (0);
- clear_last_expr ();
- push_momentary ();
- expand_start_bindings (0);
-}
-
-tree
-do_poplevel ()
-{
- tree t;
- int saved_warn_unused = 0;
-
- if (processing_template_decl)
- {
- saved_warn_unused = warn_unused;
- warn_unused = 0;
- }
- expand_end_bindings (getdecls (), kept_level_p (), 0);
- if (processing_template_decl)
- warn_unused = saved_warn_unused;
- t = poplevel (kept_level_p (), 1, 0);
- pop_momentary ();
- return t;
-}
-
/* Like tsubst, but deals with expressions. This function just replaces
template parms; to finish processing the resultant expression, use
tsubst_expr. */
@@ -6725,15 +6909,15 @@ tsubst_copy (t, args, complain, in_decl)
return t;
/* Unfortunately, we cannot just call lookup_name here.
- Consider:
-
- template <int I> int f() {
- enum E { a = I };
- struct S { void g() { E e = a; } };
- };
-
- When we instantiate f<7>::S::g(), say, lookup_name is not
- clever enough to find f<7>::a. */
+ Consider:
+
+ template <int I> int f() {
+ enum E { a = I };
+ struct S { void g() { E e = a; } };
+ };
+
+ When we instantiate f<7>::S::g(), say, lookup_name is not
+ clever enough to find f<7>::a. */
enum_type
= tsubst_aggr_type (TREE_TYPE (t), args, complain, in_decl,
/*entering_scope=*/0);
@@ -6747,7 +6931,7 @@ tsubst_copy (t, args, complain, in_decl)
/* We didn't find the name. That should never happen; if
name-lookup found it during preliminary parsing, we
should find it again here during instantiation. */
- my_friendly_abort (0);
+ abort ();
}
return t;
@@ -6778,7 +6962,7 @@ tsubst_copy (t, args, complain, in_decl)
case LOOKUP_EXPR:
{
- /* We must tsbust into a LOOKUP_EXPR in case the names to
+ /* We must tsubst into a LOOKUP_EXPR in case the names to
which it refers is a conversion operator; in that case the
name will change. We avoid making unnecessary copies,
however. */
@@ -6806,10 +6990,6 @@ tsubst_copy (t, args, complain, in_decl)
tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl));
case INDIRECT_REF:
- case PREDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
case NEGATE_EXPR:
case TRUTH_NOT_EXPR:
case BIT_NOT_EXPR:
@@ -6820,6 +7000,8 @@ tsubst_copy (t, args, complain, in_decl)
case ARROW_EXPR:
case THROW_EXPR:
case TYPEID_EXPR:
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
return build1
(code, tsubst (TREE_TYPE (t), args, complain, in_decl),
tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl));
@@ -6860,6 +7042,10 @@ tsubst_copy (t, args, complain, in_decl)
case SCOPE_REF:
case DOTSTAR_EXPR:
case MEMBER_REF:
+ case PREDECREMENT_EXPR:
+ case PREINCREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
return build_nt
(code, tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl),
tsubst_copy (TREE_OPERAND (t, 1), args, complain, in_decl));
@@ -6907,29 +7093,30 @@ tsubst_copy (t, args, complain, in_decl)
NULL_TREE);
}
- case BIND_EXPR:
+ case STMT_EXPR:
+ /* This processing should really occur in tsubst_expr, However,
+ tsubst_expr does not recurse into expressions, since it
+ assumes that there aren't any statements inside them.
+ Instead, it simply calls build_expr_from_tree. So, we need
+ to expand the STMT_EXPR here. */
+ if (!processing_template_decl)
+ {
+ tree stmt_expr = begin_stmt_expr ();
+ tsubst_expr (STMT_EXPR_STMT (t), args,
+ complain, in_decl);
+ return finish_stmt_expr (stmt_expr);
+ }
+
+ return t;
+
case COND_EXPR:
case MODOP_EXPR:
+ case PSEUDO_DTOR_EXPR:
{
r = build_nt
(code, tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl),
tsubst_copy (TREE_OPERAND (t, 1), args, complain, in_decl),
tsubst_copy (TREE_OPERAND (t, 2), args, complain, in_decl));
-
- if (code == BIND_EXPR && !processing_template_decl)
- {
- /* This processing should really occur in tsubst_expr,
- However, tsubst_expr does not recurse into expressions,
- since it assumes that there aren't any statements
- inside them. Instead, it simply calls
- build_expr_from_tree. So, we need to expand the
- BIND_EXPR here. */
- tree rtl_expr = begin_stmt_expr ();
- tree block = tsubst_expr (TREE_OPERAND (r, 1), args,
- complain, in_decl);
- r = finish_stmt_expr (rtl_expr, block);
- }
-
return r;
}
@@ -7006,6 +7193,7 @@ tsubst_copy (t, args, complain, in_decl)
case INTEGER_TYPE:
case TEMPLATE_TYPE_PARM:
case TEMPLATE_TEMPLATE_PARM:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
case TEMPLATE_PARM_INDEX:
case POINTER_TYPE:
case REFERENCE_TYPE:
@@ -7014,16 +7202,17 @@ tsubst_copy (t, args, complain, in_decl)
case METHOD_TYPE:
case ARRAY_TYPE:
case TYPENAME_TYPE:
+ case UNBOUND_CLASS_TEMPLATE:
+ case TYPEOF_TYPE:
case TYPE_DECL:
return tsubst (t, args, complain, in_decl);
case IDENTIFIER_NODE:
- if (IDENTIFIER_TYPENAME_P (t)
- /* Make sure it's not just a variable named `__opr', for instance,
- which can occur in some existing code. */
- && TREE_TYPE (t))
- return build_typename_overload
- (tsubst (TREE_TYPE (t), args, complain, in_decl));
+ if (IDENTIFIER_TYPENAME_P (t))
+ {
+ tree new_type = tsubst (TREE_TYPE (t), args, complain, in_decl);
+ return mangle_conv_op_name_for_type (new_type);
+ }
else
return t;
@@ -7037,12 +7226,17 @@ tsubst_copy (t, args, complain, in_decl)
return r;
}
+ case VA_ARG_EXPR:
+ return build_x_va_arg (tsubst_copy (TREE_OPERAND (t, 0), args, complain,
+ in_decl),
+ tsubst (TREE_TYPE (t), args, complain, in_decl));
+
default:
return t;
}
}
-/* Like tsubst_copy, but also does semantic processing and RTL expansion. */
+/* Like tsubst_copy, but also does semantic processing. */
tree
tsubst_expr (t, args, complain, in_decl)
@@ -7050,108 +7244,170 @@ tsubst_expr (t, args, complain, in_decl)
int complain;
tree in_decl;
{
+ tree stmt, tmp;
+
if (t == NULL_TREE || t == error_mark_node)
return t;
if (processing_template_decl)
return tsubst_copy (t, args, complain, in_decl);
+ if (!statement_code_p (TREE_CODE (t)))
+ return build_expr_from_tree (tsubst_copy (t, args, complain, in_decl));
+
switch (TREE_CODE (t))
{
+ case RETURN_INIT:
+ prep_stmt (t);
+ finish_named_return_value
+ (TREE_OPERAND (t, 0),
+ tsubst_expr (TREE_OPERAND (t, 1), args, /*complain=*/1, in_decl));
+ break;
+
+ case CTOR_INITIALIZER:
+ {
+ tree member_init_list;
+ tree base_init_list;
+
+ prep_stmt (t);
+ member_init_list
+ = tsubst_initializer_list (TREE_OPERAND (t, 0), args);
+ base_init_list
+ = tsubst_initializer_list (TREE_OPERAND (t, 1), args);
+ emit_base_init (member_init_list, base_init_list);
+ break;
+ }
+
case RETURN_STMT:
- lineno = TREE_COMPLEXITY (t);
+ prep_stmt (t);
finish_return_stmt (tsubst_expr (RETURN_EXPR (t),
args, complain, in_decl));
break;
case EXPR_STMT:
- lineno = TREE_COMPLEXITY (t);
+ prep_stmt (t);
finish_expr_stmt (tsubst_expr (EXPR_STMT_EXPR (t),
args, complain, in_decl));
break;
+ case USING_STMT:
+ prep_stmt (t);
+ do_using_directive (tsubst_expr (USING_STMT_NAMESPACE (t),
+ args, complain, in_decl));
+ break;
+
case DECL_STMT:
{
- int i = suspend_momentary ();
- tree dcl, init;
-
- lineno = TREE_COMPLEXITY (t);
- emit_line_note (input_filename, lineno);
- dcl = start_decl
- (tsubst (TREE_OPERAND (t, 0), args, complain, in_decl),
- tsubst (TREE_OPERAND (t, 1), args, complain, in_decl),
- TREE_OPERAND (t, 2) != 0, NULL_TREE, NULL_TREE);
- init = tsubst_expr (TREE_OPERAND (t, 2), args, complain, in_decl);
- cp_finish_decl
- (dcl, init, NULL_TREE, 1, /*init ? LOOKUP_ONLYCONVERTING :*/ 0);
- resume_momentary (i);
- return dcl;
+ tree decl;
+ tree init;
+
+ prep_stmt (t);
+ decl = DECL_STMT_DECL (t);
+ if (TREE_CODE (decl) == LABEL_DECL)
+ finish_label_decl (DECL_NAME (decl));
+ else if (TREE_CODE (decl) == USING_DECL)
+ {
+ tree scope = DECL_INITIAL (decl);
+ tree name = DECL_NAME (decl);
+
+ scope = tsubst_expr (scope, args, complain, in_decl);
+ do_local_using_decl (build_nt (SCOPE_REF, scope, name));
+ }
+ else
+ {
+ init = DECL_INITIAL (decl);
+ decl = tsubst (decl, args, complain, in_decl);
+ if (DECL_PRETTY_FUNCTION_P (decl))
+ init = DECL_INITIAL (decl);
+ else
+ init = tsubst_expr (init, args, complain, in_decl);
+ if (decl != error_mark_node)
+ {
+ if (TREE_CODE (decl) != TYPE_DECL)
+ /* Make sure the type is instantiated now. */
+ complete_type (TREE_TYPE (decl));
+ if (init)
+ DECL_INITIAL (decl) = error_mark_node;
+ /* By marking the declaration as instantiated, we avoid
+ trying to instantiate it. Since instantiate_decl can't
+ handle local variables, and since we've already done
+ all that needs to be done, that's the right thing to
+ do. */
+ if (TREE_CODE (decl) == VAR_DECL)
+ DECL_TEMPLATE_INSTANTIATED (decl) = 1;
+ maybe_push_decl (decl);
+ cp_finish_decl (decl, init, NULL_TREE, 0);
+ }
+ }
+
+ /* A DECL_STMT can also be used as an expression, in the condition
+ clause of a if/for/while construct. If we aren't followed by
+ another statement, return our decl. */
+ if (TREE_CHAIN (t) == NULL_TREE)
+ return decl;
}
+ break;
case FOR_STMT:
{
- tree tmp;
- lineno = TREE_COMPLEXITY (t);
+ prep_stmt (t);
- begin_for_stmt ();
- for (tmp = FOR_INIT_STMT (t); tmp; tmp = TREE_CHAIN (tmp))
- tsubst_expr (tmp, args, complain, in_decl);
- finish_for_init_stmt (NULL_TREE);
+ stmt = begin_for_stmt ();
+ tsubst_expr (FOR_INIT_STMT (t), args, complain, in_decl);
+ finish_for_init_stmt (stmt);
finish_for_cond (tsubst_expr (FOR_COND (t), args,
complain, in_decl),
- NULL_TREE);
+ stmt);
tmp = tsubst_expr (FOR_EXPR (t), args, complain, in_decl);
- finish_for_expr (tmp, NULL_TREE);
+ finish_for_expr (tmp, stmt);
tsubst_expr (FOR_BODY (t), args, complain, in_decl);
- finish_for_stmt (tmp, NULL_TREE);
+ finish_for_stmt (stmt);
}
break;
case WHILE_STMT:
{
- lineno = TREE_COMPLEXITY (t);
- begin_while_stmt ();
+ prep_stmt (t);
+ stmt = begin_while_stmt ();
finish_while_stmt_cond (tsubst_expr (WHILE_COND (t),
args, complain, in_decl),
- NULL_TREE);
+ stmt);
tsubst_expr (WHILE_BODY (t), args, complain, in_decl);
- finish_while_stmt (NULL_TREE);
+ finish_while_stmt (stmt);
}
break;
case DO_STMT:
{
- lineno = TREE_COMPLEXITY (t);
- begin_do_stmt ();
+ prep_stmt (t);
+ stmt = begin_do_stmt ();
tsubst_expr (DO_BODY (t), args, complain, in_decl);
- finish_do_body (NULL_TREE);
+ finish_do_body (stmt);
finish_do_stmt (tsubst_expr (DO_COND (t), args,
complain, in_decl),
- NULL_TREE);
+ stmt);
}
break;
case IF_STMT:
{
- tree tmp;
-
- lineno = TREE_COMPLEXITY (t);
- begin_if_stmt ();
+ prep_stmt (t);
+ stmt = begin_if_stmt ();
finish_if_stmt_cond (tsubst_expr (IF_COND (t),
args, complain, in_decl),
- NULL_TREE);
+ stmt);
if (tmp = THEN_CLAUSE (t), tmp)
{
tsubst_expr (tmp, args, complain, in_decl);
- finish_then_clause (NULL_TREE);
+ finish_then_clause (stmt);
}
if (tmp = ELSE_CLAUSE (t), tmp)
{
begin_else_clause ();
tsubst_expr (tmp, args, complain, in_decl);
- finish_else_clause (NULL_TREE);
+ finish_else_clause (stmt);
}
finish_if_stmt ();
@@ -7160,71 +7416,72 @@ tsubst_expr (t, args, complain, in_decl)
case COMPOUND_STMT:
{
- tree substmt;
-
- lineno = TREE_COMPLEXITY (t);
- begin_compound_stmt (COMPOUND_STMT_NO_SCOPE (t));
- for (substmt = COMPOUND_BODY (t);
- substmt != NULL_TREE;
- substmt = TREE_CHAIN (substmt))
- tsubst_expr (substmt, args, complain, in_decl);
- return finish_compound_stmt (COMPOUND_STMT_NO_SCOPE (t),
- NULL_TREE);
+ prep_stmt (t);
+ if (COMPOUND_STMT_BODY_BLOCK (t))
+ stmt = begin_function_body ();
+ else
+ stmt = begin_compound_stmt (COMPOUND_STMT_NO_SCOPE (t));
+
+ tsubst_expr (COMPOUND_BODY (t), args, complain, in_decl);
+
+ if (COMPOUND_STMT_BODY_BLOCK (t))
+ finish_function_body (stmt);
+ else
+ finish_compound_stmt (COMPOUND_STMT_NO_SCOPE (t), stmt);
}
break;
case BREAK_STMT:
- lineno = TREE_COMPLEXITY (t);
+ prep_stmt (t);
finish_break_stmt ();
break;
case CONTINUE_STMT:
- lineno = TREE_COMPLEXITY (t);
+ prep_stmt (t);
finish_continue_stmt ();
break;
case SWITCH_STMT:
{
- tree val, tmp;
+ tree val;
- lineno = TREE_COMPLEXITY (t);
- begin_switch_stmt ();
+ prep_stmt (t);
+ stmt = begin_switch_stmt ();
val = tsubst_expr (SWITCH_COND (t), args, complain, in_decl);
- finish_switch_cond (val);
-
- if (tmp = TREE_OPERAND (t, 1), tmp)
- tsubst_expr (tmp, args, complain, in_decl);
-
- finish_switch_stmt (val, NULL_TREE);
+ finish_switch_cond (val, stmt);
+ tsubst_expr (SWITCH_BODY (t), args, complain, in_decl);
+ finish_switch_stmt (stmt);
}
break;
case CASE_LABEL:
+ prep_stmt (t);
finish_case_label (tsubst_expr (CASE_LOW (t), args, complain, in_decl),
- tsubst_expr (CASE_HIGH (t), args, complain, in_decl));
+ tsubst_expr (CASE_HIGH (t), args, complain,
+ in_decl));
break;
- case LABEL_DECL:
- t = define_label (DECL_SOURCE_FILE (t), DECL_SOURCE_LINE (t),
- DECL_NAME (t));
- if (t)
- expand_label (t);
+ case LABEL_STMT:
+ lineno = STMT_LINENO (t);
+ finish_label_stmt (DECL_NAME (LABEL_STMT_LABEL (t)));
break;
case GOTO_STMT:
- lineno = TREE_COMPLEXITY (t);
- t = GOTO_DESTINATION (t);
- if (TREE_CODE (t) != IDENTIFIER_NODE)
+ prep_stmt (t);
+ tmp = GOTO_DESTINATION (t);
+ if (TREE_CODE (tmp) != LABEL_DECL)
/* Computed goto's must be tsubst'd into. On the other hand,
non-computed gotos must not be; the identifier in question
will have no binding. */
- t = tsubst_expr (t, args, complain, in_decl);
- finish_goto_stmt (t);
+ tmp = tsubst_expr (tmp, args, complain, in_decl);
+ else
+ tmp = DECL_NAME (tmp);
+ finish_goto_stmt (tmp);
break;
case ASM_STMT:
- lineno = TREE_COMPLEXITY (t);
- finish_asm_stmt (tsubst_expr (ASM_CV_QUAL (t), args, complain, in_decl),
+ prep_stmt (t);
+ finish_asm_stmt (ASM_CV_QUAL (t),
tsubst_expr (ASM_STRING (t), args, complain, in_decl),
tsubst_expr (ASM_OUTPUTS (t), args, complain, in_decl),
tsubst_expr (ASM_INPUTS (t), args, complain, in_decl),
@@ -7233,46 +7490,75 @@ tsubst_expr (t, args, complain, in_decl)
break;
case TRY_BLOCK:
- lineno = TREE_COMPLEXITY (t);
- begin_try_block ();
- tsubst_expr (TRY_STMTS (t), args, complain, in_decl);
- finish_try_block (NULL_TREE);
- {
- tree handler = TRY_HANDLERS (t);
- for (; handler; handler = TREE_CHAIN (handler))
- tsubst_expr (handler, args, complain, in_decl);
- }
- finish_handler_sequence (NULL_TREE);
- break;
-
- case HANDLER:
- lineno = TREE_COMPLEXITY (t);
- begin_handler ();
- if (HANDLER_PARMS (t))
+ prep_stmt (t);
+ if (CLEANUP_P (t))
{
- tree d = HANDLER_PARMS (t);
- expand_start_catch_block
- (tsubst (TREE_OPERAND (d, 1), args, complain, in_decl),
- tsubst (TREE_OPERAND (d, 0), args, complain, in_decl));
+ stmt = begin_try_block ();
+ tsubst_expr (TRY_STMTS (t), args, complain, in_decl);
+ finish_cleanup_try_block (stmt);
+ finish_cleanup (tsubst_expr (TRY_HANDLERS (t), args,
+ complain, in_decl),
+ stmt);
}
else
- expand_start_catch_block (NULL_TREE, NULL_TREE);
- finish_handler_parms (NULL_TREE);
- tsubst_expr (HANDLER_BODY (t), args, complain, in_decl);
- finish_handler (NULL_TREE);
+ {
+ if (FN_TRY_BLOCK_P (t))
+ stmt = begin_function_try_block ();
+ else
+ stmt = begin_try_block ();
+
+ tsubst_expr (TRY_STMTS (t), args, complain, in_decl);
+
+ if (FN_TRY_BLOCK_P (t))
+ finish_function_try_block (stmt);
+ else
+ finish_try_block (stmt);
+
+ tsubst_expr (TRY_HANDLERS (t), args, complain, in_decl);
+ if (FN_TRY_BLOCK_P (t))
+ finish_function_handler_sequence (stmt);
+ else
+ finish_handler_sequence (stmt);
+ }
+ break;
+
+ case HANDLER:
+ {
+ tree decl;
+
+ prep_stmt (t);
+ stmt = begin_handler ();
+ if (HANDLER_PARMS (t))
+ {
+ decl = DECL_STMT_DECL (HANDLER_PARMS (t));
+ decl = tsubst (decl, args, complain, in_decl);
+ /* Prevent instantiate_decl from trying to instantiate
+ this variable. We've already done all that needs to be
+ done. */
+ DECL_TEMPLATE_INSTANTIATED (decl) = 1;
+ }
+ else
+ decl = NULL_TREE;
+ finish_handler_parms (decl, stmt);
+ tsubst_expr (HANDLER_BODY (t), args, complain, in_decl);
+ finish_handler (stmt);
+ }
break;
case TAG_DEFN:
- lineno = TREE_COMPLEXITY (t);
- t = TREE_TYPE (t);
- if (TREE_CODE (t) == ENUMERAL_TYPE)
- tsubst (t, args, complain, NULL_TREE);
+ prep_stmt (t);
+ tsubst (TREE_TYPE (t), args, complain, NULL_TREE);
+ break;
+
+ case CTOR_STMT:
+ add_stmt (copy_node (t));
break;
default:
- return build_expr_from_tree (tsubst_copy (t, args, complain, in_decl));
+ abort ();
}
- return NULL_TREE;
+
+ return tsubst_expr (TREE_CHAIN (t), args, complain, in_decl);
}
/* Instantiate the indicated variable or function template TMPL with
@@ -7286,8 +7572,6 @@ instantiate_template (tmpl, targ_ptr)
tree gen_tmpl;
tree spec;
int i, len;
- struct obstack *old_fmp_obstack;
- extern struct obstack *function_maybepermanent_obstack;
tree inner_args;
if (tmpl == error_mark_node)
@@ -7295,54 +7579,64 @@ instantiate_template (tmpl, targ_ptr)
my_friendly_assert (TREE_CODE (tmpl) == TEMPLATE_DECL, 283);
+ /* If this function is a clone, handle it specially. */
+ if (DECL_CLONED_FUNCTION_P (tmpl))
+ {
+ tree spec = instantiate_template (DECL_CLONED_FUNCTION (tmpl), targ_ptr);
+ tree clone;
+
+ /* Look for the clone. */
+ for (clone = TREE_CHAIN (spec);
+ clone && DECL_CLONED_FUNCTION_P (clone);
+ clone = TREE_CHAIN (clone))
+ if (DECL_NAME (clone) == DECL_NAME (tmpl))
+ return clone;
+ /* We should always have found the clone by now. */
+ abort ();
+ return NULL_TREE;
+ }
+
/* Check to see if we already have this specialization. */
spec = retrieve_specialization (tmpl, targ_ptr);
if (spec != NULL_TREE)
return spec;
- if (DECL_TEMPLATE_INFO (tmpl))
+ gen_tmpl = most_general_template (tmpl);
+ if (tmpl != gen_tmpl)
{
/* The TMPL is a partial instantiation. To get a full set of
arguments we must add the arguments used to perform the
partial instantiation. */
targ_ptr = add_outermost_template_args (DECL_TI_ARGS (tmpl),
targ_ptr);
- gen_tmpl = most_general_template (tmpl);
/* Check to see if we already have this specialization. */
spec = retrieve_specialization (gen_tmpl, targ_ptr);
if (spec != NULL_TREE)
return spec;
}
- else
- gen_tmpl = tmpl;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
- old_fmp_obstack = function_maybepermanent_obstack;
- function_maybepermanent_obstack = &permanent_obstack;
len = DECL_NTPARMS (gen_tmpl);
- inner_args = innermost_args (targ_ptr);
+ inner_args = INNERMOST_TEMPLATE_ARGS (targ_ptr);
i = len;
while (i--)
{
tree t = TREE_VEC_ELT (inner_args, i);
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
+ if (TYPE_P (t))
{
tree nt = target_type (t);
if (IS_AGGR_TYPE (nt) && decl_function_context (TYPE_MAIN_DECL (nt)))
{
- cp_error ("type `%T' composed from a local class is not a valid template-argument", t);
- cp_error (" trying to instantiate `%D'", gen_tmpl);
- fndecl = error_mark_node;
- goto out;
+ error ("type `%T' composed from a local class is not a valid template-argument", t);
+ error (" trying to instantiate `%D'", gen_tmpl);
+ return error_mark_node;
}
}
}
- targ_ptr = copy_to_permanent (targ_ptr);
/* substitute template parameters */
- fndecl = tsubst (DECL_RESULT (gen_tmpl), targ_ptr, /*complain=*/1, gen_tmpl);
+ fndecl = tsubst (DECL_TEMPLATE_RESULT (gen_tmpl),
+ targ_ptr, /*complain=*/1, gen_tmpl);
/* The DECL_TI_TEMPLATE should always be the immediate parent
template, not the most general template. */
DECL_TI_TEMPLATE (fndecl) = tmpl;
@@ -7350,31 +7644,16 @@ instantiate_template (tmpl, targ_ptr)
if (flag_external_templates)
add_pending_template (fndecl);
- out:
- function_maybepermanent_obstack = old_fmp_obstack;
- pop_obstacks ();
+ /* If we've just instantiated the main entry point for a function,
+ instantiate all the alternate entry points as well. We do this
+ by cloning the instantiation of the main entry point, not by
+ instantiating the template clones. */
+ if (TREE_CHAIN (gen_tmpl) && DECL_CLONED_FUNCTION_P (TREE_CHAIN (gen_tmpl)))
+ clone_function_decl (fndecl, /*update_method_vec_p=*/0);
return fndecl;
}
-/* Push the name of the class template into the scope of the instantiation. */
-
-void
-overload_template_name (type)
- tree type;
-{
- tree id = DECL_NAME (CLASSTYPE_TI_TEMPLATE (type));
- tree decl;
-
- if (IDENTIFIER_CLASS_VALUE (id)
- && TREE_TYPE (IDENTIFIER_CLASS_VALUE (id)) == type)
- return;
-
- decl = build_decl (TYPE_DECL, id, type);
- SET_DECL_ARTIFICIAL (decl);
- pushdecl_class_level (decl);
-}
-
/* The FN is a TEMPLATE_DECL for a function. The ARGS are the
arguments that are being used when calling it. TARGS is a vector
into which the deduced template arguments are placed.
@@ -7383,10 +7662,8 @@ overload_template_name (type)
all the types, and 1 for complete failure. An error message will be
printed only for an incomplete match.
- If FN is a conversion operator, RETURN_TYPE is the type desired as
- the result of the conversion operator.
-
- TPARMS is a vector of template parameters.
+ If FN is a conversion operator, or we are trying to produce a specific
+ specialization, RETURN_TYPE is the return type desired.
The EXPLICIT_TARGS are explicit template arguments provided via a
template-id.
@@ -7402,24 +7679,32 @@ overload_template_name (type)
[temp.deduct.conv].
DEDUCE_EXACT:
+ We are deducing arguments when doing an explicit instantiation
+ as in [temp.explicit], when determining an explicit specialization
+ as in [temp.expl.spec], or when taking the address of a function
+ template, as in [temp.deduct.funcaddr].
+
+ DEDUCE_ORDER:
We are deducing arguments when calculating the partial
ordering between specializations of function or class
- templates, as in [temp.func.order] and [temp.class.order],
- when doing an explicit instantiation as in [temp.explicit],
- when determining an explicit specialization as in
- [temp.expl.spec], or when taking the address of a function
- template, as in [temp.deduct.funcaddr].
+ templates, as in [temp.func.order] and [temp.class.order].
- The other arguments are as for type_unification. */
+ LEN is the number of parms to consider before returning success, or -1
+ for all. This is used in partial ordering to avoid comparing parms for
+ which no actual argument was passed, since they are not considered in
+ overload resolution (and are explicitly excluded from consideration in
+ partial ordering in [temp.func.order]/6). */
int
fn_type_unification (fn, explicit_targs, targs, args, return_type,
- strict)
+ strict, len)
tree fn, explicit_targs, targs, args, return_type;
unification_kind_t strict;
+ int len;
{
tree parms;
tree fntype;
+ int result;
my_friendly_assert (TREE_CODE (fn) == TEMPLATE_DECL, 0);
@@ -7463,24 +7748,42 @@ fn_type_unification (fn, explicit_targs, targs, args, return_type,
}
parms = TYPE_ARG_TYPES (fntype);
-
- if (DECL_CONV_FN_P (fn))
+ /* Never do unification on the 'this' parameter. */
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
+ parms = TREE_CHAIN (parms);
+
+ if (return_type)
{
- /* This is a template conversion operator. Use the return types
- as well as the argument types. We use it instead of 'this', since
- we could be comparing conversions from different classes. */
- parms = scratch_tree_cons (NULL_TREE, TREE_TYPE (fntype),
- TREE_CHAIN (parms));
- args = scratch_tree_cons (NULL_TREE, return_type, TREE_CHAIN (args));
+ /* We've been given a return type to match, prepend it. */
+ parms = tree_cons (NULL_TREE, TREE_TYPE (fntype), parms);
+ args = tree_cons (NULL_TREE, return_type, args);
+ if (len >= 0)
+ ++len;
}
/* We allow incomplete unification without an error message here
because the standard doesn't seem to explicitly prohibit it. Our
callers must be ready to deal with unification failures in any
event. */
- return type_unification_real (DECL_INNERMOST_TEMPLATE_PARMS (fn),
- targs, parms, args, /*subr=*/0,
- strict, /*allow_incomplete*/1);
+ result = type_unification_real (DECL_INNERMOST_TEMPLATE_PARMS (fn),
+ targs, parms, args, /*subr=*/0,
+ strict, /*allow_incomplete*/1, len);
+
+ if (result == 0)
+ /* All is well so far. Now, check:
+
+ [temp.deduct]
+
+ When all template arguments have been deduced, all uses of
+ template parameters in nondeduced contexts are replaced with
+ the corresponding deduced argument values. If the
+ substitution results in an invalid type, as described above,
+ type deduction fails. */
+ if (tsubst (TREE_TYPE (fn), targs, /*complain=*/0, NULL_TREE)
+ == error_mark_node)
+ return 1;
+
+ return result;
}
/* Adjust types before performing type deduction, as described in
@@ -7488,14 +7791,16 @@ fn_type_unification (fn, explicit_targs, targs, args, return_type,
sections are symmetric. PARM is the type of a function parameter
or the return type of the conversion function. ARG is the type of
the argument passed to the call, or the type of the value
- intialized with the result of the conversion function. */
+ initialized with the result of the conversion function. */
-static void
+static int
maybe_adjust_types_for_deduction (strict, parm, arg)
unification_kind_t strict;
tree* parm;
tree* arg;
{
+ int result = 0;
+
switch (strict)
{
case DEDUCE_CALL:
@@ -7514,10 +7819,32 @@ maybe_adjust_types_for_deduction (strict, parm, arg)
case DEDUCE_EXACT:
/* There is nothing to do in this case. */
- return;
+ return 0;
+ case DEDUCE_ORDER:
+ /* DR 214. [temp.func.order] is underspecified, and leads to no
+ ordering between things like `T *' and `T const &' for `U *'.
+ The former has T=U and the latter T=U*. The former looks more
+ specialized and John Spicer considers it well-formed (the EDG
+ compiler accepts it).
+
+ John also confirms that deduction should proceed as in a function
+ call. Which implies the usual ARG and PARM conversions as DEDUCE_CALL.
+ However, in ordering, ARG can have REFERENCE_TYPE, but no argument
+ to an actual call can have such a type.
+
+ If both ARG and PARM are REFERENCE_TYPE, we change neither.
+ If only ARG is a REFERENCE_TYPE, we look through that and then
+ proceed as with DEDUCE_CALL (which could further convert it). */
+ if (TREE_CODE (*arg) == REFERENCE_TYPE)
+ {
+ if (TREE_CODE (*parm) == REFERENCE_TYPE)
+ return 0;
+ *arg = TREE_TYPE (*arg);
+ }
+ break;
default:
- my_friendly_abort (0);
+ abort ();
}
if (TREE_CODE (*parm) != REFERENCE_TYPE)
@@ -7554,41 +7881,49 @@ maybe_adjust_types_for_deduction (strict, parm, arg)
type deduction. */
*parm = TYPE_MAIN_VARIANT (*parm);
if (TREE_CODE (*parm) == REFERENCE_TYPE)
- *parm = TREE_TYPE (*parm);
+ {
+ *parm = TREE_TYPE (*parm);
+ result |= UNIFY_ALLOW_OUTER_MORE_CV_QUAL;
+ }
+ return result;
}
-/* Like type_unfication.
+/* Most parms like fn_type_unification.
If SUBR is 1, we're being called recursively (to unify the
arguments of a function or method parameter of a function
template). */
static int
-type_unification_real (tparms, targs, parms, args, subr,
- strict, allow_incomplete)
- tree tparms, targs, parms, args;
+type_unification_real (tparms, targs, xparms, xargs, subr,
+ strict, allow_incomplete, xlen)
+ tree tparms, targs, xparms, xargs;
int subr;
unification_kind_t strict;
- int allow_incomplete;
+ int allow_incomplete, xlen;
{
tree parm, arg;
int i;
int ntparms = TREE_VEC_LENGTH (tparms);
int sub_strict;
+ int saw_undeduced = 0;
+ tree parms, args;
+ int len;
my_friendly_assert (TREE_CODE (tparms) == TREE_VEC, 289);
- my_friendly_assert (parms == NULL_TREE
- || TREE_CODE (parms) == TREE_LIST, 290);
+ my_friendly_assert (xparms == NULL_TREE
+ || TREE_CODE (xparms) == TREE_LIST, 290);
/* ARGS could be NULL (via a call from parse.y to
build_x_function_call). */
- if (args)
- my_friendly_assert (TREE_CODE (args) == TREE_LIST, 291);
+ if (xargs)
+ my_friendly_assert (TREE_CODE (xargs) == TREE_LIST, 291);
my_friendly_assert (ntparms > 0, 292);
switch (strict)
{
case DEDUCE_CALL:
- sub_strict = UNIFY_ALLOW_MORE_CV_QUAL | UNIFY_ALLOW_DERIVED;
+ sub_strict = (UNIFY_ALLOW_OUTER_LEVEL | UNIFY_ALLOW_MORE_CV_QUAL
+ | UNIFY_ALLOW_DERIVED);
break;
case DEDUCE_CONV:
@@ -7598,11 +7933,23 @@ type_unification_real (tparms, targs, parms, args, subr,
case DEDUCE_EXACT:
sub_strict = UNIFY_ALLOW_NONE;
break;
+
+ case DEDUCE_ORDER:
+ sub_strict = UNIFY_ALLOW_NONE;
+ break;
default:
- my_friendly_abort (0);
+ abort ();
}
+ if (xlen == 0)
+ return 0;
+
+ again:
+ parms = xparms;
+ args = xargs;
+ len = xlen;
+
while (parms
&& parms != void_list_node
&& args
@@ -7628,7 +7975,7 @@ type_unification_real (tparms, targs, parms, args, subr,
{
tree type;
- if (TREE_CODE_CLASS (TREE_CODE (arg)) != 't')
+ if (!TYPE_P (arg))
type = TREE_TYPE (arg);
else
{
@@ -7636,7 +7983,7 @@ type_unification_real (tparms, targs, parms, args, subr,
arg = NULL_TREE;
}
- if (strict == DEDUCE_EXACT)
+ if (strict == DEDUCE_EXACT || strict == DEDUCE_ORDER)
{
if (same_type_p (parm, type))
continue;
@@ -7650,7 +7997,7 @@ type_unification_real (tparms, targs, parms, args, subr,
return 1;
}
- if (TREE_CODE_CLASS (TREE_CODE (arg)) != 't')
+ if (!TYPE_P (arg))
{
my_friendly_assert (TREE_TYPE (arg) != NULL_TREE, 293);
if (type_unknown_p (arg))
@@ -7669,17 +8016,20 @@ type_unification_real (tparms, targs, parms, args, subr,
}
arg = TREE_TYPE (arg);
}
+
+ {
+ int arg_strict = sub_strict;
+
+ if (!subr)
+ arg_strict |= maybe_adjust_types_for_deduction (strict, &parm, &arg);
- if (!subr)
- maybe_adjust_types_for_deduction (strict, &parm, &arg);
+ if (unify (tparms, targs, parm, arg, arg_strict))
+ return 1;
+ }
- switch (unify (tparms, targs, parm, arg, sub_strict))
- {
- case 0:
- break;
- case 1:
- return 1;
- }
+ /* Are we done with the interesting parms? */
+ if (--len == 0)
+ goto done;
}
/* Fail if we've reached the end of the parm list, and more args
are present, and the parm list isn't variadic. */
@@ -7690,10 +8040,23 @@ type_unification_real (tparms, targs, parms, args, subr,
&& parms != void_list_node
&& TREE_PURPOSE (parms) == NULL_TREE)
return 1;
+
+ done:
if (!subr)
for (i = 0; i < ntparms; i++)
if (TREE_VEC_ELT (targs, i) == NULL_TREE)
{
+ tree tparm = TREE_VALUE (TREE_VEC_ELT (tparms, i));
+
+ /* If this is an undeduced nontype parameter that depends on
+ a type parameter, try another pass; its type may have been
+ deduced from a later argument than the one from which
+ this parameter can be deduced. */
+ if (TREE_CODE (tparm) == PARM_DECL
+ && uses_template_parms (TREE_TYPE (tparm))
+ && !saw_undeduced++)
+ goto again;
+
if (!allow_incomplete)
error ("incomplete type unification");
return 2;
@@ -7748,7 +8111,8 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict,
if (TREE_CODE (fn) != TEMPLATE_DECL)
continue;
- subargs = get_bindings_overload (fn, DECL_RESULT (fn), expl_subargs);
+ subargs = get_bindings_overload (fn, DECL_TEMPLATE_RESULT (fn),
+ expl_subargs);
if (subargs)
{
elem = tsubst (TREE_TYPE (fn), subargs, /*complain=*/0,
@@ -7773,7 +8137,7 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict,
}
}
else
- my_friendly_abort (981006);
+ abort ();
/* [temp.deduct.type] A template-argument can be deduced from a pointer
to function or pointer to member function argument if the set of
@@ -7822,14 +8186,14 @@ try_one_overload (tparms, orig_targs, targs, parm, arg, strict,
if (uses_template_parms (arg))
return 1;
- maybe_adjust_types_for_deduction (strict, &parm, &arg);
+ sub_strict |= maybe_adjust_types_for_deduction (strict, &parm, &arg);
/* We don't copy orig_targs for this because if we have already deduced
some template args from previous args, unify would complain when we
try to deduce a template parameter for the same argument, even though
there isn't really a conflict. */
nargs = TREE_VEC_LENGTH (targs);
- tempargs = make_scratch_vec (nargs);
+ tempargs = make_tree_vec (nargs);
if (unify (tparms, tempargs, parm, arg, sub_strict) != 0)
return 0;
@@ -7866,6 +8230,52 @@ try_one_overload (tparms, orig_targs, targs, parm, arg, strict,
return 1;
}
+/* Verify that nondeduce template argument agrees with the type
+ obtained from argument deduction. Return nonzero if the
+ verification fails.
+
+ For example:
+
+ struct A { typedef int X; };
+ template <class T, class U> struct C {};
+ template <class T> struct C<T, typename T::X> {};
+
+ Then with the instantiation `C<A, int>', we can deduce that
+ `T' is `A' but unify () does not check whether `typename T::X'
+ is `int'. This function ensure that they agree.
+
+ TARGS, PARMS are the same as the arguments of unify.
+ ARGS contains template arguments from all levels. */
+
+static int
+verify_class_unification (targs, parms, args)
+ tree targs, parms, args;
+{
+ int i;
+ int nparms = TREE_VEC_LENGTH (parms);
+ tree new_parms = tsubst (parms, add_outermost_template_args (args, targs),
+ /*complain=*/0, NULL_TREE);
+ if (new_parms == error_mark_node)
+ return 1;
+
+ args = INNERMOST_TEMPLATE_ARGS (args);
+
+ for (i = 0; i < nparms; i++)
+ {
+ tree parm = TREE_VEC_ELT (new_parms, i);
+ tree arg = TREE_VEC_ELT (args, i);
+
+ /* In case we are deducing from a function argument of a function
+ templates, some parameters may not be deduced yet. So we
+ make sure that only fully substituted elements of PARM are
+ compared below. */
+
+ if (!uses_template_parms (parm) && !template_args_equal (parm, arg))
+ return 1;
+ }
+ return 0;
+}
+
/* PARM is a template class (perhaps with unbound template
parameters). ARG is a fully instantiated type. If ARG can be
bound to PARM, return ARG, otherwise return NULL_TREE. TPARMS and
@@ -7878,7 +8288,6 @@ try_class_unification (tparms, targs, parm, arg)
tree parm;
tree arg;
{
- int i;
tree copy_of_targs;
if (!CLASSTYPE_TEMPLATE_INFO (arg)
@@ -7915,21 +8324,18 @@ try_class_unification (tparms, targs, parm, arg)
because there are two ways to unify base classes of S<0, 1, 2>
with S<I, I, I>. If we kept the already deduced knowledge, we
would reject the possibility I=1. */
- push_momentary ();
- copy_of_targs = make_temp_vec (TREE_VEC_LENGTH (targs));
- i = unify (tparms, copy_of_targs, CLASSTYPE_TI_ARGS (parm),
- CLASSTYPE_TI_ARGS (arg), UNIFY_ALLOW_NONE);
- pop_momentary ();
+ copy_of_targs = make_tree_vec (TREE_VEC_LENGTH (targs));
/* If unification failed, we're done. */
- if (i != 0)
+ if (unify (tparms, copy_of_targs, CLASSTYPE_TI_ARGS (parm),
+ CLASSTYPE_TI_ARGS (arg), UNIFY_ALLOW_NONE))
return NULL_TREE;
- else
- return arg;
+
+ return arg;
}
/* Subroutine of get_template_base. RVAL, if non-NULL, is a base we
- have alreay discovered to be satisfactory. ARG_BINFO is the binfo
+ have already discovered to be satisfactory. ARG_BINFO is the binfo
for the base class of ARG that we are currently examining. */
static tree
@@ -8049,7 +8455,7 @@ template_decl_level (decl)
return TEMPLATE_PARM_LEVEL (DECL_INITIAL (decl));
default:
- my_friendly_abort (0);
+ abort ();
return 0;
}
}
@@ -8064,20 +8470,26 @@ check_cv_quals_for_unify (strict, arg, parm)
tree arg;
tree parm;
{
- return !((!(strict & UNIFY_ALLOW_MORE_CV_QUAL)
- && !at_least_as_qualified_p (arg, parm))
- || (!(strict & UNIFY_ALLOW_LESS_CV_QUAL)
- && (!at_least_as_qualified_p (parm, arg))));
+ if (!(strict & (UNIFY_ALLOW_MORE_CV_QUAL | UNIFY_ALLOW_OUTER_MORE_CV_QUAL))
+ && !at_least_as_qualified_p (arg, parm))
+ return 0;
+
+ if (!(strict & (UNIFY_ALLOW_LESS_CV_QUAL | UNIFY_ALLOW_OUTER_LESS_CV_QUAL))
+ && !at_least_as_qualified_p (parm, arg))
+ return 0;
+
+ return 1;
}
/* Takes parameters as for type_unification. Returns 0 if the
- type deduction suceeds, 1 otherwise. The parameter STRICT is a
+ type deduction succeeds, 1 otherwise. The parameter STRICT is a
bitwise or of the following flags:
UNIFY_ALLOW_NONE:
Require an exact match between PARM and ARG.
UNIFY_ALLOW_MORE_CV_QUAL:
- Allow the deduced ARG to be more cv-qualified than ARG.
+ Allow the deduced ARG to be more cv-qualified (by qualification
+ conversion) than ARG.
UNIFY_ALLOW_LESS_CV_QUAL:
Allow the deduced ARG to be less cv-qualified than ARG.
UNIFY_ALLOW_DERIVED:
@@ -8086,7 +8498,27 @@ check_cv_quals_for_unify (strict, arg, parm)
ARG.
UNIFY_ALLOW_INTEGER:
Allow any integral type to be deduced. See the TEMPLATE_PARM_INDEX
- case for more information. */
+ case for more information.
+ UNIFY_ALLOW_OUTER_LEVEL:
+ This is the outermost level of a deduction. Used to determine validity
+ of qualification conversions. A valid qualification conversion must
+ have const qualified pointers leading up to the inner type which
+ requires additional CV quals, except at the outer level, where const
+ is not required [conv.qual]. It would be normal to set this flag in
+ addition to setting UNIFY_ALLOW_MORE_CV_QUAL.
+ UNIFY_ALLOW_OUTER_MORE_CV_QUAL:
+ This is the outermost level of a deduction, and PARM can be more CV
+ qualified at this point.
+ UNIFY_ALLOW_OUTER_LESS_CV_QUAL:
+ This is the outermost level of a deduction, and PARM can be less CV
+ qualified at this point.
+ UNIFY_ALLOW_MAX_CORRECTION:
+ This is an INTEGER_TYPE's maximum value. Used if the range may
+ have been derived from a size specification, such as an array size.
+ If the size was given by a nontype template parameter N, the maximum
+ value will have the form N-1. The flag says that we can (and indeed
+ must) unify N with (ARG + 1), an exception to the normal rules on
+ folding PARM. */
static int
unify (tparms, targs, parm, arg, strict)
@@ -8096,6 +8528,7 @@ unify (tparms, targs, parm, arg, strict)
int idx;
tree targ;
tree tparm;
+ int strict_in = strict;
/* I don't think this will do the right thing with respect to types.
But the only case I've seen it in so far has been array bounds, where
@@ -8121,18 +8554,33 @@ unify (tparms, targs, parm, arg, strict)
/* Immediately reject some pairs that won't unify because of
cv-qualification mismatches. */
if (TREE_CODE (arg) == TREE_CODE (parm)
- && TREE_CODE_CLASS (TREE_CODE (arg)) == 't'
+ && TYPE_P (arg)
+ /* It is the elements of the array which hold the cv quals of an array
+ type, and the elements might be template type parms. We'll check
+ when we recurse. */
+ && TREE_CODE (arg) != ARRAY_TYPE
/* We check the cv-qualifiers when unifying with template type
parameters below. We want to allow ARG `const T' to unify with
PARM `T' for example, when computing which of two templates
is more specialized, for example. */
&& TREE_CODE (arg) != TEMPLATE_TYPE_PARM
- && !check_cv_quals_for_unify (strict, arg, parm))
+ && !check_cv_quals_for_unify (strict_in, arg, parm))
return 1;
+ if (!(strict & UNIFY_ALLOW_OUTER_LEVEL)
+ && TYPE_P (parm) && !CP_TYPE_CONST_P (parm))
+ strict &= ~UNIFY_ALLOW_MORE_CV_QUAL;
+ strict &= ~UNIFY_ALLOW_OUTER_LEVEL;
+ strict &= ~UNIFY_ALLOW_DERIVED;
+ strict &= ~UNIFY_ALLOW_OUTER_MORE_CV_QUAL;
+ strict &= ~UNIFY_ALLOW_OUTER_LESS_CV_QUAL;
+ strict &= ~UNIFY_ALLOW_MAX_CORRECTION;
+
switch (TREE_CODE (parm))
{
case TYPENAME_TYPE:
+ case SCOPE_REF:
+ case UNBOUND_CLASS_TEMPLATE:
/* In a type which contains a nested-name-specifier, template
argument values cannot be deduced for template parameters used
within the nested-name-specifier. */
@@ -8140,6 +8588,7 @@ unify (tparms, targs, parm, arg, strict)
case TEMPLATE_TYPE_PARM:
case TEMPLATE_TEMPLATE_PARM:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
tparm = TREE_VALUE (TREE_VEC_ELT (tparms, 0));
if (TEMPLATE_TYPE_LEVEL (parm)
@@ -8159,53 +8608,63 @@ unify (tparms, targs, parm, arg, strict)
&& TREE_CODE (tparm) != TEMPLATE_DECL))
return 1;
- if (TREE_CODE (parm) == TEMPLATE_TEMPLATE_PARM)
+ if (TREE_CODE (parm) == BOUND_TEMPLATE_TEMPLATE_PARM)
{
- if (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (parm))
- {
- /* We arrive here when PARM does not involve template
- specialization. */
+ /* ARG must be constructed from a template class or a template
+ template parameter. */
+ if (TREE_CODE (arg) != BOUND_TEMPLATE_TEMPLATE_PARM
+ && (TREE_CODE (arg) != RECORD_TYPE || !CLASSTYPE_TEMPLATE_INFO (arg)))
+ return 1;
- /* ARG must be constructed from a template class. */
- if (TREE_CODE (arg) != RECORD_TYPE || !CLASSTYPE_TEMPLATE_INFO (arg))
- return 1;
+ {
+ tree parmtmpl = TYPE_TI_TEMPLATE (parm);
+ tree parmvec = TYPE_TI_ARGS (parm);
+ tree argvec = TYPE_TI_ARGS (arg);
+ tree argtmplvec
+ = DECL_INNERMOST_TEMPLATE_PARMS (TYPE_TI_TEMPLATE (arg));
+ int i;
- {
- tree parmtmpl = TYPE_TI_TEMPLATE (parm);
- tree parmvec = TYPE_TI_ARGS (parm);
- tree argvec = CLASSTYPE_TI_ARGS (arg);
- tree argtmplvec
- = DECL_INNERMOST_TEMPLATE_PARMS (CLASSTYPE_TI_TEMPLATE (arg));
- int i;
-
- /* The parameter and argument roles have to be switched here
- in order to handle default arguments properly. For example,
- template<template <class> class TT> void f(TT<int>)
- should be able to accept vector<int> which comes from
- template <class T, class Allocator = allocator>
- class vector. */
-
- if (coerce_template_parms (argtmplvec, parmvec, parmtmpl, 0, 1)
- == error_mark_node)
- return 1;
+ /* The parameter and argument roles have to be switched here
+ in order to handle default arguments properly. For example,
+ template<template <class> class TT> void f(TT<int>)
+ should be able to accept vector<int> which comes from
+ template <class T, class Allocator = allocator>
+ class vector. */
+
+ if (coerce_template_parms (argtmplvec, parmvec, parmtmpl, 0, 1)
+ == error_mark_node)
+ return 1;
- /* Deduce arguments T, i from TT<T> or TT<i>.
- We check each element of PARMVEC and ARGVEC individually
- rather than the whole TREE_VEC since they can have
- different number of elements. */
+ /* Deduce arguments T, i from TT<T> or TT<i>.
+ We check each element of PARMVEC and ARGVEC individually
+ rather than the whole TREE_VEC since they can have
+ different number of elements. */
- for (i = 0; i < TREE_VEC_LENGTH (parmvec); ++i)
- {
- tree t = TREE_VEC_ELT (parmvec, i);
+ for (i = 0; i < TREE_VEC_LENGTH (parmvec); ++i)
+ {
+ tree t = TREE_VEC_ELT (parmvec, i);
- if (unify (tparms, targs, t,
- TREE_VEC_ELT (argvec, i),
- UNIFY_ALLOW_NONE))
- return 1;
- }
+ if (unify (tparms, targs, t,
+ TREE_VEC_ELT (argvec, i),
+ UNIFY_ALLOW_NONE))
+ return 1;
}
- arg = CLASSTYPE_TI_TEMPLATE (arg);
- }
+ }
+ arg = TYPE_TI_TEMPLATE (arg);
+
+ /* Fall through to deduce template name. */
+ }
+
+ if (TREE_CODE (parm) == TEMPLATE_TEMPLATE_PARM
+ || TREE_CODE (parm) == BOUND_TEMPLATE_TEMPLATE_PARM)
+ {
+ /* Deduce template name TT from TT, TT<>, TT<T> and TT<i>. */
+
+ /* Simple cases: Value already set, does match or doesn't. */
+ if (targ != NULL_TREE && template_args_equal (targ, arg))
+ return 0;
+ else if (targ)
+ return 1;
}
else
{
@@ -8213,23 +8672,26 @@ unify (tparms, targs, parm, arg, strict)
a match unless we are allowing additional qualification.
If ARG is `const int' and PARM is just `T' that's OK;
that binds `const int' to `T'. */
- if (!check_cv_quals_for_unify (strict | UNIFY_ALLOW_LESS_CV_QUAL,
+ if (!check_cv_quals_for_unify (strict_in | UNIFY_ALLOW_LESS_CV_QUAL,
arg, parm))
return 1;
/* Consider the case where ARG is `const volatile int' and
PARM is `const T'. Then, T should be `volatile int'. */
arg =
- cp_build_qualified_type (arg,
- CP_TYPE_QUALS (arg)
- & ~CP_TYPE_QUALS (parm));
- }
+ cp_build_qualified_type_real (arg,
+ cp_type_quals (arg)
+ & ~cp_type_quals (parm),
+ /*complain=*/0);
+ if (arg == error_mark_node)
+ return 1;
- /* Simple cases: Value already set, does match or doesn't. */
- if (targ != NULL_TREE && same_type_p (targ, arg))
- return 0;
- else if (targ)
- return 1;
+ /* Simple cases: Value already set, does match or doesn't. */
+ if (targ != NULL_TREE && same_type_p (targ, arg))
+ return 0;
+ else if (targ)
+ return 1;
+ }
/* Make sure that ARG is not a variable-sized array. (Note that
were talking about variable-sized arrays (like `int[n]'),
@@ -8240,6 +8702,7 @@ unify (tparms, targs, parm, arg, strict)
here. */
if (TREE_CODE (arg) == ARRAY_TYPE
&& !uses_template_parms (arg)
+ && TYPE_DOMAIN (arg)
&& (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (arg)))
!= INTEGER_CST))
return 1;
@@ -8268,7 +8731,7 @@ unify (tparms, targs, parm, arg, strict)
else if (i == 0)
return 1;
else
- my_friendly_abort (42);
+ abort ();
}
/* [temp.deduct.type] If, in the declaration of a function template
@@ -8277,27 +8740,27 @@ unify (tparms, targs, parm, arg, strict)
parameter-list and, if the corresponding template-argument is
deduced, the template-argument type shall match the type of the
template-parameter exactly, except that a template-argument
- deduced from an array bound may be of any integral type. */
- if (same_type_p (TREE_TYPE (arg), TREE_TYPE (parm)))
- /* OK */;
+ deduced from an array bound may be of any integral type.
+ The non-type parameter might use already deduced type parameters. */
+ tparm = tsubst (TREE_TYPE (parm), targs, 0, NULL_TREE);
+ if (same_type_p (TREE_TYPE (arg), tparm))
+ /* OK */;
else if ((strict & UNIFY_ALLOW_INTEGER)
- && (TREE_CODE (TREE_TYPE (parm)) == INTEGER_TYPE
- || TREE_CODE (TREE_TYPE (parm)) == BOOLEAN_TYPE))
+ && (TREE_CODE (tparm) == INTEGER_TYPE
+ || TREE_CODE (tparm) == BOOLEAN_TYPE))
/* OK */;
+ else if (uses_template_parms (tparm))
+ /* We haven't deduced the type of this parameter yet. Try again
+ later. */
+ return 0;
else
return 1;
- TREE_VEC_ELT (targs, idx) = copy_to_permanent (arg);
+ TREE_VEC_ELT (targs, idx) = arg;
return 0;
case POINTER_TYPE:
{
- int sub_strict;
-
- if (TREE_CODE (arg) == RECORD_TYPE && TYPE_PTRMEMFUNC_FLAG (arg))
- return (unify (tparms, targs, parm,
- TYPE_PTRMEMFUNC_FN_TYPE (arg), strict));
-
if (TREE_CODE (arg) != POINTER_TYPE)
return 1;
@@ -8309,29 +8772,34 @@ unify (tparms, targs, parm, arg, strict)
We pass down STRICT here rather than UNIFY_ALLOW_NONE.
This will allow for additional cv-qualification of the
- pointed-to types if appropriate. In general, this is a bit
- too generous; we are only supposed to allow qualification
- conversions and this method will allow an ARG of char** and
- a deduced ARG of const char**. However, overload
- resolution will subsequently invalidate the candidate, so
- this is probably OK. */
- sub_strict = strict;
+ pointed-to types if appropriate. */
- if (TREE_CODE (TREE_TYPE (arg)) != RECORD_TYPE
- || TYPE_PTRMEMFUNC_FLAG (TREE_TYPE (arg)))
+ if (TREE_CODE (TREE_TYPE (arg)) == RECORD_TYPE)
/* The derived-to-base conversion only persists through one
level of pointers. */
- sub_strict &= ~UNIFY_ALLOW_DERIVED;
+ strict |= (strict_in & UNIFY_ALLOW_DERIVED);
+
+ if (TREE_CODE (TREE_TYPE (parm)) == OFFSET_TYPE
+ && TREE_CODE (TREE_TYPE (arg)) == OFFSET_TYPE)
+ {
+ /* Avoid getting confused about cv-quals; don't recurse here.
+ Pointers to members should really be just OFFSET_TYPE, not
+ this two-level nonsense... */
- return unify (tparms, targs, TREE_TYPE (parm), TREE_TYPE
- (arg), sub_strict);
+ parm = TREE_TYPE (parm);
+ arg = TREE_TYPE (arg);
+ goto offset;
+ }
+
+ return unify (tparms, targs, TREE_TYPE (parm),
+ TREE_TYPE (arg), strict);
}
case REFERENCE_TYPE:
if (TREE_CODE (arg) != REFERENCE_TYPE)
return 1;
return unify (tparms, targs, TREE_TYPE (parm), TREE_TYPE (arg),
- UNIFY_ALLOW_NONE);
+ strict & UNIFY_ALLOW_MORE_CV_QUAL);
case ARRAY_TYPE:
if (TREE_CODE (arg) != ARRAY_TYPE)
@@ -8348,6 +8816,7 @@ unify (tparms, targs, parm, arg, strict)
case REAL_TYPE:
case COMPLEX_TYPE:
+ case VECTOR_TYPE:
case INTEGER_TYPE:
case BOOLEAN_TYPE:
case VOID_TYPE:
@@ -8363,14 +8832,13 @@ unify (tparms, targs, parm, arg, strict)
return 1;
if (TYPE_MAX_VALUE (parm) && TYPE_MAX_VALUE (arg)
&& unify (tparms, targs, TYPE_MAX_VALUE (parm),
- TYPE_MAX_VALUE (arg), UNIFY_ALLOW_INTEGER))
+ TYPE_MAX_VALUE (arg),
+ UNIFY_ALLOW_INTEGER | UNIFY_ALLOW_MAX_CORRECTION))
return 1;
}
- /* We use the TYPE_MAIN_VARIANT since we have already
- checked cv-qualification at the top of the
+ /* We have already checked cv-qualification at the top of the
function. */
- else if (!same_type_p (TYPE_MAIN_VARIANT (arg),
- TYPE_MAIN_VARIANT (parm)))
+ else if (!same_type_ignoring_top_level_qualifiers_p (arg, parm))
return 1;
/* As far as unification is concerned, this wins. Later checks
@@ -8394,7 +8862,7 @@ unify (tparms, targs, parm, arg, strict)
return 1;
if (TREE_VEC_LENGTH (parm) != TREE_VEC_LENGTH (arg))
return 1;
- for (i = TREE_VEC_LENGTH (parm) - 1; i >= 0; i--)
+ for (i = 0; i < TREE_VEC_LENGTH (parm); ++i)
if (unify (tparms, targs,
TREE_VEC_ELT (parm, i), TREE_VEC_ELT (arg, i),
UNIFY_ALLOW_NONE))
@@ -8404,18 +8872,25 @@ unify (tparms, targs, parm, arg, strict)
case RECORD_TYPE:
case UNION_TYPE:
- if (TYPE_PTRMEMFUNC_FLAG (parm))
- return unify (tparms, targs, TYPE_PTRMEMFUNC_FN_TYPE (parm),
- arg, strict);
-
if (TREE_CODE (arg) != TREE_CODE (parm))
return 1;
+ if (TYPE_PTRMEMFUNC_P (parm))
+ {
+ if (!TYPE_PTRMEMFUNC_P (arg))
+ return 1;
+
+ return unify (tparms, targs,
+ TYPE_PTRMEMFUNC_FN_TYPE (parm),
+ TYPE_PTRMEMFUNC_FN_TYPE (arg),
+ strict);
+ }
+
if (CLASSTYPE_TEMPLATE_INFO (parm))
{
tree t = NULL_TREE;
- if (strict & UNIFY_ALLOW_DERIVED)
+ if (strict_in & UNIFY_ALLOW_DERIVED)
{
/* First, we try to unify the PARM and ARG directly. */
t = try_class_unification (tparms, targs,
@@ -8446,14 +8921,13 @@ unify (tparms, targs, parm, arg, strict)
Then, we should unify `int' and `U'. */
t = arg;
else
- /* There's no chance of unication succeeding. */
+ /* There's no chance of unification succeeding. */
return 1;
return unify (tparms, targs, CLASSTYPE_TI_ARGS (parm),
CLASSTYPE_TI_ARGS (t), UNIFY_ALLOW_NONE);
}
- else if (!same_type_p (TYPE_MAIN_VARIANT (parm),
- TYPE_MAIN_VARIANT (arg)))
+ else if (!same_type_ignoring_top_level_qualifiers_p (parm, arg))
return 1;
return 0;
@@ -8467,9 +8941,10 @@ unify (tparms, targs, parm, arg, strict)
return 1;
return type_unification_real (tparms, targs, TYPE_ARG_TYPES (parm),
TYPE_ARG_TYPES (arg), 1,
- DEDUCE_EXACT, 0);
+ DEDUCE_EXACT, 0, -1);
case OFFSET_TYPE:
+ offset:
if (TREE_CODE (arg) != OFFSET_TYPE)
return 1;
if (unify (tparms, targs, TYPE_OFFSET_BASETYPE (parm),
@@ -8488,7 +8963,8 @@ unify (tparms, targs, parm, arg, strict)
return 1;
case MINUS_EXPR:
- if (TREE_CODE (TREE_OPERAND (parm, 1)) == INTEGER_CST)
+ if (tree_int_cst_equal (TREE_OPERAND (parm, 1), integer_one_node)
+ && (strict_in & UNIFY_ALLOW_MAX_CORRECTION))
{
/* We handle this case specially, since it comes up with
arrays. In particular, something like:
@@ -8501,10 +8977,7 @@ unify (tparms, targs, parm, arg, strict)
t1 = TREE_OPERAND (parm, 0);
t2 = TREE_OPERAND (parm, 1);
- /* Should this be a regular fold? */
- t = maybe_fold_nontype_arg (build (PLUS_EXPR,
- integer_type_node,
- arg, t2));
+ t = fold (build (PLUS_EXPR, integer_type_node, arg, t2));
return unify (tparms, targs, t1, t, strict);
}
@@ -8512,25 +8985,33 @@ unify (tparms, targs, parm, arg, strict)
default:
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (parm))))
- /* We're looking at an expression. This can happen with
- something like:
+ {
+
+ /* We're looking at an expression. This can happen with
+ something like:
- template <int I>
- void foo(S<I>, S<I + 2>);
+ template <int I>
+ void foo(S<I>, S<I + 2>);
- This is a "nondeduced context":
+ This is a "nondeduced context":
- [deduct.type]
+ [deduct.type]
- The nondeduced contexts are:
+ The nondeduced contexts are:
- --A type that is a template-id in which one or more of
- the template-arguments is an expression that references
- a template-parameter.
+ --A type that is a template-id in which one or more of
+ the template-arguments is an expression that references
+ a template-parameter.
- In these cases, we assume deduction succeeded, but don't
- actually infer any unifications. */
- return 0;
+ In these cases, we assume deduction succeeded, but don't
+ actually infer any unifications. */
+
+ if (!uses_template_parms (parm)
+ && !template_args_equal (parm, arg))
+ return 1;
+ else
+ return 0;
+ }
else
sorry ("use of `%s' in template type unification",
tree_code_name [(int) TREE_CODE (parm)]);
@@ -8553,6 +9034,14 @@ mark_decl_instantiated (result, extern_p)
set correctly by tsubst. */
TREE_PUBLIC (result) = 1;
+ /* We used to set this unconditionally; we moved that to
+ do_decl_instantiation so it wouldn't get set on members of
+ explicit class template instantiations. But we still need to set
+ it here for the 'extern template' case in order to suppress
+ implicit instantiations. */
+ if (extern_p)
+ SET_DECL_EXPLICIT_INSTANTIATION (result);
+
if (! extern_p)
{
DECL_INTERFACE_KNOWN (result) = 1;
@@ -8567,28 +9056,35 @@ mark_decl_instantiated (result, extern_p)
maybe_make_one_only (result);
}
else if (TREE_CODE (result) == FUNCTION_DECL)
- mark_inline_for_output (result);
+ defer_fn (result);
}
-/* Given two function templates PAT1 and PAT2, and explicit template
- arguments EXPLICIT_ARGS return:
+/* Given two function templates PAT1 and PAT2, return:
+ DEDUCE should be DEDUCE_EXACT or DEDUCE_ORDER.
+
1 if PAT1 is more specialized than PAT2 as described in [temp.func.order].
-1 if PAT2 is more specialized than PAT1.
- 0 if neither is more specialized. */
+ 0 if neither is more specialized.
+
+ LEN is passed through to fn_type_unification. */
int
-more_specialized (pat1, pat2, explicit_args)
- tree pat1, pat2, explicit_args;
+more_specialized (pat1, pat2, deduce, len)
+ tree pat1, pat2;
+ int deduce;
+ int len;
{
tree targs;
int winner = 0;
- targs = get_bindings_overload (pat1, DECL_RESULT (pat2), explicit_args);
+ targs = get_bindings_real (pat1, DECL_TEMPLATE_RESULT (pat2),
+ NULL_TREE, 0, deduce, len);
if (targs)
--winner;
- targs = get_bindings_overload (pat2, DECL_RESULT (pat1), explicit_args);
+ targs = get_bindings_real (pat2, DECL_TEMPLATE_RESULT (pat1),
+ NULL_TREE, 0, deduce, len);
if (targs)
++winner;
@@ -8625,15 +9121,15 @@ more_specialized_class (pat1, pat2)
DECL from the function template FN, with the explicit template
arguments EXPLICIT_ARGS. If CHECK_RETTYPE is 1, the return type must
also match. Return NULL_TREE if no satisfactory arguments could be
- found. */
-
+ found. DEDUCE and LEN are passed through to fn_type_unification. */
+
static tree
-get_bindings_real (fn, decl, explicit_args, check_rettype)
+get_bindings_real (fn, decl, explicit_args, check_rettype, deduce, len)
tree fn, decl, explicit_args;
- int check_rettype;
+ int check_rettype, deduce, len;
{
int ntparms = DECL_NTPARMS (fn);
- tree targs = make_scratch_vec (ntparms);
+ tree targs = make_tree_vec (ntparms);
tree decl_type;
tree decl_arg_types;
int i;
@@ -8667,31 +9163,20 @@ get_bindings_real (fn, decl, explicit_args, check_rettype)
return NULL_TREE;
}
- /* If FN is a static member function, adjust the type of DECL
- appropriately. */
decl_arg_types = TYPE_ARG_TYPES (decl_type);
- if (DECL_STATIC_FUNCTION_P (fn)
- && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
+ /* Never do unification on the 'this' parameter. */
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
decl_arg_types = TREE_CHAIN (decl_arg_types);
i = fn_type_unification (fn, explicit_args, targs,
decl_arg_types,
- TREE_TYPE (decl_type),
- DEDUCE_EXACT);
+ (check_rettype || DECL_CONV_FN_P (fn)
+ ? TREE_TYPE (decl_type) : NULL_TREE),
+ deduce, len);
if (i != 0)
return NULL_TREE;
- if (check_rettype)
- {
- /* Check to see that the resulting return type is also OK. */
- tree t = tsubst (TREE_TYPE (TREE_TYPE (fn)), targs,
- /*complain=*/0, NULL_TREE);
-
- if (!same_type_p (t, TREE_TYPE (TREE_TYPE (decl))))
- return NULL_TREE;
- }
-
return targs;
}
@@ -8701,21 +9186,22 @@ tree
get_bindings (fn, decl, explicit_args)
tree fn, decl, explicit_args;
{
- return get_bindings_real (fn, decl, explicit_args, 1);
+ return get_bindings_real (fn, decl, explicit_args, 1, DEDUCE_EXACT, -1);
}
-/* But for more_specialized, we only care about the parameter types. */
+/* But for resolve_overloaded_unification, we only care about the parameter
+ types. */
static tree
get_bindings_overload (fn, decl, explicit_args)
tree fn, decl, explicit_args;
{
- return get_bindings_real (fn, decl, explicit_args, 0);
+ return get_bindings_real (fn, decl, explicit_args, 0, DEDUCE_EXACT, -1);
}
/* Return the innermost template arguments that, when applied to a
template specialization whose innermost template parameters are
- TPARMS, and whose specialization arguments are ARGS, yield the
+ TPARMS, and whose specialization arguments are PARMS, yield the
ARGS.
For example, suppose we have:
@@ -8733,32 +9219,32 @@ get_class_bindings (tparms, parms, args)
tree tparms, parms, args;
{
int i, ntparms = TREE_VEC_LENGTH (tparms);
- tree vec = make_temp_vec (ntparms);
-
- args = innermost_args (args);
+ tree vec = make_tree_vec (ntparms);
- if (unify (tparms, vec, parms, args, UNIFY_ALLOW_NONE))
+ if (unify (tparms, vec, parms, INNERMOST_TEMPLATE_ARGS (args),
+ UNIFY_ALLOW_NONE))
return NULL_TREE;
for (i = 0; i < ntparms; ++i)
if (! TREE_VEC_ELT (vec, i))
return NULL_TREE;
+ if (verify_class_unification (vec, parms, args))
+ return NULL_TREE;
+
return vec;
}
/* In INSTANTIATIONS is a list of <INSTANTIATION, TEMPLATE> pairs.
Pick the most specialized template, and return the corresponding
instantiation, or if there is no corresponding instantiation, the
- template itself. EXPLICIT_ARGS is any template arguments explicity
- mentioned in a template-id. If there is no most specialized
- tempalte, error_mark_node is returned. If there are no templates
- at all, NULL_TREE is returned. */
+ template itself. If there is no most specialized template,
+ error_mark_node is returned. If there are no templates at all,
+ NULL_TREE is returned. */
tree
-most_specialized_instantiation (instantiations, explicit_args)
+most_specialized_instantiation (instantiations)
tree instantiations;
- tree explicit_args;
{
tree fn, champ;
int fate;
@@ -8769,8 +9255,8 @@ most_specialized_instantiation (instantiations, explicit_args)
champ = instantiations;
for (fn = TREE_CHAIN (instantiations); fn; fn = TREE_CHAIN (fn))
{
- fate = more_specialized (TREE_VALUE (champ),
- TREE_VALUE (fn), explicit_args);
+ fate = more_specialized (TREE_VALUE (champ), TREE_VALUE (fn),
+ DEDUCE_EXACT, -1);
if (fate == 1)
;
else
@@ -8787,8 +9273,8 @@ most_specialized_instantiation (instantiations, explicit_args)
for (fn = instantiations; fn && fn != champ; fn = TREE_CHAIN (fn))
{
- fate = more_specialized (TREE_VALUE (champ),
- TREE_VALUE (fn), explicit_args);
+ fate = more_specialized (TREE_VALUE (champ), TREE_VALUE (fn),
+ DEDUCE_EXACT, -1);
if (fate != 1)
return error_mark_node;
}
@@ -8813,15 +9299,16 @@ most_specialized (fns, decl, explicit_args)
args = get_bindings (candidate, decl, explicit_args);
if (args)
- candidates = scratch_tree_cons (NULL_TREE, candidate,
- candidates);
+ candidates = tree_cons (NULL_TREE, candidate, candidates);
}
- return most_specialized_instantiation (candidates, explicit_args);
+ return most_specialized_instantiation (candidates);
}
/* If DECL is a specialization of some template, return the most
- general such template. For example, given:
+ general such template. Otherwise, returns NULL_TREE.
+
+ For example, given:
template <class T> struct S { template <class U> void f(U); };
@@ -8834,12 +9321,41 @@ most_specialized (fns, decl, explicit_args)
if TMPL is `template <class U> void S<int*>::f(U)' this will return
`template <class T> template <class U> S<T*>::f(U)'. */
-static tree
+tree
most_general_template (decl)
tree decl;
{
+ /* If DECL is a FUNCTION_DECL, find the TEMPLATE_DECL of which it is
+ an immediate specialization. */
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ {
+ if (DECL_TEMPLATE_INFO (decl)) {
+ decl = DECL_TI_TEMPLATE (decl);
+
+ /* The DECL_TI_TEMPLATE can be an IDENTIFIER_NODE for a
+ template friend. */
+ if (TREE_CODE (decl) != TEMPLATE_DECL)
+ return NULL_TREE;
+ } else
+ return NULL_TREE;
+ }
+
+ /* Look for more and more general templates. */
while (DECL_TEMPLATE_INFO (decl))
- decl = DECL_TI_TEMPLATE (decl);
+ {
+ /* The DECL_TI_TEMPLATE can be a LOOKUP_EXPR or IDENTIFIER_NODE
+ in some cases. (See cp-tree.h for details.) */
+ if (TREE_CODE (DECL_TI_TEMPLATE (decl)) != TEMPLATE_DECL)
+ break;
+
+ /* Stop if we run into an explicitly specialized class template. */
+ if (!DECL_NAMESPACE_SCOPE_P (decl)
+ && DECL_CONTEXT (decl)
+ && CLASSTYPE_TEMPLATE_SPECIALIZATION (DECL_CONTEXT (decl)))
+ break;
+
+ decl = DECL_TI_TEMPLATE (decl);
+ }
return decl;
}
@@ -8865,7 +9381,7 @@ most_specialized_class (tmpl, args)
= get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t), args);
if (spec_args)
{
- list = decl_tree_cons (TREE_PURPOSE (t), TREE_VALUE (t), list);
+ list = tree_cons (TREE_PURPOSE (t), TREE_VALUE (t), list);
TREE_TYPE (list) = TREE_TYPE (t);
}
}
@@ -8909,13 +9425,17 @@ void
do_decl_instantiation (declspecs, declarator, storage)
tree declspecs, declarator, storage;
{
- tree decl = grokdeclarator (declarator, declspecs, NORMAL, 0, NULL_TREE);
+ tree decl = grokdeclarator (declarator, declspecs, NORMAL, 0, NULL);
tree result = NULL_TREE;
int extern_p = 0;
- if (! DECL_LANG_SPECIFIC (decl))
+ if (!decl)
+ /* An error occurred, for which grokdeclarator has already issued
+ an appropriate message. */
+ return;
+ else if (! DECL_LANG_SPECIFIC (decl))
{
- cp_error ("explicit instantiation of non-template `%#D'", decl);
+ error ("explicit instantiation of non-template `%#D'", decl);
return;
}
else if (TREE_CODE (decl) == VAR_DECL)
@@ -8931,13 +9451,13 @@ do_decl_instantiation (declspecs, declarator, storage)
result = lookup_field (DECL_CONTEXT (decl), DECL_NAME (decl), 0, 0);
if (result && TREE_CODE (result) != VAR_DECL)
{
- cp_error ("no matching template for `%D' found", result);
+ error ("no matching template for `%D' found", result);
return;
}
}
else if (TREE_CODE (decl) != FUNCTION_DECL)
{
- cp_error ("explicit instantiation of `%#D'", decl);
+ error ("explicit instantiation of `%#D'", decl);
return;
}
else
@@ -8954,7 +9474,7 @@ do_decl_instantiation (declspecs, declarator, storage)
No program shall both explicitly instantiate and explicitly
specialize a template. */
- cp_pedwarn ("explicit instantiation of `%#D' after", result);
+ pedwarn ("explicit instantiation of `%#D' after", result);
cp_pedwarn_at ("explicit specialization here", result);
return;
}
@@ -8965,11 +9485,12 @@ do_decl_instantiation (declspecs, declarator, storage)
No program shall explicitly instantiate any template more
than once.
- We check DECL_INTERFACE_KNOWN so as not to complain when the
- first instantiation was `extern' and the second is not, and
- EXTERN_P for the opposite case. */
+ We check DECL_INTERFACE_KNOWN so as not to complain when the first
+ instantiation was `extern' and the second is not, and EXTERN_P for
+ the opposite case. If -frepo, chances are we already got marked
+ as an explicit instantiation because of the repo file. */
if (DECL_INTERFACE_KNOWN (result) && !extern_p && !flag_use_repository)
- cp_pedwarn ("duplicate explicit instantiation of `%#D'", result);
+ pedwarn ("duplicate explicit instantiation of `%#D'", result);
/* If we've already instantiated the template, just return now. */
if (DECL_INTERFACE_KNOWN (result))
@@ -8977,12 +9498,12 @@ do_decl_instantiation (declspecs, declarator, storage)
}
else if (!DECL_IMPLICIT_INSTANTIATION (result))
{
- cp_error ("no matching template for `%D' found", result);
+ error ("no matching template for `%D' found", result);
return;
}
else if (!DECL_TEMPLATE_INFO (result))
{
- cp_pedwarn ("explicit instantiation of non-template `%#D'", result);
+ pedwarn ("explicit instantiation of non-template `%#D'", result);
return;
}
@@ -8994,18 +9515,18 @@ do_decl_instantiation (declspecs, declarator, storage)
else if (storage == ridpointers[(int) RID_EXTERN])
{
if (pedantic)
- cp_pedwarn ("ANSI C++ forbids the use of `extern' on explicit instantiations");
+ pedwarn ("ISO C++ forbids the use of `extern' on explicit instantiations");
extern_p = 1;
}
else
- cp_error ("storage class `%D' applied to template instantiation",
+ error ("storage class `%D' applied to template instantiation",
storage);
SET_DECL_EXPLICIT_INSTANTIATION (result);
mark_decl_instantiated (result, extern_p);
repo_template_instantiated (result, extern_p);
if (! extern_p)
- instantiate_decl (result);
+ instantiate_decl (result, /*defer_ok=*/1);
}
void
@@ -9016,7 +9537,6 @@ mark_class_instantiated (t, extern_p)
SET_CLASSTYPE_EXPLICIT_INSTANTIATION (t);
SET_CLASSTYPE_INTERFACE_KNOWN (t);
CLASSTYPE_INTERFACE_ONLY (t) = extern_p;
- CLASSTYPE_VTABLE_NEEDS_WRITING (t) = ! extern_p;
TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (t)) = extern_p;
if (! extern_p)
{
@@ -9025,9 +9545,15 @@ mark_class_instantiated (t, extern_p)
}
}
+/* Perform an explicit instantiation of template class T. STORAGE, if
+ non-null, is the RID for extern, inline or static. COMPLAIN is
+ non-zero if this is called from the parser, zero if called recursively,
+ since the standard is unclear (as detailed below). */
+
void
-do_type_instantiation (t, storage)
+do_type_instantiation (t, storage, complain)
tree t, storage;
+ int complain;
{
int extern_p = 0;
int nomem_p = 0;
@@ -9038,7 +9564,7 @@ do_type_instantiation (t, storage)
if (! CLASS_TYPE_P (t) || ! CLASSTYPE_TEMPLATE_INFO (t))
{
- cp_error ("explicit instantiation of non-template type `%T'", t);
+ error ("explicit instantiation of non-template type `%T'", t);
return;
}
@@ -9049,17 +9575,18 @@ do_type_instantiation (t, storage)
if (flag_external_templates)
return;
- if (TYPE_SIZE (t) == NULL_TREE)
+ if (!COMPLETE_TYPE_P (t))
{
- cp_error ("explicit instantiation of `%#T' before definition of template",
- t);
+ if (complain)
+ error ("explicit instantiation of `%#T' before definition of template",
+ t);
return;
}
if (storage != NULL_TREE)
{
if (pedantic)
- cp_pedwarn("ANSI C++ forbids the use of `%s' on explicit instantiations",
+ pedwarn("ISO C++ forbids the use of `%s' on explicit instantiations",
IDENTIFIER_POINTER (storage));
if (storage == ridpointers[(int) RID_INLINE])
@@ -9070,7 +9597,7 @@ do_type_instantiation (t, storage)
static_p = 1;
else
{
- cp_error ("storage class `%D' applied to template instantiation",
+ error ("storage class `%D' applied to template instantiation",
storage);
extern_p = 0;
}
@@ -9082,8 +9609,11 @@ do_type_instantiation (t, storage)
No program shall both explicitly instantiate and explicitly
specialize a template. */
- cp_error ("explicit instantiation of `%#T' after", t);
- cp_error_at ("explicit specialization here", t);
+ if (complain)
+ {
+ error ("explicit instantiation of `%#T' after", t);
+ cp_error_at ("explicit specialization here", t);
+ }
return;
}
else if (CLASSTYPE_EXPLICIT_INSTANTIATION (t))
@@ -9093,11 +9623,13 @@ do_type_instantiation (t, storage)
No program shall explicitly instantiate any template more
than once.
- If CLASSTYPE_INTERFACE_ONLY, then the first explicit
- instantiation was `extern', and if EXTERN_P then the second
- is. Both cases are OK. */
- if (!CLASSTYPE_INTERFACE_ONLY (t) && !extern_p && !flag_use_repository)
- cp_pedwarn ("duplicate explicit instantiation of `%#T'", t);
+ If CLASSTYPE_INTERFACE_ONLY, then the first explicit instantiation
+ was `extern'. If EXTERN_P then the second is. If -frepo, chances
+ are we already got marked as an explicit instantiation because of the
+ repo file. All these cases are OK. */
+ if (!CLASSTYPE_INTERFACE_ONLY (t) && !extern_p && !flag_use_repository
+ && complain)
+ pedwarn ("duplicate explicit instantiation of `%#T'", t);
/* If we've already instantiated the template, just return now. */
if (!CLASSTYPE_INTERFACE_ONLY (t))
@@ -9126,7 +9658,7 @@ do_type_instantiation (t, storage)
Of course, we can't instantiate member template classes, since
we don't have any arguments for them. Note that the standard
- is unclear on whether the instatiation of the members are
+ is unclear on whether the instantiation of the members are
*explicit* instantiations or not. We choose to be generous,
and not set DECL_EXPLICIT_INSTANTIATION. Therefore, we allow
the explicit instantiation of a class where some of the members
@@ -9140,7 +9672,7 @@ do_type_instantiation (t, storage)
mark_decl_instantiated (tmp, extern_p);
repo_template_instantiated (tmp, extern_p);
if (! extern_p)
- instantiate_decl (tmp);
+ instantiate_decl (tmp, /*defer_ok=*/1);
}
for (tmp = TYPE_FIELDS (t); tmp; tmp = TREE_CHAIN (tmp))
@@ -9149,13 +9681,13 @@ do_type_instantiation (t, storage)
mark_decl_instantiated (tmp, extern_p);
repo_template_instantiated (tmp, extern_p);
if (! extern_p)
- instantiate_decl (tmp);
+ instantiate_decl (tmp, /*defer_ok=*/1);
}
for (tmp = CLASSTYPE_TAGS (t); tmp; tmp = TREE_CHAIN (tmp))
if (IS_AGGR_TYPE (TREE_VALUE (tmp))
&& !uses_template_parms (CLASSTYPE_TI_ARGS (TREE_VALUE (tmp))))
- do_type_instantiation (TYPE_MAIN_DECL (TREE_VALUE (tmp)), storage);
+ do_type_instantiation (TYPE_MAIN_DECL (TREE_VALUE (tmp)), storage, 0);
}
}
@@ -9184,10 +9716,13 @@ regenerate_decl_from_template (decl, tmpl)
tree decl;
tree tmpl;
{
+ /* The most general version of TMPL. */
+ tree gen_tmpl;
+ /* The arguments used to instantiate DECL, from the most general
+ template. */
tree args;
tree code_pattern;
tree new_decl;
- tree gen_tmpl;
int unregistered;
args = DECL_TI_ARGS (decl);
@@ -9241,8 +9776,9 @@ regenerate_decl_from_template (decl, tmpl)
functions, this is not so. See tsubst_friend_function for
details. */
DECL_TI_TEMPLATE (new_decl) = DECL_TI_TEMPLATE (decl);
- DECL_ASSEMBLER_NAME (new_decl) = DECL_ASSEMBLER_NAME (decl);
- DECL_RTL (new_decl) = DECL_RTL (decl);
+ COPY_DECL_ASSEMBLER_NAME (decl, new_decl);
+ COPY_DECL_RTL (decl, new_decl);
+ DECL_USE_TEMPLATE (new_decl) = DECL_USE_TEMPLATE (decl);
/* Call duplicate decls to merge the old and new declarations. */
duplicate_decls (new_decl, decl);
@@ -9251,11 +9787,14 @@ regenerate_decl_from_template (decl, tmpl)
register_specialization (decl, gen_tmpl, args);
}
-/* Produce the definition of D, a _DECL generated from a template. */
+/* Produce the definition of D, a _DECL generated from a template. If
+ DEFER_OK is non-zero, then we don't have to actually do the
+ instantiation now; we just have to do it sometime. */
tree
-instantiate_decl (d)
+instantiate_decl (d, defer_ok)
tree d;
+ int defer_ok;
{
tree tmpl = DECL_TI_TEMPLATE (d);
tree args = DECL_TI_ARGS (d);
@@ -9263,19 +9802,24 @@ instantiate_decl (d)
tree code_pattern;
tree spec;
tree gen_tmpl;
- int nested = in_function_p ();
int pattern_defined;
int line = lineno;
- char *file = input_filename;
+ int need_push;
+ const char *file = input_filename;
/* This function should only be used to instantiate templates for
functions and static member variables. */
my_friendly_assert (TREE_CODE (d) == FUNCTION_DECL
|| TREE_CODE (d) == VAR_DECL, 0);
+ /* Don't instantiate cloned functions. Instead, instantiate the
+ functions they cloned. */
+ if (TREE_CODE (d) == FUNCTION_DECL && DECL_CLONED_FUNCTION_P (d))
+ d = DECL_CLONED_FUNCTION (d);
+
if (DECL_TEMPLATE_INSTANTIATED (d))
/* D has already been instantiated. It might seem reasonable to
- check whether or not D is an explict instantiation, and, if so,
+ check whether or not D is an explicit instantiation, and, if so,
stop here. But when an explicit instantiation is deferred
until the end of the compilation, DECL_EXPLICIT_INSTANTIATION
is set, even though we still need to do the instantiation. */
@@ -9295,6 +9839,8 @@ instantiate_decl (d)
if (! push_tinst_level (d))
return d;
+ timevar_push (TV_PARSE);
+
/* Set TD to the template whose DECL_TEMPLATE_RESULT is the pattern
for the instantiation. This is not always the most general
template. Consider, for example:
@@ -9306,32 +9852,30 @@ instantiate_decl (d)
and an instantiation of S<double>::f<int>. We want TD to be the
specialization S<T>::f<int>, not the more general S<T>::f<U>. */
td = tmpl;
- for (td = tmpl;
- /* An instantiation cannot have a definition, so we need a
- more general template. */
- DECL_TEMPLATE_INSTANTIATION (td)
- /* We must also deal with friend templates. Given:
-
- template <class T> struct S {
- template <class U> friend void f() {};
- };
-
- S<int>::f<U> say, is not an instantiation of S<T>::f<U>,
- so far as the language is concerned, but that's still
- where we get the pattern for the instantiation from. On
- ther hand, if the definition comes outside the class, say:
-
- template <class T> struct S {
- template <class U> friend void f();
- };
- template <class U> friend void f() {}
-
- we don't need to look any further. That's what the check for
- DECL_INITIAL is for. */
- || (TREE_CODE (d) == FUNCTION_DECL
- && DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (td)
- && !DECL_INITIAL (DECL_TEMPLATE_RESULT (td)));
- )
+ while (/* An instantiation cannot have a definition, so we need a
+ more general template. */
+ DECL_TEMPLATE_INSTANTIATION (td)
+ /* We must also deal with friend templates. Given:
+
+ template <class T> struct S {
+ template <class U> friend void f() {};
+ };
+
+ S<int>::f<U> say, is not an instantiation of S<T>::f<U>,
+ so far as the language is concerned, but that's still
+ where we get the pattern for the instantiation from. On
+ other hand, if the definition comes outside the class, say:
+
+ template <class T> struct S {
+ template <class U> friend void f();
+ };
+ template <class U> friend void f() {}
+
+ we don't need to look any further. That's what the check for
+ DECL_INITIAL is for. */
+ || (TREE_CODE (d) == FUNCTION_DECL
+ && DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (td)
+ && !DECL_INITIAL (DECL_TEMPLATE_RESULT (td))))
{
/* The present template, TD, should not be a definition. If it
were a definition, we should be using it! Note that we
@@ -9349,17 +9893,34 @@ instantiate_decl (d)
code_pattern = DECL_TEMPLATE_RESULT (td);
if (TREE_CODE (d) == FUNCTION_DECL)
- pattern_defined = (DECL_INITIAL (code_pattern) != NULL_TREE);
+ pattern_defined = (DECL_SAVED_TREE (code_pattern) != NULL_TREE);
else
pattern_defined = ! DECL_IN_AGGR_P (code_pattern);
- push_to_top_level ();
lineno = DECL_SOURCE_LINE (d);
input_filename = DECL_SOURCE_FILE (d);
if (pattern_defined)
{
- repo_template_used (d);
+ /* Let the repository code that this template definition is
+ available.
+
+ The repository doesn't need to know about cloned functions
+ because they never actually show up in the object file. It
+ does need to know about the clones; those are the symbols
+ that the linker will be emitting error messages about. */
+ if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (d)
+ || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (d))
+ {
+ tree t;
+
+ for (t = TREE_CHAIN (d);
+ t && DECL_CLONED_FUNCTION_P (t);
+ t = TREE_CHAIN (t))
+ repo_template_used (t);
+ }
+ else
+ repo_template_used (d);
if (flag_external_templates && ! DECL_INTERFACE_KNOWN (d))
{
@@ -9381,25 +9942,21 @@ instantiate_decl (d)
import_export_decl (d);
}
+ if (TREE_CODE (d) == VAR_DECL && DECL_INITIALIZED_IN_CLASS_P (d)
+ && DECL_INITIAL (d) == NULL_TREE)
+ /* We should have set up DECL_INITIAL in instantiate_class_template. */
+ abort ();
/* Reject all external templates except inline functions. */
- if (DECL_INTERFACE_KNOWN (d)
- && ! DECL_NOT_REALLY_EXTERN (d)
- && ! (TREE_CODE (d) == FUNCTION_DECL && DECL_INLINE (d)))
+ else if (DECL_INTERFACE_KNOWN (d)
+ && ! DECL_NOT_REALLY_EXTERN (d)
+ && ! (TREE_CODE (d) == FUNCTION_DECL
+ && DECL_INLINE (d)))
goto out;
-
- if (TREE_CODE (d) == VAR_DECL
- && TREE_READONLY (d)
- && DECL_INITIAL (d) == NULL_TREE
- && DECL_INITIAL (code_pattern) != NULL_TREE)
- /* We need to set up DECL_INITIAL regardless of pattern_defined if
- the variable is a static const initialized in the class body. */;
- else if (! pattern_defined
- || (! (TREE_CODE (d) == FUNCTION_DECL && DECL_INLINE (d) && nested)
- && ! at_eof))
- {
- /* Defer all templates except inline functions used in another
- function. We restore the source position here because it's used
- by add_pending_template. */
+ /* Defer all other templates, unless we have been explicitly
+ forbidden from doing so. We restore the source position here
+ because it's used by add_pending_template. */
+ else if (! pattern_defined || defer_ok)
+ {
lineno = line;
input_filename = file;
@@ -9412,13 +9969,17 @@ instantiate_decl (d)
member function or static data member of a class template
shall be present in every translation unit in which it is
explicitly instantiated. */
- cp_error ("explicit instantiation of `%D' but no definition available",
- d);
+ pedwarn
+ ("explicit instantiation of `%D' but no definition available", d);
add_pending_template (d);
goto out;
}
+ need_push = !global_bindings_p ();
+ if (need_push)
+ push_to_top_level ();
+
/* We're now committed to instantiating this template. Mark it as
instantiated so that recursive calls to instantiate_decl do not
try to instantiate it again. */
@@ -9443,51 +10004,51 @@ instantiate_decl (d)
DECL_EXTERNAL (d) = 1;
DECL_NOT_REALLY_EXTERN (d) = 1;
}
- cp_finish_decl (d, DECL_INITIAL (d), NULL_TREE, 0, 0);
+ cp_finish_decl (d, DECL_INITIAL (d), NULL_TREE, 0);
}
else if (TREE_CODE (d) == FUNCTION_DECL)
{
- tree t = DECL_SAVED_TREE (code_pattern);
+ htab_t saved_local_specializations;
- start_function (NULL_TREE, d, NULL_TREE, 1);
- store_parm_decls ();
+ /* Save away the current list, in case we are instantiating one
+ template from within the body of another. */
+ saved_local_specializations = local_specializations;
- if (t && TREE_CODE (t) == RETURN_INIT)
- {
- store_return_init
- (TREE_OPERAND (t, 0),
- tsubst_expr (TREE_OPERAND (t, 1), args, /*complain=*/1, tmpl));
- t = TREE_CHAIN (t);
- }
+ /* Set up the list of local specializations. */
+ local_specializations = htab_create (37,
+ htab_hash_pointer,
+ htab_eq_pointer,
+ NULL);
- if (t && TREE_CODE (t) == CTOR_INITIALIZER)
- {
- current_member_init_list
- = tsubst_expr_values (TREE_OPERAND (t, 0), args);
- current_base_init_list
- = tsubst_expr_values (TREE_OPERAND (t, 1), args);
- t = TREE_CHAIN (t);
- }
+ /* Set up context. */
+ start_function (NULL_TREE, d, NULL_TREE, SF_PRE_PARSED);
- setup_vtbl_ptr ();
- /* Always keep the BLOCK node associated with the outermost
- pair of curly braces of a function. These are needed
- for correct operation of dwarfout.c. */
- keep_next_level ();
+ /* Substitute into the body of the function. */
+ tsubst_expr (DECL_SAVED_TREE (code_pattern), args,
+ /*complain=*/1, tmpl);
- my_friendly_assert (TREE_CODE (t) == COMPOUND_STMT, 42);
- tsubst_expr (t, args, /*complain=*/1, tmpl);
+ /* We don't need the local specializations any more. */
+ htab_delete (local_specializations);
+ local_specializations = saved_local_specializations;
- finish_function (lineno, 0, nested);
+ /* Finish the function. */
+ expand_body (finish_function (0));
}
+ /* We're not deferring instantiation any more. */
+ TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (d)) = 0;
+
+ if (need_push)
+ pop_from_top_level ();
+
out:
lineno = line;
input_filename = file;
- pop_from_top_level ();
pop_tinst_level ();
+ timevar_pop (TV_PARSE);
+
return d;
}
@@ -9498,6 +10059,7 @@ int
instantiate_pending_templates ()
{
tree *t;
+ tree last = NULL_TREE;
int instantiated_something = 0;
int reconsider;
@@ -9508,17 +10070,15 @@ instantiate_pending_templates ()
t = &pending_templates;
while (*t)
{
- tree srcloc = TREE_PURPOSE (*t);
tree instantiation = TREE_VALUE (*t);
- input_filename = SRCLOC_FILE (srcloc);
- lineno = SRCLOC_LINE (srcloc);
+ reopen_tinst_level (TREE_PURPOSE (*t));
- if (TREE_CODE_CLASS (TREE_CODE (instantiation)) == 't')
+ if (TYPE_P (instantiation))
{
tree fn;
- if (!TYPE_SIZE (instantiation))
+ if (!COMPLETE_TYPE_P (instantiation))
{
instantiate_class_template (instantiation);
if (CLASSTYPE_TEMPLATE_INSTANTIATION (instantiation))
@@ -9526,27 +10086,31 @@ instantiate_pending_templates ()
fn;
fn = TREE_CHAIN (fn))
if (! DECL_ARTIFICIAL (fn))
- instantiate_decl (fn);
- if (TYPE_SIZE (instantiation))
+ instantiate_decl (fn, /*defer_ok=*/0);
+ if (COMPLETE_TYPE_P (instantiation))
{
instantiated_something = 1;
reconsider = 1;
}
}
- if (TYPE_SIZE (instantiation))
+ if (COMPLETE_TYPE_P (instantiation))
/* If INSTANTIATION has been instantiated, then we don't
need to consider it again in the future. */
*t = TREE_CHAIN (*t);
- else
- t = &TREE_CHAIN (*t);
+ else
+ {
+ last = *t;
+ t = &TREE_CHAIN (*t);
+ }
}
else
{
- if (DECL_TEMPLATE_INSTANTIATION (instantiation)
+ if (!DECL_TEMPLATE_SPECIALIZATION (instantiation)
&& !DECL_TEMPLATE_INSTANTIATED (instantiation))
{
- instantiation = instantiate_decl (instantiation);
+ instantiation = instantiate_decl (instantiation,
+ /*defer_ok=*/0);
if (DECL_TEMPLATE_INSTANTIATED (instantiation))
{
instantiated_something = 1;
@@ -9554,58 +10118,34 @@ instantiate_pending_templates ()
}
}
- if (!DECL_TEMPLATE_INSTANTIATION (instantiation)
+ if (DECL_TEMPLATE_SPECIALIZATION (instantiation)
|| DECL_TEMPLATE_INSTANTIATED (instantiation))
/* If INSTANTIATION has been instantiated, then we don't
need to consider it again in the future. */
*t = TREE_CHAIN (*t);
- else
- t = &TREE_CHAIN (*t);
- }
- }
- template_tail = t;
-
- /* Go through the things that are template instantiations if we are
- using guiding declarations. */
- t = &maybe_templates;
- while (*t)
- {
- tree template;
- tree fn;
- tree args;
-
- fn = TREE_VALUE (*t);
-
- if (DECL_INITIAL (fn))
- /* If the FN is already defined, then it was either already
- instantiated or, even though guiding declarations were
- allowed, a non-template definition was provided. */
- ;
- else
- {
- template = TREE_PURPOSE (*t);
- args = get_bindings (template, fn, NULL_TREE);
- fn = instantiate_template (template, args);
- instantiate_decl (fn);
- reconsider = 1;
+ else
+ {
+ last = *t;
+ t = &TREE_CHAIN (*t);
+ }
}
-
- /* Remove this entry from the chain. */
- *t = TREE_CHAIN (*t);
+ tinst_depth = 0;
+ current_tinst_level = NULL_TREE;
}
- maybe_template_tail = t;
+ last_pending_template = last;
}
while (reconsider);
return instantiated_something;
}
-/* Substitute ARGVEC into T, which is a TREE_LIST. In particular, it
- is an initializer list: the TREE_PURPOSEs are DECLs, and the
- TREE_VALUEs are initializer values. Used by instantiate_decl. */
+/* Substitute ARGVEC into T, which is a list of initializers for
+ either base class or a non-static data member. The TREE_PURPOSEs
+ are DECLs, and the TREE_VALUEs are the initializer values. Used by
+ instantiate_decl. */
static tree
-tsubst_expr_values (t, argvec)
+tsubst_initializer_list (t, argvec)
tree t, argvec;
{
tree first = NULL_TREE;
@@ -9613,69 +10153,27 @@ tsubst_expr_values (t, argvec)
for (; t; t = TREE_CHAIN (t))
{
- tree pur = tsubst_copy (TREE_PURPOSE (t), argvec,
- /*complain=*/1, NULL_TREE);
- tree val = tsubst_expr (TREE_VALUE (t), argvec, /*complain=*/1,
- NULL_TREE);
- *p = build_tree_list (pur, val);
- p = &TREE_CHAIN (*p);
- }
- return first;
-}
+ tree decl;
+ tree init;
+ tree val;
-tree last_tree;
+ decl = tsubst_copy (TREE_PURPOSE (t), argvec, /*complain=*/1,
+ NULL_TREE);
+ init = tsubst_expr (TREE_VALUE (t), argvec, /*complain=*/1,
+ NULL_TREE);
-void
-add_tree (t)
- tree t;
-{
- last_tree = TREE_CHAIN (last_tree) = t;
-}
-
-
-void
-begin_tree ()
-{
- saved_trees = tree_cons (NULL_TREE, last_tree, saved_trees);
- last_tree = NULL_TREE;
-}
-
-
-void
-end_tree ()
-{
- my_friendly_assert (saved_trees != NULL_TREE, 0);
-
- last_tree = TREE_VALUE (saved_trees);
- saved_trees = TREE_CHAIN (saved_trees);
-}
-
-/* D is an undefined function declaration in the presence of templates with
- the same name, listed in FNS. If one of them can produce D as an
- instantiation, remember this so we can instantiate it at EOF if D has
- not been defined by that time. */
-
-void
-add_maybe_template (d, fns)
- tree d, fns;
-{
- tree t;
-
- if (DECL_MAYBE_TEMPLATE (d))
- return;
+ if (!init)
+ ;
+ else if (TREE_CODE (init) == TREE_LIST)
+ for (val = init; val; val = TREE_CHAIN (val))
+ TREE_VALUE (val) = convert_from_reference (TREE_VALUE (val));
+ else
+ init = convert_from_reference (init);
- t = most_specialized (fns, d, NULL_TREE);
- if (! t)
- return;
- if (t == error_mark_node)
- {
- cp_error ("ambiguous template instantiation for `%D'", d);
- return;
+ *p = build_tree_list (decl, init);
+ p = &TREE_CHAIN (*p);
}
-
- *maybe_template_tail = perm_tree_cons (t, d, NULL_TREE);
- maybe_template_tail = &TREE_CHAIN (*maybe_template_tail);
- DECL_MAYBE_TEMPLATE (d) = 1;
+ return first;
}
/* Set CURRENT_ACCESS_SPECIFIER based on the protection of DECL. */
@@ -9707,8 +10205,7 @@ tsubst_enum (tag, newtag, args)
for (e = TYPE_VALUES (tag); e; e = TREE_CHAIN (e))
{
tree value;
- tree elt;
-
+
/* Note that in a template enum, the TREE_VALUE is the
CONST_DECL, not the corresponding INTEGER_CST. */
value = tsubst_expr (DECL_INITIAL (TREE_VALUE (e)),
@@ -9719,56 +10216,37 @@ tsubst_enum (tag, newtag, args)
set_current_access_from_decl (TREE_VALUE (e));
/* Actually build the enumerator itself. */
- elt = build_enumerator (TREE_PURPOSE (e), value, newtag);
-
- /* We save the enumerators we have built so far in the
- TYPE_VALUES so that if the enumeration constants for
- subsequent enumerators involve those for previous ones,
- tsubst_copy will be able to find them. */
- TREE_CHAIN (elt) = TYPE_VALUES (newtag);
- TYPE_VALUES (newtag) = elt;
+ build_enumerator (TREE_PURPOSE (e), value, newtag);
}
finish_enum (newtag);
+ DECL_SOURCE_LINE (TYPE_NAME (newtag)) = DECL_SOURCE_LINE (TYPE_NAME (tag));
+ DECL_SOURCE_FILE (TYPE_NAME (newtag)) = DECL_SOURCE_FILE (TYPE_NAME (tag));
}
-/* Set the DECL_ASSEMBLER_NAME for DECL, which is a FUNCTION_DECL that
- is either an instantiation or specialization of a template
- function. */
+/* DECL is a FUNCTION_DECL that is a template specialization. Return
+ its type -- but without substituting the innermost set of template
+ arguments. So, innermost set of template parameters will appear in
+ the type. If CONTEXTP is non-NULL, then the partially substituted
+ DECL_CONTEXT (if any) will also be filled in. Similarly, TPARMSP
+ will be filled in with the substituted template parameters, if it
+ is non-NULL. */
-static void
-set_mangled_name_for_template_decl (decl)
+tree
+get_mostly_instantiated_function_type (decl, contextp, tparmsp)
tree decl;
+ tree *contextp;
+ tree *tparmsp;
{
- tree saved_namespace;
tree context = NULL_TREE;
tree fn_type;
- tree ret_type;
- tree parm_types;
- tree tparms;
- tree targs;
tree tmpl;
+ tree targs;
+ tree tparms;
int parm_depth;
- my_friendly_assert (TREE_CODE (decl) == FUNCTION_DECL, 0);
- my_friendly_assert (DECL_TEMPLATE_INFO (decl) != NULL_TREE, 0);
-
- /* The names of template functions must be mangled so as to indicate
- what template is being specialized with what template arguments.
- For example, each of the following three functions must get
- different mangled names:
-
- void f(int);
- template <> void f<7>(int);
- template <> void f<8>(int); */
-
- targs = DECL_TI_ARGS (decl);
- if (uses_template_parms (targs))
- /* This DECL is for a partial instantiation. There's no need to
- mangle the name of such an entity. */
- return;
-
tmpl = most_general_template (DECL_TI_TEMPLATE (decl));
+ targs = DECL_TI_ARGS (decl);
tparms = DECL_TEMPLATE_PARMS (tmpl);
parm_depth = TMPL_PARMS_DEPTH (tparms);
@@ -9776,27 +10254,9 @@ set_mangled_name_for_template_decl (decl)
of parameters. */
my_friendly_assert (parm_depth == TMPL_ARGS_DEPTH (targs), 0);
- /* We now compute the PARMS and RET_TYPE to give to
- build_decl_overload_real. The PARMS and RET_TYPE are the
- parameter and return types of the template, after all but the
- innermost template arguments have been substituted, not the
- parameter and return types of the function DECL. For example,
- given:
-
- template <class T> T f(T);
-
- both PARMS and RET_TYPE should be `T' even if DECL is `int f(int)'.
- A more subtle example is:
-
- template <class T> struct S { template <class U> void f(T, U); }
-
- Here, if DECL is `void S<int>::f(int, double)', PARMS should be
- {int, U}. Thus, the args that we want to subsitute into the
- return and parameter type for the function are those in TARGS,
- with the innermost level omitted. */
fn_type = TREE_TYPE (tmpl);
if (DECL_STATIC_FUNCTION_P (decl))
- context = DECL_CLASS_CONTEXT (decl);
+ context = DECL_CONTEXT (decl);
if (parm_depth == 1)
/* No substitution is necessary. */
@@ -9807,14 +10267,14 @@ set_mangled_name_for_template_decl (decl)
tree partial_args;
/* Replace the innermost level of the TARGS with NULL_TREEs to
- let tsubst know not to subsitute for those parameters. */
- partial_args = make_temp_vec (TREE_VEC_LENGTH (targs));
+ let tsubst know not to substitute for those parameters. */
+ partial_args = make_tree_vec (TREE_VEC_LENGTH (targs));
for (i = 1; i < TMPL_ARGS_DEPTH (targs); ++i)
SET_TMPL_ARGS_LEVEL (partial_args, i,
TMPL_ARGS_LEVEL (targs, i));
SET_TMPL_ARGS_LEVEL (partial_args,
TMPL_ARGS_DEPTH (targs),
- make_temp_vec (DECL_NTPARMS (tmpl)));
+ make_tree_vec (DECL_NTPARMS (tmpl)));
/* Now, do the (partial) substitution to figure out the
appropriate function type. */
@@ -9830,47 +10290,59 @@ set_mangled_name_for_template_decl (decl)
tparms = tsubst_template_parms (tparms, partial_args, /*complain=*/1);
}
- /* Now, get the innermost parameters and arguments, and figure out
- the parameter and return types. */
- tparms = INNERMOST_TEMPLATE_PARMS (tparms);
- targs = innermost_args (targs);
- ret_type = TREE_TYPE (fn_type);
- parm_types = TYPE_ARG_TYPES (fn_type);
+ if (contextp)
+ *contextp = context;
+ if (tparmsp)
+ *tparmsp = tparms;
- /* For a static member function, we generate a fake `this' pointer,
- for the purposes of mangling. This indicates of which class the
- function is a member. Because of:
+ return fn_type;
+}
- [class.static]
+/* Return truthvalue if we're processing a template different from
+ the last one involved in diagnostics. */
+int
+problematic_instantiation_changed ()
+{
+ return last_template_error_tick != tinst_level_tick;
+}
- There shall not be a static and a nonstatic member function
- with the same name and the same parameter types
+/* Remember current template involved in diagnostics. */
+void
+record_last_problematic_instantiation ()
+{
+ last_template_error_tick = tinst_level_tick;
+}
- we don't have to worry that this will result in a clash with a
- non-static member function. */
- if (DECL_STATIC_FUNCTION_P (decl))
- parm_types = hash_tree_chain (build_pointer_type (context), parm_types);
+tree
+current_instantiation ()
+{
+ return current_tinst_level;
+}
- /* There should be the same number of template parameters as
- template arguments. */
- my_friendly_assert (TREE_VEC_LENGTH (tparms) == TREE_VEC_LENGTH (targs),
- 0);
+/* [temp.param] Check that template non-type parm TYPE is of an allowable
+ type. Return zero for ok, non-zero for disallowed. If COMPLAIN is
+ non-zero, then complain. */
- /* If the template is in a namespace, we need to put that into the
- mangled name. Unfortunately, build_decl_overload_real does not
- get the decl to mangle, so it relies on the current
- namespace. Therefore, we set that here temporarily. */
- my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd', 980702);
- saved_namespace = current_namespace;
- current_namespace = CP_DECL_CONTEXT (decl);
-
- /* Actually set the DCL_ASSEMBLER_NAME. */
- DECL_ASSEMBLER_NAME (decl)
- = build_decl_overload_real (DECL_NAME (decl), parm_types, ret_type,
- tparms, targs,
- DECL_FUNCTION_MEMBER_P (decl)
- + DECL_CONSTRUCTOR_P (decl));
-
- /* Restore the previously active namespace. */
- current_namespace = saved_namespace;
+static int
+invalid_nontype_parm_type_p (type, complain)
+ tree type;
+ int complain;
+{
+ if (INTEGRAL_TYPE_P (type))
+ return 0;
+ else if (POINTER_TYPE_P (type))
+ return 0;
+ else if (TYPE_PTRMEM_P (type))
+ return 0;
+ else if (TYPE_PTRMEMFUNC_P (type))
+ return 0;
+ else if (TREE_CODE (type) == TEMPLATE_TYPE_PARM)
+ return 0;
+ else if (TREE_CODE (type) == TYPENAME_TYPE)
+ return 0;
+
+ if (complain)
+ error ("`%#T' is not a valid type for a template constant parameter",
+ type);
+ return 1;
}
diff --git a/contrib/gcc/cp/ptree.c b/contrib/gcc/cp/ptree.c
index 1f17aec..f40e412 100644
--- a/contrib/gcc/cp/ptree.c
+++ b/contrib/gcc/cp/ptree.c
@@ -1,5 +1,6 @@
/* Prints out trees in human readable form.
- Copyright (C) 1992, 93-96, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998,
+ 1999 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -26,34 +27,38 @@ Boston, MA 02111-1307, USA. */
#include "cp-tree.h"
void
-print_lang_decl (file, node, indent)
+cxx_print_decl (file, node, indent)
FILE *file;
tree node;
int indent;
{
- if (!DECL_LANG_SPECIFIC (node))
- return;
- /* A FIELD_DECL only has the flags structure, which we aren't displaying
- anyways. */
- if (DECL_MUTABLE_P (node))
+ if (TREE_CODE (node) == FIELD_DECL)
{
- indent_to (file, indent + 3);
- fprintf (file, " mutable ");
+ if (DECL_MUTABLE_P (node))
+ {
+ indent_to (file, indent + 3);
+ fprintf (file, " mutable ");
+ }
+ return;
}
- if (TREE_CODE (node) == FIELD_DECL)
+
+ if (!DECL_LANG_SPECIFIC (node))
return;
indent_to (file, indent + 3);
- if (DECL_MAIN_VARIANT (node))
- {
- fprintf (file, " decl-main-variant ");
- fprintf (file, HOST_PTR_PRINTF, DECL_MAIN_VARIANT (node));
- }
- if (DECL_PENDING_INLINE_INFO (node))
+ if (TREE_CODE (node) == FUNCTION_DECL
+ && DECL_PENDING_INLINE_INFO (node))
{
fprintf (file, " pending-inline-info ");
fprintf (file, HOST_PTR_PRINTF, DECL_PENDING_INLINE_INFO (node));
}
- if (DECL_TEMPLATE_INFO (node))
+ if (TREE_CODE (node) == TYPE_DECL
+ && DECL_SORTED_FIELDS (node))
+ {
+ fprintf (file, " sorted-fields ");
+ fprintf (file, HOST_PTR_PRINTF, DECL_SORTED_FIELDS (node));
+ }
+ if ((TREE_CODE (node) == FUNCTION_DECL || TREE_CODE (node) == VAR_DECL)
+ && DECL_TEMPLATE_INFO (node))
{
fprintf (file, " template-info ");
fprintf (file, HOST_PTR_PRINTF, DECL_TEMPLATE_INFO (node));
@@ -61,14 +66,16 @@ print_lang_decl (file, node, indent)
}
void
-print_lang_type (file, node, indent)
+cxx_print_type (file, node, indent)
FILE *file;
register tree node;
int indent;
{
- if (TREE_CODE (node) == TEMPLATE_TYPE_PARM
- || TREE_CODE (node) == TEMPLATE_TEMPLATE_PARM)
+ switch (TREE_CODE (node))
{
+ case TEMPLATE_TYPE_PARM:
+ case TEMPLATE_TEMPLATE_PARM:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
indent_to (file, indent + 3);
fputs ("index ", file);
fprintf (file, HOST_WIDE_INT_PRINT_DEC, TEMPLATE_TYPE_IDX (node));
@@ -77,20 +84,33 @@ print_lang_type (file, node, indent)
fputs (" orig_level ", file);
fprintf (file, HOST_WIDE_INT_PRINT_DEC, TEMPLATE_TYPE_ORIG_LEVEL (node));
return;
+
+ case FUNCTION_TYPE:
+ case METHOD_TYPE:
+ if (TYPE_RAISES_EXCEPTIONS (node))
+ print_node (file, "throws", TYPE_RAISES_EXCEPTIONS (node), indent + 4);
+ return;
+
+ case RECORD_TYPE:
+ case UNION_TYPE:
+ break;
+
+ default:
+ return;
}
- if (! (TREE_CODE (node) == RECORD_TYPE
- || TREE_CODE (node) == UNION_TYPE))
- return;
+ if (TYPE_PTRMEMFUNC_P (node))
+ print_node (file, "ptrmemfunc fn type", TYPE_PTRMEMFUNC_FN_TYPE (node),
+ indent + 4);
- if (!TYPE_LANG_SPECIFIC (node))
+ if (! CLASS_TYPE_P (node))
return;
indent_to (file, indent + 3);
if (TYPE_NEEDS_CONSTRUCTING (node))
fputs ( "needs-constructor", file);
- if (TYPE_NEEDS_DESTRUCTOR (node))
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (node))
fputs (" needs-destructor", file);
if (TYPE_HAS_DESTRUCTOR (node))
fputs (" ~X()", file);
@@ -105,9 +125,9 @@ print_lang_type (file, node, indent)
else
fputs (" X(X&)", file);
}
- if (TYPE_GETS_NEW (node) & 1)
+ if (TYPE_HAS_NEW_OPERATOR (node))
fputs (" new", file);
- if (TYPE_GETS_NEW (node) & 2)
+ if (TYPE_HAS_ARRAY_NEW_OPERATOR (node))
fputs (" new[]", file);
if (TYPE_GETS_DELETE (node) & 1)
fputs (" delete", file);
@@ -138,7 +158,7 @@ print_lang_type (file, node, indent)
}
void
-print_lang_identifier (file, node, indent)
+cxx_print_identifier (file, node, indent)
FILE *file;
tree node;
int indent;
@@ -153,7 +173,7 @@ print_lang_identifier (file, node, indent)
}
void
-lang_print_xnode (file, node, indent)
+cxx_print_xnode (file, node, indent)
FILE *file;
tree node;
int indent;
diff --git a/contrib/gcc/cp/repo.c b/contrib/gcc/cp/repo.c
index 9fa8e5c..fe2eb62 100644
--- a/contrib/gcc/cp/repo.c
+++ b/contrib/gcc/cp/repo.c
@@ -1,5 +1,5 @@
/* Code to maintain a C++ template repository.
- Copyright (C) 1995, 96-97, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
Contributed by Jason Merrill (jason@cygnus.com)
This file is part of GNU CC.
@@ -32,15 +32,15 @@ Boston, MA 02111-1307, USA. */
#include "input.h"
#include "obstack.h"
#include "toplev.h"
+#include "ggc.h"
+#include "diagnostic.h"
-extern char *getpwd PROTO((void));
-
-static tree repo_get_id PROTO((tree));
-static char *extract_string PROTO((char **));
-static char *get_base_filename PROTO((const char *));
-static void open_repo_file PROTO((const char *));
-static char *afgets PROTO((FILE *));
-static void reopen_repo_file_for_write PROTO((void));
+static tree repo_get_id PARAMS ((tree));
+static char *extract_string PARAMS ((char **));
+static const char *get_base_filename PARAMS ((const char *));
+static void open_repo_file PARAMS ((const char *));
+static char *afgets PARAMS ((FILE *));
+static void reopen_repo_file_for_write PARAMS ((void));
static tree pending_repo;
static tree original_repo;
@@ -49,9 +49,7 @@ static FILE *repo_file;
static char *old_args, *old_dir, *old_main;
-extern int flag_use_repository;
-extern int errorcount, sorrycount;
-extern struct obstack temporary_obstack;
+static struct obstack temporary_obstack;
extern struct obstack permanent_obstack;
#define IDENTIFIER_REPO_USED(NODE) (TREE_LANG_FLAG_3 (NODE))
@@ -97,15 +95,19 @@ static tree
repo_get_id (t)
tree t;
{
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
+ if (TYPE_P (t))
{
+ tree vtable;
+
/* If we're not done setting up the class, we may not have set up
the vtable, so going ahead would give the wrong answer.
See g++.pt/instantiate4.C. */
- if (TYPE_SIZE (t) == NULL_TREE || TYPE_BEING_DEFINED (t))
- my_friendly_abort (981113);
+ if (!COMPLETE_TYPE_P (t) || TYPE_BEING_DEFINED (t))
+ abort ();
+
+ vtable = get_vtbl_decl_for_binfo (TYPE_BINFO (t));
- t = TYPE_BINFO_VTABLE (t);
+ t = vtable;
if (t == NULL_TREE)
return t;
}
@@ -128,23 +130,29 @@ repo_template_used (t)
if (id == NULL_TREE)
return;
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
+ if (TYPE_P (t))
{
if (IDENTIFIER_REPO_CHOSEN (id))
mark_class_instantiated (t, 0);
}
- else if (TREE_CODE_CLASS (TREE_CODE (t)) == 'd')
+ else if (DECL_P (t))
{
if (IDENTIFIER_REPO_CHOSEN (id))
- mark_decl_instantiated (t, 0);
+ /* It doesn't make sense to instantiate a clone, so we
+ instantiate the cloned function instead. Note that this
+ approach will not work correctly if collect2 assigns
+ different clones to different files -- but it shouldn't. */
+ mark_decl_instantiated (DECL_CLONED_FUNCTION_P (t)
+ ? DECL_CLONED_FUNCTION (t) : t,
+ 0);
}
else
- my_friendly_abort (1);
+ abort ();
if (! IDENTIFIER_REPO_USED (id))
{
IDENTIFIER_REPO_USED (id) = 1;
- pending_repo = perm_tree_cons (NULL_TREE, id, pending_repo);
+ pending_repo = tree_cons (NULL_TREE, id, pending_repo);
}
}
@@ -158,7 +166,7 @@ repo_vtable_used (t)
if (! flag_use_repository)
return;
- pending_repo = perm_tree_cons (NULL_TREE, t, pending_repo);
+ pending_repo = tree_cons (NULL_TREE, t, pending_repo);
}
/* Note that an inline with external linkage has been used, and offer to
@@ -172,13 +180,14 @@ repo_inline_used (fn)
return;
/* Member functions of polymorphic classes go with their vtables. */
- if (DECL_FUNCTION_MEMBER_P (fn) && TYPE_VIRTUAL_P (DECL_CLASS_CONTEXT (fn)))
+ if (DECL_FUNCTION_MEMBER_P (fn)
+ && TYPE_POLYMORPHIC_P (DECL_CONTEXT (fn)))
{
- repo_vtable_used (DECL_CLASS_CONTEXT (fn));
+ repo_vtable_used (DECL_CONTEXT (fn));
return;
}
- pending_repo = perm_tree_cons (NULL_TREE, fn, pending_repo);
+ pending_repo = tree_cons (NULL_TREE, fn, pending_repo);
}
/* Note that a particular typeinfo node has been used, and offer to
@@ -237,7 +246,7 @@ extract_string (pp)
return obstack_finish (&temporary_obstack);
}
-static char *
+const char *
get_base_filename (filename)
const char *filename;
{
@@ -265,7 +274,7 @@ get_base_filename (filename)
return NULL;
}
- return file_name_nondirectory (filename);
+ return lbasename (filename);
}
static void
@@ -278,8 +287,8 @@ open_repo_file (filename)
if (s == NULL)
return;
- p = file_name_nondirectory (s);
- p = rindex (p, '.');
+ p = lbasename (s);
+ p = strrchr (p, '.');
if (! p)
p = s + strlen (s);
@@ -311,6 +320,10 @@ init_repo (filename)
if (! flag_use_repository)
return;
+ ggc_add_tree_root (&pending_repo, 1);
+ ggc_add_tree_root (&original_repo, 1);
+ gcc_obstack_init (&temporary_obstack);
+
open_repo_file (filename);
if (repo_file == 0)
@@ -346,7 +359,7 @@ init_repo (filename)
else
orig = NULL_TREE;
- original_repo = perm_tree_cons (orig, id, original_repo);
+ original_repo = tree_cons (orig, id, original_repo);
}
break;
default:
diff --git a/contrib/gcc/cp/rtti.c b/contrib/gcc/cp/rtti.c
index c8c1ba9..8c9b1c1 100644
--- a/contrib/gcc/cp/rtti.c
+++ b/contrib/gcc/cp/rtti.c
@@ -1,5 +1,6 @@
/* RunTime Type Identification
- Copyright (C) 1995, 96-97, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
Mostly written by Jason Merrill (jason@cygnus.com).
This file is part of GNU CC.
@@ -29,66 +30,58 @@ Boston, MA 02111-1307, USA. */
#include "assert.h"
#include "toplev.h"
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
+/* Accessors for the type_info objects. We need to remember several things
+ about each of the type_info types. The global tree nodes such as
+ bltn_desc_type_node are TREE_LISTs, and these macros are used to access
+ the required information. */
+/* The RECORD_TYPE of a type_info derived class. */
+#define TINFO_PSEUDO_TYPE(NODE) TREE_TYPE (NODE)
+/* The VAR_DECL of the vtable for the type_info derived class. */
+#define TINFO_VTABLE_DECL(NODE) TREE_VALUE (NODE)
extern struct obstack permanent_obstack;
-static tree call_void_fn PROTO((const char *));
-static tree build_headof_sub PROTO((tree));
-static tree build_headof PROTO((tree));
-static tree get_tinfo_var PROTO((tree));
-static tree ifnonnull PROTO((tree, tree));
-static tree build_dynamic_cast_1 PROTO((tree, tree));
-static void expand_si_desc PROTO((tree, tree));
-static void expand_class_desc PROTO((tree, tree));
-static void expand_attr_desc PROTO((tree, tree));
-static void expand_ptr_desc PROTO((tree, tree));
-static void expand_generic_desc PROTO((tree, tree, const char *));
-static tree throw_bad_cast PROTO((void));
-static tree throw_bad_typeid PROTO((void));
-
-tree type_info_type_node;
-tree tinfo_fn_id;
-tree tinfo_fn_type;
+static tree build_headof PARAMS((tree));
+static tree ifnonnull PARAMS((tree, tree));
+static tree tinfo_name PARAMS((tree));
+static tree build_dynamic_cast_1 PARAMS((tree, tree));
+static tree throw_bad_cast PARAMS((void));
+static tree throw_bad_typeid PARAMS((void));
+static tree get_tinfo_decl_dynamic PARAMS((tree));
+static bool typeid_ok_p PARAMS ((void));
+static int qualifier_flags PARAMS((tree));
+static int target_incomplete_p PARAMS((tree));
+static tree tinfo_base_init PARAMS((tree, tree));
+static tree generic_initializer PARAMS((tree, tree));
+static tree ptr_initializer PARAMS((tree, tree, int *));
+static tree ptm_initializer PARAMS((tree, tree, int *));
+static tree dfs_class_hint_mark PARAMS ((tree, void *));
+static tree dfs_class_hint_unmark PARAMS ((tree, void *));
+static int class_hint_flags PARAMS((tree));
+static tree class_initializer PARAMS((tree, tree, tree));
+static tree synthesize_tinfo_var PARAMS((tree, tree));
+static tree create_real_tinfo_var PARAMS((tree, tree, tree, tree, int));
+static tree create_pseudo_type_info PARAMS((const char *, int, ...));
+static tree get_vmi_pseudo_type_info PARAMS((int));
+static void create_tinfo_types PARAMS((void));
+static int typeinfo_in_lib_p PARAMS((tree));
+
+static int doing_runtime = 0;
void
init_rtti_processing ()
{
- if (flag_honor_std)
- push_namespace (get_identifier ("std"));
+ push_namespace (std_identifier);
type_info_type_node = xref_tag
(class_type_node, get_identifier ("type_info"), 1);
- if (flag_honor_std)
- pop_namespace ();
- tinfo_fn_id = get_identifier ("__tf");
- tinfo_fn_type = build_function_type
- (build_reference_type (build_qualified_type (type_info_type_node,
- TYPE_QUAL_CONST)),
- void_list_node);
-}
-
-/* Given a pointer to an object with at least one virtual table
- pointer somewhere, return a pointer to a possible sub-object that
- has a virtual table pointer in it that is the vtable parent for
- that sub-object. */
-
-static tree
-build_headof_sub (exp)
- tree exp;
-{
- tree type = TREE_TYPE (TREE_TYPE (exp));
- tree basetype = CLASSTYPE_RTTI (type);
- tree binfo = get_binfo (basetype, type, 0);
-
- exp = convert_pointer_to_real (binfo, exp);
- return exp;
+ pop_namespace ();
+ tinfo_decl_type =
+ build_qualified_type (type_info_type_node, TYPE_QUAL_CONST);
}
/* Given the expression EXP of type `class *', return the head of the
object pointed to by EXP with type cv void*, if the class has any
- virtual functions (TYPE_VIRTUAL_P), else just return the
+ virtual functions (TYPE_POLYMORPHIC_P), else just return the
expression. */
static tree
@@ -96,73 +89,29 @@ build_headof (exp)
tree exp;
{
tree type = TREE_TYPE (exp);
- tree aref;
tree offset;
+ tree index;
- if (TREE_CODE (type) != POINTER_TYPE)
- {
- error ("`headof' applied to non-pointer type");
- return error_mark_node;
- }
+ my_friendly_assert (TREE_CODE (type) == POINTER_TYPE, 20000112);
type = TREE_TYPE (type);
- if (!TYPE_VIRTUAL_P (type))
+ if (!TYPE_POLYMORPHIC_P (type))
return exp;
- if (CLASSTYPE_COM_INTERFACE (type))
- {
- cp_error ("RTTI not supported for COM interface type `%T'", type);
- return error_mark_node;
- }
-
- /* If we don't have rtti stuff, get to a sub-object that does. */
- if (!CLASSTYPE_VFIELDS (TREE_TYPE (TREE_TYPE (exp))))
- exp = build_headof_sub (exp);
/* We use this a couple of times below, protect it. */
exp = save_expr (exp);
- aref = build_vtbl_ref (build_indirect_ref (exp, NULL_PTR), integer_zero_node);
+ /* The offset-to-top field is at index -2 from the vptr. */
+ index = build_int_2 (-2, -1);
- if (flag_vtable_thunks)
- offset = aref;
- else
- offset = build_component_ref (aref, delta_identifier, NULL_TREE, 0);
+ offset = build_vtbl_ref (build_indirect_ref (exp, NULL), index);
type = build_qualified_type (ptr_type_node,
- CP_TYPE_QUALS (TREE_TYPE (exp)));
+ cp_type_quals (TREE_TYPE (exp)));
return build (PLUS_EXPR, type, exp,
cp_convert (ptrdiff_type_node, offset));
}
-/* Build a call to a generic entry point taking and returning void. */
-
-static tree
-call_void_fn (name)
- const char *name;
-{
- tree d = get_identifier (name);
- tree type;
-
- if (IDENTIFIER_GLOBAL_VALUE (d))
- d = IDENTIFIER_GLOBAL_VALUE (d);
- else
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
- type = build_function_type (void_type_node, void_list_node);
- d = build_lang_decl (FUNCTION_DECL, d, type);
- DECL_EXTERNAL (d) = 1;
- TREE_PUBLIC (d) = 1;
- DECL_ARTIFICIAL (d) = 1;
- pushdecl_top_level (d);
- make_function_rtl (d);
- pop_obstacks ();
- }
-
- mark_used (d);
- return build_call (d, void_type_node, NULL_TREE);
-}
-
/* Get a bad_cast node for the program to throw...
See libstdc++/exception.cc for __throw_bad_cast */
@@ -170,34 +119,45 @@ call_void_fn (name)
static tree
throw_bad_cast ()
{
- return call_void_fn ("__throw_bad_cast");
+ tree fn = get_identifier ("__cxa_bad_cast");
+ if (IDENTIFIER_GLOBAL_VALUE (fn))
+ fn = IDENTIFIER_GLOBAL_VALUE (fn);
+ else
+ fn = push_throw_library_fn (fn, build_function_type (ptr_type_node,
+ void_list_node));
+
+ return build_call (fn, NULL_TREE);
}
static tree
throw_bad_typeid ()
{
- return call_void_fn ("__throw_bad_typeid");
+ tree fn = get_identifier ("__cxa_bad_typeid");
+ if (IDENTIFIER_GLOBAL_VALUE (fn))
+ fn = IDENTIFIER_GLOBAL_VALUE (fn);
+ else
+ {
+ tree t = build_qualified_type (type_info_type_node, TYPE_QUAL_CONST);
+ t = build_function_type (build_reference_type (t), void_list_node);
+ fn = push_throw_library_fn (fn, t);
+ }
+
+ return build_call (fn, NULL_TREE);
}
-/* Return the type_info function associated with the expression EXP. If
- EXP is a reference to a polymorphic class, return the dynamic type;
+/* Return a pointer to type_info function associated with the expression EXP.
+ If EXP is a reference to a polymorphic class, return the dynamic type;
otherwise return the static type of the expression. */
-tree
-get_tinfo_fn_dynamic (exp)
+static tree
+get_tinfo_decl_dynamic (exp)
tree exp;
{
tree type;
-
+
if (exp == error_mark_node)
return error_mark_node;
- if (type_unknown_p (exp))
- {
- error ("typeid of overloaded function");
- return error_mark_node;
- }
-
type = TREE_TYPE (exp);
/* peel back references, so they match. */
@@ -206,82 +166,66 @@ get_tinfo_fn_dynamic (exp)
/* Peel off cv qualifiers. */
type = TYPE_MAIN_VARIANT (type);
-
- if (TYPE_SIZE (complete_type (type)) == NULL_TREE)
- {
- cp_error ("taking typeid of incomplete type `%T'", type);
- return error_mark_node;
- }
+
+ if (!VOID_TYPE_P (type))
+ type = complete_type_or_else (type, exp);
+
+ if (!type)
+ return error_mark_node;
/* If exp is a reference to polymorphic type, get the real type_info. */
- if (TYPE_VIRTUAL_P (type) && ! resolves_to_fixed_type_p (exp, 0))
+ if (TYPE_POLYMORPHIC_P (type) && ! resolves_to_fixed_type_p (exp, 0))
{
/* build reference to type_info from vtable. */
tree t;
+ tree index;
- if (! flag_rtti)
- error ("taking dynamic typeid of object with -fno-rtti");
- if (CLASSTYPE_COM_INTERFACE (type))
- {
- cp_error ("RTTI not supported for COM interface type `%T'", type);
- return error_mark_node;
- }
-
- /* If we don't have rtti stuff, get to a sub-object that does. */
- if (! CLASSTYPE_VFIELDS (type))
- {
- exp = build_unary_op (ADDR_EXPR, exp, 0);
- exp = build_headof_sub (exp);
- exp = build_indirect_ref (exp, NULL_PTR);
- }
-
- if (flag_vtable_thunks)
- t = build_vfn_ref ((tree *) 0, exp, integer_one_node);
- else
- t = build_vfn_ref ((tree *) 0, exp, integer_zero_node);
- TREE_TYPE (t) = build_pointer_type (tinfo_fn_type);
+ /* The RTTI information is at index -1. */
+ index = integer_minus_one_node;
+ t = build_vtbl_ref (exp, index);
+ TREE_TYPE (t) = build_pointer_type (tinfo_decl_type);
return t;
}
/* otherwise return the type_info for the static type of the expr. */
- return get_tinfo_fn (TYPE_MAIN_VARIANT (type));
+ exp = get_tinfo_decl (TYPE_MAIN_VARIANT (type));
+ return build_unary_op (ADDR_EXPR, exp, 0);
}
-tree
-build_typeid (exp)
- tree exp;
-{
- exp = get_tinfo_fn_dynamic (exp);
- exp = build_call (exp, TREE_TYPE (tinfo_fn_type), NULL_TREE);
- return convert_from_reference (exp);
-}
-
-tree
-build_x_typeid (exp)
- tree exp;
+static bool
+typeid_ok_p ()
{
- tree cond = NULL_TREE;
- tree type;
- int nonnull;
-
if (! flag_rtti)
{
error ("cannot use typeid with -fno-rtti");
- return error_mark_node;
+ return false;
}
- if (TYPE_SIZE (type_info_type_node) == NULL_TREE)
+ if (!COMPLETE_TYPE_P (type_info_type_node))
{
error ("must #include <typeinfo> before using typeid");
- return error_mark_node;
+ return false;
}
+ return true;
+}
+
+tree
+build_typeid (exp)
+ tree exp;
+{
+ tree cond = NULL_TREE;
+ int nonnull = 0;
+
+ if (exp == error_mark_node || !typeid_ok_p ())
+ return error_mark_node;
+
if (processing_template_decl)
return build_min_nt (TYPEID_EXPR, exp);
if (TREE_CODE (exp) == INDIRECT_REF
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == POINTER_TYPE
- && TYPE_VIRTUAL_P (TREE_TYPE (exp))
+ && TYPE_POLYMORPHIC_P (TREE_TYPE (exp))
&& ! resolves_to_fixed_type_p (exp, &nonnull)
&& ! nonnull)
{
@@ -289,167 +233,104 @@ build_x_typeid (exp)
cond = cp_convert (boolean_type_node, TREE_OPERAND (exp, 0));
}
- exp = get_tinfo_fn_dynamic (exp);
+ exp = get_tinfo_decl_dynamic (exp);
if (exp == error_mark_node)
return error_mark_node;
- type = TREE_TYPE (tinfo_fn_type);
- exp = build_call (exp, type, NULL_TREE);
+ exp = build_indirect_ref (exp, NULL);
if (cond)
{
tree bad = throw_bad_typeid ();
- bad = build_compound_expr
- (expr_tree_cons (NULL_TREE, bad, build_expr_list
- (NULL_TREE, cp_convert (type, integer_zero_node))));
- exp = build (COND_EXPR, type, cond, exp, bad);
+ exp = build (COND_EXPR, TREE_TYPE (exp), cond, exp, bad);
}
return convert_from_reference (exp);
}
+/* Generate the NTBS name of a type. */
static tree
-get_tinfo_var (type)
+tinfo_name (type)
tree type;
{
- tree tname = build_overload_with_type (get_identifier ("__ti"), type);
- tree tdecl, arrtype;
- int size;
-
- if (IDENTIFIER_GLOBAL_VALUE (tname))
- return IDENTIFIER_GLOBAL_VALUE (tname);
-
- /* Figure out how much space we need to allocate for the type_info object.
- If our struct layout or the type_info classes are changed, this will
- need to be modified. */
- if (TYPE_QUALS (type) != TYPE_UNQUALIFIED)
- size = 3 * POINTER_SIZE + INT_TYPE_SIZE;
- else if (TREE_CODE (type) == POINTER_TYPE
- && ! (TREE_CODE (TREE_TYPE (type)) == OFFSET_TYPE
- || TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE))
- size = 3 * POINTER_SIZE;
- else if (IS_AGGR_TYPE (type))
- {
- if (CLASSTYPE_N_BASECLASSES (type) == 0)
- size = 2 * POINTER_SIZE;
- else if (! TYPE_USES_COMPLEX_INHERITANCE (type)
- && (TREE_VIA_PUBLIC
- (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), 0))))
- size = 3 * POINTER_SIZE;
- else
- size = 3 * POINTER_SIZE + TYPE_PRECISION (sizetype);
- }
- else
- size = 2 * POINTER_SIZE;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
- /* The type for a character array of the appropriate size. */
- arrtype = build_cplus_array_type
- (unsigned_char_type_node,
- build_index_type (size_int (size / BITS_PER_UNIT - 1)));
-
- tdecl = build_decl (VAR_DECL, tname, arrtype);
- TREE_PUBLIC (tdecl) = 1;
- DECL_EXTERNAL (tdecl) = 1;
- DECL_ARTIFICIAL (tdecl) = 1;
- pushdecl_top_level (tdecl);
- cp_finish_decl (tdecl, NULL_TREE, NULL_TREE, 0, 0);
-
- pop_obstacks ();
+ const char *name;
+ tree name_string;
- return tdecl;
+ name = mangle_type_string (type);
+ name_string = combine_strings (build_string (strlen (name) + 1, name));
+ return name_string;
}
-/* Returns the decl for a function which will return a type_info node for
- TYPE. This version does not mark the function used, for use in
- set_rtti_entry; for the vtable case, we'll get marked in
- finish_vtable_vardecl, when we know that we want to be emitted.
-
- We do this to avoid emitting the tinfo node itself, since we don't
- currently support DECL_DEFER_OUTPUT for variables. Also, we don't
- associate constant pools with their functions properly, so we would
- emit string constants and such even though we don't emit the actual
- function. When those bugs are fixed, this function should go away. */
+/* Returns a decl for the type_info variable for TYPE. You must
+ arrange that the decl is mark_used, if actually use it --- decls in
+ vtables are only used if the vtable is output. */
tree
-get_tinfo_fn_unused (type)
+get_tinfo_decl (type)
tree type;
{
tree name;
tree d;
+ if (COMPLETE_TYPE_P (type)
+ && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
+ {
+ error ("cannot create type information for type `%T' because its size is variable",
+ type);
+ return error_mark_node;
+ }
+
if (TREE_CODE (type) == OFFSET_TYPE)
type = TREE_TYPE (type);
if (TREE_CODE (type) == METHOD_TYPE)
type = build_function_type (TREE_TYPE (type),
TREE_CHAIN (TYPE_ARG_TYPES (type)));
- name = build_overload_with_type (tinfo_fn_id, type);
-
- if (IDENTIFIER_GLOBAL_VALUE (name))
- return IDENTIFIER_GLOBAL_VALUE (name);
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
- d = build_lang_decl (FUNCTION_DECL, name, tinfo_fn_type);
- DECL_EXTERNAL (d) = 1;
- TREE_PUBLIC (d) = 1;
- DECL_ARTIFICIAL (d) = 1;
- DECL_NOT_REALLY_EXTERN (d) = 1;
- SET_DECL_TINFO_FN_P (d);
- TREE_TYPE (name) = copy_to_permanent (type);
-
- pushdecl_top_level (d);
- make_function_rtl (d);
- mark_inline_for_output (d);
- pop_obstacks ();
+ name = mangle_typeinfo_for_type (type);
- return d;
-}
-
-/* Likewise, but also mark it used. Called by various EH and RTTI code. */
+ d = IDENTIFIER_GLOBAL_VALUE (name);
+ if (d)
+ /* OK */;
+ else
+ {
+ /* The tinfo decl is the type_info object itself. We make all
+ tinfo objects look as type_info, even though they will end up
+ being a subclass of that when emitted. This means that we'll
+ erroneously think we know the dynamic type -- be careful in the
+ runtime. */
+ d = build_lang_decl (VAR_DECL, name, tinfo_decl_type);
+
+ DECL_ARTIFICIAL (d) = 1;
+ DECL_ALIGN (d) = TYPE_ALIGN (ptr_type_node);
+ DECL_USER_ALIGN (d) = 0;
+ TREE_READONLY (d) = 1;
+ TREE_STATIC (d) = 1;
+ DECL_EXTERNAL (d) = 1;
+ TREE_PUBLIC (d) = 1;
+ if (flag_weak || !typeinfo_in_lib_p (type))
+ comdat_linkage (d);
+ SET_DECL_ASSEMBLER_NAME (d, name);
+ cp_finish_decl (d, NULL_TREE, NULL_TREE, 0);
-tree
-get_tinfo_fn (type)
- tree type;
-{
- tree d = get_tinfo_fn_unused (type);
- mark_used (d);
+ pushdecl_top_level (d);
+ /* Remember the type it is for. */
+ TREE_TYPE (name) = type;
+ TREE_USED (name) = 1;
+ }
return d;
}
-tree
-get_typeid_1 (type)
- tree type;
-{
- tree t;
-
- t = build_call
- (get_tinfo_fn (type), TREE_TYPE (tinfo_fn_type), NULL_TREE);
- return convert_from_reference (t);
-}
-
-/* Return the type_info object for TYPE, creating it if necessary. */
+/* Return the type_info object for TYPE. */
tree
get_typeid (type)
tree type;
{
- if (type == error_mark_node)
+ if (type == error_mark_node || !typeid_ok_p ())
return error_mark_node;
-
- if (TYPE_SIZE (type_info_type_node) == NULL_TREE)
- {
- error ("must #include <typeinfo> before using typeid");
- return error_mark_node;
- }
- if (! flag_rtti)
- error ("requesting typeid with -fno-rtti");
-
if (processing_template_decl)
return build_min_nt (TYPEID_EXPR, type);
@@ -463,13 +344,13 @@ get_typeid (type)
that is the operand of typeid are always ignored. */
type = TYPE_MAIN_VARIANT (type);
- if (TYPE_SIZE (complete_type (type)) == NULL_TREE)
- {
- cp_error ("taking typeid of incomplete type `%T'", type);
- return error_mark_node;
- }
+ if (!VOID_TYPE_P (type))
+ type = complete_type_or_else (type, NULL_TREE);
+
+ if (!type)
+ return error_mark_node;
- return get_typeid_1 (type);
+ return get_tinfo_decl (type);
}
/* Check whether TEST is null before returning RESULT. If TEST is used in
@@ -493,105 +374,125 @@ build_dynamic_cast_1 (type, expr)
tree type, expr;
{
enum tree_code tc = TREE_CODE (type);
- tree exprtype;
- enum tree_code ec;
+ tree exprtype = TREE_TYPE (expr);
tree dcast_fn;
tree old_expr = expr;
+ const char *errstr = NULL;
- if (TREE_CODE (expr) == OFFSET_REF)
- expr = resolve_offset_ref (expr);
-
- exprtype = TREE_TYPE (expr);
- assert (exprtype != NULL_TREE);
- ec = TREE_CODE (exprtype);
-
+ /* T shall be a pointer or reference to a complete class type, or
+ `pointer to cv void''. */
switch (tc)
{
case POINTER_TYPE:
- if (ec == REFERENCE_TYPE)
- {
- expr = convert_from_reference (expr);
- exprtype = TREE_TYPE (expr);
- ec = TREE_CODE (exprtype);
- }
- if (ec != POINTER_TYPE)
- goto fail;
- if (TREE_CODE (TREE_TYPE (exprtype)) != RECORD_TYPE)
- goto fail;
- if (TYPE_SIZE (complete_type (TREE_TYPE (exprtype))) == NULL_TREE)
- goto fail;
- if (!at_least_as_qualified_p (TREE_TYPE (type),
- TREE_TYPE (exprtype)))
- goto fail;
- if (TYPE_MAIN_VARIANT (TREE_TYPE (type)) == void_type_node)
+ if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE)
break;
- /* else fall through */
case REFERENCE_TYPE:
- if (TREE_CODE (TREE_TYPE (type)) != RECORD_TYPE)
- goto fail;
- if (TYPE_SIZE (complete_type (TREE_TYPE (type))) == NULL_TREE)
- goto fail;
+ if (! IS_AGGR_TYPE (TREE_TYPE (type)))
+ {
+ errstr = "target is not pointer or reference to class";
+ goto fail;
+ }
+ if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (type))))
+ {
+ errstr = "target is not pointer or reference to complete type";
+ goto fail;
+ }
break;
- /* else fall through */
+
default:
+ errstr = "target is not pointer or reference";
goto fail;
}
- /* Apply trivial conversion T -> T& for dereferenced ptrs. */
- if (ec == RECORD_TYPE)
+ if (TREE_CODE (expr) == OFFSET_REF)
+ {
+ expr = resolve_offset_ref (expr);
+ exprtype = TREE_TYPE (expr);
+ }
+
+ if (tc == POINTER_TYPE)
+ expr = convert_from_reference (expr);
+ else if (TREE_CODE (exprtype) != REFERENCE_TYPE)
{
+ /* Apply trivial conversion T -> T& for dereferenced ptrs. */
exprtype = build_reference_type (exprtype);
expr = convert_to_reference (exprtype, expr, CONV_IMPLICIT,
LOOKUP_NORMAL, NULL_TREE);
- ec = REFERENCE_TYPE;
}
- if (tc == REFERENCE_TYPE)
+ exprtype = TREE_TYPE (expr);
+
+ if (tc == POINTER_TYPE)
{
- if (ec != REFERENCE_TYPE)
- goto fail;
- if (TREE_CODE (TREE_TYPE (exprtype)) != RECORD_TYPE)
- goto fail;
- if (TYPE_SIZE (complete_type (TREE_TYPE (exprtype))) == NULL_TREE)
- goto fail;
- if (!at_least_as_qualified_p (TREE_TYPE (type),
- TREE_TYPE (exprtype)))
- goto fail;
+ /* If T is a pointer type, v shall be an rvalue of a pointer to
+ complete class type, and the result is an rvalue of type T. */
+
+ if (TREE_CODE (exprtype) != POINTER_TYPE)
+ {
+ errstr = "source is not a pointer";
+ goto fail;
+ }
+ if (! IS_AGGR_TYPE (TREE_TYPE (exprtype)))
+ {
+ errstr = "source is not a pointer to class";
+ goto fail;
+ }
+ if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (exprtype))))
+ {
+ errstr = "source is a pointer to incomplete type";
+ goto fail;
+ }
+ }
+ else
+ {
+ /* T is a reference type, v shall be an lvalue of a complete class
+ type, and the result is an lvalue of the type referred to by T. */
+
+ if (! IS_AGGR_TYPE (TREE_TYPE (exprtype)))
+ {
+ errstr = "source is not of class type";
+ goto fail;
+ }
+ if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (exprtype))))
+ {
+ errstr = "source is of incomplete class type";
+ goto fail;
+ }
+
+ }
+
+ /* The dynamic_cast operator shall not cast away constness. */
+ if (!at_least_as_qualified_p (TREE_TYPE (type),
+ TREE_TYPE (exprtype)))
+ {
+ errstr = "conversion casts away constness";
+ goto fail;
}
/* If *type is an unambiguous accessible base class of *exprtype,
convert statically. */
{
- int distance;
- tree path;
+ tree binfo;
- distance = get_base_distance (TREE_TYPE (type), TREE_TYPE (exprtype), 1,
- &path);
+ binfo = lookup_base (TREE_TYPE (exprtype), TREE_TYPE (type),
+ ba_not_special, NULL);
- if (distance == -2)
- {
- cp_error ("dynamic_cast from `%T' to ambiguous base class `%T'",
- TREE_TYPE (exprtype), TREE_TYPE (type));
- return error_mark_node;
- }
- if (distance == -3)
+ if (binfo)
{
- cp_error ("dynamic_cast from `%T' to private base class `%T'",
- TREE_TYPE (exprtype), TREE_TYPE (type));
- return error_mark_node;
+ expr = build_base_path (PLUS_EXPR, convert_from_reference (expr),
+ binfo, 0);
+ if (TREE_CODE (exprtype) == POINTER_TYPE)
+ expr = non_lvalue (expr);
+ return expr;
}
-
- if (distance >= 0)
- return build_vbase_path (PLUS_EXPR, type, expr, path, 0);
}
/* Otherwise *exprtype must be a polymorphic class (have a vtbl). */
- if (TYPE_VIRTUAL_P (TREE_TYPE (exprtype)))
+ if (TYPE_POLYMORPHIC_P (TREE_TYPE (exprtype)))
{
tree expr1;
/* if TYPE is `void *', return pointer to complete object. */
- if (tc == POINTER_TYPE
- && TYPE_MAIN_VARIANT (TREE_TYPE (type)) == void_type_node)
+ if (tc == POINTER_TYPE && VOID_TYPE_P (TREE_TYPE (type)))
{
/* if b is an object, dynamic_cast<void *>(&b) == (void *)&b. */
if (TREE_CODE (expr) == ADDR_EXPR
@@ -610,18 +511,22 @@ build_dynamic_cast_1 (type, expr)
else
{
tree retval;
- tree result, td1, td2, td3, elems, expr2;
+ tree result, td2, td3, elems;
+ tree static_type, target_type, boff;
/* If we got here, we can't convert statically. Therefore,
dynamic_cast<D&>(b) (b an object) cannot succeed. */
- if (ec == REFERENCE_TYPE)
+ if (tc == REFERENCE_TYPE)
{
if (TREE_CODE (old_expr) == VAR_DECL
&& TREE_CODE (TREE_TYPE (old_expr)) == RECORD_TYPE)
{
- cp_warning ("dynamic_cast of `%#D' to `%#T' can never succeed",
+ tree expr = throw_bad_cast ();
+ warning ("dynamic_cast of `%#D' to `%#T' can never succeed",
old_expr, type);
- return throw_bad_cast ();
+ /* Bash it to the expected type. */
+ TREE_TYPE (expr) = type;
+ return expr;
}
}
/* Ditto for dynamic_cast<D*>(&b). */
@@ -631,7 +536,7 @@ build_dynamic_cast_1 (type, expr)
if (TREE_CODE (op) == VAR_DECL
&& TREE_CODE (TREE_TYPE (op)) == RECORD_TYPE)
{
- cp_warning ("dynamic_cast of `%#D' to `%#T' can never succeed",
+ warning ("dynamic_cast of `%#D' to `%#T' can never succeed",
op, type);
retval = build_int_2 (0, 0);
TREE_TYPE (retval) = type;
@@ -639,6 +544,14 @@ build_dynamic_cast_1 (type, expr)
}
}
+ target_type = TYPE_MAIN_VARIANT (TREE_TYPE (type));
+ static_type = TYPE_MAIN_VARIANT (TREE_TYPE (exprtype));
+ td2 = build_unary_op (ADDR_EXPR, get_tinfo_decl (target_type), 0);
+ td3 = build_unary_op (ADDR_EXPR, get_tinfo_decl (static_type), 0);
+
+ /* Determine how T and V are related. */
+ boff = get_dynamic_cast_base_type (static_type, target_type);
+
/* Since expr is used twice below, save it. */
expr = save_expr (expr);
@@ -646,66 +559,47 @@ build_dynamic_cast_1 (type, expr)
if (tc == REFERENCE_TYPE)
expr1 = build_unary_op (ADDR_EXPR, expr1, 0);
- /* Build run-time conversion. */
- expr2 = build_headof (expr1);
-
- if (ec == POINTER_TYPE)
- td1 = get_tinfo_fn_dynamic (build_indirect_ref (expr, NULL_PTR));
- else
- td1 = get_tinfo_fn_dynamic (expr);
- td1 = decay_conversion (td1);
-
- td2 = decay_conversion
- (get_tinfo_fn (TYPE_MAIN_VARIANT (TREE_TYPE (type))));
- td3 = decay_conversion
- (get_tinfo_fn (TYPE_MAIN_VARIANT (TREE_TYPE (exprtype))));
-
- elems = tree_cons
- (NULL_TREE, td1, tree_cons
- (NULL_TREE, td2, tree_cons
- (NULL_TREE, build_int_2 (1, 0), tree_cons
- (NULL_TREE, expr2, tree_cons
- (NULL_TREE, td3, tree_cons
- (NULL_TREE, expr1, NULL_TREE))))));
-
- dcast_fn = get_identifier ("__dynamic_cast");
- if (IDENTIFIER_GLOBAL_VALUE (dcast_fn))
- dcast_fn = IDENTIFIER_GLOBAL_VALUE (dcast_fn);
- else
+ elems = tree_cons
+ (NULL_TREE, expr1, tree_cons
+ (NULL_TREE, td3, tree_cons
+ (NULL_TREE, td2, tree_cons
+ (NULL_TREE, boff, NULL_TREE))));
+
+ dcast_fn = dynamic_cast_node;
+ if (!dcast_fn)
{
tree tmp;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
+ tree tinfo_ptr;
+ tree ns = abi_node;
+ const char *name;
+
+ push_nested_namespace (ns);
+ tinfo_ptr = xref_tag (class_type_node,
+ get_identifier ("__class_type_info"),
+ 1);
+
+ tinfo_ptr = build_pointer_type
+ (build_qualified_type
+ (tinfo_ptr, TYPE_QUAL_CONST));
+ name = "__dynamic_cast";
tmp = tree_cons
- (NULL_TREE, TREE_TYPE (td1), tree_cons
- (NULL_TREE, TREE_TYPE (td1), tree_cons
- (NULL_TREE, integer_type_node, tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, TREE_TYPE (td1), tree_cons
- (NULL_TREE, ptr_type_node, void_list_node))))));
+ (NULL_TREE, const_ptr_type_node, tree_cons
+ (NULL_TREE, tinfo_ptr, tree_cons
+ (NULL_TREE, tinfo_ptr, tree_cons
+ (NULL_TREE, ptrdiff_type_node, void_list_node))));
tmp = build_function_type (ptr_type_node, tmp);
- dcast_fn = build_lang_decl (FUNCTION_DECL, dcast_fn, tmp);
- DECL_EXTERNAL (dcast_fn) = 1;
- TREE_PUBLIC (dcast_fn) = 1;
- DECL_ARTIFICIAL (dcast_fn) = 1;
- pushdecl_top_level (dcast_fn);
- make_function_rtl (dcast_fn);
- pop_obstacks ();
+ dcast_fn = build_library_fn_ptr (name, tmp);
+ pop_nested_namespace (ns);
+ dynamic_cast_node = dcast_fn;
}
-
- mark_used (dcast_fn);
- result = build_call
- (dcast_fn, TREE_TYPE (TREE_TYPE (dcast_fn)), elems);
+ result = build_call (dcast_fn, elems);
if (tc == REFERENCE_TYPE)
{
- expr1 = throw_bad_cast ();
- expr1 = build_compound_expr
- (expr_tree_cons (NULL_TREE, expr1,
- build_expr_list (NULL_TREE, cp_convert (type, integer_zero_node))));
- TREE_TYPE (expr1) = type;
+ tree bad = throw_bad_cast ();
+
result = save_expr (result);
- return build (COND_EXPR, type, result, result, expr1);
+ return build (COND_EXPR, type, result, result, bad);
}
/* Now back to the type we want from a void*. */
@@ -713,10 +607,12 @@ build_dynamic_cast_1 (type, expr)
return ifnonnull (expr, result);
}
}
+ else
+ errstr = "source type is not polymorphic";
fail:
- cp_error ("cannot dynamic_cast `%E' (of type `%#T') to type `%#T'",
- expr, exprtype, type);
+ error ("cannot dynamic_cast `%E' (of type `%#T') to type `%#T' (%s)",
+ expr, exprtype, type, errstr);
return error_mark_node;
}
@@ -728,476 +624,852 @@ build_dynamic_cast (type, expr)
return error_mark_node;
if (processing_template_decl)
- return build_min (DYNAMIC_CAST_EXPR, copy_to_permanent (type), expr);
+ return build_min (DYNAMIC_CAST_EXPR, type, expr);
return convert_from_reference (build_dynamic_cast_1 (type, expr));
}
-/* Build and initialize various sorts of descriptors. Every descriptor
- node has a name associated with it (the name created by mangling).
- For this reason, we use the identifier as our access to the __*_desc
- nodes, instead of sticking them directly in the types. Otherwise we
- would burden all built-in types (and pointer types) with slots that
- we don't necessarily want to use.
+/* Return the runtime bit mask encoding the qualifiers of TYPE. */
- For each descriptor we build, we build a variable that contains
- the descriptor's information. When we need this info at runtime,
- all we need is access to these variables.
+static int
+qualifier_flags (type)
+ tree type;
+{
+ int flags = 0;
+ /* we want the qualifiers on this type, not any array core, it might have */
+ int quals = TYPE_QUALS (type);
+
+ if (quals & TYPE_QUAL_CONST)
+ flags |= 1;
+ if (quals & TYPE_QUAL_VOLATILE)
+ flags |= 2;
+ if (quals & TYPE_QUAL_RESTRICT)
+ flags |= 4;
+ return flags;
+}
- Note: these constructors always return the address of the descriptor
- info, since that is simplest for their mutual interaction. */
+/* Return non-zero, if the pointer chain TYPE ends at an incomplete type, or
+ contains a pointer to member of an incomplete class. */
-extern tree const_string_type_node;
+static int
+target_incomplete_p (type)
+ tree type;
+{
+ while (TREE_CODE (type) == POINTER_TYPE)
+ if (TYPE_PTRMEM_P (type))
+ {
+ if (!COMPLETE_TYPE_P (TYPE_PTRMEM_CLASS_TYPE (type)))
+ return 1;
+ type = TYPE_PTRMEM_POINTED_TO_TYPE (type);
+ }
+ else
+ type = TREE_TYPE (type);
+ if (!COMPLETE_OR_VOID_TYPE_P (type))
+ return 1;
+
+ return 0;
+}
-/* Build an initializer for a __si_type_info node. */
+/* Return a CONSTRUCTOR for the common part of the type_info objects. This
+ is the vtable pointer and NTBS name. The NTBS name is emitted as a
+ comdat const char array, so it becomes a unique key for the type. Generate
+ and emit that VAR_DECL here. (We can't always emit the type_info itself
+ as comdat, because of pointers to incomplete.) */
-static void
-expand_si_desc (tdecl, type)
- tree tdecl;
- tree type;
+static tree
+tinfo_base_init (desc, target)
+ tree desc;
+ tree target;
{
- tree t, elems, fn;
- const char *name = build_overload_name (type, 1, 1);
- tree name_string = combine_strings (build_string (strlen (name)+1, name));
-
- type = BINFO_TYPE (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), 0));
- expand_expr_stmt (get_typeid_1 (type));
- t = decay_conversion (get_tinfo_var (type));
- elems = tree_cons
- (NULL_TREE, decay_conversion (tdecl), tree_cons
- (NULL_TREE, decay_conversion (name_string), tree_cons
- (NULL_TREE, t, NULL_TREE)));
-
- fn = get_identifier ("__rtti_si");
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
- {
- tree tmp;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- tmp = tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, const_string_type_node, tree_cons
- (NULL_TREE, build_pointer_type (type_info_type_node),
- void_list_node)));
- tmp = build_function_type (void_type_node, tmp);
+ tree init = NULL_TREE;
+ tree name_decl;
+
+ {
+ tree name_name;
+
+ /* Generate the NTBS array variable. */
+ tree name_type = build_cplus_array_type
+ (build_qualified_type (char_type_node, TYPE_QUAL_CONST),
+ NULL_TREE);
+ tree name_string = tinfo_name (target);
+
+ name_name = mangle_typeinfo_string_for_type (target);
+ name_decl = build_lang_decl (VAR_DECL, name_name, name_type);
+
+ DECL_ARTIFICIAL (name_decl) = 1;
+ TREE_READONLY (name_decl) = 1;
+ TREE_STATIC (name_decl) = 1;
+ DECL_EXTERNAL (name_decl) = 0;
+ TREE_PUBLIC (name_decl) = 1;
+ comdat_linkage (name_decl);
+ /* External name of the string containing the type's name has a
+ special name. */
+ SET_DECL_ASSEMBLER_NAME (name_decl,
+ mangle_typeinfo_string_for_type (target));
+ DECL_INITIAL (name_decl) = name_string;
+ cp_finish_decl (name_decl, name_string, NULL_TREE, 0);
+ pushdecl_top_level (name_decl);
+ }
- fn = build_lang_decl (FUNCTION_DECL, fn, tmp);
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- pop_obstacks ();
+ if (TINFO_VTABLE_DECL (desc))
+ {
+ tree vtbl_ptr = TINFO_VTABLE_DECL (desc);
+ init = tree_cons (NULL_TREE, vtbl_ptr, init);
}
-
- mark_used (fn);
- fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
- expand_expr_stmt (fn);
+
+ init = tree_cons (NULL_TREE, decay_conversion (name_decl), init);
+
+ init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, nreverse (init));
+ TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
+ init = tree_cons (NULL_TREE, init, NULL_TREE);
+
+ return init;
}
-/* Build an initializer for a __class_type_info node. */
+/* Return the CONSTRUCTOR expr for a type_info of TYPE. DESC provides the
+ information about the particular type_info derivation, which adds no
+ additional fields to the type_info base. */
-static void
-expand_class_desc (tdecl, type)
- tree tdecl;
- tree type;
+static tree
+generic_initializer (desc, target)
+ tree desc;
+ tree target;
{
- tree name_string;
- tree fn, tmp;
- const char *name;
+ tree init = tinfo_base_init (desc, target);
+
+ init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, init);
+ TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
+ return init;
+}
- int i = CLASSTYPE_N_BASECLASSES (type);
- int base_cnt = 0;
- tree binfos = TYPE_BINFO_BASETYPES (type);
-#if 0
- /* See code below that used these. */
- tree vb = CLASSTYPE_VBASECLASSES (type);
- int n_base = i;
-#endif
- tree base, elems, access, offset, isvir;
- tree elt, elts = NULL_TREE;
- static tree base_info_type_node;
-
- if (base_info_type_node == NULL_TREE)
- {
- tree fields [4];
-
- /* A reasonably close approximation of __class_type_info::base_info */
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
- base_info_type_node = make_lang_type (RECORD_TYPE);
-
- /* Actually const __user_type_info * */
- fields [0] = build_lang_field_decl
- (FIELD_DECL, NULL_TREE,
- build_pointer_type (build_qualified_type
- (type_info_type_node,
- TYPE_QUAL_CONST)));
- fields [1] = build_lang_field_decl
- (FIELD_DECL, NULL_TREE, unsigned_intSI_type_node);
- DECL_BIT_FIELD (fields[1]) = 1;
- DECL_FIELD_SIZE (fields[1]) = 29;
-
- fields [2] = build_lang_field_decl
- (FIELD_DECL, NULL_TREE, boolean_type_node);
- DECL_BIT_FIELD (fields[2]) = 1;
- DECL_FIELD_SIZE (fields[2]) = 1;
-
- /* Actually enum access */
- fields [3] = build_lang_field_decl
- (FIELD_DECL, NULL_TREE, integer_type_node);
- DECL_BIT_FIELD (fields[3]) = 1;
- DECL_FIELD_SIZE (fields[3]) = 2;
-
- finish_builtin_type (base_info_type_node, "__base_info", fields,
- 3, ptr_type_node);
- pop_obstacks ();
- }
+/* Return the CONSTRUCTOR expr for a type_info of pointer TYPE.
+ DESC provides information about the particular type_info derivation,
+ which adds target type and qualifier flags members to the type_info base. */
- while (--i >= 0)
+static tree
+ptr_initializer (desc, target, non_public_ptr)
+ tree desc;
+ tree target;
+ int *non_public_ptr;
+{
+ tree init = tinfo_base_init (desc, target);
+ tree to = TREE_TYPE (target);
+ int flags = qualifier_flags (to);
+ int incomplete = target_incomplete_p (to);
+
+ if (incomplete)
{
- tree binfo = TREE_VEC_ELT (binfos, i);
-
- expand_expr_stmt (get_typeid_1 (BINFO_TYPE (binfo)));
- base = decay_conversion (get_tinfo_var (BINFO_TYPE (binfo)));
+ flags |= 8;
+ *non_public_ptr = 1;
+ }
+ init = tree_cons (NULL_TREE, build_int_2 (flags, 0), init);
+ init = tree_cons (NULL_TREE,
+ build_unary_op (ADDR_EXPR,
+ get_tinfo_decl (TYPE_MAIN_VARIANT (to)), 0),
+ init);
+
+ init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, nreverse (init));
+ TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
+ return init;
+}
- if (TREE_VIA_VIRTUAL (binfo))
- {
- tree t = BINFO_TYPE (binfo);
- const char *name;
- tree field;
-
- FORMAT_VBASE_NAME (name, t);
- field = lookup_field (type, get_identifier (name), 0, 0);
- offset = size_binop (FLOOR_DIV_EXPR,
- DECL_FIELD_BITPOS (field), size_int (BITS_PER_UNIT));
- offset = convert (sizetype, offset);
- }
- else
- offset = BINFO_OFFSET (binfo);
+/* Return the CONSTRUCTOR expr for a type_info of pointer to member data TYPE.
+ DESC provides information about the particular type_info derivation,
+ which adds class, target type and qualifier flags members to the type_info
+ base. */
- if (TREE_VIA_PUBLIC (binfo))
- access = access_public_node;
- else if (TREE_VIA_PROTECTED (binfo))
- access = access_protected_node;
- else
- access = access_private_node;
- if (TREE_VIA_VIRTUAL (binfo))
- isvir = boolean_true_node;
- else
- isvir = boolean_false_node;
-
- elt = build
- (CONSTRUCTOR, base_info_type_node, NULL_TREE, tree_cons
- (NULL_TREE, base, tree_cons
- (NULL_TREE, offset, tree_cons
- (NULL_TREE, isvir, tree_cons
- (NULL_TREE, access, NULL_TREE)))));
- TREE_HAS_CONSTRUCTOR (elt) = TREE_CONSTANT (elt) = TREE_STATIC (elt) = 1;
- elts = expr_tree_cons (NULL_TREE, elt, elts);
- base_cnt++;
+static tree
+ptm_initializer (desc, target, non_public_ptr)
+ tree desc;
+ tree target;
+ int *non_public_ptr;
+{
+ tree init = tinfo_base_init (desc, target);
+ tree to = TYPE_PTRMEM_POINTED_TO_TYPE (target);
+ tree klass = TYPE_PTRMEM_CLASS_TYPE (target);
+ int flags = qualifier_flags (to);
+ int incomplete = target_incomplete_p (to);
+
+ if (incomplete)
+ {
+ flags |= 0x8;
+ *non_public_ptr = 1;
}
-#if 0
- i = n_base;
- while (vb)
+ if (!COMPLETE_TYPE_P (klass))
{
- tree b;
- access = access_public_node;
- while (--i >= 0)
- {
- b = TREE_VEC_ELT (binfos, i);
- if (BINFO_TYPE (vb) == BINFO_TYPE (b) && TREE_VIA_VIRTUAL (b))
- {
- if (TREE_VIA_PUBLIC (b))
- access = access_public_node;
- else if (TREE_VIA_PROTECTED (b))
- access = access_protected_node;
- else
- access = access_private_node;
- break;
- }
- }
- base = build_t_desc (BINFO_TYPE (vb), 1);
- offset = BINFO_OFFSET (vb);
- isvir = build_int_2 (1, 0);
+ flags |= 0x10;
+ *non_public_ptr = 1;
+ }
+ init = tree_cons (NULL_TREE, build_int_2 (flags, 0), init);
+ init = tree_cons (NULL_TREE,
+ build_unary_op (ADDR_EXPR,
+ get_tinfo_decl (TYPE_MAIN_VARIANT (to)), 0),
+ init);
+ init = tree_cons (NULL_TREE,
+ build_unary_op (ADDR_EXPR, get_tinfo_decl (klass), 0),
+ init);
+
+ init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, nreverse (init));
+ TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
+ return init;
+}
- base_list = expr_tree_cons (NULL_TREE, base, base_list);
- isvir_list = expr_tree_cons (NULL_TREE, isvir, isvir_list);
- acc_list = expr_tree_cons (NULL_TREE, access, acc_list);
- off_list = expr_tree_cons (NULL_TREE, offset, off_list);
+/* Check base BINFO to set hint flags in *DATA, which is really an int.
+ We use CLASSTYPE_MARKED to tag types we've found as non-virtual bases and
+ CLASSTYPE_MARKED2 to tag those which are virtual bases. Remember it is
+ possible for a type to be both a virtual and non-virtual base. */
- base_cnt++;
- vb = TREE_CHAIN (vb);
+static tree
+dfs_class_hint_mark (binfo, data)
+ tree binfo;
+ void *data;
+{
+ tree basetype = BINFO_TYPE (binfo);
+ int *hint = (int *) data;
+
+ if (TREE_VIA_VIRTUAL (binfo))
+ {
+ if (CLASSTYPE_MARKED (basetype))
+ *hint |= 1;
+ if (CLASSTYPE_MARKED2 (basetype))
+ *hint |= 2;
+ SET_CLASSTYPE_MARKED2 (basetype);
+ }
+ else
+ {
+ if (CLASSTYPE_MARKED (basetype) || CLASSTYPE_MARKED2 (basetype))
+ *hint |= 1;
+ SET_CLASSTYPE_MARKED (basetype);
}
-#endif
+ if (!TREE_VIA_PUBLIC (binfo) && TYPE_BINFO (basetype) != binfo)
+ *hint |= 4;
+ return NULL_TREE;
+};
- name = build_overload_name (type, 1, 1);
- name_string = combine_strings (build_string (strlen (name)+1, name));
+/* Clear the base's dfs marks, after searching for duplicate bases. */
- {
- tree arrtype = build_array_type (base_info_type_node, NULL_TREE);
- elts = build (CONSTRUCTOR, arrtype, NULL_TREE, elts);
- TREE_HAS_CONSTRUCTOR (elts) = TREE_CONSTANT (elts)
- = TREE_STATIC (elts) = 1;
- complete_array_type (arrtype, elts, 1);
- }
+static tree
+dfs_class_hint_unmark (binfo, data)
+ tree binfo;
+ void *data ATTRIBUTE_UNUSED;
+{
+ tree basetype = BINFO_TYPE (binfo);
+
+ CLEAR_CLASSTYPE_MARKED (basetype);
+ CLEAR_CLASSTYPE_MARKED2 (basetype);
+ return NULL_TREE;
+}
- elems = tree_cons
- (NULL_TREE, decay_conversion (tdecl), tree_cons
- (NULL_TREE, decay_conversion (name_string), tree_cons
- (NULL_TREE, decay_conversion (elts), tree_cons
- (NULL_TREE, cp_convert (sizetype, build_int_2 (base_cnt, 0)),
- NULL_TREE))));
+/* Determine the hint flags describing the features of a class's hierarchy. */
- fn = get_identifier ("__rtti_class");
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- tmp = tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, const_string_type_node, tree_cons
- (NULL_TREE, build_pointer_type (base_info_type_node), tree_cons
- (NULL_TREE, sizetype, void_list_node))));
- tmp = build_function_type (void_type_node, tmp);
+static int
+class_hint_flags (type)
+ tree type;
+{
+ int hint_flags = 0;
+ int i;
+
+ dfs_walk (TYPE_BINFO (type), dfs_class_hint_mark, NULL, &hint_flags);
+ dfs_walk (TYPE_BINFO (type), dfs_class_hint_unmark, NULL, NULL);
- fn = build_lang_decl (FUNCTION_DECL, fn, tmp);
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- pop_obstacks ();
+ for (i = 0; i < CLASSTYPE_N_BASECLASSES (type); ++i)
+ {
+ tree base_binfo = BINFO_BASETYPE (TYPE_BINFO (type), i);
+
+ if (TREE_VIA_PUBLIC (base_binfo))
+ hint_flags |= 0x8;
}
+ return hint_flags;
+}
+
+/* Return the CONSTRUCTOR expr for a type_info of class TYPE.
+ DESC provides information about the particular __class_type_info derivation,
+ which adds hint flags and TRAIL initializers to the type_info base. */
- mark_used (fn);
- fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
- expand_expr_stmt (fn);
+static tree
+class_initializer (desc, target, trail)
+ tree desc;
+ tree target;
+ tree trail;
+{
+ tree init = tinfo_base_init (desc, target);
+
+ TREE_CHAIN (init) = trail;
+ init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, init);
+ TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
+ return init;
}
-/* Build an initializer for a __pointer_type_info node. */
+/* Returns non-zero if the typeinfo for type should be placed in
+ the runtime library. */
-static void
-expand_ptr_desc (tdecl, type)
- tree tdecl;
+static int
+typeinfo_in_lib_p (type)
tree type;
{
- tree t, elems, fn;
- const char *name = build_overload_name (type, 1, 1);
- tree name_string = combine_strings (build_string (strlen (name)+1, name));
+ /* The typeinfo objects for `T*' and `const T*' are in the runtime
+ library for simple types T. */
+ if (TREE_CODE (type) == POINTER_TYPE
+ && (cp_type_quals (TREE_TYPE (type)) == TYPE_QUAL_CONST
+ || cp_type_quals (TREE_TYPE (type)) == TYPE_UNQUALIFIED))
+ type = TREE_TYPE (type);
- type = TREE_TYPE (type);
- expand_expr_stmt (get_typeid_1 (type));
- t = decay_conversion (get_tinfo_var (type));
- elems = tree_cons
- (NULL_TREE, decay_conversion (tdecl), tree_cons
- (NULL_TREE, decay_conversion (name_string), tree_cons
- (NULL_TREE, t, NULL_TREE)));
-
- fn = get_identifier ("__rtti_ptr");
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
+ switch (TREE_CODE (type))
{
- tree tmp;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- tmp = tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, const_string_type_node, tree_cons
- (NULL_TREE, build_pointer_type (type_info_type_node),
- void_list_node)));
- tmp = build_function_type (void_type_node, tmp);
-
- fn = build_lang_decl (FUNCTION_DECL, fn, tmp);
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- pop_obstacks ();
+ case INTEGER_TYPE:
+ case BOOLEAN_TYPE:
+ case CHAR_TYPE:
+ case REAL_TYPE:
+ case VOID_TYPE:
+ return 1;
+
+ default:
+ return 0;
}
+}
- mark_used (fn);
- fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
- expand_expr_stmt (fn);
+/* Generate a pseudo_type_info VAR_DECL suitable for the supplied
+ TARGET_TYPE and given the REAL_NAME. This is the structure expected by
+ the runtime, and therefore has additional fields. If we need not emit a
+ definition (because the runtime must contain it), return NULL_TREE,
+ otherwise return the VAR_DECL. */
+
+static tree
+synthesize_tinfo_var (target_type, real_name)
+ tree target_type;
+ tree real_name;
+{
+ tree var_init = NULL_TREE;
+ tree var_type = NULL_TREE;
+ int non_public = 0;
+
+ switch (TREE_CODE (target_type))
+ {
+ case POINTER_TYPE:
+ if (TYPE_PTRMEM_P (target_type))
+ {
+ var_type = ptm_desc_type_node;
+ var_init = ptm_initializer (var_type, target_type, &non_public);
+ }
+ else
+ {
+ if (typeinfo_in_lib_p (target_type) && !doing_runtime)
+ /* These are in the runtime. */
+ return NULL_TREE;
+ var_type = ptr_desc_type_node;
+ var_init = ptr_initializer (var_type, target_type, &non_public);
+ }
+ break;
+ case ENUMERAL_TYPE:
+ var_type = enum_desc_type_node;
+ var_init = generic_initializer (var_type, target_type);
+ break;
+ case FUNCTION_TYPE:
+ var_type = func_desc_type_node;
+ var_init = generic_initializer (var_type, target_type);
+ break;
+ case ARRAY_TYPE:
+ var_type = ary_desc_type_node;
+ var_init = generic_initializer (var_type, target_type);
+ break;
+ case UNION_TYPE:
+ case RECORD_TYPE:
+ if (TYPE_PTRMEMFUNC_P (target_type))
+ {
+ var_type = ptm_desc_type_node;
+ var_init = ptm_initializer (var_type, target_type, &non_public);
+ }
+ else if (!COMPLETE_TYPE_P (target_type))
+ {
+ /* Emit a non-public class_type_info. */
+ non_public = 1;
+ var_type = class_desc_type_node;
+ var_init = class_initializer (var_type, target_type, NULL_TREE);
+ }
+ else if (!CLASSTYPE_N_BASECLASSES (target_type))
+ {
+ var_type = class_desc_type_node;
+ var_init = class_initializer (var_type, target_type, NULL_TREE);
+ }
+ else
+ {
+ /* if this has a single public non-virtual base, it's easier */
+ tree binfo = TYPE_BINFO (target_type);
+ int nbases = BINFO_N_BASETYPES (binfo);
+ tree base_binfos = BINFO_BASETYPES (binfo);
+ tree base_inits = NULL_TREE;
+ int is_simple = nbases == 1;
+ int ix;
+
+ /* Generate the base information initializer. */
+ for (ix = nbases; ix--;)
+ {
+ tree base_binfo = TREE_VEC_ELT (base_binfos, ix);
+ tree base_init = NULL_TREE;
+ int flags = 0;
+ tree tinfo;
+ tree offset;
+
+ if (TREE_PUBLIC (base_binfo))
+ flags |= 2;
+ tinfo = get_tinfo_decl (BINFO_TYPE (base_binfo));
+ tinfo = build_unary_op (ADDR_EXPR, tinfo, 0);
+ if (TREE_VIA_VIRTUAL (base_binfo))
+ {
+ /* We store the vtable offset at which the virtual
+ base offset can be found. */
+ offset = BINFO_VPTR_FIELD (binfo_for_vbase (BINFO_TYPE (base_binfo),
+ target_type));
+ offset = convert (sizetype, offset);
+ flags |= 1;
+ }
+ else
+ offset = BINFO_OFFSET (base_binfo);
+
+ /* is it a single public inheritance? */
+ if (is_simple && flags == 2 && integer_zerop (offset))
+ {
+ base_inits = tree_cons (NULL_TREE, tinfo, NULL_TREE);
+ break;
+ }
+ is_simple = 0;
+
+ /* combine offset and flags into one field */
+ offset = cp_build_binary_op (LSHIFT_EXPR, offset,
+ build_int_2 (8, 0));
+ offset = cp_build_binary_op (BIT_IOR_EXPR, offset,
+ build_int_2 (flags, 0));
+ base_init = tree_cons (NULL_TREE, offset, base_init);
+ base_init = tree_cons (NULL_TREE, tinfo, base_init);
+ base_init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, base_init);
+ base_inits = tree_cons (NULL_TREE, base_init, base_inits);
+ }
+
+ if (is_simple)
+ var_type = si_class_desc_type_node;
+ else
+ {
+ int hint = class_hint_flags (target_type);
+
+ base_inits = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, base_inits);
+ base_inits = tree_cons (NULL_TREE, base_inits, NULL_TREE);
+ /* Prepend the number of bases. */
+ base_inits = tree_cons (NULL_TREE,
+ build_int_2 (nbases, 0), base_inits);
+ /* Prepend the hint flags. */
+ base_inits = tree_cons (NULL_TREE,
+ build_int_2 (hint, 0), base_inits);
+ var_type = get_vmi_pseudo_type_info (nbases);
+ }
+ var_init = class_initializer (var_type, target_type, base_inits);
+ }
+ break;
+
+ default:
+ if (typeinfo_in_lib_p (target_type))
+ {
+ if (!doing_runtime)
+ /* These are guaranteed to be in the runtime. */
+ return NULL_TREE;
+ var_type = bltn_desc_type_node;
+ var_init = generic_initializer (var_type, target_type);
+ break;
+ }
+ abort ();
+ }
+
+ return create_real_tinfo_var (target_type,
+ real_name, TINFO_PSEUDO_TYPE (var_type),
+ var_init, non_public);
}
-/* Build an initializer for a __attr_type_info node. */
+/* Create the real typeinfo variable. NON_PUBLIC indicates that we cannot
+ make this variable public (comdat). */
-static void
-expand_attr_desc (tdecl, type)
- tree tdecl;
+static tree
+create_real_tinfo_var (target_type, name, type, init, non_public)
+ tree target_type;
+ tree name;
tree type;
+ tree init;
+ int non_public;
{
- tree elems, t, fn;
- const char *name = build_overload_name (type, 1, 1);
- tree name_string = combine_strings (build_string (strlen (name)+1, name));
- tree attrval = build_int_2 (TYPE_QUALS (type), 0);
-
- expand_expr_stmt (get_typeid_1 (TYPE_MAIN_VARIANT (type)));
- t = decay_conversion (get_tinfo_var (TYPE_MAIN_VARIANT (type)));
- elems = tree_cons
- (NULL_TREE, decay_conversion (tdecl), tree_cons
- (NULL_TREE, decay_conversion (name_string), tree_cons
- (NULL_TREE, attrval, expr_tree_cons (NULL_TREE, t, NULL_TREE))));
-
- fn = get_identifier ("__rtti_attr");
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
+ static int count = 0;
+ tree decl;
+ tree hidden_name;
+ char hidden[30];
+
+ /* We cannot give this the name NAME, as that already is globally
+ bound to the tinfo_decl we originally created for this type in
+ get_tinfo_decl. */
+ sprintf (hidden, "__ti_%d", count++);
+ hidden_name = get_identifier (hidden);
+
+ decl = build_lang_decl (VAR_DECL, hidden_name,
+ build_qualified_type (type, TYPE_QUAL_CONST));
+ DECL_ARTIFICIAL (decl) = 1;
+ TREE_READONLY (decl) = 1;
+ TREE_STATIC (decl) = 1;
+ DECL_EXTERNAL (decl) = 0;
+
+ if (!non_public)
{
- tree tmp;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- tmp = tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, const_string_type_node, tree_cons
- (NULL_TREE, integer_type_node, tree_cons
- (NULL_TREE, build_pointer_type (type_info_type_node),
- void_list_node))));
- tmp = build_function_type (void_type_node, tmp);
+ TREE_PUBLIC (decl) = 1;
+ if (flag_weak || !typeinfo_in_lib_p (target_type))
+ comdat_linkage (decl);
+ }
+ SET_DECL_ASSEMBLER_NAME (decl, name);
+ DECL_INITIAL (decl) = init;
+ cp_finish_decl (decl, init, NULL_TREE, 0);
+ pushdecl_top_level (decl);
+ TREE_USED (decl) = 1;
+ return decl;
+}
+
+/* Generate the RECORD_TYPE containing the data layout of a type_info
+ derivative as used by the runtime. This layout must be consistent with
+ that defined in the runtime support. Also generate the VAR_DECL for the
+ type's vtable. We explicitly manage the vtable member, and name it for
+ real type as used in the runtime. The RECORD type has a different name,
+ to avoid collisions. Return a TREE_LIST who's TINFO_PSEUDO_TYPE
+ is the generated type and TINFO_VTABLE_DECL is the vtable decl.
+
+ REAL_NAME is the runtime's name of the type. Trailing arguments are
+ additional FIELD_DECL's for the structure. The final argument must be
+ NULL. */
+
+static tree
+create_pseudo_type_info VPARAMS((const char *real_name, int ident, ...))
+{
+ tree real_type, pseudo_type;
+ char *pseudo_name;
+ tree vtable_decl;
+ int ix;
+ tree fields[10];
+ tree field_decl;
+ tree result;
+
+ VA_OPEN (ap, ident);
+ VA_FIXEDARG (ap, const char *, real_name);
+ VA_FIXEDARG (ap, int, ident);
+
+ /* Generate the pseudo type name. */
+ pseudo_name = (char *)alloca (strlen (real_name) + 30);
+ strcpy (pseudo_name, real_name);
+ strcat (pseudo_name, "_pseudo");
+ if (ident)
+ sprintf (pseudo_name + strlen (pseudo_name), "%d", ident);
- fn = build_lang_decl (FUNCTION_DECL, fn, tmp);
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- pop_obstacks ();
+ /* Get the vtable decl. */
+ real_type = xref_tag (class_type_node, get_identifier (real_name), 1);
+ if (! TYPE_SIZE (real_type))
+ {
+ /* We never saw a definition of this type, so we need to tell the
+ compiler that this is an exported class, as indeed all of the
+ __*_type_info classes are. */
+ SET_CLASSTYPE_INTERFACE_KNOWN (real_type);
+ CLASSTYPE_INTERFACE_ONLY (real_type) = 1;
}
- mark_used (fn);
- fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
- expand_expr_stmt (fn);
+ vtable_decl = get_vtable_decl (real_type, /*complete=*/1);
+ vtable_decl = build_unary_op (ADDR_EXPR, vtable_decl, 0);
+
+ /* We need to point into the middle of the vtable. */
+ vtable_decl = build (PLUS_EXPR,
+ TREE_TYPE (vtable_decl),
+ vtable_decl,
+ size_binop (MULT_EXPR,
+ size_int (2),
+ TYPE_SIZE_UNIT (vtable_entry_type)));
+ TREE_CONSTANT (vtable_decl) = 1;
+
+ /* First field is the pseudo type_info base class. */
+ fields[0] = build_decl (FIELD_DECL, NULL_TREE, ti_desc_type_node);
+
+ /* Now add the derived fields. */
+ for (ix = 0; (field_decl = va_arg (ap, tree));)
+ fields[++ix] = field_decl;
+
+ /* Create the pseudo type. */
+ pseudo_type = make_aggr_type (RECORD_TYPE);
+ finish_builtin_type (pseudo_type, pseudo_name, fields, ix, ptr_type_node);
+ TYPE_HAS_CONSTRUCTOR (pseudo_type) = 1;
+
+ result = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE);
+ TINFO_VTABLE_DECL (result) = vtable_decl;
+ TINFO_PSEUDO_TYPE (result) = pseudo_type;
+
+ VA_CLOSE (ap);
+ return result;
}
-/* Build an initializer for a type_info node that just has a name. */
+/* Return a descriptor for a vmi type with NUM_BASES bases. */
-static void
-expand_generic_desc (tdecl, type, fnname)
- tree tdecl;
- tree type;
- const char *fnname;
+static tree
+get_vmi_pseudo_type_info (num_bases)
+ int num_bases;
{
- const char *name = build_overload_name (type, 1, 1);
- tree name_string = combine_strings (build_string (strlen (name)+1, name));
- tree elems = tree_cons
- (NULL_TREE, decay_conversion (tdecl), tree_cons
- (NULL_TREE, decay_conversion (name_string), NULL_TREE));
-
- tree fn = get_identifier (fnname);
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
- {
- tree tmp;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- tmp = tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, const_string_type_node, void_list_node));
- tmp = build_function_type (void_type_node, tmp);
+ tree desc;
+ tree array_domain, base_array;
- fn = build_lang_decl (FUNCTION_DECL, fn, tmp);
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- pop_obstacks ();
+ if (TREE_VEC_LENGTH (vmi_class_desc_type_node) <= num_bases)
+ {
+ int ix;
+ tree extend = make_tree_vec (num_bases + 5);
+
+ for (ix = TREE_VEC_LENGTH (vmi_class_desc_type_node); ix--;)
+ TREE_VEC_ELT (extend, ix) = TREE_VEC_ELT (vmi_class_desc_type_node, ix);
+ vmi_class_desc_type_node = extend;
}
+ desc = TREE_VEC_ELT (vmi_class_desc_type_node, num_bases);
+
+ if (desc)
+ return desc;
+
+ /* Add number of bases and trailing array of base_class_type_info. */
+ array_domain = build_index_type (size_int (num_bases));
+ base_array = build_array_type (base_desc_type_node, array_domain);
+
+ push_nested_namespace (abi_node);
+
+ desc = create_pseudo_type_info
+ ("__vmi_class_type_info", num_bases,
+ build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
+ build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
+ build_decl (FIELD_DECL, NULL_TREE, base_array),
+ NULL);
- mark_used (fn);
- fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
- expand_expr_stmt (fn);
+ pop_nested_namespace (abi_node);
+
+ TREE_VEC_ELT (vmi_class_desc_type_node, num_bases) = desc;
+ return desc;
}
-/* Generate the code for a type_info initialization function.
- Note that we take advantage of the passage
+/* Make sure the required builtin types exist for generating the type_info
+ varable definitions. */
- 5.2.7 Type identification [expr.typeid]
-
- Whether or not the destructor is called for the type_info object at the
- end of the program is unspecified.
+static void
+create_tinfo_types ()
+{
+ tree ptr_type_info;
+
+ if (bltn_desc_type_node)
+ return;
+ push_nested_namespace (abi_node);
+
+ ptr_type_info = build_pointer_type
+ (build_qualified_type
+ (type_info_type_node, TYPE_QUAL_CONST));
+
+ /* Create the internal type_info structure. This is used as a base for
+ the other structures. */
+ {
+ tree fields[2];
+
+ ti_desc_type_node = make_aggr_type (RECORD_TYPE);
+ fields[0] = build_decl (FIELD_DECL, NULL_TREE, const_ptr_type_node);
+ fields[1] = build_decl (FIELD_DECL, NULL_TREE, const_string_type_node);
+ finish_builtin_type (ti_desc_type_node, "__type_info_pseudo",
+ fields, 1, ptr_type_node);
+ TYPE_HAS_CONSTRUCTOR (ti_desc_type_node) = 1;
+ }
+
+ /* Fundamental type_info */
+ bltn_desc_type_node = create_pseudo_type_info
+ ("__fundamental_type_info", 0,
+ NULL);
+
+ /* Array, function and enum type_info. No additional fields. */
+ ary_desc_type_node = create_pseudo_type_info
+ ("__array_type_info", 0,
+ NULL);
+ func_desc_type_node = create_pseudo_type_info
+ ("__function_type_info", 0,
+ NULL);
+ enum_desc_type_node = create_pseudo_type_info
+ ("__enum_type_info", 0,
+ NULL);
+
+ /* Class type_info. Add a flags field. */
+ class_desc_type_node = create_pseudo_type_info
+ ("__class_type_info", 0,
+ NULL);
+
+ /* Single public non-virtual base class. Add pointer to base class.
+ This is really a descendant of __class_type_info. */
+ si_class_desc_type_node = create_pseudo_type_info
+ ("__si_class_type_info", 0,
+ build_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
+ NULL);
+
+ /* Base class internal helper. Pointer to base type, offset to base,
+ flags. */
+ {
+ tree fields[2];
+
+ fields[0] = build_decl (FIELD_DECL, NULL_TREE, ptr_type_info);
+ fields[1] = build_decl (FIELD_DECL, NULL_TREE, integer_types[itk_long]);
+ base_desc_type_node = make_aggr_type (RECORD_TYPE);
+ finish_builtin_type (base_desc_type_node, "__base_class_type_info_pseudo",
+ fields, 1, ptr_type_node);
+ TYPE_HAS_CONSTRUCTOR (base_desc_type_node) = 1;
+ }
+
+ /* General hierarchy is created as necessary in this vector. */
+ vmi_class_desc_type_node = make_tree_vec (10);
+
+ /* Pointer type_info. Adds two fields, qualification mask
+ and pointer to the pointed to type. This is really a descendant of
+ __pbase_type_info. */
+ ptr_desc_type_node = create_pseudo_type_info
+ ("__pointer_type_info", 0,
+ build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
+ build_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
+ NULL);
+
+ /* Pointer to member data type_info. Add qualifications flags,
+ pointer to the member's type info and pointer to the class.
+ This is really a descendant of __pbase_type_info. */
+ ptm_desc_type_node = create_pseudo_type_info
+ ("__pointer_to_member_type_info", 0,
+ build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
+ build_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
+ build_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
+ NULL);
+
+ pop_nested_namespace (abi_node);
+}
- and don't bother to arrange for these objects to be destroyed. It
- doesn't matter, anyway, since the destructors don't do anything.
-
- This must only be called from toplevel (i.e. from finish_file)! */
+/* Emit the type_info descriptors which are guaranteed to be in the runtime
+ support. Generating them here guarantees consistency with the other
+ structures. We use the following heuristic to determine when the runtime
+ is being generated. If std::__fundamental_type_info is defined, and its
+ destructor is defined, then the runtime is being built. */
void
-synthesize_tinfo_fn (fndecl)
- tree fndecl;
+emit_support_tinfos ()
{
- tree type = TREE_TYPE (DECL_NAME (fndecl));
- tree tmp, addr, tdecl;
-
- if (at_eof)
+ static tree *const fundamentals[] =
+ {
+ &void_type_node,
+ &boolean_type_node,
+ &wchar_type_node,
+ &char_type_node, &signed_char_type_node, &unsigned_char_type_node,
+ &short_integer_type_node, &short_unsigned_type_node,
+ &integer_type_node, &unsigned_type_node,
+ &long_integer_type_node, &long_unsigned_type_node,
+ &long_long_integer_type_node, &long_long_unsigned_type_node,
+ &float_type_node, &double_type_node, &long_double_type_node,
+ 0
+ };
+ int ix;
+ tree bltn_type, dtor;
+
+ push_nested_namespace (abi_node);
+ bltn_type = xref_tag (class_type_node,
+ get_identifier ("__fundamental_type_info"), 1);
+ pop_nested_namespace (abi_node);
+ if (!COMPLETE_TYPE_P (bltn_type))
+ return;
+ dtor = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (bltn_type), 1);
+ if (DECL_EXTERNAL (dtor))
+ return;
+ doing_runtime = 1;
+ for (ix = 0; fundamentals[ix]; ix++)
{
- import_export_decl (fndecl);
- if (DECL_REALLY_EXTERN (fndecl))
- return;
+ tree bltn = *fundamentals[ix];
+ tree bltn_ptr = build_pointer_type (bltn);
+ tree bltn_const_ptr = build_pointer_type
+ (build_qualified_type (bltn, TYPE_QUAL_CONST));
+ tree tinfo;
+
+ tinfo = get_tinfo_decl (bltn);
+ TREE_USED (tinfo) = 1;
+ TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo)) = 1;
+
+ tinfo = get_tinfo_decl (bltn_ptr);
+ TREE_USED (tinfo) = 1;
+ TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo)) = 1;
+
+ tinfo = get_tinfo_decl (bltn_const_ptr);
+ TREE_USED (tinfo) = 1;
+ TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (tinfo)) = 1;
}
+}
- tdecl = get_tinfo_var (type);
- DECL_EXTERNAL (tdecl) = 0;
- TREE_STATIC (tdecl) = 1;
- DECL_COMMON (tdecl) = 1;
- TREE_USED (tdecl) = 1;
- DECL_ALIGN (tdecl) = TYPE_ALIGN (ptr_type_node);
- cp_finish_decl (tdecl, NULL_TREE, NULL_TREE, 0, 0);
-
- start_function (NULL_TREE, fndecl, NULL_TREE, 1);
- store_parm_decls ();
- clear_last_expr ();
- push_momentary ();
-
- /* If the first word of the array (the vtable) is non-zero, we've already
- initialized the object, so don't do it again. */
- addr = decay_conversion (tdecl);
- tmp = cp_convert (build_pointer_type (ptr_type_node), addr);
- tmp = build_indirect_ref (tmp, 0);
- tmp = build_binary_op (EQ_EXPR, tmp, integer_zero_node);
- expand_start_cond (tmp, 0);
-
- if (TREE_CODE (type) == FUNCTION_TYPE)
- expand_generic_desc (tdecl, type, "__rtti_func");
- else if (TREE_CODE (type) == ARRAY_TYPE)
- expand_generic_desc (tdecl, type, "__rtti_array");
- else if (TYPE_QUALS (type) != TYPE_UNQUALIFIED)
- expand_attr_desc (tdecl, type);
- else if (TREE_CODE (type) == POINTER_TYPE)
- {
- if (TREE_CODE (TREE_TYPE (type)) == OFFSET_TYPE)
- expand_generic_desc (tdecl, type, "__rtti_ptmd");
- else if (TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE)
- expand_generic_desc (tdecl, type, "__rtti_ptmf");
- else
- expand_ptr_desc (tdecl, type);
- }
- else if (TYPE_PTRMEMFUNC_P (type))
- expand_generic_desc (tdecl, type, "__rtti_ptmf");
- else if (IS_AGGR_TYPE (type))
- {
- if (CLASSTYPE_N_BASECLASSES (type) == 0)
- expand_generic_desc (tdecl, type, "__rtti_user");
- else if (! TYPE_USES_COMPLEX_INHERITANCE (type)
- && (TREE_VIA_PUBLIC
- (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), 0))))
- expand_si_desc (tdecl, type);
- else
- expand_class_desc (tdecl, type);
- }
- else if (TREE_CODE (type) == ENUMERAL_TYPE)
- expand_generic_desc (tdecl, type, "__rtti_user");
- else
- my_friendly_abort (252);
+/* Return non-zero, iff T is a type_info variable which has not had a
+ definition emitted for it. */
- expand_end_cond ();
+int
+tinfo_decl_p (t, data)
+ tree t;
+ void *data ATTRIBUTE_UNUSED;
+{
+ return TREE_CODE (t) == VAR_DECL
+ && IDENTIFIER_GLOBAL_VALUE (DECL_NAME (t)) == (t)
+ && TREE_TYPE (t) == tinfo_decl_type
+ && TREE_TYPE (DECL_NAME (t));
+}
- /* OK, now return the type_info object. */
- tmp = cp_convert (build_pointer_type (type_info_type_node), addr);
- tmp = build_indirect_ref (tmp, 0);
- c_expand_return (tmp);
- finish_function (lineno, 0, 0);
+/* Emit a suitable type_info definition for the type_info decl pointed to by
+ DECL_PTR. We emit a completely new variable, of the correct type for the
+ actual type this is describing. The DECL_ASSEMBLER_NAME of the generated
+ definition is set to that of the supplied decl, so that they can be tied
+ up. Mark the supplied decl as having been dealt with. Emitting one
+ definition might cause other definitions to be required.
+
+ We need to do things this way, because we're trying to do something like
+
+ struct B : A {
+ ...
+ };
+
+ extern const A tinfo_var;
+
+ const B tinfo_var = {...};
+
+ which is not permitted. Also, we've not necessarily seen the definition of B.
+ So we do something like the following,
+
+ extern const A tinfo_var;
+
+ struct pseudo_A {
+ const void *vtable_ptr;
+ const char *name;
+ };
+ struct pseudo_B {
+ pseudo_A base;
+ ...
+ };
+
+ const pseudo_B proxy_tinfo_var attribute((assembler_name="tinfo_var")) =
+ {
+ {&B::vtable, "..."},
+ ...
+ };
+
+ pseudo_A and pseudo_B must be layout equivalent to the real definitions in
+ the runtime. */
+
+int
+emit_tinfo_decl (decl_ptr, data)
+ tree *decl_ptr;
+ void *data ATTRIBUTE_UNUSED;
+{
+ tree tinfo_decl = *decl_ptr;
+ tree tinfo_type, decl;
+
+ my_friendly_assert (TREE_TYPE (tinfo_decl) == tinfo_decl_type, 20000121);
+ tinfo_type = TREE_TYPE (DECL_NAME (tinfo_decl));
+ my_friendly_assert (tinfo_type != NULL_TREE, 20000120);
+
+ if (!DECL_NEEDED_P (tinfo_decl))
+ return 0;
+ /* Say we've dealt with it. */
+ TREE_TYPE (DECL_NAME (tinfo_decl)) = NULL_TREE;
+
+ create_tinfo_types ();
+ decl = synthesize_tinfo_var (tinfo_type, DECL_ASSEMBLER_NAME (tinfo_decl));
+
+ return decl != 0;
}
diff --git a/contrib/gcc/cp/search.c b/contrib/gcc/cp/search.c
index fb99f8f..10ebc73 100644
--- a/contrib/gcc/cp/search.c
+++ b/contrib/gcc/cp/search.c
@@ -1,6 +1,7 @@
/* Breadth-first and depth-first routines for
searching multiple-inheritance lattice for GNU C++.
- Copyright (C) 1987, 89, 92-97, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2002 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -31,14 +32,10 @@ Boston, MA 02111-1307, USA. */
#include "rtl.h"
#include "output.h"
#include "toplev.h"
-#include "varray.h"
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-extern struct obstack *current_obstack;
-extern tree abort_fndecl;
-
#include "stack.h"
/* Obstack used for remembering decision points of breadth-first. */
@@ -77,83 +74,63 @@ pop_stack_level (stack)
#define search_level stack_level
static struct search_level *search_stack;
-static tree get_abstract_virtuals_1 PROTO((tree, int, tree));
-static tree next_baselink PROTO((tree));
-static tree get_vbase_1 PROTO((tree, tree, unsigned int *));
-static tree convert_pointer_to_vbase PROTO((tree, tree));
-static tree lookup_field_1 PROTO((tree, tree));
-static tree convert_pointer_to_single_level PROTO((tree, tree));
-static int lookup_fnfields_here PROTO((tree, tree));
-static int is_subobject_of_p PROTO((tree, tree));
-static int hides PROTO((tree, tree));
-static tree virtual_context PROTO((tree, tree, tree));
-static tree dfs_check_overlap PROTO((tree, void *));
-static tree dfs_no_overlap_yet PROTO((tree, void *));
-static int get_base_distance_recursive
- PROTO((tree, int, int, int, int *, tree *, tree,
- int, int *, int, int));
-static void expand_upcast_fixups
- PROTO((tree, tree, tree, tree, tree, tree, tree *));
-static void fixup_virtual_upcast_offsets
- PROTO((tree, tree, int, int, tree, tree, tree, tree,
- tree *));
-static tree unmarkedp PROTO((tree, void *));
-static tree marked_vtable_pathp PROTO((tree, void *));
-static tree unmarked_vtable_pathp PROTO((tree, void *));
-static tree marked_new_vtablep PROTO((tree, void *));
-static tree unmarked_new_vtablep PROTO((tree, void *));
-static tree marked_pushdecls_p PROTO((tree, void *));
-static tree unmarked_pushdecls_p PROTO((tree, void *));
-static tree dfs_debug_unmarkedp PROTO((tree, void *));
-static tree dfs_debug_mark PROTO((tree, void *));
-static tree dfs_find_vbases PROTO((tree, void *));
-static tree dfs_clear_vbase_slots PROTO((tree, void *));
-static tree dfs_init_vbase_pointers PROTO((tree, void *));
-static tree dfs_get_vbase_types PROTO((tree, void *));
-static tree dfs_push_type_decls PROTO((tree, void *));
-static tree dfs_push_decls PROTO((tree, void *));
-static tree dfs_unuse_fields PROTO((tree, void *));
-static tree add_conversions PROTO((tree, void *));
-static tree get_virtuals_named_this PROTO((tree, tree));
-static tree get_virtual_destructor PROTO((tree, void *));
-static tree tree_has_any_destructor_p PROTO((tree, void *));
-static int covariant_return_p PROTO((tree, tree));
+struct vbase_info
+{
+ /* The class dominating the hierarchy. */
+ tree type;
+ /* A pointer to a complete object of the indicated TYPE. */
+ tree decl_ptr;
+ tree inits;
+};
+
+static tree lookup_field_1 PARAMS ((tree, tree));
+static int is_subobject_of_p PARAMS ((tree, tree, tree));
+static tree dfs_check_overlap PARAMS ((tree, void *));
+static tree dfs_no_overlap_yet PARAMS ((tree, void *));
+static base_kind lookup_base_r
+ PARAMS ((tree, tree, base_access, int, int, int, tree *));
+static int dynamic_cast_base_recurse PARAMS ((tree, tree, int, tree *));
+static tree marked_pushdecls_p PARAMS ((tree, void *));
+static tree unmarked_pushdecls_p PARAMS ((tree, void *));
+static tree dfs_debug_unmarkedp PARAMS ((tree, void *));
+static tree dfs_debug_mark PARAMS ((tree, void *));
+static tree dfs_get_vbase_types PARAMS ((tree, void *));
+static tree dfs_push_type_decls PARAMS ((tree, void *));
+static tree dfs_push_decls PARAMS ((tree, void *));
+static tree dfs_unuse_fields PARAMS ((tree, void *));
+static tree add_conversions PARAMS ((tree, void *));
+static int covariant_return_p PARAMS ((tree, tree));
+static int check_final_overrider PARAMS ((tree, tree));
+static int look_for_overrides_r PARAMS ((tree, tree));
static struct search_level *push_search_level
- PROTO((struct stack_level *, struct obstack *));
+ PARAMS ((struct stack_level *, struct obstack *));
static struct search_level *pop_search_level
- PROTO((struct stack_level *));
+ PARAMS ((struct stack_level *));
static tree bfs_walk
- PROTO((tree, tree (*) (tree, void *), tree (*) (tree, void *),
+ PARAMS ((tree, tree (*) (tree, void *), tree (*) (tree, void *),
void *));
-static tree lookup_field_queue_p PROTO((tree, void *));
-static tree lookup_field_r PROTO((tree, void *));
-static tree dfs_walk_real PROTO ((tree,
- tree (*) (tree, void *),
- tree (*) (tree, void *),
- tree (*) (tree, void *),
- void *));
-static tree dfs_bfv_queue_p PROTO ((tree, void *));
-static tree dfs_bfv_helper PROTO ((tree, void *));
-static tree get_virtuals_named_this_r PROTO ((tree, void *));
-static tree context_for_name_lookup PROTO ((tree));
-static tree canonical_binfo PROTO ((tree));
-static tree shared_marked_p PROTO ((tree, void *));
-static tree shared_unmarked_p PROTO ((tree, void *));
-static int dependent_base_p PROTO ((tree));
-static tree dfs_accessible_queue_p PROTO ((tree, void *));
-static tree dfs_accessible_p PROTO ((tree, void *));
-static tree dfs_access_in_type PROTO ((tree, void *));
-static tree access_in_type PROTO ((tree, tree));
-static tree dfs_canonical_queue PROTO ((tree, void *));
-static tree dfs_assert_unmarked_p PROTO ((tree, void *));
-static void assert_canonical_unmarked PROTO ((tree));
-static int protected_accessible_p PROTO ((tree, tree, tree, tree));
-static int friend_accessible_p PROTO ((tree, tree, tree, tree));
-static void setup_class_bindings PROTO ((tree, int));
-static int template_self_reference_p PROTO ((tree, tree));
-static void expand_direct_vtbls_init_thunks PROTO((tree, tree, int));
-static void expand_indirect_vtbls_init_thunks PROTO((tree, tree, tree));
-
+static tree lookup_field_queue_p PARAMS ((tree, void *));
+static int shared_member_p PARAMS ((tree));
+static tree lookup_field_r PARAMS ((tree, void *));
+static tree canonical_binfo PARAMS ((tree));
+static tree shared_marked_p PARAMS ((tree, void *));
+static tree shared_unmarked_p PARAMS ((tree, void *));
+static int dependent_base_p PARAMS ((tree));
+static tree dfs_accessible_queue_p PARAMS ((tree, void *));
+static tree dfs_accessible_p PARAMS ((tree, void *));
+static tree dfs_access_in_type PARAMS ((tree, void *));
+static access_kind access_in_type PARAMS ((tree, tree));
+static tree dfs_canonical_queue PARAMS ((tree, void *));
+static tree dfs_assert_unmarked_p PARAMS ((tree, void *));
+static void assert_canonical_unmarked PARAMS ((tree));
+static int protected_accessible_p PARAMS ((tree, tree, tree));
+static int friend_accessible_p PARAMS ((tree, tree, tree));
+static void setup_class_bindings PARAMS ((tree, int));
+static int template_self_reference_p PARAMS ((tree, tree));
+static tree get_shared_vbase_if_not_primary PARAMS ((tree, void *));
+static tree dfs_find_vbase_instance PARAMS ((tree, void *));
+static tree dfs_get_pure_virtuals PARAMS ((tree, void *));
+static tree dfs_build_inheritance_graph_order PARAMS ((tree, void *));
/* Allocate a level of searching. */
@@ -179,8 +156,6 @@ pop_search_level (obstack)
return stack;
}
-static tree _vptr_name;
-
/* Variables for gathering statistics. */
#ifdef GATHER_STATISTICS
static int n_fields_searched;
@@ -192,314 +167,273 @@ static int n_contexts_saved;
#endif /* GATHER_STATISTICS */
-/* Get a virtual binfo that is found inside BINFO's hierarchy that is
- the same type as the type given in PARENT. To be optimal, we want
- the first one that is found by going through the least number of
- virtual bases.
-
- This uses a clever algorithm that updates *depth when we find the vbase,
- and cuts off other paths of search when they reach that depth. */
-
-static tree
-get_vbase_1 (parent, binfo, depth)
- tree parent, binfo;
- unsigned int *depth;
+/* Worker for lookup_base. BINFO is the binfo we are searching at,
+ BASE is the RECORD_TYPE we are searching for. ACCESS is the
+ required access checks. WITHIN_CURRENT_SCOPE, IS_NON_PUBLIC and
+ IS_VIRTUAL indicate how BINFO was reached from the start of the
+ search. WITHIN_CURRENT_SCOPE is true if we met the current scope,
+ or friend thereof (this allows us to determine whether a protected
+ base is accessible or not). IS_NON_PUBLIC indicates whether BINFO
+ is accessible and IS_VIRTUAL indicates if it is morally virtual.
+
+ If BINFO is of the required type, then *BINFO_PTR is examined to
+ compare with any other instance of BASE we might have already
+ discovered. *BINFO_PTR is initialized and a base_kind return value
+ indicates what kind of base was located.
+
+ Otherwise BINFO's bases are searched. */
+
+static base_kind
+lookup_base_r (binfo, base, access, within_current_scope,
+ is_non_public, is_virtual, binfo_ptr)
+ tree binfo, base;
+ base_access access;
+ int within_current_scope;
+ int is_non_public; /* inside a non-public part */
+ int is_virtual; /* inside a virtual part */
+ tree *binfo_ptr;
{
- tree binfos;
- int i, n_baselinks;
- tree rval = NULL_TREE;
-
- if (BINFO_TYPE (binfo) == parent && TREE_VIA_VIRTUAL (binfo))
+ int i;
+ tree bases;
+ base_kind found = bk_not_base;
+
+ if (access == ba_check
+ && !within_current_scope
+ && is_friend (BINFO_TYPE (binfo), current_scope ()))
{
- *depth = 0;
- return binfo;
+ within_current_scope = 1;
+ is_non_public = 0;
}
-
- *depth = *depth - 1;
-
- binfos = BINFO_BASETYPES (binfo);
- n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- /* Process base types. */
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree nrval;
-
- if (*depth == 0)
- break;
-
- nrval = get_vbase_1 (parent, base_binfo, depth);
- if (nrval)
- rval = nrval;
+
+ if (same_type_p (BINFO_TYPE (binfo), base))
+ {
+ /* We have found a base. Check against what we have found
+ already. */
+ found = bk_same_type;
+ if (is_virtual)
+ found = bk_via_virtual;
+ if (is_non_public)
+ found = bk_inaccessible;
+
+ if (!*binfo_ptr)
+ *binfo_ptr = binfo;
+ else if (!is_virtual || !tree_int_cst_equal (BINFO_OFFSET (binfo),
+ BINFO_OFFSET (*binfo_ptr)))
+ {
+ if (access != ba_any)
+ *binfo_ptr = NULL;
+ else if (!is_virtual)
+ /* Prefer a non-virtual base. */
+ *binfo_ptr = binfo;
+ found = bk_ambig;
+ }
+
+ return found;
}
- *depth = *depth+1;
- return rval;
-}
-
-/* Return the shortest path to vbase PARENT within BINFO, ignoring
- access and ambiguity. */
-
-tree
-get_vbase (parent, binfo)
- tree parent;
- tree binfo;
-{
- unsigned int d = (unsigned int)-1;
- return get_vbase_1 (parent, binfo, &d);
-}
-
-/* Convert EXPR to a virtual base class of type TYPE. We know that
- EXPR is a non-null POINTER_TYPE to RECORD_TYPE. We also know that
- the type of what expr points to has a virtual base of type TYPE. */
+
+ bases = BINFO_BASETYPES (binfo);
+ if (!bases)
+ return bk_not_base;
+
+ for (i = TREE_VEC_LENGTH (bases); i--;)
+ {
+ tree base_binfo = TREE_VEC_ELT (bases, i);
+ int this_non_public = is_non_public;
+ int this_virtual = is_virtual;
+ base_kind bk;
+
+ if (access <= ba_ignore)
+ ; /* no change */
+ else if (TREE_VIA_PUBLIC (base_binfo))
+ ; /* no change */
+ else if (access == ba_not_special)
+ this_non_public = 1;
+ else if (TREE_VIA_PROTECTED (base_binfo) && within_current_scope)
+ ; /* no change */
+ else if (is_friend (BINFO_TYPE (binfo), current_scope ()))
+ ; /* no change */
+ else
+ this_non_public = 1;
+
+ if (TREE_VIA_VIRTUAL (base_binfo))
+ this_virtual = 1;
+
+ bk = lookup_base_r (base_binfo, base,
+ access, within_current_scope,
+ this_non_public, this_virtual,
+ binfo_ptr);
-static tree
-convert_pointer_to_vbase (type, expr)
- tree type;
- tree expr;
-{
- tree vb = get_vbase (type, TYPE_BINFO (TREE_TYPE (TREE_TYPE (expr))));
- return convert_pointer_to_real (vb, expr);
+ switch (bk)
+ {
+ case bk_ambig:
+ if (access != ba_any)
+ return bk;
+ found = bk;
+ break;
+
+ case bk_inaccessible:
+ if (found == bk_not_base)
+ found = bk;
+ my_friendly_assert (found == bk_via_virtual
+ || found == bk_inaccessible, 20010723);
+
+ break;
+
+ case bk_same_type:
+ bk = bk_proper_base;
+ /* FALLTHROUGH */
+ case bk_proper_base:
+ my_friendly_assert (found == bk_not_base, 20010723);
+ found = bk;
+ break;
+
+ case bk_via_virtual:
+ if (found != bk_ambig)
+ found = bk;
+ break;
+
+ case bk_not_base:
+ break;
+ }
+ }
+ return found;
}
-/* Check whether the type given in BINFO is derived from PARENT. If
- it isn't, return 0. If it is, but the derivation is MI-ambiguous
- AND protect != 0, emit an error message and return error_mark_node.
+/* Lookup BASE in the hierarchy dominated by T. Do access checking as
+ ACCESS specifies. Return the binfo we discover (which might not be
+ canonical). If KIND_PTR is non-NULL, fill with information about
+ what kind of base we discovered.
- Otherwise, if TYPE is derived from PARENT, return the actual base
- information, unless a one of the protection violations below
- occurs, in which case emit an error message and return error_mark_node.
-
- If PROTECT is 1, then check if access to a public field of PARENT
- would be private. Also check for ambiguity. */
+ If ba_quiet bit is set in ACCESS, then do not issue an error, and
+ return NULL_TREE for failure. */
tree
-get_binfo (parent, binfo, protect)
- register tree parent, binfo;
- int protect;
+lookup_base (t, base, access, kind_ptr)
+ tree t, base;
+ base_access access;
+ base_kind *kind_ptr;
{
- tree type = NULL_TREE;
- int dist;
- tree rval = NULL_TREE;
+ tree binfo = NULL; /* The binfo we've found so far. */
+ base_kind bk;
- if (TREE_CODE (parent) == TREE_VEC)
- parent = BINFO_TYPE (parent);
- else if (! IS_AGGR_TYPE_CODE (TREE_CODE (parent)))
- my_friendly_abort (89);
-
- if (TREE_CODE (binfo) == TREE_VEC)
- type = BINFO_TYPE (binfo);
- else if (IS_AGGR_TYPE_CODE (TREE_CODE (binfo)))
- type = binfo;
- else
- my_friendly_abort (90);
-
- dist = get_base_distance (parent, binfo, protect, &rval);
-
- if (dist == -3)
+ if (t == error_mark_node || base == error_mark_node)
{
- cp_error ("fields of `%T' are inaccessible in `%T' due to private inheritance",
- parent, type);
+ if (kind_ptr)
+ *kind_ptr = bk_not_base;
return error_mark_node;
}
- else if (dist == -2 && protect)
+ my_friendly_assert (TYPE_P (t) && TYPE_P (base), 20011127);
+
+ /* Ensure that the types are instantiated. */
+ t = complete_type (TYPE_MAIN_VARIANT (t));
+ base = complete_type (TYPE_MAIN_VARIANT (base));
+
+ bk = lookup_base_r (TYPE_BINFO (t), base, access & ~ba_quiet,
+ 0, 0, 0, &binfo);
+
+ switch (bk)
{
- cp_error ("type `%T' is ambiguous base class for type `%T'", parent,
- type);
- return error_mark_node;
+ case bk_inaccessible:
+ binfo = NULL_TREE;
+ if (!(access & ba_quiet))
+ {
+ error ("`%T' is an inaccessible base of `%T'", base, t);
+ binfo = error_mark_node;
+ }
+ break;
+ case bk_ambig:
+ if (access != ba_any)
+ {
+ binfo = NULL_TREE;
+ if (!(access & ba_quiet))
+ {
+ error ("`%T' is an ambiguous base of `%T'", base, t);
+ binfo = error_mark_node;
+ }
+ }
+ break;
+ default:;
}
-
- return rval;
+
+ if (kind_ptr)
+ *kind_ptr = bk;
+
+ return binfo;
}
-/* This is the newer depth first get_base_distance routine. */
+/* Worker function for get_dynamic_cast_base_type. */
static int
-get_base_distance_recursive (binfo, depth, is_private, rval,
- rval_private_ptr, new_binfo_ptr, parent,
- protect, via_virtual_ptr, via_virtual,
- current_scope_in_chain)
+dynamic_cast_base_recurse (subtype, binfo, via_virtual, offset_ptr)
+ tree subtype;
tree binfo;
- int depth, is_private, rval;
- int *rval_private_ptr;
- tree *new_binfo_ptr, parent;
- int protect, *via_virtual_ptr, via_virtual;
- int current_scope_in_chain;
+ int via_virtual;
+ tree *offset_ptr;
{
tree binfos;
int i, n_baselinks;
-
- if (protect
- && !current_scope_in_chain
- && is_friend (BINFO_TYPE (binfo), current_scope ()))
- current_scope_in_chain = 1;
-
- if (BINFO_TYPE (binfo) == parent || binfo == parent)
+ int worst = -2;
+
+ if (BINFO_TYPE (binfo) == subtype)
{
- int better = 0;
-
- if (rval == -1)
- /* This is the first time we've found parent. */
- better = 1;
- else if (tree_int_cst_equal (BINFO_OFFSET (*new_binfo_ptr),
- BINFO_OFFSET (binfo))
- && *via_virtual_ptr && via_virtual)
- {
- /* A new path to the same vbase. If this one has better
- access or is shorter, take it. */
-
- if (protect)
- better = *rval_private_ptr - is_private;
- if (better == 0)
- better = rval - depth;
- }
+ if (via_virtual)
+ return -1;
else
- {
- /* Ambiguous base class. */
- rval = depth = -2;
-
- /* If we get an ambiguity between virtual and non-virtual base
- class, return the non-virtual in case we are ignoring
- ambiguity. */
- better = *via_virtual_ptr - via_virtual;
- }
-
- if (better > 0)
- {
- rval = depth;
- *rval_private_ptr = is_private;
- *new_binfo_ptr = binfo;
- *via_virtual_ptr = via_virtual;
- }
-
- return rval;
+ {
+ *offset_ptr = BINFO_OFFSET (binfo);
+ return 0;
+ }
}
-
+
binfos = BINFO_BASETYPES (binfo);
n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- depth += 1;
-
- /* Process base types. */
for (i = 0; i < n_baselinks; i++)
{
tree base_binfo = TREE_VEC_ELT (binfos, i);
+ int rval;
+
+ if (!TREE_VIA_PUBLIC (base_binfo))
+ continue;
+ rval = dynamic_cast_base_recurse
+ (subtype, base_binfo,
+ via_virtual || TREE_VIA_VIRTUAL (base_binfo), offset_ptr);
+ if (worst == -2)
+ worst = rval;
+ else if (rval >= 0)
+ worst = worst >= 0 ? -3 : worst;
+ else if (rval == -1)
+ worst = -1;
+ else if (rval == -3 && worst != -1)
+ worst = -3;
+ }
+ return worst;
+}
+
+/* The dynamic cast runtime needs a hint about how the static SUBTYPE type
+ started from is related to the required TARGET type, in order to optimize
+ the inheritance graph search. This information is independent of the
+ current context, and ignores private paths, hence get_base_distance is
+ inappropriate. Return a TREE specifying the base offset, BOFF.
+ BOFF >= 0, there is only one public non-virtual SUBTYPE base at offset BOFF,
+ and there are no public virtual SUBTYPE bases.
+ BOFF == -1, SUBTYPE occurs as multiple public virtual or non-virtual bases.
+ BOFF == -2, SUBTYPE is not a public base.
+ BOFF == -3, SUBTYPE occurs as multiple public non-virtual bases. */
- int via_private
- = (protect
- && (is_private
- || (!TREE_VIA_PUBLIC (base_binfo)
- && !(TREE_VIA_PROTECTED (base_binfo)
- && current_scope_in_chain)
- && !is_friend (BINFO_TYPE (binfo), current_scope ()))));
- int this_virtual = via_virtual || TREE_VIA_VIRTUAL (base_binfo);
-
- rval = get_base_distance_recursive (base_binfo, depth, via_private,
- rval, rval_private_ptr,
- new_binfo_ptr, parent,
- protect, via_virtual_ptr,
- this_virtual,
- current_scope_in_chain);
-
- /* If we've found a non-virtual, ambiguous base class, we don't need
- to keep searching. */
- if (rval == -2 && *via_virtual_ptr == 0)
- return rval;
- }
-
- return rval;
-}
-
-/* Return the number of levels between type PARENT and the type given
- in BINFO, following the leftmost path to PARENT not found along a
- virtual path, if there are no real PARENTs (all come from virtual
- base classes), then follow the shortest public path to PARENT.
-
- Return -1 if TYPE is not derived from PARENT.
- Return -2 if PARENT is an ambiguous base class of TYPE, and PROTECT is
- non-negative.
- Return -3 if PARENT is private to TYPE, and PROTECT is non-zero.
-
- If PATH_PTR is non-NULL, then also build the list of types
- from PARENT to TYPE, with TREE_VIA_VIRTUAL and TREE_VIA_PUBLIC
- set.
-
- PARENT can also be a binfo, in which case that exact parent is found
- and no other. convert_pointer_to_real uses this functionality.
-
- If BINFO is a binfo, its BINFO_INHERITANCE_CHAIN will be left alone. */
-
-int
-get_base_distance (parent, binfo, protect, path_ptr)
- register tree parent, binfo;
- int protect;
- tree *path_ptr;
-{
- int rval;
- int rval_private = 0;
- tree type = NULL_TREE;
- tree new_binfo = NULL_TREE;
- int via_virtual;
- int watch_access = protect;
-
- /* Should we be completing types here? */
- if (TREE_CODE (parent) != TREE_VEC)
- parent = complete_type (TYPE_MAIN_VARIANT (parent));
- else
- complete_type (TREE_TYPE (parent));
-
- if (TREE_CODE (binfo) == TREE_VEC)
- type = BINFO_TYPE (binfo);
- else if (IS_AGGR_TYPE_CODE (TREE_CODE (binfo)))
- {
- type = complete_type (binfo);
- binfo = TYPE_BINFO (type);
-
- if (path_ptr)
- my_friendly_assert (BINFO_INHERITANCE_CHAIN (binfo) == NULL_TREE,
- 980827);
- }
- else
- my_friendly_abort (92);
-
- if (parent == type || parent == binfo)
- {
- /* If the distance is 0, then we don't really need
- a path pointer, but we shouldn't let garbage go back. */
- if (path_ptr)
- *path_ptr = binfo;
- return 0;
- }
-
- if (path_ptr)
- watch_access = 1;
-
- rval = get_base_distance_recursive (binfo, 0, 0, -1,
- &rval_private, &new_binfo, parent,
- watch_access, &via_virtual, 0,
- 0);
-
- /* Access restrictions don't count if we found an ambiguous basetype. */
- if (rval == -2 && protect >= 0)
- rval_private = 0;
-
- if (rval && protect && rval_private)
- return -3;
-
- /* If they gave us the real vbase binfo, which isn't in the main binfo
- tree, deal with it. This happens when we are called from
- expand_upcast_fixups. */
- if (rval == -1 && TREE_CODE (parent) == TREE_VEC
- && parent == binfo_member (BINFO_TYPE (parent),
- CLASSTYPE_VBASECLASSES (type)))
- {
- my_friendly_assert (BINFO_INHERITANCE_CHAIN (parent) == binfo, 980827);
- new_binfo = parent;
- rval = 1;
- }
-
- if (path_ptr)
- *path_ptr = new_binfo;
- return rval;
+tree
+get_dynamic_cast_base_type (subtype, target)
+ tree subtype;
+ tree target;
+{
+ tree offset = NULL_TREE;
+ int boff = dynamic_cast_base_recurse (subtype, TYPE_BINFO (target),
+ 0, &offset);
+
+ if (!boff)
+ return offset;
+ offset = build_int_2 (boff, -1);
+ TREE_TYPE (offset) = ssizetype;
+ return offset;
}
/* Search for a member with name NAME in a multiple inheritance lattice
@@ -518,13 +452,51 @@ lookup_field_1 (type, name)
register tree field;
if (TREE_CODE (type) == TEMPLATE_TYPE_PARM
- || TREE_CODE (type) == TEMPLATE_TEMPLATE_PARM)
- /* The TYPE_FIELDS of a TEMPLATE_TYPE_PARM are not fields at all;
+ || TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM
+ || TREE_CODE (type) == TYPENAME_TYPE)
+ /* The TYPE_FIELDS of a TEMPLATE_TYPE_PARM and
+ BOUND_TEMPLATE_TEMPLATE_PARM are not fields at all;
instead TYPE_FIELDS is the TEMPLATE_PARM_INDEX. (Miraculously,
the code often worked even when we treated the index as a list
- of fields!) */
+ of fields!)
+ The TYPE_FIELDS of TYPENAME_TYPE is its TYPENAME_TYPE_FULLNAME. */
return NULL_TREE;
+ if (TYPE_NAME (type)
+ && DECL_LANG_SPECIFIC (TYPE_NAME (type))
+ && DECL_SORTED_FIELDS (TYPE_NAME (type)))
+ {
+ tree *fields = &TREE_VEC_ELT (DECL_SORTED_FIELDS (TYPE_NAME (type)), 0);
+ int lo = 0, hi = TREE_VEC_LENGTH (DECL_SORTED_FIELDS (TYPE_NAME (type)));
+ int i;
+
+ while (lo < hi)
+ {
+ i = (lo + hi) / 2;
+
+#ifdef GATHER_STATISTICS
+ n_fields_searched++;
+#endif /* GATHER_STATISTICS */
+
+ if (DECL_NAME (fields[i]) > name)
+ hi = i;
+ else if (DECL_NAME (fields[i]) < name)
+ lo = i + 1;
+ else
+ {
+ /* We might have a nested class and a field with the
+ same name; we sorted them appropriately via
+ field_decl_cmp, so just look for the last field with
+ this name. */
+ while (i + 1 < hi
+ && DECL_NAME (fields[i+1]) == name)
+ ++i;
+ return fields[i];
+ }
+ }
+ return NULL_TREE;
+ }
+
field = TYPE_FIELDS (type);
#ifdef GATHER_STATISTICS
@@ -535,9 +507,9 @@ lookup_field_1 (type, name)
#ifdef GATHER_STATISTICS
n_fields_searched++;
#endif /* GATHER_STATISTICS */
- my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (field)) == 'd', 0);
+ my_friendly_assert (DECL_P (field), 0);
if (DECL_NAME (field) == NULL_TREE
- && TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
+ && ANON_AGGR_TYPE_P (TREE_TYPE (field)))
{
tree temp = lookup_field_1 (TREE_TYPE (field), name);
if (temp)
@@ -551,21 +523,15 @@ lookup_field_1 (type, name)
from TYPE_FIELDS anyhow; see handle_using_decl. */
;
else if (DECL_NAME (field) == name)
- {
- if ((TREE_CODE(field) == VAR_DECL || TREE_CODE(field) == CONST_DECL)
- && DECL_ASSEMBLER_NAME (field) != NULL)
- GNU_xref_ref(current_function_decl,
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (field)));
- return field;
- }
+ return field;
field = TREE_CHAIN (field);
}
/* Not found. */
- if (name == _vptr_name)
+ if (name == vptr_identifier)
{
/* Give the user what s/he thinks s/he wants. */
- if (TYPE_VIRTUAL_P (type))
- return CLASSTYPE_VFIELD (type);
+ if (TYPE_POLYMORPHIC_P (type))
+ return TYPE_VFIELD (type);
}
return NULL_TREE;
}
@@ -593,15 +559,31 @@ current_scope ()
return current_class_type;
if (current_class_type == NULL_TREE)
return current_function_decl;
- if (DECL_CLASS_CONTEXT (current_function_decl) == current_class_type)
+ if ((DECL_FUNCTION_MEMBER_P (current_function_decl)
+ && same_type_p (DECL_CONTEXT (current_function_decl),
+ current_class_type))
+ || (DECL_FRIEND_CONTEXT (current_function_decl)
+ && same_type_p (DECL_FRIEND_CONTEXT (current_function_decl),
+ current_class_type)))
return current_function_decl;
return current_class_type;
}
+/* Returns non-zero if we are currently in a function scope. Note
+ that this function returns zero if we are within a local class, but
+ not within a member function body of the local class. */
+
+int
+at_function_scope_p ()
+{
+ tree cs = current_scope ();
+ return cs && TREE_CODE (cs) == FUNCTION_DECL;
+}
+
/* Return the scope of DECL, as appropriate when doing name-lookup. */
-static tree
+tree
context_for_name_lookup (decl)
tree decl;
{
@@ -609,11 +591,11 @@ context_for_name_lookup (decl)
For the purposes of name lookup, after the anonymous union
definition, the members of the anonymous union are considered to
- have been defined in the scope in which teh anonymous union is
+ have been defined in the scope in which the anonymous union is
declared. */
- tree context = DECL_REAL_CONTEXT (decl);
+ tree context = DECL_CONTEXT (decl);
- while (TYPE_P (context) && ANON_UNION_TYPE_P (context))
+ while (context && TYPE_P (context) && ANON_AGGR_TYPE_P (context))
context = TYPE_CONTEXT (context);
if (!context)
context = global_namespace;
@@ -673,7 +655,7 @@ shared_marked_p (binfo, data)
void *data;
{
binfo = canonical_binfo (binfo);
- return markedp (binfo, data) ? binfo : NULL_TREE;
+ return markedp (binfo, data);
}
/* If BINFO is not marked, return a canonical version of BINFO.
@@ -685,9 +667,21 @@ shared_unmarked_p (binfo, data)
void *data;
{
binfo = canonical_binfo (binfo);
- return unmarkedp (binfo, data) ? binfo : NULL_TREE;
+ return unmarkedp (binfo, data);
}
+/* The accessibility routines use BINFO_ACCESS for scratch space
+ during the computation of the accssibility of some declaration. */
+
+#define BINFO_ACCESS(NODE) \
+ ((access_kind) ((TREE_LANG_FLAG_1 (NODE) << 1) | TREE_LANG_FLAG_6 (NODE)))
+
+/* Set the access associated with NODE to ACCESS. */
+
+#define SET_BINFO_ACCESS(NODE, ACCESS) \
+ ((TREE_LANG_FLAG_1 (NODE) = ((ACCESS) & 2) != 0), \
+ (TREE_LANG_FLAG_6 (NODE) = ((ACCESS) & 1) != 0))
+
/* Called from access_in_type via dfs_walk. Calculate the access to
DATA (which is really a DECL) in BINFO. */
@@ -698,18 +692,18 @@ dfs_access_in_type (binfo, data)
{
tree decl = (tree) data;
tree type = BINFO_TYPE (binfo);
- tree access = NULL_TREE;
+ access_kind access = ak_none;
if (context_for_name_lookup (decl) == type)
{
/* If we have desceneded to the scope of DECL, just note the
appropriate access. */
if (TREE_PRIVATE (decl))
- access = access_private_node;
+ access = ak_private;
else if (TREE_PROTECTED (decl))
- access = access_protected_node;
+ access = ak_protected;
else
- access = access_public_node;
+ access = ak_public;
}
else
{
@@ -717,11 +711,12 @@ dfs_access_in_type (binfo, data)
access to the DECL. The CONST_DECL for an enumeration
constant will not have DECL_LANG_SPECIFIC, and thus no
DECL_ACCESS. */
- if (DECL_LANG_SPECIFIC (decl))
+ if (DECL_LANG_SPECIFIC (decl) && !DECL_DISCRIMINATOR_P (decl))
{
- access = purpose_member (type, DECL_ACCESS (decl));
- if (access)
- access = TREE_VALUE (access);
+ tree decl_access = purpose_member (type, DECL_ACCESS (decl));
+ if (decl_access)
+ access = ((access_kind)
+ TREE_INT_CST_LOW (TREE_VALUE (decl_access)));
}
if (!access)
@@ -737,35 +732,36 @@ dfs_access_in_type (binfo, data)
for (i = 0; i < n_baselinks; ++i)
{
tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree base_access = TREE_CHAIN (canonical_binfo (base_binfo));
+ access_kind base_access
+ = BINFO_ACCESS (canonical_binfo (base_binfo));
- if (!base_access || base_access == access_private_node)
+ if (base_access == ak_none || base_access == ak_private)
/* If it was not accessible in the base, or only
accessible as a private member, we can't access it
all. */
- base_access = NULL_TREE;
+ base_access = ak_none;
else if (TREE_VIA_PROTECTED (base_binfo))
/* Public and protected members in the base are
protected here. */
- base_access = access_protected_node;
+ base_access = ak_protected;
else if (!TREE_VIA_PUBLIC (base_binfo))
/* Public and protected members in the base are
private here. */
- base_access = access_private_node;
+ base_access = ak_private;
/* See if the new access, via this base, gives more
access than our previous best access. */
- if (base_access &&
- (base_access == access_public_node
- || (base_access == access_protected_node
- && access != access_public_node)
- || (base_access == access_private_node
- && !access)))
+ if (base_access != ak_none
+ && (base_access == ak_public
+ || (base_access == ak_protected
+ && access != ak_public)
+ || (base_access == ak_private
+ && access == ak_none)))
{
access = base_access;
/* If the new access is public, we can't do better. */
- if (access == access_public_node)
+ if (access == ak_public)
break;
}
}
@@ -773,7 +769,7 @@ dfs_access_in_type (binfo, data)
}
/* Note the access to DECL in TYPE. */
- TREE_CHAIN (binfo) = access;
+ SET_BINFO_ACCESS (binfo, access);
/* Mark TYPE as visited so that if we reach it again we do not
duplicate our efforts here. */
@@ -784,7 +780,7 @@ dfs_access_in_type (binfo, data)
/* Return the access to DECL in TYPE. */
-static tree
+static access_kind
access_in_type (type, decl)
tree type;
tree decl;
@@ -806,7 +802,7 @@ access_in_type (type, decl)
dfs_walk (binfo, dfs_unmark, shared_marked_p, 0);
assert_canonical_unmarked (binfo);
- return TREE_CHAIN (binfo);
+ return BINFO_ACCESS (binfo);
}
/* Called from dfs_accessible_p via dfs_walk. */
@@ -837,33 +833,29 @@ dfs_accessible_p (binfo, data)
void *data;
{
int protected_ok = data != 0;
- tree access;
+ access_kind access;
- /* We marked the binfos while computing the access in each type.
- So, we unmark as we go now. */
SET_BINFO_MARKED (binfo);
-
- access = TREE_CHAIN (binfo);
- if (access == access_public_node
- || (access == access_protected_node && protected_ok))
+ access = BINFO_ACCESS (binfo);
+ if (access == ak_public || (access == ak_protected && protected_ok))
return binfo;
- else if (access && is_friend (BINFO_TYPE (binfo), current_scope ()))
+ else if (access != ak_none
+ && is_friend (BINFO_TYPE (binfo), current_scope ()))
return binfo;
return NULL_TREE;
}
-/* Returns non-zero if it is OK to access DECL when named in TYPE
- through an object indiated by BINFO in the context of DERIVED. */
+/* Returns non-zero if it is OK to access DECL through an object
+ indiated by BINFO in the context of DERIVED. */
static int
-protected_accessible_p (type, decl, derived, binfo)
- tree type;
+protected_accessible_p (decl, derived, binfo)
tree decl;
tree derived;
tree binfo;
{
- tree access;
+ access_kind access;
/* We're checking this clause from [class.access.base]
@@ -872,19 +864,23 @@ protected_accessible_p (type, decl, derived, binfo)
class P derived from N, where m as a member of P is private or
protected.
- If DERIVED isn't derived from TYPE, then it certainly does not
- apply. */
- if (!DERIVED_FROM_P (type, derived))
+ Here DERIVED is a possible P and DECL is m. accessible_p will
+ iterate over various values of N, but the access to m in DERIVED
+ does not change.
+
+ Note that I believe that the passage above is wrong, and should read
+ "...is private or protected or public"; otherwise you get bizarre results
+ whereby a public using-decl can prevent you from accessing a protected
+ member of a base. (jason 2000/02/28) */
+
+ /* If DERIVED isn't derived from m's class, then it can't be a P. */
+ if (!DERIVED_FROM_P (context_for_name_lookup (decl), derived))
return 0;
access = access_in_type (derived, decl);
- if (same_type_p (derived, type))
- {
- if (access != access_private_node)
- return 0;
- }
- else if (access != access_private_node
- && access != access_protected_node)
+
+ /* If m is inaccessible in DERIVED, then it's not a P. */
+ if (access == ak_none)
return 0;
/* [class.protected]
@@ -892,7 +888,7 @@ protected_accessible_p (type, decl, derived, binfo)
When a friend or a member function of a derived class references
a protected nonstatic member of a base class, an access check
applies in addition to those described earlier in clause
- _class.access_.4) Except when forming a pointer to member
+ _class.access_) Except when forming a pointer to member
(_expr.unary.op_), the access must be through a pointer to,
reference to, or object of the derived class itself (or any class
derived from that class) (_expr.ref_). If the access is to form
@@ -914,13 +910,11 @@ protected_accessible_p (type, decl, derived, binfo)
}
/* Returns non-zero if SCOPE is a friend of a type which would be able
- to acces DECL, named in TYPE, through the object indicated by
- BINFO. */
+ to access DECL through the object indicated by BINFO. */
static int
-friend_accessible_p (scope, type, decl, binfo)
+friend_accessible_p (scope, decl, binfo)
tree scope;
- tree type;
tree decl;
tree binfo;
{
@@ -939,32 +933,71 @@ friend_accessible_p (scope, type, decl, binfo)
return 0;
for (t = befriending_classes; t; t = TREE_CHAIN (t))
- if (protected_accessible_p (type, decl, TREE_VALUE (t), binfo))
+ if (protected_accessible_p (decl, TREE_VALUE (t), binfo))
return 1;
+ /* Nested classes are implicitly friends of their enclosing types, as
+ per core issue 45 (this is a change from the standard). */
+ if (TYPE_P (scope))
+ for (t = TYPE_CONTEXT (scope); t && TYPE_P (t); t = TYPE_CONTEXT (t))
+ if (protected_accessible_p (decl, t, binfo))
+ return 1;
+
if (TREE_CODE (scope) == FUNCTION_DECL
|| DECL_FUNCTION_TEMPLATE_P (scope))
{
/* Perhaps this SCOPE is a member of a class which is a
friend. */
- if (friend_accessible_p (DECL_CLASS_CONTEXT (scope), type,
- decl, binfo))
+ if (DECL_CLASS_SCOPE_P (decl)
+ && friend_accessible_p (DECL_CONTEXT (scope), decl, binfo))
return 1;
/* Or an instantiation of something which is a friend. */
if (DECL_TEMPLATE_INFO (scope))
- return friend_accessible_p (DECL_TI_TEMPLATE (scope),
- type, decl, binfo);
+ return friend_accessible_p (DECL_TI_TEMPLATE (scope), decl, binfo);
}
else if (CLASSTYPE_TEMPLATE_INFO (scope))
- return friend_accessible_p (CLASSTYPE_TI_TEMPLATE (scope),
- type, decl, binfo);
+ return friend_accessible_p (CLASSTYPE_TI_TEMPLATE (scope), decl, binfo);
return 0;
}
-
+
+/* Perform access control on TYPE_DECL VAL, which was looked up in TYPE.
+ This is fairly complex, so here's the design:
+
+ The lang_extdef nonterminal sets type_lookups to NULL_TREE before we
+ start to process a top-level declaration.
+ As we process the decl-specifier-seq for the declaration, any types we
+ see that might need access control are passed to type_access_control,
+ which defers checking by adding them to type_lookups.
+ When we are done with the decl-specifier-seq, we record the lookups we've
+ seen in the lookups field of the typed_declspecs nonterminal.
+ When we process the first declarator, either in parse_decl or
+ begin_function_definition, we call save_type_access_control,
+ which stores the lookups from the decl-specifier-seq in
+ current_type_lookups.
+ As we finish with each declarator, we process everything in type_lookups
+ via decl_type_access_control, which resets type_lookups to the value of
+ current_type_lookups for subsequent declarators.
+ When we enter a function, we set type_lookups to error_mark_node, so all
+ lookups are processed immediately. */
+
+void
+type_access_control (type, val)
+ tree type, val;
+{
+ if (val == NULL_TREE || TREE_CODE (val) != TYPE_DECL
+ || ! DECL_CLASS_SCOPE_P (val))
+ return;
+
+ if (type_lookups == error_mark_node)
+ enforce_access (type, val);
+ else if (! accessible_p (type, val))
+ type_lookups = tree_cons (type, val, type_lookups);
+}
+
/* DECL is a declaration from a base class of TYPE, which was the
- classs used to name DECL. Return non-zero if, in the current
+ class used to name DECL. Return non-zero if, in the current
context, DECL is accessible. If TYPE is actually a BINFO node,
then we can tell in what context the access is occurring by looking
at the most derived class along the path indicated by BINFO. */
@@ -991,10 +1024,6 @@ accessible_p (type, decl)
if (!TYPE_P (context_for_name_lookup (decl)))
return 1;
- /* We don't do access control for types yet. */
- if (TREE_CODE (decl) == TYPE_DECL)
- return 1;
-
if (!TYPE_P (type))
{
binfo = type;
@@ -1024,19 +1053,16 @@ accessible_p (type, decl)
/* Figure out where the reference is occurring. Check to see if
DECL is private or protected in this scope, since that will
- determine whether protected access in TYPE allowed. */
+ determine whether protected access is allowed. */
if (current_class_type)
- protected_ok
- = protected_accessible_p (type, decl, current_class_type,
- binfo);
+ protected_ok = protected_accessible_p (decl, current_class_type, binfo);
/* Now, loop through the classes of which we are a friend. */
if (!protected_ok)
- protected_ok = friend_accessible_p (current_scope (),
- type, decl, binfo);
+ protected_ok = friend_accessible_p (current_scope (), decl, binfo);
- /* Standardize on the same that will access_in_type will use. We
- don't need to know what path was chosen from this point onwards. */
+ /* Standardize the binfo that access_in_type will use. We don't
+ need to know what path was chosen from this point onwards. */
binfo = TYPE_BINFO (type);
/* Compute the accessibility of DECL in the class hierarchy
@@ -1058,30 +1084,23 @@ accessible_p (type, decl)
/* Routine to see if the sub-object denoted by the binfo PARENT can be
found as a base class and sub-object of the object denoted by
- BINFO. This routine relies upon binfos not being shared, except
- for binfos for virtual bases. */
+ BINFO. MOST_DERIVED is the most derived type of the hierarchy being
+ searched. */
static int
-is_subobject_of_p (parent, binfo)
- tree parent, binfo;
+is_subobject_of_p (parent, binfo, most_derived)
+ tree parent, binfo, most_derived;
{
tree binfos;
int i, n_baselinks;
- /* We want to canonicalize for comparison purposes. But, when we
- iterate through basetypes later, we want the binfos from the
- original hierarchy. That's why we have to calculate BINFOS
- first, and then canonicalize. */
- binfos = BINFO_BASETYPES (binfo);
- parent = canonical_binfo (parent);
- binfo = canonical_binfo (binfo);
-
if (parent == binfo)
return 1;
+ binfos = BINFO_BASETYPES (binfo);
n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- /* Process and/or queue base types. */
+ /* Iterate the base types. */
for (i = 0; i < n_baselinks; i++)
{
tree base_binfo = TREE_VEC_ELT (binfos, i);
@@ -1090,56 +1109,14 @@ is_subobject_of_p (parent, binfo)
class there's no way to descend into it. */
continue;
- if (is_subobject_of_p (parent, base_binfo))
+ if (is_subobject_of_p (parent,
+ CANONICAL_BINFO (base_binfo, most_derived),
+ most_derived))
return 1;
}
return 0;
}
-/* See if a one FIELD_DECL hides another. This routine is meant to
- correspond to ANSI working paper Sept 17, 1992 10p4. The two
- binfos given are the binfos corresponding to the particular places
- the FIELD_DECLs are found. This routine relies upon binfos not
- being shared, except for virtual bases. */
-
-static int
-hides (hider_binfo, hidee_binfo)
- tree hider_binfo, hidee_binfo;
-{
- /* hider hides hidee, if hider has hidee as a base class and
- the instance of hidee is a sub-object of hider. The first
- part is always true is the second part is true.
-
- When hider and hidee are the same (two ways to get to the exact
- same member) we consider either one as hiding the other. */
- return is_subobject_of_p (hidee_binfo, hider_binfo);
-}
-
-/* Very similar to lookup_fnfields_1 but it ensures that at least one
- function was declared inside the class given by TYPE. It really should
- only return functions that match the given TYPE. */
-
-static int
-lookup_fnfields_here (type, name)
- tree type, name;
-{
- int idx = lookup_fnfields_1 (type, name);
- tree fndecls;
-
- /* ctors and dtors are always only in the right class. */
- if (idx <= 1)
- return idx;
- fndecls = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), idx);
- while (fndecls)
- {
- if (TYPE_MAIN_VARIANT (DECL_CLASS_CONTEXT (OVL_CURRENT (fndecls)))
- == TYPE_MAIN_VARIANT (type))
- return idx;
- fndecls = OVL_CHAIN (fndecls);
- }
- return -1;
-}
-
struct lookup_field_info {
/* The type in which we're looking. */
tree type;
@@ -1173,25 +1150,21 @@ lookup_field_queue_p (binfo, data)
struct lookup_field_info *lfi = (struct lookup_field_info *) data;
/* Don't look for constructors or destructors in base classes. */
- if (lfi->name == ctor_identifier || lfi->name == dtor_identifier)
+ if (IDENTIFIER_CTOR_OR_DTOR_P (lfi->name))
return NULL_TREE;
/* If this base class is hidden by the best-known value so far, we
don't need to look. */
if (!lfi->from_dep_base_p && lfi->rval_binfo
- && hides (lfi->rval_binfo, binfo))
+ && is_subobject_of_p (binfo, lfi->rval_binfo, lfi->type))
return NULL_TREE;
- if (TREE_VIA_VIRTUAL (binfo))
- return binfo_member (BINFO_TYPE (binfo),
- CLASSTYPE_VBASECLASSES (lfi->type));
- else
- return binfo;
+ return CANONICAL_BINFO (binfo, lfi->type);
}
-/* Within the scope of a template class, you can refer to the
- particular to the current specialization with the name of the
- template itself. For example:
+/* Within the scope of a template class, you can refer to the to the
+ current specialization with the name of the template itself. For
+ example:
template <typename T> struct S { S* sp; }
@@ -1209,6 +1182,37 @@ template_self_reference_p (type, decl)
&& DECL_NAME (decl) == constructor_name (type));
}
+
+/* Nonzero for a class member means that it is shared between all objects
+ of that class.
+
+ [class.member.lookup]:If the resulting set of declarations are not all
+ from sub-objects of the same type, or the set has a nonstatic member
+ and includes members from distinct sub-objects, there is an ambiguity
+ and the program is ill-formed.
+
+ This function checks that T contains no nonstatic members. */
+
+static int
+shared_member_p (t)
+ tree t;
+{
+ if (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == TYPE_DECL \
+ || TREE_CODE (t) == CONST_DECL)
+ return 1;
+ if (is_overloaded_fn (t))
+ {
+ for (; t; t = OVL_NEXT (t))
+ {
+ tree fn = OVL_CURRENT (t);
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
+ return 0;
+ }
+ return 1;
+ }
+ return 0;
+}
+
/* DATA is really a struct lookup_field_info. Look for a field with
the name indicated there in BINFO. If this function returns a
non-NULL value it is the result of the lookup. Called from
@@ -1229,7 +1233,7 @@ lookup_field_r (binfo, data)
with the same name, the type is hidden by the function. */
if (!lfi->want_type)
{
- int idx = lookup_fnfields_here (type, lfi->name);
+ int idx = lookup_fnfields_1 (type, lfi->name);
if (idx >= 0)
nval = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), idx);
}
@@ -1245,13 +1249,30 @@ lookup_field_r (binfo, data)
/* If we're looking up a type (as with an elaborated type specifier)
we ignore all non-types we find. */
- if (lfi->want_type && TREE_CODE (nval) != TYPE_DECL)
+ if (lfi->want_type && TREE_CODE (nval) != TYPE_DECL
+ && !DECL_CLASS_TEMPLATE_P (nval))
{
- nval = purpose_member (lfi->name, CLASSTYPE_TAGS (type));
- if (nval)
- nval = TYPE_MAIN_DECL (TREE_VALUE (nval));
- else
- return NULL_TREE;
+ if (lfi->name == TYPE_IDENTIFIER (type))
+ {
+ /* If the aggregate has no user defined constructors, we allow
+ it to have fields with the same name as the enclosing type.
+ If we are looking for that name, find the corresponding
+ TYPE_DECL. */
+ for (nval = TREE_CHAIN (nval); nval; nval = TREE_CHAIN (nval))
+ if (DECL_NAME (nval) == lfi->name
+ && TREE_CODE (nval) == TYPE_DECL)
+ break;
+ }
+ else
+ nval = NULL_TREE;
+ if (!nval)
+ {
+ nval = purpose_member (lfi->name, CLASSTYPE_TAGS (type));
+ if (nval)
+ nval = TYPE_MAIN_DECL (TREE_VALUE (nval));
+ else
+ return NULL_TREE;
+ }
}
/* You must name a template base class with a template-id. */
@@ -1287,12 +1308,12 @@ lookup_field_r (binfo, data)
/* If the lookup already found a match, and the new value doesn't
hide the old one, we might have an ambiguity. */
- if (lfi->rval_binfo && !hides (binfo, lfi->rval_binfo))
+ if (lfi->rval_binfo && !is_subobject_of_p (lfi->rval_binfo, binfo, lfi->type))
{
- if (nval == lfi->rval && SHARED_MEMBER_P (nval))
+ if (nval == lfi->rval && shared_member_p (nval))
/* The two things are really the same. */
;
- else if (hides (lfi->rval_binfo, binfo))
+ else if (is_subobject_of_p (binfo, lfi->rval_binfo, lfi->type))
/* The previous value hides the new one. */
;
else
@@ -1304,29 +1325,18 @@ lookup_field_r (binfo, data)
/* This is the first time we noticed an ambiguity. Add
what we previously thought was a reasonable candidate
to the list. */
- lfi->ambiguous = scratch_tree_cons (NULL_TREE, lfi->rval,
- NULL_TREE);
+ lfi->ambiguous = tree_cons (NULL_TREE, lfi->rval, NULL_TREE);
TREE_TYPE (lfi->ambiguous) = error_mark_node;
}
/* Add the new value. */
- lfi->ambiguous = scratch_tree_cons (NULL_TREE, nval,
- lfi->ambiguous);
+ lfi->ambiguous = tree_cons (NULL_TREE, nval, lfi->ambiguous);
TREE_TYPE (lfi->ambiguous) = error_mark_node;
lfi->errstr = "request for member `%D' is ambiguous";
}
}
else
{
- /* If the thing we're looking for is a virtual base class, then
- we know we've got what we want at this point; there's no way
- to get an ambiguity. */
- if (VBASE_NAME_P (lfi->name))
- {
- lfi->rval = nval;
- return nval;
- }
-
if (from_dep_base_p && TREE_CODE (nval) != TYPE_DECL
/* We need to return a member template class so we can
define partial specializations. Is there a better
@@ -1345,12 +1355,12 @@ lookup_field_r (binfo, data)
return NULL_TREE;
}
-/* Look for a memer named NAME in an inheritance lattice dominated by
- XBASETYPE. PROTECT is 0 or two, we do not check access. If it is
+/* Look for a member named NAME in an inheritance lattice dominated by
+ XBASETYPE. If PROTECT is 0 or two, we do not check access. If it is
1, we enforce accessibility. If PROTECT is zero, then, for an
ambiguous lookup, we return NULL. If PROTECT is 1, we issue an
error message. If PROTECT is 2, we return a TREE_LIST whose
- TREEE_TYPE is error_mark_node and whose TREE_VALUEs are the list of
+ TREE_TYPE is error_mark_node and whose TREE_VALUEs are the list of
ambiguous candidates.
WANT_TYPE is 1 when we should only return TYPE_DECLs, if no
@@ -1398,7 +1408,7 @@ lookup_member (xbasetype, name, protect, want_type)
980827);
}
else
- my_friendly_abort (97);
+ abort ();
complete_type (type);
@@ -1406,7 +1416,7 @@ lookup_member (xbasetype, name, protect, want_type)
n_calls_lookup_field++;
#endif /* GATHER_STATISTICS */
- bzero ((PTR) &lfi, sizeof (lfi));
+ memset ((PTR) &lfi, 0, sizeof (lfi));
lfi.type = type;
lfi.name = name;
lfi.want_type = want_type;
@@ -1435,14 +1445,12 @@ lookup_member (xbasetype, name, protect, want_type)
In the case of overloaded function names, access control is
applied to the function selected by overloaded resolution. */
if (rval && protect && !is_overloaded_fn (rval)
- && !IS_SIGNATURE_POINTER (DECL_REAL_CONTEXT (rval))
- && !IS_SIGNATURE_REFERENCE (DECL_REAL_CONTEXT (rval))
&& !enforce_access (xbasetype, rval))
return error_mark_node;
if (errstr && protect)
{
- cp_error (errstr, name, type);
+ error (errstr, name, type);
if (lfi.ambiguous)
print_candidates (lfi.ambiguous);
rval = error_mark_node;
@@ -1457,7 +1465,15 @@ lookup_member (xbasetype, name, protect, want_type)
if (rval && is_overloaded_fn (rval))
{
- rval = scratch_tree_cons (basetype_path, rval, NULL_TREE);
+ /* Note that the binfo we put in the baselink is the binfo where
+ we found the functions, which we need for overload
+ resolution, but which should not be passed to enforce_access;
+ rather, enforce_access wants a binfo which refers to the
+ scope in which we started looking for the function. This
+ will generally be the binfo passed into this function as
+ xbasetype. */
+
+ rval = tree_cons (rval_binfo, rval, NULL_TREE);
SET_BASELINK_P (rval);
}
@@ -1505,83 +1521,110 @@ int
lookup_fnfields_1 (type, name)
tree type, name;
{
- register tree method_vec
+ tree method_vec
= CLASS_TYPE_P (type) ? CLASSTYPE_METHOD_VEC (type) : NULL_TREE;
if (method_vec != 0)
{
+ register int i;
register tree *methods = &TREE_VEC_ELT (method_vec, 0);
- register tree *end = TREE_VEC_END (method_vec);
+ int len = TREE_VEC_LENGTH (method_vec);
+ tree tmp;
#ifdef GATHER_STATISTICS
n_calls_lookup_fnfields_1++;
#endif /* GATHER_STATISTICS */
/* Constructors are first... */
- if (*methods && name == ctor_identifier)
- return 0;
-
+ if (name == ctor_identifier)
+ return (methods[CLASSTYPE_CONSTRUCTOR_SLOT]
+ ? CLASSTYPE_CONSTRUCTOR_SLOT : -1);
/* and destructors are second. */
- if (*++methods && name == dtor_identifier)
- return 1;
+ if (name == dtor_identifier)
+ return (methods[CLASSTYPE_DESTRUCTOR_SLOT]
+ ? CLASSTYPE_DESTRUCTOR_SLOT : -1);
- while (++methods != end && *methods)
+ for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
+ i < len && methods[i];
+ ++i)
{
#ifdef GATHER_STATISTICS
n_outer_fields_searched++;
#endif /* GATHER_STATISTICS */
- if (DECL_NAME (OVL_CURRENT (*methods)) == name)
- break;
+
+ tmp = OVL_CURRENT (methods[i]);
+ if (DECL_NAME (tmp) == name)
+ return i;
+
+ /* If the type is complete and we're past the conversion ops,
+ switch to binary search. */
+ if (! DECL_CONV_FN_P (tmp)
+ && COMPLETE_TYPE_P (type))
+ {
+ int lo = i + 1, hi = len;
+
+ while (lo < hi)
+ {
+ i = (lo + hi) / 2;
+
+#ifdef GATHER_STATISTICS
+ n_outer_fields_searched++;
+#endif /* GATHER_STATISTICS */
+
+ tmp = DECL_NAME (OVL_CURRENT (methods[i]));
+
+ if (tmp > name)
+ hi = i;
+ else if (tmp < name)
+ lo = i + 1;
+ else
+ return i;
+ }
+ break;
+ }
}
/* If we didn't find it, it might have been a template
conversion operator. (Note that we don't look for this case
above so that we will always find specializations first.) */
- if ((methods == end || !*methods)
- && IDENTIFIER_TYPENAME_P (name))
+ if (IDENTIFIER_TYPENAME_P (name))
{
- methods = &TREE_VEC_ELT (method_vec, 0) + 1;
-
- while (++methods != end && *methods)
+ for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
+ i < len && methods[i];
+ ++i)
{
- tree method_name = DECL_NAME (OVL_CURRENT (*methods));
-
- if (!IDENTIFIER_TYPENAME_P (method_name))
+ tmp = OVL_CURRENT (methods[i]);
+ if (! DECL_CONV_FN_P (tmp))
{
/* Since all conversion operators come first, we know
there is no such operator. */
- methods = end;
break;
}
- else if (TREE_CODE (OVL_CURRENT (*methods)) == TEMPLATE_DECL)
- break;
+ else if (TREE_CODE (tmp) == TEMPLATE_DECL)
+ return i;
}
}
-
- if (methods != end && *methods)
- return methods - &TREE_VEC_ELT (method_vec, 0);
}
return -1;
}
/* Walk the class hierarchy dominated by TYPE. FN is called for each
- type in the hierarchy, in a breadth-first preorder traversal. .
+ type in the hierarchy, in a breadth-first preorder traversal.
If it ever returns a non-NULL value, that value is immediately
- returned and the walk is terminated. At each node FN, is passed a
+ returned and the walk is terminated. At each node, FN is passed a
BINFO indicating the path from the curently visited base-class to
- TYPE. The TREE_CHAINs of the BINFOs may be used for scratch space;
- they are otherwise unused. Before each base-class is walked QFN is
- called. If the value returned is non-zero, the base-class is
- walked; otherwise it is not. If QFN is NULL, it is treated as a
- function which always returns 1. Both FN and QFN are passed the
- DATA whenever they are called. */
+ TYPE. Before each base-class is walked QFN is called. If the
+ value returned is non-zero, the base-class is walked; otherwise it
+ is not. If QFN is NULL, it is treated as a function which always
+ returns 1. Both FN and QFN are passed the DATA whenever they are
+ called. */
static tree
bfs_walk (binfo, fn, qfn, data)
tree binfo;
- tree (*fn) PROTO((tree, void *));
- tree (*qfn) PROTO((tree, void *));
+ tree (*fn) PARAMS ((tree, void *));
+ tree (*qfn) PARAMS ((tree, void *));
void *data;
{
size_t head;
@@ -1643,12 +1686,12 @@ bfs_walk (binfo, fn, qfn, data)
performed, and PREFN is called in preorder, while POSTFN is called
in postorder. */
-static tree
+tree
dfs_walk_real (binfo, prefn, postfn, qfn, data)
tree binfo;
- tree (*prefn) PROTO((tree, void *));
- tree (*postfn) PROTO((tree, void *));
- tree (*qfn) PROTO((tree, void *));
+ tree (*prefn) PARAMS ((tree, void *));
+ tree (*postfn) PARAMS ((tree, void *));
+ tree (*qfn) PARAMS ((tree, void *));
void *data;
{
int i;
@@ -1666,7 +1709,7 @@ dfs_walk_real (binfo, prefn, postfn, qfn, data)
/* Process the basetypes. */
binfos = BINFO_BASETYPES (binfo);
- n_baselinks = binfos ? TREE_VEC_LENGTH (binfos): 0;
+ n_baselinks = BINFO_N_BASETYPES (binfo);
for (i = 0; i < n_baselinks; i++)
{
tree base_binfo = TREE_VEC_ELT (binfos, i);
@@ -1695,95 +1738,13 @@ dfs_walk_real (binfo, prefn, postfn, qfn, data)
tree
dfs_walk (binfo, fn, qfn, data)
tree binfo;
- tree (*fn) PROTO((tree, void *));
- tree (*qfn) PROTO((tree, void *));
+ tree (*fn) PARAMS ((tree, void *));
+ tree (*qfn) PARAMS ((tree, void *));
void *data;
{
return dfs_walk_real (binfo, 0, fn, qfn, data);
}
-struct gvnt_info
-{
- /* The name of the function we are looking for. */
- tree name;
- /* The overloaded functions we have found. */
- tree fields;
-};
-
-/* Called from get_virtuals_named_this via bfs_walk. */
-
-static tree
-get_virtuals_named_this_r (binfo, data)
- tree binfo;
- void *data;
-{
- struct gvnt_info *gvnti = (struct gvnt_info *) data;
- tree type = BINFO_TYPE (binfo);
- int idx;
-
- idx = lookup_fnfields_here (BINFO_TYPE (binfo), gvnti->name);
- if (idx >= 0)
- gvnti->fields
- = scratch_tree_cons (binfo,
- TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type),
- idx),
- gvnti->fields);
-
- return NULL_TREE;
-}
-
-/* Return the virtual functions with the indicated NAME in the type
- indicated by BINFO. The result is a TREE_LIST whose TREE_PURPOSE
- indicates the base class from which the TREE_VALUE (an OVERLOAD or
- just a FUNCTION_DECL) originated. */
-
-static tree
-get_virtuals_named_this (binfo, name)
- tree binfo;
- tree name;
-{
- struct gvnt_info gvnti;
- tree fields;
-
- gvnti.name = name;
- gvnti.fields = NULL_TREE;
-
- bfs_walk (binfo, get_virtuals_named_this_r, 0, &gvnti);
-
- /* Get to the function decls, and return the first virtual function
- with this name, if there is one. */
- for (fields = gvnti.fields; fields; fields = next_baselink (fields))
- {
- tree fndecl;
-
- for (fndecl = TREE_VALUE (fields); fndecl; fndecl = OVL_NEXT (fndecl))
- if (DECL_VINDEX (OVL_CURRENT (fndecl)))
- return fields;
- }
- return NULL_TREE;
-}
-
-static tree
-get_virtual_destructor (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
-{
- tree type = BINFO_TYPE (binfo);
- if (TYPE_HAS_DESTRUCTOR (type)
- && DECL_VINDEX (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), 1)))
- return TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), 1);
- return 0;
-}
-
-static tree
-tree_has_any_destructor_p (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
-{
- tree type = BINFO_TYPE (binfo);
- return TYPE_NEEDS_DESTRUCTOR (type) ? binfo : NULL_TREE;
-}
-
/* Returns > 0 if a function with type DRETTYPE overriding a function
with type BRETTYPE is covariant, as defined in [class.virtual].
@@ -1795,9 +1756,9 @@ covariant_return_p (brettype, drettype)
tree brettype, drettype;
{
tree binfo;
+ base_kind kind;
- if (TREE_CODE (brettype) == FUNCTION_DECL
- || TREE_CODE (brettype) == THUNK_DECL)
+ if (TREE_CODE (brettype) == FUNCTION_DECL)
{
brettype = TREE_TYPE (TREE_TYPE (brettype));
drettype = TREE_TYPE (TREE_TYPE (drettype));
@@ -1827,272 +1788,355 @@ covariant_return_p (brettype, drettype)
if (! IS_AGGR_TYPE (drettype) || ! IS_AGGR_TYPE (brettype))
return -1;
- binfo = get_binfo (brettype, drettype, 1);
-
- /* If we get an error_mark_node from get_binfo, it already complained,
- so let's just succeed. */
- if (binfo == error_mark_node)
+ binfo = lookup_base (drettype, brettype, ba_check | ba_quiet, &kind);
+
+ if (!binfo)
+ return 0;
+ if (BINFO_OFFSET_ZEROP (binfo) && kind != bk_via_virtual)
return 1;
+ return 2;
+}
+
+/* Check that virtual overrider OVERRIDER is acceptable for base function
+ BASEFN. Issue diagnostic, and return zero, if unacceptable. */
+
+static int
+check_final_overrider (overrider, basefn)
+ tree overrider, basefn;
+{
+ tree over_type = TREE_TYPE (overrider);
+ tree base_type = TREE_TYPE (basefn);
+ tree over_return = TREE_TYPE (over_type);
+ tree base_return = TREE_TYPE (base_type);
+ tree over_throw = TYPE_RAISES_EXCEPTIONS (over_type);
+ tree base_throw = TYPE_RAISES_EXCEPTIONS (base_type);
+ int i;
+
+ if (same_type_p (base_return, over_return))
+ /* OK */;
+ else if ((i = covariant_return_p (base_return, over_return)))
+ {
+ if (i == 2)
+ sorry ("adjusting pointers for covariant returns");
- if (! BINFO_OFFSET_ZEROP (binfo) || TREE_VIA_VIRTUAL (binfo))
- return 2;
+ if (pedantic && i == -1)
+ {
+ cp_pedwarn_at ("invalid covariant return type for `%#D'", overrider);
+ cp_pedwarn_at (" overriding `%#D' (must be pointer or reference to class)", basefn);
+ }
+ }
+ else if (IS_AGGR_TYPE_2 (base_return, over_return)
+ && same_or_base_type_p (base_return, over_return))
+ {
+ cp_error_at ("invalid covariant return type for `%#D'", overrider);
+ cp_error_at (" overriding `%#D' (must use pointer or reference)", basefn);
+ return 0;
+ }
+ else if (IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (overrider)) == NULL_TREE)
+ {
+ cp_error_at ("conflicting return type specified for `%#D'", overrider);
+ cp_error_at (" overriding `%#D'", basefn);
+ SET_IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (overrider),
+ DECL_CONTEXT (overrider));
+ return 0;
+ }
+
+ /* Check throw specifier is subset. */
+ if (!comp_except_specs (base_throw, over_throw, 0))
+ {
+ cp_error_at ("looser throw specifier for `%#F'", overrider);
+ cp_error_at (" overriding `%#F'", basefn);
+ return 0;
+ }
return 1;
}
-/* Given a class type TYPE, and a function decl FNDECL, look for a
- virtual function in TYPE's hierarchy which FNDECL could match as a
- virtual function. It doesn't matter which one we find.
-
- DTORP is nonzero if we are looking for a destructor. Destructors
- need special treatment because they do not match by name. */
+/* Given a class TYPE, and a function decl FNDECL, look for
+ virtual functions in TYPE's hierarchy which FNDECL overrides.
+ We do not look in TYPE itself, only its bases.
+
+ Returns non-zero, if we find any. Set FNDECL's DECL_VIRTUAL_P, if we
+ find that it overrides anything.
+
+ We check that every function which is overridden, is correctly
+ overridden. */
-tree
-get_matching_virtual (binfo, fndecl, dtorp)
- tree binfo, fndecl;
- int dtorp;
+int
+look_for_overrides (type, fndecl)
+ tree type, fndecl;
{
- tree tmp = NULL_TREE;
- int i;
+ tree binfo = TYPE_BINFO (type);
+ tree basebinfos = BINFO_BASETYPES (binfo);
+ int nbasebinfos = basebinfos ? TREE_VEC_LENGTH (basebinfos) : 0;
+ int ix;
+ int found = 0;
+
+ for (ix = 0; ix != nbasebinfos; ix++)
+ {
+ tree basetype = BINFO_TYPE (TREE_VEC_ELT (basebinfos, ix));
+
+ if (TYPE_POLYMORPHIC_P (basetype))
+ found += look_for_overrides_r (basetype, fndecl);
+ }
+ return found;
+}
- if (TREE_CODE (fndecl) == TEMPLATE_DECL)
- /* In [temp.mem] we have:
+/* Look in TYPE for virtual functions with the same signature as FNDECL.
+ This differs from get_matching_virtual in that it will only return
+ a function from TYPE. */
- A specialization of a member function template does not
- override a virtual function from a base class. */
- return NULL_TREE;
+tree
+look_for_overrides_here (type, fndecl)
+ tree type, fndecl;
+{
+ int ix;
- /* Breadth first search routines start searching basetypes
- of TYPE, so we must perform first ply of search here. */
- if (dtorp)
- return bfs_walk (binfo, get_virtual_destructor,
- tree_has_any_destructor_p, 0);
+ if (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fndecl))
+ ix = CLASSTYPE_DESTRUCTOR_SLOT;
else
+ ix = lookup_fnfields_1 (type, DECL_NAME (fndecl));
+ if (ix >= 0)
{
- tree drettype, dtypes, btypes, instptr_type;
- tree basetype = DECL_CLASS_CONTEXT (fndecl);
- tree baselink, best = NULL_TREE;
- tree name = DECL_ASSEMBLER_NAME (fndecl);
- tree declarator = DECL_NAME (fndecl);
- if (IDENTIFIER_VIRTUAL_P (declarator) == 0)
- return NULL_TREE;
+ tree fns = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), ix);
+
+ for (; fns; fns = OVL_NEXT (fns))
+ {
+ tree fn = OVL_CURRENT (fns);
+
+ if (!DECL_VIRTUAL_P (fn))
+ /* Not a virtual. */;
+ else if (DECL_CONTEXT (fn) != type)
+ /* Introduced with a using declaration. */;
+ else if (DECL_STATIC_FUNCTION_P (fndecl))
+ {
+ tree btypes = TYPE_ARG_TYPES (TREE_TYPE (fn));
+ tree dtypes = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
+ if (compparms (TREE_CHAIN (btypes), dtypes))
+ return fn;
+ }
+ else if (same_signature_p (fndecl, fn))
+ return fn;
+ }
+ }
+ return NULL_TREE;
+}
- baselink = get_virtuals_named_this (binfo, declarator);
- if (baselink == NULL_TREE)
- return NULL_TREE;
+/* Look in TYPE for virtual functions overridden by FNDECL. Check both
+ TYPE itself and its bases. */
- drettype = TREE_TYPE (TREE_TYPE (fndecl));
- dtypes = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
+static int
+look_for_overrides_r (type, fndecl)
+ tree type, fndecl;
+{
+ tree fn = look_for_overrides_here (type, fndecl);
+ if (fn)
+ {
if (DECL_STATIC_FUNCTION_P (fndecl))
- instptr_type = NULL_TREE;
+ {
+ /* A static member function cannot match an inherited
+ virtual member function. */
+ cp_error_at ("`%#D' cannot be declared", fndecl);
+ cp_error_at (" since `%#D' declared in base class", fn);
+ }
else
- instptr_type = TREE_TYPE (TREE_VALUE (dtypes));
-
- for (; baselink; baselink = next_baselink (baselink))
{
- tree tmps;
- for (tmps = TREE_VALUE (baselink); tmps; tmps = OVL_NEXT (tmps))
- {
- tmp = OVL_CURRENT (tmps);
- if (! DECL_VINDEX (tmp))
- continue;
+ /* It's definitely virtual, even if not explicitly set. */
+ DECL_VIRTUAL_P (fndecl) = 1;
+ check_final_overrider (fndecl, fn);
+ }
+ return 1;
+ }
- btypes = TYPE_ARG_TYPES (TREE_TYPE (tmp));
- if (instptr_type == NULL_TREE)
- {
- if (compparms (TREE_CHAIN (btypes), dtypes))
- /* Caller knows to give error in this case. */
- return tmp;
- return NULL_TREE;
- }
+ /* We failed to find one declared in this class. Look in its bases. */
+ return look_for_overrides (type, fndecl);
+}
- if (/* The first parameter is the `this' parameter,
- which has POINTER_TYPE, and we can therefore
- safely use TYPE_QUALS, rather than
- CP_TYPE_QUALS. */
- (TYPE_QUALS (TREE_TYPE (TREE_VALUE (btypes)))
- == TYPE_QUALS (instptr_type))
- && compparms (TREE_CHAIN (btypes), TREE_CHAIN (dtypes)))
- {
- tree brettype = TREE_TYPE (TREE_TYPE (tmp));
- if (same_type_p (brettype, drettype))
- /* OK */;
- else if ((i = covariant_return_p (brettype, drettype)))
- {
- if (i == 2)
- sorry ("adjusting pointers for covariant returns");
-
- if (pedantic && i == -1)
- {
- cp_pedwarn_at ("invalid covariant return type for `%#D' (must be pointer or reference to class)", fndecl);
- cp_pedwarn_at (" overriding `%#D'", tmp);
- }
- }
- else if (IS_AGGR_TYPE_2 (brettype, drettype)
- && same_or_base_type_p (brettype, drettype))
- {
- error ("invalid covariant return type (must use pointer or reference)");
- cp_error_at (" overriding `%#D'", tmp);
- cp_error_at (" with `%#D'", fndecl);
- }
- else if (IDENTIFIER_ERROR_LOCUS (name) == NULL_TREE)
- {
- cp_error_at ("conflicting return type specified for virtual function `%#D'", fndecl);
- cp_error_at (" overriding definition as `%#D'", tmp);
- SET_IDENTIFIER_ERROR_LOCUS (name, basetype);
- }
-
- /* FNDECL overrides this function. We continue to
- check all the other functions in order to catch
- errors; it might be that in some other baseclass
- a virtual function was declared with the same
- parameter types, but a different return type. */
- best = tmp;
- }
- }
- }
+/* A queue function for dfs_walk that skips any nonprimary virtual
+ bases and any already marked bases. */
- return best;
- }
+tree
+dfs_skip_nonprimary_vbases_unmarkedp (binfo, data)
+ tree binfo;
+ void *data ATTRIBUTE_UNUSED;
+{
+ if (TREE_VIA_VIRTUAL (binfo) && !BINFO_PRIMARY_P (binfo))
+ /* This is a non-primary virtual base. Skip it. */
+ return NULL_TREE;
+
+ return unmarkedp (binfo, NULL);
}
-/* Return the list of virtual functions which are abstract in type
- TYPE that come from non virtual base classes. See
- expand_direct_vtbls_init for the style of search we do. */
+/* A queue function for dfs_walk that skips any nonprimary virtual
+ bases and any unmarked bases. */
-static tree
-get_abstract_virtuals_1 (binfo, do_self, abstract_virtuals)
+tree
+dfs_skip_nonprimary_vbases_markedp (binfo, data)
tree binfo;
- int do_self;
- tree abstract_virtuals;
+ void *data ATTRIBUTE_UNUSED;
{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
+ if (TREE_VIA_VIRTUAL (binfo) && !BINFO_PRIMARY_P (binfo))
+ /* This is a non-primary virtual base. Skip it. */
+ return NULL_TREE;
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable
- = i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));
- if (! TREE_VIA_VIRTUAL (base_binfo))
- abstract_virtuals
- = get_abstract_virtuals_1 (base_binfo, is_not_base_vtable,
- abstract_virtuals);
- }
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
+ return markedp (binfo, NULL);
+}
+
+/* If BINFO is a non-primary virtual baseclass (in the hierarchy
+ dominated by TYPE), and no primary copy appears anywhere in the
+ hierarchy, return the shared copy. If a primary copy appears
+ elsewhere, return NULL_TREE. Otherwise, return BINFO itself; it is
+ either a non-virtual base or a primary virtual base. */
+
+static tree
+get_shared_vbase_if_not_primary (binfo, data)
+ tree binfo;
+ void *data;
+{
+ if (TREE_VIA_VIRTUAL (binfo) && !BINFO_PRIMARY_P (binfo))
{
- tree virtuals = BINFO_VIRTUALS (binfo);
+ tree type = (tree) data;
- skip_rtti_stuff (&virtuals, BINFO_TYPE (binfo));
+ if (TREE_CODE (type) == TREE_LIST)
+ type = TREE_PURPOSE (type);
- while (virtuals)
- {
- tree base_pfn = FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals));
- tree base_fndecl = TREE_OPERAND (base_pfn, 0);
- if (DECL_ABSTRACT_VIRTUAL_P (base_fndecl))
- abstract_virtuals = tree_cons (NULL_TREE, base_fndecl, abstract_virtuals);
- virtuals = TREE_CHAIN (virtuals);
- }
+ /* This is a non-primary virtual base. If there is no primary
+ version, get the shared version. */
+ binfo = binfo_for_vbase (BINFO_TYPE (binfo), type);
+ if (BINFO_PRIMARY_P (binfo))
+ return NULL_TREE;
}
- return abstract_virtuals;
+
+ return binfo;
}
-/* Return the list of virtual functions which are abstract in type TYPE.
- This information is cached, and so must be built on a
- non-temporary obstack. */
+/* A queue function to use with dfs_walk that prevents travel into any
+ nonprimary virtual base, or its baseclasses. DATA should be the
+ type of the complete object, or a TREE_LIST whose TREE_PURPOSE is
+ the type of the complete object. By using this function as a queue
+ function, you will walk over exactly those BINFOs that actually
+ exist in the complete object, including those for virtual base
+ classes. If you SET_BINFO_MARKED for each binfo you process, you
+ are further guaranteed that you will walk into each virtual base
+ class exactly once. */
tree
-get_abstract_virtuals (type)
- tree type;
+dfs_unmarked_real_bases_queue_p (binfo, data)
+ tree binfo;
+ void *data;
{
- tree vbases;
- tree abstract_virtuals = NULL;
-
- /* First get all from non-virtual bases. */
- abstract_virtuals
- = get_abstract_virtuals_1 (TYPE_BINFO (type), 1, abstract_virtuals);
-
- for (vbases = CLASSTYPE_VBASECLASSES (type); vbases; vbases = TREE_CHAIN (vbases))
- {
- tree virtuals = BINFO_VIRTUALS (vbases);
+ binfo = get_shared_vbase_if_not_primary (binfo, data);
+ return binfo ? unmarkedp (binfo, NULL) : NULL_TREE;
+}
- skip_rtti_stuff (&virtuals, type);
+/* Like dfs_unmarked_real_bases_queue_p but walks only into things
+ that are marked, rather than unmarked. */
- while (virtuals)
- {
- tree base_pfn = FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals));
- tree base_fndecl = TREE_OPERAND (base_pfn, 0);
- if (DECL_NEEDS_FINAL_OVERRIDER_P (base_fndecl))
- cp_error ("`%#D' needs a final overrider", base_fndecl);
- else if (DECL_ABSTRACT_VIRTUAL_P (base_fndecl))
- abstract_virtuals = tree_cons (NULL_TREE, base_fndecl, abstract_virtuals);
- virtuals = TREE_CHAIN (virtuals);
- }
- }
- return nreverse (abstract_virtuals);
+tree
+dfs_marked_real_bases_queue_p (binfo, data)
+ tree binfo;
+ void *data;
+{
+ binfo = get_shared_vbase_if_not_primary (binfo, data);
+ return binfo ? markedp (binfo, NULL) : NULL_TREE;
}
-static tree
-next_baselink (baselink)
- tree baselink;
+/* A queue function that skips all virtual bases (and their
+ bases). */
+
+tree
+dfs_skip_vbases (binfo, data)
+ tree binfo;
+ void *data ATTRIBUTE_UNUSED;
{
- tree tmp = TREE_TYPE (baselink);
- baselink = TREE_CHAIN (baselink);
- while (tmp)
- {
- /* @@ does not yet add previous base types. */
- baselink = tree_cons (TREE_PURPOSE (tmp), TREE_VALUE (tmp),
- baselink);
- TREE_TYPE (baselink) = TREE_TYPE (tmp);
- tmp = TREE_CHAIN (tmp);
- }
- return baselink;
+ if (TREE_VIA_VIRTUAL (binfo))
+ return NULL_TREE;
+
+ return binfo;
}
-
-/* DEPTH-FIRST SEARCH ROUTINES. */
-/* This routine converts a pointer to be a pointer of an immediate
- base class. The normal convert_pointer_to routine would diagnose
- the conversion as ambiguous, under MI code that has the base class
- as an ambiguous base class. */
+/* Called via dfs_walk from dfs_get_pure_virtuals. */
static tree
-convert_pointer_to_single_level (to_type, expr)
- tree to_type, expr;
+dfs_get_pure_virtuals (binfo, data)
+ tree binfo;
+ void *data;
{
- tree derived;
- tree binfo_of_derived;
- int i;
+ tree type = (tree) data;
- derived = TREE_TYPE (TREE_TYPE (expr));
- binfo_of_derived = TYPE_BINFO (derived);
- my_friendly_assert (BINFO_INHERITANCE_CHAIN (binfo_of_derived) == NULL_TREE,
- 980827);
- for (i = CLASSTYPE_N_BASECLASSES (derived) - 1; i >= 0; --i)
+ /* We're not interested in primary base classes; the derived class
+ of which they are a primary base will contain the information we
+ need. */
+ if (!BINFO_PRIMARY_P (binfo))
{
- tree binfo = BINFO_BASETYPE (binfo_of_derived, i);
- my_friendly_assert (BINFO_INHERITANCE_CHAIN (binfo) == binfo_of_derived,
- 980827);
- if (same_type_p (BINFO_TYPE (binfo), to_type))
- return build_vbase_path (PLUS_EXPR,
- build_pointer_type (to_type),
- expr, binfo, 1);
+ tree virtuals;
+
+ for (virtuals = BINFO_VIRTUALS (binfo);
+ virtuals;
+ virtuals = TREE_CHAIN (virtuals))
+ if (DECL_PURE_VIRTUAL_P (BV_FN (virtuals)))
+ CLASSTYPE_PURE_VIRTUALS (type)
+ = tree_cons (NULL_TREE, BV_FN (virtuals),
+ CLASSTYPE_PURE_VIRTUALS (type));
}
+
+ SET_BINFO_MARKED (binfo);
- my_friendly_abort (19990607);
-
- /* NOTREACHED */
return NULL_TREE;
}
-tree markedp (binfo, data)
+/* Set CLASSTYPE_PURE_VIRTUALS for TYPE. */
+
+void
+get_pure_virtuals (type)
+ tree type;
+{
+ tree vbases;
+
+ /* Clear the CLASSTYPE_PURE_VIRTUALS list; whatever is already there
+ is going to be overridden. */
+ CLASSTYPE_PURE_VIRTUALS (type) = NULL_TREE;
+ /* Now, run through all the bases which are not primary bases, and
+ collect the pure virtual functions. We look at the vtable in
+ each class to determine what pure virtual functions are present.
+ (A primary base is not interesting because the derived class of
+ which it is a primary base will contain vtable entries for the
+ pure virtuals in the base class. */
+ dfs_walk (TYPE_BINFO (type), dfs_get_pure_virtuals,
+ dfs_unmarked_real_bases_queue_p, type);
+ dfs_walk (TYPE_BINFO (type), dfs_unmark,
+ dfs_marked_real_bases_queue_p, type);
+
+ /* Put the pure virtuals in dfs order. */
+ CLASSTYPE_PURE_VIRTUALS (type) = nreverse (CLASSTYPE_PURE_VIRTUALS (type));
+
+ for (vbases = CLASSTYPE_VBASECLASSES (type);
+ vbases;
+ vbases = TREE_CHAIN (vbases))
+ {
+ tree virtuals;
+
+ for (virtuals = BINFO_VIRTUALS (TREE_VALUE (vbases));
+ virtuals;
+ virtuals = TREE_CHAIN (virtuals))
+ {
+ tree base_fndecl = BV_FN (virtuals);
+ if (DECL_NEEDS_FINAL_OVERRIDER_P (base_fndecl))
+ error ("`%#D' needs a final overrider", base_fndecl);
+ }
+ }
+}
+
+/* DEPTH-FIRST SEARCH ROUTINES. */
+
+tree
+markedp (binfo, data)
tree binfo;
void *data ATTRIBUTE_UNUSED;
{
return BINFO_MARKED (binfo) ? binfo : NULL_TREE;
}
-static tree
+tree
unmarkedp (binfo, data)
tree binfo;
void *data ATTRIBUTE_UNUSED;
@@ -2100,7 +2144,7 @@ unmarkedp (binfo, data)
return !BINFO_MARKED (binfo) ? binfo : NULL_TREE;
}
-static tree
+tree
marked_vtable_pathp (binfo, data)
tree binfo;
void *data ATTRIBUTE_UNUSED;
@@ -2108,7 +2152,7 @@ marked_vtable_pathp (binfo, data)
return BINFO_VTABLE_PATH_MARKED (binfo) ? binfo : NULL_TREE;
}
-static tree
+tree
unmarked_vtable_pathp (binfo, data)
tree binfo;
void *data ATTRIBUTE_UNUSED;
@@ -2116,22 +2160,6 @@ unmarked_vtable_pathp (binfo, data)
return !BINFO_VTABLE_PATH_MARKED (binfo) ? binfo : NULL_TREE;
}
-static tree
-marked_new_vtablep (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
-{
- return BINFO_NEW_VTABLE_MARKED (binfo) ? binfo : NULL_TREE;
-}
-
-static tree
-unmarked_new_vtablep (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
-{
- return !BINFO_NEW_VTABLE_MARKED (binfo) ? binfo : NULL_TREE;
-}
-
static tree
marked_pushdecls_p (binfo, data)
tree binfo;
@@ -2150,30 +2178,10 @@ unmarked_pushdecls_p (binfo, data)
&& !BINFO_PUSHDECLS_MARKED (binfo)) ? binfo : NULL_TREE;
}
-#if 0
-static int dfs_search_slot_nonempty_p (binfo) tree binfo;
-{ return CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (binfo)) != 0; }
-#endif
-
-static tree
-dfs_debug_unmarkedp (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
-{
- return (!CLASSTYPE_DEBUG_REQUESTED (BINFO_TYPE (binfo))
- ? binfo : NULL_TREE);
-}
-
/* The worker functions for `dfs_walk'. These do not need to
test anything (vis a vis marking) if they are paired with
a predicate function (above). */
-#if 0
-static void
-dfs_mark (binfo) tree binfo;
-{ SET_BINFO_MARKED (binfo); }
-#endif
-
tree
dfs_unmark (binfo, data)
tree binfo;
@@ -2183,754 +2191,196 @@ dfs_unmark (binfo, data)
return NULL_TREE;
}
-#if 0
-static void
-dfs_mark_vtable_path (binfo) tree binfo;
-{ SET_BINFO_VTABLE_PATH_MARKED (binfo); }
-
-static void
-dfs_unmark_vtable_path (binfo) tree binfo;
-{ CLEAR_BINFO_VTABLE_PATH_MARKED (binfo); }
-
-static void
-dfs_mark_new_vtable (binfo) tree binfo;
-{ SET_BINFO_NEW_VTABLE_MARKED (binfo); }
-
-static void
-dfs_unmark_new_vtable (binfo) tree binfo;
-{ CLEAR_BINFO_NEW_VTABLE_MARKED (binfo); }
-
-static void
-dfs_clear_search_slot (binfo) tree binfo;
-{ CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (binfo)) = 0; }
-#endif
+/* get virtual base class types.
+ This adds type to the vbase_types list in reverse dfs order.
+ Ordering is very important, so don't change it. */
static tree
-dfs_debug_mark (binfo, data)
+dfs_get_vbase_types (binfo, data)
tree binfo;
- void *data ATTRIBUTE_UNUSED;
+ void *data;
{
- tree t = BINFO_TYPE (binfo);
-
- /* Use heuristic that if there are virtual functions,
- ignore until we see a non-inline virtual function. */
- tree methods = CLASSTYPE_METHOD_VEC (t);
-
- CLASSTYPE_DEBUG_REQUESTED (t) = 1;
-
- if (methods == 0)
- return NULL_TREE;
-
- /* If interface info is known, either we've already emitted the debug
- info or we don't need to. */
- if (CLASSTYPE_INTERFACE_KNOWN (t))
- return NULL_TREE;
-
- /* If debug info is requested from this context for this type, supply it.
- If debug info is requested from another context for this type,
- see if some third context can supply it. */
- if (current_function_decl == NULL_TREE
- || DECL_CLASS_CONTEXT (current_function_decl) != t)
- {
- if (TREE_VEC_ELT (methods, 1))
- methods = TREE_VEC_ELT (methods, 1);
- else if (TREE_VEC_ELT (methods, 0))
- methods = TREE_VEC_ELT (methods, 0);
- else
- methods = TREE_VEC_ELT (methods, 2);
- methods = OVL_CURRENT (methods);
- while (methods)
- {
- if (DECL_VINDEX (methods)
- && DECL_THIS_INLINE (methods) == 0
- && DECL_ABSTRACT_VIRTUAL_P (methods) == 0)
- {
- /* Somebody, somewhere is going to have to define this
- virtual function. When they do, they will provide
- the debugging info. */
- return NULL_TREE;
- }
- methods = TREE_CHAIN (methods);
- }
- }
- /* We cannot rely on some alien method to solve our problems,
- so we must write out the debug info ourselves. */
- TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (t)) = 0;
- rest_of_type_compilation (t, toplevel_bindings_p ());
+ tree type = (tree) data;
+ if (TREE_VIA_VIRTUAL (binfo))
+ CLASSTYPE_VBASECLASSES (type)
+ = tree_cons (BINFO_TYPE (binfo),
+ binfo,
+ CLASSTYPE_VBASECLASSES (type));
+ SET_BINFO_MARKED (binfo);
return NULL_TREE;
}
-
-struct vbase_info
-{
- tree decl_ptr;
- tree inits;
- tree vbase_types;
-};
-/* Attach to the type of the virtual base class, the pointer to the
- virtual base class. */
+/* Called via dfs_walk from mark_primary_bases. Builds the
+ inheritance graph order list of BINFOs. */
static tree
-dfs_find_vbases (binfo, data)
+dfs_build_inheritance_graph_order (binfo, data)
tree binfo;
void *data;
{
- struct vbase_info *vi = (struct vbase_info *) data;
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
+ tree *last_binfo = (tree *) data;
- for (i = n_baselinks-1; i >= 0; i--)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
+ if (*last_binfo)
+ TREE_CHAIN (*last_binfo) = binfo;
+ *last_binfo = binfo;
+ SET_BINFO_MARKED (binfo);
+ return NULL_TREE;
+}
- if (TREE_VIA_VIRTUAL (base_binfo)
- && CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (base_binfo)) == 0)
- {
- tree vbase = BINFO_TYPE (base_binfo);
- tree binfo = binfo_member (vbase, vi->vbase_types);
+/* Set CLASSTYPE_VBASECLASSES for TYPE. */
- CLASSTYPE_SEARCH_SLOT (vbase)
- = build (PLUS_EXPR, build_pointer_type (vbase),
- vi->decl_ptr, BINFO_OFFSET (binfo));
- }
- }
- SET_BINFO_VTABLE_PATH_MARKED (binfo);
- SET_BINFO_NEW_VTABLE_MARKED (binfo);
+void
+get_vbase_types (type)
+ tree type;
+{
+ tree last_binfo;
- return NULL_TREE;
+ CLASSTYPE_VBASECLASSES (type) = NULL_TREE;
+ dfs_walk (TYPE_BINFO (type), dfs_get_vbase_types, unmarkedp, type);
+ /* Rely upon the reverse dfs ordering from dfs_get_vbase_types, and now
+ reverse it so that we get normal dfs ordering. */
+ CLASSTYPE_VBASECLASSES (type) = nreverse (CLASSTYPE_VBASECLASSES (type));
+ dfs_walk (TYPE_BINFO (type), dfs_unmark, markedp, 0);
+ /* Thread the BINFOs in inheritance-graph order. */
+ last_binfo = NULL;
+ dfs_walk_real (TYPE_BINFO (type),
+ dfs_build_inheritance_graph_order,
+ NULL,
+ unmarkedp,
+ &last_binfo);
+ dfs_walk (TYPE_BINFO (type), dfs_unmark, markedp, NULL);
}
+/* Called from find_vbase_instance via dfs_walk. */
+
static tree
-dfs_init_vbase_pointers (binfo, data)
+dfs_find_vbase_instance (binfo, data)
tree binfo;
void *data;
{
- struct vbase_info *vi = (struct vbase_info *) data;
- tree type = BINFO_TYPE (binfo);
- tree fields = TYPE_FIELDS (type);
- tree this_vbase_ptr;
-
- CLEAR_BINFO_VTABLE_PATH_MARKED (binfo);
-
-#if 0
- /* See finish_struct_1 for when we can enable this. */
- /* If we have a vtable pointer first, skip it. */
- if (VFIELD_NAME_P (DECL_NAME (fields)))
- fields = TREE_CHAIN (fields);
-#endif
-
- if (BINFO_INHERITANCE_CHAIN (binfo))
- {
- this_vbase_ptr = TREE_CHAIN (BINFO_INHERITANCE_CHAIN (binfo));
- if (TREE_VIA_VIRTUAL (binfo))
- this_vbase_ptr = CLASSTYPE_SEARCH_SLOT (type);
- else
- this_vbase_ptr = convert_pointer_to_single_level (type,
- this_vbase_ptr);
- TREE_CHAIN (binfo) = this_vbase_ptr;
- }
- else
- this_vbase_ptr = TREE_CHAIN (binfo);
-
- if (fields == NULL_TREE
- || DECL_NAME (fields) == NULL_TREE
- || ! VBASE_NAME_P (DECL_NAME (fields)))
- return NULL_TREE;
+ tree base = TREE_VALUE ((tree) data);
- if (build_pointer_type (type)
- != TYPE_MAIN_VARIANT (TREE_TYPE (this_vbase_ptr)))
- my_friendly_abort (125);
+ if (BINFO_PRIMARY_P (binfo)
+ && same_type_p (BINFO_TYPE (binfo), base))
+ return binfo;
- while (fields && DECL_NAME (fields) && VBASE_NAME_P (DECL_NAME (fields)))
- {
- tree ref = build (COMPONENT_REF, TREE_TYPE (fields),
- build_indirect_ref (this_vbase_ptr, NULL_PTR), fields);
- tree init = CLASSTYPE_SEARCH_SLOT (TREE_TYPE (TREE_TYPE (fields)));
- vi->inits = tree_cons (binfo_member (TREE_TYPE (TREE_TYPE (fields)),
- vi->vbase_types),
- build_modify_expr (ref, NOP_EXPR, init),
- vi->inits);
- fields = TREE_CHAIN (fields);
- }
-
return NULL_TREE;
}
-/* Sometimes this needs to clear both VTABLE_PATH and NEW_VTABLE. Other
- times, just NEW_VTABLE, but optimizer should make both with equal
- efficiency (though it does not currently). */
-
-static tree
-dfs_clear_vbase_slots (binfo, data)
- tree binfo;
- void *data ATTRIBUTE_UNUSED;
-{
- tree type = BINFO_TYPE (binfo);
- CLASSTYPE_SEARCH_SLOT (type) = 0;
- CLEAR_BINFO_VTABLE_PATH_MARKED (binfo);
- CLEAR_BINFO_NEW_VTABLE_MARKED (binfo);
- return NULL_TREE;
-}
+/* Find the real occurrence of the virtual BASE (a class type) in the
+ hierarchy dominated by TYPE. */
tree
-init_vbase_pointers (type, decl_ptr)
+find_vbase_instance (base, type)
+ tree base;
tree type;
- tree decl_ptr;
{
- if (TYPE_USES_VIRTUAL_BASECLASSES (type))
- {
- struct vbase_info vi;
- int old_flag = flag_this_is_variable;
- tree binfo = TYPE_BINFO (type);
- flag_this_is_variable = -2;
-
- /* Find all the virtual base classes, marking them for later
- initialization. */
- vi.decl_ptr = decl_ptr;
- vi.vbase_types = CLASSTYPE_VBASECLASSES (type);
- vi.inits = NULL_TREE;
-
- dfs_walk (binfo, dfs_find_vbases, unmarked_vtable_pathp, &vi);
-
- /* Build up a list of the initializers. */
- TREE_CHAIN (binfo) = decl_ptr;
- dfs_walk_real (binfo,
- dfs_init_vbase_pointers, 0,
- marked_vtable_pathp,
- &vi);
-
- dfs_walk (binfo, dfs_clear_vbase_slots, marked_new_vtablep, 0);
- flag_this_is_variable = old_flag;
- return vi.inits;
- }
- return 0;
-}
-
-/* get the virtual context (the vbase that directly contains the
- DECL_CLASS_CONTEXT of the FNDECL) that the given FNDECL is declared in,
- or NULL_TREE if there is none.
-
- FNDECL must come from a virtual table from a virtual base to ensure that
- there is only one possible DECL_CLASS_CONTEXT.
+ tree instance;
- We know that if there is more than one place (binfo) the fndecl that the
- declared, they all refer to the same binfo. See get_class_offset_1 for
- the check that ensures this. */
+ instance = binfo_for_vbase (base, type);
+ if (!BINFO_PRIMARY_P (instance))
+ return instance;
-static tree
-virtual_context (fndecl, t, vbase)
- tree fndecl, t, vbase;
-{
- tree path;
- if (get_base_distance (DECL_CLASS_CONTEXT (fndecl), t, 0, &path) < 0)
- {
- /* DECL_CLASS_CONTEXT can be ambiguous in t. */
- if (get_base_distance (DECL_CLASS_CONTEXT (fndecl), vbase, 0, &path) >= 0)
- {
- while (path)
- {
- /* Not sure if checking path == vbase is necessary here, but just in
- case it is. */
- if (TREE_VIA_VIRTUAL (path) || path == vbase)
- return binfo_member (BINFO_TYPE (path), CLASSTYPE_VBASECLASSES (t));
- path = BINFO_INHERITANCE_CHAIN (path);
- }
- }
- /* This shouldn't happen, I don't want errors! */
- warning ("recoverable compiler error, fixups for virtual function");
- return vbase;
- }
- while (path)
- {
- if (TREE_VIA_VIRTUAL (path))
- return binfo_member (BINFO_TYPE (path), CLASSTYPE_VBASECLASSES (t));
- path = BINFO_INHERITANCE_CHAIN (path);
- }
- return 0;
+ return dfs_walk (TYPE_BINFO (type),
+ dfs_find_vbase_instance,
+ NULL,
+ build_tree_list (type, base));
}
-/* Fixups upcast offsets for one vtable.
- Entries may stay within the VBASE given, or
- they may upcast into a direct base, or
- they may upcast into a different vbase.
-
- We only need to do fixups in case 2 and 3. In case 2, we add in
- the virtual base offset to effect an upcast, in case 3, we add in
- the virtual base offset to effect an upcast, then subtract out the
- offset for the other virtual base, to effect a downcast into it.
-
- This routine mirrors fixup_vtable_deltas in functionality, though
- this one is runtime based, and the other is compile time based.
- Conceivably that routine could be removed entirely, and all fixups
- done at runtime.
-
- VBASE_OFFSETS is an association list of virtual bases that contains
- offset information for the virtual bases, so the offsets are only
- calculated once. The offsets are computed by where we think the
- vbase should be (as noted by the CLASSTYPE_SEARCH_SLOT) minus where
- the vbase really is. */
-
-static void
-expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
- vbase_offsets)
- tree binfo, addr, orig_addr, vbase, vbase_addr, t, *vbase_offsets;
-{
- tree virtuals = BINFO_VIRTUALS (binfo);
- tree vc;
- tree delta;
- unsigned HOST_WIDE_INT n;
-
- delta = purpose_member (vbase, *vbase_offsets);
- if (! delta)
- {
- delta = CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (vbase));
- delta = build (MINUS_EXPR, ptrdiff_type_node, delta, vbase_addr);
- delta = save_expr (delta);
- delta = tree_cons (vbase, delta, *vbase_offsets);
- *vbase_offsets = delta;
- }
-
- n = skip_rtti_stuff (&virtuals, t);
-
- while (virtuals)
- {
- tree current_fndecl = TREE_VALUE (virtuals);
- current_fndecl = FNADDR_FROM_VTABLE_ENTRY (current_fndecl);
- current_fndecl = TREE_OPERAND (current_fndecl, 0);
- if (current_fndecl
- && current_fndecl != abort_fndecl
- && (vc=virtual_context (current_fndecl, t, vbase)) != vbase)
- {
- /* This may in fact need a runtime fixup. */
- tree idx = build_int_2 (n, 0);
- tree vtbl = BINFO_VTABLE (binfo);
- tree nvtbl = lookup_name (DECL_NAME (vtbl), 0);
- tree aref, ref, naref;
- tree old_delta, new_delta;
- tree init;
-
- if (nvtbl == NULL_TREE
- || nvtbl == IDENTIFIER_GLOBAL_VALUE (DECL_NAME (vtbl)))
- {
- /* Dup it if it isn't in local scope yet. */
- nvtbl = build_decl
- (VAR_DECL, DECL_NAME (vtbl),
- TYPE_MAIN_VARIANT (TREE_TYPE (vtbl)));
- DECL_ALIGN (nvtbl) = MAX (TYPE_ALIGN (double_type_node),
- DECL_ALIGN (nvtbl));
- TREE_READONLY (nvtbl) = 0;
- DECL_ARTIFICIAL (nvtbl) = 1;
- nvtbl = pushdecl (nvtbl);
- init = NULL_TREE;
- cp_finish_decl (nvtbl, init, NULL_TREE, 0,
- LOOKUP_ONLYCONVERTING);
-
- /* We don't set DECL_VIRTUAL_P and DECL_CONTEXT on nvtbl
- because they wouldn't be useful; everything that wants to
- look at the vtable will look at the decl for the normal
- vtable. Setting DECL_CONTEXT also screws up
- decl_function_context. */
-
- init = build (MODIFY_EXPR, TREE_TYPE (nvtbl),
- nvtbl, vtbl);
- TREE_SIDE_EFFECTS (init) = 1;
- expand_expr_stmt (init);
- /* Update the vtable pointers as necessary. */
- ref = build_vfield_ref
- (build_indirect_ref (addr, NULL_PTR),
- DECL_CONTEXT (CLASSTYPE_VFIELD (BINFO_TYPE (binfo))));
- expand_expr_stmt
- (build_modify_expr (ref, NOP_EXPR, nvtbl));
- }
- assemble_external (vtbl);
- aref = build_array_ref (vtbl, idx);
- naref = build_array_ref (nvtbl, idx);
- old_delta = build_component_ref (aref, delta_identifier,
- NULL_TREE, 0);
- new_delta = build_component_ref (naref, delta_identifier,
- NULL_TREE, 0);
-
- /* This is a upcast, so we have to add the offset for the
- virtual base. */
- old_delta = build_binary_op (PLUS_EXPR, old_delta,
- TREE_VALUE (delta));
- if (vc)
- {
- /* If this is set, we need to subtract out the delta
- adjustments for the other virtual base that we
- downcast into. */
- tree vc_delta = purpose_member (vc, *vbase_offsets);
- if (! vc_delta)
- {
- tree vc_addr = convert_pointer_to_real (vc, orig_addr);
- vc_delta = CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (vc));
- vc_delta = build (MINUS_EXPR, ptrdiff_type_node,
- vc_delta, vc_addr);
- vc_delta = save_expr (vc_delta);
- *vbase_offsets = tree_cons (vc, vc_delta, *vbase_offsets);
- }
- else
- vc_delta = TREE_VALUE (vc_delta);
-
- /* This is a downcast, so we have to subtract the offset
- for the virtual base. */
- old_delta = build_binary_op (MINUS_EXPR, old_delta, vc_delta);
- }
-
- TREE_READONLY (new_delta) = 0;
- TREE_TYPE (new_delta) =
- cp_build_qualified_type (TREE_TYPE (new_delta),
- CP_TYPE_QUALS (TREE_TYPE (new_delta))
- & ~TYPE_QUAL_CONST);
- expand_expr_stmt (build_modify_expr (new_delta, NOP_EXPR,
- old_delta));
- }
- ++n;
- virtuals = TREE_CHAIN (virtuals);
- }
-}
-
-/* Fixup upcast offsets for all direct vtables. Patterned after
- expand_direct_vtbls_init. */
+
+/* Debug info for C++ classes can get very large; try to avoid
+ emitting it everywhere.
-static void
-fixup_virtual_upcast_offsets (real_binfo, binfo, init_self, can_elide, addr, orig_addr, type, vbase, vbase_offsets)
- tree real_binfo, binfo;
- int init_self, can_elide;
- tree addr, orig_addr, type, vbase, *vbase_offsets;
-{
- tree real_binfos = BINFO_BASETYPES (real_binfo);
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = real_binfos ? TREE_VEC_LENGTH (real_binfos) : 0;
+ Note that this optimization wins even when the target supports
+ BINCL (if only slightly), and reduces the amount of work for the
+ linker. */
- for (i = 0; i < n_baselinks; i++)
- {
- tree real_base_binfo = TREE_VEC_ELT (real_binfos, i);
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable
- = i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (real_binfo));
- if (! TREE_VIA_VIRTUAL (real_base_binfo))
- fixup_virtual_upcast_offsets (real_base_binfo, base_binfo,
- is_not_base_vtable, can_elide, addr,
- orig_addr, type, vbase, vbase_offsets);
- }
-#if 0
- /* Before turning this on, make sure it is correct. */
- if (can_elide && ! BINFO_MODIFIED (binfo))
+void
+maybe_suppress_debug_info (t)
+ tree t;
+{
+ /* We can't do the usual TYPE_DECL_SUPPRESS_DEBUG thing with DWARF, which
+ does not support name references between translation units. It supports
+ symbolic references between translation units, but only within a single
+ executable or shared library.
+
+ For DWARF 2, we handle TYPE_DECL_SUPPRESS_DEBUG by pretending
+ that the type was never defined, so we only get the members we
+ actually define. */
+ if (write_symbols == DWARF_DEBUG || write_symbols == NO_DEBUG)
return;
-#endif
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (init_self && CLASSTYPE_VFIELDS (BINFO_TYPE (real_binfo)))
- {
- tree new_addr = convert_pointer_to_real (binfo, addr);
- expand_upcast_fixups (real_binfo, new_addr, orig_addr, vbase, addr,
- type, vbase_offsets);
- }
-}
-
-/* Emit initialization of vfields of BASE, where the complete object
- is pointed to by decl_ptr. DO_SELF indicates we have to do our own
- vfield, otherwise only proceed to our own direct non-virtual bases. */
-
-static void
-expand_direct_vtbls_init_thunks (base, decl_ptr, do_self)
- tree base, decl_ptr;
- int do_self;
-{
- tree addr, expr;
- tree type = BINFO_TYPE (base);
- tree binfos = BINFO_BASETYPES (base);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- tree vlist = lookup_name (vlist_identifier, 0);
- int in_dtor = DECL_DESTRUCTOR_FOR_PVBASE_P (current_function_decl);
-
- my_friendly_assert (vlist != NULL_TREE, 990320);
-
- if (in_dtor)
- /* In the destructor, we find the vfield pointers for the bases in
- reverse order, before we find our own vfield pointer. */
- for (i = n_baselinks - 1; i >= 0; i--)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable
- = i != CLASSTYPE_VFIELD_PARENT (type);
- if (! TREE_VIA_VIRTUAL (base_binfo))
- expand_direct_vtbls_init_thunks (base_binfo, decl_ptr,
- is_not_base_vtable);
- }
-
- if (do_self && CLASSTYPE_VFIELDS (type))
- {
- addr = build_vbase_path (PLUS_EXPR, build_pointer_type (type),
- decl_ptr, base, 1);
- addr = build_indirect_ref (addr, "vptr");
- addr = build_vfield_ref (addr, type);
-
- /* In a destructor, we decrease the vlist before we retrieve the
- value. In a constructor, we increase the vlist after we
- retrieve the value. */
- if (in_dtor)
- {
- expr = build_binary_op (MINUS_EXPR, vlist, integer_one_node);
- expr = build_modify_expr (vlist, NOP_EXPR, expr);
- expand_expr_stmt (expr);
- }
-
- /* Store the next vptr into the vbase's vptr. */
- expr = build_indirect_ref (vlist, "__vlist");
- expr = convert_force (TREE_TYPE (addr), expr, 0);
- expr = build_modify_expr (addr, NOP_EXPR, expr);
- expand_expr_stmt (expr);
-
- /* Advance the vlist. */
- if (!in_dtor)
- {
- expr = build_binary_op (PLUS_EXPR, vlist, integer_one_node);
- expr = build_modify_expr (vlist, NOP_EXPR, expr);
- expand_expr_stmt (expr);
- }
- }
-
- if (!in_dtor)
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable = i != CLASSTYPE_VFIELD_PARENT (type);
- if (! TREE_VIA_VIRTUAL (base_binfo))
- expand_direct_vtbls_init_thunks (base_binfo, decl_ptr,
- is_not_base_vtable);
- }
-}
-
-/* Like expand_indirect_vtbls_init below, but based on the vtable list
- passed to the constructor. */
-
-static void
-expand_indirect_vtbls_init_thunks (binfo, true_exp, decl_ptr)
- tree binfo;
- tree true_exp, decl_ptr;
-{
- tree type = BINFO_TYPE (binfo);
- tree vbases = CLASSTYPE_VBASECLASSES (type);
- struct vbase_info vi;
- vi.decl_ptr = (true_exp ? build_unary_op (ADDR_EXPR, true_exp, 0)
- : decl_ptr);
- vi.vbase_types = vbases;
+ /* We might have set this earlier in cp_finish_decl. */
+ TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 0;
- dfs_walk (binfo, dfs_find_vbases, unmarked_new_vtablep, &vi);
-
- /* Initialized with vtables of type TYPE. */
- for (; vbases; vbases = TREE_CHAIN (vbases))
+ /* If we already know how we're handling this class, handle debug info
+ the same way. */
+ if (CLASSTYPE_INTERFACE_KNOWN (t))
{
- tree addr;
-
- if (!CLASSTYPE_VFIELD (BINFO_TYPE (vbases)))
- /* This vbase doesn't have a vptr of its own. */
- /* FIXME: check */
- continue;
-
- addr = convert_pointer_to_vbase (TREE_TYPE (vbases), decl_ptr);
- expand_direct_vtbls_init_thunks (TYPE_BINFO (BINFO_TYPE (vbases)),
- addr, 1);
-
+ if (CLASSTYPE_INTERFACE_ONLY (t))
+ TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
+ /* else don't set it. */
}
+ /* If the class has a vtable, write out the debug info along with
+ the vtable. */
+ else if (TYPE_CONTAINS_VPTR_P (t))
+ TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
- dfs_walk (binfo, dfs_clear_vbase_slots, marked_new_vtablep, 0);
+ /* Otherwise, just emit the debug info normally. */
}
-/* Build a COMPOUND_EXPR which when expanded will generate the code
- needed to initialize all the virtual function table slots of all
- the virtual baseclasses. MAIN_BINFO is the binfo which determines
- the virtual baseclasses to use; TYPE is the type of the object to
- which the initialization applies. TRUE_EXP is the true object we
- are initializing, and DECL_PTR is the pointer to the sub-object we
- are initializing.
+/* Note that we want debugging information for a base class of a class
+ whose vtable is being emitted. Normally, this would happen because
+ calling the constructor for a derived class implies calling the
+ constructors for all bases, which involve initializing the
+ appropriate vptr with the vtable for the base class; but in the
+ presence of optimization, this initialization may be optimized
+ away, so we tell finish_vtable_vardecl that we want the debugging
+ information anyway. */
- When USE_COMPUTED_OFFSETS is non-zero, we can assume that the
- object was laid out by a top-level constructor and the computed
- offsets are valid to store vtables. When zero, we must store new
- vtables through virtual baseclass pointers. */
-
-void
-expand_indirect_vtbls_init (binfo, true_exp, decl_ptr)
+static tree
+dfs_debug_mark (binfo, data)
tree binfo;
- tree true_exp, decl_ptr;
+ void *data ATTRIBUTE_UNUSED;
{
- tree type = BINFO_TYPE (binfo);
-
- /* This function executes during the finish_function() segment,
- AFTER the auto variables and temporary stack space has been marked
- unused...If space is needed for the virtual function tables,
- some of them might fit within what the compiler now thinks
- are available stack slots... These values are actually initialized at
- the beginnning of the function, so when the automatics use their space,
- they will overwrite the values that are placed here. Marking all
- temporary space as unavailable prevents this from happening. */
-
- mark_all_temps_used();
-
- if (TYPE_USES_PVBASES (type))
- {
- expand_indirect_vtbls_init_thunks (binfo, true_exp, decl_ptr);
- return;
- }
-
- if (TYPE_USES_VIRTUAL_BASECLASSES (type))
- {
- rtx fixup_insns = NULL_RTX;
- tree vbases = CLASSTYPE_VBASECLASSES (type);
- struct vbase_info vi;
- vi.decl_ptr = (true_exp ? build_unary_op (ADDR_EXPR, true_exp, 0)
- : decl_ptr);
- vi.vbase_types = vbases;
-
- dfs_walk (binfo, dfs_find_vbases, unmarked_new_vtablep, &vi);
-
- /* Initialized with vtables of type TYPE. */
- for (; vbases; vbases = TREE_CHAIN (vbases))
- {
- tree addr;
-
- addr = convert_pointer_to_vbase (TREE_TYPE (vbases), vi.decl_ptr);
-
- /* Do all vtables from this virtual base. */
- /* This assumes that virtual bases can never serve as parent
- binfos. (in the CLASSTYPE_VFIELD_PARENT sense) */
- expand_direct_vtbls_init (vbases, TYPE_BINFO (BINFO_TYPE (vbases)),
- 1, 0, addr);
-
- /* Now we adjust the offsets for virtual functions that
- cross virtual boundaries on an implicit upcast on vf call
- so that the layout of the most complete type is used,
- instead of assuming the layout of the virtual bases from
- our current type. */
-
- if (flag_vtable_thunks)
- {
- /* We don't have dynamic thunks yet!
- So for now, just fail silently. */
- }
- else
- {
- tree vbase_offsets = NULL_TREE;
- push_to_sequence (fixup_insns);
- fixup_virtual_upcast_offsets (vbases,
- TYPE_BINFO (BINFO_TYPE (vbases)),
- 1, 0, addr, vi.decl_ptr,
- type, vbases, &vbase_offsets);
- fixup_insns = get_insns ();
- end_sequence ();
- }
- }
+ tree t = BINFO_TYPE (binfo);
- if (fixup_insns)
- {
- extern tree in_charge_identifier;
- tree in_charge_node = lookup_name (in_charge_identifier, 0);
- if (! in_charge_node)
- {
- warning ("recoverable internal compiler error, nobody's in charge!");
- in_charge_node = integer_zero_node;
- }
- in_charge_node = build_binary_op (EQ_EXPR, in_charge_node, integer_zero_node);
- expand_start_cond (in_charge_node, 0);
- emit_insns (fixup_insns);
- expand_end_cond ();
- }
+ CLASSTYPE_DEBUG_REQUESTED (t) = 1;
- dfs_walk (binfo, dfs_clear_vbase_slots, marked_new_vtablep, 0);
- }
+ return NULL_TREE;
}
-/* get virtual base class types.
- This adds type to the vbase_types list in reverse dfs order.
- Ordering is very important, so don't change it. */
+/* Returns BINFO if we haven't already noted that we want debugging
+ info for this base class. */
-static tree
-dfs_get_vbase_types (binfo, data)
+static tree
+dfs_debug_unmarkedp (binfo, data)
tree binfo;
- void *data;
-{
- tree *vbase_types = (tree *) data;
-
- if (TREE_VIA_VIRTUAL (binfo) && ! BINFO_VBASE_MARKED (binfo))
- {
- tree new_vbase = make_binfo (integer_zero_node, binfo,
- BINFO_VTABLE (binfo),
- BINFO_VIRTUALS (binfo));
- TREE_CHAIN (new_vbase) = *vbase_types;
- TREE_VIA_VIRTUAL (new_vbase) = 1;
- *vbase_types = new_vbase;
- SET_BINFO_VBASE_MARKED (binfo);
- }
- SET_BINFO_MARKED (binfo);
- return NULL_TREE;
+ void *data ATTRIBUTE_UNUSED;
+{
+ return (!CLASSTYPE_DEBUG_REQUESTED (BINFO_TYPE (binfo))
+ ? binfo : NULL_TREE);
}
-/* Return a list of binfos for the virtual base classes for TYPE, in
- depth-first search order. The list is freshly allocated, so
- no modification is made to the current binfo hierarchy. */
-
-tree
-get_vbase_types (type)
- tree type;
-{
- tree vbase_types;
- tree vbases;
- tree binfo;
-
- binfo = TYPE_BINFO (type);
- vbase_types = NULL_TREE;
- dfs_walk (binfo, dfs_get_vbase_types, unmarkedp, &vbase_types);
- dfs_walk (binfo, dfs_unmark, markedp, 0);
- /* Rely upon the reverse dfs ordering from dfs_get_vbase_types, and now
- reverse it so that we get normal dfs ordering. */
- vbase_types = nreverse (vbase_types);
-
- /* unmark marked vbases */
- for (vbases = vbase_types; vbases; vbases = TREE_CHAIN (vbases))
- CLEAR_BINFO_VBASE_MARKED (vbases);
-
- return vbase_types;
-}
-
-/* If we want debug info for a type TYPE, make sure all its base types
- are also marked as being potentially interesting. This avoids
- the problem of not writing any debug info for intermediate basetypes
- that have abstract virtual functions. Also mark member types. */
+/* Write out the debugging information for TYPE, whose vtable is being
+ emitted. Also walk through our bases and note that we want to
+ write out information for them. This avoids the problem of not
+ writing any debug info for intermediate basetypes whose
+ constructors, and thus the references to their vtables, and thus
+ the vtables themselves, were optimized away. */
void
note_debug_info_needed (type)
tree type;
{
- tree field;
-
- if (current_template_parms)
- return;
-
- if (TYPE_BEING_DEFINED (type))
- /* We can't go looking for the base types and fields just yet. */
- return;
-
- /* We can't do the TYPE_DECL_SUPPRESS_DEBUG thing with DWARF, which
- does not support name references between translation units. Well, we
- could, but that would mean putting global labels in the debug output
- before each exported type and each of its functions and static data
- members. */
- if (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG)
- return;
-
- dfs_walk (TYPE_BINFO (type), dfs_debug_mark, dfs_debug_unmarkedp, 0);
- for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
+ if (TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type)))
{
- tree ttype;
- if (TREE_CODE (field) == FIELD_DECL
- && IS_AGGR_TYPE (ttype = target_type (TREE_TYPE (field)))
- && dfs_debug_unmarkedp (TYPE_BINFO (ttype), 0))
- note_debug_info_needed (ttype);
+ TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type)) = 0;
+ rest_of_type_compilation (type, toplevel_bindings_p ());
}
+
+ dfs_walk (TYPE_BINFO (type), dfs_debug_mark, dfs_debug_unmarkedp, 0);
}
/* Subroutines of push_class_decls (). */
@@ -2994,7 +2444,7 @@ setup_class_bindings (name, type_binding_p)
binding. This means that we already processed this binding
above. */
my_friendly_assert (type_binding_p, 19990401);
- else
+ else if (value_binding)
{
if (TREE_CODE (value_binding) == TREE_LIST
&& TREE_TYPE (value_binding) == error_mark_node)
@@ -3059,7 +2509,7 @@ dfs_push_decls (binfo, data)
&& TREE_CODE (fields) != USING_DECL)
setup_class_bindings (DECL_NAME (fields), /*type_binding_p=*/0);
else if (TREE_CODE (fields) == FIELD_DECL
- && ANON_UNION_TYPE_P (TREE_TYPE (fields)))
+ && ANON_AGGR_TYPE_P (TREE_TYPE (fields)))
dfs_push_decls (TYPE_BINFO (TREE_TYPE (fields)), data);
method_vec = (CLASS_TYPE_P (type)
@@ -3096,24 +2546,13 @@ void
push_class_decls (type)
tree type;
{
- struct obstack *ambient_obstack = current_obstack;
search_stack = push_search_level (search_stack, &search_obstack);
- /* Build up all the relevant bindings and such on the cache
- obstack. That way no memory is wasted when we throw away the
- cache later. */
- push_cache_obstack ();
-
/* Enter type declarations and mark. */
dfs_walk (TYPE_BINFO (type), dfs_push_type_decls, unmarked_pushdecls_p, 0);
/* Enter non-type declarations and unmark. */
dfs_walk (TYPE_BINFO (type), dfs_push_decls, marked_pushdecls_p, 0);
-
- /* Undo the call to push_cache_obstack above. */
- pop_obstacks ();
-
- current_obstack = ambient_obstack;
}
/* Here's a subroutine we need because C lacks lambdas. */
@@ -3133,7 +2572,7 @@ dfs_unuse_fields (binfo, data)
TREE_USED (fields) = 0;
if (DECL_NAME (fields) == NULL_TREE
- && TREE_CODE (TREE_TYPE (fields)) == UNION_TYPE)
+ && ANON_AGGR_TYPE_P (TREE_TYPE (fields)))
unuse_fields (TREE_TYPE (fields));
}
@@ -3174,7 +2613,6 @@ void
init_search_processing ()
{
gcc_obstack_init (&search_obstack);
- _vptr_name = get_identifier ("_vptr");
}
void
@@ -3190,8 +2628,6 @@ reinit_search_statistics ()
#endif /* GATHER_STATISTICS */
}
-#define scratch_tree_cons expr_tree_cons
-
static tree
add_conversions (binfo, data)
tree binfo;
@@ -3201,6 +2637,10 @@ add_conversions (binfo, data)
tree method_vec = CLASSTYPE_METHOD_VEC (BINFO_TYPE (binfo));
tree *conversions = (tree *) data;
+ /* Some builtin types have no method vector, not even an empty one. */
+ if (!method_vec)
+ return NULL_TREE;
+
for (i = 2; i < TREE_VEC_LENGTH (method_vec); ++i)
{
tree tmp = TREE_VEC_ELT (method_vec, i);
@@ -3214,13 +2654,19 @@ add_conversions (binfo, data)
/* Make sure we don't already have this conversion. */
if (! IDENTIFIER_MARKED (name))
{
- *conversions = scratch_tree_cons (binfo, tmp, *conversions);
+ *conversions = tree_cons (binfo, tmp, *conversions);
IDENTIFIER_MARKED (name) = 1;
}
}
return NULL_TREE;
}
+/* Return a TREE_LIST containing all the non-hidden user-defined
+ conversion functions for TYPE (and its base-classes). The
+ TREE_VALUE of each node is a FUNCTION_DECL or an OVERLOAD
+ containing the conversion functions. The TREE_PURPOSE is the BINFO
+ from which the conversion functions in this node were selected. */
+
tree
lookup_conversions (type)
tree type;
@@ -3228,7 +2674,7 @@ lookup_conversions (type)
tree t;
tree conversions = NULL_TREE;
- if (TYPE_SIZE (type))
+ if (COMPLETE_TYPE_P (type))
bfs_walk (TYPE_BINFO (type), add_conversions, 0, &conversions);
for (t = conversions; t; t = TREE_CHAIN (t))
@@ -3298,53 +2744,78 @@ types_overlap_p (empty_type, next_type)
return oi.found_overlap;
}
-struct bfv_info {
- tree vbases;
- tree var;
-};
+/* Given a vtable VAR, determine which of the inherited classes the vtable
+ inherits (in a loose sense) functions from.
-static tree
-dfs_bfv_queue_p (binfo, data)
- tree binfo;
- void *data;
+ FIXME: This does not work with the new ABI. */
+
+tree
+binfo_for_vtable (var)
+ tree var;
{
- struct bfv_info *bfvi = (struct bfv_info *) data;
+ tree main_binfo = TYPE_BINFO (DECL_CONTEXT (var));
+ tree binfos = TYPE_BINFO_BASETYPES (BINFO_TYPE (main_binfo));
+ int n_baseclasses = CLASSTYPE_N_BASECLASSES (BINFO_TYPE (main_binfo));
+ int i;
- /* Use the real virtual base class objects, not the placeholders in
- the usual hierarchy. */
- if (TREE_VIA_VIRTUAL (binfo))
- return binfo_member (BINFO_TYPE (binfo), bfvi->vbases);
-
- return binfo;
+ for (i = 0; i < n_baseclasses; i++)
+ {
+ tree base_binfo = TREE_VEC_ELT (binfos, i);
+ if (base_binfo != NULL_TREE && BINFO_VTABLE (base_binfo) == var)
+ return base_binfo;
+ }
+
+ /* If no secondary base classes matched, return the primary base, if
+ there is one. */
+ if (CLASSTYPE_HAS_PRIMARY_BASE_P (BINFO_TYPE (main_binfo)))
+ return get_primary_binfo (main_binfo);
+
+ return main_binfo;
}
-/* Passed to dfs_walk_real by binfo_for_vtable; determine if bvtable
- comes from BINFO. */
+/* Returns the binfo of the first direct or indirect virtual base derived
+ from BINFO, or NULL if binfo is not via virtual. */
-static tree
-dfs_bfv_helper (binfo, data)
+tree
+binfo_from_vbase (binfo)
tree binfo;
- void *data;
{
- struct bfv_info *bfvi = (struct bfv_info *) data;
+ for (; binfo; binfo = BINFO_INHERITANCE_CHAIN (binfo))
+ {
+ if (TREE_VIA_VIRTUAL (binfo))
+ return binfo;
+ }
+ return NULL_TREE;
+}
- if (BINFO_VTABLE (binfo) == bfvi->var)
- return binfo;
+/* Returns the binfo of the first direct or indirect virtual base derived
+ from BINFO up to the TREE_TYPE, LIMIT, or NULL if binfo is not
+ via virtual. */
+
+tree
+binfo_via_virtual (binfo, limit)
+ tree binfo;
+ tree limit;
+{
+ for (; binfo && (!limit || !same_type_p (BINFO_TYPE (binfo), limit));
+ binfo = BINFO_INHERITANCE_CHAIN (binfo))
+ {
+ if (TREE_VIA_VIRTUAL (binfo))
+ return binfo;
+ }
return NULL_TREE;
}
-/* Given a vtable VAR, determine which binfo it comes from. */
+/* Returns the BINFO (if any) for the virtual baseclass T of the class
+ C from the CLASSTYPE_VBASECLASSES list. */
tree
-binfo_for_vtable (var)
- tree var;
+binfo_for_vbase (basetype, classtype)
+ tree basetype;
+ tree classtype;
{
- tree type;
- struct bfv_info bfvi;
+ tree binfo;
- type = DECL_CONTEXT (var);
- bfvi.vbases = CLASSTYPE_VBASECLASSES (type);
- bfvi.var = var;
- return dfs_walk_real (TYPE_BINFO (type),
- 0, dfs_bfv_helper, dfs_bfv_queue_p, &bfvi);
+ binfo = purpose_member (basetype, CLASSTYPE_VBASECLASSES (classtype));
+ return binfo ? TREE_VALUE (binfo) : NULL_TREE;
}
diff --git a/contrib/gcc/cp/semantics.c b/contrib/gcc/cp/semantics.c
index 7267f46..603326c 100644
--- a/contrib/gcc/cp/semantics.c
+++ b/contrib/gcc/cp/semantics.c
@@ -3,7 +3,7 @@
building RTL. These routines are used both during actual parsing
and during the instantiation of template functions.
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Mark Mitchell (mmitchell@usa.net) based on code found
formerly in parse.y and pt.c.
@@ -28,9 +28,17 @@
#include "system.h"
#include "tree.h"
#include "cp-tree.h"
+#include "tree-inline.h"
#include "except.h"
#include "lex.h"
#include "toplev.h"
+#include "flags.h"
+#include "ggc.h"
+#include "rtl.h"
+#include "expr.h"
+#include "output.h"
+#include "timevar.h"
+#include "debug.h"
/* There routines provide a modular interface to perform many parsing
operations. They may therefore be used during actual parsing, or
@@ -41,51 +49,188 @@
parsing into this file; that will make implementing the new parser
much easier since it will be able to make use of these routines. */
-/* When parsing a template, LAST_TREE contains the last statement
- parsed. These are chained together through the TREE_CHAIN field,
- but often need to be re-organized since the parse is performed
- bottom-up. This macro makes LAST_TREE the indicated SUBSTMT of
- STMT. */
-
-#define RECHAIN_STMTS(stmt, substmt, last) \
- do { \
- substmt = last; \
- TREE_CHAIN (stmt) = NULL_TREE; \
- last_tree = stmt; \
+static tree maybe_convert_cond PARAMS ((tree));
+static tree simplify_aggr_init_exprs_r PARAMS ((tree *, int *, void *));
+static void deferred_type_access_control PARAMS ((void));
+static void emit_associated_thunks PARAMS ((tree));
+static void genrtl_try_block PARAMS ((tree));
+static void genrtl_eh_spec_block PARAMS ((tree));
+static void genrtl_handler PARAMS ((tree));
+static void genrtl_ctor_stmt PARAMS ((tree));
+static void genrtl_subobject PARAMS ((tree));
+static void genrtl_named_return_value PARAMS ((void));
+static void cp_expand_stmt PARAMS ((tree));
+static void genrtl_start_function PARAMS ((tree));
+static void genrtl_finish_function PARAMS ((tree));
+static tree clear_decl_rtl PARAMS ((tree *, int *, void *));
+
+/* Finish processing the COND, the SUBSTMT condition for STMT. */
+
+#define FINISH_COND(COND, STMT, SUBSTMT) \
+ do { \
+ if (last_tree != (STMT)) \
+ { \
+ RECHAIN_STMTS (STMT, SUBSTMT); \
+ if (!processing_template_decl) \
+ { \
+ (COND) = build_tree_list (SUBSTMT, COND); \
+ (SUBSTMT) = (COND); \
+ } \
+ } \
+ else \
+ (SUBSTMT) = (COND); \
} while (0)
-#define RECHAIN_STMTS_FROM_LAST(stmt, substmt) \
- RECHAIN_STMTS (stmt, substmt, last_tree)
+/* Returns non-zero if the current statement is a full expression,
+ i.e. temporaries created during that statement should be destroyed
+ at the end of the statement. */
-#define RECHAIN_STMTS_FROM_CHAIN(stmt, substmt) \
- RECHAIN_STMTS (stmt, substmt, TREE_CHAIN (stmt))
+int
+stmts_are_full_exprs_p ()
+{
+ return current_stmt_tree ()->stmts_are_full_exprs_p;
+}
+
+/* Returns the stmt_tree (if any) to which statements are currently
+ being added. If there is no active statement-tree, NULL is
+ returned. */
+
+stmt_tree
+current_stmt_tree ()
+{
+ return (cfun
+ ? &cfun->language->x_stmt_tree
+ : &scope_chain->x_stmt_tree);
+}
+
+/* Nonzero if TYPE is an anonymous union or struct type. We have to use a
+ flag for this because "A union for which objects or pointers are
+ declared is not an anonymous union" [class.union]. */
+
+int
+anon_aggr_type_p (node)
+ tree node;
+{
+ return (CLASS_TYPE_P (node) && TYPE_LANG_SPECIFIC(node)->anon_aggr);
+}
+
+/* Finish a scope. */
+
+tree
+do_poplevel ()
+{
+ tree block = NULL_TREE;
+
+ if (stmts_are_full_exprs_p ())
+ {
+ tree scope_stmts = NULL_TREE;
+
+ if (!processing_template_decl)
+ scope_stmts = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
+
+ block = poplevel (kept_level_p (), 1, 0);
+ if (block && !processing_template_decl)
+ {
+ SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmts)) = block;
+ SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmts)) = block;
+ }
+ }
+
+ return block;
+}
+
+/* Begin a new scope. */
+
+void
+do_pushlevel ()
+{
+ if (stmts_are_full_exprs_p ())
+ {
+ pushlevel (0);
+ if (!processing_template_decl)
+ add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
+ }
+}
+
+/* Finish a goto-statement. */
+
+tree
+finish_goto_stmt (destination)
+ tree destination;
+{
+ if (TREE_CODE (destination) == IDENTIFIER_NODE)
+ destination = lookup_label (destination);
+
+ /* We warn about unused labels with -Wunused. That means we have to
+ mark the used labels as used. */
+ if (TREE_CODE (destination) == LABEL_DECL)
+ TREE_USED (destination) = 1;
+
+ if (TREE_CODE (destination) != LABEL_DECL)
+ /* We don't inline calls to functions with computed gotos.
+ Those functions are typically up to some funny business,
+ and may be depending on the labels being at particular
+ addresses, or some such. */
+ DECL_UNINLINABLE (current_function_decl) = 1;
+
+ check_goto (destination);
+
+ return add_stmt (build_stmt (GOTO_STMT, destination));
+}
+
+/* COND is the condition-expression for an if, while, etc.,
+ statement. Convert it to a boolean value, if appropriate. */
+
+tree
+maybe_convert_cond (cond)
+ tree cond;
+{
+ /* Empty conditions remain empty. */
+ if (!cond)
+ return NULL_TREE;
+
+ /* Wait until we instantiate templates before doing conversion. */
+ if (processing_template_decl)
+ return cond;
+
+ /* Do the conversion. */
+ cond = convert_from_reference (cond);
+ return condition_conversion (cond);
+}
/* Finish an expression-statement, whose EXPRESSION is as indicated. */
-void
+tree
finish_expr_stmt (expr)
tree expr;
{
+ tree r = NULL_TREE;
+
if (expr != NULL_TREE)
{
- if (!processing_template_decl)
- {
- emit_line_note (input_filename, lineno);
- /* Do default conversion if safe and possibly important,
- in case within ({...}). */
- if ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
+ if (!processing_template_decl
+ && !(stmts_are_full_exprs_p ())
+ && ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
&& lvalue_p (expr))
- || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE)
- expr = default_conversion (expr);
- }
+ || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE))
+ expr = default_conversion (expr);
+
+ if (stmts_are_full_exprs_p ())
+ expr = convert_to_void (expr, "statement");
- cplus_expand_expr_stmt (expr);
- clear_momentary ();
+ r = add_stmt (build_stmt (EXPR_STMT, expr));
}
finish_stmt ();
+
+ /* This was an expression-statement, so we save the type of the
+ expression. */
+ last_expr_type = expr ? TREE_TYPE (expr) : NULL_TREE;
+
+ return r;
}
+
/* Begin an if-statement. Returns a newly created IF_STMT if
appropriate. */
@@ -93,17 +238,9 @@ tree
begin_if_stmt ()
{
tree r;
-
- if (processing_template_decl)
- {
- r = build_min_nt (IF_STMT, NULL_TREE, NULL_TREE, NULL_TREE);
- add_tree (r);
- }
- else
- r = NULL_TREE;
-
do_pushlevel ();
-
+ r = build_stmt (IF_STMT, NULL_TREE, NULL_TREE, NULL_TREE);
+ add_stmt (r);
return r;
}
@@ -115,18 +252,8 @@ finish_if_stmt_cond (cond, if_stmt)
tree cond;
tree if_stmt;
{
- if (processing_template_decl)
- {
- if (last_tree != if_stmt)
- RECHAIN_STMTS_FROM_LAST (if_stmt, IF_COND (if_stmt));
- else
- IF_COND (if_stmt) = copy_to_permanent (cond);
- }
- else
- {
- emit_line_note (input_filename, lineno);
- expand_start_cond (condition_conversion (cond), 0);
- }
+ cond = maybe_convert_cond (cond);
+ FINISH_COND (cond, if_stmt, IF_COND (if_stmt));
}
/* Finish the then-clause of an if-statement, which may be given by
@@ -136,15 +263,9 @@ tree
finish_then_clause (if_stmt)
tree if_stmt;
{
- if (processing_template_decl)
- {
- RECHAIN_STMTS_FROM_CHAIN (if_stmt,
- THEN_CLAUSE (if_stmt));
- last_tree = if_stmt;
- return if_stmt;
- }
- else
- return NULL_TREE;
+ RECHAIN_STMTS (if_stmt, THEN_CLAUSE (if_stmt));
+ last_tree = if_stmt;
+ return if_stmt;
}
/* Begin the else-clause of an if-statement. */
@@ -152,8 +273,6 @@ finish_then_clause (if_stmt)
void
begin_else_clause ()
{
- if (!processing_template_decl)
- expand_start_else ();
}
/* Finish the else-clause of an if-statement, which may be given by
@@ -163,22 +282,31 @@ void
finish_else_clause (if_stmt)
tree if_stmt;
{
- if (processing_template_decl)
- RECHAIN_STMTS_FROM_CHAIN (if_stmt, ELSE_CLAUSE (if_stmt));
+ RECHAIN_STMTS (if_stmt, ELSE_CLAUSE (if_stmt));
}
-/* Finsh an if-statement. */
+/* Finish an if-statement. */
void
finish_if_stmt ()
{
- if (!processing_template_decl)
- expand_end_cond ();
-
do_poplevel ();
finish_stmt ();
}
+void
+clear_out_block ()
+{
+ /* If COND wasn't a declaration, clear out the
+ block we made for it and start a new one here so the
+ optimization in expand_end_loop will work. */
+ if (getdecls () == NULL_TREE)
+ {
+ do_poplevel ();
+ do_pushlevel ();
+ }
+}
+
/* Begin a while-statement. Returns a newly created WHILE_STMT if
appropriate. */
@@ -186,26 +314,13 @@ tree
begin_while_stmt ()
{
tree r;
-
- if (processing_template_decl)
- {
- r = build_min_nt (WHILE_STMT, NULL_TREE, NULL_TREE);
- add_tree (r);
- }
- else
- {
- emit_nop ();
- emit_line_note (input_filename, lineno);
- expand_start_loop (1);
- r = NULL_TREE;
- }
-
+ r = build_stmt (WHILE_STMT, NULL_TREE, NULL_TREE);
+ add_stmt (r);
do_pushlevel ();
-
return r;
}
-/* Process the COND of an if-statement, which may be given by
+/* Process the COND of a while-statement, which may be given by
WHILE_STMT. */
void
@@ -213,28 +328,9 @@ finish_while_stmt_cond (cond, while_stmt)
tree cond;
tree while_stmt;
{
- if (processing_template_decl)
- {
- if (last_tree != while_stmt)
- RECHAIN_STMTS_FROM_LAST (while_stmt,
- WHILE_COND (while_stmt));
- else
- TREE_OPERAND (while_stmt, 0) = copy_to_permanent (cond);
- }
- else
- {
- emit_line_note (input_filename, lineno);
- expand_exit_loop_if_false (0, condition_conversion (cond));
- }
-
- /* If COND wasn't a declaration, clear out the
- block we made for it and start a new one here so the
- optimization in expand_end_loop will work. */
- if (getdecls () == NULL_TREE)
- {
- do_poplevel ();
- do_pushlevel ();
- }
+ cond = maybe_convert_cond (cond);
+ FINISH_COND (cond, while_stmt, WHILE_COND (while_stmt));
+ clear_out_block ();
}
/* Finish a while-statement, which may be given by WHILE_STMT. */
@@ -244,11 +340,7 @@ finish_while_stmt (while_stmt)
tree while_stmt;
{
do_poplevel ();
-
- if (processing_template_decl)
- RECHAIN_STMTS_FROM_CHAIN (while_stmt, WHILE_BODY (while_stmt));
- else
- expand_end_loop ();
+ RECHAIN_STMTS (while_stmt, WHILE_BODY (while_stmt));
finish_stmt ();
}
@@ -258,19 +350,9 @@ finish_while_stmt (while_stmt)
tree
begin_do_stmt ()
{
- if (processing_template_decl)
- {
- tree r = build_min_nt (DO_STMT, NULL_TREE, NULL_TREE);
- add_tree (r);
- return r;
- }
- else
- {
- emit_nop ();
- emit_line_note (input_filename, lineno);
- expand_start_loop_continue_elsewhere (1);
- return NULL_TREE;
- }
+ tree r = build_stmt (DO_STMT, NULL_TREE, NULL_TREE);
+ add_stmt (r);
+ return r;
}
/* Finish the body of a do-statement, which may be given by DO_STMT. */
@@ -279,10 +361,7 @@ void
finish_do_body (do_stmt)
tree do_stmt;
{
- if (processing_template_decl)
- RECHAIN_STMTS_FROM_CHAIN (do_stmt, DO_BODY (do_stmt));
- else
- expand_loop_continue_here ();
+ RECHAIN_STMTS (do_stmt, DO_BODY (do_stmt));
}
/* Finish a do-statement, which may be given by DO_STMT, and whose
@@ -293,29 +372,37 @@ finish_do_stmt (cond, do_stmt)
tree cond;
tree do_stmt;
{
- if (processing_template_decl)
- DO_COND (do_stmt) = copy_to_permanent (cond);
- else
- {
- emit_line_note (input_filename, lineno);
- expand_exit_loop_if_false (0, condition_conversion (cond));
- expand_end_loop ();
- }
-
- clear_momentary ();
+ cond = maybe_convert_cond (cond);
+ DO_COND (do_stmt) = cond;
finish_stmt ();
}
/* Finish a return-statement. The EXPRESSION returned, if any, is as
indicated. */
-void
+tree
finish_return_stmt (expr)
tree expr;
{
- emit_line_note (input_filename, lineno);
- c_expand_return (expr);
+ tree r;
+
+ if (!processing_template_decl)
+ expr = check_return_expr (expr);
+ if (!processing_template_decl)
+ {
+ if (DECL_DESTRUCTOR_P (current_function_decl))
+ {
+ /* Similarly, all destructors must run destructors for
+ base-classes before returning. So, all returns in a
+ destructor get sent to the DTOR_LABEL; finish_function emits
+ code to return a value there. */
+ return finish_goto_stmt (dtor_label);
+ }
+ }
+ r = add_stmt (build_stmt (RETURN_STMT, expr));
finish_stmt ();
+
+ return r;
}
/* Begin a for-statement. Returns a new FOR_STMT if appropriate. */
@@ -325,16 +412,11 @@ begin_for_stmt ()
{
tree r;
- if (processing_template_decl)
- {
- r = build_min_nt (FOR_STMT, NULL_TREE, NULL_TREE,
- NULL_TREE, NULL_TREE);
- add_tree (r);
- }
- else
- r = NULL_TREE;
-
- if (flag_new_for_scope > 0)
+ r = build_stmt (FOR_STMT, NULL_TREE, NULL_TREE,
+ NULL_TREE, NULL_TREE);
+ NEW_FOR_SCOPE_P (r) = flag_new_for_scope > 0;
+ add_stmt (r);
+ if (NEW_FOR_SCOPE_P (r))
{
do_pushlevel ();
note_level_for_for ();
@@ -350,18 +432,8 @@ void
finish_for_init_stmt (for_stmt)
tree for_stmt;
{
- if (processing_template_decl)
- {
- if (last_tree != for_stmt)
- RECHAIN_STMTS_FROM_CHAIN (for_stmt, FOR_INIT_STMT (for_stmt));
- }
- else
- {
- emit_nop ();
- emit_line_note (input_filename, lineno);
- expand_start_loop_continue_elsewhere (1);
- }
-
+ if (last_tree != for_stmt)
+ RECHAIN_STMTS (for_stmt, FOR_INIT_STMT (for_stmt));
do_pushlevel ();
}
@@ -373,28 +445,9 @@ finish_for_cond (cond, for_stmt)
tree cond;
tree for_stmt;
{
- if (processing_template_decl)
- {
- if (last_tree != for_stmt)
- RECHAIN_STMTS_FROM_LAST (for_stmt, FOR_COND (for_stmt));
- else
- FOR_COND (for_stmt) = copy_to_permanent (cond);
- }
- else
- {
- emit_line_note (input_filename, lineno);
- if (cond)
- expand_exit_loop_if_false (0, condition_conversion (cond));
- }
-
- /* If the cond wasn't a declaration, clear out the
- block we made for it and start a new one here so the
- optimization in expand_end_loop will work. */
- if (getdecls () == NULL_TREE)
- {
- do_poplevel ();
- do_pushlevel ();
- }
+ cond = maybe_convert_cond (cond);
+ FINISH_COND (cond, for_stmt, FOR_COND (for_stmt));
+ clear_out_block ();
}
/* Finish the increment-EXPRESSION in a for-statement, which may be
@@ -405,12 +458,7 @@ finish_for_expr (expr, for_stmt)
tree expr;
tree for_stmt;
{
- if (processing_template_decl)
- FOR_EXPR (for_stmt) = expr;
-
- /* Don't let the tree nodes for EXPR be discarded
- by clear_momentary during the parsing of the next stmt. */
- push_momentary ();
+ FOR_EXPR (for_stmt) = expr;
}
/* Finish the body of a for-statement, which may be given by
@@ -418,172 +466,170 @@ finish_for_expr (expr, for_stmt)
provided. */
void
-finish_for_stmt (expr, for_stmt)
- tree expr;
+finish_for_stmt (for_stmt)
tree for_stmt;
{
/* Pop the scope for the body of the loop. */
do_poplevel ();
-
- if (processing_template_decl)
- RECHAIN_STMTS_FROM_CHAIN (for_stmt, FOR_BODY (for_stmt));
- else
- {
- emit_line_note (input_filename, lineno);
- expand_loop_continue_here ();
- if (expr)
- cplus_expand_expr_stmt (expr);
- expand_end_loop ();
- }
-
- pop_momentary ();
-
- if (flag_new_for_scope > 0)
+ RECHAIN_STMTS (for_stmt, FOR_BODY (for_stmt));
+ if (NEW_FOR_SCOPE_P (for_stmt))
do_poplevel ();
-
finish_stmt ();
}
/* Finish a break-statement. */
-void
+tree
finish_break_stmt ()
{
- emit_line_note (input_filename, lineno);
- if (processing_template_decl)
- add_tree (build_min_nt (BREAK_STMT));
- else if ( ! expand_exit_something ())
- cp_error ("break statement not within loop or switch");
+ return add_stmt (build_break_stmt ());
}
/* Finish a continue-statement. */
-void
+tree
finish_continue_stmt ()
{
- emit_line_note (input_filename, lineno);
- if (processing_template_decl)
- add_tree (build_min_nt (CONTINUE_STMT));
- else if (! expand_continue_loop (0))
- cp_error ("continue statement not within a loop");
+ return add_stmt (build_continue_stmt ());
}
-/* Begin a switch-statement. */
+/* Begin a switch-statement. Returns a new SWITCH_STMT if
+ appropriate. */
-void
+tree
begin_switch_stmt ()
{
+ tree r;
+ r = build_stmt (SWITCH_STMT, NULL_TREE, NULL_TREE);
+ add_stmt (r);
do_pushlevel ();
+ return r;
}
-/* Finish the cond of a switch-statement. Returns a new
- SWITCH_STMT if appropriate. */
+/* Finish the cond of a switch-statement. */
-tree
-finish_switch_cond (cond)
+void
+finish_switch_cond (cond, switch_stmt)
tree cond;
+ tree switch_stmt;
{
- tree r;
-
- if (processing_template_decl)
- {
- r = build_min_nt (SWITCH_STMT, cond, NULL_TREE);
- add_tree (r);
- }
- else if (cond != error_mark_node)
- {
- emit_line_note (input_filename, lineno);
- c_expand_start_case (cond);
- r = NULL_TREE;
- }
- else
+ if (!processing_template_decl)
{
- /* The code is in error, but we don't want expand_end_case to
- crash. */
- c_expand_start_case (boolean_false_node);
- r = NULL_TREE;
- }
-
- push_switch ();
+ tree type;
+ tree index;
- /* Don't let the tree nodes for COND be discarded by
- clear_momentary during the parsing of the next stmt. */
- push_momentary ();
+ /* Convert the condition to an integer or enumeration type. */
+ cond = build_expr_type_conversion (WANT_INT | WANT_ENUM, cond, 1);
+ if (cond == NULL_TREE)
+ {
+ error ("switch quantity not an integer");
+ cond = error_mark_node;
+ }
+ if (cond != error_mark_node)
+ {
+ cond = default_conversion (cond);
+ cond = fold (build1 (CLEANUP_POINT_EXPR, TREE_TYPE (cond), cond));
+ }
- return r;
+ type = TREE_TYPE (cond);
+ index = get_unwidened (cond, NULL_TREE);
+ /* We can't strip a conversion from a signed type to an unsigned,
+ because if we did, int_fits_type_p would do the wrong thing
+ when checking case values for being in range,
+ and it's too hard to do the right thing. */
+ if (TREE_UNSIGNED (TREE_TYPE (cond))
+ == TREE_UNSIGNED (TREE_TYPE (index)))
+ cond = index;
+ }
+ FINISH_COND (cond, switch_stmt, SWITCH_COND (switch_stmt));
+ push_switch (switch_stmt);
}
/* Finish the body of a switch-statement, which may be given by
SWITCH_STMT. The COND to switch on is indicated. */
void
-finish_switch_stmt (cond, switch_stmt)
- tree cond;
+finish_switch_stmt (switch_stmt)
tree switch_stmt;
{
- if (processing_template_decl)
- RECHAIN_STMTS_FROM_CHAIN (switch_stmt, SWITCH_BODY (switch_stmt));
- else
- expand_end_case (cond);
- pop_momentary ();
+ RECHAIN_STMTS (switch_stmt, SWITCH_BODY (switch_stmt));
pop_switch ();
do_poplevel ();
finish_stmt ();
}
-/* Finish a case-label. */
-
-void
-finish_case_label (low_value, high_value)
- tree low_value;
- tree high_value;
-{
- do_case (low_value, high_value);
-}
-
-
-/* Finish a goto-statement. */
+/* Generate the RTL for T, which is a TRY_BLOCK. */
-void
-finish_goto_stmt (destination)
- tree destination;
+static void
+genrtl_try_block (t)
+ tree t;
{
- if (processing_template_decl)
- add_tree (build_min_nt (GOTO_STMT, destination));
+ if (CLEANUP_P (t))
+ {
+ expand_eh_region_start ();
+ expand_stmt (TRY_STMTS (t));
+ expand_eh_region_end_cleanup (TRY_HANDLERS (t));
+ }
else
{
- emit_line_note (input_filename, lineno);
+ if (!FN_TRY_BLOCK_P (t))
+ emit_line_note (input_filename, lineno);
+
+ expand_eh_region_start ();
+ expand_stmt (TRY_STMTS (t));
- if (TREE_CODE (destination) == IDENTIFIER_NODE)
+ if (FN_TRY_BLOCK_P (t))
{
- tree decl = lookup_label (destination);
- TREE_USED (decl) = 1;
- expand_goto (decl);
+ expand_start_all_catch ();
+ in_function_try_handler = 1;
+ expand_stmt (TRY_HANDLERS (t));
+ in_function_try_handler = 0;
+ expand_end_all_catch ();
+ }
+ else
+ {
+ expand_start_all_catch ();
+ expand_stmt (TRY_HANDLERS (t));
+ expand_end_all_catch ();
}
- else
- expand_computed_goto (destination);
}
}
+/* Generate the RTL for T, which is an EH_SPEC_BLOCK. */
+
+static void
+genrtl_eh_spec_block (t)
+ tree t;
+{
+ expand_eh_region_start ();
+ expand_stmt (EH_SPEC_STMTS (t));
+ expand_eh_region_end_allowed (EH_SPEC_RAISES (t),
+ build_call (call_unexpected_node,
+ tree_cons (NULL_TREE,
+ build_exc_ptr (),
+ NULL_TREE)));
+}
+
/* Begin a try-block. Returns a newly-created TRY_BLOCK if
appropriate. */
tree
begin_try_block ()
{
- if (processing_template_decl)
- {
- tree r = build_min_nt (TRY_BLOCK, NULL_TREE,
- NULL_TREE);
- add_tree (r);
- return r;
- }
- else
- {
- emit_line_note (input_filename, lineno);
- expand_start_try_stmts ();
- return NULL_TREE;
- }
+ tree r = build_stmt (TRY_BLOCK, NULL_TREE, NULL_TREE);
+ add_stmt (r);
+ return r;
+}
+
+/* Likewise, for a function-try-block. */
+
+tree
+begin_function_try_block ()
+{
+ tree r = build_stmt (TRY_BLOCK, NULL_TREE, NULL_TREE);
+ FN_TRY_BLOCK_P (r) = 1;
+ add_stmt (r);
+ return r;
}
/* Finish a try-block, which may be given by TRY_BLOCK. */
@@ -592,12 +638,48 @@ void
finish_try_block (try_block)
tree try_block;
{
- if (processing_template_decl)
- RECHAIN_STMTS_FROM_LAST (try_block, TRY_STMTS (try_block));
- else
+ RECHAIN_STMTS (try_block, TRY_STMTS (try_block));
+}
+
+/* Finish the body of a cleanup try-block, which may be given by
+ TRY_BLOCK. */
+
+void
+finish_cleanup_try_block (try_block)
+ tree try_block;
+{
+ RECHAIN_STMTS (try_block, TRY_STMTS (try_block));
+}
+
+/* Finish an implicitly generated try-block, with a cleanup is given
+ by CLEANUP. */
+
+void
+finish_cleanup (cleanup, try_block)
+ tree cleanup;
+ tree try_block;
+{
+ TRY_HANDLERS (try_block) = cleanup;
+ CLEANUP_P (try_block) = 1;
+}
+
+/* Likewise, for a function-try-block. */
+
+void
+finish_function_try_block (try_block)
+ tree try_block;
+{
+ if (TREE_CHAIN (try_block)
+ && TREE_CODE (TREE_CHAIN (try_block)) == CTOR_INITIALIZER)
{
- expand_start_all_catch ();
+ /* Chain the compound statement after the CTOR_INITIALIZER. */
+ TREE_CHAIN (TREE_CHAIN (try_block)) = last_tree;
+ /* And make the CTOR_INITIALIZER the body of the try-block. */
+ RECHAIN_STMTS (try_block, TRY_STMTS (try_block));
}
+ else
+ RECHAIN_STMTS (try_block, TRY_STMTS (try_block));
+ in_function_try_handler = 1;
}
/* Finish a handler-sequence for a try-block, which may be given by
@@ -607,12 +689,33 @@ void
finish_handler_sequence (try_block)
tree try_block;
{
- if (processing_template_decl)
- RECHAIN_STMTS_FROM_CHAIN (try_block, TRY_HANDLERS (try_block));
- else
- {
- expand_end_all_catch ();
- }
+ RECHAIN_STMTS (try_block, TRY_HANDLERS (try_block));
+ check_handlers (TRY_HANDLERS (try_block));
+}
+
+/* Likewise, for a function-try-block. */
+
+void
+finish_function_handler_sequence (try_block)
+ tree try_block;
+{
+ in_function_try_handler = 0;
+ RECHAIN_STMTS (try_block, TRY_HANDLERS (try_block));
+ check_handlers (TRY_HANDLERS (try_block));
+}
+
+/* Generate the RTL for T, which is a HANDLER. */
+
+static void
+genrtl_handler (t)
+ tree t;
+{
+ genrtl_do_pushlevel ();
+ if (!processing_template_decl)
+ expand_start_catch (HANDLER_TYPE (t));
+ expand_stmt (HANDLER_BODY (t));
+ if (!processing_template_decl)
+ expand_end_catch ();
}
/* Begin a handler. Returns a HANDLER if appropriate. */
@@ -621,43 +724,68 @@ tree
begin_handler ()
{
tree r;
-
- if (processing_template_decl)
- {
- r = build_min_nt (HANDLER, NULL_TREE, NULL_TREE);
- add_tree (r);
- }
- else
- r = NULL_TREE;
-
+ r = build_stmt (HANDLER, NULL_TREE, NULL_TREE);
+ add_stmt (r);
+ /* Create a binding level for the eh_info and the exception object
+ cleanup. */
do_pushlevel ();
-
+ note_level_for_catch ();
return r;
}
/* Finish the handler-parameters for a handler, which may be given by
- HANDLER. */
+ HANDLER. DECL is the declaration for the catch parameter, or NULL
+ if this is a `catch (...)' clause. */
void
-finish_handler_parms (handler)
+finish_handler_parms (decl, handler)
+ tree decl;
tree handler;
{
+ tree type = NULL_TREE;
if (processing_template_decl)
- RECHAIN_STMTS_FROM_CHAIN (handler, HANDLER_PARMS (handler));
+ {
+ if (decl)
+ {
+ decl = pushdecl (decl);
+ decl = push_template_decl (decl);
+ add_decl_stmt (decl);
+ RECHAIN_STMTS (handler, HANDLER_PARMS (handler));
+ type = TREE_TYPE (decl);
+ }
+ }
+ else
+ type = expand_start_catch_block (decl);
+
+ HANDLER_TYPE (handler) = type;
}
-/* Finish a handler, which may be given by HANDLER. */
+/* Finish a handler, which may be given by HANDLER. The BLOCKs are
+ the return value from the matching call to finish_handler_parms. */
void
finish_handler (handler)
tree handler;
{
- if (processing_template_decl)
- RECHAIN_STMTS_FROM_CHAIN (handler, HANDLER_BODY (handler));
- else
+ if (!processing_template_decl)
expand_end_catch_block ();
-
do_poplevel ();
+ RECHAIN_STMTS (handler, HANDLER_BODY (handler));
+}
+
+/* Generate the RTL for T, which is a CTOR_STMT. */
+
+static void
+genrtl_ctor_stmt (t)
+ tree t;
+{
+ if (CTOR_BEGIN_P (t))
+ begin_protect_partials ();
+ else
+ /* After this point, any exceptions will cause the
+ destructor to be executed, so we no longer need to worry
+ about destroying the various subobjects ourselves. */
+ end_protect_partials ();
}
/* Begin a compound-statement. If HAS_NO_SCOPE is non-zero, the
@@ -669,24 +797,35 @@ begin_compound_stmt (has_no_scope)
int has_no_scope;
{
tree r;
+ int is_try = 0;
- if (processing_template_decl)
+ r = build_stmt (COMPOUND_STMT, NULL_TREE);
+
+ if (last_tree && TREE_CODE (last_tree) == TRY_BLOCK)
+ is_try = 1;
+
+ add_stmt (r);
+ if (has_no_scope)
+ COMPOUND_STMT_NO_SCOPE (r) = 1;
+
+ last_expr_type = NULL_TREE;
+
+ if (!has_no_scope)
{
- r = build_min_nt (COMPOUND_STMT, NULL_TREE);
- add_tree (r);
- if (has_no_scope)
- COMPOUND_STMT_NO_SCOPE (r) = 1;
+ do_pushlevel ();
+ if (is_try)
+ note_level_for_try ();
}
else
- r = NULL_TREE;
-
- if (!has_no_scope)
- do_pushlevel ();
+ /* Normally, we try hard to keep the BLOCK for a
+ statement-expression. But, if it's a statement-expression with
+ a scopeless block, there's nothing to keep, and we don't want
+ to accidentally keep a block *inside* the scopeless block. */
+ keep_next_level (0);
return r;
}
-
/* Finish a compound-statement, which may be given by COMPOUND_STMT.
If HAS_NO_SCOPE is non-zero, the compound statement does not define
a scope. */
@@ -697,17 +836,22 @@ finish_compound_stmt (has_no_scope, compound_stmt)
tree compound_stmt;
{
tree r;
+ tree t;
if (!has_no_scope)
r = do_poplevel ();
else
r = NULL_TREE;
- if (processing_template_decl)
- RECHAIN_STMTS_FROM_CHAIN (compound_stmt,
- COMPOUND_BODY (compound_stmt));
+ RECHAIN_STMTS (compound_stmt, COMPOUND_BODY (compound_stmt));
+ /* When we call finish_stmt we will lose LAST_EXPR_TYPE. But, since
+ the precise purpose of that variable is store the type of the
+ last expression statement within the last compound statement, we
+ preserve the value. */
+ t = last_expr_type;
finish_stmt ();
+ last_expr_type = t;
return r;
}
@@ -716,60 +860,300 @@ finish_compound_stmt (has_no_scope, compound_stmt)
STRING, some OUTPUT_OPERANDS, some INPUT_OPERANDS, and some
CLOBBERS. */
-void
+tree
finish_asm_stmt (cv_qualifier, string, output_operands,
- input_operands, clobbers)
+ input_operands, clobbers)
tree cv_qualifier;
tree string;
tree output_operands;
tree input_operands;
tree clobbers;
{
+ tree r;
+ tree t;
+
if (TREE_CHAIN (string))
string = combine_strings (string);
- if (processing_template_decl)
+ if (cv_qualifier != NULL_TREE
+ && cv_qualifier != ridpointers[(int) RID_VOLATILE])
{
- tree r = build_min_nt (ASM_STMT, cv_qualifier, string,
- output_operands, input_operands,
- clobbers);
- add_tree (r);
+ warning ("%s qualifier ignored on asm",
+ IDENTIFIER_POINTER (cv_qualifier));
+ cv_qualifier = NULL_TREE;
}
- else
+
+ if (!processing_template_decl)
+ {
+ int i;
+ int ninputs;
+ int noutputs;
+
+ for (t = input_operands; t; t = TREE_CHAIN (t))
+ {
+ tree converted_operand
+ = decay_conversion (TREE_VALUE (t));
+
+ /* If the type of the operand hasn't been determined (e.g.,
+ because it involves an overloaded function), then issue
+ an error message. There's no context available to
+ resolve the overloading. */
+ if (TREE_TYPE (converted_operand) == unknown_type_node)
+ {
+ error ("type of asm operand `%E' could not be determined",
+ TREE_VALUE (t));
+ converted_operand = error_mark_node;
+ }
+ TREE_VALUE (t) = converted_operand;
+ }
+
+ ninputs = list_length (input_operands);
+ noutputs = list_length (output_operands);
+
+ for (i = 0, t = output_operands; t; t = TREE_CHAIN (t), ++i)
+ {
+ bool allows_mem;
+ bool allows_reg;
+ bool is_inout;
+ const char *constraint;
+ tree operand;
+
+ constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
+ operand = TREE_VALUE (output_operands);
+
+ if (!parse_output_constraint (&constraint,
+ i, ninputs, noutputs,
+ &allows_mem,
+ &allows_reg,
+ &is_inout))
+ {
+ /* By marking the type as erroneous, we will not try to
+ process this operand again in expand_asm_operands. */
+ TREE_TYPE (operand) = error_mark_node;
+ continue;
+ }
+
+ /* If the operand is a DECL that is going to end up in
+ memory, assume it is addressable. This is a bit more
+ conservative than it would ideally be; the exact test is
+ buried deep in expand_asm_operands and depends on the
+ DECL_RTL for the OPERAND -- which we don't have at this
+ point. */
+ if (!allows_reg && DECL_P (operand))
+ mark_addressable (operand);
+ }
+ }
+
+ r = build_stmt (ASM_STMT, cv_qualifier, string,
+ output_operands, input_operands,
+ clobbers);
+ return add_stmt (r);
+}
+
+/* Finish a label with the indicated NAME. */
+
+void
+finish_label_stmt (name)
+ tree name;
+{
+ tree decl = define_label (input_filename, lineno, name);
+ add_stmt (build_stmt (LABEL_STMT, decl));
+}
+
+/* Finish a series of declarations for local labels. G++ allows users
+ to declare "local" labels, i.e., labels with scope. This extension
+ is useful when writing code involving statement-expressions. */
+
+void
+finish_label_decl (name)
+ tree name;
+{
+ tree decl = declare_local_label (name);
+ add_decl_stmt (decl);
+}
+
+/* Generate the RTL for a SUBOBJECT. */
+
+static void
+genrtl_subobject (cleanup)
+ tree cleanup;
+{
+ add_partial_entry (cleanup);
+}
+
+/* We're in a constructor, and have just constructed a a subobject of
+ *THIS. CLEANUP is code to run if an exception is thrown before the
+ end of the current function is reached. */
+
+void
+finish_subobject (cleanup)
+ tree cleanup;
+{
+ tree r = build_stmt (SUBOBJECT, cleanup);
+ add_stmt (r);
+}
+
+/* When DECL goes out of scope, make sure that CLEANUP is executed. */
+
+void
+finish_decl_cleanup (decl, cleanup)
+ tree decl;
+ tree cleanup;
+{
+ add_stmt (build_stmt (CLEANUP_STMT, decl, cleanup));
+}
+
+/* Generate the RTL for a RETURN_INIT. */
+
+static void
+genrtl_named_return_value ()
+{
+ tree decl = DECL_RESULT (current_function_decl);
+
+ /* If this named return value comes in a register, put it in a
+ pseudo-register. */
+ if (DECL_REGISTER (decl))
{
- emit_line_note (input_filename, lineno);
- if (output_operands != NULL_TREE || input_operands != NULL_TREE
- || clobbers != NULL_TREE)
+ /* Note that the mode of the old DECL_RTL may be wider than the
+ mode of DECL_RESULT, depending on the calling conventions for
+ the processor. For example, on the Alpha, a 32-bit integer
+ is returned in a DImode register -- the DECL_RESULT has
+ SImode but the DECL_RTL for the DECL_RESULT has DImode. So,
+ here, we use the mode the back-end has already assigned for
+ the return value. */
+ SET_DECL_RTL (decl, gen_reg_rtx (GET_MODE (DECL_RTL (decl))));
+ if (TREE_ADDRESSABLE (decl))
+ put_var_into_stack (decl);
+ }
+
+ emit_local_var (decl);
+}
+
+/* Bind a name and initialization to the return value of
+ the current function. */
+
+void
+finish_named_return_value (return_id, init)
+ tree return_id, init;
+{
+ tree decl = DECL_RESULT (current_function_decl);
+
+ /* Give this error as many times as there are occurrences, so that
+ users can use Emacs compilation buffers to find and fix all such
+ places. */
+ if (pedantic)
+ pedwarn ("ISO C++ does not permit named return values");
+ cp_deprecated ("the named return value extension");
+
+ if (return_id != NULL_TREE)
+ {
+ if (DECL_NAME (decl) == NULL_TREE)
+ DECL_NAME (decl) = return_id;
+ else
{
- tree t;
-
- if (cv_qualifier != NULL_TREE
- && cv_qualifier != ridpointers[(int) RID_VOLATILE])
- cp_warning ("%s qualifier ignored on asm",
- IDENTIFIER_POINTER (cv_qualifier));
-
- for (t = input_operands; t; t = TREE_CHAIN (t))
- TREE_VALUE (t) = decay_conversion (TREE_VALUE (t));
-
- c_expand_asm_operands (string, output_operands,
- input_operands,
- clobbers,
- cv_qualifier
- == ridpointers[(int) RID_VOLATILE],
- input_filename, lineno);
+ error ("return identifier `%D' already in place", return_id);
+ return;
+ }
+ }
+
+ /* Can't let this happen for constructors. */
+ if (DECL_CONSTRUCTOR_P (current_function_decl))
+ {
+ error ("can't redefine default return value for constructors");
+ return;
+ }
+
+ /* If we have a named return value, put that in our scope as well. */
+ if (DECL_NAME (decl) != NULL_TREE)
+ {
+ /* Let `cp_finish_decl' know that this initializer is ok. */
+ DECL_INITIAL (decl) = init;
+ if (doing_semantic_analysis_p ())
+ pushdecl (decl);
+ if (!processing_template_decl)
+ {
+ cp_finish_decl (decl, init, NULL_TREE, 0);
+ add_stmt (build_stmt (RETURN_INIT, NULL_TREE, NULL_TREE));
}
else
+ add_stmt (build_stmt (RETURN_INIT, return_id, init));
+ }
+
+ /* Don't use tree-inlining for functions with named return values.
+ That doesn't work properly because we don't do any translation of
+ the RETURN_INITs when they are copied. */
+ DECL_UNINLINABLE (current_function_decl) = 1;
+}
+
+/* The INIT_LIST is a list of mem-initializers, in the order they were
+ written by the user. The TREE_VALUE of each node is a list of
+ initializers for a particular subobject. The TREE_PURPOSE is a
+ FIELD_DECL is the initializer is for a non-static data member, and
+ a class type if the initializer is for a base class. */
+
+void
+finish_mem_initializers (init_list)
+ tree init_list;
+{
+ tree member_init_list;
+ tree base_init_list;
+ tree last_base_warned_about;
+ tree next;
+ tree init;
+
+ member_init_list = NULL_TREE;
+ base_init_list = NULL_TREE;
+ last_base_warned_about = NULL_TREE;
+
+ for (init = init_list; init; init = next)
+ {
+ next = TREE_CHAIN (init);
+ if (TREE_CODE (TREE_PURPOSE (init)) == FIELD_DECL)
{
- /* Don't warn about redundant specification of 'volatile' here. */
- if (cv_qualifier != NULL_TREE
- && cv_qualifier != ridpointers[(int) RID_VOLATILE])
- cp_warning ("%s qualifier ignored on asm",
- IDENTIFIER_POINTER (cv_qualifier));
- expand_asm (string);
+ TREE_CHAIN (init) = member_init_list;
+ member_init_list = init;
+
+ /* We're running through the initializers from right to left
+ as we process them here. So, if we see a data member
+ initializer after we see a base initializer, that
+ actually means that the base initializer preceded the
+ data member initializer. */
+ if (warn_reorder && last_base_warned_about != base_init_list)
+ {
+ tree base;
+
+ for (base = base_init_list;
+ base != last_base_warned_about;
+ base = TREE_CHAIN (base))
+ {
+ warning ("base initializer for `%T'",
+ TREE_PURPOSE (base));
+ warning (" will be re-ordered to precede member initializations");
+ }
+
+ last_base_warned_about = base_init_list;
+ }
+ }
+ else
+ {
+ TREE_CHAIN (init) = base_init_list;
+ base_init_list = init;
}
-
- finish_stmt ();
}
+
+ if (processing_template_decl)
+ add_stmt (build_min_nt (CTOR_INITIALIZER,
+ member_init_list, base_init_list));
+ else
+ emit_base_init (member_init_list, base_init_list);
+}
+
+/* Returns the stack of SCOPE_STMTs for the current function. */
+
+tree *
+current_scope_stmt_stack ()
+{
+ return &cfun->language->x_scope_stmt_stack;
}
/* Finish a parenthesized expression EXPR. */
@@ -782,6 +1166,10 @@ finish_parenthesized_expr (expr)
/* This inhibits warnings in truthvalue_conversion. */
C_SET_EXP_ORIGINAL_CODE (expr, ERROR_MARK);
+ if (TREE_CODE (expr) == OFFSET_REF)
+ /* [expr.unary.op]/3 The qualified id of a pointer-to-member must not be
+ enclosed in parentheses. */
+ PTRMEM_OK_P (expr) = 0;
return expr;
}
@@ -791,12 +1179,48 @@ finish_parenthesized_expr (expr)
tree
begin_stmt_expr ()
{
- keep_next_level ();
- /* If we're processing_template_decl, then the upcoming compound
+ /* If we're outside a function, we won't have a statement-tree to
+ work with. But, if we see a statement-expression we need to
+ create one. */
+ if (! cfun && !last_tree)
+ begin_stmt_tree (&scope_chain->x_saved_tree);
+
+ keep_next_level (1);
+ /* If we're building a statement tree, then the upcoming compound
statement will be chained onto the tree structure, starting at
last_tree. We return last_tree so that we can later unhook the
compound statement. */
- return processing_template_decl ? last_tree : expand_start_stmt_expr();
+ return last_tree;
+}
+
+/* Used when beginning a statement-expression outside function scope.
+ For example, when handling a file-scope initializer, we use this
+ function. */
+
+tree
+begin_global_stmt_expr ()
+{
+ if (! cfun && !last_tree)
+ begin_stmt_tree (&scope_chain->x_saved_tree);
+
+ keep_next_level (1);
+
+ return (last_tree != NULL_TREE) ? last_tree : expand_start_stmt_expr();
+}
+
+/* Finish the STMT_EXPR last begun with begin_global_stmt_expr. */
+
+tree
+finish_global_stmt_expr (stmt_expr)
+ tree stmt_expr;
+{
+ stmt_expr = expand_end_stmt_expr (stmt_expr);
+
+ if (! cfun
+ && TREE_CHAIN (scope_chain->x_saved_tree) == NULL_TREE)
+ finish_stmt_tree (&scope_chain->x_saved_tree);
+
+ return stmt_expr;
}
/* Finish a statement-expression. RTL_EXPR should be the value
@@ -805,45 +1229,29 @@ begin_stmt_expr ()
statement-expression. */
tree
-finish_stmt_expr (rtl_expr, expr)
+finish_stmt_expr (rtl_expr)
tree rtl_expr;
- tree expr;
{
tree result;
- if (!processing_template_decl)
- {
- rtl_expr = expand_end_stmt_expr (rtl_expr);
- /* The statements have side effects, so the group does. */
- TREE_SIDE_EFFECTS (rtl_expr) = 1;
- }
+ /* If the last thing in the statement-expression was not an
+ expression-statement, then it has type `void'. */
+ if (!last_expr_type)
+ last_expr_type = void_type_node;
+ result = build_min (STMT_EXPR, last_expr_type, last_tree);
+ TREE_SIDE_EFFECTS (result) = 1;
+
+ /* Remove the compound statement from the tree structure; it is
+ now saved in the STMT_EXPR. */
+ last_tree = rtl_expr;
+ TREE_CHAIN (last_tree) = NULL_TREE;
- if (TREE_CODE (expr) == BLOCK)
- {
- /* Make a BIND_EXPR for the BLOCK already made. */
- if (processing_template_decl)
- result = build_min_nt (BIND_EXPR, NULL_TREE, last_tree,
- NULL_TREE);
- else
- result = build (BIND_EXPR, TREE_TYPE (rtl_expr),
- NULL_TREE, rtl_expr, expr);
-
- /* Remove the block from the tree at this point.
- It gets put back at the proper place
- when the BIND_EXPR is expanded. */
- delete_block (expr);
- }
- else
- result = expr;
+ /* If we created a statement-tree for this statement-expression,
+ remove it now. */
+ if (! cfun
+ && TREE_CHAIN (scope_chain->x_saved_tree) == NULL_TREE)
+ finish_stmt_tree (&scope_chain->x_saved_tree);
- if (processing_template_decl)
- {
- /* Remove the compound statement from the tree structure; it is
- now saved in the BIND_EXPR. */
- last_tree = rtl_expr;
- TREE_CHAIN (last_tree) = NULL_TREE;
- }
-
return result;
}
@@ -903,9 +1311,6 @@ finish_this_expr ()
if (current_class_ptr)
{
-#ifdef WARNING_ABOUT_CCD
- TREE_USED (current_class_ptr) = 1;
-#endif
result = current_class_ptr;
}
else if (current_function_decl
@@ -943,7 +1348,7 @@ finish_object_call_expr (fn, object, args)
tree real_fn = build_component_ref (object, fn, NULL_TREE, 1);
return finish_call_expr (real_fn, args);
#else
- if (TREE_CODE (fn) == TYPE_DECL)
+ if (DECL_DECLARES_TYPE_P (fn))
{
if (processing_template_decl)
/* This can happen on code like:
@@ -957,7 +1362,7 @@ finish_object_call_expr (fn, object, args)
fn = DECL_NAME (fn);
else
{
- cp_error ("calling type `%T' like a method", fn);
+ error ("calling type `%T' like a method", fn);
return error_mark_node;
}
}
@@ -967,7 +1372,7 @@ finish_object_call_expr (fn, object, args)
}
/* Finish a qualified member function call using OBJECT and ARGS as
- arguments to FN. Returns an expressino for the call. */
+ arguments to FN. Returns an expression for the call. */
tree
finish_qualified_object_call_expr (fn, object, args)
@@ -975,14 +1380,8 @@ finish_qualified_object_call_expr (fn, object, args)
tree object;
tree args;
{
- if (IS_SIGNATURE (TREE_OPERAND (fn, 0)))
- {
- warning ("signature name in scope resolution ignored");
- return finish_object_call_expr (TREE_OPERAND (fn, 1), object, args);
- }
- else
- return build_scoped_method_call (object, TREE_OPERAND (fn, 0),
- TREE_OPERAND (fn, 1), args);
+ return build_scoped_method_call (object, TREE_OPERAND (fn, 0),
+ TREE_OPERAND (fn, 1), args);
}
/* Finish a pseudo-destructor call expression of OBJECT, with SCOPE
@@ -995,14 +1394,17 @@ finish_pseudo_destructor_call_expr (object, scope, destructor)
tree scope;
tree destructor;
{
+ if (processing_template_decl)
+ return build_min_nt (PSEUDO_DTOR_EXPR, object, scope, destructor);
+
if (scope && scope != destructor)
- cp_error ("destructor specifier `%T::~%T()' must have matching names",
+ error ("destructor specifier `%T::~%T()' must have matching names",
scope, destructor);
if ((scope == NULL_TREE || IDENTIFIER_GLOBAL_VALUE (destructor))
&& (TREE_CODE (TREE_TYPE (object)) !=
TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (destructor)))))
- cp_error ("`%E' is not of type `%T'", object, destructor);
+ error ("`%E' is not of type `%T'", object, destructor);
return cp_convert (void_type_node, object);
}
@@ -1016,36 +1418,13 @@ finish_qualified_call_expr (fn, args)
tree args;
{
if (processing_template_decl)
- return build_min_nt (CALL_EXPR, copy_to_permanent (fn), args,
- NULL_TREE);
+ return build_min_nt (CALL_EXPR, fn, args, NULL_TREE);
else
return build_member_call (TREE_OPERAND (fn, 0),
TREE_OPERAND (fn, 1),
args);
}
-/* Finish an expression taking the address of LABEL. Returns an
- expression for the address. */
-
-tree
-finish_label_address_expr (label)
- tree label;
-{
- tree result;
-
- label = lookup_label (label);
- if (label == NULL_TREE)
- result = null_pointer_node;
- else
- {
- TREE_USED (label) = 1;
- result = build1 (ADDR_EXPR, ptr_type_node, label);
- TREE_CONSTANT (result) = 1;
- }
-
- return result;
-}
-
/* Finish an expression of the form CODE EXPR. */
tree
@@ -1054,7 +1433,13 @@ finish_unary_op_expr (code, expr)
tree expr;
{
tree result = build_x_unary_op (code, expr);
- if (code == NEGATE_EXPR && TREE_CODE (expr) == INTEGER_CST)
+ /* Inside a template, build_x_unary_op does not fold the
+ expression. So check whether the result is folded before
+ setting TREE_NEGATED_INT. */
+ if (code == NEGATE_EXPR && TREE_CODE (expr) == INTEGER_CST
+ && TREE_CODE (result) == INTEGER_CST
+ && !TREE_UNSIGNED (TREE_TYPE (result))
+ && INT_CST_LT (result, integer_zero_node))
TREE_NEGATED_INT (result) = 1;
overflow_warning (result);
return result;
@@ -1069,36 +1454,88 @@ finish_id_expr (expr)
if (TREE_CODE (expr) == IDENTIFIER_NODE)
expr = do_identifier (expr, 1, NULL_TREE);
+ if (TREE_TYPE (expr) == error_mark_node)
+ expr = error_mark_node;
return expr;
}
-/* Begin a new-placement. */
+static tree current_type_lookups;
-int
-begin_new_placement ()
+/* Perform deferred access control for types used in the type of a
+ declaration. */
+
+static void
+deferred_type_access_control ()
{
- /* The arguments to a placement new might be passed to a
- deallocation function, in the event that the allocation throws an
- exception. Since we don't expand exception handlers until the
- end of a function, we must make sure the arguments stay around
- that long. */
- return suspend_momentary ();
+ tree lookup = type_lookups;
+
+ if (lookup == error_mark_node)
+ return;
+
+ for (; lookup; lookup = TREE_CHAIN (lookup))
+ enforce_access (TREE_PURPOSE (lookup), TREE_VALUE (lookup));
}
-/* Finish a new-placement. The ARGS are the placement arguments. The
- COOKIE is the value returned by the previous call to
- begin_new_placement. */
+void
+decl_type_access_control (decl)
+ tree decl;
+{
+ tree save_fn;
-tree
-finish_new_placement (args, cookie)
- tree args;
- int cookie;
+ if (type_lookups == error_mark_node)
+ return;
+
+ save_fn = current_function_decl;
+
+ if (decl && TREE_CODE (decl) == FUNCTION_DECL)
+ current_function_decl = decl;
+
+ deferred_type_access_control ();
+
+ current_function_decl = save_fn;
+
+ /* Now strip away the checks for the current declarator; they were
+ added to type_lookups after typed_declspecs saved the copy that
+ ended up in current_type_lookups. */
+ type_lookups = current_type_lookups;
+
+ current_type_lookups = NULL_TREE;
+}
+
+/* Record the lookups, if we're doing deferred access control. */
+
+void
+save_type_access_control (lookups)
+ tree lookups;
{
- resume_momentary (cookie);
- return args;
+ if (type_lookups != error_mark_node)
+ {
+ my_friendly_assert (!current_type_lookups, 20010301);
+ current_type_lookups = lookups;
+ }
+ else
+ my_friendly_assert (!lookups || lookups == error_mark_node, 20010301);
}
-/* Begin a function defniition declared with DECL_SPECS and
+/* Set things up so that the next deferred access control will succeed.
+ This is needed for friend declarations see grokdeclarator for details. */
+
+void
+skip_type_access_control ()
+{
+ type_lookups = NULL_TREE;
+}
+
+/* Reset the deferred access control. */
+
+void
+reset_type_access_control ()
+{
+ type_lookups = NULL_TREE;
+ current_type_lookups = NULL_TREE;
+}
+
+/* Begin a function definition declared with DECL_SPECS and
DECLARATOR. Returns non-zero if the function-declaration is
legal. */
@@ -1109,11 +1546,14 @@ begin_function_definition (decl_specs, declarator)
{
tree specs;
tree attrs;
+
split_specs_attrs (decl_specs, &specs, &attrs);
- if (!start_function (specs, declarator, attrs, 0))
+ if (!start_function (specs, declarator, attrs, SF_DEFAULT))
return 0;
-
- reinit_parse_for_function ();
+
+ deferred_type_access_control ();
+ type_lookups = error_mark_node;
+
/* The things we're about to see are not directly qualified by any
template headers we've seen thus far. */
reset_specialization ();
@@ -1129,7 +1569,7 @@ begin_constructor_declarator (scope, name)
tree scope;
tree name;
{
- tree result = build_parse_node (SCOPE_REF, scope, name);
+ tree result = build_nt (SCOPE_REF, scope, name);
enter_scope_of (result);
return result;
}
@@ -1156,10 +1596,13 @@ finish_translation_unit ()
{
/* In case there were missing closebraces,
get us back to the global binding level. */
- while (! toplevel_bindings_p ())
- poplevel (0, 0, 0);
+ pop_everything ();
while (current_namespace != global_namespace)
pop_namespace ();
+
+ /* Do file scope __FUNCTION__ et al. */
+ finish_fname_decls ();
+
finish_file ();
}
@@ -1171,9 +1614,7 @@ finish_template_type_parm (aggr, identifier)
tree aggr;
tree identifier;
{
- if (aggr == signature_type_node)
- sorry ("signature as template type parameter");
- else if (aggr != class_type_node)
+ if (aggr != class_type_node)
{
pedwarn ("template type parameters must use the keyword `class' or `typename'");
aggr = class_type_node;
@@ -1194,9 +1635,11 @@ finish_template_template_parm (aggr, identifier)
tree tmpl = build_lang_decl (TEMPLATE_DECL, identifier, NULL_TREE);
DECL_TEMPLATE_PARMS (tmpl) = current_template_parms;
DECL_TEMPLATE_RESULT (tmpl) = decl;
- SET_DECL_ARTIFICIAL (decl);
+ DECL_ARTIFICIAL (decl) = 1;
end_template_decl ();
+ my_friendly_assert (DECL_TEMPLATE_PARMS (tmpl), 20010110);
+
return finish_template_type_parm (aggr, tmpl);
}
@@ -1208,13 +1651,15 @@ finish_parmlist (parms, ellipsis)
tree parms;
int ellipsis;
{
- if (!ellipsis)
- chainon (parms, void_list_node);
- /* We mark the PARMS as a parmlist so that declarator processing can
- disambiguate certain constructs. */
- if (parms != NULL_TREE)
- TREE_PARMLIST (parms) = 1;
-
+ if (parms)
+ {
+ /* We mark the PARMS as a parmlist so that declarator processing can
+ disambiguate certain constructs. */
+ TREE_PARMLIST (parms) = 1;
+ /* We do not append void_list_node here, but leave it to grokparms
+ to do that. */
+ PARMLIST_ELLIPSIS_P (parms) = ellipsis;
+ }
return parms;
}
@@ -1224,21 +1669,41 @@ tree
begin_class_definition (t)
tree t;
{
- push_obstacks_nochange ();
- end_temporary_allocation ();
+ if (t == error_mark_node)
+ return error_mark_node;
+
+ /* Check the bases are accessible. */
+ decl_type_access_control (TYPE_NAME (t));
+ reset_type_access_control ();
- if (t == error_mark_node
- || ! IS_AGGR_TYPE (t))
+ if (processing_template_parmlist)
{
- t = make_lang_type (RECORD_TYPE);
- pushtag (make_anon_name (), t, 0);
+ error ("definition of `%#T' inside template parameter list", t);
+ return error_mark_node;
}
- /* In a definition of a member class template, we will get here with an
- implicit typename, a TYPENAME_TYPE with a type. */
- if (TREE_CODE (t) == TYPENAME_TYPE)
+ /* In a definition of a member class template, we will get here with
+ an implicit typename. */
+ if (IMPLICIT_TYPENAME_P (t))
t = TREE_TYPE (t);
-
+ /* A non-implicit typename comes from code like:
+
+ template <typename T> struct A {
+ template <typename U> struct A<T>::B ...
+
+ This is erroneous. */
+ else if (TREE_CODE (t) == TYPENAME_TYPE)
+ {
+ error ("invalid definition of qualified type `%T'", t);
+ t = error_mark_node;
+ }
+
+ if (t == error_mark_node || ! IS_AGGR_TYPE (t))
+ {
+ t = make_aggr_type (RECORD_TYPE);
+ pushtag (make_anon_name (), t, 0);
+ }
+
/* If we generated a partial instantiation of this type, but now
we're seeing a real definition, we're actually looking at a
partial specialization. Consider:
@@ -1278,6 +1743,7 @@ begin_class_definition (t)
TYPE_FIELDS (t) = NULL_TREE;
TYPE_METHODS (t) = NULL_TREE;
CLASSTYPE_TAGS (t) = NULL_TREE;
+ CLASSTYPE_VBASECLASSES (t) = NULL_TREE;
TYPE_SIZE (t) = NULL_TREE;
}
@@ -1286,55 +1752,33 @@ begin_class_definition (t)
}
/* If this type was already complete, and we see another definition,
that's an error. */
- else if (TYPE_SIZE (t))
+ else if (COMPLETE_TYPE_P (t))
duplicate_tag_error (t);
+ /* Update the location of the decl. */
+ DECL_SOURCE_FILE (TYPE_NAME (t)) = input_filename;
+ DECL_SOURCE_LINE (TYPE_NAME (t)) = lineno;
+
if (TYPE_BEING_DEFINED (t))
{
- t = make_lang_type (TREE_CODE (t));
+ t = make_aggr_type (TREE_CODE (t));
pushtag (TYPE_IDENTIFIER (t), t, 0);
}
maybe_process_partial_specialization (t);
pushclass (t, 1);
TYPE_BEING_DEFINED (t) = 1;
+ TYPE_PACKED (t) = flag_pack_struct;
/* Reset the interface data, at the earliest possible
moment, as it might have been set via a class foo;
before. */
- /* Don't change signatures. */
- if (! IS_SIGNATURE (t))
+ if (! TYPE_ANONYMOUS_P (t))
{
- int needs_writing;
- tree name = TYPE_IDENTIFIER (t);
-
- if (! ANON_AGGRNAME_P (name))
- {
- CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
- SET_CLASSTYPE_INTERFACE_UNKNOWN_X
- (t, interface_unknown);
- }
-
- /* Record how to set the access of this class's
- virtual functions. If write_virtuals == 3, then
- inline virtuals are ``extern inline''. */
- if (write_virtuals == 3)
- needs_writing = ! CLASSTYPE_INTERFACE_ONLY (t)
- && CLASSTYPE_INTERFACE_KNOWN (t);
- else
- needs_writing = 1;
- CLASSTYPE_VTABLE_NEEDS_WRITING (t) = needs_writing;
+ CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
+ SET_CLASSTYPE_INTERFACE_UNKNOWN_X
+ (t, interface_unknown);
}
-#if 0
- tmp = TYPE_IDENTIFIER ($<ttype>0);
- if (tmp && IDENTIFIER_TEMPLATE (tmp))
- overload_template_name (tmp, 1);
-#endif
reset_specialization();
- /* In case this is a local class within a template
- function, we save the current tree structure so
- that we can get it back later. */
- begin_tree ();
-
/* Make a declaration for this class in its own scope. */
build_self_reference ();
@@ -1365,19 +1809,19 @@ finish_member_declaration (decl)
= (current_access_specifier == access_protected_node);
if (TREE_CODE (decl) == TEMPLATE_DECL)
{
- TREE_PRIVATE (DECL_RESULT (decl)) = TREE_PRIVATE (decl);
- TREE_PROTECTED (DECL_RESULT (decl)) = TREE_PROTECTED (decl);
+ TREE_PRIVATE (DECL_TEMPLATE_RESULT (decl)) = TREE_PRIVATE (decl);
+ TREE_PROTECTED (DECL_TEMPLATE_RESULT (decl)) = TREE_PROTECTED (decl);
}
/* Mark the DECL as a member of the current class. */
- if (TREE_CODE (decl) == FUNCTION_DECL
- || DECL_FUNCTION_TEMPLATE_P (decl))
- /* Historically, DECL_CONTEXT was not set for a FUNCTION_DECL in
- finish_struct. Presumably it is already set as the function is
- parsed. Perhaps DECL_CLASS_CONTEXT is already set, too? */
- DECL_CLASS_CONTEXT (decl) = current_class_type;
- else
- DECL_CONTEXT (decl) = current_class_type;
+ DECL_CONTEXT (decl) = current_class_type;
+
+ /* [dcl.link]
+
+ A C language linkage is ignored for the names of class members
+ and the member function type of class member functions. */
+ if (DECL_LANG_SPECIFIC (decl) && DECL_LANGUAGE (decl) == lang_c)
+ SET_DECL_LANGUAGE (decl, lang_cplusplus);
/* Put functions on the TYPE_METHODS list and everything else on the
TYPE_FIELDS list. Note that these are built up in reverse order.
@@ -1387,7 +1831,7 @@ finish_member_declaration (decl)
{
/* We also need to add this function to the
CLASSTYPE_METHOD_VEC. */
- add_method (current_class_type, 0, decl);
+ add_method (current_class_type, decl, /*error_p=*/0);
TREE_CHAIN (decl) = TYPE_METHODS (current_class_type);
TYPE_METHODS (current_class_type) = decl;
@@ -1437,6 +1881,9 @@ finish_class_definition (t, attributes, semi, pop_scope_p)
int semi;
int pop_scope_p;
{
+ if (t == error_mark_node)
+ return error_mark_node;
+
/* finish_struct nukes this anyway; if finish_exception does too,
then it can go. */
if (semi)
@@ -1444,24 +1891,24 @@ finish_class_definition (t, attributes, semi, pop_scope_p)
/* If we got any attributes in class_head, xref_tag will stick them in
TREE_TYPE of the type. Grab them now. */
- attributes = chainon (TREE_TYPE (t), attributes);
- TREE_TYPE (t) = NULL_TREE;
+ attributes = chainon (TYPE_ATTRIBUTES (t), attributes);
+ TYPE_ATTRIBUTES (t) = NULL_TREE;
if (TREE_CODE (t) == ENUMERAL_TYPE)
;
else
{
- t = finish_struct (t, attributes, semi);
+ t = finish_struct (t, attributes);
if (semi)
note_got_semicolon (t);
}
- pop_obstacks ();
-
if (! semi)
check_for_missing_semicolon (t);
if (pop_scope_p)
pop_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL (t)));
+ if (current_function_decl)
+ type_lookups = error_mark_node;
if (current_scope () == current_function_decl)
do_pending_defargs ();
@@ -1474,8 +1921,7 @@ finish_class_definition (t, attributes, semi, pop_scope_p)
void
begin_inline_definitions ()
{
- if (pending_inlines
- && current_scope () == current_function_decl)
+ if (current_scope () == current_function_decl)
do_pending_inlines ();
}
@@ -1487,9 +1933,6 @@ finish_inline_definitions ()
{
if (current_class_type == NULL_TREE)
clear_inline_text_obstack ();
-
- /* Undo the begin_tree in begin_class_definition. */
- end_tree ();
}
/* Finish processing the declaration of a member class template
@@ -1524,7 +1967,7 @@ finish_member_class_template (types)
return NULL_TREE;
}
-/* Finish processsing a complete template declaration. The PARMS are
+/* Finish processing a complete template declaration. The PARMS are
the template parameters. */
void
@@ -1537,7 +1980,7 @@ finish_template_decl (parms)
end_specialization ();
}
-/* Finish processing a a template-id (which names a type) of the form
+/* Finish processing a template-id (which names a type) of the form
NAME < ARGS >. Return the TYPE_DECL for the type named by the
template-id. If ENTERING_SCOPE is non-zero we are about to enter
the scope of template-id indicated. */
@@ -1551,7 +1994,8 @@ finish_template_type (name, args, entering_scope)
tree decl;
decl = lookup_template_class (name, args,
- NULL_TREE, NULL_TREE, entering_scope);
+ NULL_TREE, NULL_TREE,
+ entering_scope, /*complain=*/1);
if (decl != error_mark_node)
decl = TYPE_STUB_DECL (decl);
@@ -1589,49 +2033,27 @@ enter_scope_of (sr)
/* Finish processing a BASE_CLASS with the indicated ACCESS_SPECIFIER.
Return a TREE_LIST containing the ACCESS_SPECIFIER and the
BASE_CLASS, or NULL_TREE if an error occurred. The
- ACCESSS_SPECIFIER is one of
+ ACCESS_SPECIFIER is one of
access_{default,public,protected_private}[_virtual]_node.*/
tree
-finish_base_specifier (access_specifier, base_class,
- current_aggr_is_signature)
+finish_base_specifier (access_specifier, base_class)
tree access_specifier;
tree base_class;
- int current_aggr_is_signature;
{
- tree type;
tree result;
- if (base_class == NULL_TREE)
- {
- error ("invalid base class");
- type = error_mark_node;
- }
- else
- type = TREE_TYPE (base_class);
- if (current_aggr_is_signature && access_specifier)
- error ("access and source specifiers not allowed in signature");
- if (! is_aggr_type (type, 1))
+ if (! is_aggr_type (base_class, 1))
result = NULL_TREE;
- else if (current_aggr_is_signature
- && (! type) && (! IS_SIGNATURE (type)))
- {
- error ("class name not allowed as base signature");
- result = NULL_TREE;
- }
- else if (current_aggr_is_signature)
- {
- sorry ("signature inheritance, base type `%s' ignored",
- IDENTIFIER_POINTER (access_specifier));
- result = build_tree_list (access_public_node, type);
- }
- else if (type && IS_SIGNATURE (type))
+ else
{
- error ("signature name not allowed as base class");
- result = NULL_TREE;
+ if (cp_type_quals (base_class) != 0)
+ {
+ error ("base class `%T' has cv qualifiers", base_class);
+ base_class = TYPE_MAIN_VARIANT (base_class);
+ }
+ result = build_tree_list (access_specifier, base_class);
}
- else
- result = build_tree_list (access_specifier, type);
return result;
}
@@ -1660,9 +2082,12 @@ check_multiple_declarators ()
if (PROCESSING_REAL_TEMPLATE_DECL_P ()
|| processing_explicit_instantiation
|| processing_specialization)
- cp_error ("multiple declarators in template declaration");
+ error ("multiple declarators in template declaration");
}
+/* Implement the __typeof keyword: Return the type of EXPR, suitable for
+ use as a type-specifier. */
+
tree
finish_typeof (expr)
tree expr;
@@ -1671,16 +2096,594 @@ finish_typeof (expr)
{
tree t;
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- t = make_lang_type (TYPEOF_TYPE);
+ t = make_aggr_type (TYPEOF_TYPE);
TYPE_FIELDS (t) = expr;
- pop_obstacks ();
-
return t;
}
+ if (TREE_CODE (expr) == OFFSET_REF)
+ expr = resolve_offset_ref (expr);
+
return TREE_TYPE (expr);
}
+
+/* Compute the value of the `sizeof' operator. */
+
+tree
+finish_sizeof (t)
+ tree t;
+{
+ if (processing_template_decl)
+ return build_min_nt (SIZEOF_EXPR, t);
+
+ return TYPE_P (t) ? c_sizeof (t) : expr_sizeof (t);
+}
+
+/* Implement the __alignof keyword: Return the minimum required
+ alignment of T, measured in bytes. */
+
+tree
+finish_alignof (t)
+ tree t;
+{
+ if (processing_template_decl)
+ return build_min_nt (ALIGNOF_EXPR, t);
+
+ return TYPE_P (t) ? c_alignof (t) : c_alignof_expr (t);
+}
+
+/* Generate RTL for the statement T, and its substatements, and any
+ other statements at its nesting level. */
+
+static void
+cp_expand_stmt (t)
+ tree t;
+{
+ switch (TREE_CODE (t))
+ {
+ case CLEANUP_STMT:
+ genrtl_decl_cleanup (CLEANUP_DECL (t), CLEANUP_EXPR (t));
+ break;
+
+ case CTOR_STMT:
+ genrtl_ctor_stmt (t);
+ break;
+
+ case TRY_BLOCK:
+ genrtl_try_block (t);
+ break;
+
+ case EH_SPEC_BLOCK:
+ genrtl_eh_spec_block (t);
+ break;
+
+ case HANDLER:
+ genrtl_handler (t);
+ break;
+
+ case SUBOBJECT:
+ genrtl_subobject (SUBOBJECT_CLEANUP (t));
+ break;
+
+ case RETURN_INIT:
+ genrtl_named_return_value ();
+ break;
+
+ case USING_STMT:
+ break;
+
+ default:
+ abort ();
+ break;
+ }
+}
+
+/* Called from expand_body via walk_tree. Replace all AGGR_INIT_EXPRs
+ will equivalent CALL_EXPRs. */
+
+static tree
+simplify_aggr_init_exprs_r (tp, walk_subtrees, data)
+ tree *tp;
+ int *walk_subtrees ATTRIBUTE_UNUSED;
+ void *data ATTRIBUTE_UNUSED;
+{
+ tree aggr_init_expr;
+ tree call_expr;
+ tree fn;
+ tree args;
+ tree slot;
+ tree type;
+ int copy_from_buffer_p;
+
+ aggr_init_expr = *tp;
+ /* We don't need to walk into types; there's nothing in a type that
+ needs simplification. (And, furthermore, there are places we
+ actively don't want to go. For example, we don't want to wander
+ into the default arguments for a FUNCTION_DECL that appears in a
+ CALL_EXPR.) */
+ if (TYPE_P (aggr_init_expr))
+ {
+ *walk_subtrees = 0;
+ return NULL_TREE;
+ }
+ /* Only AGGR_INIT_EXPRs are interesting. */
+ else if (TREE_CODE (aggr_init_expr) != AGGR_INIT_EXPR)
+ return NULL_TREE;
+
+ /* Form an appropriate CALL_EXPR. */
+ fn = TREE_OPERAND (aggr_init_expr, 0);
+ args = TREE_OPERAND (aggr_init_expr, 1);
+ slot = TREE_OPERAND (aggr_init_expr, 2);
+ type = TREE_TYPE (aggr_init_expr);
+ if (AGGR_INIT_VIA_CTOR_P (aggr_init_expr))
+ {
+ /* Replace the first argument with the address of the third
+ argument to the AGGR_INIT_EXPR. */
+ mark_addressable (slot);
+ args = tree_cons (NULL_TREE,
+ build1 (ADDR_EXPR,
+ build_pointer_type (TREE_TYPE (slot)),
+ slot),
+ TREE_CHAIN (args));
+ }
+ call_expr = build (CALL_EXPR,
+ TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))),
+ fn, args, NULL_TREE);
+ TREE_SIDE_EFFECTS (call_expr) = 1;
+
+ /* If we're using the non-reentrant PCC calling convention, then we
+ need to copy the returned value out of the static buffer into the
+ SLOT. */
+ copy_from_buffer_p = 0;
+#ifdef PCC_STATIC_STRUCT_RETURN
+ if (!AGGR_INIT_VIA_CTOR_P (aggr_init_expr) && aggregate_value_p (type))
+ {
+ int old_ac = flag_access_control;
+
+ flag_access_control = 0;
+ call_expr = build_aggr_init (slot, call_expr,
+ DIRECT_BIND | LOOKUP_ONLYCONVERTING);
+ flag_access_control = old_ac;
+ copy_from_buffer_p = 1;
+ }
+#endif
+
+ /* If this AGGR_INIT_EXPR indicates the value returned by a
+ function, then we want to use the value of the initialized
+ location as the result. */
+ if (AGGR_INIT_VIA_CTOR_P (aggr_init_expr) || copy_from_buffer_p)
+ {
+ call_expr = build (COMPOUND_EXPR, type,
+ call_expr, slot);
+ TREE_SIDE_EFFECTS (call_expr) = 1;
+ }
+
+ /* Replace the AGGR_INIT_EXPR with the CALL_EXPR. */
+ TREE_CHAIN (call_expr) = TREE_CHAIN (aggr_init_expr);
+ *tp = call_expr;
+
+ /* Keep iterating. */
+ return NULL_TREE;
+}
+
+/* Emit all thunks to FN that should be emitted when FN is emitted. */
+
+static void
+emit_associated_thunks (fn)
+ tree fn;
+{
+ /* When we use vcall offsets, we emit thunks with the virtual
+ functions to which they thunk. The whole point of vcall offsets
+ is so that you can know statically the entire set of thunks that
+ will ever be needed for a given virtual function, thereby
+ enabling you to output all the thunks with the function itself. */
+ if (DECL_VIRTUAL_P (fn))
+ {
+ tree binfo;
+ tree v;
+
+ for (binfo = TYPE_BINFO (DECL_CONTEXT (fn));
+ binfo;
+ binfo = TREE_CHAIN (binfo))
+ for (v = BINFO_VIRTUALS (binfo); v; v = TREE_CHAIN (v))
+ if (BV_FN (v) == fn
+ && (!integer_zerop (BV_DELTA (v))
+ || BV_USE_VCALL_INDEX_P (v)))
+ {
+ tree thunk;
+ tree vcall_index;
+
+ if (BV_USE_VCALL_INDEX_P (v))
+ {
+ vcall_index = BV_VCALL_INDEX (v);
+ my_friendly_assert (vcall_index != NULL_TREE, 20000621);
+ }
+ else
+ vcall_index = NULL_TREE;
+
+ thunk = make_thunk (build1 (ADDR_EXPR,
+ vfunc_ptr_type_node,
+ fn),
+ BV_DELTA (v),
+ vcall_index);
+ use_thunk (thunk, /*emit_p=*/1);
+ }
+ }
+}
+
+/* Generate RTL for FN. */
+
+void
+expand_body (fn)
+ tree fn;
+{
+ int saved_lineno;
+ const char *saved_input_filename;
+
+ /* When the parser calls us after finishing the body of a template
+ function, we don't really want to expand the body. When we're
+ processing an in-class definition of an inline function,
+ PROCESSING_TEMPLATE_DECL will no longer be set here, so we have
+ to look at the function itself. */
+ if (processing_template_decl
+ || (DECL_LANG_SPECIFIC (fn)
+ && DECL_TEMPLATE_INFO (fn)
+ && uses_template_parms (DECL_TI_ARGS (fn))))
+ {
+ /* Normally, collection only occurs in rest_of_compilation. So,
+ if we don't collect here, we never collect junk generated
+ during the processing of templates until we hit a
+ non-template function. */
+ ggc_collect ();
+ return;
+ }
+
+ /* Replace AGGR_INIT_EXPRs with appropriate CALL_EXPRs. */
+ walk_tree_without_duplicates (&DECL_SAVED_TREE (fn),
+ simplify_aggr_init_exprs_r,
+ NULL);
+
+ /* If this is a constructor or destructor body, we have to clone
+ it. */
+ if (maybe_clone_body (fn))
+ {
+ /* We don't want to process FN again, so pretend we've written
+ it out, even though we haven't. */
+ TREE_ASM_WRITTEN (fn) = 1;
+ return;
+ }
+
+ /* There's no reason to do any of the work here if we're only doing
+ semantic analysis; this code just generates RTL. */
+ if (flag_syntax_only)
+ return;
+
+ /* If possible, avoid generating RTL for this function. Instead,
+ just record it as an inline function, and wait until end-of-file
+ to decide whether to write it out or not. */
+ if (/* We have to generate RTL if it's not an inline function. */
+ (DECL_INLINE (fn) || DECL_COMDAT (fn))
+ /* Or if we have to emit code for inline functions anyhow. */
+ && !flag_keep_inline_functions
+ /* Or if we actually have a reference to the function. */
+ && !DECL_NEEDED_P (fn))
+ {
+ /* Set DECL_EXTERNAL so that assemble_external will be called as
+ necessary. We'll clear it again in finish_file. */
+ if (!DECL_EXTERNAL (fn))
+ {
+ DECL_NOT_REALLY_EXTERN (fn) = 1;
+ DECL_EXTERNAL (fn) = 1;
+ }
+ /* Remember this function. In finish_file we'll decide if
+ we actually need to write this function out. */
+ defer_fn (fn);
+ /* Let the back-end know that this function exists. */
+ (*debug_hooks->deferred_inline_function) (fn);
+ return;
+ }
+
+ /* Compute the appropriate object-file linkage for inline
+ functions. */
+ if (DECL_DECLARED_INLINE_P (fn))
+ import_export_decl (fn);
+
+ /* If FN is external, then there's no point in generating RTL for
+ it. This situation can arise with an inline function under
+ `-fexternal-templates'; we instantiate the function, even though
+ we're not planning on emitting it, in case we get a chance to
+ inline it. */
+ if (DECL_EXTERNAL (fn))
+ return;
+
+ /* Emit any thunks that should be emitted at the same time as FN. */
+ emit_associated_thunks (fn);
+
+ timevar_push (TV_INTEGRATION);
+
+ /* Optimize the body of the function before expanding it. */
+ optimize_function (fn);
+
+ timevar_pop (TV_INTEGRATION);
+ timevar_push (TV_EXPAND);
+
+ /* Save the current file name and line number. When we expand the
+ body of the function, we'll set LINENO and INPUT_FILENAME so that
+ error-mesages come out in the right places. */
+ saved_lineno = lineno;
+ saved_input_filename = input_filename;
+ lineno = DECL_SOURCE_LINE (fn);
+ input_filename = DECL_SOURCE_FILE (fn);
+
+ genrtl_start_function (fn);
+ current_function_is_thunk = DECL_THUNK_P (fn);
+
+ /* Expand the body. */
+ expand_stmt (DECL_SAVED_TREE (fn));
+
+ /* Statements should always be full-expressions at the outermost set
+ of curly braces for a function. */
+ my_friendly_assert (stmts_are_full_exprs_p (), 19990831);
+
+ /* The outermost statement for a function contains the line number
+ recorded when we finished processing the function. */
+ lineno = STMT_LINENO (DECL_SAVED_TREE (fn));
+
+ /* Generate code for the function. */
+ genrtl_finish_function (fn);
+
+ /* If possible, obliterate the body of the function so that it can
+ be garbage collected. */
+ if (dump_enabled_p (TDI_all))
+ /* Keep the body; we're going to dump it. */
+ ;
+ else if (DECL_INLINE (fn) && flag_inline_trees)
+ /* We might need the body of this function so that we can expand
+ it inline somewhere else. */
+ ;
+ else
+ /* We don't need the body; blow it away. */
+ DECL_SAVED_TREE (fn) = NULL_TREE;
+
+ /* And restore the current source position. */
+ lineno = saved_lineno;
+ input_filename = saved_input_filename;
+ extract_interface_info ();
+
+ timevar_pop (TV_EXPAND);
+}
+
+/* Helper function for walk_tree, used by finish_function to override all
+ the RETURN_STMTs and pertinent CLEANUP_STMTs for the named return
+ value optimization. */
+
+tree
+nullify_returns_r (tp, walk_subtrees, data)
+ tree *tp;
+ int *walk_subtrees;
+ void *data;
+{
+ tree nrv = (tree) data;
+
+ /* No need to walk into types. There wouldn't be any need to walk into
+ non-statements, except that we have to consider STMT_EXPRs. */
+ if (TYPE_P (*tp))
+ *walk_subtrees = 0;
+ else if (TREE_CODE (*tp) == RETURN_STMT)
+ RETURN_EXPR (*tp) = NULL_TREE;
+ else if (TREE_CODE (*tp) == CLEANUP_STMT
+ && CLEANUP_DECL (*tp) == nrv)
+ CLEANUP_EXPR (*tp) = NULL_TREE;
+
+ /* Keep iterating. */
+ return NULL_TREE;
+}
+
+/* Start generating the RTL for FN. */
+
+static void
+genrtl_start_function (fn)
+ tree fn;
+{
+ /* Tell everybody what function we're processing. */
+ current_function_decl = fn;
+ /* Get the RTL machinery going for this function. */
+ init_function_start (fn, DECL_SOURCE_FILE (fn), DECL_SOURCE_LINE (fn));
+ /* Let everybody know that we're expanding this function, not doing
+ semantic analysis. */
+ expanding_p = 1;
+
+ /* Even though we're inside a function body, we still don't want to
+ call expand_expr to calculate the size of a variable-sized array.
+ We haven't necessarily assigned RTL to all variables yet, so it's
+ not safe to try to expand expressions involving them. */
+ immediate_size_expand = 0;
+ cfun->x_dont_save_pending_sizes_p = 1;
+
+ /* Let the user know we're compiling this function. */
+ announce_function (fn);
+
+ /* Initialize the per-function data. */
+ my_friendly_assert (!DECL_PENDING_INLINE_P (fn), 20000911);
+ if (DECL_SAVED_FUNCTION_DATA (fn))
+ {
+ /* If we already parsed this function, and we're just expanding it
+ now, restore saved state. */
+ *cp_function_chain = *DECL_SAVED_FUNCTION_DATA (fn);
+
+ /* This function is being processed in whole-function mode; we
+ already did semantic analysis. */
+ cfun->x_whole_function_mode_p = 1;
+
+ /* If we decided that we didn't want to inline this function,
+ make sure the back-end knows that. */
+ if (!current_function_cannot_inline)
+ current_function_cannot_inline = cp_function_chain->cannot_inline;
+
+ /* We don't need the saved data anymore. */
+ free (DECL_SAVED_FUNCTION_DATA (fn));
+ DECL_SAVED_FUNCTION_DATA (fn) = NULL;
+ }
+
+ /* Tell the cross-reference machinery that we're defining this
+ function. */
+ GNU_xref_function (fn, DECL_ARGUMENTS (fn));
+
+ /* Keep track of how many functions we're presently expanding. */
+ ++function_depth;
+
+ /* Create a binding level for the parameters. */
+ expand_function_start (fn, /*parms_have_cleanups=*/0);
+ /* If this function is `main'. */
+ if (DECL_MAIN_P (fn))
+ expand_main_function ();
+
+ /* Give our named return value the same RTL as our RESULT_DECL. */
+ if (current_function_return_value)
+ COPY_DECL_RTL (DECL_RESULT (fn), current_function_return_value);
+}
+
+/* Finish generating the RTL for FN. */
+
+static void
+genrtl_finish_function (fn)
+ tree fn;
+{
+ tree t;
+
+#if 0
+ if (write_symbols != NO_DEBUG)
+ {
+ /* Keep this code around in case we later want to control debug info
+ based on whether a type is "used". (jason 1999-11-11) */
+
+ tree ttype = target_type (fntype);
+ tree parmdecl;
+
+ if (IS_AGGR_TYPE (ttype))
+ /* Let debugger know it should output info for this type. */
+ note_debug_info_needed (ttype);
+
+ for (parmdecl = DECL_ARGUMENTS (fndecl); parmdecl; parmdecl = TREE_CHAIN (parmdecl))
+ {
+ ttype = target_type (TREE_TYPE (parmdecl));
+ if (IS_AGGR_TYPE (ttype))
+ /* Let debugger know it should output info for this type. */
+ note_debug_info_needed (ttype);
+ }
+ }
+#endif
+
+ /* Clean house because we will need to reorder insns here. */
+ do_pending_stack_adjust ();
+
+ /* If we have a named return value, we need to force a return so that
+ the return register is USEd. */
+ if (DECL_NAME (DECL_RESULT (fn)))
+ emit_jump (return_label);
+
+ /* We hard-wired immediate_size_expand to zero in start_function.
+ Expand_function_end will decrement this variable. So, we set the
+ variable to one here, so that after the decrement it will remain
+ zero. */
+ immediate_size_expand = 1;
+
+ /* Generate rtl for function exit. */
+ expand_function_end (input_filename, lineno, 0);
+
+ /* If this is a nested function (like a template instantiation that
+ we're compiling in the midst of compiling something else), push a
+ new GC context. That will keep local variables on the stack from
+ being collected while we're doing the compilation of this
+ function. */
+ if (function_depth > 1)
+ ggc_push_context ();
+
+ /* There's no need to defer outputting this function any more; we
+ know we want to output it. */
+ DECL_DEFER_OUTPUT (fn) = 0;
+
+ /* Run the optimizers and output the assembler code for this
+ function. */
+ rest_of_compilation (fn);
+
+ /* Undo the call to ggc_push_context above. */
+ if (function_depth > 1)
+ ggc_pop_context ();
+
+#if 0
+ /* Keep this code around in case we later want to control debug info
+ based on whether a type is "used". (jason 1999-11-11) */
+
+ if (ctype && TREE_ASM_WRITTEN (fn))
+ note_debug_info_needed (ctype);
+#endif
+
+ /* If this function is marked with the constructor attribute, add it
+ to the list of functions to be called along with constructors
+ from static duration objects. */
+ if (DECL_STATIC_CONSTRUCTOR (fn))
+ static_ctors = tree_cons (NULL_TREE, fn, static_ctors);
+
+ /* If this function is marked with the destructor attribute, add it
+ to the list of functions to be called along with destructors from
+ static duration objects. */
+ if (DECL_STATIC_DESTRUCTOR (fn))
+ static_dtors = tree_cons (NULL_TREE, fn, static_dtors);
+
+ --function_depth;
+
+ /* In C++, we should never be saving RTL for the function. */
+ my_friendly_assert (!DECL_SAVED_INSNS (fn), 20010903);
+
+ /* Since we don't need the RTL for this function anymore, stop
+ pointing to it. That's especially important for LABEL_DECLs,
+ since you can reach all the instructions in the function from the
+ CODE_LABEL stored in the DECL_RTL for the LABEL_DECL. Walk the
+ BLOCK-tree, clearing DECL_RTL for LABEL_DECLs and non-static
+ local variables. */
+ walk_tree_without_duplicates (&DECL_SAVED_TREE (fn),
+ clear_decl_rtl,
+ NULL);
+
+ /* Clear out the RTL for the arguments. */
+ for (t = DECL_ARGUMENTS (fn); t; t = TREE_CHAIN (t))
+ {
+ SET_DECL_RTL (t, NULL_RTX);
+ DECL_INCOMING_RTL (t) = NULL_RTX;
+ }
+
+ if (!(flag_inline_trees && DECL_INLINE (fn)))
+ /* DECL_INITIAL must remain nonzero so we know this was an
+ actual function definition. */
+ DECL_INITIAL (fn) = error_mark_node;
+
+ /* Let the error reporting routines know that we're outside a
+ function. For a nested function, this value is used in
+ pop_cp_function_context and then reset via pop_function_context. */
+ current_function_decl = NULL_TREE;
+}
+
+/* Clear out the DECL_RTL for the non-static variables in BLOCK and
+ its sub-blocks. */
+
+static tree
+clear_decl_rtl (tp, walk_subtrees, data)
+ tree *tp;
+ int *walk_subtrees ATTRIBUTE_UNUSED;
+ void *data ATTRIBUTE_UNUSED;
+{
+ if (nonstatic_local_decl_p (*tp))
+ SET_DECL_RTL (*tp, NULL_RTX);
+
+ return NULL_TREE;
+}
+
+/* Perform initialization related to this module. */
+
+void
+init_cp_semantics ()
+{
+ lang_expand_stmt = cp_expand_stmt;
+}
diff --git a/contrib/gcc/cp/spew.c b/contrib/gcc/cp/spew.c
index a573cba..e610aec 100644
--- a/contrib/gcc/cp/spew.c
+++ b/contrib/gcc/cp/spew.c
@@ -1,5 +1,6 @@
/* Type Analyzer for GNU C++.
- Copyright (C) 1987, 89, 92-97, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Hacked... nay, bludgeoned... by Mark Eichin (eichin@cygnus.com)
This file is part of GNU CC.
@@ -19,7 +20,6 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-
/* This file is the type analyzer for GNU C++. To debug it, define SPEW_DEBUG
when compiling parse.c and spew.c. */
@@ -27,36 +27,118 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "input.h"
#include "tree.h"
-#include "lex.h"
#include "cp-tree.h"
+#include "cpplib.h"
+#include "c-lex.h"
+#include "lex.h"
#include "parse.h"
#include "flags.h"
#include "obstack.h"
#include "toplev.h"
+#include "ggc.h"
+#include "intl.h"
+#include "timevar.h"
+
+#ifdef SPEW_DEBUG
+#define SPEW_INLINE
+#else
+#define SPEW_INLINE inline
+#endif
/* This takes a token stream that hasn't decided much about types and
tries to figure out as much as it can, with excessive lookahead and
backtracking. */
/* fifo of tokens recognized and available to parser. */
-struct token {
+struct token
+{
/* The values for YYCHAR will fit in a short. */
short yychar;
- short end_of_file;
+ unsigned int lineno;
YYSTYPE yylval;
};
-static int do_aggr PROTO((void));
-static int probe_obstack PROTO((struct obstack *, tree, unsigned int));
-static void scan_tokens PROTO((unsigned int));
+/* Since inline methods can refer to text which has not yet been seen,
+ we store the text of the method in a structure which is placed in the
+ DECL_PENDING_INLINE_INFO field of the FUNCTION_DECL.
+ After parsing the body of the class definition, the FUNCTION_DECL's are
+ scanned to see which ones have this field set. Those are then digested
+ one at a time.
+
+ This function's FUNCTION_DECL will have a bit set in its common so
+ that we know to watch out for it. */
+
+struct unparsed_text
+{
+ struct unparsed_text *next; /* process this one next */
+ tree decl; /* associated declaration */
+ const char *filename; /* name of file we were processing */
+ int lineno; /* line number we got the text from */
+ int interface; /* remembering interface_unknown and interface_only */
+
+ struct token *pos; /* current position, when rescanning */
+ struct token *limit; /* end of saved text */
+};
+
+/* Stack of state saved off when we return to an inline method or
+ default argument that has been stored for later parsing. */
+struct feed
+{
+ struct unparsed_text *input;
+ const char *filename;
+ int lineno;
+ int yychar;
+ YYSTYPE yylval;
+ int first_token;
+ struct obstack token_obstack;
+ struct feed *next;
+};
+
+static struct obstack feed_obstack;
+static struct feed *feed;
+
+static SPEW_INLINE void do_aggr PARAMS ((void));
+static SPEW_INLINE int identifier_type PARAMS ((tree));
+static void scan_tokens PARAMS ((int));
+static void feed_defarg PARAMS ((tree));
+static void finish_defarg PARAMS ((void));
+static int read_token PARAMS ((struct token *));
+
+static SPEW_INLINE int num_tokens PARAMS ((void));
+static SPEW_INLINE struct token *nth_token PARAMS ((int));
+static SPEW_INLINE int add_token PARAMS ((struct token *));
+static SPEW_INLINE int shift_token PARAMS ((void));
+static SPEW_INLINE void push_token PARAMS ((struct token *));
+static SPEW_INLINE void consume_token PARAMS ((void));
+static SPEW_INLINE int read_process_identifier PARAMS ((YYSTYPE *));
+
+static SPEW_INLINE void feed_input PARAMS ((struct unparsed_text *));
+static SPEW_INLINE void snarf_block PARAMS ((const char *, int));
+static tree snarf_defarg PARAMS ((void));
+static int frob_id PARAMS ((int, int, tree *));
+
+/* The list of inline functions being held off until we reach the end of
+ the current class declaration. */
+static struct unparsed_text *pending_inlines;
+static struct unparsed_text *pending_inlines_tail;
+
+/* The list of previously-deferred inline functions currently being parsed.
+ This exists solely to be a GC root. */
+static struct unparsed_text *processing_these_inlines;
+
+static void begin_parsing_inclass_inline PARAMS ((struct unparsed_text *));
#ifdef SPEW_DEBUG
-static int num_tokens PROTO((void));
-static struct token *nth_token PROTO((int));
-static void add_token PROTO((struct token *));
-static void consume_token PROTO((void));
-static int debug_yychar PROTO((int));
+int spew_debug = 0;
+static unsigned int yylex_ctr = 0;
+
+static void debug_yychar PARAMS ((int));
+
+/* In parse.y: */
+extern char *debug_yytranslate PARAMS ((int));
#endif
+static enum cpp_ttype last_token;
+static tree last_token_id;
/* From lex.c: */
/* the declaration found for the last IDENTIFIER token read in.
@@ -67,31 +149,309 @@ extern tree lastiddecl; /* let our brains leak out here too */
extern int yychar; /* the lookahead symbol */
extern YYSTYPE yylval; /* the semantic value of the */
/* lookahead symbol */
-extern int end_of_file;
-
+/* The token fifo lives in this obstack. */
struct obstack token_obstack;
int first_token;
-
-#ifdef SPEW_DEBUG
-int spew_debug = 0;
-static unsigned int yylex_ctr = 0;
-static int debug_yychar ();
-#endif
-/* Initialize token_obstack. Called once, from init_parse. */
+/* Sometimes we need to save tokens for later parsing. If so, they are
+ stored on this obstack. */
+struct obstack inline_text_obstack;
+char *inline_text_firstobj;
+
+/* When we see a default argument in a method declaration, we snarf it as
+ text using snarf_defarg. When we get up to namespace scope, we then go
+ through and parse all of them using do_pending_defargs. Since yacc
+ parsers are not reentrant, we retain defargs state in these two
+ variables so that subsequent calls to do_pending_defargs can resume
+ where the previous call left off. DEFARG_FNS is a tree_list where
+ the TREE_TYPE is the current_class_type, TREE_VALUE is the FUNCTION_DECL,
+ and TREE_PURPOSE is the list unprocessed dependent functions. */
+
+static tree defarg_fns; /* list of functions with unprocessed defargs */
+static tree defarg_parm; /* current default parameter */
+static tree defarg_depfns; /* list of unprocessed fns met during current fn. */
+static tree defarg_fnsdone; /* list of fns with circular defargs */
+
+/* Initialize obstacks. Called once, from cxx_init. */
void
init_spew ()
{
+ gcc_obstack_init (&inline_text_obstack);
+ inline_text_firstobj = (char *) obstack_alloc (&inline_text_obstack, 0);
gcc_obstack_init (&token_obstack);
+ gcc_obstack_init (&feed_obstack);
+ ggc_add_tree_root (&defarg_fns, 1);
+ ggc_add_tree_root (&defarg_parm, 1);
+ ggc_add_tree_root (&defarg_depfns, 1);
+ ggc_add_tree_root (&defarg_fnsdone, 1);
+
+ ggc_add_root (&pending_inlines, 1, sizeof (struct unparsed_text *),
+ mark_pending_inlines);
+ ggc_add_root (&processing_these_inlines, 1, sizeof (struct unparsed_text *),
+ mark_pending_inlines);
}
-#ifdef SPEW_DEBUG
-/* Use functions for debugging... */
+void
+clear_inline_text_obstack ()
+{
+ obstack_free (&inline_text_obstack, inline_text_firstobj);
+}
-/* Return the number of tokens available on the fifo. */
+/* Subroutine of read_token. */
+static SPEW_INLINE int
+read_process_identifier (pyylval)
+ YYSTYPE *pyylval;
+{
+ tree id = pyylval->ttype;
+
+ if (C_IS_RESERVED_WORD (id))
+ {
+ /* Possibly replace the IDENTIFIER_NODE with a magic cookie.
+ Can't put yylval.code numbers in ridpointers[]. Bleah. */
+
+ switch (C_RID_CODE (id))
+ {
+ case RID_BITAND: pyylval->code = BIT_AND_EXPR; return '&';
+ case RID_AND_EQ: pyylval->code = BIT_AND_EXPR; return ASSIGN;
+ case RID_BITOR: pyylval->code = BIT_IOR_EXPR; return '|';
+ case RID_OR_EQ: pyylval->code = BIT_IOR_EXPR; return ASSIGN;
+ case RID_XOR: pyylval->code = BIT_XOR_EXPR; return '^';
+ case RID_XOR_EQ: pyylval->code = BIT_XOR_EXPR; return ASSIGN;
+ case RID_NOT_EQ: pyylval->code = NE_EXPR; return EQCOMPARE;
+
+ default:
+ if (C_RID_YYCODE (id) == TYPESPEC)
+ GNU_xref_ref (current_function_decl, IDENTIFIER_POINTER (id));
+
+ pyylval->ttype = ridpointers[C_RID_CODE (id)];
+ return C_RID_YYCODE (id);
+ }
+ }
+
+ GNU_xref_ref (current_function_decl, IDENTIFIER_POINTER (id));
+
+ /* Make sure that user does not collide with our internal naming
+ scheme. This is not necessary if '.' is used to remove them from
+ the user's namespace, but is if '$' or double underscores are. */
+
+#if !defined(JOINER) || JOINER == '$'
+ if (VPTR_NAME_P (id)
+ || VTABLE_NAME_P (id)
+ || TEMP_NAME_P (id)
+ || ANON_AGGRNAME_P (id))
+ warning (
+"identifier name `%s' conflicts with GNU C++ internal naming strategy",
+ IDENTIFIER_POINTER (id));
+#endif
+ return IDENTIFIER;
+}
+/* Read the next token from the input file. The token is written into
+ T, and its type number is returned. */
static int
+read_token (t)
+ struct token *t;
+{
+ retry:
+
+ last_token = c_lex (&last_token_id);
+ t->yylval.ttype = last_token_id;
+
+ switch (last_token)
+ {
+#define YYCHAR(YY) t->yychar = (YY); break;
+#define YYCODE(C) t->yylval.code = (C);
+
+ case CPP_EQ: YYCHAR('=');
+ case CPP_NOT: YYCHAR('!');
+ case CPP_GREATER: YYCODE(GT_EXPR); YYCHAR('>');
+ case CPP_LESS: YYCODE(LT_EXPR); YYCHAR('<');
+ case CPP_PLUS: YYCODE(PLUS_EXPR); YYCHAR('+');
+ case CPP_MINUS: YYCODE(MINUS_EXPR); YYCHAR('-');
+ case CPP_MULT: YYCODE(MULT_EXPR); YYCHAR('*');
+ case CPP_DIV: YYCODE(TRUNC_DIV_EXPR); YYCHAR('/');
+ case CPP_MOD: YYCODE(TRUNC_MOD_EXPR); YYCHAR('%');
+ case CPP_AND: YYCODE(BIT_AND_EXPR); YYCHAR('&');
+ case CPP_OR: YYCODE(BIT_IOR_EXPR); YYCHAR('|');
+ case CPP_XOR: YYCODE(BIT_XOR_EXPR); YYCHAR('^');
+ case CPP_RSHIFT: YYCODE(RSHIFT_EXPR); YYCHAR(RSHIFT);
+ case CPP_LSHIFT: YYCODE(LSHIFT_EXPR); YYCHAR(LSHIFT);
+
+ case CPP_COMPL: YYCHAR('~');
+ case CPP_AND_AND: YYCHAR(ANDAND);
+ case CPP_OR_OR: YYCHAR(OROR);
+ case CPP_QUERY: YYCHAR('?');
+ case CPP_COLON: YYCHAR(':');
+ case CPP_COMMA: YYCHAR(',');
+ case CPP_OPEN_PAREN: YYCHAR('(');
+ case CPP_CLOSE_PAREN: YYCHAR(')');
+ case CPP_EQ_EQ: YYCODE(EQ_EXPR); YYCHAR(EQCOMPARE);
+ case CPP_NOT_EQ: YYCODE(NE_EXPR); YYCHAR(EQCOMPARE);
+ case CPP_GREATER_EQ:YYCODE(GE_EXPR); YYCHAR(ARITHCOMPARE);
+ case CPP_LESS_EQ: YYCODE(LE_EXPR); YYCHAR(ARITHCOMPARE);
+
+ case CPP_PLUS_EQ: YYCODE(PLUS_EXPR); YYCHAR(ASSIGN);
+ case CPP_MINUS_EQ: YYCODE(MINUS_EXPR); YYCHAR(ASSIGN);
+ case CPP_MULT_EQ: YYCODE(MULT_EXPR); YYCHAR(ASSIGN);
+ case CPP_DIV_EQ: YYCODE(TRUNC_DIV_EXPR); YYCHAR(ASSIGN);
+ case CPP_MOD_EQ: YYCODE(TRUNC_MOD_EXPR); YYCHAR(ASSIGN);
+ case CPP_AND_EQ: YYCODE(BIT_AND_EXPR); YYCHAR(ASSIGN);
+ case CPP_OR_EQ: YYCODE(BIT_IOR_EXPR); YYCHAR(ASSIGN);
+ case CPP_XOR_EQ: YYCODE(BIT_XOR_EXPR); YYCHAR(ASSIGN);
+ case CPP_RSHIFT_EQ: YYCODE(RSHIFT_EXPR); YYCHAR(ASSIGN);
+ case CPP_LSHIFT_EQ: YYCODE(LSHIFT_EXPR); YYCHAR(ASSIGN);
+
+ case CPP_OPEN_SQUARE: YYCHAR('[');
+ case CPP_CLOSE_SQUARE: YYCHAR(']');
+ case CPP_OPEN_BRACE: YYCHAR('{');
+ case CPP_CLOSE_BRACE: YYCHAR('}');
+ case CPP_SEMICOLON: YYCHAR(';');
+ case CPP_ELLIPSIS: YYCHAR(ELLIPSIS);
+
+ case CPP_PLUS_PLUS: YYCHAR(PLUSPLUS);
+ case CPP_MINUS_MINUS: YYCHAR(MINUSMINUS);
+ case CPP_DEREF: YYCHAR(POINTSAT);
+ case CPP_DOT: YYCHAR('.');
+
+ /* These tokens are C++ specific. */
+ case CPP_SCOPE: YYCHAR(SCOPE);
+ case CPP_DEREF_STAR: YYCHAR(POINTSAT_STAR);
+ case CPP_DOT_STAR: YYCHAR(DOT_STAR);
+ case CPP_MIN_EQ: YYCODE(MIN_EXPR); YYCHAR(ASSIGN);
+ case CPP_MAX_EQ: YYCODE(MAX_EXPR); YYCHAR(ASSIGN);
+ case CPP_MIN: YYCODE(MIN_EXPR); YYCHAR(MIN_MAX);
+ case CPP_MAX: YYCODE(MAX_EXPR); YYCHAR(MIN_MAX);
+#undef YYCHAR
+#undef YYCODE
+
+ case CPP_EOF:
+ t->yychar = 0;
+ break;
+
+ case CPP_NAME:
+ t->yychar = read_process_identifier (&t->yylval);
+ break;
+
+ case CPP_NUMBER:
+ case CPP_CHAR:
+ case CPP_WCHAR:
+ t->yychar = CONSTANT;
+ break;
+
+ case CPP_STRING:
+ case CPP_WSTRING:
+ t->yychar = STRING;
+ break;
+
+ default:
+ yyerror ("parse error");
+ goto retry;
+ }
+
+ t->lineno = lineno;
+ return t->yychar;
+}
+
+static void
+feed_input (input)
+ struct unparsed_text *input;
+{
+ struct feed *f;
+#if 0
+ if (feed)
+ abort ();
+#endif
+
+ f = obstack_alloc (&feed_obstack, sizeof (struct feed));
+
+ /* The token list starts just after the struct unparsed_text in memory. */
+ input->pos = (struct token *) (input + 1);
+
+#ifdef SPEW_DEBUG
+ if (spew_debug)
+ fprintf (stderr, "\tfeeding %s:%d [%d tokens]\n",
+ input->filename, input->lineno, input->limit - input->pos);
+#endif
+
+ f->input = input;
+ f->filename = input_filename;
+ f->lineno = lineno;
+ f->yychar = yychar;
+ f->yylval = yylval;
+ f->first_token = first_token;
+ f->token_obstack = token_obstack;
+ f->next = feed;
+
+ input_filename = input->filename;
+ lineno = input->lineno;
+ yychar = YYEMPTY;
+ yylval.ttype = NULL_TREE;
+ first_token = 0;
+ gcc_obstack_init (&token_obstack);
+ feed = f;
+}
+
+void
+end_input ()
+{
+ struct feed *f = feed;
+
+ input_filename = f->filename;
+ lineno = f->lineno;
+ yychar = f->yychar;
+ yylval = f->yylval;
+ first_token = f->first_token;
+ obstack_free (&token_obstack, 0);
+ token_obstack = f->token_obstack;
+ feed = f->next;
+
+ obstack_free (&feed_obstack, f);
+
+#ifdef SPEW_DEBUG
+ if (spew_debug)
+ fprintf (stderr, "\treturning to %s:%d\n", input_filename, lineno);
+#endif
+}
+
+/* GC callback to mark memory pointed to by the pending inline queue. */
+void
+mark_pending_inlines (pi)
+ PTR pi;
+{
+ struct unparsed_text *up = * (struct unparsed_text **)pi;
+
+ while (up)
+ {
+ struct token *t = (struct token *) (up + 1);
+ struct token *l = up->limit;
+
+ while (t < l)
+ {
+ /* Some of the possible values for yychar use yylval.code
+ instead of yylval.ttype. We only have to worry about
+ yychars that could have been returned by read_token. */
+ switch (t->yychar)
+ {
+ case '+': case '-': case '*': case '/':
+ case '%': case '&': case '|': case '^':
+ case '>': case '<': case LSHIFT: case RSHIFT:
+ case ASSIGN: case MIN_MAX: case EQCOMPARE: case ARITHCOMPARE:
+ t++;
+ continue;
+ }
+ if (t->yylval.ttype)
+ ggc_mark_tree (t->yylval.ttype);
+ t++;
+ }
+ up = up->next;
+ }
+}
+
+/* Token queue management. */
+
+/* Return the number of tokens available on the fifo. */
+static SPEW_INLINE int
num_tokens ()
{
return (obstack_object_size (&token_obstack) / sizeof (struct token))
@@ -100,28 +460,51 @@ num_tokens ()
/* Fetch the token N down the line from the head of the fifo. */
-static struct token*
+static SPEW_INLINE struct token*
nth_token (n)
int n;
{
+#ifdef ENABLE_CHECKING
/* could just have this do slurp_ implicitly, but this way is easier
to debug... */
- my_friendly_assert (n < num_tokens (), 298);
+ my_friendly_assert (n >= 0 && n < num_tokens (), 298);
+#endif
return ((struct token*)obstack_base (&token_obstack)) + n + first_token;
}
-/* Add a token to the token fifo. */
+static const struct token Teosi = { END_OF_SAVED_INPUT, 0 UNION_INIT_ZERO };
+static const struct token Tpad = { EMPTY, 0 UNION_INIT_ZERO };
-static void
+/* Copy the next token into T and return its value. */
+static SPEW_INLINE int
add_token (t)
- struct token* t;
+ struct token *t;
+{
+ if (!feed)
+ return read_token (t);
+
+ if (feed->input->pos < feed->input->limit)
+ {
+ memcpy (t, feed->input->pos, sizeof (struct token));
+ return (feed->input->pos++)->yychar;
+ }
+
+ memcpy (t, &Teosi, sizeof (struct token));
+ return END_OF_SAVED_INPUT;
+}
+
+/* Shift the next token onto the fifo. */
+static SPEW_INLINE int
+shift_token ()
{
- obstack_grow (&token_obstack, t, sizeof (struct token));
+ size_t point = obstack_object_size (&token_obstack);
+ obstack_blank (&token_obstack, sizeof (struct token));
+ return add_token ((struct token *) (obstack_base (&token_obstack) + point));
}
/* Consume the next token out of the fifo. */
-static void
+static SPEW_INLINE void
consume_token ()
{
if (num_tokens () == 1)
@@ -133,227 +516,256 @@ consume_token ()
first_token++;
}
-#else
-/* ...otherwise use macros. */
-
-#define num_tokens() \
- ((obstack_object_size (&token_obstack) / sizeof (struct token)) - first_token)
-
-#define nth_token(N) \
- (((struct token*)obstack_base (&token_obstack))+(N)+first_token)
-
-#define add_token(T) obstack_grow (&token_obstack, (T), sizeof (struct token))
+/* Push a token at the head of the queue; it will be the next token read. */
+static SPEW_INLINE void
+push_token (t)
+ struct token *t;
+{
+ if (first_token == 0) /* We hope this doesn't happen often. */
+ {
+ size_t active = obstack_object_size (&token_obstack);
+ obstack_blank (&token_obstack, sizeof (struct token));
+ if (active)
+ memmove (obstack_base (&token_obstack) + sizeof (struct token),
+ obstack_base (&token_obstack), active);
+ first_token++;
+ }
+ first_token--;
+ memcpy (nth_token (0), t, sizeof (struct token));
+}
-#define consume_token() \
- (num_tokens () == 1 \
- ? (obstack_free (&token_obstack, obstack_base (&token_obstack)), \
- (first_token = 0)) \
- : first_token++)
-#endif
-/* Pull in enough tokens from real_yylex that the queue is N long beyond
- the current token. */
+/* Pull in enough tokens that the queue is N long beyond the current
+ token. */
static void
scan_tokens (n)
- unsigned int n;
+ int n;
{
- unsigned int i;
- struct token *tmp;
+ int i;
+ int num = num_tokens ();
+ int yychar;
+
+ /* First, prune any empty tokens at the end. */
+ i = num;
+ while (i > 0 && nth_token (i - 1)->yychar == EMPTY)
+ i--;
+ if (i < num)
+ {
+ obstack_blank (&token_obstack, -((num - i) * sizeof (struct token)));
+ num = i;
+ }
- /* We cannot read past certain tokens, so make sure we don't. */
- i = num_tokens ();
- if (i > n)
+ /* Now, if we already have enough tokens, return. */
+ if (num > n)
return;
- while (i-- > 0)
+
+ /* Never read past these characters: they might separate
+ the current input stream from one we save away later. */
+ for (i = 0; i < num; i++)
{
- tmp = nth_token (i);
- /* Never read past these characters: they might separate
- the current input stream from one we save away later. */
- if (tmp->yychar == '{' || tmp->yychar == ':' || tmp->yychar == ';')
+ yychar = nth_token (i)->yychar;
+ if (yychar == '{' || yychar == ':' || yychar == ';')
goto pad_tokens;
}
while (num_tokens () <= n)
{
- obstack_blank (&token_obstack, sizeof (struct token));
- tmp = ((struct token *)obstack_next_free (&token_obstack))-1;
- tmp->yychar = real_yylex ();
- tmp->end_of_file = end_of_file;
- tmp->yylval = yylval;
- end_of_file = 0;
- if (tmp->yychar == '{'
- || tmp->yychar == ':'
- || tmp->yychar == ';')
- {
- pad_tokens:
- while (num_tokens () <= n)
- {
- obstack_blank (&token_obstack, sizeof (struct token));
- tmp = ((struct token *)obstack_next_free (&token_obstack))-1;
- tmp->yychar = EMPTY;
- tmp->end_of_file = 0;
- }
- }
+ yychar = shift_token ();
+ if (yychar == '{' || yychar == ':' || yychar == ';')
+ goto pad_tokens;
}
+ return;
+
+ pad_tokens:
+ while (num_tokens () <= n)
+ obstack_grow (&token_obstack, &Tpad, sizeof (struct token));
}
-/* Like _obstack_allocated_p, but stop after checking NLEVELS chunks. */
+int looking_for_typename;
+int looking_for_template;
+
+static int after_friend;
+static int after_new;
+static int do_snarf_defarg;
-static int
-probe_obstack (h, obj, nlevels)
- struct obstack *h;
- tree obj;
- unsigned int nlevels;
+tree got_scope;
+tree got_object;
+
+static SPEW_INLINE int
+identifier_type (decl)
+ tree decl;
{
- register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
- register struct _obstack_chunk* plp; /* point to previous chunk if any */
+ tree t;
- lp = (h)->chunk;
- /* We use >= rather than > since the object cannot be exactly at
- the beginning of the chunk but might be an empty object exactly
- at the end of an adjacent chunk. */
- for (; nlevels != 0 && lp != 0 && ((tree)lp >= obj || (tree)lp->limit < obj);
- nlevels -= 1)
+ if (TREE_CODE (decl) == TEMPLATE_DECL)
+ {
+ if (TREE_CODE (DECL_TEMPLATE_RESULT (decl)) == TYPE_DECL)
+ return PTYPENAME;
+ else if (looking_for_template)
+ return PFUNCNAME;
+ }
+ if (looking_for_template && really_overloaded_fn (decl))
{
- plp = lp->prev;
- lp = plp;
+ /* See through a baselink. */
+ if (TREE_CODE (decl) == TREE_LIST)
+ decl = TREE_VALUE (decl);
+
+ for (t = decl; t != NULL_TREE; t = OVL_CHAIN (t))
+ if (DECL_FUNCTION_TEMPLATE_P (OVL_FUNCTION (t)))
+ return PFUNCNAME;
}
- return nlevels != 0 && lp != 0;
+ if (TREE_CODE (decl) == NAMESPACE_DECL)
+ return NSNAME;
+ if (TREE_CODE (decl) != TYPE_DECL)
+ return IDENTIFIER;
+ if (DECL_ARTIFICIAL (decl) && TREE_TYPE (decl) == current_class_type)
+ return SELFNAME;
+
+ /* A constructor declarator for a template type will get here as an
+ implicit typename, a TYPENAME_TYPE with a type. */
+ t = got_scope;
+ if (t && TREE_CODE (t) == TYPENAME_TYPE)
+ t = TREE_TYPE (t);
+ decl = TREE_TYPE (decl);
+ if (TREE_CODE (decl) == TYPENAME_TYPE)
+ decl = TREE_TYPE (decl);
+ if (t && t == decl)
+ return SELFNAME;
+
+ return TYPENAME;
}
-/* from lex.c: */
-/* Value is 1 (or 2) if we should try to make the next identifier look like
- a typename (when it may be a local variable or a class variable).
- Value is 0 if we treat this name in a default fashion. */
-extern int looking_for_typename;
-int looking_for_template;
-extern int do_snarf_defarg;
+/* token[0] == AGGR (struct/union/enum)
+ Thus, token[1] is either a TYPENAME or a TYPENAME_DEFN.
+ If token[2] == '{' or ':' then it's TYPENAME_DEFN.
+ It's also a definition if it's a forward declaration (as in 'struct Foo;')
+ which we can tell if token[2] == ';' *and* token[-1] != FRIEND or NEW. */
-extern struct obstack *current_obstack, *saveable_obstack;
-tree got_scope;
-tree got_object;
+static SPEW_INLINE void
+do_aggr ()
+{
+ int yc1, yc2;
+
+ scan_tokens (2);
+ yc1 = nth_token (1)->yychar;
+ if (yc1 != TYPENAME && yc1 != IDENTIFIER && yc1 != PTYPENAME)
+ return;
+ yc2 = nth_token (2)->yychar;
+ if (yc2 == ';')
+ {
+ /* It's a forward declaration iff we were not preceded by
+ 'friend' or `new'. */
+ if (after_friend || after_new)
+ return;
+ }
+ else if (yc2 != '{' && yc2 != ':')
+ return;
-int
-peekyylex ()
+ switch (yc1)
+ {
+ case TYPENAME:
+ nth_token (1)->yychar = TYPENAME_DEFN;
+ break;
+ case PTYPENAME:
+ nth_token (1)->yychar = PTYPENAME_DEFN;
+ break;
+ case IDENTIFIER:
+ nth_token (1)->yychar = IDENTIFIER_DEFN;
+ break;
+ default:
+ abort ();
+ }
+}
+
+void
+see_typename ()
{
- scan_tokens (0);
- return nth_token (0)->yychar;
+ /* Only types expected, not even namespaces. */
+ looking_for_typename = 2;
+ if (yychar < 0)
+ if ((yychar = yylex ()) < 0) yychar = 0;
+ looking_for_typename = 0;
+ if (yychar == IDENTIFIER)
+ {
+ lastiddecl = lookup_name (yylval.ttype, -2);
+ if (lastiddecl)
+ yychar = identifier_type (lastiddecl);
+ }
}
int
yylex ()
{
- struct token tmp_token;
- tree trrr = NULL_TREE;
+ int yychr;
int old_looking_for_typename = 0;
+ int just_saw_new = 0;
+ int just_saw_friend = 0;
+
+ timevar_push (TV_LEX);
retry:
#ifdef SPEW_DEBUG
if (spew_debug)
{
yylex_ctr ++;
- fprintf (stderr, "\t\t## %d ##", yylex_ctr);
+ fprintf (stderr, "\t\t## %d @%d ", yylex_ctr, lineno);
}
#endif
if (do_snarf_defarg)
{
- my_friendly_assert (num_tokens () == 0, 2837);
- tmp_token.yychar = DEFARG;
- tmp_token.yylval.ttype = snarf_defarg ();
- tmp_token.end_of_file = 0;
do_snarf_defarg = 0;
- add_token (&tmp_token);
+ yylval.ttype = snarf_defarg ();
+ yychar = DEFARG;
+ got_object = NULL_TREE;
+ timevar_pop (TV_LEX);
+ return DEFARG;
}
/* if we've got tokens, send them */
else if (num_tokens ())
- {
- tmp_token= *nth_token (0);
-
- /* TMP_TOKEN.YYLVAL.TTYPE may have been allocated on the wrong obstack.
- If we don't find it in CURRENT_OBSTACK's current or immediately
- previous chunk, assume it was and copy it to the current obstack. */
- if ((tmp_token.yychar == CONSTANT
- || tmp_token.yychar == STRING)
- && ! TREE_PERMANENT (tmp_token.yylval.ttype)
- && ! probe_obstack (current_obstack, tmp_token.yylval.ttype, 2)
- && ! probe_obstack (saveable_obstack, tmp_token.yylval.ttype, 2))
- tmp_token.yylval.ttype = copy_node (tmp_token.yylval.ttype);
- }
+ yychr = nth_token (0)->yychar;
else
- {
- /* if not, grab the next one and think about it */
- tmp_token.yychar = real_yylex ();
- tmp_token.yylval = yylval;
- tmp_token.end_of_file = end_of_file;
- add_token (&tmp_token);
- }
+ yychr = shift_token ();
/* many tokens just need to be returned. At first glance, all we
have to do is send them back up, but some of them are needed to
figure out local context. */
- switch (tmp_token.yychar)
+ switch (yychr)
{
case EMPTY:
/* This is a lexical no-op. */
- consume_token ();
#ifdef SPEW_DEBUG
if (spew_debug)
- debug_yychar (tmp_token.yychar);
+ debug_yychar (yychr);
#endif
+ consume_token ();
goto retry;
- case IDENTIFIER:
+ case '(':
scan_tokens (1);
- if (nth_token (1)->yychar == SCOPE)
+ if (nth_token (1)->yychar == ')')
{
- /* Don't interfere with the setting from an 'aggr' prefix. */
- old_looking_for_typename = looking_for_typename;
- looking_for_typename = 1;
+ consume_token ();
+ yychr = LEFT_RIGHT;
}
- else if (nth_token (1)->yychar == '<')
- looking_for_template = 1;
-
- trrr = lookup_name (tmp_token.yylval.ttype, -2);
-
- if (trrr)
- {
- tmp_token.yychar = identifier_type (trrr);
- switch (tmp_token.yychar)
- {
- case TYPENAME:
- case SELFNAME:
- case NSNAME:
- case PTYPENAME:
- lastiddecl = trrr;
-
- /* If this got special lookup, remember it. In these cases,
- we don't have to worry about being a declarator-id. */
- if (got_scope || got_object)
- tmp_token.yylval.ttype = trrr;
- break;
-
- case PFUNCNAME:
- case IDENTIFIER:
- lastiddecl = trrr;
- break;
+ break;
- default:
- my_friendly_abort (101);
- }
- }
- else
- lastiddecl = NULL_TREE;
- got_scope = NULL_TREE;
- /* and fall through to... */
+ case IDENTIFIER:
+ {
+ int peek;
+
+ scan_tokens (1);
+ peek = nth_token (1)->yychar;
+ yychr = frob_id (yychr, peek, &nth_token (0)->yylval.ttype);
+ break;
+ }
case IDENTIFIER_DEFN:
case TYPENAME:
case TYPENAME_DEFN:
case PTYPENAME:
case PTYPENAME_DEFN:
- consume_token ();
/* If we see a SCOPE next, restore the old value.
Otherwise, we got what we want. */
looking_for_typename = old_looking_for_typename;
@@ -361,129 +773,736 @@ yylex ()
break;
case SCSPEC:
- /* If export, warn that it's unimplemented and go on. */
- if (tmp_token.yylval.ttype == get_identifier("export"))
+ if (nth_token (0)->yylval.ttype == ridpointers[RID_EXTERN])
{
- warning ("keyword 'export' not implemented and will be ignored");
- consume_token ();
- goto retry;
- }
- else
- {
- ++first_token;
- break;
+ scan_tokens (1);
+ if (nth_token (1)->yychar == STRING)
+ {
+ yychr = EXTERN_LANG_STRING;
+ nth_token (1)->yylval.ttype = get_identifier
+ (TREE_STRING_POINTER (nth_token (1)->yylval.ttype));
+ consume_token ();
+ }
}
+ /* do_aggr needs to know if the previous token was `friend'. */
+ else if (nth_token (0)->yylval.ttype == ridpointers[RID_FRIEND])
+ just_saw_friend = 1;
+
+ break;
case NEW:
- /* do_aggr needs to check if the previous token was RID_NEW,
- so just increment first_token instead of calling consume_token. */
- ++first_token;
+ /* do_aggr needs to know if the previous token was `new'. */
+ just_saw_new = 1;
break;
case TYPESPEC:
- consume_token ();
+ case '{':
+ case ':':
+ case ';':
+ /* If this provides a type for us, then revert lexical
+ state to standard state. */
+ looking_for_typename = 0;
break;
case AGGR:
- *nth_token (0) = tmp_token;
do_aggr ();
- /* fall through to output... */
+ break;
+
case ENUM:
/* Set this again, in case we are rescanning. */
looking_for_typename = 2;
- /* fall through... */
+ break;
+
default:
- consume_token ();
+ break;
}
+ after_friend = just_saw_friend;
+ after_new = just_saw_new;
+
/* class member lookup only applies to the first token after the object
expression, except for explicit destructor calls. */
- if (tmp_token.yychar != '~')
+ if (yychr != '~')
got_object = NULL_TREE;
- /* Clear looking_for_typename if we got 'enum { ... };'. */
- if (tmp_token.yychar == '{' || tmp_token.yychar == ':'
- || tmp_token.yychar == ';')
- looking_for_typename = 0;
+ yychar = yychr;
+ {
+ struct token *tok = nth_token (0);
+
+ yylval = tok->yylval;
+ if (tok->lineno)
+ lineno = tok->lineno;
+ }
- yylval = tmp_token.yylval;
- yychar = tmp_token.yychar;
- end_of_file = tmp_token.end_of_file;
#ifdef SPEW_DEBUG
if (spew_debug)
- debug_yychar (yychar);
+ debug_yychar (yychr);
#endif
+ consume_token ();
- return yychar;
+ timevar_pop (TV_LEX);
+ return yychr;
}
-/* token[0] == AGGR (struct/union/enum)
- Thus, token[1] is either a TYPENAME or a TYPENAME_DEFN.
- If token[2] == '{' or ':' then it's TYPENAME_DEFN.
- It's also a definition if it's a forward declaration (as in 'struct Foo;')
- which we can tell if token[2] == ';' *and* token[-1] != FRIEND or NEW. */
+/* Unget character CH from the input stream.
+ If RESCAN is non-zero, then we want to `see' this
+ character as the next input token. */
+
+void
+yyungetc (ch, rescan)
+ int ch;
+ int rescan;
+{
+ /* Unget a character from the input stream. */
+ if (yychar == YYEMPTY || rescan == 0)
+ {
+ struct token fake;
+
+ /* If we're putting back a brace, undo the change in indent_level
+ from the first time we saw it. */
+ if (ch == '{')
+ indent_level--;
+ else if (ch == '}')
+ indent_level++;
+
+ fake.yychar = ch;
+ fake.yylval.ttype = 0;
+ fake.lineno = lineno;
+
+ push_token (&fake);
+ }
+ else
+ {
+ yychar = ch;
+ }
+}
+
+/* Lexer hackery to determine what *IDP really is. */
static int
-do_aggr ()
+frob_id (yyc, peek, idp)
+ int yyc;
+ int peek;
+ tree *idp;
{
- int yc1, yc2;
+ tree trrr;
+ int old_looking_for_typename = 0;
- scan_tokens (2);
- yc1 = nth_token (1)->yychar;
- if (yc1 != TYPENAME && yc1 != IDENTIFIER && yc1 != PTYPENAME)
- return 0;
- yc2 = nth_token (2)->yychar;
- if (yc2 == ';')
+ if (peek == SCOPE)
{
- /* It's a forward declaration iff we were not preceded by
- 'friend' or `new'. */
- if (first_token > 0)
+ /* Don't interfere with the setting from an 'aggr' prefix. */
+ old_looking_for_typename = looking_for_typename;
+ looking_for_typename = 1;
+ }
+ else if (peek == '<')
+ looking_for_template = 1;
+ trrr = lookup_name (*idp, -2);
+ if (trrr)
+ {
+ yyc = identifier_type (trrr);
+ switch(yyc)
+ {
+ case TYPENAME:
+ case SELFNAME:
+ case NSNAME:
+ case PTYPENAME:
+ /* If this got special lookup, remember it. In these
+ cases, we know it can't be a declarator-id. */
+ if (got_scope || got_object)
+ *idp = trrr;
+ /* FALLTHROUGH */
+ case PFUNCNAME:
+ case IDENTIFIER:
+ lastiddecl = trrr;
+ break;
+ default:
+ abort ();
+ }
+ }
+ else
+ lastiddecl = NULL_TREE;
+ got_scope = NULL_TREE;
+ looking_for_typename = old_looking_for_typename;
+ looking_for_template = 0;
+ return yyc;
+}
+
+/* ID is an operator name. Duplicate the hackery in yylex to determine what
+ it really is. */
+
+tree frob_opname (id)
+ tree id;
+{
+ scan_tokens (0);
+ frob_id (0, nth_token (0)->yychar, &id);
+ got_object = NULL_TREE;
+ return id;
+}
+
+/* Set up the state required to correctly handle the definition of the
+ inline function whose preparsed state has been saved in PI. */
+
+static void
+begin_parsing_inclass_inline (pi)
+ struct unparsed_text *pi;
+{
+ tree context;
+
+ /* Record that we are processing the chain of inlines starting at
+ PI for GC. */
+ if (cfun)
+ cp_function_chain->unparsed_inlines = pi;
+ else
+ processing_these_inlines = pi;
+
+ ggc_collect ();
+
+ /* If this is an inline function in a local class, we must make sure
+ that we save all pertinent information about the function
+ surrounding the local class. */
+ context = decl_function_context (pi->decl);
+ if (context)
+ push_function_context_to (context);
+
+ feed_input (pi);
+ interface_unknown = pi->interface == 1;
+ interface_only = pi->interface == 0;
+ DECL_PENDING_INLINE_P (pi->decl) = 0;
+ DECL_PENDING_INLINE_INFO (pi->decl) = 0;
+
+ /* Pass back a handle to the rest of the inline functions, so that they
+ can be processed later. */
+ yychar = PRE_PARSED_FUNCTION_DECL;
+ yylval.pi = pi;
+
+ start_function (NULL_TREE, pi->decl, NULL_TREE,
+ (SF_DEFAULT | SF_PRE_PARSED | SF_INCLASS_INLINE));
+}
+
+/* Called from the top level: if there are any pending inlines to
+ do, set up to process them now. This function sets up the first function
+ to be parsed; after it has been, the rule for fndef in parse.y will
+ call process_next_inline to start working on the next one. */
+
+void
+do_pending_inlines ()
+{
+ /* Oops, we're still dealing with the last batch. */
+ if (yychar == PRE_PARSED_FUNCTION_DECL)
+ return;
+
+ if (pending_inlines)
+ {
+ /* Clear the chain, so that any inlines nested inside the batch
+ we're to process now don't refer to this batch. See e.g.
+ g++.other/lookup6.C. */
+ struct unparsed_text *first = pending_inlines;
+ pending_inlines = pending_inlines_tail = 0;
+
+ begin_parsing_inclass_inline (first);
+ }
+}
+
+/* Called from the fndecl rule in the parser when the function just parsed
+ was declared using a PRE_PARSED_FUNCTION_DECL (i.e. came from
+ do_pending_inlines). */
+
+void
+process_next_inline (i)
+ struct unparsed_text *i;
+{
+ tree decl = i->decl;
+ tree context = decl_function_context (decl);
+
+ if (context)
+ pop_function_context_from (context);
+ if (yychar == YYEMPTY)
+ yychar = yylex ();
+ if (yychar != END_OF_SAVED_INPUT)
+ error ("parse error at end of saved function text");
+ end_input ();
+
+ i = i->next;
+ if (i)
+ begin_parsing_inclass_inline (i);
+ else
+ {
+ if (cfun)
+ cp_function_chain->unparsed_inlines = 0;
+ else
+ processing_these_inlines = 0;
+ extract_interface_info ();
+ }
+}
+
+
+/* Subroutine of snarf_method, deals with actual absorption of the block. */
+
+static SPEW_INLINE void
+snarf_block (starting_file, starting_line)
+ const char *starting_file;
+ int starting_line;
+{
+ int blev = 1;
+ int look_for_semicolon = 0;
+ int look_for_lbrac = 0;
+ int look_for_catch = 0;
+ int yyc;
+ struct token tmp;
+ size_t point;
+
+ if (yychar == '{')
+ /* We incremented indent_level in yylex; undo that. */
+ indent_level--;
+ else if (yychar == '=')
+ look_for_semicolon = 1;
+ else if (yychar == ':' || yychar == RETURN_KEYWORD || yychar == TRY)
+ {
+ if (yychar == TRY)
+ look_for_catch = 1;
+ look_for_lbrac = 1;
+ blev = 0;
+ }
+ else
+ yyerror ("parse error in method specification");
+
+ /* The current token is the first one to be recorded. */
+ tmp.yychar = yychar;
+ tmp.yylval = yylval;
+ tmp.lineno = lineno;
+ obstack_grow (&inline_text_obstack, &tmp, sizeof (struct token));
+
+ for (;;)
+ {
+ point = obstack_object_size (&inline_text_obstack);
+ obstack_blank (&inline_text_obstack, sizeof (struct token));
+ yyc = add_token ((struct token *)
+ (obstack_base (&inline_text_obstack) + point));
+
+ if (yyc == '{')
+ {
+ look_for_lbrac = 0;
+ blev++;
+ }
+ else if (yyc == '}')
+ {
+ blev--;
+ if (blev == 0 && !look_for_semicolon)
+ {
+ if (!look_for_catch)
+ break;
+
+ if (add_token (&tmp) != CATCH)
+ {
+ push_token (&tmp);
+ break;
+ }
+
+ look_for_lbrac = 1;
+ obstack_grow (&inline_text_obstack, &tmp, sizeof (struct token));
+ }
+ }
+ else if (yyc == ';')
+ {
+ if (look_for_lbrac)
+ {
+ error ("function body for constructor missing");
+ /* fake a { } to avoid further errors */
+ tmp.yylval.ttype = 0;
+ tmp.yychar = '{';
+ obstack_grow (&inline_text_obstack, &tmp, sizeof (struct token));
+ tmp.yychar = '}';
+ obstack_grow (&inline_text_obstack, &tmp, sizeof (struct token));
+ break;
+ }
+ else if (look_for_semicolon && blev == 0)
+ break;
+ }
+ else if (yyc == 0)
{
- if (nth_token (-1)->yychar == SCSPEC
- && nth_token (-1)->yylval.ttype == ridpointers[(int) RID_FRIEND])
- return 0;
- if (nth_token (-1)->yychar == NEW)
- return 0;
+ error_with_file_and_line (starting_file, starting_line,
+ "end of file read inside definition");
+ break;
}
}
- else if (yc2 != '{' && yc2 != ':')
- return 0;
+}
- switch (yc1)
+/* This function stores away the text for an inline function that should
+ be processed later (by do_pending_inlines). */
+void
+snarf_method (decl)
+ tree decl;
+{
+ int starting_lineno = lineno;
+ const char *starting_filename = input_filename;
+ size_t len;
+
+ struct unparsed_text *meth;
+
+ /* Leave room for the header, then absorb the block. */
+ obstack_blank (&inline_text_obstack, sizeof (struct unparsed_text));
+ snarf_block (starting_filename, starting_lineno);
+
+ len = obstack_object_size (&inline_text_obstack);
+ meth = (struct unparsed_text *) obstack_finish (&inline_text_obstack);
+
+ /* Happens when we get two declarations of the same function in the
+ same scope. */
+ if (decl == void_type_node
+ || (current_class_type && TYPE_REDEFINED (current_class_type)))
{
- case TYPENAME:
- nth_token (1)->yychar = TYPENAME_DEFN;
- break;
- case PTYPENAME:
- nth_token (1)->yychar = PTYPENAME_DEFN;
- break;
- case IDENTIFIER:
- nth_token (1)->yychar = IDENTIFIER_DEFN;
- break;
- default:
- my_friendly_abort (102);
+ obstack_free (&inline_text_obstack, (char *)meth);
+ return;
}
- return 0;
-}
+
+ meth->decl = decl;
+ meth->filename = starting_filename;
+ meth->lineno = starting_lineno;
+ meth->limit = (struct token *) ((char *)meth + len);
+ meth->interface = (interface_unknown ? 1 : (interface_only ? 0 : 2));
+ meth->next = 0;
+
+#ifdef SPEW_DEBUG
+ if (spew_debug)
+ fprintf (stderr, "\tsaved method of %d tokens from %s:%d\n",
+ meth->limit - (struct token *) (meth + 1),
+ starting_filename, starting_lineno);
+#endif
+
+ DECL_PENDING_INLINE_INFO (decl) = meth;
+ DECL_PENDING_INLINE_P (decl) = 1;
+
+ if (pending_inlines_tail)
+ pending_inlines_tail->next = meth;
+ else
+ pending_inlines = meth;
+ pending_inlines_tail = meth;
+}
+
+/* Consume a no-commas expression - a default argument - and save it
+ on the inline_text_obstack. */
+
+static tree
+snarf_defarg ()
+{
+ int starting_lineno = lineno;
+ const char *starting_filename = input_filename;
+ int yyc;
+ int plev = 0;
+ size_t point;
+ size_t len;
+ struct unparsed_text *buf;
+ tree arg;
+
+ obstack_blank (&inline_text_obstack, sizeof (struct unparsed_text));
+
+ for (;;)
+ {
+ point = obstack_object_size (&inline_text_obstack);
+ obstack_blank (&inline_text_obstack, sizeof (struct token));
+ yyc = add_token ((struct token *)
+ (obstack_base (&inline_text_obstack) + point));
+
+ if (plev <= 0 && (yyc == ')' || yyc == ','))
+ break;
+ else if (yyc == '(' || yyc == '[')
+ ++plev;
+ else if (yyc == ']' || yyc == ')')
+ --plev;
+ else if (yyc == 0)
+ {
+ error_with_file_and_line (starting_filename, starting_lineno,
+ "end of file read inside default argument");
+ goto done;
+ }
+ }
+
+ /* Unget the last token. */
+ push_token ((struct token *) (obstack_base (&inline_text_obstack) + point));
+ /* This is the documented way to shrink a growing obstack block. */
+ obstack_blank (&inline_text_obstack, - (int) sizeof (struct token));
+
+ done:
+ len = obstack_object_size (&inline_text_obstack);
+ buf = (struct unparsed_text *) obstack_finish (&inline_text_obstack);
+
+ buf->decl = 0;
+ buf->filename = starting_filename;
+ buf->lineno = starting_lineno;
+ buf->limit = (struct token *) ((char *)buf + len);
+ buf->next = 0;
+#ifdef SPEW_DEBUG
+ if (spew_debug)
+ fprintf (stderr, "\tsaved defarg of %d tokens from %s:%d\n",
+ buf->limit - (struct token *) (buf + 1),
+ starting_filename, starting_lineno);
+#endif
+
+ arg = make_node (DEFAULT_ARG);
+ DEFARG_POINTER (arg) = (char *)buf;
+
+ return arg;
+}
+
+/* Decide whether the default argument we are about to see should be
+ gobbled up as text for later parsing. */
+
+void
+maybe_snarf_defarg ()
+{
+ if (current_class_type && TYPE_BEING_DEFINED (current_class_type))
+ do_snarf_defarg = 1;
+}
+
+/* Called from grokfndecl to note a function decl with unparsed default
+ arguments for later processing. Also called from grokdeclarator
+ for function types with unparsed defargs; the call from grokfndecl
+ will always come second, so we can overwrite the entry from the type. */
+
+void
+add_defarg_fn (decl)
+ tree decl;
+{
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ TREE_VALUE (defarg_fns) = decl;
+ else
+ {
+ defarg_fns = tree_cons (NULL_TREE, decl, defarg_fns);
+ TREE_TYPE (defarg_fns) = current_class_type;
+ }
+}
+
+/* Helper for do_pending_defargs. Starts the parsing of a default arg. */
+
+static void
+feed_defarg (p)
+ tree p;
+{
+ tree d = TREE_PURPOSE (p);
+
+ feed_input ((struct unparsed_text *)DEFARG_POINTER (d));
+ yychar = DEFARG_MARKER;
+ yylval.ttype = p;
+}
+
+/* Helper for do_pending_defargs. Ends the parsing of a default arg. */
+
+static void
+finish_defarg ()
+{
+ if (yychar == YYEMPTY)
+ yychar = yylex ();
+ if (yychar != END_OF_SAVED_INPUT)
+ error ("parse error at end of saved function text");
+
+ end_input ();
+}
+
+/* Main function for deferred parsing of default arguments. Called from
+ the parser. */
+
+void
+do_pending_defargs ()
+{
+ if (defarg_parm)
+ finish_defarg ();
+
+ for (; defarg_fns;)
+ {
+ tree current = defarg_fns;
+
+ tree defarg_fn = TREE_VALUE (defarg_fns);
+ if (defarg_parm == NULL_TREE)
+ {
+ push_nested_class (TREE_TYPE (defarg_fns), 1);
+ pushlevel (0);
+ if (TREE_CODE (defarg_fn) == FUNCTION_DECL)
+ maybe_begin_member_template_processing (defarg_fn);
+
+ if (TREE_CODE (defarg_fn) == FUNCTION_DECL)
+ defarg_parm = TYPE_ARG_TYPES (TREE_TYPE (defarg_fn));
+ else
+ defarg_parm = TYPE_ARG_TYPES (defarg_fn);
+ }
+ else
+ defarg_parm = TREE_CHAIN (defarg_parm);
+
+ for (; defarg_parm; defarg_parm = TREE_CHAIN (defarg_parm))
+ if (!TREE_PURPOSE (defarg_parm)
+ || TREE_CODE (TREE_PURPOSE (defarg_parm)) != DEFAULT_ARG)
+ ;/* OK */
+ else if (TREE_PURPOSE (current) == error_mark_node)
+ DEFARG_POINTER (TREE_PURPOSE (defarg_parm)) = NULL;
+ else
+ {
+ feed_defarg (defarg_parm);
+
+ /* Return to the parser, which will process this defarg
+ and call us again. */
+ return;
+ }
+
+ if (TREE_CODE (defarg_fn) == FUNCTION_DECL)
+ {
+ maybe_end_member_template_processing ();
+ check_default_args (defarg_fn);
+ }
+
+ poplevel (0, 0, 0);
+ pop_nested_class ();
+
+ defarg_fns = TREE_CHAIN (defarg_fns);
+ if (defarg_depfns)
+ {
+ /* This function's default args depend on unprocessed default args
+ of defarg_fns. We will need to reprocess this function, and
+ check for circular dependencies. */
+ tree a, b;
+
+ for (a = defarg_depfns, b = TREE_PURPOSE (current); a && b;
+ a = TREE_CHAIN (a), b = TREE_CHAIN (b))
+ if (TREE_VALUE (a) != TREE_VALUE (b))
+ goto different;
+ if (a || b)
+ {
+ different:;
+ TREE_CHAIN (current) = NULL_TREE;
+ defarg_fns = chainon (defarg_fns, current);
+ TREE_PURPOSE (current) = defarg_depfns;
+ }
+ else
+ {
+ cp_warning_at ("circular dependency in default args of `%#D'", defarg_fn);
+ /* No need to say what else is dependent, as they will be
+ picked up in another pass. */
+
+ /* Immediately repeat, but marked so that we break the loop. */
+ defarg_fns = current;
+ TREE_PURPOSE (current) = error_mark_node;
+ }
+ defarg_depfns = NULL_TREE;
+ }
+ else if (TREE_PURPOSE (current) == error_mark_node)
+ defarg_fnsdone = tree_cons (NULL_TREE, defarg_fn, defarg_fnsdone);
+ }
+}
+
+/* After parsing all the default arguments, we must clear any that remain,
+ which will be part of a circular dependency. */
+void
+done_pending_defargs ()
+{
+ for (; defarg_fnsdone; defarg_fnsdone = TREE_CHAIN (defarg_fnsdone))
+ {
+ tree fn = TREE_VALUE (defarg_fnsdone);
+ tree parms;
+
+ if (TREE_CODE (fn) == FUNCTION_DECL)
+ parms = TYPE_ARG_TYPES (TREE_TYPE (fn));
+ else
+ parms = TYPE_ARG_TYPES (fn);
+ for (; parms; parms = TREE_CHAIN (parms))
+ if (TREE_PURPOSE (parms)
+ && TREE_CODE (TREE_PURPOSE (parms)) == DEFAULT_ARG)
+ {
+ my_friendly_assert (!DEFARG_POINTER (TREE_PURPOSE (parms)), 20010107);
+ TREE_PURPOSE (parms) = NULL_TREE;
+ }
+ }
+}
+
+/* In processing the current default arg, we called FN, but that call
+ required a default argument of FN, and that had not yet been processed.
+ Remember FN. */
+
+void
+unprocessed_defarg_fn (fn)
+ tree fn;
+{
+ defarg_depfns = tree_cons (NULL_TREE, fn, defarg_depfns);
+}
+
+/* Called from the parser to update an element of TYPE_ARG_TYPES for some
+ FUNCTION_TYPE with the newly parsed version of its default argument, which
+ was previously digested as text. */
+
+void
+replace_defarg (arg, init)
+ tree arg, init;
+{
+ if (init == error_mark_node)
+ TREE_PURPOSE (arg) = error_mark_node;
+ else
+ {
+ if (! processing_template_decl
+ && ! can_convert_arg (TREE_VALUE (arg), TREE_TYPE (init), init))
+ pedwarn ("invalid type `%T' for default argument to `%T'",
+ TREE_TYPE (init), TREE_VALUE (arg));
+ if (!defarg_depfns)
+ TREE_PURPOSE (arg) = init;
+ }
+}
+
#ifdef SPEW_DEBUG
/* debug_yychar takes a yychar (token number) value and prints its name. */
-static int
+static void
debug_yychar (yy)
int yy;
{
- /* In parse.y: */
- extern char *debug_yytranslate ();
-
- int i;
-
- if (yy<256) {
- fprintf (stderr, "<%d: %c >\n", yy, yy);
- return 0;
- }
- fprintf (stderr, "<%d:%s>\n", yy, debug_yytranslate (yy));
- return 1;
+ if (yy<256)
+ fprintf (stderr, "->%d < %c >\n", lineno, yy);
+ else if (yy == IDENTIFIER || yy == TYPENAME)
+ {
+ const char *id;
+ if (TREE_CODE (yylval.ttype) == IDENTIFIER_NODE)
+ id = IDENTIFIER_POINTER (yylval.ttype);
+ else if (TREE_CODE_CLASS (TREE_CODE (yylval.ttype)) == 'd')
+ id = IDENTIFIER_POINTER (DECL_NAME (yylval.ttype));
+ else
+ id = "";
+ fprintf (stderr, "->%d <%s `%s'>\n", lineno, debug_yytranslate (yy), id);
+ }
+ else
+ fprintf (stderr, "->%d <%s>\n", lineno, debug_yytranslate (yy));
}
#endif
+
+#define NAME(TYPE) cpp_type2name (TYPE)
+
+void
+yyerror (msgid)
+ const char *msgid;
+{
+ const char *string = _(msgid);
+
+ if (last_token == CPP_EOF)
+ error ("%s at end of input", string);
+ else if (last_token == CPP_CHAR || last_token == CPP_WCHAR)
+ {
+ unsigned int val = TREE_INT_CST_LOW (yylval.ttype);
+ const char *const ell = (last_token == CPP_CHAR) ? "" : "L";
+ if (val <= UCHAR_MAX && ISGRAPH (val))
+ error ("%s before %s'%c'", string, ell, val);
+ else
+ error ("%s before %s'\\x%x'", string, ell, val);
+ }
+ else if (last_token == CPP_STRING
+ || last_token == CPP_WSTRING)
+ error ("%s before string constant", string);
+ else if (last_token == CPP_NUMBER)
+ error ("%s before numeric constant", string);
+ else if (last_token == CPP_NAME)
+ {
+ if (TREE_CODE (last_token_id) == IDENTIFIER_NODE)
+ error ("%s before `%s'", string, IDENTIFIER_POINTER (last_token_id));
+ else if (ISGRAPH (yychar))
+ error ("%s before `%c'", string, yychar);
+ else
+ error ("%s before `\%o'", string, yychar);
+ }
+ else
+ error ("%s before `%s' token", string, NAME (last_token));
+}
diff --git a/contrib/gcc/cp/tree.c b/contrib/gcc/cp/tree.c
index 866aa27..d353b06 100644
--- a/contrib/gcc/cp/tree.c
+++ b/contrib/gcc/cp/tree.c
@@ -1,5 +1,6 @@
/* Language-dependent node constructors for parse phase of GNU compiler.
- Copyright (C) 1987, 88, 92-98, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -27,36 +28,50 @@ Boston, MA 02111-1307, USA. */
#include "flags.h"
#include "rtl.h"
#include "toplev.h"
-
-static tree bot_manip PROTO((tree));
-static tree perm_manip PROTO((tree));
-static tree build_cplus_array_type_1 PROTO((tree, tree));
-static void list_hash_add PROTO((int, tree));
-static int list_hash PROTO((tree, tree, tree));
-static tree list_hash_lookup PROTO((int, tree, tree, tree));
-static void propagate_binfo_offsets PROTO((tree, tree));
-static int avoid_overlap PROTO((tree, tree));
-static int lvalue_p_1 PROTO((tree, int));
-static int equal_functions PROTO((tree, tree));
-static tree no_linkage_helper PROTO((tree));
-static tree build_srcloc PROTO((char *, int));
-
-#define CEIL(x,y) (((x) + (y) - 1) / (y))
-
-/* Returns non-zero if REF is an lvalue. If
- TREAT_CLASS_RVALUES_AS_LVALUES is non-zero, rvalues of class type
- are considered lvalues. */
-
-static int
+#include "ggc.h"
+#include "insn-config.h"
+#include "integrate.h"
+#include "tree-inline.h"
+
+static tree bot_manip PARAMS ((tree *, int *, void *));
+static tree bot_replace PARAMS ((tree *, int *, void *));
+static tree build_cplus_array_type_1 PARAMS ((tree, tree));
+static int list_hash_eq PARAMS ((const void *, const void *));
+static hashval_t list_hash_pieces PARAMS ((tree, tree, tree));
+static hashval_t list_hash PARAMS ((const void *));
+static cp_lvalue_kind lvalue_p_1 PARAMS ((tree, int));
+static tree no_linkage_helper PARAMS ((tree *, int *, void *));
+static tree build_srcloc PARAMS ((const char *, int));
+static tree mark_local_for_remap_r PARAMS ((tree *, int *, void *));
+static tree cp_unsave_r PARAMS ((tree *, int *, void *));
+static void cp_unsave PARAMS ((tree *));
+static tree build_target_expr PARAMS ((tree, tree));
+static tree count_trees_r PARAMS ((tree *, int *, void *));
+static tree verify_stmt_tree_r PARAMS ((tree *, int *, void *));
+static tree find_tree_r PARAMS ((tree *, int *, void *));
+extern int cp_statement_code_p PARAMS ((enum tree_code));
+
+static tree handle_java_interface_attribute PARAMS ((tree *, tree, tree, int, bool *));
+static tree handle_com_interface_attribute PARAMS ((tree *, tree, tree, int, bool *));
+static tree handle_init_priority_attribute PARAMS ((tree *, tree, tree, int, bool *));
+
+/* If REF is an lvalue, returns the kind of lvalue that REF is.
+ Otherwise, returns clk_none. If TREAT_CLASS_RVALUES_AS_LVALUES is
+ non-zero, rvalues of class type are considered lvalues. */
+
+static cp_lvalue_kind
lvalue_p_1 (ref, treat_class_rvalues_as_lvalues)
tree ref;
int treat_class_rvalues_as_lvalues;
{
+ cp_lvalue_kind op1_lvalue_kind = clk_none;
+ cp_lvalue_kind op2_lvalue_kind = clk_none;
+
if (TREE_CODE (TREE_TYPE (ref)) == REFERENCE_TYPE)
- return 1;
+ return clk_ordinary;
- if (ref == current_class_ptr && flag_this_is_variable <= 0)
- return 0;
+ if (ref == current_class_ptr)
+ return clk_none;
switch (TREE_CODE (ref))
{
@@ -64,104 +79,136 @@ lvalue_p_1 (ref, treat_class_rvalues_as_lvalues)
what they refer to are valid lvals. */
case PREINCREMENT_EXPR:
case PREDECREMENT_EXPR:
- case COMPONENT_REF:
case SAVE_EXPR:
case UNSAVE_EXPR:
case TRY_CATCH_EXPR:
case WITH_CLEANUP_EXPR:
case REALPART_EXPR:
case IMAGPART_EXPR:
+ /* This shouldn't be here, but there are lots of places in the compiler
+ that are sloppy about tacking on NOP_EXPRs to the same type when
+ no actual conversion is happening. */
case NOP_EXPR:
return lvalue_p_1 (TREE_OPERAND (ref, 0),
treat_class_rvalues_as_lvalues);
+ case COMPONENT_REF:
+ op1_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 0),
+ treat_class_rvalues_as_lvalues);
+ if (op1_lvalue_kind
+ /* The "field" can be a FUNCTION_DECL or an OVERLOAD in some
+ situations. */
+ && TREE_CODE (TREE_OPERAND (ref, 1)) == FIELD_DECL
+ && DECL_C_BIT_FIELD (TREE_OPERAND (ref, 1)))
+ {
+ /* Clear the ordinary bit. If this object was a class
+ rvalue we want to preserve that information. */
+ op1_lvalue_kind &= ~clk_ordinary;
+ /* The lvalue is for a btifield. */
+ op1_lvalue_kind |= clk_bitfield;
+ }
+ return op1_lvalue_kind;
+
case STRING_CST:
- return 1;
+ return clk_ordinary;
case VAR_DECL:
if (TREE_READONLY (ref) && ! TREE_STATIC (ref)
&& DECL_LANG_SPECIFIC (ref)
&& DECL_IN_AGGR_P (ref))
- return 0;
+ return clk_none;
case INDIRECT_REF:
case ARRAY_REF:
case PARM_DECL:
case RESULT_DECL:
if (TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)
- return 1;
+ return clk_ordinary;
break;
/* A currently unresolved scope ref. */
case SCOPE_REF:
- my_friendly_abort (103);
+ abort ();
case OFFSET_REF:
if (TREE_CODE (TREE_OPERAND (ref, 1)) == FUNCTION_DECL)
- return 1;
- return (lvalue_p_1 (TREE_OPERAND (ref, 0),
- treat_class_rvalues_as_lvalues)
- && lvalue_p_1 (TREE_OPERAND (ref, 1),
- treat_class_rvalues_as_lvalues));
+ return clk_ordinary;
+ /* Fall through. */
+ case MAX_EXPR:
+ case MIN_EXPR:
+ op1_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 0),
+ treat_class_rvalues_as_lvalues);
+ op2_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 1),
+ treat_class_rvalues_as_lvalues);
break;
case COND_EXPR:
- return (lvalue_p_1 (TREE_OPERAND (ref, 1),
- treat_class_rvalues_as_lvalues)
- && lvalue_p_1 (TREE_OPERAND (ref, 2),
- treat_class_rvalues_as_lvalues));
+ op1_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 1),
+ treat_class_rvalues_as_lvalues);
+ op2_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 2),
+ treat_class_rvalues_as_lvalues);
+ break;
case MODIFY_EXPR:
- return 1;
+ return clk_ordinary;
case COMPOUND_EXPR:
return lvalue_p_1 (TREE_OPERAND (ref, 1),
- treat_class_rvalues_as_lvalues);
-
- case MAX_EXPR:
- case MIN_EXPR:
- return (lvalue_p_1 (TREE_OPERAND (ref, 0),
- treat_class_rvalues_as_lvalues)
- && lvalue_p_1 (TREE_OPERAND (ref, 1),
- treat_class_rvalues_as_lvalues));
+ treat_class_rvalues_as_lvalues);
case TARGET_EXPR:
- return treat_class_rvalues_as_lvalues;
+ return treat_class_rvalues_as_lvalues ? clk_class : clk_none;
case CALL_EXPR:
- return (treat_class_rvalues_as_lvalues
- && IS_AGGR_TYPE (TREE_TYPE (ref)));
+ case VA_ARG_EXPR:
+ return ((treat_class_rvalues_as_lvalues
+ && IS_AGGR_TYPE (TREE_TYPE (ref)))
+ ? clk_class : clk_none);
case FUNCTION_DECL:
/* All functions (except non-static-member functions) are
lvalues. */
- return !DECL_NONSTATIC_MEMBER_FUNCTION_P (ref);
+ return (DECL_NONSTATIC_MEMBER_FUNCTION_P (ref)
+ ? clk_none : clk_ordinary);
default:
break;
}
- return 0;
+ /* If one operand is not an lvalue at all, then this expression is
+ not an lvalue. */
+ if (!op1_lvalue_kind || !op2_lvalue_kind)
+ return clk_none;
+
+ /* Otherwise, it's an lvalue, and it has all the odd properties
+ contributed by either operand. */
+ op1_lvalue_kind = op1_lvalue_kind | op2_lvalue_kind;
+ /* It's not an ordinary lvalue if it involves either a bit-field or
+ a class rvalue. */
+ if ((op1_lvalue_kind & ~clk_ordinary) != clk_none)
+ op1_lvalue_kind &= ~clk_ordinary;
+ return op1_lvalue_kind;
}
-/* Return nonzero if REF is an lvalue valid for this language.
- Lvalues can be assigned, unless they have TREE_READONLY, or unless
- they are FUNCTION_DECLs. Lvalues can have their address taken,
- unless they have DECL_REGISTER. */
+/* If REF is an lvalue, returns the kind of lvalue that REF is.
+ Otherwise, returns clk_none. Lvalues can be assigned, unless they
+ have TREE_READONLY, or unless they are FUNCTION_DECLs. Lvalues can
+ have their address taken, unless they have DECL_REGISTER. */
-int
+cp_lvalue_kind
real_lvalue_p (ref)
tree ref;
{
return lvalue_p_1 (ref, /*treat_class_rvalues_as_lvalues=*/0);
}
-/* This differs from real_lvalue_p in that class rvalues are considered
- lvalues. */
+/* This differs from real_lvalue_p in that class rvalues are
+ considered lvalues. */
int
lvalue_p (ref)
tree ref;
{
- return lvalue_p_1 (ref, /*treat_class_rvalues_as_lvalues=*/1);
+ return
+ (lvalue_p_1 (ref, /*treat_class_rvalues_as_lvalues=*/1) != clk_none);
}
/* Return nonzero if REF is an lvalue valid for this language;
@@ -178,6 +225,26 @@ lvalue_or_else (ref, string)
return win;
}
+/* Build a TARGET_EXPR, initializing the DECL with the VALUE. */
+
+static tree
+build_target_expr (decl, value)
+ tree decl;
+ tree value;
+{
+ tree t;
+
+ t = build (TARGET_EXPR, TREE_TYPE (decl), decl, value,
+ maybe_build_cleanup (decl), NULL_TREE);
+ /* We always set TREE_SIDE_EFFECTS so that expand_expr does not
+ ignore the TARGET_EXPR. If there really turn out to be no
+ side-effects, then the optimizer should be able to get rid of
+ whatever code is generated anyhow. */
+ TREE_SIDE_EFFECTS (t) = 1;
+
+ return t;
+}
+
/* INIT is a CALL_EXPR which needs info about its target.
TYPE is the type that this initialization should appear to have.
@@ -190,72 +257,72 @@ build_cplus_new (type, init)
tree type;
tree init;
{
+ tree fn;
tree slot;
tree rval;
+ /* Make sure that we're not trying to create an instance of an
+ abstract class. */
+ abstract_virtuals_error (NULL_TREE, type);
+
if (TREE_CODE (init) != CALL_EXPR && TREE_CODE (init) != AGGR_INIT_EXPR)
return convert (type, init);
slot = build (VAR_DECL, type);
DECL_ARTIFICIAL (slot) = 1;
+ DECL_CONTEXT (slot) = current_function_decl;
layout_decl (slot, 0);
- rval = build (AGGR_INIT_EXPR, type,
- TREE_OPERAND (init, 0), TREE_OPERAND (init, 1), slot);
- TREE_SIDE_EFFECTS (rval) = 1;
- rval = build (TARGET_EXPR, type, slot, rval, NULL_TREE, NULL_TREE);
+
+ /* We split the CALL_EXPR into its function and its arguments here.
+ Then, in expand_expr, we put them back together. The reason for
+ this is that this expression might be a default argument
+ expression. In that case, we need a new temporary every time the
+ expression is used. That's what break_out_target_exprs does; it
+ replaces every AGGR_INIT_EXPR with a copy that uses a fresh
+ temporary slot. Then, expand_expr builds up a call-expression
+ using the new slot. */
+ fn = TREE_OPERAND (init, 0);
+ rval = build (AGGR_INIT_EXPR, type, fn, TREE_OPERAND (init, 1), slot);
TREE_SIDE_EFFECTS (rval) = 1;
+ AGGR_INIT_VIA_CTOR_P (rval)
+ = (TREE_CODE (fn) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL
+ && DECL_CONSTRUCTOR_P (TREE_OPERAND (fn, 0)));
+ rval = build_target_expr (slot, rval);
return rval;
}
-/* Encapsulate the expression INIT in a TARGET_EXPR. */
+/* Buidl a TARGET_EXPR using INIT to initialize a new temporary of the
+ indicated TYPE. */
tree
-get_target_expr (init)
+build_target_expr_with_type (init, type)
tree init;
+ tree type;
{
tree slot;
tree rval;
- slot = build (VAR_DECL, TREE_TYPE (init));
+ if (TREE_CODE (init) == TARGET_EXPR)
+ return init;
+
+ slot = build (VAR_DECL, type);
DECL_ARTIFICIAL (slot) = 1;
+ DECL_CONTEXT (slot) = current_function_decl;
layout_decl (slot, 0);
- rval = build (TARGET_EXPR, TREE_TYPE (init), slot, init,
- NULL_TREE, NULL_TREE);
- TREE_SIDE_EFFECTS (rval) = 1;
+ rval = build_target_expr (slot, init);
return rval;
}
-/* Recursively search EXP for CALL_EXPRs that need cleanups and replace
- these CALL_EXPRs with tree nodes that will perform the cleanups. */
+/* Like build_target_expr_with_type, but use the type of INIT. */
tree
-break_out_cleanups (exp)
- tree exp;
+get_target_expr (init)
+ tree init;
{
- tree tmp = exp;
-
- if (TREE_CODE (tmp) == CALL_EXPR
- && TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (tmp)))
- return build_cplus_new (TREE_TYPE (tmp), tmp);
-
- while (TREE_CODE (tmp) == NOP_EXPR
- || TREE_CODE (tmp) == CONVERT_EXPR
- || TREE_CODE (tmp) == NON_LVALUE_EXPR)
- {
- if (TREE_CODE (TREE_OPERAND (tmp, 0)) == CALL_EXPR
- && TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (TREE_OPERAND (tmp, 0))))
- {
- TREE_OPERAND (tmp, 0)
- = build_cplus_new (TREE_TYPE (TREE_OPERAND (tmp, 0)),
- TREE_OPERAND (tmp, 0));
- break;
- }
- else
- tmp = TREE_OPERAND (tmp, 0);
- }
- return exp;
+ return build_target_expr_with_type (init, TREE_TYPE (init));
}
/* Recursively perform a preorder search EXP for CALL_EXPRs, making
@@ -317,7 +384,7 @@ break_out_calls (exp)
case 'e': /* an expression */
case 'r': /* a reference */
case 's': /* an expression with side effects */
- for (i = tree_code_length[(int) code] - 1; i >= 0; i--)
+ for (i = TREE_CODE_LENGTH (code) - 1; i >= 0; i--)
{
t1 = break_out_calls (TREE_OPERAND (exp, i));
if (t1 != TREE_OPERAND (exp, i))
@@ -339,7 +406,7 @@ break_out_calls (exp)
changed = 1;
if (changed)
{
- if (tree_code_length[(int) code] == 1)
+ if (TREE_CODE_LENGTH (code) == 1)
return build1 (code, TREE_TYPE (exp), t1);
else
return build (code, TREE_TYPE (exp), t1, t2);
@@ -349,15 +416,6 @@ break_out_calls (exp)
}
-extern struct obstack *current_obstack;
-extern struct obstack permanent_obstack, class_obstack;
-extern struct obstack *saveable_obstack;
-extern struct obstack *expression_obstack;
-
-/* Here is how primitive or already-canonicalized types' hash
- codes are made. MUST BE CONSISTENT WITH tree.c !!! */
-#define TYPE_HASH(TYPE) ((HOST_WIDE_INT) (TYPE) & 0777777)
-
/* Construct, lay out and return the type of methods belonging to class
BASETYPE and whose arguments are described by ARGTYPES and whose values
are described by RETTYPE. If each type exists already, reuse it. */
@@ -375,24 +433,22 @@ build_cplus_method_type (basetype, rettype, argtypes)
TYPE_METHOD_BASETYPE (t) = TYPE_MAIN_VARIANT (basetype);
TREE_TYPE (t) = rettype;
- if (IS_SIGNATURE (basetype))
- ptype = build_signature_pointer_type (basetype);
- else
- ptype = build_pointer_type (basetype);
+ ptype = build_pointer_type (basetype);
/* The actual arglist for this function includes a "hidden" argument
which is "this". Put it into the list of argument types. */
-
argtypes = tree_cons (NULL_TREE, ptype, argtypes);
TYPE_ARG_TYPES (t) = argtypes;
TREE_SIDE_EFFECTS (argtypes) = 1; /* Mark first argtype as "artificial". */
/* If we already have such a type, use the old one and free this one.
Note that it also frees up the above cons cell if found. */
- hashcode = TYPE_HASH (basetype) + TYPE_HASH (rettype) + type_hash_list (argtypes);
+ hashcode = TYPE_HASH (basetype) + TYPE_HASH (rettype) +
+ type_hash_list (argtypes);
+
t = type_hash_canon (hashcode, t);
- if (TYPE_SIZE (t) == 0)
+ if (!COMPLETE_TYPE_P (t))
layout_type (t);
return t;
@@ -403,18 +459,10 @@ build_cplus_array_type_1 (elt_type, index_type)
tree elt_type;
tree index_type;
{
- register struct obstack *ambient_obstack = current_obstack;
- register struct obstack *ambient_saveable_obstack = saveable_obstack;
tree t;
- /* We need a new one. If both ELT_TYPE and INDEX_TYPE are permanent,
- make this permanent too. */
- if (TREE_PERMANENT (elt_type)
- && (index_type == 0 || TREE_PERMANENT (index_type)))
- {
- current_obstack = &permanent_obstack;
- saveable_obstack = &permanent_obstack;
- }
+ if (elt_type == error_mark_node || index_type == error_mark_node)
+ return error_mark_node;
if (processing_template_decl
|| uses_template_parms (elt_type)
@@ -429,10 +477,10 @@ build_cplus_array_type_1 (elt_type, index_type)
/* Push these needs up so that initialization takes place
more easily. */
- TYPE_NEEDS_CONSTRUCTING (t) = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (elt_type));
- TYPE_NEEDS_DESTRUCTOR (t) = TYPE_NEEDS_DESTRUCTOR (TYPE_MAIN_VARIANT (elt_type));
- current_obstack = ambient_obstack;
- saveable_obstack = ambient_saveable_obstack;
+ TYPE_NEEDS_CONSTRUCTING (t)
+ = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (elt_type));
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
+ = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (elt_type));
return t;
}
@@ -442,9 +490,10 @@ build_cplus_array_type (elt_type, index_type)
tree index_type;
{
tree t;
- int type_quals = CP_TYPE_QUALS (elt_type);
+ int type_quals = cp_type_quals (elt_type);
- elt_type = TYPE_MAIN_VARIANT (elt_type);
+ if (type_quals != TYPE_UNQUALIFIED)
+ elt_type = cp_build_qualified_type (elt_type, TYPE_UNQUALIFIED);
t = build_cplus_array_type_1 (elt_type, index_type);
@@ -454,53 +503,116 @@ build_cplus_array_type (elt_type, index_type)
return t;
}
-/* Make a variant type in the proper way for C/C++, propagating qualifiers
- down to the element type of an array. */
+/* Make a variant of TYPE, qualified with the TYPE_QUALS. Handles
+ arrays correctly. In particular, if TYPE is an array of T's, and
+ TYPE_QUALS is non-empty, returns an array of qualified T's. If
+ at attempt is made to qualify a type illegally, and COMPLAIN is
+ non-zero, an error is issued. If COMPLAIN is zero, error_mark_node
+ is returned. */
tree
-cp_build_qualified_type (type, type_quals)
+cp_build_qualified_type_real (type, type_quals, complain)
tree type;
int type_quals;
+ int complain;
{
+ tree result;
+
if (type == error_mark_node)
return type;
-
+
+ if (type_quals == cp_type_quals (type))
+ return type;
+
/* A restrict-qualified pointer type must be a pointer (or reference)
to object or incomplete type. */
if ((type_quals & TYPE_QUAL_RESTRICT)
+ && TREE_CODE (type) != TEMPLATE_TYPE_PARM
&& (!POINTER_TYPE_P (type)
|| TYPE_PTRMEM_P (type)
|| TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE))
{
- cp_error ("`%T' cannot be `restrict'-qualified", type);
+ if (complain)
+ error ("`%T' cannot be `restrict'-qualified", type);
+ else
+ return error_mark_node;
+
type_quals &= ~TYPE_QUAL_RESTRICT;
}
- if (TREE_CODE (type) == ARRAY_TYPE)
+ if (type_quals != TYPE_UNQUALIFIED
+ && TREE_CODE (type) == FUNCTION_TYPE)
{
- tree real_main_variant = TYPE_MAIN_VARIANT (type);
+ if (complain)
+ error ("`%T' cannot be `const'-, `volatile'-, or `restrict'-qualified", type);
+ else
+ return error_mark_node;
+ type_quals = TYPE_UNQUALIFIED;
+ }
+ else if (TREE_CODE (type) == ARRAY_TYPE)
+ {
+ /* In C++, the qualification really applies to the array element
+ type. Obtain the appropriately qualified element type. */
+ tree t;
+ tree element_type
+ = cp_build_qualified_type_real (TREE_TYPE (type),
+ type_quals,
+ complain);
- push_obstacks (TYPE_OBSTACK (real_main_variant),
- TYPE_OBSTACK (real_main_variant));
- type = build_cplus_array_type_1 (cp_build_qualified_type
- (TREE_TYPE (type), type_quals),
- TYPE_DOMAIN (type));
+ if (element_type == error_mark_node)
+ return error_mark_node;
- /* TYPE must be on same obstack as REAL_MAIN_VARIANT. If not,
- make a copy. (TYPE might have come from the hash table and
- REAL_MAIN_VARIANT might be in some function's obstack.) */
+ /* See if we already have an identically qualified type. */
+ t = get_qualified_type (type, type_quals);
- if (TYPE_OBSTACK (type) != TYPE_OBSTACK (real_main_variant))
+ /* If we didn't already have it, create it now. */
+ if (!t)
{
- type = copy_node (type);
- TYPE_POINTER_TO (type) = TYPE_REFERENCE_TO (type) = 0;
+ /* Make a new array type, just like the old one, but with the
+ appropriately qualified element type. */
+ t = build_type_copy (type);
+ TREE_TYPE (t) = element_type;
}
- TYPE_MAIN_VARIANT (type) = real_main_variant;
- pop_obstacks ();
- return type;
+ /* Even if we already had this variant, we update
+ TYPE_NEEDS_CONSTRUCTING and TYPE_HAS_NONTRIVIAL_DESTRUCTOR in case
+ they changed since the variant was originally created.
+
+ This seems hokey; if there is some way to use a previous
+ variant *without* coming through here,
+ TYPE_NEEDS_CONSTRUCTING will never be updated. */
+ TYPE_NEEDS_CONSTRUCTING (t)
+ = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (element_type));
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
+ = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (element_type));
+ return t;
+ }
+ else if (TYPE_PTRMEMFUNC_P (type))
+ {
+ /* For a pointer-to-member type, we can't just return a
+ cv-qualified version of the RECORD_TYPE. If we do, we
+ haven't change the field that contains the actual pointer to
+ a method, and so TYPE_PTRMEMFUNC_FN_TYPE will be wrong. */
+ tree t;
+
+ t = TYPE_PTRMEMFUNC_FN_TYPE (type);
+ t = cp_build_qualified_type_real (t, type_quals, complain);
+ return build_ptrmemfunc_type (t);
}
- return build_qualified_type (type, type_quals);
+
+ /* Retrieve (or create) the appropriately qualified variant. */
+ result = build_qualified_type (type, type_quals);
+
+ /* If this was a pointer-to-method type, and we just made a copy,
+ then we need to clear the cached associated
+ pointer-to-member-function type; it is not valid for the new
+ type. */
+ if (result != type
+ && TREE_CODE (type) == POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE)
+ TYPE_SET_PTRMEMFUNC_TYPE (result, NULL_TREE);
+
+ return result;
}
/* Returns the canonical version of TYPE. In other words, if TYPE is
@@ -512,66 +624,9 @@ tree
canonical_type_variant (t)
tree t;
{
- return cp_build_qualified_type (TYPE_MAIN_VARIANT (t), CP_TYPE_QUALS (t));
+ return cp_build_qualified_type (TYPE_MAIN_VARIANT (t), cp_type_quals (t));
}
-/* Add OFFSET to all base types of T.
-
- OFFSET, which is a type offset, is number of bytes.
-
- Note that we don't have to worry about having two paths to the
- same base type, since this type owns its association list. */
-
-static void
-propagate_binfo_offsets (binfo, offset)
- tree binfo;
- tree offset;
-{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- for (i = 0; i < n_baselinks; /* note increment is done in the loop. */)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
-
- if (TREE_VIA_VIRTUAL (base_binfo))
- i += 1;
- else
- {
- int j;
- tree delta = NULL_TREE;
-
- for (j = i+1; j < n_baselinks; j++)
- if (! TREE_VIA_VIRTUAL (TREE_VEC_ELT (binfos, j)))
- {
- /* The next basetype offset must take into account the space
- between the classes, not just the size of each class. */
- delta = size_binop (MINUS_EXPR,
- BINFO_OFFSET (TREE_VEC_ELT (binfos, j)),
- BINFO_OFFSET (base_binfo));
- break;
- }
-
-#if 0
- if (BINFO_OFFSET_ZEROP (base_binfo))
- BINFO_OFFSET (base_binfo) = offset;
- else
- BINFO_OFFSET (base_binfo)
- = size_binop (PLUS_EXPR, BINFO_OFFSET (base_binfo), offset);
-#else
- BINFO_OFFSET (base_binfo) = offset;
-#endif
-
- propagate_binfo_offsets (base_binfo, offset);
-
- /* Go to our next class that counts for offset propagation. */
- i = j;
- if (i < n_baselinks)
- offset = size_binop (PLUS_EXPR, offset, delta);
- }
- }
-}
-
/* Makes new binfos for the indirect bases under BINFO, and updates
BINFO_OFFSET for them and their bases. */
@@ -600,369 +655,61 @@ unshare_base_binfos (binfo)
TREE_VIA_PROTECTED (new_binfo) = TREE_VIA_PROTECTED (base_binfo);
TREE_VIA_VIRTUAL (new_binfo) = TREE_VIA_VIRTUAL (base_binfo);
BINFO_INHERITANCE_CHAIN (new_binfo) = binfo;
+ BINFO_PRIMARY_BASE_OF (new_binfo) = NULL_TREE;
unshare_base_binfos (new_binfo);
}
}
-/* Finish the work of layout_record, now taking virtual bases into account.
- Also compute the actual offsets that our base classes will have.
- This must be performed after the fields are laid out, since virtual
- baseclasses must lay down at the end of the record.
-
- Returns the maximum number of virtual functions any of the
- baseclasses provide. */
-
-int
-layout_basetypes (rec, max)
- tree rec;
- int max;
-{
- tree binfos = TYPE_BINFO_BASETYPES (rec);
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- tree vbase_types;
-
- unsigned int record_align = MAX (BITS_PER_UNIT, TYPE_ALIGN (rec));
- unsigned int desired_align;
-
- /* Record size so far is CONST_SIZE bits, where CONST_SIZE is an integer. */
- register unsigned int const_size = 0;
- unsigned int nonvirtual_const_size;
-
-#ifdef STRUCTURE_SIZE_BOUNDARY
- /* Packed structures don't need to have minimum size. */
- if (! TYPE_PACKED (rec))
- record_align = MAX (record_align, STRUCTURE_SIZE_BOUNDARY);
-#endif
-
- /* Get all the virtual base types that this type uses. The
- TREE_VALUE slot holds the virtual baseclass type. Note that
- get_vbase_types makes copies of the virtual base BINFOs, so that
- the vbase_types are unshared. */
- vbase_types = CLASSTYPE_VBASECLASSES (rec);
-
- my_friendly_assert (TREE_CODE (TYPE_SIZE (rec)) == INTEGER_CST, 19970302);
- const_size = TREE_INT_CST_LOW (TYPE_SIZE (rec));
-
- nonvirtual_const_size = const_size;
-
- while (vbase_types)
- {
- tree basetype = BINFO_TYPE (vbase_types);
- tree offset;
-
- desired_align = TYPE_ALIGN (basetype);
- record_align = MAX (record_align, desired_align);
-
- if (const_size == 0)
- offset = integer_zero_node;
- else
- {
- /* Give each virtual base type the alignment it wants. */
- const_size = CEIL (const_size, desired_align) * desired_align;
- offset = size_int (CEIL (const_size, BITS_PER_UNIT));
- }
-
- if (CLASSTYPE_VSIZE (basetype) > max)
- max = CLASSTYPE_VSIZE (basetype);
- BINFO_OFFSET (vbase_types) = offset;
-
- /* Every virtual baseclass takes a least a UNIT, so that we can
- take it's address and get something different for each base. */
- const_size += MAX (BITS_PER_UNIT,
- TREE_INT_CST_LOW (CLASSTYPE_SIZE (basetype)));
-
- vbase_types = TREE_CHAIN (vbase_types);
- }
-
- if (const_size)
- {
- /* Because a virtual base might take a single byte above,
- we have to re-adjust the total size to make sure it is
- a multiple of the alignment. */
- /* Give the whole object the alignment it wants. */
- const_size = CEIL (const_size, record_align) * record_align;
- }
-
- /* Set the alignment in the complete type. We don't set CLASSTYPE_ALIGN
- here, as that is for this class, without any virtual base classes. */
- TYPE_ALIGN (rec) = record_align;
- if (const_size != nonvirtual_const_size)
- {
- TYPE_SIZE (rec) = size_int (const_size);
- TYPE_SIZE_UNIT (rec) = size_binop (FLOOR_DIV_EXPR, TYPE_SIZE (rec),
- size_int (BITS_PER_UNIT));
- }
-
- /* Now propagate offset information throughout the lattice. */
- for (i = 0; i < n_baseclasses; i++)
- {
- register tree base_binfo = TREE_VEC_ELT (binfos, i);
- register tree basetype = BINFO_TYPE (base_binfo);
- tree field = TYPE_FIELDS (rec);
-
- if (TREE_VIA_VIRTUAL (base_binfo))
- continue;
-
- my_friendly_assert (TREE_TYPE (field) == basetype, 23897);
-
- if (get_base_distance (basetype, rec, 0, (tree*)0) == -2)
- cp_warning ("direct base `%T' inaccessible in `%T' due to ambiguity",
- basetype, rec);
-
- BINFO_OFFSET (base_binfo)
- = size_int (CEIL (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field)),
- BITS_PER_UNIT));
- propagate_binfo_offsets (base_binfo, BINFO_OFFSET (base_binfo));
- TYPE_FIELDS (rec) = TREE_CHAIN (field);
- }
-
- for (vbase_types = CLASSTYPE_VBASECLASSES (rec); vbase_types;
- vbase_types = TREE_CHAIN (vbase_types))
- {
- BINFO_INHERITANCE_CHAIN (vbase_types) = TYPE_BINFO (rec);
- unshare_base_binfos (vbase_types);
- propagate_binfo_offsets (vbase_types, BINFO_OFFSET (vbase_types));
-
- if (extra_warnings)
- {
- tree basetype = BINFO_TYPE (vbase_types);
- if (get_base_distance (basetype, rec, 0, (tree*)0) == -2)
- cp_warning ("virtual base `%T' inaccessible in `%T' due to ambiguity",
- basetype, rec);
- }
- }
-
- return max;
-}
-
-/* If the empty base field in DECL overlaps with a base of the same type in
- NEWDECL, which is either another base field or the first data field of
- the class, pad the base just before NEWDECL and return 1. Otherwise,
- return 0. */
-
-static int
-avoid_overlap (decl, newdecl)
- tree decl, newdecl;
-{
- tree field;
-
- if (newdecl == NULL_TREE
- || ! types_overlap_p (TREE_TYPE (decl), TREE_TYPE (newdecl)))
- return 0;
-
- for (field = decl; TREE_CHAIN (field) && TREE_CHAIN (field) != newdecl;
- field = TREE_CHAIN (field))
- ;
-
- DECL_SIZE (field) = integer_one_node;
-
- return 1;
-}
-
-/* Returns a list of fields to stand in for the base class subobjects
- of REC. These fields are later removed by layout_basetypes. */
-
-tree
-build_base_fields (rec)
- tree rec;
-{
- /* Chain to hold all the new FIELD_DECLs which stand in for base class
- subobjects. */
- tree base_decls = NULL_TREE;
- tree binfos = TYPE_BINFO_BASETYPES (rec);
- int n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- tree decl, nextdecl;
- int i, saw_empty = 0;
- unsigned int base_align = 0;
-
- for (i = 0; i < n_baseclasses; ++i)
- {
- register tree base_binfo = TREE_VEC_ELT (binfos, i);
- register tree basetype = BINFO_TYPE (base_binfo);
-
- if (TYPE_SIZE (basetype) == 0)
- /* This error is now reported in xref_tag, thus giving better
- location information. */
- continue;
-
- if (TREE_VIA_VIRTUAL (base_binfo))
- continue;
-
- decl = build_lang_field_decl (FIELD_DECL, NULL_TREE, basetype);
- DECL_ARTIFICIAL (decl) = 1;
- DECL_FIELD_CONTEXT (decl) = DECL_CLASS_CONTEXT (decl) = rec;
- DECL_SIZE (decl) = CLASSTYPE_SIZE (basetype);
- DECL_ALIGN (decl) = CLASSTYPE_ALIGN (basetype);
- TREE_CHAIN (decl) = base_decls;
- base_decls = decl;
-
- if (! flag_new_abi)
- {
- /* Brain damage for backwards compatibility. For no good reason,
- the old layout_basetypes made every base at least as large as
- the alignment for the bases up to that point, gratuitously
- wasting space. So we do the same thing here. */
- base_align = MAX (base_align, DECL_ALIGN (decl));
- DECL_SIZE (decl)
- = size_int (MAX (TREE_INT_CST_LOW (DECL_SIZE (decl)),
- (int) base_align));
- }
- else if (DECL_SIZE (decl) == integer_zero_node)
- saw_empty = 1;
- }
-
- /* Reverse the list of fields so we allocate the bases in the proper
- order. */
- base_decls = nreverse (base_decls);
-
- /* In the presence of empty base classes, we run the risk of allocating
- two objects of the same class on top of one another. Avoid that. */
- if (flag_new_abi && saw_empty)
- for (decl = base_decls; decl; decl = TREE_CHAIN (decl))
- {
- if (DECL_SIZE (decl) == integer_zero_node)
- {
- /* First step through the following bases until we find
- an overlap or a non-empty base. */
- for (nextdecl = TREE_CHAIN (decl); nextdecl;
- nextdecl = TREE_CHAIN (nextdecl))
- {
- if (avoid_overlap (decl, nextdecl)
- || DECL_SIZE (nextdecl) != integer_zero_node)
- goto nextbase;
- }
-
- /* If we're still looking, also check against the first
- field. */
- for (nextdecl = TYPE_FIELDS (rec);
- nextdecl && TREE_CODE (nextdecl) != FIELD_DECL;
- nextdecl = TREE_CHAIN (nextdecl))
- /* keep looking */;
- avoid_overlap (decl, nextdecl);
- }
- nextbase:;
- }
-
- return base_decls;
-}
-
-/* Returns list of virtual base class pointers in a FIELD_DECL chain. */
-
-tree
-build_vbase_pointer_fields (rec)
- tree rec;
-{
- /* Chain to hold all the new FIELD_DECLs which point at virtual
- base classes. */
- tree vbase_decls = NULL_TREE;
- tree binfos = TYPE_BINFO_BASETYPES (rec);
- int n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- tree decl;
- int i;
-
- /* Handle basetypes almost like fields, but record their
- offsets differently. */
-
- for (i = 0; i < n_baseclasses; i++)
- {
- register tree base_binfo = TREE_VEC_ELT (binfos, i);
- register tree basetype = BINFO_TYPE (base_binfo);
-
- if (TYPE_SIZE (basetype) == 0)
- /* This error is now reported in xref_tag, thus giving better
- location information. */
- continue;
-
- /* All basetypes are recorded in the association list of the
- derived type. */
-
- if (TREE_VIA_VIRTUAL (base_binfo))
- {
- int j;
- const char *name;
-
- /* The offset for a virtual base class is only used in computing
- virtual function tables and for initializing virtual base
- pointers. It is built once `get_vbase_types' is called. */
-
- /* If this basetype can come from another vbase pointer
- without an additional indirection, we will share
- that pointer. If an indirection is involved, we
- make our own pointer. */
- for (j = 0; j < n_baseclasses; j++)
- {
- tree other_base_binfo = TREE_VEC_ELT (binfos, j);
- if (! TREE_VIA_VIRTUAL (other_base_binfo)
- && binfo_member (basetype,
- CLASSTYPE_VBASECLASSES (BINFO_TYPE
- (other_base_binfo))
- ))
- goto got_it;
- }
- FORMAT_VBASE_NAME (name, basetype);
- decl = build_lang_field_decl (FIELD_DECL, get_identifier (name),
- build_pointer_type (basetype));
- /* If you change any of the below, take a look at all the
- other VFIELD_BASEs and VTABLE_BASEs in the code, and change
- them too. */
- DECL_ASSEMBLER_NAME (decl) = get_identifier (VTABLE_BASE);
- DECL_VIRTUAL_P (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- DECL_FIELD_CONTEXT (decl) = rec;
- DECL_CLASS_CONTEXT (decl) = rec;
- DECL_FCONTEXT (decl) = basetype;
- DECL_SAVED_INSNS (decl) = NULL_RTX;
- DECL_FIELD_SIZE (decl) = 0;
- DECL_ALIGN (decl) = TYPE_ALIGN (ptr_type_node);
- TREE_CHAIN (decl) = vbase_decls;
- BINFO_VPTR_FIELD (base_binfo) = decl;
- vbase_decls = decl;
-
- got_it:
- /* The space this decl occupies has already been accounted for. */
- ;
- }
- }
-
- return vbase_decls;
-}
/* Hashing of lists so that we don't make duplicates.
The entry point is `list_hash_canon'. */
-/* Each hash table slot is a bucket containing a chain
- of these structures. */
-
-struct list_hash
-{
- struct list_hash *next; /* Next structure in the bucket. */
- int hashcode; /* Hash code of this list. */
- tree list; /* The list recorded here. */
-};
-
/* Now here is the hash table. When recording a list, it is added
to the slot whose index is the hash code mod the table size.
Note that the hash table is used for several kinds of lists.
While all these live in the same table, they are completely independent,
and the hash code is computed differently for each of these. */
-#define TYPE_HASH_SIZE 59
-static struct list_hash *list_hash_table[TYPE_HASH_SIZE];
+static htab_t list_hash_table;
+
+struct list_proxy
+{
+ tree purpose;
+ tree value;
+ tree chain;
+};
+
+/* Compare ENTRY (an entry in the hash table) with DATA (a list_proxy
+ for a node we are thinking about adding). */
+
+static int
+list_hash_eq (entry, data)
+ const void *entry;
+ const void *data;
+{
+ tree t = (tree) entry;
+ struct list_proxy *proxy = (struct list_proxy *) data;
+
+ return (TREE_VALUE (t) == proxy->value
+ && TREE_PURPOSE (t) == proxy->purpose
+ && TREE_CHAIN (t) == proxy->chain);
+}
/* Compute a hash code for a list (chain of TREE_LIST nodes
with goodies in the TREE_PURPOSE, TREE_VALUE, and bits of the
TREE_COMMON slots), by adding the hash codes of the individual entries. */
-static int
-list_hash (purpose, value, chain)
- tree purpose, value, chain;
+static hashval_t
+list_hash_pieces (purpose, value, chain)
+ tree purpose;
+ tree value;
+ tree chain;
{
- register int hashcode = 0;
-
+ hashval_t hashcode = 0;
+
if (chain)
hashcode += TYPE_HASH (chain);
-
+
if (value)
hashcode += TYPE_HASH (value);
else
@@ -974,76 +721,44 @@ list_hash (purpose, value, chain)
return hashcode;
}
-/* Look in the type hash table for a type isomorphic to TYPE.
- If one is found, return it. Otherwise return 0. */
+/* Hash an already existing TREE_LIST. */
-static tree
-list_hash_lookup (hashcode, purpose, value, chain)
- int hashcode;
- tree purpose, value, chain;
+static hashval_t
+list_hash (p)
+ const void *p;
{
- register struct list_hash *h;
-
- for (h = list_hash_table[hashcode % TYPE_HASH_SIZE]; h; h = h->next)
- if (h->hashcode == hashcode
- && TREE_PURPOSE (h->list) == purpose
- && TREE_VALUE (h->list) == value
- && TREE_CHAIN (h->list) == chain)
- return h->list;
- return 0;
-}
-
-/* Add an entry to the list-hash-table
- for a list TYPE whose hash code is HASHCODE. */
-
-static void
-list_hash_add (hashcode, list)
- int hashcode;
- tree list;
-{
- register struct list_hash *h;
-
- h = (struct list_hash *) obstack_alloc (&class_obstack, sizeof (struct list_hash));
- h->hashcode = hashcode;
- h->list = list;
- h->next = list_hash_table[hashcode % TYPE_HASH_SIZE];
- list_hash_table[hashcode % TYPE_HASH_SIZE] = h;
+ tree t = (tree) p;
+ return list_hash_pieces (TREE_PURPOSE (t),
+ TREE_VALUE (t),
+ TREE_CHAIN (t));
}
/* Given list components PURPOSE, VALUE, AND CHAIN, return the canonical
object for an identical list if one already exists. Otherwise, build a
new one, and record it as the canonical object. */
-/* Set to 1 to debug without canonicalization. Never set by program. */
-
-static int debug_no_list_hash = 0;
-
tree
hash_tree_cons (purpose, value, chain)
tree purpose, value, chain;
{
- struct obstack *ambient_obstack = current_obstack;
- tree t;
int hashcode = 0;
-
- if (! debug_no_list_hash)
- {
- hashcode = list_hash (purpose, value, chain);
- t = list_hash_lookup (hashcode, purpose, value, chain);
- if (t)
- return t;
- }
-
- current_obstack = &class_obstack;
-
- t = tree_cons (purpose, value, chain);
-
- /* If this is a new list, record it for later reuse. */
- if (! debug_no_list_hash)
- list_hash_add (hashcode, t);
-
- current_obstack = ambient_obstack;
- return t;
+ PTR* slot;
+ struct list_proxy proxy;
+
+ /* Hash the list node. */
+ hashcode = list_hash_pieces (purpose, value, chain);
+ /* Create a proxy for the TREE_LIST we would like to create. We
+ don't actually create it so as to avoid creating garbage. */
+ proxy.purpose = purpose;
+ proxy.value = value;
+ proxy.chain = chain;
+ /* See if it is already in the table. */
+ slot = htab_find_slot_with_hash (list_hash_table, &proxy, hashcode,
+ INSERT);
+ /* If not, create a new node. */
+ if (!*slot)
+ *slot = (PTR) tree_cons (purpose, value, chain);
+ return *slot;
}
/* Constructor for hashed lists. */
@@ -1091,7 +806,7 @@ make_binfo (offset, binfo, vtable, virtuals)
tree offset, binfo;
tree vtable, virtuals;
{
- tree new_binfo = make_tree_vec (7);
+ tree new_binfo = make_tree_vec (11);
tree type;
if (TREE_CODE (binfo) == TREE_VEC)
@@ -1106,75 +821,59 @@ make_binfo (offset, binfo, vtable, virtuals)
BINFO_OFFSET (new_binfo) = offset;
BINFO_VTABLE (new_binfo) = vtable;
BINFO_VIRTUALS (new_binfo) = virtuals;
- BINFO_VPTR_FIELD (new_binfo) = NULL_TREE;
if (binfo && BINFO_BASETYPES (binfo) != NULL_TREE)
BINFO_BASETYPES (new_binfo) = copy_node (BINFO_BASETYPES (binfo));
return new_binfo;
}
-/* Return the binfo value for ELEM in TYPE. */
+/* Return a TREE_LIST whose TREE_VALUE nodes along the
+ BINFO_INHERITANCE_CHAIN for BINFO, but in the opposite order. In
+ other words, while the BINFO_INHERITANCE_CHAIN goes from base
+ classes to derived classes, the reversed path goes from derived
+ classes to base classes. */
tree
-binfo_value (elem, type)
- tree elem;
- tree type;
+reverse_path (binfo)
+ tree binfo;
{
- if (get_base_distance (elem, type, 0, (tree *)0) == -2)
- compiler_error ("base class `%s' ambiguous in binfo_value",
- TYPE_NAME_STRING (elem));
- if (elem == type)
- return TYPE_BINFO (type);
- if (TREE_CODE (elem) == RECORD_TYPE && TYPE_BINFO (elem) == type)
- return type;
- return get_binfo (elem, type, 0);
-}
+ tree reversed_path;
-/* Return a reversed copy of the BINFO-chain given by PATH. (If the
- BINFO_INHERITANCE_CHAIN points from base classes to derived
- classes, it will instead point from derived classes to base
- classes.) Returns the first node in the reversed chain. */
-
-tree
-reverse_path (path)
- tree path;
-{
- register tree prev = NULL_TREE, cur;
- push_expression_obstack ();
- for (cur = path; cur; cur = BINFO_INHERITANCE_CHAIN (cur))
+ reversed_path = NULL_TREE;
+ while (binfo)
{
- tree r = copy_node (cur);
- BINFO_INHERITANCE_CHAIN (r) = prev;
- prev = r;
+ reversed_path = tree_cons (NULL_TREE, binfo, reversed_path);
+ binfo = BINFO_INHERITANCE_CHAIN (binfo);
}
- pop_obstacks ();
- return prev;
+
+ return reversed_path;
}
void
debug_binfo (elem)
tree elem;
{
- unsigned HOST_WIDE_INT n;
+ HOST_WIDE_INT n;
tree virtuals;
- fprintf (stderr, "type \"%s\"; offset = %ld\n",
- TYPE_NAME_STRING (BINFO_TYPE (elem)),
- (long) TREE_INT_CST_LOW (BINFO_OFFSET (elem)));
- fprintf (stderr, "vtable type:\n");
+ fprintf (stderr, "type \"%s\", offset = ",
+ TYPE_NAME_STRING (BINFO_TYPE (elem)));
+ fprintf (stderr, HOST_WIDE_INT_PRINT_DEC,
+ TREE_INT_CST_LOW (BINFO_OFFSET (elem)));
+ fprintf (stderr, "\nvtable type:\n");
debug_tree (BINFO_TYPE (elem));
if (BINFO_VTABLE (elem))
- fprintf (stderr, "vtable decl \"%s\"\n", IDENTIFIER_POINTER (DECL_NAME (BINFO_VTABLE (elem))));
+ fprintf (stderr, "vtable decl \"%s\"\n",
+ IDENTIFIER_POINTER (DECL_NAME (get_vtbl_decl_for_binfo (elem))));
else
fprintf (stderr, "no vtable decl yet\n");
fprintf (stderr, "virtuals:\n");
virtuals = BINFO_VIRTUALS (elem);
-
- n = skip_rtti_stuff (&virtuals, BINFO_TYPE (elem));
+ n = 0;
while (virtuals)
{
- tree fndecl = TREE_OPERAND (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals)), 0);
+ tree fndecl = TREE_VALUE (virtuals);
fprintf (stderr, "%s [%ld =? %ld]\n",
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl)),
(long) n, (long) TREE_INT_CST_LOW (DECL_VINDEX (fndecl)));
@@ -1183,25 +882,6 @@ debug_binfo (elem)
}
}
-/* Initialize an CPLUS_BINDING node that does not live on an obstack. */
-
-tree
-binding_init (node)
- struct tree_binding* node;
-{
- static struct tree_binding* source;
- if (!source)
- {
- extern struct obstack permanent_obstack;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- source = (struct tree_binding*)make_node (CPLUS_BINDING);
- pop_obstacks ();
- }
- *node = *source;
- TREE_PERMANENT ((tree)node) = 0;
- return (tree)node;
-}
-
int
count_functions (t)
tree t;
@@ -1216,7 +896,7 @@ count_functions (t)
return i;
}
- my_friendly_abort (359);
+ abort ();
return 0;
}
@@ -1286,21 +966,6 @@ ovl_cons (decl, chain)
return result;
}
-/* Same as ovl_cons, but on the scratch_obstack. */
-
-tree
-scratch_ovl_cons (value, chain)
- tree value, chain;
-{
- register tree node;
- register struct obstack *ambient_obstack = current_obstack;
- extern struct obstack *expression_obstack;
- current_obstack = expression_obstack;
- node = ovl_cons (value, chain);
- current_obstack = ambient_obstack;
- return node;
-}
-
/* Build a new overloaded function. If this is the first one,
just return it; otherwise, ovl_cons the _DECLs */
@@ -1316,49 +981,43 @@ build_overload (decl, chain)
return ovl_cons (decl, chain);
}
-/* Returns true iff functions are equivalent. Equivalent functions are
- not identical only if one is a function-local extern function.
- This assumes that function-locals don't have TREE_PERMANENT. */
-
-static int
-equal_functions (fn1, fn2)
- tree fn1;
- tree fn2;
+int
+is_aggr_type_2 (t1, t2)
+ tree t1, t2;
{
- if (!TREE_PERMANENT (fn1) || !TREE_PERMANENT (fn2))
- return decls_match (fn1, fn2);
- return fn1 == fn2;
+ if (TREE_CODE (t1) != TREE_CODE (t2))
+ return 0;
+ return IS_AGGR_TYPE (t1) && IS_AGGR_TYPE (t2);
}
-/* True if fn is in ovl. */
+/* Returns non-zero if CODE is the code for a statement. */
int
-ovl_member (fn, ovl)
- tree fn;
- tree ovl;
+cp_statement_code_p (code)
+ enum tree_code code;
{
- if (ovl == NULL_TREE)
- return 0;
- if (TREE_CODE (ovl) != OVERLOAD)
- return equal_functions (ovl, fn);
- for (; ovl; ovl = OVL_CHAIN (ovl))
- if (equal_functions (OVL_FUNCTION (ovl), fn))
+ switch (code)
+ {
+ case SUBOBJECT:
+ case CLEANUP_STMT:
+ case CTOR_STMT:
+ case CTOR_INITIALIZER:
+ case RETURN_INIT:
+ case TRY_BLOCK:
+ case HANDLER:
+ case EH_SPEC_BLOCK:
+ case USING_STMT:
+ case TAG_DEFN:
return 1;
- return 0;
-}
-int
-is_aggr_type_2 (t1, t2)
- tree t1, t2;
-{
- if (TREE_CODE (t1) != TREE_CODE (t2))
- return 0;
- return IS_AGGR_TYPE (t1) && IS_AGGR_TYPE (t2);
+ default:
+ return 0;
+ }
}
#define PRINT_RING_SIZE 4
-char *
+const char *
lang_printable_name (decl, v)
tree decl;
int v;
@@ -1390,7 +1049,7 @@ lang_printable_name (decl, v)
if (ring_counter == PRINT_RING_SIZE)
ring_counter = 0;
if (decl_ring[ring_counter] == current_function_decl)
- my_friendly_abort (106);
+ abort ();
}
if (print_ring[ring_counter])
@@ -1413,631 +1072,169 @@ build_exception_variant (type, raises)
int type_quals = TYPE_QUALS (type);
for (; v; v = TYPE_NEXT_VARIANT (v))
- {
- tree t;
- tree u;
-
- if (TYPE_QUALS (v) != type_quals)
- continue;
-
- for (t = TYPE_RAISES_EXCEPTIONS (v), u = raises;
- t != NULL_TREE && u != NULL_TREE;
- t = TREE_CHAIN (t), u = TREE_CHAIN (u))
- if (((TREE_VALUE (t) != NULL_TREE)
- != (TREE_VALUE (u) != NULL_TREE))
- || !same_type_p (TREE_VALUE (t), TREE_VALUE (u)))
- break;
-
- if (!t && !u)
- /* There's a memory leak here; RAISES is not freed. */
- return v;
- }
+ if (TYPE_QUALS (v) == type_quals
+ && comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (v), 1))
+ return v;
/* Need to build a new variant. */
v = build_type_copy (type);
-
- if (raises && ! TREE_PERMANENT (raises))
- raises = copy_to_permanent (raises);
-
TYPE_RAISES_EXCEPTIONS (v) = raises;
return v;
}
-/* Given a TEMPLATE_TEMPLATE_PARM node T, create a new one together with its
- lang_specific field and its corresponding TEMPLATE_DECL node */
+/* Given a TEMPLATE_TEMPLATE_PARM node T, create a new
+ BOUND_TEMPLATE_TEMPLATE_PARM bound with NEWARGS as its template
+ arguments. */
tree
-copy_template_template_parm (t)
+bind_template_template_parm (t, newargs)
tree t;
+ tree newargs;
{
- tree template = TYPE_NAME (t);
+ tree decl = TYPE_NAME (t);
tree t2;
- /* Make sure these end up on the permanent_obstack. */
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- t2 = make_lang_type (TEMPLATE_TEMPLATE_PARM);
- template = copy_node (template);
- copy_lang_decl (template);
+ t2 = make_aggr_type (BOUND_TEMPLATE_TEMPLATE_PARM);
+ decl = build_decl (TYPE_DECL, DECL_NAME (decl), NULL_TREE);
- pop_obstacks ();
+ /* These nodes have to be created to reflect new TYPE_DECL and template
+ arguments. */
+ TEMPLATE_TYPE_PARM_INDEX (t2) = copy_node (TEMPLATE_TYPE_PARM_INDEX (t));
+ TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (t2)) = decl;
+ TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t2)
+ = tree_cons (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t),
+ newargs, NULL_TREE);
- TREE_TYPE (template) = t2;
- TYPE_NAME (t2) = template;
- TYPE_STUB_DECL (t2) = template;
+ TREE_TYPE (decl) = t2;
+ TYPE_NAME (t2) = decl;
+ TYPE_STUB_DECL (t2) = decl;
+ TYPE_SIZE (t2) = 0;
- /* No need to copy these */
- TYPE_FIELDS (t2) = TYPE_FIELDS (t);
- TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t2)
- = TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t);
return t2;
}
-/* Walk through the tree structure T, applying func. If func ever returns
- non-null, return that value. */
+/* Called from count_trees via walk_tree. */
-tree
-search_tree (t, func)
- tree t;
- tree (*func) PROTO((tree));
+static tree
+count_trees_r (tp, walk_subtrees, data)
+ tree *tp ATTRIBUTE_UNUSED;
+ int *walk_subtrees ATTRIBUTE_UNUSED;
+ void *data;
{
-#define TRY(ARG) if (tmp=search_tree (ARG, func), tmp != NULL_TREE) return tmp
-
- tree tmp;
-
- if (t == NULL_TREE)
- return t;
-
- if (tmp = func (t), tmp != NULL_TREE)
- return tmp;
-
- switch (TREE_CODE (t))
- {
- case ERROR_MARK:
- break;
-
- case IDENTIFIER_NODE:
- break;
-
- case VAR_DECL:
- case FUNCTION_DECL:
- case CONST_DECL:
- case TEMPLATE_DECL:
- case NAMESPACE_DECL:
- break;
-
- case TYPE_DECL:
- TRY (TREE_TYPE (t));
- break;
-
- case PARM_DECL:
- TRY (TREE_TYPE (t));
- TRY (TREE_CHAIN (t));
- break;
-
- case TREE_LIST:
- TRY (TREE_PURPOSE (t));
- TRY (TREE_VALUE (t));
- TRY (TREE_CHAIN (t));
- break;
-
- case OVERLOAD:
- TRY (OVL_FUNCTION (t));
- TRY (OVL_CHAIN (t));
- break;
-
- case TREE_VEC:
- {
- int len = TREE_VEC_LENGTH (t);
-
- t = copy_node (t);
- while (len--)
- TRY (TREE_VEC_ELT (t, len));
- }
- break;
-
- case INTEGER_CST:
- case REAL_CST:
- case STRING_CST:
- case DEFAULT_ARG:
- break;
-
- case PTRMEM_CST:
- TRY (TREE_TYPE (t));
- break;
-
- case COND_EXPR:
- case TARGET_EXPR:
- case AGGR_INIT_EXPR:
- case NEW_EXPR:
- TRY (TREE_OPERAND (t, 0));
- TRY (TREE_OPERAND (t, 1));
- TRY (TREE_OPERAND (t, 2));
- break;
-
- case MODIFY_EXPR:
- case PLUS_EXPR:
- case MINUS_EXPR:
- case MULT_EXPR:
- case TRUNC_DIV_EXPR:
- case TRUNC_MOD_EXPR:
- case MIN_EXPR:
- case MAX_EXPR:
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case BIT_IOR_EXPR:
- case BIT_XOR_EXPR:
- case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case LT_EXPR:
- case LE_EXPR:
- case GT_EXPR:
- case GE_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- case CEIL_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case CEIL_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- case ROUND_MOD_EXPR:
- case COMPOUND_EXPR:
- case PREDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case ARRAY_REF:
- case SCOPE_REF:
- case TRY_CATCH_EXPR:
- case WITH_CLEANUP_EXPR:
- case CALL_EXPR:
- TRY (TREE_OPERAND (t, 0));
- TRY (TREE_OPERAND (t, 1));
- break;
-
- case SAVE_EXPR:
- case CONVERT_EXPR:
- case ADDR_EXPR:
- case INDIRECT_REF:
- case NEGATE_EXPR:
- case BIT_NOT_EXPR:
- case TRUTH_NOT_EXPR:
- case NOP_EXPR:
- case NON_LVALUE_EXPR:
- case COMPONENT_REF:
- case CLEANUP_POINT_EXPR:
- case LOOKUP_EXPR:
- case SIZEOF_EXPR:
- case ALIGNOF_EXPR:
- TRY (TREE_OPERAND (t, 0));
- break;
-
- case MODOP_EXPR:
- case CAST_EXPR:
- case REINTERPRET_CAST_EXPR:
- case CONST_CAST_EXPR:
- case STATIC_CAST_EXPR:
- case DYNAMIC_CAST_EXPR:
- case ARROW_EXPR:
- case DOTSTAR_EXPR:
- case TYPEID_EXPR:
- break;
-
- case COMPLEX_CST:
- TRY (TREE_REALPART (t));
- TRY (TREE_IMAGPART (t));
- break;
-
- case CONSTRUCTOR:
- TRY (CONSTRUCTOR_ELTS (t));
- break;
-
- case TEMPLATE_TEMPLATE_PARM:
- case TEMPLATE_PARM_INDEX:
- case TEMPLATE_TYPE_PARM:
- break;
-
- case BIND_EXPR:
- break;
-
- case REAL_TYPE:
- case COMPLEX_TYPE:
- case VOID_TYPE:
- case BOOLEAN_TYPE:
- case TYPENAME_TYPE:
- case UNION_TYPE:
- case ENUMERAL_TYPE:
- case TYPEOF_TYPE:
- break;
-
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- TRY (TREE_TYPE (t));
- break;
-
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- TRY (TREE_TYPE (t));
- TRY (TYPE_ARG_TYPES (t));
- break;
-
- case ARRAY_TYPE:
- TRY (TREE_TYPE (t));
- TRY (TYPE_DOMAIN (t));
- break;
-
- case INTEGER_TYPE:
- TRY (TYPE_MAX_VALUE (t));
- break;
-
- case OFFSET_TYPE:
- TRY (TREE_TYPE (t));
- TRY (TYPE_OFFSET_BASETYPE (t));
- break;
-
- case RECORD_TYPE:
- if (TYPE_PTRMEMFUNC_P (t))
- TRY (TYPE_PTRMEMFUNC_FN_TYPE (t));
- break;
-
- /* This list is incomplete, but should suffice for now.
- It is very important that `sorry' not call
- `report_error_function'. That could cause an infinite loop. */
- default:
- sorry ("initializer contains unrecognized tree code");
- return error_mark_node;
-
- }
-
+ ++ *((int*) data);
return NULL_TREE;
-
-#undef TRY
}
-/* Passed to search_tree. Checks for the use of types with no linkage. */
+/* Debugging function for measuring the rough complexity of a tree
+ representation. */
-static tree
-no_linkage_helper (t)
+int
+count_trees (t)
tree t;
{
- if (TYPE_P (t)
- && (IS_AGGR_TYPE (t) || TREE_CODE (t) == ENUMERAL_TYPE)
- && (decl_function_context (TYPE_MAIN_DECL (t))
- || ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))))
- return t;
- return NULL_TREE;
-}
+ int n_trees = 0;
+ walk_tree_without_duplicates (&t, count_trees_r, &n_trees);
+ return n_trees;
+}
-/* Check if the type T depends on a type with no linkage and if so, return
- it. */
+/* Called from verify_stmt_tree via walk_tree. */
+
+static tree
+verify_stmt_tree_r (tp, walk_subtrees, data)
+ tree *tp;
+ int *walk_subtrees ATTRIBUTE_UNUSED;
+ void *data;
+{
+ tree t = *tp;
+ htab_t *statements = (htab_t *) data;
+ void **slot;
+
+ if (!statement_code_p (TREE_CODE (t)))
+ return NULL_TREE;
+
+ /* If this statement is already present in the hash table, then
+ there is a circularity in the statement tree. */
+ if (htab_find (*statements, t))
+ abort ();
+
+ slot = htab_find_slot (*statements, t, INSERT);
+ *slot = t;
-tree
-no_linkage_check (t)
- tree t;
-{
- t = search_tree (t, no_linkage_helper);
- if (t != error_mark_node)
- return t;
return NULL_TREE;
}
+/* Debugging function to check that the statement T has not been
+ corrupted. For now, this function simply checks that T contains no
+ circularities. */
-/* Make copies of all the nodes below T. If FUNC is non-NULL, call it
- for each node. */
-
-tree
-mapcar (t, func)
+void
+verify_stmt_tree (t)
tree t;
- tree (*func) PROTO((tree));
{
- tree tmp;
-
- if (t == NULL_TREE)
- return t;
-
- if (func)
- {
- tmp = func (t);
- if (tmp)
- return tmp;
- }
-
- switch (TREE_CODE (t))
- {
- case ERROR_MARK:
- return error_mark_node;
-
- case VAR_DECL:
- case FUNCTION_DECL:
- case CONST_DECL:
- /* Rather than aborting, return error_mark_node. This allows us
- to report a sensible error message on code like this:
-
- void g() { int i; f<i>(7); }
-
- In a case like:
-
- void g() { const int i = 7; f<i>(7); }
-
- however, we must actually return the constant initializer. */
- if (TREE_READONLY_DECL_P (t))
- {
- tmp = decl_constant_value (t);
- if (tmp != t)
- return mapcar (tmp, func);
- }
- return error_mark_node;
-
- case PARM_DECL:
- {
- tree chain = TREE_CHAIN (t);
- t = copy_node (t);
- TREE_CHAIN (t) = mapcar (chain, func);
- TREE_TYPE (t) = mapcar (TREE_TYPE (t), func);
- DECL_INITIAL (t) = mapcar (DECL_INITIAL (t), func);
- DECL_SIZE (t) = mapcar (DECL_SIZE (t), func);
- return t;
- }
-
- case TREE_LIST:
- {
- tree chain = TREE_CHAIN (t);
- t = copy_node (t);
- TREE_PURPOSE (t) = mapcar (TREE_PURPOSE (t), func);
- TREE_VALUE (t) = mapcar (TREE_VALUE (t), func);
- TREE_CHAIN (t) = mapcar (chain, func);
- return t;
- }
-
- case OVERLOAD:
- {
- tree chain = OVL_CHAIN (t);
- t = copy_node (t);
- OVL_FUNCTION (t) = mapcar (OVL_FUNCTION (t), func);
- OVL_CHAIN (t) = mapcar (chain, func);
- return t;
- }
-
- case TREE_VEC:
- {
- int len = TREE_VEC_LENGTH (t);
-
- t = copy_node (t);
- while (len--)
- TREE_VEC_ELT (t, len) = mapcar (TREE_VEC_ELT (t, len), func);
- return t;
- }
-
- case INTEGER_CST:
- case REAL_CST:
- case STRING_CST:
- return copy_node (t);
-
- case PTRMEM_CST:
- t = copy_node (t);
- TREE_TYPE (t) = mapcar (TREE_TYPE (t), func);
- PTRMEM_CST_MEMBER (t) = mapcar (PTRMEM_CST_MEMBER (t), func);
- return t;
-
- case COND_EXPR:
- case TARGET_EXPR:
- case AGGR_INIT_EXPR:
- t = copy_node (t);
- TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
- TREE_OPERAND (t, 1) = mapcar (TREE_OPERAND (t, 1), func);
- TREE_OPERAND (t, 2) = mapcar (TREE_OPERAND (t, 2), func);
- return t;
-
- case SAVE_EXPR:
- t = copy_node (t);
- TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
- return t;
-
- case MODIFY_EXPR:
- case PLUS_EXPR:
- case MINUS_EXPR:
- case MULT_EXPR:
- case TRUNC_DIV_EXPR:
- case TRUNC_MOD_EXPR:
- case MIN_EXPR:
- case MAX_EXPR:
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case BIT_IOR_EXPR:
- case BIT_XOR_EXPR:
- case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case LT_EXPR:
- case LE_EXPR:
- case GT_EXPR:
- case GE_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- case CEIL_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case CEIL_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- case ROUND_MOD_EXPR:
- case COMPOUND_EXPR:
- case PREDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case ARRAY_REF:
- case SCOPE_REF:
- case TRY_CATCH_EXPR:
- case WITH_CLEANUP_EXPR:
- t = copy_node (t);
- TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), 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
- make_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:
- case NEGATE_EXPR:
- case BIT_NOT_EXPR:
- case TRUTH_NOT_EXPR:
- case NOP_EXPR:
- case COMPONENT_REF:
- case CLEANUP_POINT_EXPR:
- case NON_LVALUE_EXPR:
- t = copy_node (t);
- TREE_TYPE (t) = mapcar (TREE_TYPE (t), func);
- TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
- return t;
-
- case POINTER_TYPE:
- tmp = build_pointer_type (mapcar (TREE_TYPE (t), func));
- return cp_build_qualified_type (tmp, TYPE_QUALS (t));
- case REFERENCE_TYPE:
- tmp = build_reference_type (mapcar (TREE_TYPE (t), func));
- return cp_build_qualified_type (tmp, TYPE_QUALS (t));
- case FUNCTION_TYPE:
- tmp = build_function_type (mapcar (TREE_TYPE (t), func),
- mapcar (TYPE_ARG_TYPES (t), func));
- return cp_build_qualified_type (tmp, TYPE_QUALS (t));
- case ARRAY_TYPE:
- tmp = build_cplus_array_type (mapcar (TREE_TYPE (t), func),
- mapcar (TYPE_DOMAIN (t), func));
- return cp_build_qualified_type (tmp, CP_TYPE_QUALS (t));
- case INTEGER_TYPE:
- tmp = build_index_type (mapcar (TYPE_MAX_VALUE (t), func));
- return cp_build_qualified_type (tmp, TYPE_QUALS (t));
- case OFFSET_TYPE:
- tmp = build_offset_type (mapcar (TYPE_OFFSET_BASETYPE (t), func),
- mapcar (TREE_TYPE (t), func));
- return cp_build_qualified_type (tmp, TYPE_QUALS (t));
- case METHOD_TYPE:
- tmp = build_cplus_method_type
- (mapcar (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))), func),
- mapcar (TREE_TYPE (t), func),
- mapcar (TREE_CHAIN (TYPE_ARG_TYPES (t)), func));
- return cp_build_qualified_type (tmp, TYPE_QUALS (t));
-
- case COMPLEX_CST:
- t = copy_node (t);
- TREE_REALPART (t) = mapcar (TREE_REALPART (t), func);
- TREE_IMAGPART (t) = mapcar (TREE_REALPART (t), func);
- return t;
-
- case CONSTRUCTOR:
- t = copy_node (t);
- CONSTRUCTOR_ELTS (t) = mapcar (CONSTRUCTOR_ELTS (t), func);
- return t;
-
- case TEMPLATE_TEMPLATE_PARM:
- return copy_template_template_parm (t);
-
- case BIND_EXPR:
- t = copy_node (t);
- TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
- TREE_OPERAND (t, 1) = mapcar (TREE_OPERAND (t, 1), func);
- TREE_OPERAND (t, 2) = NULL_TREE;
- return t;
-
- case NEW_EXPR:
- t = copy_node (t);
- TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
- TREE_OPERAND (t, 1) = mapcar (TREE_OPERAND (t, 1), func);
- TREE_OPERAND (t, 2) = mapcar (TREE_OPERAND (t, 2), func);
- return t;
+ htab_t statements;
+ statements = htab_create (37, htab_hash_pointer, htab_eq_pointer, NULL);
+ walk_tree (&t, verify_stmt_tree_r, &statements, NULL);
+ htab_delete (statements);
+}
- case LOOKUP_EXPR:
- t = copy_node (t);
- TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
- return t;
+/* Called from find_tree via walk_tree. */
- case RECORD_TYPE:
- if (TYPE_PTRMEMFUNC_P (t))
- return build_ptrmemfunc_type
- (mapcar (TYPE_PTRMEMFUNC_FN_TYPE (t), func));
- /* else fall through */
-
- /* This list is incomplete, but should suffice for now.
- It is very important that `sorry' not call
- `report_error_function'. That could cause an infinite loop. */
- default:
- sorry ("initializer contains unrecognized tree code");
- return error_mark_node;
+static tree
+find_tree_r (tp, walk_subtrees, data)
+ tree *tp;
+ int *walk_subtrees ATTRIBUTE_UNUSED;
+ void *data;
+{
+ if (*tp == (tree) data)
+ return (tree) data;
- }
- my_friendly_abort (107);
- /* NOTREACHED */
return NULL_TREE;
}
-/* Returns T if T is allocated on the permanent obstack, NULL_TREE
- otherwise. */
+/* Returns X if X appears in the tree structure rooted at T. */
tree
-permanent_p (t)
+find_tree (t, x)
tree t;
+ tree x;
{
- return TREE_PERMANENT (t) ? t : NULL_TREE;
+ return walk_tree_without_duplicates (&t, find_tree_r, x);
}
+/* Passed to walk_tree. Checks for the use of types with no linkage. */
+
static tree
-perm_manip (t)
- tree t;
+no_linkage_helper (tp, walk_subtrees, data)
+ tree *tp;
+ int *walk_subtrees ATTRIBUTE_UNUSED;
+ void *data ATTRIBUTE_UNUSED;
{
- if (TREE_PERMANENT (t))
- return t;
-
- /* Support `void f () { extern int i; A<&i> a; }' */
- if ((TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == FUNCTION_DECL)
- && TREE_PUBLIC (t))
- {
- t = copy_node (t);
+ tree t = *tp;
- /* copy_rtx won't make a new SYMBOL_REF, so call make_decl_rtl again. */
- DECL_RTL (t) = 0;
- make_decl_rtl (t, NULL_PTR, 1);
-
- return t;
- }
+ if (TYPE_P (t)
+ && (CLASS_TYPE_P (t) || TREE_CODE (t) == ENUMERAL_TYPE)
+ && (decl_function_context (TYPE_MAIN_DECL (t))
+ || TYPE_ANONYMOUS_P (t)))
+ return t;
return NULL_TREE;
}
-/* Assuming T is a node built bottom-up, make it all exist on
- permanent obstack, if it is not permanent already. */
+/* Check if the type T depends on a type with no linkage and if so, return
+ it. */
tree
-copy_to_permanent (t)
+no_linkage_check (t)
tree t;
{
- if (t == NULL_TREE || TREE_PERMANENT (t))
- return t;
-
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- t = mapcar (t, perm_manip);
-
- pop_obstacks ();
+ /* There's no point in checking linkage on template functions; we
+ can't know their complete types. */
+ if (processing_template_decl)
+ return NULL_TREE;
- return t;
+ t = walk_tree_without_duplicates (&t, no_linkage_helper, NULL);
+ if (t != error_mark_node)
+ return t;
+ return NULL_TREE;
}
#ifdef GATHER_STATISTICS
@@ -2045,11 +1242,8 @@ extern int depth_reached;
#endif
void
-print_lang_statistics ()
+cxx_print_statistics ()
{
- extern struct obstack decl_obstack;
- print_obstack_statistics ("class_obstack", &class_obstack);
- print_obstack_statistics ("decl_obstack", &decl_obstack);
print_search_statistics ();
print_class_statistics ();
#ifdef GATHER_STATISTICS
@@ -2058,23 +1252,6 @@ print_lang_statistics ()
#endif
}
-/* This is used by the `assert' macro. It is provided in libgcc.a,
- which `cc' doesn't know how to link. Note that the C++ front-end
- no longer actually uses the `assert' macro (instead, it calls
- my_friendly_assert). But all of the back-end files still need this. */
-
-void
-__eprintf (string, expression, line, filename)
- const char *string;
- const char *expression;
- unsigned line;
- const char *filename;
-{
- fprintf (stderr, string, expression, line, filename);
- fflush (stderr);
- abort ();
-}
-
/* Return, as an INTEGER_CST node, the number of elements for TYPE
(which is an ARRAY_TYPE). This counts only elements of the top
array. */
@@ -2107,137 +1284,189 @@ array_type_nelts_total (type)
return sz;
}
-static
-tree
-bot_manip (t)
- tree t;
+/* Called from break_out_target_exprs via mapcar. */
+
+static tree
+bot_manip (tp, walk_subtrees, data)
+ tree *tp;
+ int *walk_subtrees;
+ void *data;
{
- if (TREE_CODE (t) != TREE_LIST && ! TREE_SIDE_EFFECTS (t))
- return t;
- else if (TREE_CODE (t) == TARGET_EXPR)
+ splay_tree target_remap = ((splay_tree) data);
+ tree t = *tp;
+
+ if (TREE_CONSTANT (t))
{
+ /* There can't be any TARGET_EXPRs or their slot variables below
+ this point. We used to check !TREE_SIDE_EFFECTS, but then we
+ failed to copy an ADDR_EXPR of the slot VAR_DECL. */
+ *walk_subtrees = 0;
+ return NULL_TREE;
+ }
+ if (TREE_CODE (t) == TARGET_EXPR)
+ {
+ tree u;
+
if (TREE_CODE (TREE_OPERAND (t, 1)) == AGGR_INIT_EXPR)
{
mark_used (TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (t, 1), 0), 0));
- return build_cplus_new
+ u = build_cplus_new
(TREE_TYPE (t), break_out_target_exprs (TREE_OPERAND (t, 1)));
}
- t = copy_node (t);
- TREE_OPERAND (t, 0) = build (VAR_DECL, TREE_TYPE (t));
- layout_decl (TREE_OPERAND (t, 0), 0);
- return t;
+ else
+ {
+ u = build_target_expr_with_type
+ (break_out_target_exprs (TREE_OPERAND (t, 1)), TREE_TYPE (t));
+ }
+
+ /* Map the old variable to the new one. */
+ splay_tree_insert (target_remap,
+ (splay_tree_key) TREE_OPERAND (t, 0),
+ (splay_tree_value) TREE_OPERAND (u, 0));
+
+ /* Replace the old expression with the new version. */
+ *tp = u;
+ /* We don't have to go below this point; the recursive call to
+ break_out_target_exprs will have handled anything below this
+ point. */
+ *walk_subtrees = 0;
+ return NULL_TREE;
}
else if (TREE_CODE (t) == CALL_EXPR)
mark_used (TREE_OPERAND (TREE_OPERAND (t, 0), 0));
- return NULL_TREE;
+ /* Make a copy of this node. */
+ return copy_tree_r (tp, walk_subtrees, NULL);
}
-/* Actually, we'll just clean out the target exprs for the moment. */
+/* Replace all remapped VAR_DECLs in T with their new equivalents.
+ DATA is really a splay-tree mapping old variables to new
+ variables. */
+
+static tree
+bot_replace (t, walk_subtrees, data)
+ tree *t;
+ int *walk_subtrees ATTRIBUTE_UNUSED;
+ void *data;
+{
+ splay_tree target_remap = ((splay_tree) data);
+
+ if (TREE_CODE (*t) == VAR_DECL)
+ {
+ splay_tree_node n = splay_tree_lookup (target_remap,
+ (splay_tree_key) *t);
+ if (n)
+ *t = (tree) n->value;
+ }
+
+ return NULL_TREE;
+}
+
+/* When we parse a default argument expression, we may create
+ temporary variables via TARGET_EXPRs. When we actually use the
+ default-argument expression, we make a copy of the expression, but
+ we must replace the temporaries with appropriate local versions. */
tree
break_out_target_exprs (t)
tree t;
{
- return mapcar (t, bot_manip);
+ static int target_remap_count;
+ static splay_tree target_remap;
+
+ if (!target_remap_count++)
+ target_remap = splay_tree_new (splay_tree_compare_pointers,
+ /*splay_tree_delete_key_fn=*/NULL,
+ /*splay_tree_delete_value_fn=*/NULL);
+ walk_tree (&t, bot_manip, target_remap, NULL);
+ walk_tree (&t, bot_replace, target_remap, NULL);
+
+ if (!--target_remap_count)
+ {
+ splay_tree_delete (target_remap);
+ target_remap = NULL;
+ }
+
+ return t;
}
/* Obstack used for allocating nodes in template function and variable
definitions. */
-/* Similar to `build_nt', except we build
- on the permanent_obstack, regardless. */
+/* Similar to `build_nt', except that we set TREE_COMPLEXITY to be the
+ current line number. */
tree
-build_min_nt VPROTO((enum tree_code code, ...))
+build_min_nt VPARAMS ((enum tree_code code, ...))
{
-#ifndef __STDC__
- enum tree_code code;
-#endif
- register struct obstack *ambient_obstack = expression_obstack;
- va_list p;
register tree t;
register int length;
register int i;
- VA_START (p, code);
-
-#ifndef __STDC__
- code = va_arg (p, enum tree_code);
-#endif
-
- expression_obstack = &permanent_obstack;
+ VA_OPEN (p, code);
+ VA_FIXEDARG (p, enum tree_code, code);
t = make_node (code);
- length = tree_code_length[(int) code];
+ length = TREE_CODE_LENGTH (code);
TREE_COMPLEXITY (t) = lineno;
for (i = 0; i < length; i++)
{
tree x = va_arg (p, tree);
- TREE_OPERAND (t, i) = copy_to_permanent (x);
+ TREE_OPERAND (t, i) = x;
}
- va_end (p);
- expression_obstack = ambient_obstack;
+ VA_CLOSE (p);
return t;
}
-/* Similar to `build', except we build
- on the permanent_obstack, regardless. */
+/* Similar to `build', except we set TREE_COMPLEXITY to the current
+ line-number. */
tree
-build_min VPROTO((enum tree_code code, tree tt, ...))
+build_min VPARAMS ((enum tree_code code, tree tt, ...))
{
-#ifndef __STDC__
- enum tree_code code;
- tree tt;
-#endif
- register struct obstack *ambient_obstack = expression_obstack;
- va_list p;
register tree t;
register int length;
register int i;
- VA_START (p, tt);
-
-#ifndef __STDC__
- code = va_arg (p, enum tree_code);
- tt = va_arg (p, tree);
-#endif
-
- expression_obstack = &permanent_obstack;
+ VA_OPEN (p, tt);
+ VA_FIXEDARG (p, enum tree_code, code);
+ VA_FIXEDARG (p, tree, tt);
t = make_node (code);
- length = tree_code_length[(int) code];
- TREE_TYPE (t) = copy_to_permanent (tt);
+ length = TREE_CODE_LENGTH (code);
+ TREE_TYPE (t) = tt;
TREE_COMPLEXITY (t) = lineno;
for (i = 0; i < length; i++)
{
tree x = va_arg (p, tree);
- TREE_OPERAND (t, i) = copy_to_permanent (x);
+ TREE_OPERAND (t, i) = x;
}
- va_end (p);
- expression_obstack = ambient_obstack;
+ VA_CLOSE (p);
return t;
}
-/* Same as `tree_cons' but make a permanent object. */
+/* Returns an INTEGER_CST (of type `int') corresponding to I.
+ Multiple calls with the same value of I may or may not yield the
+ same node; therefore, callers should never modify the node
+ returned. */
tree
-min_tree_cons (purpose, value, chain)
- tree purpose, value, chain;
+build_shared_int_cst (i)
+ int i;
{
- register tree node;
- register struct obstack *ambient_obstack = current_obstack;
- current_obstack = &permanent_obstack;
+ static tree cache[256];
- node = tree_cons (copy_to_permanent (purpose),
- copy_to_permanent (value), chain);
- current_obstack = ambient_obstack;
- return node;
+ if (i >= 256)
+ return build_int_2 (i, 0);
+
+ if (!cache[i])
+ cache[i] = build_int_2 (i, 0);
+
+ return cache[i];
}
tree
@@ -2246,36 +1475,17 @@ get_type_decl (t)
{
if (TREE_CODE (t) == TYPE_DECL)
return t;
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
+ if (TYPE_P (t))
return TYPE_STUB_DECL (t);
+ if (t == error_mark_node)
+ return t;
- my_friendly_abort (42);
+ abort ();
/* Stop compiler from complaining control reaches end of non-void function. */
return 0;
}
-int
-can_free (obstack, t)
- struct obstack *obstack;
- tree t;
-{
- int size = 0;
-
- if (TREE_CODE (t) == TREE_VEC)
- size = (TREE_VEC_LENGTH (t)-1) * sizeof (tree) + sizeof (struct tree_vec);
- else
- my_friendly_abort (42);
-
-#define ROUND(x) ((x + obstack_alignment_mask (obstack)) \
- & ~ obstack_alignment_mask (obstack))
- if ((char *)t + ROUND (size) == obstack_next_free (obstack))
- return 1;
-#undef ROUND
-
- return 0;
-}
-
/* Return first vector element whose BINFO_TYPE is ELEM.
Return 0 if ELEM is not in VEC. VEC may be NULL_TREE. */
@@ -2293,20 +1503,6 @@ vec_binfo_member (elem, vec)
return NULL_TREE;
}
-/* Kludge around the fact that DECL_CONTEXT for virtual functions returns
- the wrong thing for decl_function_context. Hopefully the uses in the
- backend won't matter, since we don't need a static chain for local class
- methods. FIXME! */
-
-tree
-hack_decl_function_context (decl)
- tree decl;
-{
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_FUNCTION_MEMBER_P (decl))
- return decl_function_context (TYPE_MAIN_DECL (DECL_CLASS_CONTEXT (decl)));
- return decl_function_context (decl);
-}
-
/* Returns the namespace that contains DECL, whether directly or
indirectly. */
@@ -2371,7 +1567,7 @@ cp_tree_equal (t1, t2)
case STRING_CST:
return TREE_STRING_LENGTH (t1) == TREE_STRING_LENGTH (t2)
- && !bcmp (TREE_STRING_POINTER (t1), TREE_STRING_POINTER (t2),
+ && !memcmp (TREE_STRING_POINTER (t1), TREE_STRING_POINTER (t2),
TREE_STRING_LENGTH (t1));
case CONSTRUCTOR:
@@ -2409,10 +1605,10 @@ cp_tree_equal (t1, t2)
as being equivalent to anything. */
if ((TREE_CODE (TREE_OPERAND (t1, 0)) == VAR_DECL
&& DECL_NAME (TREE_OPERAND (t1, 0)) == NULL_TREE
- && DECL_RTL (TREE_OPERAND (t1, 0)) == 0)
+ && !DECL_RTL_SET_P (TREE_OPERAND (t1, 0)))
|| (TREE_CODE (TREE_OPERAND (t2, 0)) == VAR_DECL
&& DECL_NAME (TREE_OPERAND (t2, 0)) == NULL_TREE
- && DECL_RTL (TREE_OPERAND (t2, 0)) == 0))
+ && !DECL_RTL_SET_P (TREE_OPERAND (t2, 0))))
cmp = 1;
else
cmp = cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
@@ -2424,7 +1620,7 @@ cp_tree_equal (t1, t2)
cmp = cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
if (cmp <= 0)
return cmp;
- return cp_tree_equal (TREE_OPERAND (t1, 2), TREE_OPERAND (t1, 2));
+ return cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t1, 1));
case COMPONENT_REF:
if (TREE_OPERAND (t1, 1) == TREE_OPERAND (t2, 1))
@@ -2445,7 +1641,7 @@ cp_tree_equal (t1, t2)
case ALIGNOF_EXPR:
if (TREE_CODE (TREE_OPERAND (t1, 0)) != TREE_CODE (TREE_OPERAND (t2, 0)))
return 0;
- if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t1, 0))) == 't')
+ if (TYPE_P (TREE_OPERAND (t1, 0)))
return same_type_p (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
break;
@@ -2461,40 +1657,32 @@ cp_tree_equal (t1, t2)
switch (TREE_CODE_CLASS (code1))
{
- int i;
case '1':
case '2':
case '<':
case 'e':
case 'r':
case 's':
- cmp = 1;
- for (i=0; i<tree_code_length[(int) code1]; ++i)
- {
- cmp = cp_tree_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i));
- if (cmp <= 0)
- return cmp;
- }
- return cmp;
+ {
+ int i;
+
+ cmp = 1;
+ for (i = 0; i < TREE_CODE_LENGTH (code1); ++i)
+ {
+ cmp = cp_tree_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i));
+ if (cmp <= 0)
+ return cmp;
+ }
+ return cmp;
+ }
+
+ case 't':
+ return same_type_p (t1, t2) ? 1 : 0;
}
return -1;
}
-/* Similar to make_tree_vec, but build on the momentary_obstack.
- Thus, these vectors are really and truly temporary. */
-
-tree
-make_temp_vec (len)
- int len;
-{
- register tree node;
- push_expression_obstack ();
- node = make_tree_vec (len);
- pop_obstacks ();
- return node;
-}
-
/* Build a wrapper around some pointer PTR so we can use it as a tree. */
tree
@@ -2506,19 +1694,6 @@ build_ptr_wrapper (ptr)
return t;
}
-/* Same, but on the expression_obstack. */
-
-tree
-build_expr_ptr_wrapper (ptr)
- void *ptr;
-{
- tree t;
- push_expression_obstack ();
- t = build_ptr_wrapper (ptr);
- pop_obstacks ();
- return t;
-}
-
/* Build a wrapper around some integer I so we can use it as a tree. */
tree
@@ -2532,24 +1707,15 @@ build_int_wrapper (i)
static tree
build_srcloc (file, line)
- char *file;
+ const char *file;
int line;
{
tree t;
- /* Make sure that we put these on the permanent obstack; up in
- add_pending_template, we pass this return value into perm_tree_cons,
- which also puts it on the permanent_obstack. However, this wasn't
- explicitly doing the same. */
- register struct obstack *ambient_obstack = current_obstack;
- current_obstack = &permanent_obstack;
-
t = make_node (SRCLOC);
SRCLOC_FILE (t) = file;
SRCLOC_LINE (t) = line;
- current_obstack = ambient_obstack;
-
return t;
}
@@ -2559,13 +1725,6 @@ build_srcloc_here ()
return build_srcloc (input_filename, lineno);
}
-void
-push_expression_obstack ()
-{
- push_obstacks_nochange ();
- current_obstack = expression_obstack;
-}
-
/* The type of ARG when used as an lvalue. */
tree
@@ -2615,8 +1774,8 @@ int
member_p (decl)
tree decl;
{
- tree ctx = DECL_CONTEXT (decl);
- return (ctx && TREE_CODE_CLASS (TREE_CODE (ctx)) == 't');
+ const tree ctx = DECL_CONTEXT (decl);
+ return (ctx && TYPE_P (ctx));
}
/* Create a placeholder for member access where we don't actually have an
@@ -2627,7 +1786,7 @@ build_dummy_object (type)
tree type;
{
tree decl = build1 (NOP_EXPR, build_pointer_type (type), void_zero_node);
- return build_indirect_ref (decl, NULL_PTR);
+ return build_indirect_ref (decl, NULL);
}
/* We've gotten a reference to a member of TYPE. Return *this if appropriate,
@@ -2640,18 +1799,22 @@ maybe_dummy_object (type, binfop)
tree *binfop;
{
tree decl, context;
-
+ tree binfo;
+
if (current_class_type
- && get_base_distance (type, current_class_type, 0, binfop) != -1)
+ && (binfo = lookup_base (current_class_type, type,
+ ba_ignore | ba_quiet, NULL)))
context = current_class_type;
else
{
/* Reference from a nested class member function. */
context = type;
- if (binfop)
- *binfop = TYPE_BINFO (type);
+ binfo = TYPE_BINFO (type);
}
+ if (binfop)
+ *binfop = binfo;
+
if (current_class_ref && context == current_class_type)
decl = current_class_ref;
else
@@ -2678,118 +1841,165 @@ int
pod_type_p (t)
tree t;
{
- tree f;
+ t = strip_array_types (t);
- while (TREE_CODE (t) == ARRAY_TYPE)
- t = TREE_TYPE (t);
-
- if (! IS_AGGR_TYPE (t))
+ if (INTEGRAL_TYPE_P (t))
+ return 1; /* integral, character or enumeral type */
+ if (FLOAT_TYPE_P (t))
return 1;
-
- if (CLASSTYPE_NON_AGGREGATE (t)
- || TYPE_HAS_COMPLEX_ASSIGN_REF (t)
- || TYPE_HAS_DESTRUCTOR (t))
+ if (TYPE_PTR_P (t))
+ return 1; /* pointer to non-member */
+ if (TYPE_PTRMEM_P (t))
+ return 1; /* pointer to member object */
+ if (TYPE_PTRMEMFUNC_P (t))
+ return 1; /* pointer to member function */
+
+ if (! CLASS_TYPE_P (t))
+ return 0; /* other non-class type (reference or function) */
+ if (CLASSTYPE_NON_POD_P (t))
return 0;
+ return 1;
+}
- for (f = TYPE_FIELDS (t); f; f = TREE_CHAIN (f))
- {
- if (TREE_CODE (f) != FIELD_DECL)
- continue;
+/* Table of valid C++ attributes. */
+const struct attribute_spec cp_attribute_table[] =
+{
+ /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
+ { "java_interface", 0, 0, false, false, false, handle_java_interface_attribute },
+ { "com_interface", 0, 0, false, false, false, handle_com_interface_attribute },
+ { "init_priority", 1, 1, true, false, false, handle_init_priority_attribute },
+ { NULL, 0, 0, false, false, false, NULL }
+};
- if (TREE_CODE (TREE_TYPE (f)) == REFERENCE_TYPE
- || TYPE_PTRMEMFUNC_P (TREE_TYPE (f))
- || TYPE_PTRMEM_P (TREE_TYPE (f)))
- return 0;
+/* Handle a "java_interface" attribute; arguments as in
+ struct attribute_spec.handler. */
+static tree
+handle_java_interface_attribute (node, name, args, flags, no_add_attrs)
+ tree *node;
+ tree name;
+ tree args ATTRIBUTE_UNUSED;
+ int flags;
+ bool *no_add_attrs;
+{
+ if (DECL_P (*node)
+ || !CLASS_TYPE_P (*node)
+ || !TYPE_FOR_JAVA (*node))
+ {
+ error ("`%s' attribute can only be applied to Java class definitions",
+ IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ return NULL_TREE;
}
+ if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
+ *node = build_type_copy (*node);
+ TYPE_JAVA_INTERFACE (*node) = 1;
- return 1;
+ return NULL_TREE;
}
-/* Return a 1 if ATTR_NAME and ATTR_ARGS denote a valid C++-specific
- attribute for either declaration DECL or type TYPE and 0 otherwise.
- Plugged into valid_lang_attribute. */
-
-int
-cp_valid_lang_attribute (attr_name, attr_args, decl, type)
- tree attr_name;
- tree attr_args ATTRIBUTE_UNUSED;
- tree decl ATTRIBUTE_UNUSED;
- tree type ATTRIBUTE_UNUSED;
+/* Handle a "com_interface" attribute; arguments as in
+ struct attribute_spec.handler. */
+static tree
+handle_com_interface_attribute (node, name, args, flags, no_add_attrs)
+ tree *node;
+ tree name;
+ tree args ATTRIBUTE_UNUSED;
+ int flags ATTRIBUTE_UNUSED;
+ bool *no_add_attrs;
{
- if (is_attribute_p ("com_interface", attr_name))
- {
- if (! flag_vtable_thunks)
- {
- error ("`com_interface' only supported with -fvtable-thunks");
- return 0;
- }
+ static int warned;
- if (attr_args != NULL_TREE
- || decl != NULL_TREE
- || ! CLASS_TYPE_P (type)
- || type != TYPE_MAIN_VARIANT (type))
- {
- warning ("`com_interface' attribute can only be applied to class definitions");
- return 0;
- }
+ *no_add_attrs = true;
- CLASSTYPE_COM_INTERFACE (type) = 1;
- return 1;
- }
- else if (is_attribute_p ("init_priority", attr_name))
+ if (DECL_P (*node)
+ || !CLASS_TYPE_P (*node)
+ || *node != TYPE_MAIN_VARIANT (*node))
{
- tree initp_expr = (attr_args ? TREE_VALUE (attr_args): NULL_TREE);
- int pri;
+ warning ("`%s' attribute can only be applied to class definitions",
+ IDENTIFIER_POINTER (name));
+ return NULL_TREE;
+ }
+
+ if (!warned++)
+ warning ("`%s' is obsolete; g++ vtables are now COM-compatible by default",
+ IDENTIFIER_POINTER (name));
+
+ return NULL_TREE;
+}
- if (initp_expr)
- STRIP_NOPS (initp_expr);
+/* Handle an "init_priority" attribute; arguments as in
+ struct attribute_spec.handler. */
+static tree
+handle_init_priority_attribute (node, name, args, flags, no_add_attrs)
+ tree *node;
+ tree name;
+ tree args;
+ int flags ATTRIBUTE_UNUSED;
+ bool *no_add_attrs;
+{
+ tree initp_expr = TREE_VALUE (args);
+ tree decl = *node;
+ tree type = TREE_TYPE (decl);
+ int pri;
+
+ STRIP_NOPS (initp_expr);
- if (!initp_expr || TREE_CODE (initp_expr) != INTEGER_CST)
- {
- error ("requested init_priority is not an integer constant");
- return 0;
- }
+ if (!initp_expr || TREE_CODE (initp_expr) != INTEGER_CST)
+ {
+ error ("requested init_priority is not an integer constant");
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
- pri = TREE_INT_CST_LOW (initp_expr);
+ pri = TREE_INT_CST_LOW (initp_expr);
- while (TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
-
- if (decl == NULL_TREE
- || TREE_CODE (decl) != VAR_DECL
- || ! TREE_STATIC (decl)
- || DECL_EXTERNAL (decl)
- || (TREE_CODE (type) != RECORD_TYPE
- && TREE_CODE (type) != UNION_TYPE)
- /* Static objects in functions are initialized the
- first time control passes through that
- function. This is not precise enough to pin down an
- init_priority value, so don't allow it. */
- || current_function_decl)
- {
- error ("can only use init_priority attribute on file-scope definitions of objects of class type");
- return 0;
- }
+ type = strip_array_types (type);
+
+ if (decl == NULL_TREE
+ || TREE_CODE (decl) != VAR_DECL
+ || !TREE_STATIC (decl)
+ || DECL_EXTERNAL (decl)
+ || (TREE_CODE (type) != RECORD_TYPE
+ && TREE_CODE (type) != UNION_TYPE)
+ /* Static objects in functions are initialized the
+ first time control passes through that
+ function. This is not precise enough to pin down an
+ init_priority value, so don't allow it. */
+ || current_function_decl)
+ {
+ error ("can only use `%s' attribute on file-scope definitions of objects of class type",
+ IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
- if (pri > MAX_INIT_PRIORITY || pri <= 0)
- {
- error ("requested init_priority is out of range");
- return 0;
- }
+ if (pri > MAX_INIT_PRIORITY || pri <= 0)
+ {
+ error ("requested init_priority is out of range");
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
- /* Check for init_priorities that are reserved for
- language and runtime support implementations.*/
- if (pri <= MAX_RESERVED_INIT_PRIORITY)
- {
- warning
- ("requested init_priority is reserved for internal use");
- }
+ /* Check for init_priorities that are reserved for
+ language and runtime support implementations.*/
+ if (pri <= MAX_RESERVED_INIT_PRIORITY)
+ {
+ warning
+ ("requested init_priority is reserved for internal use");
+ }
+ if (SUPPORTS_INIT_PRIORITY)
+ {
DECL_INIT_PRIORITY (decl) = pri;
- return 1;
+ return NULL_TREE;
+ }
+ else
+ {
+ error ("`%s' attribute is not supported on this platform",
+ IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ return NULL_TREE;
}
-
- return 0;
}
/* Return a new PTRMEM_CST of the indicated TYPE. The MEMBER is the
@@ -2809,3 +2019,444 @@ make_ptrmem_cst (type, member)
return ptrmem_cst;
}
+/* Apply FUNC to all language-specific sub-trees of TP in a pre-order
+ traversal. Called from walk_tree(). */
+
+tree
+cp_walk_subtrees (tp, walk_subtrees_p, func, data, htab)
+ tree *tp;
+ int *walk_subtrees_p;
+ walk_tree_fn func;
+ void *data;
+ void *htab;
+{
+ enum tree_code code = TREE_CODE (*tp);
+ tree result;
+
+#define WALK_SUBTREE(NODE) \
+ do \
+ { \
+ result = walk_tree (&(NODE), func, data, htab); \
+ if (result) \
+ return result; \
+ } \
+ while (0)
+
+ /* Not one of the easy cases. We must explicitly go through the
+ children. */
+ switch (code)
+ {
+ case DEFAULT_ARG:
+ case TEMPLATE_TEMPLATE_PARM:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
+ case UNBOUND_CLASS_TEMPLATE:
+ case TEMPLATE_PARM_INDEX:
+ case TEMPLATE_TYPE_PARM:
+ case TYPENAME_TYPE:
+ case TYPEOF_TYPE:
+ /* None of thse have subtrees other than those already walked
+ above. */
+ *walk_subtrees_p = 0;
+ break;
+
+ case PTRMEM_CST:
+ WALK_SUBTREE (TREE_TYPE (*tp));
+ *walk_subtrees_p = 0;
+ break;
+
+ case TREE_LIST:
+ /* A BASELINK_P's TREE_PURPOSE is a BINFO, and hence circular. */
+ if (!BASELINK_P (*tp))
+ WALK_SUBTREE (TREE_PURPOSE (*tp));
+ break;
+
+ case OVERLOAD:
+ WALK_SUBTREE (OVL_FUNCTION (*tp));
+ WALK_SUBTREE (OVL_CHAIN (*tp));
+ *walk_subtrees_p = 0;
+ break;
+
+ case RECORD_TYPE:
+ if (TYPE_PTRMEMFUNC_P (*tp))
+ WALK_SUBTREE (TYPE_PTRMEMFUNC_FN_TYPE (*tp));
+ break;
+
+ default:
+ break;
+ }
+
+ /* We didn't find what we were looking for. */
+ return NULL_TREE;
+
+#undef WALK_SUBTREE
+}
+
+/* Decide whether there are language-specific reasons to not inline a
+ function as a tree. */
+
+int
+cp_cannot_inline_tree_fn (fnp)
+ tree *fnp;
+{
+ tree fn = *fnp;
+
+ /* We can inline a template instantiation only if it's fully
+ instantiated. */
+ if (DECL_TEMPLATE_INFO (fn)
+ && TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)))
+ {
+ fn = *fnp = instantiate_decl (fn, /*defer_ok=*/0);
+ return TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn));
+ }
+
+ if (varargs_function_p (fn))
+ {
+ DECL_UNINLINABLE (fn) = 1;
+ return 1;
+ }
+
+ if (! function_attribute_inlinable_p (fn))
+ {
+ DECL_UNINLINABLE (fn) = 1;
+ return 1;
+ }
+
+ return 0;
+}
+
+/* Add any pending functions other than the current function (already
+ handled by the caller), that thus cannot be inlined, to FNS_P, then
+ return the latest function added to the array, PREV_FN. */
+
+tree
+cp_add_pending_fn_decls (fns_p, prev_fn)
+ void *fns_p;
+ tree prev_fn;
+{
+ varray_type *fnsp = (varray_type *)fns_p;
+ struct saved_scope *s;
+
+ for (s = scope_chain; s; s = s->prev)
+ if (s->function_decl && s->function_decl != prev_fn)
+ {
+ VARRAY_PUSH_TREE (*fnsp, s->function_decl);
+ prev_fn = s->function_decl;
+ }
+
+ return prev_fn;
+}
+
+/* Determine whether a tree node is an OVERLOAD node. Used to decide
+ whether to copy a node or to preserve its chain when inlining a
+ function. */
+
+int
+cp_is_overload_p (t)
+ tree t;
+{
+ return TREE_CODE (t) == OVERLOAD;
+}
+
+/* Determine whether VAR is a declaration of an automatic variable in
+ function FN. */
+
+int
+cp_auto_var_in_fn_p (var, fn)
+ tree var, fn;
+{
+ return (DECL_P (var) && DECL_CONTEXT (var) == fn
+ && nonstatic_local_decl_p (var));
+}
+
+/* Tell whether a declaration is needed for the RESULT of a function
+ FN being inlined into CALLER or if the top node of target_exprs is
+ to be used. */
+
+tree
+cp_copy_res_decl_for_inlining (result, fn, caller, decl_map_,
+ need_decl, target_exprs)
+ tree result, fn, caller;
+ void *decl_map_;
+ int *need_decl;
+ void *target_exprs;
+{
+ splay_tree decl_map = (splay_tree)decl_map_;
+ varray_type *texps = (varray_type *)target_exprs;
+ tree var;
+ int aggregate_return_p;
+
+ /* Figure out whether or not FN returns an aggregate. */
+ aggregate_return_p = IS_AGGR_TYPE (TREE_TYPE (result));
+ *need_decl = ! aggregate_return_p;
+
+ /* If FN returns an aggregate then the caller will always create the
+ temporary (using a TARGET_EXPR) and the call will be the
+ initializing expression for the TARGET_EXPR. If we were just to
+ create a new VAR_DECL here, then the result of this function
+ would be copied (bitwise) into the variable initialized by the
+ TARGET_EXPR. That's incorrect, so we must transform any
+ references to the RESULT into references to the target. */
+ if (aggregate_return_p)
+ {
+ if (VARRAY_ACTIVE_SIZE (*texps) == 0)
+ abort ();
+ var = TREE_OPERAND (VARRAY_TOP_TREE (*texps), 0);
+ if (! same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (var),
+ TREE_TYPE (result)))
+ abort ();
+ }
+ /* Otherwise, make an appropriate copy. */
+ else
+ var = copy_decl_for_inlining (result, fn, caller);
+
+ if (DECL_SAVED_FUNCTION_DATA (fn))
+ {
+ tree nrv = DECL_SAVED_FUNCTION_DATA (fn)->x_return_value;
+ if (nrv)
+ {
+ /* We have a named return value; copy the name and source
+ position so we can get reasonable debugging information, and
+ register the return variable as its equivalent. */
+ DECL_NAME (var) = DECL_NAME (nrv);
+ DECL_SOURCE_FILE (var) = DECL_SOURCE_FILE (nrv);
+ DECL_SOURCE_LINE (var) = DECL_SOURCE_LINE (nrv);
+ DECL_ABSTRACT_ORIGIN (var) = DECL_ORIGIN (nrv);
+ splay_tree_insert (decl_map,
+ (splay_tree_key) nrv,
+ (splay_tree_value) var);
+ }
+ }
+
+ return var;
+}
+
+/* Record that we're about to start inlining FN, and return non-zero if
+ that's OK. Used for lang_hooks.tree_inlining.start_inlining. */
+
+int
+cp_start_inlining (fn)
+ tree fn;
+{
+ if (DECL_TEMPLATE_INSTANTIATION (fn))
+ return push_tinst_level (fn);
+ else
+ return 1;
+}
+
+/* Record that we're done inlining FN. Used for
+ lang_hooks.tree_inlining.end_inlining. */
+
+void
+cp_end_inlining (fn)
+ tree fn ATTRIBUTE_UNUSED;
+{
+ if (DECL_TEMPLATE_INSTANTIATION (fn))
+ pop_tinst_level ();
+}
+
+/* Initialize tree.c. */
+
+void
+init_tree ()
+{
+ make_lang_type_fn = cp_make_lang_type;
+ lang_unsave = cp_unsave;
+ lang_statement_code_p = cp_statement_code_p;
+ lang_set_decl_assembler_name = mangle_decl;
+ list_hash_table = htab_create (31, list_hash, list_hash_eq, NULL);
+ ggc_add_root (&list_hash_table, 1,
+ sizeof (list_hash_table),
+ mark_tree_hashtable);
+}
+
+/* Called via walk_tree. If *TP points to a DECL_STMT for a local
+ declaration, copies the declaration and enters it in the splay_tree
+ pointed to by DATA (which is really a `splay_tree *'). */
+
+static tree
+mark_local_for_remap_r (tp, walk_subtrees, data)
+ tree *tp;
+ int *walk_subtrees ATTRIBUTE_UNUSED;
+ void *data;
+{
+ tree t = *tp;
+ splay_tree st = (splay_tree) data;
+ tree decl;
+
+
+ if (TREE_CODE (t) == DECL_STMT
+ && nonstatic_local_decl_p (DECL_STMT_DECL (t)))
+ decl = DECL_STMT_DECL (t);
+ else if (TREE_CODE (t) == LABEL_STMT)
+ decl = LABEL_STMT_LABEL (t);
+ else if (TREE_CODE (t) == TARGET_EXPR
+ && nonstatic_local_decl_p (TREE_OPERAND (t, 0)))
+ decl = TREE_OPERAND (t, 0);
+ else if (TREE_CODE (t) == CASE_LABEL)
+ decl = CASE_LABEL_DECL (t);
+ else
+ decl = NULL_TREE;
+
+ if (decl)
+ {
+ tree copy;
+
+ /* Make a copy. */
+ copy = copy_decl_for_inlining (decl,
+ DECL_CONTEXT (decl),
+ DECL_CONTEXT (decl));
+
+ /* Remember the copy. */
+ splay_tree_insert (st,
+ (splay_tree_key) decl,
+ (splay_tree_value) copy);
+ }
+
+ return NULL_TREE;
+}
+
+/* Called via walk_tree when an expression is unsaved. Using the
+ splay_tree pointed to by ST (which is really a `splay_tree'),
+ remaps all local declarations to appropriate replacements. */
+
+static tree
+cp_unsave_r (tp, walk_subtrees, data)
+ tree *tp;
+ int *walk_subtrees;
+ void *data;
+{
+ splay_tree st = (splay_tree) data;
+ splay_tree_node n;
+
+ /* Only a local declaration (variable or label). */
+ if (nonstatic_local_decl_p (*tp))
+ {
+ /* Lookup the declaration. */
+ n = splay_tree_lookup (st, (splay_tree_key) *tp);
+
+ /* If it's there, remap it. */
+ if (n)
+ *tp = (tree) n->value;
+ }
+ else if (TREE_CODE (*tp) == SAVE_EXPR)
+ remap_save_expr (tp, st, current_function_decl, walk_subtrees);
+ else
+ {
+ copy_tree_r (tp, walk_subtrees, NULL);
+
+ /* Do whatever unsaving is required. */
+ unsave_expr_1 (*tp);
+ }
+
+ /* Keep iterating. */
+ return NULL_TREE;
+}
+
+/* Called by unsave_expr_now whenever an expression (*TP) needs to be
+ unsaved. */
+
+static void
+cp_unsave (tp)
+ tree *tp;
+{
+ splay_tree st;
+
+ /* Create a splay-tree to map old local variable declarations to new
+ ones. */
+ st = splay_tree_new (splay_tree_compare_pointers, NULL, NULL);
+
+ /* Walk the tree once figuring out what needs to be remapped. */
+ walk_tree (tp, mark_local_for_remap_r, st, NULL);
+
+ /* Walk the tree again, copying, remapping, and unsaving. */
+ walk_tree (tp, cp_unsave_r, st, NULL);
+
+ /* Clean up. */
+ splay_tree_delete (st);
+}
+
+/* Returns the kind of special function that DECL (a FUNCTION_DECL)
+ is. Note that this sfk_none is zero, so this function can be used
+ as a predicate to test whether or not DECL is a special function. */
+
+special_function_kind
+special_function_p (decl)
+ tree decl;
+{
+ /* Rather than doing all this stuff with magic names, we should
+ probably have a field of type `special_function_kind' in
+ DECL_LANG_SPECIFIC. */
+ if (DECL_COPY_CONSTRUCTOR_P (decl))
+ return sfk_copy_constructor;
+ if (DECL_CONSTRUCTOR_P (decl))
+ return sfk_constructor;
+ if (DECL_OVERLOADED_OPERATOR_P (decl) == NOP_EXPR)
+ return sfk_assignment_operator;
+ if (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl))
+ return sfk_destructor;
+ if (DECL_COMPLETE_DESTRUCTOR_P (decl))
+ return sfk_complete_destructor;
+ if (DECL_BASE_DESTRUCTOR_P (decl))
+ return sfk_base_destructor;
+ if (DECL_DELETING_DESTRUCTOR_P (decl))
+ return sfk_deleting_destructor;
+ if (DECL_CONV_FN_P (decl))
+ return sfk_conversion;
+
+ return sfk_none;
+}
+
+/* Returns non-zero if TYPE is a character type, including wchar_t. */
+
+int
+char_type_p (type)
+ tree type;
+{
+ return (same_type_p (type, char_type_node)
+ || same_type_p (type, unsigned_char_type_node)
+ || same_type_p (type, signed_char_type_node)
+ || same_type_p (type, wchar_type_node));
+}
+
+/* Returns the kind of linkage associated with the indicated DECL. Th
+ value returned is as specified by the language standard; it is
+ independent of implementation details regarding template
+ instantiation, etc. For example, it is possible that a declaration
+ to which this function assigns external linkage would not show up
+ as a global symbol when you run `nm' on the resulting object file. */
+
+linkage_kind
+decl_linkage (decl)
+ tree decl;
+{
+ /* This function doesn't attempt to calculate the linkage from first
+ principles as given in [basic.link]. Instead, it makes use of
+ the fact that we have already set TREE_PUBLIC appropriately, and
+ then handles a few special cases. Ideally, we would calculate
+ linkage first, and then transform that into a concrete
+ implementation. */
+
+ /* Things that don't have names have no linkage. */
+ if (!DECL_NAME (decl))
+ return lk_none;
+
+ /* Things that are TREE_PUBLIC have external linkage. */
+ if (TREE_PUBLIC (decl))
+ return lk_external;
+
+ /* Some things that are not TREE_PUBLIC have external linkage, too.
+ For example, on targets that don't have weak symbols, we make all
+ template instantiations have internal linkage (in the object
+ file), but the symbols should still be treated as having external
+ linkage from the point of view of the language. */
+ if (DECL_LANG_SPECIFIC (decl) && DECL_COMDAT (decl))
+ return lk_external;
+
+ /* Things in local scope do not have linkage, if they don't have
+ TREE_PUBLIC set. */
+ if (decl_function_context (decl))
+ return lk_none;
+
+ /* Everything else has internal linkage. */
+ return lk_internal;
+}
diff --git a/contrib/gcc/cp/typeck.c b/contrib/gcc/cp/typeck.c
index d0743e9..5e69b98 100644
--- a/contrib/gcc/cp/typeck.c
+++ b/contrib/gcc/cp/typeck.c
@@ -1,5 +1,6 @@
/* Build expressions with type checking for C++ compiler.
- Copyright (C) 1987, 88, 89, 92-98, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -33,34 +34,39 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "tree.h"
#include "rtl.h"
+#include "expr.h"
#include "cp-tree.h"
+#include "tm_p.h"
#include "flags.h"
#include "output.h"
-#include "expr.h"
#include "toplev.h"
+#include "diagnostic.h"
+#include "target.h"
-static tree convert_for_assignment PROTO((tree, tree, const char *, tree,
+static tree convert_for_assignment PARAMS ((tree, tree, const char *, tree,
int));
-static tree pointer_int_sum PROTO((enum tree_code, tree, tree));
-static tree rationalize_conditional_expr PROTO((enum tree_code, tree));
-static int comp_target_parms PROTO((tree, tree, int));
-static int comp_ptr_ttypes_real PROTO((tree, tree, int));
-static int comp_ptr_ttypes_const PROTO((tree, tree));
-static int comp_ptr_ttypes_reinterpret PROTO((tree, tree));
-static int comp_array_types PROTO((int (*) (tree, tree, int), tree,
+static tree pointer_int_sum PARAMS ((enum tree_code, tree, tree));
+static tree rationalize_conditional_expr PARAMS ((enum tree_code, tree));
+static int comp_target_parms PARAMS ((tree, tree));
+static int comp_ptr_ttypes_real PARAMS ((tree, tree, int));
+static int comp_ptr_ttypes_const PARAMS ((tree, tree));
+static int comp_ptr_ttypes_reinterpret PARAMS ((tree, tree));
+static int comp_except_types PARAMS ((tree, tree, int));
+static int comp_array_types PARAMS ((int (*) (tree, tree, int), tree,
tree, int));
-static tree common_base_type PROTO((tree, tree));
-#if 0
-static tree convert_sequence PROTO((tree, tree));
-#endif
-static tree lookup_anon_field PROTO((tree, tree));
-static tree pointer_diff PROTO((tree, tree, tree));
-static tree build_component_addr PROTO((tree, tree));
-static tree qualify_type PROTO((tree, tree));
-static tree get_delta_difference PROTO((tree, tree, int));
-static int comp_cv_target_types PROTO((tree, tree, int));
-
-/* Return the target type of TYPE, which meas return T for:
+static tree common_base_type PARAMS ((tree, tree));
+static tree lookup_anon_field PARAMS ((tree, tree));
+static tree pointer_diff PARAMS ((tree, tree, tree));
+static tree build_component_addr PARAMS ((tree, tree));
+static tree qualify_type_recursive PARAMS ((tree, tree));
+static tree get_delta_difference PARAMS ((tree, tree, int));
+static int comp_cv_target_types PARAMS ((tree, tree, int));
+static void casts_away_constness_r PARAMS ((tree *, tree *));
+static int casts_away_constness PARAMS ((tree, tree));
+static void maybe_warn_about_returning_address_of_local PARAMS ((tree));
+static tree strip_all_pointer_quals PARAMS ((tree));
+
+/* Return the target type of TYPE, which means return T for:
T*, T&, T[], T (...), and otherwise, just T. */
tree
@@ -98,11 +104,7 @@ require_complete_type (value)
type = TREE_TYPE (value);
/* First, detect a valid value with a complete type. */
- if (TYPE_SIZE (type) != 0
- && TYPE_SIZE (type) != size_zero_node
- && ! (TYPE_LANG_SPECIFIC (type)
- && (IS_SIGNATURE_POINTER (type) || IS_SIGNATURE_REFERENCE (type))
- && TYPE_SIZE (SIGNATURE_TYPE (type)) == 0))
+ if (COMPLETE_TYPE_P (type))
return value;
/* If we see X::Y, we build an OFFSET_TYPE which has
@@ -112,12 +114,7 @@ require_complete_type (value)
&& current_class_ref != 0
&& TREE_OPERAND (value, 0) == current_class_ref)
{
- tree base, member = TREE_OPERAND (value, 1);
- tree basetype = TYPE_OFFSET_BASETYPE (type);
- my_friendly_assert (TREE_CODE (member) == FIELD_DECL, 305);
- base = convert_pointer_to (basetype, current_class_ptr);
- value = build (COMPONENT_REF, TREE_TYPE (member),
- build_indirect_ref (base, NULL_PTR), member);
+ value = resolve_offset_ref (value);
return require_complete_type (value);
}
@@ -127,99 +124,6 @@ require_complete_type (value)
return error_mark_node;
}
-/* Makes sure EXPR is a complete type when used in a void context, like a
- whole expression, or lhs of a comma operator. Issue a diagnostic and
- return error_mark_node on failure. This is a little tricky, because some
- valid void types look stunningly similar to invalid void types. We err on
- the side of caution */
-
-tree
-require_complete_type_in_void (expr)
- tree expr;
-{
- switch (TREE_CODE (expr))
- {
- case COND_EXPR:
- {
- tree op;
-
- op = TREE_OPERAND (expr,2);
- op = require_complete_type_in_void (op);
- TREE_OPERAND (expr,2) = op;
- if (op == error_mark_node)
- {
- expr = op;
- break;
- }
-
- /* fallthrough */
- }
-
- case COMPOUND_EXPR:
- {
- tree op;
-
- op = TREE_OPERAND (expr,1);
- op = require_complete_type_in_void (op);
- TREE_OPERAND (expr,1) = op;
- if (op == error_mark_node)
- {
- expr = op;
- break;
- }
-
- break;
- }
-
- case NON_LVALUE_EXPR:
- case NOP_EXPR:
- {
- tree op;
-
- op = TREE_OPERAND (expr,0);
- op = require_complete_type_in_void (op);
- TREE_OPERAND (expr,0) = op;
- if (op == error_mark_node)
- {
- expr = op;
- break;
- }
- break;
- }
-
- case CALL_EXPR: /* function call return can be ignored */
- case RTL_EXPR: /* RTL nodes have no value */
- case DELETE_EXPR: /* delete expressions have no type */
- case VEC_DELETE_EXPR:
- case INTEGER_CST: /* used for null pointer */
- case EXIT_EXPR: /* have no return */
- case LOOP_EXPR: /* have no return */
- case BIND_EXPR: /* have no return */
- case THROW_EXPR: /* have no return */
- case MODIFY_EXPR: /* sometimes this has a void type, but that's ok */
- case CONVERT_EXPR: /* sometimes has a void type */
- break;
-
- case INDIRECT_REF:
- {
- tree op = TREE_OPERAND (expr,0);
-
- /* Calling a function returning a reference has an implicit
- dereference applied. We don't want to make that an error. */
- if (TREE_CODE (op) == CALL_EXPR
- && TREE_CODE (TREE_TYPE (op)) == REFERENCE_TYPE)
- break;
- /* else fallthrough */
- }
-
- default:
- expr = require_complete_type (expr);
- break;
- }
-
- return expr;
-}
-
/* Try to complete TYPE, if it is incomplete. For example, if TYPE is
a template instantiation, do the instantiation. Returns TYPE,
whether or not it could be completed, unless something goes
@@ -234,17 +138,17 @@ complete_type (type)
at some point. */
return error_mark_node;
- if (type == error_mark_node || TYPE_SIZE (type) != NULL_TREE)
+ if (type == error_mark_node || COMPLETE_TYPE_P (type))
;
else if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type))
{
tree t = complete_type (TREE_TYPE (type));
- if (TYPE_SIZE (t) != NULL_TREE && ! processing_template_decl)
+ if (COMPLETE_TYPE_P (t) && ! processing_template_decl)
layout_type (type);
TYPE_NEEDS_CONSTRUCTING (type)
= TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (t));
- TYPE_NEEDS_DESTRUCTOR (type)
- = TYPE_NEEDS_DESTRUCTOR (TYPE_MAIN_VARIANT (t));
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
+ = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (t));
}
else if (CLASS_TYPE_P (type) && CLASSTYPE_TEMPLATE_INSTANTIATION (type))
instantiate_class_template (TYPE_MAIN_VARIANT (type));
@@ -265,7 +169,7 @@ complete_type_or_else (type, value)
if (type == error_mark_node)
/* We already issued an error. */
return NULL_TREE;
- else if (!TYPE_SIZE (type) || TYPE_SIZE (type) == size_zero_node)
+ else if (!COMPLETE_TYPE_P (type))
{
incomplete_type_error (value, type);
return NULL_TREE;
@@ -287,28 +191,42 @@ type_unknown_p (exp)
&& TREE_TYPE (TREE_TYPE (exp)) == unknown_type_node));
}
-/* Return truthvalue of whether T is function (or pfn) type. */
+/* Return a pointer or pointer to member type similar to T1, with a
+ cv-qualification signature that is the union of the cv-qualification
+ signatures of T1 and T2: [expr.rel], [expr.eq]. */
-int
-fntype_p (t)
- tree t;
+static tree
+qualify_type_recursive (t1, t2)
+ tree t1, t2;
{
- return (TREE_CODE (t) == FUNCTION_TYPE || TREE_CODE (t) == METHOD_TYPE
- || (TREE_CODE (t) == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (t)) == METHOD_TYPE)));
-}
+ if ((TYPE_PTR_P (t1) && TYPE_PTR_P (t2))
+ || (TYPE_PTRMEM_P (t1) && TYPE_PTRMEM_P (t2)))
+ {
+ tree tt1 = TREE_TYPE (t1);
+ tree tt2 = TREE_TYPE (t2);
+ tree b1;
+ int type_quals;
+ tree tgt;
+ tree attributes = (*targetm.merge_type_attributes) (t1, t2);
-/* Return a variant of TYPE which has all the type qualifiers of LIKE
- as well as those of TYPE. */
+ if (TREE_CODE (tt1) == OFFSET_TYPE)
+ {
+ b1 = TYPE_OFFSET_BASETYPE (tt1);
+ tt1 = TREE_TYPE (tt1);
+ tt2 = TREE_TYPE (tt2);
+ }
+ else
+ b1 = NULL_TREE;
-static tree
-qualify_type (type, like)
- tree type, like;
-{
- /* @@ Must do member pointers here. */
- return cp_build_qualified_type (type, (CP_TYPE_QUALS (type)
- | CP_TYPE_QUALS (like)));
+ type_quals = (cp_type_quals (tt1) | cp_type_quals (tt2));
+ tgt = qualify_type_recursive (tt1, tt2);
+ tgt = cp_build_qualified_type (tgt, type_quals);
+ if (b1)
+ tgt = build_offset_type (b1, tgt);
+ t1 = build_pointer_type (tgt);
+ t1 = build_type_attribute_variant (t1, attributes);
+ }
+ return t1;
}
/* Return the common type of two parameter lists.
@@ -325,7 +243,6 @@ commonparms (p1, p2)
tree oldargs = p1, newargs, n;
int i, len;
int any_change = 0;
- char *first_obj = (char *) oballoc (0);
len = list_length (p1);
newargs = tree_last (p1);
@@ -374,10 +291,7 @@ commonparms (p1, p2)
TREE_VALUE (n) = TREE_VALUE (p1);
}
if (! any_change)
- {
- obfree (first_obj);
- return oldargs;
- }
+ return oldargs;
return newargs;
}
@@ -401,6 +315,198 @@ original_type (t)
return t;
}
+/* T1 and T2 are arithmetic or enumeration types. Return the type
+ that will result from the "usual arithmetic conversions" on T1 and
+ T2 as described in [expr]. */
+
+tree
+type_after_usual_arithmetic_conversions (t1, t2)
+ tree t1;
+ tree t2;
+{
+ enum tree_code code1 = TREE_CODE (t1);
+ enum tree_code code2 = TREE_CODE (t2);
+ tree attributes;
+
+ /* FIXME: Attributes. */
+ my_friendly_assert (ARITHMETIC_TYPE_P (t1)
+ || TREE_CODE (t1) == ENUMERAL_TYPE,
+ 19990725);
+ my_friendly_assert (ARITHMETIC_TYPE_P (t2)
+ || TREE_CODE (t2) == ENUMERAL_TYPE,
+ 19990725);
+
+ /* In what follows, we slightly generalize the rules given in [expr]
+ so as to deal with `long long'. First, merge the attributes. */
+ attributes = (*targetm.merge_type_attributes) (t1, t2);
+
+ /* If only one is real, use it as the result. */
+ if (code1 == REAL_TYPE && code2 != REAL_TYPE)
+ return build_type_attribute_variant (t1, attributes);
+ if (code2 == REAL_TYPE && code1 != REAL_TYPE)
+ return build_type_attribute_variant (t2, attributes);
+
+ /* Perform the integral promotions. */
+ if (code1 != REAL_TYPE)
+ {
+ t1 = type_promotes_to (t1);
+ t2 = type_promotes_to (t2);
+ }
+
+ /* Both real or both integers; use the one with greater precision. */
+ if (TYPE_PRECISION (t1) > TYPE_PRECISION (t2))
+ return build_type_attribute_variant (t1, attributes);
+ else if (TYPE_PRECISION (t2) > TYPE_PRECISION (t1))
+ return build_type_attribute_variant (t2, attributes);
+
+ if (code1 != REAL_TYPE)
+ {
+ /* If one is a sizetype, use it so size_binop doesn't blow up. */
+ if (TYPE_IS_SIZETYPE (t1) > TYPE_IS_SIZETYPE (t2))
+ return build_type_attribute_variant (t1, attributes);
+ if (TYPE_IS_SIZETYPE (t2) > TYPE_IS_SIZETYPE (t1))
+ return build_type_attribute_variant (t2, attributes);
+
+ /* If one is unsigned long long, then convert the other to unsigned
+ long long. */
+ if (same_type_p (TYPE_MAIN_VARIANT (t1), long_long_unsigned_type_node)
+ || same_type_p (TYPE_MAIN_VARIANT (t2), long_long_unsigned_type_node))
+ return build_type_attribute_variant (long_long_unsigned_type_node,
+ attributes);
+ /* If one is a long long, and the other is an unsigned long, and
+ long long can represent all the values of an unsigned long, then
+ convert to a long long. Otherwise, convert to an unsigned long
+ long. Otherwise, if either operand is long long, convert the
+ other to long long.
+
+ Since we're here, we know the TYPE_PRECISION is the same;
+ therefore converting to long long cannot represent all the values
+ of an unsigned long, so we choose unsigned long long in that
+ case. */
+ if (same_type_p (TYPE_MAIN_VARIANT (t1), long_long_integer_type_node)
+ || same_type_p (TYPE_MAIN_VARIANT (t2), long_long_integer_type_node))
+ {
+ tree t = ((TREE_UNSIGNED (t1) || TREE_UNSIGNED (t2))
+ ? long_long_unsigned_type_node
+ : long_long_integer_type_node);
+ return build_type_attribute_variant (t, attributes);
+ }
+
+ /* Go through the same procedure, but for longs. */
+ if (same_type_p (TYPE_MAIN_VARIANT (t1), long_unsigned_type_node)
+ || same_type_p (TYPE_MAIN_VARIANT (t2), long_unsigned_type_node))
+ return build_type_attribute_variant (long_unsigned_type_node,
+ attributes);
+ if (same_type_p (TYPE_MAIN_VARIANT (t1), long_integer_type_node)
+ || same_type_p (TYPE_MAIN_VARIANT (t2), long_integer_type_node))
+ {
+ tree t = ((TREE_UNSIGNED (t1) || TREE_UNSIGNED (t2))
+ ? long_unsigned_type_node : long_integer_type_node);
+ return build_type_attribute_variant (t, attributes);
+ }
+ /* Otherwise prefer the unsigned one. */
+ if (TREE_UNSIGNED (t1))
+ return build_type_attribute_variant (t1, attributes);
+ else
+ return build_type_attribute_variant (t2, attributes);
+ }
+ else
+ {
+ if (same_type_p (TYPE_MAIN_VARIANT (t1), long_double_type_node)
+ || same_type_p (TYPE_MAIN_VARIANT (t2), long_double_type_node))
+ return build_type_attribute_variant (long_double_type_node,
+ attributes);
+ if (same_type_p (TYPE_MAIN_VARIANT (t1), double_type_node)
+ || same_type_p (TYPE_MAIN_VARIANT (t2), double_type_node))
+ return build_type_attribute_variant (double_type_node,
+ attributes);
+ else
+ return build_type_attribute_variant (float_type_node,
+ attributes);
+ }
+}
+
+/* Return the composite pointer type (see [expr.rel]) for T1 and T2.
+ ARG1 and ARG2 are the values with those types. The LOCATION is a
+ string describing the current location, in case an error occurs. */
+
+tree
+composite_pointer_type (t1, t2, arg1, arg2, location)
+ tree t1;
+ tree t2;
+ tree arg1;
+ tree arg2;
+ const char* location;
+{
+ tree result_type;
+
+ /* [expr.rel]
+
+ If one operand is a null pointer constant, the composite pointer
+ type is the type of the other operand. */
+ if (null_ptr_cst_p (arg1))
+ return t2;
+ if (null_ptr_cst_p (arg2))
+ return t1;
+
+ /* Deal with pointer-to-member functions in the same way as we deal
+ with pointers to functions. */
+ if (TYPE_PTRMEMFUNC_P (t1))
+ t1 = TYPE_PTRMEMFUNC_FN_TYPE (t1);
+ if (TYPE_PTRMEMFUNC_P (t2))
+ t2 = TYPE_PTRMEMFUNC_FN_TYPE (t2);
+
+ /* We have:
+
+ [expr.rel]
+
+ If one of the operands has type "pointer to cv1 void*", then
+ the other has type "pointer to cv2T", and the composite pointer
+ type is "pointer to cv12 void", where cv12 is the union of cv1
+ and cv2.
+
+ If either type is a pointer to void, make sure it is T1. */
+ if (VOID_TYPE_P (TREE_TYPE (t2)))
+ {
+ tree t;
+ t = t1;
+ t1 = t2;
+ t2 = t;
+ }
+ /* Now, if T1 is a pointer to void, merge the qualifiers. */
+ if (VOID_TYPE_P (TREE_TYPE (t1)))
+ {
+ if (pedantic && TYPE_PTRFN_P (t2))
+ pedwarn ("ISO C++ forbids %s between pointer of type `void *' and pointer-to-function", location);
+ t1 = TREE_TYPE (t1);
+ t2 = TREE_TYPE (t2);
+ result_type = cp_build_qualified_type (void_type_node,
+ (cp_type_quals (t1)
+ | cp_type_quals (t2)));
+ result_type = build_pointer_type (result_type);
+ }
+ else
+ {
+ tree full1 = qualify_type_recursive (t1, t2);
+ tree full2 = qualify_type_recursive (t2, t1);
+
+ int val = comp_target_types (full1, full2, 1);
+
+ if (val > 0)
+ result_type = full1;
+ else if (val < 0)
+ result_type = full2;
+ else
+ {
+ pedwarn ("%s between distinct pointer types `%T' and `%T' lacks a cast",
+ location, t1, t2);
+ result_type = ptr_type_node;
+ }
+ }
+
+ return result_type;
+}
+
/* Return the common type of two types.
We assume that comptypes has already been done and returned 1;
if that isn't so, this may crash.
@@ -433,43 +539,12 @@ common_type (t1, t2)
if (t2 == error_mark_node)
return t1;
- /* Merge the attributes. */
- attributes = merge_machine_type_attributes (t1, t2);
-
- { register tree a1, a2;
- a1 = TYPE_ATTRIBUTES (t1);
- a2 = TYPE_ATTRIBUTES (t2);
-
- /* Either one unset? Take the set one. */
+ if ((ARITHMETIC_TYPE_P (t1) || TREE_CODE (t1) == ENUMERAL_TYPE)
+ && (ARITHMETIC_TYPE_P (t2) || TREE_CODE (t2) == ENUMERAL_TYPE))
+ return type_after_usual_arithmetic_conversions (t1, t2);
- if (!(attributes = a1))
- attributes = a2;
-
- /* One that completely contains the other? Take it. */
-
- else if (a2 && !attribute_list_contained (a1, a2))
- {
- if (attribute_list_contained (a2, a1))
- attributes = a2;
- else
- {
- /* Pick the longest list, and hang on the other list. */
- /* ??? For the moment we punt on the issue of attrs with args. */
-
- if (list_length (a1) < list_length (a2))
- attributes = a2, a2 = a1;
-
- for (; a2; a2 = TREE_CHAIN (a2))
- if (lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (a2)),
- attributes) == NULL_TREE)
- {
- a1 = copy_node (a2);
- TREE_CHAIN (a1) = attributes;
- attributes = a1;
- }
- }
- }
- }
+ /* Merge the attributes. */
+ attributes = (*targetm.merge_type_attributes) (t1, t2);
/* Treat an enum type as the unsigned integer type of the same width. */
@@ -508,58 +583,17 @@ common_type (t1, t2)
{
case INTEGER_TYPE:
case REAL_TYPE:
- /* If only one is real, use it as the result. */
-
- if (code1 == REAL_TYPE && code2 != REAL_TYPE)
- return build_type_attribute_variant (t1, attributes);
-
- if (code2 == REAL_TYPE && code1 != REAL_TYPE)
- return build_type_attribute_variant (t2, attributes);
-
- /* Both real or both integers; use the one with greater precision. */
-
- if (TYPE_PRECISION (t1) > TYPE_PRECISION (t2))
- return build_type_attribute_variant (t1, attributes);
- else if (TYPE_PRECISION (t2) > TYPE_PRECISION (t1))
- return build_type_attribute_variant (t2, attributes);
-
- /* Same precision. Prefer longs to ints even when same size. */
-
- if (TYPE_MAIN_VARIANT (t1) == long_unsigned_type_node
- || TYPE_MAIN_VARIANT (t2) == long_unsigned_type_node)
- return build_type_attribute_variant (long_unsigned_type_node,
- attributes);
-
- if (TYPE_MAIN_VARIANT (t1) == long_integer_type_node
- || TYPE_MAIN_VARIANT (t2) == long_integer_type_node)
- {
- /* But preserve unsignedness from the other type,
- since long cannot hold all the values of an unsigned int. */
- if (TREE_UNSIGNED (t1) || TREE_UNSIGNED (t2))
- t1 = long_unsigned_type_node;
- else
- t1 = long_integer_type_node;
- return build_type_attribute_variant (t1, attributes);
- }
-
- if (TYPE_MAIN_VARIANT (t1) == long_double_type_node
- || TYPE_MAIN_VARIANT (t2) == long_double_type_node)
- return build_type_attribute_variant (long_double_type_node,
- attributes);
-
- /* Otherwise prefer the unsigned one. */
-
- if (TREE_UNSIGNED (t1))
- return build_type_attribute_variant (t1, attributes);
- else
- return build_type_attribute_variant (t2, attributes);
+ /* We should have called type_after_usual_arithmetic_conversions
+ above. */
+ abort ();
+ break;
case POINTER_TYPE:
case REFERENCE_TYPE:
/* For two pointers, do this recursively on the target type,
and combine the qualifiers of the two types' targets. */
/* This code was turned off; I don't know why.
- But ANSI C++ specifies doing this with the qualifiers.
+ But ISO C++ specifies doing this with the qualifiers.
So I turned it on again. */
{
tree tt1 = TREE_TYPE (t1);
@@ -578,18 +612,13 @@ common_type (t1, t2)
else
b1 = b2 = NULL_TREE;
- type_quals = (CP_TYPE_QUALS (tt1) | CP_TYPE_QUALS (tt2));
+ type_quals = (cp_type_quals (tt1) | cp_type_quals (tt2));
tt1 = TYPE_MAIN_VARIANT (tt1);
tt2 = TYPE_MAIN_VARIANT (tt2);
if (tt1 == tt2)
target = tt1;
- else if (b1)
- {
- compiler_error ("common_type called with uncommon member types");
- target = tt1;
- }
- else if (tt1 == void_type_node || tt2 == void_type_node)
+ else if (VOID_TYPE_P (tt1) || VOID_TYPE_P (tt2))
target = void_type_node;
else if (tt1 == unknown_type_node)
target = tt2;
@@ -730,20 +759,109 @@ common_type (t1, t2)
case OFFSET_TYPE:
/* Pointers to members should now be handled by the POINTER_TYPE
case above. */
- my_friendly_abort (990325);
+ abort ();
default:
return build_type_attribute_variant (t1, attributes);
}
}
-/* Return 1 if TYPE1 and TYPE2 raise the same exceptions. */
+/* Compare two exception specifier types for exactness or subsetness, if
+ allowed. Returns 0 for mismatch, 1 for same, 2 if B is allowed by A.
+
+ [except.spec] "If a class X ... objects of class X or any class publicly
+ and unambigously derrived from X. Similarly, if a pointer type Y * ...
+ exceptions of type Y * or that are pointers to any type publicly and
+ unambigously derrived from Y. Otherwise a function only allows exceptions
+ that have the same type ..."
+ This does not mention cv qualifiers and is different to what throw
+ [except.throw] and catch [except.catch] will do. They will ignore the
+ top level cv qualifiers, and allow qualifiers in the pointer to class
+ example.
+
+ We implement the letter of the standard. */
+
+static int
+comp_except_types (a, b, exact)
+ tree a, b;
+ int exact;
+{
+ if (same_type_p (a, b))
+ return 1;
+ else if (!exact)
+ {
+ if (cp_type_quals (a) || cp_type_quals (b))
+ return 0;
+
+ if (TREE_CODE (a) == POINTER_TYPE
+ && TREE_CODE (b) == POINTER_TYPE)
+ {
+ a = TREE_TYPE (a);
+ b = TREE_TYPE (b);
+ if (cp_type_quals (a) || cp_type_quals (b))
+ return 0;
+ }
+
+ if (TREE_CODE (a) != RECORD_TYPE
+ || TREE_CODE (b) != RECORD_TYPE)
+ return 0;
+
+ if (ACCESSIBLY_UNIQUELY_DERIVED_P (a, b))
+ return 2;
+ }
+ return 0;
+}
+
+/* Return 1 if TYPE1 and TYPE2 are equivalent exception specifiers.
+ If EXACT is 0, T2 can be a subset of T1 (according to 15.4/7),
+ otherwise it must be exact. Exception lists are unordered, but
+ we've already filtered out duplicates. Most lists will be in order,
+ we should try to make use of that. */
int
-compexcepttypes (t1, t2)
+comp_except_specs (t1, t2, exact)
tree t1, t2;
+ int exact;
{
- return TYPE_RAISES_EXCEPTIONS (t1) == TYPE_RAISES_EXCEPTIONS (t2);
+ tree probe;
+ tree base;
+ int length = 0;
+
+ if (t1 == t2)
+ return 1;
+
+ if (t1 == NULL_TREE) /* T1 is ... */
+ return t2 == NULL_TREE || !exact;
+ if (!TREE_VALUE (t1)) /* t1 is EMPTY */
+ return t2 != NULL_TREE && !TREE_VALUE (t2);
+ if (t2 == NULL_TREE) /* T2 is ... */
+ return 0;
+ if (TREE_VALUE(t1) && !TREE_VALUE (t2)) /* T2 is EMPTY, T1 is not */
+ return !exact;
+
+ /* Neither set is ... or EMPTY, make sure each part of T2 is in T1.
+ Count how many we find, to determine exactness. For exact matching and
+ ordered T1, T2, this is an O(n) operation, otherwise its worst case is
+ O(nm). */
+ for (base = t1; t2 != NULL_TREE; t2 = TREE_CHAIN (t2))
+ {
+ for (probe = base; probe != NULL_TREE; probe = TREE_CHAIN (probe))
+ {
+ tree a = TREE_VALUE (probe);
+ tree b = TREE_VALUE (t2);
+
+ if (comp_except_types (a, b, exact))
+ {
+ if (probe == base && exact)
+ base = TREE_CHAIN (probe);
+ length++;
+ break;
+ }
+ }
+ if (probe == NULL_TREE)
+ return 0;
+ }
+ return !exact || base == NULL_TREE || length == list_length (t1);
}
/* Compare the array types T1 and T2, using CMP as the type comparison
@@ -751,7 +869,7 @@ compexcepttypes (t1, t2)
static int
comp_array_types (cmp, t1, t2, strict)
- register int (*cmp) PROTO((tree, tree, int));
+ register int (*cmp) PARAMS ((tree, tree, int));
tree t1, t2;
int strict;
{
@@ -795,17 +913,16 @@ comp_array_types (cmp, t1, t2, strict)
TYPE_MAX_VALUE (d2)));
}
-/* Return 1 if TYPE1 and TYPE2 are compatible types for assignment
- or various other operations. STRICT is a bitwise-or of the
- COMPARE_* flags. */
+/* Return 1 if T1 and T2 are compatible types for assignment or
+ various other operations. STRICT is a bitwise-or of the COMPARE_*
+ flags. */
int
-comptypes (type1, type2, strict)
- tree type1, type2;
+comptypes (t1, t2, strict)
+ tree t1;
+ tree t2;
int strict;
{
- register tree t1 = type1;
- register tree t2 = type2;
int attrval, val;
int orig_strict = strict;
@@ -828,6 +945,16 @@ comptypes (type1, type2, strict)
if (t2 == error_mark_node)
return 0;
+ /* If either type is the internal version of sizetype, return the
+ language version. */
+ if (TREE_CODE (t1) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t1)
+ && TYPE_DOMAIN (t1) != 0)
+ t1 = TYPE_DOMAIN (t1);
+
+ if (TREE_CODE (t2) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t2)
+ && TYPE_DOMAIN (t2) != 0)
+ t2 = TYPE_DOMAIN (t2);
+
if (strict & COMPARE_RELAXED)
{
/* Treat an enum type as the unsigned integer type of the same width. */
@@ -851,7 +978,7 @@ comptypes (type1, type2, strict)
return 0;
/* Qualifiers must match. */
- if (CP_TYPE_QUALS (t1) != CP_TYPE_QUALS (t2))
+ if (cp_type_quals (t1) != cp_type_quals (t2))
return 0;
if (strict == COMPARE_STRICT
&& TYPE_FOR_JAVA (t1) != TYPE_FOR_JAVA (t2))
@@ -864,16 +991,10 @@ comptypes (type1, type2, strict)
if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
return 1;
- /* ??? COMP_TYPE_ATTRIBUTES is currently useless for variables as each
- attribute is its own main variant (`val' will remain 0). */
-#ifndef COMP_TYPE_ATTRIBUTES
-#define COMP_TYPE_ATTRIBUTES(t1,t2) 1
-#endif
-
if (strict & COMPARE_NO_ATTRIBUTES)
attrval = 1;
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
- else if (! (attrval = COMP_TYPE_ATTRIBUTES (t1, t2)))
+ else if (! (attrval = (*targetm.comp_type_attributes) (t1, t2)))
return 0;
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
@@ -882,14 +1003,15 @@ comptypes (type1, type2, strict)
switch (TREE_CODE (t1))
{
case TEMPLATE_TEMPLATE_PARM:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
if (TEMPLATE_TYPE_IDX (t1) != TEMPLATE_TYPE_IDX (t2)
|| TEMPLATE_TYPE_LEVEL (t1) != TEMPLATE_TYPE_LEVEL (t2))
return 0;
- if (! comp_template_parms (DECL_TEMPLATE_PARMS (TYPE_NAME (t1)),
- DECL_TEMPLATE_PARMS (TYPE_NAME (t2))))
+ if (! comp_template_parms
+ (DECL_TEMPLATE_PARMS (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t1)),
+ DECL_TEMPLATE_PARMS (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t2))))
return 0;
- if (!TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t1)
- && ! TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t2))
+ if (TREE_CODE (t1) == TEMPLATE_TEMPLATE_PARM)
return 1;
/* Don't check inheritance. */
strict = COMPARE_STRICT;
@@ -899,20 +1021,14 @@ comptypes (type1, type2, strict)
case UNION_TYPE:
if (TYPE_TEMPLATE_INFO (t1) && TYPE_TEMPLATE_INFO (t2)
&& (TYPE_TI_TEMPLATE (t1) == TYPE_TI_TEMPLATE (t2)
- || TREE_CODE (t1) == TEMPLATE_TEMPLATE_PARM))
+ || TREE_CODE (t1) == BOUND_TEMPLATE_TEMPLATE_PARM))
val = comp_template_args (TYPE_TI_ARGS (t1),
TYPE_TI_ARGS (t2));
look_hard:
if ((strict & COMPARE_BASE) && DERIVED_FROM_P (t1, t2))
- {
- val = 1;
- break;
- }
- if ((strict & COMPARE_RELAXED) && DERIVED_FROM_P (t2, t1))
- {
- val = 1;
- break;
- }
+ val = 1;
+ else if ((strict & COMPARE_RELAXED) && DERIVED_FROM_P (t2, t1))
+ val = 1;
break;
case OFFSET_TYPE:
@@ -922,7 +1038,8 @@ comptypes (type1, type2, strict)
break;
case METHOD_TYPE:
- if (! compexcepttypes (t1, t2))
+ if (! comp_except_specs (TYPE_RAISES_EXCEPTIONS (t1),
+ TYPE_RAISES_EXCEPTIONS (t2), 1))
return 0;
/* This case is anti-symmetrical!
@@ -949,7 +1066,8 @@ comptypes (type1, type2, strict)
break;
case FUNCTION_TYPE:
- if (! compexcepttypes (t1, t2))
+ if (! comp_except_specs (TYPE_RAISES_EXCEPTIONS (t1),
+ TYPE_RAISES_EXCEPTIONS (t2), 1))
return 0;
val = ((TREE_TYPE (t1) == TREE_TYPE (t2)
@@ -969,10 +1087,20 @@ comptypes (type1, type2, strict)
&& TEMPLATE_TYPE_LEVEL (t1) == TEMPLATE_TYPE_LEVEL (t2);
case TYPENAME_TYPE:
- if (TYPE_IDENTIFIER (t1) != TYPE_IDENTIFIER (t2))
- return 0;
+ if (cp_tree_equal (TYPENAME_TYPE_FULLNAME (t1),
+ TYPENAME_TYPE_FULLNAME (t2)) < 1)
+ return 0;
+ return same_type_p (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2));
+
+ case UNBOUND_CLASS_TEMPLATE:
+ if (cp_tree_equal (TYPE_IDENTIFIER (t1),
+ TYPE_IDENTIFIER (t2)) < 1)
+ return 0;
return same_type_p (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2));
+ case COMPLEX_TYPE:
+ return same_type_p (TREE_TYPE (t1), TREE_TYPE (t2));
+
default:
break;
}
@@ -1121,7 +1249,7 @@ comp_target_types (ttl, ttr, nptrs)
argsr = TREE_CHAIN (argsr);
}
- switch (comp_target_parms (argsl, argsr, 1))
+ switch (comp_target_parms (argsl, argsr))
{
case 0:
return 0;
@@ -1194,8 +1322,8 @@ at_least_as_qualified_p (type1, type2)
tree type2;
{
/* All qualifiers for TYPE2 must also appear in TYPE1. */
- return ((CP_TYPE_QUALS (type1) & CP_TYPE_QUALS (type2))
- == CP_TYPE_QUALS (type2));
+ return ((cp_type_quals (type1) & cp_type_quals (type2))
+ == cp_type_quals (type2));
}
/* Returns 1 if TYPE1 is more qualified than TYPE2. */
@@ -1205,7 +1333,7 @@ more_qualified_p (type1, type2)
tree type1;
tree type2;
{
- return (CP_TYPE_QUALS (type1) != CP_TYPE_QUALS (type2)
+ return (cp_type_quals (type1) != cp_type_quals (type2)
&& at_least_as_qualified_p (type1, type2));
}
@@ -1217,7 +1345,7 @@ comp_cv_qualification (type1, type2)
tree type1;
tree type2;
{
- if (CP_TYPE_QUALS (type1) == CP_TYPE_QUALS (type2))
+ if (cp_type_quals (type1) == cp_type_quals (type2))
return 0;
if (at_least_as_qualified_p (type1, type2))
@@ -1342,9 +1470,8 @@ compparms (parms1, parms2)
(jason 17 Apr 1997) */
static int
-comp_target_parms (parms1, parms2, strict)
+comp_target_parms (parms1, parms2)
tree parms1, parms2;
- int strict;
{
register tree t1 = parms1, t2 = parms2;
int warn_contravariance = 0;
@@ -1355,13 +1482,8 @@ comp_target_parms (parms1, parms2, strict)
if (t1 == 0 && t2 != 0)
{
- if (! flag_strict_prototype && t2 == void_list_node)
- /* t1 might be the arglist of a function pointer in extern "C"
- declared to take (), which we fudged to (...). Don't make the
- user pay for our mistake. */;
- else
- cp_pedwarn ("ANSI C++ prohibits conversion from `%#T' to `(...)'",
- parms2);
+ pedwarn ("ISO C++ prohibits conversion from `%#T' to `(...)'",
+ parms2);
return self_promoting_args_p (t2);
}
if (t2 == 0)
@@ -1374,13 +1496,7 @@ comp_target_parms (parms1, parms2, strict)
/* If one parmlist is shorter than the other,
they fail to match, unless STRICT is <= 0. */
if (t1 == 0 || t2 == 0)
- {
- if (strict > 0)
- return 0;
- if (strict < 0)
- return 1 + warn_contravariance;
- return ((t1 && TREE_PURPOSE (t1)) + warn_contravariance);
- }
+ return 0;
p1 = TREE_VALUE (t1);
p2 = TREE_VALUE (t2);
if (same_type_p (p1, p2))
@@ -1393,11 +1509,6 @@ comp_target_parms (parms1, parms2, strict)
|| (TREE_CODE (p1) == REFERENCE_TYPE
&& TREE_CODE (p2) == REFERENCE_TYPE))
{
- if (strict <= 0
- && (TYPE_MAIN_VARIANT (TREE_TYPE (p1))
- == TYPE_MAIN_VARIANT (TREE_TYPE (p2))))
- continue;
-
/* The following is wrong for contravariance,
but many programs depend on it. */
if (TREE_TYPE (p1) == void_type_node)
@@ -1408,8 +1519,8 @@ comp_target_parms (parms1, parms2, strict)
continue;
}
if (IS_AGGR_TYPE (TREE_TYPE (p1))
- && !same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (p1)),
- TYPE_MAIN_VARIANT (TREE_TYPE (p2))))
+ && !same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (p1),
+ TREE_TYPE (p2)))
return 0;
}
/* Note backwards order due to contravariance. */
@@ -1420,134 +1531,12 @@ comp_target_parms (parms1, parms2, strict)
warn_contravariance = 1;
continue;
}
- if (strict != 0)
- return 0;
+ return 0;
}
}
return warn_contravariance ? -1 : 1;
}
-
-/* Return 1 if PARMS specifies a fixed number of parameters
- and none of their types is affected by default promotions. */
-
-int
-self_promoting_args_p (parms)
- tree parms;
-{
- register tree t;
- for (t = parms; t; t = TREE_CHAIN (t))
- {
- register tree type = TREE_VALUE (t);
-
- if (TREE_CHAIN (t) == 0 && type != void_type_node)
- return 0;
-
- if (type == 0)
- return 0;
-
- if (TYPE_MAIN_VARIANT (type) == float_type_node)
- return 0;
-
- if (C_PROMOTING_INTEGER_TYPE_P (type))
- return 0;
- }
- return 1;
-}
-/* Return an unsigned type the same as TYPE in other respects.
-
- C++: must make these work for type variants as well. */
-
-tree
-unsigned_type (type)
- tree type;
-{
- tree type1 = TYPE_MAIN_VARIANT (type);
- if (type1 == signed_char_type_node || type1 == char_type_node)
- return unsigned_char_type_node;
- if (type1 == integer_type_node)
- return unsigned_type_node;
- if (type1 == short_integer_type_node)
- return short_unsigned_type_node;
- if (type1 == long_integer_type_node)
- return long_unsigned_type_node;
- if (type1 == long_long_integer_type_node)
- return long_long_unsigned_type_node;
-#if HOST_BITS_PER_WIDE_INT >= 64
- if (type1 == intTI_type_node)
- return unsigned_intTI_type_node;
-#endif
- if (type1 == intDI_type_node)
- return unsigned_intDI_type_node;
- if (type1 == intSI_type_node)
- return unsigned_intSI_type_node;
- if (type1 == intHI_type_node)
- return unsigned_intHI_type_node;
- if (type1 == intQI_type_node)
- return unsigned_intQI_type_node;
-
- return signed_or_unsigned_type (1, type);
-}
-
-/* Return a signed type the same as TYPE in other respects. */
-
-tree
-signed_type (type)
- tree type;
-{
- tree type1 = TYPE_MAIN_VARIANT (type);
- if (type1 == unsigned_char_type_node || type1 == char_type_node)
- return signed_char_type_node;
- if (type1 == unsigned_type_node)
- return integer_type_node;
- if (type1 == short_unsigned_type_node)
- return short_integer_type_node;
- if (type1 == long_unsigned_type_node)
- return long_integer_type_node;
- if (type1 == long_long_unsigned_type_node)
- return long_long_integer_type_node;
-#if HOST_BITS_PER_WIDE_INT >= 64
- if (type1 == unsigned_intTI_type_node)
- return intTI_type_node;
-#endif
- if (type1 == unsigned_intDI_type_node)
- return intDI_type_node;
- if (type1 == unsigned_intSI_type_node)
- return intSI_type_node;
- if (type1 == unsigned_intHI_type_node)
- return intHI_type_node;
- if (type1 == unsigned_intQI_type_node)
- return intQI_type_node;
-
- return signed_or_unsigned_type (0, type);
-}
-
-/* Return a type the same as TYPE except unsigned or
- signed according to UNSIGNEDP. */
-
-tree
-signed_or_unsigned_type (unsignedp, type)
- int unsignedp;
- tree type;
-{
- if (! INTEGRAL_TYPE_P (type)
- || TREE_UNSIGNED (type) == unsignedp)
- return type;
-
- if (TYPE_PRECISION (type) == TYPE_PRECISION (signed_char_type_node))
- return unsignedp ? unsigned_char_type_node : signed_char_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
- return unsignedp ? unsigned_type_node : integer_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (short_integer_type_node))
- return unsignedp ? short_unsigned_type_node : short_integer_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (long_integer_type_node))
- return unsignedp ? long_unsigned_type_node : long_integer_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (long_long_integer_type_node))
- return (unsignedp ? long_long_unsigned_type_node
- : long_long_integer_type_node);
- return type;
-}
-
/* Compute the value of the `sizeof' operator. */
tree
@@ -1555,99 +1544,94 @@ c_sizeof (type)
tree type;
{
enum tree_code code = TREE_CODE (type);
- tree t;
+ tree size;
if (processing_template_decl)
- return build_min (SIZEOF_EXPR, sizetype, type);
+ return build_min_nt (SIZEOF_EXPR, type);
if (code == FUNCTION_TYPE)
{
if (pedantic || warn_pointer_arith)
- pedwarn ("ANSI C++ forbids taking the sizeof a function type");
- return size_int (1);
+ pedwarn ("ISO C++ forbids applying `sizeof' to a function type");
+ size = size_one_node;
}
- if (code == METHOD_TYPE)
+ else if (code == METHOD_TYPE)
{
if (pedantic || warn_pointer_arith)
- pedwarn ("ANSI C++ forbids taking the sizeof a method type");
- return size_int (1);
+ pedwarn ("ISO C++ forbids applying `sizeof' to a member function");
+ size = size_one_node;
}
- if (code == VOID_TYPE)
+ else if (code == VOID_TYPE)
{
if (pedantic || warn_pointer_arith)
- pedwarn ("ANSI C++ forbids taking the sizeof a void type");
- return size_int (1);
+ pedwarn ("ISO C++ forbids applying `sizeof' to type `void' which is an incomplete type");
+ size = size_one_node;
}
- if (code == ERROR_MARK)
- return size_int (1);
-
- /* ARM $5.3.2: ``When applied to a reference, the result is the size of the
- referenced object.'' */
- if (code == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- /* We couldn't find anything in the ARM or the draft standard that says,
- one way or the other, if doing sizeof on something that doesn't have
- an object associated with it is correct or incorrect. For example, if
- you declare `struct S { char str[16]; };', and in your program do
- a `sizeof (S::str)', should we flag that as an error or should we give
- the size of it? Since it seems like a reasonable thing to do, we'll go
- with giving the value. */
- if (code == OFFSET_TYPE)
- type = TREE_TYPE (type);
-
- /* @@ This also produces an error for a signature ref.
- In that case we should be able to do better. */
- if (IS_SIGNATURE (type))
- {
- error ("`sizeof' applied to a signature type");
- return size_int (0);
- }
-
- if (TYPE_SIZE (complete_type (type)) == 0)
+ else if (code == ERROR_MARK)
+ size = size_one_node;
+ else
{
- cp_error ("`sizeof' applied to incomplete type `%T'", type);
- return size_int (0);
- }
+ /* ARM $5.3.2: ``When applied to a reference, the result is the
+ size of the referenced object.'' */
+ if (code == REFERENCE_TYPE)
+ type = TREE_TYPE (type);
- /* Convert in case a char is more than one unit. */
- t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type),
- size_int (TYPE_PRECISION (char_type_node)));
- t = convert (sizetype, t);
- /* size_binop does not put the constant in range, so do it now. */
- if (TREE_CODE (t) == INTEGER_CST && force_fit_type (t, 0))
- TREE_CONSTANT_OVERFLOW (t) = TREE_OVERFLOW (t) = 1;
- return t;
+ if (code == OFFSET_TYPE)
+ {
+ error ("`sizeof' applied to non-static member");
+ size = size_zero_node;
+ }
+ else if (!COMPLETE_TYPE_P (complete_type (type)))
+ {
+ error ("`sizeof' applied to incomplete type `%T'", type);
+ size = size_zero_node;
+ }
+ else
+ /* Convert in case a char is more than one unit. */
+ size = size_binop (CEIL_DIV_EXPR, TYPE_SIZE_UNIT (type),
+ size_int (TYPE_PRECISION (char_type_node)
+ / BITS_PER_UNIT));
+ }
+
+ /* SIZE will have an integer type with TYPE_IS_SIZETYPE set.
+ TYPE_IS_SIZETYPE means that certain things (like overflow) will
+ never happen. However, this node should really have type
+ `size_t', which is just a typedef for an ordinary integer type. */
+ size = fold (build1 (NOP_EXPR, c_size_type_node, size));
+ my_friendly_assert (!TYPE_IS_SIZETYPE (TREE_TYPE (size)),
+ 20001021);
+ return size;
}
+
tree
expr_sizeof (e)
tree e;
{
if (processing_template_decl)
- return build_min (SIZEOF_EXPR, sizetype, e);
+ return build_min_nt (SIZEOF_EXPR, e);
if (TREE_CODE (e) == COMPONENT_REF
&& DECL_C_BIT_FIELD (TREE_OPERAND (e, 1)))
error ("sizeof applied to a bit-field");
- /* ANSI says arrays and functions are converted inside comma.
- But we can't really convert them in build_compound_expr
- because that would break commas in lvalues.
- So do the conversion here if operand was a comma. */
- if (TREE_CODE (e) == COMPOUND_EXPR
- && (TREE_CODE (TREE_TYPE (e)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (e)) == FUNCTION_TYPE))
- e = default_conversion (e);
- else if (is_overloaded_fn (e))
- {
- pedwarn ("ANSI C++ forbids taking the sizeof a function type");
- return size_int (1);
+ if (is_overloaded_fn (e))
+ {
+ pedwarn ("ISO C++ forbids applying `sizeof' to an expression of function type");
+ return c_sizeof (char_type_node);
}
else if (type_unknown_p (e))
{
incomplete_type_error (e, TREE_TYPE (e));
- return size_int (1);
+ return c_sizeof (char_type_node);
}
+ /* It's illegal to say `sizeof (X::i)' for `i' a non-static data
+ member unless you're in a non-static member of X. So hand off to
+ resolve_offset_ref. [expr.prim] */
+ else if (TREE_CODE (e) == OFFSET_REF)
+ e = resolve_offset_ref (e);
+
+ if (e == error_mark_node)
+ return e;
return c_sizeof (TREE_TYPE (e));
}
@@ -1657,67 +1641,41 @@ c_sizeof_nowarn (type)
tree type;
{
enum tree_code code = TREE_CODE (type);
- tree t;
+ tree size;
if (code == FUNCTION_TYPE
|| code == METHOD_TYPE
|| code == VOID_TYPE
|| code == ERROR_MARK)
- return size_int (1);
- if (code == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- if (TYPE_SIZE (type) == 0)
- return size_int (0);
-
- /* Convert in case a char is more than one unit. */
- t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type),
- size_int (TYPE_PRECISION (char_type_node)));
- t = convert (sizetype, t);
- force_fit_type (t, 0);
- return t;
-}
-
-/* Implement the __alignof keyword: Return the minimum required
- alignment of TYPE, measured in bytes. */
-
-tree
-c_alignof (type)
- tree type;
-{
- enum tree_code code = TREE_CODE (type);
- tree t;
-
- if (processing_template_decl)
- return build_min (ALIGNOF_EXPR, sizetype, type);
-
- if (code == FUNCTION_TYPE || code == METHOD_TYPE)
- return size_int (FUNCTION_BOUNDARY / BITS_PER_UNIT);
-
- if (code == VOID_TYPE || code == ERROR_MARK)
- return size_int (1);
-
- /* C++: this is really correct! */
- if (code == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- /* @@ This also produces an error for a signature ref.
- In that case we should be able to do better. */
- if (IS_SIGNATURE (type))
+ size = size_one_node;
+ else
{
- error ("`__alignof' applied to a signature type");
- return size_int (1);
- }
+ if (code == REFERENCE_TYPE)
+ type = TREE_TYPE (type);
- t = size_int (TYPE_ALIGN (type) / BITS_PER_UNIT);
- force_fit_type (t, 0);
- return t;
+ if (!COMPLETE_TYPE_P (type))
+ size = size_zero_node;
+ else
+ /* Convert in case a char is more than one unit. */
+ size = size_binop (CEIL_DIV_EXPR, TYPE_SIZE_UNIT (type),
+ size_int (TYPE_PRECISION (char_type_node)
+ / BITS_PER_UNIT));
+ }
+
+ /* SIZE will have an integer type with TYPE_IS_SIZETYPE set.
+ TYPE_IS_SIZETYPE means that certain things (like overflow) will
+ never happen. However, this node should really have type
+ `size_t', which is just a typedef for an ordinary integer type. */
+ size = fold (build1 (NOP_EXPR, c_size_type_node, size));
+ my_friendly_assert (!TYPE_IS_SIZETYPE (TREE_TYPE (size)),
+ 20001021);
+ return size;
}
/* Perform the array-to-pointer and function-to-pointer conversions
for EXP.
- In addition, references are converted to rvalues and manifest
+ In addition, references are converted to lvalues and manifest
constants are replaced by their values. */
tree
@@ -1740,18 +1698,23 @@ decay_conversion (exp)
code = TREE_CODE (type);
}
+ if (type == error_mark_node)
+ return error_mark_node;
+
+ if (type_unknown_p (exp))
+ {
+ incomplete_type_error (exp, TREE_TYPE (exp));
+ return error_mark_node;
+ }
+
/* Constants can be used directly unless they're not loadable. */
if (TREE_CODE (exp) == CONST_DECL)
exp = DECL_INITIAL (exp);
/* Replace a nonvolatile const static variable with its value. We
don't do this for arrays, though; we want the address of the
first element of the array, not the address of the first element
- of its initializing constant. We *do* replace variables that the
- user isn't really supposed to know about; this is a hack to deal
- with __PRETTY_FUNCTION__ and the like. */
- else if (TREE_READONLY_DECL_P (exp)
- && (code != ARRAY_TYPE
- || (TREE_CODE (exp) == VAR_DECL && DECL_IGNORED_P (exp))))
+ of its initializing constant. */
+ else if (code != ARRAY_TYPE)
{
exp = decl_constant_value (exp);
type = TREE_TYPE (exp);
@@ -1766,7 +1729,7 @@ decay_conversion (exp)
return error_mark_node;
}
if (code == METHOD_TYPE)
- my_friendly_abort (990506);
+ abort ();
if (code == FUNCTION_TYPE || is_overloaded_fn (exp))
return build_unary_op (ADDR_EXPR, exp, 0);
if (code == ARRAY_TYPE)
@@ -1825,6 +1788,11 @@ decay_conversion (exp)
return cp_convert (ptrtype, adr);
}
+ /* [basic.lval]: Class rvalues can have cv-qualified types; non-class
+ rvalues always have cv-unqualified types. */
+ if (! CLASS_TYPE_P (type))
+ exp = cp_convert (TYPE_MAIN_VARIANT (type), exp);
+
return exp;
}
@@ -1901,7 +1869,7 @@ string_conv_p (totype, exp, warn)
/* This warning is not very useful, as it complains about printf. */
if (warn && warn_write_strings)
- cp_warning ("deprecated conversion from string constant to `%T'", totype);
+ warning ("deprecated conversion from string constant to `%T'", totype);
return 1;
}
@@ -1919,15 +1887,10 @@ build_object_ref (datum, basetype, field)
dtype = TREE_TYPE (dtype);
if (! IS_AGGR_TYPE_CODE (TREE_CODE (dtype)))
{
- cp_error ("request for member `%T::%D' in expression of non-aggregate type `%T'",
+ error ("request for member `%T::%D' in expression of non-aggregate type `%T'",
basetype, field, dtype);
return error_mark_node;
}
- else if (IS_SIGNATURE (basetype))
- {
- warning ("signature name in scope resolution ignored");
- return build_component_ref (datum, field, NULL_TREE, 1);
- }
else if (is_aggr_type (basetype, 1))
{
tree binfo = binfo_or_else (basetype, dtype);
@@ -2004,14 +1967,14 @@ lookup_anon_field (t, type)
/* If we find it directly, return the field. */
if (DECL_NAME (field) == NULL_TREE
- && type == TREE_TYPE (field))
+ && type == TYPE_MAIN_VARIANT (TREE_TYPE (field)))
{
return field;
}
/* Otherwise, it could be nested, search harder. */
if (DECL_NAME (field) == NULL_TREE
- && TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
+ && ANON_AGGR_TYPE_P (TREE_TYPE (field)))
{
tree subfield = lookup_anon_field (TREE_TYPE (field), type);
if (subfield)
@@ -2067,7 +2030,7 @@ build_component_ref (datum, component, basetype_path, protect)
basetype_path, protect));
case TEMPLATE_DECL:
- cp_error ("invalid use of %D", datum);
+ error ("invalid use of `%D'", datum);
datum = error_mark_node;
break;
@@ -2094,7 +2057,7 @@ build_component_ref (datum, component, basetype_path, protect)
if (TREE_CODE (component) == TREE_LIST)
{
/* I could not trigger this code. MvL */
- my_friendly_abort (980326);
+ abort ();
#ifdef DEAD
my_friendly_assert (!(TREE_CHAIN (component) == NULL_TREE
&& DECL_CHAIN (TREE_VALUE (component)) == NULL_TREE), 309);
@@ -2105,7 +2068,7 @@ build_component_ref (datum, component, basetype_path, protect)
if (! IS_AGGR_TYPE_CODE (code))
{
if (code != ERROR_MARK)
- cp_error ("request for member `%D' in `%E', which is of non-aggregate type `%T'",
+ error ("request for member `%D' in `%E', which is of non-aggregate type `%T'",
component, datum, basetype);
return error_mark_node;
}
@@ -2117,37 +2080,48 @@ build_component_ref (datum, component, basetype_path, protect)
{
if (TYPE_IDENTIFIER (basetype) != TREE_OPERAND (component, 0))
{
- cp_error ("destructor specifier `%T::~%T' must have matching names",
+ error ("destructor specifier `%T::~%T' must have matching names",
basetype, TREE_OPERAND (component, 0));
return error_mark_node;
}
if (! TYPE_HAS_DESTRUCTOR (basetype))
{
- cp_error ("type `%T' has no destructor", basetype);
+ error ("type `%T' has no destructor", basetype);
return error_mark_node;
}
return TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (basetype), 1);
}
/* Look up component name in the structure type definition. */
- if (CLASSTYPE_VFIELD (basetype)
- && DECL_NAME (CLASSTYPE_VFIELD (basetype)) == component)
+ if (TYPE_VFIELD (basetype)
+ && DECL_NAME (TYPE_VFIELD (basetype)) == component)
/* Special-case this because if we use normal lookups in an ambiguous
hierarchy, the compiler will abort (because vptr lookups are
not supposed to be ambiguous. */
- field = CLASSTYPE_VFIELD (basetype);
+ field = TYPE_VFIELD (basetype);
else if (TREE_CODE (component) == FIELD_DECL)
field = component;
else if (TREE_CODE (component) == TYPE_DECL)
{
- cp_error ("invalid use of type decl `%#D' as expression", component);
+ error ("invalid use of type decl `%#D' as expression", component);
+ return error_mark_node;
+ }
+ else if (TREE_CODE (component) == TEMPLATE_DECL)
+ {
+ error ("invalid use of template `%#D' as expression", component);
return error_mark_node;
}
else
{
tree name = component;
- if (TREE_CODE (component) == VAR_DECL)
+
+ if (TREE_CODE (component) == TEMPLATE_ID_EXPR)
+ name = TREE_OPERAND (component, 0);
+ else if (TREE_CODE (component) == VAR_DECL)
name = DECL_NAME (component);
+ if (TREE_CODE (component) == NAMESPACE_DECL)
+ /* Source is in error, but produce a sensible diagnostic. */
+ name = DECL_NAME (component);
if (basetype_path == NULL_TREE)
basetype_path = TYPE_BINFO (basetype);
field = lookup_field (basetype_path, name,
@@ -2176,7 +2150,7 @@ build_component_ref (datum, component, basetype_path, protect)
if (DECL_STATIC_FUNCTION_P (TREE_VALUE (fndecls)))
{
tree fndecl = TREE_VALUE (fndecls);
- enforce_access (TREE_PURPOSE (fndecls), fndecl);
+ enforce_access (basetype_path, fndecl);
mark_used (fndecl);
return fndecl;
}
@@ -2187,16 +2161,22 @@ build_component_ref (datum, component, basetype_path, protect)
unknown_type_node to be really overloaded, so
let's oblige. */
TREE_VALUE (fndecls)
- = scratch_ovl_cons (TREE_VALUE (fndecls), NULL_TREE);
+ = ovl_cons (TREE_VALUE (fndecls), NULL_TREE);
}
}
+ fndecls = TREE_VALUE (fndecls);
+
+ if (TREE_CODE (component) == TEMPLATE_ID_EXPR)
+ fndecls = build_nt (TEMPLATE_ID_EXPR,
+ fndecls, TREE_OPERAND (component, 1));
+
ref = build (COMPONENT_REF, unknown_type_node,
- datum, TREE_VALUE (fndecls));
+ datum, fndecls);
return ref;
}
- cp_error ("`%#T' has no member named `%D'", basetype, name);
+ error ("`%#T' has no member named `%D'", basetype, name);
return error_mark_node;
}
else if (TREE_TYPE (field) == error_mark_node)
@@ -2205,15 +2185,23 @@ build_component_ref (datum, component, basetype_path, protect)
if (TREE_CODE (field) != FIELD_DECL)
{
if (TREE_CODE (field) == TYPE_DECL)
- cp_pedwarn ("invalid use of type decl `%#D' as expression", field);
+ pedwarn ("invalid use of type decl `%#D' as expression", field);
else if (DECL_RTL (field) != 0)
mark_used (field);
else
TREE_USED (field) = 1;
+
+ /* Do evaluate the object when accessing a static member. */
+ if (TREE_SIDE_EFFECTS (datum))
+ field = build (COMPOUND_EXPR, TREE_TYPE (field), datum, field);
+
return field;
}
}
+ if (TREE_DEPRECATED (field))
+ warn_deprecated_use (field);
+
/* See if we have to do any conversions so that we pick up the field from the
right context. */
if (DECL_FIELD_CONTEXT (field) != basetype)
@@ -2221,37 +2209,28 @@ build_component_ref (datum, component, basetype_path, protect)
tree context = DECL_FIELD_CONTEXT (field);
tree base = context;
while (!same_type_p (base, basetype) && TYPE_NAME (base)
- && ANON_UNION_TYPE_P (base))
- {
- base = TYPE_CONTEXT (base);
- }
+ && ANON_AGGR_TYPE_P (base))
+ base = TYPE_CONTEXT (base);
/* Handle base classes here... */
- if (base != basetype && TYPE_USES_COMPLEX_INHERITANCE (basetype))
+ if (base != basetype && TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (basetype))
{
- tree addr = build_unary_op (ADDR_EXPR, datum, 0);
- if (integer_zerop (addr))
+ tree binfo = lookup_base (TREE_TYPE (datum), base, ba_check, NULL);
+
+ if (TREE_CODE (datum) == INDIRECT_REF
+ && integer_zerop (TREE_OPERAND (datum, 0)))
{
error ("invalid reference to NULL ptr, use ptr-to-member instead");
return error_mark_node;
}
- if (VBASE_NAME_P (DECL_NAME (field)))
- {
- /* It doesn't matter which vbase pointer we grab, just
- find one of them. */
- tree binfo = get_binfo (base,
- TREE_TYPE (TREE_TYPE (addr)), 0);
- addr = convert_pointer_to_real (binfo, addr);
- }
- else
- addr = convert_pointer_to (base, addr);
- datum = build_indirect_ref (addr, NULL_PTR);
- my_friendly_assert (datum != error_mark_node, 311);
+ datum = build_base_path (PLUS_EXPR, datum, binfo, 1);
+ if (datum == error_mark_node)
+ return error_mark_node;
}
basetype = base;
/* Handle things from anon unions here... */
- if (TYPE_NAME (context) && ANON_UNION_TYPE_P (context))
+ if (TYPE_NAME (context) && ANON_AGGR_TYPE_P (context))
{
tree subfield = lookup_anon_field (basetype, context);
tree subdatum = build_component_ref (datum, subfield,
@@ -2270,20 +2249,18 @@ build_component_ref (datum, component, basetype_path, protect)
;
else
{
- type_quals = (CP_TYPE_QUALS (field_type)
- | CP_TYPE_QUALS (TREE_TYPE (datum)));
+ type_quals = (cp_type_quals (field_type)
+ | cp_type_quals (TREE_TYPE (datum)));
/* A field is const (volatile) if the enclosing object, or the
field itself, is const (volatile). But, a mutable field is
not const, even within a const object. */
- if (DECL_LANG_SPECIFIC (field) && DECL_MUTABLE_P (field))
+ if (DECL_MUTABLE_P (field))
type_quals &= ~TYPE_QUAL_CONST;
- if (!IS_SIGNATURE (field_type))
- field_type = cp_build_qualified_type (field_type, type_quals);
+ field_type = cp_build_qualified_type (field_type, type_quals);
}
- ref = fold (build (COMPONENT_REF, field_type,
- break_out_cleanups (datum), field));
+ ref = fold (build (COMPONENT_REF, field_type, datum, field));
/* Mark the expression const or volatile, as appropriate. Even
though we've dealt with the type above, we still have to mark the
@@ -2365,7 +2342,14 @@ build_indirect_ref (ptr, errorstring)
types. */
tree t = canonical_type_variant (TREE_TYPE (type));
- if (TREE_CODE (pointer) == ADDR_EXPR
+ if (VOID_TYPE_P (t))
+ {
+ /* A pointer to incomplete type (other than cv void) can be
+ dereferenced [expr.unary.op]/1 */
+ error ("`%T' is not a pointer-to-object type", type);
+ return error_mark_node;
+ }
+ else if (TREE_CODE (pointer) == ADDR_EXPR
&& !flag_volatile
&& same_type_p (t, TREE_TYPE (TREE_OPERAND (pointer, 0))))
/* The POINTER was something like `&x'. We simplify `*&x' to
@@ -2390,9 +2374,6 @@ build_indirect_ref (ptr, errorstring)
pointer to member, so it's cool to check for this here. */
else if (TYPE_PTRMEM_P (type) || TYPE_PTRMEMFUNC_P (type))
error ("invalid use of `%s' on pointer to member", errorstring);
- else if (TREE_CODE (type) == RECORD_TYPE
- && (IS_SIGNATURE_POINTER (type) || IS_SIGNATURE_REFERENCE (type)))
- error ("cannot dereference signature pointer/reference");
else if (pointer != error_mark_node)
{
if (errorstring)
@@ -2430,6 +2411,27 @@ build_array_ref (array, idx)
|| TREE_TYPE (idx) == error_mark_node)
return error_mark_node;
+ /* If ARRAY is a COMPOUND_EXPR or COND_EXPR, move our reference
+ inside it. */
+ switch (TREE_CODE (array))
+ {
+ case COMPOUND_EXPR:
+ {
+ tree value = build_array_ref (TREE_OPERAND (array, 1), idx);
+ return build (COMPOUND_EXPR, TREE_TYPE (value),
+ TREE_OPERAND (array, 0), value);
+ }
+
+ case COND_EXPR:
+ return build_conditional_expr
+ (TREE_OPERAND (array, 0),
+ build_array_ref (TREE_OPERAND (array, 1), idx),
+ build_array_ref (TREE_OPERAND (array, 2), idx));
+
+ default:
+ break;
+ }
+
if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE
&& TREE_CODE (array) != INDIRECT_REF)
{
@@ -2459,13 +2461,14 @@ build_array_ref (array, idx)
address arithmetic on its address.
Likewise an array of elements of variable size. */
if (TREE_CODE (idx) != INTEGER_CST
- || (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array))) != 0
+ || (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (array)))
&& (TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array))))
!= INTEGER_CST)))
{
if (mark_addressable (array) == 0)
return error_mark_node;
}
+
/* An array that is indexed by a constant value which is not within
the array bounds cannot be stored in a register either; because we
would get a crash in store_bit_field/extract_bit_field when trying
@@ -2479,7 +2482,7 @@ build_array_ref (array, idx)
}
if (pedantic && !lvalue_p (array))
- pedwarn ("ANSI C++ forbids subscripting non-lvalue array");
+ pedwarn ("ISO C++ forbids subscripting non-lvalue array");
/* Note in C++ it is valid to subscript a `register' array, since
it is valid to take the address of something with that
@@ -2532,8 +2535,7 @@ build_array_ref (array, idx)
return error_mark_node;
}
- return build_indirect_ref (build_binary_op_nodefault (PLUS_EXPR, ar,
- ind, PLUS_EXPR),
+ return build_indirect_ref (cp_build_binary_op (PLUS_EXPR, ar, ind),
"array indexing");
}
}
@@ -2604,14 +2606,18 @@ build_x_function_call (function, params, decl)
TYPE_BINFO (type), LOOKUP_NORMAL);
}
+ if (TREE_CODE (function) == OFFSET_REF
+ && TREE_CODE (type) != METHOD_TYPE)
+ function = resolve_offset_ref (function);
+
if ((TREE_CODE (function) == FUNCTION_DECL
&& DECL_STATIC_FUNCTION_P (function))
- || (TREE_CODE (function) == TEMPLATE_DECL
- && DECL_STATIC_FUNCTION_P (DECL_RESULT (function))))
- return build_member_call(DECL_CONTEXT (function),
- template_id
- ? template_id : DECL_NAME (function),
- params);
+ || (DECL_FUNCTION_TEMPLATE_P (function)
+ && DECL_STATIC_FUNCTION_P (DECL_TEMPLATE_RESULT (function))))
+ return build_member_call (DECL_CONTEXT (function),
+ template_id
+ ? template_id : DECL_NAME (function),
+ params);
is_method = ((TREE_CODE (function) == TREE_LIST
&& current_class_type != NULL_TREE
@@ -2625,7 +2631,7 @@ build_x_function_call (function, params, decl)
/* A friend template. Make it look like a toplevel declaration. */
if (! is_method && TREE_CODE (function) == TEMPLATE_DECL)
- function = scratch_ovl_cons (function, NULL_TREE);
+ function = ovl_cons (function, NULL_TREE);
/* Handle methods, friends, and overloaded functions, respectively. */
if (is_method)
@@ -2638,18 +2644,18 @@ build_x_function_call (function, params, decl)
if (TREE_CODE (function) == FUNCTION_DECL
|| DECL_FUNCTION_TEMPLATE_P (function))
{
- basetype = DECL_CLASS_CONTEXT (function);
+ basetype = DECL_CONTEXT (function);
if (DECL_NAME (function))
function = DECL_NAME (function);
else
- function = TYPE_IDENTIFIER (DECL_CLASS_CONTEXT (function));
+ function = TYPE_IDENTIFIER (DECL_CONTEXT (function));
}
else if (TREE_CODE (function) == TREE_LIST)
{
my_friendly_assert (TREE_CODE (TREE_VALUE (function))
== FUNCTION_DECL, 312);
- basetype = DECL_CLASS_CONTEXT (TREE_VALUE (function));
+ basetype = DECL_CONTEXT (TREE_VALUE (function));
function = TREE_PURPOSE (function);
}
else if (TREE_CODE (function) != IDENTIFIER_NODE)
@@ -2686,7 +2692,7 @@ build_x_function_call (function, params, decl)
{
if (current_class_type == NULL_TREE)
{
- cp_error ("object missing in call to method `%D'", function);
+ error ("object missing in call to method `%D'", function);
return error_mark_node;
}
/* Yow: call from a static member function. */
@@ -2705,12 +2711,22 @@ build_x_function_call (function, params, decl)
/* Undo what we did in build_component_ref. */
decl = TREE_OPERAND (function, 0);
function = TREE_OPERAND (function, 1);
- function = DECL_NAME (OVL_CURRENT (function));
- if (template_id)
+ if (TREE_CODE (function) == TEMPLATE_ID_EXPR)
+ {
+ my_friendly_assert (!template_id, 20011228);
+
+ template_id = function;
+ }
+ else
{
- TREE_OPERAND (template_id, 0) = function;
- function = template_id;
+ function = DECL_NAME (OVL_CURRENT (function));
+
+ if (template_id)
+ {
+ TREE_OPERAND (template_id, 0) = function;
+ function = template_id;
+ }
}
return build_method_call (decl, function, params,
@@ -2720,7 +2736,7 @@ build_x_function_call (function, params, decl)
{
if (OVL_FUNCTION (function) == NULL_TREE)
{
- cp_error ("function `%D' declared overloaded, but no definitions appear with which to resolve it?!?",
+ error ("function `%D' declared overloaded, but no definitions appear with which to resolve it?!?",
TREE_PURPOSE (function));
return error_mark_node;
}
@@ -2762,7 +2778,7 @@ build_x_function_call (function, params, decl)
function = TREE_OPERAND (function, 1);
function = get_member_function_from_ptrfunc (&decl_addr, function);
- params = expr_tree_cons (NULL_TREE, decl_addr, params);
+ params = tree_cons (NULL_TREE, decl_addr, params);
return build_function_call (function, params);
}
@@ -2795,7 +2811,7 @@ build_x_function_call (function, params, decl)
}
/* Unexpected node type? */
else
- my_friendly_abort (116);
+ abort ();
if (decl == NULL_TREE)
{
if (current_function_decl
@@ -2808,12 +2824,15 @@ build_x_function_call (function, params, decl)
if (TREE_CODE (TREE_TYPE (decl)) != POINTER_TYPE
&& ! TYPE_PTRMEMFUNC_P (TREE_TYPE (decl)))
{
+ tree binfo = lookup_base (TREE_TYPE (decl), TREE_TYPE (ctypeptr),
+ ba_check, NULL);
+
decl = build_unary_op (ADDR_EXPR, decl, 0);
- decl = convert_pointer_to (TREE_TYPE (ctypeptr), decl);
+ decl = build_base_path (PLUS_EXPR, decl, binfo, 1);
}
else
decl = build_c_cast (ctypeptr, decl);
- params = expr_tree_cons (NULL_TREE, decl, params);
+ params = tree_cons (NULL_TREE, decl, params);
}
return build_function_call (function, params);
@@ -2828,17 +2847,26 @@ get_member_function_from_ptrfunc (instance_ptrptr, function)
tree function;
{
if (TREE_CODE (function) == OFFSET_REF)
- {
- function = TREE_OPERAND (function, 1);
- }
+ function = TREE_OPERAND (function, 1);
if (TYPE_PTRMEMFUNC_P (TREE_TYPE (function)))
{
- tree fntype, idx, e1, delta, delta2, e2, e3, aref, vtbl;
+ tree fntype, idx, e1, delta, delta2, e2, e3, vtbl;
tree instance, basetype;
tree instance_ptr = *instance_ptrptr;
+ if (instance_ptr == error_mark_node
+ && TREE_CODE (function) == PTRMEM_CST)
+ {
+ /* Extracting the function address from a pmf is only
+ allowed with -Wno-pmf-conversions. It only works for
+ pmf constants. */
+ e1 = build_addr_func (PTRMEM_CST_MEMBER (function));
+ e1 = convert (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (function)), e1);
+ return e1;
+ }
+
if (TREE_SIDE_EFFECTS (instance_ptr))
instance_ptr = save_expr (instance_ptr);
@@ -2848,71 +2876,83 @@ get_member_function_from_ptrfunc (instance_ptrptr, function)
fntype = TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (function));
basetype = TYPE_METHOD_BASETYPE (TREE_TYPE (fntype));
+ /* Convert down to the right base, before using the instance. */
+ instance = lookup_base (TREE_TYPE (TREE_TYPE (instance_ptr)), basetype,
+ ba_check, NULL);
+ instance = build_base_path (PLUS_EXPR, instance_ptr, instance, 1);
+ if (instance == error_mark_node && instance_ptr != error_mark_node)
+ return instance;
+
+ e3 = PFN_FROM_PTRMEMFUNC (function);
+
+ vtbl = build1 (NOP_EXPR, build_pointer_type (ptr_type_node), instance);
+ TREE_CONSTANT (vtbl) = TREE_CONSTANT (instance);
+
delta = cp_convert (ptrdiff_type_node,
build_component_ref (function, delta_identifier,
NULL_TREE, 0));
- e3 = PFN_FROM_PTRMEMFUNC (function);
- if (TYPE_SIZE (basetype) != NULL_TREE
- && ! TYPE_VIRTUAL_P (basetype))
- /* If basetype doesn't have virtual functions, don't emit code to
- handle that case. */
- e1 = e3;
- else
- {
- /* Promoting idx before saving it improves performance on RISC
- targets. Without promoting, the first compare used
- load-with-sign-extend, while the second used normal load then
- shift to sign-extend. An optimizer flaw, perhaps, but it's
- easier to make this change. */
- idx = save_expr (default_conversion
- (build_component_ref (function,
- index_identifier,
- NULL_TREE, 0)));
- e1 = build_binary_op (GE_EXPR, idx, integer_zero_node);
-
- /* Convert down to the right base, before using the instance. */
- instance = convert_pointer_to_real (basetype, instance_ptr);
- if (instance == error_mark_node && instance_ptr != error_mark_node)
- return instance;
-
- vtbl = convert_pointer_to (ptr_type_node, instance);
- delta2 = DELTA2_FROM_PTRMEMFUNC (function);
- vtbl = build
- (PLUS_EXPR,
- build_pointer_type (build_pointer_type (vtable_entry_type)),
- vtbl, cp_convert (ptrdiff_type_node, delta2));
- vtbl = build_indirect_ref (vtbl, NULL_PTR);
- aref = build_array_ref (vtbl, build_binary_op (MINUS_EXPR,
- idx,
- integer_one_node));
- if (! flag_vtable_thunks)
- {
- aref = save_expr (aref);
-
- delta = build_binary_op
- (PLUS_EXPR,
- build_conditional_expr (e1,
- build_component_ref (aref,
- delta_identifier,
- NULL_TREE, 0),
- integer_zero_node),
- delta);
- }
+ /* This used to avoid checking for virtual functions if basetype
+ has no virtual functions, according to an earlier ANSI draft.
+ With the final ISO C++ rules, such an optimization is
+ incorrect: A pointer to a derived member can be static_cast
+ to pointer-to-base-member, as long as the dynamic object
+ later has the right member. */
+
+ /* Promoting idx before saving it improves performance on RISC
+ targets. Without promoting, the first compare used
+ load-with-sign-extend, while the second used normal load then
+ shift to sign-extend. An optimizer flaw, perhaps, but it's
+ easier to make this change. */
+ switch (TARGET_PTRMEMFUNC_VBIT_LOCATION)
+ {
+ case ptrmemfunc_vbit_in_pfn:
+ idx = cp_build_binary_op (TRUNC_DIV_EXPR,
+ build1 (NOP_EXPR, vtable_index_type, e3),
+ TYPE_SIZE_UNIT (vtable_entry_type));
+ e1 = cp_build_binary_op (BIT_AND_EXPR,
+ build1 (NOP_EXPR, vtable_index_type, e3),
+ integer_one_node);
+ break;
- if (flag_vtable_thunks)
- e2 = aref;
- else
- e2 = build_component_ref (aref, pfn_identifier, NULL_TREE, 0);
- TREE_TYPE (e2) = TREE_TYPE (e3);
- e1 = build_conditional_expr (e1, e2, e3);
-
- /* Make sure this doesn't get evaluated first inside one of the
- branches of the COND_EXPR. */
- if (TREE_CODE (instance_ptr) == SAVE_EXPR)
- e1 = build (COMPOUND_EXPR, TREE_TYPE (e1),
- instance_ptr, e1);
- }
+ case ptrmemfunc_vbit_in_delta:
+ idx = build1 (NOP_EXPR, vtable_index_type, e3);
+ e1 = cp_build_binary_op (BIT_AND_EXPR,
+ delta, integer_one_node);
+ delta = cp_build_binary_op (RSHIFT_EXPR,
+ build1 (NOP_EXPR, vtable_index_type,
+ delta),
+ integer_one_node);
+ break;
+
+ default:
+ abort ();
+ }
+
+ /* DELTA2 is the amount by which to adjust the `this' pointer
+ to find the vtbl. */
+ delta2 = delta;
+ vtbl = build
+ (PLUS_EXPR,
+ build_pointer_type (build_pointer_type (vtable_entry_type)),
+ vtbl, cp_convert (ptrdiff_type_node, delta2));
+ vtbl = build_indirect_ref (vtbl, NULL);
+ e2 = build_array_ref (vtbl, idx);
+
+ /* When using function descriptors, the address of the
+ vtable entry is treated as a function pointer. */
+ if (TARGET_VTABLE_USES_DESCRIPTORS)
+ e2 = build1 (NOP_EXPR, TREE_TYPE (e2),
+ build_unary_op (ADDR_EXPR, e2, /*noconvert=*/1));
+
+ TREE_TYPE (e2) = TREE_TYPE (e3);
+ e1 = build_conditional_expr (e1, e2, e3);
+
+ /* Make sure this doesn't get evaluated first inside one of the
+ branches of the COND_EXPR. */
+ if (TREE_CODE (instance_ptr) == SAVE_EXPR)
+ e1 = build (COMPOUND_EXPR, TREE_TYPE (e1),
+ instance_ptr, e1);
*instance_ptrptr = build (PLUS_EXPR, TREE_TYPE (instance_ptr),
instance_ptr, delta);
@@ -2920,7 +2960,7 @@ get_member_function_from_ptrfunc (instance_ptrptr, function)
if (instance_ptr == error_mark_node
&& TREE_CODE (e1) != ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (e1, 0)) != FUNCTION_DECL)
- cp_error ("object missing in `%E'", function);
+ error ("object missing in `%E'", function);
function = e1;
}
@@ -2935,8 +2975,10 @@ build_function_call_real (function, params, require_complete, flags)
register tree fntype, fndecl;
register tree value_type;
register tree coerced_params;
+ tree result;
tree name = NULL_TREE, assembler_name = NULL_TREE;
int is_method;
+ tree original = function;
/* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
Strip such NOP_EXPRs, since FUNCTION is used in non-lvalue context. */
@@ -2958,12 +3000,12 @@ build_function_call_real (function, params, require_complete, flags)
/* Convert anything with function type to a pointer-to-function. */
if (pedantic && DECL_MAIN_P (function))
- pedwarn ("ANSI C++ forbids calling `main' from within program");
+ pedwarn ("ISO C++ forbids calling `::main' from within program");
/* Differs from default_conversion by not setting TREE_ADDRESSABLE
(because calling an inline function does not mean the function
needs to be separately compiled). */
-
+
if (DECL_INLINE (function))
function = inline_conversion (function);
else
@@ -2983,8 +3025,8 @@ build_function_call_real (function, params, require_complete, flags)
if (TYPE_PTRMEMFUNC_P (fntype))
{
- cp_error ("must use .* or ->* to call pointer-to-member function in `%E (...)'",
- function);
+ error ("must use .* or ->* to call pointer-to-member function in `%E (...)'",
+ original);
return error_mark_node;
}
@@ -2996,7 +3038,7 @@ build_function_call_real (function, params, require_complete, flags)
|| is_method
|| TREE_CODE (function) == TEMPLATE_ID_EXPR))
{
- cp_error ("`%E' cannot be used as a function", function);
+ error ("`%E' cannot be used as a function", original);
return error_mark_node;
}
@@ -3023,8 +3065,8 @@ build_function_call_real (function, params, require_complete, flags)
/* Check for errors in format strings. */
- if (warn_format && (name || assembler_name))
- check_function_format (name, assembler_name, coerced_params);
+ if (warn_format)
+ check_function_format (NULL, TYPE_ATTRIBUTES (fntype), coerced_params);
/* Recognize certain built-in functions so we can make tree-codes
other than CALL_EXPR. We do this when it enables fold-const.c
@@ -3033,35 +3075,27 @@ build_function_call_real (function, params, require_complete, flags)
if (TREE_CODE (function) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL
&& DECL_BUILT_IN (TREE_OPERAND (function, 0)))
- switch (DECL_FUNCTION_CODE (TREE_OPERAND (function, 0)))
- {
- case BUILT_IN_ABS:
- case BUILT_IN_LABS:
- case BUILT_IN_FABS:
- if (coerced_params == 0)
- return integer_zero_node;
- return build_unary_op (ABS_EXPR, TREE_VALUE (coerced_params), 0);
-
- default:
- break;
- }
+ {
+ result = expand_tree_builtin (TREE_OPERAND (function, 0),
+ params, coerced_params);
+ if (result)
+ return result;
+ }
- /* C++ */
- value_type = TREE_TYPE (fntype) ? TREE_TYPE (fntype) : void_type_node;
- {
- register tree result
- = build_call (function, value_type, coerced_params);
+ /* Some built-in function calls will be evaluated at
+ compile-time in fold (). */
+ result = fold (build_call (function, coerced_params));
+ value_type = TREE_TYPE (result);
- if (require_complete)
- {
- if (TREE_CODE (value_type) == VOID_TYPE)
- return result;
- result = require_complete_type (result);
- }
- if (IS_AGGR_TYPE (value_type))
- result = build_cplus_new (value_type, result);
- return convert_from_reference (result);
- }
+ if (require_complete)
+ {
+ if (TREE_CODE (value_type) == VOID_TYPE)
+ return result;
+ result = require_complete_type (result);
+ }
+ if (IS_AGGR_TYPE (value_type))
+ result = build_cplus_new (value_type, result);
+ return convert_from_reference (result);
}
tree
@@ -3168,7 +3202,7 @@ convert_arguments (typelist, values, fndecl, flags)
/* Formal parm type is specified by a function prototype. */
tree parmval;
- if (TYPE_SIZE (complete_type (type)) == 0)
+ if (!COMPLETE_TYPE_P (complete_type (type)))
{
error ("parameter type of called function is incomplete");
parmval = val;
@@ -3178,28 +3212,33 @@ convert_arguments (typelist, values, fndecl, flags)
parmval = convert_for_initialization
(NULL_TREE, type, val, flags,
"argument passing", fndecl, i);
-#ifdef PROMOTE_PROTOTYPES
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
+ if (PROMOTE_PROTOTYPES
+ && INTEGRAL_TYPE_P (type)
&& (TYPE_PRECISION (type)
< TYPE_PRECISION (integer_type_node)))
parmval = default_conversion (parmval);
-#endif
}
if (parmval == error_mark_node)
return error_mark_node;
- result = expr_tree_cons (NULL_TREE, parmval, result);
+ result = tree_cons (NULL_TREE, parmval, result);
}
else
{
if (TREE_CODE (TREE_TYPE (val)) == REFERENCE_TYPE)
val = convert_from_reference (val);
- result = expr_tree_cons (NULL_TREE,
- convert_arg_to_ellipsis (val),
- result);
+ if (fndecl && DECL_BUILT_IN (fndecl)
+ && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_CONSTANT_P)
+ /* Don't do ellipsis conversion for __built_in_constant_p
+ as this will result in spurious warnings for non-POD
+ types. */
+ val = require_complete_type (val);
+ else
+ val = convert_arg_to_ellipsis (val);
+
+ result = tree_cons (NULL_TREE, val, result);
}
if (typetail)
@@ -3216,12 +3255,12 @@ convert_arguments (typelist, values, fndecl, flags)
tree parmval
= convert_default_arg (TREE_VALUE (typetail),
TREE_PURPOSE (typetail),
- fndecl);
+ fndecl, i);
if (parmval == error_mark_node)
return error_mark_node;
- result = expr_tree_cons (0, parmval, result);
+ result = tree_cons (0, parmval, result);
typetail = TREE_CHAIN (typetail);
/* ends with `...'. */
if (typetail == NULL_TREE)
@@ -3259,14 +3298,6 @@ build_x_binary_op (code, arg1, arg2)
return build_new_op (code, LOOKUP_NORMAL, arg1, arg2, NULL_TREE);
}
-tree
-build_binary_op (code, arg1, arg2)
- enum tree_code code;
- tree arg1, arg2;
-{
- return build_binary_op_nodefault (code, arg1, arg2, code);
-}
-
/* Build a binary-operation expression without default conversions.
CODE is the kind of expression to build.
This function differs from `build' in several ways:
@@ -3277,9 +3308,6 @@ build_binary_op (code, arg1, arg2)
are done in the narrower type when that gives the same result).
Constant folding is also done before the result is returned.
- ERROR_CODE is the code that determines what to say in error messages.
- It is usually, but not always, the same as CODE.
-
Note that the operands will never have enumeral types
because either they have just had the default conversions performed
or they have both just been converted to some other type in which
@@ -3289,10 +3317,10 @@ build_binary_op (code, arg1, arg2)
multiple inheritance, and deal with pointer to member functions. */
tree
-build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
+build_binary_op (code, orig_op0, orig_op1, convert_p)
enum tree_code code;
tree orig_op0, orig_op1;
- enum tree_code error_code;
+ int convert_p ATTRIBUTE_UNUSED;
{
tree op0, op1;
register enum tree_code code0, code1;
@@ -3341,17 +3369,24 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
int common = 0;
/* Apply default conversions. */
+ op0 = orig_op0;
+ op1 = orig_op1;
+
if (code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR
|| code == TRUTH_OR_EXPR || code == TRUTH_ORIF_EXPR
|| code == TRUTH_XOR_EXPR)
{
- op0 = decay_conversion (orig_op0);
- op1 = decay_conversion (orig_op1);
+ if (!really_overloaded_fn (op0))
+ op0 = decay_conversion (op0);
+ if (!really_overloaded_fn (op1))
+ op1 = decay_conversion (op1);
}
else
{
- op0 = default_conversion (orig_op0);
- op1 = default_conversion (orig_op1);
+ if (!really_overloaded_fn (op0))
+ op0 = default_conversion (op0);
+ if (!really_overloaded_fn (op1))
+ op1 = default_conversion (op1);
}
/* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */
@@ -3361,20 +3396,20 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
/* DTRT if one side is an overloaded function, but complain about it. */
if (type_unknown_p (op0))
{
- tree t = instantiate_type (TREE_TYPE (op1), op0, 0);
+ tree t = instantiate_type (TREE_TYPE (op1), op0, itf_none);
if (t != error_mark_node)
{
- cp_pedwarn ("assuming cast to `%T' from overloaded function",
+ pedwarn ("assuming cast to type `%T' from overloaded function",
TREE_TYPE (t));
op0 = t;
}
}
if (type_unknown_p (op1))
{
- tree t = instantiate_type (TREE_TYPE (op0), op1, 0);
+ tree t = instantiate_type (TREE_TYPE (op0), op1, itf_none);
if (t != error_mark_node)
{
- cp_pedwarn ("assuming cast to `%T' from overloaded function",
+ pedwarn ("assuming cast to type `%T' from overloaded function",
TREE_TYPE (t));
op1 = t;
}
@@ -3434,9 +3469,9 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
|| code1 == COMPLEX_TYPE))
{
if (TREE_CODE (op1) == INTEGER_CST && integer_zerop (op1))
- cp_warning ("division by zero in `%E / 0'", op0);
+ warning ("division by zero in `%E / 0'", op0);
else if (TREE_CODE (op1) == REAL_CST && real_zerop (op1))
- cp_warning ("division by zero in `%E / 0.'", op0);
+ warning ("division by zero in `%E / 0.'", op0);
if (!(code0 == INTEGER_TYPE && code1 == INTEGER_TYPE))
resultcode = RDIV_EXPR;
@@ -3449,8 +3484,8 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
shorten = ((TREE_CODE (op0) == NOP_EXPR
&& TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op0, 0))))
|| (TREE_CODE (op1) == INTEGER_CST
- && (TREE_INT_CST_LOW (op1) != -1
- || TREE_INT_CST_HIGH (op1) != -1)));
+ && ! integer_all_onesp (op1)));
+
common = 1;
}
break;
@@ -3491,9 +3526,9 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
case TRUNC_MOD_EXPR:
case FLOOR_MOD_EXPR:
if (code1 == INTEGER_TYPE && integer_zerop (op1))
- cp_warning ("division by zero in `%E %% 0'", op0);
+ warning ("division by zero in `%E %% 0'", op0);
else if (code1 == REAL_TYPE && real_zerop (op1))
- cp_warning ("division by zero in `%E %% 0.'", op0);
+ warning ("division by zero in `%E %% 0.'", op0);
if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
{
@@ -3504,8 +3539,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
shorten = ((TREE_CODE (op0) == NOP_EXPR
&& TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op0, 0))))
|| (TREE_CODE (op1) == INTEGER_CST
- && (TREE_INT_CST_LOW (op1) != -1
- || TREE_INT_CST_HIGH (op1) != -1)));
+ && ! integer_all_onesp (op1)));
common = 1;
}
break;
@@ -3531,11 +3565,9 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
warning ("right shift count is negative");
else
{
- if (TREE_INT_CST_LOW (op1) | TREE_INT_CST_HIGH (op1))
+ if (! integer_zerop (op1))
short_shift = 1;
- if (TREE_INT_CST_HIGH (op1) != 0
- || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1)
- >= TYPE_PRECISION (type0)))
+ if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0)
warning ("right shift count >= width of type");
}
}
@@ -3556,9 +3588,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
{
if (tree_int_cst_lt (op1, integer_zero_node))
warning ("left shift count is negative");
- else if (TREE_INT_CST_HIGH (op1) != 0
- || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1)
- >= TYPE_PRECISION (type0)))
+ else if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0)
warning ("left shift count >= width of type");
}
/* Convert the shift-count to an integer, regardless of
@@ -3580,9 +3610,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
if (tree_int_cst_lt (op1, integer_zero_node))
warning ("%s rotate count is negative",
(code == LROTATE_EXPR) ? "left" : "right");
- else if (TREE_INT_CST_HIGH (op1) != 0
- || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1)
- >= TYPE_PRECISION (type0)))
+ else if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0)
warning ("%s rotate count >= width of type",
(code == LROTATE_EXPR) ? "left" : "right");
}
@@ -3595,6 +3623,9 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
case EQ_EXPR:
case NE_EXPR:
+ if (warn_float_equal && (code0 == REAL_TYPE || code1 == REAL_TYPE))
+ warning ("comparing floating point with == or != is unsafe");
+
build_type = boolean_type_node;
if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE
|| code0 == COMPLEX_TYPE)
@@ -3602,149 +3633,79 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
|| code1 == COMPLEX_TYPE))
short_compare = 1;
else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
- {
- register tree tt0 = TYPE_MAIN_VARIANT (TREE_TYPE (type0));
- register tree tt1 = TYPE_MAIN_VARIANT (TREE_TYPE (type1));
-
- if (comp_target_types (type0, type1, 1))
- result_type = common_type (type0, type1);
- else if (tt0 == void_type_node)
- {
- if (pedantic && TREE_CODE (tt1) == FUNCTION_TYPE
- && tree_int_cst_lt (TYPE_SIZE (type0), TYPE_SIZE (type1)))
- pedwarn ("ANSI C++ forbids comparison of `void *' with function pointer");
- else if (TREE_CODE (tt1) == OFFSET_TYPE)
- pedwarn ("ANSI C++ forbids conversion of a pointer to member to `void *'");
- }
- else if (tt1 == void_type_node)
- {
- if (pedantic && TREE_CODE (tt0) == FUNCTION_TYPE
- && tree_int_cst_lt (TYPE_SIZE (type1), TYPE_SIZE (type0)))
- pedwarn ("ANSI C++ forbids comparison of `void *' with function pointer");
- }
- else
- cp_pedwarn ("comparison of distinct pointer types `%T' and `%T' lacks a cast",
- type0, type1);
-
- if (result_type == NULL_TREE)
- result_type = ptr_type_node;
- }
- else if (code0 == POINTER_TYPE && TREE_CODE (op1) == INTEGER_CST
- && integer_zerop (op1))
+ result_type = composite_pointer_type (type0, type1, op0, op1,
+ "comparison");
+ else if (code0 == POINTER_TYPE && null_ptr_cst_p (op1))
result_type = type0;
- else if (code1 == POINTER_TYPE && TREE_CODE (op0) == INTEGER_CST
- && integer_zerop (op0))
+ else if (code1 == POINTER_TYPE && null_ptr_cst_p (op0))
result_type = type1;
else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
{
result_type = type0;
- error ("ANSI C++ forbids comparison between pointer and integer");
+ error ("ISO C++ forbids comparison between pointer and integer");
}
else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE)
{
result_type = type1;
- error ("ANSI C++ forbids comparison between pointer and integer");
- }
- else if (TYPE_PTRMEMFUNC_P (type0) && TREE_CODE (op1) == INTEGER_CST
- && integer_zerop (op1))
- {
- op0 = build_component_ref (op0, index_identifier, NULL_TREE, 0);
- op1 = integer_zero_node;
- result_type = TREE_TYPE (op0);
+ error ("ISO C++ forbids comparison between pointer and integer");
}
- else if (TYPE_PTRMEMFUNC_P (type1) && TREE_CODE (op0) == INTEGER_CST
- && integer_zerop (op0))
+ else if (TYPE_PTRMEMFUNC_P (type0) && null_ptr_cst_p (op1))
{
- op0 = build_component_ref (op1, index_identifier, NULL_TREE, 0);
- op1 = integer_zero_node;
+ op0 = build_component_ref (op0, pfn_identifier, NULL_TREE, 0);
+ op1 = cp_convert (TREE_TYPE (op0), integer_zero_node);
result_type = TREE_TYPE (op0);
}
+ else if (TYPE_PTRMEMFUNC_P (type1) && null_ptr_cst_p (op0))
+ return cp_build_binary_op (code, op1, op0);
else if (TYPE_PTRMEMFUNC_P (type0) && TYPE_PTRMEMFUNC_P (type1)
&& same_type_p (type0, type1))
{
- /* The code we generate for the test is:
-
- (op0.index == op1.index
- && ((op1.index != -1 && op0.delta2 == op1.delta2)
- || op0.pfn == op1.pfn)) */
-
- tree index0 = build_component_ref (op0, index_identifier,
- NULL_TREE, 0);
- tree index1 = save_expr (build_component_ref (op1, index_identifier,
- NULL_TREE, 0));
- tree pfn0 = PFN_FROM_PTRMEMFUNC (op0);
- tree pfn1 = PFN_FROM_PTRMEMFUNC (op1);
- tree delta20 = DELTA2_FROM_PTRMEMFUNC (op0);
- tree delta21 = DELTA2_FROM_PTRMEMFUNC (op1);
- tree e1, e2, e3;
- tree integer_neg_one_node
- = build_binary_op (MINUS_EXPR, integer_zero_node,
- integer_one_node);
- e1 = build_binary_op (EQ_EXPR, index0, index1);
- e2 = build_binary_op (NE_EXPR, index1, integer_neg_one_node);
- e2 = build_binary_op (TRUTH_ANDIF_EXPR, e2,
- build_binary_op (EQ_EXPR, delta20, delta21));
- /* We can't use build_binary_op for this cmp because it would get
- confused by the ptr to method types and think we want pmfs. */
- e3 = build (EQ_EXPR, boolean_type_node, pfn0, pfn1);
- e2 = build_binary_op (TRUTH_ORIF_EXPR, e2, e3);
- e2 = build_binary_op (TRUTH_ANDIF_EXPR, e1, e2);
- if (code == EQ_EXPR)
- return e2;
- return build_binary_op (EQ_EXPR, e2, integer_zero_node);
- }
- else if (TYPE_PTRMEMFUNC_P (type0)
- && same_type_p (TYPE_PTRMEMFUNC_FN_TYPE (type0), type1))
- {
- tree index0 = build_component_ref (op0, index_identifier,
- NULL_TREE, 0);
- tree index1;
- tree pfn0 = PFN_FROM_PTRMEMFUNC (op0);
- tree delta20 = DELTA2_FROM_PTRMEMFUNC (op0);
- tree delta21 = integer_zero_node;
- tree e1, e2, e3;
- tree integer_neg_one_node
- = build_binary_op (MINUS_EXPR, integer_zero_node, integer_one_node);
- if (TREE_CODE (TREE_OPERAND (op1, 0)) == FUNCTION_DECL
- && DECL_VINDEX (TREE_OPERAND (op1, 0)))
- {
- /* Map everything down one to make room for
- the null pointer to member. */
- index1 = size_binop (PLUS_EXPR,
- DECL_VINDEX (TREE_OPERAND (op1, 0)),
- integer_one_node);
- op1 = integer_zero_node;
- delta21 = CLASSTYPE_VFIELD (TYPE_METHOD_BASETYPE
- (TREE_TYPE (type1)));
- delta21 = DECL_FIELD_BITPOS (delta21);
- delta21 = size_binop (FLOOR_DIV_EXPR, delta21,
- size_int (BITS_PER_UNIT));
- delta21 = convert (sizetype, delta21);
- }
- else
- index1 = integer_neg_one_node;
- {
- tree nop1 = build1 (NOP_EXPR, TYPE_PTRMEMFUNC_FN_TYPE (type0),
- op1);
- TREE_CONSTANT (nop1) = TREE_CONSTANT (op1);
- op1 = nop1;
- }
- e1 = build_binary_op (EQ_EXPR, index0, index1);
- e2 = build_binary_op (NE_EXPR, index1, integer_neg_one_node);
- e2 = build_binary_op (TRUTH_ANDIF_EXPR, e2,
- build_binary_op (EQ_EXPR, delta20, delta21));
- /* We can't use build_binary_op for this cmp because it would get
- confused by the ptr to method types and think we want pmfs. */
- e3 = build (EQ_EXPR, boolean_type_node, pfn0, op1);
- e2 = build_binary_op (TRUTH_ORIF_EXPR, e2, e3);
- e2 = build_binary_op (TRUTH_ANDIF_EXPR, e1, e2);
+ /* E will be the final comparison. */
+ tree e;
+ /* E1 and E2 are for scratch. */
+ tree e1;
+ tree e2;
+ tree pfn0;
+ tree pfn1;
+ tree delta0;
+ tree delta1;
+
+ if (TREE_SIDE_EFFECTS (op0))
+ op0 = save_expr (op0);
+ if (TREE_SIDE_EFFECTS (op1))
+ op1 = save_expr (op1);
+
+ /* We generate:
+
+ (op0.pfn == op1.pfn
+ && (!op0.pfn || op0.delta == op1.delta))
+
+ The reason for the `!op0.pfn' bit is that a NULL
+ pointer-to-member is any member with a zero PFN; the
+ DELTA field is unspecified. */
+ pfn0 = pfn_from_ptrmemfunc (op0);
+ pfn1 = pfn_from_ptrmemfunc (op1);
+ delta0 = build_component_ref (op0, delta_identifier,
+ NULL_TREE, 0);
+ delta1 = build_component_ref (op1, delta_identifier,
+ NULL_TREE, 0);
+ e1 = cp_build_binary_op (EQ_EXPR, delta0, delta1);
+ e2 = cp_build_binary_op (EQ_EXPR,
+ pfn0,
+ cp_convert (TREE_TYPE (pfn0),
+ integer_zero_node));
+ e1 = cp_build_binary_op (TRUTH_ORIF_EXPR, e1, e2);
+ e2 = build (EQ_EXPR, boolean_type_node, pfn0, pfn1);
+ e = cp_build_binary_op (TRUTH_ANDIF_EXPR, e2, e1);
if (code == EQ_EXPR)
- return e2;
- return build_binary_op (EQ_EXPR, e2, integer_zero_node);
- }
- else if (TYPE_PTRMEMFUNC_P (type1)
- && same_type_p (TYPE_PTRMEMFUNC_FN_TYPE (type1), type0))
- return build_binary_op (code, op1, op0);
+ return e;
+ return cp_build_binary_op (EQ_EXPR, e, integer_zero_node);
+ }
+ else if ((TYPE_PTRMEMFUNC_P (type0)
+ && same_type_p (TYPE_PTRMEMFUNC_FN_TYPE (type0), type1))
+ || (TYPE_PTRMEMFUNC_P (type1)
+ && same_type_p (TYPE_PTRMEMFUNC_FN_TYPE (type1), type0)))
+ abort ();
break;
case MAX_EXPR:
@@ -3753,16 +3714,8 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
&& (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
shorten = 1;
else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
- {
- if (comp_target_types (type0, type1, 1))
- result_type = common_type (type0, type1);
- else
- {
- cp_pedwarn ("comparison of distinct pointer types `%T' and `%T' lacks a cast",
- type0, type1);
- result_type = ptr_type_node;
- }
- }
+ result_type = composite_pointer_type (type0, type1, op0, op1,
+ "comparison");
break;
case LE_EXPR:
@@ -3774,16 +3727,8 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
&& (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
short_compare = 1;
else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
- {
- if (comp_target_types (type0, type1, 1))
- result_type = common_type (type0, type1);
- else
- {
- cp_pedwarn ("comparison of distinct pointer types `%T' and `%T' lacks a cast",
- type0, type1);
- result_type = ptr_type_node;
- }
- }
+ result_type = composite_pointer_type (type0, type1, op0, op1,
+ "comparison");
else if (code0 == POINTER_TYPE && TREE_CODE (op1) == INTEGER_CST
&& integer_zerop (op1))
result_type = type0;
@@ -3793,15 +3738,31 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
{
result_type = type0;
- pedwarn ("ANSI C++ forbids comparison between pointer and integer");
+ pedwarn ("ISO C++ forbids comparison between pointer and integer");
}
else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE)
{
result_type = type1;
- pedwarn ("ANSI C++ forbids comparison between pointer and integer");
+ pedwarn ("ISO C++ forbids comparison between pointer and integer");
}
break;
+ case UNORDERED_EXPR:
+ case ORDERED_EXPR:
+ case UNLT_EXPR:
+ case UNLE_EXPR:
+ case UNGT_EXPR:
+ case UNGE_EXPR:
+ case UNEQ_EXPR:
+ build_type = integer_type_node;
+ if (code0 != REAL_TYPE || code1 != REAL_TYPE)
+ {
+ error ("unordered comparison on non-floating point argument");
+ return error_mark_node;
+ }
+ common = 1;
+ break;
+
default:
break;
}
@@ -3902,8 +3863,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type)
/* We can shorten only if the shift count is less than the
number of bits in the smaller type size. */
- && TREE_INT_CST_HIGH (op1) == 0
- && TYPE_PRECISION (TREE_TYPE (arg0)) > TREE_INT_CST_LOW (op1)
+ && compare_tree_int (op1, TYPE_PRECISION (TREE_TYPE (arg0))) < 0
/* If arg is sign-extended and then unsigned-shifted,
we can simulate this with a signed shift in arg's type
only if the extended result is at least twice as wide
@@ -3947,7 +3907,8 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
resultcode = xresultcode;
}
- if (short_compare && warn_sign_compare)
+ if ((short_compare || code == MIN_EXPR || code == MAX_EXPR)
+ && warn_sign_compare)
{
int op0_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op0));
int op1_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op1));
@@ -3962,7 +3923,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
&& TYPE_MAIN_VARIANT (TREE_TYPE (orig_op0))
!= TYPE_MAIN_VARIANT (TREE_TYPE (orig_op1)))
{
- cp_warning ("comparison between `%#T' and `%#T'",
+ warning ("comparison between types `%#T' and `%#T'",
TREE_TYPE (orig_op0), TREE_TYPE (orig_op1));
}
@@ -3981,11 +3942,10 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
/* OK */;
/* Do not warn if the signed quantity is an unsuffixed
integer literal (or some static constant expression
+ involving such literals or a conditional expression
involving such literals) and it is non-negative. */
- else if ((op0_signed && TREE_CODE (orig_op0) == INTEGER_CST
- && tree_int_cst_sgn (orig_op0) >= 0)
- || (op1_signed && TREE_CODE (orig_op1) == INTEGER_CST
- && tree_int_cst_sgn (orig_op1) >= 0))
+ else if ((op0_signed && tree_expr_nonnegative_p (orig_op0))
+ || (op1_signed && tree_expr_nonnegative_p (orig_op1)))
/* OK */;
/* Do not warn if the comparison is an equality operation,
the unsigned quantity is an integral constant and it does
@@ -3999,7 +3959,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
signed_type (result_type)))))
/* OK */;
else
- warning ("comparison between signed and unsigned");
+ warning ("comparison between signed and unsigned integer expressions");
/* Warn if two unsigned values are being compared in a size
larger than their original size, and one (and only one) is the
@@ -4017,25 +3977,24 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
if (TREE_CODE (primop1) == BIT_NOT_EXPR)
primop1 = get_narrower (TREE_OPERAND (op1, 0), &unsignedp1);
- if (TREE_CODE (primop0) == INTEGER_CST
- || TREE_CODE (primop1) == INTEGER_CST)
+ if (host_integerp (primop0, 0) || host_integerp (primop1, 0))
{
tree primop;
HOST_WIDE_INT constant, mask;
int unsignedp;
- unsigned bits;
+ unsigned int bits;
- if (TREE_CODE (primop0) == INTEGER_CST)
+ if (host_integerp (primop0, 0))
{
primop = primop1;
unsignedp = unsignedp1;
- constant = TREE_INT_CST_LOW (primop0);
+ constant = tree_low_cst (primop0, 0);
}
else
{
primop = primop0;
unsignedp = unsignedp0;
- constant = TREE_INT_CST_LOW (primop1);
+ constant = tree_low_cst (primop1, 0);
}
bits = TYPE_PRECISION (TREE_TYPE (primop));
@@ -4065,8 +4024,8 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
if (!result_type)
{
- cp_error ("invalid operands `%T' and `%T' to binary `%O'",
- TREE_TYPE (orig_op0), TREE_TYPE (orig_op1), error_code);
+ error ("invalid operands of types `%T' and `%T' to binary `%O'",
+ TREE_TYPE (orig_op0), TREE_TYPE (orig_op1), code);
return error_mark_node;
}
@@ -4087,7 +4046,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
performed. Note that pointer-difference and pointer-addition
have already been handled above, and so we don't end up here in
that case. */
- cp_warning ("NULL used in arithmetic");
+ warning ("NULL used in arithmetic");
if (! converted)
{
@@ -4139,25 +4098,25 @@ pointer_int_sum (resultcode, ptrop, intop)
if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
{
if (pedantic || warn_pointer_arith)
- pedwarn ("ANSI C++ forbids using pointer of type `void *' in arithmetic");
+ pedwarn ("ISO C++ forbids using pointer of type `void *' in pointer arithmetic");
size_exp = integer_one_node;
}
else if (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE)
{
if (pedantic || warn_pointer_arith)
- pedwarn ("ANSI C++ forbids using pointer to a function in arithmetic");
+ pedwarn ("ISO C++ forbids using a pointer-to-function in pointer arithmetic");
size_exp = integer_one_node;
}
else if (TREE_CODE (TREE_TYPE (result_type)) == METHOD_TYPE)
{
if (pedantic || warn_pointer_arith)
- pedwarn ("ANSI C++ forbids using pointer to a method in arithmetic");
+ pedwarn ("ISO C++ forbids using a pointer to member function in pointer arithmetic");
size_exp = integer_one_node;
}
else if (TREE_CODE (TREE_TYPE (result_type)) == OFFSET_TYPE)
{
if (pedantic || warn_pointer_arith)
- pedwarn ("ANSI C++ forbids using pointer to a member in arithmetic");
+ pedwarn ("ISO C++ forbids using pointer to a member in pointer arithmetic");
size_exp = integer_one_node;
}
else
@@ -4165,9 +4124,7 @@ pointer_int_sum (resultcode, ptrop, intop)
/* Needed to make OOPS V2R3 work. */
intop = folded;
- if (TREE_CODE (intop) == INTEGER_CST
- && TREE_INT_CST_LOW (intop) == 0
- && TREE_INT_CST_HIGH (intop) == 0)
+ if (integer_zerop (intop))
return ptrop;
/* If what we are about to multiply by the size of the elements
@@ -4183,7 +4140,7 @@ pointer_int_sum (resultcode, ptrop, intop)
enum tree_code subcode = resultcode;
if (TREE_CODE (intop) == MINUS_EXPR)
subcode = (subcode == PLUS_EXPR ? MINUS_EXPR : PLUS_EXPR);
- ptrop = build_binary_op (subcode, ptrop, TREE_OPERAND (intop, 1));
+ ptrop = cp_build_binary_op (subcode, ptrop, TREE_OPERAND (intop, 1));
intop = TREE_OPERAND (intop, 0);
}
@@ -4198,9 +4155,9 @@ pointer_int_sum (resultcode, ptrop, intop)
pointer type (actually unsigned integral). */
intop = cp_convert (result_type,
- build_binary_op (MULT_EXPR, intop,
- cp_convert (TREE_TYPE (intop),
- size_exp)));
+ cp_build_binary_op (MULT_EXPR, intop,
+ cp_convert (TREE_TYPE (intop),
+ size_exp)));
/* Create the sum or difference. */
@@ -4230,24 +4187,25 @@ pointer_diff (op0, op1, ptrtype)
if (pedantic || warn_pointer_arith)
{
if (TREE_CODE (target_type) == VOID_TYPE)
- pedwarn ("ANSI C++ forbids using pointer of type `void *' in subtraction");
+ pedwarn ("ISO C++ forbids using pointer of type `void *' in subtraction");
if (TREE_CODE (target_type) == FUNCTION_TYPE)
- pedwarn ("ANSI C++ forbids using pointer to a function in subtraction");
+ pedwarn ("ISO C++ forbids using pointer to a function in subtraction");
if (TREE_CODE (target_type) == METHOD_TYPE)
- pedwarn ("ANSI C++ forbids using pointer to a method in subtraction");
+ pedwarn ("ISO C++ forbids using pointer to a method in subtraction");
if (TREE_CODE (target_type) == OFFSET_TYPE)
- pedwarn ("ANSI C++ forbids using pointer to a member in subtraction");
+ pedwarn ("ISO C++ forbids using pointer to a member in subtraction");
}
/* First do the subtraction as integers;
then drop through to build the divide operator. */
- op0 = build_binary_op (MINUS_EXPR, cp_convert (restype, op0),
- cp_convert (restype, op1));
+ op0 = cp_build_binary_op (MINUS_EXPR,
+ cp_convert (restype, op0),
+ cp_convert (restype, op1));
/* This generates an error if op1 is a pointer to an incomplete type. */
- if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (op1))) == 0)
- error ("arithmetic on pointer to an incomplete type");
+ if (!COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (op1))))
+ error ("invalid use of a pointer to an incomplete type in pointer arithmetic");
op1 = ((TREE_CODE (target_type) == VOID_TYPE
|| TREE_CODE (target_type) == FUNCTION_TYPE
@@ -4284,36 +4242,30 @@ build_component_addr (arg, argtype)
if (DECL_C_BIT_FIELD (field))
{
- cp_error ("attempt to take address of bit-field structure member `%D'",
+ error ("attempt to take address of bit-field structure member `%D'",
field);
return error_mark_node;
}
if (TREE_CODE (field) == FIELD_DECL
- && TYPE_USES_COMPLEX_INHERITANCE (basetype))
+ && TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (basetype))
{
/* Can't convert directly to ARGTYPE, since that
may have the same pointer type as one of our
baseclasses. */
- rval = build1 (NOP_EXPR, argtype,
- convert_pointer_to (basetype, rval));
+ tree binfo = lookup_base (TREE_TYPE (TREE_TYPE (rval)), basetype,
+ ba_check, NULL);
+
+ rval = build_base_path (PLUS_EXPR, rval, binfo, 1);
+ rval = build1 (NOP_EXPR, argtype, rval);
TREE_CONSTANT (rval) = TREE_CONSTANT (TREE_OPERAND (rval, 0));
}
else
/* This conversion is harmless. */
rval = convert_force (argtype, rval, 0);
- if (! integer_zerop (DECL_FIELD_BITPOS (field)))
- {
- tree offset = size_binop (EASY_DIV_EXPR, DECL_FIELD_BITPOS (field),
- size_int (BITS_PER_UNIT));
- int flag = TREE_CONSTANT (rval);
- offset = convert (sizetype, offset);
- rval = fold (build (PLUS_EXPR, argtype,
- rval, cp_convert (argtype, offset)));
- TREE_CONSTANT (rval) = flag;
- }
- return rval;
+ return fold (build (PLUS_EXPR, argtype, rval,
+ cp_convert (argtype, byte_position (field))));
}
/* Construct and perhaps optimize a tree representation
@@ -4325,6 +4277,9 @@ build_x_unary_op (code, xarg)
enum tree_code code;
tree xarg;
{
+ tree exp;
+ int ptrmem = 0;
+
if (processing_template_decl)
return build_min_nt (code, xarg, NULL_TREE);
@@ -4333,7 +4288,7 @@ build_x_unary_op (code, xarg)
if (code == ADDR_EXPR
&& TREE_CODE (xarg) != TEMPLATE_ID_EXPR
&& ((IS_AGGR_TYPE_CODE (TREE_CODE (TREE_TYPE (xarg)))
- && TYPE_SIZE (TREE_TYPE (xarg)) == NULL_TREE)
+ && !COMPLETE_TYPE_P (TREE_TYPE (xarg)))
|| (TREE_CODE (xarg) == OFFSET_REF)))
/* don't look for a function */;
else
@@ -4345,17 +4300,49 @@ build_x_unary_op (code, xarg)
if (rval || code != ADDR_EXPR)
return rval;
}
-
if (code == ADDR_EXPR)
{
- if (TREE_CODE (xarg) == TARGET_EXPR)
+ if (TREE_CODE (xarg) == OFFSET_REF)
+ {
+ ptrmem = PTRMEM_OK_P (xarg);
+
+ if (!ptrmem && !flag_ms_extensions
+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (xarg, 1))) == METHOD_TYPE)
+ {
+ /* A single non-static member, make sure we don't allow a
+ pointer-to-member. */
+ xarg = build (OFFSET_REF, TREE_TYPE (xarg),
+ TREE_OPERAND (xarg, 0),
+ ovl_cons (TREE_OPERAND (xarg, 1), NULL_TREE));
+ PTRMEM_OK_P (xarg) = ptrmem;
+ }
+
+ }
+ else if (TREE_CODE (xarg) == TARGET_EXPR)
warning ("taking address of temporary");
}
+ exp = build_unary_op (code, xarg, 0);
+ if (TREE_CODE (exp) == ADDR_EXPR)
+ PTRMEM_OK_P (exp) = ptrmem;
+
+ return exp;
+}
+
+/* Like truthvalue_conversion, but handle pointer-to-member constants, where
+ a null value is represented by an INTEGER_CST of -1. */
- return build_unary_op (code, xarg, 0);
+tree
+cp_truthvalue_conversion (expr)
+ tree expr;
+{
+ tree type = TREE_TYPE (expr);
+ if (TYPE_PTRMEM_P (type))
+ return build_binary_op (NE_EXPR, expr, integer_zero_node, 1);
+ else
+ return truthvalue_conversion (expr);
}
-/* Just like truthvalue_conversion, but we want a CLEANUP_POINT_EXPR. */
+/* Just like cp_truthvalue_conversion, but we want a CLEANUP_POINT_EXPR. */
tree
condition_conversion (expr)
@@ -4364,7 +4351,9 @@ condition_conversion (expr)
tree t;
if (processing_template_decl)
return expr;
- t = cp_convert (boolean_type_node, expr);
+ if (TREE_CODE (expr) == OFFSET_REF)
+ expr = resolve_offset_ref (expr);
+ t = perform_implicit_conversion (boolean_type_node, expr);
t = fold (build1 (CLEANUP_POINT_EXPR, boolean_type_node, t));
return t;
}
@@ -4532,7 +4521,7 @@ build_unary_op (code, xarg, noconvert)
/* ARM $5.2.5 last annotation says this should be forbidden. */
if (TREE_CODE (argtype) == ENUMERAL_TYPE)
- pedwarn ("ANSI C++ forbids %sing an enum",
+ pedwarn ("ISO C++ forbids %sing an enum",
(code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
? "increment" : "decrement");
@@ -4541,15 +4530,17 @@ build_unary_op (code, xarg, noconvert)
if (TREE_CODE (argtype) == POINTER_TYPE)
{
enum tree_code tmp = TREE_CODE (TREE_TYPE (argtype));
- if (TYPE_SIZE (complete_type (TREE_TYPE (argtype))) == 0)
- cp_error ("cannot %s a pointer to incomplete type `%T'",
+ tree type = complete_type (TREE_TYPE (argtype));
+
+ if (!COMPLETE_OR_VOID_TYPE_P (type))
+ error ("cannot %s a pointer to incomplete type `%T'",
((code == PREINCREMENT_EXPR
|| code == POSTINCREMENT_EXPR)
? "increment" : "decrement"), TREE_TYPE (argtype));
else if ((pedantic || warn_pointer_arith)
&& (tmp == FUNCTION_TYPE || tmp == METHOD_TYPE
|| tmp == VOID_TYPE || tmp == OFFSET_TYPE))
- cp_pedwarn ("ANSI C++ forbids %sing a pointer of type `%T'",
+ pedwarn ("ISO C++ forbids %sing a pointer of type `%T'",
((code == PREINCREMENT_EXPR
|| code == POSTINCREMENT_EXPR)
? "increment" : "decrement"), argtype);
@@ -4584,7 +4575,6 @@ build_unary_op (code, xarg, noconvert)
|| code == POSTINCREMENT_EXPR)
? PLUS_EXPR : MINUS_EXPR),
argtype, value, inc);
- TREE_SIDE_EFFECTS (incremented) = 1;
modify = build_modify_expr (arg, NOP_EXPR, incremented);
compound = build (COMPOUND_EXPR, TREE_TYPE (arg), modify, value);
@@ -4609,7 +4599,7 @@ build_unary_op (code, xarg, noconvert)
{
if (code == POSTDECREMENT_EXPR || code == PREDECREMENT_EXPR)
{
- cp_error ("invalid use of `--' on bool variable `%D'", arg);
+ error ("invalid use of `--' on bool variable `%D'", arg);
return error_mark_node;
}
#if 0
@@ -4617,19 +4607,7 @@ build_unary_op (code, xarg, noconvert)
my patch to expand_increment. (jason) */
val = build (code, TREE_TYPE (arg), arg, inc);
#else
- if (code == POSTINCREMENT_EXPR)
- {
- arg = stabilize_reference (arg);
- val = build (MODIFY_EXPR, TREE_TYPE (arg), arg,
- boolean_true_node);
- TREE_SIDE_EFFECTS (val) = 1;
- arg = save_expr (arg);
- val = build (COMPOUND_EXPR, TREE_TYPE (arg), val, arg);
- val = build (COMPOUND_EXPR, TREE_TYPE (arg), arg, val);
- }
- else
- val = build (MODIFY_EXPR, TREE_TYPE (arg), arg,
- boolean_true_node);
+ val = boolean_increment (code, arg);
#endif
}
else
@@ -4654,7 +4632,7 @@ build_unary_op (code, xarg, noconvert)
}
else if (pedantic && DECL_MAIN_P (arg))
/* ARM $3.4 */
- pedwarn ("taking address of function `main'");
+ pedwarn ("ISO C++ forbids taking address of function `::main'");
/* Let &* cancel out to simplify resulting code. */
if (TREE_CODE (arg) == INDIRECT_REF)
@@ -4683,8 +4661,8 @@ build_unary_op (code, xarg, noconvert)
{
if (mark_addressable (TREE_OPERAND (arg, 0)) == 0)
return error_mark_node;
- return build_binary_op (PLUS_EXPR, TREE_OPERAND (arg, 0),
- TREE_OPERAND (arg, 1));
+ return cp_build_binary_op (PLUS_EXPR, TREE_OPERAND (arg, 0),
+ TREE_OPERAND (arg, 1));
}
/* Uninstantiated types are all functions. Taking the
@@ -4694,37 +4672,43 @@ build_unary_op (code, xarg, noconvert)
if (TREE_CODE (arg) == IDENTIFIER_NODE
&& IDENTIFIER_OPNAME_P (arg))
{
- my_friendly_abort (117);
+ abort ();
/* We don't know the type yet, so just work around the problem.
We know that this will resolve to an lvalue. */
return build1 (ADDR_EXPR, unknown_type_node, arg);
}
if (TREE_CODE (arg) == COMPONENT_REF && type_unknown_p (arg)
- && OVL_NEXT (TREE_OPERAND (arg, 1)) == NULL_TREE)
- {
+ && OVL_NEXT (TREE_OPERAND (arg, 1)) == NULL_TREE)
+ {
/* They're trying to take the address of a unique non-static
- member function. This is ill-formed, but let's try to DTRT. */
- tree base, name;
-
- if (current_class_type
- && TREE_OPERAND (arg, 0) == current_class_ref)
- /* An expression like &memfn. */
- pedwarn ("taking the address of a non-static member function");
- else
- pedwarn ("taking the address of a bound member function");
-
- base = TREE_TYPE (TREE_OPERAND (arg, 0));
- name = DECL_NAME (OVL_CURRENT (TREE_OPERAND (arg, 1)));
-
- cp_pedwarn (" to form a pointer to member function, say `&%T::%D'",
- base, name);
+ member function. This is ill-formed (except in MS-land),
+ but let's try to DTRT.
+ Note: We only handle unique functions here because we don't
+ want to complain if there's a static overload; non-unique
+ cases will be handled by instantiate_type. But we need to
+ handle this case here to allow casts on the resulting PMF.
+ We could defer this in non-MS mode, but it's easier to give
+ a useful error here. */
+
+ tree base = TREE_TYPE (TREE_OPERAND (arg, 0));
+ tree name = DECL_NAME (OVL_CURRENT (TREE_OPERAND (arg, 1)));
+
+ if (! flag_ms_extensions)
+ {
+ if (current_class_type
+ && TREE_OPERAND (arg, 0) == current_class_ref)
+ /* An expression like &memfn. */
+ pedwarn ("ISO C++ forbids taking the address of an unqualified non-static member function to form a pointer to member function. Say `&%T::%D'", base, name);
+ else
+ pedwarn ("ISO C++ forbids taking the address of a bound member function to form a pointer to member function. Say `&%T::%D'", base, name);
+ }
arg = build_offset_ref (base, name);
- }
-
+ }
+
if (type_unknown_p (arg))
return build1 (ADDR_EXPR, unknown_type_node, arg);
-
+
/* Handle complex lvalues (when permitted)
by reduction to simpler cases. */
val = unary_complex_lvalue (code, arg);
@@ -4741,7 +4725,7 @@ build_unary_op (code, xarg, noconvert)
case FIX_ROUND_EXPR:
case FIX_CEIL_EXPR:
if (! lvalue_p (arg) && pedantic)
- pedwarn ("taking the address of a cast to non-reference type");
+ pedwarn ("ISO C++ forbids taking the address of a cast to a non-lvalue expression");
break;
default:
@@ -4800,39 +4784,10 @@ build_unary_op (code, xarg, noconvert)
return fold (build1 (code, argtype, arg));
}
- error (errstring);
+ error ("%s", errstring);
return error_mark_node;
}
-#if 0
-/* If CONVERSIONS is a conversion expression or a nested sequence of such,
- convert ARG with the same conversions in the same order
- and return the result. */
-
-static tree
-convert_sequence (conversions, arg)
- tree conversions;
- tree arg;
-{
- switch (TREE_CODE (conversions))
- {
- case NOP_EXPR:
- case CONVERT_EXPR:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_ROUND_EXPR:
- case FIX_CEIL_EXPR:
- return cp_convert (TREE_TYPE (conversions),
- convert_sequence (TREE_OPERAND (conversions, 0),
- arg));
-
- default:
- return arg;
- }
-}
-#endif
-
/* Apply unary lvalue-demanding operator CODE to the expression ARG
for certain kinds of expressions which are not really lvalues
but which we can accept as lvalues.
@@ -4857,12 +4812,21 @@ unary_complex_lvalue (code, arg)
|| TREE_CODE (arg) == MIN_EXPR || TREE_CODE (arg) == MAX_EXPR)
return rationalize_conditional_expr (code, arg);
+ /* Handle (a = b), (++a), and (--a) used as an "lvalue". */
if (TREE_CODE (arg) == MODIFY_EXPR
|| TREE_CODE (arg) == PREINCREMENT_EXPR
|| TREE_CODE (arg) == PREDECREMENT_EXPR)
- return unary_complex_lvalue
- (code, build (COMPOUND_EXPR, TREE_TYPE (TREE_OPERAND (arg, 0)),
- arg, TREE_OPERAND (arg, 0)));
+ {
+ tree lvalue = TREE_OPERAND (arg, 0);
+ if (TREE_SIDE_EFFECTS (lvalue))
+ {
+ lvalue = stabilize_reference (lvalue);
+ arg = build (TREE_CODE (arg), TREE_TYPE (arg),
+ lvalue, TREE_OPERAND (arg, 1));
+ }
+ return unary_complex_lvalue
+ (code, build (COMPOUND_EXPR, TREE_TYPE (lvalue), arg, lvalue));
+ }
if (code != ADDR_EXPR)
return 0;
@@ -4897,7 +4861,7 @@ unary_complex_lvalue (code, arg)
if (TREE_CODE (t) == FUNCTION_DECL)
{
if (DECL_DESTRUCTOR_P (t))
- cp_error ("taking address of destructor");
+ error ("taking address of destructor");
return build_unary_op (ADDR_EXPR, t, 0);
}
if (TREE_CODE (t) == VAR_DECL)
@@ -4910,7 +4874,23 @@ unary_complex_lvalue (code, arg)
&& ! is_dummy_object (TREE_OPERAND (arg, 0))
&& TREE_CODE (t) != FIELD_DECL)
{
- cp_error ("taking address of bound pointer-to-member expression");
+ error ("taking address of bound pointer-to-member expression");
+ return error_mark_node;
+ }
+ if (!PTRMEM_OK_P (arg))
+ {
+ /* This cannot form a pointer to method, so we must
+ resolve the offset ref, and take the address of the
+ result. For instance,
+ &(C::m) */
+ arg = resolve_offset_ref (arg);
+
+ return build_unary_op (code, arg, 0);
+ }
+
+ if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE)
+ {
+ error ("cannot create pointer to reference member `%D'", t);
return error_mark_node;
}
@@ -4978,33 +4958,11 @@ mark_addressable (exp)
case PARM_DECL:
if (x == current_class_ptr)
{
- if (! flag_this_is_variable)
- error ("address of `this' not available");
+ error ("cannot take the address of `this', which is an rvalue expression");
TREE_ADDRESSABLE (x) = 1; /* so compiler doesn't die later */
- put_var_into_stack (x);
return 1;
}
case VAR_DECL:
- if (TREE_STATIC (x) && TREE_READONLY (x)
- && DECL_RTL (x) != 0
- && ! DECL_IN_MEMORY_P (x))
- {
- /* We thought this would make a good constant variable,
- but we were wrong. */
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- TREE_ASM_WRITTEN (x) = 0;
- DECL_RTL (x) = 0;
- rest_of_decl_compilation (x, 0,
- !DECL_FUNCTION_SCOPE_P (x),
- 0);
- TREE_ADDRESSABLE (x) = 1;
-
- pop_obstacks ();
-
- return 1;
- }
/* Caller should not be trying to mark initialized
constant fields addressable. */
my_friendly_assert (DECL_LANG_SPECIFIC (x) == 0
@@ -5016,24 +4974,13 @@ mark_addressable (exp)
case RESULT_DECL:
if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x)
&& !DECL_ARTIFICIAL (x) && extra_warnings)
- cp_warning ("address requested for `%D', which is declared `register'",
+ warning ("address requested for `%D', which is declared `register'",
x);
- put_var_into_stack (x);
TREE_ADDRESSABLE (x) = 1;
return 1;
case FUNCTION_DECL:
- if (DECL_LANG_SPECIFIC (x) != 0)
- {
- x = DECL_MAIN_VARIANT (x);
- /* We have to test both conditions here. The first may be
- non-zero in the case of processing a default function. The
- second may be non-zero in the case of a template function. */
- if (DECL_TEMPLATE_INFO (x) && !DECL_TEMPLATE_SPECIALIZATION (x))
- mark_used (x);
- }
TREE_ADDRESSABLE (x) = 1;
- TREE_USED (x) = 1;
TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (x)) = 1;
return 1;
@@ -5060,326 +5007,7 @@ build_x_conditional_expr (ifexp, op1, op2)
if (processing_template_decl)
return build_min_nt (COND_EXPR, ifexp, op1, op2);
- return build_new_op (COND_EXPR, LOOKUP_NORMAL, ifexp, op1, op2);
-}
-
-tree
-build_conditional_expr (ifexp, op1, op2)
- tree ifexp, op1, op2;
-{
- register tree type1;
- register tree type2;
- register enum tree_code code1;
- register enum tree_code code2;
- register tree result_type = NULL_TREE;
-
- /* If second operand is omitted, it is the same as the first one;
- make sure it is calculated only once. */
- if (op1 == 0)
- {
- if (pedantic)
- pedwarn ("ANSI C++ forbids omitting the middle term of a ?: expression");
- ifexp = op1 = save_expr (ifexp);
- }
-
- type1 = TREE_TYPE (op1);
- code1 = TREE_CODE (type1);
- type2 = TREE_TYPE (op2);
- code2 = TREE_CODE (type2);
- if (op1 == error_mark_node || op2 == error_mark_node
- || type1 == error_mark_node || type2 == error_mark_node)
- return error_mark_node;
-
- ifexp = cp_convert (boolean_type_node, ifexp);
-
- if (TREE_CODE (ifexp) == ERROR_MARK)
- return error_mark_node;
-
- /* C++: REFERENCE_TYPES must be dereferenced. */
- if (code1 == REFERENCE_TYPE)
- {
- op1 = convert_from_reference (op1);
- type1 = TREE_TYPE (op1);
- code1 = TREE_CODE (type1);
- }
- if (code2 == REFERENCE_TYPE)
- {
- op2 = convert_from_reference (op2);
- type2 = TREE_TYPE (op2);
- code2 = TREE_CODE (type2);
- }
-
- /* Don't promote the operands separately if they promote
- the same way. Return the unpromoted type and let the combined
- value get promoted if necessary. */
-
- if (TYPE_MAIN_VARIANT (type1) == TYPE_MAIN_VARIANT (type2)
- && code2 != ARRAY_TYPE
- && code2 != FUNCTION_TYPE
- && code2 != METHOD_TYPE)
- {
- tree result;
-
- if (TREE_CONSTANT (ifexp)
- && (TREE_CODE (ifexp) == INTEGER_CST
- || TREE_CODE (ifexp) == ADDR_EXPR))
- return (integer_zerop (ifexp) ? op2 : op1);
-
- if (TREE_CODE (op1) == CONST_DECL)
- op1 = DECL_INITIAL (op1);
- else if (TREE_READONLY_DECL_P (op1))
- op1 = decl_constant_value (op1);
- if (TREE_CODE (op2) == CONST_DECL)
- op2 = DECL_INITIAL (op2);
- else if (TREE_READONLY_DECL_P (op2))
- op2 = decl_constant_value (op2);
- if (type1 != type2)
- type1 = cp_build_qualified_type
- (type1, (CP_TYPE_QUALS (TREE_TYPE (op1))
- | CP_TYPE_QUALS (TREE_TYPE (op2))));
- /* ??? This is a kludge to deal with the fact that
- we don't sort out integers and enums properly, yet. */
- result = fold (build (COND_EXPR, type1, ifexp, op1, op2));
- if (TREE_TYPE (result) != type1)
- result = build1 (NOP_EXPR, type1, result);
- /* Expand both sides into the same slot,
- hopefully the target of the ?: expression. */
- if (TREE_CODE (op1) == TARGET_EXPR && TREE_CODE (op2) == TARGET_EXPR)
- {
- tree slot = build (VAR_DECL, TREE_TYPE (result));
- layout_decl (slot, 0);
- result = build (TARGET_EXPR, TREE_TYPE (result),
- slot, result, NULL_TREE, NULL_TREE);
- }
- return result;
- }
-
- /* They don't match; promote them both and then try to reconcile them.
- But don't permit mismatching enum types. */
- if (code1 == ENUMERAL_TYPE)
- {
- if (code2 == ENUMERAL_TYPE)
- {
- cp_error ("enumeral mismatch in conditional expression: `%T' vs `%T'",
- type1, type2);
- return error_mark_node;
- }
- else if (extra_warnings && ! IS_AGGR_TYPE_CODE (code2)
- && type2 != type_promotes_to (type1))
- warning ("enumeral and non-enumeral type in conditional expression");
- }
- else if (extra_warnings
- && code2 == ENUMERAL_TYPE && ! IS_AGGR_TYPE_CODE (code1)
- && type1 != type_promotes_to (type2))
- warning ("enumeral and non-enumeral type in conditional expression");
-
- if (code1 != VOID_TYPE)
- {
- op1 = default_conversion (op1);
- type1 = TREE_TYPE (op1);
- if (TYPE_PTRMEMFUNC_P (type1))
- type1 = TYPE_PTRMEMFUNC_FN_TYPE (type1);
- code1 = TREE_CODE (type1);
- }
- if (code2 != VOID_TYPE)
- {
- op2 = default_conversion (op2);
- type2 = TREE_TYPE (op2);
- if (TYPE_PTRMEMFUNC_P (type2))
- type2 = TYPE_PTRMEMFUNC_FN_TYPE (type2);
- code2 = TREE_CODE (type2);
- }
-
- if (code1 == RECORD_TYPE && code2 == RECORD_TYPE
- && real_lvalue_p (op1) && real_lvalue_p (op2)
- && comptypes (type1, type2, COMPARE_BASE | COMPARE_RELAXED))
- {
- type1 = build_reference_type (type1);
- type2 = build_reference_type (type2);
- result_type = common_type (type1, type2);
- op1 = convert_to_reference (result_type, op1, CONV_IMPLICIT,
- LOOKUP_NORMAL, NULL_TREE);
- op2 = convert_to_reference (result_type, op2, CONV_IMPLICIT,
- LOOKUP_NORMAL, NULL_TREE);
- }
- /* Quickly detect the usual case where op1 and op2 have the same type
- after promotion. */
- else if (TYPE_MAIN_VARIANT (type1) == TYPE_MAIN_VARIANT (type2))
- {
- if (type1 == type2)
- result_type = type1;
- else
- result_type =
- cp_build_qualified_type (type1,
- CP_TYPE_QUALS (TREE_TYPE (op1))
- | CP_TYPE_QUALS (TREE_TYPE (op2)));
- }
- else if ((code1 == INTEGER_TYPE || code1 == REAL_TYPE)
- && (code2 == INTEGER_TYPE || code2 == REAL_TYPE))
- {
- result_type = common_type (type1, type2);
- }
- else if (code1 == VOID_TYPE || code2 == VOID_TYPE)
- {
- if (pedantic && (code1 != VOID_TYPE || code2 != VOID_TYPE))
- pedwarn ("ANSI C++ forbids conditional expr with only one void side");
- result_type = void_type_node;
- }
- else if (code1 == POINTER_TYPE && null_ptr_cst_p (op2))
- result_type = qualify_type (type1, type2);
- else if (code2 == POINTER_TYPE && null_ptr_cst_p (op1))
- result_type = qualify_type (type2, type1);
- else if (code1 == POINTER_TYPE && code2 == POINTER_TYPE)
- {
- if (comp_target_types (type1, type2, 1))
- result_type = common_type (type1, type2);
- else if (TYPE_MAIN_VARIANT (TREE_TYPE (type1)) == void_type_node)
- {
- if (pedantic && TREE_CODE (type2) == FUNCTION_TYPE)
- pedwarn ("ANSI C++ forbids conditional expr between `void *' and function pointer");
- result_type = qualify_type (type1, type2);
- }
- else if (TYPE_MAIN_VARIANT (TREE_TYPE (type2)) == void_type_node)
- {
- if (pedantic && TREE_CODE (type1) == FUNCTION_TYPE)
- pedwarn ("ANSI C++ forbids conditional expr between `void *' and function pointer");
- result_type = qualify_type (type2, type1);
- }
- /* C++ */
- else if (same_or_base_type_p (type2, type1))
- result_type = type2;
- else if (IS_AGGR_TYPE (TREE_TYPE (type1))
- && IS_AGGR_TYPE (TREE_TYPE (type2))
- && (result_type = common_base_type (TREE_TYPE (type1),
- TREE_TYPE (type2))))
- {
- if (result_type == error_mark_node)
- {
- cp_error ("common base type of types `%T' and `%T' is ambiguous",
- TREE_TYPE (type1), TREE_TYPE (type2));
- result_type = ptr_type_node;
- }
- else
- {
- if (pedantic
- && result_type != TREE_TYPE (type1)
- && result_type != TREE_TYPE (type2))
- cp_pedwarn ("`%T' and `%T' converted to `%T *' in conditional expression",
- type1, type2, result_type);
-
- result_type = build_pointer_type (result_type);
- }
- }
- else
- {
- pedwarn ("pointer type mismatch in conditional expression");
- result_type = ptr_type_node;
- }
- }
- else if (code1 == POINTER_TYPE && code2 == INTEGER_TYPE)
- {
- pedwarn ("pointer/integer type mismatch in conditional expression");
- result_type = type1;
- }
- else if (code2 == POINTER_TYPE && code1 == INTEGER_TYPE)
- {
- pedwarn ("pointer/integer type mismatch in conditional expression");
- result_type = type2;
- }
- if (type2 == unknown_type_node)
- result_type = type1;
- else if (type1 == unknown_type_node)
- result_type = type2;
-
- if (!result_type)
- {
- /* The match does not look good. If either is
- an aggregate value, try converting to a scalar type. */
- if (code1 == RECORD_TYPE && code2 == RECORD_TYPE)
- {
- cp_error ("aggregate mismatch in conditional expression: `%T' vs `%T'",
- type1, type2);
- return error_mark_node;
- }
- /* Warning: this code assumes that conversion between cv-variants of
- a type is done using NOP_EXPRs. */
- if (code1 == RECORD_TYPE && TYPE_HAS_CONVERSION (type1))
- {
- /* There are other types besides pointers and records. */
- tree tmp;
- if (code2 == POINTER_TYPE)
- tmp = build_pointer_type
- (cp_build_qualified_type (TREE_TYPE (type2),
- TYPE_QUAL_CONST
- | TYPE_QUAL_VOLATILE
- | TYPE_QUAL_RESTRICT));
- else
- tmp = type2;
- tmp = build_type_conversion (tmp, op1, 0);
- if (tmp == NULL_TREE)
- {
- cp_error ("incompatible types `%T' and `%T' in `?:'",
- type1, type2);
- return error_mark_node;
- }
- if (tmp == error_mark_node)
- error ("ambiguous pointer conversion");
- else
- STRIP_NOPS (tmp);
- result_type = common_type (type2, TREE_TYPE (tmp));
- op1 = tmp;
- }
- else if (code2 == RECORD_TYPE && TYPE_HAS_CONVERSION (type2))
- {
- tree tmp;
- if (code1 == POINTER_TYPE)
- tmp = build_pointer_type
- (cp_build_qualified_type (TREE_TYPE (type1),
- TYPE_QUAL_CONST
- | TYPE_QUAL_VOLATILE
- | TYPE_QUAL_RESTRICT));
- else
- tmp = type1;
-
- tmp = build_type_conversion (tmp, op2, 0);
- if (tmp == NULL_TREE)
- {
- cp_error ("incompatible types `%T' and `%T' in `?:'",
- type1, type2);
- return error_mark_node;
- }
- if (tmp == error_mark_node)
- error ("ambiguous pointer conversion");
- else
- STRIP_NOPS (tmp);
- result_type = common_type (type1, TREE_TYPE (tmp));
- op2 = tmp;
- }
- else if (flag_cond_mismatch)
- result_type = void_type_node;
- else
- {
- error ("type mismatch in conditional expression");
- return error_mark_node;
- }
- }
-
- if (TREE_CODE (result_type) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (result_type)) == METHOD_TYPE)
- result_type = build_ptrmemfunc_type (result_type);
-
- if (result_type != TREE_TYPE (op1))
- op1 = convert_for_initialization
- (NULL_TREE, result_type, op1, LOOKUP_NORMAL, "converting", NULL_TREE, 0);
- if (result_type != TREE_TYPE (op2))
- op2 = convert_for_initialization
- (NULL_TREE, result_type, op2, LOOKUP_NORMAL, "converting", NULL_TREE, 0);
-
- if (TREE_CODE (ifexp) == INTEGER_CST)
- return integer_zerop (ifexp) ? op2 : op1;
-
- return convert_from_reference
- (fold (build (COND_EXPR, result_type, ifexp, op1, op2)));
+ return build_conditional_expr (ifexp, op1, op2);
}
/* Handle overloading of the ',' operator when needed. Otherwise,
@@ -5401,27 +5029,28 @@ build_x_compound_expr (list)
result = build_opfncall (COMPOUND_EXPR, LOOKUP_NORMAL,
TREE_VALUE (list), TREE_VALUE (rest), NULL_TREE);
if (result)
- return build_x_compound_expr (expr_tree_cons (NULL_TREE, result,
+ return build_x_compound_expr (tree_cons (NULL_TREE, result,
TREE_CHAIN (rest)));
if (! TREE_SIDE_EFFECTS (TREE_VALUE (list)))
{
+ /* FIXME: This test should be in the implicit cast to void of the LHS. */
/* the left-hand operand of a comma expression is like an expression
statement: we should warn if it doesn't have any side-effects,
unless it was explicitly cast to (void). */
- if ((extra_warnings || warn_unused)
+ if ((extra_warnings || warn_unused_value)
&& !(TREE_CODE (TREE_VALUE(list)) == CONVERT_EXPR
- && TREE_TYPE (TREE_VALUE(list)) == void_type_node))
+ && VOID_TYPE_P (TREE_TYPE (TREE_VALUE(list)))))
warning("left-hand operand of comma expression has no effect");
}
#if 0 /* this requires a gcc backend patch to export warn_if_unused_value */
- else if (warn_unused)
+ else if (warn_unused_value)
warn_if_unused_value (TREE_VALUE(list));
#endif
return build_compound_expr
- (expr_tree_cons (NULL_TREE, TREE_VALUE (list),
- build_expr_list (NULL_TREE,
+ (tree_cons (NULL_TREE, TREE_VALUE (list),
+ build_tree_list (NULL_TREE,
build_x_compound_expr (rest))));
}
@@ -5435,8 +5064,7 @@ build_compound_expr (list)
register tree rest;
tree first;
- if (TREE_READONLY_DECL_P (TREE_VALUE (list)))
- TREE_VALUE (list) = decl_constant_value (TREE_VALUE (list));
+ TREE_VALUE (list) = decl_constant_value (TREE_VALUE (list));
if (TREE_CHAIN (list) == 0)
{
@@ -5445,16 +5073,12 @@ build_compound_expr (list)
if (TREE_CODE (list) == NOP_EXPR
&& TREE_TYPE (list) == TREE_TYPE (TREE_OPERAND (list, 0)))
list = TREE_OPERAND (list, 0);
-
- /* Convert arrays to pointers. */
- if (TREE_CODE (TREE_TYPE (TREE_VALUE (list))) == ARRAY_TYPE)
- return default_conversion (TREE_VALUE (list));
- else
- return TREE_VALUE (list);
+
+ return TREE_VALUE (list);
}
first = TREE_VALUE (list);
- first = require_complete_type_in_void (first);
+ first = convert_to_void (first, "left-hand operand of comma");
if (first == error_mark_node)
return error_mark_node;
@@ -5466,15 +5090,14 @@ build_compound_expr (list)
if (! TREE_SIDE_EFFECTS (first) && ! pedantic)
return rest;
- return build (COMPOUND_EXPR, TREE_TYPE (rest),
- break_out_cleanups (first), rest);
+ return build (COMPOUND_EXPR, TREE_TYPE (rest), first, rest);
}
tree
build_static_cast (type, expr)
tree type, expr;
{
- tree intype, binfo;
+ tree intype;
int ok;
if (type == error_mark_node || expr == error_mark_node)
@@ -5485,8 +5108,7 @@ build_static_cast (type, expr)
if (processing_template_decl)
{
- tree t = build_min (STATIC_CAST_EXPR, copy_to_permanent (type),
- expr);
+ tree t = build_min (STATIC_CAST_EXPR, type, expr);
return t;
}
@@ -5498,7 +5120,10 @@ build_static_cast (type, expr)
expr = TREE_OPERAND (expr, 0);
if (TREE_CODE (type) == VOID_TYPE)
- return build1 (CONVERT_EXPR, type, expr);
+ {
+ expr = convert_to_void (expr, /*implicit=*/NULL);
+ return expr;
+ }
if (TREE_CODE (type) == REFERENCE_TYPE)
return (convert_from_reference
@@ -5506,50 +5131,62 @@ build_static_cast (type, expr)
LOOKUP_COMPLAIN, NULL_TREE)));
if (IS_AGGR_TYPE (type))
- return build_cplus_new
- (type, (build_method_call
- (NULL_TREE, ctor_identifier, build_expr_list (NULL_TREE, expr),
- TYPE_BINFO (type), LOOKUP_NORMAL)));
-
- expr = decay_conversion (expr);
+ return build_cplus_new (type, (build_method_call
+ (NULL_TREE, complete_ctor_identifier,
+ build_tree_list (NULL_TREE, expr),
+ TYPE_BINFO (type), LOOKUP_NORMAL)));
+
intype = TREE_TYPE (expr);
/* FIXME handle casting to array type. */
ok = 0;
- if (can_convert_arg (type, intype, expr))
+ if (IS_AGGR_TYPE (intype)
+ ? can_convert_arg (type, intype, expr)
+ : can_convert_arg (strip_all_pointer_quals (type),
+ strip_all_pointer_quals (intype), expr))
+ /* This is a standard conversion. */
ok = 1;
else if (TYPE_PTROB_P (type) && TYPE_PTROB_P (intype))
{
- tree binfo;
+ /* They're pointers to objects. They must be aggregates that
+ are related non-virtually. */
+ base_kind kind;
+
if (IS_AGGR_TYPE (TREE_TYPE (type)) && IS_AGGR_TYPE (TREE_TYPE (intype))
- && at_least_as_qualified_p (TREE_TYPE (type),
- TREE_TYPE (intype))
- && (binfo = get_binfo (TREE_TYPE (intype), TREE_TYPE (type), 0))
- && ! TREE_VIA_VIRTUAL (binfo))
- ok = 1;
- }
- else if (TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
- {
- if (same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type))),
- TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (intype))))
- && at_least_as_qualified_p (TREE_TYPE (TREE_TYPE (type)),
- TREE_TYPE (TREE_TYPE (intype)))
- && (binfo = get_binfo (TYPE_OFFSET_BASETYPE (TREE_TYPE (type)),
- TYPE_OFFSET_BASETYPE (TREE_TYPE (intype)), 0))
- && ! TREE_VIA_VIRTUAL (binfo))
+ && lookup_base (TREE_TYPE (type), TREE_TYPE (intype),
+ ba_ignore | ba_quiet, &kind)
+ && kind != bk_via_virtual)
ok = 1;
}
else if (TREE_CODE (intype) != BOOLEAN_TYPE
&& TREE_CODE (type) != ARRAY_TYPE
&& TREE_CODE (type) != FUNCTION_TYPE
- && can_convert (intype, type))
+ && can_convert (intype, strip_all_pointer_quals (type)))
ok = 1;
+ else if (TREE_CODE (intype) == ENUMERAL_TYPE
+ && TREE_CODE (type) == ENUMERAL_TYPE)
+ /* DR 128: "A value of integral _or enumeration_ type can be explicitly
+ converted to an enumeration type."
+ The integral to enumeration will be accepted by the previous clause.
+ We need to explicitly check for enumeration to enumeration. */
+ ok = 1;
+
+ /* [expr.static.cast]
+
+ The static_cast operator shall not be used to cast away
+ constness. */
+ if (ok && casts_away_constness (intype, type))
+ {
+ error ("static_cast from type `%T' to type `%T' casts away constness",
+ intype, type);
+ return error_mark_node;
+ }
if (ok)
return build_c_cast (type, expr);
- cp_error ("static_cast from `%T' to `%T'", intype, type);
+ error ("invalid static_cast from type `%T' to type `%T'", intype, type);
return error_mark_node;
}
@@ -5567,8 +5204,7 @@ build_reinterpret_cast (type, expr)
if (processing_template_decl)
{
- tree t = build_min (REINTERPRET_CAST_EXPR,
- copy_to_permanent (type), expr);
+ tree t = build_min (REINTERPRET_CAST_EXPR, type, expr);
return t;
}
@@ -5589,7 +5225,7 @@ build_reinterpret_cast (type, expr)
{
if (! real_lvalue_p (expr))
{
- cp_error ("reinterpret_cast from `%T' rvalue to `%T'", intype, type);
+ error ("invalid reinterpret_cast of an rvalue expression of type `%T' to type `%T'", intype, type);
return error_mark_node;
}
expr = build_unary_op (ADDR_EXPR, expr, 0);
@@ -5600,8 +5236,7 @@ build_reinterpret_cast (type, expr)
expr = build_indirect_ref (expr, 0);
return expr;
}
- else if (same_type_p (TYPE_MAIN_VARIANT (intype),
- TYPE_MAIN_VARIANT (type)))
+ else if (same_type_ignoring_top_level_qualifiers_p (intype, type))
return build_static_cast (type, expr);
if (TYPE_PTR_P (type) && (TREE_CODE (intype) == INTEGER_TYPE
@@ -5610,38 +5245,36 @@ build_reinterpret_cast (type, expr)
else if (TREE_CODE (type) == INTEGER_TYPE && TYPE_PTR_P (intype))
{
if (TYPE_PRECISION (type) < TYPE_PRECISION (intype))
- cp_pedwarn ("reinterpret_cast from `%T' to `%T' loses precision",
+ pedwarn ("reinterpret_cast from `%T' to `%T' loses precision",
intype, type);
}
else if ((TYPE_PTRFN_P (type) && TYPE_PTRFN_P (intype))
|| (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype)))
{
- if (TREE_READONLY_DECL_P (expr))
- expr = decl_constant_value (expr);
+ expr = decl_constant_value (expr);
return fold (build1 (NOP_EXPR, type, expr));
}
else if ((TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
|| (TYPE_PTROBV_P (type) && TYPE_PTROBV_P (intype)))
{
if (! comp_ptr_ttypes_reinterpret (TREE_TYPE (type), TREE_TYPE (intype)))
- cp_pedwarn ("reinterpret_cast from `%T' to `%T' casts away const (or volatile)",
+ pedwarn ("reinterpret_cast from `%T' to `%T' casts away const (or volatile)",
intype, type);
- if (TREE_READONLY_DECL_P (expr))
- expr = decl_constant_value (expr);
+ expr = decl_constant_value (expr);
return fold (build1 (NOP_EXPR, type, expr));
}
else if ((TYPE_PTRFN_P (type) && TYPE_PTROBV_P (intype))
|| (TYPE_PTRFN_P (intype) && TYPE_PTROBV_P (type)))
{
- pedwarn ("ANSI C++ forbids casting between pointers to functions and objects");
- if (TREE_READONLY_DECL_P (expr))
- expr = decl_constant_value (expr);
+ pedwarn ("ISO C++ forbids casting between pointer-to-function and pointer-to-object");
+ expr = decl_constant_value (expr);
return fold (build1 (NOP_EXPR, type, expr));
}
else
{
- cp_error ("reinterpret_cast from `%T' to `%T'", intype, type);
+ error ("invalid reinterpret_cast from type `%T' to type `%T'",
+ intype, type);
return error_mark_node;
}
@@ -5662,22 +5295,15 @@ build_const_cast (type, expr)
if (processing_template_decl)
{
- tree t = build_min (CONST_CAST_EXPR, copy_to_permanent (type),
- expr);
+ tree t = build_min (CONST_CAST_EXPR, type, expr);
return t;
}
if (!POINTER_TYPE_P (type))
- {
- cp_error ("`%T' is not a pointer, reference, or pointer-to-data-member type",
- type);
- cp_error ("as required by const_cast");
- }
+ error ("invalid use of const_cast with type `%T', which is not a pointer, reference, nor a pointer-to-data-member type", type);
else if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
{
- cp_error ("`%T' is a pointer or reference to a function type",
- type);
- cp_error ("which is forbidden by const_cast");
+ error ("invalid use of const_cast with type `%T', which is a pointer or reference to a function type", type);
return error_mark_node;
}
@@ -5693,14 +5319,14 @@ build_const_cast (type, expr)
}
intype = TREE_TYPE (expr);
-
- if (same_type_p (TYPE_MAIN_VARIANT (intype), TYPE_MAIN_VARIANT (type)))
+
+ if (same_type_ignoring_top_level_qualifiers_p (intype, type))
return build_static_cast (type, expr);
else if (TREE_CODE (type) == REFERENCE_TYPE)
{
if (! real_lvalue_p (expr))
{
- cp_error ("const_cast from `%T' rvalue to `%T'", intype, type);
+ error ("invalid const_cast of an rvalue of type `%T' to type `%T'", intype, type);
return error_mark_node;
}
@@ -5716,7 +5342,7 @@ build_const_cast (type, expr)
&& comp_ptr_ttypes_const (TREE_TYPE (type), TREE_TYPE (intype)))
return cp_convert (type, expr);
- cp_error ("const_cast from `%T' to `%T'", intype, type);
+ error ("invalid const_cast from type `%T' to type `%T'", intype, type);
return error_mark_node;
}
@@ -5735,6 +5361,13 @@ build_c_cast (type, expr)
if (type == error_mark_node || expr == error_mark_node)
return error_mark_node;
+ if (processing_template_decl)
+ {
+ tree t = build_min (CAST_EXPR, type,
+ tree_cons (NULL_TREE, value, NULL_TREE));
+ return t;
+ }
+
/* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
Strip such NOP_EXPRs if VALUE is being used in non-lvalue context. */
if (TREE_CODE (type) != REFERENCE_TYPE
@@ -5748,17 +5381,15 @@ build_c_cast (type, expr)
if (TREE_CODE (type) == ARRAY_TYPE)
{
/* Allow casting from T1* to T2[] because Cfront allows it.
- NIHCL uses it. It is not valid ANSI C however, and hence, not
- valid ANSI C++. */
+ NIHCL uses it. It is not valid ISO C++ however. */
if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE)
{
- if (pedantic)
- pedwarn ("ANSI C++ forbids casting to an array type");
+ pedwarn ("ISO C++ forbids casting to an array type `%T'", type);
type = build_pointer_type (TREE_TYPE (type));
}
else
{
- error ("ANSI C++ forbids casting to an array type");
+ error ("ISO C++ forbids casting to an array type `%T'", type);
return error_mark_node;
}
}
@@ -5766,23 +5397,18 @@ build_c_cast (type, expr)
if (TREE_CODE (type) == FUNCTION_TYPE
|| TREE_CODE (type) == METHOD_TYPE)
{
- cp_error ("casting to function type `%T'", type);
- return error_mark_node;
- }
-
- if (IS_SIGNATURE (type))
- {
- error ("cast specifies signature type");
+ error ("invalid cast to function type `%T'", type);
return error_mark_node;
}
- if (processing_template_decl)
+ if (TREE_CODE (type) == VOID_TYPE)
{
- tree t = build_min (CAST_EXPR, type,
- min_tree_cons (NULL_TREE, value, NULL_TREE));
- return t;
+ /* Conversion to void does not cause any of the normal function to
+ * pointer, array to pointer and lvalue to rvalue decays. */
+
+ value = convert_to_void (value, /*implicit=*/NULL);
+ return value;
}
-
/* Convert functions and arrays to pointers and
convert references to their expanded types,
but don't convert any other types. If, however, we are
@@ -5823,20 +5449,9 @@ build_c_cast (type, expr)
&& TREE_CODE (otype) == POINTER_TYPE
&& !at_least_as_qualified_p (TREE_TYPE (type),
TREE_TYPE (otype)))
- cp_warning ("cast discards qualifiers from pointer target type");
-
- /* Warn about possible alignment problems. */
- if (STRICT_ALIGNMENT && warn_cast_align
- && TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (otype) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (otype)) != VOID_TYPE
- && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE
- && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype)))
- warning ("cast increases required alignment of target type");
+ warning ("cast from `%T' to `%T' discards qualifiers from pointer target type",
+ otype, type);
-#if 0
- /* We should see about re-enabling these, they seem useful to
- me. */
if (TREE_CODE (type) == INTEGER_TYPE
&& TREE_CODE (otype) == POINTER_TYPE
&& TYPE_PRECISION (type) != TYPE_PRECISION (otype))
@@ -5845,19 +5460,11 @@ build_c_cast (type, expr)
if (TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (otype) == INTEGER_TYPE
&& TYPE_PRECISION (type) != TYPE_PRECISION (otype)
- /* Don't warn about converting 0 to pointer,
- provided the 0 was explicit--not cast or made by folding. */
- && !(TREE_CODE (value) == INTEGER_CST && integer_zerop (value)))
+ /* Don't warn about converting any constant. */
+ && !TREE_CONSTANT (value))
warning ("cast to pointer from integer of different size");
-#endif
- if (TREE_CODE (type) == VOID_TYPE)
- {
- value = require_complete_type_in_void (value);
- if (value != error_mark_node)
- value = build1 (CONVERT_EXPR, void_type_node, value);
- }
- else if (TREE_CODE (type) == REFERENCE_TYPE)
+ if (TREE_CODE (type) == REFERENCE_TYPE)
value = (convert_from_reference
(convert_to_reference (type, value, CONV_C_CAST,
LOOKUP_COMPLAIN, NULL_TREE)));
@@ -5865,8 +5472,7 @@ build_c_cast (type, expr)
{
tree ovalue;
- if (TREE_READONLY_DECL_P (value))
- value = decl_constant_value (value);
+ value = decl_constant_value (value);
ovalue = value;
value = convert_force (type, value, CONV_C_CAST);
@@ -5879,6 +5485,19 @@ build_c_cast (type, expr)
}
}
+ /* Warn about possible alignment problems. Do this here when we will have
+ instantiated any necessary template types. */
+ if (STRICT_ALIGNMENT && warn_cast_align
+ && TREE_CODE (type) == POINTER_TYPE
+ && TREE_CODE (otype) == POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (otype)) != VOID_TYPE
+ && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE
+ && COMPLETE_TYPE_P (TREE_TYPE (otype))
+ && COMPLETE_TYPE_P (TREE_TYPE (type))
+ && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype)))
+ warning ("cast from `%T' to `%T' increases required alignment of target type",
+ otype, type);
+
/* Always produce some operator for an explicit cast,
so we can tell (for -pedantic) that the cast is no lvalue. */
if (TREE_CODE (type) != REFERENCE_TYPE && value == expr
@@ -5911,21 +5530,7 @@ build_modify_expr (lhs, modifycode, rhs)
if (lhs == error_mark_node || rhs == error_mark_node)
return error_mark_node;
- /* Types that aren't fully specified cannot be used in assignments. */
- lhs = require_complete_type (lhs);
-
- newrhs = rhs;
-
- /* Handle assignment to signature pointers/refs. */
-
- if (TYPE_LANG_SPECIFIC (lhstype)
- && (IS_SIGNATURE_POINTER (lhstype) || IS_SIGNATURE_REFERENCE (lhstype)))
- {
- return build_signature_pointer_constructor (lhs, rhs);
- }
-
/* Handle control structure constructs used as "lvalues". */
-
switch (TREE_CODE (lhs))
{
/* Handle --foo = 5; as these are valid constructs in C++ */
@@ -5957,107 +5562,119 @@ build_modify_expr (lhs, modifycode, rhs)
/* Handle (a ? b : c) used as an "lvalue". */
case COND_EXPR:
- rhs = save_expr (rhs);
{
/* Produce (a ? (b = rhs) : (c = rhs))
except that the RHS goes through a save-expr
so the code to compute it is only emitted once. */
- tree cond
- = build_conditional_expr (TREE_OPERAND (lhs, 0),
- build_modify_expr (cp_convert (TREE_TYPE (lhs), TREE_OPERAND (lhs, 1)),
- modifycode, rhs),
- build_modify_expr (cp_convert (TREE_TYPE (lhs), TREE_OPERAND (lhs, 2)),
- modifycode, rhs));
+ tree cond;
+
+ rhs = save_expr (rhs);
+
+ /* Check this here to avoid odd errors when trying to convert
+ a throw to the type of the COND_EXPR. */
+ if (!lvalue_or_else (lhs, "assignment"))
+ return error_mark_node;
+
+ cond = build_conditional_expr
+ (TREE_OPERAND (lhs, 0),
+ build_modify_expr (cp_convert (TREE_TYPE (lhs),
+ TREE_OPERAND (lhs, 1)),
+ modifycode, rhs),
+ build_modify_expr (cp_convert (TREE_TYPE (lhs),
+ TREE_OPERAND (lhs, 2)),
+ modifycode, rhs));
+
if (cond == error_mark_node)
return cond;
/* Make sure the code to compute the rhs comes out
before the split. */
return build (COMPOUND_EXPR, TREE_TYPE (lhs),
- /* Case to void to suppress warning
+ /* Cast to void to suppress warning
from warn_if_unused_value. */
cp_convert (void_type_node, rhs), cond);
}
-
+
+ case OFFSET_REF:
+ lhs = resolve_offset_ref (lhs);
+ if (lhs == error_mark_node)
+ return error_mark_node;
+ olhstype = lhstype = TREE_TYPE (lhs);
+
default:
break;
}
- if (TREE_CODE (lhs) == OFFSET_REF)
- {
- if (TREE_OPERAND (lhs, 0) == NULL_TREE)
- {
- /* Static class member? */
- tree member = TREE_OPERAND (lhs, 1);
- if (TREE_CODE (member) == VAR_DECL)
- lhs = member;
- else
- {
- compiler_error ("invalid static class member");
- return error_mark_node;
- }
- }
- else
- lhs = resolve_offset_ref (lhs);
-
- olhstype = lhstype = TREE_TYPE (lhs);
- }
-
- if (lhs == error_mark_node)
- return lhs;
-
- if (TREE_CODE (lhstype) == REFERENCE_TYPE
- && modifycode != INIT_EXPR)
- {
- lhs = convert_from_reference (lhs);
- olhstype = lhstype = TREE_TYPE (lhs);
- }
-
- /* If a binary op has been requested, combine the old LHS value with the RHS
- producing the value we should actually store into the LHS. */
-
if (modifycode == INIT_EXPR)
{
- if (! IS_AGGR_TYPE (lhstype))
- /* Do the default thing */;
- else
+ if (TREE_CODE (rhs) == CONSTRUCTOR)
{
- result = build_method_call (lhs, ctor_identifier,
- build_expr_list (NULL_TREE, rhs),
- TYPE_BINFO (lhstype), LOOKUP_NORMAL);
- if (result == NULL_TREE)
- return error_mark_node;
+ my_friendly_assert (same_type_p (TREE_TYPE (rhs), lhstype),
+ 20011220);
+ result = build (INIT_EXPR, lhstype, lhs, rhs);
+ TREE_SIDE_EFFECTS (result) = 1;
return result;
}
- }
- else if (modifycode == NOP_EXPR)
- {
- /* `operator=' is not an inheritable operator. */
- if (! IS_AGGR_TYPE (lhstype))
+ else if (! IS_AGGR_TYPE (lhstype))
/* Do the default thing */;
else
{
- result = build_opfncall (MODIFY_EXPR, LOOKUP_NORMAL,
- lhs, rhs, make_node (NOP_EXPR));
+ result = build_method_call (lhs, complete_ctor_identifier,
+ build_tree_list (NULL_TREE, rhs),
+ TYPE_BINFO (lhstype), LOOKUP_NORMAL);
if (result == NULL_TREE)
return error_mark_node;
return result;
}
- lhstype = olhstype;
- }
- else if (PROMOTES_TO_AGGR_TYPE (lhstype, REFERENCE_TYPE))
- {
- my_friendly_abort (978652);
}
else
{
- lhs = stabilize_reference (lhs);
- newrhs = build_binary_op (modifycode, lhs, rhs);
- if (newrhs == error_mark_node)
+ if (TREE_CODE (lhstype) == REFERENCE_TYPE)
{
- cp_error (" in evaluation of `%Q(%#T, %#T)'", modifycode,
- TREE_TYPE (lhs), TREE_TYPE (rhs));
- return error_mark_node;
+ lhs = convert_from_reference (lhs);
+ olhstype = lhstype = TREE_TYPE (lhs);
+ }
+ lhs = require_complete_type (lhs);
+ if (lhs == error_mark_node)
+ return error_mark_node;
+
+ if (modifycode == NOP_EXPR)
+ {
+ /* `operator=' is not an inheritable operator. */
+ if (! IS_AGGR_TYPE (lhstype))
+ /* Do the default thing */;
+ else
+ {
+ result = build_opfncall (MODIFY_EXPR, LOOKUP_NORMAL,
+ lhs, rhs, make_node (NOP_EXPR));
+ if (result == NULL_TREE)
+ return error_mark_node;
+ return result;
+ }
+ lhstype = olhstype;
+ }
+ else
+ {
+ /* A binary op has been requested. Combine the old LHS
+ value with the RHS producing the value we should actually
+ store into the LHS. */
+
+ my_friendly_assert (!PROMOTES_TO_AGGR_TYPE (lhstype, REFERENCE_TYPE),
+ 978652);
+ lhs = stabilize_reference (lhs);
+ newrhs = cp_build_binary_op (modifycode, lhs, rhs);
+ if (newrhs == error_mark_node)
+ {
+ error (" in evaluation of `%Q(%#T, %#T)'", modifycode,
+ TREE_TYPE (lhs), TREE_TYPE (rhs));
+ return error_mark_node;
+ }
+
+ /* Now it looks like a plain assignment. */
+ modifycode = NOP_EXPR;
}
+ my_friendly_assert (TREE_CODE (lhstype) != REFERENCE_TYPE, 20011220);
+ my_friendly_assert (TREE_CODE (TREE_TYPE (newrhs)) != REFERENCE_TYPE,
+ 20011220);
}
/* Handle a cast used as an "lvalue".
@@ -6076,19 +5693,20 @@ build_modify_expr (lhs, modifycode, rhs)
case FIX_FLOOR_EXPR:
case FIX_ROUND_EXPR:
case FIX_CEIL_EXPR:
- if (TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (newrhs)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (newrhs)) == METHOD_TYPE
- || TREE_CODE (TREE_TYPE (newrhs)) == OFFSET_TYPE)
- newrhs = default_conversion (newrhs);
{
tree inner_lhs = TREE_OPERAND (lhs, 0);
tree result;
- /* WP 5.4.1: The result is an lvalue if T is a reference type,
- otherwise the result is an rvalue. */
+ if (TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE
+ || TREE_CODE (TREE_TYPE (newrhs)) == FUNCTION_TYPE
+ || TREE_CODE (TREE_TYPE (newrhs)) == METHOD_TYPE
+ || TREE_CODE (TREE_TYPE (newrhs)) == OFFSET_TYPE)
+ newrhs = default_conversion (newrhs);
+
+ /* ISO C++ 5.4/1: The result is an lvalue if T is a reference
+ type, otherwise the result is an rvalue. */
if (! lvalue_p (lhs))
- pedwarn ("ANSI C++ forbids cast to non-reference type used as lvalue");
+ pedwarn ("ISO C++ forbids cast to non-reference type used as lvalue");
result = build_modify_expr (inner_lhs, NOP_EXPR,
cp_convert (TREE_TYPE (inner_lhs),
@@ -6110,29 +5728,23 @@ build_modify_expr (lhs, modifycode, rhs)
GNU_xref_assign (lhs);
- /* Warn about storing in something that is `const'. */
- /* For C++, don't warn if this is initialization. */
+ /* Warn about modifying something that is `const'. Don't warn if
+ this is initialization. */
if (modifycode != INIT_EXPR
- /* For assignment to `const' signature pointer/reference fields,
- don't warn either, we already printed a better message before. */
- && ! (TREE_CODE (lhs) == COMPONENT_REF
- && (IS_SIGNATURE_POINTER (TREE_TYPE (TREE_OPERAND (lhs, 0)))
- || IS_SIGNATURE_REFERENCE (TREE_TYPE (TREE_OPERAND (lhs, 0)))))
&& (TREE_READONLY (lhs) || CP_TYPE_CONST_P (lhstype)
/* Functions are not modifiable, even though they are
lvalues. */
|| TREE_CODE (TREE_TYPE (lhs)) == FUNCTION_TYPE
- || ((TREE_CODE (lhstype) == RECORD_TYPE
- || TREE_CODE (lhstype) == UNION_TYPE)
- && C_TYPE_FIELDS_READONLY (lhstype))
- || (TREE_CODE (lhstype) == REFERENCE_TYPE
- && CP_TYPE_CONST_P (TREE_TYPE (lhstype)))))
+ || TREE_CODE (TREE_TYPE (lhs)) == METHOD_TYPE
+ /* If it's an aggregate and any field is const, then it is
+ effectively const. */
+ || (IS_AGGR_TYPE_CODE (TREE_CODE (lhstype))
+ && C_TYPE_FIELDS_READONLY (lhstype))))
readonly_error (lhs, "assignment", 0);
- /* If storing into a structure or union member,
- it has probably been given type `int'.
- Compute the type that would go with
- the actual amount of storage the member occupies. */
+ /* If storing into a structure or union member, it has probably been
+ given type `int'. Compute the type that would go with the actual
+ amount of storage the member occupies. */
if (TREE_CODE (lhs) == COMPONENT_REF
&& (TREE_CODE (lhstype) == INTEGER_TYPE
@@ -6151,51 +5763,14 @@ build_modify_expr (lhs, modifycode, rhs)
}
}
- /* check to see if there is an assignment to `this' */
- if (lhs == current_class_ptr)
- {
- if (flag_this_is_variable > 0
- && DECL_NAME (current_function_decl) != NULL_TREE
- && (DECL_NAME (current_function_decl)
- != constructor_name (current_class_type)))
- warning ("assignment to `this' not in constructor or destructor");
- current_function_just_assigned_this = 1;
- }
-
- if (modifycode != INIT_EXPR)
+ if (TREE_CODE (lhstype) != REFERENCE_TYPE)
{
- /* Make modifycode now either a NOP_EXPR or an INIT_EXPR. */
- modifycode = NOP_EXPR;
- /* Reference-bashing */
- if (TREE_CODE (lhstype) == REFERENCE_TYPE)
- {
- tree tmp = convert_from_reference (lhs);
- lhstype = TREE_TYPE (tmp);
- if (TYPE_SIZE (lhstype) == 0)
- {
- incomplete_type_error (lhs, lhstype);
- return error_mark_node;
- }
- lhs = tmp;
- olhstype = lhstype;
- }
- if (TREE_CODE (TREE_TYPE (newrhs)) == REFERENCE_TYPE)
- {
- tree tmp = convert_from_reference (newrhs);
- if (TYPE_SIZE (TREE_TYPE (tmp)) == 0)
- {
- incomplete_type_error (newrhs, TREE_TYPE (tmp));
- return error_mark_node;
- }
- newrhs = tmp;
- }
+ if (TREE_SIDE_EFFECTS (lhs))
+ lhs = stabilize_reference (lhs);
+ if (TREE_SIDE_EFFECTS (newrhs))
+ newrhs = stabilize_reference (newrhs);
}
- if (TREE_SIDE_EFFECTS (lhs))
- lhs = stabilize_reference (lhs);
- if (TREE_SIDE_EFFECTS (newrhs))
- newrhs = stabilize_reference (newrhs);
-
/* Convert new value to destination type. */
if (TREE_CODE (lhstype) == ARRAY_TYPE)
@@ -6204,54 +5779,23 @@ build_modify_expr (lhs, modifycode, rhs)
if (!same_or_base_type_p (lhstype, TREE_TYPE (rhs)))
{
- cp_error ("incompatible types in assignment of `%T' to `%T'",
+ error ("incompatible types in assignment of `%T' to `%T'",
TREE_TYPE (rhs), lhstype);
return error_mark_node;
}
/* Allow array assignment in compiler-generated code. */
if (pedantic && ! DECL_ARTIFICIAL (current_function_decl))
- pedwarn ("ANSI C++ forbids assignment of arrays");
-
- /* Have to wrap this in RTL_EXPR for two cases:
- in base or member initialization and if we
- are a branch of a ?: operator. Since we
- can't easily know the latter, just do it always. */
-
- result = make_node (RTL_EXPR);
-
- TREE_TYPE (result) = void_type_node;
- do_pending_stack_adjust ();
- start_sequence_for_rtl_expr (result);
-
- /* As a matter of principle, `start_sequence' should do this. */
- emit_note (0, -1);
+ pedwarn ("ISO C++ forbids assignment of arrays");
from_array = TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE
? 1 + (modifycode != INIT_EXPR): 0;
- expand_vec_init (lhs, lhs, array_type_nelts (lhstype), newrhs,
- from_array);
-
- do_pending_stack_adjust ();
-
- TREE_SIDE_EFFECTS (result) = 1;
- RTL_EXPR_SEQUENCE (result) = get_insns ();
- RTL_EXPR_RTL (result) = const0_rtx;
- end_sequence ();
- return result;
+ return build_vec_init (lhs, newrhs, from_array);
}
if (modifycode == INIT_EXPR)
- {
- newrhs = convert_for_initialization (lhs, lhstype, newrhs, LOOKUP_NORMAL,
- "assignment", NULL_TREE, 0);
- if (lhs == DECL_RESULT (current_function_decl))
- {
- if (DECL_INITIAL (lhs))
- warning ("return value from function receives multiple initializations");
- DECL_INITIAL (lhs) = newrhs;
- }
- }
+ newrhs = convert_for_initialization (lhs, lhstype, newrhs, LOOKUP_NORMAL,
+ "initialization", NULL_TREE, 0);
else
{
/* Avoid warnings on enum bit fields. */
@@ -6289,7 +5833,7 @@ build_modify_expr (lhs, modifycode, rhs)
if (TREE_SIDE_EFFECTS (lhs))
cond = build_compound_expr (tree_cons
(NULL_TREE, lhs,
- build_expr_list (NULL_TREE, cond)));
+ build_tree_list (NULL_TREE, cond)));
/* Cannot have two identical lhs on this one tree (result) as preexpand
calls will rip them out and fill in RTL for them, but when the
@@ -6379,22 +5923,16 @@ get_delta_difference (from, to, force)
{
tree delta = integer_zero_node;
tree binfo;
+ tree virt_binfo;
+ base_kind kind;
- if (to == from)
- return delta;
-
- /* Should get_base_distance here, so we can check if any thing along the
- path is virtual, and we need to make sure we stay
- inside the real binfos when going through virtual bases.
- Maybe we should replace virtual bases with
- binfo_member (...CLASSTYPE_VBASECLASSES...)... (mrs) */
- binfo = get_binfo (from, to, 1);
- if (binfo == error_mark_node)
+ binfo = lookup_base (to, from, ba_check, &kind);
+ if (kind == bk_inaccessible || kind == bk_ambig)
{
error (" in pointer to member function conversion");
return delta;
}
- if (binfo == 0)
+ if (!binfo)
{
if (!force)
{
@@ -6402,112 +5940,76 @@ get_delta_difference (from, to, force)
error (" in pointer to member conversion");
return delta;
}
- binfo = get_binfo (to, from, 1);
- if (binfo == 0 || binfo == error_mark_node)
+ binfo = lookup_base (from, to, ba_check, &kind);
+ if (binfo == 0)
return delta;
- if (TREE_VIA_VIRTUAL (binfo))
- {
- binfo = binfo_member (BINFO_TYPE (binfo),
- CLASSTYPE_VBASECLASSES (from));
- cp_warning ("pointer to member cast to virtual base `%T'",
- BINFO_TYPE (binfo));
- warning (" will only work if you are very careful");
- }
+ virt_binfo = binfo_from_vbase (binfo);
+
+ if (virt_binfo)
+ {
+ /* This is a reinterpret cast, we choose to do nothing. */
+ warning ("pointer to member cast via virtual base `%T' of `%T'",
+ BINFO_TYPE (virt_binfo),
+ BINFO_TYPE (BINFO_INHERITANCE_CHAIN (virt_binfo)));
+ return delta;
+ }
delta = BINFO_OFFSET (binfo);
delta = cp_convert (ptrdiff_type_node, delta);
-
- return build_binary_op (MINUS_EXPR,
- integer_zero_node,
- delta);
+ delta = cp_build_binary_op (MINUS_EXPR,
+ integer_zero_node,
+ delta);
+
+ return delta;
}
- if (TREE_VIA_VIRTUAL (binfo))
+ virt_binfo = binfo_from_vbase (binfo);
+ if (virt_binfo)
{
+ /* This is a reinterpret cast, we choose to do nothing. */
if (force)
- {
- cp_warning ("pointer to member cast from virtual base `%T'",
- BINFO_TYPE (binfo));
- warning (" will only work if you are very careful");
- }
+ warning ("pointer to member cast via virtual base `%T' of `%T'",
+ BINFO_TYPE (virt_binfo),
+ BINFO_TYPE (BINFO_INHERITANCE_CHAIN (virt_binfo)));
else
- cp_error ("pointer to member conversion from virtual base `%T'",
- BINFO_TYPE (binfo));
+ error ("pointer to member conversion via virtual base `%T' of `%T'",
+ BINFO_TYPE (virt_binfo),
+ BINFO_TYPE (BINFO_INHERITANCE_CHAIN (virt_binfo)));
+ return delta;
}
+ delta = BINFO_OFFSET (binfo);
- return BINFO_OFFSET (binfo);
+ return cp_convert (ptrdiff_type_node, delta);
}
+/* Return a constructor for the pointer-to-member-function TYPE using
+ the other components as specified. */
+
tree
-build_ptrmemfunc1 (type, delta, idx, pfn, delta2)
- tree type, delta, idx, pfn, delta2;
+build_ptrmemfunc1 (type, delta, pfn)
+ tree type, delta, pfn;
{
- tree u;
-
-#if 0
- /* This is the old way we did it. We want to avoid calling
- digest_init, so that it can give an error if we use { } when
- initializing a pointer to member function. */
-
- if (pfn)
- {
- u = build_nt (CONSTRUCTOR, NULL_TREE,
- expr_tree_cons (pfn_identifier, pfn, NULL_TREE));
- }
- else
- {
- u = build_nt (CONSTRUCTOR, NULL_TREE,
- expr_tree_cons (delta2_identifier, delta2, NULL_TREE));
- }
-
- u = build_nt (CONSTRUCTOR, NULL_TREE,
- expr_tree_cons (NULL_TREE, delta,
- expr_tree_cons (NULL_TREE, idx,
- expr_tree_cons (NULL_TREE, u, NULL_TREE))));
+ tree u = NULL_TREE;
+ tree delta_field;
+ tree pfn_field;
- return digest_init (type, u, (tree*)0);
-#else
- tree delta_field, idx_field, pfn_or_delta2_field, pfn_field, delta2_field;
- tree subtype;
- int allconstant, allsimple;
-
- delta_field = TYPE_FIELDS (type);
- idx_field = TREE_CHAIN (delta_field);
- pfn_or_delta2_field = TREE_CHAIN (idx_field);
- subtype = TREE_TYPE (pfn_or_delta2_field);
- pfn_field = TYPE_FIELDS (subtype);
- delta2_field = TREE_CHAIN (pfn_field);
-
- if (pfn)
- {
- allconstant = TREE_CONSTANT (pfn);
- allsimple = !! initializer_constant_valid_p (pfn, TREE_TYPE (pfn));
- u = expr_tree_cons (pfn_field, pfn, NULL_TREE);
- }
- else
- {
- delta2 = convert_and_check (delta_type_node, delta2);
- allconstant = TREE_CONSTANT (delta2);
- allsimple = !! initializer_constant_valid_p (delta2, TREE_TYPE (delta2));
- u = expr_tree_cons (delta2_field, delta2, NULL_TREE);
- }
+ /* Pull the FIELD_DECLs out of the type. */
+ pfn_field = TYPE_FIELDS (type);
+ delta_field = TREE_CHAIN (pfn_field);
+ /* Make sure DELTA has the type we want. */
delta = convert_and_check (delta_type_node, delta);
- idx = convert_and_check (delta_type_node, idx);
-
- allconstant = allconstant && TREE_CONSTANT (delta) && TREE_CONSTANT (idx);
- allsimple = allsimple
- && initializer_constant_valid_p (delta, TREE_TYPE (delta))
- && initializer_constant_valid_p (idx, TREE_TYPE (idx));
- u = build (CONSTRUCTOR, subtype, NULL_TREE, u);
- u = expr_tree_cons (delta_field, delta,
- expr_tree_cons (idx_field, idx,
- expr_tree_cons (pfn_or_delta2_field, u, NULL_TREE)));
+ /* Finish creating the initializer. */
+ u = tree_cons (pfn_field, pfn,
+ build_tree_list (delta_field, delta));
u = build (CONSTRUCTOR, type, NULL_TREE, u);
- TREE_CONSTANT (u) = allconstant;
- TREE_STATIC (u) = allconstant && allsimple;
+ TREE_CONSTANT (u) = TREE_CONSTANT (pfn) && TREE_CONSTANT (delta);
+ TREE_STATIC (u) = (TREE_CONSTANT (u)
+ && (initializer_constant_valid_p (pfn, TREE_TYPE (pfn))
+ != NULL_TREE)
+ && (initializer_constant_valid_p (delta, TREE_TYPE (delta))
+ != NULL_TREE));
return u;
-#endif
}
/* Build a constructor for a pointer to member function. It can be
@@ -6527,104 +6029,86 @@ build_ptrmemfunc (type, pfn, force)
int force;
{
tree fn;
-
+ tree pfn_type = TREE_TYPE (pfn);
+ tree to_type = build_ptrmemfunc_type (type);
+
/* Handle multiple conversions of pointer to member functions. */
if (TYPE_PTRMEMFUNC_P (TREE_TYPE (pfn)))
{
- tree idx = integer_zero_node;
- tree delta = integer_zero_node;
- tree delta2 = integer_zero_node;
+ tree delta = NULL_TREE;
tree npfn = NULL_TREE;
- tree ndelta, ndelta2;
- tree e1, e2, e3, n;
- tree pfn_type;
+ tree n;
- /* Is is already the right type? */
- if (type == TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (pfn)))
- return pfn;
+ if (!force
+ && !can_convert_arg (to_type, TREE_TYPE (pfn), pfn))
+ error ("invalid conversion to type `%T' from type `%T'",
+ to_type, pfn_type);
- pfn_type = TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (pfn));
- if (!force
- && comp_target_types (type, pfn_type, 1) != 1)
- cp_error ("conversion to `%T' from `%T'", type, pfn_type);
+ n = get_delta_difference (TYPE_PTRMEMFUNC_OBJECT_TYPE (pfn_type),
+ TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type),
+ force);
- if (TREE_CODE (pfn) == PTRMEM_CST)
+ /* We don't have to do any conversion to convert a
+ pointer-to-member to its own type. But, we don't want to
+ just return a PTRMEM_CST if there's an explicit cast; that
+ cast should make the expression an invalid template argument. */
+ if (TREE_CODE (pfn) != PTRMEM_CST)
{
- /* We could just build the resulting CONSTRUCTOR now, but we
- don't, relying on the general machinery below, together
- with constant-folding, to do the right thing. We don't
- want to return a PTRMEM_CST here, even though we could,
- because a pointer-to-member constant ceases to be a
- constant (from the point of view of the language) when it
- is cast to another type. */
-
- expand_ptrmemfunc_cst (pfn, &ndelta, &idx, &npfn, &ndelta2);
- if (npfn)
- /* This constant points to a non-virtual function.
- NDELTA2 will be NULL, but it's value doesn't really
- matter since we won't use it anyhow. */
- ndelta2 = integer_zero_node;
+ if (same_type_p (to_type, pfn_type))
+ return pfn;
+ else if (integer_zerop (n))
+ return build_reinterpret_cast (to_type, pfn);
}
+
+ if (TREE_SIDE_EFFECTS (pfn))
+ pfn = save_expr (pfn);
+
+ /* Obtain the function pointer and the current DELTA. */
+ if (TREE_CODE (pfn) == PTRMEM_CST)
+ expand_ptrmemfunc_cst (pfn, &delta, &npfn);
else
{
- ndelta = cp_convert (ptrdiff_type_node,
- build_component_ref (pfn,
- delta_identifier,
- NULL_TREE, 0));
- ndelta2 = cp_convert (ptrdiff_type_node,
- DELTA2_FROM_PTRMEMFUNC (pfn));
- idx = build_component_ref (pfn, index_identifier, NULL_TREE, 0);
+ npfn = build_component_ref (pfn, pfn_identifier, NULL_TREE, 0);
+ delta = build_component_ref (pfn, delta_identifier, NULL_TREE, 0);
}
- n = get_delta_difference (TYPE_METHOD_BASETYPE (TREE_TYPE (pfn_type)),
- TYPE_METHOD_BASETYPE (TREE_TYPE (type)),
- force);
- delta = build_binary_op (PLUS_EXPR, ndelta, n);
- delta2 = build_binary_op (PLUS_EXPR, ndelta2, n);
- e1 = fold (build (GT_EXPR, boolean_type_node, idx, integer_zero_node));
-
- /* If it's a virtual function, this is what we want. */
- e2 = build_ptrmemfunc1 (TYPE_GET_PTRMEMFUNC_TYPE (type), delta, idx,
- NULL_TREE, delta2);
-
- pfn = PFN_FROM_PTRMEMFUNC (pfn);
- npfn = build1 (NOP_EXPR, type, pfn);
- TREE_CONSTANT (npfn) = TREE_CONSTANT (pfn);
-
- /* But if it's a non-virtual function, or NULL, we use this
- instead. */
- e3 = build_ptrmemfunc1 (TYPE_GET_PTRMEMFUNC_TYPE (type), delta,
- idx, npfn, NULL_TREE);
- return build_conditional_expr (e1, e2, e3);
+ /* Just adjust the DELTA field. */
+ delta = cp_convert (ptrdiff_type_node, delta);
+ if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta)
+ n = cp_build_binary_op (LSHIFT_EXPR, n, integer_one_node);
+ delta = cp_build_binary_op (PLUS_EXPR, delta, n);
+ return build_ptrmemfunc1 (to_type, delta, npfn);
}
/* Handle null pointer to member function conversions. */
if (integer_zerop (pfn))
{
pfn = build_c_cast (type, integer_zero_node);
- return build_ptrmemfunc1 (TYPE_GET_PTRMEMFUNC_TYPE (type),
- integer_zero_node, integer_zero_node,
- pfn, NULL_TREE);
+ return build_ptrmemfunc1 (to_type,
+ integer_zero_node,
+ pfn);
}
if (type_unknown_p (pfn))
- return instantiate_type (type, pfn, 1);
+ return instantiate_type (type, pfn, itf_complain);
fn = TREE_OPERAND (pfn, 0);
my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL, 0);
- return make_ptrmem_cst (build_ptrmemfunc_type (type), fn);
+ return make_ptrmem_cst (to_type, fn);
}
/* Return the DELTA, IDX, PFN, and DELTA2 values for the PTRMEM_CST
- given by CST. */
+ given by CST.
+
+ ??? There is no consistency as to the types returned for the above
+ values. Some code acts as if its a sizetype and some as if its
+ integer_type_node. */
void
-expand_ptrmemfunc_cst (cst, delta, idx, pfn, delta2)
+expand_ptrmemfunc_cst (cst, delta, pfn)
tree cst;
tree *delta;
- tree *idx;
tree *pfn;
- tree *delta2;
{
tree type = TREE_TYPE (cst);
tree fn = PTRMEM_CST_MEMBER (cst);
@@ -6633,7 +6117,7 @@ expand_ptrmemfunc_cst (cst, delta, idx, pfn, delta2)
my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL, 0);
/* The class that the function belongs to. */
- fn_class = DECL_CLASS_CONTEXT (fn);
+ fn_class = DECL_CONTEXT (fn);
/* The class that we're creating a pointer to member of. */
ptr_class = TYPE_PTRMEMFUNC_OBJECT_TYPE (type);
@@ -6642,11 +6126,7 @@ expand_ptrmemfunc_cst (cst, delta, idx, pfn, delta2)
*delta = get_delta_difference (fn_class, ptr_class, /*force=*/0);
if (!DECL_VIRTUAL_P (fn))
- {
- *idx = size_binop (MINUS_EXPR, integer_zero_node, integer_one_node);
- *pfn = convert (TYPE_PTRMEMFUNC_FN_TYPE (type), build_addr_func (fn));
- *delta2 = NULL_TREE;
- }
+ *pfn = convert (TYPE_PTRMEMFUNC_FN_TYPE (type), build_addr_func (fn));
else
{
/* If we're dealing with a virtual function, we have to adjust 'this'
@@ -6654,82 +6134,122 @@ expand_ptrmemfunc_cst (cst, delta, idx, pfn, delta2)
fn; the call will do the opposite adjustment. */
tree orig_class = DECL_VIRTUAL_CONTEXT (fn);
tree binfo = binfo_or_else (orig_class, fn_class);
- *delta = size_binop (PLUS_EXPR, *delta, BINFO_OFFSET (binfo));
+ *delta = fold (build (PLUS_EXPR, TREE_TYPE (*delta),
+ *delta, BINFO_OFFSET (binfo)));
+
+ /* We set PFN to the vtable offset at which the function can be
+ found, plus one (unless ptrmemfunc_vbit_in_delta, in which
+ case delta is shifted left, and then incremented). */
+ *pfn = DECL_VINDEX (fn);
+ *pfn = fold (build (MULT_EXPR, integer_type_node, *pfn,
+ TYPE_SIZE_UNIT (vtable_entry_type)));
- /* Map everything down one to make room for the null PMF. */
- *idx = size_binop (PLUS_EXPR, DECL_VINDEX (fn), integer_one_node);
- *pfn = NULL_TREE;
+ switch (TARGET_PTRMEMFUNC_VBIT_LOCATION)
+ {
+ case ptrmemfunc_vbit_in_pfn:
+ *pfn = fold (build (PLUS_EXPR, integer_type_node, *pfn,
+ integer_one_node));
+ break;
- /* Offset from an object of PTR_CLASS to the vptr for ORIG_CLASS. */
- *delta2 = size_binop (PLUS_EXPR, *delta,
- get_vfield_offset (TYPE_BINFO (orig_class)));
+ case ptrmemfunc_vbit_in_delta:
+ *delta = fold (build (LSHIFT_EXPR, TREE_TYPE (*delta),
+ *delta, integer_one_node));
+ *delta = fold (build (PLUS_EXPR, TREE_TYPE (*delta),
+ *delta, integer_one_node));
+ break;
+
+ default:
+ abort ();
+ }
+
+ *pfn = fold (build1 (NOP_EXPR, TYPE_PTRMEMFUNC_FN_TYPE (type),
+ *pfn));
}
}
-/* Return an expression for DELTA2 from the pointer-to-member function
+/* Return an expression for PFN from the pointer-to-member function
given by T. */
tree
-delta2_from_ptrmemfunc (t)
+pfn_from_ptrmemfunc (t)
tree t;
{
if (TREE_CODE (t) == PTRMEM_CST)
{
tree delta;
- tree idx;
tree pfn;
- tree delta2;
- expand_ptrmemfunc_cst (t, &delta, &idx, &pfn, &delta2);
- if (delta2)
- return delta2;
+ expand_ptrmemfunc_cst (t, &delta, &pfn);
+ if (pfn)
+ return pfn;
}
- return (build_component_ref
- (build_component_ref (t,
- pfn_or_delta2_identifier, NULL_TREE,
- 0),
- delta2_identifier, NULL_TREE, 0));
+ return build_component_ref (t, pfn_identifier, NULL_TREE, 0);
}
-/* Return an expression for PFN from the pointer-to-member function
- given by T. */
+/* Expression EXPR is about to be implicitly converted to TYPE. Warn
+ if this is a potentially dangerous thing to do. Returns a possibly
+ marked EXPR. */
tree
-pfn_from_ptrmemfunc (t)
- tree t;
+dubious_conversion_warnings (type, expr, errtype, fndecl, parmnum)
+ tree type;
+ tree expr;
+ const char *errtype;
+ tree fndecl;
+ int parmnum;
{
- if (TREE_CODE (t) == PTRMEM_CST)
+ if (TREE_CODE (type) == REFERENCE_TYPE)
+ type = TREE_TYPE (type);
+
+ /* Issue warnings about peculiar, but legal, uses of NULL. */
+ if (ARITHMETIC_TYPE_P (type) && expr == null_node)
{
- tree delta;
- tree idx;
- tree pfn;
- tree delta2;
-
- expand_ptrmemfunc_cst (t, &delta, &idx, &pfn, &delta2);
- if (pfn)
- return pfn;
+ if (fndecl)
+ warning ("passing NULL used for non-pointer %s %P of `%D'",
+ errtype, parmnum, fndecl);
+ else
+ warning ("%s to non-pointer type `%T' from NULL", errtype, type);
+ }
+
+ /* Warn about assigning a floating-point type to an integer type. */
+ if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
+ && TREE_CODE (type) == INTEGER_TYPE)
+ {
+ if (fndecl)
+ warning ("passing `%T' for %s %P of `%D'",
+ TREE_TYPE (expr), errtype, parmnum, fndecl);
+ else
+ warning ("%s to `%T' from `%T'", errtype, type, TREE_TYPE (expr));
}
+ /* And warn about assigning a negative value to an unsigned
+ variable. */
+ else if (TREE_UNSIGNED (type) && TREE_CODE (type) != BOOLEAN_TYPE)
+ {
+ if (TREE_CODE (expr) == INTEGER_CST
+ && TREE_NEGATED_INT (expr))
+ {
+ if (fndecl)
+ warning ("passing negative value `%E' for %s %P of `%D'",
+ expr, errtype, parmnum, fndecl);
+ else
+ warning ("%s of negative value `%E' to `%T'",
+ errtype, expr, type);
+ }
- return (build_component_ref
- (build_component_ref (t,
- pfn_or_delta2_identifier, NULL_TREE,
- 0),
- pfn_identifier, NULL_TREE, 0));
-}
+ overflow_warning (expr);
-/* Convert value RHS to type TYPE as preparation for an assignment
- to an lvalue of type TYPE.
- The real work of conversion is done by `convert'.
- The purpose of this function is to generate error messages
- for assignments that are not allowed in C.
- ERRTYPE is a string to use in error messages:
- "assignment", "return", etc.
+ if (TREE_CONSTANT (expr))
+ expr = fold (expr);
+ }
+ return expr;
+}
- C++: attempts to allow `convert' to find conversions involving
- implicit type conversion between aggregate and scalar types
- as per 8.5.6 of C++ manual. Does not randomly dereference
- pointers to aggregates! */
+/* Convert value RHS to type TYPE as preparation for an assignment to
+ an lvalue of type TYPE. ERRTYPE is a string to use in error
+ messages: "assignment", "return", etc. If FNDECL is non-NULL, we
+ are doing the conversion in order to pass the PARMNUMth argument of
+ FNDECL. */
static tree
convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
@@ -6743,7 +6263,7 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
register enum tree_code coder;
if (codel == OFFSET_TYPE)
- my_friendly_abort (990505);
+ abort ();
if (TREE_CODE (rhs) == OFFSET_REF)
rhs = resolve_offset_ref (rhs);
@@ -6752,388 +6272,63 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
if (TREE_CODE (rhs) == NON_LVALUE_EXPR)
rhs = TREE_OPERAND (rhs, 0);
- if (rhs == error_mark_node || TREE_TYPE (rhs) == error_mark_node)
- return error_mark_node;
- if (TREE_CODE (rhs) == TREE_LIST && TREE_VALUE (rhs) == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (TREE_TYPE (rhs)) == ARRAY_TYPE
- || is_overloaded_fn (rhs))
- rhs = default_conversion (rhs);
- else if (TREE_CODE (TREE_TYPE (rhs)) == REFERENCE_TYPE)
- rhs = convert_from_reference (rhs);
-
- /* If rhs is some sort of overloaded function, ocp_convert will either
- do the right thing or complain; we don't need to check anything else.
- So just hand off. */
- if (type_unknown_p (rhs))
- return ocp_convert (type, rhs, CONV_IMPLICIT, LOOKUP_NORMAL);
-
rhstype = TREE_TYPE (rhs);
coder = TREE_CODE (rhstype);
- /* Issue warnings about peculiar, but legal, uses of NULL. */
- if (ARITHMETIC_TYPE_P (type) && rhs == null_node)
- cp_warning ("converting NULL to non-pointer type");
-
- /* This should no longer change types on us. */
- if (TREE_CODE (rhs) == CONST_DECL)
- rhs = DECL_INITIAL (rhs);
- else if (TREE_READONLY_DECL_P (rhs))
- rhs = decl_constant_value (rhs);
+ if (rhs == error_mark_node || rhstype == error_mark_node)
+ return error_mark_node;
+ if (TREE_CODE (rhs) == TREE_LIST && TREE_VALUE (rhs) == error_mark_node)
+ return error_mark_node;
- if (same_type_p (type, rhstype))
- {
- overflow_warning (rhs);
- return rhs;
- }
+ rhs = dubious_conversion_warnings (type, rhs, errtype, fndecl, parmnum);
+ /* The RHS of an assignment cannot have void type. */
if (coder == VOID_TYPE)
{
error ("void value not ignored as it ought to be");
return error_mark_node;
}
- /* Arithmetic types all interconvert. */
- if ((codel == INTEGER_TYPE || codel == REAL_TYPE || codel == BOOLEAN_TYPE
- || codel == COMPLEX_TYPE)
- && (coder == INTEGER_TYPE || coder == REAL_TYPE || coder == BOOLEAN_TYPE
- || coder == COMPLEX_TYPE))
- {
- /* But we should warn if assigning REAL_TYPE to INTEGER_TYPE. */
- if (coder == REAL_TYPE && codel == INTEGER_TYPE)
- {
- if (fndecl)
- cp_warning ("`%T' used for argument %P of `%D'",
- rhstype, parmnum, fndecl);
- else
- cp_warning ("%s to `%T' from `%T'", errtype, type, rhstype);
- }
- /* And we should warn if assigning a negative value to
- an unsigned variable. */
- else if (TREE_UNSIGNED (type) && codel != BOOLEAN_TYPE)
- {
- if (TREE_CODE (rhs) == INTEGER_CST
- && TREE_NEGATED_INT (rhs))
- {
- if (fndecl)
- cp_warning ("negative value `%E' passed as argument %P of `%D'",
- rhs, parmnum, fndecl);
- else
- cp_warning ("%s of negative value `%E' to `%T'",
- errtype, rhs, type);
- }
- overflow_warning (rhs);
- if (TREE_CONSTANT (rhs))
- rhs = fold (rhs);
- }
-
- return convert_and_check (type, rhs);
- }
- /* Conversions involving enums. */
- else if ((codel == ENUMERAL_TYPE
- && (INTEGRAL_CODE_P (coder) || coder == REAL_TYPE))
- || (coder == ENUMERAL_TYPE
- && (INTEGRAL_CODE_P (codel) || codel == REAL_TYPE)))
- {
- return ocp_convert (type, rhs, CONV_IMPLICIT, LOOKUP_NORMAL);
- }
- /* Conversions among pointers */
- else if (codel == POINTER_TYPE
- && (coder == POINTER_TYPE
- || (coder == RECORD_TYPE
- && (IS_SIGNATURE_POINTER (rhstype)
- || IS_SIGNATURE_REFERENCE (rhstype)))))
- {
- register tree ttl = TREE_TYPE (type);
- register tree ttr;
- int ctt = 0;
-
- if (coder == RECORD_TYPE)
- {
- rhs = build_optr_ref (rhs);
- rhstype = TREE_TYPE (rhs);
- }
- ttr = TREE_TYPE (rhstype);
-
- /* If both pointers are of aggregate type, then we
- can give better error messages, and save some work
- as well. */
- if (TREE_CODE (ttl) == RECORD_TYPE && TREE_CODE (ttr) == RECORD_TYPE)
- {
- tree binfo;
-
- if (TYPE_MAIN_VARIANT (ttl) == TYPE_MAIN_VARIANT (ttr)
- || type == class_star_type_node
- || rhstype == class_star_type_node)
- binfo = TYPE_BINFO (ttl);
- else
- binfo = get_binfo (ttl, ttr, 1);
-
- if (binfo == error_mark_node)
- return error_mark_node;
- if (binfo == 0)
- return error_not_base_type (ttl, ttr);
-
- if (!at_least_as_qualified_p (ttl, ttr))
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' discards qualifiers",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' discards qualifiers",
- errtype, type, rhstype);
- }
- }
-
- /* Any non-function converts to a [const][volatile] void *
- and vice versa; otherwise, targets must be the same.
- Meanwhile, the lhs target must have all the qualifiers of the rhs. */
- else if (TYPE_MAIN_VARIANT (ttl) == void_type_node
- || TYPE_MAIN_VARIANT (ttr) == void_type_node
- || (ctt = comp_target_types (type, rhstype, 1))
- || (unsigned_type (TYPE_MAIN_VARIANT (ttl))
- == unsigned_type (TYPE_MAIN_VARIANT (ttr))))
- {
- /* ARM $4.8, commentary on p39. */
- if (TYPE_MAIN_VARIANT (ttl) == void_type_node
- && TREE_CODE (ttr) == OFFSET_TYPE)
- {
- cp_error ("no standard conversion from `%T' to `void *'", ttr);
- return error_mark_node;
- }
-
- if (ctt < 0 && TYPE_MAIN_VARIANT (ttl) != TYPE_MAIN_VARIANT (ttr))
- cp_pedwarn ("converting `%T' to `%T' is a contravariance violation",
- rhstype, type);
-
- if (TYPE_MAIN_VARIANT (ttl) != void_type_node
- && TYPE_MAIN_VARIANT (ttr) == void_type_node
- && ! null_ptr_cst_p (rhs))
- {
- if (coder == RECORD_TYPE)
- cp_pedwarn ("implicit conversion of signature pointer to type `%T'",
- type);
- else
- pedwarn ("ANSI C++ forbids implicit conversion from `void *' in %s",
- errtype);
- }
- /* Const and volatile mean something different for function types,
- so the usual warnings are not appropriate. */
- else if ((TREE_CODE (ttr) != FUNCTION_TYPE && TREE_CODE (ttr) != METHOD_TYPE)
- || (TREE_CODE (ttl) != FUNCTION_TYPE && TREE_CODE (ttl) != METHOD_TYPE))
- {
- if (TREE_CODE (ttl) == OFFSET_TYPE
- && binfo_member (TYPE_OFFSET_BASETYPE (ttr),
- CLASSTYPE_VBASECLASSES (TYPE_OFFSET_BASETYPE (ttl))))
- {
- error ("%s between pointer to members converting across virtual baseclasses", errtype);
- return error_mark_node;
- }
- else if (!at_least_as_qualified_p (ttl, ttr))
- {
- if (string_conv_p (type, rhs, 1))
- /* converting from string constant to char *, OK. */;
- else if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' discards qualifiers",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' discards qualifiers",
- errtype, type, rhstype);
- }
- else if (TREE_CODE (ttl) == TREE_CODE (ttr)
- && ! comp_target_types (type, rhstype, 1))
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' changes signedness",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' changes signedness",
- errtype, type, rhstype);
- }
- }
- }
- else
- {
- int add_quals = 0;
- int drops_quals = 0;
- int left_const = 1;
- int unsigned_parity;
- int nptrs = 0;
-
- /* This code is basically a duplicate of comp_ptr_ttypes_real. */
- for (; ; ttl = TREE_TYPE (ttl), ttr = TREE_TYPE (ttr))
- {
- nptrs -= 1;
- drops_quals |= !at_least_as_qualified_p (ttl, ttr);
- if (! left_const
- && !at_least_as_qualified_p (ttr, ttl))
- add_quals = 1;
- left_const &= TYPE_READONLY (ttl);
+ /* Simplify the RHS if possible. */
+ if (TREE_CODE (rhs) == CONST_DECL)
+ rhs = DECL_INITIAL (rhs);
+ else if (coder != ARRAY_TYPE)
+ rhs = decl_constant_value (rhs);
- if (TREE_CODE (ttl) != POINTER_TYPE
- || TREE_CODE (ttr) != POINTER_TYPE)
- break;
- }
- unsigned_parity = TREE_UNSIGNED (ttl) - TREE_UNSIGNED (ttr);
- if (unsigned_parity)
- {
- if (TREE_UNSIGNED (ttl))
- ttr = unsigned_type (ttr);
- else
- ttl = unsigned_type (ttl);
- }
+ /* [expr.ass]
- if (comp_target_types (ttl, ttr, nptrs) > 0)
- {
- if (add_quals)
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' adds cv-quals without intervening `const'",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' adds cv-quals without intervening `const'",
- errtype, type, rhstype);
- }
- if (drops_quals)
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' discards qualifiers",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' discards qualifiers",
- errtype, type, rhstype);
- }
- if (unsigned_parity > 0)
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' changes signed to unsigned",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' changes signed to unsigned",
- errtype, type, rhstype);
- }
- else if (unsigned_parity < 0)
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' changes unsigned to signed",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' changes unsigned to signed",
- errtype, type, rhstype);
- }
+ The expression is implicitly converted (clause _conv_) to the
+ cv-unqualified type of the left operand.
- /* C++ is not so friendly about converting function and
- member function pointers as C. Emit warnings here. */
- if (TREE_CODE (ttl) == FUNCTION_TYPE
- || TREE_CODE (ttl) == METHOD_TYPE)
- if (!same_or_base_type_p (ttl, ttr))
- {
- warning ("conflicting function types in %s:", errtype);
- cp_warning ("\t`%T' != `%T'", type, rhstype);
- }
- }
- else
- {
- if (fndecl)
- cp_error ("passing `%T' as argument %P of `%D'",
- rhstype, parmnum, fndecl);
- else
- cp_error ("%s to `%T' from `%T'", errtype, type, rhstype);
- return error_mark_node;
- }
- }
- return cp_convert (type, rhs);
- }
- else if (codel == POINTER_TYPE
- && (coder == INTEGER_TYPE
- || coder == BOOLEAN_TYPE))
+ We allow bad conversions here because by the time we get to this point
+ we are committed to doing the conversion. If we end up doing a bad
+ conversion, convert_like will complain. */
+ if (!can_convert_arg_bad (type, rhstype, rhs))
{
- /* An explicit constant 0 can convert to a pointer,
- but not a 0 that results from casting or folding. */
- if (! (TREE_CODE (rhs) == INTEGER_CST && integer_zerop (rhs)))
+ /* When -Wno-pmf-conversions is use, we just silently allow
+ conversions from pointers-to-members to plain pointers. If
+ the conversion doesn't work, cp_convert will complain. */
+ if (!warn_pmf2ptr
+ && TYPE_PTR_P (type)
+ && TYPE_PTRMEMFUNC_P (rhstype))
+ rhs = cp_convert (strip_top_quals (type), rhs);
+ else
{
- if (fndecl)
- cp_pedwarn ("passing `%T' to argument %P of `%D' lacks a cast",
- rhstype, parmnum, fndecl);
+ /* If the right-hand side has unknown type, then it is an
+ overloaded function. Call instantiate_type to get error
+ messages. */
+ if (rhstype == unknown_type_node)
+ instantiate_type (type, rhs, itf_complain);
+ else if (fndecl)
+ error ("cannot convert `%T' to `%T' for argument `%P' to `%D'",
+ rhstype, type, parmnum, fndecl);
else
- cp_pedwarn ("%s to `%T' from `%T' lacks a cast",
- errtype, type, rhstype);
+ error ("cannot convert `%T' to `%T' in %s", rhstype, type,
+ errtype);
+ return error_mark_node;
}
- return cp_convert (type, rhs);
- }
- else if (codel == INTEGER_TYPE
- && (coder == POINTER_TYPE
- || (coder == RECORD_TYPE
- && (IS_SIGNATURE_POINTER (rhstype)
- || TYPE_PTRMEMFUNC_FLAG (rhstype)
- || IS_SIGNATURE_REFERENCE (rhstype)))))
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' to argument %P of `%D' lacks a cast",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' lacks a cast",
- errtype, type, rhstype);
- return cp_convert (type, rhs);
- }
- else if (codel == BOOLEAN_TYPE
- && (coder == POINTER_TYPE
- || (coder == RECORD_TYPE
- && (IS_SIGNATURE_POINTER (rhstype)
- || TYPE_PTRMEMFUNC_FLAG (rhstype)
- || IS_SIGNATURE_REFERENCE (rhstype)))))
- return cp_convert (type, rhs);
-
- /* C++ */
- else if (((coder == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (rhstype)) == METHOD_TYPE)
- || integer_zerop (rhs)
- || TYPE_PTRMEMFUNC_P (rhstype))
- && TYPE_PTRMEMFUNC_P (type))
- {
- tree ttl = TYPE_PTRMEMFUNC_FN_TYPE (type);
- tree ttr = (TYPE_PTRMEMFUNC_P (rhstype)
- ? TYPE_PTRMEMFUNC_FN_TYPE (rhstype)
- : rhstype);
- int ctt = (TREE_CODE (rhstype) == INTEGER_TYPE ? 1
- : comp_target_types (ttl, ttr, 1));
-
- if (ctt < 0)
- cp_pedwarn ("converting `%T' to `%T' is a contravariance violation",
- ttr, ttl);
- else if (ctt == 0)
- cp_error ("%s to `%T' from `%T'", errtype, ttl, ttr);
-
- /* compatible pointer to member functions. */
- return build_ptrmemfunc (ttl, rhs, 0);
- }
- else if (codel == ERROR_MARK || coder == ERROR_MARK)
- return error_mark_node;
-
- /* This should no longer happen. References are initialized via
- `convert_for_initialization'. They should otherwise be
- bashed before coming here. */
- else if (codel == REFERENCE_TYPE)
- my_friendly_abort (317);
- else if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (rhs)))
- {
- tree nrhs = build1 (NOP_EXPR, type, rhs);
- TREE_CONSTANT (nrhs) = TREE_CONSTANT (rhs);
- return nrhs;
}
- else if (TYPE_HAS_CONSTRUCTOR (type) || IS_AGGR_TYPE (TREE_TYPE (rhs)))
- return cp_convert (type, rhs);
- /* Handle anachronistic conversions from (::*)() to cv void* or (*)(). */
- else if (TREE_CODE (type) == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
- || TYPE_MAIN_VARIANT (TREE_TYPE (type)) == void_type_node)
- && TREE_TYPE (rhs)
- && TYPE_PTRMEMFUNC_P (TREE_TYPE (rhs)))
- return cp_convert (type, rhs);
-
- cp_error ("%s to `%T' from `%T'", errtype, type, rhstype);
- return error_mark_node;
+ return perform_implicit_conversion (strip_top_quals (type), rhs);
}
/* Convert RHS to be of type TYPE.
@@ -7207,13 +6402,11 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
if (codel == REFERENCE_TYPE)
{
/* This should eventually happen in convert_arguments. */
- extern int warningcount, errorcount;
int savew = 0, savee = 0;
if (fndecl)
savew = warningcount, savee = errorcount;
- rhs = convert_to_reference (type, rhs, CONV_IMPLICIT, flags,
- exp ? exp : error_mark_node);
+ rhs = initialize_reference (type, rhs);
if (fndecl)
{
if (warningcount > savew)
@@ -7234,28 +6427,9 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
type = complete_type (type);
- if (TYPE_LANG_SPECIFIC (type)
- && (IS_SIGNATURE_POINTER (type) || IS_SIGNATURE_REFERENCE (type)))
- return build_signature_pointer_constructor (type, rhs);
-
if (IS_AGGR_TYPE (type))
return ocp_convert (type, rhs, CONV_IMPLICIT|CONV_FORCE_TEMP, flags);
- if (type == TREE_TYPE (rhs))
- {
- /* Issue warnings about peculiar, but legal, uses of NULL. We
- do this *before* the call to decl_constant_value so as to
- avoid duplicate warnings on code like `const int I = NULL;
- f(I);'. */
- if (ARITHMETIC_TYPE_P (type) && rhs == null_node)
- cp_warning ("converting NULL to non-pointer type");
-
- if (TREE_READONLY_DECL_P (rhs))
- rhs = decl_constant_value (rhs);
-
- return rhs;
- }
-
return convert_for_assignment (type, rhs, errtype, fndecl, parmnum);
}
@@ -7272,7 +6446,7 @@ void
c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
tree string, outputs, inputs, clobbers;
int vol;
- char *filename;
+ const char *filename;
int line;
{
int noutputs = list_length (outputs);
@@ -7298,6 +6472,10 @@ c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
expand_expr (build_modify_expr (o[i], NOP_EXPR, TREE_VALUE (tail)),
const0_rtx, VOIDmode, EXPAND_NORMAL);
free_temp_slots ();
+
+ /* Restore the original value so that it's correct the next
+ time we expand this function. */
+ TREE_VALUE (tail) = o[i];
}
/* Detect modification of read-only values.
(Otherwise done by build_modify_expr.) */
@@ -7305,8 +6483,7 @@ c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
{
tree type = TREE_TYPE (o[i]);
if (CP_TYPE_CONST_P (type)
- || ((TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE)
+ || (IS_AGGR_TYPE_CODE (TREE_CODE (type))
&& C_TYPE_FIELDS_READONLY (type)))
readonly_error (o[i], "modification by `asm'", 1);
}
@@ -7316,270 +6493,247 @@ c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
emit_queue ();
}
-/* Expand a C `return' statement.
- RETVAL is the expression for what to return,
- or a null pointer for `return;' with no value.
-
- C++: upon seeing a `return', we must call destructors on all
- variables in scope which had constructors called on them.
- This means that if in a destructor, the base class destructors
- must be called before returning.
+/* If RETVAL is the address of, or a reference to, a local variable or
+ temporary give an appropraite warning. */
- The RETURN statement in C++ has initialization semantics. */
-
-void
-c_expand_return (retval)
+static void
+maybe_warn_about_returning_address_of_local (retval)
tree retval;
{
- extern struct nesting *cond_stack, *loop_stack, *case_stack;
- extern tree dtor_label, ctor_label;
- tree result = DECL_RESULT (current_function_decl);
- tree valtype = TREE_TYPE (result);
+ tree valtype = TREE_TYPE (DECL_RESULT (current_function_decl));
+ tree whats_returned = retval;
- if (TREE_THIS_VOLATILE (current_function_decl))
- warning ("function declared `noreturn' has a `return' statement");
+ for (;;)
+ {
+ if (TREE_CODE (whats_returned) == COMPOUND_EXPR)
+ whats_returned = TREE_OPERAND (whats_returned, 1);
+ else if (TREE_CODE (whats_returned) == CONVERT_EXPR
+ || TREE_CODE (whats_returned) == NON_LVALUE_EXPR
+ || TREE_CODE (whats_returned) == NOP_EXPR)
+ whats_returned = TREE_OPERAND (whats_returned, 0);
+ else
+ break;
+ }
+
+ if (TREE_CODE (whats_returned) != ADDR_EXPR)
+ return;
+ whats_returned = TREE_OPERAND (whats_returned, 0);
- if (retval == error_mark_node)
+ if (TREE_CODE (valtype) == REFERENCE_TYPE)
{
- current_function_returns_null = 1;
- return;
+ if (TREE_CODE (whats_returned) == AGGR_INIT_EXPR
+ || TREE_CODE (whats_returned) == TARGET_EXPR)
+ {
+ /* Get the target. */
+ whats_returned = TREE_OPERAND (whats_returned, 0);
+ warning ("returning reference to temporary");
+ return;
+ }
+ if (TREE_CODE (whats_returned) == VAR_DECL
+ && DECL_NAME (whats_returned)
+ && TEMP_NAME_P (DECL_NAME (whats_returned)))
+ {
+ warning ("reference to non-lvalue returned");
+ return;
+ }
}
- if (processing_template_decl)
+ if (TREE_CODE (whats_returned) == VAR_DECL
+ && DECL_NAME (whats_returned)
+ && DECL_FUNCTION_SCOPE_P (whats_returned)
+ && !(TREE_STATIC (whats_returned)
+ || TREE_PUBLIC (whats_returned)))
{
- add_tree (build_min_nt (RETURN_STMT, retval));
+ if (TREE_CODE (valtype) == REFERENCE_TYPE)
+ cp_warning_at ("reference to local variable `%D' returned",
+ whats_returned);
+ else
+ cp_warning_at ("address of local variable `%D' returned",
+ whats_returned);
return;
}
+}
- if (dtor_label)
+/* Check that returning RETVAL from the current function is legal.
+ Return an expression explicitly showing all conversions required to
+ change RETVAL into the function return type, and to assign it to
+ the DECL_RESULT for the function. */
+
+tree
+check_return_expr (retval)
+ tree retval;
+{
+ tree result;
+ /* The type actually returned by the function, after any
+ promotions. */
+ tree valtype;
+ int fn_returns_value_p;
+
+ /* A `volatile' function is one that isn't supposed to return, ever.
+ (This is a G++ extension, used to get better code for functions
+ that call the `volatile' function.) */
+ if (TREE_THIS_VOLATILE (current_function_decl))
+ warning ("function declared `noreturn' has a `return' statement");
+
+ /* Check for various simple errors. */
+ if (DECL_DESTRUCTOR_P (current_function_decl))
{
if (retval)
error ("returning a value from a destructor");
-
- /* Can't just return from a destructor. */
- expand_goto (dtor_label);
- return;
+ return NULL_TREE;
}
-
- /* Only operator new(...) throw(), can return NULL [expr.new/13]. */
- if ((DECL_NAME (current_function_decl) == ansi_opname[(int) NEW_EXPR]
- || DECL_NAME (current_function_decl) == ansi_opname[(int) VEC_NEW_EXPR])
- && !TYPE_NOTHROW_P (TREE_TYPE (current_function_decl))
- && null_ptr_cst_p (retval))
- cp_warning ("operator new should throw an exception, not return NULL");
-
- if (retval == NULL_TREE)
+ else if (DECL_CONSTRUCTOR_P (current_function_decl))
{
- /* A non-named return value does not count. */
+ if (in_function_try_handler)
+ /* If a return statement appears in a handler of the
+ function-try-block of a constructor, the program is ill-formed. */
+ error ("cannot return from a handler of a function-try-block of a constructor");
+ else if (retval)
+ /* You can't return a value from a constructor. */
+ error ("returning a value from a constructor");
+ return NULL_TREE;
+ }
- if (DECL_CONSTRUCTOR_P (current_function_decl))
- retval = current_class_ptr;
- else if (DECL_NAME (result) != NULL_TREE
- && TREE_CODE (valtype) != VOID_TYPE)
- retval = result;
+ /* When no explicit return-value is given in a function with a named
+ return value, the named return value is used. */
+ result = DECL_RESULT (current_function_decl);
+ valtype = TREE_TYPE (result);
+ my_friendly_assert (valtype != NULL_TREE, 19990924);
+ fn_returns_value_p = !VOID_TYPE_P (valtype);
+ if (!retval && DECL_NAME (result) && fn_returns_value_p)
+ retval = result;
+
+ /* Check for a return statement with no return value in a function
+ that's supposed to return a value. */
+ if (!retval && fn_returns_value_p)
+ {
+ pedwarn ("return-statement with no value, in function declared with a non-void return type");
+ /* Clear this, so finish_function won't say that we reach the
+ end of a non-void function (which we don't, we gave a
+ return!). */
+ current_function_returns_null = 0;
+ }
+ /* Check for a return statement with a value in a function that
+ isn't supposed to return a value. */
+ else if (retval && !fn_returns_value_p)
+ {
+ if (VOID_TYPE_P (TREE_TYPE (retval)))
+ /* You can return a `void' value from a function of `void'
+ type. In that case, we have to evaluate the expression for
+ its side-effects. */
+ finish_expr_stmt (retval);
else
- {
- current_function_returns_null = 1;
+ pedwarn ("return-statement with a value, in function declared with a void return type");
- if (valtype != NULL_TREE && TREE_CODE (valtype) != VOID_TYPE)
- {
- if (DECL_NAME (DECL_RESULT (current_function_decl)) == NULL_TREE)
- {
- pedwarn ("`return' with no value, in function returning non-void");
- /* Clear this, so finish_function won't say that we
- reach the end of a non-void function (which we don't,
- we gave a return!). */
- current_function_returns_null = 0;
- }
- }
+ current_function_returns_null = 1;
- expand_null_return ();
- return;
- }
- }
- else if (DECL_CONSTRUCTOR_P (current_function_decl))
- {
- if (flag_this_is_variable)
- error ("return from a constructor: use `this = ...' instead");
- else
- error ("returning a value from a constructor");
- retval = current_class_ptr;
+ /* There's really no value to return, after all. */
+ return NULL_TREE;
}
+ else if (!retval)
+ /* Remember that this function can sometimes return without a
+ value. */
+ current_function_returns_null = 1;
+ else
+ /* Remember that this function did return a value. */
+ current_function_returns_value = 1;
+
+ /* Only operator new(...) throw(), can return NULL [expr.new/13]. */
+ if ((DECL_OVERLOADED_OPERATOR_P (current_function_decl) == NEW_EXPR
+ || DECL_OVERLOADED_OPERATOR_P (current_function_decl) == VEC_NEW_EXPR)
+ && !TYPE_NOTHROW_P (TREE_TYPE (current_function_decl))
+ && ! flag_check_new
+ && null_ptr_cst_p (retval))
+ warning ("`operator new' must not return NULL unless it is declared `throw()' (or -fcheck-new is in effect)");
/* Effective C++ rule 15. See also start_function. */
if (warn_ecpp
- && DECL_NAME (current_function_decl) == ansi_opname[(int) MODIFY_EXPR]
+ && DECL_NAME (current_function_decl) == ansi_assopname(NOP_EXPR)
&& retval != current_class_ref)
- cp_warning ("`operator=' should return a reference to `*this'");
-
- if (valtype == NULL_TREE || TREE_CODE (valtype) == VOID_TYPE)
- {
- current_function_returns_null = 1;
- if (TREE_CODE (TREE_TYPE (retval)) != VOID_TYPE)
- pedwarn ("`return' with a value, in function returning void");
- expand_return (retval);
- return;
- }
-
- /* Now deal with possible C++ hair:
- (1) Compute the return value.
- (2) If there are aggregate values with destructors which
- must be cleaned up, clean them (taking care
- not to clobber the return value).
- (3) If an X(X&) constructor is defined, the return
- value must be returned via that. */
-
- if (retval == result
- || DECL_CONSTRUCTOR_P (current_function_decl))
- /* It's already done for us. */;
- else if (TREE_CODE (TREE_TYPE (retval)) == VOID_TYPE)
- {
- pedwarn ("return of void value in function returning non-void");
- expand_expr_stmt (retval);
- retval = 0;
+ warning ("`operator=' should return a reference to `*this'");
+
+ /* The fabled Named Return Value optimization, as per [class.copy]/15:
+
+ [...] For a function with a class return type, if the expression
+ in the return statement is the name of a local object, and the cv-
+ unqualified type of the local object is the same as the function
+ return type, an implementation is permitted to omit creating the tem-
+ porary object to hold the function return value [...]
+
+ So, if this is a value-returning function that always returns the same
+ local variable, remember it.
+
+ It might be nice to be more flexible, and choose the first suitable
+ variable even if the function sometimes returns something else, but
+ then we run the risk of clobbering the variable we chose if the other
+ returned expression uses the chosen variable somehow. And people expect
+ this restriction, anyway. (jason 2000-11-19)
+
+ See finish_function, genrtl_start_function, and declare_return_variable
+ for other pieces of this optimization. */
+
+ if (fn_returns_value_p && flag_elide_constructors)
+ {
+ if (retval != NULL_TREE
+ && (current_function_return_value == NULL_TREE
+ || current_function_return_value == retval)
+ && TREE_CODE (retval) == VAR_DECL
+ && DECL_CONTEXT (retval) == current_function_decl
+ && ! TREE_STATIC (retval)
+ && (DECL_ALIGN (retval)
+ >= DECL_ALIGN (DECL_RESULT (current_function_decl)))
+ && same_type_p ((TYPE_MAIN_VARIANT
+ (TREE_TYPE (retval))),
+ (TYPE_MAIN_VARIANT
+ (TREE_TYPE (TREE_TYPE (current_function_decl))))))
+ current_function_return_value = retval;
+ else
+ current_function_return_value = error_mark_node;
}
+
+ /* We don't need to do any conversions when there's nothing being
+ returned. */
+ if (!retval || retval == error_mark_node)
+ return retval;
+
+ /* Do any required conversions. */
+ if (retval == result || DECL_CONSTRUCTOR_P (current_function_decl))
+ /* No conversions are required. */
+ ;
else
{
+ /* The type the function is declared to return. */
tree functype = TREE_TYPE (TREE_TYPE (current_function_decl));
/* First convert the value to the function's return type, then
to the type of return value's location to handle the
- case that functype is thiner than the valtype. */
-
+ case that functype is smaller than the valtype. */
retval = convert_for_initialization
(NULL_TREE, functype, retval, LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING,
"return", NULL_TREE, 0);
-
retval = convert (valtype, retval);
+ /* If the conversion failed, treat this just like `return;'. */
if (retval == error_mark_node)
- {
- /* Avoid warning about control reaching end of function. */
- expand_null_return ();
- return;
- }
-
+ return retval;
/* We can't initialize a register from a AGGR_INIT_EXPR. */
else if (! current_function_returns_struct
&& TREE_CODE (retval) == TARGET_EXPR
&& TREE_CODE (TREE_OPERAND (retval, 1)) == AGGR_INIT_EXPR)
retval = build (COMPOUND_EXPR, TREE_TYPE (retval), retval,
TREE_OPERAND (retval, 0));
-
- /* Add some useful error checking for C++. */
- else if (TREE_CODE (valtype) == REFERENCE_TYPE)
- {
- tree whats_returned;
-
- /* Sort through common things to see what it is
- we are returning. */
- whats_returned = retval;
- if (TREE_CODE (whats_returned) == COMPOUND_EXPR)
- {
- whats_returned = TREE_OPERAND (whats_returned, 1);
- if (TREE_CODE (whats_returned) == ADDR_EXPR)
- whats_returned = TREE_OPERAND (whats_returned, 0);
- }
- while (TREE_CODE (whats_returned) == CONVERT_EXPR
- || TREE_CODE (whats_returned) == NOP_EXPR)
- whats_returned = TREE_OPERAND (whats_returned, 0);
- if (TREE_CODE (whats_returned) == ADDR_EXPR)
- {
- whats_returned = TREE_OPERAND (whats_returned, 0);
- while (TREE_CODE (whats_returned) == AGGR_INIT_EXPR
- || TREE_CODE (whats_returned) == TARGET_EXPR)
- {
- /* Get the target. */
- whats_returned = TREE_OPERAND (whats_returned, 0);
- warning ("returning reference to temporary");
- }
- }
-
- if (TREE_CODE (whats_returned) == VAR_DECL && DECL_NAME (whats_returned))
- {
- if (TEMP_NAME_P (DECL_NAME (whats_returned)))
- warning ("reference to non-lvalue returned");
- else if (TREE_CODE (TREE_TYPE (whats_returned)) != REFERENCE_TYPE
- && DECL_FUNCTION_SCOPE_P (whats_returned)
- && !(TREE_STATIC (whats_returned)
- || TREE_PUBLIC (whats_returned)))
- cp_warning_at ("reference to local variable `%D' returned", whats_returned);
- }
- }
- else if (TREE_CODE (retval) == ADDR_EXPR)
- {
- tree whats_returned = TREE_OPERAND (retval, 0);
-
- if (TREE_CODE (whats_returned) == VAR_DECL
- && DECL_NAME (whats_returned)
- && DECL_FUNCTION_SCOPE_P (whats_returned)
- && !(TREE_STATIC (whats_returned)
- || TREE_PUBLIC (whats_returned)))
- cp_warning_at ("address of local variable `%D' returned", whats_returned);
- }
- }
-
- if (retval != NULL_TREE
- && TREE_CODE_CLASS (TREE_CODE (retval)) == 'd'
- && cond_stack == 0 && loop_stack == 0 && case_stack == 0)
- current_function_return_value = retval;
-
- if (ctor_label && TREE_CODE (ctor_label) != ERROR_MARK)
- {
- /* Here RETVAL is CURRENT_CLASS_PTR, so there's nothing to do. */
- expand_goto (ctor_label);
+ else
+ maybe_warn_about_returning_address_of_local (retval);
}
-
+
+ /* Actually copy the value returned into the appropriate location. */
if (retval && retval != result)
- {
- result = build (INIT_EXPR, TREE_TYPE (result), result, retval);
- TREE_SIDE_EFFECTS (result) = 1;
- }
-
- expand_start_target_temps ();
-
- expand_return (result);
-
- expand_end_target_temps ();
-
- current_function_returns_value = 1;
-}
-
-/* Start a C switch statement, testing expression EXP.
- Return EXP if it is valid, an error node otherwise. */
-
-tree
-c_expand_start_case (exp)
- tree exp;
-{
- tree type, idx;
-
- exp = build_expr_type_conversion (WANT_INT | WANT_ENUM, exp, 1);
- if (exp == NULL_TREE)
- {
- error ("switch quantity not an integer");
- exp = error_mark_node;
- }
- if (exp == error_mark_node)
- return error_mark_node;
+ retval = build (INIT_EXPR, TREE_TYPE (result), result, retval);
- exp = default_conversion (exp);
- type = TREE_TYPE (exp);
- idx = get_unwidened (exp, 0);
- /* We can't strip a conversion from a signed type to an unsigned,
- because if we did, int_fits_type_p would do the wrong thing
- when checking case values for being in range,
- and it's too hard to do the right thing. */
- if (TREE_UNSIGNED (TREE_TYPE (exp)) == TREE_UNSIGNED (TREE_TYPE (idx)))
- exp = idx;
-
- expand_start_case
- (1, fold (build1 (CLEANUP_POINT_EXPR, TREE_TYPE (exp), exp)),
- type, "switch statement");
-
- return exp;
+ return retval;
}
+
/* Returns non-zero if the pointer-type FROM can be converted to the
pointer-type TO via a qualification conversion. If CONSTP is -1,
then we return non-zero if the pointers are similar, and the
@@ -7626,7 +6780,7 @@ comp_ptr_ttypes_real (to, from, constp)
if (TREE_CODE (to) != POINTER_TYPE)
return
- same_type_p (TYPE_MAIN_VARIANT (to), TYPE_MAIN_VARIANT (from))
+ same_type_ignoring_top_level_qualifiers_p (to, from)
&& (constp >= 0 || to_more_cv_qualified);
}
}
@@ -7651,6 +6805,11 @@ ptr_reasonably_similar (to, from)
{
for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
{
+ /* Any target type is similar enough to void. */
+ if (TREE_CODE (to) == VOID_TYPE
+ || TREE_CODE (from) == VOID_TYPE)
+ return 1;
+
if (TREE_CODE (to) != TREE_CODE (from))
return 0;
@@ -7660,6 +6819,13 @@ ptr_reasonably_similar (to, from)
COMPARE_BASE | COMPARE_RELAXED))
continue;
+ if (TREE_CODE (to) == INTEGER_TYPE
+ && TYPE_PRECISION (to) == TYPE_PRECISION (from))
+ return 1;
+
+ if (TREE_CODE (to) == FUNCTION_TYPE)
+ return 1;
+
if (TREE_CODE (to) != POINTER_TYPE)
return comptypes
(TYPE_MAIN_VARIANT (to), TYPE_MAIN_VARIANT (from),
@@ -7684,8 +6850,7 @@ comp_ptr_ttypes_const (to, from)
continue;
if (TREE_CODE (to) != POINTER_TYPE)
- return same_type_p (TYPE_MAIN_VARIANT (to),
- TYPE_MAIN_VARIANT (from));
+ return same_type_ignoring_top_level_qualifiers_p (to, from);
}
}
@@ -7724,15 +6889,14 @@ comp_ptr_ttypes_reinterpret (to, from)
}
}
-/* Returns the type-qualifier set corresponding to TYPE. */
+/* Returns the type qualifiers for this type, including the qualifiers on the
+ elements for an array type. */
int
cp_type_quals (type)
tree type;
{
- while (TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
-
+ type = strip_array_types (type);
return TYPE_QUALS (type);
}
@@ -7742,8 +6906,137 @@ int
cp_has_mutable_p (type)
tree type;
{
- while (TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
+ type = strip_array_types (type);
return CLASS_TYPE_P (type) && CLASSTYPE_HAS_MUTABLE (type);
}
+
+/* Subroutine of casts_away_constness. Make T1 and T2 point at
+ exemplar types such that casting T1 to T2 is casting away castness
+ if and only if there is no implicit conversion from T1 to T2. */
+
+static void
+casts_away_constness_r (t1, t2)
+ tree *t1;
+ tree *t2;
+{
+ int quals1;
+ int quals2;
+
+ /* [expr.const.cast]
+
+ For multi-level pointer to members and multi-level mixed pointers
+ and pointers to members (conv.qual), the "member" aspect of a
+ pointer to member level is ignored when determining if a const
+ cv-qualifier has been cast away. */
+ if (TYPE_PTRMEM_P (*t1))
+ *t1 = build_pointer_type (TREE_TYPE (TREE_TYPE (*t1)));
+ if (TYPE_PTRMEM_P (*t2))
+ *t2 = build_pointer_type (TREE_TYPE (TREE_TYPE (*t2)));
+
+ /* [expr.const.cast]
+
+ For two pointer types:
+
+ X1 is T1cv1,1 * ... cv1,N * where T1 is not a pointer type
+ X2 is T2cv2,1 * ... cv2,M * where T2 is not a pointer type
+ K is min(N,M)
+
+ casting from X1 to X2 casts away constness if, for a non-pointer
+ type T there does not exist an implicit conversion (clause
+ _conv_) from:
+
+ Tcv1,(N-K+1) * cv1,(N-K+2) * ... cv1,N *
+
+ to
+
+ Tcv2,(M-K+1) * cv2,(M-K+2) * ... cv2,M *. */
+
+ if (TREE_CODE (*t1) != POINTER_TYPE
+ || TREE_CODE (*t2) != POINTER_TYPE)
+ {
+ *t1 = cp_build_qualified_type (void_type_node,
+ cp_type_quals (*t1));
+ *t2 = cp_build_qualified_type (void_type_node,
+ cp_type_quals (*t2));
+ return;
+ }
+
+ quals1 = cp_type_quals (*t1);
+ quals2 = cp_type_quals (*t2);
+ *t1 = TREE_TYPE (*t1);
+ *t2 = TREE_TYPE (*t2);
+ casts_away_constness_r (t1, t2);
+ *t1 = build_pointer_type (*t1);
+ *t2 = build_pointer_type (*t2);
+ *t1 = cp_build_qualified_type (*t1, quals1);
+ *t2 = cp_build_qualified_type (*t2, quals2);
+}
+
+/* Returns non-zero if casting from TYPE1 to TYPE2 casts away
+ constness. */
+
+static int
+casts_away_constness (t1, t2)
+ tree t1;
+ tree t2;
+{
+ if (TREE_CODE (t2) == REFERENCE_TYPE)
+ {
+ /* [expr.const.cast]
+
+ Casting from an lvalue of type T1 to an lvalue of type T2
+ using a reference cast casts away constness if a cast from an
+ rvalue of type "pointer to T1" to the type "pointer to T2"
+ casts away constness. */
+ t1 = (TREE_CODE (t1) == REFERENCE_TYPE
+ ? TREE_TYPE (t1) : t1);
+ return casts_away_constness (build_pointer_type (t1),
+ build_pointer_type (TREE_TYPE (t2)));
+ }
+
+ if (TYPE_PTRMEM_P (t1) && TYPE_PTRMEM_P (t2))
+ /* [expr.const.cast]
+
+ Casting from an rvalue of type "pointer to data member of X
+ of type T1" to the type "pointer to data member of Y of type
+ T2" casts away constness if a cast from an rvalue of type
+ "pointer to T1" to the type "pointer to T2" casts away
+ constness. */
+ return casts_away_constness
+ (build_pointer_type (TREE_TYPE (TREE_TYPE (t1))),
+ build_pointer_type (TREE_TYPE (TREE_TYPE (t2))));
+
+ /* Casting away constness is only something that makes sense for
+ pointer or reference types. */
+ if (TREE_CODE (t1) != POINTER_TYPE
+ || TREE_CODE (t2) != POINTER_TYPE)
+ return 0;
+
+ /* Top-level qualifiers don't matter. */
+ t1 = TYPE_MAIN_VARIANT (t1);
+ t2 = TYPE_MAIN_VARIANT (t2);
+ casts_away_constness_r (&t1, &t2);
+ if (!can_convert (t2, t1))
+ return 1;
+
+ return 0;
+}
+
+/* Returns TYPE with its cv qualifiers removed
+ TYPE is T cv* .. *cv where T is not a pointer type,
+ returns T * .. *. (If T is an array type, then the cv qualifiers
+ above are those of the array members.) */
+
+static tree
+strip_all_pointer_quals (type)
+ tree type;
+{
+ if (TREE_CODE (type) == POINTER_TYPE)
+ return build_pointer_type (strip_all_pointer_quals (TREE_TYPE (type)));
+ else if (TREE_CODE (type) == OFFSET_TYPE)
+ return build_offset_type (TYPE_OFFSET_BASETYPE (type),
+ strip_all_pointer_quals (TREE_TYPE (type)));
+ else
+ return TYPE_MAIN_VARIANT (type);
+}
diff --git a/contrib/gcc/cp/typeck2.c b/contrib/gcc/cp/typeck2.c
index da98203..314685a 100644
--- a/contrib/gcc/cp/typeck2.c
+++ b/contrib/gcc/cp/typeck2.c
@@ -1,6 +1,7 @@
/* Report error messages, build initializers, and perform
some front-end optimizations for C++ compiler.
- Copyright (C) 1987, 88, 89, 92-98, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 1999, 2000 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -36,12 +37,10 @@ Boston, MA 02111-1307, USA. */
#include "cp-tree.h"
#include "flags.h"
#include "toplev.h"
+#include "output.h"
+#include "diagnostic.h"
-static tree process_init_constructor PROTO((tree, tree, tree *));
-static void ack PVPROTO ((const char *, ...)) ATTRIBUTE_PRINTF_1;
-
-extern int errorcount;
-extern int sorrycount;
+static tree process_init_constructor PARAMS ((tree, tree, tree *));
/* Print an error message stemming from an attempt to use
BASETYPE as a base class for TYPE. */
@@ -51,26 +50,22 @@ error_not_base_type (basetype, type)
tree basetype, type;
{
if (TREE_CODE (basetype) == FUNCTION_DECL)
- basetype = DECL_CLASS_CONTEXT (basetype);
- cp_error ("type `%T' is not a base type for type `%T'", basetype, type);
+ basetype = DECL_CONTEXT (basetype);
+ error ("type `%T' is not a base type for type `%T'", basetype, type);
return error_mark_node;
}
tree
-binfo_or_else (parent_or_type, type)
- tree parent_or_type, type;
+binfo_or_else (base, type)
+ tree base, type;
{
- tree binfo;
- if (TYPE_MAIN_VARIANT (parent_or_type) == TYPE_MAIN_VARIANT (type))
- return TYPE_BINFO (parent_or_type);
- if ((binfo = get_binfo (parent_or_type, TYPE_MAIN_VARIANT (type), 0)))
- {
- if (binfo == error_mark_node)
- return NULL_TREE;
- return binfo;
- }
- error_not_base_type (parent_or_type, type);
- return NULL_TREE;
+ tree binfo = lookup_base (type, base, ba_ignore, NULL);
+
+ if (binfo == error_mark_node)
+ return NULL_TREE;
+ else if (!binfo)
+ error_not_base_type (base, type);
+ return binfo;
}
/* According to ARM $7.1.6, "A `const' object may be initialized, but its
@@ -85,19 +80,19 @@ readonly_error (arg, string, soft)
int soft;
{
const char *fmt;
- void (*fn) PVPROTO ((const char *, ...));
+ void (*fn) PARAMS ((const char *, ...));
if (soft)
- fn = cp_pedwarn;
+ fn = pedwarn;
else
- fn = cp_error;
+ fn = error;
if (TREE_CODE (arg) == COMPONENT_REF)
{
if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
- fmt = "%s of member `%D' in read-only structure";
+ fmt = "%s of data-member `%D' in read-only structure";
else
- fmt = "%s of read-only member `%D'";
+ fmt = "%s of read-only data-member `%D'";
(*fn) (fmt, string, TREE_OPERAND (arg, 1));
}
else if (TREE_CODE (arg) == VAR_DECL)
@@ -125,84 +120,64 @@ readonly_error (arg, string, soft)
(*fn) ("%s of read-only location", string);
}
-/* Print an error message for invalid use of a type which declares
- virtual functions which are not inheritable. */
+/* If TYPE has abstract virtual functions, issue an error about trying
+ to create an object of that type. DECL is the object declared, or
+ NULL_TREE if the declaration is unavailable. Returns 1 if an error
+ occurred; zero if all was well. */
-void
+int
abstract_virtuals_error (decl, type)
tree decl;
tree type;
{
- tree u = CLASSTYPE_ABSTRACT_VIRTUALS (type);
+ tree u;
tree tu;
+ if (!CLASS_TYPE_P (type) || !CLASSTYPE_PURE_VIRTUALS (type))
+ return 0;
+
+ if (!TYPE_SIZE (type))
+ /* TYPE is being defined, and during that time
+ CLASSTYPE_PURE_VIRTUALS holds the inline friends. */
+ return 0;
+
+ u = CLASSTYPE_PURE_VIRTUALS (type);
if (decl)
{
if (TREE_CODE (decl) == RESULT_DECL)
- return;
+ return 0;
if (TREE_CODE (decl) == VAR_DECL)
- cp_error ("cannot declare variable `%D' to be of type `%T'",
+ error ("cannot declare variable `%D' to be of type `%T'",
decl, type);
else if (TREE_CODE (decl) == PARM_DECL)
- cp_error ("cannot declare parameter `%D' to be of type `%T'",
+ error ("cannot declare parameter `%D' to be of type `%T'",
decl, type);
else if (TREE_CODE (decl) == FIELD_DECL)
- cp_error ("cannot declare field `%D' to be of type `%T'",
+ error ("cannot declare field `%D' to be of type `%T'",
decl, type);
else if (TREE_CODE (decl) == FUNCTION_DECL
&& TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
- cp_error ("invalid return type for method `%#D'", decl);
+ error ("invalid return type for member function `%#D'", decl);
else if (TREE_CODE (decl) == FUNCTION_DECL)
- cp_error ("invalid return type for function `%#D'", decl);
+ error ("invalid return type for function `%#D'", decl);
}
else
- cp_error ("cannot allocate an object of type `%T'", type);
+ error ("cannot allocate an object of type `%T'", type);
/* Only go through this once. */
if (TREE_PURPOSE (u) == NULL_TREE)
{
TREE_PURPOSE (u) = error_mark_node;
- error (" since the following virtual functions are abstract:");
+ error (" because the following virtual functions are abstract:");
for (tu = u; tu; tu = TREE_CHAIN (tu))
cp_error_at ("\t%#D", TREE_VALUE (tu));
}
else
- cp_error (" since type `%T' has abstract virtual functions", type);
-}
-
-/* Print an error message for invalid use of a signature type.
- Signatures are treated similar to abstract classes here, they
- cannot be instantiated. */
+ error (" since type `%T' has abstract virtual functions", type);
-void
-signature_error (decl, type)
- tree decl;
- tree type;
-{
- if (decl)
- {
- if (TREE_CODE (decl) == RESULT_DECL)
- return;
-
- if (TREE_CODE (decl) == VAR_DECL)
- cp_error ("cannot declare variable `%D' to be of signature type `%T'",
- decl, type);
- else if (TREE_CODE (decl) == PARM_DECL)
- cp_error ("cannot declare parameter `%D' to be of signature type `%T'",
- decl, type);
- else if (TREE_CODE (decl) == FIELD_DECL)
- cp_error ("cannot declare field `%D' to be of signature type `%T'",
- decl, type);
- else if (TREE_CODE (decl) == FUNCTION_DECL
- && TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
- cp_error ("invalid return type for method `%#D'", decl);
- else if (TREE_CODE (decl) == FUNCTION_DECL)
- cp_error ("invalid return type for function `%#D'", decl);
- }
- else
- cp_error ("cannot allocate an object of signature type `%T'", type);
+ return 1;
}
/* Print an error message for invalid use of an incomplete type.
@@ -214,10 +189,18 @@ incomplete_type_error (value, type)
tree value;
tree type;
{
+ int decl = 0;
+
/* Avoid duplicate error message. */
if (TREE_CODE (type) == ERROR_MARK)
return;
+ if (value != 0 && (TREE_CODE (value) == VAR_DECL
+ || TREE_CODE (value) == PARM_DECL))
+ {
+ cp_error_at ("`%D' has incomplete type", value);
+ decl = 1;
+ }
retry:
/* We must print an error message. Be clever about what it says. */
@@ -226,12 +209,13 @@ retry:
case RECORD_TYPE:
case UNION_TYPE:
case ENUMERAL_TYPE:
- cp_error ("invalid use of undefined type `%#T'", type);
+ if (!decl)
+ error ("invalid use of undefined type `%#T'", type);
cp_error_at ("forward declaration of `%#T'", type);
break;
case VOID_TYPE:
- cp_error ("invalid use of void expression");
+ error ("invalid use of `%T'", type);
break;
case ARRAY_TYPE:
@@ -240,275 +224,34 @@ retry:
type = TREE_TYPE (type);
goto retry;
}
- cp_error ("invalid use of array with unspecified bounds");
+ error ("invalid use of array with unspecified bounds");
break;
case OFFSET_TYPE:
bad_member:
- cp_error ("invalid use of member (did you forget the `&' ?)");
+ error ("invalid use of member (did you forget the `&' ?)");
break;
case TEMPLATE_TYPE_PARM:
- cp_error ("invalid use of template type parameter");
+ error ("invalid use of template type parameter");
break;
case UNKNOWN_TYPE:
if (value && TREE_CODE (value) == COMPONENT_REF)
goto bad_member;
else if (value && TREE_CODE (value) == ADDR_EXPR)
- cp_error ("address of overloaded function with no contextual type information");
+ error ("address of overloaded function with no contextual type information");
else if (value && TREE_CODE (value) == OVERLOAD)
- cp_error ("overloaded function with no contextual type information");
+ error ("overloaded function with no contextual type information");
else
- cp_error ("insufficient contextual information to determine type");
+ error ("insufficient contextual information to determine type");
break;
default:
- my_friendly_abort (108);
+ abort ();
}
-
- if (value != 0 && (TREE_CODE (value) == VAR_DECL
- || TREE_CODE (value) == PARM_DECL))
- cp_error_at ("incomplete `%D' defined here", value);
-}
-
-/* Like error(), but don't call report_error_function(). */
-
-static void
-ack VPROTO ((const char *msg, ...))
-{
-#ifndef ANSI_PROTOTYPES
- const char *msg;
-#endif
- va_list ap;
- extern char * progname;
-
- VA_START (ap, msg);
-
-#ifndef ANSI_PROTOTYPES
- msg = va_arg (ap, const char *);
-#endif
-
- if (input_filename)
- fprintf (stderr, "%s:%d: ", input_filename, lineno);
- else
- fprintf (stderr, "%s: ", progname);
-
- vfprintf (stderr, msg, ap);
- va_end (ap);
-
- fprintf (stderr, "\n");
}
-
-/* There are times when the compiler can get very confused, confused
- to the point of giving up by aborting, simply because of previous
- input errors. It is much better to have the user go back and
- correct those errors first, and see if it makes us happier, than it
- is to abort on him. This is because when one has a 10,000 line
- program, and the compiler comes back with ``core dump'', the user
- is left not knowing even where to begin to fix things and no place
- to even try and work around things.
-
- The parameter is to uniquely identify the problem to the user, so
- that they can say, I am having problem 59, and know that fix 7 will
- probably solve their problem. Or, we can document what problem
- 59 is, so they can understand how to work around it, should they
- ever run into it.
-
- We used to tell people to "fix the above error[s] and try recompiling
- the program" via a call to fatal, but that message tended to look
- silly. So instead, we just do the equivalent of a call to fatal in the
- same situation (call exit).
-
- We used to assign sequential numbers for the aborts; now we use an
- encoding of the date the abort was added, since that has more meaning
- when we only see the error message. */
-
-static int abortcount = 0;
-void
-my_friendly_abort (i)
- int i;
-{
- /* if the previous error came through here, i.e. report_error_function
- ended up calling us again, don't just exit; we want a diagnostic of
- some kind. */
- if (abortcount == 1)
- current_function_decl = NULL_TREE;
- else if (errorcount > 0 || sorrycount > 0)
- {
- if (abortcount > 1)
- {
- if (i == 0)
- ack ("Internal compiler error.");
- else
- ack ("Internal compiler error %d.", i);
- ack ("Please submit a full bug report.");
- ack ("See %s for instructions.", GCCBUGURL);
- }
- else
- error ("confused by earlier errors, bailing out");
-
- exit (34);
- }
- ++abortcount;
-
- if (i == 0)
- error ("Internal compiler error.");
- else
- error ("Internal compiler error %d.", i);
-
- error ("Please submit a full bug report.");
- fatal ("See %s for instructions.", GCCBUGURL);
-}
-
-void
-my_friendly_assert (cond, where)
- int cond, where;
-{
- if (cond == 0)
- my_friendly_abort (where);
-}
-
-/* Return nonzero if VALUE is a valid constant-valued expression
- for use in initializing a static variable; one that can be an
- element of a "constant" initializer.
-
- Return null_pointer_node if the value is absolute;
- if it is relocatable, return the variable that determines the relocation.
- We assume that VALUE has been folded as much as possible;
- therefore, we do not need to check for such things as
- arithmetic-combinations of integers. */
-
-tree
-initializer_constant_valid_p (value, endtype)
- tree value;
- tree endtype;
-{
- switch (TREE_CODE (value))
- {
- case CONSTRUCTOR:
- if (TREE_CODE (TREE_TYPE (value)) == UNION_TYPE
- && TREE_CONSTANT (value))
- return
- initializer_constant_valid_p (TREE_VALUE (CONSTRUCTOR_ELTS (value)),
- endtype);
-
- return TREE_STATIC (value) ? null_pointer_node : 0;
-
- case INTEGER_CST:
- case REAL_CST:
- case STRING_CST:
- case COMPLEX_CST:
- case PTRMEM_CST:
- return null_pointer_node;
-
- case ADDR_EXPR:
- return TREE_OPERAND (value, 0);
-
- case NON_LVALUE_EXPR:
- return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype);
-
- case CONVERT_EXPR:
- case NOP_EXPR:
- /* Allow conversions between pointer types. */
- if (POINTER_TYPE_P (TREE_TYPE (value))
- && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (value, 0))))
- return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype);
-
- /* Allow conversions between real types. */
- if (TREE_CODE (TREE_TYPE (value)) == REAL_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == REAL_TYPE)
- return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype);
-
- /* Allow length-preserving conversions between integer types. */
- if (TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE
- && (TYPE_PRECISION (TREE_TYPE (value))
- == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0)))))
- return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype);
-
- /* Allow conversions between other integer types only if
- explicit value. */
- if (TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE)
- {
- tree inner = initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
- if (inner == null_pointer_node)
- return null_pointer_node;
- return 0;
- }
-
- /* Allow (int) &foo provided int is as wide as a pointer. */
- if (TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == POINTER_TYPE
- && (TYPE_PRECISION (TREE_TYPE (value))
- >= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0)))))
- return initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
-
- /* Likewise conversions from int to pointers, but also allow
- conversions from 0. */
- if (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE)
- {
- if (integer_zerop (TREE_OPERAND (value, 0)))
- return null_pointer_node;
- else if (TYPE_PRECISION (TREE_TYPE (value))
- <= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0))))
- return initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
- }
-
- /* Allow conversions to union types if the value inside is okay. */
- if (TREE_CODE (TREE_TYPE (value)) == UNION_TYPE)
- return initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
- return 0;
-
- case PLUS_EXPR:
- if ((TREE_CODE (endtype) == INTEGER_TYPE)
- && (TYPE_PRECISION (endtype) < POINTER_SIZE))
- return 0;
- {
- tree valid0 = initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
- tree valid1 = initializer_constant_valid_p (TREE_OPERAND (value, 1),
- endtype);
- /* If either term is absolute, use the other terms relocation. */
- if (valid0 == null_pointer_node)
- return valid1;
- if (valid1 == null_pointer_node)
- return valid0;
- return 0;
- }
-
- case MINUS_EXPR:
- if ((TREE_CODE (endtype) == INTEGER_TYPE)
- && (TYPE_PRECISION (endtype) < POINTER_SIZE))
- return 0;
- {
- tree valid0 = initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
- tree valid1 = initializer_constant_valid_p (TREE_OPERAND (value, 1),
- endtype);
- /* Win if second argument is absolute. */
- if (valid1 == null_pointer_node)
- return valid0;
- /* Win if both arguments have the same relocation.
- Then the value is absolute. */
- if (valid0 == valid1)
- return null_pointer_node;
- return 0;
- }
-
- default:
- break;
- }
-
- return 0;
-}
/* Perform appropriate conversions on the initial value of a variable,
store it in the declaration DECL,
@@ -551,21 +294,11 @@ store_init_value (decl, init)
{
if (! TYPE_HAS_TRIVIAL_INIT_REF (type)
&& TREE_CODE (init) != CONSTRUCTOR)
- my_friendly_abort (109);
+ abort ();
- /* Although we are not allowed to declare variables of signature
- type, we complain about a possible constructor call in such a
- declaration as well. */
- if (TREE_CODE (init) == TREE_LIST
- && IS_SIGNATURE (type))
- {
- cp_error ("constructor syntax cannot be used with signature type `%T'",
- type);
- init = error_mark_node;
- }
- else if (TREE_CODE (init) == TREE_LIST)
+ if (TREE_CODE (init) == TREE_LIST)
{
- cp_error ("constructor syntax used, but no constructor declared for type `%T'", type);
+ error ("constructor syntax used, but no constructor declared for type `%T'", type);
init = build_nt (CONSTRUCTOR, NULL_TREE, nreverse (init));
}
#if 0
@@ -633,9 +366,15 @@ store_init_value (decl, init)
/* End of special C++ code. */
- /* Digest the specified initializer into an expression. */
-
- value = digest_init (type, init, (tree *) 0);
+ /* We might have already run this bracketed initializer through
+ digest_init. Don't do so again. */
+ if (TREE_CODE (init) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (init)
+ && TREE_TYPE (init)
+ && TYPE_MAIN_VARIANT (TREE_TYPE (init)) == TYPE_MAIN_VARIANT (type))
+ value = init;
+ else
+ /* Digest the specified initializer into an expression. */
+ value = digest_init (type, init, (tree *) 0);
/* Store the expression if valid; else report error. */
@@ -643,7 +382,7 @@ store_init_value (decl, init)
;
/* 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. */
+ build_aggr_init without checking DECL_INITIAL. So just return. */
else if (TYPE_NEEDS_CONSTRUCTING (type))
return value;
else if (TREE_STATIC (decl)
@@ -667,19 +406,17 @@ store_init_value (decl, init)
#if 0 /* No, that's C. jason 9/19/94 */
else
{
- if (pedantic && TREE_CODE (value) == CONSTRUCTOR
- /* Don't complain about non-constant initializers of
- signature tables and signature pointers/references. */
- && ! (TYPE_LANG_SPECIFIC (type)
- && (IS_SIGNATURE (type)
- || IS_SIGNATURE_POINTER (type)
- || IS_SIGNATURE_REFERENCE (type))))
+ if (pedantic && TREE_CODE (value) == CONSTRUCTOR)
{
if (! TREE_CONSTANT (value) || ! TREE_STATIC (value))
- pedwarn ("ANSI C++ forbids non-constant aggregate initializer expressions");
+ pedwarn ("ISO C++ forbids non-constant aggregate initializer expressions");
}
}
#endif
+
+ /* Store the VALUE in DECL_INITIAL. If we're building a
+ statement-tree we will actually expand the initialization later
+ when we output this function. */
DECL_INITIAL (decl) = value;
return NULL_TREE;
}
@@ -717,6 +454,17 @@ digest_init (type, init, tail)
&& TREE_VALUE (init) == error_mark_node))
return error_mark_node;
+ if (TREE_CODE (init) == ERROR_MARK)
+ /* __PRETTY_FUNCTION__'s initializer is a bogus expression inside
+ a template function. This gets substituted during instantiation. */
+ return init;
+
+ /* We must strip the outermost array type when completing the type,
+ because the its bounds might be incomplete at the moment. */
+ if (!complete_type_or_else (TREE_CODE (type) == ARRAY_TYPE
+ ? TREE_TYPE (type) : type, NULL_TREE))
+ return error_mark_node;
+
/* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
if (TREE_CODE (init) == NON_LVALUE_EXPR)
init = TREE_OPERAND (init, 0);
@@ -752,11 +500,7 @@ digest_init (type, init, tail)
}
typ1 = TYPE_MAIN_VARIANT (TREE_TYPE (type));
- if ((typ1 == char_type_node
- || typ1 == signed_char_type_node
- || typ1 == unsigned_char_type_node
- || typ1 == unsigned_wchar_type_node
- || typ1 == signed_wchar_type_node)
+ if (char_type_p (typ1)
&& ((init && TREE_CODE (init) == STRING_CST)
|| (element && TREE_CODE (element) == STRING_CST)))
{
@@ -800,10 +544,8 @@ digest_init (type, init, tail)
if (code == INTEGER_TYPE || code == REAL_TYPE || code == POINTER_TYPE
|| code == ENUMERAL_TYPE || code == REFERENCE_TYPE
- || code == BOOLEAN_TYPE || code == COMPLEX_TYPE
- || TYPE_PTRMEMFUNC_P (type)
- || (code == RECORD_TYPE && ! raw_constructor
- && (IS_SIGNATURE_POINTER (type) || IS_SIGNATURE_REFERENCE (type))))
+ || code == BOOLEAN_TYPE || code == COMPLEX_TYPE || code == VECTOR_TYPE
+ || TYPE_PTRMEMFUNC_P (type))
{
if (raw_constructor)
{
@@ -816,10 +558,10 @@ digest_init (type, init, tail)
}
while (TREE_CODE (init) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (init))
{
- cp_pedwarn ("braces around scalar initializer for `%T'", type);
+ pedwarn ("braces around scalar initializer for `%T'", type);
init = CONSTRUCTOR_ELTS (init);
if (TREE_CHAIN (init))
- cp_pedwarn ("ignoring extra initializers for `%T'", type);
+ pedwarn ("ignoring extra initializers for `%T'", type);
init = TREE_VALUE (init);
}
@@ -829,18 +571,19 @@ digest_init (type, init, tail)
/* Come here only for records and arrays (and unions with constructors). */
- if (TYPE_SIZE (type) && ! TREE_CONSTANT (TYPE_SIZE (type)))
+ if (COMPLETE_TYPE_P (type) && ! TREE_CONSTANT (TYPE_SIZE (type)))
{
- cp_error ("variable-sized object of type `%T' may not be initialized",
+ error ("variable-sized object of type `%T' may not be initialized",
type);
return error_mark_node;
}
- if (code == ARRAY_TYPE || code == RECORD_TYPE || code == UNION_TYPE)
+ if (code == ARRAY_TYPE || IS_AGGR_TYPE_CODE (code))
{
- if (raw_constructor && TYPE_NON_AGGREGATE_CLASS (type))
+ if (raw_constructor && TYPE_NON_AGGREGATE_CLASS (type)
+ && TREE_HAS_CONSTRUCTOR (init))
{
- cp_error ("subobject of type `%T' must be initialized by constructor, not by `%E'",
+ error ("subobject of type `%T' must be initialized by constructor, not by `%E'",
type, init);
return error_mark_node;
}
@@ -935,7 +678,7 @@ process_init_constructor (type, init, elts)
{
if (TREE_PURPOSE (tail)
&& (TREE_CODE (TREE_PURPOSE (tail)) != INTEGER_CST
- || TREE_INT_CST_LOW (TREE_PURPOSE (tail)) != i))
+ || compare_tree_int (TREE_PURPOSE (tail), i) != 0))
sorry ("non-trivial labeled initializers");
if (TREE_VALUE (tail) != 0)
@@ -946,8 +689,8 @@ process_init_constructor (type, init, elts)
if (next1 == error_mark_node)
return next1;
my_friendly_assert
- (same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (type)),
- TYPE_MAIN_VARIANT (TREE_TYPE (next1))),
+ (same_type_ignoring_top_level_qualifiers_p
+ (TREE_TYPE (type), TREE_TYPE (next1)),
981123);
my_friendly_assert (tail1 == 0
|| TREE_CODE (tail1) == TREE_LIST, 319);
@@ -992,7 +735,7 @@ process_init_constructor (type, init, elts)
allconstant = 0;
else if (! initializer_constant_valid_p (next1, TREE_TYPE (next1)))
allsimple = 0;
- members = expr_tree_cons (NULL_TREE, next1, members);
+ members = tree_cons (size_int (i), next1, members);
}
}
else if (TREE_CODE (type) == RECORD_TYPE)
@@ -1003,17 +746,17 @@ process_init_constructor (type, init, elts)
{
if (TYPE_USES_VIRTUAL_BASECLASSES (type))
{
- sorry ("initializer list for object of class with virtual baseclasses");
+ sorry ("initializer list for object of class with virtual base classes");
return error_mark_node;
}
if (TYPE_BINFO_BASETYPES (type))
{
- sorry ("initializer list for object of class with baseclasses");
+ sorry ("initializer list for object of class with base classes");
return error_mark_node;
}
- if (TYPE_VIRTUAL_P (type))
+ if (TYPE_POLYMORPHIC_P (type))
{
sorry ("initializer list for object using virtual functions");
return error_mark_node;
@@ -1025,7 +768,7 @@ process_init_constructor (type, init, elts)
{
if (! DECL_NAME (field) && DECL_C_BIT_FIELD (field))
{
- members = expr_tree_cons (field, integer_zero_node, members);
+ members = tree_cons (field, integer_zero_node, members);
continue;
}
@@ -1066,29 +809,36 @@ process_init_constructor (type, init, elts)
next1 = build_functional_cast (TREE_TYPE (field),
NULL_TREE);
else
- next1 = build (CONSTRUCTOR, NULL_TREE, NULL_TREE,
- NULL_TREE);
+ {
+ next1 = build (CONSTRUCTOR, NULL_TREE, NULL_TREE,
+ NULL_TREE);
+ if (init)
+ TREE_HAS_CONSTRUCTOR (next1)
+ = TREE_HAS_CONSTRUCTOR (init);
+ }
next1 = digest_init (TREE_TYPE (field), next1, 0);
/* Warn when some struct elements are implicitly initialized. */
- if (extra_warnings)
- cp_warning ("missing initializer for member `%D'", field);
+ if (extra_warnings
+ && (!init || TREE_HAS_CONSTRUCTOR (init)))
+ warning ("missing initializer for member `%D'", field);
}
else
{
if (TREE_READONLY (field))
- cp_error ("uninitialized const member `%D'", field);
+ error ("uninitialized const member `%D'", field);
else if (TYPE_LANG_SPECIFIC (TREE_TYPE (field))
&& CLASSTYPE_READONLY_FIELDS_NEED_INIT (TREE_TYPE (field)))
- cp_error ("member `%D' with uninitialized const fields",
+ error ("member `%D' with uninitialized const fields",
field);
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
- cp_error ("member `%D' is uninitialized reference", field);
+ error ("member `%D' is uninitialized reference", field);
/* Warn when some struct elements are implicitly initialized
to zero. */
- if (extra_warnings)
- cp_warning ("missing initializer for member `%D'", field);
+ if (extra_warnings
+ && (!init || TREE_HAS_CONSTRUCTOR (init)))
+ warning ("missing initializer for member `%D'", field);
/* The default zero-initialization is fine for us; don't
add anything to the CONSTRUCTOR. */
@@ -1101,10 +851,12 @@ process_init_constructor (type, init, elts)
allconstant = 0;
else if (! initializer_constant_valid_p (next1, TREE_TYPE (next1)))
allsimple = 0;
- members = expr_tree_cons (field, next1, members);
+ members = tree_cons (field, next1, members);
}
}
- else if (TREE_CODE (type) == UNION_TYPE)
+ else if (TREE_CODE (type) == UNION_TYPE
+ /* If the initializer was empty, use default zero initialization. */
+ && tail)
{
register tree field = TYPE_FIELDS (type);
@@ -1135,7 +887,7 @@ process_init_constructor (type, init, elts)
if (temp)
field = temp, win = 1;
else
- cp_error ("no field `%D' in union being initialized",
+ error ("no field `%D' in union being initialized",
TREE_PURPOSE (tail));
}
if (!win)
@@ -1143,7 +895,7 @@ process_init_constructor (type, init, elts)
}
else if (field == 0)
{
- cp_error ("union `%T' with no named members cannot be initialized",
+ error ("union `%T' with no named members cannot be initialized",
type);
TREE_VALUE (tail) = error_mark_node;
}
@@ -1155,7 +907,7 @@ process_init_constructor (type, init, elts)
next1 = digest_init (TREE_TYPE (field),
TREE_VALUE (tail), &tail1);
if (tail1 != 0 && TREE_CODE (tail1) != TREE_LIST)
- my_friendly_abort (357);
+ abort ();
tail = tail1;
}
else
@@ -1170,7 +922,7 @@ process_init_constructor (type, init, elts)
allconstant = 0;
else if (initializer_constant_valid_p (next1, TREE_TYPE (next1)) == 0)
allsimple = 0;
- members = expr_tree_cons (field, next1, members);
+ members = tree_cons (field, next1, members);
}
/* If arguments were specified as a list, just remove the ones we used. */
@@ -1210,7 +962,12 @@ process_init_constructor (type, init, elts)
x.A::ii refers to the ii member of the L part of
the A part of the C object named by X. In this case,
- DATUM would be x, and BASETYPE would be A. */
+ DATUM would be x, and BASETYPE would be A.
+
+ I used to think that this was nonconformant, that the standard specified
+ that first we look up ii in A, then convert x to an L& and pull out the
+ ii part. But in fact, it does say that we convert x to an A&; A here
+ is known as the "naming class". (jason 2000-12-19) */
tree
build_scoped_ref (datum, basetype)
@@ -1218,48 +975,21 @@ build_scoped_ref (datum, basetype)
tree basetype;
{
tree ref;
- tree type = TREE_TYPE (datum);
+ tree binfo;
if (datum == error_mark_node)
return error_mark_node;
+ binfo = lookup_base (TREE_TYPE (datum), basetype, ba_check, NULL);
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- type = TYPE_MAIN_VARIANT (type);
-
- /* This is an easy conversion. */
- if (is_aggr_type (basetype, 1))
- {
- tree binfo = TYPE_BINFO (basetype);
- if (binfo != TYPE_BINFO (type))
- {
- binfo = get_binfo (binfo, type, 1);
- if (binfo == error_mark_node)
- return error_mark_node;
- if (binfo == 0)
- return error_not_base_type (basetype, type);
- }
+ if (binfo == error_mark_node)
+ return error_mark_node;
+ if (!binfo)
+ return error_not_base_type (TREE_TYPE (datum), basetype);
+
+ ref = build_unary_op (ADDR_EXPR, datum, 0);
+ ref = build_base_path (PLUS_EXPR, ref, binfo, 1);
- switch (TREE_CODE (datum))
- {
- case NOP_EXPR:
- case CONVERT_EXPR:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_ROUND_EXPR:
- case FIX_CEIL_EXPR:
- ref = convert_pointer_to (binfo,
- build_unary_op (ADDR_EXPR, TREE_OPERAND (datum, 0), 0));
- break;
- default:
- ref = convert_pointer_to (binfo,
- build_unary_op (ADDR_EXPR, datum, 0));
- }
- return build_indirect_ref (ref, "(compiler error in build_scoped_ref)");
- }
- return error_mark_node;
+ return build_indirect_ref (ref, "(compiler error in build_scoped_ref)");
}
/* Build a reference to an object specified by the C++ `->' operator.
@@ -1319,7 +1049,7 @@ build_x_arrow (datum)
if (last_rval == NULL_TREE)
{
- cp_error ("base operand of `->' has non-pointer type `%T'", type);
+ error ("base operand of `->' has non-pointer type `%T'", type);
return error_mark_node;
}
@@ -1329,13 +1059,8 @@ build_x_arrow (datum)
else
last_rval = default_conversion (rval);
- /* Signature pointers are not dereferenced. */
- if (TYPE_LANG_SPECIFIC (TREE_TYPE (last_rval))
- && IS_SIGNATURE_POINTER (TREE_TYPE (last_rval)))
- return last_rval;
-
if (TREE_CODE (TREE_TYPE (last_rval)) == POINTER_TYPE)
- return build_indirect_ref (last_rval, NULL_PTR);
+ return build_indirect_ref (last_rval, NULL);
if (types_memoized)
error ("result of `operator->()' yields non-pointer result");
@@ -1361,55 +1086,75 @@ build_m_component_ref (datum, component)
tree datum, component;
{
tree type;
- tree objtype = TREE_TYPE (datum);
- tree rettype;
+ tree objtype;
+ tree field_type;
+ int type_quals;
tree binfo;
if (processing_template_decl)
return build_min_nt (DOTSTAR_EXPR, datum, component);
+ datum = decay_conversion (datum);
+
+ if (datum == error_mark_node || component == error_mark_node)
+ return error_mark_node;
+
+ objtype = TYPE_MAIN_VARIANT (TREE_TYPE (datum));
+
if (TYPE_PTRMEMFUNC_P (TREE_TYPE (component)))
{
type = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (component)));
- rettype = type;
+ field_type = type;
}
- else
+ else if (TYPE_PTRMEM_P (TREE_TYPE (component)))
{
type = TREE_TYPE (TREE_TYPE (component));
- rettype = TREE_TYPE (type);
- }
-
- if (datum == error_mark_node || component == error_mark_node)
- return error_mark_node;
+ field_type = TREE_TYPE (type);
+
+ /* Compute the type of the field, as described in [expr.ref]. */
+ type_quals = TYPE_UNQUALIFIED;
+ if (TREE_CODE (field_type) == REFERENCE_TYPE)
+ /* The standard says that the type of the result should be the
+ type referred to by the reference. But for now, at least,
+ we do the conversion from reference type later. */
+ ;
+ else
+ {
+ type_quals = (cp_type_quals (field_type)
+ | cp_type_quals (TREE_TYPE (datum)));
- if (TREE_CODE (type) != OFFSET_TYPE && TREE_CODE (type) != METHOD_TYPE)
+ /* There's no such thing as a mutable pointer-to-member, so
+ we don't need to deal with that here like we do in
+ build_component_ref. */
+ field_type = cp_build_qualified_type (field_type, type_quals);
+ }
+ }
+ else
{
- cp_error ("`%E' cannot be used as a member pointer, since it is of type `%T'", component, type);
+ error ("`%E' cannot be used as a member pointer, since it is of type `%T'",
+ component, TREE_TYPE (component));
return error_mark_node;
}
- if (TREE_CODE (objtype) == REFERENCE_TYPE)
- objtype = TREE_TYPE (objtype);
- objtype = TYPE_MAIN_VARIANT (objtype);
-
if (! IS_AGGR_TYPE (objtype))
{
- cp_error ("cannot apply member pointer `%E' to `%E'", component, datum);
- cp_error ("which is of non-aggregate type `%T'", objtype);
+ error ("cannot apply member pointer `%E' to `%E', which is of non-aggregate type `%T'",
+ component, datum, objtype);
return error_mark_node;
}
- binfo = get_binfo (TYPE_METHOD_BASETYPE (type), objtype, 1);
- if (binfo == NULL_TREE)
+ binfo = lookup_base (objtype, TYPE_METHOD_BASETYPE (type),
+ ba_check, NULL);
+ if (!binfo)
{
- cp_error ("member type `%T::' incompatible with object type `%T'",
+ error ("member type `%T::' incompatible with object type `%T'",
TYPE_METHOD_BASETYPE (type), objtype);
return error_mark_node;
}
else if (binfo == error_mark_node)
return error_mark_node;
- component = build (OFFSET_REF, rettype, datum, component);
+ component = build (OFFSET_REF, field_type, datum, component);
if (TREE_CODE (type) == OFFSET_TYPE)
component = resolve_offset_ref (component);
return component;
@@ -1439,7 +1184,7 @@ build_functional_cast (exp, parms)
type = lookup_name (exp, 1);
if (!type || TREE_CODE (type) != TYPE_DECL)
{
- cp_error ("`%T' fails to be a typedef or built-in type", exp);
+ error ("`%T' fails to be a typedef or built-in type", exp);
return error_mark_node;
}
type = TREE_TYPE (type);
@@ -1453,12 +1198,6 @@ build_functional_cast (exp, parms)
if (processing_template_decl)
return build_min (CAST_EXPR, type, parms);
- if (IS_SIGNATURE (type))
- {
- error ("signature type not allowed in cast or constructor expression");
- return error_mark_node;
- }
-
if (! IS_AGGR_TYPE (type))
{
/* this must build a C cast */
@@ -1481,16 +1220,10 @@ build_functional_cast (exp, parms)
then the slot being initialized will be filled in. */
- if (TYPE_SIZE (complete_type (type)) == NULL_TREE)
- {
- cp_error ("type `%T' is not yet defined", type);
- return error_mark_node;
- }
- if (IS_AGGR_TYPE (type) && CLASSTYPE_ABSTRACT_VIRTUALS (type))
- {
- abstract_virtuals_error (NULL_TREE, type);
- return error_mark_node;
- }
+ if (!complete_type_or_else (type, NULL_TREE))
+ return error_mark_node;
+ if (abstract_virtuals_error (NULL_TREE, type))
+ return error_mark_node;
if (parms && TREE_CHAIN (parms) == NULL_TREE)
return build_c_cast (type, TREE_VALUE (parms));
@@ -1504,7 +1237,7 @@ build_functional_cast (exp, parms)
return get_target_expr (exp);
}
- exp = build_method_call (NULL_TREE, ctor_identifier, parms,
+ exp = build_method_call (NULL_TREE, complete_ctor_identifier, parms,
TYPE_BINFO (type), LOOKUP_NORMAL);
if (exp == error_mark_node)
@@ -1513,148 +1246,107 @@ build_functional_cast (exp, parms)
return build_cplus_new (type, exp);
}
-/* Return the character string for the name that encodes the
- enumeral value VALUE in the domain TYPE. */
-char *
-enum_name_string (value, type)
- tree value;
- tree type;
-{
- register tree values = TYPE_VALUES (type);
- register HOST_WIDE_INT intval = TREE_INT_CST_LOW (value);
-
- my_friendly_assert (TREE_CODE (type) == ENUMERAL_TYPE, 324);
- while (values
- && TREE_INT_CST_LOW (TREE_VALUE (values)) != intval)
- values = TREE_CHAIN (values);
- if (values == NULL_TREE)
- {
- char *buf = (char *)oballoc (16 + TYPE_NAME_LENGTH (type));
+/* Complain about defining new types in inappropriate places. We give an
+ exception for C-style casts, to accommodate GNU C stylings. */
- /* Value must have been cast. */
- sprintf (buf, "(enum %s)%ld",
- TYPE_NAME_STRING (type), (long) intval);
- return buf;
- }
- return IDENTIFIER_POINTER (TREE_PURPOSE (values));
+void
+check_for_new_type (string, inptree)
+ const char *string;
+ flagged_type_tree inptree;
+{
+ if (inptree.new_type_flag
+ && (pedantic || strcmp (string, "cast") != 0))
+ pedwarn ("ISO C++ forbids defining types within %s", string);
}
-#if 0
-/* Print out a language-specific error message for
- (Pascal) case or (C) switch statements.
- CODE tells what sort of message to print.
- TYPE is the type of the switch index expression.
- NEW is the new value that we were trying to add.
- OLD is the old value that stopped us from adding it. */
+/* Add new exception specifier SPEC, to the LIST we currently have.
+ If it's already in LIST then do nothing.
+ Moan if it's bad and we're allowed to. COMPLAIN < 0 means we
+ know what we're doing. */
-void
-report_case_error (code, type, new_value, old_value)
- int code;
- tree type;
- tree new_value, old_value;
+tree
+add_exception_specifier (list, spec, complain)
+ tree list, spec;
+ int complain;
{
- if (code == 1)
- {
- if (new_value)
- error ("case label not within a switch statement");
- else
- error ("default label not within a switch statement");
- }
- else if (code == 2)
- {
- if (new_value == 0)
- {
- error ("multiple default labels in one switch");
- return;
- }
- if (TREE_CODE (new_value) == RANGE_EXPR)
- if (TREE_CODE (old_value) == RANGE_EXPR)
- {
- char *buf = (char *)alloca (4 * (8 + TYPE_NAME_LENGTH (type)));
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- sprintf (buf, "overlapping ranges [%s..%s], [%s..%s] in case expression",
- enum_name_string (TREE_OPERAND (new_value, 0), type),
- enum_name_string (TREE_OPERAND (new_value, 1), type),
- enum_name_string (TREE_OPERAND (old_value, 0), type),
- enum_name_string (TREE_OPERAND (old_value, 1), type));
- else
- sprintf (buf, "overlapping ranges [%d..%d], [%d..%d] in case expression",
- TREE_INT_CST_LOW (TREE_OPERAND (new_value, 0)),
- TREE_INT_CST_LOW (TREE_OPERAND (new_value, 1)),
- TREE_INT_CST_LOW (TREE_OPERAND (old_value, 0)),
- TREE_INT_CST_LOW (TREE_OPERAND (old_value, 1)));
- error (buf);
- }
- else
- {
- char *buf = (char *)alloca (4 * (8 + TYPE_NAME_LENGTH (type)));
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- sprintf (buf, "range [%s..%s] includes element `%s' in case expression",
- enum_name_string (TREE_OPERAND (new_value, 0), type),
- enum_name_string (TREE_OPERAND (new_value, 1), type),
- enum_name_string (old_value, type));
- else
- sprintf (buf, "range [%d..%d] includes (%d) in case expression",
- TREE_INT_CST_LOW (TREE_OPERAND (new_value, 0)),
- TREE_INT_CST_LOW (TREE_OPERAND (new_value, 1)),
- TREE_INT_CST_LOW (old_value));
- error (buf);
- }
- else if (TREE_CODE (old_value) == RANGE_EXPR)
- {
- char *buf = (char *)alloca (4 * (8 + TYPE_NAME_LENGTH (type)));
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- sprintf (buf, "range [%s..%s] includes element `%s' in case expression",
- enum_name_string (TREE_OPERAND (old_value, 0), type),
- enum_name_string (TREE_OPERAND (old_value, 1), type),
- enum_name_string (new_value, type));
- else
- sprintf (buf, "range [%d..%d] includes (%d) in case expression",
- TREE_INT_CST_LOW (TREE_OPERAND (old_value, 0)),
- TREE_INT_CST_LOW (TREE_OPERAND (old_value, 1)),
- TREE_INT_CST_LOW (new_value));
- error (buf);
- }
- else
- {
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- error ("duplicate label `%s' in switch statement",
- enum_name_string (new_value, type));
- else
- error ("duplicate label (%d) in switch statement",
- TREE_INT_CST_LOW (new_value));
- }
- }
- else if (code == 3)
- {
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- warning ("case value out of range for enum %s",
- TYPE_NAME_STRING (type));
- else
- warning ("case value out of range");
- }
- else if (code == 4)
+ int ok;
+ tree core = spec;
+ int is_ptr;
+
+ if (spec == error_mark_node)
+ return list;
+
+ my_friendly_assert (spec && (!list || TREE_VALUE (list)), 19990317);
+
+ /* [except.spec] 1, type in an exception specifier shall not be
+ incomplete, or pointer or ref to incomplete other than pointer
+ to cv void. */
+ is_ptr = TREE_CODE (core) == POINTER_TYPE;
+ if (is_ptr || TREE_CODE (core) == REFERENCE_TYPE)
+ core = TREE_TYPE (core);
+ if (complain < 0)
+ ok = 1;
+ else if (VOID_TYPE_P (core))
+ ok = is_ptr;
+ else if (TREE_CODE (core) == TEMPLATE_TYPE_PARM)
+ ok = 1;
+ else if (processing_template_decl)
+ ok = 1;
+ else
+ ok = COMPLETE_TYPE_P (complete_type (core));
+
+ if (ok)
{
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- error ("range values `%s' and `%s' reversed",
- enum_name_string (new_value, type),
- enum_name_string (old_value, type));
- else
- error ("range values reversed");
+ tree probe;
+
+ for (probe = list; probe; probe = TREE_CHAIN (probe))
+ if (same_type_p (TREE_VALUE (probe), spec))
+ break;
+ if (!probe)
+ {
+ spec = build_tree_list (NULL_TREE, spec);
+ TREE_CHAIN (spec) = list;
+ list = spec;
+ }
}
+ else if (complain)
+ incomplete_type_error (NULL_TREE, core);
+ return list;
}
-#endif
-/* Complain about defining new types in inappropriate places. We give an
- exception for C-style casts, to accommodate GNU C stylings. */
+/* Combine the two exceptions specifier lists LIST and ADD, and return
+ their union. */
-void
-check_for_new_type (string, inptree)
- const char *string;
- flagged_type_tree inptree;
+tree
+merge_exception_specifiers (list, add)
+ tree list, add;
{
- if (inptree.new_type_flag
- && (pedantic || strcmp (string, "cast") != 0))
- pedwarn ("ANSI C++ forbids defining types within %s",string);
+ if (!list || !add)
+ return NULL_TREE;
+ else if (!TREE_VALUE (list))
+ return add;
+ else if (!TREE_VALUE (add))
+ return list;
+ else
+ {
+ tree orig_list = list;
+
+ for (; add; add = TREE_CHAIN (add))
+ {
+ tree spec = TREE_VALUE (add);
+ tree probe;
+
+ for (probe = orig_list; probe; probe = TREE_CHAIN (probe))
+ if (same_type_p (TREE_VALUE (probe), spec))
+ break;
+ if (!probe)
+ {
+ spec = build_tree_list (NULL_TREE, spec);
+ TREE_CHAIN (spec) = list;
+ list = spec;
+ }
+ }
+ }
+ return list;
}
diff --git a/contrib/gcc/cp/xref.c b/contrib/gcc/cp/xref.c
index 6e06eda..4560c4a 100644
--- a/contrib/gcc/cp/xref.c
+++ b/contrib/gcc/cp/xref.c
@@ -1,5 +1,6 @@
/* Code for handling XREF output from GNU C++.
- Copyright (C) 1992, 93-97, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ 2000, 2002 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -27,8 +28,6 @@ Boston, MA 02111-1307, USA. */
#include "input.h"
#include "toplev.h"
-extern char *getpwd PROTO((void));
-
/* The character(s) used to join a directory specification (obtained with
getwd or equivalent) with a non-absolute file name. */
@@ -38,7 +37,7 @@ extern char *getpwd PROTO((void));
/* Nonzero if NAME as a file name is absolute. */
#ifndef FILE_NAME_ABSOLUTE_P
-#define FILE_NAME_ABSOLUTE_P(NAME) (NAME[0] == '/')
+#define FILE_NAME_ABSOLUTE_P(NAME) ((NAME)[0] == '/')
#endif
/* For cross referencing. */
@@ -58,21 +57,19 @@ int flag_gnu_xref;
#define FALSE 0
#endif
-#define PALLOC(typ) ((typ *) calloc(1,sizeof(typ)))
+#define PALLOC(TYP) ((TYP *) xcalloc (1, sizeof (TYP)))
/* Return a malloc'd copy of STR. */
-#define SALLOC(str) \
- ((char *) ((str) == NULL ? NULL \
- : (char *) strcpy ((char *) malloc (strlen ((str)) + 1), (str))))
-#define SFREE(str) (str != NULL && (free(str),0))
-
-#define STREQL(s1,s2) (strcmp((s1),(s2)) == 0)
-#define STRNEQ(s1,s2) (strcmp((s1),(s2)) != 0)
-#define STRLSS(s1,s2) (strcmp((s1),(s2)) < 0)
-#define STRLEQ(s1,s2) (strcmp((s1),(s2)) <= 0)
-#define STRGTR(s1,s2) (strcmp((s1),(s2)) > 0)
-#define STRGEQ(s1,s2) (strcmp((s1),(s2)) >= 0)
+#define SALLOC(STR) ((char *) ((STR) == NULL ? NULL : xstrdup (STR)))
+#define SFREE(STR) ((STR) != NULL && (free (STR), 0))
+
+#define STREQL(S1,S2) (strcmp ((S1), (S2)) == 0)
+#define STRNEQ(S1,S2) (strcmp ((S1), (S2)) != 0)
+#define STRLSS(S1,S2) (strcmp ((S1), (S2)) < 0)
+#define STRLEQ(S1,S2) (strcmp ((S1), (S2)) <= 0)
+#define STRGTR(S1,S2) (strcmp ((S1), (S2)) > 0)
+#define STRGEQ(S1,S2) (strcmp ((S1), (S2)) >= 0)
/************************************************************************/
/* */
@@ -121,15 +118,15 @@ static tree last_fndecl = NULL;
/* Forward definitions */
/* */
/************************************************************************/
-static void gen_assign PROTO((XREF_FILE, tree));
-static XREF_FILE find_file PROTO((const char *));
-static const char * filename PROTO((XREF_FILE));
-static const char * fctname PROTO((tree));
-static const char * declname PROTO((tree));
-static void simplify_type PROTO((char *));
-static const char * fixname PROTO((const char *, char *));
-static void open_xref_file PROTO((const char *));
-static const char * classname PROTO((tree));
+static void gen_assign PARAMS ((XREF_FILE, tree));
+static XREF_FILE find_file PARAMS ((const char *));
+static const char * filename PARAMS ((XREF_FILE));
+static const char * fctname PARAMS ((tree));
+static const char * declname PARAMS ((tree));
+static void simplify_type PARAMS ((char *));
+static const char * fixname PARAMS ((const char *, char *));
+static void open_xref_file PARAMS ((const char *));
+static const char * classname PARAMS ((tree));
/* Start cross referencing. FILE is the name of the file we xref. */
@@ -208,14 +205,7 @@ GNU_xref_file (name)
if (FILE_NAME_ABSOLUTE_P (name) || ! wd_name)
xf->outname = xf->name;
else
- {
- char *nmbuf
- = (char *) xmalloc (strlen (wd_name) + strlen (FILE_NAME_JOINER)
- + strlen (name) + 1);
- sprintf (nmbuf, "%s%s%s", wd_name, FILE_NAME_JOINER, name);
- name = nmbuf;
- xf->outname = nmbuf;
- }
+ xf->outname = name = concat (wd_name, FILE_NAME_JOINER, name, NULL);
fprintf (xref_file, "FIL %s %s 0\n", name, wd_name);
@@ -367,7 +357,6 @@ GNU_xref_decl (fndecl,decl)
else if (TREE_CODE (decl) == RECORD_TYPE)
{
if (CLASSTYPE_DECLARED_CLASS (decl)) cls = "CLASSID";
- else if (IS_SIGNATURE (decl)) cls = "SIGNATUREID";
else cls = "STRUCTID";
decl = TYPE_NAME (decl);
uselin = TRUE;
@@ -387,7 +376,7 @@ GNU_xref_decl (fndecl,decl)
else if (TREE_CODE (DECL_RESULT (decl)) == VAR_DECL)
cls = "VARTEMP";
else
- my_friendly_abort (358);
+ abort ();
uselin = TRUE;
}
else cls = "UNKNOWN";
@@ -417,8 +406,7 @@ GNU_xref_decl (fndecl,decl)
(cur_scope != NULL ? cur_scope->lid : 0),
cls, fctname(fndecl), buf);
- if (STREQL (cls, "STRUCTID") || STREQL (cls, "UNIONID")
- || STREQL (cls, "SIGNATUREID"))
+ if (STREQL (cls, "STRUCTID") || STREQL (cls, "UNIONID"))
{
cls = "CLASSID";
fprintf (xref_file, "DCL %s %d %s %d %s %s %s\n",
@@ -546,9 +534,9 @@ static const char *
classname (cls)
tree cls;
{
- if (cls && TREE_CODE_CLASS (TREE_CODE (cls)) == 't')
+ if (cls && TYPE_P (cls))
cls = TYPE_NAME (cls);
- if (cls && TREE_CODE_CLASS (TREE_CODE (cls)) == 'd')
+ if (cls && DECL_P (cls))
cls = DECL_NAME (cls);
if (cls && TREE_CODE (cls) == IDENTIFIER_NODE)
return IDENTIFIER_POINTER (cls);
@@ -614,7 +602,7 @@ GNU_xref_member(cls, fld)
confg = 1;
pure = 0;
- if (TREE_CODE (fld) == FUNCTION_DECL && DECL_ABSTRACT_VIRTUAL_P(fld))
+ if (TREE_CODE (fld) == FUNCTION_DECL && DECL_PURE_VIRTUAL_P(fld))
pure = 1;
d = IDENTIFIER_POINTER(cls);
@@ -627,11 +615,11 @@ GNU_xref_member(cls, fld)
#ifdef XREF_SHORT_MEMBER_NAMES
for (p = &bufa[1]; *p != 0; ++p)
{
- if (p[0] == '_' && p[1] == '_' && p[2] >= '0' && p[2] <= '9') {
+ if (p[0] == '_' && p[1] == '_' && ISDIGIT (p[2])) {
if (strncmp(&p[2], buf, i) == 0) *p = 0;
break;
}
- else if (p[0] == '_' && p[1] == '_' && p[2] == 'C' && p[3] >= '0' && p[3] <= '9') {
+ else if (p[0] == '_' && p[1] == '_' && p[2] == 'C' && ISDIGIT (p[3])) {
if (strncmp(&p[3], buf, i) == 0) *p = 0;
break;
}
@@ -816,14 +804,14 @@ open_xref_file(file)
#ifdef XREF_FILE_NAME
XREF_FILE_NAME (xref_name, file);
#else
- s = rindex (file, '/');
+ s = strrchr (file, '/');
if (s == NULL)
sprintf (xref_name, ".%s.gxref", file);
else
{
++s;
strcpy (xref_name, file);
- t = rindex (xref_name, '/');
+ t = strrchr (xref_name, '/');
++t;
*t++ = '.';
strcpy (t, s);
@@ -835,7 +823,7 @@ open_xref_file(file)
if (xref_file == NULL)
{
- error("Can't create cross-reference file `%s'", xref_name);
+ error("can't create cross-reference file `%s'", xref_name);
doing_xref = 0;
}
}
OpenPOWER on IntegriCloud